2025008071805
This commit is contained in:
parent
3331ea2609
commit
04bf2bae48
|
|
@ -311,10 +311,10 @@ public class AppleOrderController extends BaseController {
|
||||||
ordertype=2;
|
ordertype=2;
|
||||||
UserUseSecondaryCard userUseSecondaryCard = userUseSecondaryCardService.selectUserUseSecondaryCardByorderId(cikaid);
|
UserUseSecondaryCard userUseSecondaryCard = userUseSecondaryCardService.selectUserUseSecondaryCardByorderId(cikaid);
|
||||||
if (userUseSecondaryCard == null){
|
if (userUseSecondaryCard == null){
|
||||||
return AjaxResult.error("此卡不存在");
|
return AppletControllerUtil.appletWarning("此卡不存在");
|
||||||
}
|
}
|
||||||
if (userUseSecondaryCard.getStatus() != 1){
|
if (userUseSecondaryCard.getStatus() != 1){
|
||||||
return AjaxResult.error("此卡不是使用状态");
|
return AppletControllerUtil.appletWarning("此卡不是使用状态");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String ptcode=GenerateCustomCode.generCreateOrder("PT");
|
String ptcode=GenerateCustomCode.generCreateOrder("PT");
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,19 @@ public class DiyCityController extends BaseController
|
||||||
List<DiyCity> list = diyCityService.selectDiyCityList(diyCity);
|
List<DiyCity> list = diyCityService.selectDiyCityList(diyCity);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询自定义地区列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:DiyCity:list')")
|
||||||
|
@GetMapping("/datalist")
|
||||||
|
public AjaxResult listdata(DiyCity diyCity)
|
||||||
|
{
|
||||||
|
List<DiyCity> list = diyCityService.selectDiyCityList(diyCity);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取自定义地区树形结构数据
|
* 获取自定义地区树形结构数据
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -71,13 +71,13 @@ public class SiteSkillController extends BaseController
|
||||||
SiteSkill siteSkill = new SiteSkill();
|
SiteSkill siteSkill = new SiteSkill();
|
||||||
siteSkill.setStatus(1L); // 只获取启用状态的技能
|
siteSkill.setStatus(1L); // 只获取启用状态的技能
|
||||||
List<SiteSkill> list = siteSkillService.selectSiteSkillList(siteSkill);
|
List<SiteSkill> list = siteSkillService.selectSiteSkillList(siteSkill);
|
||||||
// 按照排序字段升序排列
|
// // 按照排序字段升序排列
|
||||||
list.sort((a, b) -> {
|
// list.sort((a, b) -> {
|
||||||
if (a.getSort() == null && b.getSort() == null) return 0;
|
// if (a.getSort() == null && b.getSort() == null) return 0;
|
||||||
if (a.getSort() == null) return 1;
|
// if (a.getSort() == null) return 1;
|
||||||
if (b.getSort() == null) return -1;
|
// if (b.getSort() == null) return -1;
|
||||||
return a.getSort().compareTo(b.getSort());
|
// return a.getSort().compareTo(b.getSort());
|
||||||
});
|
// });
|
||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,17 @@ export function listDiyCity(query) {
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 查询自定义地区列表
|
||||||
|
export function datalist(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/DiyCity/datalist',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 查询自定义地区详细
|
// 查询自定义地区详细
|
||||||
export function getDiyCity(id) {
|
export function getDiyCity(id) {
|
||||||
|
|
|
||||||
|
|
@ -43,20 +43,31 @@
|
||||||
|
|
||||||
<el-form-item label="服务城市" prop="serviceCityPid">
|
<el-form-item label="服务城市" prop="serviceCityPid">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.serviceCityPid"
|
v-model="selectedCities"
|
||||||
placeholder="请选择服务城市"
|
placeholder="请选择服务城市"
|
||||||
filterable
|
filterable
|
||||||
@change="handleProvinceChange"
|
|
||||||
multiple
|
multiple
|
||||||
collapse-tags
|
collapse-tags
|
||||||
style="width: 100%">
|
style="width: 100%"
|
||||||
|
@change="handleCityChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in selectAreaShenDataList"
|
v-for="item in cityList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.title"
|
:label="item.title"
|
||||||
:value="item.id">
|
:value="item.id">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<!-- 显示已选择的城市标签 -->
|
||||||
|
<div class="selected-tags" v-if="selectedCities.length > 0">
|
||||||
|
<el-tag
|
||||||
|
v-for="cityId in selectedCities"
|
||||||
|
:key="cityId"
|
||||||
|
closable
|
||||||
|
@close="removeCity(cityId)"
|
||||||
|
style="margin: 2px;">
|
||||||
|
{{ getCityName(cityId) }}
|
||||||
|
</el-tag>
|
||||||
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="服务地区" prop="serviceCityIds">
|
<el-form-item label="服务地区" prop="serviceCityIds">
|
||||||
|
|
@ -66,9 +77,10 @@
|
||||||
filterable
|
filterable
|
||||||
multiple
|
multiple
|
||||||
collapse-tags
|
collapse-tags
|
||||||
style="width: 100%">
|
style="width: 100%"
|
||||||
|
@change="handleAreaChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in selectAreaShiDataList"
|
v-for="item in areaList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.title"
|
:label="item.title"
|
||||||
:value="item.id">
|
:value="item.id">
|
||||||
|
|
@ -104,6 +116,7 @@
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<!-- 显示已选择的技能标签 -->
|
||||||
<div class="selected-tags" v-if="selectedSkills.length > 0">
|
<div class="selected-tags" v-if="selectedSkills.length > 0">
|
||||||
<el-tag
|
<el-tag
|
||||||
v-for="skillId in selectedSkills"
|
v-for="skillId in selectedSkills"
|
||||||
|
|
@ -120,9 +133,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="当前佣金" prop="commission">
|
<el-form-item label="当前佣金" prop="commission">
|
||||||
<el-input v-model="form.commission" placeholder="0.00">
|
<el-input v-model="form.commission" disabled />
|
||||||
<template slot="prepend">¥</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
|
|
@ -131,12 +142,12 @@
|
||||||
:active-value="1"
|
:active-value="1"
|
||||||
:inactive-value="0"
|
:inactive-value="0"
|
||||||
active-text="启用"
|
active-text="启用"
|
||||||
inactive-text="禁用"
|
inactive-text="禁用">
|
||||||
/>
|
</el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="创建时间" v-if="form.createdAt">
|
<el-form-item label="创建时间" prop="createdAt">
|
||||||
<el-input v-model="createdAtDisplay" disabled />
|
<el-input v-model="form.createdAt" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
|
|
@ -147,21 +158,29 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { selectAreaList } from "@/api/system/WorkerApply"
|
import { datalist } from "@/api/system/DiyCity"
|
||||||
import { getSiteSkillList } from "@/api/system/SiteSkill"
|
import { getSiteSkillList } from "@/api/system/SiteSkill"
|
||||||
import { listDiyCity } from "@/api/system/DiyCity"
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "UserEditDialog",
|
name: "UserEditDialog",
|
||||||
props: {
|
props: {
|
||||||
visible: Boolean,
|
visible: {
|
||||||
user: Object,
|
type: Boolean,
|
||||||
mode: String // 'add' or 'edit'
|
default: false
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
mode: {
|
||||||
|
type: String,
|
||||||
|
default: 'add'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
id: undefined,
|
id: null,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
phone: undefined,
|
phone: undefined,
|
||||||
avatar: undefined,
|
avatar: undefined,
|
||||||
|
|
@ -172,7 +191,7 @@ export default {
|
||||||
skillIds: undefined,
|
skillIds: undefined,
|
||||||
commission: undefined,
|
commission: undefined,
|
||||||
status: 1,
|
status: 1,
|
||||||
createdAt: undefined
|
createdAt: null
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
|
|
@ -191,31 +210,29 @@ export default {
|
||||||
{ required: true, message: "技能不能为空", trigger: "change" }
|
{ required: true, message: "技能不能为空", trigger: "change" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
selectAreaShenDataList: [],
|
// 城市相关数据
|
||||||
selectAreaShiDataList: [],
|
cityList: [],
|
||||||
|
selectedCities: [],
|
||||||
|
cityNameCache: {},
|
||||||
|
|
||||||
|
// 地区相关数据
|
||||||
|
areaList: [],
|
||||||
selectedAreas: [],
|
selectedAreas: [],
|
||||||
selectedSkills: [],
|
|
||||||
skillList: [],
|
|
||||||
// 缓存地区名称
|
|
||||||
areaNameCache: {},
|
areaNameCache: {},
|
||||||
// 缓存技能名称
|
|
||||||
|
// 技能相关数据
|
||||||
|
skillList: [],
|
||||||
|
selectedSkills: [],
|
||||||
skillNameCache: {}
|
skillNameCache: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
createdAtDisplay() {
|
|
||||||
if (this.form.createdAt) {
|
|
||||||
return this.parseTime(this.form.createdAt, '{y}-{m}-{d} {h}:{i}:{s}')
|
|
||||||
}
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
watch: {
|
||||||
user: {
|
user: {
|
||||||
handler(val) {
|
handler(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
console.log('UserEditDialog - 接收到用户数据:', val);
|
console.log('UserEditDialog - 接收到用户数据:', val);
|
||||||
this.form = { ...val }
|
this.form = { ...val }
|
||||||
|
|
||||||
// 确保status是数字类型
|
// 确保status是数字类型
|
||||||
if (typeof this.form.status === 'string') {
|
if (typeof this.form.status === 'string') {
|
||||||
this.form.status = parseInt(this.form.status)
|
this.form.status = parseInt(this.form.status)
|
||||||
|
|
@ -226,32 +243,21 @@ export default {
|
||||||
this.form.prohibitTimeNum = parseInt(this.form.prohibitTimeNum) || 0
|
this.form.prohibitTimeNum = parseInt(this.form.prohibitTimeNum) || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理服务城市ID,如果是字符串则转换为数组
|
// 处理服务城市ID
|
||||||
if (this.form.serviceCityPid) {
|
this.processSelectedCities();
|
||||||
if (typeof this.form.serviceCityPid === 'string') {
|
|
||||||
this.form.serviceCityPid = this.form.serviceCityPid.split(',').map(Number).filter(n => !isNaN(n))
|
|
||||||
} else if (!Array.isArray(this.form.serviceCityPid)) {
|
|
||||||
this.form.serviceCityPid = [this.form.serviceCityPid]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.form.serviceCityPid = []
|
|
||||||
}
|
|
||||||
|
|
||||||
// 延迟处理已选择的项目,确保数据加载完成
|
// 处理服务地区ID
|
||||||
|
this.processSelectedAreas();
|
||||||
|
|
||||||
|
// 处理技能ID
|
||||||
|
this.processSelectedSkills();
|
||||||
|
|
||||||
|
// 清除验证错误
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.processSelectedAreas();
|
|
||||||
this.processSelectedSkills();
|
|
||||||
// 清除验证错误
|
|
||||||
if (this.$refs["form"]) {
|
if (this.$refs["form"]) {
|
||||||
this.$refs["form"].clearValidate();
|
this.$refs["form"].clearValidate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 如果有服务城市ID,加载对应的城市数据
|
|
||||||
if (this.form.serviceCityPid) {
|
|
||||||
console.log('UserEditDialog - 用户数据加载完成,加载城市数据,省份ID:', this.form.serviceCityPid);
|
|
||||||
this.handleProvinceChange(); // 调用handleProvinceChange来加载城市数据
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: true
|
||||||
|
|
@ -259,49 +265,187 @@ export default {
|
||||||
visible(val) {
|
visible(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
console.log('UserEditDialog - 弹窗打开,开始加载数据');
|
console.log('UserEditDialog - 弹窗打开,开始加载数据');
|
||||||
this.getShenDataList()
|
this.loadCityList();
|
||||||
this.getSkillList()
|
this.loadSkillList();
|
||||||
// 延迟加载城市数据,确保省份数据先加载完成
|
|
||||||
this.$nextTick(() => {
|
|
||||||
// 如果有服务城市ID,加载对应的城市数据
|
|
||||||
if (this.form.serviceCityPid && this.form.serviceCityPid.length > 0) {
|
|
||||||
console.log('UserEditDialog - 加载城市数据,省份ID:', this.form.serviceCityPid);
|
|
||||||
this.handleProvinceChange(); // 调用handleProvinceChange来加载城市数据
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
selectedCities(val) {
|
||||||
|
this.form.serviceCityPid = val.join(',');
|
||||||
|
this.updateCityNameCache();
|
||||||
|
this.loadAreaList();
|
||||||
|
},
|
||||||
selectedAreas(val) {
|
selectedAreas(val) {
|
||||||
this.form.serviceCityIds = val.join(',')
|
this.form.serviceCityIds = val.join(',');
|
||||||
// 更新地区名称缓存
|
|
||||||
this.updateAreaNameCache();
|
this.updateAreaNameCache();
|
||||||
},
|
},
|
||||||
selectedSkills(val) {
|
selectedSkills(val) {
|
||||||
this.form.skillIds = val.join(',')
|
this.form.skillIds = val.join(',');
|
||||||
// 更新技能名称缓存
|
|
||||||
this.updateSkillNameCache();
|
this.updateSkillNameCache();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 强制更新显示
|
// 加载城市列表
|
||||||
forceUpdateDisplay() {
|
loadCityList() {
|
||||||
// 强制更新地区显示
|
console.log('UserEditDialog - 开始加载城市列表');
|
||||||
if (this.selectedAreas.length > 0) {
|
const queryParams = {
|
||||||
this.updateAreaNameCache();
|
parentId: 0 // 查询一级城市
|
||||||
}
|
}
|
||||||
// 强制更新技能显示
|
datalist(queryParams).then(response => {
|
||||||
if (this.selectedSkills.length > 0) {
|
console.log('UserEditDialog - 获取城市列表成功:', response);
|
||||||
this.updateSkillNameCache();
|
if (response.code === 200) {
|
||||||
|
this.cityList = response.rows || [];
|
||||||
|
console.log('UserEditDialog - 城市列表:', this.cityList);
|
||||||
|
this.updateCityNameCache();
|
||||||
|
} else {
|
||||||
|
console.warn('UserEditDialog - 获取城市列表失败,使用默认数据');
|
||||||
|
this.cityList = [
|
||||||
|
{ id: 1, title: '陕西省' },
|
||||||
|
{ id: 27, title: '上海市' },
|
||||||
|
{ id: 44, title: '湖南省' },
|
||||||
|
{ id: 52, title: '安徽省' }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('UserEditDialog - 获取城市列表异常:', error);
|
||||||
|
this.cityList = [
|
||||||
|
{ id: 1, title: '陕西省' },
|
||||||
|
{ id: 27, title: '上海市' },
|
||||||
|
{ id: 44, title: '湖南省' },
|
||||||
|
{ id: 52, title: '安徽省' }
|
||||||
|
];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 加载地区列表
|
||||||
|
loadAreaList() {
|
||||||
|
console.log('UserEditDialog - 开始加载地区列表,选中的城市:', this.selectedCities);
|
||||||
|
this.areaList = [];
|
||||||
|
this.areaNameCache = {};
|
||||||
|
|
||||||
|
if (this.selectedCities.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 为每个选中的城市加载地区数据
|
||||||
|
this.selectedCities.forEach(cityId => {
|
||||||
|
const queryParams = {
|
||||||
|
parentId: cityId
|
||||||
|
}
|
||||||
|
datalist(queryParams).then(response => {
|
||||||
|
console.log(`UserEditDialog - 获取城市${cityId}的地区数据成功:`, response);
|
||||||
|
if (response.code === 200) {
|
||||||
|
const newAreas = response.rows || [];
|
||||||
|
// 合并到现有列表中,避免重复
|
||||||
|
newAreas.forEach(area => {
|
||||||
|
const exists = this.areaList.find(item => item.id === area.id);
|
||||||
|
if (!exists) {
|
||||||
|
this.areaList.push(area);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log('UserEditDialog - 合并后的地区列表:', this.areaList);
|
||||||
|
this.updateAreaNameCache();
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error(`UserEditDialog - 获取城市${cityId}的地区数据失败:`, error);
|
||||||
|
// 使用默认数据
|
||||||
|
let defaultAreas = [];
|
||||||
|
if (cityId === 1) {
|
||||||
|
defaultAreas = [
|
||||||
|
{ id: 2, title: '新城区' },
|
||||||
|
{ id: 5, title: '碑林区' },
|
||||||
|
{ id: 7, title: '莲湖区' },
|
||||||
|
{ id: 10, title: '灞桥区' },
|
||||||
|
{ id: 11, title: '未央区' },
|
||||||
|
{ id: 12, title: '雁塔区' },
|
||||||
|
{ id: 13, title: '阎良区' },
|
||||||
|
{ id: 14, title: '临潼区' },
|
||||||
|
{ id: 15, title: '长安区' },
|
||||||
|
{ id: 16, title: '高陵区' },
|
||||||
|
{ id: 17, title: '鄠邑区' }
|
||||||
|
];
|
||||||
|
} else if (cityId === 52) {
|
||||||
|
defaultAreas = [
|
||||||
|
{ id: 53, title: '瑶海区' },
|
||||||
|
{ id: 54, title: '庐阳区' },
|
||||||
|
{ id: 55, title: '蜀山区' },
|
||||||
|
{ id: 56, title: '包河区' },
|
||||||
|
{ id: 57, title: '经开区' },
|
||||||
|
{ id: 58, title: '高新区' }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultAreas.forEach(area => {
|
||||||
|
const exists = this.areaList.find(item => item.id === area.id);
|
||||||
|
if (!exists) {
|
||||||
|
this.areaList.push(area);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.updateAreaNameCache();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 加载技能列表
|
||||||
|
loadSkillList() {
|
||||||
|
console.log('UserEditDialog - 开始加载技能列表');
|
||||||
|
getSiteSkillList().then(response => {
|
||||||
|
console.log('UserEditDialog - 获取技能列表成功:', response);
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.skillList = response.data || [];
|
||||||
|
console.log('UserEditDialog - 技能列表:', this.skillList);
|
||||||
|
this.updateSkillNameCache();
|
||||||
|
} else {
|
||||||
|
console.warn('UserEditDialog - 获取技能列表失败,使用默认数据');
|
||||||
|
this.skillList = [
|
||||||
|
{ id: 1, title: '水电工' },
|
||||||
|
{ id: 2, title: '油工师傅' },
|
||||||
|
{ id: 3, title: '改造维修' },
|
||||||
|
{ id: 4, title: '工程施工' }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('UserEditDialog - 获取技能列表异常:', error);
|
||||||
|
this.skillList = [
|
||||||
|
{ id: 1, title: '水电工' },
|
||||||
|
{ id: 2, title: '油工师傅' },
|
||||||
|
{ id: 3, title: '改造维修' },
|
||||||
|
{ id: 4, title: '工程施工' }
|
||||||
|
];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理已选择的城市
|
||||||
|
processSelectedCities() {
|
||||||
|
if (this.form.serviceCityPid) {
|
||||||
|
console.log('处理服务城市数据:', this.form.serviceCityPid, '类型:', typeof this.form.serviceCityPid);
|
||||||
|
try {
|
||||||
|
if (typeof this.form.serviceCityPid === 'string') {
|
||||||
|
if (this.form.serviceCityPid.startsWith('[') && this.form.serviceCityPid.endsWith(']')) {
|
||||||
|
this.selectedCities = JSON.parse(this.form.serviceCityPid).map(Number).filter(n => !isNaN(n));
|
||||||
|
} else {
|
||||||
|
this.selectedCities = this.form.serviceCityPid.split(',').map(Number).filter(n => !isNaN(n));
|
||||||
|
}
|
||||||
|
} else if (Array.isArray(this.form.serviceCityPid)) {
|
||||||
|
this.selectedCities = this.form.serviceCityPid.map(Number).filter(n => !isNaN(n));
|
||||||
|
} else {
|
||||||
|
this.selectedCities = [];
|
||||||
|
}
|
||||||
|
console.log('解析后的服务城市:', this.selectedCities);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('解析服务城市数据失败:', error);
|
||||||
|
this.selectedCities = [];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.selectedCities = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 处理已选择的地区
|
// 处理已选择的地区
|
||||||
processSelectedAreas() {
|
processSelectedAreas() {
|
||||||
if (this.form.serviceCityIds) {
|
if (this.form.serviceCityIds) {
|
||||||
console.log('处理服务区域数据:', this.form.serviceCityIds, '类型:', typeof this.form.serviceCityIds);
|
console.log('处理服务地区数据:', this.form.serviceCityIds, '类型:', typeof this.form.serviceCityIds);
|
||||||
try {
|
try {
|
||||||
if (typeof this.form.serviceCityIds === 'string') {
|
if (typeof this.form.serviceCityIds === 'string') {
|
||||||
// 处理可能是JSON字符串的情况
|
|
||||||
if (this.form.serviceCityIds.startsWith('[') && this.form.serviceCityIds.endsWith(']')) {
|
if (this.form.serviceCityIds.startsWith('[') && this.form.serviceCityIds.endsWith(']')) {
|
||||||
this.selectedAreas = JSON.parse(this.form.serviceCityIds).map(Number).filter(n => !isNaN(n));
|
this.selectedAreas = JSON.parse(this.form.serviceCityIds).map(Number).filter(n => !isNaN(n));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -312,24 +456,9 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.selectedAreas = [];
|
this.selectedAreas = [];
|
||||||
}
|
}
|
||||||
console.log('解析后的服务区域:', this.selectedAreas);
|
console.log('解析后的服务地区:', this.selectedAreas);
|
||||||
|
|
||||||
// 如果有已选择的地区,但地区列表为空,需要等待地区数据加载完成
|
|
||||||
if (this.selectedAreas.length > 0 && this.selectAreaShiDataList.length === 0) {
|
|
||||||
console.log('UserEditDialog - 有已选择的地区但地区列表为空,等待数据加载');
|
|
||||||
// 延迟处理,等待地区数据加载完成
|
|
||||||
setTimeout(() => {
|
|
||||||
this.processSelectedAreas();
|
|
||||||
}, 500);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 强制更新显示
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.forceUpdateDisplay();
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('解析服务区域数据失败:', error);
|
console.error('解析服务地区数据失败:', error);
|
||||||
this.selectedAreas = [];
|
this.selectedAreas = [];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -343,7 +472,6 @@ export default {
|
||||||
console.log('处理技能数据:', this.form.skillIds, '类型:', typeof this.form.skillIds);
|
console.log('处理技能数据:', this.form.skillIds, '类型:', typeof this.form.skillIds);
|
||||||
try {
|
try {
|
||||||
if (typeof this.form.skillIds === 'string') {
|
if (typeof this.form.skillIds === 'string') {
|
||||||
// 处理可能是JSON字符串的情况
|
|
||||||
if (this.form.skillIds.startsWith('[') && this.form.skillIds.endsWith(']')) {
|
if (this.form.skillIds.startsWith('[') && this.form.skillIds.endsWith(']')) {
|
||||||
this.selectedSkills = JSON.parse(this.form.skillIds).map(Number).filter(n => !isNaN(n));
|
this.selectedSkills = JSON.parse(this.form.skillIds).map(Number).filter(n => !isNaN(n));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -355,10 +483,6 @@ export default {
|
||||||
this.selectedSkills = [];
|
this.selectedSkills = [];
|
||||||
}
|
}
|
||||||
console.log('解析后的技能:', this.selectedSkills);
|
console.log('解析后的技能:', this.selectedSkills);
|
||||||
// 强制更新显示
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.forceUpdateDisplay();
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('解析技能数据失败:', error);
|
console.error('解析技能数据失败:', error);
|
||||||
this.selectedSkills = [];
|
this.selectedSkills = [];
|
||||||
|
|
@ -368,57 +492,72 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 更新城市名称缓存
|
||||||
|
updateCityNameCache() {
|
||||||
|
console.log('更新城市名称缓存,已选择城市:', this.selectedCities, '城市列表:', this.cityList);
|
||||||
|
this.cityNameCache = {};
|
||||||
|
this.selectedCities.forEach(cityId => {
|
||||||
|
const city = this.cityList.find(item => item.id === cityId);
|
||||||
|
if (city) {
|
||||||
|
this.cityNameCache[cityId] = city.title;
|
||||||
|
} else {
|
||||||
|
console.warn('未找到城市ID:', cityId, '对应的名称');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log('城市名称缓存:', this.cityNameCache);
|
||||||
|
},
|
||||||
|
|
||||||
// 更新地区名称缓存
|
// 更新地区名称缓存
|
||||||
updateAreaNameCache() {
|
updateAreaNameCache() {
|
||||||
console.log('UserEditDialog - 更新地区名称缓存,已选择地区:', this.selectedAreas, '地区列表:', this.selectAreaShiDataList);
|
console.log('更新地区名称缓存,已选择地区:', this.selectedAreas, '地区列表:', this.areaList);
|
||||||
this.areaNameCache = {};
|
this.areaNameCache = {};
|
||||||
this.selectedAreas.forEach(areaId => {
|
this.selectedAreas.forEach(areaId => {
|
||||||
const area = this.selectAreaShiDataList.find(item => item.id === areaId);
|
const area = this.areaList.find(item => item.id === areaId);
|
||||||
if (area) {
|
if (area) {
|
||||||
this.areaNameCache[areaId] = area.title;
|
this.areaNameCache[areaId] = area.title;
|
||||||
} else {
|
} else {
|
||||||
console.warn('UserEditDialog - 未找到地区ID:', areaId, '对应的名称');
|
console.warn('未找到地区ID:', areaId, '对应的名称');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log('UserEditDialog - 地区名称缓存:', this.areaNameCache);
|
console.log('地区名称缓存:', this.areaNameCache);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 更新技能名称缓存
|
// 更新技能名称缓存
|
||||||
updateSkillNameCache() {
|
updateSkillNameCache() {
|
||||||
|
console.log('更新技能名称缓存,已选择技能:', this.selectedSkills, '技能列表:', this.skillList);
|
||||||
|
this.skillNameCache = {};
|
||||||
this.selectedSkills.forEach(skillId => {
|
this.selectedSkills.forEach(skillId => {
|
||||||
if (!this.skillNameCache[skillId]) {
|
const skill = this.skillList.find(item => item.id === skillId);
|
||||||
const skill = this.skillList.find(item => item.id == skillId);
|
if (skill) {
|
||||||
if (skill) {
|
this.skillNameCache[skillId] = skill.title;
|
||||||
this.skillNameCache[skillId] = skill.title;
|
} else {
|
||||||
}
|
console.warn('未找到技能ID:', skillId, '对应的名称');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
console.log('技能名称缓存:', this.skillNameCache);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取城市名称
|
||||||
|
getCityName(cityId) {
|
||||||
|
return this.cityNameCache[cityId] || this.cityList.find(item => item.id === cityId)?.title || cityId;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取地区名称
|
// 获取地区名称
|
||||||
getAreaName(areaId) {
|
getAreaName(areaId) {
|
||||||
if (this.areaNameCache[areaId]) {
|
return this.areaNameCache[areaId] || this.areaList.find(item => item.id === areaId)?.title || areaId;
|
||||||
return this.areaNameCache[areaId];
|
|
||||||
}
|
|
||||||
const area = this.selectAreaShiDataList.find(item => item.id == areaId);
|
|
||||||
if (area) {
|
|
||||||
this.areaNameCache[areaId] = area.title;
|
|
||||||
return area.title;
|
|
||||||
}
|
|
||||||
return areaId;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取技能名称
|
// 获取技能名称
|
||||||
getSkillName(skillId) {
|
getSkillName(skillId) {
|
||||||
if (this.skillNameCache[skillId]) {
|
return this.skillNameCache[skillId] || this.skillList.find(item => item.id === skillId)?.title || skillId;
|
||||||
return this.skillNameCache[skillId];
|
},
|
||||||
|
|
||||||
|
// 移除城市
|
||||||
|
removeCity(cityId) {
|
||||||
|
const index = this.selectedCities.indexOf(cityId);
|
||||||
|
if (index > -1) {
|
||||||
|
this.selectedCities.splice(index, 1);
|
||||||
}
|
}
|
||||||
const skill = this.skillList.find(item => item.id == skillId);
|
|
||||||
if (skill) {
|
|
||||||
this.skillNameCache[skillId] = skill.title;
|
|
||||||
return skill.title;
|
|
||||||
}
|
|
||||||
return skillId;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 移除地区
|
// 移除地区
|
||||||
|
|
@ -437,288 +576,39 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 城市选择变化
|
||||||
|
handleCityChange() {
|
||||||
|
console.log('城市选择变化:', this.selectedCities);
|
||||||
|
this.updateCityNameCache();
|
||||||
|
// 重新加载地区列表
|
||||||
|
this.loadAreaList();
|
||||||
|
},
|
||||||
|
|
||||||
// 地区选择变化
|
// 地区选择变化
|
||||||
handleAreaChange() {
|
handleAreaChange() {
|
||||||
|
console.log('地区选择变化:', this.selectedAreas);
|
||||||
this.updateAreaNameCache();
|
this.updateAreaNameCache();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 技能选择变化
|
// 技能选择变化
|
||||||
handleSkillChange() {
|
handleSkillChange() {
|
||||||
|
console.log('技能选择变化:', this.selectedSkills);
|
||||||
this.updateSkillNameCache();
|
this.updateSkillNameCache();
|
||||||
},
|
},
|
||||||
|
|
||||||
getShenDataList() {
|
// 减少时间
|
||||||
console.log('UserEditDialog - 开始获取省份数据');
|
|
||||||
// 使用DiyCityService获取一级城市(省份)
|
|
||||||
const queryParams = {
|
|
||||||
parentId: 0 // 查询parent_id=0的一级城市
|
|
||||||
}
|
|
||||||
listDiyCity(queryParams).then(response => {
|
|
||||||
console.log('UserEditDialog - 获取省份数据成功:', response);
|
|
||||||
if (response.code === 200) {
|
|
||||||
this.selectAreaShenDataList = response.rows || []
|
|
||||||
console.log('UserEditDialog - 省份列表:', this.selectAreaShenDataList);
|
|
||||||
} else {
|
|
||||||
console.warn('UserEditDialog - 获取省份数据失败,使用默认数据');
|
|
||||||
// 如果接口失败,使用默认数据
|
|
||||||
this.selectAreaShenDataList = [
|
|
||||||
{ id: 1, title: '陕西省' },
|
|
||||||
{ id: 27, title: '上海市' },
|
|
||||||
{ id: 44, title: '湖南省' },
|
|
||||||
{ id: 52, title: '安徽省' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('UserEditDialog - 获取省份数据异常:', error);
|
|
||||||
// 如果接口失败,使用默认数据
|
|
||||||
this.selectAreaShenDataList = [
|
|
||||||
{ id: 1, title: '陕西省' },
|
|
||||||
{ id: 27, title: '上海市' },
|
|
||||||
{ id: 44, title: '湖南省' },
|
|
||||||
{ id: 52, title: '安徽省' }
|
|
||||||
]
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getShiDataList(id) {
|
|
||||||
console.log('UserEditDialog - 开始获取城市数据,省份ID:', id);
|
|
||||||
// 使用DiyCityService获取指定省份下的城市
|
|
||||||
const queryParams = {
|
|
||||||
parentId: id // 查询指定parent_id的城市
|
|
||||||
}
|
|
||||||
listDiyCity(queryParams).then(response => {
|
|
||||||
console.log('UserEditDialog - 获取城市数据成功:', response);
|
|
||||||
if (response.code === 200) {
|
|
||||||
const newAreas = response.rows || []
|
|
||||||
console.log('UserEditDialog - 城市列表:', newAreas);
|
|
||||||
|
|
||||||
// 合并到现有列表中,避免重复
|
|
||||||
newAreas.forEach(area => {
|
|
||||||
const exists = this.selectAreaShiDataList.find(item => item.id === area.id)
|
|
||||||
if (!exists) {
|
|
||||||
this.selectAreaShiDataList.push(area)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log('UserEditDialog - 合并后的地区列表:', this.selectAreaShiDataList);
|
|
||||||
|
|
||||||
// 更新地区名称缓存
|
|
||||||
this.updateAreaNameCache();
|
|
||||||
// 重新处理已选择的地区,确保显示正确的名称
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.processSelectedAreas();
|
|
||||||
this.forceUpdateDisplay();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.warn('UserEditDialog - 获取城市数据失败,使用默认数据');
|
|
||||||
// 如果接口失败,使用默认数据
|
|
||||||
let defaultAreas = []
|
|
||||||
if (id === 1) {
|
|
||||||
defaultAreas = [
|
|
||||||
{ id: 2, title: '新城区' },
|
|
||||||
{ id: 5, title: '碑林区' },
|
|
||||||
{ id: 7, title: '莲湖区' },
|
|
||||||
{ id: 10, title: '灞桥区' },
|
|
||||||
{ id: 11, title: '未央区' },
|
|
||||||
{ id: 12, title: '雁塔区' },
|
|
||||||
{ id: 13, title: '阎良区' },
|
|
||||||
{ id: 14, title: '临潼区' },
|
|
||||||
{ id: 15, title: '长安区' },
|
|
||||||
{ id: 16, title: '高陵区' },
|
|
||||||
{ id: 17, title: '鄠邑区' }
|
|
||||||
]
|
|
||||||
} else if (id === 52) {
|
|
||||||
defaultAreas = [
|
|
||||||
{ id: 53, title: '瑶海区' },
|
|
||||||
{ id: 54, title: '庐阳区' },
|
|
||||||
{ id: 55, title: '蜀山区' },
|
|
||||||
{ id: 56, title: '包河区' },
|
|
||||||
{ id: 57, title: '经开区' },
|
|
||||||
{ id: 58, title: '高新区' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合并到现有列表中,避免重复
|
|
||||||
defaultAreas.forEach(area => {
|
|
||||||
const exists = this.selectAreaShiDataList.find(item => item.id === area.id)
|
|
||||||
if (!exists) {
|
|
||||||
this.selectAreaShiDataList.push(area)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log('UserEditDialog - 使用默认数据后的地区列表:', this.selectAreaShiDataList);
|
|
||||||
|
|
||||||
// 更新地区名称缓存
|
|
||||||
this.updateAreaNameCache();
|
|
||||||
// 重新处理已选择的地区
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.processSelectedAreas();
|
|
||||||
this.forceUpdateDisplay();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('UserEditDialog - 获取城市数据失败:', error);
|
|
||||||
// 如果接口失败,使用默认数据
|
|
||||||
let defaultAreas = []
|
|
||||||
if (id === 1) {
|
|
||||||
defaultAreas = [
|
|
||||||
{ id: 2, title: '新城区' },
|
|
||||||
{ id: 5, title: '碑林区' },
|
|
||||||
{ id: 7, title: '莲湖区' },
|
|
||||||
{ id: 10, title: '灞桥区' },
|
|
||||||
{ id: 11, title: '未央区' },
|
|
||||||
{ id: 12, title: '雁塔区' },
|
|
||||||
{ id: 13, title: '阎良区' },
|
|
||||||
{ id: 14, title: '临潼区' },
|
|
||||||
{ id: 15, title: '长安区' },
|
|
||||||
{ id: 16, title: '高陵区' },
|
|
||||||
{ id: 17, title: '鄠邑区' }
|
|
||||||
]
|
|
||||||
} else if (id === 52) {
|
|
||||||
defaultAreas = [
|
|
||||||
{ id: 53, title: '瑶海区' },
|
|
||||||
{ id: 54, title: '庐阳区' },
|
|
||||||
{ id: 55, title: '蜀山区' },
|
|
||||||
{ id: 56, title: '包河区' },
|
|
||||||
{ id: 57, title: '经开区' },
|
|
||||||
{ id: 58, title: '高新区' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合并到现有列表中,避免重复
|
|
||||||
defaultAreas.forEach(area => {
|
|
||||||
const exists = this.selectAreaShiDataList.find(item => item.id === area.id)
|
|
||||||
if (!exists) {
|
|
||||||
this.selectAreaShiDataList.push(area)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log('UserEditDialog - 异常处理后的地区列表:', this.selectAreaShiDataList);
|
|
||||||
|
|
||||||
// 更新地区名称缓存
|
|
||||||
this.updateAreaNameCache();
|
|
||||||
// 重新处理已选择的地区
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.processSelectedAreas();
|
|
||||||
this.forceUpdateDisplay();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getSkillList() {
|
|
||||||
console.log('UserEditDialog - 开始获取技能列表');
|
|
||||||
getSiteSkillList().then(response => {
|
|
||||||
console.log('UserEditDialog - 获取技能列表成功:', response);
|
|
||||||
if (response.code === 200) {
|
|
||||||
this.skillList = response.data || []
|
|
||||||
console.log('UserEditDialog - 技能列表:', this.skillList);
|
|
||||||
// 更新技能名称缓存
|
|
||||||
this.updateSkillNameCache();
|
|
||||||
// 重新处理已选择的技能,确保显示正确的名称
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.processSelectedSkills();
|
|
||||||
this.forceUpdateDisplay();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.warn('UserEditDialog - 获取技能列表失败,使用默认数据');
|
|
||||||
// 如果接口失败,使用默认数据
|
|
||||||
this.skillList = [
|
|
||||||
{ id: 1, title: '水电工' },
|
|
||||||
{ id: 2, title: '油工师傅' },
|
|
||||||
{ id: 3, title: '改造维修' },
|
|
||||||
{ id: 4, title: '工程施工' }
|
|
||||||
]
|
|
||||||
// 更新技能名称缓存
|
|
||||||
this.updateSkillNameCache();
|
|
||||||
// 重新处理已选择的技能
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.processSelectedSkills();
|
|
||||||
this.forceUpdateDisplay();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('UserEditDialog - 获取技能列表异常:', error);
|
|
||||||
// 如果接口失败,使用默认数据
|
|
||||||
this.skillList = [
|
|
||||||
{ id: 1, title: '水电工' },
|
|
||||||
{ id: 2, title: '油工师傅' },
|
|
||||||
{ id: 3, title: '改造维修' },
|
|
||||||
{ id: 4, title: '工程施工' }
|
|
||||||
]
|
|
||||||
// 更新技能名称缓存
|
|
||||||
this.updateSkillNameCache();
|
|
||||||
// 重新处理已选择的技能
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.processSelectedSkills();
|
|
||||||
this.forceUpdateDisplay();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleProvinceChange() {
|
|
||||||
console.log('UserEditDialog - 服务城市变化:', this.form.serviceCityPid);
|
|
||||||
|
|
||||||
// 清空已选择的地区
|
|
||||||
this.selectedAreas = []
|
|
||||||
this.form.serviceCityIds = ''
|
|
||||||
this.areaNameCache = {} // 清空地区名称缓存
|
|
||||||
this.selectAreaShiDataList = [] // 清空地区列表
|
|
||||||
|
|
||||||
// 如果有选择的服务城市,加载对应的城市数据
|
|
||||||
if (this.form.serviceCityPid && this.form.serviceCityPid.length > 0) {
|
|
||||||
console.log('UserEditDialog - 开始加载多个城市的数据');
|
|
||||||
// 为每个选中的城市加载地区数据
|
|
||||||
this.form.serviceCityPid.forEach(cityId => {
|
|
||||||
this.getShiDataList(cityId)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
console.log('UserEditDialog - 没有选择服务城市');
|
|
||||||
this.selectAreaShiDataList = []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
decreaseTime() {
|
decreaseTime() {
|
||||||
if (this.form.prohibitTimeNum > 0) {
|
if (this.form.prohibitTimeNum > 0) {
|
||||||
this.form.prohibitTimeNum--
|
this.form.prohibitTimeNum--;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 增加时间
|
||||||
increaseTime() {
|
increaseTime() {
|
||||||
this.form.prohibitTimeNum++
|
this.form.prohibitTimeNum++;
|
||||||
},
|
|
||||||
parseTime(time, pattern) {
|
|
||||||
if (arguments.length === 0 || !time) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
|
|
||||||
let date
|
|
||||||
if (typeof time === 'object') {
|
|
||||||
date = time
|
|
||||||
} else {
|
|
||||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
|
||||||
time = parseInt(time)
|
|
||||||
} else if (typeof time === 'string') {
|
|
||||||
time = time.replace(new RegExp(/-/gm), '/')
|
|
||||||
}
|
|
||||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
|
||||||
time = time * 1000
|
|
||||||
}
|
|
||||||
date = new Date(time)
|
|
||||||
}
|
|
||||||
const formatObj = {
|
|
||||||
y: date.getFullYear(),
|
|
||||||
m: date.getMonth() + 1,
|
|
||||||
d: date.getDate(),
|
|
||||||
h: date.getHours(),
|
|
||||||
i: date.getMinutes(),
|
|
||||||
s: date.getSeconds(),
|
|
||||||
a: date.getDay()
|
|
||||||
}
|
|
||||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
|
||||||
let value = formatObj[key]
|
|
||||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
|
|
||||||
if (result.length > 0 && value < 10) {
|
|
||||||
value = '0' + value
|
|
||||||
}
|
|
||||||
return value || 0
|
|
||||||
})
|
|
||||||
return time_str
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
|
@ -727,9 +617,7 @@ export default {
|
||||||
...this.form,
|
...this.form,
|
||||||
type: '2', // 师傅类型
|
type: '2', // 师傅类型
|
||||||
status: this.form.status || 0,
|
status: this.form.status || 0,
|
||||||
prohibitTimeNum: this.form.prohibitTimeNum || 0,
|
prohibitTimeNum: this.form.prohibitTimeNum || 0
|
||||||
// 处理服务城市ID,如果是数组则转换为字符串
|
|
||||||
serviceCityPid: Array.isArray(this.form.serviceCityPid) ? this.form.serviceCityPid.join(',') : this.form.serviceCityPid
|
|
||||||
}
|
}
|
||||||
this.$emit('confirm', submitData)
|
this.$emit('confirm', submitData)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -737,13 +625,17 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 重置表单
|
||||||
resetForm() {
|
resetForm() {
|
||||||
// 重置表单但保留id
|
// 重置表单但保留id
|
||||||
const id = this.form.id
|
const id = this.form.id
|
||||||
const createdAt = this.form.createdAt
|
const createdAt = this.form.createdAt
|
||||||
this.$refs["form"].resetFields()
|
this.$refs["form"].resetFields()
|
||||||
|
this.selectedCities = []
|
||||||
this.selectedAreas = []
|
this.selectedAreas = []
|
||||||
this.selectedSkills = []
|
this.selectedSkills = []
|
||||||
|
this.cityNameCache = {}
|
||||||
this.areaNameCache = {}
|
this.areaNameCache = {}
|
||||||
this.skillNameCache = {}
|
this.skillNameCache = {}
|
||||||
this.form = {
|
this.form = {
|
||||||
|
|
@ -777,58 +669,14 @@ export default {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-input .el-input-number {
|
|
||||||
margin: 0 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.time-input .el-button {
|
|
||||||
padding: 7px;
|
|
||||||
min-width: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-select {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-selection,
|
|
||||||
.skill-selection {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.selected-tags {
|
.selected-tags {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
padding: 8px;
|
max-width: 100%;
|
||||||
border: 1px solid #e4e7ed;
|
overflow: hidden;
|
||||||
border-radius: 4px;
|
|
||||||
background-color: #fafafa;
|
|
||||||
min-height: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected-tags .el-tag {
|
.selected-tags .el-tag {
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .el-input-number .el-input__inner {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .el-dialog__body {
|
|
||||||
padding: 20px 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .el-form-item {
|
|
||||||
margin-bottom: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .el-input-group__prepend {
|
|
||||||
padding: 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .el-select .el-input__inner {
|
|
||||||
padding-right: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .el-tag {
|
|
||||||
max-width: 200px;
|
max-width: 200px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue