luowei 1 năm trước cách đây
mục cha
commit
099f2375c5
2 tập tin đã thay đổi với 61 bổ sung35 xóa
  1. 1 4
      src/views/core/accessPlan/index.vue
  2. 60 31
      src/views/system/bind/index.vue

+ 1 - 4
src/views/core/accessPlan/index.vue

@@ -2,10 +2,7 @@
   <div class="app-container">
     <el-row :gutter="10">
       <!--机构数据-->
-      <!-- <el-col :span="4" :xs="24">
-                  <org-tree v-model="queryParams.orgId" @defaultKey="getDefaultKey" @defaultOrg="getDefaultOrg" @checkChange="checkChange"
-                    @click="clickTreeNode" :defaultCheckSub="false" hangsheTree></org-tree>
-      </el-col> -->
+  
       <!--搜索栏-->
       <el-col :span="24" :xs="24">
         <div class="main-right-box">

+ 60 - 31
src/views/system/bind/index.vue

@@ -23,14 +23,14 @@
               v-show="showSearch"
             >
               <el-form-item label="机构名称">
-                <org-tree
-                  v-model="queryParams.orgId"
-                  @defaultKey="getDefaultKey"
-                  @checkChange="checkChange"
-                  @click="clickTreeNode"
-                  businessTree
+                  <org-tree
+                    v-model="queryParams.orgId"
+                    @defaultOrg="getDefaultOrg"
+                    @checkChange="checkChange"
+                    @click="clickTreeNode"
                   ref="orgTree"
-                ></org-tree>
+                
+                  ></org-tree>
               </el-form-item>
 
               <el-form-item label="机构类型" prop="orgType">
@@ -303,12 +303,16 @@ import { getAreaByOrg } from "@/api/system/area";
 import { deptTreeSelect, businessTreeSelect } from "@/api/system/public";
 import { getCheckByAreaId, getAreaCheckInfoByOrgId } from "@/api/system/check";
 import orgTree from "@/components/orgTree/orgQuerySelector.vue";
+
 import { mapGetters } from "vuex";
 export default {
+  dicts: ["sys_normal_disable", "plan_status","sys_org_type"],
+
   /** 引入基础minxins*/
   mixins: [tableList],
+
   components: { treeselect, orgTree },
-  dicts: ["sys_normal_disable", "plan_status","sys_org_type"],
+
   data() {
     return {
       // 遮罩层
@@ -378,18 +382,22 @@ export default {
       },
     };
   },
-  created() {
-    this.getDeptTree();
-  },
+
   computed: {
     ...mapGetters(["orgId"]),
   },
+
   watch: {
     // 根据名称筛选部门树
     deptName(val) {
       this.$refs.tree.filter(val);
     },
   },
+
+  created() {
+   // this.getDeptTree();
+  },
+
   methods: {
     //单选框状态改变
     checkChange(state) {
@@ -437,10 +445,10 @@ export default {
         }
       });
     },
-    getDefaultKey(key) {
-      this.queryParams.orgId = key;
-      this.getList();
-    },
+    // getDefaultKey(key) {
+    //   this.queryParams.orgId = key;
+    //   this.getList();
+    // },
     // changeSelect(val) {
     //   getCheckByAreaId(val).then(response => {
 
@@ -459,21 +467,41 @@ export default {
         this.loading = false;
       });
     },
-    /** 查询部门下拉树结构 */
-    getDeptTree() {
-      // deptTreeSelect().then(response => {
-      //   this.deptOptions = response.data;
-      //   this.defaultKeys.push(response.data[0].id);
-      //   this.queryParams.orgId = response.data[0].id;
-      //   this.handleQuery();
-      // });
-      businessTreeSelect().then((response) => {
-        this.deptOptions = response.data;
-        this.defaultKeys.push(response.data[0].id);
-        this.queryParams.orgId = response.data[0].id;
-        this.handleQuery();
-      });
+    getDefaultOrg(node) {
+      this.queryParams.orgId = node.id;
+      this.selectedOrgName = node.shortName;
+      this.getList();
+    },
+        //单选框状态改变
+        checkChange(state) {
+      this.queryParams.checkSub = state;
+      this.getList();
+    },
+            // 节点单击事件
+            clickTreeNode(data) {
+      if(data==null){
+        return;
+      }
+      this.queryParams.orgId = data.id;
+      this.selectedOrgName = data.shortName;
+      this.getList();
     },
+
+    /** 查询部门下拉树结构 */
+    // getDeptTree() {
+    //   // deptTreeSelect().then(response => {
+    //   //   this.deptOptions = response.data;
+    //   //   this.defaultKeys.push(response.data[0].id);
+    //   //   this.queryParams.orgId = response.data[0].id;
+    //   //   this.handleQuery();
+    //   // });
+    //   businessTreeSelect().then((response) => {
+    //     this.deptOptions = response.data;
+    //     this.defaultKeys.push(response.data[0].id);
+    //     this.queryParams.orgId = response.data[0].id;
+    //     this.handleQuery();
+    //   });
+    // },
     tenantIdnormalizer(node, instanceId) {
       if (node.children && !node.children.length) {
         delete node.children;
@@ -516,7 +544,7 @@ export default {
     /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
-      this.queryParams.orgId = this.orgId;
+     this.queryParams.orgId = this.orgId;
       this.queryParams.checkSub = true;
       this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub)
       this.handleQuery();
@@ -601,6 +629,7 @@ export default {
         `bind_${new Date().getTime()}.xlsx`
       );
     },
-  },
+  }
 };
 </script>
+