diff --git a/packages/app-operation/src/app.tsx b/packages/app-operation/src/app.tsx index 19e76e3..1e35fa9 100644 --- a/packages/app-operation/src/app.tsx +++ b/packages/app-operation/src/app.tsx @@ -141,7 +141,7 @@ export async function getInitialState(): Promise { let current: any; const { data: channel } = await auth.channel.selectChannelByDomain({ - domain: window.location.host, + domain: "operation.erp.qilincloud168.com", }); const { data: userAuthVO } = await auth.user.userInfo(); @@ -346,7 +346,6 @@ export const request: RequestConfig = { 'X-Requested-With': 'XMLHttpRequest', 'Xh-Platform-Id': '1769220738064285698', }, - // 错误处理: umi@3 的错误处理方案。 errorConfig: { // 错误抛出 @@ -433,6 +432,12 @@ export const request: RequestConfig = { headers: any; }, ) => { + + options.headers = { + ...options.headers, + 'Xh-Role-Slug': "operation", + }; + console.debug('请求拦截器', url, options); const apiUrl = '/api' + url; diff --git a/packages/app-operation/src/components/Dealer/DealerList.tsx b/packages/app-operation/src/components/Dealer/DealerList.tsx index 29d77fb..0763619 100644 --- a/packages/app-operation/src/components/Dealer/DealerList.tsx +++ b/packages/app-operation/src/components/Dealer/DealerList.tsx @@ -80,6 +80,7 @@ export default function DealerList(props: IDealerListProps) { <> {record.shareRatio ? ` ${record.shareRatio}%` : ''} + {record.shareAdjusted ? '可调整' : '不可调整'} ) : ( @@ -178,7 +179,9 @@ export default function DealerList(props: IDealerListProps) { })} > - {intl.formatMessage({ id: intlPrefix + '.column.enableAccrualTax' })} + {intl.formatMessage({ + id: intlPrefix + '.column.enableAccrualTax', + })} ), @@ -277,32 +280,45 @@ export default function DealerList(props: IDealerListProps) { {({ enableShare }) => { return ( enableShare && ( - + <> + + + ) ); }} diff --git a/packages/app-operation/src/components/Dealer/DealerSelect.tsx b/packages/app-operation/src/components/Dealer/DealerSelect.tsx index bb3c105..194f8ae 100644 --- a/packages/app-operation/src/components/Dealer/DealerSelect.tsx +++ b/packages/app-operation/src/components/Dealer/DealerSelect.tsx @@ -25,10 +25,10 @@ export default function DealerSelect(props: IUserSelectProps) { label={intl.formatMessage({ id: 'form.dealerId.label', })} - transform={(userVO) => { + transform={(dealerVO) => { return { - userVO: userVO, - userId: userVO.userId, + dealerVO: dealerVO, + dealerId: dealerVO.dealerId, }; }} name={'dealerVO'} diff --git a/packages/app-operation/src/components/Delivery/ShipOrderList.tsx b/packages/app-operation/src/components/Delivery/ShipOrderList.tsx new file mode 100644 index 0000000..c48f9b6 --- /dev/null +++ b/packages/app-operation/src/components/Delivery/ShipOrderList.tsx @@ -0,0 +1,277 @@ +import { BizContainer, BizValueType, ModeType } from '@/components'; +import { business } from '@/services'; +import { useIntl } from '@@/exports'; +import { + ProColumns, + ProFormDatePicker, + ProFormDigit, + ProFormSelect, + ProFormText, + ProFormTextArea, +} from '@ant-design/pro-components'; +import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import { Tag } from 'antd'; +import React from 'react'; + +interface IShipOrderListProps { + ghost?: boolean; + shipOrderId?: BusinessAPI.ShipOrderVO['shipOrderId']; + search?: boolean; + onValueChange?: () => void; + mode?: ModeType; + trigger?: () => React.ReactNode; +} + +export default function ShipOrderList(props: IShipOrderListProps) { + const { + ghost = false, + shipOrderId, + search = true, + mode = 'page', + trigger, + onValueChange, + } = props; + const intl = useIntl(); + const intlPrefix = 'shipOrder'; + + const columns: ProColumns[] = [ + { + title: intl.formatMessage({ id: intlPrefix + '.column.orderSn' }), + dataIndex: 'orderSn', + key: 'orderSn', + renderText: (text: string) => {text}, + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.dealerName' }), + dataIndex: 'dealerName', + key: 'dealerName', + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.vehicleNo' }), + dataIndex: 'vehicleNo', + key: 'vehicleNo', + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.shippingDate' }), + dataIndex: 'shippingDate', + key: 'shippingDate', + valueType: 'date', + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.state' }), + dataIndex: 'state', + key: 'state', + valueType: 'select', + valueEnum: { + WAIT_PAYMENT: { + text: intl.formatMessage({ + id: intlPrefix + '.column.state.waitPayment', + }), + status: 'Default', + }, + PARTIAL_PAYMENT: { + text: intl.formatMessage({ + id: intlPrefix + '.column.state.partialPayment', + }), + status: 'Processing', + }, + FULL_PAYMENT: { + text: intl.formatMessage({ + id: intlPrefix + '.column.state.fullPayment', + }), + status: 'Success', + }, + REJECT_FINISH: { + text: intl.formatMessage({ + id: intlPrefix + '.column.state.rejectFinish', + }), + status: 'Error', + }, + FINISH: { + text: intl.formatMessage({ id: intlPrefix + '.column.state.finish' }), + status: 'Success', + }, + }, + render: (_, record) => { + const stateText = intl.formatMessage({ + id: `${intlPrefix}.column.state.${record.state?.toLowerCase() || 'unknown'}`, + }); + + let color = 'default'; + switch (record.state) { + case 'WAIT_PAYMENT': + color = 'default'; + break; + case 'PARTIAL_PAYMENT': + color = 'processing'; + break; + case 'FULL_PAYMENT': + color = 'success'; + break; + case 'REJECT_FINISH': + color = 'error'; + break; + case 'FINISH': + color = 'success'; + break; + default: + color = 'default'; + } + + return {stateText}; + }, + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.totalAmount' }), + dataIndex: 'totalAmount', + key: 'totalAmount', + valueType: 'money', + search: false, + }, + { + title: intl.formatMessage({ id: intlPrefix + '.column.createdAt' }), + dataIndex: 'createdAt', + key: 'createdAt', + valueType: 'dateTime', + search: false, + }, + ]; + + const formContext = [ + , + , + , + , + , + , + , + ]; + + const detailColumns: ProDescriptionsItemProps< + BusinessAPI.ShipOrderVO, + BizValueType + >[] = columns as ProDescriptionsItemProps< + BusinessAPI.ShipOrderVO, + BizValueType + >[]; + + return ( + + rowKey={'shipOrderId'} + permission={'operation-ship-order'} + func={business.shipOrder} + method={'shipOrder'} + methodUpper={'ShipOrder'} + intlPrefix={intlPrefix} + modeType={mode} + onValueChange={onValueChange} + container={{ + ghost, + }} + status={false} + page={{ + fieldProps: { + bordered: true, + ghost, + //@ts-ignore + search, + }, + columns, + }} + create={{ + formType: 'drawer', + formContext, + initValues: { + status: true, + }, + }} + update={{ + formType: 'drawer', + formContext, + }} + destroy={{}} + detail={{ + rowId: shipOrderId, + formType: 'drawer', + columns: detailColumns, + trigger, + }} + /> + ); +} diff --git a/packages/app-operation/src/components/Delivery/index.ts b/packages/app-operation/src/components/Delivery/index.ts new file mode 100644 index 0000000..ea3c280 --- /dev/null +++ b/packages/app-operation/src/components/Delivery/index.ts @@ -0,0 +1 @@ +export { default as ShipOrderList } from './ShipOrderList'; diff --git a/packages/app-operation/src/components/Employee/EmployeeList.tsx b/packages/app-operation/src/components/Employee/EmployeeList.tsx index 2e187d2..f9c82a3 100644 --- a/packages/app-operation/src/components/Employee/EmployeeList.tsx +++ b/packages/app-operation/src/components/Employee/EmployeeList.tsx @@ -7,7 +7,6 @@ import { ModeType, RestPassword, } from '@/components'; -import { PERMISSION } from '@/constants'; import { business } from '@/services'; import { aesEncrypt } from '@/utils/aes'; import { formatParam } from '@/utils/formatParam'; @@ -45,6 +44,7 @@ const EmployeeList: React.FC = (props: IEmployeeListProps) => { title: intl.formatMessage({ id: intlPrefix + '.column.avatar' }), dataIndex: 'avatar', valueType: 'avatar', + search: false, }, { title: intl.formatMessage({ id: intlPrefix + '.column.name' }), @@ -76,7 +76,7 @@ const EmployeeList: React.FC = (props: IEmployeeListProps) => { }); return ( data?.data?.map((item: BusinessAPI.RoleVO) => ({ - label: item.name, + label: item.platformVO?.platformName + '-' + item.name, value: item.roleId, })) ?? [] ); @@ -301,7 +301,7 @@ const EmployeeList: React.FC = (props: IEmployeeListProps) => { }); return ( data?.data?.map((item: BusinessAPI.RoleVO) => ({ - label: item.name, + label: item.platformVO?.platformName + '-' + item.name, value: item.roleId, })) ?? [] ); @@ -478,24 +478,24 @@ const EmployeeList: React.FC = (props: IEmployeeListProps) => { columns, options: (record, actionRef) => [ { await actionRef.current?.reload(); }} employeeId={record.employeeId} />, { await actionRef.current?.reload(); }} employeeId={record.employeeId} />, { await actionRef.current?.reload(); }} diff --git a/packages/app-operation/src/components/Employee/EmployeeRoleUpdate.tsx b/packages/app-operation/src/components/Employee/EmployeeRoleUpdate.tsx index 65f4868..957e529 100644 --- a/packages/app-operation/src/components/Employee/EmployeeRoleUpdate.tsx +++ b/packages/app-operation/src/components/Employee/EmployeeRoleUpdate.tsx @@ -1,4 +1,4 @@ -import { ButtonAccess } from '@/components'; +import { ButtonAccess, SafeModal } from '@/components'; import { business } from '@/services'; import { formLayout } from '@/utils/formLayout'; import { @@ -7,7 +7,7 @@ import { ProFormText, } from '@ant-design/pro-components'; import { message } from 'antd'; -import React from 'react'; +import React, { useState } from 'react'; interface IEmployeeUpdateProps { onFinish: () => void; @@ -17,70 +17,89 @@ interface IEmployeeUpdateProps { const EmployeeRoleUpdate: React.FC = (props) => { const { onFinish, employeeId, permission } = props; + const [openSafeModal, setOpenSafeModal] = useState(false); + return ( - - title="更新员工" - {...formLayout()} - grid={true} - trigger={ - - 分配角色 - - } - autoFocusFirstInput - modalProps={{ - destroyOnHidden: true, - }} - submitTimeout={2000} - //@ts-ignore - request={async () => { - const { data } = await business.employee.showEmployee({ - employeeShowQry: { employeeId: employeeId }, - }); - return { - ...data, - employeeId: employeeId, - }; - }} - onFinish={async (values) => { - const { success } = await business.employee.updateEmployeeRole(values); - if (success) { - message.success('更新员工角色成功'); - onFinish(); - return true; - } - }} - > -