From edf132557e5eee4e8607ca83d987c5f6b830f025 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期五, 17 十月 2025 16:43:10 +0800
Subject: [PATCH] 档案相关发布
---
src/views/project/travelexpenseapply/travelexpensedetail/index.vue | 400 ++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 311 insertions(+), 89 deletions(-)
diff --git a/src/views/project/travelexpenseapply/travelexpensedetail/index.vue b/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
index b67779b..2f36bc2 100644
--- a/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
+++ b/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
@@ -51,16 +51,37 @@
</el-col>
</el-row>
<el-row>
- <el-col :span="15">
+ <el-col :span="10">
<el-form-item label="鍑哄樊浜嬬敱" prop="reason">
<el-input v-model="form.reason" placeholder="鍑哄樊浜嬬敱" />
</el-form-item>
</el-col>
<el-col :span="5">
- <el-form-item label="鎹愮尞鑰�" prop="infoid">
+ <el-form-item label="鎶ラ攢绫诲埆" prop="costtype">
+ <el-select
+ v-model="form.costtype"
+ value-key="value"
+ placeholder="璇烽�夋嫨鎶ラ攢浜哄憳绫诲埆"
+ >
+ <el-option
+ v-for="dict in dict.type.sys_travelexpensebelong"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
+ ></el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="5">
+ <el-form-item
+ label="鎹愮尞鑰�"
+ prop="infoid"
+ v-show="form.costtype == 4"
+ >
<el-select
v-model="form.infoid"
@change="selectbaseinfo"
+ clearable
filterable
placeholder="璇烽�夋嫨鎹愮尞鑰�"
>
@@ -77,23 +98,6 @@
</el-row>
<el-row style="margin-top: 10px">
<el-col :span="5">
- <el-form-item label="鎶ラ攢閲戦" prop="amountrequested">
- <el-input
- :disabled="true"
- v-model="form.amountrequested"
- placeholder="鎶ラ攢鍚堣閲戦"
- />
- </el-form-item>
- </el-col>
- <el-col :span="7">
- <el-form-item label="澶у啓閲戦" prop="bigstrmoney">
- <el-input
- :disabled="true"
- v-model="form.bigstrmoney"
- placeholder="鎶ラ攢澶у啓閲戦"
- />
- </el-form-item> </el-col
- ><el-col :span="4">
<el-form-item label="瀹℃牳鐘舵��" prop="flowlevel">
<el-select
v-model="form.recordstatus"
@@ -111,20 +115,30 @@
</el-select>
</el-form-item>
</el-col>
+ <el-col :span="5">
+ <el-form-item label="鎶ラ攢閲戦" prop="amountrequested">
+ <el-input
+ :disabled="true"
+ v-model="form.amountrequested"
+ placeholder="鎶ラ攢鍚堣閲戦"
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="澶у啓閲戦" prop="bigstrmoney">
+ <el-input
+ :disabled="true"
+ v-model="form.bigstrmoney"
+ placeholder="鎶ラ攢澶у啓閲戦"
+ />
+ </el-form-item>
+ </el-col>
</el-row>
<!--
<el-row>
<el-col :span="15">
<el-form-item label="鍑哄樊浜嬬敱" prop="reason">
<el-input v-model="form.reason" placeholder="鍑哄樊浜嬬敱" />
- </el-form-item>
- </el-col>
- <el-col :span="5">
- <el-form-item label="鎶ラ攢鍒嗙被" prop="costtype">
- <el-select v-model="form.costtype" value-key="value" placeholder="璇烽�夋嫨鍑哄樊浜哄垎绫�" @change="getTravelers">
- <el-option v-for="dict in dict.type.sys_travelexpensebelong" :key="dict.value" :label="dict.label"
- :value="dict.value"></el-option>
- </el-select>
</el-form-item>
</el-col>
<el-col :span="5">
@@ -195,7 +209,7 @@
</el-col>
</el-row>
-->
- <!--
+ <!--
<el-row type="flex" :gutter="10" align="right" class="mb8">
<el-col :span="6">
<el-button
@@ -541,7 +555,7 @@
width="120"
>
<template slot-scope="scope">
- <el-input
+ <el-input
v-model="scope.row.foodexpenses"
placeholder="浼欓璐规姤閿�"
@blur="
@@ -909,6 +923,15 @@
</el-radio-group>
</el-form-item>
</el-col>
+ <el-col :span="12">
+ <el-form-item label="绠楃◣鐘舵��" prop="infoid">
+ <el-radio-group v-model="form.istax" align="left">
+ <el-radio :label="-1">瀹℃牳涓�</el-radio>
+ <el-radio :label="0">鍏佽绠楃◣</el-radio>
+ <el-radio :label="1">宸茬畻绋�</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ </el-col>
</el-row>
<el-row
@@ -957,7 +980,7 @@
:visible.sync="pdfVisible"
width="60%"
>
- <div>
+ <div style="margin-bottom: 10px;">
<el-table :data="tableDatatop" style="width: 100%">
<el-table-column prop="orderno" label="搴忓彿"> </el-table-column>
<el-table-column prop="personname" label="璐圭敤浜哄憳">
@@ -986,6 +1009,13 @@
</el-table-column>
</el-table>
</div>
+ <el-alert
+ title="鏂颁笂浼犳枃浠堕渶鍦ㄦ彁浜や繚瀛樺悗鎵嶅彲杩涜妗堜緥鍏宠仈锛屽惁鍒欒涓烘斁寮�"
+ type="error"
+ show-icon
+ close-text="鐭ラ亾浜�"
+ >
+ </el-alert>
<el-tabs
style="margin-top: 20px;"
v-model="activeName"
@@ -1054,7 +1084,7 @@
>
<template slot-scope="scope">
<el-button
- type="primary"
+ type="danger"
size="mini"
@click.native.prevent.stop="deletedowfile(scope.row)"
>鍒犻櫎</el-button
@@ -1076,15 +1106,29 @@
class="pdfimgmin"
>
<!-- <img :src="pdfimg" /> -->
- <el-image
+ <!-- <el-image
style="width: 95%; height: 90%"
:src="pdfimg"
- :preview-src-list="pdfimgsrcList"
+ :preview-src-list="pdfimgsrcList" -->
>
- <!-- <div slot="error" class="image-slot">
+ <el-image
+ ref="imagePreview"
+ style="width: 95%; height: 90%"
+ :src="pdfimg"
+ @click="handleImageClick(initialIndex)"
+ >
+ </el-image>
+ <custom-image-viewer
+ :url-list="pdfimgsrcList"
+ :initial-index="currentIndex"
+ :visible="viewerVisible"
+ @update:visible="viewerVisible = $event"
+ @close="handleViewerClose"
+ />
+ <!-- <div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div> -->
- </el-image>
+ <!-- </el-image> -->
</div>
<div v-else class="pdfimgmins">{{ hintitle }}</div>
</div>
@@ -1176,12 +1220,16 @@
<el-image
style="width: 95%; height: 90%"
:src="invoicepdfimg"
- :preview-src-list="invoicepdfimgsrcList"
+ @click="invoicehandleImageClick(initialIndex)"
>
- <!-- <div slot="error" class="image-slot">
- <i class="el-icon-picture-outline"></i>
- </div> -->
</el-image>
+ <custom-image-viewer
+ :url-list="invoicepdfimgsrcList"
+ :initial-index="invoicecurrentIndex"
+ :visible="invoiceviewerVisible"
+ @update:visible="invoiceviewerVisible = $event"
+ @close="invoicehandleViewerClose"
+ />
</div>
<div v-else class="pdfimgmins">{{ hintitle }}</div>
</div>
@@ -1241,6 +1289,7 @@
import { getInfoBytheUserNo } from "@/api/project/externalperson";
import { regionDataPlus, CodeToText } from "element-china-area-data";
import Li_area_select from "@/components/Address";
+import CustomImageViewer from "@/components/CustomImageViewer"; // 鏍规嵁浣犵殑璺緞璋冩暣
import { getUser, getUserProfile } from "@/api/system/user";
import { treeselect } from "@/api/system/dept";
import { getSubsidy } from "@/api/project/travelcity";
@@ -1251,6 +1300,7 @@
components: {
Treeselect,
Li_area_select,
+ CustomImageViewer,
pdf
},
name: "Funddetail",
@@ -1366,6 +1416,9 @@
],
deptmentname: [
{ required: true, message: "璇疯緭鍏ユ墍灞炰笟鍔$粍", trigger: "blur" }
+ ],
+ costtype: [
+ { required: true, message: "璇疯緭鍏ユ姤閿�绫诲埆", trigger: "blur" }
]
},
//璐圭敤鐢宠鍗昮orm
@@ -1410,7 +1463,12 @@
invoicefileListto: [],
invoicepdfimg: "",
invoicepdfimgsrcList: [],
- invoDatatop: [],
+ currentIndex: 0, // 鍒濆绱㈠紩
+ invoicecurrentIndex: 0, // 鍒濆绱㈠紩
+ initialIndex: 0, // 鍒濆绱㈠紩
+ viewerVisible: false, // 鎺у埗棰勮缁勪欢鏄剧ず
+ invoiceviewerVisible: false, // 鎺у埗棰勮缁勪欢鏄剧ず
+
//浜哄憳绫诲埆
persontype: null,
//鍒拌揪鍦�
@@ -1472,7 +1530,14 @@
mounted() {
window.addEventListener("beforeunload", e => this.beforeunloadHandler(e));
-
+ this.$nextTick(() => {
+ const viewer = this.$refs.imagePreview.$el.querySelector(
+ ".el-image-viewer"
+ );
+ if (viewer) {
+ viewer.addEventListener("click", this.handlePreviewClick);
+ }
+ });
//閫夋嫨涓氬姟绫诲瀷:1銆佹柊澧烇紱2銆佷慨鏀癸紱3銆佹煡鐪�
let curId = this.$route.query.id;
let pos = this.$route.query.pos;
@@ -1495,7 +1560,15 @@
destroyed() {
window.removeEventListener("beforeunload", e => this.beforeunloadFn(e));
}, //鐢熷懡鍛ㄦ湡 - 閿�姣佸畬鎴�
-
+ beforeDestroy() {
+ // 绉婚櫎浜嬩欢鐩戝惉
+ const viewer = this.$refs.imagePreview.$el.querySelector(
+ ".el-image-viewer"
+ );
+ if (viewer) {
+ viewer.removeEventListener("click", this.handlePreviewClick);
+ }
+ },
methods: {
// 娴忚鍣ㄩ〉闈㈠叧闂垨鍒锋柊鎻愮ず
beforeunloadHandler(e) {
@@ -1514,7 +1587,57 @@
return "鍏抽棴鎻愮ず";
}
},
+ handlePreviewClick(e) {
+ const viewer = this.$refs.imagePreview.$el.querySelector(
+ ".el-image-viewer"
+ );
+ if (!viewer) return;
+ // 鍒ゆ柇鏄惁鐐瑰嚮浜嗏�滀笅涓�寮犫�濇寜閽紙鍙充晶绠ご锛�
+ const isNextBtn = e.target.closest(".el-image-viewer__next");
+ if (isNextBtn) {
+ const currentIndex = this.getCurrentPreviewIndex();
+ if (currentIndex === this.pdfimgsrcList.length - 1) {
+ e.preventDefault(); // 闃绘榛樿鍒囨崲琛屼负
+ this.$message.warning("宸茬粡鏄渶鍚庝竴寮犱簡锛�");
+ return;
+ }
+ }
+ },
+ // 鑾峰彇褰撳墠棰勮鐨勫浘鐗囩储寮�
+ getCurrentPreviewIndex() {
+ const viewer = this.$refs.imagePreview.$el.querySelector(
+ ".el-image-viewer"
+ );
+ if (viewer) {
+ const img = viewer.querySelector(".el-image-viewer__img");
+ if (img) {
+ const currentSrc = img.getAttribute("src");
+ return this.pdfimgsrcList.indexOf(currentSrc);
+ }
+ }
+ return 0;
+ },
+ handleImageClick(index) {
+ this.currentIndex = index;
+ this.viewerVisible = true;
+ },
+ invoicehandleImageClick(index) {
+ this.invoicecurrentIndex = index;
+ this.invoiceviewerVisible = true;
+ },
+ handleViewerClose() {
+ this.viewerVisible = false;
+ },
+ invoicehandleViewerClose() {
+ this.invoiceviewerVisible = false;
+ },
+ handleImageError() {
+ console.error("鍥剧墖鍔犺浇澶辫触");
+ },
+ handleImageLoad() {
+ console.log("鍥剧墖鍔犺浇鎴愬姛");
+ },
handleUploadError() {},
// 鑾峰彇璇锋眰澶�
Getnetworkheader() {
@@ -1636,36 +1759,41 @@
this.tableDatatop = [];
this.fileListto = [];
+ this.invoicefileListto = [];
+ this.pdfimg = "";
this.invoicepdfimg = [];
this.pdfimgsrcList = [];
- this.invoDatatop = [];
this.invoicepdfimgsrcList = [];
- this.invoDatatop.push(row);
this.tableDatatop.push(row);
this.atpresent = index;
this.pdfVisible = true;
if (this.rbDetails[index].annexfilesList) {
- this.rbDetails[index].annexfilesList.forEach((value, indexson) => {
- const pdfimg = this.Networkheader + "/prod-api" + value.url;
- fetch(pdfimg, config)
- .then(response => response.blob())
- .then(blob => {
- // 灏嗚幏鍙栫殑鏁版嵁娴佽浆鎹负URL
- this.fileListto.push({
- name: value.name,
- url: URL.createObjectURL(blob)
+ const fetchPromises = this.rbDetails[index].annexfilesList.map(
+ (value, indexson) => {
+ const pdfimg = this.Networkheader + "/prod-api" + value.url;
+ return fetch(pdfimg, config)
+ .then(response => response.blob())
+ .then(blob => {
+ return {
+ name: value.name,
+ url: URL.createObjectURL(blob)
+ };
+ })
+ .catch(error => {
+ console.error("Error loading image", error);
+ return null;
});
- if (this.fileListto.length == 1) {
- this.pdfimg = URL.createObjectURL(blob);
- }
- this.pdfimgsrcList.push(URL.createObjectURL(blob));
- })
- .catch(error => {
- console.error("Error loading image", error);
- return;
- });
+ }
+ );
+
+ Promise.all(fetchPromises).then(fileListto => {
+ this.fileListto = fileListto.filter(item => item !== null);
+ this.pdfimg = this.fileListto[0].url;
+ console.log(this.pdfimg, "pdfimg");
+ this.pdfimgsrcList = this.fileListto.map(item => item.url);
});
+
this.previewpdf = true;
} else {
this.fileListto = [];
@@ -1674,26 +1802,35 @@
}
//鍙戠エ
if (this.rbDetails[index].invoicefilesList) {
- this.rbDetails[index].invoicefilesList.forEach((value, indexson) => {
- const pdfimg = this.Networkheader + "/prod-api" + value.url;
- fetch(pdfimg, config)
- .then(response => response.blob())
- .then(blob => {
- // 灏嗚幏鍙栫殑鏁版嵁娴佽浆鎹负URL
- this.invoicefileListto.push({
- name: value.name,
- url: URL.createObjectURL(blob)
+ const fetchPromises = this.rbDetails[index].invoicefilesList.map(
+ (value, indexson) => {
+ const pdfimg = this.Networkheader + "/prod-api" + value.url;
+ return fetch(pdfimg, config)
+ .then(response => response.blob())
+ .then(blob => {
+ return {
+ name: value.name,
+ url: URL.createObjectURL(blob)
+ };
+ })
+ .catch(error => {
+ console.error("Error loading image", error);
+ return null;
});
- if (this.invoicefileListto.length == 1) {
- this.invoicepdfimg = URL.createObjectURL(blob);
- }
- this.invoicepdfimgsrcList.push(URL.createObjectURL(blob));
- })
- .catch(error => {
- console.error("Error loading image", error);
- return;
- });
+ }
+ );
+
+ Promise.all(fetchPromises).then(invoicefileListto => {
+ this.invoicefileListto = invoicefileListto.filter(
+ item => item !== null
+ );
+ this.invoicepdfimg = this.invoicefileListto[0].url;
+ console.log(this.invoicepdfimg, "invoicepdfimg");
+ this.invoicepdfimgsrcList = this.invoicefileListto.map(
+ item => item.url
+ );
});
+
this.previewpdf = true;
} else {
this.invoicefileListto = [];
@@ -1701,11 +1838,13 @@
this.pdftitle = "";
}
- if (this.activeName == 1) {
+ if (this.activeName == "common") {
this.pdftitle = "鍏�" + this.pdfimgsrcList.length + "椤�";
} else {
this.pdftitle = "鍏�" + this.invoicepdfimgsrcList.length + "椤�";
}
+ console.log(this.fileListto, "this.fileListto");
+ console.log(this.rbDetails[index].annexfilesList, "annexfilesList");
},
// 鐐瑰嚮宸蹭笂浼犳枃浠�
@@ -1797,10 +1936,36 @@
const index = this.getIndexInArray(this.fileListto, row);
const item = this.fileListto.splice(index, 1)[0]; // 绉婚櫎鎸囧畾绱㈠紩澶勭殑鍏冪礌锛屽苟淇濆瓨鍒癷tem鍙橀噺涓�
this.fileListto.splice(index - 1, 0, item); // 灏唅tem鎻掑叆鍒扮储寮曚綅缃殑鍓嶄竴浣�
+
+ const indexann = this.rbDetails[
+ this.atpresent
+ ].annexfilesList.findIndex(item => item.name == row.name);
+ const itemann = this.rbDetails[this.atpresent].annexfilesList.splice(
+ indexann,
+ 1
+ )[0]; // 绉婚櫎鎸囧畾绱㈠紩澶勭殑鍏冪礌锛屽苟淇濆瓨鍒癷tem鍙橀噺涓�
+ this.rbDetails[this.atpresent].annexfilesList.splice(
+ indexann - 1,
+ 0,
+ itemann
+ ); // 灏唅temann鎻掑叆鍒扮储寮曚綅缃殑鍓嶄竴浣�
} else {
const index = this.getIndexInArray(this.invoicefileListto, row);
const item = this.invoicefileListto.splice(index, 1)[0]; // 绉婚櫎鎸囧畾绱㈠紩澶勭殑鍏冪礌锛屽苟淇濆瓨鍒癷tem鍙橀噺涓�
this.invoicefileListto.splice(index - 1, 0, item); // 灏唅tem鎻掑叆鍒扮储寮曚綅缃殑鍓嶄竴浣�
+
+ const indexinvo = this.rbDetails[
+ this.atpresent
+ ].invoicefilesList.findIndex(item => item.name == row.name);
+ const iteminvo = this.rbDetails[this.atpresent].invoicefilesList.splice(
+ indexinvo,
+ 1
+ )[0]; // 绉婚櫎鎸囧畾绱㈠紩澶勭殑鍏冪礌锛屽苟淇濆瓨鍒癷tem鍙橀噺涓�
+ this.rbDetails[this.atpresent].invoicefilesList.splice(
+ indexinvo - 1,
+ 0,
+ iteminvo
+ ); // 灏唅teminvo鎻掑叆鍒扮储寮曚綅缃殑鍓嶄竴浣�
}
},
@@ -2354,6 +2519,8 @@
getReimbursement(id).then(response => {
this.form = response.data;
+ console.log(this.form.checkstatus, "checkstatus");
+ this.form.checkstatus = this.form.checkstatus.toString();
//绁ㄦ嵁
this.fileListto = this.form.annexfiles
@@ -2432,11 +2599,23 @@
this.Savenow();
console.log("淇濆瓨");
}
+ this.$modal.loading("姝e湪鎻愪氦瀹℃牳锛岃绋嶅�欙紒");
+
checkfund(checkfundobj).then(res => {
- this.$modal.msgSuccess("鎻愪氦瀹℃牳鎴愬姛!");
- // 鍏抽棴绐楀彛
- this.$store.dispatch("tagsView/delView", this.$route);
- this.$router.go(-1);
+ if (res.code == 200) {
+ this.$modal.closeLoading();
+ this.$modal.msgSuccess("鎻愪氦瀹℃牳鎴愬姛!");
+ // 鍏抽棴绐楀彛
+ this.$store.dispatch("tagsView/delView", this.$route);
+ this.$router.go(-1);
+ } else {
+ this.$modal.closeLoading();
+ if (res.msg) {
+ this.$modal.msgError("鎿嶄綔澶辫");
+ } else {
+ this.$modal.msgError(res.msg);
+ }
+ }
});
},
@@ -2462,8 +2641,48 @@
const rbDetails = [...this.rbDetails];
const rbPayees = [...this.rbPayees];
+ //淇濆瓨鍓嶆牎楠屾暟鎹�
+ for (let k = 0; k < rbDetails.length; k++) {
+ let tempDetail = rbDetails[k];
+ console.log(tempDetail, "tem");
+ if (!tempDetail.persontype) {
+ this.$modal.msgWarning(
+ "鏄庣粏琛ㄤ腑锛岀" +
+ (k + 1).toString() +
+ "琛岀殑浜哄憳绫诲埆鏈�夋嫨锛岃鍏堥�夋嫨浜哄憳绫诲埆鍚庡啀鎻愪氦淇濆瓨锛�"
+ );
+ return;
+ }
+
+ if (!tempDetail.personname) {
+ this.$modal.msgWarning(
+ "鏄庣粏琛ㄤ腑锛岀" +
+ (k + 1).toString() +
+ "琛岀殑璐圭敤浜哄憳鏈�夋嫨,璇烽�夋嫨璐圭敤浜哄憳鍚庡啀鎻愪氦淇濆瓨锛�"
+ );
+ return;
+ }
+
+ if (!tempDetail.starttime) {
+ this.$modal.msgWarning(
+ "鏄庣粏琛ㄤ腑锛岀" +
+ (k + 1).toString() +
+ "琛岀殑寮�濮嬫棩鏈熸湭閫夋嫨,璇烽�夋嫨寮�濮嬫棩鏈熷悗鍐嶆彁浜や繚瀛橈紒"
+ );
+ return;
+ }
+
+ if (!tempDetail.endtime) {
+ this.$modal.msgWarning(
+ "鏄庣粏琛ㄤ腑锛岀" +
+ (k + 1).toString() +
+ "琛岀殑缁撴潫鏃ユ湡濮撳悕涓洪�夋嫨,璇烽�夋嫨缁撴潫鏃ユ湡鍚庡啀鎻愪氦淇濆瓨锛�"
+ );
+ return;
+ }
+ }
+
if (this.form.id != null) {
- console.log(this.form);
updateReimbursement(this.form);
// .then(res => {
//淇濆瓨鏄庣粏
@@ -2473,7 +2692,9 @@
if (this.form.infoid) {
updateReimbursementdetail(rbDetails[i]);
} else {
- return this.$message.error(`鍥犲灞炲垎閰嶈姹傦紝璇烽�夋嫨鎹愮尞鑰呬俊鎭痐);
+ return this.$message.error(
+ `鍥犲灞炲垎閰嶈姹傦紝璇烽�夋嫨鎹愮尞鑰呬俊鎭痐
+ );
}
} else {
updateReimbursementdetail(rbDetails[i]);
@@ -2485,7 +2706,9 @@
rbDetails[i].rbid = this.form.id;
addReimbursementdetail(rbDetails[i]);
} else {
- return this.$message.error(`鍥犲灞炲垎閰嶈姹傦紝璇烽�夋嫨鎹愮尞鑰呬俊鎭痐);
+ return this.$message.error(
+ `鍥犲灞炲垎閰嶈姹傦紝璇烽�夋嫨鎹愮尞鑰呬俊鎭痐
+ );
}
} else {
//rbid鍏宠仈涓昏〃Id
@@ -2629,7 +2852,6 @@
const rbDetails = [...this.rbDetails];
const rbPayees = [...this.rbPayees];
if (this.form.id != null) {
- console.log(this.form);
updateReimbursement(this.form);
// .then(res => {
//淇濆瓨鏄庣粏
--
Gitblit v1.9.3