提交 ae793c0d 作者: 龚洪江

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

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