From c870390bfc28b314f30240352895c5d6c466c148 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期日, 20 九月 2026 13:46:23 +0800
Subject: [PATCH] AI修复
---
src/views/home/components/BarChart3/index.vue | 8
src/views/project/travelexpenseapply/edit.vue | 45 -
vue.config.js | 4
src/views/project/fundcheck/ethicalExpertFeeCheck/index.vue | 41
src/views/project/donorcharge/donorchargedetail/index.vue | 41 -
src/views/project/travelexpensecheck/index.vue | 45 -
src/utils/money.js | 240 +++++++++
src/views/project/fund/performancedetails/index.vue | 26
src/views/home/components/line1Chart/index.vue | 8
src/views/project/fund/applyDetail0/index.vue | 44
build/checkMoney.js | 148 +++++
src/views/project/fund/officeExpenseApply/index.vue | 33
src/views/project/tallage/computingBill/index.vue | 22
src/views/project/travelexpenseapply/index.vue | 346 +++++--------
src/views/home/components/line2Chart/index.vue | 8
src/views/project/fund/medicalCostApply/index.vue | 34
src/views/project/travelexpenseapply/travelexpensedetail/index.vue | 107 ---
src/views/home/components/BarChart2/index.vue | 8
src/views/home/components/MapChart/index.vue | 8
src/views/home/components/BarChart/index.vue | 8
src/views/home/components/BarChartH/index.vue | 8
src/views/home/components/lineChart/index.vue | 10
src/views/project/fundcheck/officeExpenseCheck/index.vue | 34
README.md | 9
/dev/null | 0
src/views/project/fund/applyDetail/index.vue | 59 +-
src/views/project/fund/expertFeeApply/index.vue | 38
src/views/project/fund/ethicalExpertFeeApply/index.vue | 53 -
src/views/project/fundcheck/medicalCostCheck/index.vue | 34
package.json | 3
src/views/project/unitCost/particulars/index.vue | 22
31 files changed, 872 insertions(+), 622 deletions(-)
diff --git a/README.md b/README.md
index 19ff2bb..4ceed42 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,9 @@
## 寮�鍙�
+> 鏈洰褰� `opo-web/` 鍗� PC 鍓嶇宸ョ▼鏍圭洰褰曪紙鍘熻嫢渚濇ā鏉垮悕涓� `ruoyi-ui`锛屾澶勫凡鏀瑰悕锛夈��
+> 浠ヤ笅鍛戒护**鍧囧湪 `opo-web/` 涓嬫墽琛�**銆�
+
```bash
-# 鍏嬮殕椤圭洰
-git clone https://gitee.com/y_project/RuoYi-Vue
-
-# 杩涘叆椤圭洰鐩綍
-cd ruoyi-ui
-
# 瀹夎渚濊禆
npm install
diff --git a/build/checkMoney.js b/build/checkMoney.js
new file mode 100644
index 0000000..790b862
--- /dev/null
+++ b/build/checkMoney.js
@@ -0,0 +1,148 @@
+#!/usr/bin/env node
+/**
+ * 閲戦绮惧害妫�鏌ワ紙闃插鍙戦棬绂侊級
+ *
+ * 鑳屾櫙锛氶噾棰濇诞鐐圭疮鍔犲湪鏈」鐩弽澶嶅紩鍙戠嚎涓婇棶棰橈紝鍏稿瀷鐥囩姸鏄�
+ * 銆屽悎璁″涓嶄笂銆嶃�屽嚭鐜� -0.00銆嶃�岄噾棰濆甫涓�闀夸覆灏忔暟銆嶃�傛牴鍥犳槸 JS 鐨� Number
+ * 鏄� IEEE-754 鍙岀簿搴︽诞鐐癸紝瀵� 2 浣嶅皬鏁伴噾棰濆仛 + - * 浼氬紩鍏ヤ簩杩涘埗鑸嶅叆璇樊锛�
+ * 涓旇宸細闅忔槑缁嗘潯鏁扮疮绉紙瀹炴祴绾� 39% 鐨勫鏄庣粏缁勫悎浼氬嚭鐜板熬宸級銆�
+ *
+ * 鍥犳绾﹀畾锛氶噾棰濊繍绠椾竴寰嬩娇鐢� @/utils/money锛堝唴閮ㄥ熀浜� decimal.js锛屽崄杩涘埗绮剧‘杩愮畻锛夈��
+ *
+ * 鏈剼鏈壂鎻� src 涓嬬殑 .js / .vue锛屾壘鍑恒�岀枒浼煎閲戦鍋氭诞鐐圭疮鍔犮�嶇殑鍐欐硶骞舵姤閿欓��鍑猴紝
+ * 浠ヤ究鍦ㄦ彁浜ゅ墠鎷︿綇鍥炲綊銆傚缓璁寕鍒� pre-commit 鎴� CI銆�
+ *
+ * 鐢ㄦ硶锛�
+ * node build/checkMoney.js
+ * 鎴� npm run check:money
+ *
+ * 鑻ョ‘璁ゆ煇澶勬槸璇姤锛堜緥濡傜疮鍔犵殑涓嶆槸閲戦锛岃�屾槸鏁伴噺銆佸ぉ鏁扮瓑锛夛紝
+ * 鍦ㄨ琛屼笂鏂瑰姞娉ㄩ噴锛�// money-check-ignore
+ */
+const fs = require("fs");
+const path = require("path");
+
+const SRC_DIR = path.resolve(__dirname, "../src");
+const IGNORE_COMMENT = "money-check-ignore";
+
+// 鍗遍櫓鍐欐硶锛氬 parseFloat 缁撴灉鍋氱疮鍔狅紝鎴栦互 parseFloat 鐩镐箻鍚庡弬涓庣疮鍔�
+const RULES = [
+ {
+ id: "float-accumulate",
+ // 褰㈠ totalFee += parseFloat(...)
+ pattern: /\+=\s*parseFloat\s*\(/,
+ message: "瀵� parseFloat 缁撴灉鍋氱疮鍔狅紝閲戦浼氱疮绉诞鐐硅宸�"
+ },
+ {
+ id: "float-subtract-assign",
+ // 褰㈠ totalFee -= parseFloat(...)
+ pattern: /-=\s*parseFloat\s*\(/,
+ message: "瀵� parseFloat 缁撴灉鍋氬噺娉曠疮鍔狅紝閲戦浼氱疮绉诞鐐硅宸�"
+ },
+ {
+ id: "float-text-math",
+ // 褰㈠ a = (parseFloat(x) - parseFloat(y)).toFixed(2)
+ pattern: /=\s*\(?\s*parseFloat\s*\([^)]*\)\s*[-+*]\s*parseFloat\s*\(/,
+ message: "parseFloat 涔嬮棿鐩存帴鍋氱畻鏈繍绠楀啀鏍煎紡鍖栵紝缁撴灉鍙兘甯︽诞鐐瑰熬宸�"
+ }
+];
+
+// 鎺掗櫎绗笁鏂瑰簱涓庢瀯寤轰骇鐗╋紝浠呮鏌ヤ笟鍔℃簮鐮�
+const EXCLUDE_DIRS = [
+ path.join(SRC_DIR, "echarts"), // echarts 绗笁鏂瑰簱婧愮爜
+ path.join(SRC_DIR, "assets")
+];
+
+// 鍏佽鐨勫啓娉曪細杩欎簺鏄鍗曚釜鍊肩殑鍚堟硶鎬�/闆跺�兼牎楠岋紝涓嶆瀯鎴愮疮鍔狅紝涓嶄細鏀惧ぇ璇樊
+const ALLOW = [/parseFloat\([^)]*\)\s*==\s*0/, /parseFloat\([^)]*\)\s*!=\s*0/];
+
+function walk(dir, out) {
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
+ const full = path.join(dir, entry.name);
+ if (entry.isDirectory()) {
+ if (entry.name === "node_modules") continue;
+ if (EXCLUDE_DIRS.indexOf(full) >= 0) continue;
+ walk(full, out);
+ } else if (/\.(js|vue)$/.test(entry.name)) {
+ out.push(full);
+ }
+ }
+ return out;
+}
+
+function checkFile(file) {
+ const lines = fs.readFileSync(file, "utf8").split(/\r?\n/);
+ const hits = [];
+ let inBlockComment = false;
+
+ lines.forEach((line, idx) => {
+ const code = line.trim();
+
+ // 璺熻釜璺ㄨ鍧楁敞閲婏細鍧楁敞閲婁腑鐨勪唬鐮佷笉鍙備笌妫�鏌ワ紙閬垮厤瀵瑰凡娉ㄩ噴鎺夌殑浠g爜璇姤锛�
+ if (inBlockComment) {
+ if (code.indexOf("*/") >= 0) inBlockComment = false;
+ return;
+ }
+ if (code.indexOf("/*") === 0) {
+ if (code.indexOf("*/") < 0) inBlockComment = true;
+ return;
+ }
+ // 琛屾敞閲�
+ if (code.indexOf("//") === 0 || code.indexOf("*") === 0) return;
+ // 鍏佽鐨勫啓娉曪細鍗曚釜鍊肩殑鍚堟硶鎬�/闆跺�兼牎楠�
+ if (ALLOW.some((re) => re.test(line))) return;
+ // 鏄惧紡璇姤鏍囪
+ const prev = idx > 0 ? lines[idx - 1] : "";
+ if (prev.indexOf(IGNORE_COMMENT) >= 0) return;
+
+ RULES.forEach((rule) => {
+ if (rule.pattern.test(line)) {
+ hits.push({ line: idx + 1, id: rule.id, message: rule.message, code: code.slice(0, 120) });
+ }
+ });
+ });
+
+ return hits;
+}
+
+function main() {
+ if (!fs.existsSync(SRC_DIR)) {
+ console.error(`鎵句笉鍒版簮鐮佺洰褰曪細${SRC_DIR}`);
+ process.exit(1);
+ }
+
+ const files = walk(SRC_DIR, []);
+ let total = 0;
+ const report = [];
+
+ files.forEach((file) => {
+ const hits = checkFile(file);
+ if (hits.length) {
+ total += hits.length;
+ report.push({ file: path.relative(path.resolve(__dirname, ".."), file), hits });
+ }
+ });
+
+ if (total === 0) {
+ console.log(`閲戦绮惧害妫�鏌ラ�氳繃锛堝凡鎵弿 ${files.length} 涓枃浠讹級`);
+ process.exit(0);
+ }
+
+ console.error("閲戦绮惧害妫�鏌ユ湭閫氳繃锛氬彂鐜扮枒浼奸噾棰濇诞鐐圭疮鍔燶n");
+ report.forEach(({ file, hits }) => {
+ console.error(` ${file}`);
+ hits.forEach((h) => {
+ console.error(` L${h.line} [${h.id}] ${h.message}`);
+ console.error(` ${h.code}`);
+ });
+ console.error("");
+ });
+ console.error("璇锋敼鐢� @/utils/money 鎻愪緵鐨勬柟娉曪紝渚嬪锛�");
+ console.error(' import { moneySum, moneyAdd, moneyMul, moneyRound } from "@/utils/money";');
+ console.error(" const total = moneyRound(moneySum(list, \"amount\"));");
+ console.error(" 閲戦鐩哥瓑姣旇緝鐢� moneyEq()锛屼笉瑕佺敤 parseFloat(...) == 鎴� ===銆�");
+ console.error(" 纭睘璇姤鏃讹紝鍦ㄨ琛屼笂鏂瑰姞娉ㄩ噴 // money-check-ignore");
+ process.exit(1);
+}
+
+main();
diff --git a/dist.rar b/dist.rar
deleted file mode 100644
index fdd5f31..0000000
--- a/dist.rar
+++ /dev/null
Binary files differ
diff --git a/package.json b/package.json
index d4c726f..761dd72 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,8 @@
"build": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
- "lint": "eslint --ext .js,.vue src"
+ "lint": "eslint --ext .js,.vue src",
+ "check:money": "node build/checkMoney.js"
},
"husky": {
"hooks": {
diff --git a/src/utils/money.js b/src/utils/money.js
new file mode 100644
index 0000000..a8d93b1
--- /dev/null
+++ b/src/utils/money.js
@@ -0,0 +1,240 @@
+/**
+ * 閲戦璁$畻宸ュ叿
+ *
+ * 鑳屾櫙锛氭湰绯荤粺閲戦涓�寰嬩互銆屽厓銆嶄负鍗曚綅銆佷繚鐣� 2 浣嶅皬鏁帮紝灞炶储鍔℃暟鎹��
+ * JS 鐨� Number 鏄� IEEE-754 鍙岀簿搴︽诞鐐癸紝鐩存帴鍋氬姞鍑忎箻浼氬紩鍏ヤ簩杩涘埗鑸嶅叆璇樊锛�
+ * 鍏稿瀷琛ㄧ幇锛�
+ * 0.1 + 0.2 -> 0.30000000000000004
+ * 1.1 * 3 -> 3.3000000000000003
+ * 0.3 - 0.2 - 0.1 -> -2.7755575615628914e-17 锛堥��璐�/鎵g◣鐩稿噺鍚庢畫鐣欏熬宸級
+ * 杩欑被灏惧樊瀵艰嚧銆屽悎璁″涓嶄笂銆嶃�岄噾棰濇樉绀轰负 -0銆嶃�岀浉绛夊垽鏂け璐ャ�嶇瓑绾夸笂闂锛�
+ * 涓斾細闅忓崟鎹祦杞鍐欏叆鏁版嵁搴擄紝浜嬪悗闅句互杩芥函銆�
+ *
+ * 鍥犳锛氭墍鏈夐噾棰濊繍绠楃粺涓�璧版湰妯″潡锛岀姝㈢洿鎺ュ閲戦浣跨敤 + - * / 涓� parseFloat 绱姞銆�
+ * 鍐呴儴鍩轰簬 decimal.js锛坧ackage.json 宸插紩鍏ワ級锛屼繚璇佸崄杩涘埗绮剧‘杩愮畻銆�
+ *
+ * 鐢ㄦ硶绀轰緥锛�
+ * import { moneySum, moneyMul, moneySub, moneyRound, moneyEq } from "@/utils/money";
+ *
+ * // 绱姞鏄庣粏锛堣繃婊ら潪鏁板瓧涓庣┖鍊硷紝涓嶄細鎶� NaN 浼犳煋缁欏悎璁★級
+ * const total = moneySum(this.rbDetails, "amount");
+ *
+ * // 鍗曚环 脳 鏁伴噺
+ * const preTax = moneyMul(row.price, row.quantity);
+ *
+ * // 绋庡墠 - 鎵g◣ = 绋庡悗
+ * const afterTax = moneySub(row.amount, row.taxamount);
+ *
+ * // 钀藉簱/灞曠ず鍓嶇粺涓�淇濈暀 2 浣嶏紙鍥涜垗浜斿叆锛�
+ * this.form.amountrequested = moneyRound(total);
+ *
+ * // 閲戦姣旇緝锛堝嬁鐢� == / === 鎴� parseFloat 鍚庣浉鍑忥級
+ * if (!moneyEq(sumOfPayees, this.form.amountrequested)) { ... }
+ */
+import Decimal from 'decimal.js'
+
+/** 閲戦淇濈暀灏忔暟浣� */
+export const MONEY_SCALE = 2
+
+/**
+ * 杞负 Decimal锛涙棤娉曡瘑鍒殑鍊硷紙绌轰覆/undefined/null/NaN/闈炴暟瀛楋級涓�寰嬫寜 0 澶勭悊銆�
+ * 鎸� 0 澶勭悊鑰岄潪鎶涢敊锛屾槸涓轰簡淇濇寔鏃㈡湁椤甸潰銆�!isNaN(parseFloat(x)) 鎵嶇疮鍔犮�嶇殑琛屼负锛�
+ * 鍚屾椂閬垮厤 NaN 姹℃煋鏁存潯鍚堣閾俱��
+ *
+ * @param {string|number|Decimal|null|undefined} value
+ * @returns {Decimal}
+ */
+export function toMoney(value) {
+ if (value === null || value === undefined || value === '') {
+ return new Decimal(0)
+ }
+ if (value instanceof Decimal) {
+ return value
+ }
+ let d
+ try {
+ d = new Decimal(value)
+ } catch (e) {
+ return new Decimal(0)
+ }
+ return d.isFinite() ? d : new Decimal(0)
+}
+
+/**
+ * 鍒ゆ柇鏄惁涓烘湁鏁堥噾棰濓紙鍙弬涓庤绠楋級銆傜敤浜庡師鏈� !isNaN(parseFloat(x)) 鐨勬牎楠屽満鏅��
+ *
+ * @param {*} value
+ * @returns {boolean}
+ */
+export function isValidMoney(value) {
+ if (value === null || value === undefined || value === '') {
+ return false
+ }
+ if (value instanceof Decimal) {
+ return value.isFinite()
+ }
+ if (typeof value === 'number') {
+ return Number.isFinite(value)
+ }
+ const s = String(value).trim()
+ if (s === '') {
+ return false
+ }
+ try {
+ return new Decimal(s).isFinite()
+ } catch (e) {
+ return false
+ }
+}
+
+/**
+ * 绱姞姹傚拰銆�
+ *
+ * @param {Array} list 寰呯疮鍔犵殑鏁扮粍
+ * @param {string|Function} [selector] 鍙栭噾棰濈殑鏂瑰紡锛�
+ * 瀛楃涓� -> 鍙栬椤圭殑璇ュ睘鎬у悕锛屽 "amount"锛�
+ * 鍑芥暟 -> 鐢ㄨ繑鍥炲�硷紝濡� (item) => item.detail && item.detail.amount锛�
+ * 鐪佺暐 -> 鐩存帴绱姞鏁扮粍鍏冪礌鏈韩銆�
+ * @returns {number} 姹傚拰缁撴灉锛圢umber锛屼究浜庤祴鍊肩粰琛ㄥ崟瀛楁锛�
+ */
+export function moneySum(list, selector) {
+ if (!Array.isArray(list) || list.length === 0) {
+ return 0
+ }
+ let acc = new Decimal(0)
+ for (let i = 0; i < list.length; i++) {
+ const raw =
+ selector === undefined
+ ? list[i]
+ : typeof selector === 'function'
+ ? selector(list[i])
+ : list[i][selector]
+ acc = acc.plus(toMoney(raw))
+ }
+ return acc.toNumber()
+}
+
+/**
+ * 姹傚拰鍚庝繚鐣� 2 浣嶅皬鏁帮紙浼樺厛鍦ㄥ睍绀�/钀藉簱鏃朵娇鐢級銆�
+ */
+export function moneySumRound(list, selector) {
+ return roundNumber(moneySum(list, selector))
+}
+
+/**
+ * 绮剧‘鍔犳硶銆傛敮鎸佸鍙傛暟鎴栨暟缁勶細moneyAdd(1.1, 2.2) / moneyAdd([1.1, 2.2])
+ */
+export function moneyAdd(...args) {
+ const list = args.length === 1 && Array.isArray(args[0]) ? args[0] : args
+ let acc = new Decimal(0)
+ list.forEach((v) => {
+ acc = acc.plus(toMoney(v))
+ })
+ return acc.toNumber()
+}
+
+/**
+ * 绮剧‘鍑忔硶 a - b锛堝彲浼犲涓細a - b - c锛�
+ */
+export function moneySub(a, ...rest) {
+ let acc = toMoney(a)
+ rest.forEach((v) => {
+ acc = acc.minus(toMoney(v))
+ })
+ return acc.toNumber()
+}
+
+/**
+ * 绮剧‘涔樻硶锛堝崟浠� 脳 鏁伴噺銆侀噾棰� 脳 绋庣巼锛�
+ */
+export function moneyMul(a, ...rest) {
+ let acc = toMoney(a)
+ rest.forEach((v) => {
+ acc = acc.times(toMoney(v))
+ })
+ return acc.toNumber()
+}
+
+/**
+ * 绮剧‘闄ゆ硶锛堥噾棰� 梅 鏁伴噺锛夛紝divideBy 涓� 0 鏃惰繑鍥� 0锛屼笉浜х敓 Infinity
+ */
+export function moneyDiv(a, b) {
+ const divisor = toMoney(b)
+ if (divisor.isZero()) {
+ return 0
+ }
+ return toMoney(a).div(divisor).toNumber()
+}
+
+/**
+ * 閲戦鏄惁鐩哥瓑锛堝崄杩涘埗绮剧‘姣旇緝锛屼笉鍙楁诞鐐瑰熬宸奖鍝嶏級銆�
+ * 浼氳嚜鍔ㄥ綊涓�鍖栧埌 2 浣嶏紝閬垮厤 100 涓� 100.001 杩欑被杈圭晫璇垽銆�
+ *
+ * @returns {boolean}
+ */
+export function moneyEq(a, b) {
+ return roundDecimal(a).eq(roundDecimal(b))
+}
+
+/**
+ * 閲戦澶у皬姣旇緝锛歛 > b 杩斿洖 1锛宎 < b 杩斿洖 -1锛岀浉绛夎繑鍥� 0
+ */
+export function moneyCmp(a, b) {
+ return roundDecimal(a).cmp(roundDecimal(b))
+}
+
+/**
+ * 淇濈暀 2 浣嶅皬鏁板苟杩斿洖 Number锛堝洓鑸嶄簲鍏ワ紝ROUND_HALF_UP锛夈��
+ * 鐢ㄤ簬璧嬪�肩粰琛ㄥ崟瀛楁銆佸弬涓庡悗绔氦浜掋��
+ *
+ * @param {*} value
+ * @param {number} [scale=2]
+ * @returns {number}
+ */
+export function moneyRound(value, scale = MONEY_SCALE) {
+ return roundDecimal(value, scale).toNumber()
+}
+
+/**
+ * 淇濈暀 2 浣嶅皬鏁板苟杩斿洖瀛楃涓诧紙鐢ㄤ簬閲戦灞曠ず锛岄伩鍏嶅ぇ棰濇椂鍑虹幇绉戝璁℃暟娉曪級銆�
+ *
+ * @param {*} value
+ * @param {number} [scale=2]
+ * @returns {string}
+ */
+export function moneyText(value, scale = MONEY_SCALE) {
+ return roundDecimal(value, scale).toFixed(scale)
+}
+
+/**
+ * 淇濈暀 2 浣嶅皬鏁板苟杩斿洖 Decimal锛屼緵鍚庣画缁х画绮剧‘杩愮畻
+ */
+export function moneyDecimal(value, scale = MONEY_SCALE) {
+ return roundDecimal(value, scale)
+}
+
+function roundDecimal(value, scale = MONEY_SCALE) {
+ return toMoney(value).toDecimalPlaces(scale, Decimal.ROUND_HALF_UP)
+}
+
+// moneySum 鍐呴儴宸茶繑鍥� Number锛岃繖閲岀粺涓�璧板悓涓�濂楀洓鑸嶄簲鍏�
+function roundNumber(value) {
+ return roundDecimal(value).toNumber()
+}
+
+export default {
+ MONEY_SCALE,
+ toMoney,
+ isValidMoney,
+ moneySum,
+ moneySumRound,
+ moneyAdd,
+ moneySub,
+ moneyMul,
+ moneyDiv,
+ moneyEq,
+ moneyCmp,
+ moneyRound,
+ moneyText,
+ moneyDecimal
+}
diff --git a/src/views/home/components/BarChart/index.vue b/src/views/home/components/BarChart/index.vue
index 0ac9b80..7d042ab 100644
--- a/src/views/home/components/BarChart/index.vue
+++ b/src/views/home/components/BarChart/index.vue
@@ -37,8 +37,16 @@
data() {
return {
options: {},
+ // 鑷姩杞挱瀹氭椂鍣ㄥ彞鏌勶紱涓嶆竻鐞嗕細鍦ㄧ粍浠堕攢姣佸悗缁х画瑙﹀彂锛屽鑷村宸查攢姣佸疄渚嬫搷浣�
+ intervalId: null,
};
},
+ beforeDestroy() {
+ if (this.intervalId !== null) {
+ clearInterval(this.intervalId);
+ this.intervalId = null;
+ }
+ },
components: {
Echart,
},
diff --git a/src/views/home/components/BarChart2/index.vue b/src/views/home/components/BarChart2/index.vue
index 02bf911..66baeea 100644
--- a/src/views/home/components/BarChart2/index.vue
+++ b/src/views/home/components/BarChart2/index.vue
@@ -37,8 +37,16 @@
data() {
return {
options: {},
+ // 鑷姩杞挱瀹氭椂鍣ㄥ彞鏌勶紱涓嶆竻鐞嗕細鍦ㄧ粍浠堕攢姣佸悗缁х画瑙﹀彂锛屽鑷村宸查攢姣佸疄渚嬫搷浣�
+ intervalId: null,
};
},
+ beforeDestroy() {
+ if (this.intervalId !== null) {
+ clearInterval(this.intervalId);
+ this.intervalId = null;
+ }
+ },
components: {
Echart,
},
diff --git a/src/views/home/components/BarChart3/index.vue b/src/views/home/components/BarChart3/index.vue
index dfc94a7..f80e664 100644
--- a/src/views/home/components/BarChart3/index.vue
+++ b/src/views/home/components/BarChart3/index.vue
@@ -37,8 +37,16 @@
data() {
return {
options: {},
+ // 鑷姩杞挱瀹氭椂鍣ㄥ彞鏌勶紱涓嶆竻鐞嗕細鍦ㄧ粍浠堕攢姣佸悗缁х画瑙﹀彂锛屽鑷村宸查攢姣佸疄渚嬫搷浣�
+ intervalId: null,
};
},
+ beforeDestroy() {
+ if (this.intervalId !== null) {
+ clearInterval(this.intervalId);
+ this.intervalId = null;
+ }
+ },
components: {
Echart,
},
diff --git a/src/views/home/components/BarChartH/index.vue b/src/views/home/components/BarChartH/index.vue
index 94526c6..1037ab8 100644
--- a/src/views/home/components/BarChartH/index.vue
+++ b/src/views/home/components/BarChartH/index.vue
@@ -41,8 +41,16 @@
data() {
return {
options: {},
+ // 鑷姩杞挱瀹氭椂鍣ㄥ彞鏌勶紱涓嶆竻鐞嗕細鍦ㄧ粍浠堕攢姣佸悗缁х画瑙﹀彂锛屽鑷村宸查攢姣佸疄渚嬫搷浣�
+ intervalId: null,
};
},
+ beforeDestroy() {
+ if (this.intervalId !== null) {
+ clearInterval(this.intervalId);
+ this.intervalId = null;
+ }
+ },
components: {
Echart,
},
diff --git a/src/views/home/components/MapChart/index.vue b/src/views/home/components/MapChart/index.vue
index a1fc886..8f1b89c 100644
--- a/src/views/home/components/MapChart/index.vue
+++ b/src/views/home/components/MapChart/index.vue
@@ -41,8 +41,16 @@
data() {
return {
options: {},
+ // 鑷姩杞挱瀹氭椂鍣ㄥ彞鏌勶紱涓嶆竻鐞嗕細鍦ㄧ粍浠堕攢姣佸悗缁х画瑙﹀彂锛屽鑷村宸查攢姣佸疄渚嬫搷浣�
+ intervalId: null,
};
},
+ beforeDestroy() {
+ if (this.intervalId !== null) {
+ clearInterval(this.intervalId);
+ this.intervalId = null;
+ }
+ },
components: {
Echart,
},
diff --git a/src/views/home/components/line1Chart/index.vue b/src/views/home/components/line1Chart/index.vue
index 5e81580..e85e3db 100644
--- a/src/views/home/components/line1Chart/index.vue
+++ b/src/views/home/components/line1Chart/index.vue
@@ -37,8 +37,16 @@
data() {
return {
options: {},
+ // 鑷姩杞挱瀹氭椂鍣ㄥ彞鏌勶紱涓嶆竻鐞嗕細鍦ㄧ粍浠堕攢姣佸悗缁х画瑙﹀彂锛屽鑷村宸查攢姣佸疄渚嬫搷浣�
+ intervalId: null,
};
},
+ beforeDestroy() {
+ if (this.intervalId !== null) {
+ clearInterval(this.intervalId);
+ this.intervalId = null;
+ }
+ },
components: {
Echart,
},
diff --git a/src/views/home/components/line2Chart/index.vue b/src/views/home/components/line2Chart/index.vue
index 44d6f89..ad87db4 100644
--- a/src/views/home/components/line2Chart/index.vue
+++ b/src/views/home/components/line2Chart/index.vue
@@ -37,8 +37,16 @@
data() {
return {
options: {},
+ // 鑷姩杞挱瀹氭椂鍣ㄥ彞鏌勶紱涓嶆竻鐞嗕細鍦ㄧ粍浠堕攢姣佸悗缁х画瑙﹀彂锛屽鑷村宸查攢姣佸疄渚嬫搷浣�
+ intervalId: null,
};
},
+ beforeDestroy() {
+ if (this.intervalId !== null) {
+ clearInterval(this.intervalId);
+ this.intervalId = null;
+ }
+ },
components: {
Echart,
},
diff --git a/src/views/home/components/lineChart/index.vue b/src/views/home/components/lineChart/index.vue
index 2fc89be..e2c33f5 100644
--- a/src/views/home/components/lineChart/index.vue
+++ b/src/views/home/components/lineChart/index.vue
@@ -36,9 +36,17 @@
},
data() {
return {
- options: {}
+ options: {},
+ // 鑷姩杞挱瀹氭椂鍣ㄥ彞鏌勶紱涓嶆竻鐞嗕細鍦ㄧ粍浠堕攢姣佸悗缁х画瑙﹀彂锛屽鑷村宸查攢姣佸疄渚嬫搷浣�
+ intervalId: null
};
},
+ beforeDestroy() {
+ if (this.intervalId !== null) {
+ clearInterval(this.intervalId);
+ this.intervalId = null;
+ }
+ },
components: {
Echart
},
diff --git a/src/views/project/donorcharge/donorchargedetail/index.vue b/src/views/project/donorcharge/donorchargedetail/index.vue
index 953e979..01356c5 100644
--- a/src/views/project/donorcharge/donorchargedetail/index.vue
+++ b/src/views/project/donorcharge/donorchargedetail/index.vue
@@ -294,6 +294,7 @@
import Li_area_select from "@/components/Address";
import { getUserProfile } from "@/api/system/user";
import { getToken } from "@/utils/auth";
+import { moneySum, moneyRound } from "@/utils/money";
import debounce from "lodash/debounce";
export default {
components: {
@@ -667,27 +668,23 @@
submitForm: debounce(function(data) {
this.$refs["form"].validate(valid => {
if (valid) {
- //鏍¢獙銆佽垂鐢ㄥ悎璁�
- let ChargeSum = 0;
- let ChargeamountSum = 0;
+ //鏍¢獙銆佽垂鐢ㄥ悎璁★紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛�
let organname = "";
try {
for (let i = 0; i < this.donorchargeorgans.length; i++) {
organname += this.donorchargeorgans[i].organname + ",";
- if (!isNaN(parseFloat(this.donorchargeorgans[i].organcharge))) {
- ChargeSum += parseFloat(this.donorchargeorgans[i].organcharge);
- }
- if (!isNaN(parseFloat(this.donorchargeorgans[i].amount))) {
- ChargeamountSum += parseFloat(this.donorchargeorgans[i].amount);
- }
}
this.form.donateorgan = organname.substring(
0,
organname.lastIndexOf(",")
);
- this.form.chargeamount = ChargeSum.toFixed(2);
- this.form.chargeamounted = ChargeamountSum.toFixed(2);
+ this.form.chargeamount = moneyRound(
+ moneySum(this.donorchargeorgans, "organcharge")
+ ).toFixed(2);
+ this.form.chargeamounted = moneyRound(
+ moneySum(this.donorchargeorgans, "amount")
+ ).toFixed(2);
} catch {}
//淇濆瓨
@@ -728,24 +725,16 @@
});
}, 500),
- //璁$畻璐圭敤鍚堣
+ //璁$畻璐圭敤鍚堣锛堥噾棰濅竴寰嬭蛋绮剧‘杩愮畻锛�
chargeSum() {
- let ChargeSum = 0;
- let ChargeamountSum = 0;
-
//璐圭敤鍚堣
try {
- for (let i = 0; i < this.donorchargeorgans.length; i++) {
- if (!isNaN(parseFloat(this.donorchargeorgans[i].organcharge))) {
- ChargeSum += parseFloat(this.donorchargeorgans[i].organcharge);
- }
- if (!isNaN(parseFloat(this.donorchargeorgans[i].amount))) {
- ChargeamountSum += parseFloat(this.donorchargeorgans[i].amount);
- }
- }
-
- this.form.chargeamount = ChargeSum.toFixed(2);
- this.form.chargeamounted = ChargeamountSum.toFixed(2);
+ this.form.chargeamount = moneyRound(
+ moneySum(this.donorchargeorgans, "organcharge")
+ ).toFixed(2);
+ this.form.chargeamounted = moneyRound(
+ moneySum(this.donorchargeorgans, "amount")
+ ).toFixed(2);
} catch {}
},
diff --git a/src/views/project/fund/applyDetail/index.vue b/src/views/project/fund/applyDetail/index.vue
index 60c5e5c..8f7e001 100644
--- a/src/views/project/fund/applyDetail/index.vue
+++ b/src/views/project/fund/applyDetail/index.vue
@@ -786,6 +786,7 @@
import Li_area_select from "@/components/Address";
import OrgSelecter from "@/views/project/components/orgselect";
import { getToken } from "@/utils/auth";
+import { moneySum, moneyMul, moneySub, moneyRound } from "@/utils/money";
import CustomImageViewer from "@/components/CustomImageViewer"; // 鏍规嵁浣犵殑璺緞璋冩暣
export default {
@@ -1607,7 +1608,7 @@
let tempDetail = this.rbDetails[j];
if (
isNaN(parseFloat(tempDetail.amount)) ||
- parseFloat(tempDetail.amount) == 0
+ moneyRound(tempDetail.amount) == 0
) {
this.$modal.msgWarning(
"鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -1622,7 +1623,7 @@
let tempDetail = this.rbDetails[j];
if (
isNaN(parseFloat(tempDetail.amount)) ||
- parseFloat(tempDetail.amount) == 0
+ moneyRound(tempDetail.amount) == 0
) {
this.$modal.msgWarning(
"鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -1633,7 +1634,7 @@
}
if (
isNaN(parseFloat(tempDetail.taxamount)) ||
- parseFloat(tempDetail.taxamount) == 0
+ moneyRound(tempDetail.taxamount) == 0
) {
tempDetail.taxedamount = parseFloat(tempDetail.amount);
} else {
@@ -2105,14 +2106,13 @@
//璁$畻涓◣锛歵ype(A:宸茬煡绋庡墠閲戦锛岃绠楃◣鍚庨噾棰濓紱B锛氬凡鐭ョ◣鍚庨噾棰濓紝璁$畻绋庡墠閲戦)
calculateTax(row, type) {
- let targetValue = 0;
for (let i = 0; i < this.rbDetails.length; i++) {
if (!this.rbDetails[i].amount) {
this.rbDetails[i].amount = 0;
}
- targetValue += parseFloat(this.rbDetails[i].amount); // 鍋囪姣忎釜瀵硅薄涓殑鐗瑰畾鍊煎瓨鍌ㄥ湪'specificValue'灞炴�т笅
}
- this.form.pretaxcost = targetValue;
+ // 鍚堣閲戦蹇呴』绮剧‘绱姞锛屽惁鍒欎細鍐欏叆 form.pretaxcost 骞惰惤搴�
+ this.form.pretaxcost = moneySum(this.rbDetails, "amount");
},
//瀵煎叆鎵�鏈夐」鐩�
@@ -2274,7 +2274,7 @@
let tempDetail = this.rbDetails[j];
if (
isNaN(parseFloat(tempDetail.amount)) ||
- parseFloat(tempDetail.amount) == 0
+ moneyRound(tempDetail.amount) == 0
) {
this.$modal.msgWarning(
"鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -2289,7 +2289,7 @@
let tempDetail = this.rbDetails[j];
if (
isNaN(parseFloat(tempDetail.amount)) ||
- parseFloat(tempDetail.amount) == 0
+ moneyRound(tempDetail.amount) == 0
) {
this.$modal.msgWarning(
"鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -2300,7 +2300,7 @@
}
if (
isNaN(parseFloat(tempDetail.taxamount)) ||
- parseFloat(tempDetail.taxamount) == 0
+ moneyRound(tempDetail.taxamount) == 0
) {
tempDetail.taxedamount = parseFloat(tempDetail.amount);
} else {
@@ -2581,33 +2581,32 @@
});
//鍏ㄩ儴鍒犻櫎鍚庢坊鍔犱竴鏉℃柊琛�
},
- //璁$畻鎬婚噾棰�
+ //璁$畻鎬婚噾棰濓紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛岀姝� parseFloat 绱姞锛�
sumTotalFee(row) {
- let allSum = 0;
+ const detailsArr = [];
if (this.form.applytype != null) {
for (let i = 0; i < this.rbDetails.length; i++) {
+ const detail = this.rbDetails[i];
let totalFee = 0;
let taxFee = 0;
if (this.form.applytype == 1 || this.form.applytype == 2) {
- //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
- if (!isNaN(parseFloat(this.rbDetails[i].amount))) {
- totalFee += parseFloat(this.rbDetails[i].amount);
- taxFee += parseFloat(this.rbDetails[i].amount);
+ //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣锛氱◣鍓� - 鎵g◣
+ if (!isNaN(parseFloat(detail.amount))) {
+ totalFee = moneySub(totalFee, -parseFloat(detail.amount));
+ taxFee = moneySub(taxFee, -parseFloat(detail.amount));
}
- if (!isNaN(parseFloat(this.rbDetails[i].taxamount))) {
- totalFee -= parseFloat(this.rbDetails[i].taxamount);
- taxFee -= parseFloat(this.rbDetails[i].taxamount);
+ if (!isNaN(parseFloat(detail.taxamount))) {
+ totalFee = moneySub(totalFee, detail.taxamount);
+ taxFee = moneySub(taxFee, detail.taxamount);
}
} else if (this.form.applytype == 3 || this.form.applytype == 4) {
//鍗曚环*鏁伴噺=绋庡墠閲戦
if (
- !isNaN(parseFloat(this.rbDetails[i].price)) &&
- !isNaN(parseFloat(this.rbDetails[i].quantity))
+ !isNaN(parseFloat(detail.price)) &&
+ !isNaN(parseFloat(detail.quantity))
) {
- totalFee +=
- parseFloat(this.rbDetails[i].price) *
- parseFloat(this.rbDetails[i].quantity);
- this.rbDetails[i].amount = totalFee;
+ totalFee = moneyMul(detail.price, detail.quantity);
+ detail.amount = totalFee;
}
}
@@ -2616,9 +2615,10 @@
// this.rbDetails[i].taxedamount = taxFee.toFixed(2);
// }
- allSum += totalFee;
+ detailsArr.push(totalFee);
}
}
+ const allSum = moneyRound(moneySum(detailsArr));
// this.form.amountrequested = allSum.toFixed(2);
// this.$forceUpdate();
},
@@ -3321,7 +3321,9 @@
//鐢熷懡鍛ㄦ湡 - 鎸傝浇瀹屾垚锛堝彲浠ヨ闂瓺OM鍏冪礌锛�
mounted() {
- window.addEventListener("beforeunload", e => this.beforeunloadHandler(e));
+ // 瀛樹綇鍚屼竴涓紩鐢紝鍚﹀垯 removeEventListener 浼犳柊绠ご鍑芥暟鏃犳硶鐪熸绉婚櫎锛屼細娉勬紡鐩戝惉鍣�
+ this._beforeUnloadHandler = e => this.beforeunloadHandler(e);
+ window.addEventListener("beforeunload", this._beforeUnloadHandler);
this.getUserList();
let apiaccountselectform = this.accountselectform;
let apiform = this.form;
@@ -3337,7 +3339,10 @@
updated() { }, //鐢熷懡鍛ㄦ湡 - 鏇存柊涔嬪悗
beforeDestroy() { }, //鐢熷懡鍛ㄦ湡 - 閿�姣佷箣鍓�
destroyed() {
- window.removeEventListener("beforeunload", e => this.beforeunloadFn(e));
+ if (this._beforeUnloadHandler) {
+ window.removeEventListener("beforeunload", this._beforeUnloadHandler);
+ this._beforeUnloadHandler = null;
+ }
}, //鐢熷懡鍛ㄦ湡 - 閿�姣佸畬鎴�
activated() { } //濡傛灉椤甸潰鏈塳eep-alive缂撳瓨鍔熻兘锛岃繖涓嚱鏁颁細瑙﹀彂
};
diff --git a/src/views/project/fund/applyDetail0/index.vue b/src/views/project/fund/applyDetail0/index.vue
index 9671250..b84928d 100644
--- a/src/views/project/fund/applyDetail0/index.vue
+++ b/src/views/project/fund/applyDetail0/index.vue
@@ -1227,6 +1227,7 @@
import Li_area_select from "@/components/Address";
import OrgSelecter from "@/views/project/components/orgselect";
import { getToken } from "@/utils/auth";
+import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money";
export default {
//import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
@@ -2876,32 +2877,28 @@
}
},
- //璁$畻鎬婚噾棰�
+ //璁$畻鎬婚噾棰濓紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛�
sumTotalFee(row) {
- let allSum = 0;
+ const detailsArr = [];
if (this.form.applytype != null) {
for (let i = 0; i < this.rbDetails.length; i++) {
+ const detail = this.rbDetails[i];
let totalFee = 0;
- let taxFee = 0;
if (this.form.applytype == 1 || this.form.applytype == 2) {
- //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
- if (!isNaN(parseFloat(this.rbDetails[i].amount))) {
- totalFee += parseFloat(this.rbDetails[i].amount);
- taxFee += parseFloat(this.rbDetails[i].amount);
+ //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣锛氱◣鍓� - 鎵g◣
+ if (!isNaN(parseFloat(detail.amount))) {
+ totalFee = moneyAdd(totalFee, detail.amount);
}
- if (!isNaN(parseFloat(this.rbDetails[i].taxamount))) {
- totalFee -= parseFloat(this.rbDetails[i].taxamount);
- taxFee -= parseFloat(this.rbDetails[i].taxamount);
+ if (!isNaN(parseFloat(detail.taxamount))) {
+ totalFee = moneySub(totalFee, detail.taxamount);
}
} else if (this.form.applytype == 3 || this.form.applytype == 4) {
//鍗曚环*鏁伴噺=绋庡墠閲戦
if (
- !isNaN(parseFloat(this.rbDetails[i].price)) &&
- !isNaN(parseFloat(this.rbDetails[i].quantity))
+ !isNaN(parseFloat(detail.price)) &&
+ !isNaN(parseFloat(detail.quantity))
) {
- totalFee +=
- parseFloat(this.rbDetails[i].price) *
- parseFloat(this.rbDetails[i].quantity);
+ totalFee = moneyMul(detail.price, detail.quantity);
this.rbDetails[i].amount = totalFee;
}
}
@@ -2911,10 +2908,10 @@
// this.rbDetails[i].taxedamount = taxFee.toFixed(2);
// }
- allSum += totalFee;
+ detailsArr.push(totalFee);
}
}
- // this.form.amountrequested = allSum.toFixed(2);
+ // this.form.amountrequested = moneyRound(moneySum(detailsArr)).toFixed(2);
// this.$forceUpdate();
},
@@ -3279,13 +3276,13 @@
//鐢熷懡鍛ㄦ湡 - 鎸傝浇瀹屾垚锛堝彲浠ヨ闂瓺OM鍏冪礌锛�
mounted() {
- window.addEventListener("beforeunload", e => this.beforeunloadHandler(e));
+ // 瀛樹綇鍚屼竴涓紩鐢紝鍚﹀垯 removeEventListener 浼犳柊绠ご鍑芥暟鏃犳硶鐪熸绉婚櫎锛屼細娉勬紡鐩戝惉鍣�
+ this._beforeUnloadHandler = e => this.beforeunloadHandler(e);
+ window.addEventListener("beforeunload", this._beforeUnloadHandler);
this.getUserList();
this.getUserProfile();
let apifunddetailForm = this.funddetailForm;
let apiform = this.form;
- console.log(apiform);
- console.log(apifunddetailForm);
// this.getFeeUnitList();
},
@@ -3294,7 +3291,12 @@
beforeMount() {}, //鐢熷懡鍛ㄦ湡 - 鎸傝浇涔嬪墠
beforeUpdate() {}, //鐢熷懡鍛ㄦ湡 - 鏇存柊涔嬪墠
updated() {}, //鐢熷懡鍛ㄦ湡 - 鏇存柊涔嬪悗
- beforeDestroy() {}, //鐢熷懡鍛ㄦ湡 - 閿�姣佷箣鍓�
+ beforeDestroy() {
+ if (this._beforeUnloadHandler) {
+ window.removeEventListener("beforeunload", this._beforeUnloadHandler);
+ this._beforeUnloadHandler = null;
+ }
+ }, //鐢熷懡鍛ㄦ湡 - 閿�姣佷箣鍓�
destroyed() {}, //鐢熷懡鍛ㄦ湡 - 閿�姣佸畬鎴�
activated() {} //濡傛灉椤甸潰鏈塳eep-alive缂撳瓨鍔熻兘锛岃繖涓嚱鏁颁細瑙﹀彂
};
diff --git a/src/views/project/fund/ethicalExpertFeeApply/index.vue b/src/views/project/fund/ethicalExpertFeeApply/index.vue
index ab8dad1..5be6779 100644
--- a/src/views/project/fund/ethicalExpertFeeApply/index.vue
+++ b/src/views/project/fund/ethicalExpertFeeApply/index.vue
@@ -960,6 +960,7 @@
import { getUserProfile } from "@/api/system/user";
import { listFundflow } from "@/api/project/fundflow";
import { getToken } from "@/utils/auth";
+import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money";
export default {
//import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
@@ -1360,15 +1361,11 @@
// } catch {
// tempDetail.unitname = tempDetail.unitno;
// }
- if (!isNaN(parseFloat(tempDetail.amount))) {
- totalPreTaxAmount += parseFloat(tempDetail.amount);
- totalAmount += parseFloat(tempDetail.amount);
- }
- if (!isNaN(parseFloat(tempDetail.taxedamount))) {
- totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
- totalAmount += parseFloat(tempDetail.taxedamount);
- }
}
+ //閲戦涓�寰嬭蛋绮剧‘杩愮畻锛岀姝� parseFloat 绱姞
+ totalPreTaxAmount = moneySum(this.fundDetailArr, "amount");
+ totalAfterTaxAmount = moneySum(this.fundDetailArr, "taxedamount");
+ totalAmount = moneyAdd(totalPreTaxAmount, totalAfterTaxAmount);
try {
this.form.unitname = this.$refs.orgSelecter.getOptionByValue(
this.form.unitno
@@ -1736,49 +1733,45 @@
});
},
- //璁$畻鎬婚噾棰�
+ //璁$畻鎬婚噾棰濓紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛岀姝� parseFloat 绱姞锛�
sumTotalFee() {
- let allSum = 0;
+ const detailsArr = [];
let preTaxSum = 0;
let taxedSum = 0;
if (this.form.applytype != null) {
for (let i = 0; i < this.fundDetailArr.length; i++) {
+ const detail = this.fundDetailArr[i];
let totalFee = 0;
- let taxFee = 0;
if (this.form.applytype == 1 || this.form.applytype == 2) {
- //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
- if (!isNaN(parseFloat(this.fundDetailArr[i].amount))) {
- totalFee += parseFloat(this.fundDetailArr[i].amount);
- taxFee += parseFloat(this.fundDetailArr[i].amount);
- preTaxSum += parseFloat(this.fundDetailArr[i].amount);
+ //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣锛氱◣鍓� - 鎵g◣
+ if (!isNaN(parseFloat(detail.amount))) {
+ totalFee = moneyAdd(totalFee, detail.amount);
+ preTaxSum = moneyAdd(preTaxSum, detail.amount);
}
- if (!isNaN(parseFloat(this.fundDetailArr[i].taxamount))) {
- totalFee -= parseFloat(this.fundDetailArr[i].taxamount);
- taxFee -= parseFloat(this.fundDetailArr[i].taxamount);
+ if (!isNaN(parseFloat(detail.taxamount))) {
+ totalFee = moneySub(totalFee, detail.taxamount);
}
//taxedamount
- if (!isNaN(parseFloat(this.fundDetailArr[i].taxedamount))) {
- taxedSum += parseFloat(this.fundDetailArr[i].taxedamount);
+ if (!isNaN(parseFloat(detail.taxedamount))) {
+ taxedSum = moneyAdd(taxedSum, detail.taxedamount);
}
} else if (this.form.applytype == 3) {
if (
- !isNaN(parseFloat(this.fundDetailArr[i].price)) &&
- !isNaN(parseFloat(this.fundDetailArr[i].quantity))
+ !isNaN(parseFloat(detail.price)) &&
+ !isNaN(parseFloat(detail.quantity))
) {
- totalFee +=
- parseFloat(this.fundDetailArr[i].price) *
- parseFloat(this.fundDetailArr[i].quantity);
+ totalFee = moneyMul(detail.price, detail.quantity);
}
}
// if (!isNaN(parseFloat(taxFee))) {
// this.fundDetailArr[i].taxedamount = taxFee.toFixed(2);
// }
- allSum += totalFee;
+ detailsArr.push(totalFee);
}
}
- this.form.amountrequested = allSum.toFixed(2);
- this.form.pretaxcost = preTaxSum.toFixed(2);
- this.form.taxedcost = taxedSum.toFixed(2);
+ this.form.amountrequested = moneyRound(moneySum(detailsArr)).toFixed(2);
+ this.form.pretaxcost = moneyRound(preTaxSum).toFixed(2);
+ this.form.taxedcost = moneyRound(taxedSum).toFixed(2);
this.$forceUpdate();
},
diff --git a/src/views/project/fund/expertFeeApply/index.vue b/src/views/project/fund/expertFeeApply/index.vue
index e3bc9f3..4f61c94 100644
--- a/src/views/project/fund/expertFeeApply/index.vue
+++ b/src/views/project/fund/expertFeeApply/index.vue
@@ -1159,6 +1159,7 @@
import OrgSelecter from "@/views/project/components/orgselect";
import elementIcons from "../../../components/icons/element-icons";
import { getToken } from "@/utils/auth";
+import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money";
export default {
//import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
@@ -2451,43 +2452,34 @@
//璁$畻涓◣
calculateTax() {},
- //璁$畻鎬婚噾棰�
+ //璁$畻鎬婚噾棰濓紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛�
sumTotalFee(row) {
- let allSum = 0;
+ const detailsArr = [];
if (this.form.applytype != null) {
for (let i = 0; i < this.fundDetails.length; i++) {
+ const detail = this.fundDetails[i];
let totalFee = 0;
- let taxFee = 0;
if (this.form.applytype == 1 || this.form.applytype == 2) {
- //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
- if (!isNaN(parseFloat(this.fundDetails[i].amount))) {
- totalFee += parseFloat(this.fundDetails[i].amount);
- taxFee += parseFloat(this.fundDetails[i].amount);
+ //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣锛氱◣鍓� - 鎵g◣
+ if (!isNaN(parseFloat(detail.amount))) {
+ totalFee = moneyAdd(totalFee, detail.amount);
}
- if (!isNaN(parseFloat(this.fundDetails[i].taxamount))) {
- totalFee -= parseFloat(this.fundDetails[i].taxamount);
- taxFee -= parseFloat(this.fundDetails[i].taxamount);
+ if (!isNaN(parseFloat(detail.taxamount))) {
+ totalFee = moneySub(totalFee, detail.taxamount);
}
} else if (this.form.applytype == 3) {
if (
- !isNaN(parseFloat(this.fundDetails[i].price)) &&
- !isNaN(parseFloat(this.fundDetails[i].quantity))
+ !isNaN(parseFloat(detail.price)) &&
+ !isNaN(parseFloat(detail.quantity))
) {
- totalFee +=
- parseFloat(this.fundDetails[i].price) *
- parseFloat(this.fundDetails[i].quantity);
+ totalFee = moneyMul(detail.price, detail.quantity);
}
}
-
- //绋庡墠銆佺◣鍚庨渶瑕佺嫭绔嬪綍鍏�
- // if (!isNaN(parseFloat(taxFee))) {
- // this.fundDetails[i].taxedamount = taxFee.toFixed(2);
- // }
-
- allSum += totalFee;
+ detailsArr.push(totalFee);
}
}
- // this.form.amountrequested = allSum.toFixed(2);
+ // 鍚堣浠嶅湪纭鍙e緞鍚庡惎鐢紱鍏堜繚璇佽绠楁湰韬槸绮剧‘鐨�
+ // this.form.amountrequested = moneyRound(moneySum(detailsArr)).toFixed(2);
// this.$forceUpdate();
},
diff --git a/src/views/project/fund/medicalCostApply/index.vue b/src/views/project/fund/medicalCostApply/index.vue
index 208cc78..d1212ab 100644
--- a/src/views/project/fund/medicalCostApply/index.vue
+++ b/src/views/project/fund/medicalCostApply/index.vue
@@ -335,6 +335,7 @@
import { getUserProfile } from "@/api/system/user";
import { listFundflow } from "@/api/project/fundflow";
import { getToken } from "@/utils/auth";
+import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money";
export default {
//import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
@@ -1190,41 +1191,40 @@
});
},
- //璁$畻鎬婚噾棰�
+ //璁$畻鎬婚噾棰濓紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛岀姝� parseFloat 绱姞锛�
sumTotalFee(row) {
- let allSum = 0;
+ const detailsArr = [];
if (this.form.applytype != null) {
for (let i = 0; i < this.fundDetails.length; i++) {
+ const detail = this.fundDetails[i];
let totalFee = 0;
let taxFee = 0;
if (this.form.applytype == 1 || this.form.applytype == 2) {
- //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
- if (!isNaN(parseFloat(this.fundDetails[i].amount))) {
- totalFee += parseFloat(this.fundDetails[i].amount);
- taxFee += parseFloat(this.fundDetails[i].amount);
+ //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣锛氱◣鍓� - 鎵g◣
+ if (!isNaN(parseFloat(detail.amount))) {
+ totalFee = moneyAdd(totalFee, detail.amount);
+ taxFee = moneyAdd(taxFee, detail.amount);
}
- if (!isNaN(parseFloat(this.fundDetails[i].taxamount))) {
- totalFee -= parseFloat(this.fundDetails[i].taxamount);
- taxFee -= parseFloat(this.fundDetails[i].taxamount);
+ if (!isNaN(parseFloat(detail.taxamount))) {
+ totalFee = moneySub(totalFee, detail.taxamount);
+ taxFee = moneySub(taxFee, detail.taxamount);
}
} else if (this.form.applytype == 3) {
if (
- !isNaN(parseFloat(this.fundDetails[i].price)) &&
- !isNaN(parseFloat(this.fundDetails[i].quantity))
+ !isNaN(parseFloat(detail.price)) &&
+ !isNaN(parseFloat(detail.quantity))
) {
- totalFee +=
- parseFloat(this.fundDetails[i].price) *
- parseFloat(this.fundDetails[i].quantity);
+ totalFee = moneyMul(detail.price, detail.quantity);
}
}
if (!isNaN(parseFloat(taxFee))) {
- this.fundDetails[i].taxedamount = taxFee.toFixed(2);
+ this.fundDetails[i].taxedamount = moneyRound(taxFee).toFixed(2);
}
- allSum += totalFee;
+ detailsArr.push(totalFee);
}
}
//this.form.amountrequested = allSum.toFixed(2);
- this.$set(this.form, "amountrequested", allSum.toFixed(2));
+ this.$set(this.form, "amountrequested", moneyRound(moneySum(detailsArr)).toFixed(2));
//this.$forceUpdate();
},
diff --git a/src/views/project/fund/officeExpenseApply/index.vue b/src/views/project/fund/officeExpenseApply/index.vue
index ac02615..3c72b6b 100644
--- a/src/views/project/fund/officeExpenseApply/index.vue
+++ b/src/views/project/fund/officeExpenseApply/index.vue
@@ -1709,41 +1709,40 @@
});
},
- //璁$畻鎬婚噾棰�
+ //璁$畻鎬婚噾棰濓紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛岀姝� parseFloat 绱姞锛�
sumTotalFee(row) {
- let allSum = 0;
+ const detailsArr = [];
if (this.form.applytype != null) {
for (let i = 0; i < this.fundDetails.length; i++) {
+ const detail = this.fundDetails[i];
let totalFee = 0;
let taxFee = 0;
if (this.form.applytype == 1 || this.form.applytype == 2) {
- //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
- if (!isNaN(parseFloat(this.fundDetails[i].amount))) {
- totalFee += parseFloat(this.fundDetails[i].amount);
- taxFee += parseFloat(this.fundDetails[i].amount);
+ //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣锛氱◣鍓� - 鎵g◣
+ if (!isNaN(parseFloat(detail.amount))) {
+ totalFee = moneyAdd(totalFee, detail.amount);
+ taxFee = moneyAdd(taxFee, detail.amount);
}
- if (!isNaN(parseFloat(this.fundDetails[i].taxamount))) {
- totalFee -= parseFloat(this.fundDetails[i].taxamount);
- taxFee -= parseFloat(this.fundDetails[i].taxamount);
+ if (!isNaN(parseFloat(detail.taxamount))) {
+ totalFee = moneySub(totalFee, detail.taxamount);
+ taxFee = moneySub(taxFee, detail.taxamount);
}
} else if (this.form.applytype == 3) {
if (
- !isNaN(parseFloat(this.fundDetails[i].price)) &&
- !isNaN(parseFloat(this.fundDetails[i].quantity))
+ !isNaN(parseFloat(detail.price)) &&
+ !isNaN(parseFloat(detail.quantity))
) {
- totalFee +=
- parseFloat(this.fundDetails[i].price) *
- parseFloat(this.fundDetails[i].quantity);
+ totalFee = moneyMul(detail.price, detail.quantity);
}
}
if (!isNaN(parseFloat(taxFee))) {
- this.fundDetails[i].taxedamount = taxFee.toFixed(2);
+ this.fundDetails[i].taxedamount = moneyRound(taxFee).toFixed(2);
}
- allSum += totalFee;
+ detailsArr.push(totalFee);
}
}
//this.form.amountrequested = allSum.toFixed(2);
- this.$set(this.form, "amountrequested", allSum.toFixed(2));
+ this.$set(this.form, "amountrequested", moneyRound(moneySum(detailsArr)).toFixed(2));
//this.$forceUpdate();
},
diff --git a/src/views/project/fund/performancedetails/index.vue b/src/views/project/fund/performancedetails/index.vue
index 5454ea9..aabeffc 100644
--- a/src/views/project/fund/performancedetails/index.vue
+++ b/src/views/project/fund/performancedetails/index.vue
@@ -876,6 +876,7 @@
import Li_area_select from "@/components/Address";
import OrgSelecter from "@/views/project/components/orgselect";
import { getToken } from "@/utils/auth";
+import { moneySum, moneyAdd, moneySub, moneyRound } from "@/utils/money";
import CustomImageViewer from "@/components/CustomImageViewer";
export default {
@@ -2065,9 +2066,8 @@
}
},
- //绋庡墠鎵g◣绠楃◣鍚�
+ //绋庡墠鎵g◣绠楃◣鍚庯紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛�
chargeSum(row, type) {
- let targetValue = 0;
for (let i = 0; i < this.rbDetails.length; i++) {
if (!this.rbDetails[i].amount) {
this.rbDetails[i].amount = 0;
@@ -2075,17 +2075,16 @@
if (!this.rbDetails[i].taxamount) {
this.rbDetails[i].taxamount = 0;
}
- this.rbDetails[i].taxedamount = (
- parseFloat(this.rbDetails[i].amount) -
- parseFloat(this.rbDetails[i].taxamount)
+ //绋庡墠 - 鎵g◣ = 绋庡悗锛堟诞鐐圭浉鍑忎細娈嬬暀鏋佸皬灏惧樊锛屽鑷村嚭鐜� -0.00锛�
+ this.rbDetails[i].taxedamount = moneySub(
+ this.rbDetails[i].amount,
+ this.rbDetails[i].taxamount
).toFixed(2);
- targetValue += parseFloat(this.rbDetails[i].amount); // 鍋囪姣忎釜瀵硅薄涓殑鐗瑰畾鍊煎瓨鍌ㄥ湪'specificValue'灞炴�т笅
- console.log(this.rbDetails[i].taxedamount, "鍚堣");
}
- console.log(targetValue, "鍚堣");
- this.form.pretaxcost = targetValue;
+ //鍚堣蹇呴』绮剧‘绱姞锛屽惁鍒欎細鍐欏叆 form.pretaxcost 骞惰惤搴�
+ this.form.pretaxcost = moneySum(this.rbDetails, "amount");
},
- //绋庡悗鎵g◣绠楃◣鍓�
+ //绋庡悗鎵g◣绠楃◣鍓嶏紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛�
queenchargeSum(row, type) {
for (let i = 0; i < this.rbDetails.length; i++) {
if (!this.rbDetails[i].amount) {
@@ -2094,9 +2093,10 @@
if (!this.rbDetails[i].taxamount) {
this.rbDetails[i].taxamount = 0;
}
- this.rbDetails[i].amount =
- parseFloat(this.rbDetails[i].taxamount) +
- parseFloat(this.rbDetails[i].taxedamount);
+ //鎵g◣ + 绋庡悗 = 绋庡墠锛堝繀椤荤簿纭浉鍔犲苟褰掍竴鍖栧埌 2 浣嶏紝鍚﹀垯浼氭畫鐣欓暱灏忔暟锛�
+ this.rbDetails[i].amount = moneyRound(
+ moneyAdd(this.rbDetails[i].taxamount, this.rbDetails[i].taxedamount)
+ );
}
},
diff --git a/src/views/project/fundcheck/ethicalExpertFeeCheck/index.vue b/src/views/project/fundcheck/ethicalExpertFeeCheck/index.vue
index d882563..f891b4b 100644
--- a/src/views/project/fundcheck/ethicalExpertFeeCheck/index.vue
+++ b/src/views/project/fundcheck/ethicalExpertFeeCheck/index.vue
@@ -437,6 +437,7 @@
// 瀵煎叆鏈湴瀛樺偍鐨勬柟娉�
import { setItem, grtItem, removeItem } from "@/utils/storage.js";
+import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money";
export default {
components: {
@@ -1469,49 +1470,45 @@
});
},
- //璁$畻鎬婚噾棰�
+ //璁$畻鎬婚噾棰濓紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛岀姝� parseFloat 绱姞锛�
sumTotalFee() {
- let allSum = 0;
+ const detailsArr = [];
let preTaxSum = 0;
let taxedSum = 0;
if (this.form.applytype != null) {
for (let i = 0; i < this.fundDetailArr.length; i++) {
+ const detail = this.fundDetailArr[i];
let totalFee = 0;
- let taxFee = 0;
if (this.form.applytype == 1 || this.form.applytype == 2) {
- //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
- if (!isNaN(parseFloat(this.fundDetailArr[i].amount))) {
- totalFee += parseFloat(this.fundDetailArr[i].amount);
- taxFee += parseFloat(this.fundDetailArr[i].amount);
- preTaxSum += parseFloat(this.fundDetailArr[i].amount);
+ //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣锛氱◣鍓� - 鎵g◣
+ if (!isNaN(parseFloat(detail.amount))) {
+ totalFee = moneyAdd(totalFee, detail.amount);
+ preTaxSum = moneyAdd(preTaxSum, detail.amount);
}
- if (!isNaN(parseFloat(this.fundDetailArr[i].taxamount))) {
- totalFee -= parseFloat(this.fundDetailArr[i].taxamount);
- taxFee -= parseFloat(this.fundDetailArr[i].taxamount);
+ if (!isNaN(parseFloat(detail.taxamount))) {
+ totalFee = moneySub(totalFee, detail.taxamount);
}
//taxedamount
- if (!isNaN(parseFloat(this.fundDetailArr[i].taxedamount))) {
- taxedSum += parseFloat(this.fundDetailArr[i].taxedamount);
+ if (!isNaN(parseFloat(detail.taxedamount))) {
+ taxedSum = moneyAdd(taxedSum, detail.taxedamount);
}
} else if (this.form.applytype == 3) {
if (
- !isNaN(parseFloat(this.fundDetailArr[i].price)) &&
- !isNaN(parseFloat(this.fundDetailArr[i].quantity))
+ !isNaN(parseFloat(detail.price)) &&
+ !isNaN(parseFloat(detail.quantity))
) {
- totalFee +=
- parseFloat(this.fundDetailArr[i].price) *
- parseFloat(this.fundDetailArr[i].quantity);
+ totalFee = moneyMul(detail.price, detail.quantity);
}
}
// if (!isNaN(parseFloat(taxFee))) {
// this.fundDetailArr[i].taxedamount = taxFee.toFixed(2);
// }
- allSum += totalFee;
+ detailsArr.push(totalFee);
}
}
- this.form.amountrequested = allSum.toFixed(2);
- this.form.pretaxcost = preTaxSum.toFixed(2);
- this.form.taxedcost = taxedSum.toFixed(2);
+ this.form.amountrequested = moneyRound(moneySum(detailsArr)).toFixed(2);
+ this.form.pretaxcost = moneyRound(preTaxSum).toFixed(2);
+ this.form.taxedcost = moneyRound(taxedSum).toFixed(2);
this.$forceUpdate();
console.log(this.form);
},
diff --git a/src/views/project/fundcheck/medicalCostCheck/index.vue b/src/views/project/fundcheck/medicalCostCheck/index.vue
index 464203a..6d247fc 100644
--- a/src/views/project/fundcheck/medicalCostCheck/index.vue
+++ b/src/views/project/fundcheck/medicalCostCheck/index.vue
@@ -496,6 +496,7 @@
import { listDept } from "@/api/system/dept";
import { getToken } from "@/utils/auth";
import { setItem, grtItem, removeItem } from "@/utils/storage.js";
+import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money";
export default {
components: {
@@ -1443,41 +1444,40 @@
// });
},
- //璁$畻鎬婚噾棰�
+ //璁$畻鎬婚噾棰濓紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛岀姝� parseFloat 绱姞锛�
sumTotalFee() {
- let allSum = 0;
+ const detailsArr = [];
if (this.form.applytype != null) {
for (let i = 0; i < this.fundDetailArr.length; i++) {
+ const detail = this.fundDetailArr[i];
let totalFee = 0;
let taxFee = 0;
if (this.form.applytype == 1 || this.form.applytype == 2) {
- //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
- if (!isNaN(parseFloat(this.fundDetailArr[i].amount))) {
- totalFee += parseFloat(this.fundDetailArr[i].amount);
- taxFee += parseFloat(this.fundDetailArr[i].amount);
+ //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣锛氱◣鍓� - 鎵g◣
+ if (!isNaN(parseFloat(detail.amount))) {
+ totalFee = moneyAdd(totalFee, detail.amount);
+ taxFee = moneyAdd(taxFee, detail.amount);
}
- if (!isNaN(parseFloat(this.fundDetailArr[i].taxamount))) {
- totalFee -= parseFloat(this.fundDetailArr[i].taxamount);
- taxFee -= parseFloat(this.fundDetailArr[i].taxamount);
+ if (!isNaN(parseFloat(detail.taxamount))) {
+ totalFee = moneySub(totalFee, detail.taxamount);
+ taxFee = moneySub(taxFee, detail.taxamount);
}
} else if (this.form.applytype == 3) {
if (
- !isNaN(parseFloat(this.fundDetailArr[i].price)) &&
- !isNaN(parseFloat(this.fundDetailArr[i].quantity))
+ !isNaN(parseFloat(detail.price)) &&
+ !isNaN(parseFloat(detail.quantity))
) {
- totalFee +=
- parseFloat(this.fundDetailArr[i].price) *
- parseFloat(this.fundDetailArr[i].quantity);
+ totalFee = moneyMul(detail.price, detail.quantity);
}
}
if (!isNaN(parseFloat(taxFee))) {
- this.fundDetailArr[i].taxedamount = taxFee.toFixed(2);
+ this.fundDetailArr[i].taxedamount = moneyRound(taxFee).toFixed(2);
}
- allSum += totalFee;
+ detailsArr.push(totalFee);
}
}
//this.form.amountrequested = allSum.toFixed(2);
- this.$set(this.form, "amountrequested", allSum.toFixed(2));
+ this.$set(this.form, "amountrequested", moneyRound(moneySum(detailsArr)).toFixed(2));
//this.$forceUpdate();
},
diff --git a/src/views/project/fundcheck/officeExpenseCheck/index.vue b/src/views/project/fundcheck/officeExpenseCheck/index.vue
index 45b6ac6..e048953 100644
--- a/src/views/project/fundcheck/officeExpenseCheck/index.vue
+++ b/src/views/project/fundcheck/officeExpenseCheck/index.vue
@@ -499,6 +499,7 @@
import { listDept } from "@/api/system/dept";
import { getToken } from "@/utils/auth";
import { setItem, grtItem, removeItem } from "@/utils/storage.js";
+import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money";
export default {
components: {
@@ -1448,41 +1449,40 @@
// });
},
- //璁$畻鎬婚噾棰�
+ //璁$畻鎬婚噾棰濓紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛岀姝� parseFloat 绱姞锛�
sumTotalFee() {
- let allSum = 0;
+ const detailsArr = [];
if (this.form.applytype != null) {
for (let i = 0; i < this.fundDetailArr.length; i++) {
+ const detail = this.fundDetailArr[i];
let totalFee = 0;
let taxFee = 0;
if (this.form.applytype == 1 || this.form.applytype == 2) {
- //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
- if (!isNaN(parseFloat(this.fundDetailArr[i].amount))) {
- totalFee += parseFloat(this.fundDetailArr[i].amount);
- taxFee += parseFloat(this.fundDetailArr[i].amount);
+ //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣锛氱◣鍓� - 鎵g◣
+ if (!isNaN(parseFloat(detail.amount))) {
+ totalFee = moneyAdd(totalFee, detail.amount);
+ taxFee = moneyAdd(taxFee, detail.amount);
}
- if (!isNaN(parseFloat(this.fundDetailArr[i].taxamount))) {
- totalFee -= parseFloat(this.fundDetailArr[i].taxamount);
- taxFee -= parseFloat(this.fundDetailArr[i].taxamount);
+ if (!isNaN(parseFloat(detail.taxamount))) {
+ totalFee = moneySub(totalFee, detail.taxamount);
+ taxFee = moneySub(taxFee, detail.taxamount);
}
} else if (this.form.applytype == 3) {
if (
- !isNaN(parseFloat(this.fundDetailArr[i].price)) &&
- !isNaN(parseFloat(this.fundDetailArr[i].quantity))
+ !isNaN(parseFloat(detail.price)) &&
+ !isNaN(parseFloat(detail.quantity))
) {
- totalFee +=
- parseFloat(this.fundDetailArr[i].price) *
- parseFloat(this.fundDetailArr[i].quantity);
+ totalFee = moneyMul(detail.price, detail.quantity);
}
}
if (!isNaN(parseFloat(taxFee))) {
- this.fundDetailArr[i].taxedamount = taxFee.toFixed(2);
+ this.fundDetailArr[i].taxedamount = moneyRound(taxFee).toFixed(2);
}
- allSum += totalFee;
+ detailsArr.push(totalFee);
}
}
//this.form.amountrequested = allSum.toFixed(2);
- this.$set(this.form, "amountrequested", allSum.toFixed(2));
+ this.$set(this.form, "amountrequested", moneyRound(moneySum(detailsArr)).toFixed(2));
//this.$forceUpdate();
},
diff --git a/src/views/project/tallage/computingBill/index.vue b/src/views/project/tallage/computingBill/index.vue
index 50bcbba..ed59471 100644
--- a/src/views/project/tallage/computingBill/index.vue
+++ b/src/views/project/tallage/computingBill/index.vue
@@ -570,6 +570,7 @@
import Li_area_select from "@/components/Address";
import { getUserProfile } from "@/api/system/user";
import { getToken } from "@/utils/auth";
+import { moneySum, moneyRound } from "@/utils/money";
import {
ExpertfeeListnb,
getFundtax,
@@ -1110,23 +1111,16 @@
this.$modal.msgError("娉ㄦ剰瀹炴敹閲戦涓嶇瓑浜庡簲鏀堕噾棰濓紝璇锋牳瀵规暟鎹紒");
}
},
- //淇敼瀹炴敹鎴栧簲鏀跺悗瑙﹀彂
+ //淇敼瀹炴敹鎴栧簲鏀跺悗瑙﹀彂锛堥噾棰濅竴寰嬭蛋绮剧‘杩愮畻锛�
chargeSum() {
- let ChargeSum = 0;
- let ChargeamountSum = 0;
-
//璐圭敤鍚堣
try {
- for (let i = 0; i < this.donorchargeorgans.length; i++) {
- if (!isNaN(parseFloat(this.donorchargeorgans[i].organcharge))) {
- ChargeSum += parseFloat(this.donorchargeorgans[i].organcharge);
- }
- if (!isNaN(parseFloat(this.donorchargeorgans[i].amount))) {
- ChargeamountSum += parseFloat(this.donorchargeorgans[i].amount);
- }
- }
- this.form.receivableamount = ChargeSum.toFixed(2);
- this.form.receivedamount = ChargeamountSum.toFixed(2);
+ this.form.receivableamount = moneyRound(
+ moneySum(this.donorchargeorgans, "organcharge")
+ ).toFixed(2);
+ this.form.receivedamount = moneyRound(
+ moneySum(this.donorchargeorgans, "amount")
+ ).toFixed(2);
} catch {}
},
diff --git a/src/views/project/travelexpenseapply/edit.vue b/src/views/project/travelexpenseapply/edit.vue
index d888db5..dd4e719 100644
--- a/src/views/project/travelexpenseapply/edit.vue
+++ b/src/views/project/travelexpenseapply/edit.vue
@@ -340,6 +340,7 @@
} from "@/api/project/organization";
import { listDonatebaseinfo } from "@/api/project/donatebaseinfo";
import { getToken } from "@/utils/auth";
+import { moneySum } from "@/utils/money";
export default {
data() {
return {
@@ -673,41 +674,25 @@
//鍑犵偣鍙栨秷鐨勬彁绀�
});
},
- //璁$畻璐圭敤鍚堣
+ //璁$畻璐圭敤鍚堣锛堥噾棰濅竴寰嬭蛋绮剧‘杩愮畻锛岀姝� parseFloat 绱姞锛�
sumTotalFee() {
- let allSum = 0;
try {
for (let i = 0; i < this.applicationDetailArr.length; i++) {
- let totalFee = 0;
+ const row = this.applicationDetailArr[i];
//璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
- if (!isNaN(parseFloat(this.applicationDetailArr[i].trafficexpense))) {
- totalFee += parseFloat(this.applicationDetailArr[i].trafficexpense);
- }
- if (!isNaN(parseFloat(this.applicationDetailArr[i].cityfee))) {
- totalFee += parseFloat(this.applicationDetailArr[i].cityfee);
- }
- if (!isNaN(parseFloat(this.applicationDetailArr[i].hotelexpense))) {
- totalFee += parseFloat(this.applicationDetailArr[i].hotelexpense);
- }
- if (!isNaN(parseFloat(this.applicationDetailArr[i].otherexpense))) {
- totalFee += parseFloat(this.applicationDetailArr[i].otherexpense);
- }
- if (!isNaN(parseFloat(this.applicationDetailArr[i].foodexpenses))) {
- totalFee += parseFloat(this.applicationDetailArr[i].foodexpenses);
- }
- if (!isNaN(parseFloat(this.applicationDetailArr[i].foodallowance))) {
- totalFee += parseFloat(this.applicationDetailArr[i].foodallowance);
- }
- if (!isNaN(parseFloat(this.applicationDetailArr[i].otherfeeamount))) {
- totalFee += parseFloat(this.applicationDetailArr[i].otherfeeamount);
- }
- this.applicationDetailArr[i].total = parseFloat(totalFee).toFixed(2);
- this.$set(this.applicationDetailArr, i, this.applicationDetailArr[i]);
- if (!isNaN(parseFloat(this.applicationDetailArr[i].total))) {
- allSum += parseFloat(this.applicationDetailArr[i].total);
- }
+ const totalFee = moneySum([
+ row.trafficexpense,
+ row.cityfee,
+ row.hotelexpense,
+ row.otherexpense,
+ row.foodexpenses,
+ row.foodallowance,
+ row.otherfeeamount
+ ]);
+ row.total = totalFee.toFixed(2);
+ this.$set(this.applicationDetailArr, i, row);
}
- this.form.amountrequested = allSum.toFixed(2);
+ this.form.amountrequested = moneySum(this.applicationDetailArr, "total").toFixed(2);
this.form.bigstrmoney = this.convertCurrency(this.form.amountrequested);
} catch { }
},
diff --git a/src/views/project/travelexpenseapply/index.vue b/src/views/project/travelexpenseapply/index.vue
index 8e19f52..ba1f14c 100644
--- a/src/views/project/travelexpenseapply/index.vue
+++ b/src/views/project/travelexpenseapply/index.vue
@@ -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 { }
},
diff --git a/src/views/project/travelexpenseapply/travelexpensedetail/index.vue b/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
index 89c4b0b..410ebbc 100644
--- a/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
+++ b/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
@@ -1305,6 +1305,7 @@
import { listReportname, listUser } from "@/api/project/organization";
import { getToken } from "@/utils/auth";
import debounce from "lodash/debounce";
+import { moneySum, moneyAdd, moneyRound } from "@/utils/money";
export default {
components: {
Treeselect,
@@ -3251,107 +3252,31 @@
},
//璁$畻涓�琛屽悎璁�
- //璁$畻褰撳墠琛屾姤閿�鍐呭璐圭敤鍚堣
+ //璁$畻褰撳墠琛屾姤閿�鍐呭璐圭敤鍚堣锛堥噾棰濅竴寰嬭蛋绮剧‘杩愮畻锛�
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.toFixed(2);
+ const totalFee = moneySum([
+ row.trafficexpense,
+ row.cityfee,
+ row.hotelexpense,
+ row.otherexpense,
+ row.foodexpenses,
+ row.foodallowance,
+ row.otherfeeamount
+ ]);
+ row.total = moneyRound(totalFee).toFixed(2);
- /*
- 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 { }
},
diff --git a/src/views/project/travelexpensecheck/index.vue b/src/views/project/travelexpensecheck/index.vue
index 5b1ba62..3c8ea41 100644
--- a/src/views/project/travelexpensecheck/index.vue
+++ b/src/views/project/travelexpensecheck/index.vue
@@ -678,6 +678,7 @@
import { getUserProfile } from "@/api/system/user";
import { getToken } from "@/utils/auth";
import { setItem, grtItem, removeItem } from "@/utils/storage.js";
+import { moneySum } from "@/utils/money";
export default {
components: {
@@ -1294,41 +1295,25 @@
});
},
- //璁$畻璐圭敤鍚堣
+ //璁$畻璐圭敤鍚堣锛堥噾棰濅竴寰嬭蛋绮剧‘杩愮畻锛岀姝� parseFloat 绱姞锛�
sumTotalFee(scope) {
- let allSum = 0;
try {
for (let i = 0; i < this.rbDetails.length; i++) {
- let totalFee = 0;
+ const row = this.rbDetails[i];
//璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
- if (!isNaN(parseFloat(this.rbDetails[i].trafficexpense))) {
- totalFee += parseFloat(this.rbDetails[i].trafficexpense);
- }
- 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, scope.$index, this.rbDetails[i]);
- if (!isNaN(parseFloat(this.rbDetails[i].total))) {
- allSum += parseFloat(this.rbDetails[i].total);
- }
+ const totalFee = moneySum([
+ row.trafficexpense,
+ row.cityfee,
+ row.hotelexpense,
+ row.otherexpense,
+ row.foodexpenses,
+ row.foodallowance,
+ row.otherfeeamount
+ ]);
+ row.total = totalFee.toFixed(2);
+ this.$set(this.rbDetails, scope.$index, row);
}
- this.form.amountrequested = allSum.toFixed(2);
+ this.form.amountrequested = moneySum(this.rbDetails, "total").toFixed(2);
this.form.bigstrmoney = this.convertCurrency(this.form.amountrequested);
} catch { }
},
diff --git a/src/views/project/unitCost/particulars/index.vue b/src/views/project/unitCost/particulars/index.vue
index 8947231..9fe76f4 100644
--- a/src/views/project/unitCost/particulars/index.vue
+++ b/src/views/project/unitCost/particulars/index.vue
@@ -575,6 +575,7 @@
import Li_area_select from "@/components/Address";
import { getUserProfile } from "@/api/system/user";
import { getToken } from "@/utils/auth";
+import { moneySum, moneyRound } from "@/utils/money";
import debounce from "lodash/debounce";
export default {
components: {
@@ -1089,23 +1090,16 @@
this.$modal.msgError("娉ㄦ剰瀹炴敹閲戦涓嶇瓑浜庡簲鏀堕噾棰濓紝璇锋牳瀵规暟鎹紒");
}
},
- //淇敼瀹炴敹鎴栧簲鏀跺悗瑙﹀彂
+ //淇敼瀹炴敹鎴栧簲鏀跺悗瑙﹀彂锛堥噾棰濅竴寰嬭蛋绮剧‘杩愮畻锛�
chargeSum() {
- let ChargeSum = 0;
- let ChargeamountSum = 0;
-
//璐圭敤鍚堣
try {
- for (let i = 0; i < this.donorchargeorgans.length; i++) {
- if (!isNaN(parseFloat(this.donorchargeorgans[i].organcharge))) {
- ChargeSum += parseFloat(this.donorchargeorgans[i].organcharge);
- }
- if (!isNaN(parseFloat(this.donorchargeorgans[i].amount))) {
- ChargeamountSum += parseFloat(this.donorchargeorgans[i].amount);
- }
- }
- this.form.receivableamount = ChargeSum.toFixed(2);
- this.form.receivedamount = ChargeamountSum.toFixed(2);
+ this.form.receivableamount = moneyRound(
+ moneySum(this.donorchargeorgans, "organcharge")
+ ).toFixed(2);
+ this.form.receivedamount = moneyRound(
+ moneySum(this.donorchargeorgans, "amount")
+ ).toFixed(2);
} catch {}
},
diff --git a/vue.config.js b/vue.config.js
index 8f72f61..d5c694b 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -33,8 +33,8 @@
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
- // target:`http://localhost:8080`,
- target:`http://192.168.100.10:8081`,
+ target:`http://localhost:8080`,
+ // target:`http://192.168.100.10:8081`,
// target:`http://192.168.100.137:8080`,
// target: `https://slb.hospitalstar.com:9093`,
changeOrigin: true,
diff --git "a/\347\234\201\344\272\272\346\260\221opo.zip" "b/\347\234\201\344\272\272\346\260\221opo.zip"
deleted file mode 100644
index cd44616..0000000
--- "a/\347\234\201\344\272\272\346\260\221opo.zip"
+++ /dev/null
Binary files differ
--
Gitblit v1.9.3