Selaa lähdekoodia

提交合同管理

Lijy 7 kuukautta sitten
vanhempi
commit
d3a2ecdc6c

+ 107 - 90
fhKeeper/formulahousekeeper/timesheet/src/views/contract/components/customContract.vue

@@ -96,8 +96,8 @@
       <el-table-column prop="useDepartment" label="使用部门" min-width="190"></el-table-column>
       <el-table-column prop="fundsSource" label="经费来源" min-width="190">
         <template slot-scope="scope">
-          <span v-if="scope.row.payWay == 1">科研</span>
-          <span v-if="scope.row.payWay == 2">其他(专项等)</span>
+          <span v-if="scope.row.fundsSource == 1">科研</span>
+          <span v-if="scope.row.fundsSource == 2">其他(专项等)</span>
         </template>
       </el-table-column>
       <el-table-column prop="undertaker" label="合同承办人" min-width="190"></el-table-column>
@@ -114,18 +114,6 @@
       </el-table-column>
       <el-table-column prop="amountsNoTax" label="合同金额(元)/不含税价" min-width="190"></el-table-column>
       <el-table-column prop="currency" label="币种" min-width="190"></el-table-column>
-      <el-table-column prop="payedAmount" label="已付款金额(元)" min-width="190"></el-table-column>
-      <el-table-column prop="payWay" label="付款类型" min-width="190">
-        <template slot-scope="scope">
-          <span v-if="scope.row.payWay == 1">预付</span>
-          <span v-if="scope.row.payWay == 2">报账</span>
-        </template>
-      </el-table-column>
-      <el-table-column prop="billNumber" label="凭证号" min-width="190"></el-table-column>
-      <el-table-column prop="reservedAmounts" label="已冲销金额" min-width="190"></el-table-column>
-      <el-table-column prop="reservedBillNumber" label="冲销凭证号" min-width="190"></el-table-column>
-      <el-table-column prop="totalPayedAmounts" label="付款总金额" min-width="190"></el-table-column>
-      <el-table-column prop="pendingAmounts" label="待付款金额" min-width="190"></el-table-column>
       <el-table-column prop="finishStatus" label="合同状态(是否结清)" min-width="190">
         <template slot-scope="scope">
           <span v-if="scope.row.finishStatus == 1">履约中</span>
@@ -157,7 +145,7 @@
       ></el-pagination>
     </el-col>
 
-    <el-dialog :title="dialogTitle + $t('he-tong')" :visible.sync="addDialog" v-if="addDialog" :close-on-click-modal="false" customClass="customWidth" width="900px" :top="'7.8vh'">
+    <el-dialog :title="dialogTitle + $t('he-tong')" :visible.sync="addDialog" v-if="addDialog" :close-on-click-modal="false" customClass="customWidth" width="1200px" :top="'7.8vh'">
       <div style="height: 72vh;overflow-y: auto;overflow-x: hidden;">
         <el-form ref="contractForm" :model="contractForm" label-width="160px" :rules="rules" class="contractForm">
           <el-form-item :label="$t('contractno')">
@@ -242,7 +230,7 @@
             <el-date-picker v-model="contractForm.filingsDate" value-format="yyyy-MM-dd" type="date" :placeholder="$t('optiondate')"></el-date-picker>
           </el-form-item>
           <el-form-item label="合同金额(元)/含税价">
-            <el-input v-model="contractForm.amounts" :placeholder="$t('peaseenterthe')" clearable>
+            <el-input v-model="contractForm.amounts" :placeholder="$t('peaseenterthe')" @change="chgPayedAmount()" clearable>
               <span slot="prefix">¥</span>
             </el-input>
           </el-form-item>
@@ -259,38 +247,6 @@
           <el-form-item label="币种">
             <el-input v-model="contractForm.currency" :placeholder="$t('peaseenterthe')" clearable></el-input>
           </el-form-item>
-          <el-form-item label="已付款金额(元)">
-            <el-input v-model="contractForm.payedAmount" :placeholder="$t('peaseenterthe')" clearable>
-              <span slot="prefix">¥</span>
-            </el-input>
-          </el-form-item>
-          <el-form-item label="付款类型">
-            <el-select v-model="contractForm.payWay" placeholder="请选择">
-              <el-option label="付款" :value="1"></el-option>
-              <el-option label="报账" :value="2"></el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="凭证号">
-            <el-input v-model="contractForm.billNumber" :placeholder="$t('peaseenterthe')" clearable></el-input>
-          </el-form-item>
-          <el-form-item label="已冲销金额">
-            <el-input v-model="contractForm.reservedAmounts" :placeholder="$t('peaseenterthe')" clearable>
-              <span slot="prefix">¥</span>
-            </el-input>
-          </el-form-item>
-          <el-form-item label="冲销凭证号">
-            <el-input v-model="contractForm.reservedBillNumber" :placeholder="$t('peaseenterthe')" clearable></el-input>
-          </el-form-item>
-          <el-form-item label="付款总金额">
-            <el-input v-model="contractForm.totalPayedAmounts" :placeholder="$t('peaseenterthe')" clearable>
-              <span slot="prefix">¥</span>
-            </el-input>
-          </el-form-item>
-          <el-form-item label="待付款金额">
-            <el-input v-model="contractForm.pendingAmounts" :placeholder="$t('peaseenterthe')" clearable>
-              <span slot="prefix">¥</span>
-            </el-input>
-          </el-form-item>
           <el-form-item label="合同状态(是否结清)">
             <el-select v-model="contractForm.finishStatus" placeholder="请选择">
               <el-option label="履约中" :value="1"></el-option>
@@ -304,9 +260,53 @@
             <el-input v-model="contractForm.remarks" :disabled="contractForm.status == 0" :placeholder="$t('peaseenterthe')" type="textarea" :rows="3" clearable></el-input>
           </el-form-item>
 
-          <el-form-item :label="$t('hui-kuan-ji-hua')">
+          <el-form-item label="付款计划">
             <el-table :data="contractPaymentList" size="small" :key="Math.random()" :height="'300px'" show-header="false" style="margin-top:10px;">
-                  <el-table-column prop="isPayed" >
+              <el-table-column prop="isPayed" width="120">
+                  <template slot-scope="scope">
+                      <el-checkbox v-model="scope.row.isPayed" >已付款</el-checkbox>
+                  </template>
+                  <template slot="header" >
+                      <span style="font-size:14px;font-weight:normal;">是否已付款</span>
+                  </template>
+              </el-table-column>
+                <el-table-column prop="payDate" label="付款日期" width="150">
+                  <template slot-scope="scope">
+                      <div><el-date-picker type="date" v-model="scope.row.payDate" style="width:140px;" :placeholder="$t('optiondate')" value-format="yyyy-MM-dd" size="small"></el-date-picker></div>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="payedAmount" label="已付款金额(元)" width="160">
+                  <template slot-scope="scope">
+                    <el-input-number v-model="scope.row.payedAmount" controls-position="right" @change="chgPayedAmount()" :min="0" size="small" :precision="2"></el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="payType" label="付款类型" width="140">
+                  <template slot-scope="scope">
+                    <el-select v-model="scope.row.payType" placeholder="请选择" size="small">
+                      <el-option label="预付" :value="1"></el-option>
+                      <el-option label="报账" :value="2"></el-option>
+                    </el-select>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="billNumber" label="凭证号" width="210">
+                  <template slot-scope="scope">
+                    <el-input v-model="scope.row.billNumber" :placeholder="$t('peaseenterthe')" clearable  size="small"></el-input>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="pendingAmounts" label="待付款金额(元)" width="210">
+                  <template slot-scope="scope">
+                    {{ scope.row.pendingAmounts }}
+                  </template>
+                </el-table-column>
+                <el-table-column width="80" fixed="right">
+                    <template slot-scope="scope">
+                        <el-button icon="el-icon-delete" size="mini" style="margin-left:10px;" @click.stop.native="deleteItem(scope.$index)"></el-button>
+                    </template>
+                    <template slot="header" >
+                        <el-link type="primary" :underline="false" @click="addItem">{{ $t('addTian') }}</el-link>
+                    </template>
+                </el-table-column>
+                  <!-- <el-table-column prop="isPayed" >
                       <template slot-scope="scope">
                           <el-checkbox v-model="scope.row.isPayed" >{{ $t('yi-hui-kuan') }}</el-checkbox>
                       </template>
@@ -334,7 +334,7 @@
                       <template slot="header" >
                           <el-link type="primary" :underline="false" @click="addItem">{{ $t('addTian') }}</el-link>
                       </template>
-                  </el-table-column>
+                  </el-table-column> -->
               </el-table>
           </el-form-item>
           
@@ -374,7 +374,7 @@
       </div>
     </el-dialog>
 
-    <el-dialog :title="$t('cha-kan-he-tong')" :visible.sync="lookoverDialog" v-if="lookoverDialog" :close-on-click-modal="false" customClass="customWidth" width="900px">
+    <el-dialog :title="$t('cha-kan-he-tong')" :visible.sync="lookoverDialog" v-if="lookoverDialog" :close-on-click-modal="false" customClass="customWidth" width="1200px" top="7.5vh">
       <div style="height: 72vh;overflow-y: auto;overflow-x: hidden;">
         <el-form label-width="160px" class="lookoverContract clearfix">
           <el-form-item :label="$t('contractno')">
@@ -454,25 +454,6 @@
           <el-form-item label="币种">
             {{contractForm.currency}}
           </el-form-item>
-          <el-form-item label="已付款金额(元)">
-            ¥ {{contractForm.payedAmount}}
-          </el-form-item>
-          <el-form-item label="付款类型">
-            <span v-if="contractForm.payWay">付款</span>
-            <span v-if="contractForm.payWay">报账</span>
-          </el-form-item>
-          <el-form-item label="凭证号">
-            {{contractForm.billNumber}}
-          </el-form-item>
-          <el-form-item label="已冲销金额">
-            ¥ {{contractForm.reservedAmounts}}
-          </el-form-item>
-          <el-form-item label="冲销凭证号">
-            {{contractForm.reservedBillNumber}}
-          </el-form-item>
-          <el-form-item label="付款总金额">
-            ¥ {{contractForm.totalPayedAmounts}}
-          </el-form-item>
           <el-form-item label="合同状态(是否结清)">
             <span v-if="contractForm.finishStatus == 1">履约中</span>
             <span v-else>履约完成</span>
@@ -484,27 +465,25 @@
           <el-form-item style="width:100%" :label="$t('bei-zhu')">
             {{contractForm.remarks}}
           </el-form-item>
-          <el-form-item style="width:100%" :label="$t('hui-kuan-ji-hua')">
+          <el-form-item style="width:100%" label="付款计划">
             <el-table :data="contractPaymentList" size="small" :key="Math.random()" :height="'300px'" show-header="false" style="margin-top:10px;">
                   <el-table-column prop="isPayed" >
                       <template slot-scope="scope">
-                        {{ scope.row.isPayed?$t('yi-hui-kuan'):$t('wei-hui-kuan') }}
+                        {{ scope.row.isPayed?'已付款':'未付款' }}
                       </template>
                       <template slot="header" >
-                          <span style="font-size:14px;font-weight:normal;">{{ $t('shi-fou-yi-hui-kuan') }}</span>
-                      </template>
-                  </el-table-column>
-                  <el-table-column prop="payDate"  :label="$t('hui-kuan-ri-qi')" width="210">
-                      <template slot-scope="scope">
-                          <div>{{ scope.row.payDate }}</div>
+                          <span style="font-size:14px;font-weight:normal;">是否已付款</span>
                       </template>
                   </el-table-column>
-                  
-                  <el-table-column prop="amount" :label="$t('hui-kuan-jin-e')">
-                      <template slot-scope="scope">
-                        <div>{{ scope.row.amount }}</div>
-                      </template>
+                  <el-table-column prop="payDate" label="付款日期" width="150"></el-table-column>
+                  <el-table-column prop="payedAmount" label="已付款金额(元)" width="160"></el-table-column>
+                  <el-table-column prop="payType" label="付款类型" width="140">
+                    <template slot-scope="scope">
+                      {{scope.row.payType?'预付':'报账'}}
+                    </template>
                   </el-table-column>
+                  <el-table-column prop="billNumber" label="凭证号" width="210"></el-table-column>
+                  <el-table-column prop="pendingAmounts" label="待付款金额(元)" width="180"></el-table-column>
               </el-table>
           </el-form-item>
           
@@ -712,6 +691,23 @@ export default {
     //   console.log('test',row);
     //   // this.$refs.uploadFile.submit()
     // },
+    chgPayedAmount() {
+      const { amounts } = this.contractForm
+      const list = this.contractPaymentList || []
+      let totalNum = +amounts || 0
+      if(amounts <= 0 || list.length <= 0) {
+        return
+      }
+      
+      for(let i in list) {
+        if(list[i].payedAmount) {
+          totalNum = totalNum - list[i].payedAmount
+          list[i].pendingAmounts = totalNum
+        }
+      }
+
+      this.contractPaymentList = list
+    },
     restrictNumber(targetId) {
                 let inpu = document.getElementById(targetId);
                 inpu.value = inpu.value.replace(/[^\d.]/g, "");  //仅保留数字和"."
@@ -747,8 +743,20 @@ export default {
         },
         //添加合同回款情况
         addItem() {
-            let p = 0;
-            this.contractPaymentList.push( { contractId:this.contractForm.id, isPayed:false,payDate: null, amount:0.0});
+            // let p = 0;
+            // this.contractPaymentList.push( { contractId:this.contractForm.id, isPayed:false,payDate: null, amount:0.0});
+            
+            let val = {
+              contractId:this.contractForm.id, 
+              isPayed:false,
+              payDate: null,
+              payedAmount: 0,
+              payType: 1,
+              billNumber: '',
+              pendingAmounts: 0,
+            }
+
+            this.contractPaymentList.push(val)
         },
         
         getProjectList() {
@@ -1013,6 +1021,11 @@ export default {
       this.http.post('/contract-payment/getList',{contractId: this.contractForm.id},
       res => {
         if(res.code == 'ok'){
+          res.data = res.data.map(item => ({
+            ...item,
+            payType: item.payType ? 1 : 0
+          }));
+          console.log(res.data, '<==== 数据')
           this.contractPaymentList = res.data;
         }else{
           this.$message({
@@ -1158,14 +1171,14 @@ export default {
               })
               return;
             }
-            if (!this.contractPaymentList[i].amount) {
+            if (!this.contractPaymentList[i].payedAmount) {
               this.$message({
                 message: this.$t('hui-kuan-jinebu-neng-wei-0'),
                 type: 'error'
               })
               return;
             }
-            totalPayment += parseFloat(this.contractPaymentList[i].amount);
+            totalPayment += parseFloat(this.contractPaymentList[i].payedAmount);
           }
           if (totalPayment > parseFloat(this.contractForm.amounts)) {
             this.$message({
@@ -1177,11 +1190,16 @@ export default {
           this.submitLoading = true
           delete this.contractForm.files
           this.contractForm.paymentListStr = JSON.stringify(this.contractPaymentList);
+          delete this.contractForm.msg
+          delete this.contractForm.nextPaymentDate
+          delete this.contractForm.nextPaymentAmount
+          delete this.contractForm.payCustomizedData
+          delete this.contractForm.checkerId
           this.http.post(this.dialogTitle == this.$t('add') ? '/contract/addContract' : '/contract/editContract',this.contractForm,
           res => {
             this.submitLoading = false
-            this.addDialog = false
             if(res.code == 'ok'){
+              this.addDialog = false
               this.$message({
                 message: res.msg,
                 type: 'success'
@@ -1199,7 +1217,6 @@ export default {
             }
           },err => {
             this.submitLoading = false
-            this.addDialog = false
             this.$message({
               message: err,
               type: 'error'