From ea38b4eb21cca72bdd380eb89b28d1a417637e04 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Fri, 28 Mar 2025 09:31:46 +0800 Subject: [PATCH] =?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/package.json | 1 - frontend/src/api/index.ts | 2 +- .../components/Header/components/Avatar.vue | 2 +- frontend/src/stores/interface/index.ts | 72 +++++++++---------- frontend/src/stores/modules/user.ts | 2 +- .../views/home/components/channelsTest.vue | 9 ++- .../src/views/home/components/factorTest.vue | 6 +- .../src/views/home/components/testPopup.vue | 14 ++-- 8 files changed, 59 insertions(+), 49 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index a31c982..0cbf3b6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -76,7 +76,6 @@ "vite-plugin-compression": "^0.5.1", "vite-plugin-eslint": "^1.8.1", "vite-plugin-html": "^3.2.0", - "vite-plugin-node-polyfills": "^0.22.0", "vite-plugin-pwa": "^0.16.5", "vite-plugin-svg-icons": "^2.0.1", "vue-tsc": "^2.0.21" diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 8f932d5..670dd06 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -89,7 +89,7 @@ class RequestHttp { userStore.setAccessToken('') userStore.setRefreshToken('') userStore.setIsRefreshToken(false) - userStore.setUserInfo({ name: '' }) + userStore.setUserInfo({ id:'',name: '' }) await router.replace(LOGIN_URL) if(isFirst){//临时处理token失效弹窗多次 ElMessage.error(data.message) diff --git a/frontend/src/layouts/components/Header/components/Avatar.vue b/frontend/src/layouts/components/Header/components/Avatar.vue index de46406..1100a0a 100644 --- a/frontend/src/layouts/components/Header/components/Avatar.vue +++ b/frontend/src/layouts/components/Header/components/Avatar.vue @@ -99,7 +99,7 @@ const logout = () => { // 2.清除 Token userStore.setAccessToken(""); userStore.setRefreshToken(""); - userStore.setUserInfo({name: ""}); + userStore.setUserInfo({id: "", name: ""}); userStore.setIsRefreshToken(false) dictStore.setDictData([]); modeStore.setCurrentMode(''); diff --git a/frontend/src/stores/interface/index.ts b/frontend/src/stores/interface/index.ts index 9ec75a1..6a67089 100644 --- a/frontend/src/stores/interface/index.ts +++ b/frontend/src/stores/interface/index.ts @@ -6,60 +6,60 @@ export type LanguageType = 'zh' | 'en' | null; /* GlobalState */ export interface GlobalState { - layout: LayoutType; - assemblySize: AssemblySizeType; - language: LanguageType; - maximize: boolean; - primary: string; - isDark: boolean; - isGrey: boolean; - isWeak: boolean; - asideInverted: boolean; - headerInverted: boolean; - isCollapse: boolean; - accordion: boolean; - breadcrumb: boolean; - breadcrumbIcon: boolean; - tabs: boolean; - tabsIcon: boolean; - footer: boolean; + layout: LayoutType; + assemblySize: AssemblySizeType; + language: LanguageType; + maximize: boolean; + primary: string; + isDark: boolean; + isGrey: boolean; + isWeak: boolean; + asideInverted: boolean; + headerInverted: boolean; + isCollapse: boolean; + accordion: boolean; + breadcrumb: boolean; + breadcrumbIcon: boolean; + tabs: boolean; + tabsIcon: boolean; + footer: boolean; } /* UserState */ export interface UserState { - accessToken: string; - refreshToken: string; - isRefreshToken: boolean; - userInfo: { name: string }; + accessToken: string; + refreshToken: string; + isRefreshToken: boolean; + userInfo: { id: string, name: string }; } /* tabsMenuProps */ export interface TabsMenuProps { - icon: string; - title: string; - path: string; - name: string; - close: boolean; - isKeepAlive: boolean; - unshift?: boolean; + icon: string; + title: string; + path: string; + name: string; + close: boolean; + isKeepAlive: boolean; + unshift?: boolean; } /* TabsState */ export interface TabsState { - tabsMenuList: TabsMenuProps[]; + tabsMenuList: TabsMenuProps[]; } /* AuthState */ export interface AuthState { - routeName: string; - authButtonList: { - [key: string]: string[]; - }; - authMenuList: Menu.MenuOptions[]; - showMenuFlag: boolean; + routeName: string; + authButtonList: { + [key: string]: string[]; + }; + authMenuList: Menu.MenuOptions[]; + showMenuFlag: boolean; } /* KeepAliveState */ export interface KeepAliveState { - keepAliveName: string[]; + keepAliveName: string[]; } diff --git a/frontend/src/stores/modules/user.ts b/frontend/src/stores/modules/user.ts index 79fd3ab..d52fc5a 100644 --- a/frontend/src/stores/modules/user.ts +++ b/frontend/src/stores/modules/user.ts @@ -9,7 +9,7 @@ export const useUserStore = defineStore({ accessToken: "", refreshToken: "", isRefreshToken:false, - userInfo: { name: "admin" }, + userInfo: {id:"", name: "admin" }, }), getters: {}, actions: { diff --git a/frontend/src/views/home/components/channelsTest.vue b/frontend/src/views/home/components/channelsTest.vue index 80213f0..1d1c7b9 100644 --- a/frontend/src/views/home/components/channelsTest.vue +++ b/frontend/src/views/home/components/channelsTest.vue @@ -98,6 +98,7 @@ import { getCoefficientCheck } from '@/api/home/channelsTest/index' import type { ChannelsTest } from '@/api/home/interface/channelsTest'; import type { Plan } from '@/api/plan/interface'; import { fa } from 'element-plus/es/locale'; +import {useUserStore} from "@/stores/modules/user"; const activeIndex = ref(0) @@ -138,6 +139,7 @@ const props = defineProps({ default: () => ({}) } }) +const userStore = useUserStore() const tableDataMap = new Map>([]); const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish'); const webMsgSend = toRef(props, 'webMsgSend'); @@ -786,9 +788,10 @@ const handleSubmit = async () => { userPageId: "cdf", devIds:devIdArray.value, planId:planId.value, - errorSysId: select_Plan.value?.errorSysId, -     scriptId: select_Plan.value?.scriptId, - operateType:'0' // '0'为预检测、‘1‘为正式检测 + errorSysId:select_Plan.value?.errorSysId, + scriptId:select_Plan.value?.scriptId, + operateType:'0', // '0'为预检测、‘1‘为正式检测 + userId:userStore.userInfo.id }) active.value++; diff --git a/frontend/src/views/home/components/factorTest.vue b/frontend/src/views/home/components/factorTest.vue index 105cab8..e4d04d5 100644 --- a/frontend/src/views/home/components/factorTest.vue +++ b/frontend/src/views/home/components/factorTest.vue @@ -99,6 +99,7 @@ import {getCoefficientCheck} from '@/api/home/channelsTest/index' import type {ChannelsTest} from '@/api/home/interface/channelsTest'; import type {Plan} from '@/api/plan/interface'; import {useCheckStore} from "@/stores/modules/check"; +import {useUserStore} from "@/stores/modules/user"; const checkStore = useCheckStore() const activeIndex = ref(0) @@ -143,7 +144,7 @@ const props = defineProps({ default: () => ({}) }, }) - +const userStore = useUserStore() const testStatus = toRef(props, 'testStatus'); const tableDataMap = new Map>([]); const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish'); @@ -720,7 +721,8 @@ const handleSubmit = async () => { planId: planId.value, errorSysId: select_Plan.value?.errorSysId, scriptId: select_Plan.value?.scriptId, - operateType: '0' // '0'为预检测、‘1‘为正式检测 + operateType: '0', // '0'为预检测、‘1‘为正式检测 + userId:userStore.userInfo.id }) active.value++; diff --git a/frontend/src/views/home/components/testPopup.vue b/frontend/src/views/home/components/testPopup.vue index 810aaa3..fafe423 100644 --- a/frontend/src/views/home/components/testPopup.vue +++ b/frontend/src/views/home/components/testPopup.vue @@ -93,7 +93,9 @@ import test from './test.vue' import socketClient from '@/utils/webSocketClient'; import {useCheckStore} from "@/stores/modules/check"; import {pauseTest, resumeTest, startPreTest} from '@/api/socket/socket' +import {useUserStore} from "@/stores/modules/user"; +const userStore = useUserStore() const checkStore = useCheckStore(); const nextStepText = ref('下一步'); const dialogVisible = ref(false) @@ -210,7 +212,8 @@ const handleSubmit = () => { userPageId: "cdf", devIds: deviceIds, planId: planId, - operateType: '1' // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检 + operateType: '1', // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检 + userId:userStore.userInfo.id }).then(res => { if (res.code === 'A001014') { ElMessageBox.alert('装置配置异常', '检测失败', { @@ -238,7 +241,8 @@ const handleSubmit = () => { userPageId: "cdf", devIds: deviceIds, planId: planId, - operateType: checkStore.reCheckType ==1 ?'2':'8' // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检 + operateType: checkStore.reCheckType ==1 ?'2':'8', // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检 + userId:userStore.userInfo.id }).then(res => { console.log(res) if (res.code === 'A001014') { @@ -360,7 +364,8 @@ const sendResume = () => { userPageId: "cdf", devIds: checkStore.devices.map((item) => item.deviceId), planId: checkStore.plan.id, - operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检 + operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检 + userId:userStore.userInfo.id }) Object.assign(webMsgSend.value, { requestId: 'Resume_Success' @@ -373,7 +378,8 @@ const sendReCheck = () => { userPageId: "cdf", devIds: checkStore.devices.map((item) => item.deviceId), planId: checkStore.plan.id, - operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检 + operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检 + userId:userStore.userInfo.id }).then(res => { console.log(res) if (res.code === 'A001014') {