caojunjie il y a 4 ans
Parent
commit
7818710383
1 fichiers modifiés avec 118 ajouts et 62 suppressions
  1. 118 62
      src/views/jiGang/index.vue

+ 118 - 62
src/views/jiGang/index.vue

@@ -170,11 +170,14 @@
         <el-button round icon="el-icon-arrow-left" @click="open" size="small">返回列表</el-button>
         <el-button type="primary" round size="small" @click="submitForm" icon="el-icon-edit">保 存</el-button>
         <el-button type="success" round size="small" @click="submit" icon="el-icon-check">提 交</el-button>
-        <el-button type="danger" round size="small" icon="el-icon-close" @click="cancellation" v-if="queryParams.fBillstatus >2">撤销提交</el-button>
+        <el-button type="danger" round size="small" icon="el-icon-close" @click="cancellation"
+                   v-if="queryParams.fBillstatus >2">撤销提交
+        </el-button>
       </div>
       <el-form
         :model="queryParams"
-        ref="queryForm"
+        ref="rules"
+        :rules="rules"
         :inline="true"
         label-width="88px"
       >
@@ -253,6 +256,7 @@
               remote
               :remote-method="corpsRemoteMethod"
               placeholder="客户名称"
+              :disabled="disabled"
             >
               <el-option
                 v-for="(dict, index) in KHblnoOptions"
@@ -275,6 +279,7 @@
               style="width: 80%"
               v-model="scope.row.fFeeUnitid"
               filterable
+              :disabled="disabled"
             >
               <el-option
                 v-for="(dict, index) in businessTypeOption"
@@ -299,6 +304,7 @@
               style="width: 80%"
               v-model="scope.row.fFeeid"
               filterable
+              :disabled="disabled"
             >
               <el-option
                 v-for="(dict, index) in fFeeid_s"
@@ -322,6 +328,7 @@
               v-model="scope.row.fInventoryDays"
               placeholder="请选择箱型"
               clearable
+              :disabled="disabled"
             >
               <el-option
                 v-for="(dict, index) in jFeetunitOptions"
@@ -344,7 +351,9 @@
               oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
               v-model="scope.row.fQty"
               placeholder="箱量"
+              @input="calculation(scope.row)"
               show-word-limit
+              :disabled="disabled"
             />
           </template>
         </el-table-column>
@@ -361,6 +370,8 @@
               v-model="scope.row.fUnitprice"
               placeholder="单价"
               show-word-limit
+              @input="calculation(scope.row)"
+              :disabled="disabled"
             />
           </template>
         </el-table-column>
@@ -373,6 +384,7 @@
         >
           <template slot-scope="scope">
             <el-input
+              :disabled="disabled"
               oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
               v-model="scope.row.fAmt"
               placeholder="金额"
@@ -391,7 +403,7 @@
                     deleteRow(scope.$index, warehouseDrList)
                   "
               size="small"
-              :disabled="browseStatus"
+              :disabled="disabled"
             >移除
             </el-button
             >
@@ -414,12 +426,14 @@
             type="primary"
             @click.prevent="addpayment()"
             size="small"
+            :disabled="disabled"
           >新行
           </el-button>
         </div>
       </div>
       <el-table
         :data="warehouseCrList"
+        :disabled="disabled"
         ref="table"
         tooltip-effect="dark"
         border
@@ -441,6 +455,7 @@
             <el-select
               v-model="scope.row.fCorpid"
               filterable
+              :disabled="disabled"
               remote
               :remote-method="corpsRemoteMethod"
               placeholder="客户名称"
@@ -466,6 +481,7 @@
               style="width: 80%"
               v-model="scope.row.fFeeUnitid"
               filterable
+              :disabled="disabled"
             >
               <el-option
                 v-for="(dict, index) in businessTypeOption"
@@ -488,6 +504,7 @@
               style="width: 80%"
               v-model="scope.row.fFeeid"
               filterable
+              :disabled="disabled"
             >
               <el-option
                 v-for="(dict, index) in fFeeid_s"
@@ -509,6 +526,7 @@
             <el-select
               v-model="scope.row.fInventoryDays"
               placeholder="请选择箱型"
+              :disabled="disabled"
               clearable
             >
               <el-option
@@ -529,9 +547,11 @@
         >
           <template slot-scope="scope">
             <el-input
+              :disabled="disabled"
               oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
               v-model="scope.row.fQty"
               placeholder="箱量"
+              @input="calculation(scope.row)"
               show-word-limit
             />
           </template>
@@ -545,8 +565,10 @@
         >
           <template slot-scope="scope">
             <el-input
+              :disabled="disabled"
               oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
               v-model="scope.row.fUnitprice"
+              @input="calculation(scope.row)"
               placeholder="单价"
               show-word-limit
             />
@@ -561,6 +583,7 @@
         >
           <template slot-scope="scope">
             <el-input
+              :disabled="disabled"
               oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
               v-model="scope.row.fAmt"
               placeholder="金额"
@@ -580,7 +603,7 @@
                     deleteRoww(scope.$index, warehouseCrList)
                   "
               size="small"
-              :disabled="browseStatus"
+              :disabled="disabled"
             >移除
             </el-button
             >
@@ -592,20 +615,33 @@
 </template>
 
 <script>
-import { listCorps, preservation, submit, allInformation,single ,singleDeletion,listCorps_s,revokeContainerPort} from '@/api/jiGang'
-import { listFees } from '@/api/basicdata/fees'
+import {
+  listCorps,
+  preservation,
+  submit,
+  allInformation,
+  single,
+  singleDeletion,
+  listCorps_s,
+  revokeContainerPort
+} from '@/api/jiGang'
+import {listFees} from '@/api/basicdata/fees'
 
 export default {
   name: 'jiGang',
   data() {
     return {
+      rules:{
+        fBsdate:[{required: true, message: ' ', trigger: 'blur'}],
+        fMblno:[{required: true, message: ' ', trigger: 'blur'}]
+      },
       showSearch: true,
       jiGang: false,
-      disabled:false,
+      disabled: false,
       agreementList: [],
       warehouseCrList: [],
       fCNameOptions: [],
-      fFeeid_s:[],
+      fFeeid_s: [],
       fStltypeOptions: [],
       jFeetunitOptions: [],
       KHblnoOptions: [],
@@ -615,29 +651,29 @@ export default {
       businessTypeOption: [],
       loading: true,
       blnoOptions: [],
-      single:true,
-      total:0,
+      single: true,
+      total: 0,
       query: {
         pageNum: 1,
         pageSize: 10
       },
-      selection:[],
+      selection: [],
       queryParams: {}
     }
   },
   created() {
     allInformation().then(res => {
       console.log(res)
-      if(res.data.corpList){
+      if (res.data.corpList) {
         this.KHblnoOptions = res.data.corpList
       }
-      if(res.data.pierList){
+      if (res.data.pierList) {
         this.businessTypeOption = res.data.pierList
       }
-      if(res.data.cntrList){
+      if (res.data.cntrList) {
         this.jFeetunitOptions = res.data.cntrList
       }
-      if(res.data.fees){
+      if (res.data.fees) {
         this.fFeeid_s = res.data.fees
       }
     })
@@ -666,7 +702,7 @@ export default {
       if (name == null || name === '') {
         return false
       }
-      let queryParams = { pageNum: 1, fName: name, type: 1 }
+      let queryParams = {pageNum: 1, fName: name, type: 1}
       listCorps(queryParams).then((response) => {
         console.log(response)
         this.fMblnoOptions = response.rows
@@ -701,37 +737,37 @@ export default {
     handleSelectionChange(selection) {
       console.log(selection)
       this.selection = selection
-      if (selection.length === 1){
+      if (selection.length === 1) {
         this.single = false
-      }else {
+      } else {
         this.single = true
       }
     },
-    handleUpdate(row){
+    handleUpdate(row) {
       let fId
-      if (this.selection.length == 1){
+      if (this.selection.length == 1) {
         fId = this.selection[0].fId
-      }else {
+      } else {
         fId = row.fId
       }
-      single(fId).then(res =>{
-        if (res.code === 200){
+      single(fId).then(res => {
+        if (res.code === 200) {
           this.jiGang = true
           this.queryParams = res.data.warehouseBills
           this.warehouseDrList = res.data.feesDrList
           this.warehouseCrList = res.data.feesCrList
-          this.warehouseDrList.fFeeUnitid = this.warehouseDrList.fFeeUnitid +''
-          this.warehouseCrList.fFeeUnitid = this.warehouseCrList.fFeeUnitid +''
-          if (this.queryParams.fBillstatus !== 2){
+          this.warehouseDrList.fFeeUnitid = this.warehouseDrList.fFeeUnitid + ''
+          this.warehouseCrList.fFeeUnitid = this.warehouseCrList.fFeeUnitid + ''
+          if (this.queryParams.fBillstatus !== 2) {
             this.disabled = true
-          }else {
+          } else {
             this.disabled = false
           }
         }
       })
     },
-    handleDelete(row){
-      singleDeletion(row.fId).then(res =>{
+    handleDelete(row) {
+      singleDeletion(row.fId).then(res => {
         console.log(res)
       })
     },
@@ -749,10 +785,10 @@ export default {
         fQty: '',
         fUnitprice: '',
         fAmt: '',
-        fFeeid:''
+        fFeeid: ''
       })
       this.fWbuOptions = []
-      let queryParams = { pageNum: 1, fDc: 'C' }
+      let queryParams = {pageNum: 1, fDc: 'C'}
       listFees(queryParams).then((response) => {
         this.fCNameOptions = response.rows
       })
@@ -764,40 +800,60 @@ export default {
       rows.splice(index, 1)
     },
     submitForm() {
-      let formDatae = new window.FormData()
-      formDatae.append('warehouseBills', JSON.stringify(this.queryParams))
-      formDatae.append('feesCr', JSON.stringify(this.warehouseDrList))
-      formDatae.append('feesDr', JSON.stringify(this.warehouseCrList))
-      preservation(formDatae).then(res => {
-        console.log(res)
-        if (res.code === 200){
-          this.$message.success('保存成功');
+      this.$refs["rules"].validate((valid) => {
+        if (valid) {
+          let formDatae = new window.FormData()
+          formDatae.append('warehouseBills', JSON.stringify(this.queryParams))
+          formDatae.append('feesDr', JSON.stringify(this.warehouseDrList))
+          formDatae.append('feesCr', JSON.stringify(this.warehouseCrList))
+          preservation(formDatae).then(res => {
+            console.log(res)
+            if (res.code === 200) {
+              this.$message.success('保存成功');
+              this.jiGang = false
+            }
+          })
         }
-      })
+      });
     },
     submit() {
-      let formDatae = new window.FormData()
-      formDatae.append('warehouseBills', JSON.stringify(this.queryParams))
-      formDatae.append('feesCr', JSON.stringify(this.warehouseDrList))
-      formDatae.append('feesDr', JSON.stringify(this.warehouseCrList))
-      submit(formDatae).then(res => {
-        console.log(res)
-        if(res.code === 200){
-          this.$message.success('提交成功');
+      this.$refs["rules"].validate((valid) => {
+        if (valid) {
+          let formDatae = new window.FormData()
+          formDatae.append('warehouseBills', JSON.stringify(this.queryParams))
+          formDatae.append('feesDr', JSON.stringify(this.warehouseDrList))
+          formDatae.append('feesCr', JSON.stringify(this.warehouseCrList))
+          submit(formDatae).then(res => {
+            console.log(res)
+            if (res.code === 200) {
+              this.$message.success('提交成功');
+              this.jiGang = false
+            }
+          })
         }
-      })
+      });
     },
-    cancellation(){
-      let formDatae = new window.FormData()
-      formDatae.append('warehouseBills', JSON.stringify(this.queryParams))
-      formDatae.append('feesCr', JSON.stringify(this.warehouseDrList))
-      formDatae.append('feesDr', JSON.stringify(this.warehouseCrList))
-      revokeContainerPort(formDatae).then(res => {
-        console.log(res)
-        if(res.code === 200){
-          this.$message.success('撤销成功');
+    cancellation() {
+      this.$refs["rules"].validate((valid) => {
+        if (valid) {
+          let formDatae = new window.FormData()
+          formDatae.append('warehouseBills', JSON.stringify(this.queryParams))
+          formDatae.append('feesDr', JSON.stringify(this.warehouseDrList))
+          formDatae.append('feesCr', JSON.stringify(this.warehouseCrList))
+          revokeContainerPort(formDatae).then(res => {
+            console.log(res)
+            if (res.code === 200) {
+              this.$message.success('撤销成功');
+            }
+          })
         }
-      })
+      });
+    },
+    calculation(row) {
+      console.log(row)
+      if (row.fQty && row.fUnitprice) {
+        row.fAmt = Number(row.fQty) * Number(row.fUnitprice)
+      }
     },
     addCollection() {
       this.warehouseDrList.push({
@@ -807,17 +863,17 @@ export default {
         fQty: '',
         fUnitprice: '',
         fAmt: '',
-        fFeeid:''
+        fFeeid: ''
       })
       this.fWbuOptions = []
-      let queryParams = { pageNum: 1, fDc: 'D' }
+      let queryParams = {pageNum: 1, fDc: 'D'}
       listFees(queryParams).then((response) => {
         this.fDNameOptions = response.rows
       })
     },
     // 付款合计
     warehouseDrSummaries(param) {
-      const { columns, data } = param
+      const {columns, data} = param
       const sums = []
       columns.forEach((column, index) => {
         if (index === 0) {