提交 139348ed 作者: ZhangLingKun

Merge branch 'develop'

流水线 #8084 已通过 于阶段
in 1 分 13 秒
...@@ -14,4 +14,4 @@ patches: ...@@ -14,4 +14,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin
newTag: e2fa6ec9b7eb648ff80da57a525c33ce8513aeb7 newTag: 556d1f7ce7d41f05def7a717eb33572fb21d9ee5
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button, message, Table } from 'antd'; import { Button, message, Modal, Table } from 'antd';
import { import {
getOrderAmountDetailsType, getOrderAmountDetailsType,
serviceOrderFormDetailsType, serviceOrderFormDetailsType,
...@@ -52,6 +52,8 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> = ...@@ -52,6 +52,8 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
settleAccountsProportion: 0, settleAccountsProportion: 0,
subsidyFestival: 0, subsidyFestival: 0,
trafficSubsidy: 0, trafficSubsidy: 0,
otherSubsidy: 0,
remark: undefined,
workDate: '合计', workDate: '合计',
}, },
]; ];
...@@ -60,7 +62,7 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> = ...@@ -60,7 +62,7 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
// 使用 reduce () 函数计算每一列的总和 // 使用 reduce () 函数计算每一列的总和
const data = keys.reduce((acc, key) => { 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 }; return { ...acc, [key]: total };
}, {}); }, {});
...@@ -72,6 +74,7 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> = ...@@ -72,6 +74,7 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
workDate: '合计', workDate: '合计',
id: new Date().getTime(), id: new Date().getTime(),
settleAccountsProportion: undefined, settleAccountsProportion: undefined,
remark: undefined,
}, },
] as ListType; ] as ListType;
}; };
...@@ -101,7 +104,11 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> = ...@@ -101,7 +104,11 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
// console.log('添加数据 --->', data); // console.log('添加数据 --->', data);
}; };
// 提交数据 // 提交数据
const handleSubmit = async () => { const handleSubmit = () => {
Modal.confirm({
title: '提示',
content: '确认修改订单结算信息?',
onOk: async () => {
const res = await OrderManageAPI.updateOrderAmountDetails( const res = await OrderManageAPI.updateOrderAmountDetails(
tableData.slice(0, -1)?.map((i) => ({ tableData.slice(0, -1)?.map((i) => ({
...i, ...i,
...@@ -114,6 +121,8 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> = ...@@ -114,6 +121,8 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
await getTableData(); await getTableData();
onRefresh(); onRefresh();
} }
},
});
}; };
// 组件挂载 // 组件挂载
useEffect(() => { useEffect(() => {
...@@ -126,11 +135,13 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> = ...@@ -126,11 +135,13 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
{ title: '日期', dataIndex: 'workDate', align: 'center' }, { title: '日期', dataIndex: 'workDate', align: 'center' },
{ title: '结算标准(元/天)', dataIndex: 'dailyWage', align: 'center' }, { title: '结算标准(元/天)', dataIndex: 'dailyWage', align: 'center' },
{ title: '节日补贴(元/天)', dataIndex: 'subsidyFestival', align: 'center' }, { title: '节日补贴(元/天)', dataIndex: 'subsidyFestival', align: 'center' },
{ title: '出差租房补贴', dataIndex: 'rentalSubsidy', align: 'center' }, { title: '出差租房补贴(元)', dataIndex: 'rentalSubsidy', align: 'center' },
{ title: '交通补贴', dataIndex: 'trafficSubsidy', align: 'center' }, { title: '交通补贴(元)', dataIndex: 'trafficSubsidy', align: 'center' },
{ title: '高温补贴', dataIndex: 'highTemperatureSubsidy', align: 'center' }, { title: '高温补贴(元)', dataIndex: 'highTemperatureSubsidy', align: 'center' },
{ title: '结算比例', dataIndex: 'settleAccountsProportion', align: 'center' }, { title: '其他费用(元)', dataIndex: 'otherSubsidy', align: 'center' },
{ title: '结算比例(%)', dataIndex: 'settleAccountsProportion', align: 'center' },
{ title: '应结工资(元)', dataIndex: 'realWages', align: 'center' }, { title: '应结工资(元)', dataIndex: 'realWages', align: 'center' },
{ title: '备注', dataIndex: 'remark', align: 'center', ellipsis: true },
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
......
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { DatePicker, Form, InputNumber, message, Modal, ModalProps } from 'antd'; import { DatePicker, Form, Input, InputNumber, message, Modal, ModalProps } from 'antd';
import { InterDataType } from '~/api/interface'; import { InterDataType } from '~/api/interface';
import { getOrderAmountDetailsType } from '~/api/interface/orderManageType'; import { getOrderAmountDetailsType } from '~/api/interface/orderManageType';
import Big from 'big.js'; import Big from 'big.js';
...@@ -29,12 +29,20 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({ ...@@ -29,12 +29,20 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({
}; };
// 表单值改变事件 // 表单值改变事件
const handleChange = () => { const handleChange = () => {
// 结算比例
const settleRatio = Big(editForm.getFieldValue('settleAccountsProportion') || 0);
// 结算标准
const dailyWage = Big(editForm.getFieldValue('dailyWage') || 0)
.mul(settleRatio)
.toNumber();
// 计算其他金额的总和 // 计算其他金额的总和
const money = Object.values({ const money = Object.values({
...editForm.getFieldsValue(), ...editForm.getFieldsValue(),
dailyWage: dailyWage,
realWages: 0, realWages: 0,
workDate: 0, workDate: 0,
settleAccountsProportion: 0, settleAccountsProportion: 0,
remark: 0,
})?.reduce( })?.reduce(
(a: number, b: any) => (a: number, b: any) =>
Big(a || 0) Big(a || 0)
...@@ -42,11 +50,7 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({ ...@@ -42,11 +50,7 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({
.toNumber(), .toNumber(),
0, 0,
); );
// 最后乘以结算比例 editForm?.setFieldValue('realWages', money);
const total = Big(money || 0)
.mul(Big(editForm.getFieldValue('settleAccountsProportion') || 0))
.toNumber();
editForm?.setFieldValue('realWages', total);
}; };
// 提交事件 // 提交事件
const handleSubmit = async () => { const handleSubmit = async () => {
...@@ -186,6 +190,24 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({ ...@@ -186,6 +190,24 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({
/> />
</Form.Item> </Form.Item>
<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='结算比例' label='结算比例'
name='settleAccountsProportion' name='settleAccountsProportion'
rules={[ rules={[
...@@ -222,6 +244,9 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({ ...@@ -222,6 +244,9 @@ const OrderSettleModal: React.FC<ModalProps & SelfProps> = ({
disabled={true} disabled={true}
/> />
</Form.Item> </Form.Item>
<Form.Item label='备注' name='remark'>
<Input.TextArea placeholder={'请输入备注'} maxLength={50} showCount />
</Form.Item>
</Form> </Form>
</Modal> </Modal>
); );
......
...@@ -2,7 +2,7 @@ import SearchBox from '~/components/search-box'; ...@@ -2,7 +2,7 @@ import SearchBox from '~/components/search-box';
import { searchColumns as searchColumnsType } from '~/components/search-box'; import { searchColumns as searchColumnsType } from '~/components/search-box';
import { Button, Table, Tag } from 'antd'; import { Button, Table, Tag } from 'antd';
import { ColumnsType } from 'antd/es/table/InternalTable'; import { ColumnsType } from 'antd/es/table/InternalTable';
import { useEffect, useState } from 'react'; import { createRef, useEffect, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom'; import { useLocation, useNavigate } from 'react-router-dom';
import { OrderManageAPI } from '~/api'; import { OrderManageAPI } from '~/api';
import { InterDataType, InterListType, PaginationProps } from '~/api/interface'; import { InterDataType, InterListType, PaginationProps } from '~/api/interface';
...@@ -21,22 +21,31 @@ const DemandOrderList = () => { ...@@ -21,22 +21,31 @@ const DemandOrderList = () => {
// 表格数据 // 表格数据
const [tableData, setTableData] = useState<demandOrderListType>([]); const [tableData, setTableData] = useState<demandOrderListType>([]);
// 翻页数据 // 翻页数据
const [pagination, setPagination] = useState<PaginationProps & { totalCount: number }>({ const [pagination, setPagination] = useState<Array<PaginationProps & { totalCount: number }>>([
{
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
totalCount: 0, totalCount: 0,
}); },
{
pageNo: 1,
pageSize: 10,
totalCount: 0,
},
]);
// 搜索数据 // 搜索数据
const [query, setQuery] = useState<demandOrderListParameterType>(); const [query, setQuery] = useState<demandOrderListParameterType>();
// 订单状态列表 // 订单状态列表
const [orderStatusList, setOrderStatusList] = useState<{ label: string; value: string }[]>([]); const [orderStatusList, setOrderStatusList] = useState<{ label: string; value: string }[]>([]);
// 刷新子组件 // 刷新子组件
// const [refresh, setRefresh] = useState<boolean>(true); // const [refresh, setRefresh] = useState<boolean>(true);
// 是否是派单
const isPilotOrder = Number(location?.pathname?.split('/')?.at(-1));
// 获取需求订单列表 // 获取需求订单列表
const getServiceOrderFormList = (query?: demandOrderListParameterType) => { const getServiceOrderFormList = (query?: demandOrderListParameterType) => {
OrderManageAPI.getServiceOrderFormList({ OrderManageAPI.getServiceOrderFormList({
pageNo: pagination.pageNo, pageNo: pagination[isPilotOrder].pageNo,
pageSize: pagination.pageSize, pageSize: pagination[isPilotOrder].pageSize,
isPilotOrder: Number(location?.pathname?.split('/')?.at(-1)), isPilotOrder: Number(location?.pathname?.split('/')?.at(-1)),
...query, ...query,
}).then(({ result }) => { }).then(({ result }) => {
...@@ -45,7 +54,7 @@ const DemandOrderList = () => { ...@@ -45,7 +54,7 @@ const DemandOrderList = () => {
childrenRequire: i.childrenRequire?.length ? i.childrenRequire : undefined, childrenRequire: i.childrenRequire?.length ? i.childrenRequire : undefined,
})); }));
setTableData(list); setTableData(list);
pagination.totalCount = result.totalCount; pagination[isPilotOrder].totalCount = result.totalCount;
setPagination({ ...pagination }); setPagination({ ...pagination });
}); });
}; };
...@@ -55,15 +64,15 @@ const DemandOrderList = () => { ...@@ -55,15 +64,15 @@ const DemandOrderList = () => {
}; };
//分页 //分页
const paginationChange = (pageNo: number, pageSize: number) => { const paginationChange = (pageNo: number, pageSize: number) => {
pagination.pageNo = pageNo; pagination[isPilotOrder].pageNo = pageNo;
pagination.pageSize = pageSize; pagination[isPilotOrder].pageSize = pageSize;
getServiceOrderFormList(query); getServiceOrderFormList(query);
}; };
// 筛选成功事件 // 筛选成功事件
const searchSuccessEvent = (value: any) => { const searchSuccessEvent = (value: any) => {
setQuery(value); setQuery(value);
pagination.pageNo = 1; pagination[isPilotOrder].pageNo = 1;
pagination.pageSize = 10; pagination[isPilotOrder].pageSize = 10;
getServiceOrderFormList(value); getServiceOrderFormList(value);
}; };
// 获取订单进度条字典 // 获取订单进度条字典
...@@ -77,16 +86,19 @@ const DemandOrderList = () => { ...@@ -77,16 +86,19 @@ const DemandOrderList = () => {
); );
} }
}; };
// 创建子组件实例
const SearchBoxRef = createRef<any>();
// 组件挂载 // 组件挂载
useEffect(() => { useEffect(() => {
// 还原列表 // 还原列表
setTableData([]); setTableData([]);
setQuery(undefined);
SearchBoxRef.current.handleRestForm();
// 还原分页 // 还原分页
setPagination({ pageNo: 1, pageSize: 10, totalCount: 0 }); // setPagination({ pageNo: 1, pageSize: 10, totalCount: 0 });
// 获取数据 // 获取数据
getFlowDictionary().then(); getFlowDictionary().then();
getServiceOrderFormList(); getServiceOrderFormList();
// console.log('组件挂载 --->', );
}, [location]); }, [location]);
const searchColumns: searchColumnsType[] = [ const searchColumns: searchColumnsType[] = [
{ {
...@@ -226,7 +238,7 @@ const DemandOrderList = () => { ...@@ -226,7 +238,7 @@ const DemandOrderList = () => {
]; ];
return ( return (
<div className='demand-order'> <div className='demand-order'>
<SearchBox search={searchColumns} searchData={searchSuccessEvent} /> <SearchBox search={searchColumns} searchData={searchSuccessEvent} onRef={SearchBoxRef} />
<Table <Table
columns={tableColumns} columns={tableColumns}
bordered bordered
...@@ -238,9 +250,9 @@ const DemandOrderList = () => { ...@@ -238,9 +250,9 @@ const DemandOrderList = () => {
}} }}
scroll={{ x: 1000 }} scroll={{ x: 1000 }}
pagination={{ pagination={{
total: pagination.totalCount, total: pagination[isPilotOrder].totalCount,
pageSize: pagination.pageSize, pageSize: pagination[isPilotOrder].pageSize,
current: pagination.pageNo, current: pagination[isPilotOrder].pageNo,
showSizeChanger: true, showSizeChanger: true,
showQuickJumper: true, showQuickJumper: true,
onChange: (page: number, pageSize: number) => paginationChange(page, pageSize), onChange: (page: number, pageSize: number) => paginationChange(page, pageSize),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论