feat(产品管理): 重构产品属性管理功能
新增统一属性管理页面,整合品牌、强度、口味等属性配置 删除原有的独立属性管理页面(Brand/Flavors/Strength) 在产品列表页新增产品组成管理功能 更新API接口以支持新的属性管理方式
This commit is contained in:
parent
1d9d8a19f9
commit
ef838123f3
|
|
@ -0,0 +1,243 @@
|
||||||
|
import { UploadOutlined } from '@ant-design/icons';
|
||||||
|
import { PageContainer } from '@ant-design/pro-components';
|
||||||
|
import { request } from '@umijs/max';
|
||||||
|
import { Button, Form, Input, Layout, Modal, Space, Table, Upload, message } from 'antd';
|
||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
const { Sider, Content } = Layout;
|
||||||
|
|
||||||
|
// 中文注释:限定允许管理的字典名称集合
|
||||||
|
const allowedDictNames = new Set(['brand', 'strength', 'flavor', 'size', 'humidity']);
|
||||||
|
|
||||||
|
const AttributePage: React.FC = () => {
|
||||||
|
// 中文注释:左侧字典列表状态
|
||||||
|
const [dicts, setDicts] = useState<any[]>([]);
|
||||||
|
const [loadingDicts, setLoadingDicts] = useState(false);
|
||||||
|
const [searchText, setSearchText] = useState('');
|
||||||
|
const [selectedDict, setSelectedDict] = useState<any>(null);
|
||||||
|
|
||||||
|
// 中文注释:右侧字典项状态
|
||||||
|
const [dictItems, setDictItems] = useState<any[]>([]);
|
||||||
|
const [loadingDictItems, setLoadingDictItems] = useState(false);
|
||||||
|
|
||||||
|
// 中文注释:字典项新增/编辑模态框控制
|
||||||
|
const [isDictItemModalVisible, setIsDictItemModalVisible] = useState(false);
|
||||||
|
const [editingDictItem, setEditingDictItem] = useState<any>(null);
|
||||||
|
const [dictItemForm] = Form.useForm();
|
||||||
|
|
||||||
|
// 中文注释:获取字典列表,仅保留允许的名称
|
||||||
|
const fetchDicts = async (title?: string) => {
|
||||||
|
setLoadingDicts(true);
|
||||||
|
try {
|
||||||
|
const res = await request('/dict/list', { params: { title } });
|
||||||
|
// 中文注释:条件判断,过滤只保留 allowedDictNames 中的字典
|
||||||
|
const filtered = (res || []).filter((d: any) => allowedDictNames.has(d?.name));
|
||||||
|
setDicts(filtered);
|
||||||
|
} catch (error) {
|
||||||
|
message.error('获取字典列表失败');
|
||||||
|
}
|
||||||
|
setLoadingDicts(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 中文注释:获取字典项列表
|
||||||
|
const fetchDictItems = async (dictId?: number) => {
|
||||||
|
setLoadingDictItems(true);
|
||||||
|
try {
|
||||||
|
const res = await request('/dict/items', { params: { dictId } });
|
||||||
|
setDictItems(res || []);
|
||||||
|
} catch (error) {
|
||||||
|
message.error('获取字典项列表失败');
|
||||||
|
}
|
||||||
|
setLoadingDictItems(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 中文注释:组件挂载时初始化数据
|
||||||
|
useEffect(() => {
|
||||||
|
fetchDicts();
|
||||||
|
fetchDictItems();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// 中文注释:当选择的字典发生变化时刷新右侧字典项
|
||||||
|
useEffect(() => {
|
||||||
|
fetchDictItems(selectedDict?.id);
|
||||||
|
}, [selectedDict]);
|
||||||
|
|
||||||
|
// 中文注释:搜索触发过滤
|
||||||
|
const handleSearch = (value: string) => {
|
||||||
|
fetchDicts(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 中文注释:打开添加字典项模态框
|
||||||
|
const handleAddDictItem = () => {
|
||||||
|
setEditingDictItem(null);
|
||||||
|
dictItemForm.resetFields();
|
||||||
|
setIsDictItemModalVisible(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 中文注释:打开编辑字典项模态框
|
||||||
|
const handleEditDictItem = (item: any) => {
|
||||||
|
setEditingDictItem(item);
|
||||||
|
dictItemForm.setFieldsValue(item);
|
||||||
|
setIsDictItemModalVisible(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 中文注释:字典项表单提交(新增或编辑)
|
||||||
|
const handleDictItemFormSubmit = async (values: any) => {
|
||||||
|
try {
|
||||||
|
if (editingDictItem) {
|
||||||
|
// 中文注释:条件判断,存在编辑项则执行更新
|
||||||
|
await request(`/dict/item/${editingDictItem.id}`, {
|
||||||
|
method: 'PUT',
|
||||||
|
data: values,
|
||||||
|
});
|
||||||
|
message.success('更新成功');
|
||||||
|
} else {
|
||||||
|
// 中文注释:否则执行新增,绑定到当前选择的字典
|
||||||
|
await request('/dict/item', {
|
||||||
|
method: 'POST',
|
||||||
|
data: { ...values, dictId: selectedDict.id },
|
||||||
|
});
|
||||||
|
message.success('添加成功');
|
||||||
|
}
|
||||||
|
setIsDictItemModalVisible(false);
|
||||||
|
fetchDictItems(selectedDict.id);
|
||||||
|
} catch (error) {
|
||||||
|
message.error(editingDictItem ? '更新失败' : '添加失败');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 中文注释:删除字典项
|
||||||
|
const handleDeleteDictItem = async (itemId: number) => {
|
||||||
|
try {
|
||||||
|
await request(`/dict/item/${itemId}`, { method: 'DELETE' });
|
||||||
|
message.success('删除成功');
|
||||||
|
fetchDictItems(selectedDict.id);
|
||||||
|
} catch (error) {
|
||||||
|
message.error('删除失败');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 中文注释:左侧字典列表列定义(紧凑样式)
|
||||||
|
const dictColumns = [
|
||||||
|
{ title: '名称', dataIndex: 'name', key: 'name' },
|
||||||
|
{ title: '标题', dataIndex: 'title', key: 'title' },
|
||||||
|
];
|
||||||
|
|
||||||
|
// 中文注释:右侧字典项列表列定义(紧凑样式)
|
||||||
|
const dictItemColumns = [
|
||||||
|
{ title: '名称', dataIndex: 'name', key: 'name' },
|
||||||
|
{ title: '标题', dataIndex: 'title', key: 'title' },
|
||||||
|
{ title: '中文标题', dataIndex: 'titleCN', key: 'titleCN' },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
render: (_: any, record: any) => (
|
||||||
|
<Space size="small">
|
||||||
|
<Button size="small" type="link" onClick={() => handleEditDictItem(record)}>编辑</Button>
|
||||||
|
<Button size="small" type="link" danger onClick={() => handleDeleteDictItem(record.id)}>删除</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageContainer>
|
||||||
|
<Layout style={{ background: '#fff' }}>
|
||||||
|
<Sider
|
||||||
|
width={240}
|
||||||
|
style={{ background: '#fff', padding: '8px', borderRight: '1px solid #f0f0f0' }}
|
||||||
|
>
|
||||||
|
<Space direction="vertical" style={{ width: '100%' }} size="small">
|
||||||
|
<Input.Search
|
||||||
|
placeholder="搜索字典"
|
||||||
|
onSearch={handleSearch}
|
||||||
|
onChange={(e) => setSearchText(e.target.value)}
|
||||||
|
enterButton
|
||||||
|
allowClear
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
dataSource={dicts}
|
||||||
|
columns={dictColumns}
|
||||||
|
rowKey="id"
|
||||||
|
loading={loadingDicts}
|
||||||
|
size="small"
|
||||||
|
onRow={(record) => ({
|
||||||
|
onClick: () => {
|
||||||
|
// 中文注释:条件判断,重复点击同一行则取消选择
|
||||||
|
if (selectedDict?.id === record.id) {
|
||||||
|
setSelectedDict(null);
|
||||||
|
} else {
|
||||||
|
setSelectedDict(record);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})}
|
||||||
|
rowClassName={(record) => (selectedDict?.id === record.id ? 'ant-table-row-selected' : '')}
|
||||||
|
pagination={false}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
</Sider>
|
||||||
|
<Content style={{ padding: '8px' }}>
|
||||||
|
<Space direction="vertical" style={{ width: '100%' }} size="small">
|
||||||
|
<div style={{ width: '100%', display: 'flex', flexDirection: 'row', gap: '4px' }}>
|
||||||
|
<Button type="primary" size="small" onClick={handleAddDictItem} disabled={!selectedDict}>添加字典项</Button>
|
||||||
|
<Upload
|
||||||
|
name="file"
|
||||||
|
action={`/dict/item/import`}
|
||||||
|
data={{ dictId: selectedDict?.id }}
|
||||||
|
showUploadList={false}
|
||||||
|
disabled={!selectedDict}
|
||||||
|
onChange={(info) => {
|
||||||
|
// 中文注释:条件判断,上传状态处理
|
||||||
|
if (info.file.status === 'done') {
|
||||||
|
message.success(`${info.file.name} 文件上传成功`);
|
||||||
|
fetchDictItems(selectedDict.id);
|
||||||
|
} else if (info.file.status === 'error') {
|
||||||
|
message.error(`${info.file.name} 文件上传失败`);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button size="small" icon={<UploadOutlined />} disabled={!selectedDict}>
|
||||||
|
导入字典项
|
||||||
|
</Button>
|
||||||
|
</Upload>
|
||||||
|
</div>
|
||||||
|
<Table
|
||||||
|
dataSource={dictItems}
|
||||||
|
columns={dictItemColumns}
|
||||||
|
rowKey="id"
|
||||||
|
loading={loadingDictItems}
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
</Content>
|
||||||
|
</Layout>
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
title={editingDictItem ? '编辑字典项' : '添加字典项'}
|
||||||
|
open={isDictItemModalVisible}
|
||||||
|
onOk={() => dictItemForm.submit()}
|
||||||
|
onCancel={() => setIsDictItemModalVisible(false)}
|
||||||
|
destroyOnClose
|
||||||
|
>
|
||||||
|
<Form form={dictItemForm} layout="vertical" onFinish={handleDictItemFormSubmit}>
|
||||||
|
<Form.Item label="名称" name="name" rules={[{ required: true, message: '请输入名称' }]}>
|
||||||
|
<Input size="small" placeholder="名称 (e.g., zyn)" />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label="标题" name="title" rules={[{ required: true, message: '请输入标题' }]}>
|
||||||
|
<Input size="small" placeholder="标题 (e.g., ZYN)" />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label="中文标题" name="titleCN">
|
||||||
|
<Input size="small" placeholder="中文标题 (e.g., 品牌)" />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label="值 (可选)" name="value">
|
||||||
|
<Input size="small" placeholder="值 (可选)" />
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
|
</PageContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AttributePage;
|
||||||
|
|
||||||
|
|
@ -1,208 +0,0 @@
|
||||||
import {
|
|
||||||
productcontrollerCreatebrand,
|
|
||||||
productcontrollerDeletebrand,
|
|
||||||
productcontrollerGetbrands,
|
|
||||||
productcontrollerUpdatebrand,
|
|
||||||
} from '@/servers/api/product';
|
|
||||||
import { EditOutlined, PlusOutlined } from '@ant-design/icons';
|
|
||||||
import {
|
|
||||||
ActionType,
|
|
||||||
DrawerForm,
|
|
||||||
PageContainer,
|
|
||||||
ProColumns,
|
|
||||||
ProForm,
|
|
||||||
ProFormText,
|
|
||||||
ProTable,
|
|
||||||
} from '@ant-design/pro-components';
|
|
||||||
import { App, Button, Popconfirm } from 'antd';
|
|
||||||
import { useRef } from 'react';
|
|
||||||
|
|
||||||
const List: React.FC = () => {
|
|
||||||
const actionRef = useRef<ActionType>();
|
|
||||||
const { message } = App.useApp();
|
|
||||||
const columns: ProColumns<API.Brand>[] = [
|
|
||||||
{
|
|
||||||
title: '名称',
|
|
||||||
dataIndex: 'name',
|
|
||||||
tip: '名称是唯一的 key',
|
|
||||||
formItemProps: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '名称为必填项',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '标识',
|
|
||||||
dataIndex: 'unique_key',
|
|
||||||
hideInSearch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '更新时间',
|
|
||||||
dataIndex: 'updatedAt',
|
|
||||||
valueType: 'dateTime',
|
|
||||||
hideInSearch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createdAt',
|
|
||||||
valueType: 'dateTime',
|
|
||||||
hideInSearch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
dataIndex: 'option',
|
|
||||||
valueType: 'option',
|
|
||||||
render: (_, record) => (
|
|
||||||
<>
|
|
||||||
{/* <UpdateForm tableRef={actionRef} values={record} />
|
|
||||||
<Divider type="vertical" /> */}
|
|
||||||
<Popconfirm
|
|
||||||
title="删除"
|
|
||||||
description="确认删除?"
|
|
||||||
onConfirm={async () => {
|
|
||||||
try {
|
|
||||||
const { success, message: errMsg } =
|
|
||||||
await productcontrollerDeletebrand({ id: record.id });
|
|
||||||
if (!success) {
|
|
||||||
throw new Error(errMsg);
|
|
||||||
}
|
|
||||||
actionRef.current?.reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
message.error(error.message);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Button type="primary" danger>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageContainer header={{ title: '品牌列表' }}>
|
|
||||||
<ProTable<any>
|
|
||||||
headerTitle="查询表格"
|
|
||||||
actionRef={actionRef}
|
|
||||||
rowKey="id"
|
|
||||||
toolBarRender={() => [<CreateForm tableRef={actionRef} />]}
|
|
||||||
request={async (params) => {
|
|
||||||
const { data, success } = await productcontrollerGetbrands(params);
|
|
||||||
return {
|
|
||||||
total: data?.total || 0,
|
|
||||||
data: data?.items || [],
|
|
||||||
success,
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
columns={columns}
|
|
||||||
/>
|
|
||||||
</PageContainer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const CreateForm: React.FC<{
|
|
||||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
|
||||||
}> = ({ tableRef }) => {
|
|
||||||
const { message } = App.useApp();
|
|
||||||
return (
|
|
||||||
<DrawerForm<API.CreateBrandDTO>
|
|
||||||
title="新建"
|
|
||||||
trigger={
|
|
||||||
<Button type="primary">
|
|
||||||
<PlusOutlined />
|
|
||||||
新建
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
autoFocusFirstInput
|
|
||||||
drawerProps={{
|
|
||||||
destroyOnHidden: true,
|
|
||||||
}}
|
|
||||||
onFinish={async (values) => {
|
|
||||||
try {
|
|
||||||
const { success, message: errMsg } =
|
|
||||||
await productcontrollerCreatebrand(values);
|
|
||||||
if (!success) {
|
|
||||||
throw new Error(errMsg);
|
|
||||||
}
|
|
||||||
tableRef.current?.reload();
|
|
||||||
message.success('提交成功');
|
|
||||||
return true;
|
|
||||||
} catch (error: any) {
|
|
||||||
message.error(error.message);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ProFormText
|
|
||||||
name="name"
|
|
||||||
width="md"
|
|
||||||
label="品牌名称"
|
|
||||||
placeholder="请输入名称"
|
|
||||||
rules={[{ required: true, message: '请输入名称' }]}
|
|
||||||
/>
|
|
||||||
<ProFormText
|
|
||||||
name="unique_key"
|
|
||||||
width="md"
|
|
||||||
label="Key"
|
|
||||||
placeholder="请输入Key"
|
|
||||||
rules={[{ required: true, message: '请输入Key' }]}
|
|
||||||
/>
|
|
||||||
</DrawerForm>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdateForm: React.FC<{
|
|
||||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
|
||||||
values: API.Brand;
|
|
||||||
}> = ({ tableRef, values: initialValues }) => {
|
|
||||||
const { message } = App.useApp();
|
|
||||||
return (
|
|
||||||
<DrawerForm<API.UpdateBrandDTO>
|
|
||||||
title="编辑"
|
|
||||||
initialValues={initialValues}
|
|
||||||
trigger={
|
|
||||||
<Button type="primary">
|
|
||||||
<EditOutlined />
|
|
||||||
编辑
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
autoFocusFirstInput
|
|
||||||
drawerProps={{
|
|
||||||
destroyOnHidden: true,
|
|
||||||
}}
|
|
||||||
onFinish={async (values) => {
|
|
||||||
try {
|
|
||||||
const { success, message: errMsg } =
|
|
||||||
await productcontrollerUpdatebrand(
|
|
||||||
{ id: initialValues.id },
|
|
||||||
values,
|
|
||||||
);
|
|
||||||
if (!success) {
|
|
||||||
throw new Error(errMsg);
|
|
||||||
}
|
|
||||||
message.success('提交成功');
|
|
||||||
tableRef.current?.reload();
|
|
||||||
return true;
|
|
||||||
} catch (error: any) {
|
|
||||||
message.error(error.message);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ProForm.Group>
|
|
||||||
<ProFormText
|
|
||||||
name="name"
|
|
||||||
width="md"
|
|
||||||
label="品牌名称"
|
|
||||||
placeholder="请输入名称"
|
|
||||||
rules={[{ required: true, message: '请输入名称' }]}
|
|
||||||
/>
|
|
||||||
</ProForm.Group>
|
|
||||||
</DrawerForm>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default List;
|
|
||||||
|
|
@ -1,207 +0,0 @@
|
||||||
import {
|
|
||||||
productcontrollerCreateflavors,
|
|
||||||
productcontrollerDeleteflavors,
|
|
||||||
productcontrollerGetflavors,
|
|
||||||
productcontrollerUpdateflavors,
|
|
||||||
} from '@/servers/api/product';
|
|
||||||
import { EditOutlined, PlusOutlined } from '@ant-design/icons';
|
|
||||||
import {
|
|
||||||
ActionType,
|
|
||||||
DrawerForm,
|
|
||||||
PageContainer,
|
|
||||||
ProColumns,
|
|
||||||
ProForm,
|
|
||||||
ProFormText,
|
|
||||||
ProTable,
|
|
||||||
} from '@ant-design/pro-components';
|
|
||||||
import { App, Button, Popconfirm } from 'antd';
|
|
||||||
import { useRef } from 'react';
|
|
||||||
|
|
||||||
const List: React.FC = () => {
|
|
||||||
const actionRef = useRef<ActionType>();
|
|
||||||
const { message } = App.useApp();
|
|
||||||
const columns: ProColumns<API.Category>[] = [
|
|
||||||
{
|
|
||||||
title: '名称',
|
|
||||||
dataIndex: 'name',
|
|
||||||
tip: '名称是唯一的 key',
|
|
||||||
formItemProps: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '名称为必填项',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '显示名称',
|
|
||||||
dataIndex: 'title',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '更新时间',
|
|
||||||
dataIndex: 'updatedAt',
|
|
||||||
valueType: 'dateTime',
|
|
||||||
hideInSearch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createdAt',
|
|
||||||
valueType: 'dateTime',
|
|
||||||
hideInSearch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
dataIndex: 'option',
|
|
||||||
valueType: 'option',
|
|
||||||
render: (_, record) => (
|
|
||||||
<>
|
|
||||||
{/* <UpdateForm tableRef={actionRef} values={record} />
|
|
||||||
<Divider type="vertical" /> */}
|
|
||||||
<Popconfirm
|
|
||||||
title="删除"
|
|
||||||
description="确认删除?"
|
|
||||||
onConfirm={async () => {
|
|
||||||
try {
|
|
||||||
const { success, message: errMsg } =
|
|
||||||
await productcontrollerDeleteflavors({ id: record.id });
|
|
||||||
if (!success) {
|
|
||||||
throw new Error(errMsg);
|
|
||||||
}
|
|
||||||
actionRef.current?.reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
message.error(error.message);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Button type="primary" danger>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageContainer header={{ title: '口味列表' }}>
|
|
||||||
<ProTable<API.Category>
|
|
||||||
headerTitle="查询表格"
|
|
||||||
actionRef={actionRef}
|
|
||||||
rowKey="id"
|
|
||||||
toolBarRender={() => [<CreateForm tableRef={actionRef} />]}
|
|
||||||
request={async (params) => {
|
|
||||||
const { data, success } = await productcontrollerGetflavors(params);
|
|
||||||
return {
|
|
||||||
total: data?.total || 0,
|
|
||||||
data: data?.items || [],
|
|
||||||
success,
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
columns={columns}
|
|
||||||
/>
|
|
||||||
</PageContainer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const CreateForm: React.FC<{
|
|
||||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
|
||||||
}> = ({ tableRef }) => {
|
|
||||||
const { message } = App.useApp();
|
|
||||||
return (
|
|
||||||
<DrawerForm<API.CreateCategoryDTO>
|
|
||||||
title="新建"
|
|
||||||
trigger={
|
|
||||||
<Button type="primary">
|
|
||||||
<PlusOutlined />
|
|
||||||
新建
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
autoFocusFirstInput
|
|
||||||
drawerProps={{
|
|
||||||
destroyOnHidden: true,
|
|
||||||
}}
|
|
||||||
onFinish={async (values) => {
|
|
||||||
try {
|
|
||||||
const { success, message: errMsg } =
|
|
||||||
await productcontrollerCreateflavors(values);
|
|
||||||
if (!success) {
|
|
||||||
throw new Error(errMsg);
|
|
||||||
}
|
|
||||||
tableRef.current?.reload();
|
|
||||||
message.success('提交成功');
|
|
||||||
return true;
|
|
||||||
} catch (error: any) {
|
|
||||||
message.error(error.message);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ProFormText
|
|
||||||
name="name"
|
|
||||||
width="md"
|
|
||||||
label="口味名称"
|
|
||||||
placeholder="请输入名称"
|
|
||||||
rules={[{ required: true, message: '请输入名称' }]}
|
|
||||||
/>
|
|
||||||
<ProFormText
|
|
||||||
name="unique_key"
|
|
||||||
width="md"
|
|
||||||
label="Key"
|
|
||||||
placeholder="请输入Key"
|
|
||||||
rules={[{ required: true, message: '请输入Key' }]}
|
|
||||||
/>
|
|
||||||
</DrawerForm>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const UpdateForm: React.FC<{
|
|
||||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
|
||||||
values: API.Category;
|
|
||||||
}> = ({ tableRef, values: initialValues }) => {
|
|
||||||
const { message } = App.useApp();
|
|
||||||
return (
|
|
||||||
<DrawerForm<API.UpdateCategoryDTO>
|
|
||||||
title="编辑"
|
|
||||||
initialValues={initialValues}
|
|
||||||
trigger={
|
|
||||||
<Button type="primary">
|
|
||||||
<EditOutlined />
|
|
||||||
编辑
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
autoFocusFirstInput
|
|
||||||
drawerProps={{
|
|
||||||
destroyOnHidden: true,
|
|
||||||
}}
|
|
||||||
onFinish={async (values) => {
|
|
||||||
try {
|
|
||||||
const { success, message: errMsg } =
|
|
||||||
await productcontrollerUpdateflavors(
|
|
||||||
{ id: initialValues.id },
|
|
||||||
values,
|
|
||||||
);
|
|
||||||
if (!success) {
|
|
||||||
throw new Error(errMsg);
|
|
||||||
}
|
|
||||||
message.success('提交成功');
|
|
||||||
tableRef.current?.reload();
|
|
||||||
return true;
|
|
||||||
} catch (error: any) {
|
|
||||||
message.error(error.message);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ProForm.Group>
|
|
||||||
<ProFormText
|
|
||||||
name="name"
|
|
||||||
width="md"
|
|
||||||
label="口味名称"
|
|
||||||
placeholder="请输入名称"
|
|
||||||
rules={[{ required: true, message: '请输入名称' }]}
|
|
||||||
/>
|
|
||||||
</ProForm.Group>
|
|
||||||
</DrawerForm>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default List;
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
import {
|
import {
|
||||||
productcontrollerCreateproduct,
|
productcontrollerCreateproduct,
|
||||||
productcontrollerDeleteproduct,
|
productcontrollerDeleteproduct,
|
||||||
productcontrollerGetbrandall,
|
productcontrollerCompatbrandall,
|
||||||
productcontrollerGetflavorsall,
|
productcontrollerCompatflavorsall,
|
||||||
productcontrollerGetproductlist,
|
productcontrollerGetproductlist,
|
||||||
productcontrollerGetstrengthall,
|
productcontrollerCompatstrengthall,
|
||||||
productcontrollerUpdateproductnamecn,
|
productcontrollerUpdateproductnamecn,
|
||||||
productcontrollerUpdateproduct,
|
productcontrollerUpdateproduct,
|
||||||
|
productcontrollerGetproductcomponents,
|
||||||
|
productcontrollerSetproductcomponents,
|
||||||
|
productcontrollerAutobindcomponents,
|
||||||
|
productcontrollerGetattributeall,
|
||||||
} from '@/servers/api/product';
|
} from '@/servers/api/product';
|
||||||
import { templatecontrollerRendertemplate } from '@/servers/api/template';
|
import { templatecontrollerRendertemplate } from '@/servers/api/template';
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
|
|
@ -17,6 +21,7 @@ import {
|
||||||
ProColumns,
|
ProColumns,
|
||||||
ProForm,
|
ProForm,
|
||||||
ProFormInstance,
|
ProFormInstance,
|
||||||
|
ProFormList,
|
||||||
ProFormSelect,
|
ProFormSelect,
|
||||||
ProFormText,
|
ProFormText,
|
||||||
ProFormTextArea,
|
ProFormTextArea,
|
||||||
|
|
@ -102,21 +107,21 @@ const List: React.FC = () => {
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '产品描述',
|
title: '描述',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '产品品牌',
|
title: '品牌',
|
||||||
dataIndex: 'brandName',
|
dataIndex: 'brand.name',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '强度',
|
title: '强度',
|
||||||
dataIndex: 'strengthName',
|
dataIndex: 'strength.name',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '口味',
|
title: '口味',
|
||||||
dataIndex: 'flavorsName',
|
dataIndex: 'flavors.name',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '湿度',
|
title: '湿度',
|
||||||
|
|
@ -306,8 +311,22 @@ const CreateForm: React.FC<{
|
||||||
destroyOnHidden: true,
|
destroyOnHidden: true,
|
||||||
}}
|
}}
|
||||||
onFinish={async (values) => {
|
onFinish={async (values) => {
|
||||||
|
// 中文注释:将选择的字典项ID与干湿属性组装为后端需要的 attributes
|
||||||
|
const payload: any = {
|
||||||
|
name: values.name,
|
||||||
|
description: values.description,
|
||||||
|
sku: values.sku,
|
||||||
|
price: values.price,
|
||||||
|
promotionPrice: values.promotionPrice,
|
||||||
|
attributes: [
|
||||||
|
values.brandId ? { id: values.brandId } : null,
|
||||||
|
values.strengthId ? { id: values.strengthId } : null,
|
||||||
|
values.flavorsId ? { id: values.flavorsId } : null,
|
||||||
|
values.humidity ? { dictName: 'humidity', name: values.humidity } : null,
|
||||||
|
].filter(Boolean),
|
||||||
|
};
|
||||||
const { success, message: errMsg } =
|
const { success, message: errMsg } =
|
||||||
await productcontrollerCreateproduct(values);
|
await productcontrollerCreateproduct(payload);
|
||||||
if (success) {
|
if (success) {
|
||||||
message.success('提交成功');
|
message.success('提交成功');
|
||||||
tableRef.current?.reloadAndRest?.();
|
tableRef.current?.reloadAndRest?.();
|
||||||
|
|
@ -323,7 +342,7 @@ const CreateForm: React.FC<{
|
||||||
label="产品品牌"
|
label="产品品牌"
|
||||||
placeholder="请选择产品品牌"
|
placeholder="请选择产品品牌"
|
||||||
request={async () => {
|
request={async () => {
|
||||||
const { data = [] } = await productcontrollerGetbrandall();
|
const { data = [] } = await productcontrollerCompatbrandall();
|
||||||
setBrandOptions(data);
|
setBrandOptions(data);
|
||||||
return data.map((item: DictItem) => ({
|
return data.map((item: DictItem) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
|
|
@ -338,7 +357,7 @@ const CreateForm: React.FC<{
|
||||||
label="强度"
|
label="强度"
|
||||||
placeholder="请选择强度"
|
placeholder="请选择强度"
|
||||||
request={async () => {
|
request={async () => {
|
||||||
const { data = [] } = await productcontrollerGetstrengthall();
|
const { data = [] } = await productcontrollerCompatstrengthall();
|
||||||
setStrengthOptions(data);
|
setStrengthOptions(data);
|
||||||
return data.map((item: DictItem) => ({
|
return data.map((item: DictItem) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
|
|
@ -353,7 +372,7 @@ const CreateForm: React.FC<{
|
||||||
label="口味"
|
label="口味"
|
||||||
placeholder="请选择口味"
|
placeholder="请选择口味"
|
||||||
request={async () => {
|
request={async () => {
|
||||||
const { data = [] } = await productcontrollerGetflavorsall();
|
const { data = [] } = await productcontrollerCompatflavorsall();
|
||||||
setFlavorOptions(data);
|
setFlavorOptions(data);
|
||||||
return data.map((item: DictItem) => ({
|
return data.map((item: DictItem) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
|
|
@ -367,9 +386,9 @@ const CreateForm: React.FC<{
|
||||||
width="lg"
|
width="lg"
|
||||||
label="干湿"
|
label="干湿"
|
||||||
placeholder="请选择干湿"
|
placeholder="请选择干湿"
|
||||||
valueEnum={{
|
request={async () => {
|
||||||
dry: 'dry',
|
const { data = [] } = await productcontrollerGetattributeall({ dictName: 'humidity' } as any);
|
||||||
moisture: 'moisture',
|
return (data || []).map((item: any) => ({ label: item.name, value: item.name }));
|
||||||
}}
|
}}
|
||||||
rules={[{ required: true, message: '请选择干湿' }]}
|
rules={[{ required: true, message: '请选择干湿' }]}
|
||||||
/>
|
/>
|
||||||
|
|
@ -432,11 +451,13 @@ const EditForm: React.FC<{
|
||||||
const [brandOptions, setBrandOptions] = useState<DictItem[]>([]);
|
const [brandOptions, setBrandOptions] = useState<DictItem[]>([]);
|
||||||
const [strengthOptions, setStrengthOptions] = useState<DictItem[]>([]);
|
const [strengthOptions, setStrengthOptions] = useState<DictItem[]>([]);
|
||||||
const [flavorOptions, setFlavorOptions] = useState<DictItem[]>([]);
|
const [flavorOptions, setFlavorOptions] = useState<DictItem[]>([]);
|
||||||
|
const [humidityOptions, setHumidityOptions] = useState<{ label: string; value: string }[]>([]);
|
||||||
|
const [components, setComponents] = useState<{ stockId: number; quantity: number }[]>([]);
|
||||||
|
|
||||||
const setInitialIds = () => {
|
const setInitialIds = () => {
|
||||||
const brand = brandOptions.find((item) => item.title === record.brandName);
|
const brand = brandOptions.find((item) => item.title === record.brand.name);
|
||||||
const strength = strengthOptions.find((item) => item.title === record.strengthName);
|
const strength = strengthOptions.find((item) => item.title === record.strength.name);
|
||||||
const flavor = flavorOptions.find((item) => item.title === record.flavorsName);
|
const flavor = flavorOptions.find((item) => item.title === record.flavors.name);
|
||||||
formRef.current?.setFieldsValue({
|
formRef.current?.setFieldsValue({
|
||||||
brandId: brand?.id,
|
brandId: brand?.id,
|
||||||
strengthId: strength?.id,
|
strengthId: strength?.id,
|
||||||
|
|
@ -450,6 +471,21 @@ const EditForm: React.FC<{
|
||||||
}
|
}
|
||||||
}, [brandOptions, strengthOptions, flavorOptions]);
|
}, [brandOptions, strengthOptions, flavorOptions]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
// 中文注释:加载干湿选项
|
||||||
|
(async () => {
|
||||||
|
const { data = [] } = await productcontrollerGetattributeall({ dictName: 'humidity' } as any);
|
||||||
|
setHumidityOptions((data || []).map((i: any) => ({ label: i.name, value: i.name })));
|
||||||
|
})();
|
||||||
|
// 中文注释:加载当前产品的组成
|
||||||
|
(async () => {
|
||||||
|
const { data = [] } = await productcontrollerGetproductcomponents({ id: (record as any).id });
|
||||||
|
const items = (data || []).map((c: any) => ({ stockId: c.stockId, quantity: c.quantity }));
|
||||||
|
setComponents(items);
|
||||||
|
formRef.current?.setFieldsValue({ components: items });
|
||||||
|
})();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DrawerForm<API.UpdateProductDTO>
|
<DrawerForm<API.UpdateProductDTO>
|
||||||
formRef={formRef}
|
formRef={formRef}
|
||||||
|
|
@ -462,13 +498,37 @@ const EditForm: React.FC<{
|
||||||
humidity: record.humidity,
|
humidity: record.humidity,
|
||||||
price: (record as any).price,
|
price: (record as any).price,
|
||||||
promotionPrice: (record as any).promotionPrice,
|
promotionPrice: (record as any).promotionPrice,
|
||||||
|
components,
|
||||||
}}
|
}}
|
||||||
onFinish={async (values) => {
|
onFinish={async (values) => {
|
||||||
|
// 中文注释:组装 attributes(若选择了则发送)
|
||||||
|
const attrs = [
|
||||||
|
values.brandId ? { id: values.brandId } : null,
|
||||||
|
values.strengthId ? { id: values.strengthId } : null,
|
||||||
|
values.flavorsId ? { id: values.flavorsId } : null,
|
||||||
|
values.humidity ? { dictName: 'humidity', name: values.humidity } : null,
|
||||||
|
].filter(Boolean);
|
||||||
|
const updatePayload: any = {
|
||||||
|
name: values.name,
|
||||||
|
sku: values.sku,
|
||||||
|
description: values.description,
|
||||||
|
price: values.price,
|
||||||
|
promotionPrice: values.promotionPrice,
|
||||||
|
...(attrs.length ? { attributes: attrs } : {}),
|
||||||
|
};
|
||||||
const { success, message: errMsg } = await productcontrollerUpdateproduct(
|
const { success, message: errMsg } = await productcontrollerUpdateproduct(
|
||||||
{ id: record.id },
|
{ id: (record as any).id },
|
||||||
values as any,
|
updatePayload,
|
||||||
);
|
);
|
||||||
if (success) {
|
if (success) {
|
||||||
|
// 中文注释:同步更新组成(覆盖式)
|
||||||
|
const items = (values as any)?.components || [];
|
||||||
|
if (Array.isArray(items)) {
|
||||||
|
const payloadItems = items
|
||||||
|
.filter((i: any) => i && i.stockId && i.quantity && i.quantity > 0)
|
||||||
|
.map((i: any) => ({ stockId: Number(i.stockId), quantity: Number(i.quantity) }));
|
||||||
|
await productcontrollerSetproductcomponents({ id: (record as any).id }, { items: payloadItems });
|
||||||
|
}
|
||||||
message.success('更新成功');
|
message.success('更新成功');
|
||||||
tableRef.current?.reloadAndRest?.();
|
tableRef.current?.reloadAndRest?.();
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -477,62 +537,7 @@ const EditForm: React.FC<{
|
||||||
return false;
|
return false;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ProFormSelect
|
{/* 在这里列举attribute字段 */}
|
||||||
name="brandId"
|
|
||||||
width="lg"
|
|
||||||
label="产品品牌"
|
|
||||||
placeholder="请选择产品品牌"
|
|
||||||
request={async () => {
|
|
||||||
const { data = [] } = await productcontrollerGetbrandall();
|
|
||||||
setBrandOptions(data);
|
|
||||||
return data.map((item: DictItem) => ({
|
|
||||||
label: item.name,
|
|
||||||
value: item.id,
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
rules={[{ required: true, message: '请选择产品品牌' }]}
|
|
||||||
/>
|
|
||||||
<ProFormSelect
|
|
||||||
name="strengthId"
|
|
||||||
width="lg"
|
|
||||||
label="强度"
|
|
||||||
placeholder="请选择强度"
|
|
||||||
request={async () => {
|
|
||||||
const { data = [] } = await productcontrollerGetstrengthall();
|
|
||||||
setStrengthOptions(data);
|
|
||||||
return data.map((item: DictItem) => ({
|
|
||||||
label: item.name,
|
|
||||||
value: item.id,
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
rules={[{ required: true, message: '请选择强度' }]}
|
|
||||||
/>
|
|
||||||
<ProFormSelect
|
|
||||||
name="flavorsId"
|
|
||||||
width="lg"
|
|
||||||
label="口味"
|
|
||||||
placeholder="请选择口味"
|
|
||||||
request={async () => {
|
|
||||||
const { data = [] } = await productcontrollerGetflavorsall();
|
|
||||||
setFlavorOptions(data);
|
|
||||||
return data.map((item: DictItem) => ({
|
|
||||||
label: item.name,
|
|
||||||
value: item.id,
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
rules={[{ required: true, message: '请选择口味' }]}
|
|
||||||
/>
|
|
||||||
<ProFormSelect
|
|
||||||
name="humidity"
|
|
||||||
width="lg"
|
|
||||||
label="干湿"
|
|
||||||
placeholder="请选择干湿"
|
|
||||||
valueEnum={{
|
|
||||||
dry: 'dry',
|
|
||||||
moisture: 'moisture',
|
|
||||||
}}
|
|
||||||
rules={[{ required: true, message: '请选择干湿' }]}
|
|
||||||
/>
|
|
||||||
<ProForm.Group>
|
<ProForm.Group>
|
||||||
<ProFormText
|
<ProFormText
|
||||||
name="sku"
|
name="sku"
|
||||||
|
|
@ -549,6 +554,46 @@ const EditForm: React.FC<{
|
||||||
rules={[{ required: true, message: '请输入名称' }]}
|
rules={[{ required: true, message: '请输入名称' }]}
|
||||||
/>
|
/>
|
||||||
</ProForm.Group>
|
</ProForm.Group>
|
||||||
|
<ProFormSelect
|
||||||
|
name="brandId"
|
||||||
|
width="lg"
|
||||||
|
label="产品品牌"
|
||||||
|
placeholder="请选择产品品牌"
|
||||||
|
request={async () => {
|
||||||
|
const { data = [] } = await productcontrollerCompatbrandall();
|
||||||
|
setBrandOptions(data);
|
||||||
|
return data.map((item: DictItem) => ({ label: item.name, value: item.id }));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<ProFormSelect
|
||||||
|
name="strengthId"
|
||||||
|
width="lg"
|
||||||
|
label="强度"
|
||||||
|
placeholder="请选择强度"
|
||||||
|
request={async () => {
|
||||||
|
const { data = [] } = await productcontrollerCompatstrengthall();
|
||||||
|
setStrengthOptions(data);
|
||||||
|
return data.map((item: DictItem) => ({ label: item.name, value: item.id }));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<ProFormSelect
|
||||||
|
name="flavorsId"
|
||||||
|
width="lg"
|
||||||
|
label="口味"
|
||||||
|
placeholder="请选择口味"
|
||||||
|
request={async () => {
|
||||||
|
const { data = [] } = await productcontrollerCompatflavorsall();
|
||||||
|
setFlavorOptions(data);
|
||||||
|
return data.map((item: DictItem) => ({ label: item.name, value: item.id }));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<ProFormSelect
|
||||||
|
name="humidity"
|
||||||
|
width="lg"
|
||||||
|
label="干湿"
|
||||||
|
placeholder="请选择干湿"
|
||||||
|
options={humidityOptions}
|
||||||
|
/>
|
||||||
<ProFormText
|
<ProFormText
|
||||||
name="price"
|
name="price"
|
||||||
label="价格"
|
label="价格"
|
||||||
|
|
@ -569,6 +614,52 @@ const EditForm: React.FC<{
|
||||||
label="产品描述"
|
label="产品描述"
|
||||||
placeholder="请输入产品描述"
|
placeholder="请输入产品描述"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{/* 中文注释:编辑产品组成(库存ID + 数量) */}
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormText
|
||||||
|
name={['__helper']}
|
||||||
|
hidden
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
onClick={async () => {
|
||||||
|
await productcontrollerAutobindcomponents({ id: (record as any).id });
|
||||||
|
const { data = [] } = await productcontrollerGetproductcomponents({ id: (record as any).id });
|
||||||
|
const items = (data || []).map((c: any) => ({ stockId: c.stockId, quantity: c.quantity }));
|
||||||
|
formRef.current?.setFieldsValue({ components: items });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
自动绑定(同 SKU)
|
||||||
|
</Button>
|
||||||
|
</ProForm.Group>
|
||||||
|
<ProFormList
|
||||||
|
name="components"
|
||||||
|
label="组成项"
|
||||||
|
creatorButtonProps={{ position: 'bottom', creatorButtonText: '新增组成项' }}
|
||||||
|
itemRender={({ listDom, action }) => (
|
||||||
|
<div style={{ marginBottom: 8 }}>
|
||||||
|
{listDom}
|
||||||
|
{action}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormText
|
||||||
|
name="stockId"
|
||||||
|
label="库存ID"
|
||||||
|
width="md"
|
||||||
|
placeholder="请输入库存ID"
|
||||||
|
rules={[{ required: true, message: '请输入库存ID' }]}
|
||||||
|
/>
|
||||||
|
<ProFormText
|
||||||
|
name="quantity"
|
||||||
|
label="数量"
|
||||||
|
width="md"
|
||||||
|
placeholder="请输入数量"
|
||||||
|
rules={[{ required: true, message: '请输入数量' }]}
|
||||||
|
/>
|
||||||
|
</ProForm.Group>
|
||||||
|
</ProFormList>
|
||||||
</DrawerForm>
|
</DrawerForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,206 +0,0 @@
|
||||||
import {
|
|
||||||
productcontrollerCreatestrength,
|
|
||||||
productcontrollerDeletestrength,
|
|
||||||
productcontrollerGetstrength,
|
|
||||||
} from '@/servers/api/product';
|
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
|
||||||
import {
|
|
||||||
ActionType,
|
|
||||||
DrawerForm,
|
|
||||||
PageContainer,
|
|
||||||
ProColumns,
|
|
||||||
ProFormText,
|
|
||||||
ProTable,
|
|
||||||
} from '@ant-design/pro-components';
|
|
||||||
import { App, Button, Popconfirm } from 'antd';
|
|
||||||
import { useRef } from 'react';
|
|
||||||
|
|
||||||
const List: React.FC = () => {
|
|
||||||
const actionRef = useRef<ActionType>();
|
|
||||||
const { message } = App.useApp();
|
|
||||||
const columns: ProColumns<API.Category>[] = [
|
|
||||||
{
|
|
||||||
title: '名称',
|
|
||||||
dataIndex: 'name',
|
|
||||||
tip: '名称是唯一的 key',
|
|
||||||
formItemProps: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '名称为必填项',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '标识',
|
|
||||||
dataIndex: 'unique_key',
|
|
||||||
hideInSearch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '更新时间',
|
|
||||||
dataIndex: 'updatedAt',
|
|
||||||
valueType: 'dateTime',
|
|
||||||
hideInSearch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createdAt',
|
|
||||||
valueType: 'dateTime',
|
|
||||||
hideInSearch: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
dataIndex: 'option',
|
|
||||||
valueType: 'option',
|
|
||||||
render: (_, record) => (
|
|
||||||
<>
|
|
||||||
{/* <UpdateForm tableRef={actionRef} values={record} />
|
|
||||||
<Divider type="vertical" /> */}
|
|
||||||
<Popconfirm
|
|
||||||
title="删除"
|
|
||||||
description="确认删除?"
|
|
||||||
onConfirm={async () => {
|
|
||||||
try {
|
|
||||||
const { success, message: errMsg } =
|
|
||||||
await productcontrollerDeletestrength({ id: record.id });
|
|
||||||
if (!success) {
|
|
||||||
throw new Error(errMsg);
|
|
||||||
}
|
|
||||||
actionRef.current?.reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
message.error(error.message);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Button type="primary" danger>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageContainer header={{ title: '强度列表' }}>
|
|
||||||
<ProTable<API.Category>
|
|
||||||
headerTitle="查询表格"
|
|
||||||
actionRef={actionRef}
|
|
||||||
rowKey="id"
|
|
||||||
toolBarRender={() => [<CreateForm tableRef={actionRef} />]}
|
|
||||||
request={async (params) => {
|
|
||||||
const { data, success } = await productcontrollerGetstrength(params);
|
|
||||||
return {
|
|
||||||
total: data?.total || 0,
|
|
||||||
data: data?.items || [],
|
|
||||||
success,
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
columns={columns}
|
|
||||||
/>
|
|
||||||
</PageContainer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const CreateForm: React.FC<{
|
|
||||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
|
||||||
}> = ({ tableRef }) => {
|
|
||||||
const { message } = App.useApp();
|
|
||||||
return (
|
|
||||||
<DrawerForm<API.CreateCategoryDTO>
|
|
||||||
title="新建"
|
|
||||||
trigger={
|
|
||||||
<Button type="primary">
|
|
||||||
<PlusOutlined />
|
|
||||||
新建
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
autoFocusFirstInput
|
|
||||||
drawerProps={{
|
|
||||||
destroyOnHidden: true,
|
|
||||||
}}
|
|
||||||
onFinish={async (values) => {
|
|
||||||
try {
|
|
||||||
const { success, message: errMsg } =
|
|
||||||
await productcontrollerCreatestrength(values);
|
|
||||||
if (!success) {
|
|
||||||
throw new Error(errMsg);
|
|
||||||
}
|
|
||||||
tableRef.current?.reload();
|
|
||||||
message.success('提交成功');
|
|
||||||
return true;
|
|
||||||
} catch (error: any) {
|
|
||||||
message.error(error.message);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ProFormText
|
|
||||||
name="name"
|
|
||||||
width="md"
|
|
||||||
label="强度名称"
|
|
||||||
placeholder="请输入名称"
|
|
||||||
rules={[{ required: true, message: '请输入名称' }]}
|
|
||||||
/>
|
|
||||||
<ProFormText
|
|
||||||
name="unique_key"
|
|
||||||
width="md"
|
|
||||||
label="Key"
|
|
||||||
placeholder="请输入Key"
|
|
||||||
rules={[{ required: true, message: '请输入Key' }]}
|
|
||||||
/>
|
|
||||||
</DrawerForm>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// const UpdateForm: React.FC<{
|
|
||||||
// tableRef: React.MutableRefObject<ActionType | undefined>;
|
|
||||||
// values: API.Category;
|
|
||||||
// }> = ({ tableRef, values: initialValues }) => {
|
|
||||||
// const { message } = App.useApp();
|
|
||||||
// return (
|
|
||||||
// <DrawerForm<API.UpdateCategoryDTO>
|
|
||||||
// title="编辑"
|
|
||||||
// initialValues={initialValues}
|
|
||||||
// trigger={
|
|
||||||
// <Button type="primary">
|
|
||||||
// <EditOutlined />
|
|
||||||
// 编辑
|
|
||||||
// </Button>
|
|
||||||
// }
|
|
||||||
// autoFocusFirstInput
|
|
||||||
// drawerProps={{
|
|
||||||
// destroyOnHidden: true,
|
|
||||||
// }}
|
|
||||||
// onFinish={async (values) => {
|
|
||||||
// try {
|
|
||||||
// const { success, message: errMsg } =
|
|
||||||
// await productcontrollerUpdatestrength(
|
|
||||||
// { id: initialValues.id },
|
|
||||||
// values,
|
|
||||||
// );
|
|
||||||
// if (!success) {
|
|
||||||
// throw new Error(errMsg);
|
|
||||||
// }
|
|
||||||
// message.success('提交成功');
|
|
||||||
// tableRef.current?.reload();
|
|
||||||
// return true;
|
|
||||||
// } catch (error: any) {
|
|
||||||
// message.error(error.message);
|
|
||||||
// }
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// <ProForm.Group>
|
|
||||||
// <ProFormText
|
|
||||||
// name="name"
|
|
||||||
// width="md"
|
|
||||||
// label="强度名称"
|
|
||||||
// placeholder="请输入名称"
|
|
||||||
// rules={[{ required: true, message: '请输入名称' }]}
|
|
||||||
// />
|
|
||||||
// </ProForm.Group>
|
|
||||||
// </DrawerForm>
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
|
|
||||||
export default List;
|
|
||||||
|
|
@ -50,46 +50,30 @@ export async function productcontrollerDeleteproduct(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 POST /product/batchSetSku */
|
/** 此处后端没有提供注释 GET /product/${param0}/components */
|
||||||
export async function productcontrollerBatchsetsku(
|
export async function productcontrollerGetproductcomponents(
|
||||||
body: API.BatchSetSkuDTO,
|
|
||||||
options?: { [key: string]: any },
|
|
||||||
) {
|
|
||||||
return request<API.BooleanRes>('/product/batchSetSku', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
data: body,
|
|
||||||
...(options || {}),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 此处后端没有提供注释 POST /product/brand */
|
|
||||||
export async function productcontrollerCreatebrand(
|
|
||||||
body: API.CreateBrandDTO,
|
|
||||||
options?: { [key: string]: any },
|
|
||||||
) {
|
|
||||||
return request<API.ProductBrandRes>('/product/brand', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
data: body,
|
|
||||||
...(options || {}),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 此处后端没有提供注释 PUT /product/brand/${param0} */
|
|
||||||
export async function productcontrollerUpdatebrand(
|
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
params: API.productcontrollerUpdatebrandParams,
|
params: API.productcontrollerGetproductcomponentsParams,
|
||||||
body: API.UpdateBrandDTO,
|
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
const { id: param0, ...queryParams } = params;
|
const { id: param0, ...queryParams } = params;
|
||||||
return request<API.ProductBrandRes>(`/product/brand/${param0}`, {
|
return request<any>(`/product/${param0}/components`, {
|
||||||
method: 'PUT',
|
method: 'GET',
|
||||||
|
params: { ...queryParams },
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 POST /product/${param0}/components */
|
||||||
|
export async function productcontrollerSetproductcomponents(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.productcontrollerSetproductcomponentsParams,
|
||||||
|
body: API.SetProductComponentsDTO,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
const { id: param0, ...queryParams } = params;
|
||||||
|
return request<any>(`/product/${param0}/components`, {
|
||||||
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
|
|
@ -99,10 +83,147 @@ export async function productcontrollerUpdatebrand(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 DELETE /product/brand/${param0} */
|
/** 此处后端没有提供注释 POST /product/${param0}/components/auto */
|
||||||
export async function productcontrollerDeletebrand(
|
export async function productcontrollerAutobindcomponents(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
params: API.productcontrollerDeletebrandParams,
|
params: API.productcontrollerAutobindcomponentsParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
const { id: param0, ...queryParams } = params;
|
||||||
|
return request<any>(`/product/${param0}/components/auto`, {
|
||||||
|
method: 'POST',
|
||||||
|
params: { ...queryParams },
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 GET /product/attribute */
|
||||||
|
export async function productcontrollerGetattributelist(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.productcontrollerGetattributelistParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<any>('/product/attribute', {
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
pageSize: undefined,
|
||||||
|
...params['pageSize'],
|
||||||
|
current: undefined,
|
||||||
|
...params['current'],
|
||||||
|
},
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 POST /product/attribute */
|
||||||
|
export async function productcontrollerCreateattribute(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.productcontrollerCreateattributeParams,
|
||||||
|
body: Record<string, any>,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<any>('/product/attribute', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain',
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 PUT /product/attribute/${param0} */
|
||||||
|
export async function productcontrollerUpdateattribute(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.productcontrollerUpdateattributeParams,
|
||||||
|
body: Record<string, any>,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
const { id: param0, ...queryParams } = params;
|
||||||
|
return request<any>(`/product/attribute/${param0}`, {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain',
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
...queryParams,
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 DELETE /product/attribute/${param0} */
|
||||||
|
export async function productcontrollerDeleteattribute(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.productcontrollerDeleteattributeParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
const { id: param0, ...queryParams } = params;
|
||||||
|
return request<API.BooleanRes>(`/product/attribute/${param0}`, {
|
||||||
|
method: 'DELETE',
|
||||||
|
params: { ...queryParams },
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 GET /product/attributeAll */
|
||||||
|
export async function productcontrollerGetattributeall(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.productcontrollerGetattributeallParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<any>('/product/attributeAll', {
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 POST /product/brand */
|
||||||
|
export async function productcontrollerCompatcreatebrand(
|
||||||
|
body: Record<string, any>,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<any>('/product/brand', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 PUT /product/brand/${param0} */
|
||||||
|
export async function productcontrollerCompatupdatebrand(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.productcontrollerCompatupdatebrandParams,
|
||||||
|
body: Record<string, any>,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
const { id: param0, ...queryParams } = params;
|
||||||
|
return request<any>(`/product/brand/${param0}`, {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain',
|
||||||
|
},
|
||||||
|
params: { ...queryParams },
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 DELETE /product/brand/${param0} */
|
||||||
|
export async function productcontrollerCompatdeletebrand(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.productcontrollerCompatdeletebrandParams,
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
const { id: param0, ...queryParams } = params;
|
const { id: param0, ...queryParams } = params;
|
||||||
|
|
@ -114,7 +235,7 @@ export async function productcontrollerDeletebrand(
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 GET /product/brandAll */
|
/** 此处后端没有提供注释 GET /product/brandAll */
|
||||||
export async function productcontrollerGetbrandall(options?: {
|
export async function productcontrollerCompatbrandall(options?: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}) {
|
}) {
|
||||||
return request<any>('/product/brandAll', {
|
return request<any>('/product/brandAll', {
|
||||||
|
|
@ -124,44 +245,52 @@ export async function productcontrollerGetbrandall(options?: {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 GET /product/brands */
|
/** 此处后端没有提供注释 GET /product/brands */
|
||||||
export async function productcontrollerGetbrands(
|
export async function productcontrollerCompatbrands(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
params: API.productcontrollerGetbrandsParams,
|
params: API.productcontrollerCompatbrandsParams,
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
return request<API.ProductBrandListRes>('/product/brands', {
|
return request<any>('/product/brands', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: {
|
params: {
|
||||||
...params,
|
...params,
|
||||||
|
pageSize: undefined,
|
||||||
|
...params['pageSize'],
|
||||||
|
current: undefined,
|
||||||
|
...params['current'],
|
||||||
},
|
},
|
||||||
...(options || {}),
|
...(options || {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 GET /product/flavors */
|
/** 此处后端没有提供注释 GET /product/flavors */
|
||||||
export async function productcontrollerGetflavors(
|
export async function productcontrollerCompatflavors(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
params: API.productcontrollerGetflavorsParams,
|
params: API.productcontrollerCompatflavorsParams,
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
return request<any>('/product/flavors', {
|
return request<any>('/product/flavors', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: {
|
params: {
|
||||||
...params,
|
...params,
|
||||||
|
pageSize: undefined,
|
||||||
|
...params['pageSize'],
|
||||||
|
current: undefined,
|
||||||
|
...params['current'],
|
||||||
},
|
},
|
||||||
...(options || {}),
|
...(options || {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 POST /product/flavors */
|
/** 此处后端没有提供注释 POST /product/flavors */
|
||||||
export async function productcontrollerCreateflavors(
|
export async function productcontrollerCompatcreateflavors(
|
||||||
body: API.CreateFlavorsDTO,
|
body: Record<string, any>,
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
return request<any>('/product/flavors', {
|
return request<any>('/product/flavors', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'text/plain',
|
||||||
},
|
},
|
||||||
data: body,
|
data: body,
|
||||||
...(options || {}),
|
...(options || {}),
|
||||||
|
|
@ -169,17 +298,17 @@ export async function productcontrollerCreateflavors(
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 PUT /product/flavors/${param0} */
|
/** 此处后端没有提供注释 PUT /product/flavors/${param0} */
|
||||||
export async function productcontrollerUpdateflavors(
|
export async function productcontrollerCompatupdateflavors(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
params: API.productcontrollerUpdateflavorsParams,
|
params: API.productcontrollerCompatupdateflavorsParams,
|
||||||
body: API.UpdateFlavorsDTO,
|
body: Record<string, any>,
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
const { id: param0, ...queryParams } = params;
|
const { id: param0, ...queryParams } = params;
|
||||||
return request<any>(`/product/flavors/${param0}`, {
|
return request<any>(`/product/flavors/${param0}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'text/plain',
|
||||||
},
|
},
|
||||||
params: { ...queryParams },
|
params: { ...queryParams },
|
||||||
data: body,
|
data: body,
|
||||||
|
|
@ -188,9 +317,9 @@ export async function productcontrollerUpdateflavors(
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 DELETE /product/flavors/${param0} */
|
/** 此处后端没有提供注释 DELETE /product/flavors/${param0} */
|
||||||
export async function productcontrollerDeleteflavors(
|
export async function productcontrollerCompatdeleteflavors(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
params: API.productcontrollerDeleteflavorsParams,
|
params: API.productcontrollerCompatdeleteflavorsParams,
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
const { id: param0, ...queryParams } = params;
|
const { id: param0, ...queryParams } = params;
|
||||||
|
|
@ -202,7 +331,7 @@ export async function productcontrollerDeleteflavors(
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 GET /product/flavorsAll */
|
/** 此处后端没有提供注释 GET /product/flavorsAll */
|
||||||
export async function productcontrollerGetflavorsall(options?: {
|
export async function productcontrollerCompatflavorsall(options?: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}) {
|
}) {
|
||||||
return request<any>('/product/flavorsAll', {
|
return request<any>('/product/flavorsAll', {
|
||||||
|
|
@ -241,6 +370,83 @@ export async function productcontrollerSearchproducts(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 GET /product/size */
|
||||||
|
export async function productcontrollerCompatsize(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.productcontrollerCompatsizeParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<any>('/product/size', {
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
pageSize: undefined,
|
||||||
|
...params['pageSize'],
|
||||||
|
current: undefined,
|
||||||
|
...params['current'],
|
||||||
|
},
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 POST /product/size */
|
||||||
|
export async function productcontrollerCompatcreatesize(
|
||||||
|
body: Record<string, any>,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<any>('/product/size', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 PUT /product/size/${param0} */
|
||||||
|
export async function productcontrollerCompatupdatesize(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.productcontrollerCompatupdatesizeParams,
|
||||||
|
body: Record<string, any>,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
const { id: param0, ...queryParams } = params;
|
||||||
|
return request<any>(`/product/size/${param0}`, {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain',
|
||||||
|
},
|
||||||
|
params: { ...queryParams },
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 DELETE /product/size/${param0} */
|
||||||
|
export async function productcontrollerCompatdeletesize(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.productcontrollerCompatdeletesizeParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
const { id: param0, ...queryParams } = params;
|
||||||
|
return request<API.BooleanRes>(`/product/size/${param0}`, {
|
||||||
|
method: 'DELETE',
|
||||||
|
params: { ...queryParams },
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 GET /product/sizeAll */
|
||||||
|
export async function productcontrollerCompatsizeall(options?: {
|
||||||
|
[key: string]: any;
|
||||||
|
}) {
|
||||||
|
return request<any>('/product/sizeAll', {
|
||||||
|
method: 'GET',
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 GET /product/sku/${param0} */
|
/** 此处后端没有提供注释 GET /product/sku/${param0} */
|
||||||
export async function productcontrollerProductbysku(
|
export async function productcontrollerProductbysku(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
|
@ -256,29 +462,33 @@ export async function productcontrollerProductbysku(
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 GET /product/strength */
|
/** 此处后端没有提供注释 GET /product/strength */
|
||||||
export async function productcontrollerGetstrength(
|
export async function productcontrollerCompatstrength(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
params: API.productcontrollerGetstrengthParams,
|
params: API.productcontrollerCompatstrengthParams,
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
return request<any>('/product/strength', {
|
return request<any>('/product/strength', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: {
|
params: {
|
||||||
...params,
|
...params,
|
||||||
|
pageSize: undefined,
|
||||||
|
...params['pageSize'],
|
||||||
|
current: undefined,
|
||||||
|
...params['current'],
|
||||||
},
|
},
|
||||||
...(options || {}),
|
...(options || {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 POST /product/strength */
|
/** 此处后端没有提供注释 POST /product/strength */
|
||||||
export async function productcontrollerCreatestrength(
|
export async function productcontrollerCompatcreatestrength(
|
||||||
body: API.CreateStrengthDTO,
|
body: Record<string, any>,
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
return request<any>('/product/strength', {
|
return request<any>('/product/strength', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'text/plain',
|
||||||
},
|
},
|
||||||
data: body,
|
data: body,
|
||||||
...(options || {}),
|
...(options || {}),
|
||||||
|
|
@ -286,17 +496,17 @@ export async function productcontrollerCreatestrength(
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 PUT /product/strength/${param0} */
|
/** 此处后端没有提供注释 PUT /product/strength/${param0} */
|
||||||
export async function productcontrollerUpdatestrength(
|
export async function productcontrollerCompatupdatestrength(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
params: API.productcontrollerUpdatestrengthParams,
|
params: API.productcontrollerCompatupdatestrengthParams,
|
||||||
body: API.UpdateStrengthDTO,
|
body: Record<string, any>,
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
const { id: param0, ...queryParams } = params;
|
const { id: param0, ...queryParams } = params;
|
||||||
return request<any>(`/product/strength/${param0}`, {
|
return request<any>(`/product/strength/${param0}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'text/plain',
|
||||||
},
|
},
|
||||||
params: { ...queryParams },
|
params: { ...queryParams },
|
||||||
data: body,
|
data: body,
|
||||||
|
|
@ -305,9 +515,9 @@ export async function productcontrollerUpdatestrength(
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 DELETE /product/strength/${param0} */
|
/** 此处后端没有提供注释 DELETE /product/strength/${param0} */
|
||||||
export async function productcontrollerDeletestrength(
|
export async function productcontrollerCompatdeletestrength(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
params: API.productcontrollerDeletestrengthParams,
|
params: API.productcontrollerCompatdeletestrengthParams,
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
const { id: param0, ...queryParams } = params;
|
const { id: param0, ...queryParams } = params;
|
||||||
|
|
@ -319,7 +529,7 @@ export async function productcontrollerDeletestrength(
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 GET /product/strengthAll */
|
/** 此处后端没有提供注释 GET /product/strengthAll */
|
||||||
export async function productcontrollerGetstrengthall(options?: {
|
export async function productcontrollerCompatstrengthall(options?: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}) {
|
}) {
|
||||||
return request<any>('/product/strengthAll', {
|
return request<any>('/product/strengthAll', {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@ declare namespace API {
|
||||||
id?: number;
|
id?: number;
|
||||||
/** 区域名称 */
|
/** 区域名称 */
|
||||||
name?: string;
|
name?: string;
|
||||||
|
/** 纬度 */
|
||||||
|
latitude?: number;
|
||||||
|
/** 经度 */
|
||||||
|
longitude?: number;
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
/** 更新时间 */
|
/** 更新时间 */
|
||||||
|
|
@ -38,11 +42,6 @@ declare namespace API {
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type BatchSetSkuDTO = {
|
|
||||||
/** sku 数据列表 */
|
|
||||||
skus?: SkuItemDTO[];
|
|
||||||
};
|
|
||||||
|
|
||||||
type BooleanRes = {
|
type BooleanRes = {
|
||||||
/** 状态码 */
|
/** 状态码 */
|
||||||
code?: number;
|
code?: number;
|
||||||
|
|
@ -54,40 +53,19 @@ declare namespace API {
|
||||||
data?: boolean;
|
data?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type BrandPaginatedResponse = {
|
|
||||||
/** 当前页码 */
|
|
||||||
page?: number;
|
|
||||||
/** 每页大小 */
|
|
||||||
pageSize?: number;
|
|
||||||
/** 总记录数 */
|
|
||||||
total?: number;
|
|
||||||
/** 数据列表 */
|
|
||||||
items?: Dict[];
|
|
||||||
};
|
|
||||||
|
|
||||||
type CreateAreaDTO = {
|
type CreateAreaDTO = {
|
||||||
/** 区域名称 */
|
/** 区域名称 */
|
||||||
name?: string;
|
name?: string;
|
||||||
};
|
/** 纬度 */
|
||||||
|
latitude?: number;
|
||||||
type CreateBrandDTO = {
|
/** 经度 */
|
||||||
/** 品牌名称 */
|
longitude?: number;
|
||||||
title: string;
|
|
||||||
/** 品牌唯一标识 */
|
|
||||||
name: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type CreateDictDTO = {};
|
type CreateDictDTO = {};
|
||||||
|
|
||||||
type CreateDictItemDTO = {};
|
type CreateDictItemDTO = {};
|
||||||
|
|
||||||
type CreateFlavorsDTO = {
|
|
||||||
/** 口味名称 */
|
|
||||||
title: string;
|
|
||||||
/** 口味唯一标识 */
|
|
||||||
name: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type CreateOrderNoteDTO = {
|
type CreateOrderNoteDTO = {
|
||||||
orderId?: number;
|
orderId?: number;
|
||||||
content?: string;
|
content?: string;
|
||||||
|
|
@ -100,15 +78,12 @@ declare namespace API {
|
||||||
description?: string;
|
description?: string;
|
||||||
/** 产品 SKU */
|
/** 产品 SKU */
|
||||||
sku?: string;
|
sku?: string;
|
||||||
/** 品牌 ID */
|
/** 属性列表 */
|
||||||
brandId?: number;
|
attributes?: any[];
|
||||||
/** 规格 ID */
|
|
||||||
strengthId?: number;
|
|
||||||
/** 口味 ID */
|
|
||||||
flavorsId?: number;
|
|
||||||
humidity?: string;
|
|
||||||
/** 价格 */
|
/** 价格 */
|
||||||
price?: number;
|
price?: number;
|
||||||
|
/** 促销价格 */
|
||||||
|
promotionPrice?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type CreatePurchaseOrderDTO = {
|
type CreatePurchaseOrderDTO = {
|
||||||
|
|
@ -128,13 +103,6 @@ declare namespace API {
|
||||||
contactPhone?: string;
|
contactPhone?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type CreateStrengthDTO = {
|
|
||||||
/** 规格名称 */
|
|
||||||
title?: string;
|
|
||||||
/** 规格唯一标识 */
|
|
||||||
name: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type CreateTemplateDTO = {
|
type CreateTemplateDTO = {
|
||||||
/** 模板名称 */
|
/** 模板名称 */
|
||||||
name: string;
|
name: string;
|
||||||
|
|
@ -182,8 +150,6 @@ declare namespace API {
|
||||||
SignatureRequirementEnum?: any;
|
SignatureRequirementEnum?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Dict = {};
|
|
||||||
|
|
||||||
type dictcontrollerDeletedictitemParams = {
|
type dictcontrollerDeletedictitemParams = {
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
@ -734,10 +700,14 @@ declare namespace API {
|
||||||
sku?: string;
|
sku?: string;
|
||||||
/** 价格 */
|
/** 价格 */
|
||||||
price?: number;
|
price?: number;
|
||||||
|
/** 类型 */
|
||||||
|
type?: string;
|
||||||
/** 促销价格 */
|
/** 促销价格 */
|
||||||
promotionPrice?: number;
|
promotionPrice?: number;
|
||||||
/** 库存 */
|
/** 库存 */
|
||||||
stock?: number;
|
stock?: number;
|
||||||
|
/** 库存组成 */
|
||||||
|
components?: ProductStockComponent[];
|
||||||
/** 来源 */
|
/** 来源 */
|
||||||
source?: number;
|
source?: number;
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
|
|
@ -746,33 +716,78 @@ declare namespace API {
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type ProductBrandListRes = {
|
type ProductComponentItemDTO = {
|
||||||
/** 状态码 */
|
/** 库存记录ID */
|
||||||
code?: number;
|
stockId?: number;
|
||||||
/** 是否成功 */
|
/** 组成数量 */
|
||||||
success?: boolean;
|
quantity?: number;
|
||||||
/** 消息内容 */
|
|
||||||
message?: string;
|
|
||||||
/** 响应数据 */
|
|
||||||
data?: BrandPaginatedResponse;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type ProductBrandRes = {
|
type productcontrollerAutobindcomponentsParams = {
|
||||||
/** 状态码 */
|
|
||||||
code?: number;
|
|
||||||
/** 是否成功 */
|
|
||||||
success?: boolean;
|
|
||||||
/** 消息内容 */
|
|
||||||
message?: string;
|
|
||||||
/** 响应数据 */
|
|
||||||
data?: Dict;
|
|
||||||
};
|
|
||||||
|
|
||||||
type productcontrollerDeletebrandParams = {
|
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type productcontrollerDeleteflavorsParams = {
|
type productcontrollerCompatbrandsParams = {
|
||||||
|
name?: string;
|
||||||
|
pageSize?: Record<string, any>;
|
||||||
|
current?: Record<string, any>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCompatdeletebrandParams = {
|
||||||
|
id: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCompatdeleteflavorsParams = {
|
||||||
|
id: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCompatdeletesizeParams = {
|
||||||
|
id: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCompatdeletestrengthParams = {
|
||||||
|
id: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCompatflavorsParams = {
|
||||||
|
name?: string;
|
||||||
|
pageSize?: Record<string, any>;
|
||||||
|
current?: Record<string, any>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCompatsizeParams = {
|
||||||
|
name?: string;
|
||||||
|
pageSize?: Record<string, any>;
|
||||||
|
current?: Record<string, any>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCompatstrengthParams = {
|
||||||
|
name?: string;
|
||||||
|
pageSize?: Record<string, any>;
|
||||||
|
current?: Record<string, any>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCompatupdatebrandParams = {
|
||||||
|
id: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCompatupdateflavorsParams = {
|
||||||
|
id: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCompatupdatesizeParams = {
|
||||||
|
id: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCompatupdatestrengthParams = {
|
||||||
|
id: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerCreateattributeParams = {
|
||||||
|
dictName?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerDeleteattributeParams = {
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -780,28 +795,21 @@ declare namespace API {
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type productcontrollerDeletestrengthParams = {
|
type productcontrollerGetattributeallParams = {
|
||||||
|
dictName?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerGetattributelistParams = {
|
||||||
|
name?: string;
|
||||||
|
pageSize?: Record<string, any>;
|
||||||
|
current?: Record<string, any>;
|
||||||
|
dictName?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type productcontrollerGetproductcomponentsParams = {
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type productcontrollerGetbrandsParams = {
|
|
||||||
/** 页码 */
|
|
||||||
current?: number;
|
|
||||||
/** 每页大小 */
|
|
||||||
pageSize?: number;
|
|
||||||
/** 关键字 */
|
|
||||||
name?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type productcontrollerGetflavorsParams = {
|
|
||||||
/** 页码 */
|
|
||||||
current?: number;
|
|
||||||
/** 每页大小 */
|
|
||||||
pageSize?: number;
|
|
||||||
/** 关键字 */
|
|
||||||
name?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type productcontrollerGetproductlistParams = {
|
type productcontrollerGetproductlistParams = {
|
||||||
/** 页码 */
|
/** 页码 */
|
||||||
current?: number;
|
current?: number;
|
||||||
|
|
@ -813,15 +821,6 @@ declare namespace API {
|
||||||
brandId?: number;
|
brandId?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type productcontrollerGetstrengthParams = {
|
|
||||||
/** 页码 */
|
|
||||||
current?: number;
|
|
||||||
/** 每页大小 */
|
|
||||||
pageSize?: number;
|
|
||||||
/** 关键字 */
|
|
||||||
name?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type productcontrollerProductbyskuParams = {
|
type productcontrollerProductbyskuParams = {
|
||||||
sku: string;
|
sku: string;
|
||||||
};
|
};
|
||||||
|
|
@ -830,11 +829,12 @@ declare namespace API {
|
||||||
name?: string;
|
name?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type productcontrollerUpdatebrandParams = {
|
type productcontrollerSetproductcomponentsParams = {
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type productcontrollerUpdateflavorsParams = {
|
type productcontrollerUpdateattributeParams = {
|
||||||
|
dictName?: string;
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -847,10 +847,6 @@ declare namespace API {
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type productcontrollerUpdatestrengthParams = {
|
|
||||||
id: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
type ProductListRes = {
|
type ProductListRes = {
|
||||||
/** 状态码 */
|
/** 状态码 */
|
||||||
code?: number;
|
code?: number;
|
||||||
|
|
@ -895,6 +891,18 @@ declare namespace API {
|
||||||
data?: Product[];
|
data?: Product[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ProductStockComponent = {
|
||||||
|
id?: number;
|
||||||
|
productId?: number;
|
||||||
|
stockId?: number;
|
||||||
|
/** 组成数量 */
|
||||||
|
quantity?: number;
|
||||||
|
/** 创建时间 */
|
||||||
|
createdAt?: string;
|
||||||
|
/** 更新时间 */
|
||||||
|
updatedAt?: string;
|
||||||
|
};
|
||||||
|
|
||||||
type PurchaseOrderDTO = {
|
type PurchaseOrderDTO = {
|
||||||
id?: number;
|
id?: number;
|
||||||
stockPointId?: number;
|
stockPointId?: number;
|
||||||
|
|
@ -950,15 +958,6 @@ declare namespace API {
|
||||||
name?: string;
|
name?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type QueryBrandDTO = {
|
|
||||||
/** 页码 */
|
|
||||||
current?: number;
|
|
||||||
/** 每页大小 */
|
|
||||||
pageSize?: number;
|
|
||||||
/** 关键字 */
|
|
||||||
name?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type QueryCustomerListDTO = {
|
type QueryCustomerListDTO = {
|
||||||
current?: string;
|
current?: string;
|
||||||
pageSize?: string;
|
pageSize?: string;
|
||||||
|
|
@ -971,15 +970,6 @@ declare namespace API {
|
||||||
customerId?: number;
|
customerId?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type QueryFlavorsDTO = {
|
|
||||||
/** 页码 */
|
|
||||||
current?: number;
|
|
||||||
/** 每页大小 */
|
|
||||||
pageSize?: number;
|
|
||||||
/** 关键字 */
|
|
||||||
name?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type QueryOrderDTO = {
|
type QueryOrderDTO = {
|
||||||
/** 页码 */
|
/** 页码 */
|
||||||
current?: number;
|
current?: number;
|
||||||
|
|
@ -1095,15 +1085,6 @@ declare namespace API {
|
||||||
endDate?: string;
|
endDate?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type QueryStrengthDTO = {
|
|
||||||
/** 页码 */
|
|
||||||
current?: number;
|
|
||||||
/** 每页大小 */
|
|
||||||
pageSize?: number;
|
|
||||||
/** 关键字 */
|
|
||||||
name?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type QuerySubscriptionDTO = {
|
type QuerySubscriptionDTO = {
|
||||||
/** 页码 */
|
/** 页码 */
|
||||||
current?: number;
|
current?: number;
|
||||||
|
|
@ -1198,6 +1179,11 @@ declare namespace API {
|
||||||
constitution?: { sku?: string; quantity?: number }[];
|
constitution?: { sku?: string; quantity?: number }[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type SetProductComponentsDTO = {
|
||||||
|
/** 组成项列表 */
|
||||||
|
items?: ProductComponentItemDTO[];
|
||||||
|
};
|
||||||
|
|
||||||
type ShipmentBookDTO = {
|
type ShipmentBookDTO = {
|
||||||
sales?: OrderSale[];
|
sales?: OrderSale[];
|
||||||
details?: ShippingDetailsDTO;
|
details?: ShippingDetailsDTO;
|
||||||
|
|
@ -1273,7 +1259,7 @@ declare namespace API {
|
||||||
/** 站点 rest 秘钥 */
|
/** 站点 rest 秘钥 */
|
||||||
consumerSecret?: string;
|
consumerSecret?: string;
|
||||||
/** 站点名 */
|
/** 站点名 */
|
||||||
siteName?: string;
|
name?: string;
|
||||||
/** 平台类型 */
|
/** 平台类型 */
|
||||||
type?: 'woocommerce' | 'shopyy';
|
type?: 'woocommerce' | 'shopyy';
|
||||||
/** SKU 前缀 */
|
/** SKU 前缀 */
|
||||||
|
|
@ -1292,13 +1278,6 @@ declare namespace API {
|
||||||
id: string;
|
id: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type SkuItemDTO = {
|
|
||||||
/** 产品 ID */
|
|
||||||
productId?: number;
|
|
||||||
/** sku 编码 */
|
|
||||||
sku?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type statisticscontrollerGetinativeusersbymonthParams = {
|
type statisticscontrollerGetinativeusersbymonthParams = {
|
||||||
month?: string;
|
month?: string;
|
||||||
};
|
};
|
||||||
|
|
@ -1616,26 +1595,16 @@ declare namespace API {
|
||||||
type UpdateAreaDTO = {
|
type UpdateAreaDTO = {
|
||||||
/** 区域名称 */
|
/** 区域名称 */
|
||||||
name?: string;
|
name?: string;
|
||||||
};
|
/** 纬度 */
|
||||||
|
latitude?: number;
|
||||||
type UpdateBrandDTO = {
|
/** 经度 */
|
||||||
/** 品牌名称 */
|
longitude?: number;
|
||||||
title?: string;
|
|
||||||
/** 品牌唯一标识 */
|
|
||||||
name?: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type UpdateDictDTO = {};
|
type UpdateDictDTO = {};
|
||||||
|
|
||||||
type UpdateDictItemDTO = {};
|
type UpdateDictItemDTO = {};
|
||||||
|
|
||||||
type UpdateFlavorsDTO = {
|
|
||||||
/** 口味名称 */
|
|
||||||
title?: string;
|
|
||||||
/** 口味唯一标识 */
|
|
||||||
name?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type UpdateProductDTO = {
|
type UpdateProductDTO = {
|
||||||
/** 产品名称 */
|
/** 产品名称 */
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|
@ -1643,15 +1612,12 @@ declare namespace API {
|
||||||
description?: string;
|
description?: string;
|
||||||
/** 产品 SKU */
|
/** 产品 SKU */
|
||||||
sku?: string;
|
sku?: string;
|
||||||
/** 品牌 ID */
|
|
||||||
brandId?: number;
|
|
||||||
/** 规格 ID */
|
|
||||||
strengthId?: number;
|
|
||||||
/** 口味 ID */
|
|
||||||
flavorsId?: number;
|
|
||||||
humidity?: string;
|
|
||||||
/** 价格 */
|
/** 价格 */
|
||||||
price?: number;
|
price?: number;
|
||||||
|
/** 促销价格 */
|
||||||
|
promotionPrice?: number;
|
||||||
|
/** 属性列表 */
|
||||||
|
attributes?: any[];
|
||||||
};
|
};
|
||||||
|
|
||||||
type UpdatePurchaseOrderDTO = {
|
type UpdatePurchaseOrderDTO = {
|
||||||
|
|
@ -1680,13 +1646,6 @@ declare namespace API {
|
||||||
contactPhone?: string;
|
contactPhone?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type UpdateStrengthDTO = {
|
|
||||||
/** 规格名称 */
|
|
||||||
title?: string;
|
|
||||||
/** 规格唯一标识 */
|
|
||||||
name?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type UpdateTemplateDTO = {
|
type UpdateTemplateDTO = {
|
||||||
/** 模板名称 */
|
/** 模板名称 */
|
||||||
name: string;
|
name: string;
|
||||||
|
|
@ -1720,6 +1679,10 @@ declare namespace API {
|
||||||
on_sale?: boolean;
|
on_sale?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type usercontrollerUpdateuserParams = {
|
||||||
|
id?: number;
|
||||||
|
};
|
||||||
|
|
||||||
type VariationDTO = {
|
type VariationDTO = {
|
||||||
/** ID */
|
/** ID */
|
||||||
id: number;
|
id: number;
|
||||||
|
|
|
||||||
|
|
@ -72,3 +72,24 @@ export async function usercontrollerToggleactive(
|
||||||
...(options || {}),
|
...(options || {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 POST /user/update/${param0} */
|
||||||
|
export async function usercontrollerUpdateuser(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.usercontrollerUpdateuserParams,
|
||||||
|
body: Record<string, any>,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
const { id: param0, ...queryParams } = params;
|
||||||
|
return request<any>(`/user/update/${param0}`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain',
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
...queryParams,
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue