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

辅材采购入库单 新增页面缺少库存数量字段(用图3、图4查库存)
辅材列表/辅材收费标准 建议精确到小数点后2位

linwenxin преди 1 година
родител
ревизия
772a9f92c0

+ 21 - 6
src/views/auxiliaryFittings/auxiliaryDataManagement/auxiliaryChargeManagement/index.vue

@@ -221,8 +221,12 @@ export default {
             this.formData.selfWorkerAmount = ""
             this.formData.outWorkerAmount = ""
             this.$nextTick(() => {
-              this.formData.selfWebsitAmount = this.formData.normAmount - (this.formData.selfWorkerAmount || 0)
-              this.formData.outWebsitAmount = this.formData.normAmount - (this.formData.outWorkerAmount || 0)
+              this.formData.selfWebsitAmount = this.setNumber(
+                this.formData.normAmount - (this.formData.selfWorkerAmount || 0)
+              )
+              this.formData.outWebsitAmount = this.setNumber(
+                this.formData.normAmount - (this.formData.outWorkerAmount || 0)
+              )
             })
           }
         },
@@ -255,9 +259,13 @@ export default {
         events: {
           input: (val) => {
             if (Number(val) > this.formData.normAmount) {
-              this.formData.selfWorkerAmount = this.formData.normAmount
+              this.formData.selfWorkerAmount = this.setNumber(
+                this.formData.normAmount
+              )
             }
-            this.formData.selfWebsitAmount = this.formData.normAmount - this.formData.selfWorkerAmount
+            this.formData.selfWebsitAmount = this.setNumber(
+              this.formData.normAmount - this.formData.selfWorkerAmount
+            )
           }
         },
         slots: {
@@ -278,9 +286,13 @@ export default {
         events: {
           input: (val) => {
             if (Number(val) > this.formData.normAmount) {
-              this.formData.outWorkerAmount = this.formData.normAmount
+              this.formData.outWorkerAmount = this.setNumber(
+                this.formData.normAmount
+              )
             }
-            this.formData.outWebsitAmount = this.formData.normAmount - this.formData.outWorkerAmount
+            this.formData.outWebsitAmount = this.setNumber(
+              this.formData.normAmount - this.formData.outWorkerAmount
+            )
           }
         },
         slots: {
@@ -396,6 +408,9 @@ export default {
         this.$message({ type: 'success', message: `设置成功!` })
         this.$refs.pageRef.refreshList()
       })
+    },
+    setNumber(val) {
+      return Number(val.toFixed(2))
     }
   }
 }

+ 41 - 33
src/views/auxiliaryFittings/purchasingManagement/mixins/form_tpl.js

@@ -195,7 +195,7 @@ export default {
                             this.qkrow(row)
                             if (val) {
                               row['goodsCategoryName'] = selectList.find(item => item.categoryId == val).categoryName
-                              materialNormList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "b.category_id", "compare": "=", "value": val }] }).then(res => {
+                              materialNormList({ isShowStockQty: true, websitId: this.formData.websitId, "pageNum": 1, "pageSize": -1, "params": [{ "param": "b.category_id", "compare": "=", "value": val }] }).then(res => {
                                 this.materialNormList = res.data.records
                               })
                             } else {
@@ -342,7 +342,9 @@ export default {
                           onInput={(val) => {
                             row[column.columnAttributes.prop] = val
                             if (val) {
-                              row.costValue = Number(row.cost) * Number(val)
+                              row.costValue = this.setNumber(
+                                Number(row.cost) * Number(val)
+                              )
                             } else {
                               row.costValue = ""
                             }
@@ -378,7 +380,9 @@ export default {
                           onInput={(val) => {
                             row[column.columnAttributes.prop] = val
                             if (val) {
-                              row.retValue = Number(row.cost) * Number(val)
+                              row.retValue = this.setNumber(
+                                Number(row.cost) * Number(val)
+                              )
                             } else {
                               row.retValue = ""
                             }
@@ -496,7 +500,7 @@ export default {
           return []
         })(),
         ...(() => {
-          if (this.formData.flag === "SAVE" && !!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType)) {
+          if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials', 'partsStorage', 'partsReturn'].indexOf(this.pageType)) {
             return [{
               columnAttributes: {
                 label: '库存数量',
@@ -540,7 +544,7 @@ export default {
                               item.isEditRow = false
                             }
                             if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType) && row.goodsCategoryId) {
-                              materialNormList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "b.category_id", "compare": "=", "value": row.goodsCategoryId }] }).then(res => {
+                              materialNormList({ isShowStockQty: true, websitId: this.formData.websitId, "pageNum": 1, "pageSize": -1, "params": [{ "param": "b.category_id", "compare": "=", "value": row.goodsCategoryId }] }).then(res => {
                                 this.materialNormList = res.data.records
                               })
                             }
@@ -735,35 +739,36 @@ export default {
                 {!!~[0, 1].indexOf(this.formDialogType) ? <div style="margin-bottom:8px">
                   <el-button onClick={() => {
                     this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
-                      if (valid || !this.formData.items.length) {
-                        this.formData.items.map((item) => { item.isEditRow = false })
-                        this.formData.items.push({
-                          "brand": "",
-                          "companyWechatId": "",
-                          "cost": "",
-                          "costValue": "",
-                          "goodsCategoryId": "",
-                          "goodsCategoryName": "",
-                          "goodsCode": "",
-                          "goodsId": "",
-                          "goodsName": "",
-                          "goodsSpecification": "",
-                          "goodsStockUnit": "",
-                          "goodsType": "",
-                          "note": "",
-                          "parentCategoryId": "",
-                          "parentCategoryName": "",
-                          "productCategory": "",
-                          "purchaseId": "",
-                          "recQty": "",
-                          "retQty": "",
-                          "retValue": "",
-                          "stockQty": "",
-                          "websitId": "",
-                          "websitName": "",
-                          "isEditRow": true,
-                        })
+                      if (invalidFields.websitId || invalidFields.venderId) {
+                        return
                       }
+                      this.formData.items.map((item) => { item.isEditRow = false })
+                      this.formData.items.push({
+                        "brand": "",
+                        "companyWechatId": "",
+                        "cost": "",
+                        "costValue": "",
+                        "goodsCategoryId": "",
+                        "goodsCategoryName": "",
+                        "goodsCode": "",
+                        "goodsId": "",
+                        "goodsName": "",
+                        "goodsSpecification": "",
+                        "goodsStockUnit": "",
+                        "goodsType": "",
+                        "note": "",
+                        "parentCategoryId": "",
+                        "parentCategoryName": "",
+                        "productCategory": "",
+                        "purchaseId": "",
+                        "recQty": "",
+                        "retQty": "",
+                        "retValue": "",
+                        "stockQty": "",
+                        "websitId": "",
+                        "websitName": "",
+                        "isEditRow": true,
+                      })
                     })
                   }}>添加</el-button>
                 </div> : null}
@@ -908,5 +913,8 @@ export default {
     jiaoyan() {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => { }, false)
     },
+    setNumber(val) {
+      return Number(val.toFixed(2))
+    }
   },
 }