Преглед изворни кода

处理看板机构选择问题

jiawuxian пре 1 година
родитељ
комит
89a270e7fa
1 измењених фајлова са 3 додато и 140 уклоњено
  1. 3 140
      src/views/board/index.vue

+ 3 - 140
src/views/board/index.vue

@@ -8,7 +8,7 @@
         <el-divider direction="vertical" style="margin-top: 5px"></el-divider>
         <el-cascader
           :options="orgOptions"
-          v-model="selectedOrg.id"
+          v-model="orgCascaderSelectedIds"
           :props="{ checkStrictly: true, value: 'id', label: 'shortName' }"
           :show-all-levels="false"
           class="org-cascader"
@@ -114,6 +114,7 @@ export default {
         id: null,
         name: null,
       },
+      orgCascaderSelectedIds:[],
       electricHost: undefined,
       api,
     };
@@ -191,6 +192,7 @@ export default {
       id: this.orgId,
       name: this.orgName,
     };
+    this.orgCascaderSelectedIds=[this.orgId]
   },
   beforeDestroy() {
     clearInterval(this.orgtimer);
@@ -227,145 +229,6 @@ export default {
         name: checked[0].data.shortName,
       };
     },
-    // handleSelect(e) {
-    //   var item = this.branchlist.find((o) => o.orgId === parseInt(e));
-    //   this.activeIndex = e;
-    //   this.selectedOrg = { ...item };
-    // },
-    // async getOrgList(currentUserOrgId) {
-    //   let r = await getOrgList();
-    //   if (r.ret === 2) {
-    //     this.exitSys();
-    //   } else if (r.ret != 1) {
-    //     this.$notify.error({
-    //       message: `获取机构列表错误:${r.errorMsg}`,
-    //       duration: 20 * 1000,
-    //     });
-
-    //     return;
-    //   }
-
-    //   let { data } = r;
-    //   Vue.prototype.$treeList = data;
-    //   const tree = this.genDropdownTree(data, currentUserOrgId);
-    //   if (tree && tree.length > 0) {
-    //     this.selectedOrg = {
-    //       orgId: tree[0].id,
-    //       name: tree[0].label,
-    //     };
-    //   }
-    //   this.orgTree = tree;
-
-    //   let top = data.find((d) => !data.find((d2) => d2.orgId == d.parentId));
-    //   if (!top) {
-    //     this.$$notify.error({
-    //       message: "未找到顶级机构",
-    //       duration: 20 * 1000,
-    //     });
-    //     return;
-    //   }
-
-    //   let branchlist = [];
-    //   if (
-    //     top.orgType != dictionary.orgType.firstLevelBranchType &&
-    //     top.orgType != dictionary.orgType.secondLevelBranchType &&
-    //     top.orgType != dictionary.orgType.subBranchType
-    //   ) {
-    //     this.$$notify.error({
-    //       message: "不支持机构类型" + top.orgType,
-    //       duration: 20 * 1000,
-    //     });
-    //     return;
-    //   }
-
-    //   branchlist.push(top);
-    //   var subOrgType =
-    //     top.orgType == dictionary.orgType.firstLevelBranchType
-    //       ? dictionary.orgType.secondLevelBranchType
-    //       : top.orgType == dictionary.orgType.secondLevelBranchType
-    //       ? dictionary.orgType.subBranchType
-    //       : undefined;
-    //   let subs = data.filter(
-    //     (d) => d.orgId != top.orgId && d.orgType == subOrgType
-    //   );
-
-    //   this.branchlist = branchlist.concat(subs);
-    //   if (!this.branchlist || this.branchlist.length === 0) {
-    //     this.$notify.error({
-    //       message: "机构列表为空",
-    //       duration: 20 * 1000,
-    //     });
-    //   } else {
-    //     if (!this.selectedOrg) {
-    //       this.selectedOrg = {
-    //         ...this.branchlist[0],
-    //       };
-    //     }
-    //   }
-    // },
-
-    // /**生成下拉树 */
-    // genDropdownTree(orgList, topOrgId) {
-    //   const orgTypeConst = dictionary.orgType;
-    //   const needOrgTypes = [
-    //     orgTypeConst.firstLevelBranchType,
-    //     orgTypeConst.secondLevelBranchType,
-    //     orgTypeConst.subBranchType,
-    //   ];
-    //   const topOrg = orgList.find((org) => org.orgId == topOrgId);
-    //   var top = { id: topOrg.orgId, label: topOrg.orgName, path: topOrg.path };
-    //   var topTypeIndex = needOrgTypes.indexOf(topOrg.orgType);
-    //   if (topTypeIndex < 0) {
-    //     return [];
-    //   }
-
-    //   var nodes = [top];
-    //   if (topTypeIndex == needOrgTypes.length - 1) {
-    //     return [top];
-    //   }
-
-    //   for (var i = topTypeIndex + 1; i < needOrgTypes.length; i++) {
-    //     let tmpNodes = [];
-    //     nodes.forEach((item) => {
-    //       var children = orgList.filter(
-    //         (org) =>
-    //           org.path.startsWith(item.path) && org.orgType == needOrgTypes[i]
-    //       );
-    //       children = children.map((c) => ({
-    //         id: c.orgId,
-    //         label: c.orgName,
-    //         path: c.path,
-    //       }));
-
-    //       tmpNodes = tmpNodes.concat(children);
-    //       item.children = children;
-    //     });
-    //     nodes = tmpNodes;
-    //   }
-
-    //   return [top];
-    // },
-
-    // exitSys() {
-    //   this.$alert("确定退出系统吗?", "提示", {
-    //     confirmButtonText: "确定",
-    //     cancelButtonText: "取消",
-    //     showCancelButton: true,
-    //     callback: (r) => {
-    //       if (r === "confirm") {
-    //         logout()
-    //           .then((r) => {
-    //             location.href =
-    //               Vue.$electricHost + "/security/login/sysCenterMain.html";
-    //           })
-    //           .catch((e) => {
-    //             location.href =
-    //               Vue.$electricHost + "/security/login/sysCenterMain.html";
-    //           });
-    //       }
-    //     },
-    //   });
-    // },
   },
 };
 </script>