diff --git a/src/views/modules/base/organization/organization.vue b/src/views/modules/base/organization/organization.vue
index 54cdf2e95..8195c3c4f 100644
--- a/src/views/modules/base/organization/organization.vue
+++ b/src/views/modules/base/organization/organization.vue
@@ -728,11 +728,20 @@
+
+ {{ data.label }}
+ ({{ data.typeName }})
+
+
@@ -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);
}