Commit 47dd5aad authored by 武广's avatar 武广

fix: 修改自定义属性字数

parent 7f667c1b
...@@ -429,6 +429,7 @@ class goodsManage extends Component { ...@@ -429,6 +429,7 @@ class goodsManage extends Component {
} }
}); });
const attributeApplyList = []; const attributeApplyList = [];
let isMaxLength = false;
if (values.attributeApplyList && values.attributeApplyList.length) { if (values.attributeApplyList && values.attributeApplyList.length) {
values.attributeApplyList.forEach(item => { values.attributeApplyList.forEach(item => {
const key = Object.keys(item)[0]; const key = Object.keys(item)[0];
...@@ -442,6 +443,9 @@ class goodsManage extends Component { ...@@ -442,6 +443,9 @@ class goodsManage extends Component {
attrs.push(json); attrs.push(json);
} }
} catch { } catch {
if (attr && attr.length > 30) {
isMaxLength = true;
}
attrs.push({ attributeValueName: attr }); attrs.push({ attributeValueName: attr });
} }
}); });
...@@ -452,9 +456,18 @@ class goodsManage extends Component { ...@@ -452,9 +456,18 @@ class goodsManage extends Component {
attrs = [json]; attrs = [json];
} }
} catch { } catch {
if (item[key] && item[key].length > 30) {
isMaxLength = true;
}
attrs = [{ attributeValueName: item[key] }]; attrs = [{ attributeValueName: item[key] }];
} }
} }
if (isMaxLength) {
notification.error({
message: '自定义属性不能超过30个字符',
});
return;
}
attributeApplyList.push({ attributeApplyList.push({
attributeId: key.replace('attr', ''), attributeId: key.replace('attr', ''),
attributeApplyValueList: attrs, attributeApplyValueList: attrs,
......
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