From fb16e99d60035949b870d0bed7f38b452458000a Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期四, 15 十月 2026 15:10:00 +0800
Subject: [PATCH] 修改了专家费校验和附件名字校验

---
 src/views/project/travelexpenseapply/index.vue |  566 +++++++++++++++++++++++++++----------------------------
 1 files changed, 277 insertions(+), 289 deletions(-)

diff --git a/src/views/project/travelexpenseapply/index.vue b/src/views/project/travelexpenseapply/index.vue
index 6104285..aebd6af 100644
--- a/src/views/project/travelexpenseapply/index.vue
+++ b/src/views/project/travelexpenseapply/index.vue
@@ -17,12 +17,13 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="鎶ラ攢鏃ユ湡" prop="createTime">
-            <el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="value1" type="daterange" @blur="onpick"
-              range-separator="鑷�" start-placeholder="鎶ラ攢寮�濮嬫棩鏈�" end-placeholder="鎶ラ攢缁撴潫鏃ユ湡" @keyup.enter.native="handleQuery">
+          <el-form-item label="鎶ラ攢鏃ユ湡" prop="applyTime">
+            <el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" v-model="value1" type="daterange"
+              @change="selecttime" range-separator="鑷�" start-placeholder="鎶ラ攢寮�濮嬫棩鏈�" end-placeholder="鎶ラ攢缁撴潫鏃ユ湡"
+              @keyup.enter.native="handlQuery">
             </el-date-picker>
           </el-form-item>
-        </el-col>
+        </el-col>      
         <el-col :span="6">
           <el-form-item label="瀹℃牳鐘舵��" prop="recordstatus">
             <el-input v-model="queryParams.recordstatus" placeholder="璇烽�夋嫨瀹℃牳鐘舵��" clearable size="small" v-if="0"
@@ -31,6 +32,14 @@
               <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="6">
+          <el-form-item label="鎹愮尞鑰�" prop="name">
+            <el-input v-model="queryParams.donorname" placeholder="璇疯緭鍏ユ崘鐚�呭鍚�" clearable size="small"
+              @keyup.enter.native="handleQuery" />
           </el-form-item>
         </el-col>
         <el-col :span="4">
@@ -55,31 +64,37 @@
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table  :row-class-name="rowClassName" v-loading="loading" :data="reimbursementList" @selection-change="handleSelectionChange" >
+    <el-table :row-class-name="rowClassName" v-loading="loading" :data="reimbursementList"
+      @selection-change="handleSelectionChange">
       <!-- <el-table-column type="selection" width="55" align="center" /> 
       <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="150" align="center" prop="createTime">
+</el-table-column>-->
+      <el-table-column label="鐢宠鏃堕棿" width="120" align="center" prop="applyTime">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
+          <span>{{ parseTime(scope.row.applyTime, "{y}-{m}-{d}") }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="瀹℃牳鐘舵��" align="center" prop="recordstatus" width="160">
+      <el-table-column label="瀹℃牳鐘舵��" align="center" prop="recordstatus" width="140">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.sys_recordstatus" :value="scope.row.recordstatus" />
         </template>
       </el-table-column>
-      <el-table-column label="缁忓姙浜�" width="150" align="center" prop="username" />
+      <el-table-column label="鏉愭枡棰勫鐘舵��" width="140" align="center" prop="checkstatus">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.sys_stage_type" :value="scope.row.checkstatus" />
+        </template>
+      </el-table-column>
+      <el-table-column label="缁忓姙浜�" width="100" align="center" prop="username" />
       <!--
       <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 label="鎶ラ攢閲戦" width="120" align="center" prop="amountrequested">
       </el-table-column>
-      <el-table-column label="鎵�灞炵粍鍒�" width="150" align="center" prop="deptmentname" />
-      <el-table-column label="缁勯暱" width="150" align="center" prop="managername" />
+      <el-table-column label="鎵�灞炵粍鍒�" width="120" align="center" prop="deptmentname" />
+      <el-table-column label="缁勯暱" width="100" align="center" prop="managername" />
       <el-table-column label="鍑哄樊浜嬬敱" align="center" prop="reason" />
       <!-- <el-table-column label="鑱旂郴鐢佃瘽" width="120" align="center" prop="phone">
       </el-table-column>
@@ -89,22 +104,30 @@
       </el-table-column>
       <el-table-column label="鎶ラ攢鍚堣" align="center" prop="financechecher"/>-->
       <!-- <el-table-column label="璐㈠姟瀹℃牳" width="120" align="center" prop="financechecher" /> -->
-      <el-table-column label="鎹愮尞鑰�" width="150" align="center" prop="donorname" />
-      <el-table-column label="鎿嶄綔" align="center" fixed="right" class-name="small-padding fixed-width">
+      <el-table-column label="鎹愮尞鑰�" width="100" align="center" prop="donorname" />
+      <el-table-column label="鎿嶄綔" align="center" fixed="right" width="300" 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>
           <el-button v-if="scope.row.recordstatus == -1 || scope.row.recordstatus == 1" size="mini" type="text"
             icon="el-icon-edit" @click="handleUpdate(scope.row)">淇敼</el-button>
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleDetail(scope.row)">鏌ョ湅</el-button>
+          <el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.row)">鏌ョ湅</el-button>
           <!-- v-hasPermi="['project:funddetail:edit']" -->
           <el-button size="mini" type="text" icon="el-icon-download" @click="gettable(scope.row)">
             涓嬭浇
           </el-button>
           <!-- v-hasPermi="['project:funddetail:edit']" -->
           <el-button v-if="scope.row.recordstatus == -1 || scope.row.recordstatus == 1" size="mini" type="text"
-            icon="el-icon-delete" @click="handleDelete(scope.row)">鍒犻櫎</el-button>
+            @click="handleDelete(scope.row)"><span class="button-delete"><i
+                class="el-icon-delete"></i>鍒犻櫎</span></el-button>
           <!-- v-hasPermi="['project:funddetail:remove']" -->
+        </template>
+      </el-table-column>
+      <el-table-column fixed="right" align="center" width="120" label="鍔熻兘" v-if="false">
+        <template slot-scope="scope">
+          <el-button size="mini" v-if="scope.row.uploadStates == 1">绾夸笅宸叉姤閿�</el-button>
+          <el-button size="mini" type="success" v-else-if="scope.row.uploadStates == 0"
+            @click="Dooffline('1', scope.row)">绾夸笅鎶ラ攢</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -118,9 +141,9 @@
       @close="reset">
       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-row><el-col :span="5">
-            <el-form-item label="鐢宠鏃ユ湡" prop="createTime">
-              <el-date-picker style="width: 100%" v-model="form.createTime" type="date" value-format="yyyy-MM-dd HH:mm:ss"
-                placeholder="鐢宠鏃ユ湡">
+            <el-form-item label="鐢宠鏃ユ湡" prop="applyTime">
+              <el-date-picker style="width: 100%" v-model="form.applyTime" type="date" format="yyyy-MM-dd"
+                value-format="yyyy-MM-dd HH:mm:ss" placeholder="鐢宠鏃ユ湡">
               </el-date-picker>
             </el-form-item>
           </el-col>
@@ -328,7 +351,7 @@
                       );
                     }
                   }
-                }" clearable size="small" style="width: 100%" v-model="scope.row.starttime" type="date"
+                }" clearable size="small" style="width: 100%" v-model="scope.row.starttime" type="date" format="yyyy-MM-dd"
                   value-format="yyyy-MM-dd HH:mm:ss" placeholder="寮�濮嬫棩鏈�" @blur="getdays(scope.row)">
                 </el-date-picker>
               </template>
@@ -344,7 +367,7 @@
                       );
                     }
                   }
-                }" clearable size="small" style="width: 100%" v-model="scope.row.endtime" type="date"
+                }" clearable size="small" style="width: 100%" v-model="scope.row.endtime" type="date" format="yyyy-MM-dd"
                   value-format="yyyy-MM-dd HH:mm:ss" placeholder="缁撴潫鏃ユ湡" @blur="getdays(scope.row)">
                 </el-date-picker>
               </template>
@@ -387,10 +410,11 @@
             </el-table-column>
             <el-table-column prop="trafficexpense" label="浜ら�氳垂" align="center" width="80">
               <template slot-scope="scope">
-                <el-input v-model="scope.row.trafficexpense" placeholder="浜ら�氳垂" @blur="val => {
-                  sumRowFee(scope.row);
-                }
-                  " />
+                <el-input v-model="scope.row.trafficexpense" placeholder="浜ら�氳垂" @blur="
+                  val => {
+                    sumRowFee(scope.row);
+                  }
+                " />
               </template>
             </el-table-column>
             <!--
@@ -407,44 +431,49 @@
                                                                                                                                       -->
             <el-table-column prop="hotelexpense" label="浣忓璐�" align="center" width="80">
               <template slot-scope="scope">
-                <el-input v-model="scope.row.hotelexpense" placeholder="浣忓璐�" @blur="val => {
-                  sumRowFee(scope.row);
-                }
-                  " />
+                <el-input v-model="scope.row.hotelexpense" placeholder="浣忓璐�" @blur="
+                  val => {
+                    sumRowFee(scope.row);
+                  }
+                " />
               </template>
             </el-table-column>
 
             <el-table-column prop="foodexpenses" label="椁愯垂鎶ラ攢" align="center" width="80">
               <template slot-scope="scope">
-                <el-input v-model="scope.row.foodexpenses" placeholder="浼欓璐规姤閿�" @blur="val => {
-                  sumRowFee(scope.row);
-                }
-                  " />
+                <el-input v-model="scope.row.foodexpenses" placeholder="浼欓璐规姤閿�" @blur="
+                  val => {
+                    sumRowFee(scope.row);
+                  }
+                " />
               </template>
             </el-table-column>
             <el-table-column prop="foodallowance" label="浼欓琛ュ姪" align="center" width="80">
               <template slot-scope="scope">
-                <el-input v-model="scope.row.foodallowance" placeholder="浼欓璐硅ˉ鍔�" @blur="val => {
-                  sumRowFee(scope.row);
-                }
-                  " />
+                <el-input v-model="scope.row.foodallowance" placeholder="浼欓璐硅ˉ鍔�" @blur="
+                  val => {
+                    sumRowFee(scope.row);
+                  }
+                " />
               </template>
             </el-table-column>
             <el-table-column prop="otherexpense" label="鍏潅璐硅ˉ鍔�" align="center" width="80">
               <template slot-scope="scope">
-                <el-input v-model="scope.row.otherexpense" placeholder="鏉傝垂" @blur="val => {
-                  sumRowFee(scope.row);
-                }
-                  " />
+                <el-input v-model="scope.row.otherexpense" placeholder="鏉傝垂" @blur="
+                  val => {
+                    sumRowFee(scope.row);
+                  }
+                " />
               </template>
             </el-table-column>
 
             <el-table-column prop="otherfeeamount" label="鍏朵粬璐圭敤" align="center" width="90">
               <template slot-scope="scope">
-                <el-input v-model="scope.row.otherfeeamount" placeholder="鍏朵粬璐圭敤" @blur="val => {
-                  sumRowFee(scope.row);
-                }
-                  " />
+                <el-input v-model="scope.row.otherfeeamount" placeholder="鍏朵粬璐圭敤" @blur="
+                  val => {
+                    sumRowFee(scope.row);
+                  }
+                " />
               </template>
             </el-table-column>
             <el-table-column prop="departure" slot="" label="鍏朵粬璐圭敤璇存槑" align="center" width="120">
@@ -533,7 +562,7 @@
               </template> </el-table-column><el-table-column prop="paiddate" slot="" label="鎵撴鏃ユ湡" fixed align="center"
               width="150">
               <template slot-scope="scope">
-                <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.paiddate" type="date"
+                <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.paiddate" type="date" format="yyyy-MM-dd"
                   value-format="yyyy-MM-dd HH:mm:ss" placeholder="鎵撴鏃ユ湡" :disabled="true">
                 </el-date-picker>
               </template>
@@ -592,7 +621,7 @@
               <!-- <file-upload ref="fileUpload" :fileType=fileType :limit="1" :on-success="handleUploadSuccess"></file-upload> -->
               <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="fileList" multiple
                 :limit="20" :headers="headers" :on-success="(response, file, fileList) =>
-                  uploadSccess(response, file, fileList)
+                    uploadSccess(response, file, fileList)
                   " :on-preview="downFile" :disabled="dialogType == 'detail'" :on-error="handleUploadError"
                 :on-exceed="handleExceed" :on-remove="remove" accept="image/*,.pdf">
                 <el-button :disabled="dialogType == 'detail'" size="small" type="primary">涓婁紶</el-button>
@@ -613,7 +642,7 @@
         </el-row>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm" v-if="dialogType == 'edit'">淇� 瀛�</el-button>
+        <el-button type="primary" :loading="saveLoading" @click="submitForm" v-if="dialogType == 'edit'">淇� 瀛�</el-button>
         <el-button @click="cancel">鍙� 娑�</el-button>
       </div>
     </el-dialog>
@@ -655,8 +684,10 @@
 import { getUser, getUserProfile } from "@/api/system/user";
 import { treeselect } from "@/api/system/dept";
 import { getSubsidy } from "@/api/project/travelcity";
+import { addorupdateFund } from "@/api/project/fund";
 import { listReportname, listUser } from "@/api/project/organization";
 import { getToken } from "@/utils/auth";
+import { moneySum, moneyAdd } from "@/utils/money";
 export default {
   components: {
     Treeselect,
@@ -671,7 +702,8 @@
     "sys_recordstatus",
     "sys_travelexpensebelong",
     "sys_traffictype",
-    "sys_area_name"
+    "sys_area_name",
+    "sys_stage_type"
   ],
   data() {
     return {
@@ -707,6 +739,8 @@
       loading: true,
       // 瀵煎嚭閬僵灞�
       exportLoading: false,
+      // 淇濆瓨鎸夐挳 loading锛岄槻姝㈤噸澶嶆彁浜�
+      saveLoading: false,
       // 閫変腑鏁扮粍
       ids: [],
       // 闈炲崟涓鐢�
@@ -727,17 +761,10 @@
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        itemname: null,
-        itemtype: null,
+        costtype: null,
+        donorname: null,
         starttime: null,
-        remark: null,
-        departure: null,
         endtime: null,
-        destination: null,
-        uploadFlag: null,
-        uploadTime: null,
-        // orderByColumn: "createTime",
-        orderByColumn: "id",
         isAsc: "desc"
       },
       queryParams2: {
@@ -836,6 +863,8 @@
   },
 
   methods: {
+   
+
     handleUploadError() { },
 
     remove(file) {
@@ -844,6 +873,17 @@
 
     handleExceed() {
       this.$message.error(`涓婁紶鏂囦欢鏁伴噺涓嶈兘瓒呰繃 ${5} 涓�!`);
+    },
+    Dooffline(a, value) {
+      value.uploadStates = 1;
+      value.notes = "绾夸笅宸叉姤閿�";
+      addorupdateFund(value).then(res => {
+        if (res.code == 200) {
+          this.$modal.msgSuccess("璁板綍鎴愬姛");
+        } else {
+          this.$modal.msgError(res.msg);
+        }
+      });
     },
 
     //鏂囦欢涓婁紶鎴愬姛鍥炶皟
@@ -855,7 +895,7 @@
         this.$modal.msgSuccess(response.msg);
         this.fileList.push({ name: response.fileName, url: response.fileName });
       } else {
-        console.log(response.msg);;
+        console.log(response.msg);
       }
     },
 
@@ -986,9 +1026,9 @@
         if (tempStr == "鏉窞") {
           row.otherexpense = "";
         } else if (
-          tempStr == "鏉窞-妗愬簮" ||
-          tempStr == "鏉窞-寤哄痉" ||
-          tempStr == "鏉窞-娣冲畨"
+          tempStr.includes("妗愬簮") ||
+          tempStr.includes("寤哄痉") ||
+          tempStr.includes("娣冲畨")
         ) {
           row.otherexpense = (parseInt(row.days) * 60).toString();
         } else {
@@ -1119,11 +1159,7 @@
         }
       });
     },
-
-    onpick(e) {
-      // console.log(e,this.value1)
-    },
-
+ 
     gettable(e) {
       const id = e.id;
       getdownload(e.id).then(res => {
@@ -1136,21 +1172,27 @@
         var aEle = document.createElement("a");
         aEle.href =
           curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"];
-        aEle.click();
+        console.log(aEle.href);
+        // 娣诲姞Authorization澶撮儴
+        fetch(aEle.href, {
+          headers: this.headers
+        })
+          .then(response => {
+            // 灏嗘枃浠朵笅杞介摼鎺ヤ綔涓篵lob瀵硅薄杩涜涓嬭浇
+            return response.blob();
+          })
+          .then(blob => {
+            const url = window.URL.createObjectURL(new Blob([blob]));
+            console.log(url);
+            const link = document.createElement("a");
+            link.href = url;
+            const name = fileUrl["downloadName"];
+            link.setAttribute("download", name); // 鏇挎崲file.pdf涓哄疄闄呯殑鏂囦欢鍚�
+            document.body.appendChild(link);
+            link.click();
+            link.parentNode.removeChild(link);
+          });
       });
-
-      // downloadconfirmationinfo(id).then((response) => {
-      //   var fileUrl = response;
-      //   //鑾峰彇褰撳墠缃戝潃
-      //   var urlBase = process.env.VUE_APP_BASE_API;
-      //   var curWWWPath = window.document.location.href;
-      //   var pos = curWWWPath.indexOf(window.document.location.pathname);
-      //   // 鍒涘缓a鏍囩
-      //   var aEle = document.createElement("a");
-      //   aEle.href =
-      //     curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"];
-      //   aEle.click();
-      // });
     },
 
     /** 鏌ヨ鎶ラ攢鐢宠鍒楄〃 */
@@ -1296,19 +1338,26 @@
 
       //鑾峰彇鎶ラ攢涓讳俊鎭�
       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 + "";
+      getReimbursement(id)
+        .then(async 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 + "";
 
-        let ids = response.data.id;
-        //鑾峰彇鎶ラ攢鏄庣粏淇℃伅
-        getReimbursementdetaillist(ids).then(res => {
-          this.rbDetails = res.data;
+          const ids = response.data.id;
+          this.queryParamsPayee.rbid = ids;
+
+          //鏄庣粏涓庢墦娆句俊鎭簰涓嶄緷璧栵紝骞跺彂鑾峰彇锛屽噺灏戠瓑寰呮椂闂�
+          const [detailRes, payeeRes] = await Promise.all([
+            getReimbursementdetaillist(ids),
+            listReimbursementpayee(this.queryParamsPayee)
+          ]);
+
+          this.rbDetails = detailRes.data;
           if (this.rbDetails.length == 0) {
             this.addDetailRow(0);
           }
@@ -1327,17 +1376,15 @@
 
           //瀹炴椂鍚堣閲戦
           //this.sumTotalFee();
-        });
 
-        //鑾峰彇鎶ラ攢鎵撴淇℃伅
-        this.queryParamsPayee.rbid = ids;
-        listReimbursementpayee(this.queryParamsPayee).then(res => {
-          this.rbPayees = res.rows;
+          this.rbPayees = payeeRes.rows;
           if (this.rbPayees.length == 0) {
             this.addPayeeRow(0);
           }
+        })
+        .catch(() => {
+          this.$modal.msgError("鎶ラ攢鍗曚俊鎭姞杞藉け璐ワ紝璇烽噸璇曪紒");
         });
-      });
     },
 
     /** 鏌ョ湅鎸夐挳鎿嶄綔 */
@@ -1354,59 +1401,56 @@
       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 }))
-          : [];
+      getReimbursement(id)
+        .then(async 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.form.recordstatus = response.data.recordstatus + "";
 
-        let ids = response.data.id;
-        let listFundflowparams = {
-          fundid: row.id,
-          fundtype: 1
-        };
-        listFundflow(listFundflowparams).then(res => {
-          this.fundflowList = res.rows;
-        });
+          const ids = response.data.id;
+          const listFundflowparams = {
+            fundid: row.id,
+            fundtype: 1
+          };
+          this.queryParamsPayee.rbid = ids;
 
-        //鎶ラ攢鏄庣粏
-        getReimbursementdetaillist(ids).then(res => {
-          this.rbDetails = res.data;
-          /*
-          for (let i = 0; i < this.rbDetails.length; i++) {
-            this.rbDetails[i].index = i;
-            this.rbDetails[i].searchAddress = {
-              sheng: this.rbDetails[i].travelprovincename,
-              shi: this.rbDetails[i].travelcityname,
-              qu: this.rbDetails[i].traveltownname,
-            };
-          }
-          */
-        });
+          //璧勯噾娴佹按銆佹姤閿�鏄庣粏銆佹墦娆句俊鎭簰涓嶄緷璧栵紝骞跺彂鑾峰彇
+          const [fundflowRes, detailRes, payeeRes] = await Promise.all([
+            listFundflow(listFundflowparams),
+            getReimbursementdetaillist(ids),
+            listReimbursementpayee(this.queryParamsPayee)
+          ]);
 
-        if (this.rbDetails.length > 0) this.sumTotalFee();
+          this.fundflowList = fundflowRes.rows;
+          this.rbDetails = detailRes.data;
 
-        //浠樻淇℃伅
-        this.queryParamsPayee.rbid = ids;
-        listReimbursementpayee(this.queryParamsPayee).then(res => {
-          this.rbPayees = res.rows;
+          //鏄庣粏鍔犺浇瀹屾垚鍚庡啀璁$畻鍚堣锛屼慨澶嶅師浠g爜鍦ㄦ槑缁嗚繑鍥炲墠灏� sumTotalFee 鐨勭珵鎬侀棶棰�
+          if (this.rbDetails.length > 0) this.sumTotalFee();
+
+          //浠樻淇℃伅
+          this.rbPayees = payeeRes.rows;
           if (this.rbPayees.length == 0) {
             this.addPayeeRow(0);
           }
+        })
+        .catch(() => {
+          this.$modal.msgError("鎶ラ攢鍗曚俊鎭姞杞藉け璐ワ紝璇烽噸璇曪紒");
         });
-      });
     },
 
     /** 鎻愪氦鎸夐挳 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
+      //闃叉閲嶅鎻愪氦锛氫繚瀛樹腑鐩存帴蹇界暐鍐嶆鐐瑰嚮
+      if (this.saveLoading) return;
+      this.$refs["form"].validate(async valid => {
+        if (!valid) return;
           /**
            let indexErrTime = this.rbDetails.findIndex((item) => {
              if (item.endtime && item.starttime) {
@@ -1463,6 +1507,8 @@
           }
           */
 
+          try {
+          this.saveLoading = true;
           //闄勪欢鏂囦欢澶勭悊
           let list = this.fileList;
           if (list.length > 0) {
@@ -1488,65 +1534,70 @@
           const rbDetails = [...this.rbDetails];
           const rbPayees = [...this.rbPayees];
           if (this.form.id != null) {
-            updateReimbursement(this.form)
-              .then(res => {
-                //淇濆瓨鏄庣粏
-                for (let i = 0; i < rbDetails.length; i++) {
-                  if (rbDetails[i].rbid != null) {
-                    updateReimbursementdetail(rbDetails[i]);
-                  } else {
-                    //rbid鍏宠仈涓昏〃Id
-                    rbDetails[i].rbid = this.form.id;
-                    addReimbursementdetail(rbDetails[i]);
-                  }
-                }
+            //绗�1姝ワ細鏇存柊涓昏〃锛屾垚鍔熷悗鍐嶅鐞嗗瓙琛�
+            await updateReimbursement(this.form);
 
-                //淇濆瓨璐︽埛
-                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]);
-                  }
+            //绗�2姝ワ細骞跺彂淇濆瓨鏄庣粏锛岀瓑寰呭叏閮ㄥ畬鎴愶紝浠讳竴澶辫触鍒欒蛋 catch 鎻愮ず
+            await Promise.all(
+              rbDetails.map(detail => {
+                if (detail.rbid != null) {
+                  return updateReimbursementdetail(detail);
                 }
-
-                this.$modal.msgSuccess("淇敼鎶ラ攢鍗曚繚瀛樻垚鍔�!");
-                this.open = false;
-                this.getList();
+                //rbid鍏宠仈涓昏〃Id
+                detail.rbid = this.form.id;
+                return addReimbursementdetail(detail);
               })
-              .catch(err => {
-                this.$modal.msgError("淇敼鎶ラ攢鍗曚繚瀛樺け璐ワ紒");
-              });
+            );
+
+            //绗�3姝ワ細骞跺彂淇濆瓨璐︽埛
+            await Promise.all(
+              rbPayees.map(payee => {
+                if (payee.rbid != null) {
+                  return updateReimbursementpayee(payee);
+                }
+                //rbid鍏宠仈涓昏〃Id
+                payee.rbid = this.form.id;
+                return addReimbursementpayee(payee);
+              })
+            );
+
+            this.$modal.msgSuccess("淇敼鎶ラ攢鍗曚繚瀛樻垚鍔�!");
           } 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]);
-                }
+            //绗�1姝ワ細鏂板涓昏〃锛岃繑鍥炰富琛↖d
+            const response = await addReimbursement(this.form);
 
-                //淇濆瓨璐﹀彿
-                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();
+            //绗�2姝ワ細骞跺彂淇濆瓨鏄庣粏
+            await Promise.all(
+              rbDetails.map(detail => {
+                //rbid鍏宠仈涓昏〃Id
+                detail.rbid = response.data;
+                return addReimbursementdetail(detail);
               })
-              .catch(err => {
-                this.$modal.msgError("鏂板鎶ラ攢鍗曚繚瀛樺け璐ワ紒");
-              });
+            );
+
+            //绗�3姝ワ細骞跺彂淇濆瓨璐﹀彿
+            await Promise.all(
+              rbPayees.map(payee => {
+                //rbid鍏宠仈涓昏〃Id
+                payee.rbid = response.data;
+                return addReimbursementpayee(payee);
+              })
+            );
+
+            this.$modal.msgSuccess("鏂板鎶ラ攢鍗曚繚瀛樻垚鍔�!");
+          }
+
+          //鎵�鏈変繚瀛樻楠ゅ叏閮ㄦ垚鍔熷悗鎵嶅叧闂脊绐楀苟鍒锋柊鍒楄〃
+          this.open = false;
+          this.getList();
+          } catch (err) {
+            this.$modal.msgError("鎶ラ攢鍗曚繚瀛樺け璐ワ紝璇烽噸璇曪紒");
+          } finally {
+            this.saveLoading = false;
           }
         }
-      });
+      );
     },
 
     /** 鍒犻櫎鎸夐挳鎿嶄綔 */
@@ -1559,7 +1610,10 @@
           return delReimbursement(ids);
         })
         .then(() => {
-          delReimbursementdetail(ids);
+          //绛夊緟鏄庣粏鍒犻櫎瀹屾垚鍚庡啀鍒锋柊鍒楄〃锛岄伩鍏嶅垪琛ㄥ埛鏂版椂鏄庣粏灏氭湭鍒犻櫎
+          return delReimbursementdetail(ids);
+        })
+        .then(() => {
           this.getList();
           this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
         })
@@ -1579,7 +1633,10 @@
           this.$download.name(response.msg);
           this.exportLoading = false;
         })
-        .catch(() => { });
+        .catch(() => {
+          //澶辫触鏃朵篃瑕佸浣� loading锛屽惁鍒欐寜閽案涔呰浆鍦�
+          this.exportLoading = false;
+        });
     },
 
     //鏂板涓�琛�
@@ -1760,107 +1817,30 @@
     },
 
     //璁$畻涓�琛屽悎璁�
-    //璁$畻褰撳墠琛屾姤閿�鍐呭璐圭敤鍚堣
+    //璁$畻褰撳墠琛屾姤閿�鍐呭璐圭敤鍚堣锛堥噾棰濅竴寰嬭蛋绮剧‘杩愮畻锛�
     sumRowFee(row) {
-      let totalFee = 0;
-      if (!isNaN(parseFloat(row.trafficexpense))) {
-        totalFee += parseFloat(row.trafficexpense);
-      }
-      if (!isNaN(parseFloat(row.cityfee))) {
-        totalFee += parseFloat(row.cityfee);
-      }
-      if (!isNaN(parseFloat(row.hotelexpense))) {
-        totalFee += parseFloat(row.hotelexpense);
-      }
-      if (!isNaN(parseFloat(row.otherexpense))) {
-        totalFee += parseFloat(row.otherexpense);
-      }
-      if (!isNaN(parseFloat(row.foodexpenses))) {
-        totalFee += parseFloat(row.foodexpenses);
-      }
-      if (!isNaN(parseFloat(row.foodallowance))) {
-        totalFee += parseFloat(row.foodallowance);
-      }
-      if (!isNaN(parseFloat(row.otherfeeamount))) {
-        totalFee += parseFloat(row.otherfeeamount);
-      }
-      row.total = totalFee;
+      row.total = moneySum([
+        row.trafficexpense,
+        row.cityfee,
+        row.hotelexpense,
+        row.otherexpense,
+        row.foodexpenses,
+        row.foodallowance,
+        row.otherfeeamount
+      ]);
 
-      /*
-      if (!isNaN(parseFloat(this.rbDetails[rowIndex].trafficexpense))) {
-        totalFee += parseFloat(this.rbDetails[rowIndex].trafficexpense);
-      }
-      if (!isNaN(parseFloat(this.rbDetails[rowIndex].cityfee))) {
-        totalFee += parseFloat(this.rbDetails[rowIndex].cityfee);
-      }
-      if (!isNaN(parseFloat(this.rbDetails[rowIndex].hotelexpense))) {
-        totalFee += parseFloat(this.rbDetails[rowIndex].hotelexpense);
-      }
-      if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherexpense))) {
-        totalFee += parseFloat(this.rbDetails[rowIndex].otherexpense);
-      }
-      if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodexpenses))) {
-        totalFee += parseFloat(this.rbDetails[rowIndex].foodexpenses);
-      }
-      if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodallowance))) {
-        totalFee += parseFloat(this.rbDetails[rowIndex].foodallowance);
-      }
-      if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherfeeamount))) {
-        totalFee += parseFloat(this.rbDetails[rowIndex].otherfeeamount);
-      }
-      this.rbDetails[rowIndex].total = parseFloat(totalFee).toFixed(2);
-      this.$set(this.rbDetails, rowIndex, this.rbDetails[rowIndex]);
-      */
       //閲嶆柊璁$畻鏁翠釜鎶ラ攢鍗曠殑鍚堣
       this.sumTotalFee();
     },
 
     //璁$畻璐圭敤鍚堣
     sumTotalFee() {
-      let allSum = 0;
-
-      //鎹愮尞鑰呭灞炶垂鐢�
-      if (!isNaN(parseFloat(this.form.donoramount))) {
-        allSum += parseFloat(this.form.donoramount);
-      }
-
       //鎶ラ攢鏄庣粏璐圭敤
       try {
-        for (let i = 0; i < this.rbDetails.length; i++) {
-          /*
-          let totalFee = 0;
-          //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
-          if (!isNaN(parseFloat(this.rbDetails[i].total))) {
-            totalFee += parseFloat(this.rbDetails[i].total);
-          }
-          if (!isNaN(parseFloat(this.rbDetails[i].cityfee))) {
-            totalFee += parseFloat(this.rbDetails[i].cityfee);
-          }
-          if (!isNaN(parseFloat(this.rbDetails[i].hotelexpense))) {
-            totalFee += parseFloat(this.rbDetails[i].hotelexpense);
-          }
-          if (!isNaN(parseFloat(this.rbDetails[i].otherexpense))) {
-            totalFee += parseFloat(this.rbDetails[i].otherexpense);
-          }
-          if (!isNaN(parseFloat(this.rbDetails[i].foodexpenses))) {
-            totalFee += parseFloat(this.rbDetails[i].foodexpenses);
-          }
-          if (!isNaN(parseFloat(this.rbDetails[i].foodallowance))) {
-            totalFee += parseFloat(this.rbDetails[i].foodallowance);
-          }
-          if (!isNaN(parseFloat(this.rbDetails[i].otherfeeamount))) {
-            totalFee += parseFloat(this.rbDetails[i].otherfeeamount);
-          }
-          this.rbDetails[i].total = parseFloat(totalFee).toFixed(2);
-          this.$set(this.rbDetails, i, this.rbDetails[i]);
-          */
-
-          if (!isNaN(parseFloat(this.rbDetails[i].total))) {
-            allSum += parseFloat(this.rbDetails[i].total);
-          }
-        }
-
-        this.form.amountrequested = allSum.toFixed(2);
+        this.form.amountrequested = moneyAdd(
+          moneySum(this.rbDetails, "total"),
+          this.form.donoramount
+        ).toFixed(2);
         this.form.bigstrmoney = this.convertCurrency(this.form.amountrequested);
       } catch { }
     },
@@ -1968,20 +1948,28 @@
     //鏄庢樉鎻愮ず瀹℃壒閫�鍥炶褰�
     rowClassName({ row, column, rowIndex, columnIndex }) {
       //姝ゅ垽鏂负鏈�鍚庝笁琛�
-      if (row.backflowlevel==199) {
-        return "addClassva";
+      if (row.recordstatus == -1 && row.backflowlevel != null) {
+        return "error-row";
       }
-    },
-
+      return "";
+    }
   }
 };
 </script>
 <!-- <style scoped> -->
 <!-- 涓嶅彲鍔爏coped,浼氱嫭绔嬫牱寮廵lement璁块棶涓嶅埌 -->
-<style>
+<style lang="scss" scoped>
 .addClassva {
   /* background: #10aec2; */
-  background:#10aec2!important; 
+  background: #e8f4ff !important;
   /* color:whitesmoke; */
 }
+
+.button-delete {
+  color: rgb(236, 69, 69);
+}
+
+::v-deep.el-table .error-row {
+  background: #fcebeb;
+}
 </style>

--
Gitblit v1.9.3