Browse Source

Merge branch 'master' of http://git.echepei.com/zhujiawei/Warehouse_management_ui

翁玉文 4 years ago
parent
commit
4022863549
1 changed files with 68 additions and 13 deletions
  1. 68 13
      src/views/finance/charge/index.vue

+ 68 - 13
src/views/finance/charge/index.vue

@@ -14,7 +14,7 @@
         <el-input
           v-model="queryParams_s.fCtrlcorpid"
           placeholder="请输入货权方"
-          clearablef
+          clearable
           size="small"
           @keyup.enter.native="handleQuery"
         />
@@ -249,10 +249,10 @@
           </template>
         </el-table-column>
         <el-table-column label="费用名称" align="center" prop="fFeeName"/>
-        <el-table-column label="收/付" align="center" prop="fDc">
+        <el-table-column label="收/付" align="center" prop="fSrcdc">
           <template slot-scope="scope">
-            <span v-if="scope.row.fDc =='D'">收</span>
-            <span v-else="scope.row.fDc =='C'">付</span>
+            <span v-if="scope.row.fSrcdc =='D'">收</span>
+            <span v-else-if="scope.row.fSrcdc =='C'">付</span>
           </template>
         </el-table-column>
         <el-table-column label="业务类型" align="center" prop="fBilltype">
@@ -279,7 +279,7 @@
         </el-table-column>
       </el-table>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button type="primary" @click="submitForm">保 存</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
       <el-dialog :close-on-click-modal="false" width="70%" :visible.sync="innerVisible" title="导入数据" append-to-body>
@@ -377,9 +377,9 @@
             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery_s">重1置</el-button>
           </el-form-item>
         </el-form>
-        <el-table v-loading="loading" :data="chargeList_s" @selection-change="handleSelectionChange_s">
+        <el-table v-loading="loading" :data="chargeList_s" show-summary :summary-method="getSummaries" @selection-change="handleSelectionChange_s">
           <el-table-column type="selection" width="55" align="center"/>
-          <el-table-column label="序号" type="index" width="55" align="center"/>
+          <el-table-column label="序2号" type="index" width="55" align="center"/>
           <el-table-column label="货权方" align="center" prop="fName"/>
           <el-table-column label="提单号" align="center" prop="fMblno"/>
           <el-table-column label="品名" align="center" prop="fProductName"/>
@@ -487,8 +487,16 @@ export default {
         timeExamine: '',
         timeInterval: ''
       },
+      //导入从表传主表
+      pass:{
+        fAmtdr:'',    //应收合计
+        fAmtcr:'',    //应付合计
+        fMblno:'',    //提单号
+        fName:''      //货权方
+      },
       // 查询参数
       queryParams: {
+        fId: null,
         pageNum: 1,
         pageSize: 10,
         fBillno: null,
@@ -557,6 +565,28 @@ export default {
     this.getList()
   },
   methods: {
+    getSummaries(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        const values = data.map(item => Number(item[column.property]));
+        if (!values.every(value => isNaN(value))) {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[0] = '合计';
+          sums[3] = '';
+          this.pass.fAmtdr = sums[9]
+          this.pass.fAmtcr = sums[10]
+        }
+      });
+      return sums;
+    },
     imgChange1(fAmtdr,fAmt){
       if (fAmt <= fAmtdr){
         console.log("小了!")
@@ -578,13 +608,23 @@ export default {
           for (let item in this.selection){
             console.log(this.selection[item])
             console.log(this.selection[item].fMblno)
+
+            console.log(this.selection[item].fName)
             if(item > 1){
-              this.fMblno = this.selection[item].fMblno + "..."
+              this.pass.fMblno = this.selection[item].fMblno + "..."
+              this.pass.fName = this.selection[item].fName + "..."
+
             }else if(item == 0){
-              this.fMblno = this.selection[item].fMblno
+              this.pass.fMblno = this.selection[item].fMblno
+              this.pass.fName = this.selection[item].fName
             }
           }
           this.increase_s = this.selection
+          this.queryParams.tMblno = this.pass.fMblno //提单号
+          this.queryParams.fCtrlcorpid = this.pass.fName
+          this.queryParams.fAmtcr = this.pass.fAmtcr
+          this.queryParams.fAmtdr = this.pass.fAmtdr
+          console.log(this.queryParams)
           this.innerVisible = false
           this.chargeList_s = []
           this.queryParameter = {
@@ -597,7 +637,6 @@ export default {
             timeInterval: ''
           }
         }
-        this.queryParams.tMblno = this.fMblno
       }else if(this.state_s == false){
         this.$message.error('本次金额不能大于原定金额');
       }
@@ -751,7 +790,7 @@ export default {
         this.fWbuOptions = response.data.feesList
         this.fMblnoOptions = response.data.corps
         this.open = true
-        this.title = '修改财务数据主'
+        this.title = '修改收费列表'
       })
     },
     /** 提交按钮 */
@@ -760,8 +799,10 @@ export default {
       this.$refs['ruless'].validate(valid => {
         console.log(valid)
         if (valid) {
-          console.log(this.queryParams)
-            this.chargeList.fBillstatus = '1'
+          if(this.queryParams.fId == null){
+            console.log(this.queryParams)
+            // this.chargeList.fBillstatus = '1'
+            this.queryParams.fBillstatus = '1'
             let formData = new window.FormData()
             formData.append('tFee', JSON.stringify(this.queryParams))
             formData.append('tFeeDo', JSON.stringify(this.increase_s))
@@ -771,6 +812,20 @@ export default {
               this.open = false
               this.getList()
             })
+          }else {
+            console.log(this.queryParams)
+            // this.chargeList.fBillstatus = '1'
+            this.queryParams.fBillstatus = '1'
+            let formData = new window.FormData()
+            formData.append('tFee', JSON.stringify(this.queryParams))
+            formData.append('tFeeDo', JSON.stringify(this.increase_s))
+            addCharge(formData).then(response => {
+              this.msgSuccess('修改成功')
+              this.increase_s = []
+              this.open = false
+              this.getList()
+            })
+          }
         }
       })
     },