Explorar el Código

添加disable功能

chenrui hace 2 años
padre
commit
6404bba563
Se han modificado 1 ficheros con 20 adiciones y 15 borrados
  1. 20 15
      src/views/common/supplier.js

+ 20 - 15
src/views/common/supplier.js

@@ -7,6 +7,7 @@ const Employee = {
         allowClear
         :value="defaultVal"
         :showSearch="true"
+        :disabled="disabledFlag"
         @change="handleChange"
         option-filter-prop="children"
         :filter-option="filterOption">
@@ -31,21 +32,25 @@ const Employee = {
     enableFlag: {
       type: String,
       default: ''
+    },
+    disabledFlag: {
+      type: Boolean,
+      default: false
     }
   },
-  data() {
+  data () {
     return {
       defaultVal: this.value,
       list: []
-    };
+    }
   },
-  mounted() {
+  mounted () {
     this.getList()
   },
   watch: {
-    value(newValue, oldValue) {
+    value (newValue, oldValue) {
       this.defaultVal = newValue
-    },
+    }
   },
   methods: {
     filterOption (input, option) {
@@ -53,26 +58,26 @@ const Employee = {
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
       )
     },
-    handleChange(value) {
-      this.defaultVal = value;
+    handleChange (value) {
+      this.defaultVal = value
       const item = this.list.find(item => item.supplierSn == value)
-      this.$emit('input', value);
-      this.$emit('change', value, item);
+      this.$emit('input', value)
+      this.$emit('change', value, item)
     },
     getList () {
       supplierAllList().then(res => {
         if (res.status == 200) {
-          if(this.enableFlag!=''){
+          if (this.enableFlag != '') {
             this.list = res.data.filter(item => item.enableFlag == this.enableFlag)
-          }else{
+          } else {
             this.list = res.data
           }
         } else {
           this.list = []
         }
       })
-    },
-  },
-};
+    }
+  }
+}
 
-export default Employee
+export default Employee