Commit c1d48359 authored by GuanHua's avatar GuanHua

fix: app企业商城-优质推荐-品牌无法删除新增的问题

parent 66376958
......@@ -26,7 +26,7 @@ const MobileSettingPanel: React.FC = ()=> {
const newProps = get(componentConfigs, [selectedKey, 'props'], oldProps)
const updateSelectInfo = { ...selectedInfo }
updateSelectInfo.props = newProps
console.log(JSON.stringify(newProps))
setNewSelectInfo(updateSelectInfo)
}
}
......
......@@ -273,12 +273,42 @@ const Quality: React.FC<QualityPropsType> = (props) => {
})
}
/**
* 删除品牌
* @param sort
*/
const handleDeleteSelectBrandItem = async (id: number, delelteId: number) => {
const newList = [...list]
for(const item of newList) {
if (item.id === id) {
item.recommend = item.recommend.filter(recommendId => recommendId !== delelteId)
const param = {
idList: item.recommend
}
const result = await PublicApi.postSearchMobileShopEnterpriseGetCategoryBrand(param)
message.destroy()
item.recommendList = result.data
}
}
setList(newList)
changeProps({
props:Object.assign({ ...props }, { dataList: newList })
})
}
const changeBrandData = (list: any[] | undefined) => {
if(list) {
let newList: any[] = []
const newList: any[] = []
list.forEach((item) => {
if(item.brandResponseList) {
newList = [...newList, ...item.brandResponseList]
if (item.brandResponseList && item.brandResponseList.length > 0 ){
item.brandResponseList.forEach((childItem) => {
if(newList.every((newItem) => newItem.id !== childItem.id)) {
newList.push(childItem)
}
})
}
}
});
return newList
......@@ -354,7 +384,7 @@ const Quality: React.FC<QualityPropsType> = (props) => {
<div className={cx(styles.selectInfo, styles.shop)}>
<div className={styles.selectInfo_name}>{selectItem.name}</div>
</div>
<div className={styles.selectInfoBox_delete} onClick={() => handleDeleteSelectItem(item.id, selectItem.id)}>
<div className={styles.selectInfoBox_delete} onClick={() => handleDeleteSelectBrandItem(item.id, selectItem.id)}>
<DeleteOutlined />
</div>
</div>
......@@ -436,6 +466,7 @@ const Quality: React.FC<QualityPropsType> = (props) => {
idList: item.recommend
}
const result = await PublicApi.postSearchMobileShopEnterpriseGetCategoryBrand(param)
message.destroy()
item.recommendList = result.data
} else {
if(item.recommendList) {
......
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