diff --git a/src/views/app/ModuleManage.vue b/src/views/app/ModuleManage.vue index 0870c4e..93d271d 100644 --- a/src/views/app/ModuleManage.vue +++ b/src/views/app/ModuleManage.vue @@ -29,6 +29,10 @@ + + + @@ -91,6 +95,24 @@ const flatData = computed(() => flattenTree(moduleList.value)); /* ---------------- 表格列 ---------------- */ const columns = [ { title: "模块名称", key: "name", minWidth: 260, slot: "name" }, + { + title: "图标", + key: "icon", + width: 170, + align: "center", + render: (h: any, { row }: any) => { + if (!row.icon) return h("span", { style: { color: "#c5c8ce" } }, "-"); + return h("div", { + style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "6px" }, + title: row.icon, + }, [ + h(SvgIcon, { name: row.icon, size: 16 }), + h("span", { + style: { maxWidth: "110px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, + }, row.icon), + ]); + }, + }, { title: "ID", key: "customId", width: 120, align: "center", render: (h: any, { row }: any) => h("span", row.customId || "-") }, { title: "路径", key: "path", minWidth: 200, render: (h: any, { row }: any) => h("span", row.path || "-") }, { title: "排序号", key: "sortNo", width: 100, align: "center", render: (h: any, { row }: any) => h("span", row.sortNo ?? "-") }, @@ -123,6 +145,7 @@ const form = ref<{ id: number | null; name: string; path: string; + icon: string; customId: number | null; parentId: number | null; sortNo: number | null; @@ -130,6 +153,7 @@ const form = ref<{ id: null, name: '', path: '', + icon: '', customId: null, parentId: null, sortNo: null, @@ -177,6 +201,7 @@ function openEditModal(item: any) { f.id = item?.id ?? null; f.name = item?.name || ''; f.path = item?.path || ''; + f.icon = item?.icon || ''; f.customId = item?.customId != null ? Number(item.customId) : null; f.parentId = item?.parentId ?? null; f.sortNo = item?.sortNo != null ? Number(item.sortNo) : null; @@ -189,13 +214,13 @@ function openEditModal(item: any) { /* ---------------- 新增模块 ---------------- */ function handleAdd() { openingIsChild.value = false; - openEditModal({ id: null, name: '', path: '', customId: null, parentId: null, sortNo: null }); + openEditModal({ id: null, name: '', path: '', icon: '', customId: null, parentId: null, sortNo: null }); } /* ---------------- 新增子模块 ---------------- */ function handleAddChild(parent: any) { openingIsChild.value = true; - openEditModal({ id: null, name: '', path: '', customId: null, parentId: parent.id, sortNo: null }); + openEditModal({ id: null, name: '', path: '', icon: '', customId: null, parentId: parent.id, sortNo: null }); } /* ---------------- 编辑 ---------------- */ @@ -240,6 +265,7 @@ async function onRawSave() { appId: appId.value, name: form.value.name, path: form.value.path, + icon: form.value.icon?.trim() || undefined, customId: form.value.customId == null ? '' : String(form.value.customId), parentId: form.value.parentId ?? undefined, sortNo: form.value.sortNo == null ? undefined : Number(form.value.sortNo), @@ -253,6 +279,8 @@ async function onRawSave() { appId: appId.value, name: form.value.name, path: form.value.path, + // 后端 edit 逐字段整体赋值,字段缺省即置空 → 清空图标能生效 + icon: form.value.icon?.trim() || undefined, customId: form.value.customId == null ? '' : String(form.value.customId), parentId: form.value.parentId ?? undefined, sortNo: form.value.sortNo == null ? undefined : Number(form.value.sortNo),