feat(product): 添加产品数据管理功能
- 新增产品数据列表组件 ProductDataList - 在基础数据模块中导出 ProductDataList 组件 - 为工人列表和辅料列表添加 requireQuantityAndPrice 字段 - 添加产品相关的国际化文案配置 - 创建产品数据页面并引入 ProductDataList 组件 - 在业务服务中增加产品相关接口定义 - 实现产品的增删改查、拖拽排序等完整功能 - 添加新增页面开发指南文档
This commit is contained in:
parent
5c002a42cf
commit
0da56e27df
241
.lingma/rules/add-new-page.md
Normal file
241
.lingma/rules/add-new-page.md
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
# 添加新页面指南
|
||||||
|
|
||||||
|
本文档总结了在 ERPTurbo_Admin 项目中添加新页面所需的所有步骤和代码。
|
||||||
|
|
||||||
|
## 基本步骤
|
||||||
|
|
||||||
|
1. 创建页面组件
|
||||||
|
2. (可选)创建对应的业务组件
|
||||||
|
3. 在路由中注册页面(如果使用约定式路由则不需要)
|
||||||
|
|
||||||
|
## 详细说明
|
||||||
|
|
||||||
|
### 1. 创建页面组件
|
||||||
|
|
||||||
|
在 `packages/app-operation/src/pages/` 目录下创建一个新的页面文件,例如 `NewPage.tsx`:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { NewComponentList } from '@/components';
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
return <NewComponentList />;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
页面组件应:
|
||||||
|
- 默认导出一个函数式组件,名称为 `Page`
|
||||||
|
- 直接返回要渲染的组件
|
||||||
|
- 从 '@/components' 导入需要的业务组件
|
||||||
|
|
||||||
|
### 2. 创建业务组件(如果需要)
|
||||||
|
|
||||||
|
如果页面需要展示特定业务数据,需要在 `packages/app-operation/src/components/` 目录下创建对应的业务组件。
|
||||||
|
|
||||||
|
例如,在 `packages/app-operation/src/components/BasicData/` 目录下创建 `NewComponentList.tsx`:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { BizContainer, BizValueType, ModeType } from '@/components';
|
||||||
|
import { business } from '@/services';
|
||||||
|
import { useIntl } from '@@/exports';
|
||||||
|
import {
|
||||||
|
ProColumns,
|
||||||
|
ProFormMoney,
|
||||||
|
ProFormSwitch,
|
||||||
|
ProFormText,
|
||||||
|
} from '@ant-design/pro-components';
|
||||||
|
import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
interface INewComponentListProps {
|
||||||
|
ghost?: boolean;
|
||||||
|
id?: BusinessAPI.NewComponentVO['id'];
|
||||||
|
search?: boolean;
|
||||||
|
onValueChange?: () => void;
|
||||||
|
mode?: ModeType;
|
||||||
|
trigger?: () => React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function NewComponentList(props: INewComponentListProps) {
|
||||||
|
const {
|
||||||
|
ghost = false,
|
||||||
|
itemId,
|
||||||
|
search = true,
|
||||||
|
mode = 'drag',
|
||||||
|
trigger,
|
||||||
|
onValueChange,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const intl = useIntl();
|
||||||
|
const intlPrefix = 'newComponent';
|
||||||
|
|
||||||
|
const columns: ProColumns<BusinessAPI.NewComponentVO, BizValueType>[] = [
|
||||||
|
{
|
||||||
|
title: intl.formatMessage({ id: intlPrefix + '.column.name' }),
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
renderText: (text: string) => <span className="font-medium">{text}</span>,
|
||||||
|
},
|
||||||
|
// 更多列定义...根据 BusinessAPI.NewComponentVO 的字段来生成
|
||||||
|
];
|
||||||
|
|
||||||
|
const formContext = [
|
||||||
|
<ProFormText key={'name'} name={'name'} /* 表单字段配置 */ />,
|
||||||
|
// 更多表单字段...根据 BusinessAPI.NewComponentVO 的字段来生成
|
||||||
|
];
|
||||||
|
|
||||||
|
const detailColumns: ProDescriptionsItemProps<
|
||||||
|
BusinessAPI.NewComponentVO,
|
||||||
|
BizValueType
|
||||||
|
>[] = columns as ProDescriptionsItemProps<
|
||||||
|
BusinessAPI.NewComponentVO,
|
||||||
|
BizValueType
|
||||||
|
>[];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BizContainer<
|
||||||
|
typeof business.newComponent,
|
||||||
|
BusinessAPI.NewComponentVO,
|
||||||
|
BusinessAPI.NewComponentPageQry,
|
||||||
|
BusinessAPI.NewComponentCreateCmd,
|
||||||
|
BusinessAPI.NewComponentUpdateCmd
|
||||||
|
>
|
||||||
|
rowKey={'id'}
|
||||||
|
permission={'operation-new-component'}
|
||||||
|
func={business.newComponent}
|
||||||
|
method={'newComponent'}
|
||||||
|
methodUpper={'NewComponent'}
|
||||||
|
intlPrefix={intlPrefix}
|
||||||
|
modeType={mode}
|
||||||
|
onValueChange={onValueChange}
|
||||||
|
container={{}}
|
||||||
|
remark={{
|
||||||
|
mode: 'editor',
|
||||||
|
}}
|
||||||
|
status
|
||||||
|
drag={{
|
||||||
|
fieldProps: {
|
||||||
|
bordered: true,
|
||||||
|
ghost,
|
||||||
|
search,
|
||||||
|
params: {
|
||||||
|
// 这里可以添加特定的查询参数
|
||||||
|
},
|
||||||
|
},
|
||||||
|
columns,
|
||||||
|
}}
|
||||||
|
create={{
|
||||||
|
formType: 'drawer',
|
||||||
|
formContext,
|
||||||
|
initValues: {
|
||||||
|
showInEntry: false,
|
||||||
|
status: true,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
update={{
|
||||||
|
formType: 'drawer',
|
||||||
|
formContext,
|
||||||
|
}}
|
||||||
|
destroy={{}}
|
||||||
|
detail={{
|
||||||
|
rowId: id,
|
||||||
|
formType: 'drawer',
|
||||||
|
columns: detailColumns,
|
||||||
|
trigger,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
业务组件要点:
|
||||||
|
- 使用 `BizContainer` 组件来构建标准的增删改查页面
|
||||||
|
- 定义国际化前缀 `intlPrefix` 用于多语言支持
|
||||||
|
- 定义表格列 `columns` 和表单字段 `formContext`
|
||||||
|
- 使用 `useIntl()` 进行国际化处理
|
||||||
|
|
||||||
|
### 3. 导出组件(如果创建了新组件)
|
||||||
|
|
||||||
|
如果创建了新的业务组件,需要在对应目录的 `index.ts` 文件中导出:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
export { default as NewComponentList } from './NewComponentList';
|
||||||
|
```
|
||||||
|
|
||||||
|
例如,在 `packages/app-operation/src/components/BasicData/index.ts` 中添加导出。
|
||||||
|
|
||||||
|
### 4. 国际化配置
|
||||||
|
|
||||||
|
在 `packages/app-operation/src/locales/zh-CN.ts` 中添加对应中文翻译:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
newComponent: {
|
||||||
|
column: {
|
||||||
|
name: '名称',
|
||||||
|
// 更多字段...
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
name: {
|
||||||
|
label: '名称',
|
||||||
|
placeholder: '请输入名称',
|
||||||
|
required: '名称为必填项',
|
||||||
|
},
|
||||||
|
// 更多表单字段...
|
||||||
|
},
|
||||||
|
modal: {
|
||||||
|
create: {
|
||||||
|
title: '新增',
|
||||||
|
button: '新增',
|
||||||
|
success: '新增成功',
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
title: '更新',
|
||||||
|
button: '编辑',
|
||||||
|
success: '更新成功',
|
||||||
|
status: {
|
||||||
|
success: '修改状态成功',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
delete: {
|
||||||
|
success: '删除成功',
|
||||||
|
button: '删除',
|
||||||
|
confirm: {
|
||||||
|
title: '确认删除',
|
||||||
|
content: '您确定要删除该项吗?',
|
||||||
|
okText: '确定',
|
||||||
|
cancelText: '取消',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
import: {
|
||||||
|
title: '导入',
|
||||||
|
button: '导入',
|
||||||
|
success: '导入成功',
|
||||||
|
},
|
||||||
|
view: {
|
||||||
|
title: '查看',
|
||||||
|
button: '查看',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. 路由配置
|
||||||
|
|
||||||
|
项目使用约定式路由,页面文件放置在 `packages/app-operation/src/pages/` 目录下会自动注册为路由。
|
||||||
|
|
||||||
|
例如,创建 `packages/app-operation/src/pages/NewPage.tsx` 文件后,访问路径为 `/new-page`。
|
||||||
|
|
||||||
|
## 示例参考
|
||||||
|
|
||||||
|
可以参考以下最近添加的页面:
|
||||||
|
|
||||||
|
1. `packages/app-operation/src/pages/ProductionAdvance.tsx`
|
||||||
|
2. `packages/app-operation/src/pages/WorkerAdvance.tsx`
|
||||||
|
3. `packages/app-operation/src/components/BasicData/ProductionAdvanceList.tsx`
|
||||||
|
4. `packages/app-operation/src/components/BasicData/WorkerAdvanceList.tsx`
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
1. 页面组件必须默认导出名为 `Page` 的函数组件
|
||||||
|
2. 使用已有的业务组件和容器组件以保持一致性
|
||||||
|
3. 国际化是必需的,所有显示文本都需要支持多语言
|
||||||
|
4. 遵循项目现有的代码风格和结构
|
||||||
@ -63,6 +63,7 @@ export default function ExcipientList(props: IExcipientListProps) {
|
|||||||
|
|
||||||
const formContext = [
|
const formContext = [
|
||||||
<ProFormText key={'costType'} name={'costType'} hidden={true} />,
|
<ProFormText key={'costType'} name={'costType'} hidden={true} />,
|
||||||
|
<ProFormText key={'requireQuantityAndPrice'} name={'requireQuantityAndPrice'} hidden={true} />,
|
||||||
<ProFormText
|
<ProFormText
|
||||||
key={'name'}
|
key={'name'}
|
||||||
name={'name'}
|
name={'name'}
|
||||||
@ -190,6 +191,7 @@ export default function ExcipientList(props: IExcipientListProps) {
|
|||||||
formContext,
|
formContext,
|
||||||
initValues: {
|
initValues: {
|
||||||
costType: 'PACKAGING_MATERIALS',
|
costType: 'PACKAGING_MATERIALS',
|
||||||
|
requireQuantityAndPrice: true,
|
||||||
status: true,
|
status: true,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -0,0 +1,287 @@
|
|||||||
|
import { BizContainer, BizValueType, ModeType } from '@/components';
|
||||||
|
import { business } from '@/services';
|
||||||
|
import { useIntl } from '@@/exports';
|
||||||
|
import {
|
||||||
|
ProColumns,
|
||||||
|
ProFormCheckbox,
|
||||||
|
ProFormDependency,
|
||||||
|
ProFormText,
|
||||||
|
} from '@ant-design/pro-components';
|
||||||
|
import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
interface IProductDataListProps {
|
||||||
|
ghost?: boolean;
|
||||||
|
id?: BusinessAPI.ProductVO['productId'];
|
||||||
|
search?: boolean;
|
||||||
|
onValueChange?: () => void;
|
||||||
|
mode?: ModeType;
|
||||||
|
trigger?: () => React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ProductDataList(props: IProductDataListProps) {
|
||||||
|
const {
|
||||||
|
ghost = false,
|
||||||
|
id,
|
||||||
|
search = true,
|
||||||
|
mode = 'drag',
|
||||||
|
trigger,
|
||||||
|
onValueChange,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const intl = useIntl();
|
||||||
|
const intlPrefix = 'productData';
|
||||||
|
|
||||||
|
const columns: ProColumns<BusinessAPI.ProductVO, BizValueType>[] = [
|
||||||
|
{
|
||||||
|
title: intl.formatMessage({ id: intlPrefix + '.column.name' }),
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
renderText: (text: string) => <span className="font-medium">{text}</span>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: intl.formatMessage({
|
||||||
|
id: intlPrefix + '.column.excipientIds',
|
||||||
|
}),
|
||||||
|
dataIndex: 'constItemVOList',
|
||||||
|
key: 'excipientIds',
|
||||||
|
valueType: 'text',
|
||||||
|
render: (_, record) => (
|
||||||
|
<div>
|
||||||
|
{record.costItemVOList
|
||||||
|
?.filter((item) => item.costType === 'PACKAGING_MATERIALS')
|
||||||
|
.map((item) => item.name)
|
||||||
|
.join(',')}
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: intl.formatMessage({
|
||||||
|
id: intlPrefix + '.column.workerAdvanceIds',
|
||||||
|
}),
|
||||||
|
dataIndex: 'constItemVOList',
|
||||||
|
key: 'workerAdvanceIds',
|
||||||
|
valueType: 'text',
|
||||||
|
render: (_, record) => (
|
||||||
|
<div>
|
||||||
|
{record.costItemVOList
|
||||||
|
?.filter((item) => item.costType === 'WORKER_ADVANCE')
|
||||||
|
?.map((item) => item.name)
|
||||||
|
.join(',')}
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: intl.formatMessage({
|
||||||
|
id: intlPrefix + '.column.productionAdvanceIds',
|
||||||
|
}),
|
||||||
|
dataIndex: 'constItemVOList',
|
||||||
|
key: 'productionAdvanceIds',
|
||||||
|
valueType: 'text',
|
||||||
|
render: (_, record) => (
|
||||||
|
<div>
|
||||||
|
{record.costItemVOList
|
||||||
|
?.filter((item) => item.costType === 'PRODUCTION_ADVANCE')
|
||||||
|
?.map((item) => item.name)
|
||||||
|
.join(',')}
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const formContext = [
|
||||||
|
<ProFormText
|
||||||
|
key="name"
|
||||||
|
name="name"
|
||||||
|
label={intl.formatMessage({ id: intlPrefix + '.form.name.label' })}
|
||||||
|
placeholder={intl.formatMessage({
|
||||||
|
id: intlPrefix + '.form.name.placeholder',
|
||||||
|
})}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: intl.formatMessage({
|
||||||
|
id: intlPrefix + '.form.name.required',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>,
|
||||||
|
<ProFormDependency key={'costItemIds'} name={['costItemIds']}>
|
||||||
|
{({ costItemIds }, form) => (
|
||||||
|
<>
|
||||||
|
<ProFormText key="costItemIds" name="costItemIds" hidden={true} />
|
||||||
|
<ProFormCheckbox.Group
|
||||||
|
key="excipient"
|
||||||
|
name="excipientIds"
|
||||||
|
label={intl.formatMessage({
|
||||||
|
id: intlPrefix + '.form.excipientIds.label',
|
||||||
|
})}
|
||||||
|
placeholder={intl.formatMessage({
|
||||||
|
id: intlPrefix + '.form.excipientIds.placeholder',
|
||||||
|
})}
|
||||||
|
fieldProps={{
|
||||||
|
onChange: (value) => {
|
||||||
|
form.setFieldsValue({
|
||||||
|
costItemIds: [
|
||||||
|
...new Set([...(costItemIds || []), ...(value || [])]),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
request={async () => {
|
||||||
|
const { data } = await business.costItem.listCostItem({
|
||||||
|
costItemListQry: {
|
||||||
|
costType: 'PACKAGING_MATERIALS',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
data?.map((item) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.itemId,
|
||||||
|
})) || []
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<ProFormCheckbox.Group
|
||||||
|
key="workerAdvance"
|
||||||
|
name="workerAdvanceIds"
|
||||||
|
label={intl.formatMessage({
|
||||||
|
id: intlPrefix + '.form.workerAdvanceIds.label',
|
||||||
|
})}
|
||||||
|
placeholder={intl.formatMessage({
|
||||||
|
id: intlPrefix + '.form.workerAdvanceIds.placeholder',
|
||||||
|
})}
|
||||||
|
fieldProps={{
|
||||||
|
onChange: (value) => {
|
||||||
|
form.setFieldsValue({
|
||||||
|
costItemIds: [
|
||||||
|
...new Set([...(costItemIds || []), ...(value || [])]),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
request={async () => {
|
||||||
|
const { data } = await business.costItem.listCostItem({
|
||||||
|
costItemListQry: {
|
||||||
|
costType: 'WORKER_ADVANCE',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
data?.map((item) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.itemId,
|
||||||
|
})) || []
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<ProFormCheckbox.Group
|
||||||
|
key="productionAdvance"
|
||||||
|
name="productionAdvanceIds"
|
||||||
|
label={intl.formatMessage({
|
||||||
|
id: intlPrefix + '.form.productionAdvanceIds.label',
|
||||||
|
})}
|
||||||
|
placeholder={intl.formatMessage({
|
||||||
|
id: intlPrefix + '.form.productionAdvanceIds.placeholder',
|
||||||
|
})}
|
||||||
|
fieldProps={{
|
||||||
|
onChange: (value) => {
|
||||||
|
form.setFieldsValue({
|
||||||
|
costItemIds: [
|
||||||
|
...new Set([...(costItemIds || []), ...(value || [])]),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
request={async () => {
|
||||||
|
const { data } = await business.costItem.listCostItem({
|
||||||
|
costItemListQry: {
|
||||||
|
costType: 'PRODUCTION_ADVANCE',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
data?.map((item) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.itemId,
|
||||||
|
})) || []
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</ProFormDependency>,
|
||||||
|
];
|
||||||
|
|
||||||
|
const detailColumns: ProDescriptionsItemProps<
|
||||||
|
BusinessAPI.ProductVO,
|
||||||
|
BizValueType
|
||||||
|
>[] = columns as ProDescriptionsItemProps<
|
||||||
|
BusinessAPI.ProductVO,
|
||||||
|
BizValueType
|
||||||
|
>[];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BizContainer<
|
||||||
|
typeof business.product,
|
||||||
|
BusinessAPI.ProductVO,
|
||||||
|
BusinessAPI.ProductPageQry,
|
||||||
|
BusinessAPI.ProductCreateCmd,
|
||||||
|
BusinessAPI.ProductUpdateCmd
|
||||||
|
>
|
||||||
|
rowKey={'productId'}
|
||||||
|
permission={'operation-product-data'}
|
||||||
|
func={business.product}
|
||||||
|
method={'product'}
|
||||||
|
methodUpper={'Product'}
|
||||||
|
intlPrefix={intlPrefix}
|
||||||
|
modeType={mode}
|
||||||
|
onValueChange={onValueChange}
|
||||||
|
container={{}}
|
||||||
|
remark={{
|
||||||
|
mode: 'editor',
|
||||||
|
}}
|
||||||
|
status
|
||||||
|
drag={{
|
||||||
|
fieldProps: {
|
||||||
|
bordered: true,
|
||||||
|
ghost,
|
||||||
|
//@ts-ignore
|
||||||
|
search,
|
||||||
|
params: {
|
||||||
|
// 这里可以添加特定的查询参数
|
||||||
|
},
|
||||||
|
},
|
||||||
|
columns,
|
||||||
|
}}
|
||||||
|
create={{
|
||||||
|
formType: 'drawer',
|
||||||
|
formContext,
|
||||||
|
initValues: {
|
||||||
|
status: true,
|
||||||
|
sort: 0,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
update={{
|
||||||
|
formType: 'drawer',
|
||||||
|
formContext,
|
||||||
|
transform: async (data) => {
|
||||||
|
return {
|
||||||
|
...data,
|
||||||
|
workerAdvanceIds: data.costItemIds,
|
||||||
|
productionAdvanceIds: data.costItemIds,
|
||||||
|
excipientIds: data.costItemIds,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
destroy={{}}
|
||||||
|
detail={{
|
||||||
|
rowId: id,
|
||||||
|
formType: 'drawer',
|
||||||
|
columns: detailColumns,
|
||||||
|
trigger,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -63,6 +63,7 @@ export default function WorkerList(props: IWorkerListProps) {
|
|||||||
|
|
||||||
const formContext = [
|
const formContext = [
|
||||||
<ProFormText key={'costType'} name={'costType'} hidden={true} />,
|
<ProFormText key={'costType'} name={'costType'} hidden={true} />,
|
||||||
|
<ProFormText key={'requireQuantityAndPrice'} name={'requireQuantityAndPrice'} hidden={true} />,
|
||||||
<ProFormText
|
<ProFormText
|
||||||
key={'name'}
|
key={'name'}
|
||||||
name={'name'}
|
name={'name'}
|
||||||
@ -190,6 +191,7 @@ export default function WorkerList(props: IWorkerListProps) {
|
|||||||
formContext,
|
formContext,
|
||||||
initValues: {
|
initValues: {
|
||||||
costType: 'HUMAN_COST',
|
costType: 'HUMAN_COST',
|
||||||
|
requireQuantityAndPrice: true,
|
||||||
status: true,
|
status: true,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -6,3 +6,4 @@ export { default as WorkerList } from './WorkerList';
|
|||||||
export { default as GiftBoxList } from './GiftBoxList';
|
export { default as GiftBoxList } from './GiftBoxList';
|
||||||
export { default as ProductionAdvanceList } from './ProductionAdvanceList';
|
export { default as ProductionAdvanceList } from './ProductionAdvanceList';
|
||||||
export { default as WorkerAdvanceList } from './WorkerAdvanceList';
|
export { default as WorkerAdvanceList } from './WorkerAdvanceList';
|
||||||
|
export { default as ProductDataList } from './ProductDataList';
|
||||||
|
|||||||
@ -2079,4 +2079,93 @@ export default {
|
|||||||
required: '操作经销商为必填项',
|
required: '操作经销商为必填项',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
productData: {
|
||||||
|
column: {
|
||||||
|
name: '产品名称',
|
||||||
|
excipientIds: '辅料费用',
|
||||||
|
productionAdvanceIds: '产地承担费用',
|
||||||
|
workerAdvanceIds: '工头承担费用',
|
||||||
|
remark: '备注',
|
||||||
|
status: '状态',
|
||||||
|
'status.enum.enabled': '正常',
|
||||||
|
'status.enum.disabled': '禁用',
|
||||||
|
'status.placeholder': '请选择状态',
|
||||||
|
createdAt: '创建时间',
|
||||||
|
option: '操作',
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
name: {
|
||||||
|
label: '产品名称',
|
||||||
|
placeholder: '请输入产品名称',
|
||||||
|
required: '产品名称为必填项',
|
||||||
|
},
|
||||||
|
excipientIds: {
|
||||||
|
label: '辅料费用',
|
||||||
|
placeholder: '请选择辅料费用',
|
||||||
|
required: '辅料费用为必填项',
|
||||||
|
},
|
||||||
|
productionAdvanceIds: {
|
||||||
|
label: '产地承担费用',
|
||||||
|
placeholder: '请选择产地承担费用',
|
||||||
|
required: '产地承担费用为必填项',
|
||||||
|
},
|
||||||
|
workerAdvanceIds: {
|
||||||
|
label: '工头承担费用',
|
||||||
|
placeholder: '请选择工头承担费用',
|
||||||
|
required: '工头承担费用为必填项',
|
||||||
|
},
|
||||||
|
sort: {
|
||||||
|
label: '排序号',
|
||||||
|
placeholder: '请输入排序号',
|
||||||
|
required: '排序号为必填项',
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
label: '状态',
|
||||||
|
placeholder: '请选择状态',
|
||||||
|
required: '状态为必填项',
|
||||||
|
enum: {
|
||||||
|
checkedChildren: '启用',
|
||||||
|
unCheckedChildren: '禁用',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
remark: {
|
||||||
|
label: '备注',
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
modal: {
|
||||||
|
create: {
|
||||||
|
title: '新增产品',
|
||||||
|
button: '新增',
|
||||||
|
success: '新增成功',
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
title: '编辑产品',
|
||||||
|
button: '编辑',
|
||||||
|
success: '更新成功',
|
||||||
|
status: {
|
||||||
|
success: '修改状态成功',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
delete: {
|
||||||
|
success: '删除成功',
|
||||||
|
button: '删除',
|
||||||
|
confirm: {
|
||||||
|
title: '确认删除',
|
||||||
|
content: '您确定要删除该项吗?',
|
||||||
|
okText: '确定',
|
||||||
|
cancelText: '取消',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
import: {
|
||||||
|
title: '导入',
|
||||||
|
button: '导入',
|
||||||
|
success: '导入成功',
|
||||||
|
},
|
||||||
|
view: {
|
||||||
|
title: '查看',
|
||||||
|
button: '查看',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import { ProductDataList } from '@/components';
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
return <></>;
|
return <ProductDataList />;
|
||||||
}
|
}
|
||||||
@ -22,6 +22,7 @@ import * as materialCategory from './materialCategory';
|
|||||||
import * as menu from './menu';
|
import * as menu from './menu';
|
||||||
import * as permission from './permission';
|
import * as permission from './permission';
|
||||||
import * as platform from './platform';
|
import * as platform from './platform';
|
||||||
|
import * as product from './product';
|
||||||
import * as purchaseOrder from './purchaseOrder';
|
import * as purchaseOrder from './purchaseOrder';
|
||||||
import * as role from './role';
|
import * as role from './role';
|
||||||
import * as setting from './setting';
|
import * as setting from './setting';
|
||||||
@ -34,6 +35,7 @@ export default {
|
|||||||
shipOrder,
|
shipOrder,
|
||||||
setting,
|
setting,
|
||||||
purchaseOrder,
|
purchaseOrder,
|
||||||
|
product,
|
||||||
platform,
|
platform,
|
||||||
menu,
|
menu,
|
||||||
material,
|
material,
|
||||||
|
|||||||
162
packages/app-operation/src/services/business/product.ts
Normal file
162
packages/app-operation/src/services/business/product.ts
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
// @ts-ignore
|
||||||
|
/* eslint-disable */
|
||||||
|
import request from '../request';
|
||||||
|
|
||||||
|
/** 创建产品 POST /operation/createProduct */
|
||||||
|
export async function createProduct(
|
||||||
|
body: BusinessAPI.ProductCreateCmd,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<BusinessAPI.SingleResponseProductVO>(
|
||||||
|
'/operation/createProduct',
|
||||||
|
{
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 产品删除 DELETE /operation/destroyProduct */
|
||||||
|
export async function destroyProduct(
|
||||||
|
body: BusinessAPI.ProductDestroyCmd,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<BusinessAPI.Response>('/operation/destroyProduct', {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 产品拖拽排序 PUT /operation/dragProduct */
|
||||||
|
export async function dragProduct(
|
||||||
|
body: BusinessAPI.ProductDragCmd,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<BusinessAPI.Response>('/operation/dragProduct', {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 产品拖拽排序 PATCH /operation/dragProduct */
|
||||||
|
export async function dragProduct1(
|
||||||
|
body: BusinessAPI.ProductDragCmd,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<BusinessAPI.Response>('/operation/dragProduct', {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 产品列表 GET /operation/listProduct */
|
||||||
|
export async function listProduct(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: BusinessAPI.listProductParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<BusinessAPI.MultiResponseProductVO>(
|
||||||
|
'/operation/listProduct',
|
||||||
|
{
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
productListQry: undefined,
|
||||||
|
...params['productListQry'],
|
||||||
|
},
|
||||||
|
...(options || {}),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 产品列表 GET /operation/pageProduct */
|
||||||
|
export async function pageProduct(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: BusinessAPI.pageProductParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<BusinessAPI.PageResponseProductVO>(
|
||||||
|
'/operation/pageProduct',
|
||||||
|
{
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
productPageQry: undefined,
|
||||||
|
...params['productPageQry'],
|
||||||
|
},
|
||||||
|
...(options || {}),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 产品详情 GET /operation/showProduct */
|
||||||
|
export async function showProduct(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: BusinessAPI.showProductParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<BusinessAPI.SingleResponseProductVO>(
|
||||||
|
'/operation/showProduct',
|
||||||
|
{
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
productShowQry: undefined,
|
||||||
|
...params['productShowQry'],
|
||||||
|
},
|
||||||
|
...(options || {}),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 产品更新 PUT /operation/updateProduct */
|
||||||
|
export async function updateProduct(
|
||||||
|
body: BusinessAPI.ProductUpdateCmd,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<BusinessAPI.SingleResponseProductVO>(
|
||||||
|
'/operation/updateProduct',
|
||||||
|
{
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 产品更新 PATCH /operation/updateProduct */
|
||||||
|
export async function updateProduct1(
|
||||||
|
body: BusinessAPI.ProductUpdateCmd,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<BusinessAPI.SingleResponseProductVO>(
|
||||||
|
'/operation/updateProduct',
|
||||||
|
{
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -1875,6 +1875,10 @@ declare namespace BusinessAPI {
|
|||||||
platformListQry: PlatformListQry;
|
platformListQry: PlatformListQry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type listProductParams = {
|
||||||
|
productListQry: ProductListQry;
|
||||||
|
};
|
||||||
|
|
||||||
type listPurchaseOrderParams = {
|
type listPurchaseOrderParams = {
|
||||||
purchaseOrderListQry: PurchaseOrderListQry;
|
purchaseOrderListQry: PurchaseOrderListQry;
|
||||||
};
|
};
|
||||||
@ -2267,6 +2271,15 @@ declare namespace BusinessAPI {
|
|||||||
notEmpty?: boolean;
|
notEmpty?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type MultiResponseProductVO = {
|
||||||
|
success?: boolean;
|
||||||
|
errCode?: string;
|
||||||
|
errMessage?: string;
|
||||||
|
data?: ProductVO[];
|
||||||
|
empty?: boolean;
|
||||||
|
notEmpty?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
type MultiResponsePurchaseOrderVO = {
|
type MultiResponsePurchaseOrderVO = {
|
||||||
success?: boolean;
|
success?: boolean;
|
||||||
errCode?: string;
|
errCode?: string;
|
||||||
@ -2633,6 +2646,10 @@ declare namespace BusinessAPI {
|
|||||||
platformPageQry: PlatformPageQry;
|
platformPageQry: PlatformPageQry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type pageProductParams = {
|
||||||
|
productPageQry: ProductPageQry;
|
||||||
|
};
|
||||||
|
|
||||||
type pagePurchaseOrderParams = {
|
type pagePurchaseOrderParams = {
|
||||||
purchaseOrderPageQry: PurchaseOrderPageQry;
|
purchaseOrderPageQry: PurchaseOrderPageQry;
|
||||||
};
|
};
|
||||||
@ -2858,6 +2875,19 @@ declare namespace BusinessAPI {
|
|||||||
totalPages?: number;
|
totalPages?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type PageResponseProductVO = {
|
||||||
|
success?: boolean;
|
||||||
|
errCode?: string;
|
||||||
|
errMessage?: string;
|
||||||
|
totalCount?: number;
|
||||||
|
pageSize?: number;
|
||||||
|
pageIndex?: number;
|
||||||
|
data?: ProductVO[];
|
||||||
|
empty?: boolean;
|
||||||
|
notEmpty?: boolean;
|
||||||
|
totalPages?: number;
|
||||||
|
};
|
||||||
|
|
||||||
type PageResponsePurchaseOrderVO = {
|
type PageResponsePurchaseOrderVO = {
|
||||||
success?: boolean;
|
success?: boolean;
|
||||||
errCode?: string;
|
errCode?: string;
|
||||||
@ -3039,6 +3069,107 @@ declare namespace BusinessAPI {
|
|||||||
homePage: string;
|
homePage: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ProductCreateCmd = {
|
||||||
|
/** 产品ID */
|
||||||
|
productId: string;
|
||||||
|
/** 产品名称 */
|
||||||
|
name: string;
|
||||||
|
/** 关联成本费用id */
|
||||||
|
costItemIds?: number[];
|
||||||
|
/** 备注 */
|
||||||
|
remark?: string;
|
||||||
|
/** 排序号 */
|
||||||
|
sort: number;
|
||||||
|
/** 状态:1_启用;0_禁用 */
|
||||||
|
status: boolean;
|
||||||
|
/** 创建时间 */
|
||||||
|
createdAt?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ProductDestroyCmd = {
|
||||||
|
/** 产品表ID */
|
||||||
|
productId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ProductDragCmd = {
|
||||||
|
/** 相邻元素前 */
|
||||||
|
prevId?: number;
|
||||||
|
/** 相邻元素后 */
|
||||||
|
nextId?: number;
|
||||||
|
/** 当前元素 */
|
||||||
|
currentId?: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ProductListQry = {
|
||||||
|
/** 状态:1_启用;0_禁用; */
|
||||||
|
status?: boolean;
|
||||||
|
/** 产品表ID */
|
||||||
|
productId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ProductPageQry = {
|
||||||
|
pageSize?: number;
|
||||||
|
pageIndex?: number;
|
||||||
|
orderBy?: string;
|
||||||
|
orderDirection?: string;
|
||||||
|
groupBy?: string;
|
||||||
|
needTotalCount?: boolean;
|
||||||
|
/** 自定义字段key */
|
||||||
|
customFieldKey?: string;
|
||||||
|
/** 自定义字段value */
|
||||||
|
customFieldValue?: string;
|
||||||
|
/** 备注 */
|
||||||
|
remark?: string;
|
||||||
|
/** 状态:1_启用;0_禁用; */
|
||||||
|
status?: boolean;
|
||||||
|
/** 产品表ID */
|
||||||
|
productId?: string;
|
||||||
|
offset?: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ProductShowQry = {
|
||||||
|
/** 状态:1_启用;0_禁用; */
|
||||||
|
status?: boolean;
|
||||||
|
/** 产品表ID */
|
||||||
|
productId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ProductUpdateCmd = {
|
||||||
|
/** 产品表ID */
|
||||||
|
productId: string;
|
||||||
|
/** 产品名称 */
|
||||||
|
name: string;
|
||||||
|
/** 关联成本费用id */
|
||||||
|
costItemIds?: number[];
|
||||||
|
/** 备注 */
|
||||||
|
remark?: string;
|
||||||
|
/** 排序号 */
|
||||||
|
sort: number;
|
||||||
|
/** 状态:1_启用;0_禁用 */
|
||||||
|
status: boolean;
|
||||||
|
/** 创建时间 */
|
||||||
|
createdAt?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ProductVO = {
|
||||||
|
/** 产品ID */
|
||||||
|
productId: string;
|
||||||
|
/** 产品名称 */
|
||||||
|
name: string;
|
||||||
|
/** 关联成本费用id */
|
||||||
|
costItemIds?: number[];
|
||||||
|
/** 备注 */
|
||||||
|
remark?: string;
|
||||||
|
/** 排序号 */
|
||||||
|
sort: number;
|
||||||
|
/** 状态:1_启用;0_禁用 */
|
||||||
|
status: boolean;
|
||||||
|
/** 成本费用 */
|
||||||
|
costItemVOList?: CostItemVO[];
|
||||||
|
/** 创建时间 */
|
||||||
|
createdAt?: string;
|
||||||
|
};
|
||||||
|
|
||||||
type PurchaseOrderApproveCmd = {
|
type PurchaseOrderApproveCmd = {
|
||||||
/** 采购订单ID */
|
/** 采购订单ID */
|
||||||
orderId: string;
|
orderId: string;
|
||||||
@ -3856,6 +3987,10 @@ declare namespace BusinessAPI {
|
|||||||
platformShowQry: PlatformShowQry;
|
platformShowQry: PlatformShowQry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type showProductParams = {
|
||||||
|
productShowQry: ProductShowQry;
|
||||||
|
};
|
||||||
|
|
||||||
type showPurchaseOrderParams = {
|
type showPurchaseOrderParams = {
|
||||||
purchaseOrderShowQry: PurchaseOrderShowQry;
|
purchaseOrderShowQry: PurchaseOrderShowQry;
|
||||||
};
|
};
|
||||||
@ -4027,6 +4162,13 @@ declare namespace BusinessAPI {
|
|||||||
data?: PlatformVO;
|
data?: PlatformVO;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type SingleResponseProductVO = {
|
||||||
|
success?: boolean;
|
||||||
|
errCode?: string;
|
||||||
|
errMessage?: string;
|
||||||
|
data?: ProductVO;
|
||||||
|
};
|
||||||
|
|
||||||
type SingleResponsePurchaseOrderVO = {
|
type SingleResponsePurchaseOrderVO = {
|
||||||
success?: boolean;
|
success?: boolean;
|
||||||
errCode?: string;
|
errCode?: string;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user