From 0c14c70cbc02619b516dd92f1cee3d74b2b1f4a3 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期四, 11 五月 2023 15:07:06 +0800
Subject: [PATCH] 修改了报销单计算补助

---
 src/views/project/travelexpenseslist/index.vue |   94 +++++++++++++++++++++++------------------------
 1 files changed, 46 insertions(+), 48 deletions(-)

diff --git a/src/views/project/travelexpenseslist/index.vue b/src/views/project/travelexpenseslist/index.vue
index d70002b..85f18fc 100644
--- a/src/views/project/travelexpenseslist/index.vue
+++ b/src/views/project/travelexpenseslist/index.vue
@@ -290,17 +290,17 @@
               </template>
             </el-table-column>
 
-            <el-table-column prop="persontype" slot="" label="浜哄憳绫诲埆" align="center" fixed width="120">
+            <el-table-column prop="persontype" slot="" label="浜哄憳绫诲埆" align="center" fixed width="130">
               <template slot-scope="scope">
                 <el-select v-model="scope.row.persontype" value-key="value" placeholder="浜哄憳绫诲埆"
                   @change="getPersons(scope.row)">
                   <el-option v-for="dict in dict.type.sys_travelexpensebelong" :key="dict.value" :label="dict.label"
-                    :value="dict.value"></el-option>
+                    :value="dict.label"></el-option>
 
                 </el-select>
               </template>
             </el-table-column>
-            <el-table-column prop="personname" slot="" label="璐圭敤浜哄憳" align="center" fixed width="120">
+            <el-table-column prop="personname" slot="" label="璐圭敤浜哄憳" align="center" fixed width="110">
               <template slot-scope="scope">
                 <el-select v-model="scope.row.personname" clearable filterable allow-create default-first-option
                   placeholder="璇烽�夋嫨" @focus1="getPersons(scope.row)">
@@ -337,7 +337,7 @@
                 <el-input v-model="scope.row.departure" placeholder="鍑哄彂鍦�" />
               </template>
             </el-table-column>
-            <el-table-column label="鍒拌揪鍦�" prop="destination2" align="center" width="120">
+            <el-table-column label="鍒拌揪鍦�" prop="destination2" align="center" width="140">
               <template slot-scope="scope">
                 <!--  <el-input v-model="scope.row.destination" placeholder="鍒拌揪鍦�" @blur="getallowance(scope.row)" /> -->
 
@@ -477,16 +477,16 @@
               </template>
             </el-table-column>
 
-            <el-table-column prop="persontype" slot="" label="浜哄憳绫诲埆" align="center" fixed width="120">
+            <el-table-column prop="persontype" slot="" label="浜哄憳绫诲埆" align="center" fixed width="130">
               <template slot-scope="scope">
                 <el-select v-model="scope.row.persontype" value-key="value" placeholder="浜哄憳绫诲埆"
                   @change="getPersons(scope.row)">
                   <el-option v-for="dict in dict.type.sys_travelexpensebelong" :key="dict.value" :label="dict.label"
-                    :value="dict.value"></el-option>
+                    :value="dict.label"></el-option>
                 </el-select>
               </template>
             </el-table-column>
-            <el-table-column prop="personname" slot="" label="鏀舵浜�" align="center" fixed width="130">
+            <el-table-column prop="personname" slot="" label="鏀舵浜�" align="center" fixed width="110">
               <template slot-scope="scope">
                 <el-select v-model="scope.row.personname" clearable filterable allow-create ref="getReportname"
                   default-first-option placeholder="璇烽�夋嫨" @change="getAccountinfo2(scope.row, scope.row.persontype)">
@@ -607,7 +607,7 @@
 
 <script>
 import { listDonatebaseinfo } from "@/api/project/donatebaseinfo";
-import { addOrUpdateRBpayee, listReimbursementpayee, addReimbursementpayee, updateReimbursementpayee } from "@/api/project/reimbursementpayee";
+import { listReimbursementpayee, addReimbursementpayee, updateReimbursementpayee } from "@/api/project/reimbursementpayee";
 import {
   listReimbursement,
   getReimbursement,
@@ -869,15 +869,15 @@
     getPersons(row) {
       //涓撹亴浜哄憳-1,鍗忚皟鍛�-2,涓撳-3,瀹跺睘-4,鍏朵粬浜哄憳-5
       let tmpList = null;
-      if (row.persontype == "1") {
+      if (row.persontype == "涓撹亴浜哄憳") {
         this.personsSel = this.personsZzry;
-      } else if (row.persontype == "2") {
+      } else if (row.persontype == "鍗忚皟鍛�") {
         this.personsSel = this.personsXty;
-      } else if (row.persontype == "3") {
+      } else if (row.persontype == "涓撳") {
         this.personsSel = this.personsExpert;
-      } else if (row.persontype == "4") {
+      } else if (row.persontype == "瀹跺睘") {
         this.personsSel = tmpList;
-      } else if (row.persontype == "5") {
+      } else if (row.persontype == "绠$悊浜哄憳") {
         this.personsSel = this.personsManager;
       }
     },
@@ -898,13 +898,13 @@
     //鑾峰彇璁剧疆浜哄憳璐﹀彿淇℃伅
     getAccountinfo2(row, personType) {
       let dataArr = [];
-      if (personType == 1) {
+      if (personType == '涓撹亴浜哄憳') {
         dataArr = this.personsZzry;
-      } else if (personType == 2) {
+      } else if (personType == '鍗忚皟鍛�') {
         dataArr = this.personsXty;
-      } else if (personType == 3) {
+      } else if (personType == '涓撳') {
         dataArr = this.personsExpert;
-      } else if (personType == 5) {
+      } else if (personType == '绠$悊浜哄憳') {
         dataArr = this.personsManager;
       }
 
@@ -963,7 +963,7 @@
       this.arriveAddr = val2;
       this.queryParams2.arriveAddr;
       this.queryParams2.personType = row;
-      if (row.persontype != undefined && row.persontype == "2" || row.persontype == "5") {
+      if (row.persontype != undefined && row.persontype == "鍗忚皟鍛�" || row.persontype == "绠$悊浜哄憳") {
         this.loading = true;
         getSubsidy(val2).then((response) => {
           this.loading = false;
@@ -1216,20 +1216,23 @@
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
       this.reset();
+      
+      this.open = true;
+      this.title = "鏂板鎶ラ攢鐢宠";
       this.dialogType = "edit";
       this.fundflowList = [];
       this.form.username = this.defaultperson.nickName;
       this.form.userno = this.defaultperson.userName;
-      this.addDetailRow();
-      this.addPayeeRow();
-      this.open = true;
-      this.title = "娣诲姞鎶ラ攢鐢宠";
+      this.addDetailRow(0);
+      this.addPayeeRow(0);
     },
 
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleUpdate(row) {
       this.dialogType = "edit";
       this.reset();
+      this.open = true;
+      this.title = "淇敼鎶ラ攢鐢宠";
 
       //鑾峰彇鎶ラ攢涓讳俊鎭�
       const id = row.id || this.ids;
@@ -1243,6 +1246,7 @@
         //鑾峰彇鎶ラ攢鏄庣粏淇℃伅
         getReimbursementdetaillist(ids).then((res) => {
           this.rbDetails = res.data;
+          if (this.rbDetails.length==0) {this.addDetailRow(0);}  
           //瑙f瀽鍑哄樊鍦板潃
           /*
           for (let i = 0; i < this.rbDetails.length; i++) {
@@ -1259,26 +1263,21 @@
         });
 
         //鑾峰彇鎶ラ攢鎵撴淇℃伅
-        queryParamsPayee.rbid=response.data.id;
-        console.log("rbPayees11111    ", queryParamsPayee);
-        listReimbursementpayee(queryParamsPayee).then((res) => {
-          console.log("rbPayees", res);
-          this.rbPayees = res.data.rows;
+        this.queryParamsPayee.rbid=ids;
+        listReimbursementpayee(this.queryParamsPayee).then((res) => {
+          this.rbPayees = res.rows;
+          if (this.rbPayees.length==0) {this.addPayeeRow(0);}      
         });
       });
-
-      //榛樿瀛樺湪涓�琛�
-      this.addDetailRow();
-      this.addPayeeRow();
-
-      this.open = true;
-      this.title = "淇敼鎶ラ攢鐢宠";
     },
 
     /** 鏌ョ湅鎸夐挳鎿嶄綔 */
     handleDetail(row) {
       this.dialogType = "detail";
-      this.reset();
+      this.title = "鏌ョ湅鎶ラ攢鐢宠";
+
+      this.reset(); 
+      this.open = true;
       const id = row.id || this.ids;
 
 
@@ -1312,15 +1311,14 @@
           //this.sumTotalFee();
         });
 
-        //璐︽埛
-        getReimbursementpayeelist(ids).then((res) => {
-          this.rbPayees = res.data;
+        //璐︽埛        
+        this.queryParamsPayee.rbid=ids;
+        listReimbursementpayee(this.queryParamsPayee).then((res) => {
+          this.rbPayees = res.rows;
+          if (this.rbPayees.length==0) {this.addPayeeRow(0);}      
         });
 
       });
-
-      this.open = true;
-      this.title = "鏌ョ湅鎶ラ攢鐢宠";
     },
 
     /** 鎻愪氦鎸夐挳 */
@@ -1401,7 +1399,7 @@
           const rbDetails = [...this.rbDetails]
           const rbPayees = [...this.rbPayees]
           if (this.form.id != null) {
-            updateReimbursement(this.form).then((response) => {
+            updateReimbursement(this.form).then((res) => {
               //淇濆瓨鏄庣粏
               for (let i = 0; i < rbDetails.length; i++) {
                 if (rbDetails[i].rbid != null) {
@@ -1424,12 +1422,12 @@
                 }
               }
 
-              this.$modal.msgSuccess("鎶ラ攢鍗曚慨鏀规垚鍔�!");
+              this.$modal.msgSuccess("淇敼鎶ラ攢鍗曚繚瀛樻垚鍔�!");
               this.open = false;
               this.getList();
 
             }).catch(err => {
-              this.$modal.msgError("鎶ラ攢鍗曚繚瀛樺け璐ワ紒");
+              this.$modal.msgError("淇敼鎶ラ攢鍗曚繚瀛樺け璐ワ紒");
             });
           }
           else {
@@ -1445,16 +1443,16 @@
               //淇濆瓨璐﹀彿
               for (let i = 0; i < rbPayees.length; i++) {
                 //rbid鍏宠仈涓昏〃Id
-                rbPayees[i].rbid = id;
+                rbPayees[i].rbid = response.data;
                 addReimbursementpayee(rbPayees[i]);
               }
 
-              this.$modal.msgSuccess("鎶ラ攢鍗曚慨鏀规垚鍔�!");
+              this.$modal.msgSuccess("鏂板鎶ラ攢鍗曚繚瀛樻垚鍔�!");
               this.open = false;
               this.getList();
 
             }).catch(err => {
-              this.$modal.msgError("鎶ラ攢鍗曚繚瀛樺け璐ワ紒");
+              this.$modal.msgError("鏂板鎶ラ攢鍗曚繚瀛樺け璐ワ紒");
             });
           }
         }
@@ -1558,7 +1556,7 @@
         personname: null,
         amount: null,
       };
-      if (rowIndex == undefined || rowIndex == null || rowIndex < 0) {
+      if (rowIndex == undefined || rowIndex == null || rowIndex <= 0) {
         this.rbPayees.push(rowData);
       } else {
         this.rbPayees.splice(rowIndex + 1, 0, rowData);

--
Gitblit v1.9.3