From 2609b97724716da6e74abf2e11f4495a374e448d Mon Sep 17 00:00:00 2001 From: qijq <624811160@qq.com> Date: Wed, 16 Jul 2025 00:46:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=95=86=E5=93=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E7=B4=AF=E5=8A=A0=E9=97=AE=E9=A2=98=E5=92=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=B9=E9=87=8F=E7=AE=A1=E7=90=86=E6=89=8B?= =?UTF-8?q?=E9=A3=8E=E7=90=B4=E6=97=A0=E6=B3=95=E6=94=B6=E7=BC=A9=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/warehouse/manage/batch.vue | 46 +++++++++++-------- .../pages/warehouse/manage/productList.vue | 22 ++++----- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/batch.vue b/java-mall-app-shop-admin/pages/warehouse/manage/batch.vue index cbec742..9701f2b 100644 --- a/java-mall-app-shop-admin/pages/warehouse/manage/batch.vue +++ b/java-mall-app-shop-admin/pages/warehouse/manage/batch.vue @@ -87,7 +87,7 @@ commodityList.length > 0 && !loadingCommodityData && tabbar.length > 0 && - tabbar[current].children.length > 0 + tabbar[collApseIndex].children.length > 0 " class="checkbox-all" @click="handleSelectAll(null, true)" @@ -95,7 +95,8 @@ 已勾选{{ - tabbar[current].children[currTabChildrenIndex].checkboxList + tabbar[collApseIndex].children[currTabChildrenIndex].checkboxList .length }}个 @@ -118,14 +119,14 @@ commodityList.length > 0 && !loadingCommodityData && tabbar.length > 0 && - tabbar[current].children.length <= 0 + tabbar[collApseIndex].children.length <= 0 " class="checkbox-all" @click="handleSelectAll(null, false)" > @@ -135,7 +136,7 @@ > - 已勾选{{ tabbar[current].checkboxList.length }}个 + 已勾选{{ tabbar[collApseIndex].checkboxList.length }}个 @@ -812,10 +816,10 @@ export default { if (!selectedIdsInCurrentPage.length) return; // 根据是否有子分类决定操作哪个数据 - const hasChildren = this.tabbar[this.current]?.children?.length > 0; + const hasChildren = this.tabbar[this.collApseIndex]?.children?.length > 0; const targetData = hasChildren - ? this.tabbar[this.current].children[this.currTabChildrenIndex] - : this.tabbar[this.current]; + ? this.tabbar[this.collApseIndex].children[this.currTabChildrenIndex] + : this.tabbar[this.collApseIndex]; if (!targetData) return; @@ -918,12 +922,12 @@ export default { } }, handerScrolltolower() { - if (this.tabbar[this.current].children.length > 0) { - this.tabbar[this.current].children[ + if (this.tabbar[this.collApseIndex].children.length > 0) { + this.tabbar[this.collApseIndex].children[ this.currTabChildrenIndex ].checkboxAllList = []; } else { - this.tabbar[this.current].checkboxAllList = []; + this.tabbar[this.collApseIndex].checkboxAllList = []; } if (this.isNoDownCommodityData) return; @@ -978,6 +982,7 @@ export default { this.tabbar[index].children[this.currTabChildrenIndex].id; } else { this.currentTab = index; + this.currCategoryId = this.tabbar[index].id; if (this.current != -1) { @@ -991,6 +996,7 @@ export default { if (this.collApseIndex == index) { return; } + if (this.currCategoryId != oldCategoryId && this.current != -1) { this.getProductList(); this.collApseIndex = index; @@ -1013,8 +1019,8 @@ export default { handleSelectAll(e, isHaveChildren) { const MAX_LIMIT = 100; const currentTabData = isHaveChildren - ? this.tabbar[this.current].children[this.currTabChildrenIndex] - : this.tabbar[this.current]; + ? this.tabbar[this.collApseIndex].children[this.currTabChildrenIndex] + : this.tabbar[this.collApseIndex]; // 获取当前页所有有效商品ID const allProductIds = this.commodityList @@ -1078,8 +1084,8 @@ export default { handleSingleCheckboxChange(list, isHaveChildren) { const MAX_LIMIT = 100; const currentTabData = isHaveChildren - ? this.tabbar[this.current].children[this.currTabChildrenIndex] - : this.tabbar[this.current]; + ? this.tabbar[this.collApseIndex].children[this.currTabChildrenIndex] + : this.tabbar[this.collApseIndex]; // 过滤掉全选标识和无效ID let newIdList = list diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/productList.vue b/java-mall-app-shop-admin/pages/warehouse/manage/productList.vue index 89e001a..00e42c9 100644 --- a/java-mall-app-shop-admin/pages/warehouse/manage/productList.vue +++ b/java-mall-app-shop-admin/pages/warehouse/manage/productList.vue @@ -305,13 +305,7 @@ export default { }, data() { return { - tabbar: [ - { - id: null, - label: "全部", - children: [], - }, - ], + tabbar: [], height: 0, //scroll-view高度 top: 0, currentTab: 0, //预设当前项的值 @@ -436,11 +430,14 @@ export default { async getProductCategoryTree() { let res = await GetProductCategoryTree(); if (res && res.status == 200) { - // var list = res.data.map((item) => ({ - // ...item, - // current: -1, - // })); - this.tabbar = [...this.tabbar, ...res.data]; + this.tabbar = [ + { + id: null, + label: "全部", + children: [], + }, + ...res.data, + ]; } }, async getProductList() { @@ -576,7 +573,6 @@ export default { let index = e.index; //手风琴展开状态 -1 == 不展开 const oldCategoryId = this.currCategoryId; - this.current = this.current == index ? -1 : e.index; // 如果current没有实际变化(点击的是已经展开的项),直接返回