diff --git a/frontend/src/directives/modules/auth.ts b/frontend/src/directives/modules/auth.ts index 3872e4b..8730c93 100644 --- a/frontend/src/directives/modules/auth.ts +++ b/frontend/src/directives/modules/auth.ts @@ -10,8 +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) + // 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/Header/components/Avatar.vue b/frontend/src/layouts/components/Header/components/Avatar.vue index 7239ef9..603082c 100644 --- a/frontend/src/layouts/components/Header/components/Avatar.vue +++ b/frontend/src/layouts/components/Header/components/Avatar.vue @@ -56,11 +56,14 @@ import Message from "./components/Message.vue"; import Fullscreen from "./components/Fullscreen.vue"; import { useAuthStore } from "@/stores/modules/auth"; import {useDictStore} from "@/stores/modules/dict"; +import { useModeStore } from "@/stores/modules/mode"; const userStore = useUserStore(); const dictStore = useDictStore(); const username = computed(() => userStore.userInfo.name); const router = useRouter(); const authStore = useAuthStore(); +const modeStore = useModeStore(); + // 退出登录 const logout = () => { ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", { @@ -74,6 +77,7 @@ const logout = () => { userStore.setToken(""); userStore.setUserInfo({name: ""}); dictStore.setDictData([]); + modeStore.setCurrentMode(''); // 3.重定向到登陆页 router.replace(LOGIN_URL); ElMessage.success("退出登录成功!"); diff --git a/frontend/src/routers/index.ts b/frontend/src/routers/index.ts index eb3a989..3d11a40 100644 --- a/frontend/src/routers/index.ts +++ b/frontend/src/routers/index.ts @@ -69,7 +69,7 @@ router.beforeEach(async (to, from, next) => { await initDynamicRouter() return next({ ...to, replace: true }) } - console.log(to) + //console.log(to) // 7.存储 routerName 做按钮权限筛选 authStore.setRouteName(to.name as string) diff --git a/frontend/src/views/authority/resource/components/resourcePopup.vue b/frontend/src/views/authority/resource/components/resourcePopup.vue index 2a48c80..211082e 100644 --- a/frontend/src/views/authority/resource/components/resourcePopup.vue +++ b/frontend/src/views/authority/resource/components/resourcePopup.vue @@ -21,6 +21,7 @@ diff --git a/frontend/src/views/authority/role/components/roleResourcePopup.vue b/frontend/src/views/authority/role/components/roleResourcePopup.vue index 74fc1f6..e8db775 100644 --- a/frontend/src/views/authority/role/components/roleResourcePopup.vue +++ b/frontend/src/views/authority/role/components/roleResourcePopup.vue @@ -146,10 +146,14 @@ const open = async (sign: string, data: Role.RoleBO, AllFunction: Function.ResFu const allIds = getAllIds(AllFunction); // 匹配 roleFunctions 中的 id 并设置 checkedKeys const checkedKeys = allIds.filter(id => roleFunctions.some(roleFunc => roleFunc.id === id)); + + // 过滤出叶子节点 + const leafCheckedKeys = filterLeafNodes(AllFunction, checkedKeys); + // 设置 functionList 和 checkedKeys functionList.value = AllFunction; - checkedKeysRef.value = checkedKeys; - + checkedKeysRef.value = leafCheckedKeys; + // nextTick(() => { // // 触发一次更新,确保表单中的数据被更新 // dialogFormRef.value?.validate(); @@ -166,14 +170,32 @@ const open = async (sign: string, data: Role.RoleBO, AllFunction: Function.ResFu } } +const filterLeafNodes = (functions: Function.ResFunction[], checkedKeys: string[]): string[] => { + const leafNodes: string[] = []; + const isLeafNode = (func: Function.ResFunction) => !func.children || func.children.length === 0; + const traverse = (funcs: Function.ResFunction[]) => { + for (const func of funcs) { + if (isLeafNode(func)) { + if (checkedKeys.includes(func.id)) { + leafNodes.push(func.id); + } + } else { + traverse(func.children); + } + } + }; + + traverse(functions); + return leafNodes; +}; const getAllIds = (functions: Function.ResFunction[]): string[] => { const ids: string[] = []; const traverse = (func: Function.ResFunction) => { ids.push(func.id); if (func.children && func.children.length > 0) { - func.children.forEach(child => traverse(child)); + func.children.forEach((child: any) => traverse(child)); } }; diff --git a/frontend/src/views/authority/role/index.vue b/frontend/src/views/authority/role/index.vue index 6398eb3..fdd3906 100644 --- a/frontend/src/views/authority/role/index.vue +++ b/frontend/src/views/authority/role/index.vue @@ -8,17 +8,17 @@ diff --git a/frontend/src/views/authority/user/index.vue b/frontend/src/views/authority/user/index.vue index 56bdddb..20a1a94 100644 --- a/frontend/src/views/authority/user/index.vue +++ b/frontend/src/views/authority/user/index.vue @@ -8,17 +8,17 @@ diff --git a/frontend/src/views/home/tabs/model.vue b/frontend/src/views/home/tabs/model.vue index 8b98dc7..3773a4b 100644 --- a/frontend/src/views/home/tabs/model.vue +++ b/frontend/src/views/home/tabs/model.vue @@ -41,27 +41,30 @@ const router = useRouter(); const modeList = [ { name: "模拟式模块", + code:"模拟式", subName: "未启用模拟式检测计划", img: "/src/assets/images/dashboard/1.svg", isActive: true, }, { name: "数字式模块", + code:"数字式", subName: "启用数字检测计划", img: "/src/assets/images/dashboard/2.svg", - isActive: false, + isActive: true, }, { name: "比对式模块", + code:"比对式", subName: "启用比对式检测计划", img: "/src/assets/images/dashboard/3.svg", - isActive: false, + isActive: true, }, ]; const handelOpen = async (item: any) => { await authStore.setShowMenu(); - modeStore.setCurrentMode(item.name); // 将模式名称存入 store + modeStore.setCurrentMode(item.code); // 将模式code存入 store return; if (isActive) { router.push({ path: "/static" }); diff --git a/frontend/src/views/machine/device/index.vue b/frontend/src/views/machine/device/index.vue index 097d3ae..489200c 100644 --- a/frontend/src/views/machine/device/index.vue +++ b/frontend/src/views/machine/device/index.vue @@ -8,18 +8,18 @@ diff --git a/frontend/src/views/machine/testScript/index.vue b/frontend/src/views/machine/testScript/index.vue index ce3b88f..db927e0 100644 --- a/frontend/src/views/machine/testScript/index.vue +++ b/frontend/src/views/machine/testScript/index.vue @@ -16,8 +16,8 @@ @@ -66,7 +66,7 @@ const columns = reactive[]>([ }, { prop: 'standardTime', - label: '标准推行时间', + label: '标准推行年份', minWidth: 150, }, { diff --git a/frontend/src/views/system/base/index.vue b/frontend/src/views/system/base/index.vue index c6e9f85..ce9e695 100644 --- a/frontend/src/views/system/base/index.vue +++ b/frontend/src/views/system/base/index.vue @@ -6,7 +6,7 @@ 检测配置 - + @@ -14,12 +14,12 @@ - + - + 有效数据配置 - - + + - + - + - + @@ -63,10 +63,117 @@ - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
- +
+ + + + + + + + + + + + + + + + + + 立即进行备份 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
@@ -78,7 +185,7 @@ import PqPopup from '@/views/system/dictionary/dictPq/components/pqPopup.vue' import { useDictStore } from '@/stores/modules/dict' import { useHandleData } from '@/hooks/useHandleData' - import { computed, onMounted, reactive, Ref, ref } from 'vue' + import { computed, onMounted, reactive, Ref, ref, watch } from 'vue' import {type Base } from '@/api/system/base/interface' import {type VersionRegister } from '@/api/system/versionRegister/interface' import {getTestConfig,updateTestConfig } from '@/api/system/base/index' @@ -86,10 +193,33 @@ import { ElMessage, FormItemRule } from 'element-plus' import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store + const modeStore = useModeStore(); const dictStore = useDictStore() const dialogFormRef = ref() const mode = ref() + const IsMode = ref(false) + const TestConfigList = ref() + const RegResList = ref() + + +// 初始化时获取 +onMounted(async () => { + mode.value =modeStore.currentMode;//pinia中获取当前是那个模块进来的 + const response = await getTestConfig() + TestConfigForm.value = response.data as unknown as Base.ResTestConfig + const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== mode.value)?.id//获取数据字典中对应的id + RegResForm.value.type = patternId || ''; + const response2 = await getRegRes(RegResForm.value) + RegResForm.value = response2.data as unknown as VersionRegister.ResSys_Reg_Res + //只有比对式有录波 + if(mode.value == '比对式'){ + IsMode.value = false + }else{ + IsMode.value = true + } + }) + const TestConfigForm = ref({ id: '', autoGenerate: 0, @@ -119,7 +249,6 @@ flicker: 1, }) - // 定义弹出组件元信息 const rules = computed(() =>{ const baseRules : Ref>> = ref({ @@ -149,20 +278,8 @@ }) - const TestConfigList = ref() - const RegResList = ref() - // 初始化时获取 - onMounted(async () => { - mode.value =modeStore.currentMode.replace('模块', '');//pinia中获取当前是那个模块进来的,临时处理去除模块两字 - const response = await getTestConfig() - TestConfigForm.value = response.data as unknown as Base.ResTestConfig - //console.log(mode) - const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== mode.value)?.id//获取数据字典中对应的id - RegResForm.value.type = patternId || ''; - const response2 = await getRegRes(RegResForm.value) - RegResForm.value = response2.data as unknown as VersionRegister.ResSys_Reg_Res - }) + const submitForm = async () => { try { diff --git a/frontend/src/views/system/dictionary/dictData/index.vue b/frontend/src/views/system/dictionary/dictData/index.vue index b540ef3..1bfb75c 100644 --- a/frontend/src/views/system/dictionary/dictData/index.vue +++ b/frontend/src/views/system/dictionary/dictData/index.vue @@ -7,17 +7,17 @@
diff --git a/frontend/src/views/system/dictionary/dictPq/components/pqPopup.vue b/frontend/src/views/system/dictionary/dictPq/components/pqPopup.vue index 3bf79cf..9464a13 100644 --- a/frontend/src/views/system/dictionary/dictPq/components/pqPopup.vue +++ b/frontend/src/views/system/dictionary/dictPq/components/pqPopup.vue @@ -265,4 +265,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/frontend/src/views/system/dictionary/dictPq/index.vue b/frontend/src/views/system/dictionary/dictPq/index.vue index 91c9b07..6542dad 100644 --- a/frontend/src/views/system/dictionary/dictPq/index.vue +++ b/frontend/src/views/system/dictionary/dictPq/index.vue @@ -6,16 +6,16 @@ :request-api='getDictPqList' > diff --git a/frontend/src/views/system/dictionary/dictTree/index.vue b/frontend/src/views/system/dictionary/dictTree/index.vue index a8ddd3e..90c5706 100644 --- a/frontend/src/views/system/dictionary/dictTree/index.vue +++ b/frontend/src/views/system/dictionary/dictTree/index.vue @@ -8,13 +8,13 @@ > diff --git a/frontend/src/views/system/dictionary/dictType/index.vue b/frontend/src/views/system/dictionary/dictType/index.vue index 7dfc2b9..03fc6ec 100644 --- a/frontend/src/views/system/dictionary/dictType/index.vue +++ b/frontend/src/views/system/dictionary/dictType/index.vue @@ -6,18 +6,18 @@ :request-api='getDictTypeList' >