diff --git a/yxt-as-ui/src/views/operation/settleAccounts/settleAccountsAdd.vue b/yxt-as-ui/src/views/operation/settleAccounts/settleAccountsAdd.vue index 6639cf55e4..8f59093edd 100644 --- a/yxt-as-ui/src/views/operation/settleAccounts/settleAccountsAdd.vue +++ b/yxt-as-ui/src/views/operation/settleAccounts/settleAccountsAdd.vue @@ -102,11 +102,11 @@
成本合计
- {{ formobj.costAmount }} + {{ totalCost }}
利润额
- {{ formobj.profit }} + {{ amountOfProfit }}
维修项目
@@ -247,8 +247,6 @@ export default { viewTitle: '', viewState: 1, submitdisabled: false, - totalCost: '', // 成本合计(用于页面临时计算) - amountOfProfit: '', // 利润额(用于页面临时计算) tableKey: 0, index: 0, // service服务 @@ -314,6 +312,56 @@ export default { rules: {} } }, + computed: { + // 单据信息模块 -- 成本合计 = 维修项目列表成本合计 + 维修用料列表成本合计 + 其他附加项目成本合计(附加项目列表成本合计 + 外出费成本 + 厂家补助成本 + 施救费成本) + totalCost() { + let cost = '0' + // 维修项目列表成本合计 + if (this.formobj.sitemVos.length > 0) { + this.formobj.sitemVos.forEach((e) => { + cost = Math.round((parseFloat(cost) + parseFloat(e.sitemCost !== '' ? e.sitemCost : 0)) * 100) / 100 + }) + } + // 维修用料列表成本合计 + if (this.formobj.goodsDetailsVos.length > 0) { + this.formobj.goodsDetailsVos.forEach((e) => { + cost = Math.round((parseFloat(cost) + parseFloat(e.goodsCost !== '' ? e.goodsCost : 0)) * 100) / 100 + }) + } + // 其他附加项目列表成本合计 + if (this.formobj.aitemVos.length > 0) { + this.formobj.aitemVos.forEach((e) => { + cost = Math.round((parseFloat(cost) + parseFloat(e.aitemCost !== '' ? e.aitemCost : 0)) * 100) / 100 + }) + } + cost = Math.round((parseFloat(cost) + parseFloat(this.formobj.outCost !== '' ? this.formobj.outCost : 0) + parseFloat(this.formobj.subsidyCost !== '' ? this.formobj.subsidyCost : 0) + parseFloat(this.formobj.rescueCost !== '' ? this.formobj.rescueCost : 0)) * 100) / 100 + return cost + }, + // 单据信息模块 -- 利润额 = 维修项目列表利润额合计 + 维修用料列表利润额合计 + 其他附加项目利润额合计(附加项目列表利润额合计 + 外出费利润额 + 厂家补助利润额 + 施救费利润额) + amountOfProfit() { + let print = '0' + // 维修项目列表成本合计 + if (this.formobj.sitemVos.length > 0) { + this.formobj.sitemVos.forEach((e) => { + print = Math.round((parseFloat(print) + parseFloat(e.sitemPrint !== '' ? e.sitemPrint : 0)) * 100) / 100 + }) + } + // 维修用料列表成本合计 + if (this.formobj.goodsDetailsVos.length > 0) { + this.formobj.goodsDetailsVos.forEach((e) => { + print = Math.round((parseFloat(print) + parseFloat(e.goodsPrint !== '' ? e.goodsPrint : 0)) * 100) / 100 + }) + } + // 其他附加项目列表成本合计 + if (this.formobj.aitemVos.length > 0) { + this.formobj.aitemVos.forEach((e) => { + print = Math.round((parseFloat(print) + parseFloat(e.aitemPrint !== '' ? e.aitemPrint : 0)) * 100) / 100 + }) + } + print = Math.round((parseFloat(print) + parseFloat(this.formobj.outPrint !== '' ? this.formobj.outPrint : 0) + parseFloat(this.formobj.subsidyPrint !== '' ? this.formobj.subsidyPrint : 0) + parseFloat(this.formobj.rescuePrint !== '' ? this.formobj.rescuePrint : 0)) * 100) / 100 + return print + } + }, methods: { getNumber(val, limit) { val = val.replace(/[^0-9.]/g, '') // 保留数字 @@ -341,8 +389,6 @@ export default { req.busrepairbillInit({ sid: row.sid, userSid: window.sessionStorage.getItem('userSid'), orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => { if (res.success) { this.formobj = res.data - this.totalCost = this.formobj.costAmount - this.amountOfProfit = this.formobj.profit } }) }, @@ -360,31 +406,23 @@ export default { // 计算附加项目 -- 外出费 -- 利润额 = 不开票金额 - 成本 outPrintInput() { this.formobj.outPrint = Math.round((parseFloat(this.formobj.outAmount !== '' ? this.formobj.outAmount : 0) - parseFloat(this.formobj.outCost !== '' ? this.formobj.outCost : 0)) * 100) / 100 - this.costAmountAndPrint() }, // 计算附加项目 -- 厂家补助 -- 利润额 = 不开票金额 - 成本 subsidyPrintInput() { this.formobj.subsidyPrint = Math.round((parseFloat(this.formobj.subsidyAmount !== '' ? this.formobj.subsidyAmount : 0) - parseFloat(this.formobj.subsidyCost !== '' ? this.formobj.subsidyCost : 0)) * 100) / 100 - this.costAmountAndPrint() }, // 计算附加项目 -- 施救费 -- 利润额 = 不开票金额 - 成本 rescuePrintInput() { this.formobj.rescuePrint = Math.round((parseFloat(this.formobj.rescueAmount !== '' ? this.formobj.rescueAmount : 0) - parseFloat(this.formobj.rescueCost !== '' ? this.formobj.rescueCost : 0)) * 100) / 100 - this.costAmountAndPrint() }, handleOpen(value) { window.open(value, '_blank') }, - // 计算单据信息模块 -- 成本合计、利润额 - costAmountAndPrint() { - // 成本合计 = 原成本合计 + 其他附加项目成本之和 - this.formobj.costAmount = Math.round((parseFloat(this.totalCost !== '' ? this.totalCost : 0) + parseFloat(this.formobj.outCost !== '' ? this.formobj.outCost : 0) + parseFloat(this.formobj.subsidyCost !== '' ? this.formobj.subsidyCost : 0) + parseFloat(this.formobj.rescueCost !== '' ? this.formobj.rescueCost : 0)) * 100) / 100 - // 利润额 = 原利润额 + 其他附加项目利润额之和 - this.formobj.profit = Math.round((parseFloat(this.amountOfProfit !== '' ? this.amountOfProfit : 0) + parseFloat(this.formobj.outPrint !== '' ? this.formobj.outPrint : 0) + parseFloat(this.formobj.subsidyPrint !== '' ? this.formobj.subsidyPrint : 0) + parseFloat(this.formobj.rescuePrint !== '' ? this.formobj.rescuePrint : 0)) * 100) / 100 - }, submit() { this.$refs['form_obj'].validate((valid) => { if (valid) { + this.formobj.costAmount = this.totalCost + this.formobj.profit = this.amountOfProfit this.submitdisabled = true req.submit(this.formobj).then((res) => { if (res.success) { @@ -457,8 +495,6 @@ export default { taskId: '', instanceId: '' } - this.totalCost = '' - this.amountOfProfit = '' this.submitdisabled = false this.$refs['form_obj'].resetFields() this.$emit('doback') diff --git a/yxt-as-ui/src/views/workFlow/jiesuanFlow/settleAccountsEdit.vue b/yxt-as-ui/src/views/workFlow/jiesuanFlow/settleAccountsEdit.vue index 40efd08a4e..133cb6f30a 100644 --- a/yxt-as-ui/src/views/workFlow/jiesuanFlow/settleAccountsEdit.vue +++ b/yxt-as-ui/src/views/workFlow/jiesuanFlow/settleAccountsEdit.vue @@ -101,11 +101,11 @@
成本合计
- {{ formobj.costAmount }} + {{ totalCost }}
利润额
- {{ formobj.profit }} + {{ amountOfProfit }}
维修项目
@@ -246,8 +246,6 @@ export default { viewTitle: '', viewState: 1, submitdisabled: false, - totalCost: '', // 成本合计(用于页面临时计算) - amountOfProfit: '', // 利润额(用于页面临时计算) tableKey: 0, index: 0, // service服务 @@ -330,6 +328,56 @@ export default { } }, '*') }, + computed: { + // 单据信息模块 -- 成本合计 = 维修项目列表成本合计 + 维修用料列表成本合计 + 其他附加项目成本合计(附加项目列表成本合计 + 外出费成本 + 厂家补助成本 + 施救费成本) + totalCost() { + let cost = '0' + // 维修项目列表成本合计 + if (this.formobj.sitemVos.length > 0) { + this.formobj.sitemVos.forEach((e) => { + cost = Math.round((parseFloat(cost) + parseFloat(e.sitemCost !== '' ? e.sitemCost : 0)) * 100) / 100 + }) + } + // 维修用料列表成本合计 + if (this.formobj.goodsDetailsVos.length > 0) { + this.formobj.goodsDetailsVos.forEach((e) => { + cost = Math.round((parseFloat(cost) + parseFloat(e.goodsCost !== '' ? e.goodsCost : 0)) * 100) / 100 + }) + } + // 其他附加项目列表成本合计 + if (this.formobj.aitemVos.length > 0) { + this.formobj.aitemVos.forEach((e) => { + cost = Math.round((parseFloat(cost) + parseFloat(e.aitemCost !== '' ? e.aitemCost : 0)) * 100) / 100 + }) + } + cost = Math.round((parseFloat(cost) + parseFloat(this.formobj.outCost !== '' ? this.formobj.outCost : 0) + parseFloat(this.formobj.subsidyCost !== '' ? this.formobj.subsidyCost : 0) + parseFloat(this.formobj.rescueCost !== '' ? this.formobj.rescueCost : 0)) * 100) / 100 + return cost + }, + // 单据信息模块 -- 利润额 = 维修项目列表利润额合计 + 维修用料列表利润额合计 + 其他附加项目利润额合计(附加项目列表利润额合计 + 外出费利润额 + 厂家补助利润额 + 施救费利润额) + amountOfProfit() { + let print = '0' + // 维修项目列表成本合计 + if (this.formobj.sitemVos.length > 0) { + this.formobj.sitemVos.forEach((e) => { + print = Math.round((parseFloat(print) + parseFloat(e.sitemPrint !== '' ? e.sitemPrint : 0)) * 100) / 100 + }) + } + // 维修用料列表成本合计 + if (this.formobj.goodsDetailsVos.length > 0) { + this.formobj.goodsDetailsVos.forEach((e) => { + print = Math.round((parseFloat(print) + parseFloat(e.goodsPrint !== '' ? e.goodsPrint : 0)) * 100) / 100 + }) + } + // 其他附加项目列表成本合计 + if (this.formobj.aitemVos.length > 0) { + this.formobj.aitemVos.forEach((e) => { + print = Math.round((parseFloat(print) + parseFloat(e.aitemPrint !== '' ? e.aitemPrint : 0)) * 100) / 100 + }) + } + print = Math.round((parseFloat(print) + parseFloat(this.formobj.outPrint !== '' ? this.formobj.outPrint : 0) + parseFloat(this.formobj.subsidyPrint !== '' ? this.formobj.subsidyPrint : 0) + parseFloat(this.formobj.rescuePrint !== '' ? this.formobj.rescuePrint : 0)) * 100) / 100 + return print + } + }, methods: { getNumber(val, limit) { val = val.replace(/[^0-9.]/g, '') // 保留数字 @@ -357,39 +405,29 @@ export default { req.fetchBySid(sid).then((res) => { if (res.success) { this.formobj = res.data - this.totalCost = this.formobj.costAmount - this.amountOfProfit = this.formobj.profit } }) }, // 计算附加项目 -- 外出费 -- 利润额 = 不开票金额 - 成本 outPrintInput() { this.formobj.outPrint = Math.round((parseFloat(this.formobj.outAmount !== '' ? this.formobj.outAmount : 0) - parseFloat(this.formobj.outCost !== '' ? this.formobj.outCost : 0)) * 100) / 100 - this.costAmountAndPrint() }, // 计算附加项目 -- 厂家补助 -- 利润额 = 不开票金额 - 成本 subsidyPrintInput() { this.formobj.subsidyPrint = Math.round((parseFloat(this.formobj.subsidyAmount !== '' ? this.formobj.subsidyAmount : 0) - parseFloat(this.formobj.subsidyCost !== '' ? this.formobj.subsidyCost : 0)) * 100) / 100 - this.costAmountAndPrint() }, // 计算附加项目 -- 施救费 -- 利润额 = 不开票金额 - 成本 rescuePrintInput() { this.formobj.rescuePrint = Math.round((parseFloat(this.formobj.rescueAmount !== '' ? this.formobj.rescueAmount : 0) - parseFloat(this.formobj.rescueCost !== '' ? this.formobj.rescueCost : 0)) * 100) / 100 - this.costAmountAndPrint() }, handleOpen(value) { window.open(value, '_blank') }, - // 计算单据信息模块 -- 成本合计、利润额 - costAmountAndPrint() { - // 成本合计 = 原成本合计 + 其他附加项目成本之和 - this.formobj.costAmount = Math.round((parseFloat(this.totalCost !== '' ? this.totalCost : 0) + parseFloat(this.formobj.outCost !== '' ? this.formobj.outCost : 0) + parseFloat(this.formobj.subsidyCost !== '' ? this.formobj.subsidyCost : 0) + parseFloat(this.formobj.rescueCost !== '' ? this.formobj.rescueCost : 0)) * 100) / 100 - // 利润额 = 原利润额 + 其他附加项目利润额之和 - this.formobj.profit = Math.round((parseFloat(this.amountOfProfit !== '' ? this.amountOfProfit : 0) + parseFloat(this.formobj.outPrint !== '' ? this.formobj.outPrint : 0) + parseFloat(this.formobj.subsidyPrint !== '' ? this.formobj.subsidyPrint : 0) + parseFloat(this.formobj.rescuePrint !== '' ? this.formobj.rescuePrint : 0)) * 100) / 100 - }, submit() { this.$refs['form_obj'].validate((valid) => { if (valid) { + this.formobj.costAmount = this.totalCost + this.formobj.profit = this.amountOfProfit this.submitdisabled = true req.submit(this.formobj).then((res) => { if (res.success) {