🐞 fix(ID1001342): 【电子商城&内部商城】-功能{添加剪样}:取消掉已经添加的剪样后刷新页面依然显示继续添加,

【【电子商城&内部商城】-功能{添加剪样}:取消掉已经添加的剪样后刷新页面依然显示继续添加,】 https://www.tapd.cn/53459131/bugtrace/bugs/view/1153459131001001342
This commit is contained in:
xuan 2023-02-24 19:36:15 +08:00
parent 20400ba978
commit aa0734a2f9
2 changed files with 9 additions and 7 deletions

View File

@ -84,7 +84,7 @@ page {
flex-flow: column nowrap; flex-flow: column nowrap;
} }
.addButton { .addButton {
width: 30%; width: 250px;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;

View File

@ -169,6 +169,10 @@ const SampleCuttingList = () => {
const [show, setShow] = useState(false) const [show, setShow] = useState(false)
const onClose = () => { const onClose = () => {
const index = multipleSelection.current.findIndex(mul => mul.product_id === currentSelect.current.id)
if (index !== -1) {
multipleSelection.current[index].multipleSelection = productMultipleSelection
}
setShow(false) setShow(false)
setProductMultipleSelection([]) setProductMultipleSelection([])
} }
@ -197,9 +201,6 @@ const SampleCuttingList = () => {
} }
} }
const handleClose = () => {
onClose()
}
const handleAddProduct = () => { const handleAddProduct = () => {
const index = multipleSelection.current.findIndex(mul => mul.product_id === currentSelect.current.id) const index = multipleSelection.current.findIndex(mul => mul.product_id === currentSelect.current.id)
if (index !== -1) { if (index !== -1) {
@ -212,7 +213,8 @@ const SampleCuttingList = () => {
multipleSelection: productMultipleSelection, multipleSelection: productMultipleSelection,
}) })
} }
onClose() setShow(false)
setProductMultipleSelection([])
} }
const [productMultipleSelection, setProductMultipleSelection] = useState<SampleCuttingCache['multipleSelection']>([]) const [productMultipleSelection, setProductMultipleSelection] = useState<SampleCuttingCache['multipleSelection']>([])
@ -263,7 +265,7 @@ const SampleCuttingList = () => {
onClick={() => handleClickAddButton(item)} onClick={() => handleClickAddButton(item)}
> >
{ {
isAdd?.includes(item.id) || multipleSelection.current.some(mul => mul.product_id === item.id) ? '继续添加' : '添加' isAdd?.includes(item.id) || multipleSelection.current.find(mul => mul.product_id === item.id)?.multipleSelection.length ? '继续添加' : '添加'
} }
</NormalButton> </NormalButton>
</View> </View>
@ -335,7 +337,7 @@ const SampleCuttingList = () => {
round round
plain plain
customStyles={{ width: '48%' }} customStyles={{ width: '48%' }}
onClick={handleClose} onClick={onClose}
> >
</NormalButton> </NormalButton>