From 7fa43bd47b64ff1e419b4db18ccd613e14799ac9 Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期五, 30 十月 2026 10:12:47 +0800
Subject: [PATCH] tst
---
src/views/project/components/fundsummary/index.vue | 124 ++++++++++++++++++++++++-----------------
1 files changed, 72 insertions(+), 52 deletions(-)
diff --git a/src/views/project/components/fundsummary/index.vue b/src/views/project/components/fundsummary/index.vue
index 6ada3d8..96585be 100644
--- a/src/views/project/components/fundsummary/index.vue
+++ b/src/views/project/components/fundsummary/index.vue
@@ -1,8 +1,18 @@
<!-- -->
<template>
<div class="app-container" :donorno="donorno">
+ <el-alert
+ v-if="noCostData"
+ title="璇ユ渚嬫殏鏃犳垚鏈暟鎹�"
+ type="info"
+ :closable="false"
+ show-icon
+ style="margin-bottom: 10px"
+ />
<el-table
+ v-loading="costLoading"
border
+ class="table-bordered"
:data="fundList"
:span-method="objectSpanMethod"
label-width="96px"
@@ -54,8 +64,6 @@
</template>
<script>
-//杩欓噷鍙互瀵煎叆鍏朵粬鏂囦欢锛堟瘮濡傦細缁勪欢锛屽伐鍏穓s锛岀涓夋柟鎻掍欢js锛宩son鏂囦欢锛屽浘鐗囨枃浠剁瓑绛夛級
-//渚嬪锛歩mport 銆婄粍浠跺悕绉般�� from '銆婄粍浠惰矾寰勩��';
import { getDonationCost, exportFundCost } from "@/api/project/financesubject";
export default {
name: "fundsummary",
@@ -624,19 +632,22 @@
organMedicineSupportCostRowIndex: 0,
//鍣ㄥ畼鑾峰彇鎵嬫湳鎴愭湰鍚堝苟琛屾暟
organMedicineSupportCostRowSpan: 0,
- curdorno: null,
+ // 鎴愭湰鏄庣粏鍔犺浇涓�
+ costLoading: false,
+ // 褰撳墠妗堜緥鏄惁娌℃湁鎴愭湰鏁版嵁
+ noCostData: false,
};
},
//鐩戝惉灞炴�� 绫讳技浜巇ata姒傚康
computed: {},
//鐩戞帶data涓殑鏁版嵁鍙樺寲
watch: {
- //鐩戝惉donorno鍙戠敓鏀瑰彉鏃惰Е鍙�
- curdorno(newVal) {
- this.curdorno = newVal;
- //alert(this.donorno);
- //console.log("鐩戝惉鍒版崘鐚紪鍙峰彉鍖�" + this.curdorno);
- this.getCostData(this.curdorno);
+ // 鐩戝惉妗堜緥 ID 鍙樺寲锛岀珛鍗冲姞杞芥垚鏈槑缁�
+ donorno: {
+ immediate: true,
+ handler(val) {
+ this.getCostData(val);
+ },
},
},
//鏂规硶闆嗗悎
@@ -913,56 +924,65 @@
//璋冪敤鎺ュ彛鑾峰彇鎴愭湰鏁版嵁
getCostData(donorno) {
- getDonationCost(donorno).then((res) => {
- if (res.code == 200) {
- let resList = res.data;
- debugger
- var arr = [];
- for (var i in resList) {
- arr.push(resList[i]);
+ if (donorno === null || donorno === undefined || donorno === "") {
+ this.costLoading = false;
+ this.noCostData = false;
+ return;
+ }
+ this.costLoading = true;
+ this.noCostData = false;
+ this.resetCostAmounts();
+ getDonationCost(donorno)
+ .then((res) => {
+ if (res.code == 200) {
+ const data = res.data || {};
+ const before = [];
+ for (let i = 1; i <= 52; i++) {
+ before.push(data["fy" + i]);
+ }
+ before.push(data.fyhj);
+ const after = [];
+ for (let i = 1; i <= 52; i++) {
+ after.push(data["sh" + i]);
+ }
+ after.push(data.shhj);
+
+ let hasData = false;
+ before.forEach((value, index) => {
+ const num = Number(value);
+ if (!Number.isNaN(num) && num !== 0) {
+ this.fundList[index].amount = num.toFixed(2);
+ hasData = true;
+ }
+ });
+ after.forEach((value, index) => {
+ const num = Number(value);
+ if (!Number.isNaN(num) && num !== 0) {
+ this.fundList[index].amounted = num.toFixed(2);
+ hasData = true;
+ }
+ });
+ this.noCostData = !hasData;
+ } else {
+ this.$modal.msgError(res.msg || "鑾峰彇鎴愭湰鏄庣粏澶辫触");
}
-
- let arr1 = arr.slice(0, 53);
- arr1.forEach((item, i) => {
- if (item !== 0) {
- this.fundList[i].amount = item.toFixed(2);
- }
- });
-
- arr1 = arr.slice(53, 106);
- arr1.forEach((item, i) => {
- if (item !== 0) {
- this.fundList[i].amounted = item.toFixed(2);
- }
- });
-
- // this.fundList = resList
- // for (let i = 0; i < resList.length; i++) {
- // let itemIndex = this.fundList.findIndex(
- // (item) => resList[i].itemname == item.itemname
- // );
- // console.log(itemIndex);
- // if (itemIndex > -1) {
- // if(resList[i].amount != "0.00"){
- // this.fundList[itemIndex].amount =
- // resList[i].amount;
- // }else{
- // this.fundList[itemIndex].amount =
- // ""
- // }
- // }
- // }
- }
+ this.costLoading = false;
+ })
+ .catch(() => {
+ this.costLoading = false;
+ this.$modal.msgError("鑾峰彇鎴愭湰鏄庣粏澶辫触");
+ });
+ },
+ resetCostAmounts() {
+ this.fundList.forEach((item) => {
+ item.amount = "";
+ item.amounted = "";
});
},
},
//鐢熷懡鍛ㄦ湡 - 鍒涘缓瀹屾垚锛堝彲浠ヨ闂綋鍓峵his瀹炰緥锛�
created() {
this.calculateRowSpanConfig();
- },
- //鐢熷懡鍛ㄦ湡 - 鎸傝浇瀹屾垚锛堝彲浠ヨ闂瓺OM鍏冪礌锛�
- mounted() {
- this.curdorno = this.donorno;
},
beforeCreate() {}, //鐢熷懡鍛ㄦ湡 - 鍒涘缓涔嬪墠
beforeMount() {}, //鐢熷懡鍛ㄦ湡 - 鎸傝浇涔嬪墠
--
Gitblit v1.9.3