From 3e6139bb65d868729922376f4318407b251cd327 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 26 Oct 2022 10:28:14 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=92=8C=E5=A4=8D=E5=88=B6=E5=85=91=E6=8D=A2=E7=A0=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=8B=BE=E9=80=89=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exchangecode/exchangecodeAdd/index.jsx | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/pages/exchangecode/exchangecodeAdd/index.jsx b/src/pages/exchangecode/exchangecodeAdd/index.jsx index 2556e75b..a26d7666 100644 --- a/src/pages/exchangecode/exchangecodeAdd/index.jsx +++ b/src/pages/exchangecode/exchangecodeAdd/index.jsx @@ -153,6 +153,7 @@ export default class exchangeAdd extends React.Component { } } + const checkedArray = [] /* 要勾选得数据 */ /* 处理新老数据 */ if (resData.length > 0) { let new_ids = [] /* 新数据唯一id */ @@ -160,6 +161,11 @@ export default class exchangeAdd extends React.Component { codeInfo.range = resData.map((item) => { if (item?.id) { /* 老数据 */ + checkedArray.push({ + key: item.only, + text: item.product_name, + id: item.id + }) item.checked = true old_ids.push(item.id) } else { @@ -189,23 +195,6 @@ export default class exchangeAdd extends React.Component { arr.push(obj) return obj }) - // is_delete 有值,不勾选 - _.map(reqCopy.goods, (item) => { - if (item.type === 2) { - if (item.origin.is_delete) { - item.checked = false - } else { - item.checked = true - } - } else { - if (item.is_delete) { - item.checked = false - } else { - item.checked = true - } - } - return item - }) /* 统一设置state */ this.setState({ @@ -213,7 +202,7 @@ export default class exchangeAdd extends React.Component { isload: true, tempdata: reqCopy.goods || [], plan_time: [reqCopy.plan.start_time, reqCopy.plan.end_time], - rank: arr, + rank: checkedArray, rankoptions: arr })