From c75027743ea7c3ecc2d0885f01d11d2ad78679a3 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期五, 23 十月 2026 14:23:26 +0800
Subject: [PATCH] Merge branch 'yxh' of http://116.62.18.175:6699/r/~yxh/opo-web
---
src/views/project/travelexpenseapply/index.vue | 553 ++++++++++++++++++++++++++++---------------------------
1 files changed, 280 insertions(+), 273 deletions(-)
diff --git a/src/views/project/travelexpenseapply/index.vue b/src/views/project/travelexpenseapply/index.vue
index d5a9478..66ca263 100644
--- a/src/views/project/travelexpenseapply/index.vue
+++ b/src/views/project/travelexpenseapply/index.vue
@@ -1,6 +1,7 @@
<template>
<div class="app-container">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+ <el-form
+ class="opo-query-form" :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-row>
<!--
<el-col :span="6">
@@ -17,12 +18,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 +33,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">
@@ -44,42 +54,48 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
- <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">鏂板</el-button>
+ <el-button type="primary" plain icon="el-icon-plus" @click="handleAdd">鏂板</el-button>
<!-- v-hasPermi="['project:funddetail:add']" -->
</el-col>
<el-col :span="1.5">
- <el-button type="warning" plain icon="el-icon-download" size="mini" :loading="exportLoading"
+ <el-button type="warning" plain icon="el-icon-download" :loading="exportLoading"
@click="handleExport">瀵煎嚭</el-button>
</el-col>
<!-- v-hasPermi="['project:funddetail:export']" -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
- <el-table border 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 +105,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" width="210">
+ <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 +142,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 +352,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 +368,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 +411,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 => {
+ <el-input v-model="scope.row.trafficexpense" placeholder="浜ら�氳垂" @blur="
+ val => {
sumRowFee(scope.row);
}
- " />
+ " />
</template>
</el-table-column>
<!--
@@ -407,44 +432,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 => {
+ <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 => {
+ <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 => {
+ <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 => {
+ <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 => {
+ <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 +563,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>
@@ -613,7 +643,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 +685,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 +703,8 @@
"sys_recordstatus",
"sys_travelexpensebelong",
"sys_traffictype",
- "sys_area_name"
+ "sys_area_name",
+ "sys_stage_type"
],
data() {
return {
@@ -707,6 +740,8 @@
loading: true,
// 瀵煎嚭閬僵灞�
exportLoading: false,
+ // 淇濆瓨鎸夐挳 loading锛岄槻姝㈤噸澶嶆彁浜�
+ saveLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
@@ -727,17 +762,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 +864,8 @@
},
methods: {
+
+
handleUploadError() { },
remove(file) {
@@ -844,6 +874,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 +896,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 +1027,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 +1160,7 @@
}
});
},
-
- onpick(e) {
- // console.log(e,this.value1)
- },
-
+
gettable(e) {
const id = e.id;
getdownload(e.id).then(res => {
@@ -1136,21 +1173,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 +1339,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 +1377,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 +1402,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 +1508,8 @@
}
*/
+ try {
+ this.saveLoading = true;
//闄勪欢鏂囦欢澶勭悊
let list = this.fileList;
if (list.length > 0) {
@@ -1488,65 +1535,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 +1611,10 @@
return delReimbursement(ids);
})
.then(() => {
- delReimbursementdetail(ids);
+ //绛夊緟鏄庣粏鍒犻櫎瀹屾垚鍚庡啀鍒锋柊鍒楄〃锛岄伩鍏嶅垪琛ㄥ埛鏂版椂鏄庣粏灏氭湭鍒犻櫎
+ return delReimbursementdetail(ids);
+ })
+ .then(() => {
this.getList();
this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
})
@@ -1579,7 +1634,10 @@
this.$download.name(response.msg);
this.exportLoading = false;
})
- .catch(() => { });
+ .catch(() => {
+ //澶辫触鏃朵篃瑕佸浣� loading锛屽惁鍒欐寜閽案涔呰浆鍦�
+ this.exportLoading = false;
+ });
},
//鏂板涓�琛�
@@ -1760,107 +1818,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 { }
},
@@ -1963,7 +1944,33 @@
chineseStr += cnInteger;
}
return chineseStr;
+ },
+
+ //鏄庢樉鎻愮ず瀹℃壒閫�鍥炶褰�
+ rowClassName({ row, column, rowIndex, columnIndex }) {
+ //姝ゅ垽鏂负鏈�鍚庝笁琛�
+ if (row.recordstatus == -1 && row.backflowlevel != null) {
+ return "error-row";
+ }
+ return "";
}
}
};
</script>
+<!-- <style scoped> -->
+<!-- 涓嶅彲鍔爏coped,浼氱嫭绔嬫牱寮廵lement璁块棶涓嶅埌 -->
+<style lang="scss" scoped>
+.addClassva {
+ /* background: #10aec2; */
+ 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