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

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

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