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 | 356 ++++++++++++++++++++++++----------------------------------
1 files changed, 148 insertions(+), 208 deletions(-)
diff --git a/src/views/project/travelexpenseapply/index.vue b/src/views/project/travelexpenseapply/index.vue
index 8e19f52..aebd6af 100644
--- a/src/views/project/travelexpenseapply/index.vue
+++ b/src/views/project/travelexpenseapply/index.vue
@@ -18,7 +18,7 @@
</el-col>
<el-col :span="8">
<el-form-item label="鎶ラ攢鏃ユ湡" prop="applyTime">
- <el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="value1" type="daterange"
+ <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>
@@ -142,7 +142,7 @@
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row><el-col :span="5">
<el-form-item label="鐢宠鏃ユ湡" prop="applyTime">
- <el-date-picker style="width: 100%" v-model="form.applyTime" type="date"
+ <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>
@@ -351,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>
@@ -367,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>
@@ -562,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>
@@ -642,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>
@@ -687,6 +687,7 @@
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,
@@ -738,6 +739,8 @@
loading: true,
// 瀵煎嚭閬僵灞�
exportLoading: false,
+ // 淇濆瓨鎸夐挳 loading锛岄槻姝㈤噸澶嶆彁浜�
+ saveLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
@@ -1335,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);
}
@@ -1366,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("鎶ラ攢鍗曚俊鎭姞杞藉け璐ワ紝璇烽噸璇曪紒");
});
- });
},
/** 鏌ョ湅鎸夐挳鎿嶄綔 */
@@ -1393,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) {
@@ -1502,6 +1507,8 @@
}
*/
+ try {
+ this.saveLoading = true;
//闄勪欢鏂囦欢澶勭悊
let list = this.fileList;
if (list.length > 0) {
@@ -1527,71 +1534,75 @@
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;
}
}
- });
+ );
},
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
handleDelete(row) {
const ids = row.id || this.ids;
- console.log(ids);
this.$modal
.confirm("鏄惁纭鍒犻櫎璇ユ潯璁板綍锛�")
.then(function () {
@@ -1599,7 +1610,10 @@
return delReimbursement(ids);
})
.then(() => {
- delReimbursementdetail(ids);
+ //绛夊緟鏄庣粏鍒犻櫎瀹屾垚鍚庡啀鍒锋柊鍒楄〃锛岄伩鍏嶅垪琛ㄥ埛鏂版椂鏄庣粏灏氭湭鍒犻櫎
+ return delReimbursementdetail(ids);
+ })
+ .then(() => {
this.getList();
this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
})
@@ -1619,7 +1633,10 @@
this.$download.name(response.msg);
this.exportLoading = false;
})
- .catch(() => { });
+ .catch(() => {
+ //澶辫触鏃朵篃瑕佸浣� loading锛屽惁鍒欐寜閽案涔呰浆鍦�
+ this.exportLoading = false;
+ });
},
//鏂板涓�琛�
@@ -1800,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 { }
},
--
Gitblit v1.9.3