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-cascader
clearable
:props="{ checkStrictly: true }"
:props="{ multiple: false }"
v-model="selectValue"
: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-form-item>
<el-form-item label="调动原因">
@ -1254,24 +1263,7 @@ export default {
roleList: [],
//
options: [
{
value: "",
label: "",
children: [
{
value: "",
label: "",
children: [],
},
{
value: "",
label: "",
children: [],
},
],
},
],
options: [],
selectValue: [],
//
breadcrumbArr: [],
@ -1358,30 +1350,24 @@ export default {
},
methods: {
// id
handleChange(e) {
this.transferForm.orgId = e[1];
if (this.transferForm.orgId != null || "") {
if (this.transferForm.orgId === 0) {
if (e[2] == null || "") {
this.transferForm.orgType = "dept";
this.transferForm.orgId = "14f572e724eecf7668b655505d789cab";
} else {
this.transferForm.orgId = e[2];
this.transferForm.orgType = "dept";
}
handleChangeTransferCascader(e) {
console.log("*********************");
function findItem(valueArr, coll) {
console.log("--------------------");
console.log(valueArr);
let copyArr = [...valueArr];
let firstValue = copyArr.shift();
let item = coll.find((a) => a.value == firstValue);
console.log(item);
if (copyArr.length > 0) {
return findItem(copyArr, item.children);
} else {
if (e[2] == null || "") {
this.transferForm.orgType = "grid";
this.transferForm.orgId = "63d5ff92ea981b1c58e4914ac894c610";
} else {
this.transferForm.orgId = e[2];
this.transferForm.orgType = "grid";
}
return item;
}
} 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() {
@ -2166,31 +2152,32 @@ export default {
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.options[0].label = data.agencyName;
this.options[0].value = data.agencyId;
console.log("--------", this.options);
let depart = Array.from(data.departmentList);
let gr = Array.from(data.gridList);
depart.forEach((item) => {
const ob = {
value: item.deptId,
label: item.deptName,
};
this.options[0].children[0].children.push(ob);
});
this.options[0].children[0].value = 0;
this.options[0].children[0].label = "部门";
this.options[0].children[1].value = 1;
this.options[0].children[1].label = "网格";
gr.forEach((item) => {
const obj = {
value: item.gridId,
label: item.gridName,
function computeOption(opt) {
return {
label: opt.agencyName,
value: opt.agencyId,
type: "agency",
children: [
...(opt.departmentList || []).map((item) => ({
label: item.deptName,
value: item.deptId,
type: "dept",
typeName: "部门",
})),
...(opt.gridList || []).map((item) => ({
label: item.gridName,
value: item.gridId,
type: "grid",
typeName: "网格",
})),
...(opt.subAgencyList || []).map((item) => computeOption(item)),
],
};
this.options[0].children[1].children.push(obj);
});
}
if (data) {
this.options = [computeOption(data)];
console.log("树树树树树树树树树树", this.options[0]);
}
} else {
this.$message.error("树查询失败", msg);
}

Loading…
Cancel
Save