From 2c097084a09e4f3118f8a8a9b69f366912cc9145 Mon Sep 17 00:00:00 2001 From: limengyang <2509946015@qq.com> Date: Mon, 1 Apr 2024 18:15:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(lmy):=E8=A7=A3=E5=86=B3=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/addProduct.vue | 20 +- .../regionalSpotManage/components/list.vue | 392 +++++++++--------- 2 files changed, 209 insertions(+), 203 deletions(-) diff --git a/src/views/regionalSpotManage/components/addProduct.vue b/src/views/regionalSpotManage/components/addProduct.vue index 6f67c94..148afc2 100644 --- a/src/views/regionalSpotManage/components/addProduct.vue +++ b/src/views/regionalSpotManage/components/addProduct.vue @@ -104,8 +104,8 @@ const getLeftData = () => { ] if (rightData.value.length > 0) { for (let i = 0; i < rightData.value.length; i++) { - if (leftData.value.findIndex((v) => v.sysid === rightData.value[i].sysid) !== -1) { - leftData.value.find((v) => v.sysid === rightData.value[i].sysid).choice = true + if (leftData.value.findIndex((v) => v.brand + v.goodsNo + v.spec === rightData.value[i].brand + rightData.value[i].goodsNo + rightData.value[i].spec) !== -1) { + leftData.value.find((v) => v.brand + v.goodsNo + v.spec === rightData.value[i].brand + rightData.value[i].goodsNo + rightData.value[i].spec).choice = true } } } @@ -131,8 +131,8 @@ const toRight = () => { let arr = JSON.parse(JSON.stringify(selectedRows.value)) rightData.value = [...arr, ...rightData.value] for (let i = 0; i < selectedRows.value.length; i++) { - if (leftData.value.findIndex((v) => v.sysid === selectedRows.value[i].sysid) !== -1) { - leftData.value.find((v) => v.sysid === selectedRows.value[i].sysid).choice = true + if (leftData.value.findIndex((v) => v.brand + v.goodsNo + v.spec === selectedRows.value[i].brand + selectedRows.value[i].goodsNo + selectedRows.value[i].spec) !== -1) { + leftData.value.find((v) => v.brand + v.goodsNo + v.spec === selectedRows.value[i].brand + selectedRows.value[i].goodsNo + selectedRows.value[i].spec).choice = true } } leftData.value = [...leftData.value] @@ -153,15 +153,15 @@ const rightRowSelection = computed(() => { }) const toLeft = () => { for (let i = 0; i < rightSelectedRows.value.length; i++) { - if (leftData.value.findIndex((v) => v.sysid === rightSelectedRows.value[i].sysid) !== -1) { - leftData.value.find((v) => v.sysid === rightSelectedRows.value[i].sysid).choice = false + if (leftData.value.findIndex((v) => v.brand + v.goodsNo + v.spec === rightSelectedRows.value[i].brand + rightSelectedRows.value[i].goodsNo + rightSelectedRows.value[i].spec) !== -1) { + leftData.value.find((v) => v.brand + v.goodsNo + v.spec === rightSelectedRows.value[i].brand + rightSelectedRows.value[i].goodsNo + rightSelectedRows.value[i].spec).choice = false rightData.value.splice( - rightData.value.findIndex((v) => v.sysid == rightSelectedRows.value[i].sysid), + rightData.value.findIndex((v) => v.brand + v.goodsNo + v.spec == rightSelectedRows.value[i].brand + rightSelectedRows.value[i].goodsNo + rightSelectedRows.value[i].spec), 1 ) } else { rightData.value.splice( - rightData.value.findIndex((v) => v.sysid == rightSelectedRows.value[i].sysid), + rightData.value.findIndex((v) => v.brand + v.goodsNo + v.spec == rightSelectedRows.value[i].brand + rightSelectedRows.value[i].goodsNo + rightSelectedRows.value[i].spec), 1 ) } @@ -319,7 +319,7 @@ const confirm = async () => { :columns="leftColumns" :pagination="pagination" :row-selection="rowSelection" - :rowKey="(record) => record.sysid" + :rowKey="(record) => record.brand + record.goodsNo + record.spec" :scroll="{ x: false, y: 280 }" :rowClassName="rowClassName" :loading="loading" @@ -366,7 +366,7 @@ const confirm = async () => { :data-source="rightData" :columns="leftColumns" :pagination="false" - :rowKey="(record) => record.sysid" + :rowKey="(record) => record.brand + record.goodsNo + record.spec" :scroll="{ x: false, y: 280 }" :rowClassName="rowClassName" :row-selection="rightRowSelection" diff --git a/src/views/regionalSpotManage/components/list.vue b/src/views/regionalSpotManage/components/list.vue index 5194da5..1a7e90d 100644 --- a/src/views/regionalSpotManage/components/list.vue +++ b/src/views/regionalSpotManage/components/list.vue @@ -55,7 +55,11 @@ const typesOption = ref([ let searchBrandList = ref([]) const handleSearch = async (value) => { const res = await regionalSpotManageBrandListApi({brand: value}); - searchBrandList.value = res.data + if (res.code === 20000) { + searchBrandList.value = res.data + } else { + searchBrandList.value = [] + } } let listLoading = ref(false) const pagination = ref({ @@ -465,203 +469,205 @@ const goTaskCenter = () => {