Commit 014dec87 authored by 武广's avatar 武广

feat: 添加编辑状态 内容可编辑范围设置

parent 4035f0b8
...@@ -90,7 +90,7 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -90,7 +90,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
> >
<Cascader <Cascader
placeholder="请选择商品类目!" placeholder="请选择商品类目!"
disabled={customer.isEdit} disabled={customer.isEdit && customer.isNormal}
showSearch={{ filter: filterCategoryOptions }} showSearch={{ filter: filterCategoryOptions }}
fieldNames={{ label: 'name', value: 'id', children: 'children' }} fieldNames={{ label: 'name', value: 'id', children: 'children' }}
onChange={props.onCategoryChange} onChange={props.onCategoryChange}
...@@ -106,7 +106,7 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -106,7 +106,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
> >
<Select <Select
showSearch showSearch
disabled={customer.isEdit && !customer.isCard} disabled={customer.isDisabled}
placeholder="请选择商品品牌" placeholder="请选择商品品牌"
filterOption={fileterBrandOptions} filterOption={fileterBrandOptions}
> >
...@@ -125,7 +125,7 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -125,7 +125,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
{ required: true, min: 2, message: '请输入最少两个字符的商品名称!', whitespace: true }, { required: true, min: 2, message: '请输入最少两个字符的商品名称!', whitespace: true },
]} ]}
> >
<Input placeholder="请输入商品名称" disabled={customer.isEdit && !customer.isCard} /> <Input placeholder="请输入商品名称" disabled={customer.isDisabled} />
</Form.Item> </Form.Item>
</Popover> </Popover>
{!customer.isCard && ( {!customer.isCard && (
......
...@@ -91,7 +91,7 @@ const SpecificationTemplate = (props, _) => { ...@@ -91,7 +91,7 @@ const SpecificationTemplate = (props, _) => {
<> <>
<Form.Item name={formName} label={label}> <Form.Item name={formName} label={label}>
<Select <Select
disabled={customer.isEdit} disabled={customer.isEdit && customer.isNormal}
allowClear allowClear
options={specList} options={specList}
style={{ width: 200 }} style={{ width: 200 }}
...@@ -151,7 +151,7 @@ const SpecificationTemplate = (props, _) => { ...@@ -151,7 +151,7 @@ const SpecificationTemplate = (props, _) => {
)} )}
</Form.Item> </Form.Item>
))} ))}
{fields.length < 3 && (!customer.isEdit || customer.isCard) && ( {fields.length < 3 && !customer.isDisabled && (
<Form.Item noStyle key="btnpush"> <Form.Item noStyle key="btnpush">
<Button <Button
style={{ marginLeft: 10, marginBottom: 24 }} style={{ marginLeft: 10, marginBottom: 24 }}
...@@ -206,7 +206,7 @@ const CreateBatchFormItems = ({ specInitValue, batchChange, editRef, defaultColu ...@@ -206,7 +206,7 @@ const CreateBatchFormItems = ({ specInitValue, batchChange, editRef, defaultColu
<Button <Button
key="batch" key="batch"
type="primary" type="primary"
disabled={customer.isEdit && !customer.isCard} disabled={customer.isEdit && customer.isNormal}
onClick={batchChange} onClick={batchChange}
> >
批量设置 批量设置
...@@ -278,7 +278,6 @@ const FormPriceOrStock = forwardRef((props, ref) => { ...@@ -278,7 +278,6 @@ const FormPriceOrStock = forwardRef((props, ref) => {
inputType: 'text', inputType: 'text',
}); });
} }
const dynamicColumns = [...columsData, ...StaticColumns(customer)]; const dynamicColumns = [...columsData, ...StaticColumns(customer)];
setDefaultColumns(dynamicColumns); setDefaultColumns(dynamicColumns);
}; };
......
...@@ -163,7 +163,7 @@ const FormRuleVPictures = forwardRef((props, ref) => { ...@@ -163,7 +163,7 @@ const FormRuleVPictures = forwardRef((props, ref) => {
maxHeight={customer.isCard ? 0 : 1200} maxHeight={customer.isCard ? 0 : 1200}
superTips="公共滑动图尺寸不可大于 1200*1200" superTips="公共滑动图尺寸不可大于 1200*1200"
name="commonImageList" name="commonImageList"
disabled={customer.isEdit && !customer.isCard} disabled={customer.isDisabled}
limit={imgConfig.commonImageList.limit} limit={imgConfig.commonImageList.limit}
pictures={commonImageList} pictures={commonImageList}
setPictureList={list => onCommonSuccessEvent(list)} setPictureList={list => onCommonSuccessEvent(list)}
...@@ -185,7 +185,7 @@ const FormRuleVPictures = forwardRef((props, ref) => { ...@@ -185,7 +185,7 @@ const FormRuleVPictures = forwardRef((props, ref) => {
<UploadImage <UploadImage
name="cardImageList" name="cardImageList"
limit={imgConfig.cardImageList.limit} limit={imgConfig.cardImageList.limit}
disabled={customer.isEdit && !customer.isCard} disabled={customer.isDisabled}
pictures={cardImageList} pictures={cardImageList}
setPictureList={list => onCardSuccessImageList(list)} setPictureList={list => onCardSuccessImageList(list)}
/> />
...@@ -206,7 +206,7 @@ const FormRuleVPictures = forwardRef((props, ref) => { ...@@ -206,7 +206,7 @@ const FormRuleVPictures = forwardRef((props, ref) => {
<UploadImage <UploadImage
name={key} name={key}
limit={11} limit={11}
disabled={customer.isEdit && !customer.isCard} disabled={customer.isDisabled}
pictures={imageList[key]} pictures={imageList[key]}
setPictureList={list => onPictureSuccessEvent(list, key)} setPictureList={list => onPictureSuccessEvent(list, key)}
/> />
...@@ -238,7 +238,7 @@ const FormRuleVPictures = forwardRef((props, ref) => { ...@@ -238,7 +238,7 @@ const FormRuleVPictures = forwardRef((props, ref) => {
maxWidth={customer.isCard ? 0 : 800} maxWidth={customer.isCard ? 0 : 800}
superTips="详情图宽度不可大于800" superTips="详情图宽度不可大于800"
name="detailImageList" name="detailImageList"
disabled={customer.isEdit && !customer.isCard} disabled={customer.isDisabled}
pictures={detailImageList} pictures={detailImageList}
setPictureList={list => onDetailSuccessImageList(list)} setPictureList={list => onDetailSuccessImageList(list)}
/> />
......
...@@ -138,7 +138,7 @@ export const StaticColumns = customer => [ ...@@ -138,7 +138,7 @@ export const StaticColumns = customer => [
min: 0, min: 0,
}, },
roleRules: { required: true }, roleRules: { required: true },
disabeldRender: () => customer.isEdit && !customer.isCard, disabeldRender: () => customer.isDisabled,
}, },
{ {
title: '佣金费率', title: '佣金费率',
...@@ -161,7 +161,7 @@ export const StaticColumns = customer => [ ...@@ -161,7 +161,7 @@ export const StaticColumns = customer => [
min: 0, min: 0,
}, },
roleRules: { required: true }, roleRules: { required: true },
disabeldRender: () => customer.isEdit && !customer.isCard, disabeldRender: () => customer.isDisabled,
}, },
{ {
title: '销售价', title: '销售价',
...@@ -174,7 +174,7 @@ export const StaticColumns = customer => [ ...@@ -174,7 +174,7 @@ export const StaticColumns = customer => [
precision: 2, precision: 2,
min: 0, min: 0,
}, },
disabeldRender: () => customer.isEdit && !customer.isCard, disabeldRender: () => customer.isDisabled,
}, },
{ {
title: '重量(kg)', title: '重量(kg)',
...@@ -193,7 +193,7 @@ export const StaticColumns = customer => [ ...@@ -193,7 +193,7 @@ export const StaticColumns = customer => [
precision: 3, precision: 3,
max: 999999.999, max: 999999.999,
}, },
disabeldRender: () => customer.isEdit && !customer.isCard, disabeldRender: () => customer.isDisabled,
}, },
{ {
title: '库存', title: '库存',
...@@ -210,7 +210,10 @@ export const StaticColumns = customer => [ ...@@ -210,7 +210,10 @@ export const StaticColumns = customer => [
min: 0, min: 0,
}, },
roleRules: { required: true }, roleRules: { required: true },
disabeldRender: () => customer.isEdit, disabeldRender: record => {
if (record.stock === null) return false;
return customer.isEdit && customer.isNormal;
},
}, },
{ {
title: '库存预警', title: '库存预警',
...@@ -223,7 +226,7 @@ export const StaticColumns = customer => [ ...@@ -223,7 +226,7 @@ export const StaticColumns = customer => [
precision: 0, precision: 0,
maxLength: 5, maxLength: 5,
}, },
disabeldRender: () => customer.isEdit && !customer.isCard, disabeldRender: () => customer.isDisabled,
}, },
{ {
title: '商品自编码', title: '商品自编码',
...@@ -232,7 +235,7 @@ export const StaticColumns = customer => [ ...@@ -232,7 +235,7 @@ export const StaticColumns = customer => [
role: [1, 2], role: [1, 2],
inputType: 'input', inputType: 'input',
roleRules: { required: true }, roleRules: { required: true },
disabeldRender: () => customer.isEdit && !customer.isCard, disabeldRender: () => customer.isDisabled,
}, },
{ {
title: '京东链接', title: '京东链接',
...@@ -241,7 +244,7 @@ export const StaticColumns = customer => [ ...@@ -241,7 +244,7 @@ export const StaticColumns = customer => [
role: [1, 2], role: [1, 2],
inputType: 'input', inputType: 'input',
roleRules: { required: false }, roleRules: { required: false },
disabeldRender: () => customer.isEdit && !customer.isCard, disabeldRender: () => customer.isDisabled,
}, },
{ {
title: 'sku名称', title: 'sku名称',
...@@ -250,7 +253,7 @@ export const StaticColumns = customer => [ ...@@ -250,7 +253,7 @@ export const StaticColumns = customer => [
role: customer.isEdit && customer.isJDGoods ? [1, 2] : [], role: customer.isEdit && customer.isJDGoods ? [1, 2] : [],
inputType: 'btnText', inputType: 'btnText',
roleRules: { required: false }, roleRules: { required: false },
disabeldRender: () => customer.isEdit && !customer.isCard, disabeldRender: () => customer.isDisabled,
}, },
{ {
title: '操作', title: '操作',
...@@ -260,10 +263,10 @@ export const StaticColumns = customer => [ ...@@ -260,10 +263,10 @@ export const StaticColumns = customer => [
inputType: 'option', inputType: 'option',
roleProps: { roleProps: {
isJDGoods: customer.isJDGoods, isJDGoods: customer.isJDGoods,
disabled: customer.isEdit && !customer.isCard, disabled: customer.isDisabled,
min: 0, min: 0,
}, },
roleRules: { required: false }, roleRules: { required: false },
disabeldRender: () => customer.isEdit && !customer.isCard, disabeldRender: () => customer.isDisabled,
}, },
]; ];
...@@ -241,7 +241,10 @@ const ServiceGoods = options => { ...@@ -241,7 +241,10 @@ const ServiceGoods = options => {
canAddService, // 是否可以添加服务商品(电子卡券) canAddService, // 是否可以添加服务商品(电子卡券)
canAddNormal, // 是否可以添加实物商品 canAddNormal, // 是否可以添加实物商品
isCard: productType === 4, isCard: productType === 4,
isService: SourceData.state && SourceData.state !== 4, // 0, "商品删除" 1, "新建" 2, "提交审核" 3, "待审核" 4, "驳回" 5, "未上架" 6, "已上架" 7, "已下架"
isNormal: SourceData.state && SourceData.state !== 4, // 商品不是驳回状态
// 当商品进行编辑 & 类型不为电子卡券 & 商品状态不为驳回 禁用当前功能
isDisabled: isEdit && productType !== 4 && SourceData.state && SourceData.state !== 4,
isJDGoods: isEdit && SourceData.pageProductType && +SourceData.pageProductType !== 1, isJDGoods: isEdit && SourceData.pageProductType && +SourceData.pageProductType !== 1,
onEventBus, onEventBus,
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment