luojun 1 år sedan
förälder
incheckning
5c13edd940
1 ändrade filer med 40 tillägg och 6 borttagningar
  1. 40 6
      src/views/safetycheck/task/index.vue

+ 40 - 6
src/views/safetycheck/task/index.vue

@@ -55,14 +55,26 @@
               :maxlength="50" @input="inputRestriction"
             /> -->
                 <div style="width: 200px; height: 30px">
-                  <org-tree-select
+                  <!-- <org-tree-select
                     size="mini"
                     v-model="queryParams.checkOrgIds"
                     ref="checkorgTreeSelect"
                     :disable="true"
                     @change="getList"
                   >
-                  </org-tree-select>
+                  </org-tree-select> -->
+                  <tree-select
+                  v-model="queryParams.checkOrgIds"
+                  :options="deptOptions"
+                  :show-count="true"
+                  :normalizer="tenantIdnormalizer"
+                  :props="{ checkStrictly: true, label: 'name' }"
+                  placeholder="请选择组织机构"
+                  clearValueText="清除"
+                  :noChildrenText="''"
+                  noOptionsText="没有数据"
+                  noResultsText="没有搜索结果"
+                />
                 </div>
               </el-form-item>
               <el-form-item label="任务进度" prop="status">
@@ -400,6 +412,7 @@ import { getLabel } from "@/views/commonOption.js";
 import OrgTreeSelect from "@/components/orgTreeSelect";
 import { checkPermi } from "@/utils/permission.js";
 import dayjs from "dayjs";
+import { deptTreeSelect } from "@/api/system/public";
 import request from "@/utils/request";
 export default {
   name: "Saftask",
@@ -413,6 +426,8 @@ export default {
   },
   data() {
     return {
+       // 机构树选项
+       deptOptions: [],
       loading: false,
       showSearch: true,
       total: 0,
@@ -473,10 +488,27 @@ export default {
     ...mapGetters(["orgName", "userId", "roleList", "orgId"]),
   },
   activated (){
-    console.log("刷新");
+    // console.log("刷新");
     this.getList();
   },
   methods: {
+    getDeptTree() {
+      deptTreeSelect().then((response) => {
+        // console.log(response,"sss")
+        this.deptOptions = response.data;
+      });
+    },
+        /** treeSelect组件自定义数据*/
+        tenantIdnormalizer(node, instanceId) {
+      if (node.children && !node.children.length) {
+        delete node.children;
+      }
+      return {
+        id: node.id,
+        label: node.shortName,
+        children: node.children,
+      };
+    },
     async onDown(pdfUrl) {
       window.open(pdfUrl);
     },
@@ -503,7 +535,7 @@ export default {
     getLabel,
     showDetail(row) {
       let path = "/core/safetycheck/detail/" + row.id;
-      console.log(path,"path")
+      // console.log(path,"path")
       this.$router.push(path);
     },
     showscanRecord(row) {
@@ -560,7 +592,7 @@ export default {
       this.getList();
     },
     resetQuery() {
-      this.queryParams.checkOrgIds = [];
+      this.queryParams.checkOrgIds = null;
       this.queryParams.range = [];
       this.resetForm("queryParams");
       this.getList();
@@ -585,7 +617,7 @@ export default {
         });
     },
     async getList() {
-      console.log(this.queryParams, "this.queryParams2222");
+      // console.log(this.queryParams, "this.queryParams2222");
       this.loading = true;
       api
         .page(this.queryParams)
@@ -660,7 +692,9 @@ export default {
   },
   async mounted() {
     this.selectLoadRoles();
+   
   },
+  created(){ this.getDeptTree();},
 };
 </script>