Преглед на файлове

修复沟通列表-沟通物料明细-单位

damon227 преди 9 месеца
родител
ревизия
9042f52aef
променени са 2 файла, в които са добавени 12 реда и са изтрити 7 реда
  1. 7 5
      src/views/modules/cus/communicate-add-or-update.vue
  2. 5 2
      src/views/modules/product/template-add-or-update-v2.vue

+ 7 - 5
src/views/modules/cus/communicate-add-or-update.vue

@@ -631,14 +631,16 @@ export default {
       if (!item.recordId) {
         item.recordId = Math.round(Math.random() * 1000000)
       }
-      if (
-        this.cusRCommProductVOS.findIndex(
-          (item1) => item1.recordId === item.recordId
-        ) === -1
-      ) {
+      let index = this.cusRCommProductVOS.findIndex((item1) => item1.recordId === item.recordId)
+      console.log(index)
+      console.log(item)
+      if (index === -1) {
         this.cusRCommProductVOS.push({
           ...item
         })
+      } else {
+        this.cusRCommProductVOS.splice(index, 1)
+        this.cusRCommProductVOS.splice(index, 0, item)
       }
     },
     addWorderItems (array) {

+ 5 - 2
src/views/modules/product/template-add-or-update-v2.vue

@@ -68,13 +68,14 @@
         isModify: false,
         bizType: 1,
         dataForm: {
+          unit: ''
         },
         dataRule: {
           mapNumber: [{ required: true, message: '图号不能为空', trigger: 'blur' }],
           productName: [{ required: true, message: '物料名称不能为空', trigger: 'blur' }],
           productSpecifications: [{ required: true, message: '规格不能为空', trigger: 'blur' }],
           cnt: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
-          unitName: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
+          unit: [{ required: true, message: '单位不能为空', trigger: 'blur' }],
           price: [{ required: true, message: '含税单价不能为空', trigger: 'blur' }]
         }
       }
@@ -88,7 +89,8 @@
         this.bizType = techType ? 3 : type
         if (dataForm) {
           this.isModify = true
-          this.dataForm = dataForm
+          dataForm.unit = dataForm.unitName
+          this.dataForm = {...dataForm}
         } else {
           this.dataForm = {
             recordId: Math.round(Math.random() * 1000000),
@@ -102,6 +104,7 @@
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
             this.visible = false
+            this.dataForm.unitName = this.dataForm.unit
             this.$emit('addItem', this.dataForm)
           }
         })