提交 ae793c0d 作者: 龚洪江

功能:服务关联单位,产品修改

上级 fb31c48d
...@@ -108,6 +108,7 @@ export type addServiceType = InterFunction< ...@@ -108,6 +108,7 @@ export type addServiceType = InterFunction<
serviceName: string; serviceName: string;
shareCard?: string; shareCard?: string;
video?: string; video?: string;
companyId: number;
}, },
any any
>; >;
...@@ -123,6 +124,7 @@ export type editServiceType = InterFunction< ...@@ -123,6 +124,7 @@ export type editServiceType = InterFunction<
shareCard?: string; shareCard?: string;
video?: string; video?: string;
id: number; id: number;
companyId: number;
}, },
any any
>; >;
...@@ -141,6 +143,7 @@ export type serviceType = InterItemFunction< ...@@ -141,6 +143,7 @@ export type serviceType = InterItemFunction<
applicationId: number; applicationId: number;
industryId: number; industryId: number;
id: number; id: number;
companyId: number;
}[] }[]
>; >;
//服务-上下架-批量 //服务-上下架-批量
...@@ -165,5 +168,6 @@ export type serviceDetailType = InterFunction< ...@@ -165,5 +168,6 @@ export type serviceDetailType = InterFunction<
applicationId: number; applicationId: number;
industryId: number; industryId: number;
id: number; id: number;
companyName: string;
} }
>; >;
...@@ -10,7 +10,7 @@ export type MakeListType = InterItemFunction< ...@@ -10,7 +10,7 @@ export type MakeListType = InterItemFunction<
>; >;
//产品-列表 //产品-列表
export type productListType = InterItemFunction< export type productListType = InterItemFunction<
{ categoryId?: number; directoryId?: number; productName?: string }, { type?: number; productName?: string },
{ {
id: number; id: number;
productName: string; productName: string;
...@@ -21,6 +21,7 @@ export type productListType = InterItemFunction< ...@@ -21,6 +21,7 @@ export type productListType = InterItemFunction<
categoryName: string; categoryName: string;
directoryId: number; directoryId: number;
directoryName: string; directoryName: string;
type: number;
productSpecList: { productSpecList: {
id: number; id: number;
partNo: string; partNo: string;
...@@ -34,8 +35,7 @@ export type productListType = InterItemFunction< ...@@ -34,8 +35,7 @@ export type productListType = InterItemFunction<
//产品-新增 //产品-新增
export type addProductType = InterFunction< export type addProductType = InterFunction<
{ {
categoryId: number; type: number;
directoryId: number;
model: string; model: string;
productBrandId: number; productBrandId: number;
productName: string; productName: string;
...@@ -77,6 +77,7 @@ export type productDetailType = InterFunction< ...@@ -77,6 +77,7 @@ export type productDetailType = InterFunction<
versionDesc: string; versionDesc: string;
productSkuId: number; productSkuId: number;
}[]; }[];
type: number;
} }
>; >;
//产品-规格-列表 //产品-规格-列表
......
...@@ -313,47 +313,44 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({ ...@@ -313,47 +313,44 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
}; };
// 点击确定,触发表单验证 // 点击确定,触发表单验证
const submitSku = () => { const submitSku = () => {
skuForm skuForm.validateFields().then(async (values) => {
.validateFields() if (!isCustomProd) {
.then(async (values) => { let productObj: productType[0] | undefined = undefined;
if (!isCustomProd) { switch (currentDesc) {
let productObj: productType[0] | undefined = undefined; case 2:
switch (currentDesc) { // const schemeObj = schemeList.find((i) => i.id === values.skuId);
case 2: // values.skuName = schemeObj?.solutionName;
// const schemeObj = schemeList.find((i) => i.id === values.skuId); break;
// values.skuName = schemeObj?.solutionName; default:
break; productObj = productList.find((i) => i.id === values.skuId);
default: values.skuName = productObj?.productName;
productObj = productList.find((i) => i.id === values.skuId);
values.skuName = productObj?.productName;
}
values.specIds = values.specIds.reduce((pre: any, cur: number | string) => {
const sourceObj = productSpecList.find((i) => i.id === cur);
const specObj: any =
curtRowData?.specIds && curtRowData?.specIds.find((i: any) => i.mallSpecId === cur);
pre.push({
mallSpecId: cur,
specName: sourceObj?.specName,
partNo: sourceObj?.partNo,
id: specObj ? specObj.id : undefined,
});
return pre;
}, []);
handleOk({ ...values, id: curtRowData?.id || Math.random() });
} else {
const res: any = await Promise.all([validateCustomForm()]);
handleOk({
...values,
customizeInfo: res[0],
id: curtRowData?.id || Math.random(),
skuId: curtRowData?.skuId,
skuName: values.productName,
delProductSpecId: selfIds,
});
} }
// onCancel(); values.specIds = values.specIds.reduce((pre: any, cur: number | string) => {
}) const sourceObj = productSpecList.find((i) => i.id === cur);
.catch(() => {}); const specObj: any =
curtRowData?.specIds && curtRowData?.specIds.find((i: any) => i.mallSpecId === cur);
pre.push({
mallSpecId: cur,
specName: sourceObj?.specName,
partNo: sourceObj?.partNo,
id: specObj ? specObj.id : undefined,
});
return pre;
}, []);
handleOk({ ...values, id: curtRowData?.id || Math.random() });
} else {
const res: any = await Promise.all([validateCustomForm()]);
handleOk({
...values,
customizeInfo: res[0],
id: curtRowData?.id || Math.random(),
skuId: curtRowData?.skuId,
skuName: values.productName,
delProductSpecId: selfIds,
});
}
// onCancel();
});
// 验证自定义表单 // 验证自定义表单
const validateCustomForm: any = () => { const validateCustomForm: any = () => {
......
...@@ -205,9 +205,7 @@ const GoodsAddOrEditOrDetail = () => { ...@@ -205,9 +205,7 @@ const GoodsAddOrEditOrDetail = () => {
}); });
cusPre = [ cusPre = [
...cusPre, ...cusPre,
bol bol ? filterObjAttr(cusCur, ['fileList']) : filterObjAttr(cusCur, ['id', 'fileList']),
? filterObjAttr({ ...cusCur, id: cusCur.productSpec }, ['fileList'])
: filterObjAttr(cusCur, ['id', 'fileList']),
]; ];
return cusPre; return cusPre;
}, []); }, []);
......
...@@ -193,8 +193,9 @@ function ProduceDetail() { ...@@ -193,8 +193,9 @@ function ProduceDetail() {
} }
> >
<Descriptions.Item label='产品名称'>{detailData?.productName}</Descriptions.Item> <Descriptions.Item label='产品名称'>{detailData?.productName}</Descriptions.Item>
<Descriptions.Item label='产品目录'>{detailData?.directoryName}</Descriptions.Item> <Descriptions.Item label='归属商品'>
<Descriptions.Item label='产品类型'>{detailData?.categoryName}</Descriptions.Item> {detailData?.type === 1 ? '租赁商品' : detailData?.type === 0 ? '商城商品' : ''}
</Descriptions.Item>
<Descriptions.Item label='型号'>{detailData?.model}</Descriptions.Item> <Descriptions.Item label='型号'>{detailData?.model}</Descriptions.Item>
<Descriptions.Item label='产品品牌'>{detailData?.productBrand}</Descriptions.Item> <Descriptions.Item label='产品品牌'>{detailData?.productBrand}</Descriptions.Item>
</Descriptions> </Descriptions>
......
...@@ -13,7 +13,7 @@ type addMakeParameterType = InterReqType<addProductType>; ...@@ -13,7 +13,7 @@ type addMakeParameterType = InterReqType<addProductType>;
interface PropsType { interface PropsType {
closed: () => void; closed: () => void;
data: (addMakeParameterType & { id: number; categoriesId: number }) | undefined; data: (addMakeParameterType & { id: number }) | undefined;
makeList: makeListType; makeList: makeListType;
onOk: () => void; onOk: () => void;
} }
...@@ -25,8 +25,6 @@ const AddOrEditProduceModal: FC<ModalProps & PropsType> = ({ ...@@ -25,8 +25,6 @@ const AddOrEditProduceModal: FC<ModalProps & PropsType> = ({
makeList, makeList,
onOk, onOk,
}) => { }) => {
// 产品类型下拉列表
// const [productTypeSelectList, setProductTypeSelectList] = useState<categoryType>([]);
// 表格事件 // 表格事件
const [form] = Form.useForm<addMakeParameterType>(); const [form] = Form.useForm<addMakeParameterType>();
// 关闭弹窗 // 关闭弹窗
...@@ -54,14 +52,6 @@ const AddOrEditProduceModal: FC<ModalProps & PropsType> = ({ ...@@ -54,14 +52,6 @@ const AddOrEditProduceModal: FC<ModalProps & PropsType> = ({
message.warning(err.errorFields[0].errors[0]).then(); message.warning(err.errorFields[0].errors[0]).then();
}); });
}; };
//根据目录获取分类
// const getCategoryListByDirectory = (directoryId: number) => {
// CategoryManageAPI.getCategoryList({ pageNo: 1, pageSize: 99999, directoryId, type: 4 }).then(
// ({ result }) => {
// setProductTypeSelectList(result.list || []);
// },
// );
// };
// componentsDidMounted // componentsDidMounted
useEffect(() => { useEffect(() => {
if (data) { if (data) {
...@@ -94,43 +84,16 @@ const AddOrEditProduceModal: FC<ModalProps & PropsType> = ({ ...@@ -94,43 +84,16 @@ const AddOrEditProduceModal: FC<ModalProps & PropsType> = ({
> >
<Input placeholder='请输入产品名称' allowClear maxLength={30} /> <Input placeholder='请输入产品名称' allowClear maxLength={30} />
</Form.Item> </Form.Item>
<Form.Item label='归属商品'> <Form.Item
<Select.Option value={1}>商城商品</Select.Option> label='归属商品'
<Select.Option value={2}>租赁商品</Select.Option> name='type'
rules={[{ required: true, message: '请选择归属商品' }]}
>
<Select placeholder='请选择归属商品'>
<Select.Option value={0}>商城商品</Select.Option>
<Select.Option value={1}>租赁商品</Select.Option>
</Select>
</Form.Item> </Form.Item>
{/*<Form.Item*/}
{/* label='产品目录'*/}
{/* name='directoryId'*/}
{/* rules={[{ required: true, message: '请选择产品目录' }]}*/}
{/*>*/}
{/* <Select placeholder='请选择产品目录' onChange={decSelectChange}>*/}
{/* {decList.map((v: any, index: number) => (*/}
{/* <Select.Option value={v.id} key={index}>*/}
{/* {v.directoryName}*/}
{/* </Select.Option>*/}
{/* ))}*/}
{/* </Select>*/}
{/*</Form.Item>*/}
{/*<Form.Item*/}
{/* name='categoryId'*/}
{/* label='产品类型'*/}
{/* rules={[{ required: true, message: '请选择产品类型' }]}*/}
{/*>*/}
{/* <Select*/}
{/* placeholder='请选择产品类型'*/}
{/* allowClear*/}
{/* showSearch*/}
{/* filterOption={(input, option) =>*/}
{/* (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())*/}
{/* }*/}
{/* >*/}
{/* {productTypeSelectList.map((i, j) => (*/}
{/* <Option value={i.id} key={j}>*/}
{/* {i.classifyName}*/}
{/* </Option>*/}
{/* ))}*/}
{/* </Select>*/}
{/*</Form.Item>*/}
<Form.Item <Form.Item
name='model' name='model'
label='产品型号' label='产品型号'
......
...@@ -37,9 +37,7 @@ function ProduceManage() { ...@@ -37,9 +37,7 @@ function ProduceManage() {
// 新增弹窗是否显示 // 新增弹窗是否显示
const [visibleAddEdit, setVisibleAddEdit] = useState(false); const [visibleAddEdit, setVisibleAddEdit] = useState(false);
// 新增弹窗内容 // 新增弹窗内容
const [addEditData, setAddEditData] = useState< const [addEditData, setAddEditData] = useState<addMakeParameterType & { id: number }>();
addMakeParameterType & { id: number; categoriesId: number }
>();
// 品牌列表 // 品牌列表
const [makeList, setMakeList] = useState<makeListType>([]); const [makeList, setMakeList] = useState<makeListType>([]);
// 表格结构 // 表格结构
...@@ -52,10 +50,10 @@ function ProduceManage() { ...@@ -52,10 +50,10 @@ function ProduceManage() {
}, },
{ {
title: '归属产品', title: '归属产品',
dataIndex: 'directoryName', dataIndex: 'type',
align: 'center', align: 'center',
render: (text: number) => (text === 1 ? '租赁商品' : text === 0 ? '商城商品' : ''),
}, },
{ title: '产品类型', dataIndex: 'categoryName', align: 'center' },
{ title: '型号', dataIndex: 'model', align: 'center' }, { title: '型号', dataIndex: 'model', align: 'center' },
{ title: '产品品牌', dataIndex: 'productBrand', align: 'center' }, { title: '产品品牌', dataIndex: 'productBrand', align: 'center' },
{ {
...@@ -87,7 +85,7 @@ function ProduceManage() { ...@@ -87,7 +85,7 @@ function ProduceManage() {
totalCount: 0, totalCount: 0,
}); });
//筛选参数 //筛选参数
const [searchColumnsData, setSearchColumnsData] = useState<searchColumns[]>([ const [searchColumnsData] = useState<searchColumns[]>([
{ {
label: '产品名称', label: '产品名称',
placeholder: '请输入产品名称', placeholder: '请输入产品名称',
...@@ -95,11 +93,14 @@ function ProduceManage() { ...@@ -95,11 +93,14 @@ function ProduceManage() {
name: 'productName', name: 'productName',
}, },
{ {
label: '产品类型', label: '归属产品',
placeholder: '请输入产品名称', placeholder: '请选择归属产品',
type: 'select', type: 'select',
name: 'categoryId', name: 'type',
options: [], options: [
{ name: '商城商品', id: 0 },
{ name: '租赁商品', id: 1 },
],
}, },
]); ]);
...@@ -122,12 +123,10 @@ function ProduceManage() { ...@@ -122,12 +123,10 @@ function ProduceManage() {
setVisibleAddEdit(true); setVisibleAddEdit(true);
setAddEditData({ setAddEditData({
id: record.id, id: record.id,
categoryId: record.categoriesId,
directoryId: record.directoryId,
model: record.model, model: record.model,
productBrandId: record.productBrandId, productBrandId: record.productBrandId,
productName: record.productName, productName: record.productName,
categoriesId: record.categoriesId, type: record.type,
}); });
}; };
// 关闭弹窗 // 关闭弹窗
......
...@@ -41,6 +41,7 @@ const ServiceDetail = () => { ...@@ -41,6 +41,7 @@ const ServiceDetail = () => {
<Form.Item label='展示状态'> <Form.Item label='展示状态'>
{serviceDetail?.displayState === 0 ? '上架' : '下架'} {serviceDetail?.displayState === 0 ? '上架' : '下架'}
</Form.Item> </Form.Item>
<Form.Item label='所属单位'>{serviceDetail?.companyName}</Form.Item>
<Form.Item label='封面图'> <Form.Item label='封面图'>
<Image src={serviceDetail?.coverPlan} width={100} height={100} /> <Image src={serviceDetail?.coverPlan} width={100} height={100} />
</Form.Item> </Form.Item>
......
...@@ -6,12 +6,15 @@ import { Uploader } from '~/components/uploader'; ...@@ -6,12 +6,15 @@ import { Uploader } from '~/components/uploader';
import { InterDataType, InterReqType } from '~/api/interface'; import { InterDataType, InterReqType } from '~/api/interface';
import { categoryListType } from '~/api/interface/categoryManage'; import { categoryListType } from '~/api/interface/categoryManage';
import { addServiceType, serviceType } from '~/api/interface/mallManageType'; import { addServiceType, serviceType } from '~/api/interface/mallManageType';
import { MallManageAPI } from '~/api'; import { MallManageAPI, SystemManageAPI } from '~/api';
import { listCompanyPage } from '~/api/interface/systemManageType';
//分类返回类型 //分类返回类型
type categoryType = InterDataType<categoryListType>['list']; type categoryType = InterDataType<categoryListType>['list'];
//服务返回类型 //服务返回类型
type serviceListType = InterDataType<serviceType>['list']; type serviceListType = InterDataType<serviceType>['list'];
//单位返回类型
type companyType = InterDataType<listCompanyPage>['list'];
interface selfProps { interface selfProps {
industryCategoryList: categoryType; industryCategoryList: categoryType;
...@@ -60,6 +63,8 @@ const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({ ...@@ -60,6 +63,8 @@ const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({
url: string; url: string;
}[] }[]
>([]); >([]);
//单位列表
const [companyList, setCompanyList] = useState<companyType>([]);
//封面图上传成功 //封面图上传成功
const coverPlanUploadSuccess = ( const coverPlanUploadSuccess = (
...@@ -121,6 +126,15 @@ const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({ ...@@ -121,6 +126,15 @@ const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({
form.resetFields(); form.resetFields();
handleCancel(); handleCancel();
}; };
//获取单位列表
const getCompanyList = () => {
SystemManageAPI.listCompanyPage({ pageNo: 1, pageSize: 99999 }).then(({ result }) => {
setCompanyList(result.list);
});
};
useEffect(() => {
getCompanyList();
}, []);
useEffect(() => { useEffect(() => {
if (currentServiceData) { if (currentServiceData) {
form.setFieldsValue({ form.setFieldsValue({
...@@ -131,6 +145,7 @@ const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({ ...@@ -131,6 +145,7 @@ const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({
shareCard: currentServiceData.shareCard || undefined, shareCard: currentServiceData.shareCard || undefined,
video: currentServiceData.video || undefined, video: currentServiceData.video || undefined,
displayState: currentServiceData.displayState, displayState: currentServiceData.displayState,
companyId: currentServiceData.companyId,
}); });
setCoverPlanFileList([ setCoverPlanFileList([
{ {
...@@ -209,6 +224,25 @@ const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({ ...@@ -209,6 +224,25 @@ const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='所属单位'
name='companyId'
rules={[{ required: true, message: '请选择所属单位' }]}
>
<Select
placeholder='请选择所属单位'
filterOption={(input, option) =>
(option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
}
showSearch
>
{companyList.map((v) => (
<Select.Option value={v.id} key={v.id}>
{v.companyName}
</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item
label='封面图' label='封面图'
name='coverPlan' name='coverPlan'
rules={[{ required: true, message: '请上传封面图' }]} rules={[{ required: true, message: '请上传封面图' }]}
......
...@@ -73,7 +73,7 @@ const ServiceList: FC<any> = () => { ...@@ -73,7 +73,7 @@ const ServiceList: FC<any> = () => {
render: (_text: any, _record: any, index: number) => render: (_text: any, _record: any, index: number) =>
(pagination.pageNo - 1) * pagination.pageSize + index + 1, (pagination.pageNo - 1) * pagination.pageSize + index + 1,
}, },
{ title: '服务名称', align: 'center', dataIndex: 'serviceName' }, { title: '服务名称', align: 'center', dataIndex: 'serviceName', width: '20%' },
{ title: '应用', align: 'center', dataIndex: 'applicationName' }, { title: '应用', align: 'center', dataIndex: 'applicationName' },
{ title: '对应行业', align: 'center', dataIndex: 'industryName' }, { title: '对应行业', align: 'center', dataIndex: 'industryName' },
{ {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论