Commit c53507cf authored by 左玲玲's avatar 左玲玲 :grimacing:

1146

parent fe07fb7d
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
dev: { dev: {
[defaultSetting.proxypath]: { [defaultSetting.proxypath]: {
// 要代理的地址 // 要代理的地址
target: 'http://192.168.40.110:8000', //jf哥 target: 'http://192.168.40.111:8000', //jf哥
// target: 'http://192.168.40.248:8080', //jf哥 // target: 'http://192.168.40.248:8080', //jf哥
// target: 'http://192.168.40.64:28000', //gc哥 // target: 'http://192.168.40.64:28000', //gc哥
// target: 'http://192.168.40.203:8000', //dj哥 // target: 'http://192.168.40.203:8000', //dj哥
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
}, },
'/token': { '/token': {
// 要代理的地址 // 要代理的地址
target: 'http://192.168.40.110:8000', target: 'http://192.168.40.111:8000',
changeOrigin: true, changeOrigin: true,
}, },
'/staticfile/': { '/staticfile/': {
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
"classnames": "^2.3.0", "classnames": "^2.3.0",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"dayjs": "^1.11.9", "dayjs": "^1.11.9",
"decimal.js": "^10.4.3",
"echarts": "^5.4.3", "echarts": "^5.4.3",
"echarts-for-react": "^3.0.2", "echarts-for-react": "^3.0.2",
"fabric": "^5.3.0", "fabric": "^5.3.0",
......
...@@ -20,6 +20,7 @@ import dayjs from 'dayjs'; ...@@ -20,6 +20,7 @@ import dayjs from 'dayjs';
import Details from "./Details"; import Details from "./Details";
import Devices from "./Devices"; import Devices from "./Devices";
import { useLocation } from '@umijs/max'; import { useLocation } from '@umijs/max';
import Decimal from 'decimal.js';
const formCommonColumns = [ const formCommonColumns = [
{ {
title: '是否可操作', title: '是否可操作',
...@@ -546,17 +547,20 @@ function Contract(props) { ...@@ -546,17 +547,20 @@ function Contract(props) {
return defpath; return defpath;
}, [activeTabKey]); }, [activeTabKey]);
const calculateContractAmount = (list = [], month = 0) => { const calculateContractAmount = (list = [], month = 0) => {
const sum = list?.reduce((prev, next) => { if (!(list?.length == 1 && list?.[0] == 0) && month) {
if (Number(prev + next)) { let sum = list?.reduce((prev, next) => {
return Number((prev + next).toFixed(2)); return prev?.add(Decimal(next));
} }, Decimal(0));
}, 0); let res = sum.mul(Decimal(month));
camount(month == 0 || month ? ((sum ?? 0) * 100) * month / 100 : 0); camount(res.toNumber());
} else {
camount(0)
}
}; };
const changeList = (list = []) => { const changeList = (list = []) => {
list.forEach(it => { list.forEach(it => {
if (it.unitPrice && it.zxPrice) { if (it.unitPrice && it.zxPrice) {
it.rebatePrice = Number(((it.unitPrice ?? 0) - (it.zxPrice ?? 0)).toFixed(2)) it.rebatePrice = Decimal(it.unitPrice).sub(Decimal(it.zxPrice)).toNumber();
} else { } else {
it.rebatePrice = '' it.rebatePrice = ''
} }
...@@ -668,9 +672,12 @@ function Contract(props) { ...@@ -668,9 +672,12 @@ function Contract(props) {
} }
}} }}
onValuesChange={(changedValues, allValues) => { onValuesChange={(changedValues, allValues) => {
if (!allValues['tenancy']) {
camount(0);
}
for (let i in changedValues) { for (let i in changedValues) {
if (i == 'contractEquipmentList' || i == 'tenancy') { if (i == 'contractEquipmentList' || i == 'tenancy') {
calculateContractAmount(allValues['contractEquipmentList']?.map(it => it.unitPrice ?? 0), allValues['tenancy']); calculateContractAmount(allValues['contractEquipmentList']?.map(it => it.unitPrice ? it.unitPrice : 0), allValues['tenancy']);
} }
if (i == 'contractEquipmentList') { if (i == 'contractEquipmentList') {
let newList = changeList(allValues['contractEquipmentList']); let newList = changeList(allValues['contractEquipmentList']);
......
...@@ -6195,7 +6195,7 @@ decamelize@^1.1.0, decamelize@^1.2.0: ...@@ -6195,7 +6195,7 @@ decamelize@^1.1.0, decamelize@^1.2.0:
resolved "https://mirrors.huaweicloud.com/repository/npm/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" resolved "https://mirrors.huaweicloud.com/repository/npm/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==
decimal.js@^10.3.1: decimal.js@^10.3.1, decimal.js@^10.4.3:
version "10.4.3" version "10.4.3"
resolved "https://registry.npmmirror.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" resolved "https://registry.npmmirror.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23"
integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment