Commit 18ce0d24 authored by GuanHua's avatar GuanHua

fix: 进货单勾选状态问题

parent d13aa7e5
......@@ -364,13 +364,13 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
idList = [...idList, ...item.checkedList]
}
if (idList.length <= 0) {
message.info("请选择要移动的商品")
message.info("请选择要删除的商品")
return false
}
Modal.confirm({
centered: true,
className: styles.mallComfirm,
content: `是否从进货单中除选中的商品?`,
content: `是否从进货单中除选中的商品?`,
onOk: () => {
return new Promise((resolve, reject) => {
PublicApi.postSearchShopPurchaseDeletePurchase({ idList: idList }).then(res => {
......@@ -393,16 +393,21 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
* @param ids
*/
const deleteListItems = (ids: number[]) => {
console.log(ids, "ids")
const newOrderList = JSON.parse(JSON.stringify(orderList))
const result = []
for (const item of newOrderList) {
const newItem = item
newItem.checkedList = newItem.checkedList.filter(checkItem => !ids.includes(checkItem))
newItem.orderList = newItem.orderList.filter(orderItem => !ids.includes(orderItem.id))
if (newItem.orderList.length > 0) {
result.push(newItem)
}
}
setOrderList(result)
if(result.every(resItem => resItem.checkedList.length === 0)){
setIndeterminate(false)
}
}
/**
......@@ -750,7 +755,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
<Checkbox
value={item.id}
className="common_checkbox"
indeterminate={!!item.checkedList.length && item.checkedList.length < item.defaultCheckedList.length}
indeterminate={!!item.checkedList.length && item.checkedList.length < item.defaultCheckedList.length && item.checkedList.length > 0}
onChange={(e) => onCheckChildAllChange(e, item.id)}
></Checkbox>
<label>{item.shopname}</label>
......
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