From e799dd2f08b79437d12c7777c243a061237c3a26 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Thu, 13 Feb 2025 21:02:34 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E7=A7=BB=E9=99=A4headers=E4=B8=AD=E7=9A=84?= =?UTF-8?q?Refresh-Token=EF=BC=8C=E6=B7=BB=E5=8A=A0Is-Refresh-Token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .merge_file_uAPEJh | 112 ------------------------- frontend/src/api/index.ts | 4 +- frontend/src/stores/interface/index.ts | 4 +- frontend/src/stores/modules/user.ts | 4 + 4 files changed, 10 insertions(+), 114 deletions(-) delete mode 100644 .merge_file_uAPEJh diff --git a/.merge_file_uAPEJh b/.merge_file_uAPEJh deleted file mode 100644 index e459224..0000000 --- a/.merge_file_uAPEJh +++ /dev/null @@ -1,112 +0,0 @@ -import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from "axios"; -import { showFullScreenLoading, tryHideFullScreenLoading } from "@/components/Loading/fullScreen"; -import { LOGIN_URL } from "@/config"; -import { ElMessage } from "element-plus"; -import { ResultData } from "@/api/interface"; -import { ResultEnum } from "@/enums/httpEnum"; -import { checkStatus } from "./helper/checkStatus"; -import { useUserStore } from "@/stores/modules/user"; -import router from "@/routers"; - -export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig { - loading?: boolean; -} - -const config = { - // 默认地址请求地址,可在 .env.** 文件中修改 - baseURL: import.meta.env.VITE_API_URL as string, - // 设置超时时间 - timeout: ResultEnum.TIMEOUT as number, - // 跨域时候允许携带凭证 - withCredentials: true, - // post请求指定数据类型以及编码 - headers: { 'Content-Type': 'application/json;charset=utf-8' } -}; - -class RequestHttp { - service: AxiosInstance; - public constructor(config: AxiosRequestConfig) { - // 创建实例 - this.service = axios.create(config); - - /** - * @description 请求拦截器 - * 客户端发送请求 -> [请求拦截器] -> 服务器 - * token校验(JWT) : 接受服务器返回的 token,存储到 vuex/pinia/本地储存当中 - */ - this.service.interceptors.request.use( - (config: CustomAxiosRequestConfig) => { - const userStore = useUserStore(); - // 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制 - config.loading ?? (config.loading = true); - config.loading && showFullScreenLoading(); - if (config.headers && typeof config.headers.set === "function") { - config.headers.set("x-access-token", userStore.token); - } - return config; - }, - (error: AxiosError) => { - return Promise.reject(error); - } - ); - - /** - * @description 响应拦截器 - * 服务器换返回信息 -> [拦截统一处理] -> 客户端JS获取到信息 - */ - this.service.interceptors.response.use( - (response: AxiosResponse) => { - const { data } = response; - const userStore = useUserStore(); - tryHideFullScreenLoading(); - // 登陆失效 - if (data.code == ResultEnum.OVERDUE) { - userStore.setToken(""); - router.replace(LOGIN_URL); - ElMessage.error(data.message); - return Promise.reject(data); - } - // 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错) - if (data.code && data.code !== ResultEnum.SUCCESS) { - ElMessage.error(data.message); - return Promise.reject(data); - } - // 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑) - return data; - }, - async (error: AxiosError) => { - const { response } = error; - tryHideFullScreenLoading(); - // 请求超时 && 网络错误单独判断,没有 response - if (error.message.indexOf("timeout") !== -1) ElMessage.error("请求超时!请您稍后重试"); - if (error.message.indexOf("Network Error") !== -1) ElMessage.error("网络错误!请您稍后重试"); - // 根据服务器响应的错误状态码,做不同的处理 - if (response) checkStatus(response.status); - // 服务器结果都没有返回(可能服务器错误可能客户端断网),断网处理:可以跳转到断网页面 - if (!window.navigator.onLine) router.replace("/500"); - return Promise.reject(error); - } - ); - } - - /** - * @description 常用请求方法封装 - */ - get(url: string, params?: object, _object = {}): Promise> { - return this.service.get(url, { params, ..._object }); - } - post(url: string, params?: object | string, _object = {}): Promise> { - return this.service.post(url, params, _object); - } - put(url: string, params?: object, _object = {}): Promise> { - return this.service.put(url, params, _object); - } - delete(url: string, params?: any, _object = {}): Promise> { - return this.service.delete(url, { params, ..._object }); - } - download(url: string, params?: object, _object = {}): Promise { - return this.service.post(url, params, { ..._object, responseType: "blob" }); - } -} - -export default new RequestHttp(config); diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 65b7fb4..fc57d06 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -45,7 +45,7 @@ class RequestHttp { config.loading && showFullScreenLoading() if (config.headers && typeof config.headers.set === 'function') { config.headers.set('Authorization', 'Bearer ' + userStore.accessToken) - config.headers.set('Refresh-Token', userStore.refreshToken) + config.headers.set('Is-Refresh-Token', userStore.isRefreshToken+"") } return config }, @@ -67,6 +67,8 @@ class RequestHttp { if(data.code === ResultEnum.ACCESSTOKEN_EXPIRED){ // 用长token去换短token + userStore.setAccessToken(userStore.refreshToken) + userStore.setIsRefreshToken(true) const result = await refreshToken() if (result) { //获取新token成功的话 // 有新的token后,重新请求 diff --git a/frontend/src/stores/interface/index.ts b/frontend/src/stores/interface/index.ts index 7f7d416..9ec75a1 100644 --- a/frontend/src/stores/interface/index.ts +++ b/frontend/src/stores/interface/index.ts @@ -27,7 +27,9 @@ export interface GlobalState { /* UserState */ export interface UserState { - token: string; + accessToken: string; + refreshToken: string; + isRefreshToken: boolean; userInfo: { name: string }; } diff --git a/frontend/src/stores/modules/user.ts b/frontend/src/stores/modules/user.ts index ddd9db3..ea186f3 100644 --- a/frontend/src/stores/modules/user.ts +++ b/frontend/src/stores/modules/user.ts @@ -8,6 +8,7 @@ export const useUserStore = defineStore({ state: (): UserState => ({ accessToken: "", refreshToken: "", + isRefreshToken:false, userInfo: { name: "admin" }, }), getters: {}, @@ -19,6 +20,9 @@ export const useUserStore = defineStore({ setRefreshToken(refreshToken: string) { this.refreshToken = refreshToken; }, + setIsRefreshToken(isRefreshToken: boolean) { + this.isRefreshToken = isRefreshToken; + }, // Set setUserInfo setUserInfo(userInfo: UserState["userInfo"]) { this.userInfo = userInfo; From 305c30d725d5d64b812de0781e7011be969591da Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Fri, 14 Feb 2025 09:16:07 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/machine/device/components/devicePopup.vue | 10 ++++++++++ frontend/src/views/plan/planList/index.vue | 3 --- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/machine/device/components/devicePopup.vue b/frontend/src/views/machine/device/components/devicePopup.vue index 625b57d..eca74f9 100644 --- a/frontend/src/views/machine/device/components/devicePopup.vue +++ b/frontend/src/views/machine/device/components/devicePopup.vue @@ -428,10 +428,20 @@ const handleDevTypeChange = (value: string) => { formContent.value.devVolt = dev.devVolt; // 默认值为1 formContent.value.icdId = dev.icd formContent.value.power = dev.power + if(dev.name.includes('882B')){ + formContent.value.ip = '172.17.102.220' + }else if(dev.name.includes('882A')){ + formContent.value.ip = '172.17.102.221' + }else{ + formContent.value.ip = '172.17.102.200' + } + + } else { formContent.value.devChns = 1; // 默认值为1 formContent.value.devCurr = 1; // 默认值为1 formContent.value.devVolt = 57.74; // 默认值为1 + formContent.value.ip = '172.17.102.200' } } diff --git a/frontend/src/views/plan/planList/index.vue b/frontend/src/views/plan/planList/index.vue index ca3880e..ab6e731 100644 --- a/frontend/src/views/plan/planList/index.vue +++ b/frontend/src/views/plan/planList/index.vue @@ -394,9 +394,6 @@ const showDeviceOpen = (row: Partial = {}) => { const myDict = new Map(); -// 引用图表容器 -const chartContainer = ref(null); -let myChart: echarts.ECharts | null = null; const statisticalAnalysis = async (row: Partial = {}) => { // const response = await getTestConfig() as unknown as Base.ResTestConfig // const maxTime= response.data.maxTime//检测最大次数 From 6842260f595a6b2199c2751d710c5c11ed4a0798 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Fri, 14 Feb 2025 09:57:26 +0800 Subject: [PATCH 3/9] =?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/index.ts | 6 +++--- .../src/layouts/components/Header/components/Avatar.vue | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index fc57d06..10f7550 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -74,6 +74,7 @@ class RequestHttp { // 有新的token后,重新请求 userStore.setAccessToken(result.data.accessToken) userStore.setRefreshToken(result.data.refreshToken) + userStore.setIsRefreshToken(false) response.config.headers.Authorization = `Bearer ${result.data.accessToken}`//重新请求前需要将更新后的新token更换掉之前无效的token,不然会死循环 const resp = await this.service.request(response.config) return resp @@ -86,11 +87,10 @@ class RequestHttp { console.log("登陆失效") userStore.setAccessToken('') userStore.setRefreshToken('') + userStore.setIsRefreshToken(false) userStore.setUserInfo({ name: '' }) router.replace(LOGIN_URL) - if(data.code != ResultEnum.OVERDUE){//临时处理token失效弹窗多次 - ElMessage.error(data.message) - }else if(isFirst){ + if(isFirst){//临时处理token失效弹窗多次 ElMessage.error(data.message) isFirst = false } diff --git a/frontend/src/layouts/components/Header/components/Avatar.vue b/frontend/src/layouts/components/Header/components/Avatar.vue index 459f66b..cd893c8 100644 --- a/frontend/src/layouts/components/Header/components/Avatar.vue +++ b/frontend/src/layouts/components/Header/components/Avatar.vue @@ -77,6 +77,7 @@ const logout = () => { userStore.setAccessToken(""); userStore.setRefreshToken(""); userStore.setUserInfo({name: ""}); + userStore.setIsRefreshToken(false) dictStore.setDictData([]); modeStore.setCurrentMode(''); AppSceneStore.setCurrentMode(''); From 3bb9cec08a49f8a4eda7651da9246afdd8124aaf Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Fri, 14 Feb 2025 10:31:16 +0800 Subject: [PATCH 4/9] =?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/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 10f7550..1a67bc3 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -39,6 +39,7 @@ class RequestHttp { */ this.service.interceptors.request.use( (config: CustomAxiosRequestConfig) => { + isFirst = true const userStore = useUserStore() // 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制 config.loading ?? (config.loading = true) @@ -89,7 +90,7 @@ class RequestHttp { userStore.setRefreshToken('') userStore.setIsRefreshToken(false) userStore.setUserInfo({ name: '' }) - router.replace(LOGIN_URL) + await router.replace(LOGIN_URL) if(isFirst){//临时处理token失效弹窗多次 ElMessage.error(data.message) isFirst = false From 40f18bbdf8791f6e8f84820925c52d61616cb38a Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Fri, 14 Feb 2025 10:39:00 +0800 Subject: [PATCH 5/9] =?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/views/log/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/log/index.vue b/frontend/src/views/log/index.vue index 4837d52..55a38bb 100644 --- a/frontend/src/views/log/index.vue +++ b/frontend/src/views/log/index.vue @@ -102,7 +102,7 @@ const columns = reactive[]>([ }, }, { - prop: 'operate_Type', + prop: 'operateType', label: '日志类型', width: 100, }, From f992637ad2d0155df708cc8b8a518fd5a6df274d Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Fri, 14 Feb 2025 10:59:21 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/components/dataCheckSingleChannelSingleTestPopup.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue index d36bdac..c6414c8 100644 --- a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue +++ b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue @@ -380,8 +380,8 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul chnList = resFormContent.chnList.map((item: { value: string, label: string }) => ({ value: item.value, - // label: item.value - label: item.label == '1' ? `${item.value}` : item.label == '2' ? `${item.value}(不符合)` : `${item.value}` + label: item.value + //label: item.label == '1' ? `${item.value}` : item.label == '2' ? `${item.value}(不符合)` : `${item.value}` })) let dataRuleName = dictStore.getDictData('Data_Rule').find(item => item.id == resFormContent.dataRule)?.name From 1d918f33350aa9b323480bcb0e32d43821903b29 Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Fri, 14 Feb 2025 11:44:19 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 1 + frontend/src/api/plan/plan.ts | 6 +++++- frontend/src/views/plan/planList/index.vue | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a9ddf8c..f9ac897 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "cSpell.words": [ + "Analyse", "CHNFACTOR", "CHNPACTOR", "Chns", diff --git a/frontend/src/api/plan/plan.ts b/frontend/src/api/plan/plan.ts index 03901a5..497fcbc 100644 --- a/frontend/src/api/plan/plan.ts +++ b/frontend/src/api/plan/plan.ts @@ -84,4 +84,8 @@ export const generateDevReport = (params: Device.ReqDevReportParams) => { // 装置检测报告下载 export const downloadDevData = (params: Device.ReqDevReportParams) => { return http.download(`/report/downloadReport`, params) -} \ No newline at end of file +} + +export const staticsAnalyse = (planId: string) => { + return http.download(`/adPlan/analyse?planId=${planId}`) +} diff --git a/frontend/src/views/plan/planList/index.vue b/frontend/src/views/plan/planList/index.vue index ab6e731..b294b76 100644 --- a/frontend/src/views/plan/planList/index.vue +++ b/frontend/src/views/plan/planList/index.vue @@ -68,7 +68,7 @@ import ImportExcel from "@/components/ImportExcel/index.vue"; import {useDownload} from "@/hooks/useDownload"; import {getTestConfig } from '@/api/system/base/index' import {type Base } from '@/api/system/base/interface' -import { getBoundPqDevList } from '@/api/plan/plan.ts' +import { getBoundPqDevList ,staticsAnalyse} from '@/api/plan/plan.ts' // defineOptions({ // name: 'planList' @@ -395,6 +395,8 @@ const showDeviceOpen = (row: Partial = {}) => { const myDict = new Map(); const statisticalAnalysis = async (row: Partial = {}) => { + await staticsAnalyse(row.id) + // const response = await getTestConfig() as unknown as Base.ResTestConfig // const maxTime= response.data.maxTime//检测最大次数 // const dev = await getBoundPqDevList({ 'planId': row.id }) From 95022f62a8bd2a36480f858a3814dc82484831e6 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Fri, 14 Feb 2025 13:30:50 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/plan/plan.ts | 5 +++-- frontend/src/views/plan/planList/index.vue | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/api/plan/plan.ts b/frontend/src/api/plan/plan.ts index 497fcbc..62418db 100644 --- a/frontend/src/api/plan/plan.ts +++ b/frontend/src/api/plan/plan.ts @@ -86,6 +86,7 @@ export const downloadDevData = (params: Device.ReqDevReportParams) => { return http.download(`/report/downloadReport`, params) } -export const staticsAnalyse = (planId: string) => { - return http.download(`/adPlan/analyse?planId=${planId}`) +export const staticsAnalyse = (params: { planId: string }) => { + return http.download(`/adPlan/analyse?planId=${params.planId}`) } + diff --git a/frontend/src/views/plan/planList/index.vue b/frontend/src/views/plan/planList/index.vue index b294b76..bdda78f 100644 --- a/frontend/src/views/plan/planList/index.vue +++ b/frontend/src/views/plan/planList/index.vue @@ -395,7 +395,7 @@ const showDeviceOpen = (row: Partial = {}) => { const myDict = new Map(); const statisticalAnalysis = async (row: Partial = {}) => { - await staticsAnalyse(row.id) + useDownload(staticsAnalyse,row.name+'分析结果', {planId:row.id}, false,'.xlsx') // const response = await getTestConfig() as unknown as Base.ResTestConfig // const maxTime= response.data.maxTime//检测最大次数 From e8de7b56d96d73976b8dad20e5e55d28c7f1388d Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Fri, 14 Feb 2025 16:22:45 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/system/dictionary/dictTree/index.ts | 10 ++++++++-- .../components/errorSystemPopup.vue | 18 +++++++++--------- .../testScript/components/testScriptPopup.vue | 10 +++++----- .../views/system/dictionary/dictTree/index.vue | 4 ++-- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/frontend/src/api/system/dictionary/dictTree/index.ts b/frontend/src/api/system/dictionary/dictTree/index.ts index 1b593e4..4abe467 100644 --- a/frontend/src/api/system/dictionary/dictTree/index.ts +++ b/frontend/src/api/system/dictionary/dictTree/index.ts @@ -1,10 +1,16 @@ import http from '@/api' import { type Dict } from '@/api/system/dictionary/interface' +import {c} from "vite/dist/node/types.d-aGj9QkWt"; //获取字典类型 -export const getDictTreeList = (params: Dict.ResDictTree) => { +export const getDictTreeByCode = (params: Dict.ResDictTree) => { + const code = params.code || ''; + return http.get(`/dictTree/getTreeByCode?code=${code}`) +} + +export const getDictTreeByName = (params: Dict.ResDictTree) => { const name = params.name || ''; - return http.get(`/dictTree/getTree?keyword=${name}`, params) + return http.get(`/dictTree/getTreeByName?name=${name}`) } //添加字典类型 diff --git a/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue b/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue index a1e29b2..435bdde 100644 --- a/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue +++ b/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue @@ -57,7 +57,7 @@ import { useDictStore } from '@/stores/modules/dict' import { type ErrorSystem } from '@/api/device/interface/error'; import ErrorSystemDetailTable from '@/views/machine/errorSystem/components/errorSystemDetailTable.vue'; - import {getDictTreeList} from '@/api/system/dictionary/dictTree' + import {getDictTreeByCode} from '@/api/system/dictionary/dictTree' import { type Dict } from '@/api/system/dictionary/interface'; // 定义弹出组件元信息 const dialogFormRef = ref() @@ -156,31 +156,31 @@ const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) => } // 封装提取第二层节点的逻辑 const loadSecondLevelOptions = async () => { - const dictCode = '误差体系指标项'; // 替换为实际需要的字典代码 - const dictCode2 = '脚本-误差'; // 替换为实际需要的字典代码 + const dictCode = 'Err_Sys_Items'; // 替换为实际需要的字典代码 + const dictCode2 = 'Script_Error'; // 替换为实际需要的字典代码 const resDictTree: Dict.ResDictTree = { - name: dictCode, + name: '', id: '', pid: '', pids: '', - code: '', + code: dictCode, sort: 0 }; const resDictTree2: Dict.ResDictTree = { - name: dictCode2, + name: '', id: '', pid: '', pids: '', - code: '', + code: dictCode2, sort: 0 }; // 并行请求两个字典树列表 const [result, result2] = await Promise.all([ - getDictTreeList(resDictTree), - getDictTreeList(resDictTree2) + getDictTreeByCode(resDictTree), + getDictTreeByCode(resDictTree2) ]); const allOptions = convertToOptions(result.data as Dict.ResDictTree[]); diff --git a/frontend/src/views/machine/testScript/components/testScriptPopup.vue b/frontend/src/views/machine/testScript/components/testScriptPopup.vue index 65421af..382fa5a 100644 --- a/frontend/src/views/machine/testScript/components/testScriptPopup.vue +++ b/frontend/src/views/machine/testScript/components/testScriptPopup.vue @@ -60,7 +60,7 @@ import { useDictStore } from '@/stores/modules/dict' import TestScriptDetail from '@/views/machine/testScript/components/testScriptDetail.vue' import { type TestScript } from '@/api/device/interface/testScript' import type { Dict } from '@/api/system/dictionary/interface' -import { getDictTreeList } from '@/api/system/dictionary/dictTree' +import { getDictTreeByCode } from '@/api/system/dictionary/dictTree' import type { CascaderOption } from 'element-plus' const modeId = ref() const secondLevelOptions: any[] = [] @@ -123,16 +123,16 @@ const save = () => { // 打开弹窗,可能是新增,也可能是编辑 const open = async (sign: string, row: any, currentMode: string, id: string) => { - const dictCode = '测试脚本字典表' // 替换为实际需要的字典代码 + const dictCode = 'Script_Indicator_Items' // 替换为实际需要的字典代码 const resDictTree: Dict.ResDictTree = { - name: dictCode, + name: '', id: '', pid: '', pids: '', - code: '', + code: dictCode, sort: 0 } - const result = await getDictTreeList(resDictTree) + const result = await getDictTreeByCode(resDictTree) const allOptions = convertToOptions(result.data as Dict.ResDictTree[]) secondLevelOptions.push(...(allOptions[0]?.children || [])) diff --git a/frontend/src/views/system/dictionary/dictTree/index.vue b/frontend/src/views/system/dictionary/dictTree/index.vue index 708bcf2..7c463e3 100644 --- a/frontend/src/views/system/dictionary/dictTree/index.vue +++ b/frontend/src/views/system/dictionary/dictTree/index.vue @@ -3,7 +3,7 @@ @@ -29,7 +29,7 @@ import {useDictStore} from '@/stores/modules/dict' import {useHandleData} from '@/hooks/useHandleData' import { - getDictTreeList, + getDictTreeByName, deleteDictTree, } from '@/api/system/dictionary/dictTree' import { reactive, ref } from 'vue'