chris 3 жил өмнө
parent
commit
ce8dd928d9

+ 33 - 4
src/views/modules/common/material-type-component.vue

@@ -36,6 +36,13 @@
       prop: 'typeId',
       event: 'typeSelected'
     },
+    watch: {
+      typeId (value) {
+        this.value = value
+        // 检查缺失item
+        this.checkItem(value)
+      }
+    },
     data () {
       return {
         value: '',
@@ -75,10 +82,13 @@
               return
             }
             data.data.records.forEach(item => {
-              this.options.push({
-                label: item.name,
-                value: item.id
-              })
+              let i = this.options.findIndex(a => a.value === item.id)
+              if (i < 0) {
+                this.options.push({
+                  label: item.name,
+                  value: item.id
+                })
+              }
             })
           } else {
             this.options = []
@@ -93,11 +103,30 @@
         this.getList()
       },
       onChange (item) {
+        console.log(item)
         if (item === 'undefined') {
+          // console.log('m1')
           this.value = null
         }
         this.$emit('typeSelected', item)
       },
+      checkItem (code) {
+        if (!code || !this.options) return
+        let i = this.options.findIndex(item => item.value === code)
+        if (i > -1) return
+        // info
+        this.$http({
+          url: this.$http.adornUrl(`/biz-service/wh-category/info/${code}`),
+          method: 'get'
+        }).then(({data}) => {
+          if (data && data.code === '200' && data.data) {
+            this.options.push({
+              label: data.data.name,
+              value: data.data.id
+            })
+          }
+        })
+      },
       cancelReadOnly (onOff) {
         this.$nextTick(() => {
           if (!onOff) {

+ 1 - 5
src/views/modules/common/user-component-all.vue

@@ -81,11 +81,7 @@
             if (this.current > data.data.pages) {
               return
             }
-            if (data.data.records.length < 10) {
-              this.noMore = false
-            } else {
-              this.noMore = true
-            }
+            // this.noMore = data.data.records.length >= 10
             data.data.records.forEach(item => {
               this.options.push({
                 label: item.name + ' (' + item.orgName + ')',

+ 9 - 6
src/views/modules/common/user-component.vue

@@ -83,12 +83,15 @@
               return
             }
             data.data.records.forEach(item => {
-              this.options.push({
-                label: item.name + ' (' + item.orgName + ')',
-                value: item.userId,
-                name: item.name,
-                phone: item.mobile
-              })
+              let i = this.options.findIndex(a => a.value === item.userId)
+              if (i < 0) {
+                this.options.push({
+                  label: item.name + ' (' + item.orgName + ')',
+                  value: item.userId,
+                  name: item.name,
+                  phone: item.mobile
+                })
+              }
             })
           } else {
             this.options = []

+ 1 - 1
src/views/modules/common/user-components.vue

@@ -84,7 +84,7 @@
             if (this.current > data.data.pages) {
               return
             }
-            this.noMore = data.data.records.length >= 10
+            // this.noMore = data.data.records.length >= 10
             data.data.records.forEach(item => {
               this.options.push({
                 label: item.name + ' (' + item.orgName + ')',

+ 5 - 1
src/views/modules/order/order-add-or-update.vue

@@ -46,7 +46,7 @@
           <el-col :span="8">
             <el-form-item label="业务员" prop="salesmanId">
               <el-input v-if="display" v-model="dataForm.salesmanName" disabled></el-input>
-              <user-component v-else v-model="dataForm.salesmanId" :user-id="dataForm.salesmanId"></user-component>
+              <user-component v-else v-model="dataForm.salesmanId" :user-id="dataForm.salesmanId" @userSelected="salesmanChanged"></user-component>
             </el-form-item>
           </el-col>
           <el-col :span="8" style="padding-left: 20px">
@@ -337,6 +337,10 @@
             })
           }
         })
+      },
+      // 业务员选择变化
+      salesmanChanged (val) {
+        this.dataForm.salesmanId = val
       }
     }
   }