Browse Source

提交金额反向计算单价

caojunjie 3 years ago
parent
commit
66eb989c96

+ 4 - 2
src/api/warehouse/inStock.js

@@ -27,11 +27,13 @@ export function addSave(data) {
   })
 }
 // 获取项目名称
-export function getEntry(data) {
+export function getEntry(query) {
   return request({
     url: '/anpin/project/projectName',
     method: 'post',
-    data: data
+    data: {
+      projectName:query
+    }
   })
 }
 //获取仓库

+ 3 - 3
src/combination/listComponent.vue

@@ -94,7 +94,7 @@
                 :value="item.value"
               ></el-option>
             </el-select>
-            <el-input v-if="item.changeable == 2" @input="totalAmount(scope)" :disabled="item.disabled" v-model="scope.row[item.label]" placeholder="请输入内容" :onkeyup="item.onabort"></el-input>
+            <el-input v-if="item.changeable == 2" @input="totalAmount(scope,item)" :disabled="item.disabled" v-model="scope.row[item.label]" placeholder="请输入内容" :onkeyup="item.onabort"></el-input>
             <el-date-picker
               v-if="item.changeable == 3"
               v-model="scope.row[item.label]"
@@ -195,8 +195,8 @@ export default {
       this.$emit('change',scope)
     },
     //输入框数据变动时触发
-    totalAmount(scope){
-      this.$emit('totalAmount',scope)
+    totalAmount(scope,item){
+      this.$emit('totalAmount',scope,item)
     },
     //合计
     listTotal(param) {

+ 0 - 1
src/views/morePage/stock/index.vue

@@ -726,7 +726,6 @@ export default {
     approval(row) {
       console.log(row)
       if(row.audit == '审核通过' || row.audit == '审核退回'){
-        console.log("111")
         switch (row.refno4) {
           case "XS":
             this.$router.push({

+ 11 - 4
src/views/project/index.vue

@@ -215,34 +215,41 @@ export default {
         },
         {
           surface: "7",
+          label: "fCorpName",
+          name: "收费对象",
+          checked: 0,
+          width: 100,
+        },
+        {
+          surface: "8",
           label: "createBy",
           name: "录入人",
           checked: 0,
           width: 100,
         },
         {
-          surface: "8",
+          surface: "9",
           label: "createTime",
           name: "录入时间",
           checked: 0,
           width: 100,
         },
         {
-          surface: "9",
+          surface: "10",
           label: "updateBy",
           name: "最新修改人",
           checked: 0,
           width: 100,
         },
         {
-          surface: "10",
+          surface: "11",
           label: "updateTime",
           name: "最新修改时间",
           checked: 0,
           width: 100,
         },
         {
-          surface: "11",
+          surface: "12",
           label: "fBillstatusName",
           name: "审核状态",
           checked: 0,

+ 13 - 6
src/views/project/index1.vue

@@ -692,42 +692,49 @@ export default {
           width: 100,
         },
         {
-          surface: "6",
+          surface: "7",
+          label: "fCorpName",
+          name: "收费对象",
+          checked: 0,
+          width: 100,
+        },
+        {
+          surface: "8",
           label: "fAmtdr",
           name: "备注",
           checked: 0,
           width: 100,
         },
         {
-          surface: "7",
+          surface: "9",
           label: "createBy",
           name: "录入人",
           checked: 0,
           width: 100,
         },
         {
-          surface: "8",
+          surface: "10",
           label: "createTime",
           name: "录入时间",
           checked: 0,
           width: 100,
         },
         {
-          surface: "9",
+          surface: "11",
           label: "updateBy",
           name: "最新修改人",
           checked: 0,
           width: 100,
         },
         {
-          surface: "10",
+          surface: "12",
           label: "updateTime",
           name: "最新修改时间",
           checked: 0,
           width: 100,
         },
         {
-          surface: "11",
+          surface: "13",
           label: "fBillstatusName",
           name: "审核状态",
           checked: 0,

+ 10 - 3
src/views/purchaseIssue/index.vue

@@ -1040,9 +1040,16 @@ export default {
       this.query(this.formDataList)
     },
     //计算金额
-    totalAmount(scope) {
-      if (scope.row.fUnitprice && scope.row.fQty) {
-        scope.row.fAmount = (scope.row.fUnitprice * scope.row.fQty).toFixed(2)
+    totalAmount(scope,item) {
+      if (item.label === 'fAmount'){
+        if (scope.row.fAmount && scope.row.fQty) {
+          this.$set(scope.row,'fUnitprice',(scope.row.fAmount / scope.row.fQty).toFixed(2))
+        }
+      }
+      if (item.label === 'fUnitprice'||item.label === 'fQty'){
+        if (scope.row.fUnitprice && scope.row.fQty) {
+          this.$set(scope.row,'fAmount',(scope.row.fUnitprice * scope.row.fQty).toFixed(2))
+        }
       }
     },
     //查询公司

+ 10 - 4
src/views/purchaseRequest/index.vue

@@ -989,10 +989,16 @@ export default {
       this.query(this.formDataList)
     },
     //计算金额
-    totalAmount(scope) {
-      console.log(scope)
-      if (scope.row.fUnitprice && scope.row.fQty) {
-        scope.row.fAmount = (scope.row.fUnitprice * scope.row.fQty).toFixed(2)
+    totalAmount(scope,item) {
+      if (item.label === 'fAmount'){
+        if (scope.row.fAmount && scope.row.fQty) {
+          this.$set(scope.row,'fUnitprice',(scope.row.fAmount / scope.row.fQty).toFixed(2))
+        }
+      }
+      if (item.label === 'fUnitprice'||item.label === 'fQty'){
+        if (scope.row.fUnitprice && scope.row.fQty) {
+          this.$set(scope.row,'fAmount',(scope.row.fUnitprice * scope.row.fQty).toFixed(2))
+        }
       }
     },
     //查询公司

+ 22 - 5
src/views/warehouse/inStock/index.vue

@@ -503,7 +503,9 @@ export default {
           checked: 0,
           width: 100,
           operation: 2,
-          disabled: false
+          changeable: 2,
+          disabled: false,
+          onabort: 'this.value=this.value.replace(/[^\\-?\\d.]/g,"").replace(/^(\\-)*(\\d+)\\.(\\d\\d).*$/, "$1$2.$3")',
         }, {
           surface: '9',
           label: 'fStltypeid',
@@ -947,10 +949,15 @@ export default {
       })
     },
     //自动合计金额
-    totalAmount() {
-      for (let li in this.detailData) {
-        if (this.detailData[li].fUnitprice && this.detailData[li].fQty) {
-          this.detailData[li].fAmount = (this.detailData[li].fUnitprice * this.detailData[li].fQty).toFixed(2)
+    totalAmount(scope,item) {
+      if (item.label === 'fAmount'){
+        if (scope.row.fAmount && scope.row.fQty) {
+          this.$set(scope.row,'fUnitprice',(scope.row.fAmount / scope.row.fQty).toFixed(2))
+        }
+      }
+      if (item.label === 'fUnitprice'||item.label === 'fQty'){
+        if (scope.row.fUnitprice && scope.row.fQty) {
+          this.$set(scope.row,'fAmount',(scope.row.fUnitprice * scope.row.fQty).toFixed(2))
         }
       }
     },
@@ -986,6 +993,16 @@ export default {
             }
           })
         }
+        if (this.formOption[li].name == '项目名称') {
+          getEntry().then(res => {
+            for (let item in res.data) {
+              this.formOption[li].data.push({
+                label: res.data[item].projectName,
+                value: res.data[item].fId
+              })
+            }
+          })
+        }
         if (this.formOption[li].name == '供应商') {
           let queryParams = { pageNum: 1, fTypeid: 1 }
           getustomer(queryParams).then(res => {

+ 22 - 4
src/views/warehouse/outStock/index.vue

@@ -494,6 +494,9 @@ export default {
           checked: 0,
           width: 100,
           operation:2,
+          changeable:2,
+          disabled:false,
+          onabort: 'this.value=this.value.replace(/[^\\-?\\d.]/g,"").replace(/^(\\-)*(\\d+)\\.(\\d\\d).*$/, "$1$2.$3")',
         },{
           surface: "9",
           label: "fStltypeid",
@@ -939,10 +942,15 @@ export default {
       })
     },
     //自动合计金额
-    totalAmount(){
-      for(let li in this.detailData){
-        if(this.detailData[li].fUnitprice && this.detailData[li].fQty){
-          this.detailData[li].fAmount = (this.detailData[li].fUnitprice * this.detailData[li].fQty).toFixed(2)
+    totalAmount(scope,item) {
+      if (item.label === 'fAmount'){
+        if (scope.row.fAmount && scope.row.fQty) {
+          this.$set(scope.row,'fUnitprice',(scope.row.fAmount / scope.row.fQty).toFixed(2))
+        }
+      }
+      if (item.label === 'fUnitprice'||item.label === 'fQty'){
+        if (scope.row.fUnitprice && scope.row.fQty) {
+          this.$set(scope.row,'fAmount',(scope.row.fUnitprice * scope.row.fQty).toFixed(2))
         }
       }
     },
@@ -1000,6 +1008,16 @@ export default {
             }
           })
         }
+        if (this.formOption[li].name == '项目名称'){
+          getEntry().then(res => {
+            for (let item in res.data) {
+              this.formOption[li].data.push({
+                label: res.data[item].projectName,
+                value: res.data[item].fId
+              })
+            }
+          })
+        }
       }
     },
     //弹窗页获取下拉名称