Преглед изворни кода

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-eom into dev

liujt пре 5 месеци
родитељ
комит
9da75d6237

+ 2 - 2
src/views/purchasingManage/inquiryManage/components/inquiryTable.vue

@@ -940,8 +940,8 @@
       //改变数量
       changeCount(row, index) {
         this.$set(
-          this.form,
-          'resultList[' + index + ']',
+          this.form.resultList,
+          index,
           changeCount(row, {
             countKey: 'purchaseCount',
             unitKey: 'purchaseUnit',

+ 2 - 2
src/views/purchasingManage/purchaseNeedManage/components/inventoryTable.vue

@@ -965,8 +965,8 @@
       //改变数量
       changeCount(row, index) {
         this.$set(
-          this.form,
-          'datasource[' + index + ']',
+          this.form.datasource,
+          index,
           changeCount(row, {
             countKey: 'purchaseCount',
             unitKey: 'purchaseUnit',

+ 41 - 33
src/views/purchasingManage/purchasePlanManage/components/inventoryTable.vue

@@ -610,7 +610,7 @@
             showOverflowTooltip: true,
             formatter: (row, column) => {
               if (row.reqTotalCount) {
-                return row.reqTotalCount + ' ' +( row.measuringUnit || '');
+                return row.reqTotalCount + ' ' + (row.measuringUnit || '');
               }
             },
             align: 'center'
@@ -920,8 +920,8 @@
       //改变数量
       changeCount(row, index) {
         this.$set(
-          this.form,
-          'datasource[' + index + ']',
+          this.form.datasource,
+          index,
           changeCount(row, {
             countKey: 'purchaseCount',
             unitKey: 'purchaseUnit',
@@ -1283,47 +1283,55 @@
           callback(valid);
         });
       },
-      validateForm(callback) { 
-        //开始表单校验 
-        this.$refs.form.validate((valid, obj) => { 
-          console.log(valid, obj); 
-          if (obj) { 
-            let messages = Object.keys(obj).map((key) => obj[key][0]); 
-            if (messages.length > 0) { 
-              this.$message.warning(messages[0].message); 
-            } 
-          } 
+      validateForm(callback) {
+        //开始表单校验
+        this.$refs.form.validate((valid, obj) => {
+          console.log(valid, obj);
+          if (obj) {
+            let messages = Object.keys(obj).map((key) => obj[key][0]);
+            if (messages.length > 0) {
+              this.$message.warning(messages[0].message);
+            }
+          }
           // 如果表单校验未通过,不需要进行下面的额外校验
           if (valid) {
             // 额外校验数量和到货日期是否填写
-            if (this.form && this.form.datasource) { 
-              let isDataSourceValid = true; 
+            if (this.form && this.form.datasource) {
+              let isDataSourceValid = true;
               let errorItemIndex = -1;
-              for (let i = 0; i < this.form.datasource.length; i++) { 
-                const item = this.form.datasource[i]; 
+              for (let i = 0; i < this.form.datasource.length; i++) {
+                const item = this.form.datasource[i];
                 // 检查数量和到货日期是否填写(数量可以为0)
-                if (item.totalCount == null || item.totalCount === '' || !item.expectReceiveDate) { 
-                  isDataSourceValid = false; 
-                  errorItemIndex = i; 
-                  break; // 找到第一个未填写的项目 
-                } 
-              } 
-              // 如果有未填写的项目 
-              if (!isDataSourceValid) { 
-                this.$message.warning(`第${errorItemIndex + 1}项数据未完整填写,请检查数量和到货日期`); 
+                if (
+                  item.totalCount == null ||
+                  item.totalCount === '' ||
+                  !item.expectReceiveDate
+                ) {
+                  isDataSourceValid = false;
+                  errorItemIndex = i;
+                  break; // 找到第一个未填写的项目
+                }
+              }
+              // 如果有未填写的项目
+              if (!isDataSourceValid) {
+                this.$message.warning(
+                  `第${
+                    errorItemIndex + 1
+                  }项数据未完整填写,请检查数量和到货日期`
+                );
                 // let currentPage = this.$refs.table.tablePage;
                 // const pageSize = this.$refs.table.tableLimit; // 每页显示10条数据
                 // const targetPage = Math.floor(errorItemIndex / pageSize) + 1; // 计算目标页码
                 // if (currentPage !== targetPage) {
                 //   currentPage = targetPage;
                 //   this.$refs.table.reload({ page: currentPage });
-                // } 
-                valid = false; 
-              } 
-            } 
-          } 
-          callback(valid); 
-        }); 
+                // }
+                valid = false;
+              }
+            }
+          }
+          callback(valid);
+        });
       }
     }
   };