From 210386a0368d5542ce25901a288094d0f3cb1836 Mon Sep 17 00:00:00 2001 From: dzq Date: Mon, 26 May 2025 09:59:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=E6=90=9C=E7=B4=A2=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=A1=86=E6=B7=BB=E5=8A=A0.native.prevent=E4=BF=AE?= =?UTF-8?q?=E9=A5=B0=E7=AC=A6=E5=B9=B6=E4=BC=98=E5=8C=96=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E8=8F=9C=E5=8D=95=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 在多个视图的搜索输入框上添加.native.prevent修饰符,防止表单默认提交行为 2. 重构角色表单的菜单权限选择,从树形结构改为分类复选框形式 3. 在智能柜详情页添加商品名称搜索功能 4. 在cabinet-cell接口中添加goodsName查询参数 --- src/api/cabinet/cabinet-cell.ts | 1 + src/views/cabinet/cabinet-cell/index.vue | 8 +- src/views/cabinet/mqtt-server/index.vue | 8 +- src/views/cabinet/operation/index.vue | 4 +- src/views/cabinet/shop/index.vue | 4 +- .../cabinet/smart-cabinet-card/detail.vue | 36 +++++++-- .../cabinet/smart-cabinet-card/index.vue | 4 +- src/views/cabinet/smart-cabinet/index.vue | 4 +- src/views/qy/balance/index.vue | 6 +- src/views/shop/approval/index.vue | 12 +-- src/views/shop/cabinet-goods/index.vue | 6 +- src/views/shop/category/index.vue | 7 +- src/views/shop/goods/index.vue | 6 +- src/views/shop/order/index.vue | 8 +- src/views/system/role/role-form-modal.vue | 81 ++++++++++++------- src/views/system/user/index.vue | 4 +- src/views/user/ab98/index.vue | 2 +- src/views/user/qy/index.vue | 2 +- 18 files changed, 125 insertions(+), 78 deletions(-) diff --git a/src/api/cabinet/cabinet-cell.ts b/src/api/cabinet/cabinet-cell.ts index cc11ee6..095e9c5 100644 --- a/src/api/cabinet/cabinet-cell.ts +++ b/src/api/cabinet/cabinet-cell.ts @@ -4,6 +4,7 @@ export interface CabinetCellQuery extends BasePageQuery { cabinetId?: number; cellNo?: number; cellType?: number; + goodsName?: string; } export interface CabinetCellDTO { diff --git a/src/views/cabinet/cabinet-cell/index.vue b/src/views/cabinet/cabinet-cell/index.vue index 10c435f..dbb69b3 100644 --- a/src/views/cabinet/cabinet-cell/index.vue +++ b/src/views/cabinet/cabinet-cell/index.vue @@ -204,12 +204,12 @@ const switchCellType = (cellType: number) => { - + - + diff --git a/src/views/cabinet/mqtt-server/index.vue b/src/views/cabinet/mqtt-server/index.vue index 07569b4..51ae077 100644 --- a/src/views/cabinet/mqtt-server/index.vue +++ b/src/views/cabinet/mqtt-server/index.vue @@ -122,12 +122,12 @@ getList(); - + - + diff --git a/src/views/cabinet/operation/index.vue b/src/views/cabinet/operation/index.vue index aa81a50..48d0217 100644 --- a/src/views/cabinet/operation/index.vue +++ b/src/views/cabinet/operation/index.vue @@ -84,8 +84,8 @@ getList(); - + diff --git a/src/views/cabinet/shop/index.vue b/src/views/cabinet/shop/index.vue index 9113da3..b10231f 100644 --- a/src/views/cabinet/shop/index.vue +++ b/src/views/cabinet/shop/index.vue @@ -138,8 +138,8 @@ getList(); - + diff --git a/src/views/cabinet/smart-cabinet-card/detail.vue b/src/views/cabinet/smart-cabinet-card/detail.vue index 650266a..83b2d41 100644 --- a/src/views/cabinet/smart-cabinet-card/detail.vue +++ b/src/views/cabinet/smart-cabinet-card/detail.vue @@ -2,7 +2,7 @@ import { ref, onMounted } from "vue"; import { useRoute, useRouter } from "vue-router"; import { getSmartCabinetDetailApi, type SmartCabinetDTO } from "@/api/cabinet/smart-cabinet"; -import { changeGoodsCellsStock, clearGoodsCells, getCabinetCellList, type CabinetCellDTO } from "@/api/cabinet/cabinet-cell"; +import { CabinetCellQuery, changeGoodsCellsStock, clearGoodsCells, getCabinetCellList, type CabinetCellDTO } from "@/api/cabinet/cabinet-cell"; import { useRenderIcon } from "@/components/ReIcon/src/hooks"; import { CabinetImgMap } from "@/utils/cabinetImgMap"; import GatewayConfigModal from "@/views/cabinet/smart-cabinet/GatewayConfigModal.vue"; @@ -50,6 +50,9 @@ const shopConfigVisible = ref(false); const mainCabinetConfigVisible = ref(false); const editCabinetDrawerVisible = ref(false); const cellList = ref([]); +const searchCellParams = ref({ + goodsName: null +}); const cellPagination = ref({ pageSize: 5, currentPage: 1, @@ -140,11 +143,17 @@ function switchCellType(cellType: number) { } } +function resetCellSearch() { + searchCellParams.value.cellNo = null; + fetchCellList(); +} + async function fetchCellList() { try { loading.value = true; const { data } = await getCabinetCellList({ cabinetId: cabinetId.value, + goodsName: searchCellParams.value.goodsName, pageSize: cellPagination.value.pageSize, pageNum: cellPagination.value.currentPage }); @@ -304,10 +313,26 @@ onMounted(() => {
-
- +
+ + + + + + + 搜索 + + + + + 重置 + + + +
@@ -346,7 +371,8 @@ onMounted(() => { - --> + --> diff --git a/src/views/shop/order/index.vue b/src/views/shop/order/index.vue index f59c206..9dd1802 100644 --- a/src/views/shop/order/index.vue +++ b/src/views/shop/order/index.vue @@ -142,12 +142,12 @@ getList(); value-format="YYYY-MM-DD HH:mm:ss" class="!w-[200px]" /> - + - + diff --git a/src/views/system/role/role-form-modal.vue b/src/views/system/role/role-form-modal.vue index 94be0dc..f2fb717 100644 --- a/src/views/system/role/role-form-modal.vue +++ b/src/views/system/role/role-form-modal.vue @@ -101,20 +101,42 @@ async function handleConfirm() { loading.value = false; } } + +const processedMenuOptions = computed(() => { + const categories = []; + + const collectLeaves = (menu: MenuDTO) => { + if (!menu.children) return []; + return menu.children.filter(child => child.children?.length ? false : true); + }; + + const collectMenus = (menuOption: MenuDTO) => { + const leaves = collectLeaves(menuOption); + leaves.unshift(menuOption); + if (leaves.length) { + categories.push({ + categoryName: menuOption.menuName, + items: leaves + }); + } + if (menuOption.children?.length) { + const lastMenu = menuOption.children.filter(child => child.children?.length); + lastMenu.forEach(child => { + collectMenus(child); + }); + } + }; + props.menuOptions.forEach(menuOption => { + collectMenus(menuOption); + }) + + return categories; +}); + + \ No newline at end of file diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index f272a2a..dbfb64b 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -53,8 +53,8 @@ watch( - +