Ver Fonte

修改材料定额验证

695593266@qq.com há 9 meses atrás
pai
commit
9f57caf8c3

+ 13 - 18
src/views/material/BOMmanage/components/attribute.vue

@@ -364,24 +364,7 @@
             value: 4
           }
         ],
-        attributeList: [
-          {
-            label: '总装',
-            value: 1
-          },
-          {
-            label: '部件',
-            value: 2
-          },
-          {
-            label: '零件',
-            value: 3
-          },
-          {
-            label: '原材料',
-            value: 4
-          }
-        ],
+        attributeList: [],
         // dictList: [],
 
         rules: {
@@ -398,6 +381,7 @@
 
     created() {
       // this.getDictList('productionType');
+      this.getAttriButeList('inventory_type');
     },
 
     beforeDestroy() {},
@@ -414,6 +398,17 @@
         });
       },
 
+      async getAttriButeList(code) {
+        let { data: res } = await getByCode(code);
+        this.attributeList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+      },
+
       handleUpdate() {
         this.$refs.form.validate(async (valid) => {
           if (valid) {

+ 14 - 1
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -1753,7 +1753,6 @@
               );
               this.tableData.taskParam[this.currentIndex].beatParam =
                 this.beatParam;
-              // 保存标准工时
 
               // 保存材料定额
               this.tableData.taskParam[this.currentIndex].baseCount =
@@ -1761,6 +1760,20 @@
               this.tableData.taskParam[this.currentIndex].baseCountUnit =
                 this.form.baseCountUnit;
 
+              const isCount = this.tableData.taskParam[
+                this.currentIndex
+              ].materialQuota.every((item) => {
+                if (!item.count) {
+                  return false;
+                }
+                return true;
+              });
+
+              if (!isCount) {
+                this.$message.warning('材料定额数量不能为空');
+                return;
+              }
+
               this.tableData.taskParam[this.currentIndex].baseCount2 =
                 this.baseCount2;
               this.tableData.taskParam[this.currentIndex].baseCountUnit2 =