Quellcode durchsuchen

优化选择履职内容、检查内容窗口

jiawuxian vor 1 Jahr
Ursprung
Commit
f35cdb4273

+ 16 - 6
src/views/resumption/ruleManager/dialog.select.point.vue

@@ -3,11 +3,10 @@
     title="选择履职内容"
     :visible.sync="isShow"
     class="g-dialog-select-safe-check"
-    :close-on-click-modal="false"
     width="55%"
     top="10vh"
-    destroy-on-close
     append-to-body
+    @close="closed"
   >
     <div class="el-dialog-div">
       <g-search-table
@@ -95,6 +94,7 @@ export default {
   data() {
     return {
       isShow: false,
+      prevOrgType: null,
       selectList: [],
       ruleList: [],
       search: this.emptySearch(),
@@ -121,23 +121,33 @@ export default {
     },
   },
   methods: {
-    show(defaultSelect) {
-      this.search = this.emptySearch();
+    show(defaultSelect) {      
       this.isShow = true;
       if (defaultSelect && defaultSelect.map) {
         this.selectList = defaultSelect.map((s) => ({ id: s }));
       }
-
-      ruleListForOrg({ orgType: this.orgType }).then((r) => {
+      if (this.prevOrgType == this.orgType) {
+        this.search.itemName=null;
+        if (this.search.ruleId) {
+          this.$refs.st.search();
+        }
+      } else {
+        this.search = this.emptySearch();
+        ruleListForOrg({ orgType: this.orgType }).then((r) => {
         this.ruleList = r.data;
+        this.prevOrgType = this.orgType;
         if (r.data && r.data.length > 0) {
           this.search.ruleId = r.data[0].id;
         }
       });
+      }
     },
     onHide() {
       this.isShow = false;
     },
+    closed() {
+      this.$refs.st.dataList=[];
+    },
     onSelect(item) {
       this.selectList = item;
     },

+ 22 - 13
src/views/safetycheck/ruleManager/dialog.select.point.vue

@@ -3,11 +3,10 @@
     title="选择检查要点"
     :visible.sync="isShow"
     class="g-dialog-select-safe-check"
-    :close-on-click-modal="false"
-    destroy-on-close
     width="55%"
     top="10vh"
     append-to-body
+    @close="closed"
   >
     <div class="el-dialog-div">
       <g-search-table
@@ -92,6 +91,7 @@ export default {
       selectList: [],
       ruleList: [],
       search: this.emptySearch(),
+      prevOrgType: null,
     };
   },
   computed: {},
@@ -109,29 +109,38 @@ export default {
     // defaultSelect:{
     //   type:Array
     // },
-    orgType:{
-      type:[String,Number]
+    orgType: {
+      type: [String, Number],
     },
   },
   methods: {
-    show(defaultSelect) {
-      this.search = this.emptySearch();
+    show(defaultSelect) {      
       this.isShow = true;
       if (defaultSelect && defaultSelect.map) {
         this.selectList = defaultSelect.map((s) => ({ id: s }));
       }
-
-      ruleListForOrg({ orgType: this.orgType }).then((r) => {
-        this.ruleList = r.data;
-
-        if (r.data && r.data.length > 0) {
-          this.search.ruleId = r.data[0].id;
+      if (this.prevOrgType == this.orgType) {
+        this.search.itemName=null;
+        if (this.search.ruleId) {
+          this.$refs.st.search();
         }
-      });
+      } else {
+        this.search = this.emptySearch();
+        ruleListForOrg({ orgType: this.orgType }).then((r) => {
+          this.ruleList = r.data;
+          this.prevOrgType = this.orgType;
+          if (r.data && r.data.length > 0) {
+            this.search.ruleId = r.data[0].id;
+          }
+        });
+      }
     },
     onHide() {
       this.isShow = false;
     },
+    closed() {
+      this.$refs.st.dataList=[];
+    },
     onSelect(item) {
       this.selectList = item;
     },