提交 ef1aece3 作者: 龚洪江

功能:服务管理

上级 ed945fa9
......@@ -190,27 +190,27 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
setIsCustomProd(e.target.value === 1);
};
// // 清除表单
// const onCancel = () => {
// // 关闭前恢复初始值
// skuForm.resetFields();
// selfProduct.resetFields();
// setSelfProductData([
// {
// id: 1,
// specName: '',
// partNo: '',
// specImage: '',
// fileList: [],
// productSpecCPQVO: {},
// },
// ]);
// setCustomRowData({
// id: -1,
// productSpecCPQVO: {},
// });
// setIsCustomProd(false);
// handleCancel();
// };
const onCancel = () => {
// 关闭前恢复初始值
skuForm.resetFields();
selfProduct.resetFields();
setSelfProductData([
{
id: 1,
specName: '',
partNo: '',
specImage: '',
fileList: [],
productSpecCPQVO: {},
},
]);
setCustomRowData({
id: -1,
productSpecCPQVO: {},
});
setIsCustomProd(false);
handleCancel();
};
//获取产品列表
const getProductList = (categoryId: number) => {
ProduceManageAPI.listPageProductSku({ pageNo: 1, pageSize: 9999, categoryId }).then(
......@@ -433,7 +433,7 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
open={open}
title={`${dialogTitle}规格`}
onOk={() => submitSku()}
onCancel={() => handleCancel()}
onCancel={onCancel}
width={820}
destroyOnClose
>
......
......@@ -244,6 +244,7 @@ const BaseInfo: React.FC<selfProps> = forwardRef(
fileUpload
onChange={videoUploadSuccess}
defaultFileList={videoList}
fileType={['video/mp4', 'video/avi', 'video/wmv', 'video/rmvb']}
fileSize={50}
>
{isDetail ? (
......
......@@ -25,17 +25,7 @@ export const Uploader: React.FC<PropsType> = (props) => {
listType: 'picture-card',
fileSize: 2,
fileLength: 1,
fileType: [
'image/png',
'image/jpeg',
'image/jpg',
'image/gif',
'image/bmp',
'video/mp4',
'video/avi',
'video/mov',
'video/mkv',
],
fileType: ['image/png', 'image/jpeg', 'image/jpg', 'image/gif'],
// eslint-disable-next-line @typescript-eslint/no-empty-function
onChange: () => {},
defaultFileList: [],
......
......@@ -192,7 +192,7 @@ const GoodsAddOrEditOrDetail = () => {
}
//分类
values.categoryByOne = values.masterTypeId[0];
values.categoryByTne = values.masterTypeId[1] || undefined;
values.categoryByTwo = values.masterTypeId[1] || undefined;
// 过滤对象属性
const goodsSpecVO: specEntity[] = specData.reduce((pre: any, cur: specEntity) => {
cur.customizeInfo = cur.customizeInfo?.reduce((cusPre: any, cusCur: customizeEntity) => {
......
......@@ -192,7 +192,7 @@ const GoodsAddOrEditOrDetail = () => {
}
//分类
values.categoryByOne = values.masterTypeId[0];
values.categoryByTne = values.masterTypeId[1] || undefined;
values.categoryByTwo = values.masterTypeId[1] || undefined;
// 过滤对象属性
const goodsSpecVO: specEntity[] = specData.reduce((pre: any, cur: specEntity) => {
cur.customizeInfo = cur.customizeInfo?.reduce((cusPre: any, cusCur: customizeEntity) => {
......
import { FC } from 'react';
import { FC, useState } from 'react';
import { Button, Col, Form, Input, Modal, Row, Select, Upload } from 'antd';
import { ModalProps } from 'antd';
import { UploadOutlined } from '@ant-design/icons';
import { Uploader } from '~/components/uploader';
import { InterDataType, InterReqType } from '~/api/interface';
import { categoryListType } from '~/api/interface/categoryManage';
import { addServiceType } from '~/api/interface/mallManageType';
const AddOrEditServiceModal: FC<ModalProps> = ({ open, title, onCancel }) => {
//分类返回类型
type categoryType = InterDataType<categoryListType>['list'];
interface selfProps {
industryCategoryList: categoryType;
applicationCategoryList: categoryType;
}
//新增服务参数类型
type addServiceParametersType = InterReqType<addServiceType>;
const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({
open,
title,
onCancel,
industryCategoryList,
applicationCategoryList,
}) => {
const [form] = Form.useForm<addServiceParametersType>();
//封面图文件
const [coverPlanFileList, setCoverPlanFileList] = useState<
{
id: number;
name: string;
uid: number;
url: string;
}[]
>([]);
//分享卡片文件
const [shareCardFileList, setShareCardFileList] = useState<
{
id: number;
name: string;
uid: number;
url: string;
}[]
>([]);
//视频上传文件
const [videoFileList, setVideoFileList] = useState<
{
id: number;
name: string;
uid: number;
url: string;
}[]
>([]);
//封面图上传成功
const coverPlanUploadSuccess = (
fileList: {
id: number;
name: string;
uid: number;
url: string;
}[],
) => {
form.setFieldsValue({
coverPlan: fileList[0].url,
});
setCoverPlanFileList(fileList);
};
//分享卡片上传成功
const shareCardUploadSuccess = (
fileList: {
id: number;
name: string;
uid: number;
url: string;
}[],
) => {
form.setFieldsValue({
shareCard: fileList[0].url,
});
setShareCardFileList(fileList);
};
//视频上传成功
const videoUploadSuccess = (
fileList: {
id: number;
name: string;
uid: number;
url: string;
}[],
) => {
form.setFieldsValue({
video: fileList[0].url,
});
setVideoFileList(fileList);
};
return (
<Modal open={open} title={title} onCancel={onCancel}>
<Form labelCol={{ span: 4 }} wrapperCol={{ span: 16 }}>
<Form
labelCol={{ span: 4 }}
wrapperCol={{ span: 16 }}
form={form}
initialValues={{ displayState: 0 }}
>
<Form.Item
label='服务名称'
name='serviceName'
......@@ -21,7 +115,11 @@ const AddOrEditServiceModal: FC<ModalProps> = ({ open, title, onCancel }) => {
rules={[{ required: true, message: '请选择应用' }]}
>
<Select placeholder='请选择应用'>
<Select.Option>111</Select.Option>
{applicationCategoryList.map((v) => (
<Select.Option key={v.id} value={v.id}>
{v.classifyName}
</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item
......@@ -30,7 +128,11 @@ const AddOrEditServiceModal: FC<ModalProps> = ({ open, title, onCancel }) => {
rules={[{ required: true, message: '请选择对应行业' }]}
>
<Select placeholder='请选择对应行业'>
<Select.Option>111</Select.Option>
{industryCategoryList.map((v) => (
<Select.Option value={v.id} key={v.id}>
{v.classifyName}
</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item
......@@ -38,12 +140,12 @@ const AddOrEditServiceModal: FC<ModalProps> = ({ open, title, onCancel }) => {
name='coverPlan'
rules={[{ required: true, message: '请上传封面图' }]}
>
<Uploader listType='picture-card' fileUpload>
<Uploader listType='picture-card' fileUpload onChange={coverPlanUploadSuccess}>
<UploadOutlined />
</Uploader>
</Form.Item>
<Form.Item label='分享卡片' name='shareCard'>
<Uploader listType='picture-card' fileUpload>
<Uploader listType='picture-card' fileUpload onChange={shareCardUploadSuccess}>
<UploadOutlined />
</Uploader>
</Form.Item>
......@@ -51,7 +153,12 @@ const AddOrEditServiceModal: FC<ModalProps> = ({ open, title, onCancel }) => {
<Row>
<Col></Col>
<Col>
<Uploader listType='text' fileUpload>
<Uploader
listType='text'
fileUpload
onChange={videoUploadSuccess}
fileType={['video/mp4', 'video/avi', 'video/wmv', 'video/rmvb']}
>
<Button icon={<UploadOutlined />} size='small' type='primary'>
上传
</Button>
......@@ -61,8 +168,8 @@ const AddOrEditServiceModal: FC<ModalProps> = ({ open, title, onCancel }) => {
</Form.Item>
<Form.Item label='展示状态' name='displayState'>
<Select placeholder='请选择展示状态'>
<Select.Option>上架</Select.Option>
<Select.Option>下架</Select.Option>
<Select.Option value={0}>上架</Select.Option>
<Select.Option value={1}>下架</Select.Option>
</Select>
</Form.Item>
</Form>
......
......@@ -35,7 +35,7 @@ const ServiceList: FC<any> = () => {
},
];
const [activeTabKey, setActiveTabKey] = useState<string>('1');
const [searchColumnsData] = useState<searchColumns[]>([
const [searchColumnsData, setSearchColumnsData] = useState<searchColumns[]>([
{
type: 'input',
placeholder: '请输入服务名称',
......@@ -90,6 +90,8 @@ const ServiceList: FC<any> = () => {
const [tableData] = useState<{ id: number }[]>([{ id: 1 }]);
//行业分类列表
const [industryCategoryList, setIndustryCategoryList] = useState<categoryType>([]);
//应用分类列表
const [applicationCategoryList, setApplicationCategoryList] = useState<categoryType>([]);
//新增、编辑服务弹窗
const [addOrEditServiceModalOpen, setAddOrEditServiceModalOpen] = useState<boolean>(false);
const [addOrEditServiceModalTitle, setAddOrEditServiceModalTitle] = useState<string>('新增服务');
......@@ -109,13 +111,29 @@ const ServiceList: FC<any> = () => {
//行业分类列表
const getIndustryCategoryList = () => {
CategoryManageAPI.getCategoryList({ directoryId: 2, pageSize: 99999, pageNo: 1 }).then(
() => {},
({ result }) => {
setIndustryCategoryList(result.list || []);
searchColumnsData[2].options =
result.list?.map((v) => ({
id: v.id,
name: v.classifyName,
})) || [];
setSearchColumnsData(searchColumnsData);
},
);
};
//应用分类列表
const getApplicationCategoryList = () => {
CategoryManageAPI.getCategoryList({ directoryId: 3, pageSize: 99999, pageNo: 1 }).then(
() => {},
({ result }) => {
setApplicationCategoryList(result.list || []);
searchColumnsData[1].options =
result.list?.map((v) => ({
id: v.id,
name: v.classifyName,
})) || [];
setSearchColumnsData(searchColumnsData);
},
);
};
//服务详情
......@@ -160,6 +178,8 @@ const ServiceList: FC<any> = () => {
open={addOrEditServiceModalOpen}
title={addOrEditServiceModalTitle}
onCancel={addOrEditServiceModalCancel}
industryCategoryList={industryCategoryList}
applicationCategoryList={applicationCategoryList}
/>
</div>
);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论