提交 139348ed 作者: ZhangLingKun

Merge branch 'develop'

流水线 #8084 已通过 于阶段
in 1 分 13 秒
......@@ -14,4 +14,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin
newTag: e2fa6ec9b7eb648ff80da57a525c33ce8513aeb7
newTag: 556d1f7ce7d41f05def7a717eb33572fb21d9ee5
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,7 +104,11 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
// console.log('添加数据 --->', data);
};
// 提交数据
const handleSubmit = async () => {
const handleSubmit = () => {
Modal.confirm({
title: '提示',
content: '确认修改订单结算信息?',
onOk: async () => {
const res = await OrderManageAPI.updateOrderAmountDetails(
tableData.slice(0, -1)?.map((i) => ({
...i,
......@@ -114,6 +121,8 @@ const OrderSettleView: React.FC<{ detail: DetailType; onRefresh: () => void }> =
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',
......
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 { 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>
);
......
......@@ -2,7 +2,7 @@ import SearchBox from '~/components/search-box';
import { searchColumns as searchColumnsType } from '~/components/search-box';
import { Button, Table, Tag } from 'antd';
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 { OrderManageAPI } from '~/api';
import { InterDataType, InterListType, PaginationProps } from '~/api/interface';
......@@ -21,22 +21,31 @@ const DemandOrderList = () => {
// 表格数据
const [tableData, setTableData] = useState<demandOrderListType>([]);
// 翻页数据
const [pagination, setPagination] = useState<PaginationProps & { totalCount: number }>({
const [pagination, setPagination] = useState<Array<PaginationProps & { totalCount: number }>>([
{
pageNo: 1,
pageSize: 10,
totalCount: 0,
});
},
{
pageNo: 1,
pageSize: 10,
totalCount: 0,
},
]);
// 搜索数据
const [query, setQuery] = useState<demandOrderListParameterType>();
// 订单状态列表
const [orderStatusList, setOrderStatusList] = useState<{ label: string; value: string }[]>([]);
// 刷新子组件
// const [refresh, setRefresh] = useState<boolean>(true);
// 是否是派单
const isPilotOrder = Number(location?.pathname?.split('/')?.at(-1));
// 获取需求订单列表
const getServiceOrderFormList = (query?: demandOrderListParameterType) => {
OrderManageAPI.getServiceOrderFormList({
pageNo: pagination.pageNo,
pageSize: pagination.pageSize,
pageNo: pagination[isPilotOrder].pageNo,
pageSize: pagination[isPilotOrder].pageSize,
isPilotOrder: Number(location?.pathname?.split('/')?.at(-1)),
...query,
}).then(({ result }) => {
......@@ -45,7 +54,7 @@ const DemandOrderList = () => {
childrenRequire: i.childrenRequire?.length ? i.childrenRequire : undefined,
}));
setTableData(list);
pagination.totalCount = result.totalCount;
pagination[isPilotOrder].totalCount = result.totalCount;
setPagination({ ...pagination });
});
};
......@@ -55,15 +64,15 @@ const DemandOrderList = () => {
};
//分页
const paginationChange = (pageNo: number, pageSize: number) => {
pagination.pageNo = pageNo;
pagination.pageSize = pageSize;
pagination[isPilotOrder].pageNo = pageNo;
pagination[isPilotOrder].pageSize = pageSize;
getServiceOrderFormList(query);
};
// 筛选成功事件
const searchSuccessEvent = (value: any) => {
setQuery(value);
pagination.pageNo = 1;
pagination.pageSize = 10;
pagination[isPilotOrder].pageNo = 1;
pagination[isPilotOrder].pageSize = 10;
getServiceOrderFormList(value);
};
// 获取订单进度条字典
......@@ -77,16 +86,19 @@ const DemandOrderList = () => {
);
}
};
// 创建子组件实例
const SearchBoxRef = createRef<any>();
// 组件挂载
useEffect(() => {
// 还原列表
setTableData([]);
setQuery(undefined);
SearchBoxRef.current.handleRestForm();
// 还原分页
setPagination({ pageNo: 1, pageSize: 10, totalCount: 0 });
// setPagination({ pageNo: 1, pageSize: 10, totalCount: 0 });
// 获取数据
getFlowDictionary().then();
getServiceOrderFormList();
// console.log('组件挂载 --->', );
}, [location]);
const searchColumns: searchColumnsType[] = [
{
......@@ -226,7 +238,7 @@ const DemandOrderList = () => {
];
return (
<div className='demand-order'>
<SearchBox search={searchColumns} searchData={searchSuccessEvent} />
<SearchBox search={searchColumns} searchData={searchSuccessEvent} onRef={SearchBoxRef} />
<Table
columns={tableColumns}
bordered
......@@ -238,9 +250,9 @@ const DemandOrderList = () => {
}}
scroll={{ x: 1000 }}
pagination={{
total: pagination.totalCount,
pageSize: pagination.pageSize,
current: pagination.pageNo,
total: pagination[isPilotOrder].totalCount,
pageSize: pagination[isPilotOrder].pageSize,
current: pagination[isPilotOrder].pageNo,
showSizeChanger: true,
showQuickJumper: true,
onChange: (page: number, pageSize: number) => paginationChange(page, pageSize),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论