瀏覽代碼

merge master

haojianlong 5 年之前
父節點
當前提交
94c9def4a0
共有 3 個文件被更改,包括 36 次插入33 次删除
  1. 13 11
      src/components/ledger/lib/assets.vue
  2. 13 15
      src/components/ledger/lib/cascader.vue
  3. 10 7
      src/components/ledger/lib/system.vue

+ 13 - 11
src/components/ledger/lib/assets.vue

@@ -66,9 +66,8 @@ export default {
       this.$emit("change", value)
     },
     async getData() {
-      let _this = this
       await getEquipmentFamily(res => {
-        _this.options = _this.changeArr(res.Content)
+        this.options = this.changeArr(res.Content)
         if (!!this.value && this.value.length) {
           let value = {}
           this.options.map(item => {
@@ -78,8 +77,8 @@ export default {
           })
           this.$emit("change", value)
         }
-        if (!_this.falg) {
-          _this.changeList()
+        if (!this.falg) {
+          this.changeList()
         }
       })
     },
@@ -100,13 +99,16 @@ export default {
       }
     },
     changeList() {
-      this.options.map(item => {
-        item.disabled = true
-        this.content.map(child => {
-          if (item.code == child) {
-            item.disabled = false
-          }
-        })
+      this.options = this.options.filter(item => {
+        if (this.content.indexOf(item.code) > -1) {
+          return item
+        }
+        // item.disabled = true
+        // this.content.map(child => {
+        //   if (item.code == child) {
+        //     item.disabled = false
+        //   }
+        // })
       })
     }
   }

+ 13 - 15
src/components/ledger/lib/cascader.vue

@@ -78,7 +78,6 @@ export default {
             facility: "全部"
           });
           this.options = data
-          console.log(this.options, "options")
           this.value = ["all"]
         } else {
           this.options = this.changeArr(res.data.Content);
@@ -101,13 +100,9 @@ export default {
       let data = [];
       arr.map(item => {
         if (item.content && item.content.length) {
-          return item.content.map(children => {
-            if (children.content && children.content.length) {
-              return children.content.map(i => {
-                data.push(i);
-              });
-            }
-          });
+          data = data.concat(this.changeArr(item.content))
+        } else {
+          data.push(item)
         }
       });
       return data;
@@ -124,13 +119,16 @@ export default {
     },
 
     changeList() {
-      this.options.map(item => {
-        item.disabled = true
-        this.content.map(child => {
-          if (item.code == child) {
-            item.disabled = false
-          }
-        })
+      this.options = this.options.filter(item => {
+        if (this.content.indexOf(item.code) > -1) {
+          return item
+        }
+        // item.disabled = true
+        // this.content.map(child => {
+        //   if (item.code == child) {
+        //     item.disabled = false
+        //   }
+        // })
       })
     }
   }

+ 10 - 7
src/components/ledger/lib/system.vue

@@ -106,13 +106,16 @@ export default {
 
     //修改list
     changeList() {
-      this.options.map(item => {
-        item.disabled = true
-        this.content.map(child => {
-          if (item.code == child) {
-            item.disabled = false
-          }
-        })
+      this.options = this.options.filter(item => {
+        if (this.content.indexOf(item.code) > -1) {
+          return item
+        }
+        // item.disabled = true
+        // this.content.map(child => {
+        //   if (item.code == child) {
+        //     item.disabled = false
+        //   }
+        // })
       })
     }
   }