From f7aff93b978fb1563f56fcd901798acb841bed46 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期三, 17 五月 2023 09:41:03 +0800
Subject: [PATCH] 修改了财务差旅费审批

---
 src/views/project/travelexpenseslist/index.vue |  401 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 212 insertions(+), 189 deletions(-)

diff --git a/src/views/project/travelexpenseslist/index.vue b/src/views/project/travelexpenseslist/index.vue
index 5b40667..4d27765 100644
--- a/src/views/project/travelexpenseslist/index.vue
+++ b/src/views/project/travelexpenseslist/index.vue
@@ -62,40 +62,41 @@
 
     <el-table border v-loading="loading" :data="reimbursementList" @selection-change="handleSelectionChange">
       <!-- <el-table-column type="selection" width="55" align="center" /> -->
-      <el-table-column label="璁板綍鐘舵��" align="center" prop="recordstatus" width="180">
+      <el-table-column label="璁板綍鐘舵��" align="center" prop="recordstatus" width="160">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.sys_recordstatus" :value="scope.row.recordstatus" />
         </template>
       </el-table-column>
+      <!--
       <el-table-column label="鎶ラ攢浜虹被鍒�" width="120" align="center" prop="costtype">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.sys_travelexpensebelong" :value="scope.row.costtype" />
         </template>
-      </el-table-column>
-      <el-table-column label="鐢宠鏃堕棿" width="120" align="center" prop="createTime">
+      </el-table-column>-->
+      <el-table-column label="鐢宠鏃堕棿" width="150" align="center" prop="createTime">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="鎶ラ攢浜�" width="120" align="center" prop="username">
-      </el-table-column>
+      <el-table-column label="缁忓姙浜�" width="150" align="center" prop="username">
+      </el-table-column><!--
       <el-table-column label="鍑哄樊浜�" width="180" align="center" prop="travelers">
+      </el-table-column>-->
+      <el-table-column label="鎶ラ攢閲戦" width="150" align="center" prop="amountrequested">
       </el-table-column>
-      <el-table-column label="鎶ラ攢閲戦" width="120" align="center" prop="amountrequested">
+      <el-table-column label="鍑哄樊浜嬬敱" align="center" width="500" prop="reason">
       </el-table-column>
-      <el-table-column label="鍑哄樊浜嬬敱" align="center" width="280" prop="reason">
-      </el-table-column>
-      <el-table-column label="鑱旂郴鐢佃瘽" width="120" align="center" prop="phone">
+      <!-- <el-table-column label="鑱旂郴鐢佃瘽" width="120" align="center" prop="phone">
       </el-table-column>
       <el-table-column label="寮�鎴烽摱琛�" width="180" align="center" prop="depositbank">
       </el-table-column>
       <el-table-column label="閾惰鍗″彿" width="180" align="center" prop="bankcardno">
       </el-table-column>
-      <!-- <el-table-column label="鎶ラ攢鍚堣" align="center" prop="financechecher"/>-->
+      <el-table-column label="鎶ラ攢鍚堣" align="center" prop="financechecher"/>-->
       <!-- <el-table-column label="璐㈠姟瀹℃牳" width="120" align="center" prop="financechecher" /> -->
-      <el-table-column label="鎹愮尞鑰�" width="120" align="center" prop="donorname">
+      <el-table-column label="鎹愮尞鑰�" width="150" align="center" prop="donorname">
       </el-table-column>
-      <el-table-column label="鎿嶄綔" align="center" fixed="right" class-name="small-padding fixed-width" width="250">
+      <el-table-column label="鎿嶄綔" align="center" fixed="right" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button v-if="scope.row.recordstatus == -1 || scope.row.recordstatus == 1" size="mini" type="text"
             icon="el-icon-upload2" @click="handleup(scope.row)">涓婃姤</el-button>
@@ -167,6 +168,13 @@
                 <el-option v-for="dict in dict.type.sys_recordstatus" :key="dict.value" :label="dict.label"
                   :value="dict.value" />
               </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="20">
+            <el-form-item label="鍑哄樊浜嬬敱" prop="reason">
+              <el-input v-model="form.reason" placeholder="鍑哄樊浜嬬敱" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -261,7 +269,7 @@
               plain
               icon="el-icon-plus"
               size="mini"
-              @click="adddetailRow"
+              @click="addDetailRow"
               >鏂板涓�琛�</el-button
             >
           </el-col>
@@ -289,17 +297,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)">
@@ -336,7 +344,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)" /> -->
 
@@ -444,8 +452,8 @@
             </el-table-column>
             <el-table-column fixed="right" label="鎿嶄綔" align="center" width="120" v-if="dialogType == 'edit'">
               <template slot-scope="scope">
-                <el-button type="text" size="mini" @click="adddetailRow(scope.$index)">鏂板</el-button>
-                <el-button @click.native.prevent="deleteRow(scope.$index, rbDetails, scope.row)
+                <el-button type="text" size="mini" @click="addDetailRow(scope.$index)">鏂板</el-button>
+                <el-button @click.native.prevent="deleteDetailRow(scope.$index, rbDetails, scope.row)
                   " type="text" size="small">
                   鍒犻櫎
                 </el-button>
@@ -476,16 +484,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)">
@@ -523,8 +531,8 @@
             </el-table-column>
             <el-table-column label="鎿嶄綔" align="center" width="100" v-if="dialogType == 'edit'">
               <template slot-scope="scope">
-                <el-button type="text" size="mini" @click="addpayeeRow(scope.$index)">鏂板</el-button>
-                <el-button @click.native.prevent="deleteRow2(scope.$index, rbPayees, scope.row)
+                <el-button type="text" size="mini" @click="addPayeeRow(scope.$index)">鏂板</el-button>
+                <el-button @click.native.prevent="deletePayeeRow(scope.$index, rbPayees, scope.row)
                   " type="text" size="small">
                   鍒犻櫎
                 </el-button>
@@ -606,7 +614,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,
@@ -648,7 +656,6 @@
     "sys_travelexpensebelong",
     "sys_traffictype",
     "sys_area_name",
-    "sys_traffictype"
   ],
   data() {
     return {
@@ -718,6 +725,10 @@
       queryParams2: {
         persontype: null,
         arriveAddr: null,
+      },
+      //鏌ヨ浠樻
+      queryParamsPayee: {
+        rbid: null,
       },
       // 琛ㄥ崟鍙傛暟
       form: {},
@@ -864,15 +875,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;
       }
     },
@@ -893,13 +904,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;
       }
 
@@ -920,34 +931,29 @@
         row.endtime != null
       ) {
         //璁$畻澶╂暟
-        row.days = 1 + Math.floor(Math.abs(Date.parse(row.starttime) - Date.parse(row.endtime)) / (1099 * 3699 * 24))
-
-        /*let aDate, oDate1, oDate2, Date_end,Date_start;
-        Date_end = row.endtime.split(" "); //灏嗘椂闂翠互绌烘牸鍒掑垎涓轰袱涓暟缁�  绗竴涓暟缁勬槸 2019-05-20 绗簩涓暟缁勬槸 00锛�00锛�00
-        aDate = Date_end[0].split("-"); //鑾峰彇绗竴涓暟缁勭殑鍊�
-        oDate1 = new Date(aDate[0], aDate[1], aDate[2]);  //灏嗗墠鍗婁釜鏁扮粍浠�-鎷嗗垎锛屾瘡涓�涓槸涓�涓暟鍊�
-
-        Date_start = row.starttime.split(" ");
-        aDate = Date_start[0].split("-");
-        oDate2 = new Date(aDate[0], aDate[1], aDate[2]);
-        row.days = 1+parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24);    //鎶婄浉宸殑姣鏁拌浆鎹负澶╂暟
-        */
+        row.days = (Math.floor(Math.abs(Date.parse(row.starttime) - Date.parse(row.endtime)) / (1000 * 3600 * 24)) + 1).toString()
       } else {
-        row.days = ''
+        row.days = '';
       };
 
       //鍏潅璐硅ˉ鍔╋細鏉窞妗愬簮锛屽缓寰凤紝娣冲畨60锛屾澀宸炲叾浠栧湴鍖�0锛岄潪鏉窞鍦板尯80
       if (row.destination2 != "") {
-        var str = row.destination2;
+        var tempStr = row.destination2;
+
         //楠岃瘉鍩庡競
-        ////if (str.indexOf("妗愬簮锛屽缓寰凤紝娣冲畨") !== -1) { };
-        if (str.includes("鏉窞")) { row.otherexpense = parseInt(row.days) * 0 }
-        else if (str.includes("妗愬簮") || str.includes("寤哄痉") || str.includes("娣冲畨")) { row.otherexpense = parseInt(row.days) * 60 }
-        else { row.otherexpense = parseInt(row.days) * 80 };
+        if (tempStr == "鏉窞") {
+          row.otherexpense = '';
+        }
+        else if (tempStr == "鏉窞-妗愬簮" || tempStr == "鏉窞-寤哄痉" || tempStr == "鏉窞-娣冲畨") {
+          row.otherexpense = (parseInt(row.days) * 60).toString();
+        }
+        else {
+          row.otherexpense = (parseInt(row.days) * 80).toString();
+        };
       }
 
       //浼欓璐硅ˉ鍔╋細鍩庡競锛堣タ钘忥紝鏂扮枂锛岄潚娴�.120锛夛紙鍏朵粬100锛�
-      row.foodallowance = parseInt(row.days) * 100
+      row.foodallowance = (parseInt(row.days) * 100).toString();
 
       //璁$畻鍚堣
       this.sumTotalFee();
@@ -958,7 +964,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;
@@ -989,6 +995,7 @@
           patowncode: this.$refs["residenceSelect_" + row.index].getQu(),
           standardlevel: this.standardlevel,
         };
+
         getTravelStandard(info)
           .then((response) => {
             let fee = 0;
@@ -1211,20 +1218,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;
@@ -1232,21 +1242,15 @@
         this.form = response.data;
         this.fileList = this.form.annexfiles ? this.form.annexfiles.split(",").map(item => ({ url: item, name: item })) : []
         this.form.recordstatus = response.data.recordstatus + "";
-        this.open = true;
-        this.title = "淇敼鎶ラ攢鐢宠";
-        let ids = response.data.id;
 
+
+        let ids = response.data.id;
         //鑾峰彇鎶ラ攢鏄庣粏淇℃伅
         getReimbursementdetaillist(ids).then((res) => {
-          if (res.data.length == 0) {
-            return;
-          }
-
           this.rbDetails = res.data;
-          for (let i = 0; i < this.rbDetails.length; i++) {
-            //   this.rbDetails[i].personname2 = res.data[i].personname;
-          }
-
+          if (this.rbDetails.length == 0) { this.addDetailRow(0); }
+          //瑙f瀽鍑哄樊鍦板潃
+          /*
           for (let i = 0; i < this.rbDetails.length; i++) {
             this.rbDetails[i].index = i;
             this.rbDetails[i].searchAddress = {
@@ -1255,37 +1259,38 @@
               qu: this.rbDetails[i].traveltownname,
             };
           }
+          */
           //瀹炴椂鍚堣閲戦
-          this.sumTotalFee();
+          //this.sumTotalFee();
+        });
 
-          //鑾峰彇鎶ラ攢鎵撴淇℃伅
-          let obj = { rbid: ids };
-          listReimbursementpayee(obj).then((res) => {
-            if (res.rows.length == 0) {
-              return;
-            }
-            this.rbPayees = res.rows;
-            console.log("listReimbursementpayee", res.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();
     },
 
     /** 鏌ョ湅鎸夐挳鎿嶄綔 */
     handleDetail(row) {
       this.dialogType = "detail";
+      this.title = "鏌ョ湅鎶ラ攢鐢宠";
+
       this.reset();
+      this.open = true;
       const id = row.id || this.ids;
+
+
       getReimbursement(id).then((response) => {
         this.form = response.data;
+        //闄勪欢
         this.fileList = this.form.annexfiles ? this.form.annexfiles.split(",").map(item => ({ url: item, name: item })) : []
 
+        //瀹℃牳鐘舵��
         this.form.recordstatus = response.data.recordstatus + "";
-        this.open = true;
-        this.title = "鏌ョ湅鎶ラ攢鐢宠";
+
         let ids = response.data.id;
         let listFundflowparams = {
           fundid: row.id,
@@ -1294,6 +1299,7 @@
         listFundflow(listFundflowparams).then((res) => {
           this.fundflowList = res.rows;
         });
+        //鎶ラ攢鏄庣粏
         getReimbursementdetaillist(ids).then((res) => {
           this.rbDetails = res.data;
           for (let i = 0; i < this.rbDetails.length; i++) {
@@ -1306,6 +1312,14 @@
           }
           //this.sumTotalFee();
         });
+
+        //璐︽埛        
+        this.queryParamsPayee.rbid = ids;
+        listReimbursementpayee(this.queryParamsPayee).then((res) => {
+          this.rbPayees = res.rows;
+          if (this.rbPayees.length == 0) { this.addPayeeRow(0); }
+        });
+
       });
     },
 
@@ -1313,61 +1327,66 @@
     submitForm() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          let indexErrTime = this.rbDetails.findIndex((item) => {
-            if (item.endtime && item.starttime) {
-              let d = this.$moment(item.endtime).diff(this.$moment(item.starttime), "d");
-              if (d < 0) {
-                return true;
-              } else {
-                return false;
-              }
-            } else {
-              false;
-            }
-          });
-
-          if (indexErrTime > -1) {
-            this.$message({
-              message: "绗�" + (indexErrTime + 1) + "琛屽埌杈炬棩鏈熸棭浜庡嚭鍙戞棩鏈�",
-              type: "warning",
-            });
-            return;
-          }
-
-          let emptyStartTimeindex = this.rbDetails.findIndex(
-            (item) => item.starttime == null || item.starttime == undefined || item.starttime == ""
-          );
-
-          if (emptyStartTimeindex > -1) {
-            this.$message({
-              message: "绗�" + (emptyStartTimeindex + 1) + "琛屽嚭鍙戞棩鏈熶负绌�",
-              type: "warning",
-            });
-            return;
-          }
-
-          let emptyEndTimeindex = this.rbDetails.findIndex(
-            (item) => item.endtime == null || item.endtime == undefined || item.endtime == ""
-          );
-
-          if (emptyEndTimeindex > -1) {
-            this.$message({
-              message: "绗�" + (emptyEndTimeindex + 1) + "琛屽埌杈炬棩鏈熶负绌�",
-              type: "warning",
-            });
-            return;
-          }
-
+          /**
+           let indexErrTime = this.rbDetails.findIndex((item) => {
+             if (item.endtime && item.starttime) {
+               let d = this.$moment(item.endtime).diff(this.$moment(item.starttime), "d");
+               if (d < 0) {
+                 return true;
+               } else {
+                 return false;
+               }
+             } else {
+               false;
+             }
+           });
+          
+           if (indexErrTime > -1) {
+             this.$message({
+               message: "绗�" + (indexErrTime + 1) + "琛屽埌杈炬棩鏈熸棭浜庡嚭鍙戞棩鏈�",
+               type: "warning",
+             });
+             return;
+           }
+     
+           let emptyStartTimeindex = this.rbDetails.findIndex(
+             (item) => item.starttime == null || item.starttime == undefined || item.starttime == ""
+           );
+     
+           if (emptyStartTimeindex > -1) {
+             this.$message({
+               message: "绗�" + (emptyStartTimeindex + 1) + "琛屽嚭鍙戞棩鏈熶负绌�",
+               type: "warning",
+             });
+             return;
+           }
+     
+           let emptyEndTimeindex = this.rbDetails.findIndex(
+             (item) => item.endtime == null || item.endtime == undefined || item.endtime == ""
+           );
+     
+           if (emptyEndTimeindex > -1) {
+             this.$message({
+               message: "绗�" + (emptyEndTimeindex + 1) + "琛屽埌杈炬棩鏈熶负绌�",
+               type: "warning",
+             });
+             return;
+           }           
+    
+          //璐圭敤褰掑睘
           let belongArr = this.dict.type.sys_travelexpensebelong;
           let costtypeindex = belongArr.findIndex(
             (item) => this.form.costtype == item.value
           );
+          if (costtypeindex > -1) {
+            this.form.costtypename = belongArr[costtypeindex].label;
+          }
+          */
+
+          //闄勪欢鏂囦欢澶勭悊
           let list = this.fileList;
           if (list.length > 0) {
             this.form.annexfiles = list.map(item => item.url).join(",");
-          }
-          if (costtypeindex > -1) {
-            this.form.costtypename = belongArr[costtypeindex].label;
           }
 
           //鏍¢獙璇锋閲戦鍚堣鏄惁绛変簬鎶ラ攢鍗曢噾棰�
@@ -1379,61 +1398,64 @@
             return;
           }
 
-
+          const rbDetails = [...this.rbDetails]
+          const rbPayees = [...this.rbPayees]
           if (this.form.id != null) {
-            //rbid涓昏〃Id,鏂逛究鍚庨潰鍏宠仈涓昏〃
-            let rbid = this.form.id;
-            for (let i = 0; i < this.rbDetails.length; i++) {
-              this.rbDetails[i].rbid = rbid;
-            }
-            updateReimbursement(this.form).then((response) => {
-              addOrupdateReimbursementdetaillist(this.rbDetails).then((response) => {
-                //鏇存柊鏀粯琛ㄤ俊鎭�
-                for (let i = 0; i < this.rbPayees.length; i++) {
-                  this.rbPayees[i].rbid = rbid;
-                }
-                //addOrUpdateRBpayee(this.rbPayees);
-                for (let i = 0; i < this.rbPayees.length; i++) {
-                  if (this.rbPayees[i].rbid != null) {
-                    updateReimbursementpayee(this.rbPayees[i]);
-                  } else {
-                    addReimbursementpayee(this.rbPayees[i]);
-                  }
-                }
-                this.$modal.msgSuccess("淇敼鎴愬姛");
-                this.open = false;
-                this.getList();
-              });
-            }).catch(err => {
-              console.log(err);
-            })
-          } else {
-            this.form.recordstatus = -1;
-            const rbDetails = [...this.rbDetails]
-            const rbPayees = [...this.rbPayees]
-            addReimbursement(this.form).then((response) => {
+            updateReimbursement(this.form).then((res) => {
+              //淇濆瓨鏄庣粏
               for (let i = 0; i < rbDetails.length; i++) {
-                rbDetails[i].rbid = response.data;
+                if (rbDetails[i].rbid != null) {
+                  updateReimbursementdetail(rbDetails[i]);
+                } else {
+                  //rbid鍏宠仈涓昏〃Id
+                  rbDetails[i].rbid = this.form.id;
+                  addReimbursementdetail(rbDetails[i]);
+                }
               }
-              addOrupdateReimbursementdetaillist(rbDetails).then((response) => {
-                this.$modal.msgSuccess("鏂板鎴愬姛");
-                this.open = false;
-                this.getList();
-                listReimbursementdetailid().then((res) => {
-                  let id = res.data;
-                  for (let i = 0; i < rbDetails.length; i++) {
-                    rbDetails[i].rbid = id;
-                    addReimbursementdetail(rbDetails[i]);
-                  }
 
-                  for (let i = 0; i < rbPayees.length; i++) {
-                    rbPayees[i].rbid = id;
-                  }
-                  //addOrUpdateRBpayee(rbPayees);
-                  addReimbursementpayee(rbPayees);
-                })
-              })
-            })
+              //淇濆瓨璐︽埛
+              for (let i = 0; i < rbPayees.length; i++) {
+                if (rbPayees[i].rbid != null) {
+                  updateReimbursementpayee(rbPayees[i]);
+                } else {
+                  //rbid鍏宠仈涓昏〃Id
+                  rbPayees[i].rbid = this.form.id;
+                  addReimbursementpayee(rbPayees[i]);
+                }
+              }
+
+              this.$modal.msgSuccess("淇敼鎶ラ攢鍗曚繚瀛樻垚鍔�!");
+              this.open = false;
+              this.getList();
+
+            }).catch(err => {
+              this.$modal.msgError("淇敼鎶ラ攢鍗曚繚瀛樺け璐ワ紒");
+            });
+          }
+          else {
+            this.form.recordstatus = -1;
+            addReimbursement(this.form).then((response) => {
+              //淇濆瓨鏄庣粏
+              for (let i = 0; i < rbDetails.length; i++) {
+                //rbid鍏宠仈涓昏〃Id
+                rbDetails[i].rbid = response.data;
+                addReimbursementdetail(rbDetails[i]);
+              }
+
+              //淇濆瓨璐﹀彿
+              for (let i = 0; i < rbPayees.length; i++) {
+                //rbid鍏宠仈涓昏〃Id
+                rbPayees[i].rbid = response.data;
+                addReimbursementpayee(rbPayees[i]);
+              }
+
+              this.$modal.msgSuccess("鏂板鎶ラ攢鍗曚繚瀛樻垚鍔�!");
+              this.open = false;
+              this.getList();
+
+            }).catch(err => {
+              this.$modal.msgError("鏂板鎶ラ攢鍗曚繚瀛樺け璐ワ紒");
+            });
           }
         }
       });
@@ -1473,7 +1495,7 @@
     },
 
     //鏂板涓�琛�
-    adddetailRow(rowIndex) {
+    addDetailRow(rowIndex) {
       let rowData = {
         //index: this.rbDetails.length,
         searchAddress: {
@@ -1490,6 +1512,7 @@
         days: null,
         trafficexpense: 0,
         traffictype: null,
+        traffictype2: null,
         cityfee: 0,
         hotelexpense: 0,
         invoicecount: null,
@@ -1523,7 +1546,7 @@
       }
     },
 
-    addpayeeRow(rowIndex) {
+    addPayeeRow(rowIndex) {
       let rowData = {
         id: null,
         personType: null,
@@ -1536,7 +1559,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);
@@ -1546,7 +1569,7 @@
       }
     },
 
-    deleteRow(index, rows, row) {
+    deleteDetailRow(index, rows, row) {
       this.$confirm("鏄惁纭鍒犻櫎?", "鎻愮ず", {
         confirmButtonText: "纭畾",
         cancelButtonText: "鍙栨秷",
@@ -1573,7 +1596,7 @@
         });
     },
 
-    deleteRow2(index, rows, row) {
+    deletePayeeRow(index, rows, row) {
       this.$confirm("鏄惁纭鍒犻櫎?", "鎻愮ず", {
         confirmButtonText: "纭畾",
         cancelButtonText: "鍙栨秷",

--
Gitblit v1.9.3