Browse Source

调整协议管理-仓储费bug

阿伏兔 4 years ago
parent
commit
a8202409e9
1 changed files with 66 additions and 166 deletions
  1. 66 166
      src/views/warehouseBusiness/agreement/index.vue

+ 66 - 166
src/views/warehouseBusiness/agreement/index.vue

@@ -101,28 +101,6 @@
         >新增
         </el-button>
       </el-col>
-<!--      <el-col :span="1.5">-->
-<!--        <el-button-->
-<!--          type="success"-->
-<!--          icon="el-icon-edit"-->
-<!--          size="mini"-->
-<!--          :disabled="single"-->
-<!--          @click="handleUpdate"-->
-<!--          v-hasPermi="['agreement:agreementStorage:edit']"-->
-<!--        >修改-->
-<!--        </el-button>-->
-<!--      </el-col>-->
-<!--      <el-col :span="1.5">-->
-<!--        <el-button-->
-<!--          type="danger"-->
-<!--          icon="el-icon-delete"-->
-<!--          size="mini"-->
-<!--          :disabled="multiple"-->
-<!--          @click="handleDelete"-->
-<!--          v-hasPermi="['agreement:agreementStorage:remove']"-->
-<!--        >删除-->
-<!--        </el-button>-->
-<!--      </el-col>-->
       <el-col :span="1.5">
         <el-button
           type="warning"
@@ -164,12 +142,12 @@
       </el-table-column>
       <el-table-column label="状态" align="center" prop="fBillstatus">
         <template slot-scope="scope">
-          <span v-if="scope.row.fBillstatus == '1'">保存</span>
-          <span v-else-if="scope.row.fBillstatus == '2'">暂存</span>
-          <span v-else-if="scope.row.fBillstatus == '3'">审批驳回</span>
-          <span v-else-if="scope.row.fBillstatus == '4'">提交审核</span>
-          <span v-else-if="scope.row.fBillstatus == '5'">审核中</span>
-          <span v-else-if="scope.row.fBillstatus == '6'">审核完成</span>
+          <span v-if="scope.row.fBillstatus === '1'">保存</span>
+          <span v-else-if="scope.row.fBillstatus === '2'">暂存</span>
+          <span v-else-if="scope.row.fBillstatus === '3'">审批驳回</span>
+          <span v-else-if="scope.row.fBillstatus === '4'">提交审核</span>
+          <span v-else-if="scope.row.fBillstatus === '5'">审核中</span>
+          <span v-else-if="scope.row.fBillstatus === '6'">审核完成</span>
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -188,7 +166,7 @@
             icon="el-icon-view"
             @click="check(scope.row,1)"
             v-hasPermi="['agreement:agreementStorage:edit']"
-            v-if="scope.row.fBillstatus == 4 || scope.row.fBillstatus == 5"
+            v-if="scope.row.fBillstatus === '4' || scope.row.fBillstatus === '5'"
           >审批进度
           </el-button>
 
@@ -212,16 +190,7 @@
           </el-button>
         </template>
       </el-table-column>
-      <!--      <el-table-column label="业务编号" align="center" prop="fBillno" />-->
-      <!--      <el-table-column label="制单部门" align="center" prop="fDeptid" />-->
-      <!--      <el-table-column label="结算方式" align="center" prop="fStltypeid" :formatter="fStltypeidFormat" />-->
-      <!--      <el-table-column label="费用类型" align="center" prop="fFeetypeid" />-->
-      <!--      <el-table-column label="货物类别" align="center" prop="tPackages" :formatter="tPackagesFormat" />-->
-      <!--      <el-table-column label="贸易方式" align="center" prop="fTrademodeid" :formatter="fTrademodeidFormat" />-->
-      <!--      <el-table-column label="免堆天数" align="center" prop="fFreedays" />-->
-      <!--      <el-table-column label="备注" align="center" prop="remark" />-->
     </el-table>
-
     <pagination
       v-show="total>0"
       :total="total"
@@ -229,7 +198,6 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
-
     <!-- 添加或修改仓储费对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="65%" append-to-body :show-close="colseButton"
                :close-on-click-modal="false"
@@ -331,7 +299,6 @@
             </el-select>
           </template>
         </el-table-column>
-
         <el-table-column label="开始天数" align="center">
           <template slot-scope="scope">
             <el-input
@@ -413,13 +380,13 @@
             </el-select>
           </template>
         </el-table-column>
-
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
           <template slot-scope="scope">
             <el-button
               size="mini"
               type="text"
               icon="el-icon-delete"
+              :disabled="browseStatus"
               @click.native.prevent="deleteRow(scope.$index, agreementitemsList)"
             >删除
             </el-button>
@@ -430,9 +397,9 @@
         <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
         <approval-comments v-if="addOrUpdateVisib" ref="ApprovalComments" @refreshDataList="returnData"></approval-comments>
         <el-button v-if="approve === true" @click="goApproval">审批</el-button>
-        <el-button type="danger" :disabled="disappear" @click="backApproval" v-if="form.fBillstatus == '4' && Operator == Lander">撤销审批</el-button>
+        <el-button type="danger" @click="backApproval" v-if="form.fBillstatus === '4' && operator === lander">撤销审批</el-button>
         <el-button type="info" v-if="form.fBillstatus >= 3" @click="addOrUpdateHandle()">查看审批流</el-button>
-        <el-button type="success" @click="backrRconciliation" v-if="form.fBillstatus == '6'">撤销请核</el-button>
+        <el-button type="success" @click="backrRconciliation" v-if="form.fBillstatus === '6'">撤销请核</el-button>
         <el-button type="primary" @click="submitForm" :disabled="notChange">保 存</el-button>
         <el-button v-if="cancelButton === true" @click="cancel">取 消</el-button>
         <el-button v-if="cancelButton === false" @click="homePage">取消</el-button>
@@ -451,7 +418,6 @@ import {
   getAgreement,
   delAgreement,
   addAgreement,
-  updateAgreement,
   updateAgreement_s,
   exportAgreement,
   listAgreementitems,
@@ -482,7 +448,6 @@ export default {
       approve:false,
       addOrUpdateVisible: false,
       addOrUpdateVisib:false,
-      disappear: false,
       notChange: false,
       dataList: '',
       value_s: [],
@@ -532,7 +497,8 @@ export default {
       // 仓储费明细表表格数据
       agreementitemsList: [],
       // 操作人
-      Operator: '',
+      operator: '',
+      lander: '',
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -652,7 +618,6 @@ export default {
         this.open = true
         this.notChange = true
         this.approve = true
-        this.disappear = true
         this.cancelButton = false
         this.reset()
         getAgreement(this.approval.billId).then(response => {
@@ -698,54 +663,26 @@ export default {
     },
     register() {
       queryUserVal().then((response) => {
-        this.Lander = response.user.userName
+        this.lander = response.user.userName
       })
     },
     check_s(row, res) {
-      this.disappear = true
       this.notChange = true
       this.browseStatus = true
+      this.register()
       getAgreement(row.fId).then(response => {
-        this.Operator = response.data.corps.createBy
         this.deptName = response.data.dept.deptName
         this.form = response.data.tWarehouseAgreement
+        this.operator = this.form.createBy
         this.fMblnoOptions = response.data.corps
         this.agreementitemsList = response.data.tWarehouseAgreementitems
         for (let item in this.agreementitemsList) {
           this.$set(this.agreementitemsList[item], 'fFeeunitid', this.agreementitemsList[item].fFeeunitid + '')
-          // this.fWRemoteMethod(this.agreementitemsList[item].fFeeid)
         }
         this.fWbuOptions = response.data.feesList
         this.add = row
         this.title = '修改仓储费'
-        // if (res == 1) {
-        //   this.notChange = true
-        //   if (this.Operator == this.Lander) {
-        //     this.disappear = false
-        //     this.reset()
-        //     // const fId = row.fId || this.ids
-        //     getAgreement(row.fId).then(response => {
-        //       this.deptName = response.data.dept.deptName
-        //       this.form = response.data.tWarehouseAgreement
-        //       this.fMblnoOptions = response.data.corps
-        //       this.agreementitemsList = response.data.tWarehouseAgreementitems
-        //       for (let item in this.agreementitemsList) {
-        //         this.$set(this.agreementitemsList[item], 'fFeeunitid', this.agreementitemsList[item].fFeeunitid + '')
-        //         // this.fWRemoteMethod(this.agreementitemsList[item].fFeeid)
-        //       }
-        //       this.fWbuOptions = response.data.feesList
-        //       this.add = row
-        //       this.open = true
-        //     })
-        //   }else {
-        //     this.notChange = true
-        //   }
-        // }else{
-        //   this.notChange = true
-        //   this.reset()
-        // }
       })
-      const fId = row.fId || this.ids
       getAgreement(row.fId).then(response => {
         this.deptName = response.data.dept.deptName
         this.form = response.data.tWarehouseAgreement
@@ -753,75 +690,31 @@ export default {
         this.agreementitemsList = response.data.tWarehouseAgreementitems
         for (let item in this.agreementitemsList) {
           this.$set(this.agreementitemsList[item], 'fFeeunitid', this.agreementitemsList[item].fFeeunitid + '')
-          // this.fWRemoteMethod(this.agreementitemsList[item].fFeeid)
         }
         this.fWbuOptions = response.data.feesList
         this.add = row
         this.open = true
       })
     },
-
     // 查看按钮
     check(row, res) {
-      this.disappear = false
       this.notChange = true
       this.browseStatus = true
+      this.register()
       getAgreement(row.fId).then(response => {
-        console.log(response.data.corps[0].createBy)
-        this.Operator = response.data.corps[0].createBy
         this.deptName = response.data.dept.deptName
         this.form = response.data.tWarehouseAgreement
+        this.operator = this.form.createBy
         this.fMblnoOptions = response.data.corps
         this.agreementitemsList = response.data.tWarehouseAgreementitems
         for (let item in this.agreementitemsList) {
           this.$set(this.agreementitemsList[item], 'fFeeunitid', this.agreementitemsList[item].fFeeunitid + '')
-          // this.fWRemoteMethod(this.agreementitemsList[item].fFeeid)
         }
         this.fWbuOptions = response.data.feesList
         this.add = row
         this.title = '修改仓储费'
-        // if (res == 1) {
-        //   this.notChange = true
-        //   if (this.Operator == this.Lander) {
-        //     this.disappear = false
-        //     this.reset()
-        //     // const fId = row.fId || this.ids
-        //     getAgreement(row.fId).then(response => {
-        //       this.deptName = response.data.dept.deptName
-        //       this.form = response.data.tWarehouseAgreement
-        //       this.fMblnoOptions = response.data.corps
-        //       this.agreementitemsList = response.data.tWarehouseAgreementitems
-        //       for (let item in this.agreementitemsList) {
-        //         this.$set(this.agreementitemsList[item], 'fFeeunitid', this.agreementitemsList[item].fFeeunitid + '')
-        //         // this.fWRemoteMethod(this.agreementitemsList[item].fFeeid)
-        //       }
-        //       this.fWbuOptions = response.data.feesList
-        //       this.add = row
-        //       this.open = true
-        //     })
-        //   }else {
-        //     this.notChange = true
-        //   }
-        // }else{
-        //   this.notChange = true
-        //   this.reset()
-        // }
-      })
-      const fId = row.fId || this.ids
-      getAgreement(row.fId).then(response => {
-        console.log(response)
-        this.deptName = response.data.dept.deptName
-        this.form = response.data.tWarehouseAgreement
-        this.fMblnoOptions = response.data.corps
-        this.agreementitemsList = response.data.tWarehouseAgreementitems
-        for (let item in this.agreementitemsList) {
-          this.$set(this.agreementitemsList[item], 'fFeeunitid', this.agreementitemsList[item].fFeeunitid + '')
-          // this.fWRemoteMethod(this.agreementitemsList[item].fFeeid)
-        }
-        this.fWbuOptions = response.data.feesList
-        this.add = row
-        this.open = true
       })
+      this.open = true
     },
     //撤销审批
     backApproval() {
@@ -848,24 +741,48 @@ export default {
         this.msgSuccess('撤销成功')
         this.open = false
         this.getList()
-        this.disappear = false
       })
     },
     // 请核按钮
     submit() {
-      if (this.agreementitemsList.length !== 0) {
-        this.open = false
-        let formData = new window.FormData()
-        // 附件数据
-        formData.append('agreement', JSON.stringify(this.form))
-        formData.append('agreementitems', JSON.stringify(this.agreementitemsList))
-        PleaseCheck(formData).then(response => {
-          this.msgSuccess('请核成功')
-          this.getList()
-        })
-      } else {
+      if (this.agreementitemsList.length <= 0) {
         this.$message.error('仓储费协议明细为空,无法操作')
+        return false
+      }
+      for (let agr = 0; agr < this.agreementitemsList.length; agr ++) {
+        if (!this.agreementitemsList[agr].fFeeunitid) {
+          this.$message.error('请维护仓储费明细计价单位')
+          return false
+        }
+        if (!this.agreementitemsList[agr].fFromdays) {
+          this.$message.error('请维护仓储费明细开始天数')
+          return false
+        }
+        if (!this.agreementitemsList[agr].fEndays) {
+          this.$message.error('请维护仓储费明细结束天数')
+          return false
+        }
+        if (!this.agreementitemsList[agr].fPrice) {
+          this.$message.error('请维护仓储费明细单价')
+          return false
+        }
+        if (!this.agreementitemsList[agr].fFeeid) {
+          this.$message.error('请维护仓储费明细费用名称')
+          return false
+        }
       }
+      this.$refs['form'].validate(valid => {
+        if (valid) {
+          let formData = new window.FormData()
+          formData.append('agreement', JSON.stringify(this.form))
+          formData.append('agreementitems', JSON.stringify(this.agreementitemsList))
+          PleaseCheck(formData).then(response => {
+            this.msgSuccess('请核成功')
+            this.open = false
+            this.getList()
+          })
+        }
+      })
     },
     // 仓储费状态修改
     handleStatusChange(row) {
@@ -971,12 +888,14 @@ export default {
     cancel() {
       this.open = false
       this.reset()
+      this.getList()
       this.agreementitemsList = []
     },
     handleClose() {
       this.open = false
-      this.agreementitemsList = []
       this.reset()
+      this.getList()
+      this.agreementitemsList = []
     },
     // 表单重置
     reset() {
@@ -1096,7 +1015,6 @@ export default {
       })
     },
     debounce(fn, delay) {
-      console.log("防抖触发")
       let timerId = null;
       return function () {
         let self = this;
@@ -1107,36 +1025,18 @@ export default {
         }, delay || 1000);
       }
     },
-    /** 提交按钮 */
+    /** 保存按钮 */
     submitForm() {
       this.$refs['form'].validate(valid => {
         if (valid) {
-          if (this.form.fId != null) {
-            updateAgreement(this.form).then(response => {
-              let formData = new window.FormData()
-              // 附件数据
-              formData.append('agreement', JSON.stringify(this.form))
-              formData.append('agreementitems', JSON.stringify(this.agreementitemsList))
-              addAgreement(formData).then(response => {
-                this.msgSuccess('修改成功')
-                // this.open = false
-                this.getList()
-                // this.agreementitemsList = []
-              })
-            })
-          } else {
-            let formData = new window.FormData()
-            // 附件数据
-            formData.append('agreement', JSON.stringify(this.form))
-            formData.append('agreementitems', JSON.stringify(this.agreementitemsList))
-            addAgreement(formData).then(response => {
-              this.msgSuccess('新增成功')
-              // this.open = false
-              this.form.fId  = response.data.tWarehouseAgreement.fId;
-              this.getList()
-              // this.agreementitemsList = []
-            })
-          }
+          let formData = new window.FormData()
+          formData.append('agreement', JSON.stringify(this.form))
+          formData.append('agreementitems', JSON.stringify(this.agreementitemsList))
+          addAgreement(formData).then(response => {
+            this.msgSuccess('操作成功')
+            this.$set(this.form, 'fId', response.data.tWarehouseAgreement.fId)
+            this.$set(this.form, 'fBillsStatus', response.data.tWarehouseAgreement.fBillsStatus)
+          })
         }
       })
     },