From c46a55e9c44a795f6c4aa07ad029f05413826232 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Wed, 20 Nov 2024 13:53:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/user/login/index.ts | 4 ++-- frontend/src/routers/index.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/api/user/login/index.ts b/frontend/src/api/user/login/index.ts index 4f9ef65..70dad1f 100644 --- a/frontend/src/api/user/login/index.ts +++ b/frontend/src/api/user/login/index.ts @@ -12,12 +12,12 @@ export const loginApi = (params: Login.ReqLoginForm) => { } // 获取菜单列表 export const getAuthMenuListApi = () => { - return http.get(`${rePrefix}/menu/list`, {}, { loading: false }) + return http.get(`/sysFunction/getMenu`, {}, { loading: false }) // return http.post(`/Register2`, {}, { loading: false }) } // 获取按钮权限 export const getAuthButtonListApi = () => { - return http.get(`${rePrefix}/auth/buttons`, {}, { loading: false }) + return http.get(`/sysFunction/getButton`, {}, { loading: false }) // return http.post(`/Register3`, {}, { loading: false }) } // 用户退出登录 diff --git a/frontend/src/routers/index.ts b/frontend/src/routers/index.ts index 3d7aa48..b57af3a 100644 --- a/frontend/src/routers/index.ts +++ b/frontend/src/routers/index.ts @@ -69,7 +69,6 @@ router.beforeEach(async (to, from, next) => { await initDynamicRouter() return next({ ...to, replace: true }) } - // 7.存储 routerName 做按钮权限筛选 authStore.setRouteName(to.name as string) From 55383cf501cf8809db65883aede38b997fac18d6 Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Wed, 20 Nov 2024 15:13:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/directives/modules/auth.ts | 2 + .../src/layouts/components/Footer/index.vue | 4 +- frontend/src/routers/index.ts | 1 + frontend/src/views/analyse/index.vue | 13 ----- .../resource/components/resourcePopup.vue | 2 + .../src/views/authority/resource/index.vue | 4 +- .../authority/role/components/rolePopup.vue | 2 + .../role/components/roleResourcePopup.vue | 13 +++-- .../user/components/passWordPopup.vue | 2 + .../authority/user/components/userPopup.vue | 2 + frontend/src/views/authority/user/index.vue | 4 +- frontend/src/views/home/index.vue | 7 ++- frontend/src/views/home/tabs/model.vue | 4 +- .../machine/device/components/devicePopup.vue | 2 + .../src/views/machine/testScript/index.vue | 6 +-- .../src/views/plan/singlePlanList/index.vue | 2 +- .../dictData/components/dataPopup.vue | 2 + .../dictionary/dictPq/components/pqPopup.vue | 2 + .../dictTree/components/treePopup.vue | 2 + .../dictType/components/typePopup.vue | 2 + .../views/system/versionRegister/index.vue | 52 +++++++++---------- 21 files changed, 74 insertions(+), 56 deletions(-) delete mode 100644 frontend/src/views/analyse/index.vue diff --git a/frontend/src/directives/modules/auth.ts b/frontend/src/directives/modules/auth.ts index 8745f7b..3872e4b 100644 --- a/frontend/src/directives/modules/auth.ts +++ b/frontend/src/directives/modules/auth.ts @@ -10,6 +10,8 @@ const auth: Directive = { const { value } = binding const authStore = useAuthStore() const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? [] + console.log('1234',authStore.routeName) + console.log('123',currentPageRoles) if (value instanceof Array && value.length) { const hasPermission = value.every(item => currentPageRoles.includes(item)) if (!hasPermission) el.remove() diff --git a/frontend/src/layouts/components/Footer/index.vue b/frontend/src/layouts/components/Footer/index.vue index 6467635..a76ca37 100644 --- a/frontend/src/layouts/components/Footer/index.vue +++ b/frontend/src/layouts/components/Footer/index.vue @@ -24,8 +24,8 @@ 数字式模块 - 对比式模块比对式模块 diff --git a/frontend/src/routers/index.ts b/frontend/src/routers/index.ts index b57af3a..eb3a989 100644 --- a/frontend/src/routers/index.ts +++ b/frontend/src/routers/index.ts @@ -69,6 +69,7 @@ router.beforeEach(async (to, from, next) => { await initDynamicRouter() return next({ ...to, replace: true }) } + console.log(to) // 7.存储 routerName 做按钮权限筛选 authStore.setRouteName(to.name as string) diff --git a/frontend/src/views/analyse/index.vue b/frontend/src/views/analyse/index.vue deleted file mode 100644 index 8e8347f..0000000 --- a/frontend/src/views/analyse/index.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - - - \ No newline at end of file diff --git a/frontend/src/views/authority/resource/components/resourcePopup.vue b/frontend/src/views/authority/resource/components/resourcePopup.vue index d70780b..2a48c80 100644 --- a/frontend/src/views/authority/resource/components/resourcePopup.vue +++ b/frontend/src/views/authority/resource/components/resourcePopup.vue @@ -192,6 +192,8 @@ const displayPid = computed({ // 打开弹窗,可能是新增,也可能是编辑 const open = async (sign: string, data: Function.ResFunction) => { + // 重置表单 + dialogFormRef.value?.resetFields() const response = await getFunctionListNoButton() functionList.value = response.data as unknown as Function.ResFunction[] titleType.value = sign diff --git a/frontend/src/views/authority/resource/index.vue b/frontend/src/views/authority/resource/index.vue index 0fe1e6d..8161315 100644 --- a/frontend/src/views/authority/resource/index.vue +++ b/frontend/src/views/authority/resource/index.vue @@ -53,7 +53,7 @@ { prop: 'code', label: '编码', - minWidth: 100, + minWidth: 120, }, { prop: 'type', @@ -75,7 +75,7 @@ { prop: 'icon', label: '图标', - minWidth: 100, + minWidth: 80, render: scope => { const customIcons: { [key: string]: any } = Icons const iconKey = scope.row.icon; // diff --git a/frontend/src/views/authority/role/components/rolePopup.vue b/frontend/src/views/authority/role/components/rolePopup.vue index 95f061b..86ee722 100644 --- a/frontend/src/views/authority/role/components/rolePopup.vue +++ b/frontend/src/views/authority/role/components/rolePopup.vue @@ -133,6 +133,8 @@ const close = () => { // 打开弹窗,可能是新增,也可能是编辑 const open = async (sign: string, data: Role.RoleBO) => { + // 重置表单 + dialogFormRef.value?.resetFields() titleType.value = sign dialogVisible.value = true diff --git a/frontend/src/views/authority/role/components/roleResourcePopup.vue b/frontend/src/views/authority/role/components/roleResourcePopup.vue index 2605152..74fc1f6 100644 --- a/frontend/src/views/authority/role/components/roleResourcePopup.vue +++ b/frontend/src/views/authority/role/components/roleResourcePopup.vue @@ -98,15 +98,20 @@ const close = () => { dialogFormRef.value?.validate(async (valid: boolean) => { if (valid) { if (formContent.value.id) { - // 获取勾选的节点 ID + // 获取半选中的节点 ID + const halfCheckedKeys = treeRef.value?.getHalfCheckedKeys() || []; + // 获取全选中的节点 ID const checkedKeys = treeRef.value?.getCheckedKeys() || []; - + // 将两个数组合并 + const allCheckedKeys = [...halfCheckedKeys, ...checkedKeys]; + // 将 checkedKeys 转换为字符串数组 - const checkedKeysAsString: string[] = checkedKeys.map(key => String(key)); + const checkedKeysAsString: string[] = allCheckedKeys.map(key => String(key)); // 假设 RoleFunctionId 是一个对象,且需要 id 属性 const roleFunctionIdObject: Role.RoleFunctionId = { id: checkedKeysAsString }; + const result = await assignFunction(formContent.value,roleFunctionIdObject); if(result.code != 'A0000'){ ElMessage.error({ message: result.message}) @@ -128,6 +133,8 @@ const close = () => { // 打开弹窗,可能是新增,也可能是编辑 const open = async (sign: string, data: Role.RoleBO, AllFunction: Function.ResFunction[]) => { + // 重置表单 + dialogFormRef.value?.resetFields() // 重置树状结构 functionList.value = [] checkedKeysRef.value = [] diff --git a/frontend/src/views/authority/user/components/passWordPopup.vue b/frontend/src/views/authority/user/components/passWordPopup.vue index 90cbda3..0dff840 100644 --- a/frontend/src/views/authority/user/components/passWordPopup.vue +++ b/frontend/src/views/authority/user/components/passWordPopup.vue @@ -121,6 +121,8 @@ const rules: Ref>> = ref({ // 打开弹窗是编辑 const open = async ( data: User.ResPassWordUser) => { + // 重置表单 + dialogFormRef.value?.resetFields() dialogVisible.value = true if (data.id) { formContent.value = { ...data } diff --git a/frontend/src/views/authority/user/components/userPopup.vue b/frontend/src/views/authority/user/components/userPopup.vue index 29959db..3804a81 100644 --- a/frontend/src/views/authority/user/components/userPopup.vue +++ b/frontend/src/views/authority/user/components/userPopup.vue @@ -151,6 +151,8 @@ // 打开弹窗,可能是新增,也可能是编辑 const open = async (sign: string, data: User.ResUser,roleParams: Role.RoleBO[]) => { + // 重置表单 + dialogFormRef.value?.resetFields() // 获取角色列表 roleList.value = roleParams titleType.value = sign diff --git a/frontend/src/views/authority/user/index.vue b/frontend/src/views/authority/user/index.vue index 8092689..56bdddb 100644 --- a/frontend/src/views/authority/user/index.vue +++ b/frontend/src/views/authority/user/index.vue @@ -8,8 +8,8 @@