Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
bf461fce
提交
bf461fce
authored
1月 18, 2024
作者:
ZhangLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化:结算问题修复
上级
340ee2a5
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
61 行增加
和
25 行删除
+61
-25
index.tsx
...Manage/demandOrder/orderDetail/comp/orderSettle/index.tsx
+30
-19
index.tsx
...e/demandOrder/orderDetail/comp/orderSettleModal/index.tsx
+31
-6
没有找到文件。
src/pages/orderManage/demandOrder/orderDetail/comp/orderSettle/index.tsx
浏览文件 @
bf461fce
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Button
,
message
,
Table
}
from
'antd'
;
import
{
Button
,
message
,
Modal
,
Table
}
from
'antd'
;
import
{
getOrderAmountDetailsType
,
serviceOrderFormDetailsType
,
...
...
@@ -52,6 +52,8 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
settleAccountsProportion
:
0
,
subsidyFestival
:
0
,
trafficSubsidy
:
0
,
otherSubsidy
:
0
,
remark
:
undefined
,
workDate
:
'合计'
,
},
];
...
...
@@ -60,7 +62,7 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
// 使用 reduce () 函数计算每一列的总和
const
data
=
keys
.
reduce
((
acc
,
key
)
=>
{
// 将字符串转换为数字并累加
const
total
=
list
.
reduce
((
sum
,
row
:
any
)
=>
sum
+
(
+
row
[
key
]
??
0
),
0
);
const
total
=
list
.
reduce
((
sum
,
row
:
any
)
=>
sum
+
(
+
row
[
key
]
||
0
),
0
);
// 返回累加器对象
return
{
...
acc
,
[
key
]:
total
};
},
{});
...
...
@@ -72,6 +74,7 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
workDate
:
'合计'
,
id
:
new
Date
().
getTime
(),
settleAccountsProportion
:
undefined
,
remark
:
undefined
,
},
]
as
ListType
;
};
...
...
@@ -101,19 +104,25 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
// console.log('添加数据 --->', data);
};
// 提交数据
const
handleSubmit
=
async
()
=>
{
const
res
=
await
OrderManageAPI
.
updateOrderAmountDetails
(
tableData
.
slice
(
0
,
-
1
)?.
map
((
i
)
=>
({
...
i
,
requirementsInfoId
:
detail
?.
serviceOrderFormDetailsDTO
?.
id
,
id
:
undefined
,
})),
);
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
await
getTableData
();
onRefresh
();
}
const
handleSubmit
=
()
=>
{
Modal
.
confirm
({
title
:
'提示'
,
content
:
'确认修改订单结算信息?'
,
onOk
:
async
()
=>
{
const
res
=
await
OrderManageAPI
.
updateOrderAmountDetails
(
tableData
.
slice
(
0
,
-
1
)?.
map
((
i
)
=>
({
...
i
,
requirementsInfoId
:
detail
?.
serviceOrderFormDetailsDTO
?.
id
,
id
:
undefined
,
})),
);
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
await
getTableData
();
onRefresh
();
}
},
});
};
// 组件挂载
useEffect
(()
=>
{
...
...
@@ -126,11 +135,13 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
{
title
:
'日期'
,
dataIndex
:
'workDate'
,
align
:
'center'
},
{
title
:
'结算标准(元/天)'
,
dataIndex
:
'dailyWage'
,
align
:
'center'
},
{
title
:
'节日补贴(元/天)'
,
dataIndex
:
'subsidyFestival'
,
align
:
'center'
},
{
title
:
'出差租房补贴'
,
dataIndex
:
'rentalSubsidy'
,
align
:
'center'
},
{
title
:
'交通补贴'
,
dataIndex
:
'trafficSubsidy'
,
align
:
'center'
},
{
title
:
'高温补贴'
,
dataIndex
:
'highTemperatureSubsidy'
,
align
:
'center'
},
{
title
:
'结算比例'
,
dataIndex
:
'settleAccountsProportion'
,
align
:
'center'
},
{
title
:
'出差租房补贴(元)'
,
dataIndex
:
'rentalSubsidy'
,
align
:
'center'
},
{
title
:
'交通补贴(元)'
,
dataIndex
:
'trafficSubsidy'
,
align
:
'center'
},
{
title
:
'高温补贴(元)'
,
dataIndex
:
'highTemperatureSubsidy'
,
align
:
'center'
},
{
title
:
'其他费用(元)'
,
dataIndex
:
'otherSubsidy'
,
align
:
'center'
},
{
title
:
'结算比例(%)'
,
dataIndex
:
'settleAccountsProportion'
,
align
:
'center'
},
{
title
:
'应结工资(元)'
,
dataIndex
:
'realWages'
,
align
:
'center'
},
{
title
:
'备注'
,
dataIndex
:
'remark'
,
align
:
'center'
,
ellipsis
:
true
},
{
title
:
'操作'
,
dataIndex
:
'action'
,
...
...
src/pages/orderManage/demandOrder/orderDetail/comp/orderSettleModal/index.tsx
浏览文件 @
bf461fce
import
React
,
{
useEffect
}
from
'react'
;
import
{
DatePicker
,
Form
,
InputNumber
,
message
,
Modal
,
ModalProps
}
from
'antd'
;
import
{
DatePicker
,
Form
,
Input
,
Input
Number
,
message
,
Modal
,
ModalProps
}
from
'antd'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
getOrderAmountDetailsType
}
from
'~/api/interface/orderManageType'
;
import
Big
from
'big.js'
;
...
...
@@ -29,12 +29,20 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({
};
// 表单值改变事件
const
handleChange
=
()
=>
{
// 结算比例
const
settleRatio
=
Big
(
editForm
.
getFieldValue
(
'settleAccountsProportion'
)
||
0
);
// 结算标准
const
dailyWage
=
Big
(
editForm
.
getFieldValue
(
'dailyWage'
)
||
0
)
.
mul
(
settleRatio
)
.
toNumber
();
// 计算其他金额的总和
const
money
=
Object
.
values
({
...
editForm
.
getFieldsValue
(),
dailyWage
:
dailyWage
,
realWages
:
0
,
workDate
:
0
,
settleAccountsProportion
:
0
,
remark
:
0
,
})?.
reduce
(
(
a
:
number
,
b
:
any
)
=>
Big
(
a
||
0
)
...
...
@@ -42,11 +50,7 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({
.
toNumber
(),
0
,
);
// 最后乘以结算比例
const
total
=
Big
(
money
||
0
)
.
mul
(
Big
(
editForm
.
getFieldValue
(
'settleAccountsProportion'
)
||
0
))
.
toNumber
();
editForm
?.
setFieldValue
(
'realWages'
,
total
);
editForm
?.
setFieldValue
(
'realWages'
,
money
);
};
// 提交事件
const
handleSubmit
=
async
()
=>
{
...
...
@@ -186,6 +190,24 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'其他费用'
name=
'otherSubsidy'
rules=
{
[
{
required
:
true
,
message
:
'请输入其他费用'
},
// 最多两位小数
{
pattern
:
/^
(\d
+
)?(?:\.\d
{1,2}
)?
$/
,
message
:
'最多两位小数'
},
]
}
initialValue=
{
0
}
>
<
InputNumber
placeholder=
'请输入其他费用'
maxLength=
{
25
}
min=
{
0
}
max=
{
999999999
}
style=
{
{
width
:
'100%'
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'结算比例'
name=
'settleAccountsProportion'
rules=
{
[
...
...
@@ -222,6 +244,9 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({
disabled=
{
true
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'备注'
name=
'remark'
>
<
Input
.
TextArea
placeholder=
{
'请输入备注'
}
maxLength=
{
50
}
showCount
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论