Commit 12ee430b authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 处理单条属性组合情况下修改商品直接点击价格设置出错

parent ee212034
...@@ -416,15 +416,17 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -416,15 +416,17 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
id: attributeObjArr[_index].customerAttributeId, id: attributeObjArr[_index].customerAttributeId,
name: attributeObjArr[_index].attributeName name: attributeObjArr[_index].attributeName
} }
// console.log(attributeValObjArr, item, index, _item, _index, _tableDataSource, '调试属性') // console.log(attributeObjArr, attributeValObjArr, item, index, _item, _index, _tableDataSource, '调试属性')
_tempObject.customerAttributeValue = {
// @fixed bug: 属性名称相同的情况下 只找第一个元素 会出现id异常 // @fixed bug: 属性名称相同的情况下 只找第一个元素 会出现id异常
// id: attributeValObjArr.map(__item => __item.find(_ => _.value===_item)).filter(__ => __)[0].id, let filterData = attributeValObjArr.map((__item, __index) => {
id: attributeValObjArr.map((__item, __index) => {
if(_index === __index) { if(_index === __index) {
return __item.find(_ => _.value===_item) return __item.find(_ => _.value===_item)
} }
}).filter(__ => __)[0].id, }).filter(__ => __)[0]
_tempObject.customerAttributeValue = {
// @fixed bug: 属性名称相同的情况下 只找第一个元素 会出现id异常
// id: attributeValObjArr.map(__item => __item.find(_ => _.value===_item)).filter(__ => __)[0].id,
id: filterData?.id ? filterData.id : null,
value: item[_index] value: item[_index]
} }
_tempArr.push(_tempObject) _tempArr.push(_tempObject)
......
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