diff --git a/.merge_file_uAPEJh b/.merge_file_uAPEJh new file mode 100644 index 0000000..e459224 --- /dev/null +++ b/.merge_file_uAPEJh @@ -0,0 +1,112 @@ +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/.env.development b/frontend/.env.development index 8f13788..282bdb3 100644 --- a/frontend/.env.development +++ b/frontend/.env.development @@ -20,5 +20,5 @@ VITE_API_URL=/api # 开发环境跨域代理,支持配置多个 VITE_PROXY=[["/api","http://192.168.1.124:18092/"]] -#VITE_PROXY=[["/api","http://192.168.1.125:18092/"]] +# VITE_PROXY=[["/api","http://192.168.1.125:18092/"]] # VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文 diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 99f931c..c42142b 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -108,15 +108,6 @@ class RequestHttp { download(url: string, params?: object, _object = {}): Promise { return this.service.post(url, params, { ..._object, responseType: "blob" }); } - /** - * @description 批量导入专用请求方法 - */ - batchImport(url: string, formData: FormData, _object = {}): Promise> { - return this.service.post(url, formData, { - ..._object, - headers: { 'Content-Type': 'multipart/form-data' } - }); - } } diff --git a/frontend/src/api/plan/autoTest.json b/frontend/src/api/plan/autoTest.json index 67ab275..1e087f3 100644 --- a/frontend/src/api/plan/autoTest.json +++ b/frontend/src/api/plan/autoTest.json @@ -3,7 +3,7 @@ "data": [ { "id": 0, - "name": "频率准备度检测", + "name": "频率准确度检测", "children": [ { "pid": 0, @@ -11,16 +11,22 @@ "name": "额定工作条件下的检测", "children": [ { + "scriptIdx":1, + "isChildNode":true, "pid": "0-1", "id": "0-1-1", "name": "输入:频率 42.5Hz..." }, { + "scriptIdx":2, + "isChildNode":true, "pid": "0-1", "id": "0-1-2", "name": "输入:频率 50.0Hz..." }, { + "scriptIdx":3, + "isChildNode":true, "pid": "0-1", "id": "0-1-3", "name": "输入:频率 50.05Hz..." @@ -33,16 +39,22 @@ "name": "电压对频率测量的影响", "children": [ { + "scriptIdx":4, + "isChildNode":true, "pid": "0-2", "id": "0-2-1", "name": "输入:频率 50.05Hz Ua =10%Un..." }, { + "scriptIdx":5, + "isChildNode":true, "pid": "0-2", "id": "0-2-1", "name": "输入:频率 51.05Hz Ua =10%Un..." }, { + "scriptIdx":6, + "isChildNode":true, "pid": "0-2", "id": "0-2-2", "name": "输入:频率 52.05Hz Ua =10%Un..." @@ -55,6 +67,8 @@ "name": "谐波对频率测量的影响", "children": [ { + "scriptIdx":7, + "isChildNode":true, "pid": "0-3", "id": "0-3-1", "name": "输入:频率 50.05Hz Ua =100%Un..." @@ -73,16 +87,22 @@ "name": "额定工作条件下的检测", "children": [ { + "scriptIdx":8, + "isChildNode":true, "pid": "1-1", "id": "1-1-1", "name": "输入:频率 42.5Hz..." }, { + "scriptIdx":9, + "isChildNode":true, "pid": "1-1", "id": "1-1-2", "name": "输入:频率 50.0Hz..." }, { + "scriptIdx":10, + "isChildNode":true, "pid": "1-1", "id": "1-1-3", "name": "输入:频率 50.05Hz..." @@ -95,16 +115,22 @@ "name": "电压对频率测量的影响", "children": [ { + "scriptIdx":11, + "isChildNode":true, "pid": "1-2", "id": "1-2-1", "name": "输入:频率 50.05Hz Ua =10%Un..." }, { + "scriptIdx":12, + "isChildNode":true, "pid": "1-2", "id": "1-2-1", "name": "输入:频率 51.05Hz Ua =10%Un..." }, { + "scriptIdx":13, + "isChildNode":true, "pid": "1-2", "id": "1-2-2", "name": "输入:频率 52.05Hz Ua =10%Un..." @@ -117,6 +143,8 @@ "name": "谐波对频率测量的影响", "children": [ { + "scriptIdx":14, + "isChildNode":true, "pid": "0-3", "id": "0-3-1", "name": "输入:频率 50.05Hz Ua =100%Un..." @@ -136,16 +164,19 @@ "name": "额定工作条件下的检测", "children": [ { + "scriptIdx":15, "pid": "2-1", "id": "2-1-1", "name": "输入:频率 42.5Hz..." }, { + "scriptIdx":16, "pid": "2-1", "id": "2-1-2", "name": "输入:频率 50.0Hz..." }, { + "scriptIdx":17, "pid": "2-1", "id": "2-1-3", "name": "输入:频率 50.05Hz..." @@ -158,16 +189,19 @@ "name": "电压对频率测量的影响", "children": [ { + "scriptIdx":18, "pid": "2-2", "id": "2-2-1", "name": "输入:频率 50.05Hz Ua =10%Un..." }, { + "scriptIdx":19, "pid": "2-2", "id": "2-2-1", "name": "输入:频率 51.05Hz Ua =10%Un..." }, { + "scriptIdx":20, "pid": "2-2", "id": "2-2-2", "name": "输入:频率 52.05Hz Ua =10%Un..." @@ -180,6 +214,7 @@ "name": "谐波对频率测量的影响", "children": [ { + "scriptIdx":21, "pid": "2-3", "id": "2-3-1", "name": "输入:频率 50.05Hz Ua =100%Un..." diff --git a/frontend/src/api/plan/interface/index.ts b/frontend/src/api/plan/interface/index.ts index a8bf0f1..d2df439 100644 --- a/frontend/src/api/plan/interface/index.ts +++ b/frontend/src/api/plan/interface/index.ts @@ -27,6 +27,7 @@ export namespace Plan { // 检测计划 + 检测源 export interface PlanAndSourceBO extends PlanBO { testSourceName: string;//计划所属检测源 + testSourceList?: string[];//临时测试 } // // 检测计划列表 // export interface PlanList { diff --git a/frontend/src/api/plan/planData.ts b/frontend/src/api/plan/planData.ts index 630be73..7d11bd8 100644 --- a/frontend/src/api/plan/planData.ts +++ b/frontend/src/api/plan/planData.ts @@ -178,6 +178,7 @@ const planData = ref([ 'test_State':'1', 'report_State':'1', 'result':'1', + }, { 'id': '2', @@ -191,6 +192,9 @@ const planData = ref([ 'test_State':'2', 'report_State':'2', 'result':'0', + "testSourceList":[ + '高精度设备-PQV520-1','高精度设备-PQV520-2', + ] }, { 'id': '3', diff --git a/frontend/src/components/ProTable/components/TableColumn.vue b/frontend/src/components/ProTable/components/TableColumn.vue index c059430..c368d6d 100644 --- a/frontend/src/components/ProTable/components/TableColumn.vue +++ b/frontend/src/components/ProTable/components/TableColumn.vue @@ -1,57 +1,57 @@ - diff --git a/frontend/src/styles/element.scss b/frontend/src/styles/element.scss index b7d2e63..ab4ce1e 100644 --- a/frontend/src/styles/element.scss +++ b/frontend/src/styles/element.scss @@ -306,8 +306,6 @@ // font-family:; .el-dialog__headerbtn { - top: 5px; - .el-icon { color: var(--el-color-white); } @@ -479,4 +477,16 @@ } } } +} + +.cn-render-buttons { + cursor: pointer; + display: inline-block; + margin-left: 13px; + line-height: 18px; + padding: 2px; + .icon { + font-size: 12px !important; + // color: var(--ba-bg-color-overlay) !important; + } } \ No newline at end of file diff --git a/frontend/src/utils/elementBind.ts b/frontend/src/utils/elementBind.ts index cd7036e..4b4d3c3 100644 --- a/frontend/src/utils/elementBind.ts +++ b/frontend/src/utils/elementBind.ts @@ -1,5 +1,5 @@ export const dialogSmall = { - width:'400px', + width:'500px', closeOnClickModal:false, draggable:true, class:'dialog-small' diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts index f604164..10680f6 100644 --- a/frontend/src/utils/index.ts +++ b/frontend/src/utils/index.ts @@ -1,7 +1,7 @@ -import { isArray } from "@/utils/is"; -import { FieldNamesProps } from "@/components/ProTable/interface"; +import { isArray } from '@/utils/is' +import { FieldNamesProps } from '@/components/ProTable/interface' -const mode = import.meta.env.VITE_ROUTER_MODE; +const mode = import.meta.env.VITE_ROUTER_MODE /** * @description 获取localStorage @@ -9,12 +9,12 @@ const mode = import.meta.env.VITE_ROUTER_MODE; * @returns {String} */ export function localGet(key: string) { - const value = window.localStorage.getItem(key); - try { - return JSON.parse(window.localStorage.getItem(key) as string); - } catch (error) { - return value; - } + const value = window.localStorage.getItem(key) + try { + return JSON.parse(window.localStorage.getItem(key) as string) + } catch (error) { + return value + } } /** @@ -24,7 +24,7 @@ export function localGet(key: string) { * @returns {void} */ export function localSet(key: string, value: any) { - window.localStorage.setItem(key, JSON.stringify(value)); + window.localStorage.setItem(key, JSON.stringify(value)) } /** @@ -33,7 +33,7 @@ export function localSet(key: string, value: any) { * @returns {void} */ export function localRemove(key: string) { - window.localStorage.removeItem(key); + window.localStorage.removeItem(key) } /** @@ -41,7 +41,7 @@ export function localRemove(key: string) { * @returns {void} */ export function localClear() { - window.localStorage.clear(); + window.localStorage.clear() } /** @@ -50,9 +50,9 @@ export function localClear() { * @returns {String} */ export function isType(val: any) { - if (val === null) return "null"; - if (typeof val !== "object") return typeof val; - else return Object.prototype.toString.call(val).slice(8, -1).toLocaleLowerCase(); + if (val === null) return 'null' + if (typeof val !== 'object') return typeof val + else return Object.prototype.toString.call(val).slice(8, -1).toLocaleLowerCase() } /** @@ -60,13 +60,13 @@ export function isType(val: any) { * @returns {String} */ export function generateUUID() { - let uuid = ""; - for (let i = 0; i < 32; i++) { - let random = (Math.random() * 16) | 0; - if (i === 8 || i === 12 || i === 16 || i === 20) uuid += "-"; - uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16); - } - return uuid; + let uuid = '' + for (let i = 0; i < 32; i++) { + let random = (Math.random() * 16) | 0 + if (i === 8 || i === 12 || i === 16 || i === 20) uuid += '-' + uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16) + } + return uuid } /** @@ -76,22 +76,22 @@ export function generateUUID() { * @returns {Boolean} 相同返回 true,反之 false */ export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]: any }) { - if (!a || !b) return false; - let aProps = Object.getOwnPropertyNames(a); - let bProps = Object.getOwnPropertyNames(b); - if (aProps.length != bProps.length) return false; - for (let i = 0; i < aProps.length; i++) { - let propName = aProps[i]; - let propA = a[propName]; - let propB = b[propName]; - if (!b.hasOwnProperty(propName)) return false; - if (propA instanceof Object) { - if (!isObjectValueEqual(propA, propB)) return false; - } else if (propA !== propB) { - return false; + if (!a || !b) return false + let aProps = Object.getOwnPropertyNames(a) + let bProps = Object.getOwnPropertyNames(b) + if (aProps.length != bProps.length) return false + for (let i = 0; i < aProps.length; i++) { + let propName = aProps[i] + let propA = a[propName] + let propB = b[propName] + if (!b.hasOwnProperty(propName)) return false + if (propA instanceof Object) { + if (!isObjectValueEqual(propA, propB)) return false + } else if (propA !== propB) { + return false + } } - } - return true; + return true } /** @@ -101,8 +101,8 @@ export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string] * @returns {Number} */ export function randomNum(min: number, max: number): number { - let num = Math.floor(Math.random() * (min - max) + max); - return num; + let num = Math.floor(Math.random() * (min - max) + max) + return num } /** @@ -110,13 +110,13 @@ export function randomNum(min: number, max: number): number { * @returns {String} */ export function getTimeState() { - let timeNow = new Date(); - let hours = timeNow.getHours(); - if (hours >= 6 && hours <= 10) return `早上好 ⛅`; - if (hours >= 10 && hours <= 14) return `中午好 🌞`; - if (hours >= 14 && hours <= 18) return `下午好 🌞`; - if (hours >= 18 && hours <= 24) return `晚上好 🌛`; - if (hours >= 0 && hours <= 6) return `凌晨好 🌛`; + let timeNow = new Date() + let hours = timeNow.getHours() + if (hours >= 6 && hours <= 10) return `早上好 ⛅` + if (hours >= 10 && hours <= 14) return `中午好 🌞` + if (hours >= 14 && hours <= 18) return `下午好 🌞` + if (hours >= 18 && hours <= 24) return `晚上好 🌛` + if (hours >= 0 && hours <= 6) return `凌晨好 🌛` } /** @@ -124,14 +124,14 @@ export function getTimeState() { * @returns {String} */ export function getBrowserLang() { - let browserLang = navigator.language ? navigator.language : navigator.browserLanguage; - let defaultBrowserLang = ""; - if (["cn", "zh", "zh-cn"].includes(browserLang.toLowerCase())) { - defaultBrowserLang = "zh"; - } else { - defaultBrowserLang = "en"; - } - return defaultBrowserLang; + let browserLang = navigator.language ? navigator.language : navigator.browserLanguage + let defaultBrowserLang = '' + if (['cn', 'zh', 'zh-cn'].includes(browserLang.toLowerCase())) { + defaultBrowserLang = 'zh' + } else { + defaultBrowserLang = 'en' + } + return defaultBrowserLang } /** @@ -139,11 +139,11 @@ export function getBrowserLang() { * @returns {String} */ export function getUrlWithParams() { - const url = { - hash: location.hash.substring(1), - history: location.pathname + location.search - }; - return url[mode]; + const url = { + hash: location.hash.substring(1), + history: location.pathname + location.search, + } + return url[mode] } /** @@ -152,8 +152,8 @@ export function getUrlWithParams() { * @returns {Array} */ export function getFlatMenuList(menuList: Menu.MenuOptions[]): Menu.MenuOptions[] { - let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList)); - return newMenuList.flatMap(item => [item, ...(item.children ? getFlatMenuList(item.children) : [])]); + let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList)) + return newMenuList.flatMap(item => [item, ...(item.children ? getFlatMenuList(item.children) : [])]) } /** @@ -162,11 +162,11 @@ export function getFlatMenuList(menuList: Menu.MenuOptions[]): Menu.MenuOptions[ * @returns {Array} * */ export function getShowMenuList(menuList: Menu.MenuOptions[]) { - let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList)); - return newMenuList.filter(item => { - item.children?.length && (item.children = getShowMenuList(item.children)); - return !item.meta?.isHide; - }); + let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList)) + return newMenuList.filter(item => { + item.children?.length && (item.children = getShowMenuList(item.children)) + return !item.meta?.isHide + }) } /** @@ -177,12 +177,12 @@ export function getShowMenuList(menuList: Menu.MenuOptions[]) { * @returns {Object} */ export const getAllBreadcrumbList = (menuList: Menu.MenuOptions[], parent = [], result: { [key: string]: any } = {}) => { - for (const item of menuList) { - result[item.path] = [...parent, item]; - if (item.children) getAllBreadcrumbList(item.children, result[item.path], result); - } - return result; -}; + for (const item of menuList) { + result[item.path] = [...parent, item] + if (item.children) getAllBreadcrumbList(item.children, result[item.path], result) + } + return result +} /** * @description 使用递归处理路由菜单 path,生成一维数组 (第一版本地路由鉴权会用到,该函数暂未使用) @@ -191,11 +191,11 @@ export const getAllBreadcrumbList = (menuList: Menu.MenuOptions[], parent = [], * @returns {Array} */ export function getMenuListPath(menuList: Menu.MenuOptions[], menuPathArr: string[] = []): string[] { - for (const item of menuList) { - if (typeof item === "object" && item.path) menuPathArr.push(item.path); - if (item.children?.length) getMenuListPath(item.children, menuPathArr); - } - return menuPathArr; + for (const item of menuList) { + if (typeof item === 'object' && item.path) menuPathArr.push(item.path) + if (item.children?.length) getMenuListPath(item.children, menuPathArr) + } + return menuPathArr } /** @@ -205,14 +205,14 @@ export function getMenuListPath(menuList: Menu.MenuOptions[], menuPathArr: strin * @returns {Object | null} */ export function findMenuByPath(menuList: Menu.MenuOptions[], path: string): Menu.MenuOptions | null { - for (const item of menuList) { - if (item.path === path) return item; - if (item.children) { - const res = findMenuByPath(item.children, path); - if (res) return res; + for (const item of menuList) { + if (item.path === path) return item + if (item.children) { + const res = findMenuByPath(item.children, path) + if (res) return res + } } - } - return null; + return null } /** @@ -222,11 +222,11 @@ export function findMenuByPath(menuList: Menu.MenuOptions[], path: string): Menu * @returns {Array} * */ export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNameArr: string[] = []) { - menuList.forEach(item => { - item.meta.isKeepAlive && item.name && keepAliveNameArr.push(item.name); - item.children?.length && getKeepAliveRouterName(item.children, keepAliveNameArr); - }); - return keepAliveNameArr; + menuList.forEach(item => { + item.meta.isKeepAlive && item.name && keepAliveNameArr.push(item.name) + item.children?.length && getKeepAliveRouterName(item.children, keepAliveNameArr) + }) + return keepAliveNameArr } /** @@ -237,9 +237,9 @@ export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNa * @returns {String} * */ export function formatTableColumn(row: number, col: number, callValue: any) { - // 如果当前值为数组,使用 / 拼接(根据需求自定义) - if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--"; - return callValue ?? "--"; + // 如果当前值为数组,使用 / 拼接(根据需求自定义) + if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/' + return (callValue && callValue.length > 0) ? callValue : '/' } /** @@ -248,9 +248,9 @@ export function formatTableColumn(row: number, col: number, callValue: any) { * @returns {String} * */ export function formatValue(callValue: any) { - // 如果当前值为数组,使用 / 拼接(根据需求自定义) - if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--"; - return callValue ?? "--"; + // 如果当前值为数组,使用 / 拼接(根据需求自定义) + if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/' + return (callValue && callValue.length > 0) ? callValue : '/' } /** @@ -260,9 +260,9 @@ export function formatValue(callValue: any) { * @returns {*} * */ export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string) { - if (!prop.includes(".")) return row[prop] ?? "--"; - prop.split(".").forEach(item => (row = row[item] ?? "--")); - return row; + if (!prop.includes('.')) return row[prop] ?? '/' + prop.split('.').forEach(item => (row = row[item] ?? '/')) + return row } /** @@ -271,9 +271,9 @@ export function handleRowAccordingToProp(row: { [key: string]: any }, prop: stri * @returns {String} * */ export function handleProp(prop: string) { - const propArr = prop.split("."); - if (propArr.length == 1) return prop; - return propArr[propArr.length - 1]; + const propArr = prop.split('.') + if (propArr.length == 1) return prop + return propArr[propArr.length - 1] } /** @@ -284,28 +284,28 @@ export function handleProp(prop: string) { * @param {String} type 过滤类型(目前只有 tag) * @returns {String} * */ -export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: "tag") { - const value = fieldNames?.value ?? "value"; - const label = fieldNames?.label ?? "label"; - const children = fieldNames?.children ?? "children"; - let filterData: { [key: string]: any } = {}; - // 判断 enumData 是否为数组 - if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children); - // 判断是否输出的结果为 tag 类型 - if (type == "tag") { - return filterData?.tagType ? filterData.tagType : ""; - } else { - return filterData ? filterData[label] : "--"; - } +export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: 'tag') { + const value = fieldNames?.value ?? 'value' + const label = fieldNames?.label ?? 'label' + const children = fieldNames?.children ?? 'children' + let filterData: { [key: string]: any } = {} + // 判断 enumData 是否为数组 + if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children) + // 判断是否输出的结果为 tag 类型 + if (type == 'tag') { + return filterData?.tagType ? filterData.tagType : '' + } else { + return filterData ? filterData[label] : '/' + } } /** * @description 递归查找 callValue 对应的 enum 值 * */ export function findItemNested(enumData: any, callValue: any, value: string, children: string) { - return enumData.reduce((accumulator: any, current: any) => { - if (accumulator) return accumulator; - if (current[value] === callValue) return current; - if (current[children]) return findItemNested(current[children], callValue, value, children); - }, null); + return enumData.reduce((accumulator: any, current: any) => { + if (accumulator) return accumulator + if (current[value] === callValue) return current + if (current[children]) return findItemNested(current[children], callValue, value, children) + }, null) } diff --git a/frontend/src/views/home/components/changeErrSysPopup.vue b/frontend/src/views/home/components/changeErrSysPopup.vue new file mode 100644 index 0000000..0f1a3fd --- /dev/null +++ b/frontend/src/views/home/components/changeErrSysPopup.vue @@ -0,0 +1,136 @@ + + + \ No newline at end of file diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index ed35fa6..0321b91 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -55,13 +55,13 @@ type="primary" @click="handleTest" v-if="form.activeTabs === 0" - >启动自动检测自动检测 启动手动检测手动检测 不合格项复检 批量生成报告报告批量生成 - + > --> + @@ -116,7 +118,7 @@ import { ElMessage, ElMessageBox } from "element-plus"; import ProTable from "@/components/ProTable/index.vue"; import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface' import { - Search, + Search,View,EditPen } from "@element-plus/icons-vue"; import { getPlanList } from "@/api/plan/planList"; import deviceDataList from '@/api/device/deviceData' @@ -129,7 +131,7 @@ const tableHeight = ref(0); console.log(window.innerHeight, "+++++++++"); tableHeight.value = window.innerHeight - 630; const deviceData = deviceDataList.plan_devicedata - +const operationShow = ref(false); //下拉框数据 //检测状态数据 let checkStatusList = reactive([ @@ -305,29 +307,29 @@ const columns = reactive[]>([ { prop: 'reCheck_Num', label: '复检次数', - minWidth: 70, + minWidth: 100, }, { prop: 'report_State', label: '报告状态', - minWidth: 130, + minWidth: 100, }, { prop: 'check_Result', label: '检测结果', - minWidth: 130, + minWidth: 100, }, { prop: 'check_State', label: '检测状态', - minWidth: 130, + minWidth: 100, }, { prop: 'document_State', label: '归档状态', - minWidth: 130, + minWidth: 100, }, - // { prop: 'operation', label: '操作', fixed: 'right', minWidth: 200 }, + { prop: 'operation', label: '操作', fixed: 'right', minWidth: 150 ,isShow: operationShow}, ]) // 表格配置项 @@ -567,36 +569,41 @@ function tableHeaderInit(val: number) { form.value.checkResult = 0;//检测结果默认为未出结果 disableCheckStatus("检测中") disableCheckStatus("归档") + operationShow.value = false; break; case 2://设备复检 form.value.checkStatus = 2;//检测状态默认为检测完成 form.value.checkReportStatus = 0;//检测报告状态默认为未生成报告 form.value.checkResult = 1;//检测结果默认为不合格 - disableCheckStatus("未检") + disableCheckStatus("未检测") disableCheckStatus("检测中") disableCheckStatus("归档") disablecheckResultList("未出结果") + operationShow.value = false; break; case 3://报告生成 form.value.checkStatus = 2;//检测状态默认为检测完成 form.value.checkReportStatus = 0;//检测报告状态默认为未生成报告 form.value.checkResult = 2;//检测结果默认为合格 - disableCheckStatus("未检") + disableCheckStatus("未检测") disableCheckStatus("检测中") disableCheckStatus("归档") disablecheckResultList("未出结果") + operationShow.value = true; break; case 4://设备归档 form.value.checkStatus = 2;//检测状态默认为检测完成 form.value.checkReportStatus = 1;//检测报告状态默认为已生成报告 form.value.checkResult = 2;//检测结果默认为合格 - disableCheckStatus("未检") + disableCheckStatus("未检测") disableCheckStatus("检测中") disableCheckStatus("归档") disableCheckReportStatus("未生成报告") disablecheckResultList("未出结果") + operationShow.value = false; break; - case 5://报告浏览 + case 5://设备浏览 + operationShow.value = true; break; } } @@ -656,6 +663,16 @@ const handleTest = () => { } }; +// 打开 drawer(新增、查看、编辑) +const openDrawer = (title: string, row: any) => { + if (title === '报告查看') + console.log(title); + + else if (title === '误差体系编辑') + console.log(title); + +} + onMounted(() => { console.log(proTable.value?.tableData); }); diff --git a/frontend/src/views/home/components/tree.vue b/frontend/src/views/home/components/tree.vue index 39b3e45..226fbdf 100644 --- a/frontend/src/views/home/components/tree.vue +++ b/frontend/src/views/home/components/tree.vue @@ -32,7 +32,7 @@ + \ No newline at end of file diff --git a/frontend/src/views/plan/autoTest/components/tree.vue b/frontend/src/views/plan/autoTest/components/tree.vue index 7d355f8..bf4a531 100644 --- a/frontend/src/views/plan/autoTest/components/tree.vue +++ b/frontend/src/views/plan/autoTest/components/tree.vue @@ -1,11 +1,11 @@ + \ No newline at end of file diff --git a/frontend/src/views/plan/planList/components/temp.vue b/frontend/src/views/plan/planList/components/temp.vue new file mode 100644 index 0000000..9bbec88 --- /dev/null +++ b/frontend/src/views/plan/planList/components/temp.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/frontend/src/views/plan/planList/index.vue b/frontend/src/views/plan/planList/index.vue index a518017..5f5d806 100644 --- a/frontend/src/views/plan/planList/index.vue +++ b/frontend/src/views/plan/planList/index.vue @@ -1,170 +1,250 @@ + - - + + + - - - + - - + + + - + }, + { + prop: 'resourcesId', + label: '报表数据来源', + width: 180, + enum: dictStore.getDictData('Data_Day'), + fieldNames: { label: 'name', value: 'code' } + }, + { + prop: 'operation', + label: '操作', + fixed: 'right', + minWidth: 200, + }, +]) + + +// 打开 drawer(新增、编辑) +const openDialog = (titleType: string, row: Partial = {}) => { + pqPopup.value?.open(titleType, row) + +} + +// 批量删除字典类型 +const batchDelete = async (id: string[]) => { + await useHandleData(deleteDictPq, id, '删除所选字典类型') + proTable.value?.clearSelection() + proTable.value?.getTableList() +} + +// 删除字典类型 +const handleDelete = async (params: Dict.ResDictPq) => { + await useHandleData(deleteDictPq, [params.id], `删除【${params.name}】指标字典类型`) + proTable.value?.getTableList() +} + + + \ No newline at end of file diff --git a/frontend/src/views/system/dictionary/dictType/components/typePopup.vue b/frontend/src/views/system/dictionary/dictType/components/typePopup.vue index 38b7daf..6911b5f 100644 --- a/frontend/src/views/system/dictionary/dictType/components/typePopup.vue +++ b/frontend/src/views/system/dictionary/dictType/components/typePopup.vue @@ -9,13 +9,13 @@ - + - + diff --git a/frontend/src/views/system/dictionary/dictType/index.vue b/frontend/src/views/system/dictionary/dictType/index.vue index 73594a0..720c428 100644 --- a/frontend/src/views/system/dictionary/dictType/index.vue +++ b/frontend/src/views/system/dictionary/dictType/index.vue @@ -30,13 +30,11 @@ import { CirclePlus, Delete, Download, EditPen, View } from '@element-plus/icons import { Dict } from '@/api/system/dictionary/interface' import { ColumnProps, ProTableInstance } from '@/components/ProTable/interface' import DictData from '@/views/system/dictionary/dictData/index.vue' -import { useDictStore } from '@/stores/modules/dict' import { useHandleData } from '@/hooks/useHandleData' import { useViewSize } from '@/hooks/useViewSize' import { useDownload } from '@/hooks/useDownload' import { deleteDictType, getDictTypeList, exportDictType } from '@/api/system/dictionary/dictType' -const dictStore = useDictStore() const { popupBaseView, viewWidth, viewHeight } = useViewSize() const proTable = ref() @@ -57,7 +55,7 @@ const columns = reactive[]>([ { prop: 'code', label: '类型编码', - minWidth: 200, + minWidth: 220, search: { el: 'input', }, @@ -65,7 +63,7 @@ const columns = reactive[]>([ { prop: 'remark', label: '描述', - minWidth: 300, + minWidth: 250, }, { prop: 'sort', @@ -81,7 +79,7 @@ const columns = reactive[]>([ prop: 'operation', label: '操作', fixed: 'right', - minWidth: 300, + minWidth: 250, }, ])