Commit c53507cf authored by 左玲玲's avatar 左玲玲 😬

1146

parent fe07fb7d
......@@ -23,7 +23,7 @@ export default {
dev: {
[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.64:28000', //gc哥
// target: 'http://192.168.40.203:8000', //dj哥
......@@ -32,7 +32,7 @@ export default {
},
'/token': {
// 要代理的地址
target: 'http://192.168.40.110:8000',
target: 'http://192.168.40.111:8000',
changeOrigin: true,
},
'/staticfile/': {
......
......@@ -20,6 +20,7 @@ import dayjs from 'dayjs';
import Details from "./Details";
import Devices from "./Devices";
import { useLocation } from '@umijs/max';
import Decimal from 'decimal.js';
const formCommonColumns = [
{
title: '是否可操作',
......@@ -546,17 +547,20 @@ function Contract(props) {
return defpath;
}, [activeTabKey]);
const calculateContractAmount = (list = [], month = 0) => {
const sum = list?.reduce((prev, next) => {
if (Number(prev + next)) {
return Number((prev + next).toFixed(2));
}
}, 0);
camount(month == 0 || month ? ((sum ?? 0) * 100) * month / 100 : 0);
if (!(list?.length == 1 && list?.[0] == 0) && month) {
let sum = list?.reduce((prev, next) => {
return prev?.add(Decimal(next));
}, Decimal(0));
let res = sum.mul(Decimal(month));
camount(res.toNumber());
} else {
camount(0)
}
};
const changeList = (list = []) => {
list.forEach(it => {
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 {
it.rebatePrice = ''
}
......@@ -668,9 +672,12 @@ function Contract(props) {
}
}}
onValuesChange={(changedValues, allValues) => {
if (!allValues['tenancy']) {
camount(0);
}
for (let i in changedValues) {
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') {
let newList = changeList(allValues['contractEquipmentList']);
......
......@@ -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"
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"
resolved "https://registry.npmmirror.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23"
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