提交 aa26cfe8 作者: ZhangLingKun

Merge remote-tracking branch 'origin/develop' into develop

......@@ -14,4 +14,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin
newTag: 4e74e0c8dcab0da8b857761643f3e09e67393359
newTag: a8683e3e1ce56b57a7775c43b06a8f8e443ffbdd
......@@ -5,7 +5,6 @@ import type { RadioChangeEvent } from 'antd';
import EditableCell from '~/components/EditableCell';
import { InterDataType } from '~/api/interface';
import { categoryListType } from '~/api/interface/categoryManage';
import { ProduceManageAPI } from '~/api';
import {
cooperationTagType,
......@@ -16,8 +15,6 @@ import { customizeEntity, skuUnitType, specEntity } from '~/api/interface/goodsT
import { Uploader } from '~/components/uploader';
import ConfigurePriceModal from '../configurePriceModal';
//分类返回类型
type categoryType = InterDataType<categoryListType>['list'];
//产品返回类型
type productType = InterDataType<productListType>['list'];
//产品-规格返回类型
......@@ -31,7 +28,6 @@ interface selfProps {
handleCancel: () => void;
handleOk: (data: specEntity) => void;
currentDesc: number;
categoryList: categoryType;
curtRowData: Partial<specEntity>;
skuUnitList: unitType;
goodsType: number;
......@@ -49,7 +45,6 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
handleCancel,
handleOk,
currentDesc,
categoryList,
curtRowData,
skuUnitList,
goodsType,
......@@ -151,15 +146,6 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
}),
};
});
// // 根据产品类型获取产品列表
const handleProdTypeSelect = (id: number) => {
getProductList(id);
skuForm.setFieldsValue({
skuId: undefined,
specIds: undefined,
});
// getProduct(id);
};
//
// // 根据所属行业获取方案列表
// const handleIndeTypeSelect = async (id: number) => {
......@@ -212,8 +198,8 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
handleCancel();
};
//获取产品列表
const getProductList = (categoryId: number) => {
ProduceManageAPI.listPageProductSku({ pageNo: 1, pageSize: 9999, categoryId }).then(
const getProductList = () => {
ProduceManageAPI.listPageProductSku({ pageNo: 1, pageSize: 9999, type: goodsType }).then(
({ result }) => {
setProductList(result.list || []);
},
......@@ -393,7 +379,6 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
useEffect(() => {
if (Object.keys(curtRowData).length !== 0) {
setDialogTitle('编辑');
getProductList(curtRowData.categoryId as number);
if (!curtRowData.flag) {
getProductSpecList(curtRowData.skuId as number);
}
......@@ -424,6 +409,9 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
setDialogTitle('添加');
}
}, [curtRowData]);
useEffect(() => {
getProductList();
}, []);
return (
<div>
<Modal
......
......@@ -290,7 +290,6 @@ const GoodsAddOrEditOrDetail = () => {
open={addOrEditSkuModalShow}
handleCancel={addOrEditSkuModalCancel}
handleOk={addOrEditSkuModalOk}
categoryList={categoryList}
skuUnitList={skuUnitList}
curtRowData={curtRowData}
goodsType={0}
......
import React, { FC, useEffect, useState } from 'react';
import { Form, Input, message, Modal, Select, Row, Col, Button, ModalProps, Card } from 'antd';
import { Form, Input, message, Modal, Select, Row, Col, Button, ModalProps } from 'antd';
import { ProduceManageAPI } from '~/api';
import { InterDataType } from '~/api/interface';
import { cooperationTagType, ProductSpecListType } from '~/api/interface/produceManageType';
......@@ -13,23 +13,12 @@ type specType = InterDataType<ProductSpecListType>['list'][0];
interface PropsType {
onCancel: () => void;
data: specType | undefined;
type: number; //产品所属类型
}
const { Option } = Select;
const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel, data }) => {
const tabList = [
{
key: '0',
tab: '销售价格',
},
{
key: '1',
tab: '租赁价格',
},
];
//当前tab
const [currentTab, setCurrentTab] = useState<string>('0');
const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel, data, type }) => {
// 表格事件
const [form] = Form.useForm();
// 等级标签列表
......@@ -58,7 +47,6 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
}
return pre;
}, {});
console.log('数据-->', setDefaultObj);
form.setFieldsValue({ ...Obj, level: levelNumber, ...setDefaultObj });
} else {
//如果没有返回价格,清楚上一次选择的租期价格
......@@ -97,16 +85,7 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
};
// 关闭弹窗
const handleClosed = () => {
setCurrentTab('0');
const data = Object.fromEntries(
selectList.map((i) => {
return [i, undefined];
}),
);
form.setFieldsValue({
0: undefined,
...data,
});
form.resetFields();
setSelectList([]);
onCancel();
};
......@@ -124,7 +103,7 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
ProduceManageAPI[isEdit ? 'editProductSpecPrice' : 'setProductSpecPrice']({
specPrice,
productSpecId: data?.id,
type: Number(currentTab),
type: type,
leaseTerm: values.leaseTerm,
}).then(({ code }) => {
if (code === '200') {
......@@ -151,30 +130,15 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
}
return Promise.resolve();
};
//tab change
const onTabChange = (key: string) => {
form.resetFields();
switch (key) {
case '0':
getProductSpecPrice(Number(key), data?.id);
break;
case '1':
getProductSpecPrice(Number(key), data?.id, 0);
break;
}
setSelectList([]);
setCurrentTab(key);
};
//租期选择
const rentDateChange = (value: string) => {
getProductSpecPrice(Number(currentTab), data?.id, Number(value));
getProductSpecPrice(type, data?.id, Number(value));
};
// componentsDidMounted
useEffect(() => {
if (data) {
getTagNameList();
getProductSpecPrice(Number(currentTab), data?.id);
getProductSpecPrice(type, data?.id, type === 0 ? undefined : 0);
}
}, [data]);
return (
......@@ -193,88 +157,80 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
</Button>,
]}
>
<Card tabList={tabList} onTabChange={onTabChange}>
<Form
name='form'
form={form}
layout='horizontal'
labelWrap
initialValues={{ leaseTerm: 0 }}
>
{currentTab === '1' && (
<Form.Item
label='租期'
labelCol={{ span: 5 }}
wrapperCol={{ span: 15 }}
name='leaseTerm'
rules={[{ required: true, message: '请选择租期' }]}
>
<Select onChange={rentDateChange}>
<Select.Option value={0}>1-7天</Select.Option>
<Select.Option value={1}>8-15天</Select.Option>
<Select.Option value={2}>16-30天</Select.Option>
<Select.Option value={3}>31天以上</Select.Option>
</Select>
</Form.Item>
)}
<Form name='form' form={form} layout='horizontal' labelWrap initialValues={{ leaseTerm: 0 }}>
{type === 1 && (
<Form.Item
label='渠道等级'
name='level'
rules={[{ required: true, message: '请选择渠道等级' }]}
label='租期'
labelCol={{ span: 5 }}
wrapperCol={{ span: 15 }}
name='leaseTerm'
rules={[{ required: true, message: '请选择租期' }]}
>
<Select
placeholder='请选择渠道等级'
allowClear
mode='multiple'
onChange={handleChange}
value={selectList}
>
{tagInfoList.map((i, j) => (
<Option value={i.id} key={j}>
{i.tagName}
</Option>
))}
<Select onChange={rentDateChange}>
<Select.Option value={0}>1-7天</Select.Option>
<Select.Option value={1}>8-15天</Select.Option>
<Select.Option value={2}>16-30天</Select.Option>
<Select.Option value={3}>31天以上</Select.Option>
</Select>
</Form.Item>
<Row>
)}
<Form.Item
label='渠道等级'
name='level'
rules={[{ required: true, message: '请选择渠道等级' }]}
labelCol={{ span: 5 }}
wrapperCol={{ span: 15 }}
>
<Select
placeholder='请选择渠道等级'
allowClear
mode='multiple'
onChange={handleChange}
value={selectList}
>
{tagInfoList.map((i, j) => (
<Option value={i.id} key={j}>
{i.tagName}
</Option>
))}
</Select>
</Form.Item>
<Row>
<Col span={20}>
<Form.Item
name='0'
label='市场单价'
rules={[{ required: true, validator: priceValidator }]}
labelCol={{ span: 6 }}
wrapperCol={{ span: 18 }}
>
<Input placeholder='请输入市场单价' maxLength={11} allowClear />
</Form.Item>
</Col>
<Col span={4}>
<div style={{ margin: '6px 0 0 10px' }}>元/件</div>
</Col>
</Row>
{selectList.map((i, j) => (
<Row key={j}>
<Col span={20}>
<Form.Item
name='0'
label='市场单价'
name={i}
label={transValtoLabel(i)}
rules={[{ required: true, validator: priceValidator }]}
key={j}
labelCol={{ span: 6 }}
wrapperCol={{ span: 18 }}
>
<Input placeholder='请输入市场单价' maxLength={11} allowClear />
<Input placeholder='请输入定价金额' maxLength={11} allowClear />
</Form.Item>
</Col>
<Col span={4}>
<div style={{ margin: '6px 0 0 10px' }}>元/件</div>
</Col>
</Row>
{selectList.map((i, j) => (
<Row key={j}>
<Col span={20}>
<Form.Item
name={i}
label={transValtoLabel(i)}
rules={[{ required: true, validator: priceValidator }]}
key={j}
labelCol={{ span: 6 }}
wrapperCol={{ span: 18 }}
>
<Input placeholder='请输入定价金额' maxLength={11} allowClear />
</Form.Item>
</Col>
<Col span={4}>
<div style={{ margin: '6px 0 0 10px' }}>元/件</div>
</Col>
</Row>
))}
</Form>
</Card>
))}
</Form>
</Modal>
);
};
......
......@@ -245,6 +245,7 @@ function ProduceDetail() {
open={produceSpecPriceModalShow}
onCancel={produceSpecPriceModalCancel}
data={addEditData}
type={detailData?.type || 0}
/>
</div>
);
......
......@@ -209,30 +209,15 @@ function ProduceManage() {
pagination.pageSize = Number(searchParams.get('pageSize') || 10);
(searchRef.current as any).getForm().setFieldsValue({
productName: searchParams.get('productName') || undefined,
directoryId: searchParams.get('directoryId')
? Number(searchParams.get('directoryId'))
: undefined,
categoryId: searchParams.get('categoryId')
? Number(searchParams.get('categoryId'))
: undefined,
type: searchParams.get('type') ? Number(searchParams.get('type')) : undefined,
});
setQuery({
productName: searchParams.get('productName') || undefined,
directoryId: searchParams.get('directoryId')
? Number(searchParams.get('directoryId'))
: undefined,
categoryId: searchParams.get('categoryId')
? Number(searchParams.get('categoryId'))
: undefined,
type: searchParams.get('type') ? Number(searchParams.get('type')) : undefined,
});
getProduceList({
productName: searchParams.get('productName') || undefined,
directoryId: searchParams.get('directoryId')
? Number(searchParams.get('directoryId'))
: undefined,
categoryId: searchParams.get('categoryId')
? Number(searchParams.get('categoryId'))
: undefined,
type: searchParams.get('type') ? Number(searchParams.get('type')) : undefined,
});
}, []);
......
......@@ -290,7 +290,6 @@ const GoodsAddOrEditOrDetail = () => {
open={addOrEditSkuModalShow}
handleCancel={addOrEditSkuModalCancel}
handleOk={addOrEditSkuModalOk}
categoryList={categoryList}
skuUnitList={skuUnitList}
curtRowData={curtRowData}
goodsType={1}
......
......@@ -117,6 +117,9 @@ const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({
if (code === '200') {
message.success(currentServiceData ? '编辑服务成功' : '新增服务成功');
form.resetFields();
setCoverPlanFileList([]);
setVideoFileList([]);
setShareCardFileList([]);
handleOk();
}
});
......@@ -124,6 +127,9 @@ const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({
};
const onCancel = () => {
form.resetFields();
setCoverPlanFileList([]);
setVideoFileList([]);
setShareCardFileList([]);
handleCancel();
};
//获取单位列表
......@@ -175,10 +181,6 @@ const AddOrEditServiceModal: FC<ModalProps & selfProps> = ({
},
]);
}
} else {
setCoverPlanFileList([]);
setVideoFileList([]);
setShareCardFileList([]);
}
}, [currentServiceData]);
......
......@@ -63,7 +63,6 @@ const AddEditModal: FC<propType> = (props) => {
if (!open) return;
if (!data) return;
form.setFieldsValue(data);
// console.log('data --->', data);
}, [open]);
return (
<Modal
......@@ -95,11 +94,7 @@ const AddEditModal: FC<propType> = (props) => {
>
<Input placeholder={'请输入文章来源'} maxLength={50} allowClear />
</Form.Item>
<Form.Item
label='文章详情'
name='caseContents'
rules={[{ required: true, message: '请输入文章详情' }]}
>
<Form.Item label='文章详情' name='caseContents'>
<RichText
value={form.getFieldValue('caseContents')}
onChange={(e) => form.setFieldValue('caseContents', e)}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论