Browse Source

通讯录bug修复 心累

dev-数据对比
dai 3 years ago
parent
commit
03fa771115
  1. 117
      src/views/modules/base/organization/organization.vue

117
src/views/modules/base/organization/organization.vue

@ -728,11 +728,20 @@
<el-form-item label="调动至"> <el-form-item label="调动至">
<el-cascader <el-cascader
clearable clearable
:props="{ checkStrictly: true }" :props="{ multiple: false }"
v-model="selectValue" v-model="selectValue"
:options="options" :options="options"
@change="handleChange" style="width: 100%"
@change="handleChangeTransferCascader"
> >
<template slot-scope="{ data }">
<span>{{ data.label }}</span>
<span
v-if="data.type != 'agency'"
style="color: #aaa; font-size: 12px"
>{{ data.typeName }}
</span>
</template>
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="调动原因"> <el-form-item label="调动原因">
@ -1254,24 +1263,7 @@ export default {
roleList: [], roleList: [],
// //
options: [ options: [],
{
value: "",
label: "",
children: [
{
value: "",
label: "",
children: [],
},
{
value: "",
label: "",
children: [],
},
],
},
],
selectValue: [], selectValue: [],
// //
breadcrumbArr: [], breadcrumbArr: [],
@ -1358,30 +1350,24 @@ export default {
}, },
methods: { methods: {
// id // id
handleChange(e) { handleChangeTransferCascader(e) {
this.transferForm.orgId = e[1]; console.log("*********************");
if (this.transferForm.orgId != null || "") { function findItem(valueArr, coll) {
if (this.transferForm.orgId === 0) { console.log("--------------------");
if (e[2] == null || "") { console.log(valueArr);
this.transferForm.orgType = "dept"; let copyArr = [...valueArr];
this.transferForm.orgId = "14f572e724eecf7668b655505d789cab"; let firstValue = copyArr.shift();
} else { let item = coll.find((a) => a.value == firstValue);
this.transferForm.orgId = e[2]; console.log(item);
this.transferForm.orgType = "dept"; if (copyArr.length > 0) {
} return findItem(copyArr, item.children);
} else { } else {
if (e[2] == null || "") { return item;
this.transferForm.orgType = "grid";
this.transferForm.orgId = "63d5ff92ea981b1c58e4914ac894c610";
} else {
this.transferForm.orgId = e[2];
this.transferForm.orgType = "grid";
}
} }
} else {
this.transferForm.orgId = e[0];
this.transferForm.orgType = "agency";
} }
let item = findItem(e, this.options);
this.transferForm.orgId = item.value;
this.transferForm.orgType = item.type;
}, },
/** 查询系统工作人员角色(职责) */ /** 查询系统工作人员角色(职责) */
async getDutyList() { async getDutyList() {
@ -2166,31 +2152,32 @@ export default {
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
this.options[0].label = data.agencyName; function computeOption(opt) {
this.options[0].value = data.agencyId; return {
label: opt.agencyName,
console.log("--------", this.options); value: opt.agencyId,
let depart = Array.from(data.departmentList); type: "agency",
let gr = Array.from(data.gridList); children: [
...(opt.departmentList || []).map((item) => ({
depart.forEach((item) => { label: item.deptName,
const ob = { value: item.deptId,
value: item.deptId, type: "dept",
label: item.deptName, typeName: "部门",
}; })),
this.options[0].children[0].children.push(ob); ...(opt.gridList || []).map((item) => ({
}); label: item.gridName,
this.options[0].children[0].value = 0; value: item.gridId,
this.options[0].children[0].label = "部门"; type: "grid",
this.options[0].children[1].value = 1; typeName: "网格",
this.options[0].children[1].label = "网格"; })),
gr.forEach((item) => { ...(opt.subAgencyList || []).map((item) => computeOption(item)),
const obj = { ],
value: item.gridId,
label: item.gridName,
}; };
this.options[0].children[1].children.push(obj); }
}); if (data) {
this.options = [computeOption(data)];
console.log("树树树树树树树树树树", this.options[0]);
}
} else { } else {
this.$message.error("树查询失败", msg); this.$message.error("树查询失败", msg);
} }

Loading…
Cancel
Save