From f3312f4970817f57682e8d6be602ae7e9239afab Mon Sep 17 00:00:00 2001
From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com>
Date: Thu, 15 Aug 2024 09:34:06 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E7=AE=97=E9=87=91=E9=A2=9D=E5=A4=84?=
=?UTF-8?q?=E7=95=A5=E5=BE=AE=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../cost/csotSettlement/costApplyAdd.vue | 107 +++++++++++++-----
1 file changed, 77 insertions(+), 30 deletions(-)
diff --git a/sgzb-ui/src/views/cost/csotSettlement/costApplyAdd.vue b/sgzb-ui/src/views/cost/csotSettlement/costApplyAdd.vue
index 161f70dd..f52d00c2 100644
--- a/sgzb-ui/src/views/cost/csotSettlement/costApplyAdd.vue
+++ b/sgzb-ui/src/views/cost/csotSettlement/costApplyAdd.vue
@@ -36,7 +36,6 @@
repairCost
}},报废费用¥{{ scrapCost }},丢失费用{{ loseCost }}
-
-->
-
+ > -->
+
+
-->
-
+ > -->
+
+
= 100000000) {
+
+ if (row.addCost * 1 >= 100000000) {
this.$message.error('增项费用不能超过1亿')
row.addCost = 99999999
}
- row.cost = (
+
+ // 判断减免费用框里金额是否过大,如果过大直接清空为 0 避免负数情况
+ if (
row.leaseCost +
- row.repairCost +
- row.scrapCost +
- row.loseCost +
- row.addCost -
- row.subCost
- ).toFixed(2)
+ row.repairCost +
+ row.scrapCost +
+ row.loseCost +
+ row.addCost * 1 <
+ row.subCost * 1
+ ) {
+ row.subCost = 0
+ }
+ row.addCost = row.addCost * 1
+
+ this.$nextTick(() => {
+ row.cost = (
+ row.leaseCost +
+ row.repairCost +
+ row.scrapCost +
+ row.loseCost +
+ row.addCost * 1 -
+ row.subCost * 1
+ ).toFixed(2)
+ })
},
/** 费用减项时触发事件 */
onSubChange(row) {
- if (row.subCost === undefined) {
+ this.$message.closeAll()
+ const isRegex = this.isNumRegex(row.subCost)
+ if (!isRegex && row.subCost != '') {
+ this.$message.error('请输入大于等于0或包含两位小数点的数字!')
row.subCost = 0
}
- if (row.subCost > this.costAll && this.costAll === row.cost) {
+ row.subCost = row.subCost * 1
+ if (row.subCost > row.cost && this.costAll <= row.cost) {
this.$message.error('减免费用不能超过小计费用')
- this.subCostFlag = row.costAll
- row.subCost = this.costAll
- }
- if (row.cost > this.costAll) {
- this.$message.error('减免费用不能超过小计费用')
- this.subCostFlag = row.cost
row.subCost = row.cost
}
- row.cost = (
- row.leaseCost +
- row.repairCost +
- row.scrapCost +
- row.loseCost +
- row.addCost -
- row.subCost
- ).toFixed(2)
+ if (row.subCost > row.cost && this.costAll > row.cost) {
+ this.$message.error('减免费用不能超过小计费用')
+ row.subCost = this.costAll
+ }
+
+ if (row.cost == 0 && row.subCost != '') {
+ this.$message.error('小计费用已为0,无法再减免')
+ row.subCost = 0
+ }
+
+ this.$nextTick(() => {
+ row.cost = (
+ row.leaseCost +
+ row.repairCost +
+ row.scrapCost +
+ row.loseCost +
+ row.addCost * 1 -
+ row.subCost * 1
+ ).toFixed(2)
+ })
+ },
+
+ isNumRegex(val) {
+ const regex = /^(0|[1-9]\d*)(\.\d{2})?$/
+ const isNum = regex.test(val)
+ return isNum
},
//提交按钮