Compare commits
298 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83998f88ac | ||
|
|
9c5e54507b | ||
|
|
15689b5284 | ||
|
|
00893d2d1f | ||
|
|
0079f7415e | ||
| 327801d040 | |||
|
|
6e22c01dd8 | ||
|
|
bccb4b1f17 | ||
|
|
1f37cc567c | ||
|
|
f81503091d | ||
|
|
e29f25653e | ||
|
|
9e8e44b886 | ||
|
|
6e10b0c645 | ||
|
|
c8f3b4eddc | ||
|
|
cc848b1ffb | ||
|
|
d2f0382bd9 | ||
|
|
9fecf0ce3f | ||
|
|
290586d0ff | ||
|
|
ddc45af223 | ||
|
|
0e6f123306 | ||
|
|
7b93363b23 | ||
|
|
2fd0dcb8a3 | ||
|
|
86ee05f8af | ||
|
|
38814b9f44 | ||
|
|
fb5d13671d | ||
|
|
310a769092 | ||
|
|
8c63edabdc | ||
|
|
5363625a2f | ||
| efcd6e1cfe | |||
| acc4d0ca67 | |||
| 772f38feca | |||
|
|
1eb141e559 | ||
|
|
16b446bf20 | ||
|
|
bc0de34c15 | ||
|
|
15f2c1ee41 | ||
|
|
81a944062a | ||
|
|
3c19b05f4b | ||
|
|
c1f53cdc69 | ||
|
|
6ef2a6049b | ||
|
|
9989cc98cb | ||
|
|
e192158deb | ||
|
|
2e5d551e5d | ||
|
|
4622eb36d9 | ||
|
|
9c53b7c18e | ||
|
|
7b3805060f | ||
|
|
629600bc00 | ||
|
|
8b144b63fc | ||
|
|
098ab3a41d | ||
|
|
2a53f577aa | ||
|
|
f8b7c224b7 | ||
|
|
f0b3bdd37c | ||
|
|
bb35eb749b | ||
|
|
b3750d6a7f | ||
|
|
33ebb91ab6 | ||
|
|
3e00f2fee7 | ||
|
|
68e9856641 | ||
|
|
51b2e80493 | ||
|
|
cf77572f41 | ||
| fe6524404c | |||
|
|
ccda7218f4 | ||
|
|
ddd0e6a22b | ||
|
|
ed85453de1 | ||
|
|
04939606fc | ||
|
|
2df455b667 | ||
|
|
8fb214d7a7 | ||
|
|
4f2c8a8016 | ||
|
|
c2974dbe0d | ||
|
|
3891e5459a | ||
|
|
9ed47ac5bc | ||
|
|
114fcd140d | ||
|
|
19a30894f8 | ||
|
|
2134fea518 | ||
|
|
82f495ce3b | ||
|
|
f2ecff54a3 | ||
|
|
f56004ac15 | ||
|
|
5303c47248 | ||
| 37731592f7 | |||
|
|
c9e41e0c82 | ||
|
|
4a80a88e6e | ||
|
|
30b219e14d | ||
|
|
ecec9adeea | ||
|
|
1853152138 | ||
| 5619413f37 | |||
|
|
5b736bc475 | ||
|
|
2aa37c3fe3 | ||
|
|
4e0cb72f32 | ||
|
|
ce74ec4db7 | ||
|
|
9938306884 | ||
|
|
ef63fcf807 | ||
|
|
08cffa4256 | ||
|
|
e1a740f8bf | ||
|
|
56d035253b | ||
|
|
e7348107d0 | ||
|
|
ea38b4eb21 | ||
| 67ef976739 | |||
| 60145ec4f7 | |||
|
|
81600ddc69 | ||
|
|
e0941d628b | ||
|
|
760dcbf723 | ||
|
|
b75ecb8c66 | ||
|
|
39f4cfa670 | ||
|
|
862251b83c | ||
|
|
312490ce59 | ||
|
|
d7df999cf2 | ||
|
|
e0b1b5907b | ||
|
|
f06ca03881 | ||
|
|
a9b80ed33c | ||
|
|
834230b26a | ||
|
|
403ddbfb6e | ||
|
|
ffb44ea909 | ||
|
|
b729e4efa1 | ||
|
|
962c286fd5 | ||
|
|
c215f51554 | ||
| 859c85b427 | |||
|
|
5fe637e84f | ||
|
|
5f68071c77 | ||
|
|
1675a5af31 | ||
|
|
ec1d09dbd0 | ||
|
|
eda7b516f6 | ||
|
|
630eb48d28 | ||
|
|
0d2f8a7788 | ||
| 230c68f454 | |||
| 68934060e6 | |||
| 846e7514b7 | |||
| 410cfb0f7a | |||
|
|
c892410b07 | ||
|
|
7caa4a5303 | ||
|
|
c17efbf9f6 | ||
| c46abeecf5 | |||
|
|
0947097932 | ||
|
|
50fc02d4eb | ||
|
|
a122e9e1b3 | ||
|
|
d7cfcc7855 | ||
|
|
05948aebf5 | ||
|
|
cca214aaf7 | ||
|
|
0111954c5e | ||
|
|
ce31499964 | ||
|
|
059864d193 | ||
|
|
6d2fb4dde8 | ||
|
|
49059d9c59 | ||
|
|
d2f7041988 | ||
|
|
f94372d20b | ||
|
|
9af98b034f | ||
|
|
341b8df5a9 | ||
|
|
7470f697bd | ||
|
|
c058b99a0d | ||
|
|
d5eed13f38 | ||
|
|
c27ee88182 | ||
|
|
e2559ffa65 | ||
|
|
a0bd32453c | ||
|
|
54e7a91841 | ||
|
|
042f6eef51 | ||
| c9857326c6 | |||
| 9c4e0094f9 | |||
| 781b27af51 | |||
|
|
37e257afc8 | ||
| 4d4fdd6190 | |||
|
|
0fd2d8252d | ||
|
|
3cf5019880 | ||
|
|
258d3d692f | ||
|
|
667ed3bcc0 | ||
|
|
a882189022 | ||
|
|
686e009243 | ||
|
|
30d5f3390c | ||
|
|
3398b414ca | ||
|
|
b6a2c42feb | ||
|
|
cb5a9050f2 | ||
|
|
661b27abd0 | ||
|
|
59a24c9ea2 | ||
|
|
6cf5da5d48 | ||
|
|
537f5e2f4c | ||
|
|
70531a0729 | ||
|
|
ded15e5c8b | ||
|
|
3021f7e4d3 | ||
|
|
876d9cfa00 | ||
|
|
8f28825162 | ||
|
|
0e6612f6bd | ||
|
|
39183fde5d | ||
|
|
b967419cb1 | ||
|
|
0712698638 | ||
|
|
d3a74e830f | ||
|
|
f68da773ab | ||
|
|
8db814dba4 | ||
|
|
7dcff99de5 | ||
|
|
97100dfa63 | ||
|
|
d41707fcf9 | ||
|
|
2377916f29 | ||
|
|
be2f40715a | ||
|
|
489c0882ac | ||
|
|
492db88b45 | ||
|
|
3b198eb4ed | ||
|
|
5efc27d4b6 | ||
|
|
ec9f270d04 | ||
|
|
afd2d467f3 | ||
|
|
ff0798450d | ||
|
|
fbefc70368 | ||
|
|
faa0bc54a6 | ||
|
|
bf5f4eab77 | ||
| 188456c970 | |||
|
|
c06334e96f | ||
| 82e8bf2e0b | |||
| 30382fb34d | |||
| c7e5ee0862 | |||
|
|
d6ac63586b | ||
|
|
e0fd42199f | ||
|
|
d9e3168484 | ||
|
|
dc7e91ca66 | ||
|
|
692358d278 | ||
| 3750031d6b | |||
| 0bae200241 | |||
|
|
61bd1a0d6a | ||
|
|
37cf3dfdd7 | ||
|
|
8be96ca64e | ||
|
|
d225391248 | ||
|
|
f2fd0b078e | ||
|
|
f71963ea3b | ||
|
|
6a635246bb | ||
|
|
d338ca6b25 | ||
|
|
193c3b963c | ||
|
|
cad4965b1b | ||
|
|
79306d846f | ||
|
|
f4ea510c5d | ||
|
|
07cc26fa8d | ||
|
|
f87e268242 | ||
|
|
1aeceffe0b | ||
|
|
fc97087767 | ||
|
|
61be97b04b | ||
|
|
934162875c | ||
|
|
4b3991099a | ||
|
|
b14a961c1a | ||
|
|
cbe41d80ce | ||
|
|
28203f2621 | ||
|
|
b8492dfbe6 | ||
|
|
15faac8079 | ||
|
|
ad850ca4ee | ||
|
|
6c05c6e06e | ||
|
|
8b2cda80b1 | ||
|
|
3f7756b417 | ||
|
|
5004e319b6 | ||
|
|
19035f2dc9 | ||
|
|
9d8a5c76b2 | ||
|
|
6300eb2f43 | ||
|
|
da58ffb621 | ||
|
|
1500fafb92 | ||
|
|
df53eea432 | ||
|
|
cc1771c208 | ||
|
|
5e881c0804 | ||
|
|
5666e01ae0 | ||
|
|
4acec8a2d6 | ||
|
|
426a511099 | ||
|
|
89303b44ae | ||
|
|
ffb82066bb | ||
|
|
f46b8c0a56 | ||
|
|
280289af37 | ||
| a0c7f79302 | |||
| bd1eecc106 | |||
|
|
1a23bcb510 | ||
|
|
942c28d3bd | ||
| 034b31ba47 | |||
|
|
7a76c2da8a | ||
|
|
1a9d8e8606 | ||
| 14583d919d | |||
|
|
629fd174e4 | ||
|
|
9080fe06a4 | ||
|
|
0e183bb5c1 | ||
| 8caf856d2d | |||
|
|
d28669e6b0 | ||
| 700884d01a | |||
| c06bd9fa24 | |||
| ce92a1d645 | |||
|
|
4f622da52c | ||
| 7d3e86a5fc | |||
|
|
c66d181b98 | ||
| f860630bfb | |||
|
|
6db4d79839 | ||
| e2924d5e57 | |||
| 92b9a82f21 | |||
|
|
c3f89ca1f8 | ||
|
|
8c435c91dd | ||
|
|
6e6cfa5be0 | ||
|
|
ea203d0ccc | ||
|
|
370cd52774 | ||
|
|
942bae3045 | ||
|
|
356548c8fb | ||
| 5c012c2bc9 | |||
| 9c9b8015a0 | |||
| bba0ced7f9 | |||
|
|
e8de7b56d9 | ||
|
|
95022f62a8 | ||
|
|
1d918f3335 | ||
|
|
f992637ad2 | ||
|
|
40f18bbdf8 | ||
|
|
3bb9cec08a | ||
|
|
6842260f59 | ||
|
|
305c30d725 | ||
|
|
e799dd2f08 | ||
| 1e83172e9a | |||
|
|
475d236b7e |
@@ -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<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
||||
return this.service.get(url, { params, ..._object });
|
||||
}
|
||||
post<T>(url: string, params?: object | string, _object = {}): Promise<ResultData<T>> {
|
||||
return this.service.post(url, params, _object);
|
||||
}
|
||||
put<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
||||
return this.service.put(url, params, _object);
|
||||
}
|
||||
delete<T>(url: string, params?: any, _object = {}): Promise<ResultData<T>> {
|
||||
return this.service.delete(url, { params, ..._object });
|
||||
}
|
||||
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||
return this.service.post(url, params, { ..._object, responseType: "blob" });
|
||||
}
|
||||
}
|
||||
|
||||
export default new RequestHttp(config);
|
||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"Analyse",
|
||||
"CHNFACTOR",
|
||||
"CHNPACTOR",
|
||||
"Chns",
|
||||
|
||||
@@ -19,6 +19,7 @@ VITE_API_URL=/api
|
||||
|
||||
# 开发环境跨域代理,支持配置多个
|
||||
|
||||
#VITE_PROXY=[["/api","http://127.0.0.1:18092/"]]
|
||||
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.138:8080/"]]张文
|
||||
|
||||
@@ -22,4 +22,5 @@ VITE_DROP_CONSOLE=true
|
||||
VITE_PWA=true
|
||||
|
||||
# 线上环境接口地址
|
||||
#VITE_API_URL="/api" # 打包时用
|
||||
VITE_API_URL="http://192.168.1.125:18092/"
|
||||
|
||||
11
frontend/.prettierrc
Normal file
11
frontend/.prettierrc
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"tabWidth": 4,
|
||||
"printWidth": 120,
|
||||
"useTabs": false,
|
||||
"semi": false,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf",
|
||||
"htmlWhitespaceSensitivity": "ignore"
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@vue-flow/core": "^1.45.0",
|
||||
"@vueuse/core": "^10.4.1",
|
||||
"axios": "^1.7.3",
|
||||
"crypto-js": "^4.2.0",
|
||||
@@ -22,9 +23,11 @@
|
||||
"echarts": "^5.4.3",
|
||||
"echarts-liquidfill": "^3.1.0",
|
||||
"element-plus": "^2.7.8",
|
||||
"html2canvas": "^1.4.1",
|
||||
"md5": "^2.3.0",
|
||||
"mitt": "^3.0.1",
|
||||
"mkdirp": "^3.0.1",
|
||||
"node-forge": "^1.3.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^2.2.1",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
@@ -41,11 +44,14 @@
|
||||
"devDependencies": {
|
||||
"@rushstack/eslint-patch": "^1.8.0",
|
||||
"@tsconfig/node20": "^20.1.4",
|
||||
"@types/html2canvas": "^1.0.0",
|
||||
"@types/md5": "^2.3.2",
|
||||
"@types/node": "^20.14.14",
|
||||
"@types/node-forge": "^1.3.11",
|
||||
"@types/nprogress": "^0.2.0",
|
||||
"@types/qs": "^6.9.8",
|
||||
"@types/sortablejs": "^1.15.2",
|
||||
"@types/xlsx": "^0.0.36",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
||||
"@typescript-eslint/parser": "^6.7.0",
|
||||
"@vitejs/plugin-vue": "^5.0.5",
|
||||
@@ -67,11 +73,11 @@
|
||||
"unplugin-auto-import": "^0.18.3",
|
||||
"unplugin-vue-components": "^0.27.4",
|
||||
"unplugin-vue-setup-extend-plus": "^1.0.0",
|
||||
"vite": "^5.3.1",
|
||||
"vite": "^5.4.19",
|
||||
"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-node-polyfills": "^0.23.0",
|
||||
"vite-plugin-pwa": "^0.16.5",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vue-tsc": "^2.0.21"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export namespace CheckData {
|
||||
export interface DataCheck {
|
||||
scriptName: string,
|
||||
errorSysName: string,
|
||||
errorSysId: string,
|
||||
dataRule: string,
|
||||
deviceName: string,
|
||||
chnNum: string,
|
||||
@@ -13,13 +13,15 @@ export namespace CheckData {
|
||||
// 装置原始数据-被检值
|
||||
data: number,
|
||||
|
||||
|
||||
// 误差值
|
||||
errorData: number,
|
||||
// 第几次谐波
|
||||
num?: number,
|
||||
//符合、不符合
|
||||
isData?: number,
|
||||
//最大误差值
|
||||
radius?: string,
|
||||
unit?: string,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,21 +52,25 @@ export namespace CheckData {
|
||||
errorA?: string,
|
||||
maxErrorA?: string,
|
||||
isDataA?: number,
|
||||
unitA?: string,
|
||||
stdB?: string,
|
||||
dataB?: string,
|
||||
errorB?: string,
|
||||
maxErrorB?: string,
|
||||
isDataB?: number,
|
||||
unitB?: string,
|
||||
stdC?: string,
|
||||
dataC?: string,
|
||||
errorC?: string,
|
||||
maxErrorC?: string,
|
||||
isDataC?: number,
|
||||
unitC?: string,
|
||||
stdT?: string,
|
||||
dataT?: string,
|
||||
errorT?: string,
|
||||
maxErrorT?: string,
|
||||
isDataT?: number,
|
||||
unitT?: string,
|
||||
|
||||
//最大误差值
|
||||
maxError?: string,
|
||||
@@ -90,6 +96,13 @@ export namespace CheckData {
|
||||
deviceId: string; //装置序号Id
|
||||
deviceName: string; //设备名称
|
||||
chnNum: number; //设备通道数
|
||||
|
||||
planId: string; //计划Id
|
||||
devType: string; //设备类型
|
||||
devVolt: number; //设备电压
|
||||
devCurr: number; //设备电流
|
||||
factorFlag: number; //是否支持系数校准
|
||||
checkResult:number; //检测结果
|
||||
}
|
||||
|
||||
// 用来描述检测脚本类型
|
||||
@@ -101,6 +114,7 @@ export namespace CheckData {
|
||||
|
||||
// 用来描述 检测数据-左侧树结构
|
||||
export interface TreeItem {
|
||||
id: string | null,
|
||||
scriptTypeName: string | null,
|
||||
sourceDesc: string | null,
|
||||
harmNum: number | null,
|
||||
@@ -116,7 +130,8 @@ export namespace CheckData {
|
||||
SUCCESS = 1,
|
||||
FAIL = 2,
|
||||
TIMEOUT = 3,
|
||||
ERRORDATA = 4
|
||||
ERRORDATA = 4,
|
||||
NOT_PART_IN_ERROR = 5
|
||||
}
|
||||
|
||||
export interface DeviceCheckResult {
|
||||
@@ -136,8 +151,8 @@ export namespace CheckData {
|
||||
|
||||
export enum ButtonColorEnum {
|
||||
INFO = '#909399',
|
||||
LOADING = '#003078',
|
||||
SUCCESS = '#67c23a',
|
||||
LOADING = 'var(--el-color-primary)',
|
||||
SUCCESS = '#91cc75',
|
||||
WARNING = '#e6a23c',
|
||||
DANGER = '#f56c6c',
|
||||
}
|
||||
@@ -147,7 +162,7 @@ export namespace CheckData {
|
||||
*/
|
||||
export interface ButtonResult {
|
||||
color: ButtonColorEnum
|
||||
icon: 'Minus' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled'
|
||||
icon: 'More' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled' | 'Minus'
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,6 +188,16 @@ export namespace CheckData {
|
||||
type: 'info' | 'warning' | 'error'
|
||||
log: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义手动检测时,勾选的测试项
|
||||
*/
|
||||
export interface SelectTestItem {
|
||||
preTest: boolean,
|
||||
timeTest: boolean,
|
||||
channelsTest: boolean,
|
||||
test: boolean
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import http from "@/api";
|
||||
import {CheckData} from "@/api/check/interface";
|
||||
|
||||
export const getBigTestItem = (planId: string) => {
|
||||
return http.get(`/adPlan/getBigTestItem?planId=${planId}`, {loading: false});
|
||||
export const getBigTestItem = (params: {
|
||||
reCheckType: number,
|
||||
planId: string,
|
||||
devIds: string[],
|
||||
}) => {
|
||||
return http.post(`/adPlan/getBigTestItem`, params, {loading: false});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,13 +27,13 @@ export const getFormData = (params: {
|
||||
* @param params
|
||||
*/
|
||||
export const getTreeData = (params: {
|
||||
scriptId: string,
|
||||
devId: string,
|
||||
devNum: string,
|
||||
scriptType: string | null,
|
||||
code: number,
|
||||
scriptId?: string,
|
||||
devId?: string,
|
||||
devNum?: string,
|
||||
scriptType?: string | null,
|
||||
code?: string,
|
||||
}) => {
|
||||
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true});
|
||||
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: false});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +45,7 @@ export const getTableData = (params: {
|
||||
scriptId: string,
|
||||
devId: string,
|
||||
devNum: string,
|
||||
code: number,
|
||||
code: string,
|
||||
index: number,
|
||||
}) => {
|
||||
return http.post("/result/resultData/", params, {loading: false});
|
||||
@@ -52,8 +56,44 @@ export const exportRawData = (params: {
|
||||
scriptId: string,
|
||||
devId: string,
|
||||
devNum: string,
|
||||
code: number,
|
||||
code: string,
|
||||
index: number,
|
||||
}) => {
|
||||
return http.download("/result/exportRawData", params, {loading: false});
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新计算
|
||||
* @param params
|
||||
*/
|
||||
export const reCalculate = (params: {
|
||||
planId: string,
|
||||
scriptId: string,
|
||||
errorSysId: string,
|
||||
deviceId: string,
|
||||
code: string
|
||||
}) => {
|
||||
return http.post("/result/reCalculate", params, {loading: true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更换误差体系
|
||||
* @param params
|
||||
*/
|
||||
export const changeErrorSystem = (params: {
|
||||
planId: string,
|
||||
scriptId: string,
|
||||
errorSysId: string,
|
||||
deviceId: string,
|
||||
code: string
|
||||
}) => {
|
||||
return http.post("/result/changeErrorSystem", params, {loading: true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除(误差体系切换时产生的)临时表
|
||||
* @param code
|
||||
*/
|
||||
export const deleteTempTable = (code: string) => {
|
||||
return http.get(`/result/deleteTempTable?code=${code}`, null, {loading: false})
|
||||
}
|
||||
24
frontend/src/api/device/controlSource/index.ts
Normal file
24
frontend/src/api/device/controlSource/index.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
import type { controlSource } from '@/api/device/interface/controlSource'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
* @name 程控源管理模块
|
||||
*/
|
||||
|
||||
//通讯校验
|
||||
export const checkSimulate = (params: controlSource.ResControl) => {
|
||||
return http.post(`/prepare/ytxCheckSimulate`,params)
|
||||
}
|
||||
|
||||
//启动
|
||||
export const startSimulateTest = (params: controlSource.ResControl) => {
|
||||
return http.post(`prepare/startSimulateTest`,params,{loading:false})
|
||||
}
|
||||
|
||||
//停止
|
||||
export const closeSimulateTest = (params: controlSource.ResControl) => {
|
||||
return http.post(`/prepare/closeSimulateTest`,params,{loading:false})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Device } from '@/api/device/interface/device'
|
||||
import { pa } from 'element-plus/es/locale/index.mjs';
|
||||
import type {Device} from '@/api/device/interface/device'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
@@ -7,57 +8,67 @@ import http from '@/api'
|
||||
|
||||
//获取被检设备
|
||||
export const getPqDevList = (params: Device.ReqPqDevParams) => {
|
||||
return http.post(`/pqDev/list`, params)
|
||||
return http.post(`/pqDev/list`, params)
|
||||
}
|
||||
|
||||
//添加被检设备
|
||||
export const addPqDev = (params: Device.ResPqDev) => {
|
||||
return http.post(`/pqDev/add`, params)
|
||||
return http.post(`/pqDev/add`, params)
|
||||
}
|
||||
|
||||
//编辑被检设备
|
||||
export const updatePqDev = (params: Device.ResPqDev) => {
|
||||
return http.post(`/pqDev/update`, params)
|
||||
return http.post(`/pqDev/update`, params)
|
||||
}
|
||||
|
||||
//删除被检设备
|
||||
export const deletePqDev = (params: string[]) => {
|
||||
return http.post(`/pqDev/delete`, params)
|
||||
return http.post(`/pqDev/delete`, params)
|
||||
}
|
||||
|
||||
// export const downloadTemplate = () => {
|
||||
// return http.download(`/pqDev/downloadTemplate`)
|
||||
//导出被检设备
|
||||
export const exportPqDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.download(`/pqDev/export`, params)
|
||||
}
|
||||
// 下载导入文件模板
|
||||
export const downloadTemplate = (params: { pattern: string }) => {
|
||||
return http.download(`/pqDev/downloadTemplate`,params)
|
||||
}
|
||||
|
||||
//导入被检设备
|
||||
export const importPqDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.uploadExcel(`/pqDev/import`, params)
|
||||
}
|
||||
|
||||
//导入比对式被检设备
|
||||
export const importContrastPqDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.upload(`/pqDev/importContrast`, params)
|
||||
}
|
||||
|
||||
// //导出灿能二楼设备
|
||||
// export const exportCNDev = (params: Device.ReqPqDevParams) => {
|
||||
// return http.download(`/pqDev/exportCNDev`, params)
|
||||
// }
|
||||
//
|
||||
// // 下载灿能二楼设备导入文件模板
|
||||
// export const downloadCNDevTemplate = () => {
|
||||
// return http.download(`/pqDev/downloadCNDevTemplate`)
|
||||
// }
|
||||
//
|
||||
// //导入灿能二楼设备
|
||||
// export const importCNDev = (params: Device.ReqPqDevParams) => {
|
||||
// return http.uploadExcel(`/pqDev/importCNDev`, params)
|
||||
// }
|
||||
|
||||
// //导入被检设备(比对)
|
||||
// export const importPqDev=(params: Device.ReqPqDevParams)=>{
|
||||
// return http.upload(`/pqDev/import`, params)
|
||||
// }
|
||||
// //导入比对式被检设备
|
||||
// export const importContrastPqDev=(params: Device.ReqPqDevParams)=>{
|
||||
// return http.upload(`/pqDev/importContrast`, params)
|
||||
// }
|
||||
|
||||
//导出灿能二楼设备
|
||||
export const exportCNDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.download(`/pqDev/exportCNDev`, params)
|
||||
export const getPqDevById = (params: Device.ReqPqDevParams) => {
|
||||
return http.get(`/pqDev/getById?id=${params.id}`)
|
||||
}
|
||||
|
||||
// 下载灿能二楼设备导入文件模板
|
||||
export const downloadCNDevTemplate = () => {
|
||||
return http.download(`/pqDev/downloadCNDevTemplate`)
|
||||
}
|
||||
|
||||
//导入灿能二楼设备
|
||||
export const importCNDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.uploadExcel(`/pqDev/importCNDev`, params)
|
||||
}
|
||||
//根据设备类型决定(电源、icd、模板、通道数、额定电压、额定电流);
|
||||
export const getPqDev = () => {
|
||||
return http.get(`/devType/listAll`)
|
||||
return http.get(`/devType/listAll`)
|
||||
}
|
||||
|
||||
//被检设备归档
|
||||
export const documentedPqDev = (ids: string[]) => {
|
||||
return http.post(`/pqDev/documented`, ids)
|
||||
export const getSelectOptions = (params:{ pattern: string }) => {
|
||||
return http.get(`/pqDev/getSelectOptions`, params)
|
||||
}
|
||||
|
||||
@@ -30,5 +30,7 @@ export const deletePqErrSys = (params: string[]) => {
|
||||
return http.post(`/pqErrSys/delete`, params)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//复制误差体系
|
||||
export const copyPqErrSys = (params: ErrorSystem.ErrorSystemList) => {
|
||||
return http.get(`/pqErrSys/copy?id=${params.id}`)
|
||||
}
|
||||
15
frontend/src/api/device/interface/controlSource.ts
Normal file
15
frontend/src/api/device/interface/controlSource.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { ReqPage,ResPage } from '@/api/interface'
|
||||
|
||||
// 被检设备模块
|
||||
export namespace controlSource {
|
||||
|
||||
/**
|
||||
* 被检设备新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResControl {
|
||||
userPageId: string;
|
||||
scriptId: string;
|
||||
scriptIndex: number;
|
||||
sourceId: string;
|
||||
}
|
||||
}
|
||||
@@ -1,91 +1,124 @@
|
||||
import type { ReqPage,ResPage } from '@/api/interface'
|
||||
import { getPqDevById } from './../device/index';
|
||||
import type {ReqPage, ResPage} from '@/api/interface'
|
||||
import type { Monitor } from './monitor';
|
||||
|
||||
// 被检设备模块
|
||||
export namespace Device {
|
||||
|
||||
/**
|
||||
* 被检设备表格分页查询参数
|
||||
*/
|
||||
export interface ReqPqDevParams extends ReqPage{
|
||||
id: string; // 装置序号id 必填
|
||||
name: string; //设备名称
|
||||
devType?: string; // 设备名称
|
||||
createTime?:string; //创建时间
|
||||
pattern:string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备表格分页查询参数
|
||||
*/
|
||||
export interface ReqDevReportParams extends ReqPage{
|
||||
planId?:string; // 计划id
|
||||
devId?:string; // 装置id
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
* 被检设备表格分页查询参数
|
||||
*/
|
||||
export interface ReqPqDevParams extends ReqPage {
|
||||
id: string; // 装置序号id 必填
|
||||
name: string; //设备名称
|
||||
devType?: string; // 设备名称
|
||||
createTime?: string; //创建时间
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备表格分页查询参数
|
||||
*/
|
||||
export interface ReqDevReportParams extends ReqPage {
|
||||
planId?: string; // 计划id
|
||||
devId?: string; // 装置id
|
||||
scriptId?: string; // 脚本id
|
||||
planCode?: string;
|
||||
devIdList?: string[]; // 装置id列表
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResPqDev {
|
||||
id: string; //装置序号ID
|
||||
name: string; //设备名称
|
||||
pattern: string; //设备模式 模拟 数字 比对
|
||||
devType: string;//设备类型
|
||||
devChns: number; //设备通道数
|
||||
devVolt: number; //额定电压(V)
|
||||
devCurr: number; //额定电流(A)
|
||||
manufacturer?: string | null;//生产厂家
|
||||
createDate: string; //生产日期
|
||||
createId: string; //出厂编号
|
||||
hardwareVersion: string; //固件版本
|
||||
softwareVersion: string; //软件版本
|
||||
protocol:string; //通讯协议
|
||||
protocol: string; //通讯协议
|
||||
ip: string; //IP地址
|
||||
port: number; //端口号
|
||||
encryptionFlag: number; //装置是否为加密版本
|
||||
series?: string| null; //装置识别码(3ds加密)
|
||||
devKey?: string| null; //装置秘钥(3ds加密)
|
||||
sampleID?: string| null; //样品编号
|
||||
series?: string | null; //装置识别码(3ds加密)
|
||||
devKey?: string | null; //装置秘钥(3ds加密)
|
||||
sampleId?: string | null; //样品编号
|
||||
arrivedDate?: string; //送样日期
|
||||
cityName?: string| null; //所属地市名称
|
||||
gDName?: string| null; //所属供电公司名称
|
||||
subName?: string| null; //所属电站名称
|
||||
checkState?: number| null; //检测状态
|
||||
checkResult?: number| null; //检测结果
|
||||
reportState?: number| null; //报告状态
|
||||
reportPath?: string| null; //报告路径
|
||||
qRCode?: string| null; //设备关键信息二维码
|
||||
reCheckNum: number; //复检次数
|
||||
planId?:string;//检测计划Id
|
||||
timeCheckResult?:number;//守时检测结果(0:不符合1:符合)
|
||||
factorFlag?:number;//是否支持系数校准(0:不支持,1:支持)
|
||||
factorCheckResult?: number;//系数校准结果(0:不合格,1:合格,2:/表示没有做系数校准)
|
||||
cityName?: string | null; //所属地市名称
|
||||
gdName?: string | null; //所属供电公司名称
|
||||
subName?: string | null; //所属电站名称
|
||||
reportPath?: string | null; //报告路径
|
||||
planId?: string;//检测计划Id
|
||||
factorFlag?: number;//是否支持系数校准(0:不支持,1:支持)
|
||||
preinvestmentPlan: string | null;//预投计划
|
||||
delegate: string | null; //委托方
|
||||
inspectChannel?: string[] | string;//被检通道
|
||||
inspectDate?: string | null;//定检日期
|
||||
harmSysId?: string | null;//谐波系统设备id
|
||||
importFlag?: number;//是否为导入设备 0否 1是
|
||||
state: number; //状态
|
||||
createBy?: string| null; //创建用户
|
||||
createTime?: string| null; //创建时间
|
||||
updateBy?: string| null; //更新用户
|
||||
updateTime?: string| null; //更新时间
|
||||
icdId: string| null;
|
||||
power: string| null;//工作电源
|
||||
preinvestmentPlan: string| null;
|
||||
createBy?: string | null; //创建用户
|
||||
createTime?: string | null; //创建时间
|
||||
updateBy?: string | null; //更新用户
|
||||
updateTime?: string | null; //更新时间
|
||||
|
||||
devChns: number; //设备通道数
|
||||
devVolt: number; //额定电压(V)
|
||||
devCurr: number; //额定电流(A)
|
||||
icdId: string | null;
|
||||
power: string | null;//工作电源
|
||||
|
||||
devId?: number;
|
||||
checkState?: number | null; //检测状态(0:未检,1:检测中,2:检测完成 3:归档)
|
||||
checkResult?: number | null; //检测结果(0:不符合,1:符合,2:未检)
|
||||
reportState?: number | null; //报告状态(0:未生成,1:已生成,2:未检)
|
||||
recheckNum: number; //复检次数
|
||||
timeCheckResult?: number;//守时检测结果(0:不符合1:符合)
|
||||
factorCheckResult?: number;//系数校准结果(0:不合格,1:合格,2:未检)
|
||||
realtimeResult?: number;//实时数据结论(0:不符合,1:符合,2:未检)
|
||||
statisticsResult?: number;//统计数据结论(0:不符合,1:符合,2:未检)
|
||||
recordedResult?: number;//录波数据结论(0:不符合,1:符合,2:未检)
|
||||
checkBy?: string | null;//检测人
|
||||
checkTime?: string | null;//检测时间
|
||||
preDetectTime?: number;//预检测耗时
|
||||
coefficientTime?: number;//系数校准耗时
|
||||
formalCheckTime?: number;//正式检测耗时
|
||||
|
||||
boundPlanName?: string| null;
|
||||
assign?: number;////是否分配给检测人员 0否 1是
|
||||
monitorList: Monitor.ResPqMon[] ;
|
||||
}
|
||||
|
||||
|
||||
export interface ResDev{
|
||||
id: string;
|
||||
name: string ,
|
||||
icd:string ,
|
||||
power:string,
|
||||
devVolt:number,
|
||||
devCurr:number,
|
||||
devChns:number,
|
||||
export interface SelectOption {
|
||||
label: string;
|
||||
value: string | number;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 被检设备表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResPqDevPage extends ResPage<ResPqDev> {
|
||||
|
||||
}
|
||||
}
|
||||
export interface ResDev {
|
||||
id: string;
|
||||
name: string,
|
||||
icd: string,
|
||||
power: string,
|
||||
devVolt: number,
|
||||
devCurr: number,
|
||||
devChns: number,
|
||||
}
|
||||
|
||||
export interface ResTH {
|
||||
temperature :number | null;//温度
|
||||
humidity:number | null;//湿度
|
||||
}
|
||||
/**
|
||||
* 被检设备表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResPqDevPage extends ResPage<ResPqDev> {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,9 @@ export namespace ErrorSystem {
|
||||
endFlag?:number;//是否包含结束值
|
||||
conditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值)
|
||||
maxErrorValue:number;//误差最大值
|
||||
errorValueType:string;//误差值类型(包括值类型,绝对值、相对值1、相对值2)
|
||||
errorValueType:any;//误差值类型(0标称值、1标准值、2值类型)
|
||||
valueType:number;//值类型(1绝对值、2相对值)
|
||||
errorUnit:string;//误差单位
|
||||
}
|
||||
|
||||
//查看详细误差体系
|
||||
|
||||
@@ -1,33 +1,35 @@
|
||||
import type { ReqPage, ResPage } from '@/api/interface'
|
||||
|
||||
// 被检设备模块
|
||||
// 监测点模块
|
||||
export namespace Monitor {
|
||||
|
||||
/**
|
||||
* 电能质量指标字典数据表格分页查询参数
|
||||
* 监测点表格分页查询参数
|
||||
*/
|
||||
export interface ReqPqMonParams extends ReqPage {
|
||||
id: string; // 装置序号id 必填
|
||||
devType?: string; // 设备名称
|
||||
createTime?: string; //创建时间
|
||||
name?: string; // 设备名称
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备新增、修改、根据id查询返回的对象
|
||||
* 监测点新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResPqMon {
|
||||
id: string; //监测点ID
|
||||
code: string; //默认与谐波系统监测点ID相同
|
||||
devId: string; //所属设备ID
|
||||
name: string; //所属母线
|
||||
num: number; //监测点序号
|
||||
pt: number; //PT变比
|
||||
ct: number; //CT变比
|
||||
ptType: string; //接线方式,字典表
|
||||
busbar: string;//所属母线
|
||||
name: string; //监测点名称
|
||||
num: number; //线路号,监测点序号
|
||||
pt: string; //PT变比
|
||||
ct: string; //CT变比
|
||||
connection: string; //接线方式,字典表
|
||||
statInterval: number; //统计间隔
|
||||
harmSysId: string; //默认与谐波系统监测点ID相同
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备表格查询分页返回的对象;
|
||||
* 监测点表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResPqMonPage extends ResPage<ResPqMon> {
|
||||
|
||||
|
||||
39
frontend/src/api/device/interface/report.ts
Normal file
39
frontend/src/api/device/interface/report.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { ReqPage, ResPage } from '@/api/interface'
|
||||
import type { UploadFile } from 'element-plus';
|
||||
|
||||
// 报告模版接口
|
||||
export namespace PqReport {
|
||||
|
||||
/**
|
||||
* 报告模版表格分页查询参数
|
||||
*/
|
||||
export interface ReqReportParams extends ReqPage {
|
||||
id: string; // 装置序号id 必填
|
||||
name?: string; // 设备名称
|
||||
createTime?: string; //创建时间
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告模版新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResReport {
|
||||
id: string; //报告模板id
|
||||
name: string;//报告模板名称
|
||||
version:string;//版本号
|
||||
baseFile?:string;//基础模板文件路径
|
||||
detailFile?:string;//检测项模版文件路径
|
||||
description:string;//描述信息
|
||||
state:number;//状态:8-删除 1-正常
|
||||
createBy?: string| null; //创建用户
|
||||
createTime?: string| null; //创建时间
|
||||
updateBy?: string| null; //更新用户
|
||||
updateTime?: string| null; //更新时间
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告模版表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResReportPage extends ResPage<ResReport> {
|
||||
|
||||
}
|
||||
}
|
||||
46
frontend/src/api/device/interface/standardDevice.ts
Normal file
46
frontend/src/api/device/interface/standardDevice.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import type {ReqPage, ResPage} from '@/api/interface'
|
||||
|
||||
// 标准设备模块
|
||||
export namespace StandardDevice {
|
||||
|
||||
/**
|
||||
* 标准设备表格分页查询参数
|
||||
*/
|
||||
export interface ReqPqStandardDeviceParams extends ReqPage {
|
||||
id: string; // 装置序号id 必填
|
||||
name: string; //设备名称
|
||||
devType?: string; // 设备名称
|
||||
createTime?: string; //创建时间
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 标准设备新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResPqStandardDevice {
|
||||
id: string; //装置序号ID
|
||||
name: string; //设备名称
|
||||
devType: string;//设备类型
|
||||
manufacturer?: string | null;//生产厂家
|
||||
protocol: string;//通讯协议
|
||||
ip: string; //IP地址
|
||||
port: number; //端口号
|
||||
inspectChannel:string[] |string;//可检通道数
|
||||
encryptionFlag: number; //装置是否为加密版本
|
||||
series?: string | null; //装置识别码(3ds加密)
|
||||
devKey?: string | null; //装置秘钥(3ds加密)
|
||||
state: number; //状态
|
||||
createBy?: string | null; //创建用户
|
||||
createTime?: string | null; //创建时间
|
||||
updateBy?: string | null; //更新用户
|
||||
updateTime?: string | null; //更新时间
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 标准设备表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResPqStandardDevicePage extends ResPage<ResPqStandardDevice> {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,38 +2,37 @@ import type { ReqPage, ResPage } from '@/api/interface'
|
||||
|
||||
// 检测脚本模块
|
||||
export namespace TestScript {
|
||||
|
||||
|
||||
/**
|
||||
* 检测脚本表格分页查询参数
|
||||
*/
|
||||
export interface ReqTestScriptParams extends ReqPage{
|
||||
id: string; // 装置序号id 必填
|
||||
name: string;
|
||||
type: string;
|
||||
pattern:string;
|
||||
}
|
||||
/**
|
||||
* 检测脚本表格分页查询参数
|
||||
*/
|
||||
export interface ReqTestScriptParams extends ReqPage {
|
||||
id: string // 装置序号id 必填
|
||||
name: string
|
||||
type: string
|
||||
pattern: string
|
||||
}
|
||||
|
||||
// 检测脚本接口
|
||||
export interface ResTestScript {
|
||||
id?: string; //检测脚本ID
|
||||
name: string; //检测脚本名称
|
||||
type: string; //设定0为脚本,1为模板
|
||||
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
||||
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||
standardName: string;//参照标准名称
|
||||
standardTime: string;//标准推行时间
|
||||
state:number;//
|
||||
createBy?: string;
|
||||
createTime?: string;
|
||||
updateBy?: string;
|
||||
updateTime?: string;
|
||||
id?: string //检测脚本ID
|
||||
name: string //检测脚本名称
|
||||
type: string //设定0为脚本,1为模板
|
||||
pattern: string //检测脚本模式(字典表Code字段,数字、模拟、比对)
|
||||
valueType?: string //脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||
standardName: string //参照标准名称
|
||||
standardTime: string //标准推行时间
|
||||
state?: number //
|
||||
createBy?: string
|
||||
createTime?: string
|
||||
updateBy?: string
|
||||
updateTime?: string
|
||||
selectedValue?: string
|
||||
ratedCurr?: number
|
||||
ratedVolt?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测脚本查询分页返回的对象;
|
||||
*/
|
||||
export interface ResTestScriptPage extends ResPage<ResTestScript> {
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 检测脚本查询分页返回的对象;
|
||||
*/
|
||||
export interface ResTestScriptPage extends ResPage<ResTestScript> {}
|
||||
}
|
||||
|
||||
51
frontend/src/api/device/report/index.ts
Normal file
51
frontend/src/api/device/report/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type {PqReport} from '@/api/device/interface/report'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
* @name 报告模版模块
|
||||
*/
|
||||
|
||||
//获取报告模版
|
||||
export const getPqReportList = (params: PqReport.ReqReportParams) => {
|
||||
return http.post(`/report/list`, params)
|
||||
}
|
||||
|
||||
//新增报告模版
|
||||
export const addPqReport = (params: PqReport.ResReport) => {
|
||||
return http.upload(`/report/add`, params)
|
||||
}
|
||||
|
||||
//删除报告模版
|
||||
export const deletePqReport = (params: string[]) => {
|
||||
return http.post(`/report/delete`, params)
|
||||
}
|
||||
|
||||
//查询报告模板详情
|
||||
export const getPqReportById = (params: PqReport.ResReport) => {
|
||||
return http.get(`/report/getById?id=${params.id}`)
|
||||
}
|
||||
|
||||
//修改报告模板
|
||||
export const updatePqReport = (params: PqReport.ResReport) => {
|
||||
return http.upload(`/report/update`, params)
|
||||
}
|
||||
|
||||
//查询所有报告模板名称
|
||||
export const getPqReportAllName = () => {
|
||||
return http.get(`/report/listAllName`)
|
||||
}
|
||||
|
||||
//根据名称查询指定报告模板的所有版本
|
||||
export const getPqReportAllVersion = (params:any) => {
|
||||
return http.get(`/report/listAllVersion?name=${params.name}`)
|
||||
}
|
||||
|
||||
//被检设备归档
|
||||
export const documentedPqDev = (ids: string[]) => {
|
||||
return http.post(`/report/documented`, ids)
|
||||
}
|
||||
|
||||
//上传报告到云端
|
||||
export const uploadReportToCloud = (deviceIds: string[]) => {
|
||||
return http.post(`/report/uploadReportToCloud`, deviceIds)
|
||||
}
|
||||
51
frontend/src/api/device/standardDevice/index.ts
Normal file
51
frontend/src/api/device/standardDevice/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type {StandardDevice} from '@/api/device/interface/standardDevice'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
* @name 标准设备管理模块
|
||||
*/
|
||||
|
||||
//获取标准设备
|
||||
export const getPqStandardDevList = (params: StandardDevice.ReqPqStandardDeviceParams) => {
|
||||
return http.post(`/pqStandardDev/list`, params)
|
||||
}
|
||||
|
||||
//根据id查询标准设备
|
||||
export const getPqStandardDevById = (params: StandardDevice.ReqPqStandardDeviceParams) => {
|
||||
return http.get(`/pqStandardDev/getById?id=${params.id}`)
|
||||
}
|
||||
|
||||
//添加标准设备
|
||||
export const addPqStandardDev = (params: StandardDevice.ResPqStandardDevice) => {
|
||||
return http.post(`/pqStandardDev/add`, params)
|
||||
}
|
||||
|
||||
//编辑标准设备
|
||||
export const updatePqStandardDev = (params: StandardDevice.ResPqStandardDevice) => {
|
||||
return http.post(`/pqStandardDev/update`, params)
|
||||
}
|
||||
|
||||
//删除标准设备
|
||||
export const deletePqStandardDev = (params: string[]) => {
|
||||
return http.post(`/pqStandardDev/delete`, params)
|
||||
}
|
||||
|
||||
|
||||
//导出标准设备
|
||||
export const exportPqStandardDev = (params: StandardDevice.ReqPqStandardDeviceParams) => {
|
||||
return http.download(`/pqStandardDev/export`, params)
|
||||
}
|
||||
// 下载导入文件模板
|
||||
export const downloadTemplate = () => {
|
||||
return http.download(`/pqStandardDev/downloadTemplate`)
|
||||
}
|
||||
|
||||
//导入标准设备
|
||||
export const importPqStandardDev = (params: StandardDevice.ReqPqStandardDeviceParams) => {
|
||||
return http.uploadExcel(`/pqStandardDev/import`, params)
|
||||
}
|
||||
|
||||
//获取所有标准设备
|
||||
export const getAllPqStandardDev = () => {
|
||||
return http.get(`/pqStandardDev/getAll`)
|
||||
}
|
||||
@@ -1,21 +1,53 @@
|
||||
import type { TestScript } from '@/api/device/interface/testScript'
|
||||
import http from '@/api'
|
||||
import { Loading } from '@element-plus/icons-vue'
|
||||
|
||||
/**
|
||||
* @name 检测脚本管理模块
|
||||
*/
|
||||
// 新增脚本
|
||||
export const pqScriptAdd = (params: TestScript.ResTestScript) => {
|
||||
return http.post(`/pqScript/add`, params)
|
||||
}
|
||||
// 修改脚本
|
||||
export const pqScriptUpdate = (params: TestScript.ResTestScript) => {
|
||||
return http.post(`/pqScript/update`, params)
|
||||
}
|
||||
// 获取检测脚本列表
|
||||
export const getPqScriptList = (params: TestScript.ReqTestScriptParams) => {
|
||||
return http.post(`/pqScript/list`, params)
|
||||
return http.post(`/pqScript/list`, params)
|
||||
}
|
||||
|
||||
|
||||
//升级为模版
|
||||
export const updatePqScript = (params: TestScript.ResTestScript) => {
|
||||
return http.get(`/pqScript/upgradeToTemplate?id=${params.id}`)
|
||||
return http.get(`/pqScript/upgradeToTemplate?id=${params.id}`)
|
||||
}
|
||||
|
||||
//删除检测脚本
|
||||
export const deletePqScript = (params: string[]) => {
|
||||
return http.post(`/pqScript/delete`, params)
|
||||
return http.post(`/pqScript/delete`, params)
|
||||
}
|
||||
//添加检测脚本
|
||||
export const addScriptDtls = (params: any) => {
|
||||
return http.post(`/pqScript/addScriptDtls`, params)
|
||||
}
|
||||
//根据脚本id查询检测脚本详情
|
||||
export const dlsDetails = (params: any) => {
|
||||
return http.post(`/pqScript/dlsDetails`, params)
|
||||
}
|
||||
// 删除脚本
|
||||
export const deleteDtls = (params: any) => {
|
||||
return http.post(`/pqScript/deleteDtls`, params)
|
||||
}
|
||||
// 启用关闭脚本
|
||||
export const updateDtls = (params: any) => {
|
||||
return http.post(`/pqScript/updateDtls`, params)
|
||||
}
|
||||
// 根据通讯参数生成装置下发原始数据公式
|
||||
export const scriptDtlsCheckDataList = (params: any) => {
|
||||
return http.post(`/pqScript/scriptDtlsCheckDataList`, params,{loading: false})
|
||||
}
|
||||
// 通讯脚本回显
|
||||
export const checkDataList = (params: any) => {
|
||||
return http.post(`/pqScript/checkDataList`, params, { loading: true })
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ import http from "@/api";
|
||||
|
||||
//系数校准发送基本信息
|
||||
export const getCoefficientCheck = (params: any) => {
|
||||
return http.post(`/prepare/coefficientCheck`, params)
|
||||
return http.post(`/prepare/coefficientCheck`, params,{loading: false})
|
||||
}
|
||||
@@ -39,13 +39,14 @@ class RequestHttp {
|
||||
*/
|
||||
this.service.interceptors.request.use(
|
||||
(config: CustomAxiosRequestConfig) => {
|
||||
isFirst = true
|
||||
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('Authorization', 'Bearer ' + userStore.accessToken)
|
||||
config.headers.set('Refresh-Token', userStore.refreshToken)
|
||||
config.headers.set('Is-Refresh-Token', userStore.isRefreshToken+"")
|
||||
}
|
||||
return config
|
||||
},
|
||||
@@ -67,11 +68,15 @@ 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后,重新请求
|
||||
userStore.setAccessToken(result.data.accessToken)
|
||||
userStore.setRefreshToken(result.data.refreshToken)
|
||||
userStore.setIsRefreshToken(false)
|
||||
userStore.setExp(1000 * 60 * 60 * 24 * 30)
|
||||
response.config.headers.Authorization = `Bearer ${result.data.accessToken}`//重新请求前需要将更新后的新token更换掉之前无效的token,不然会死循环
|
||||
const resp = await this.service.request(response.config)
|
||||
return resp
|
||||
@@ -80,15 +85,15 @@ class RequestHttp {
|
||||
}
|
||||
}
|
||||
// 登陆失效
|
||||
if (data.code == ResultEnum.OVERDUE) {
|
||||
if (data.code === ResultEnum.OVERDUE) {
|
||||
console.log("登陆失效")
|
||||
userStore.setAccessToken('')
|
||||
userStore.setRefreshToken('')
|
||||
userStore.setUserInfo({ name: '' })
|
||||
router.replace(LOGIN_URL)
|
||||
if(data.code != ResultEnum.OVERDUE){//临时处理token失效弹窗多次
|
||||
ElMessage.error(data.message)
|
||||
}else if(isFirst){
|
||||
userStore.setIsRefreshToken(false)
|
||||
userStore.setUserInfo({ id:'',name: '' })
|
||||
userStore.setExp(0)
|
||||
await router.replace(LOGIN_URL)
|
||||
if(isFirst){//临时处理token失效弹窗多次
|
||||
ElMessage.error(data.message)
|
||||
isFirst = false
|
||||
}
|
||||
@@ -97,14 +102,29 @@ class RequestHttp {
|
||||
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
||||
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
||||
if(data.message.includes('&')){
|
||||
const formattedMessage = data.message.split('&').join('<br>');
|
||||
let formattedMessage = data.message.split('&').join('<br>');
|
||||
if (data.message.includes(':')) {
|
||||
formattedMessage = formattedMessage.replace(':', '')
|
||||
}
|
||||
ElMessage.error({ message: formattedMessage, dangerouslyUseHTMLString: true });
|
||||
return Promise.reject(data)
|
||||
}
|
||||
}
|
||||
|
||||
ElMessage.error(data.message)
|
||||
return Promise.reject(data)
|
||||
}
|
||||
// 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑)
|
||||
|
||||
if (userStore.exp <= Date.now() && userStore.exp !== 0) {
|
||||
userStore.setAccessToken('')
|
||||
userStore.setRefreshToken('')
|
||||
userStore.setIsRefreshToken(false)
|
||||
userStore.setUserInfo({ id:'',name: '' })
|
||||
userStore.setExp(0)
|
||||
ElMessage.error('登录已过期,请重新登录!')
|
||||
await router.replace(LOGIN_URL)
|
||||
return Promise.reject(data)
|
||||
}
|
||||
return data
|
||||
},
|
||||
async (error: AxiosError) => {
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface Result {
|
||||
* 请求响应参数(包含data)
|
||||
*/
|
||||
export interface ResultData<T = any> extends Result {
|
||||
map(arg0: (item: any) => { label: any; value: any; }): { label: string; value: string; }[] | { label: string; value: string; }[];
|
||||
data: T;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ export namespace Plan {
|
||||
export interface ResPlan {
|
||||
id: string; //检测计划ID
|
||||
name: string; //检测计划名称
|
||||
pattern: string; //模式,字典表(数字、模拟、比对)
|
||||
pattern?: string; //模式,字典表(数字、模拟、比对)
|
||||
fatherPlanId?: string; //父计划ID
|
||||
dataSourceId: string; //数据源ID
|
||||
scriptId: string; //检测脚本ID
|
||||
@@ -22,6 +22,18 @@ export namespace Plan {
|
||||
createTime?:string; //创建时间
|
||||
updateBy?:string; //更新用户
|
||||
updateTime?:string; //更新时间
|
||||
|
||||
associateReport:number;//是否关联报告模板 0否 1是
|
||||
reportTemplateName:string;
|
||||
reportTemplateVersion:string;
|
||||
dataRule:string;//数据处理原则
|
||||
|
||||
standardDevIds:string[];
|
||||
standardDevMap:Map<string,number>;//标准设备
|
||||
testItems:string[];//测试项
|
||||
Check_By?:string;//计划检测人
|
||||
progress?: number; // 进度百分比,例如 75
|
||||
children?: ResPlan[];
|
||||
}
|
||||
|
||||
// 检测计划 + 分页
|
||||
@@ -32,11 +44,13 @@ export namespace Plan {
|
||||
|
||||
export interface ReqPlan extends ResPlan {
|
||||
datasourceIds:string;
|
||||
sourceIds: string;
|
||||
sourceIds: string | null;
|
||||
planId:string;
|
||||
scriptName: string ;
|
||||
errorSysName: string;
|
||||
sourceName: string ;
|
||||
standardDevNameStr: string;
|
||||
testItemNameStr:string;
|
||||
devIds: string[];
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Plan } from './interface'
|
||||
import http from '@/api'
|
||||
import type { ErrorSystem } from '../device/interface/error'
|
||||
import type { Device } from '../device/interface/device'
|
||||
import { ReqDevReportParams } from '@/api/device/interface/device'
|
||||
import { pa } from 'element-plus/es/locale/index.mjs'
|
||||
|
||||
/**
|
||||
* @name 检测计划管理模块
|
||||
@@ -23,8 +23,8 @@ export const updatePlan = (params: any) => {
|
||||
}
|
||||
|
||||
// 删除检测计划
|
||||
export const deletePlan = (params: { id: string[] }) => {
|
||||
return http.post(`/adPlan/delete`, params)
|
||||
export const deletePlan = (params: { id: string[] ,pattern: string}) => {
|
||||
return http.post(`/adPlan/delete?pattern=${params.pattern}`, params.id)
|
||||
}
|
||||
|
||||
// 获取指定模式下所有检测源
|
||||
@@ -49,7 +49,7 @@ export const getUnboundPqDevList = (params: Plan.ReqPlan) => {
|
||||
|
||||
//根据检测计划id查询出所有已绑定的设备
|
||||
export const getBoundPqDevList = (params: any) => {
|
||||
return http.post(`/pqDev/listByPlanId`, params)
|
||||
return http.post(`/adPlan/listByPlanId`, params)
|
||||
}
|
||||
|
||||
//检测计划绑定设备
|
||||
@@ -68,12 +68,12 @@ export const exportPlan = (params: Device.ReqPqDevParams) => {
|
||||
}
|
||||
|
||||
// 下载模板
|
||||
export const downloadTemplate = () => {
|
||||
return http.download(`/adPlan/downloadTemplate`)
|
||||
export const downloadTemplate = (params: { patternId: string }) => {
|
||||
return http.download(`/adPlan/downloadTemplate`, params)
|
||||
}
|
||||
// 导入检测计划
|
||||
export const importPlan = (params: Device.ReqPqDevParams) => {
|
||||
return http.upload(`/adPlan/import`, params)
|
||||
return http.uploadExcel(`/adPlan/import`, params)
|
||||
}
|
||||
|
||||
// 装置检测报告生成
|
||||
@@ -84,4 +84,38 @@ export const generateDevReport = (params: Device.ReqDevReportParams) => {
|
||||
// 装置检测报告下载
|
||||
export const downloadDevData = (params: Device.ReqDevReportParams) => {
|
||||
return http.download(`/report/downloadReport`, params)
|
||||
}
|
||||
|
||||
export const staticsAnalyse = (params: { id: string[] }) => {
|
||||
return http.download('/adPlan/analyse', params)
|
||||
}
|
||||
|
||||
//根据计划id分页查询被检设
|
||||
export const getDevListByPlanId = (params:any) => {
|
||||
return http.post(`/adPlan/listDevByPlanId`, params)
|
||||
}
|
||||
|
||||
//修改子计划名称
|
||||
export const updateSubPlanName = (params:Plan.ReqPlan) => {
|
||||
return http.get(`/adPlan/updateSubPlanName?planId=${params.id}&name=${params.name}`)
|
||||
}
|
||||
|
||||
//子计划绑定/解绑标准设备
|
||||
export const subPlanBindStandardDevList = (params:Plan.ReqPlan) => {
|
||||
return http.post(`/adPlan/updateBindStandardDev`, params)
|
||||
}
|
||||
|
||||
//子计划绑定/解绑被检设备
|
||||
export const subPlanBindDev = (params:Plan.ReqPlan) => {
|
||||
return http.post(`/adPlan/updateBindDev`, params)
|
||||
}
|
||||
|
||||
//根据父计划ID获取未被子计划绑定的标准设备
|
||||
export const getUnboundStandardDevList = (params:Plan.ResPlan) => {
|
||||
return http.get(`/adPlan/getUnBoundStandardDev?fatherPlanId=${params.fatherPlanId}`)
|
||||
}
|
||||
|
||||
//根据计划ID获取已绑定的标准设备
|
||||
export const getBoundStandardDevList = (params:Plan.ResPlan) => {
|
||||
return http.get(`/adPlan/getBoundStandardDev?planId=${params.id}`)
|
||||
}
|
||||
@@ -13,9 +13,9 @@ export const closePreTest = (params) => {
|
||||
* 开始正式检测
|
||||
* @param params
|
||||
*/
|
||||
export const startTest = (params) => {
|
||||
return http.post(`/prepare/startTest`, params, {loading: false})
|
||||
}
|
||||
// export const startTest = (params) => {
|
||||
// return http.post(`/prepare/startTest`, params, {loading: false})
|
||||
// }
|
||||
|
||||
/**
|
||||
* 暂停正式检测
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
import http from '@/api'
|
||||
import {type Base} from '@/api/system/base/interface'
|
||||
|
||||
@@ -12,6 +13,10 @@ export const updateTestConfig = (params: Base.ResTestConfig) => {
|
||||
return http.post(`/sysTestConfig/update`, params)
|
||||
}
|
||||
|
||||
//场景切换
|
||||
export const updateScene = (params: any) => {
|
||||
return http.post(`/sysTestConfig/update`,params)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ export namespace Base {
|
||||
id: string; //系统配置表Id
|
||||
autoGenerate:number;//检测报告是否自动生成0 否;1是
|
||||
maxTime:number;//最大复检次数,默认3次
|
||||
dataRule:string;//数据处理原则,关联字典(所有值、部分值、cp95值、平均值、任意值),默认任意值
|
||||
state: number; //状态
|
||||
scale:number;//小数位
|
||||
createBy?: string| null; //创建用户
|
||||
createTime?: string| null; //创建时间
|
||||
updateBy?: string| null; //更新用户
|
||||
|
||||
@@ -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) => {
|
||||
const name = params.name || '';
|
||||
return http.get(`/dictTree/getTree?keyword=${name}`, params)
|
||||
export const getDictTreeByCode = (params: Dict.ResDictTree) => {
|
||||
const code = params.code || ''
|
||||
return http.get(`/dictTree/getTreeByCode?code=${code}`, { loading: true })
|
||||
}
|
||||
|
||||
export const getDictTreeByName = (params: Dict.ResDictTree) => {
|
||||
const name = params.name || ''
|
||||
return http.get(`/dictTree/getTreeByName?name=${name}`)
|
||||
}
|
||||
|
||||
//添加字典类型
|
||||
@@ -21,4 +27,3 @@ export const updateDictTree = (params: Dict.ResDictTree) => {
|
||||
export const deleteDictTree = (params: Dict.ResDictTree) => {
|
||||
return http.post(`/dictTree/delete?id=${params.id}`)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import type {AuditLog } from '@/api/system/log/interface/log.ts'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
* @name 审计日志管理模块
|
||||
*/
|
||||
|
||||
//获取审计日志
|
||||
export const getAuditLog = (params: AuditLog.ReqAuditLogParams) => {
|
||||
return http.post(`/sysLog/list`, params)
|
||||
}
|
||||
|
||||
|
||||
export const exportCsv = (params: AuditLog.ReqAuditLogParams) => {
|
||||
return http.download(`/sysLog/exportCSV`, params)
|
||||
}
|
||||
@@ -1,15 +1,36 @@
|
||||
// 审计日志管理模块
|
||||
export namespace Sys_Log_Audit {
|
||||
// 日志列表
|
||||
export interface Audit_LogList {
|
||||
id: string;//日志表Id
|
||||
operate_Type:string;//日志类型
|
||||
ip:string;//操作IP
|
||||
result: string;//事件结果
|
||||
remark: string;//事件描述
|
||||
warn:number;//告警标志
|
||||
create_By:string;//创建用户
|
||||
create_Time:string;//创建时间
|
||||
}
|
||||
import type { ReqPage, ResPage } from '@/api/interface'
|
||||
|
||||
}
|
||||
// 审计日志管理模块
|
||||
export namespace AuditLog {
|
||||
|
||||
/**
|
||||
* 设备类型数据表格分页查询参数
|
||||
*/
|
||||
export interface ReqAuditLogParams extends ReqPage {
|
||||
id: string; //审计日志Id 必填
|
||||
createTime?: string; //创建时间
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备类型新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResAuditLog {
|
||||
id: string;//审计日志Id
|
||||
operate_Type:string;//操作类型
|
||||
ip:string;//操作IP
|
||||
result: string;//事件结果
|
||||
remark: string;//事件描述
|
||||
level:number;//告警等级
|
||||
warn:number;//告警标志
|
||||
create_By:string;//创建用户
|
||||
create_Time:string;//创建时间
|
||||
sort:number;//排序
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备类型表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResAuditLogPage extends ResPage<ResAuditLog> {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,13 @@ export namespace Login {
|
||||
export interface ReqLoginForm {
|
||||
username: string;
|
||||
password: string;
|
||||
checked: boolean;
|
||||
}
|
||||
export interface ResLogin {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
userInfo:{
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +1,60 @@
|
||||
import type { Login } from '@/api/user/interface/user'
|
||||
import { ADMIN as rePrefix } from '@/api/system/config/serviceName'
|
||||
import { pa } from 'element-plus/es/locale/index.mjs';
|
||||
import type {Login} from '@/api/user/interface/user'
|
||||
import {ADMIN as rePrefix} from '@/api/system/config/serviceName'
|
||||
import http from '@/api'
|
||||
import type { Dict } from '@/api/interface'
|
||||
import type {Dict} from '@/api/interface'
|
||||
|
||||
/**
|
||||
* @name 登录模块
|
||||
*/
|
||||
// 用户登录
|
||||
export const loginApi = (params: Login.ReqLoginForm) => {
|
||||
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false })
|
||||
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
||||
export const loginApi = (params: { username: string; password: string}) => {
|
||||
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, {loading: false})
|
||||
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
||||
}
|
||||
// 获取菜单列表
|
||||
export const getAuthMenuListApi = () => {
|
||||
return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, { loading: false })
|
||||
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
||||
return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, {loading: false})
|
||||
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
||||
}
|
||||
// 获取按钮权限
|
||||
export const getAuthButtonListApi = () => {
|
||||
return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, { loading: false })
|
||||
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
||||
return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, {loading: false})
|
||||
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
||||
}
|
||||
// 用户退出登录
|
||||
export const logoutApi = () => {
|
||||
return http.post(`${rePrefix}/logout`)
|
||||
return http.post(`${rePrefix}/logout`)
|
||||
}
|
||||
|
||||
//获取下拉框列表
|
||||
export const getDictList = () =>{
|
||||
return http.get<Dict>('/dictData/dictDataCache')
|
||||
export const getDictList = () => {
|
||||
return http.get<Dict>('/dictData/dictDataCache')
|
||||
}
|
||||
|
||||
//token刷新
|
||||
export const refreshToken = () => {
|
||||
return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`,
|
||||
{},
|
||||
{ loading: false }
|
||||
return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`,
|
||||
{},
|
||||
{loading: false}
|
||||
)
|
||||
}
|
||||
|
||||
//获取场景
|
||||
export const getCurrentScene = () => {
|
||||
return http.get('/sysTestConfig/getCurrentScene', {}, {loading: false})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取RSA公钥
|
||||
*/
|
||||
export const getPublicKey = (username: string) => {
|
||||
return http.get(`/admin/getPublicKey?username=${username}`, {}, {loading: false})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否在检测中自动生成报告
|
||||
*/
|
||||
export const getAutoGenerate = () => {
|
||||
return http.get('/sysTestConfig/getAutoGenerate', {}, {loading: false})
|
||||
}
|
||||
|
||||
@@ -37,3 +37,7 @@ export const updatePassWord = (params: User.ResPassWordUser) => {
|
||||
return http.post(`/sysUser/updatePassword`,params)
|
||||
}
|
||||
|
||||
// 获取所有用户
|
||||
export const getAllUser= () => {
|
||||
return http.get(`/sysUser/getAll`)
|
||||
}
|
||||
|
||||
BIN
frontend/src/assets/images/transient.png
Normal file
BIN
frontend/src/assets/images/transient.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
@@ -48,6 +48,7 @@ export interface ExcelParameterProps {
|
||||
title: string; // 标题
|
||||
showCover?: boolean; // 是否显示”数据覆盖“选项
|
||||
patternId?: string; // 模式ID
|
||||
planId?: string | null ;//计划ID
|
||||
fileSize?: number; // 上传文件的大小
|
||||
fileType?: File.ExcelMimeType[]; // 上传文件的类型
|
||||
tempApi?: (params: any) => Promise<any>; // 下载模板的Api
|
||||
@@ -77,7 +78,7 @@ const acceptParams = (params: ExcelParameterProps) => {
|
||||
// Excel 导入模板下载
|
||||
const downloadTemp = () => {
|
||||
if (!parameter.value.tempApi) return
|
||||
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, {}, false)
|
||||
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, {'pattern':parameter.value.patternId}, false)
|
||||
}
|
||||
|
||||
// 文件上传
|
||||
@@ -87,6 +88,9 @@ const uploadExcel = async (param: UploadRequestOptions) => {
|
||||
if (parameter.value.patternId) {
|
||||
excelFormData.append('patternId', parameter.value.patternId)
|
||||
}
|
||||
|
||||
excelFormData.append('planId', parameter.value.planId)
|
||||
|
||||
isCover.value && excelFormData.append('isCover', isCover.value as unknown as Blob)
|
||||
//await parameter.value.importApi!(excelFormData);
|
||||
await parameter.value.importApi!(excelFormData)
|
||||
@@ -97,6 +101,8 @@ const uploadExcel = async (param: UploadRequestOptions) => {
|
||||
|
||||
|
||||
async function handleImportResponse(res: any) {
|
||||
console.log(res)
|
||||
|
||||
if (res.type === 'application/json') {
|
||||
const fileReader = new FileReader()
|
||||
fileReader.onloadend = () => {
|
||||
@@ -118,7 +124,7 @@ async function handleImportResponse(res: any) {
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = '终端入网检测失败列表'
|
||||
link.download = '导入失败数据'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
|
||||
@@ -119,6 +119,7 @@ import TableColumn from './components/TableColumn.vue'
|
||||
import Sortable from 'sortablejs'
|
||||
|
||||
export interface ProTableProps {
|
||||
|
||||
columns: ColumnProps[]; // 列配置项 ==> 必传
|
||||
data?: any[]; // 静态 table data 数据,若存在则不会使用 requestApi 返回的 data ==> 非必传
|
||||
requestApi?: (params: any) => Promise<any>; // 请求表格数据的 api ==> 非必传
|
||||
|
||||
282
frontend/src/components/echarts/line/index.vue
Normal file
282
frontend/src/components/echarts/line/index.vue
Normal file
@@ -0,0 +1,282 @@
|
||||
<template>
|
||||
<div class="chart">
|
||||
<div ref="chartRef" class="my-chart" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount, onMounted, ref, defineExpose, watch, nextTick } from 'vue'
|
||||
// import echarts from './echarts'
|
||||
import * as echarts from 'echarts' // 全引入
|
||||
// import 'echarts/lib/component/dataZoom'
|
||||
|
||||
const color = [
|
||||
'var(--el-color-primary)',
|
||||
'#07CCCA',
|
||||
'#00BFF5',
|
||||
'#FFBF00',
|
||||
'#77DA63',
|
||||
'#D5FF6B',
|
||||
'#Ff6600',
|
||||
'#FF9100',
|
||||
'#5B6E96',
|
||||
'#66FFCC',
|
||||
'#B3B3B3'
|
||||
]
|
||||
|
||||
const chartRef = ref<HTMLDivElement>()
|
||||
|
||||
const props = defineProps(['options', 'isInterVal', 'pieInterVal'])
|
||||
let chart: echarts.ECharts | any = null
|
||||
const resizeHandler = () => {
|
||||
// 不在视野中的时候不进行resize
|
||||
if (!chartRef.value) return
|
||||
if (chartRef.value.offsetHeight == 0) return
|
||||
chart.getZr().painter.getViewportRoot().style.display = 'none'
|
||||
requestAnimationFrame(() => {
|
||||
chart.resize()
|
||||
chart.getZr().painter.getViewportRoot().style.display = ''
|
||||
})
|
||||
}
|
||||
const initChart = () => {
|
||||
if (!props.isInterVal && !props.pieInterVal) {
|
||||
chart?.dispose()
|
||||
}
|
||||
// chart?.dispose()
|
||||
chart = echarts.init(chartRef.value as HTMLDivElement)
|
||||
const options = {
|
||||
title: {
|
||||
left: 'center',
|
||||
// textStyle: {
|
||||
color: '#000',
|
||||
fontSize: 18,
|
||||
// },
|
||||
...(props.options?.title || null)
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow',
|
||||
label: {
|
||||
color: '#fff',
|
||||
fontSize: 16
|
||||
}
|
||||
},
|
||||
textStyle: {
|
||||
color: '#fff',
|
||||
fontStyle: 'normal',
|
||||
opacity: 0.35,
|
||||
fontSize: 14
|
||||
},
|
||||
backgroundColor: 'rgba(0,0,0,0.55)',
|
||||
borderWidth: 0,
|
||||
confine: true,
|
||||
...(props.options?.tooltip || null)
|
||||
},
|
||||
|
||||
legend: {
|
||||
right: 20,
|
||||
top: 0,
|
||||
itemGap: 10,
|
||||
itemStyle: {},
|
||||
// textStyle: {
|
||||
fontSize: 12,
|
||||
padding: [2, 0, 0, 0], //[上、右、下、左]
|
||||
// },
|
||||
itemWidth: 15,
|
||||
itemHeight: 10,
|
||||
...(props.options?.legend || null)
|
||||
},
|
||||
grid: {
|
||||
top: '60px',
|
||||
left: '30px',
|
||||
right: '70px',
|
||||
bottom: props.options?.options?.dataZoom === null ? '10px' : '40px',
|
||||
containLabel: true,
|
||||
...(props.options?.grid || null)
|
||||
},
|
||||
xAxis: props.options?.xAxis ? handlerXAxis() : null,
|
||||
yAxis: props.options?.yAxis ? handlerYAxis() : null,
|
||||
dataZoom: props.options?.dataZoom || [
|
||||
{
|
||||
type: 'inside',
|
||||
height: 13,
|
||||
start: 0,
|
||||
bottom: '20px',
|
||||
end: 100
|
||||
},
|
||||
{
|
||||
start: 0,
|
||||
height: 13,
|
||||
bottom: '20px',
|
||||
end: 100
|
||||
}
|
||||
],
|
||||
color: props.options?.color || color,
|
||||
series: props.options?.series,
|
||||
...props.options?.options
|
||||
}
|
||||
// console.log(options.series,"获取x轴");
|
||||
handlerBar(options)
|
||||
|
||||
// 处理柱状图
|
||||
chart.setOption(options, true)
|
||||
|
||||
setTimeout(() => {
|
||||
chart.resize()
|
||||
}, 0)
|
||||
}
|
||||
const handlerBar = (options: any) => {
|
||||
if (Array.isArray(options.series)) {
|
||||
options.series.forEach((item: any) => {
|
||||
if (item.type === 'bar') {
|
||||
item.barMinHeight = 10
|
||||
item.barMaxWidth = 20
|
||||
item.itemStyle = Object.assign(
|
||||
{
|
||||
color: (params: any) => {
|
||||
if (params.value == 0 || params.value == 3.14159) {
|
||||
return '#ccc'
|
||||
} else {
|
||||
return props.options?.color
|
||||
? props.options?.color[params.seriesIndex]
|
||||
: color[params.seriesIndex]
|
||||
}
|
||||
}
|
||||
},
|
||||
item.itemStyle
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
const handlerYAxis = () => {
|
||||
let temp = {
|
||||
type: 'value',
|
||||
nameGap: 15,
|
||||
nameTextStyle: {
|
||||
color: '#000'
|
||||
},
|
||||
splitNumber: 5,
|
||||
minInterval: 1,
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: '#000'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
color: '#000',
|
||||
fontSize: 14,
|
||||
formatter: function (value) {
|
||||
return value.toFixed(0) // 格式化显示为一位小数
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
// 使用深浅的间隔色
|
||||
color: ['#ccc'],
|
||||
type: 'dashed',
|
||||
opacity: 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
// props.options?.xAxis 是数组还是对象
|
||||
if (Array.isArray(props.options?.yAxis)) {
|
||||
return props.options?.yAxis.map((item: any) => {
|
||||
return {
|
||||
...temp,
|
||||
...item
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return {
|
||||
...temp,
|
||||
...props.options?.yAxis
|
||||
}
|
||||
}
|
||||
}
|
||||
const handlerXAxis = () => {
|
||||
let temp = {
|
||||
type: 'category',
|
||||
axisTick: { show: false },
|
||||
nameTextStyle: {
|
||||
color: '#000'
|
||||
},
|
||||
axisLine: {
|
||||
// lineStyle: {
|
||||
color: '#000'
|
||||
// }
|
||||
},
|
||||
axisLabel: {
|
||||
// textStyle: {
|
||||
fontFamily: 'dinproRegular',
|
||||
color: '#000',
|
||||
fontSize: '12'
|
||||
// }
|
||||
}
|
||||
// boundaryGap: false,
|
||||
}
|
||||
// props.options?.xAxis 是数组还是对象
|
||||
if (Array.isArray(props.options?.xAxis)) {
|
||||
return props.options?.xAxis.map((item: any) => {
|
||||
return {
|
||||
...temp,
|
||||
...item
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return {
|
||||
...temp,
|
||||
...props.options?.xAxis
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let throttle: ReturnType<typeof setTimeout>
|
||||
// 动态计算table高度
|
||||
const resizeObserver = new ResizeObserver(entries => {
|
||||
for (const entry of entries) {
|
||||
if (throttle) {
|
||||
clearTimeout(throttle)
|
||||
}
|
||||
throttle = setTimeout(() => {
|
||||
resizeHandler()
|
||||
}, 100)
|
||||
}
|
||||
})
|
||||
onMounted(() => {
|
||||
initChart()
|
||||
resizeObserver.observe(chartRef.value!)
|
||||
})
|
||||
defineExpose({ initChart })
|
||||
onBeforeUnmount(() => {
|
||||
resizeObserver.unobserve(chartRef.value!)
|
||||
chart?.dispose()
|
||||
})
|
||||
watch(
|
||||
() => props.options,
|
||||
(newVal, oldVal) => {
|
||||
initChart()
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.chart {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
|
||||
.el-button {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: -60px;
|
||||
}
|
||||
|
||||
.my-chart {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -3,11 +3,13 @@
|
||||
// 首页地址(默认)
|
||||
export const HOME_URL: string = "/home/index";
|
||||
|
||||
// export const HOME_URL: string = "/machine/controlSource";
|
||||
|
||||
// 登录页地址(默认)
|
||||
export const LOGIN_URL: string = "/login";
|
||||
|
||||
// 默认主题颜色
|
||||
export const DEFAULT_PRIMARY: string = "#003078";
|
||||
export const DEFAULT_PRIMARY: string = "#526ADE";
|
||||
|
||||
// 路由白名单地址(本地存在的路由 staticRouter.ts 中)
|
||||
export const ROUTER_WHITE_LIST: string[] = ["/500"];
|
||||
@@ -17,3 +19,5 @@ export const AMAP_MAP_KEY: string = "";
|
||||
|
||||
// 百度地图 key
|
||||
export const BAIDU_MAP_KEY: string = "";
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
export enum ResultEnum {
|
||||
SUCCESS = "A0000",
|
||||
ERROR = 500,
|
||||
ACCESSTOKEN_EXPIRED = 401,
|
||||
OVERDUE = 4001,
|
||||
ACCESSTOKEN_EXPIRED = "A0024",
|
||||
OVERDUE = "A0025",
|
||||
TIMEOUT = 30000,
|
||||
TYPE = "success"
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ export const useTable = (
|
||||
});
|
||||
dataCallBack && (data = dataCallBack(data));
|
||||
state.tableData = isPageable ? data.records : data;
|
||||
//console.log(data);
|
||||
// 解构后台返回的分页数据 (如果有分页更新分页信息)
|
||||
if (isPageable) {
|
||||
state.resPageable.total = data.total;
|
||||
@@ -85,6 +86,7 @@ export const useTable = (
|
||||
state.resPageable.size = data.size;
|
||||
}
|
||||
} catch (error) {
|
||||
//console.log('123');
|
||||
requestError && requestError(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,6 +27,7 @@ export const useTheme = () => {
|
||||
|
||||
// 修改主题颜色
|
||||
const changePrimary = (val: string | null) => {
|
||||
|
||||
if (!val) {
|
||||
val = DEFAULT_PRIMARY;
|
||||
ElMessage({ type: "success", message: `主题颜色已重置为 ${DEFAULT_PRIMARY}` });
|
||||
@@ -40,10 +41,13 @@ export const useTheme = () => {
|
||||
for (let i = 1; i <= 9; i++) {
|
||||
const primaryColor = isDark.value ? `${getDarkColor(val, i / 10)}` : `${getLightColor(val, i / 10)}`;
|
||||
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, primaryColor);
|
||||
|
||||
// const colorValue = document.documentElement.style.getPropertyValue(`--el-color-primary-light-${i}`).trim();
|
||||
// console.log(`--el-color-primary-light-${i}: ${colorValue}`);
|
||||
}
|
||||
globalStore.setGlobalState("primary", val);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
// 灰色和弱色切换
|
||||
const changeGreyOrWeak = (type: Theme.GreyOrWeakType, value: boolean) => {
|
||||
const body = document.body as HTMLElement;
|
||||
|
||||
@@ -26,6 +26,8 @@ export default {
|
||||
changePassword: "Change Password",
|
||||
changeMode:"Change Mode",
|
||||
versionRegister:"Version Register",
|
||||
changeTheme: "Change Theme",
|
||||
changeScene: "Change Scene",
|
||||
logout: "Logout"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,6 +26,8 @@ export default {
|
||||
changePassword: "修改密码",
|
||||
changeMode:"模式切换",
|
||||
versionRegister:"版本注册",
|
||||
changeTheme:"主题切换",
|
||||
changeScene: "场景切换",
|
||||
logout: "退出登录"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
}
|
||||
.el-menu-item:hover {
|
||||
color: #fff; //一级导航划过颜色
|
||||
background-color: #5274a5 !important; //一级导航划过背景色
|
||||
//background-color: #5274a5 !important; //一级导航划过背景色
|
||||
background-color:var(--el-color-primary-light-3) !important;
|
||||
|
||||
}
|
||||
.el-sub-menu__hide-arrow {
|
||||
width: 65px;
|
||||
@@ -47,7 +49,9 @@
|
||||
}
|
||||
.el-menu-item.is-active {
|
||||
color: #fff !important; //一级导航文字选中颜色
|
||||
background-color: #5274a5 !important; //一级导航选中背景色
|
||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
border-bottom: 0 !important;
|
||||
}
|
||||
.el-sub-menu__title {
|
||||
@@ -67,7 +71,9 @@
|
||||
color: #fff !important; //二级导航文字选中颜色
|
||||
// background-color: var(--el-color-primary) !important;
|
||||
// background-color: #5274a5 !important;//二级导航选中背景色
|
||||
background-color: #5274a5 !important;
|
||||
|
||||
//background-color: #7588e5 !important;
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
border-bottom-color: var(--el-color-primary) !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
>数字式模块</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item @click="handelOpen('比对式')"
|
||||
>比对式模块</el-dropdown-item
|
||||
>比对式模块</el-dropdown-item
|
||||
>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<p style="margin: 0;">
|
||||
<p style="margin: 0;" >
|
||||
<a href="http://www.shining-electric.com/" target="_blank">
|
||||
2024 © 南京灿能电力自动化股份有限公司
|
||||
</a>
|
||||
@@ -42,25 +42,12 @@ import { ref, reactive, computed, onMounted, watch } from "vue";
|
||||
import { useAuthStore } from "@/stores/modules/auth";
|
||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
||||
import { useRouter } from "vue-router";
|
||||
const title = ref("模拟式模块");
|
||||
const router = useRouter();
|
||||
const authStore = useAuthStore();
|
||||
const modeStore = useModeStore();
|
||||
|
||||
onMounted(() => {
|
||||
switch (modeStore.currentMode) {
|
||||
case '模拟式':
|
||||
title.value = '模拟式模块';
|
||||
break;
|
||||
case '数字式':
|
||||
title.value = '数字式模块';
|
||||
break;
|
||||
case '比对式':
|
||||
title.value = '比对式模块';
|
||||
break;
|
||||
default:
|
||||
title.value = '模拟式模块';
|
||||
}
|
||||
const title = computed(() => {
|
||||
return modeStore.currentMode=== ''? '模拟式模块' : modeStore.currentMode+'模块';
|
||||
});
|
||||
|
||||
const handelOpen = async (item: string) => {
|
||||
@@ -117,10 +104,11 @@ const handelOpen = async (item: string) => {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
text-align: right;
|
||||
line-height: 40px;
|
||||
a {
|
||||
color: #fff;
|
||||
margin-right: 25px; // 增加右边距
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
<template>
|
||||
<!-- <div class="userInfo">-->
|
||||
<!-- <div class="icon">-->
|
||||
<!-- <Avatar/>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="username">-->
|
||||
<!-- {{ username }}-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<el-dropdown trigger="click">
|
||||
<div class="userInfo">
|
||||
<div class="userInfo">
|
||||
<div class="icon">
|
||||
<Avatar />
|
||||
</div>
|
||||
@@ -10,18 +18,43 @@
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="openDialog('themeRef')">
|
||||
<el-icon><Sunny /></el-icon>{{ t("header.changeTheme") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDialog('infoRef')">
|
||||
<el-icon><User /></el-icon>{{ $t("header.personalData") }}
|
||||
<el-icon><User /></el-icon>{{ t("header.personalData") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDialog('passwordRef')">
|
||||
<el-icon><Edit /></el-icon>{{ $t("header.changePassword") }}
|
||||
<el-icon><Edit /></el-icon>{{ t("header.changePassword") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="changeMode">
|
||||
<el-icon><Edit /></el-icon>{{ $t("header.changeMode") }}
|
||||
<el-icon><Switch /></el-icon>{{ t("header.changeMode") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDialog('versionRegisterRef')">
|
||||
<el-icon><SetUp /></el-icon>{{ $t("header.versionRegister") }}
|
||||
<el-icon><SetUp /></el-icon>{{ t("header.versionRegister") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown trigger="hover" placement="left-start" v-if="userStore.userInfo.loginName == 'root'">
|
||||
<div class="custom-dropdown-trigger">
|
||||
<el-icon><Tools /></el-icon>
|
||||
<span>{{ t("header.changeScene") }}</span>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
v-for="item in dictStore.getDictData('app_scene')"
|
||||
:key="item.value"
|
||||
:class="{
|
||||
'custom-dropdown-item': true,
|
||||
active: item.value === appSceneStore.currentScene
|
||||
}"
|
||||
@click="changeScene(item.value?? '')"
|
||||
:disabled = "item.value === appSceneStore.currentScene"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@@ -34,6 +67,9 @@
|
||||
<PasswordDialog ref="passwordRef"></PasswordDialog>
|
||||
<!-- versionRegisterDialog -->
|
||||
<VersionDialog ref="versionRegisterRef"></VersionDialog>
|
||||
<!-- ThemeDialog -->
|
||||
<ThemeDialog ref="themeRef"></ThemeDialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -42,12 +78,13 @@ import { LOGIN_URL } from "@/config";
|
||||
import { useRouter } from "vue-router";
|
||||
import { logoutApi } from "@/api/user/login";
|
||||
import { useUserStore } from "@/stores/modules/user";
|
||||
import { ElMessageBox, ElMessage } from "element-plus";
|
||||
import { ElMessageBox, ElMessage, CHANGE_EVENT } from "element-plus";
|
||||
import InfoDialog from "./InfoDialog.vue";
|
||||
import PasswordDialog from "./PasswordDialog.vue";
|
||||
import ThemeDialog from "./ThemeDialog.vue";
|
||||
import VersionDialog from "@/views/system/versionRegister/index.vue";
|
||||
import { computed } from "vue";
|
||||
import { Avatar } from "@element-plus/icons-vue";
|
||||
import { ArrowLeft, Avatar, Delete, Document, Sunny, Switch ,Tools} from "@element-plus/icons-vue";
|
||||
import AssemblySize from "./components/AssemblySize.vue";
|
||||
import Language from "./components/Language.vue";
|
||||
import SearchMenu from "./components/SearchMenu.vue";
|
||||
@@ -60,10 +97,21 @@ import { useModeStore,useAppSceneStore } 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 AppSceneStore = useAppSceneStore();
|
||||
import { useTheme } from "@/hooks/useTheme";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import {updateScene} from '@/api/system/base/index'
|
||||
|
||||
|
||||
const { changePrimary} = useTheme();
|
||||
|
||||
// 初始化 i18n
|
||||
const { t } = useI18n(); // 使用 t 方法替代 $t
|
||||
|
||||
// 退出登录
|
||||
const logout = () => {
|
||||
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
|
||||
@@ -76,7 +124,9 @@ const logout = () => {
|
||||
// 2.清除 Token
|
||||
userStore.setAccessToken("");
|
||||
userStore.setRefreshToken("");
|
||||
userStore.setUserInfo({name: ""});
|
||||
userStore.setExp(0)
|
||||
userStore.setUserInfo({id: "", name: ""});
|
||||
userStore.setIsRefreshToken(false)
|
||||
dictStore.setDictData([]);
|
||||
modeStore.setCurrentMode('');
|
||||
AppSceneStore.setCurrentMode('');
|
||||
@@ -92,12 +142,26 @@ const logout = () => {
|
||||
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
|
||||
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
|
||||
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null);
|
||||
|
||||
const themeRef = ref<InstanceType<typeof ThemeDialog> | null>(null);
|
||||
const openDialog = (ref: string) => {
|
||||
if (ref == "infoRef") infoRef.value?.openDialog();
|
||||
if (ref == "passwordRef") passwordRef.value?.openDialog();
|
||||
if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog();
|
||||
if (ref == "themeRef") themeRef.value?.openDialog();
|
||||
|
||||
};
|
||||
|
||||
|
||||
const appSceneStore = useAppSceneStore();
|
||||
|
||||
const changeScene = async (value: string) => {
|
||||
appSceneStore.setCurrentMode(value);
|
||||
await updateScene({scene :dictStore.getDictData('app_scene').find(item => item.value == value)?.id});
|
||||
// 强制刷新页面
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
|
||||
//模式切换
|
||||
const changeMode = () => {
|
||||
authStore.changeModel();
|
||||
@@ -137,4 +201,18 @@ const changeMode = () => {
|
||||
// height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.custom-dropdown-trigger {
|
||||
padding: 8px 15px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
:deep(.el-dropdown-menu__item.custom-dropdown-item.active),
|
||||
:deep(.el-dropdown-menu__item.custom-dropdown-item.active:hover) {
|
||||
background-color: var(--el-color-primary-light-9) !important;
|
||||
color: var(--el-color-primary)
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" title="主题切换" width="500px" draggable>
|
||||
<el-divider content-position="center">主题颜色</el-divider>
|
||||
<div style="display: flex; justify-content: center;">
|
||||
<el-color-picker v-model="color" />
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="sure">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useTheme } from "@/hooks/useTheme";
|
||||
import { on } from "events";
|
||||
const color = ref('')
|
||||
const { changePrimary} = useTheme();
|
||||
|
||||
const dialogVisible = ref(false);
|
||||
const openDialog = () => {
|
||||
// 修复:使用可选链和空值合并运算符确保不会出现 null 或 undefined
|
||||
const storedColor = JSON.parse(localStorage.getItem('cn-global') ?? '{}').primary;
|
||||
color.value = storedColor ?? '#526ADE'; // 默认值为 '#526ADE'
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
|
||||
const sure = () => {
|
||||
changePrimary(color.value); // 切换主题
|
||||
dialogVisible.value = false;
|
||||
};
|
||||
|
||||
// onMounted(() => {
|
||||
// // 修复:使用可选链和空值合并运算符确保不会出现 null 或 undefined
|
||||
// const storedColor = JSON.parse(localStorage.getItem('cn-global') ?? '{}').primary;
|
||||
// console.log('123',storedColor)
|
||||
// color.value = storedColor ?? '#526ADE'; // 默认值为 '#526ADE'
|
||||
// })
|
||||
|
||||
defineExpose({ openDialog });
|
||||
</script>
|
||||
|
||||
@@ -20,27 +20,36 @@
|
||||
</template>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onBeforeMount } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
defineProps<{ menuList: Menu.MenuOptions[] }>();
|
||||
const router = useRouter();
|
||||
const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
||||
//console.log('1456----------------',subItem);
|
||||
if (subItem.meta.isLink) return window.open(subItem.meta.isLink, "_blank");
|
||||
router.push(subItem.path);
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.el-sub-menu .el-sub-menu__title:hover {
|
||||
// color: var(--el-menu-hover-text-color) !important;
|
||||
// background-color: transparent !important;
|
||||
color: #fff !important;//一级导航文字选中颜色
|
||||
background-color: #5274a5 !important; //一级导航选中背景色
|
||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
}
|
||||
.el-menu--collapse {
|
||||
.is-active {
|
||||
.el-sub-menu__title {
|
||||
color: #ffffff !important;
|
||||
// background-color: var(--el-color-primary) !important;
|
||||
background-color: #5274a5 !important;
|
||||
//background-color: #5274a5 !important;
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
border-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
@@ -53,7 +62,9 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
||||
// color: var(--el-menu-active-color) !important;
|
||||
// background-color: var(--el-menu-active-bg-color) !important;
|
||||
color: #fff !important;//一级导航文字选中颜色
|
||||
background-color: #5274a5 !important; //一级导航选中背景色
|
||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
<template>
|
||||
<div class='tabs-box'>
|
||||
<div class='tabs-menu'>
|
||||
<el-tabs v-model='tabsMenuValue' type='card' @tab-click='tabClick' @tab-remove='tabRemove'>
|
||||
<el-tab-pane v-for='item in tabsMenuList' :key='item.path' :label='item.title' :name='item.path'
|
||||
:closable='item.close'>
|
||||
<template #label>
|
||||
<el-icon v-show='item.icon && tabsIcon' class='tabs-icon'>
|
||||
<component :is='item.icon'></component>
|
||||
</el-icon>
|
||||
{{ item.title }}
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<MoreButton />
|
||||
<div class="tabs-box">
|
||||
<div class="tabs-menu">
|
||||
<el-tabs v-model="tabsMenuValue" type="card" @tab-click="tabClick" @tab-remove="tabRemove">
|
||||
<el-tab-pane
|
||||
v-for="item in tabsMenuList"
|
||||
:key="item.path"
|
||||
:label="item.title"
|
||||
:name="item.path"
|
||||
:closable="item.close"
|
||||
>
|
||||
<template #label>
|
||||
<el-icon v-show="item.icon && tabsIcon" class="tabs-icon">
|
||||
<component :is="item.icon"></component>
|
||||
</el-icon>
|
||||
{{ item.title }}
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<MoreButton />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
<script setup lang="ts">
|
||||
import Sortable from 'sortablejs'
|
||||
import { ref, computed, watch, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
@@ -38,79 +43,80 @@ const tabsMenuList = computed(() => tabStore.tabsMenuList)
|
||||
const tabsIcon = computed(() => globalStore.tabsIcon)
|
||||
|
||||
onMounted(() => {
|
||||
tabsDrop()
|
||||
initTabs()
|
||||
tabsDrop()
|
||||
initTabs()
|
||||
})
|
||||
|
||||
|
||||
// 监听路由的变化(防止浏览器后退/前进不变化 tabsMenuValue)
|
||||
watch(
|
||||
() => route.fullPath,
|
||||
() => {
|
||||
if (route.meta.isFull) return
|
||||
if (route.meta.hideTab){
|
||||
tabsMenuValue.value = route.meta.parentPath as string
|
||||
}else{
|
||||
tabsMenuValue.value = route.fullPath
|
||||
const tabsParams = {
|
||||
icon: route.meta.icon as string,
|
||||
title: route.meta.title as string,
|
||||
path: route.fullPath,
|
||||
name: route.name as string,
|
||||
close: !route.meta.isAffix,
|
||||
isKeepAlive: route.meta.isKeepAlive as boolean,
|
||||
}
|
||||
tabStore.addTabs(tabsParams)
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
() => route.fullPath,
|
||||
() => {
|
||||
if (route.meta.isFull) return
|
||||
if (route.meta.hideTab) {
|
||||
tabsMenuValue.value = route.meta.parentPath as string
|
||||
} else {
|
||||
tabsMenuValue.value = route.fullPath
|
||||
const tabsParams = {
|
||||
icon: route.meta.icon as string,
|
||||
title: route.meta.title as string,
|
||||
path: route.fullPath,
|
||||
name: route.name as string,
|
||||
close: !route.meta.isAffix,
|
||||
isKeepAlive: route.meta.isKeepAlive as boolean
|
||||
}
|
||||
tabStore.addTabs(tabsParams)
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
// 初始化需要固定的 tabs
|
||||
const initTabs = () => {
|
||||
authStore.flatMenuListGet.forEach(item => {
|
||||
if (item.meta.isAffix && !item.meta.isHide && !item.meta.isFull) {
|
||||
const tabsParams = {
|
||||
icon: item.meta.icon,
|
||||
title: item.meta.title,
|
||||
path: item.path,
|
||||
name: item.name,
|
||||
close: !item.meta.isAffix,
|
||||
isKeepAlive: item.meta.isKeepAlive,
|
||||
unshift:true
|
||||
}
|
||||
tabStore.addTabs(tabsParams)
|
||||
}
|
||||
})
|
||||
authStore.flatMenuListGet.forEach(item => {
|
||||
if (item.meta.isAffix && !item.meta.isHide && !item.meta.isFull) {
|
||||
const tabsParams = {
|
||||
icon: item.meta.icon,
|
||||
title: item.meta.title,
|
||||
path: item.path,
|
||||
name: item.name,
|
||||
close: !item.meta.isAffix,
|
||||
isKeepAlive: item.meta.isKeepAlive,
|
||||
unshift: true
|
||||
}
|
||||
tabStore.addTabs(tabsParams)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// tabs 拖拽排序
|
||||
const tabsDrop = () => {
|
||||
Sortable.create(document.querySelector('.el-tabs__nav') as HTMLElement, {
|
||||
draggable: '.el-tabs__item',
|
||||
animation: 300,
|
||||
onEnd({ newIndex, oldIndex }) {
|
||||
const tabsList = [...tabStore.tabsMenuList]
|
||||
const currRow = tabsList.splice(oldIndex as number, 1)[0]
|
||||
tabsList.splice(newIndex as number, 0, currRow)
|
||||
tabStore.setTabs(tabsList)
|
||||
},
|
||||
})
|
||||
Sortable.create(document.querySelector('.el-tabs__nav') as HTMLElement, {
|
||||
draggable: '.el-tabs__item',
|
||||
animation: 300,
|
||||
onEnd({ newIndex, oldIndex }) {
|
||||
const tabsList = [...tabStore.tabsMenuList]
|
||||
const currRow = tabsList.splice(oldIndex as number, 1)[0]
|
||||
tabsList.splice(newIndex as number, 0, currRow)
|
||||
tabStore.setTabs(tabsList)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Tab Click
|
||||
const tabClick = (tabItem: TabsPaneContext) => {
|
||||
const fullPath = tabItem.props.name as string
|
||||
// console.log("🚀 ~ tabClick ~ fullPath:", tabItem)
|
||||
router.push(fullPath)
|
||||
const fullPath = tabItem.props.name as string
|
||||
// console.log("🚀 ~ tabClick ~ fullPath:", tabItem)
|
||||
router.push(fullPath)
|
||||
}
|
||||
|
||||
// Remove Tab
|
||||
const tabRemove = (fullPath: TabPaneName) => {
|
||||
tabStore.removeTabs(fullPath as string, fullPath == route.fullPath)
|
||||
|
||||
|
||||
tabStore.removeTabs(fullPath as string, fullPath == route.fullPath || '/machine/testScriptAdd' == route.fullPath)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
@import "./index.scss";
|
||||
<style scoped lang="scss">
|
||||
@import './index.scss';
|
||||
</style>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
border-radius: 3px;
|
||||
}
|
||||
.layout-light {
|
||||
background-color: var(--el-color-primary-light-5);
|
||||
background-color: var(--el-color-primary-light-3);
|
||||
border-radius: 3px;
|
||||
}
|
||||
.layout-content {
|
||||
|
||||
@@ -65,5 +65,6 @@ const setupAll = async () => {
|
||||
|
||||
//挂载app
|
||||
setupAll().then(() => {
|
||||
|
||||
app.mount('#app')
|
||||
})
|
||||
|
||||
@@ -30,6 +30,7 @@ const routerMode = {
|
||||
* @param meta.isKeepAlive ==> 当前路由是否缓存
|
||||
* */
|
||||
const router = createRouter({
|
||||
|
||||
history: routerMode[mode](),
|
||||
routes: [...staticRouter],
|
||||
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
|
||||
@@ -68,10 +69,9 @@ router.beforeEach(async (to, from, next) => {
|
||||
await initDynamicRouter()
|
||||
return next({ ...to, replace: true })
|
||||
}
|
||||
//console.log(to)
|
||||
|
||||
// 7.存储 routerName 做按钮权限筛选
|
||||
authStore.setRouteName(to.name as string)
|
||||
|
||||
// 8.正常访问页面
|
||||
next()
|
||||
})
|
||||
|
||||
@@ -30,6 +30,7 @@ export const initDynamicRouter = async () => {
|
||||
});
|
||||
userStore.setAccessToken("");
|
||||
userStore.setRefreshToken("");
|
||||
userStore.setExp(0)
|
||||
router.replace(LOGIN_URL);
|
||||
return Promise.reject("No permission");
|
||||
}
|
||||
@@ -41,6 +42,7 @@ export const initDynamicRouter = async () => {
|
||||
if (item.component && typeof item.component == "string") {
|
||||
item.component = modules["/src/views" + item.component + ".vue"];
|
||||
}
|
||||
|
||||
if (item.meta.isFull) {
|
||||
router.addRoute(item as unknown as RouteRecordRaw);
|
||||
} else {
|
||||
@@ -51,6 +53,7 @@ export const initDynamicRouter = async () => {
|
||||
// 当按钮 || 菜单请求出错时,重定向到登陆页
|
||||
userStore.setAccessToken("");
|
||||
userStore.setRefreshToken("");
|
||||
userStore.setExp(0)
|
||||
router.replace(LOGIN_URL);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
@@ -1,122 +1,139 @@
|
||||
import { RouteRecordRaw } from "vue-router";
|
||||
import { HOME_URL, LOGIN_URL } from "@/config";
|
||||
export const Layout = () => import('@/layouts/index.vue');
|
||||
import { RouteRecordRaw } from 'vue-router'
|
||||
import { HOME_URL, LOGIN_URL } from '@/config'
|
||||
export const Layout = () => import('@/layouts/index.vue')
|
||||
/**
|
||||
* staticRouter (静态路由)
|
||||
*/
|
||||
export const staticRouter: RouteRecordRaw[] = [
|
||||
{
|
||||
path: "/",
|
||||
redirect: HOME_URL,
|
||||
},
|
||||
{
|
||||
path: LOGIN_URL,
|
||||
name: "login",
|
||||
component: () => import("@/views/login/index.vue"),
|
||||
meta: {
|
||||
title: "登录",
|
||||
{
|
||||
path: '/',
|
||||
redirect: HOME_URL
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/layout",
|
||||
name: "layout",
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: "/plan",
|
||||
name: "plan",
|
||||
redirect: "/plan/planList",
|
||||
{
|
||||
path: LOGIN_URL,
|
||||
name: 'login',
|
||||
component: () => import('@/views/login/index.vue'),
|
||||
meta: {
|
||||
title: '登录'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/layout',
|
||||
name: 'layout',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: "/plan/planList",
|
||||
name: "planList",
|
||||
component: () => import("@/views/plan/planList/index.vue"),
|
||||
meta: {
|
||||
title: "检测计划列表",
|
||||
icon: "List",
|
||||
isLink: "",
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: true,//缓存改成true
|
||||
{
|
||||
path: '/plan',
|
||||
name: 'plan',
|
||||
redirect: '/plan/planList',
|
||||
children: [
|
||||
// {
|
||||
// path: "/plan/planList",
|
||||
// name: "planList",
|
||||
// component: () => import("@/views/plan/planList/index.vue"),
|
||||
// meta: {
|
||||
// title: "检测计划列表",
|
||||
// icon: "List",
|
||||
// isLink: "",
|
||||
// isHide: false,
|
||||
// isFull: false,
|
||||
// isAffix: false,
|
||||
// isKeepAlive: true,//缓存改成true
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: "/plan/singlePlanList",
|
||||
// name: "singlePlanList",
|
||||
// component: () => import("@/views/plan/singlePlanList/index.vue"),
|
||||
// meta: {
|
||||
// title: "单个计划列表",
|
||||
// icon: "List",
|
||||
// isLink: "",
|
||||
// isHide: false,
|
||||
// isFull: false,
|
||||
// isAffix: false,
|
||||
// isKeepAlive: true,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: "/plan/preTest",
|
||||
// name: "preTest",
|
||||
// component: () => import("@/views/plan/preTest/index.vue"),
|
||||
// meta: {
|
||||
// title: "预检测",
|
||||
// icon: "List",
|
||||
// isLink: "",
|
||||
// isHide: false,
|
||||
// isFull: false,
|
||||
// isAffix: false,
|
||||
// isKeepAlive: false,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: "/plan/autoTest",
|
||||
// name: "autoTest",
|
||||
// component: () => import("@/views/plan/autoTest/index.vue"),
|
||||
// meta: {
|
||||
// title: "自动检测",
|
||||
// icon: "List",
|
||||
// isLink: "",
|
||||
// hideTab:true,
|
||||
// parentPath:'/system/proTable',
|
||||
// isHide: false,
|
||||
// isFull: false,
|
||||
// isAffix: false,
|
||||
// isKeepAlive: true,
|
||||
// },
|
||||
// },
|
||||
|
||||
// 错误页面路由
|
||||
{
|
||||
path: '/403',
|
||||
name: '403',
|
||||
component: () => import('@/components/ErrorMessage/403.vue'),
|
||||
meta: {
|
||||
title: '403页面'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/404',
|
||||
name: '404',
|
||||
component: () => import('@/components/ErrorMessage/404.vue'),
|
||||
meta: {
|
||||
title: '404页面'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/500',
|
||||
name: '500',
|
||||
component: () => import('@/components/ErrorMessage/500.vue'),
|
||||
meta: {
|
||||
title: '500页面'
|
||||
}
|
||||
},
|
||||
// Resolve refresh page, route warnings
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
component: () => import('@/components/ErrorMessage/404.vue')
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/plan/singlePlanList",
|
||||
name: "singlePlanList",
|
||||
component: () => import("@/views/plan/singlePlanList/index.vue"),
|
||||
meta: {
|
||||
title: "单个计划列表",
|
||||
icon: "List",
|
||||
isLink: "",
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/plan/preTest",
|
||||
name: "preTest",
|
||||
component: () => import("@/views/plan/preTest/index.vue"),
|
||||
meta: {
|
||||
title: "预检测",
|
||||
icon: "List",
|
||||
isLink: "",
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/plan/autoTest",
|
||||
name: "autoTest",
|
||||
component: () => import("@/views/plan/autoTest/index.vue"),
|
||||
meta: {
|
||||
title: "自动检测",
|
||||
icon: "List",
|
||||
isLink: "",
|
||||
hideTab:true,
|
||||
parentPath:'/system/proTable',
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: true,
|
||||
},
|
||||
},
|
||||
// 错误页面路由
|
||||
{
|
||||
path: "/403",
|
||||
name: "403",
|
||||
component: () => import("@/components/ErrorMessage/403.vue"),
|
||||
meta: {
|
||||
title: "403页面",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/404",
|
||||
name: "404",
|
||||
component: () => import("@/components/ErrorMessage/404.vue"),
|
||||
meta: {
|
||||
title: "404页面",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/500",
|
||||
name: "500",
|
||||
component: () => import("@/components/ErrorMessage/500.vue"),
|
||||
meta: {
|
||||
title: "500页面",
|
||||
},
|
||||
},
|
||||
// Resolve refresh page, route warnings
|
||||
{
|
||||
path: "/:pathMatch(.*)*",
|
||||
component: () => import("@/components/ErrorMessage/404.vue"),
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
},
|
||||
];
|
||||
{
|
||||
path: '/machine/testScriptAdd',
|
||||
name: 'testScriptAdd',
|
||||
component: () => import('@/views/machine/testScript/components/testScriptPopup.vue'),
|
||||
meta: {
|
||||
title: '检测脚本配置',
|
||||
icon: 'List',
|
||||
isLink: '',
|
||||
hideTab: true,
|
||||
parentPath: '/machine/testScript',
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -6,58 +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 {
|
||||
token: string;
|
||||
userInfo: { name: string };
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
isRefreshToken: boolean;
|
||||
userInfo: { id: string, name: string,loginName: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[];
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import {
|
||||
} from "@/utils";
|
||||
import { useRouter } from "vue-router";
|
||||
import { AUTH_STORE_KEY } from "@/stores/constant";
|
||||
import {useModeStore} from '@/stores/modules/mode'
|
||||
|
||||
|
||||
export const useAuthStore = defineStore({
|
||||
id: AUTH_STORE_KEY,
|
||||
state: (): AuthState => ({
|
||||
@@ -43,9 +46,15 @@ export const useAuthStore = defineStore({
|
||||
},
|
||||
// Get AuthMenuList
|
||||
async getAuthMenuList() {
|
||||
const { data } = await getAuthMenuListApi();
|
||||
this.authMenuList = data;
|
||||
const modeStore = useModeStore()
|
||||
|
||||
const { data: menuData } = await getAuthMenuListApi();
|
||||
let data = menuData; // 新增变量接收并操作
|
||||
if(modeStore.currentMode === '比对式'){
|
||||
data = filterMenuTree(data);
|
||||
}
|
||||
this.authMenuList = data;
|
||||
|
||||
},
|
||||
// Set RouteName
|
||||
async setRouteName(name: string) {
|
||||
@@ -73,3 +82,16 @@ export const useAuthStore = defineStore({
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
// 工具函数:递归过滤掉 name == 'test' 的菜单项
|
||||
function filterMenuTree(menuList: any[]) {
|
||||
return menuList.filter(menu => {
|
||||
// 如果当前项有 children,递归处理子项
|
||||
if (menu.children && menu.children.length > 0) {
|
||||
menu.children = filterMenuTree(menu.children);
|
||||
}
|
||||
// 过滤掉 name 是 testSource、testScript 或 controlSource 的菜单项
|
||||
return !['testSource', 'testScript', 'controlSource'].includes(menu.name);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
import {defineStore} from "pinia";
|
||||
import {CHECK_STORE_KEY} from "@/stores/constant";
|
||||
import type {CheckData} from "@/api/check/interface";
|
||||
import type {Plan} from '@/api/plan/interface'
|
||||
import {useAppSceneStore} from "@/stores/modules/mode";
|
||||
import { set } from "lodash";
|
||||
|
||||
|
||||
const AppSceneStore = useAppSceneStore()
|
||||
export const useCheckStore = defineStore("check", {
|
||||
id: CHECK_STORE_KEY,
|
||||
|
||||
state: () => ({
|
||||
devices: Array<CheckData.Device>(),
|
||||
planId: String(""),
|
||||
planCode: String(""),
|
||||
scriptId: String(""),
|
||||
errorSysId: String(""),
|
||||
plan: Object<Plan.ResPlan>(),
|
||||
selectTestItems: Object<CheckData.SelectTestItem>({preTest: true, timeTest: false, channelsTest: false, test: true}),
|
||||
checkType:1, // 0:手动检测 1:自动检测
|
||||
reCheckType: 1, // 0:不合格项复检 1:全部复检
|
||||
showDetailType: 0 ,// 0:数据查询 1:误差体系跟换 2:正式检测
|
||||
temperature: 0,
|
||||
humidity: 0
|
||||
}),
|
||||
|
||||
getters: {},
|
||||
@@ -20,25 +26,38 @@ export const useCheckStore = defineStore("check", {
|
||||
addDevices(device: CheckData.Device[]) {
|
||||
this.devices.push(...device);
|
||||
},
|
||||
|
||||
setPlan(plan: Plan.ResPlan) {
|
||||
this.plan = plan
|
||||
},
|
||||
clearDevices() {
|
||||
this.devices = [];
|
||||
},
|
||||
|
||||
setPlanId(planId: string) {
|
||||
this.planId = planId
|
||||
initSelectTestItems() {
|
||||
this.selectTestItems.preTest = true
|
||||
if (AppSceneStore.currentScene === '1') {
|
||||
this.selectTestItems.channelsTest = true
|
||||
} else {
|
||||
this.selectTestItems.channelsTest = false
|
||||
}
|
||||
this.selectTestItems.test = true
|
||||
},
|
||||
|
||||
setPlanCode(planCode: string) {
|
||||
this.planCode = planCode
|
||||
setSelectTestItems(selectTestItems: CheckData.SelectTestItem) {
|
||||
this.selectTestItems = selectTestItems
|
||||
},
|
||||
|
||||
setScriptId(scriptId: string) {
|
||||
this.scriptId = scriptId
|
||||
setCheckType(checkType: number) {
|
||||
this.checkType = checkType
|
||||
},
|
||||
|
||||
setErrorSysId(errorSysId: string) {
|
||||
this.errorSysId = errorSysId
|
||||
setReCheckType(reCheckType: number) {
|
||||
this.reCheckType = reCheckType
|
||||
},
|
||||
setShowDetailType(showDetailType: number) {
|
||||
this.showDetailType = showDetailType
|
||||
},
|
||||
setTemperature(temperature: number) {
|
||||
this.temperature = temperature
|
||||
},
|
||||
setHumidity(humidity: number) {
|
||||
this.humidity = humidity
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { GlobalState } from "@/stores/interface";
|
||||
import { DEFAULT_PRIMARY } from "@/config";
|
||||
import { DEFAULT_PRIMARY} from "@/config";
|
||||
import piniaPersistConfig from "@/stores/helper/persist";
|
||||
import {GLOBAL_STORE_KEY} from "@/stores/constant";
|
||||
|
||||
@@ -31,7 +31,7 @@ export const useGlobalStore = defineStore({
|
||||
// 折叠菜单
|
||||
isCollapse: false,
|
||||
// 菜单手风琴
|
||||
accordion: true,
|
||||
accordion: false,
|
||||
// 面包屑导航
|
||||
breadcrumb: true,
|
||||
// 面包屑导航图标
|
||||
@@ -42,12 +42,14 @@ export const useGlobalStore = defineStore({
|
||||
tabsIcon: true,
|
||||
// 页脚
|
||||
footer: false
|
||||
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
// Set GlobalState
|
||||
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
|
||||
this.$patch({ [args[0]]: args[1] });
|
||||
console.log(DEFAULT_PRIMARY);
|
||||
}
|
||||
},
|
||||
persist: piniaPersistConfig(GLOBAL_STORE_KEY)
|
||||
|
||||
@@ -8,7 +8,9 @@ export const useUserStore = defineStore({
|
||||
state: (): UserState => ({
|
||||
accessToken: "",
|
||||
refreshToken: "",
|
||||
userInfo: { name: "admin" },
|
||||
isRefreshToken:false,
|
||||
exp: Number(0),
|
||||
userInfo: {id:"", name: "" ,loginName:""},
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
@@ -19,10 +21,16 @@ 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;
|
||||
},
|
||||
setExp(exp: number) {
|
||||
this.exp = exp;
|
||||
}
|
||||
},
|
||||
persist: piniaPersistConfig(USER_STORE_KEY),
|
||||
});
|
||||
|
||||
@@ -445,7 +445,7 @@
|
||||
|
||||
.dialog-small {
|
||||
.el-dialog__body {
|
||||
max-height: 340px;
|
||||
max-height: 350px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -578,6 +578,26 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.form-four {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
// justify-content: space-between;
|
||||
.el-form-item {
|
||||
display: flex;
|
||||
width: 24%;
|
||||
|
||||
.el-form-item__content {
|
||||
flex: 1;
|
||||
|
||||
.el-select,
|
||||
.el-cascader,
|
||||
.el-input__inner,
|
||||
.el-date-editor {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.el-table__cell {
|
||||
border-right: 1px solid #ebeef5 !important;
|
||||
|
||||
@@ -140,3 +140,9 @@ body,
|
||||
:-webkit-any(article, aside, nav, section) h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
@import 'https://cdn.jsdelivr.net/npm/@vue-flow/core@1.45.0/dist/style.css';
|
||||
@import 'https://cdn.jsdelivr.net/npm/@vue-flow/core@1.45.0/dist/theme-default.css';
|
||||
@import 'https://cdn.jsdelivr.net/npm/@vue-flow/controls@latest/dist/style.css';
|
||||
@import 'https://cdn.jsdelivr.net/npm/@vue-flow/minimap@latest/dist/style.css';
|
||||
@import 'https://cdn.jsdelivr.net/npm/@vue-flow/node-resizer@latest/dist/style.css';
|
||||
|
||||
@@ -37,6 +37,7 @@ export function rgbToHex(r: any, g: any, b: any) {
|
||||
* @returns {String} 返回处理后的颜色值
|
||||
*/
|
||||
export function getDarkColor(color: string, level: number) {
|
||||
|
||||
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
||||
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
||||
let rgb = hexToRgb(color);
|
||||
@@ -51,6 +52,7 @@ export function getDarkColor(color: string, level: number) {
|
||||
* @returns {String} 返回处理后的颜色值
|
||||
*/
|
||||
export function getLightColor(color: string, level: number) {
|
||||
|
||||
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
||||
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
||||
let rgb = hexToRgb(color);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import mitt from "mitt";
|
||||
|
||||
const mittBus = mitt();
|
||||
|
||||
export default mittBus;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export default class SocketService {
|
||||
static instance = null;
|
||||
static get Instance() {
|
||||
@@ -23,9 +20,10 @@ export default class SocketService {
|
||||
// 重新连接尝试的次数
|
||||
connectRetryCount = 0;
|
||||
work:any;
|
||||
heartbeatTimer;
|
||||
heartbeatInterval = 6000; // 心跳间隔,单位毫秒
|
||||
workerBlobUrl:any;
|
||||
lastActivityTime= 0; // 上次活动时间戳
|
||||
lastResponseHeartTime = Date.now();//最后一次收到心跳回复时间
|
||||
|
||||
reconnectDelay= 5000; // 重新连接延迟,单位毫秒
|
||||
|
||||
// 定义连接服务器的方法
|
||||
@@ -40,7 +38,7 @@ export default class SocketService {
|
||||
// let token = '4E6EF539AAF119D82AC4C2BC84FBA21F';
|
||||
|
||||
|
||||
const url = 'ws://localhost:7777/hello?name=cdf'
|
||||
const url = 'ws://127.0.0.1:7777/hello?name=cdf'
|
||||
this.ws = new WebSocket(url);
|
||||
// 连接成功的事件
|
||||
this.ws.onopen = () => {
|
||||
@@ -55,13 +53,13 @@ export default class SocketService {
|
||||
// 1.连接服务端失败
|
||||
// 2.当连接成功之后, 服务器关闭的情况
|
||||
this.ws.onclose = () => {
|
||||
console.log('连接服务端失败');
|
||||
console.log('连接webSocket服务端关闭');
|
||||
this.connected = false;
|
||||
this.connectRetryCount++;
|
||||
this.clearHeartbeat();
|
||||
setTimeout(() => {
|
||||
// this.connect();
|
||||
}, 500 * this.connectRetryCount);
|
||||
/* setTimeout(() => {
|
||||
this.connect();
|
||||
}, 500 * this.connectRetryCount);*/
|
||||
|
||||
|
||||
};
|
||||
@@ -72,26 +70,34 @@ export default class SocketService {
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 得到服务端发送过来的数据
|
||||
this.ws.onmessage = (event) => {
|
||||
let message: { [key: string]: any };
|
||||
// console.log('🚀 ~ SocketService ~ connect ~ event:', event)
|
||||
if(event.data == 'over') {
|
||||
//心跳消息处理
|
||||
this.lastResponseHeartTime = Date.now();
|
||||
this.updateLastActivityTime(); // 收到心跳响应时更新活动时间
|
||||
}else {
|
||||
let message: { [key: string]: any };
|
||||
try {
|
||||
console.log('Received message:',event.data)
|
||||
message = JSON.parse(event.data);
|
||||
} catch (e) {
|
||||
return console.error("消息解析失败", event.data, e);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
console.log('Received message:',event.data)
|
||||
message = JSON.parse(event.data);
|
||||
} catch (e) {
|
||||
return console.error("消息解析失败", event.data, e);
|
||||
}
|
||||
//console.log(message, "从服务端获取到了数据");
|
||||
/* 通过接受服务端发送的type字段来回调函数 */
|
||||
if (message?.type && this.callBackMapping[message.type]) {
|
||||
this.callBackMapping[message.type](message);
|
||||
} else {
|
||||
/* 通过接受服务端发送的type字段来回调函数 */
|
||||
if (message?.type && this.callBackMapping[message.type]) {
|
||||
this.callBackMapping[message.type](message);
|
||||
} else {
|
||||
console.log("抛弃====>")
|
||||
console.log(event.data)
|
||||
/* 丢弃或继续写你的逻辑 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -100,25 +106,26 @@ export default class SocketService {
|
||||
|
||||
|
||||
startHeartbeat() {
|
||||
let _this = this
|
||||
var url = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},3000)})()']));
|
||||
this.work = new Worker(url)
|
||||
this.lastResponseHeartTime = Date.now();
|
||||
const _this = this
|
||||
_this.workerBlobUrl = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},9000)})()']));
|
||||
|
||||
this.work = new Worker(_this.workerBlobUrl);
|
||||
this.work.onmessage = function(e){
|
||||
if ((Date.now() - _this.lastActivityTime) > _this.heartbeatInterval) {
|
||||
// 如果超过心跳间隔没有活动,发送心跳消息
|
||||
_this.sendHeartbeat();
|
||||
//判断多久没收到心跳响应
|
||||
|
||||
if(_this.lastActivityTime - _this.lastResponseHeartTime > 30000){
|
||||
//说明已经三轮心跳没收到回复了,关闭检测,提示用户。
|
||||
ElMessage.error("业务主体模块发生未知异常,请尝试重新启动!");
|
||||
_this.clearHeartbeat();
|
||||
return;
|
||||
}
|
||||
|
||||
_this.sendHeartbeat();
|
||||
}
|
||||
// this.heartbeatTimer = setInterval(() => {
|
||||
// if ((Date.now() - this.lastActivityTime) > this.heartbeatInterval) {
|
||||
// // 如果超过心跳间隔没有活动,发送心跳消息
|
||||
// this.sendHeartbeat();
|
||||
// }
|
||||
// }, this.heartbeatInterval/2); // 每半个心跳间隔检查一次
|
||||
|
||||
}
|
||||
sendHeartbeat() {
|
||||
console.log("进入心跳消息发送。。。。。。。。。。。。。")
|
||||
console.log(new Date()+"进入心跳消息发送。。。。。。。。。。。。。")
|
||||
this.ws.send('alive');
|
||||
this.updateLastActivityTime(); // 发送心跳后更新活动时间
|
||||
}
|
||||
@@ -129,11 +136,14 @@ export default class SocketService {
|
||||
}
|
||||
|
||||
clearHeartbeat() {
|
||||
this.work.terminate();
|
||||
if (this.heartbeatTimer) {
|
||||
|
||||
clearInterval(this.heartbeatTimer);
|
||||
this.heartbeatTimer = null;
|
||||
const _this = this
|
||||
if (_this.work) {
|
||||
_this.work.terminate();
|
||||
_this.work = null;
|
||||
}
|
||||
if (_this.workerBlobUrl) {
|
||||
window.URL.revokeObjectURL(_this.workerBlobUrl); // 释放临时的Blob URL
|
||||
_this.workerBlobUrl = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +180,6 @@ export default class SocketService {
|
||||
if (this.connected) {
|
||||
this.ws.close()
|
||||
}
|
||||
console.log('WS关闭中..');
|
||||
console.log('执行WS关闭命令..');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" :model-value="dialogVisible" @close="close" v-bind="dialogMiddle">
|
||||
<el-dialog :title="dialogTitle" :model-value="dialogVisible" @close="close" v-bind="dialogMiddle" align-center>
|
||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
||||
<el-form-item label="上级菜单" prop="pid" :label-width="100">
|
||||
<el-tree-select
|
||||
@@ -14,10 +14,10 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name" :label-width="100">
|
||||
<el-input v-model="formContent.name" />
|
||||
<el-input v-model="formContent.name" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="code" :label-width="100">
|
||||
<el-input v-model="formContent.code" />
|
||||
<el-input v-model="formContent.code" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!formContent.type" label="图标" prop="icon" :label-width="100">
|
||||
<IconSelect
|
||||
@@ -27,11 +27,11 @@
|
||||
placeholder="选择一个图标"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!formContent.type" label="路由地址" prop="path" :label-width="100">
|
||||
<el-input v-model="formContent.path" />
|
||||
<el-form-item v-if="!formContent.type" label="路由地址" prop="path" :label-width="100" >
|
||||
<el-input v-model="formContent.path" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!formContent.type" label="组件地址" prop="component" :label-width="100">
|
||||
<el-input v-model="formContent.component" />
|
||||
<el-input v-model="formContent.component" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort" :label-width="100">
|
||||
<el-input-number v-model="formContent.sort" :min='1' :max='999' />
|
||||
@@ -199,6 +199,8 @@ const displayPid = computed({
|
||||
functionList.value = response.data as unknown as Function.ResFunction[]
|
||||
titleType.value = sign
|
||||
dialogVisible.value = true
|
||||
rules.value.path = [{ required: true, trigger: 'blur', message: '路由地址必填!' }];
|
||||
rules.value.component = [{ required: true, trigger: 'blur', message: '组件地址必填!' }];
|
||||
|
||||
if (formContent.value.pid ==='0') {
|
||||
formContent.value.pid = '';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<!-- 基础信息弹出框 -->
|
||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogSmall" @close="close" >
|
||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogSmall" @close="close" align-center>
|
||||
<div>
|
||||
|
||||
<el-form :model="formContent"
|
||||
@@ -8,11 +8,11 @@
|
||||
:rules='rules'
|
||||
>
|
||||
<el-form-item label="名称" prop='name' :label-width="100" >
|
||||
<el-input v-model="formContent.name" placeholder="请输入名称" autocomplete="off" :disabled="rootIsEdit"/>
|
||||
<el-input v-model="formContent.name" placeholder="请输入名称" autocomplete="off" :disabled="rootIsEdit" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="编码" prop='code' :label-width="100">
|
||||
<el-input v-model="formContent.code" placeholder="请输入编码" autocomplete="off" :disabled="rootIsEdit"/>
|
||||
<el-input v-model="formContent.code" placeholder="请输入编码" autocomplete="off" :disabled="rootIsEdit" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item label='类型' prop='type' :label-width="100">
|
||||
<el-select v-model="formContent.type" clearable placeholder="请选择类型" :disabled="rootIsEdit">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<!-- 基础信息弹出框 -->
|
||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" >
|
||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" align-center>
|
||||
<div>
|
||||
<el-form :model="formContent" ref='dialogFormRef'>
|
||||
<el-tree
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<!-- :requestApi="getRoleList" -->
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader='scope'>
|
||||
<el-button v-auth.role="'add'" type='primary' :icon='CirclePlus' @click="openDrawer('新增角色')">新增</el-button>
|
||||
<el-button v-auth.role="'add'" type='primary' :icon='CirclePlus' @click="openDrawer('add')">新增</el-button>
|
||||
<el-button v-auth.role="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||
@click='batchDelete(scope.selectedListIds)'>
|
||||
删除
|
||||
@@ -16,9 +16,9 @@
|
||||
</template>
|
||||
<!-- 表格操作 -->
|
||||
<template #operation='scope'>
|
||||
<el-button v-auth.role="'edit'" type='primary' link :icon='EditPen' @click="openDrawer('编辑角色', scope.row)">编辑</el-button>
|
||||
<el-button v-auth.role="'delete'" v-if="scope.row.type !== 0 && scope.row.type !== 1" type='primary' link :icon='Delete' @click='deleteAccount(scope.row)'>删除</el-button>
|
||||
<el-button v-auth.role="'SetPermissions'" type='primary' link :icon='Share' @click="openDrawer('设置权限', scope.row)">设置权限</el-button>
|
||||
<el-button v-auth.role="'edit'" type='primary' link :icon='EditPen' @click="openDrawer('edit', scope.row)" :disabled="scope.row.code == 'root'">编辑</el-button>
|
||||
<el-button v-auth.role="'delete'" type='primary' link :icon='Delete' @click='deleteAccount(scope.row)' :disabled="scope.row.code == 'root'">删除</el-button>
|
||||
<el-button v-auth.role="'SetPermissions'" type='primary' link :icon='Share' @click="openDrawer('设置权限', scope.row)" :disabled="scope.row.code == 'root'">设置权限</el-button>
|
||||
</template>
|
||||
|
||||
</ProTable>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<template>
|
||||
<!-- 基础信息弹出框 -->
|
||||
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close">
|
||||
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close" align-center>
|
||||
<div>
|
||||
<el-form :model="formContent"
|
||||
ref='dialogFormRef'
|
||||
:rules='rules'
|
||||
>
|
||||
<el-form-item label="原密码" prop='oldPassword' :label-width="100">
|
||||
<el-input type="oldPassword" v-model="formContent.oldPassword" show-password placeholder="请输入原密码" autocomplete="off" />
|
||||
<el-input type="oldPassword" v-model="formContent.oldPassword" show-password placeholder="请输入原密码" autocomplete="off" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码" prop='newPassword' :label-width="100">
|
||||
<el-input type="newPassword" v-model="formContent.newPassword" show-password placeholder="请输入新密码" autocomplete="off" />
|
||||
<el-input type="newPassword" v-model="formContent.newPassword" show-password placeholder="请输入新密码" autocomplete="off" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码" prop='surePassword' :label-width="100">
|
||||
<el-input type="surePassword" v-model="formContent.surePassword" show-password placeholder="请再次输入确认密码" autocomplete="off" />
|
||||
<el-input type="surePassword" v-model="formContent.surePassword" show-password placeholder="请再次输入确认密码" autocomplete="off" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<template>
|
||||
<!-- 基础信息弹出框 -->
|
||||
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close" >
|
||||
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close" align-center>
|
||||
<div>
|
||||
<el-form :model="formContent"
|
||||
ref='dialogFormRef'
|
||||
:rules='rules'
|
||||
>
|
||||
<el-form-item label="用户名" prop='name' :label-width="100">
|
||||
<el-input v-model="formContent.name" placeholder="请输入用户名" autocomplete="off" />
|
||||
<el-input v-model="formContent.name" placeholder="请输入用户名" autocomplete="off" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item label="登录名" prop='loginName' :label-width="100" >
|
||||
<el-input v-model="formContent.loginName" placeholder="请输入登录名" autocomplete="off" :disabled="LoginNameIsShow"/>
|
||||
<el-input v-model="formContent.loginName" placeholder="请输入登录名" autocomplete="off" :disabled="LoginNameIsShow" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop='password' :label-width="100" v-if="IsPasswordShow">
|
||||
<el-input type="password" v-model="formContent.password" show-password placeholder="请输入密码" autocomplete="off" />
|
||||
<el-input type="password" v-model="formContent.password" show-password placeholder="请输入密码" autocomplete="off" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item label='角色' :label-width='100' prop='roles'>
|
||||
<el-select v-model="formContent.roleIds" multiple placeholder="请选择角色">
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
</template>
|
||||
<!-- 表格操作 -->
|
||||
<template #operation='scope'>
|
||||
<el-button v-auth.user="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||
<el-button v-auth.user="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||
<el-button v-auth.user="'editPassWord'" type='primary' link :icon='Delete' @click='EditPassWord(scope.row)'>修改密码</el-button>
|
||||
<el-button v-auth.user="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)" :disabled="scope.row.loginName == 'root'">编辑</el-button>
|
||||
<el-button v-auth.user="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)' :disabled="scope.row.loginName == 'root'">删除</el-button>
|
||||
<el-button v-auth.user="'editPassWord'" type='primary' link :icon='Delete' @click='EditPassWord(scope.row)' :disabled="scope.row.loginName == 'root'">修改密码</el-button>
|
||||
</template>
|
||||
|
||||
</ProTable>
|
||||
@@ -64,8 +64,8 @@
|
||||
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
|
||||
const getTableList = (params: any) => {
|
||||
let newParams = JSON.parse(JSON.stringify(params))
|
||||
newParams.searchEndTime = endDate.value
|
||||
newParams.searchBeginTime = startDate.value
|
||||
// newParams.searchEndTime = endDate.value
|
||||
// newParams.searchBeginTime = startDate.value
|
||||
return getUserList(newParams)
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
render: (scope) => {
|
||||
const roleNames = scope.row.roleNames;
|
||||
const roleArray = Array.isArray(roleNames) ? roleNames : [roleNames];
|
||||
|
||||
if (roleArray.length > 1) {
|
||||
return roleArray.join(', ');
|
||||
}
|
||||
@@ -111,19 +112,19 @@
|
||||
prop: 'loginTime',
|
||||
label: '最后一次登录时间',
|
||||
minWidth: 180,
|
||||
search: {
|
||||
render: () => {
|
||||
return (
|
||||
<div class='flx-flex-start'>
|
||||
<TimeControl
|
||||
include={['日', '周', '月', '自定义']}
|
||||
default={'月'}
|
||||
onUpdate-dates={handleDateChange}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
// search: {
|
||||
// render: () => {
|
||||
// return (
|
||||
// <div class='flx-flex-start'>
|
||||
// <TimeControl
|
||||
// include={['日', '周', '月', '自定义']}
|
||||
// default={'月'}
|
||||
// onUpdate-dates={handleDateChange}
|
||||
// />
|
||||
// </div>
|
||||
// )
|
||||
// },
|
||||
// },
|
||||
},
|
||||
{
|
||||
prop: 'state',
|
||||
|
||||
85
frontend/src/views/home/components/RemoveableEdge.vue
Normal file
85
frontend/src/views/home/components/RemoveableEdge.vue
Normal file
@@ -0,0 +1,85 @@
|
||||
<script setup>
|
||||
import { BaseEdge, EdgeLabelRenderer, getBezierPath, useVueFlow } from '@vue-flow/core'
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
id: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
sourceX: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
sourceY: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
targetX: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
targetY: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
sourcePosition: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
targetPosition: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
markerEnd: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
style: {
|
||||
type: Object,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const { removeEdges } = useVueFlow()
|
||||
|
||||
const path = computed(() => getBezierPath(props))
|
||||
</script>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inheritAttrs: false,
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BaseEdge :id="id" :style="style" :path="path[0]" :marker-end="markerEnd" />
|
||||
<EdgeLabelRenderer>
|
||||
<div
|
||||
:style="{
|
||||
pointerEvents: 'all',
|
||||
position: 'absolute',
|
||||
transform: `translate(-50%, -50%) translate(${path[1]}px,${path[2]}px)`,
|
||||
}"
|
||||
class="nodrag nopan"
|
||||
>
|
||||
<el-popconfirm
|
||||
title="确定要删除这条连线吗?"
|
||||
@confirm="removeEdges(id)"
|
||||
>
|
||||
<template #reference>
|
||||
<el-icon class="edge-icon"><Delete/></el-icon>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</div>
|
||||
</EdgeLabelRenderer>
|
||||
</template>
|
||||
<style scoped>
|
||||
.edge-icon {
|
||||
background: white;
|
||||
border-radius: 50%;
|
||||
padding: 2px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
657
frontend/src/views/home/components/comparePreTest.vue
Normal file
657
frontend/src/views/home/components/comparePreTest.vue
Normal file
@@ -0,0 +1,657 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane label="预检测项目">
|
||||
<div class="form-grid">
|
||||
<el-checkbox v-for="(item, index) in detectionOptions" v-model="item.selected" :key="index"
|
||||
:label="item.name" disabled></el-checkbox>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<div class="test-dialog">
|
||||
<div class="dialog-left">
|
||||
<el-steps direction="vertical" :active="activeIndex" :process-status="currentStepStatus"
|
||||
finish-status="success">
|
||||
<el-step :status="step1" title="设备通讯校验"/>
|
||||
<el-step :status="step2" title="协议校验"/>
|
||||
<el-step :status="step3" title="模型一致性校验"/>
|
||||
<el-step :status="step4" title="实时数据对齐验证"/>
|
||||
<el-step :status="step5" title="相序校验"/>
|
||||
<!-- <el-step :status="step6" title="遥控录波功能验证"/> -->
|
||||
<el-step :status="step6" :title="ts === 'error'? '检测失败':ts === 'process'? '检测中':ts === 'success'? '检测成功':'待检测'"/>
|
||||
</el-steps>
|
||||
</div>
|
||||
<div class="dialog-right">
|
||||
<el-collapse v-model="collapseActiveName" accordion>
|
||||
<el-collapse-item title="设备通讯校验" name="1">
|
||||
<div class="div-log">
|
||||
<p v-for="(item, index) in step1InitLog" :key="index"
|
||||
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||
{{ item.log }} <br/>
|
||||
</p>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="协议校验" name="2">
|
||||
<div class="div-log">
|
||||
<p v-for="(item, index) in step2InitLog" :key="index"
|
||||
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||
{{ item.log }} <br/>
|
||||
</p>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="模型一致性校验" name="3">
|
||||
<div class="div-log">
|
||||
<p v-for="(item, index) in step3InitLog" :key="index"
|
||||
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||
{{ item.log }} <br/>
|
||||
</p>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item name="4">
|
||||
<template #title>
|
||||
实时数据对齐验证
|
||||
<el-icon class="title-icon" @click="openDialog"><InfoFilled/></el-icon>
|
||||
</template>
|
||||
<div class="div-log">
|
||||
<p v-for="(item, index) in step4InitLog" :key="index"
|
||||
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||
{{ item.log }}
|
||||
<br/>
|
||||
</p>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="相序校验" name="5">
|
||||
<div class="div-log">
|
||||
<p v-for="(item, index) in step5InitLog" :key="index"
|
||||
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||
{{ item.log }} <br/>
|
||||
</p>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
<!-- <el-collapse-item title="遥控录波功能验证" name="3">
|
||||
<div class="div-log">
|
||||
<p v-for="(item, index) in step3InitLog" :key="index"
|
||||
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||
{{ item.log.split('&&')[0] }}
|
||||
<br v-if="item.log.includes('&&')"/>
|
||||
{{ item.log.split('&&')[1] }}
|
||||
|
||||
<br v-if="item.log.includes('&&')"/>
|
||||
{{ item.log.split('&&')[2] }}
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</el-collapse-item> -->
|
||||
</el-collapse>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<RealTimeData ref="realTimeDataRef"/>
|
||||
</template>
|
||||
<script lang="tsx" setup name="preTest">
|
||||
import {ElMessage, ElMessageBox, StepProps} from "element-plus";
|
||||
import {defineExpose, ref, toRef, watch} from 'vue';
|
||||
import RealTimeData from './realTimeDataAlign.vue'
|
||||
|
||||
const realTimeDataRef = ref()
|
||||
|
||||
|
||||
const step1InitLog = ref([
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
])
|
||||
|
||||
const step2InitLog = ref([
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
])
|
||||
|
||||
const step3InitLog = ref([
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
])
|
||||
|
||||
const step4InitLog = ref([
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
])
|
||||
|
||||
const step5InitLog = ref([
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
|
||||
const collapseActiveName = ref('1')
|
||||
const activeIndex = ref(0)
|
||||
const activeTotalNum = ref(5)
|
||||
const step1 = ref<StepProps['status']>('wait')
|
||||
const step2 = ref<StepProps['status']>('wait')
|
||||
const step3 = ref<StepProps['status']>('wait')
|
||||
const step4 = ref<StepProps['status']>('wait')
|
||||
const step5 = ref<StepProps['status']>('wait')
|
||||
const step6 = ref<StepProps['status']>('wait')
|
||||
|
||||
//定义与预检测配置数组
|
||||
const detectionOptions = ref([
|
||||
{
|
||||
id: 0,
|
||||
name: "设备通讯校验",
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: "协议校验",
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "模型一致性校验",
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "实时数据对齐验证",
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "相序校验",
|
||||
selected: true,
|
||||
},
|
||||
]);
|
||||
|
||||
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||
|
||||
const props = defineProps({
|
||||
testStatus: {
|
||||
type: String,
|
||||
default: 'wait'
|
||||
},
|
||||
webMsgSend: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const testStatus = toRef(props, 'testStatus');
|
||||
const webMsgSend = toRef(props, 'webMsgSend');
|
||||
const ts = ref('');
|
||||
|
||||
watch(webMsgSend, function (newValue, oldValue) {
|
||||
if (testStatus.value !== 'waiting') {
|
||||
switch (newValue.requestId) {
|
||||
case 'yjc_sbtxjy':
|
||||
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$01':
|
||||
if (newValue.code == 10200) {
|
||||
step1InitLog.value.push({
|
||||
type: 'info',
|
||||
log: newValue.data + '设备通讯校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step1.value = 'process'
|
||||
step1InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行设备通讯校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10550) {
|
||||
step1InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step1.value = 'error'
|
||||
// ts.value = 'error'
|
||||
// step6.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step1InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
step6.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step2InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
step6.value = 'error'
|
||||
} else if (newValue.code == 25001) {
|
||||
activeIndex.value = 1
|
||||
step1.value = 'success'
|
||||
step3.value = 'process'
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'yjc_xyjy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$01':
|
||||
if (newValue.code == 10200) {
|
||||
step2InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '统计数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step2.value = 'process'
|
||||
step2InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行通讯协议校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10550) {
|
||||
step2InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step2.value = 'error'
|
||||
// ts.value = 'error'
|
||||
// step5.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
step3.value = 'error'
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
}
|
||||
break;
|
||||
case 'INIT_GATHER$02':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '实时数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3.value = 'process'
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行通讯协议校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10550) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
// ts.value = 'error'
|
||||
// step5.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
step3.value = 'error'
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
}
|
||||
break;
|
||||
case 'INIT_GATHER$03':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '暂态数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3.value = 'process'
|
||||
} else if (newValue.code == 10550) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
// ts.value = 'error'
|
||||
// step5.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
//ElMessage.error("当前步骤已经初始化,执行自动关闭,请重新发起检测!")
|
||||
step3.value = 'error'
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
}
|
||||
break;
|
||||
case 'VERIFY_MAPPING$01':
|
||||
if (newValue.code == 25001) {
|
||||
activeIndex.value = 3
|
||||
step3.value = 'success'
|
||||
step4.value = 'process'
|
||||
} else if (newValue.code == 10200) {
|
||||
let data = JSON.parse(newValue.data)
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: `脚本与icd检验失败! icd名称:${data['icdType']} -> 校验项:${data['dataType']}`,
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10500) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: `装置中未找到该icd!`,
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'YJC_xujy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'OPER_GATHER':
|
||||
if (newValue.code == 10200) {
|
||||
step4InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '源参数下发成功,等待校验中.....',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step4.value = 'process'
|
||||
step4InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '源参数下发中.....',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step4.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10520) {
|
||||
step4.value = 'error'
|
||||
step4InitLog.value.push({
|
||||
type: 'error',
|
||||
log: '解析报文异常',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
}
|
||||
break;
|
||||
|
||||
case 'DATA_REQUEST$02':
|
||||
if (newValue.code == 10200) {
|
||||
let type = 'info'
|
||||
if (newValue.data.includes('不合格')) {
|
||||
type = 'error'
|
||||
}
|
||||
|
||||
newValue.data.split('<br/>')
|
||||
step4InitLog.value.push({
|
||||
type: type,
|
||||
log: newValue.data,
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step4.value = 'process'
|
||||
step4InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '获取数据相序校验数据!',
|
||||
}];
|
||||
} else if (newValue.code == 25003) {
|
||||
step4.value = 'error'
|
||||
step4InitLog.value.push({
|
||||
type: 'error',
|
||||
log: '相序校验未通过!',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 25001) {
|
||||
step4.value = 'success'
|
||||
step5.value = 'success'
|
||||
step4InitLog.value.push({
|
||||
type: 'wait',
|
||||
log: '相序校验成功!',
|
||||
})
|
||||
ts.value = 'success'
|
||||
}
|
||||
activeIndex.value = 5
|
||||
console.log("@@@@", ts.value)
|
||||
break
|
||||
}
|
||||
|
||||
break;
|
||||
case 'quit':
|
||||
break;
|
||||
case 'connect':
|
||||
switch (newValue.operateCode) {
|
||||
case "Source":
|
||||
step1.value = 'error'
|
||||
step1InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '源服务端连接失败!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
break;
|
||||
case "Dev":
|
||||
step2.value = 'error'
|
||||
step2InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '设备服务端连接失败!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'unknown_operate':
|
||||
|
||||
break;
|
||||
case 'error_flow_end':
|
||||
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
break;
|
||||
case 'socket_timeout':
|
||||
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
break;
|
||||
case 'server_error':
|
||||
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
break;
|
||||
case 'device_error':
|
||||
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
watch(activeIndex, function (newValue, oldValue) {
|
||||
if (newValue <= activeTotalNum.value - 2) {
|
||||
collapseActiveName.value = (newValue + 1).toString()
|
||||
} else {
|
||||
collapseActiveName.value = (newValue - 1).toString()
|
||||
}
|
||||
})
|
||||
|
||||
//监听goods_sn的变化
|
||||
watch(testStatus, function (newValue, oldValue) {
|
||||
ts.value = props.testStatus;
|
||||
if (ts.value === 'start') {
|
||||
ts.value = 'process'
|
||||
} else if (ts.value === 'waiting') {
|
||||
activeIndex.value = 0
|
||||
step1InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
step1.value = 'finish'
|
||||
step2.value = 'wait'
|
||||
step3.value = 'wait'
|
||||
step4.value = 'wait'
|
||||
step5.value = 'wait'
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:testStatus']);
|
||||
//监听sn
|
||||
watch(ts, function (newValue, oldValue) {
|
||||
//修改父组件
|
||||
emit('update:testStatus', ts.value)
|
||||
})
|
||||
|
||||
|
||||
// 定义一个初始化参数的方法
|
||||
function initializeParameters() {
|
||||
activeIndex.value = 0
|
||||
step1.value = 'process'
|
||||
step2.value = 'wait'
|
||||
step3.value = 'wait'
|
||||
step4.value = 'wait'
|
||||
step5.value = 'wait'
|
||||
|
||||
step1InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
step2InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
step3InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
step4InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
step5InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
const openDialog = () => {
|
||||
realTimeDataRef.value.open()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
initializeParameters,
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
||||
|
||||
.title-icon {
|
||||
margin-left: 10px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.test-dialog {
|
||||
height: 350px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
/* 横向排列 */
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.dialog-left {
|
||||
width: 15%;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.dialog-right {
|
||||
margin-left: 20px;
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.dialog-right :deep(.el-collapse-item__header) {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.div-log {
|
||||
height: 145px;
|
||||
overflow-y: auto;
|
||||
padding-left: 10px;
|
||||
|
||||
p {
|
||||
margin: 5px 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
470
frontend/src/views/home/components/compareTestPopup.vue
Normal file
470
frontend/src/views/home/components/compareTestPopup.vue
Normal file
@@ -0,0 +1,470 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" width="1550px" :model-value="dialogVisible" :before-close="beforeClose" @close="handleClose" height="1000px" draggable>
|
||||
|
||||
<div class="steps-container">
|
||||
<el-steps v-if="showSteps" class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
|
||||
<el-step v-if="preTestSelected" title="预检测" :icon="stepsActive > 1 || stepsActiveIndex > stepsTotalNum - 1? SuccessFilled :Edit" @click="handleStepClick(1)"/>
|
||||
|
||||
<el-step v-if="testSelected" title="正式检测" :icon="stepsActive > 2 || stepsActiveIndex > stepsTotalNum - 1? SuccessFilled :Coin" @click="handleStepClick(2)"/>
|
||||
<el-step title="检测完成" :icon="stepsActiveIndex > stepsTotalNum-1 ? SuccessFilled :Key"/>
|
||||
</el-steps>
|
||||
</div>
|
||||
|
||||
<ComparePreTest v-if="showComponent&&preTestSelected" v-show="preTestSelected && stepsActiveView==1" ref="preTestRef" v-model:testStatus="preTestStatus"
|
||||
:webMsgSend="webMsgSend"/>
|
||||
<test v-if="showComponent&&testSelected" ref="testRef" v-show="testSelected && stepsActiveView==2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend"
|
||||
@update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck" @closeWebSocket="closeWebSocket"
|
||||
:stepsActive="stepsActive"/>
|
||||
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmitFast">开始检测</el-button>
|
||||
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
初始化中
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="TestStatus=='process'"
|
||||
:icon="VideoPause"
|
||||
@click="handlePause()">停止检测
|
||||
</el-button>
|
||||
<el-button type="warning" v-if="TestStatus === 'paused_ing'" disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
暂停中
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
v-if="(TestStatus =='paused')"
|
||||
:icon="VideoPlay"
|
||||
@click="sendResume"
|
||||
>继续检测
|
||||
</el-button>
|
||||
|
||||
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
||||
v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
|
||||
@click="nextStep">
|
||||
{{ nextStepText }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="handleQuit" v-else>
|
||||
退出检测
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup name="testPopup">
|
||||
import {reactive, ref, watch} from 'vue';
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
import {Coin, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPause, VideoPlay} from '@element-plus/icons-vue'
|
||||
import ComparePreTest from './comparePreTest.vue'
|
||||
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)
|
||||
|
||||
const showSteps = ref(false)
|
||||
const stepsTotalNum = ref(-1);//步骤总数
|
||||
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
|
||||
const stepsActiveView = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
|
||||
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态,用于切换步骤
|
||||
const ActiveStatue = ref('waiting');//当前步骤状态
|
||||
const preTestStatus = ref('waiting');//预检测执行状态
|
||||
const TestStatus = ref('waiting');//正式检测执行状态
|
||||
const webMsgSend = ref();//webSocket推送的数据
|
||||
|
||||
|
||||
const dialogTitle = ref('')
|
||||
const showComponent = ref(true)
|
||||
const preTestRef = ref(null)
|
||||
const testRef = ref(null)
|
||||
|
||||
const dataSocket = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
});
|
||||
|
||||
// 勾选的检测内容
|
||||
const preTestSelected = ref(false)
|
||||
const testSelected = ref(false)
|
||||
|
||||
const initOperate = () => {
|
||||
ActiveStatue.value = 'waiting'
|
||||
preTestStatus.value = 'waiting'
|
||||
|
||||
TestStatus.value = 'waiting'
|
||||
|
||||
stepsActiveIndex.value = 1
|
||||
showComponent.value = true
|
||||
// 初始化勾选的检测内容
|
||||
preTestSelected.value = checkStore.selectTestItems.preTest
|
||||
testSelected.value = checkStore.selectTestItems.test
|
||||
|
||||
let count = 0
|
||||
for (let key in checkStore.selectTestItems) {
|
||||
if (checkStore.selectTestItems[key]) {
|
||||
count++
|
||||
}
|
||||
}
|
||||
stepsTotalNum.value = count + 1
|
||||
|
||||
if (preTestSelected.value) {
|
||||
stepsActiveView.value = 1
|
||||
stepsActive.value = 1
|
||||
return
|
||||
}
|
||||
if (testSelected.value) {
|
||||
stepsActiveView.value = 2
|
||||
stepsActive.value = 2
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const open = (title: string,sourceIds: string[]) => {
|
||||
|
||||
showSteps.value = true
|
||||
initOperate()
|
||||
dialogTitle.value = title;
|
||||
dialogVisible.value = true;
|
||||
|
||||
if (preTestRef.value) {
|
||||
preTestRef.value.initializeParameters();
|
||||
}
|
||||
|
||||
//开始创建webSocket客户端
|
||||
socketClient.Instance.connect();
|
||||
dataSocket.socketServe = socketClient.Instance;
|
||||
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
||||
// 处理来自服务器的消息
|
||||
// console.log('Received message:', res);
|
||||
if (res.code === 20000) {
|
||||
//ElMessage.error(message.message)
|
||||
// loading.close()
|
||||
} else {
|
||||
webMsgSend.value = res
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const handleSubmitFast = () => {
|
||||
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
||||
let planId = checkStore.plan.id
|
||||
|
||||
if (!dataSocket.socketServe.connected) {
|
||||
ElMessage.error('webSocket连接中断!')
|
||||
return
|
||||
}
|
||||
console.log("handleSubmit", stepsActive.value, TestStatus.value)
|
||||
switch (stepsActive.value) {
|
||||
case 1:
|
||||
if (preTestStatus.value == 'waiting') {
|
||||
if (checkStore.selectTestItems.preTest) {
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: checkStore.reCheckType == 1 ? '1' : '2',
|
||||
userId: userStore.userInfo.id,
|
||||
temperature: checkStore.temperature,
|
||||
humidity: checkStore.humidity,
|
||||
testItemList: [checkStore.selectTestItems.preTest, checkStore.selectTestItems.channelsTest, checkStore.selectTestItems.test]
|
||||
}).then(res => {
|
||||
if (res.code === 'A001014') {
|
||||
ElMessageBox.alert('装置配置异常', '检测失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
preTestStatus.value = 'error'
|
||||
}
|
||||
})
|
||||
preTestStatus.value = 'start'
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (TestStatus.value == "waiting") {
|
||||
if (!checkStore.selectTestItems.preTest && !checkStore.selectTestItems.channelsTest && checkStore.selectTestItems.test) {
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: checkStore.reCheckType == 1 ? '1' : '2',
|
||||
userId: userStore.userInfo.id,
|
||||
temperature: checkStore.temperature,
|
||||
humidity: checkStore.humidity,
|
||||
testItemList: [checkStore.selectTestItems.preTest, checkStore.selectTestItems.channelsTest, checkStore.selectTestItems.test]
|
||||
}).then(res => {
|
||||
if (res.code === 'A001014') {
|
||||
ElMessageBox.alert('装置配置异常', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TestStatus.value = 'test_init_fail'
|
||||
}
|
||||
})
|
||||
}
|
||||
TestStatus.value = 'start'
|
||||
} else if (TestStatus.value == 'paused') {
|
||||
// 发送继续指令
|
||||
sendResume()
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'quitClicked'): void;
|
||||
}>();
|
||||
|
||||
watch(preTestStatus, function (newValue, oldValue) {
|
||||
console.log('预检测',newValue, oldValue);
|
||||
|
||||
ActiveStatue.value = newValue
|
||||
})
|
||||
|
||||
watch(TestStatus, function (newValue, oldValue) {
|
||||
console.log(newValue, oldValue);
|
||||
|
||||
ActiveStatue.value = newValue
|
||||
})
|
||||
|
||||
watch(ActiveStatue, function (newValue, oldValue) {
|
||||
if (newValue === 'error') {
|
||||
stepsActiveIndex.value = stepsTotalNum.value + 1
|
||||
nextStepText.value = '检测失败'
|
||||
}
|
||||
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 1) {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '检测完成'
|
||||
}
|
||||
if (newValue === 'test_init_fail') {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '初始化失败'
|
||||
}
|
||||
if (newValue === 'connect_timeout') {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '连接超时'
|
||||
}
|
||||
if (newValue === 'pause_timeout') {
|
||||
stepsActiveIndex.value += 2
|
||||
// nextStepText.value = '结束测试'
|
||||
nextStepText.value = '暂停超时'
|
||||
}
|
||||
if (newValue === 'success' && stepsActiveIndex.value < stepsTotalNum.value - 1) {
|
||||
nextStep() // 实现自动点击,进入下一个测试内容
|
||||
//handleSubmit()
|
||||
handleSubmitFast()
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
const handleQuit = () => {
|
||||
console.log('handleQuit', ActiveStatue.value)
|
||||
if (ActiveStatue.value !== 'success' && ActiveStatue.value !== 'waiting' && ActiveStatue.value !== 'paused' && ActiveStatue.value !== 'test_init_fail' && ActiveStatue.value !== 'connect_timeout' && ActiveStatue.value !== 'pause_timeout') {
|
||||
beforeClose(() => {
|
||||
})
|
||||
} else {
|
||||
handleClose()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handlePause = () => {
|
||||
sendPause()
|
||||
testRef.value?.handlePause()
|
||||
}
|
||||
const sendPause = () => {
|
||||
console.log('发起暂停请求')
|
||||
|
||||
TestStatus.value = 'paused_ing'
|
||||
pauseTest()
|
||||
}
|
||||
const sendResume = () => {
|
||||
console.log('发起继续检测请求')
|
||||
|
||||
resumeTest({
|
||||
userPageId: "cdf",
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.plan.id,
|
||||
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId: userStore.userInfo.id,
|
||||
temperature: checkStore.temperature,
|
||||
humidity: checkStore.humidity
|
||||
})
|
||||
Object.assign(webMsgSend.value, {
|
||||
requestId: 'Resume_Success'
|
||||
})
|
||||
}
|
||||
|
||||
const sendReCheck = () => {
|
||||
console.log('发送重新检测指令')
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.plan.id,
|
||||
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId: userStore.userInfo.id,
|
||||
temperature: checkStore.temperature,
|
||||
humidity: checkStore.humidity,
|
||||
testItemList: [checkStore.selectTestItems.preTest, checkStore.selectTestItems.channelsTest, checkStore.selectTestItems.test]
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 'A001014') {
|
||||
ElMessageBox.alert('装置配置异常', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TestStatus.value = 'test_init_fail'
|
||||
}
|
||||
})
|
||||
TestStatus.value = 'start'
|
||||
}
|
||||
|
||||
const closeWebSocket = () => {
|
||||
dataSocket.socketServe.closeWs()
|
||||
}
|
||||
|
||||
const nextStep = () => {
|
||||
if (stepsActiveIndex.value == stepsTotalNum.value + 1 || ActiveStatue.value === 'error' || ActiveStatue.value === 'test_init_fail' || ActiveStatue.value === 'connect_timeout' || ActiveStatue.value === 'pause_timeout') {
|
||||
handleClose()
|
||||
return
|
||||
}
|
||||
if (ActiveStatue.value != 'error') {
|
||||
ActiveStatue.value = 'waiting'
|
||||
let tempStep = stepsActiveIndex.value
|
||||
let idx = 1
|
||||
stepsActiveIndex.value++
|
||||
for (let selectTestItemsKey in checkStore.selectTestItems) {
|
||||
if (tempStep == 0 && checkStore.selectTestItems[selectTestItemsKey]) {
|
||||
stepsActiveView.value = idx
|
||||
stepsActive.value = idx
|
||||
return
|
||||
}
|
||||
if (checkStore.selectTestItems[selectTestItemsKey] && tempStep != 0) {
|
||||
tempStep--
|
||||
}
|
||||
idx++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleStepClick = (step: number) => {
|
||||
if (step > stepsActive.value) {
|
||||
return
|
||||
} else {
|
||||
stepsActiveView.value = step
|
||||
}
|
||||
}
|
||||
|
||||
function clearData() {
|
||||
stepsTotalNum.value = -1
|
||||
stepsActiveIndex.value = 1
|
||||
stepsActiveView.value = -1
|
||||
preTestStatus.value = "waiting"
|
||||
TestStatus.value = "waiting"
|
||||
ActiveStatue.value = "waiting"
|
||||
nextStepText.value = "下一步"
|
||||
}
|
||||
|
||||
const beforeClose = (done: () => void) => {
|
||||
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||
ElMessageBox.confirm('检测未完成,是否退出当前检测流程?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(() => {
|
||||
handleClose()
|
||||
})
|
||||
} else {
|
||||
handleClose()
|
||||
}
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
showSteps.value = false
|
||||
dataSocket.socketServe.closeWs()
|
||||
dialogVisible.value = false;
|
||||
clearData()
|
||||
showComponent.value = false;
|
||||
|
||||
emit('quitClicked'); // 触发事件
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({open})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
.test-head-steps {
|
||||
::v-deep .el-step {
|
||||
.el-step__head.is-success {
|
||||
color: #91cc75;
|
||||
}
|
||||
|
||||
.el-step__title.is-success {
|
||||
color: #91cc75;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.dialog-big .el-dialog__body) {
|
||||
max-height: 840px !important;
|
||||
}
|
||||
|
||||
.steps-container :deep(.test-head-steps) {
|
||||
height: 80px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.steps-container :deep(.el-step__title) {
|
||||
font-size: 20px !important; /* 设置标题字体大小 */
|
||||
vertical-align: baseline !important;
|
||||
display: inline-block; /* 确保文字和图标在同一行 */
|
||||
line-height: 1; /* 调整行高以确保底部对齐 */
|
||||
}
|
||||
|
||||
.steps-container :deep(.el-step__icon-inner) {
|
||||
font-size: 18px !important;
|
||||
vertical-align: baseline !important;
|
||||
display: inline-block; /* 确保文字和图标在同一行 */
|
||||
line-height: 1; /* 调整行高以确保底部对齐 */
|
||||
}
|
||||
|
||||
.steps-container :deep(.el-step__icon) {
|
||||
font-size: 18px !important;
|
||||
vertical-align: baseline !important;
|
||||
display: inline-block; /* 确保文字和图标在同一行 */
|
||||
line-height: 1; /* 调整行高以确保底部对齐 */
|
||||
}
|
||||
|
||||
.loading-box {
|
||||
animation: loading 1.5s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes loading {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -38,13 +38,13 @@
|
||||
<!-- <el-button type="primary" loading v-if="activeIndex > 0 && activeIndex < activeTotalNum">合格92项/共103项</el-button>
|
||||
<el-button type="primary" v-if="activeIndex >= activeTotalNum" disabled>合格92项/共103项</el-button> -->
|
||||
<span style=" font-size: 18px;font-weight: 600;">
|
||||
数据已合格 <span style="color: #67C23A">{{ qualified }}</span> 项/共 <span style="color: green">{{ 103 }}</span>
|
||||
数据已合格 <span style="color: #91cc75">{{ qualified }}</span> 项/共 <span style="color: green">{{ 103 }}</span>
|
||||
项
|
||||
</span>
|
||||
</div>
|
||||
<div class="dialog-content">
|
||||
<el-table :data="tableData" :cell-class-name="tableCell" row-key="id" height="450px"
|
||||
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' }" style="width: 100%"
|
||||
:header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' }" style="width: 100%"
|
||||
border>
|
||||
<el-table-column fixed prop="scriptItemName" label="检测项目" width="210px" />
|
||||
<el-table-column label="被检通道1" :min-width="minwidth" align="center">
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
v-model="scriptSwitch"
|
||||
class="ml-2"
|
||||
inline-prompt
|
||||
style="--el-switch-on-color: #003078; --el-switch-off-color: #5a79a9"
|
||||
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #5a79a9"
|
||||
active-text="不合格测试项"
|
||||
inactive-text="全部测试项"
|
||||
/> -->
|
||||
|
||||
@@ -1,22 +1,16 @@
|
||||
<template>
|
||||
<el-button v-if="tableData.length > 0" type="primary" @click="exportData" style="margin-bottom: 10px">导出</el-button>
|
||||
<div class="table-main">
|
||||
<div class="table-main" max-height="282px">
|
||||
<el-table v-if="tableData.length > 0" :data="tableData" stripe border :header-cell-style="{ textAlign: 'center' } "
|
||||
:cell-style="{ textAlign: 'center' }" height="315px"
|
||||
:cell-style="{ textAlign: 'center' }" max-height="282px"
|
||||
style="width: 100%;">
|
||||
<el-table-column type="index" label="序号" width="70" fixed="left"/>
|
||||
<el-table-column prop="time" label="数据时间"/>
|
||||
<template v-if="!isThreePhase && phaseT === 0">
|
||||
<el-table-column prop="dataA" :label="'A相'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataB" :label="'B相'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataC" :label="'C相'+(unit==''?'':'('+unit+')')"/>
|
||||
</template>
|
||||
<template v-if="!isThreePhase && phaseT === 1">
|
||||
<el-table-column prop="dataT" :label="tableHeader+(unit==''?'':'('+unit+')')"/>
|
||||
</template>
|
||||
<template v-if="isThreePhase">
|
||||
<el-table-column prop="dataB" :label="'负序不平衡度'+(unit==''?'':'('+unit+')')"/>
|
||||
</template>
|
||||
<el-table-column v-if="!isThreePhase && phaseA==1" prop="dataA" :label="'A相'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column v-if="!isThreePhase && phaseB==1" prop="dataB" :label="'B相'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column v-if="!isThreePhase && phaseC==1" prop="dataC" :label="'C相'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column v-if="!isThreePhase && phaseT === 1" prop="dataT" :label="tableHeader+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column v-if="isThreePhase" prop="dataB" :label="'负序不平衡度'+(unit==''?'':'('+unit+')')"/>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -37,6 +31,16 @@ const unit = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unit : '';
|
||||
})
|
||||
|
||||
const phaseA = computed(() => {
|
||||
return tableData[0].dataA == '/' ? 0 : 1
|
||||
})
|
||||
const phaseB = computed(() => {
|
||||
return tableData[0].dataB == '/' ? 0 : 1
|
||||
})
|
||||
const phaseC = computed(() => {
|
||||
return tableData[0].dataC == '/' ? 0 : 1
|
||||
})
|
||||
|
||||
const phaseT = computed(() => {
|
||||
return tableData[0].dataT == '/' ? 0 : 1
|
||||
})
|
||||
|
||||
@@ -8,88 +8,79 @@
|
||||
<!-- {{ '通道' + row.chnNum }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<template v-if="phaseT === 0">
|
||||
<el-table-column label="A相">
|
||||
<el-table-column prop="stdA" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataA" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="isDataA" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围:{{ scope.row.maxErrorA }} <br/>
|
||||
误差值:{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataA === 4">/</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="A相" v-if="phaseA === 1">
|
||||
<el-table-column prop="stdA" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataA" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataA" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围:{{ scope.row.maxErrorA }} <br/>
|
||||
误差值:{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? innerUnitA : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataA === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="B相">
|
||||
<el-table-column prop="stdB" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataB" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="isDataB" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围:{{ scope.row.maxErrorB }}<br/>
|
||||
误差值:{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataB === 4">/</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="B相" v-if="phaseB === 1">
|
||||
<el-table-column prop="stdB" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataB" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataB" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围:{{ scope.row.maxErrorB }}<br/>
|
||||
误差值:{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? innerUnitB : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataB === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="C相">
|
||||
<el-table-column prop="stdC" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataC" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="isDataC" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围: {{ scope.row.maxErrorC }}<br/>
|
||||
误差值:{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataC === 4">/</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="C相" v-if="phaseC === 1">
|
||||
<el-table-column prop="stdC" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataC" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataC" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围: {{ scope.row.maxErrorC }}<br/>
|
||||
误差值:{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? innerUnitC : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataC === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<template v-if="phaseT === 1">
|
||||
<el-table-column :label="tableHeader">
|
||||
<el-table-column prop="stdT" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataT" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="isDataT" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围: {{ scope.row.maxErrorT }}<br/>
|
||||
误差值:{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataT === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataT === 4">/</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="tableHeader" v-if="phaseT === 1">
|
||||
<el-table-column prop="stdT" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataT" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataT" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围: {{ scope.row.maxErrorT }}<br/>
|
||||
误差值:{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? innerUnitT : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataT === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataT === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="maxError" label="误差范围"/>-->
|
||||
<!-- <el-table-column prop="result" label="检测结果">-->
|
||||
<!-- <template #default="scope">-->
|
||||
<!-- <span v-if="scope.row.result === 1">符合</span>-->
|
||||
<!-- <el-tag type="danger" v-if="scope.row.result === 2">不符合</el-tag>-->
|
||||
<!-- <span v-if="scope.row.result === 4">/</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -105,16 +96,39 @@ const {tableData, currentScriptTypeName} = defineProps<{
|
||||
}>();
|
||||
|
||||
|
||||
const unit = computed(() => {
|
||||
const outerUnit = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unit : '';
|
||||
})
|
||||
|
||||
const innerUnitA = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitA : '';
|
||||
})
|
||||
const innerUnitB = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitB : '';
|
||||
})
|
||||
const innerUnitC = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitC : '';
|
||||
})
|
||||
const innerUnitT = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitT : '';
|
||||
})
|
||||
|
||||
const phaseA = computed(() => {
|
||||
return tableData.length <= 0 || tableData[0].dataA == null || tableData[0].dataA == "/" ? 0 : 1
|
||||
})
|
||||
const phaseB = computed(() => {
|
||||
return tableData.length <= 0 || tableData[0].dataB == null || tableData[0].dataB == "/" ? 0 : 1
|
||||
})
|
||||
const phaseC = computed(() => {
|
||||
return tableData.length <= 0 || tableData[0].dataC == null || tableData[0].dataC == "/" ? 0 : 1
|
||||
})
|
||||
|
||||
const phaseT = computed(() => {
|
||||
return tableData[0].dataT == null || tableData[0].dataT == undefined ? 0 : 1
|
||||
return tableData.length <= 0 || tableData[0].dataT == null || tableData[0].dataT == "/" ? 0 : 1
|
||||
})
|
||||
|
||||
const tableHeader = computed(() => {
|
||||
if (phaseT.value === 1){
|
||||
if (phaseT.value === 1) {
|
||||
let index = currentScriptTypeName.indexOf('=');
|
||||
return currentScriptTypeName.substring(0, index);
|
||||
}
|
||||
@@ -125,7 +139,7 @@ const tableHeader = computed(() => {
|
||||
// let result = tableData[0].maxError ?? '/'
|
||||
// let idx = result.indexOf('~');
|
||||
// if (idx > 0) {
|
||||
// result = result.substring(0, idx) + unit.value + result.substring(idx, result.length) + unit.value;
|
||||
// result = result.substring(0, idx) + outerUnit.value + result.substring(idx, result.length) + outerUnit.value;
|
||||
// }
|
||||
// return result;
|
||||
// })
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-dialog :append-to-body="appendToBody" class="dialog" title="数据查询" :model-value='visible' @close="close"
|
||||
v-bind="dialogBig" :draggable="false">
|
||||
v-bind="dialogBig" :draggable="false" width="1400px">
|
||||
<div class="data-check-dialog">
|
||||
<div class="data-check-head">
|
||||
<el-form :model='formContent' label-width="auto" class="form-three ">
|
||||
@@ -8,7 +8,14 @@
|
||||
<el-input v-model='formContent.scriptName' :disabled="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="误差体系">
|
||||
<el-input v-model='formContent.errorSysName' :disabled="true"/>
|
||||
<el-select :disabled="checkStore.showDetailType===2 || checkStore.showDetailType===0" v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off"
|
||||
@change="handleErrorSysChange">
|
||||
<el-option
|
||||
v-for="(option) in pqErrorList"
|
||||
:key="option.id"
|
||||
:label="option.name"
|
||||
:value="option.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据原则">
|
||||
<el-input v-model='formContent.dataRule' :disabled="true"/>
|
||||
@@ -21,6 +28,12 @@
|
||||
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="checkStore.showDetailType===1">
|
||||
<el-button type="primary" :icon="Postcard" @click="handleGenerateReport">报告生成</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="checkStore.showDetailType===0">
|
||||
<el-button type="primary" :icon="Histogram" @click="handleReCalculate">重新计算</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
@@ -40,7 +53,7 @@
|
||||
:props="defaultProps"
|
||||
@node-click="handleNodeClick" class="custom-tree" ref="treeRef">
|
||||
<template #default="{ node, data }">
|
||||
<el-tooltip effect="dark" :content="data.scriptTypeName" placement="top">
|
||||
<el-tooltip effect="dark" :content="data.scriptTypeName" placement="right">
|
||||
<span class="custom-tree-node" :style="data.fly===2? 'color: #F56C6C;':data.fly===4? 'color: #e6a23c;':''">{{
|
||||
data.scriptTypeName
|
||||
}}</span>
|
||||
@@ -52,7 +65,7 @@
|
||||
|
||||
<div class="content-right">
|
||||
<div class="content-right-title">
|
||||
<div style="width: 750px;">
|
||||
<div style="width: 840px;">
|
||||
<span class="content-right-title-text">当前检测项目:
|
||||
<el-popover trigger="hover" :content="currentDesc" :width="popoverWidth" placement="right">
|
||||
<template #reference>
|
||||
@@ -63,15 +76,13 @@
|
||||
</el-popover>
|
||||
</span>
|
||||
</div>
|
||||
<!-- <el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 210px;" v-if="harmNumList.length" label='次数'>-->
|
||||
<!-- <el-select v-model="currentHarmNum">-->
|
||||
<!-- <el-option v-for="item in harmNumList" :key="item.value" :label="item.label" :value="item.value"/>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 230px;" v-if="checkList.length" label='测试项'>
|
||||
<el-select v-model="currentCheckItem">
|
||||
<el-option v-for="item in checkList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
<el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 280px;" v-if="checkListLevel.length" label='测试项'>
|
||||
<el-cascader
|
||||
v-model="currentCheckItem"
|
||||
:options="checkListLevel"
|
||||
:props="{expandTrigger: 'click' as const}"
|
||||
placement="bottom-end"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="content-right-Tabs">
|
||||
@@ -98,9 +109,12 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
||||
import {CheckData} from "@/api/check/interface";
|
||||
import {useDictStore} from "@/stores/modules/dict";
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {getFormData, getTreeData, getTableData} from "@/api/check/test";
|
||||
import {changeErrorSystem, deleteTempTable, exportRawData, getFormData, getTableData, getTreeData, reCalculate} from "@/api/check/test";
|
||||
import {generateDevReport, getPqErrSysList} from '@/api/plan/plan'
|
||||
import {useDownload} from "@/hooks/useDownload";
|
||||
import {exportRawData} from "@/api/check/test"
|
||||
import {Histogram, Postcard} from "@element-plus/icons-vue";
|
||||
import {ResultEnum} from "@/enums/httpEnum";
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
const {appendToBody} = withDefaults(defineProps<{
|
||||
appendToBody: boolean
|
||||
@@ -117,6 +131,7 @@ const checkStore = useCheckStore()
|
||||
const visible = ref(false)
|
||||
const treeRef = ref()
|
||||
const searchValue = ref<string>('')
|
||||
const pqErrorList = reactive<{ id: string; name: string; }[]>([])
|
||||
watch(searchValue, (val) => {
|
||||
treeRef.value!.filter(val)
|
||||
})
|
||||
@@ -127,19 +142,22 @@ const fixed = 4;
|
||||
// 表单数据
|
||||
const formContent = reactive<CheckData.DataCheck>({
|
||||
scriptName: '',
|
||||
errorSysName: '',
|
||||
errorSysId: '',
|
||||
dataRule: '',
|
||||
deviceName: '',
|
||||
chnNum: '',
|
||||
})
|
||||
// 当前选中的谐波次数
|
||||
// const currentHarmNum = ref<string>("-1")
|
||||
// 原始误差体系id
|
||||
let originErrorSysId: string = ''
|
||||
let planCode: string = ''
|
||||
// 谐波次数列表
|
||||
// const harmNumList = reactive<{ value: string, label: string }[]>([])
|
||||
// 当前选中的检测项
|
||||
const currentCheckItem = ref<string>("")
|
||||
const currentCheckItem = ref<any>()
|
||||
// 检测项列表
|
||||
const checkList = reactive<{ value: string, label: string }[]>([])
|
||||
// const checkList = reactive<{ value: string, label: string }[]>([])
|
||||
// 带有层级的检测项列表
|
||||
const checkListLevel = reactive<{ value: string, label: string, children: { value: string, label: string }[] }[]>([])
|
||||
|
||||
let deviceId: string = ''
|
||||
let originScriptType: string | null = null
|
||||
@@ -163,14 +181,13 @@ const currentDesc = ref('');
|
||||
const activeTab = ref<string>('resultTab')
|
||||
|
||||
//存放相应的表格数据
|
||||
let resTableData: { resultData: Map<string, any>, rawData: Map<string, any> } = {resultData: new Map(), rawData: new Map()}
|
||||
const resTableData = reactive<{ resultData: Map<string, any>, rawData: Map<string, any> }>({resultData: new Map(), rawData: new Map()})
|
||||
|
||||
// 检测结果表格数据
|
||||
const checkResultData = reactive<CheckData.CheckResult[]>([])
|
||||
|
||||
const popoverWidth: ComputedRef<string> = computed(() => {
|
||||
// return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (harmNumList.length || checkList.length ? 160 : 0)}px`
|
||||
return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (checkList.length ? 220 : 0)}px`
|
||||
return `${1140 - (currentScriptTypeName.value.length + 7 + 3) * 14 - (checkListLevel.length ? 280 : 0)}px`
|
||||
})
|
||||
|
||||
|
||||
@@ -193,59 +210,78 @@ const handleNodeClick = async (data: any) => {
|
||||
currentDesc.value = data.sourceDesc
|
||||
scriptType = data.scriptType ?? scriptType
|
||||
|
||||
if (checkIndex.value) {
|
||||
console.log("点击左侧树节点触发事件handleNodeClick", checkIndex.value)
|
||||
if (checkIndex.value !== '') {
|
||||
await updateTableData()
|
||||
activeTab.value = 'resultTab'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleErrorSysChange = async () => {
|
||||
console.log("切换误差体系", formContent.errorSysId);
|
||||
changeErrorSystem({
|
||||
planId: checkStore.plan.id,
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
errorSysId: formContent.errorSysId,
|
||||
deviceId: deviceId,
|
||||
code: checkStore.plan.code + '',
|
||||
}).then((res) => {
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
ElMessage.success('切换误差体系成功')
|
||||
if (originErrorSysId != formContent.errorSysId) {
|
||||
planCode = checkStore.plan.code + "_temp"
|
||||
} else {
|
||||
planCode = checkStore.plan.code + ''
|
||||
}
|
||||
if (formContent.chnNum != chnList[0].value) {
|
||||
formContent.chnNum = chnList[0].value
|
||||
} else {
|
||||
handleChnNumChange()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||
// console.log("通道号", newVal);
|
||||
|
||||
if (newVal) {
|
||||
// 发起请求,查询该测试项的检测结果
|
||||
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
|
||||
scriptId: checkStore.scriptId,
|
||||
devId: deviceId,
|
||||
devNum: formContent.chnNum + '',
|
||||
scriptType: originScriptType,
|
||||
code: parseInt(checkStore.planCode)
|
||||
})
|
||||
updateTreeFly(resTreeDataTemp, 4)
|
||||
updateTreeFly(resTreeDataTemp, 2)
|
||||
|
||||
treeDataAll.length = 0
|
||||
|
||||
Object.assign(treeDataAll, resTreeDataTemp)
|
||||
|
||||
defaultOperate()
|
||||
await updateTableData()
|
||||
if (newVal != '') {
|
||||
handleChnNumChange()
|
||||
}
|
||||
activeTab.value = 'resultTab'
|
||||
})
|
||||
|
||||
// watch(currentHarmNum, (newVal, oldVal) => {
|
||||
// console.log("谐波次数", newVal);
|
||||
// if (newVal !== '-1') {
|
||||
// let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal.toString())
|
||||
// setCheckResultData(resCheckResult)
|
||||
//
|
||||
// let tempRawData = resTableData.rawData.get(newVal.toString())
|
||||
// if (tempRawData) {
|
||||
// setRawData(tempRawData)
|
||||
// } else {
|
||||
// setRawData([])
|
||||
// }
|
||||
// }
|
||||
// activeTab.value = 'resultTab'
|
||||
// })
|
||||
const handleChnNumChange = async () => {
|
||||
console.log("通道号", formContent.chnNum);
|
||||
// 发起请求,查询该测试项的检测结果
|
||||
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
devId: deviceId,
|
||||
devNum: formContent.chnNum + '',
|
||||
scriptType: originScriptType,
|
||||
code: planCode
|
||||
})
|
||||
updateTreeFly(resTreeDataTemp, 4)
|
||||
updateTreeFly(resTreeDataTemp, 2)
|
||||
|
||||
treeDataAll.length = 0
|
||||
|
||||
Object.assign(treeDataAll, resTreeDataTemp)
|
||||
|
||||
defaultOperate()
|
||||
await updateTableData()
|
||||
activeTab.value = 'resultTab'
|
||||
}
|
||||
|
||||
|
||||
watch(currentCheckItem, (newVal, oldVal) => {
|
||||
console.log("当前检测项", newVal);
|
||||
if (newVal) {
|
||||
doCurrentCheckItemUpdate(newVal)
|
||||
if (newVal !== '') {
|
||||
let key = newVal[0]
|
||||
if (newVal.length == 2) {
|
||||
key += "_" + newVal[1]
|
||||
}
|
||||
console.log("当前检测项", key);
|
||||
doCurrentCheckItemUpdate(key)
|
||||
} else {
|
||||
activeTab.value = 'resultTab'
|
||||
}
|
||||
@@ -272,80 +308,85 @@ const defaultOperate = () => {
|
||||
}
|
||||
|
||||
const updateTableData = async () => {
|
||||
// console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
||||
if (checkIndex.value) {
|
||||
console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
||||
if (checkIndex.value !== '') {
|
||||
|
||||
checkListLevel.length = 0
|
||||
checkResultData.length = 0
|
||||
rawTableData.length = 0
|
||||
currentCheckItem.value = ''
|
||||
|
||||
// console.log("更新表格数据");
|
||||
// 发起请求,查询该测试项的检测结果
|
||||
const {data} = await getTableData({
|
||||
scriptType,
|
||||
scriptId: checkStore.scriptId,
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
devId: deviceId,
|
||||
devNum: formContent.chnNum + '',
|
||||
code: parseInt(checkStore.planCode),
|
||||
code: planCode,
|
||||
index: parseInt(checkIndex.value),
|
||||
})
|
||||
|
||||
let keys1 = Object.keys(data.resultData)
|
||||
let resultData = new Map()
|
||||
for (let key of keys1) {
|
||||
resultData.set(key, data.resultData[key])
|
||||
let children = []
|
||||
let label = key
|
||||
if ((key.includes('谐波') || key.includes('简谐波')) && key !== '谐波有功功率') {
|
||||
for (let item of data.resultData[key]) {
|
||||
let num = formatHarmNum(item.harmNum + '')
|
||||
label = item.isData === 1 ? `${num}` : item.isData === 4 ? `${num}(/)` : item.isData === 5 ? `${num}(-)` : `${num}(不符合)`
|
||||
children.push({label: label, value: num})
|
||||
resultData.set(key + "_" + num, item)
|
||||
}
|
||||
checkListLevel.push({label: key, value: key, children: children})
|
||||
} else {
|
||||
label = data.resultData[key][0].isData === 1 ? `${key}` : data.resultData[key][0].isData === 4 ? `${key}(/)` : data.resultData[key][0].isData === 5 ? `${key}(-)` : `${key}(不符合)`
|
||||
resultData.set(key, data.resultData[key][0])
|
||||
checkListLevel.push({label: label, value: key, children: []})
|
||||
let temp = checkListLevel.find(item => item.label.includes('电压幅值'))
|
||||
if (temp) {
|
||||
checkListLevel.splice(checkListLevel.indexOf(temp), 1)
|
||||
checkListLevel.unshift(temp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let keys2 = Object.keys(data.rawData)
|
||||
let rawData = new Map()
|
||||
for (let key of keys2) {
|
||||
rawData.set(key, data.rawData[key])
|
||||
}
|
||||
|
||||
resTableData = {
|
||||
resultData,
|
||||
rawData
|
||||
}
|
||||
|
||||
let resCheckResult: CheckData.ResCheckResult = {}
|
||||
let resRawData: CheckData.RawDataItem[] = []
|
||||
|
||||
if (keys1.length === 0) {
|
||||
checkList.length = 0
|
||||
checkResultData.length = 0
|
||||
rawTableData.length = 0
|
||||
currentCheckItem.value = ''
|
||||
}
|
||||
|
||||
if (keys1.length === 1) {
|
||||
resCheckResult = resTableData.resultData.get(keys1[0])
|
||||
resRawData = resTableData.rawData.get(keys2[0])
|
||||
|
||||
resRawData = (resRawData == null || resRawData == undefined ? [] : resRawData)
|
||||
resCheckResult = (resCheckResult == null || resCheckResult == undefined ? {} : resCheckResult)
|
||||
setCheckResultData(resCheckResult)
|
||||
setRawData(resRawData)
|
||||
checkList.length = 0
|
||||
currentCheckItem.value = ''
|
||||
} else if (keys1.length != 0) {
|
||||
let tempCheckList = []
|
||||
for (let [key, value] of resTableData.resultData) {
|
||||
let hum = formatHarmNum(key)
|
||||
tempCheckList.push({
|
||||
value: key,
|
||||
label: value.isData === 1 ? hum : value.isData === 4 ? `${hum}(/)` : `${hum}(不符合)`
|
||||
})
|
||||
}
|
||||
|
||||
toAngleLast(tempCheckList)
|
||||
checkList.length = 0
|
||||
Object.assign(checkList, tempCheckList)
|
||||
|
||||
if (currentCheckItem.value == tempCheckList[0].value) {
|
||||
doCurrentCheckItemUpdate(tempCheckList[0].value)
|
||||
if ((key.includes('谐波') || key.includes('简谐波')) && key !== '谐波有功功率') {
|
||||
for (let item of data.rawData[key]) {
|
||||
let num = formatHarmNum(item.harmNum + '')
|
||||
let value = rawData.get(key + "_" + num)
|
||||
if (!value) {
|
||||
rawData.set(key + "_" + num, [item])
|
||||
} else {
|
||||
value.push(item)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
currentCheckItem.value = tempCheckList[0].value
|
||||
rawData.set(key, data.rawData[key])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// setCheckResultData(resCheckResult)
|
||||
else {
|
||||
|
||||
resTableData.resultData = resultData
|
||||
resTableData.rawData = rawData
|
||||
|
||||
toAngleLast()
|
||||
|
||||
if (checkListLevel.length !== 0) {
|
||||
if (checkListLevel[0].children.length !== 0) {
|
||||
currentCheckItem.value = [checkListLevel[0].value + '', checkListLevel[0].children[0].value + '']
|
||||
} else {
|
||||
currentCheckItem.value = [checkListLevel[0].value + '']
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
checkResultData.length = 0
|
||||
rawTableData.length = 0
|
||||
}
|
||||
@@ -366,13 +407,14 @@ const doCurrentCheckItemUpdate = (newVal: string) => {
|
||||
}
|
||||
|
||||
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
|
||||
planCode = checkStore.plan.code + ''
|
||||
deviceId = _deviceId
|
||||
originScriptType = _scriptType
|
||||
scriptType = _scriptType
|
||||
|
||||
// 发起后端请求,查询详细信息 当chnNum为-1时,查询所有通道号
|
||||
const {data: resFormContent}: { data: any } = await getFormData({
|
||||
planId: checkStore.planId,
|
||||
planId: checkStore.plan.id,
|
||||
deviceId,
|
||||
chnNum,
|
||||
scriptType
|
||||
@@ -380,23 +422,51 @@ 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
|
||||
|
||||
Object.assign(formContent, {
|
||||
...resFormContent,
|
||||
dataRule: dataRuleName,
|
||||
chnNum: chnList.length > 0 ? chnList[0].value : '',
|
||||
})
|
||||
originErrorSysId = formContent.errorSysId
|
||||
|
||||
pqErrorList.length = 0
|
||||
let {data: resPqErrorList} = await getPqErrSysList()
|
||||
Object.assign(pqErrorList, resPqErrorList)
|
||||
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
const handleGenerateReport = async () => {
|
||||
await generateDevReport({'planId': checkStore.plan.id, 'devIdList': [deviceId],'scriptId':checkStore.plan.scriptId,'planCode':planCode})
|
||||
ElMessage.success({message: `报告生成成功!`})
|
||||
}
|
||||
|
||||
const handleReCalculate = async () => {
|
||||
reCalculate({
|
||||
planId: checkStore.plan.id,
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
errorSysId: formContent.errorSysId,
|
||||
deviceId: deviceId,
|
||||
code: checkStore.plan.code + ''
|
||||
}).then((res) => {
|
||||
ElMessage.success('重新计算成功!')
|
||||
// if (originErrorSysId != formContent.errorSysId) {
|
||||
// planCode = checkStore.plan.code + "_temp"
|
||||
// } else {
|
||||
// planCode = checkStore.plan.code + ''
|
||||
// }
|
||||
if (formContent.chnNum != chnList[0].value) {
|
||||
formContent.chnNum = chnList[0].value
|
||||
} else {
|
||||
handleChnNumChange()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const close = async () => {
|
||||
//数据清空
|
||||
Object.assign(formContent, {
|
||||
scriptName: '',
|
||||
@@ -411,18 +481,23 @@ const close = () => {
|
||||
currentCheckItem.value = ''
|
||||
checkResultData.length = 0
|
||||
rawTableData.length = 0
|
||||
checkList.length = 0
|
||||
//checkList.length = 0
|
||||
defaultExpandedKeys = []
|
||||
checkIndex.value = ''
|
||||
activeTab.value = 'resultTab'
|
||||
currentScriptTypeName.value = ''
|
||||
currentDesc.value = ''
|
||||
pqErrorList.length = 0
|
||||
planCode = ''
|
||||
|
||||
visible.value = false;
|
||||
|
||||
if (checkStore.showDetailType === 1) {
|
||||
await deleteTempTable(checkStore.plan.code + '')
|
||||
}
|
||||
};
|
||||
|
||||
const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||
// console.log("检测结果", data);
|
||||
let result: CheckData.CheckResult[] = []
|
||||
if (data == null || data == undefined) {
|
||||
Object.assign(checkResultData, [])
|
||||
@@ -430,21 +505,30 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||
}
|
||||
if (data.dataA != null && data.dataB != null && data.dataC != null) {
|
||||
result.push({
|
||||
stdA: numberToFixed(data.dataA.resultData),
|
||||
dataA: numberToFixed(data.dataA.data),
|
||||
errorA: getError(data.dataA.resultData, data.dataA.data),
|
||||
maxErrorA: toMaxErrorStr(data.dataA.radius, data.unit),
|
||||
// stdA: numberToFixed(data.dataA.resultData),
|
||||
// dataA: numberToFixed(data.dataA.data),
|
||||
stdA: dataToShow(data.dataA.resultData),
|
||||
dataA: dataToShow(data.dataA.data),
|
||||
errorA: data.dataA.errorData == null ? '/' : data.dataA.errorData + '',
|
||||
maxErrorA: toMaxErrorStr(data.dataA.radius, data.dataA.unit),
|
||||
unitA: data.dataA.unit,
|
||||
isDataA: data.dataA.isData,
|
||||
stdB: numberToFixed(data.dataB.resultData),
|
||||
dataB: numberToFixed(data.dataB.data),
|
||||
errorB: getError(data.dataB.resultData, data.dataB.data),
|
||||
maxErrorB: toMaxErrorStr(data.dataB.radius, data.unit),
|
||||
// stdB: numberToFixed(data.dataB.resultData),
|
||||
// dataB: numberToFixed(data.dataB.data),
|
||||
stdB: dataToShow(data.dataB.resultData),
|
||||
dataB: dataToShow(data.dataB.data),
|
||||
errorB: data.dataB.errorData == null ? '/' : data.dataB.errorData + '',
|
||||
maxErrorB: toMaxErrorStr(data.dataB.radius, data.dataB.unit),
|
||||
isDataB: data.dataB.isData,
|
||||
stdC: numberToFixed(data.dataC.resultData),
|
||||
dataC: numberToFixed(data.dataC.data),
|
||||
errorC: getError(data.dataC.resultData, data.dataC.data),
|
||||
maxErrorC: toMaxErrorStr(data.dataC.radius, data.unit),
|
||||
unitB: data.dataB.unit,
|
||||
// stdC: numberToFixed(data.dataC.resultData),
|
||||
// dataC: numberToFixed(data.dataC.data),
|
||||
stdC: dataToShow(data.dataC.resultData),
|
||||
dataC: dataToShow(data.dataC.data),
|
||||
errorC: data.dataC.errorData == null ? '/' : data.dataC.errorData + '',
|
||||
maxErrorC: toMaxErrorStr(data.dataC.radius, data.dataC.unit),
|
||||
isDataC: data.dataC.isData,
|
||||
unitC: data.dataC.unit,
|
||||
|
||||
maxError: data.radius,
|
||||
unit: data.unit,
|
||||
@@ -452,13 +536,16 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||
})
|
||||
}
|
||||
|
||||
if (data.dataT != null) {
|
||||
if (data.dataT != null && data.dataA == null && data.dataB == null && data.dataC == null) {
|
||||
result.push({
|
||||
stdT: numberToFixed(data.dataT.resultData),
|
||||
dataT: numberToFixed(data.dataT.data),
|
||||
errorT: getError(data.dataT.resultData, data.dataT.data),
|
||||
maxErrorT: toMaxErrorStr(data.dataT.radius, data.unit),
|
||||
// stdT: numberToFixed(data.dataT.resultData),
|
||||
// dataT: numberToFixed(data.dataT.data),
|
||||
stdT: dataToShow(data.dataT.resultData),
|
||||
dataT: dataToShow(data.dataT.data),
|
||||
errorT: data.dataT.errorData == null ? '/' : data.dataT.errorData + '',
|
||||
maxErrorT: toMaxErrorStr(data.dataT.radius, data.dataT.unit),
|
||||
isDataT: data.dataT?.isData,
|
||||
unitT: data.dataT.unit,
|
||||
|
||||
maxError: data.radius,
|
||||
unit: data.unit,
|
||||
@@ -466,15 +553,16 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||
})
|
||||
}
|
||||
Object.assign(checkResultData, result)
|
||||
console.log("检测结果", checkResultData);
|
||||
}
|
||||
|
||||
const exportRawDataHandler = () => {
|
||||
useDownload(exportRawData, '原始数据.xlsx', {
|
||||
useDownload(exportRawData, '原始数据', {
|
||||
scriptType,
|
||||
scriptId: checkStore.scriptId,
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
devId: deviceId,
|
||||
devNum: formContent.chnNum + '',
|
||||
code: parseInt(checkStore.planCode),
|
||||
code: checkStore.plan.code + '',
|
||||
index: parseInt(checkIndex.value),
|
||||
}, false, '.xlsx')
|
||||
}
|
||||
@@ -491,14 +579,26 @@ const formatHarmNum = (num: string) => {
|
||||
|
||||
const setRawData = (data: CheckData.RawDataItem[]) => {
|
||||
data.forEach((item: CheckData.RawDataItem) => {
|
||||
item.dataA = stringToFixed(item.dataA)
|
||||
item.dataB = stringToFixed(item.dataB)
|
||||
item.dataC = stringToFixed(item.dataC)
|
||||
item.dataT = stringToFixed(item.dataT)
|
||||
// item.dataA = stringToFixed(item.dataA)
|
||||
// item.dataB = stringToFixed(item.dataB)
|
||||
// item.dataC = stringToFixed(item.dataC)
|
||||
// item.dataT = stringToFixed(item.dataT)
|
||||
item.dataA = dataToShow(item.dataA)
|
||||
item.dataB = dataToShow(item.dataB)
|
||||
item.dataC = dataToShow(item.dataC)
|
||||
item.dataT = dataToShow(item.dataT)
|
||||
})
|
||||
rawTableData.length = 0
|
||||
Object.assign(rawTableData, data)
|
||||
console.log("原始数据", rawTableData)
|
||||
}
|
||||
const dataToShow = (num: number): string => {
|
||||
if (num == null || num == undefined) {
|
||||
return '/'
|
||||
}
|
||||
return num+''
|
||||
}
|
||||
|
||||
|
||||
const numberToFixed = (num: number): string => {
|
||||
if (num == null || num == undefined) {
|
||||
@@ -564,18 +664,18 @@ const getDefaultNode = (data: any[]) => {
|
||||
return findFirstLeafNode(firstElement);
|
||||
}
|
||||
|
||||
const toAngleLast = (data: any[]) => {
|
||||
const toAngleLast = () => {
|
||||
let angleIndex = -1
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].value.toString().includes('相角')) {
|
||||
for (let i = 0; i < checkListLevel.length; i++) {
|
||||
if (checkListLevel[i].value.toString().includes('相角')) {
|
||||
angleIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if (angleIndex != -1) {
|
||||
let temp = data[angleIndex]
|
||||
data.splice(angleIndex, 1)
|
||||
data.push(temp)
|
||||
let temp = checkListLevel[angleIndex]
|
||||
checkListLevel.splice(angleIndex, 1)
|
||||
checkListLevel.push(temp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -647,7 +747,6 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.dialog {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -742,7 +841,7 @@ defineExpose({
|
||||
<!--.el-popover.popover-class {-->
|
||||
<!-- .el-popover__title {-->
|
||||
<!-- color: #fff;-->
|
||||
<!-- background-color: #003078 !important;-->
|
||||
<!-- background-color: var(--el-color-primary) !important;-->
|
||||
<!-- }-->
|
||||
<!--}-->
|
||||
<!--</style>-->
|
||||
362
frontend/src/views/home/components/deviceConnectionPopup.vue
Normal file
362
frontend/src/views/home/components/deviceConnectionPopup.vue
Normal file
@@ -0,0 +1,362 @@
|
||||
<template>
|
||||
<el-dialog title="设备通道配对" v-model='dialogVisible' v-bind="dialogBig">
|
||||
<div class="flow-container" style="overflow: hidden; position: relative;">
|
||||
<el-button @click="logConnections">打印当前配对</el-button>
|
||||
<VueFlow
|
||||
:nodes="nodes"
|
||||
:edges="edges"
|
||||
:connection-radius="30"
|
||||
:nodes-draggable="false"
|
||||
:dragging="false"
|
||||
:zoom-on-scroll="false"
|
||||
:pan-on-drag="false"
|
||||
:disable-zoom-pan-on-connect="true"
|
||||
:prevent-scrolling="true"
|
||||
:fit-view="true"
|
||||
:min-zoom="1"
|
||||
:max-zoom="1"
|
||||
:elements-selectable="false"
|
||||
auto-connect
|
||||
@connect="handleConnect"
|
||||
@connect-start="handleConnectStart"
|
||||
@connect-end="handleConnectEnd"
|
||||
@pane-ready="onPaneReady"
|
||||
v-on:pane-mouse-move="false"
|
||||
>
|
||||
</VueFlow>
|
||||
</div>
|
||||
|
||||
<!-- 底部操作按钮 -->
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleNext">下一步</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 手动检测-勾选检测项弹窗 -->
|
||||
<SelectTestItemPopup ref="selectTestItemPopupRef" @openTestDialog="openTestDialog"></SelectTestItemPopup>
|
||||
<CompareTestPopup ref='testPopup'></CompareTestPopup>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { h, ref } from 'vue'
|
||||
import { VueFlow, useVueFlow } from '@vue-flow/core'
|
||||
import { dialogBig } from "@/utils/elementBind";
|
||||
import { Platform, Flag } from '@element-plus/icons-vue'
|
||||
import { Device } from '@/api/device/interface/device';
|
||||
import { StandardDevice } from '@/api/device/interface/standardDevice';
|
||||
import SelectTestItemPopup from "@/views/home/components/selectTestItemPopup.vue";
|
||||
import CompareTestPopup from './compareTestPopup.vue'
|
||||
import { ElMessage } from 'element-plus';
|
||||
import CustomEdge from './RemoveableEdge.vue' // 导入自定义连接线组件
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
|
||||
const testPopup = ref()
|
||||
const dialogTitle = ref('手动检测')
|
||||
|
||||
// 初始化 VueFlow,注册自定义连线类型
|
||||
const { edges, setViewport } = useVueFlow({
|
||||
edgeTypes: {
|
||||
default: CustomEdge
|
||||
}
|
||||
})
|
||||
|
||||
// 初始化时锁定画布位置
|
||||
const onPaneReady = () => {
|
||||
setViewport({ x: 0, y: 0, zoom: 1 })
|
||||
}
|
||||
|
||||
// 提取公共的label渲染函数
|
||||
const createLabel = (text: string, type: string) => {
|
||||
return h('div', {
|
||||
style: {
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
fontSize: '15px',
|
||||
textAlign: 'center',
|
||||
border: '1px solid #ccc',
|
||||
borderRadius: '8px',
|
||||
padding: '8px',
|
||||
backgroundColor: '#f9f9f9'
|
||||
}
|
||||
}, [
|
||||
h(Platform, {
|
||||
style: {
|
||||
width: '20px',
|
||||
marginBottom: '4px',
|
||||
color: '#526ade'
|
||||
}
|
||||
}),
|
||||
h('div', null, '设备名称:' + text),
|
||||
h('div', null, '设备类型:' + type)
|
||||
]) as any
|
||||
}
|
||||
|
||||
const createLabel3 = (text: string) => {
|
||||
return h('div', {
|
||||
style: {
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
fontSize: '15px',
|
||||
textAlign: 'center',
|
||||
border: '1px solid #ccc',
|
||||
borderRadius: '8px',
|
||||
padding: '8px',
|
||||
backgroundColor: '#f9f9f9'
|
||||
}
|
||||
}, [
|
||||
h(Flag, {
|
||||
style: {
|
||||
width: '20px',
|
||||
marginRight: '4px',
|
||||
color: '#526ade'
|
||||
}
|
||||
}),
|
||||
text
|
||||
]) as any
|
||||
}
|
||||
|
||||
|
||||
const handleConnectStart = (params: any) => {
|
||||
onPaneReady()
|
||||
}
|
||||
|
||||
const handleConnectEnd = (params: any) => {
|
||||
onPaneReady()
|
||||
}
|
||||
|
||||
const handleConnect = (params: any) => {
|
||||
console.log('连接信息:', params);
|
||||
const sourceNode = nodes.value.find(node => node.id === params.source)
|
||||
const targetNode = nodes.value.find(node => node.id === params.target)
|
||||
|
||||
// 连接规则验证
|
||||
const isValidConnection =
|
||||
sourceNode?.type === 'input' &&
|
||||
targetNode?.type === 'output'
|
||||
|
||||
if (!isValidConnection) {
|
||||
removeEdge(params)
|
||||
ElMessage.warning('只能从被检通道连接到标准通道')
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 删除不合法连接
|
||||
const removeEdge = (params: any) => {
|
||||
const edgeIndex = edges.value.findIndex(edge =>
|
||||
edge.source === params.source && edge.target === params.target
|
||||
)
|
||||
if (edgeIndex !== -1) {
|
||||
edges.value.splice(edgeIndex, 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 打印当前节点和连线信息
|
||||
function logConnections() {
|
||||
console.log('当前节点:', nodes.value);
|
||||
console.log('当前连线:', edges.value);
|
||||
|
||||
const connections = edges.value.map(edge => ({
|
||||
source: edge.source,
|
||||
target: edge.target,
|
||||
label: `${edge.source} → ${edge.target}`
|
||||
}));
|
||||
|
||||
console.table(connections);
|
||||
}
|
||||
|
||||
const nodes = ref([])
|
||||
const sourceIdArray = ref<string[]>()
|
||||
const open = async (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[],sourceIds: string[]) => {
|
||||
edges.value = []
|
||||
sourceIdArray.value = sourceIds
|
||||
nodes.value = createNodes(device, standardDev)
|
||||
dialogVisible.value = true
|
||||
onPaneReady()
|
||||
}
|
||||
|
||||
const handleNext = () => {
|
||||
if (edges.value.length === 0) {
|
||||
ElMessage.warning('请先完成通道配对')
|
||||
return
|
||||
}
|
||||
dialogVisible.value = false
|
||||
selectTestItemPopupRef.value?.open(sourceIdArray.value)
|
||||
}
|
||||
|
||||
const openTestDialog = () => {
|
||||
testPopup.value?.open(dialogTitle.value,sourceIdArray.value)
|
||||
}
|
||||
|
||||
const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[]) => {
|
||||
const channelCounts: Record<string, number> = {}
|
||||
device.forEach(device => {
|
||||
channelCounts[device.id] = device.devChns || 0
|
||||
})
|
||||
|
||||
const inspectionDevices = device.map(d => ({
|
||||
id: d.id,
|
||||
name: d.name,
|
||||
type: 'normal',
|
||||
deviceType: d.devType
|
||||
}))
|
||||
|
||||
const channelCounts2: Record<string, number> = {}
|
||||
standardDev.forEach(dev => {
|
||||
const channelList = dev.inspectChannel ? dev.inspectChannel.split(',') : []
|
||||
channelCounts2[dev.id] = channelList.length
|
||||
})
|
||||
|
||||
const standardDevices = standardDev.map(d => ({
|
||||
id: d.id,
|
||||
name: d.name,
|
||||
type: 'normal',
|
||||
deviceType: d.devType
|
||||
}))
|
||||
|
||||
const newNodes: any[] = []
|
||||
const deviceChannelGroups: { deviceId: string; centerY: number; }[] = []
|
||||
const standardChannelGroups: any[] = []
|
||||
|
||||
const deviceWidth = 0
|
||||
const inputChannelX = 200
|
||||
const outputChannelX = 800
|
||||
const standardWidth = 950
|
||||
|
||||
const yPosition = ref(25)
|
||||
const yPosition2 = ref(25)
|
||||
|
||||
// 添加被检通道
|
||||
Object.entries(channelCounts).forEach(([deviceId, count]) => {
|
||||
for (let i = 1; i <= count; i++) {
|
||||
const channelId = `被检通道-${deviceId}-${i}`
|
||||
newNodes.push({
|
||||
id: channelId,
|
||||
type: 'input',
|
||||
data: { label: createLabel3(`被检通道${i}`) },
|
||||
position: { x: inputChannelX, y: yPosition.value },
|
||||
sourcePosition: 'right',
|
||||
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||
})
|
||||
|
||||
// 计算设备节点Y坐标(居中显示)
|
||||
if(i == 1 && count == 1){
|
||||
deviceChannelGroups.push({
|
||||
deviceId,
|
||||
centerY: yPosition.value - 25
|
||||
})
|
||||
}else if(i == 2 && count == 2){
|
||||
deviceChannelGroups.push({
|
||||
deviceId,
|
||||
centerY: yPosition.value - 50
|
||||
})
|
||||
}else if(i == 3 && count == 3){
|
||||
deviceChannelGroups.push({
|
||||
deviceId,
|
||||
centerY: yPosition.value - 75
|
||||
})
|
||||
}else if(i == 4 && count == 4){
|
||||
deviceChannelGroups.push({
|
||||
deviceId,
|
||||
centerY: yPosition.value - 100
|
||||
})
|
||||
}
|
||||
|
||||
yPosition.value += 50
|
||||
}
|
||||
yPosition.value += 50
|
||||
})
|
||||
|
||||
// 添加标准通道
|
||||
Object.entries(channelCounts2).forEach(([deviceId, count]) => {
|
||||
for (let i = 1; i <= count; i++) {
|
||||
const channelId = `标准通道-${deviceId}-${i}`
|
||||
newNodes.push({
|
||||
id: channelId,
|
||||
type: 'output',
|
||||
data: { label: createLabel3(`标准通道${i}`) },
|
||||
position: { x: outputChannelX, y: yPosition2.value },
|
||||
targetPosition: 'left',
|
||||
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||
})
|
||||
|
||||
// 计算设备节点Y坐标(居中显示)
|
||||
if(i == 1 && count == 1){
|
||||
standardChannelGroups.push({
|
||||
deviceId,
|
||||
centerY: yPosition2.value - 25
|
||||
})
|
||||
}else if(i == 2 && count == 2){
|
||||
standardChannelGroups.push({
|
||||
deviceId,
|
||||
centerY: yPosition2.value - 50
|
||||
})
|
||||
}else if(i == 3 && count == 3){
|
||||
standardChannelGroups.push({
|
||||
deviceId,
|
||||
centerY: yPosition2.value - 100
|
||||
})
|
||||
}else if(i == 4 && count == 4){
|
||||
standardChannelGroups.push({
|
||||
deviceId,
|
||||
centerY: yPosition2.value - 100
|
||||
})
|
||||
}
|
||||
|
||||
yPosition2.value += 50
|
||||
}
|
||||
yPosition2.value += 50
|
||||
})
|
||||
|
||||
// 添加被检设备
|
||||
deviceChannelGroups.forEach(({ deviceId, centerY }) => {
|
||||
const device = inspectionDevices.find(d => d.id === deviceId)
|
||||
if (device) {
|
||||
newNodes.push({
|
||||
id: device.id,
|
||||
data: { label: createLabel(device.name, device.deviceType) },
|
||||
position: { x: deviceWidth, y: centerY },
|
||||
class: 'no-handle-node',
|
||||
style: { width: '200px', border: 'none', boxShadow: 'none' }
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// 添加标准设备
|
||||
standardChannelGroups.forEach(({ deviceId, centerY }) => {
|
||||
const device = standardDevices.find(d => d.id === deviceId)
|
||||
if (device) {
|
||||
newNodes.push({
|
||||
id: device.id,
|
||||
data: { label: createLabel(device.name, device.deviceType) },
|
||||
position: { x: standardWidth, y: centerY },
|
||||
class: 'no-handle-node',
|
||||
style: { width: '200px', border: 'none', boxShadow: 'none' }
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return newNodes
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.flow-container {
|
||||
height: 600px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.vue-flow__node.no-handle-node .vue-flow__handle {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
840
frontend/src/views/home/components/factorTest.vue
Normal file
840
frontend/src/views/home/components/factorTest.vue
Normal file
@@ -0,0 +1,840 @@
|
||||
<template>
|
||||
<div class="dialog" v-bind="dialogBig">
|
||||
<div class="dialog-content">
|
||||
<div class="right-title">
|
||||
<!-- <div>系数校准表</div> -->
|
||||
<div>{{ outputDsc }}</div>
|
||||
<div>
|
||||
<span style=" font-size: 18px;font-weight: 600;">
|
||||
设备已合格 <span style="color: #91cc75">{{ qualified }}</span> 台/共 <span style="color: green">{{ total }}</span>
|
||||
台
|
||||
</span>
|
||||
<!-- <el-button type="primary" loading
|
||||
v-if="activeIndex > 0 && activeIndex < activeTotalNum">通道系数已校准3台/共3台</el-button>
|
||||
<el-button type="primary" :disabled="true" v-if="activeIndex === activeTotalNum">通道系数已校准3台/共3台</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="dialog-left">
|
||||
<el-steps direction="vertical" :active="active" :process-status="currentStepStatus" finish-status="success">
|
||||
<el-step title="开始"/>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>大电压/电流系数下装</span><br/>
|
||||
<span class="spanStyle">源输出为:</span><br/>
|
||||
<span class="spanStyle" v-if="active > 0">{{ big_V_Download }}</span><br/>
|
||||
<span class="spanStyle" v-if="active > 0">{{ big_I_Download }}</span>
|
||||
<el-icon v-if="active === 1 " class="loading-box">
|
||||
<el-icon-loading/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-step>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>小电压/电流系数下装</span><br/>
|
||||
<span class="spanStyle">源输出为:</span><br/>
|
||||
<span class="spanStyle" v-if="active > 1">{{ small_V_Download }}</span><br/>
|
||||
<span class="spanStyle" v-if="active > 1">{{ small_I_Download }}</span>
|
||||
<el-icon v-if="active === 2" class="loading-box">
|
||||
<el-icon-loading/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-step>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>大电压/电流校准</span><br/>
|
||||
<span class="spanStyle">源输出为:</span><br/>
|
||||
<span class="spanStyle" v-if="active > 2">{{ big_V_Adjust }}</span><br/>
|
||||
<span class="spanStyle" v-if="active > 2">{{ big_I_Adjust }}</span>
|
||||
<el-icon v-if="active === 3" class="loading-box">
|
||||
<el-icon-loading/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-step>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>小电压/电流校准</span><br/>
|
||||
<span class="spanStyle">源输出为:</span><br/>
|
||||
<span class="spanStyle" v-if="active > 3">{{ small_V_Adjust }}</span><br/>
|
||||
<span class="spanStyle" v-if="active > 3">{{ small_I_Adjust }}</span>
|
||||
<el-icon v-if="active === 4" class="loading-box">
|
||||
<el-icon-loading/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-step>
|
||||
<el-step title="结束"/>
|
||||
</el-steps>
|
||||
</div>
|
||||
<div class="right-content">
|
||||
<el-tabs type="border-card" v-model="editableTabsValue" :active-index="String(activeIndex)">
|
||||
<el-tab-pane v-for="(device, index) in name" :key="index" :label="device">
|
||||
<template #label>
|
||||
<span class="custom-tabs-label">
|
||||
<span>{{ device }}</span>
|
||||
<el-icon v-if="errorStates[index]" class="icon-style">
|
||||
<Failed/>
|
||||
</el-icon>
|
||||
</span>
|
||||
</template>
|
||||
<channelsTestTable
|
||||
:tableData="getTableDataForChannel(index)"
|
||||
:big_V_loading="big_V_loadingStates"
|
||||
:curV="CurV">
|
||||
</channelsTestTable>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup name="FactorTest">
|
||||
import {type Device} from '@/api/device/interface/device';
|
||||
import {Failed} from '@element-plus/icons-vue'
|
||||
import {onBeforeMount, type Ref, ref, toRef, watch} from 'vue'
|
||||
import {dialogBig} from '@/utils/elementBind'
|
||||
import {ElMessageBox} from 'element-plus';
|
||||
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)
|
||||
const activeTotalNum = ref(4)
|
||||
const qualified = ref(0)
|
||||
const outputDsc = ref('电压误差为:±0.1Un%; 电流误差为:±0.5%')
|
||||
const total = ref(0)
|
||||
const dialogVisible = ref(false)
|
||||
const active = ref(0)
|
||||
let timer1: NodeJS.Timeout | null = null; // 声明并初始化 timer1
|
||||
let timer2: NodeJS.Timeout | null = null; // 同样声明并初始化 timer2
|
||||
const name = ref<string[]>([])//系数校准所选设备名字数组
|
||||
const channel = ref<number[]>([])//系数校准所选设备通道数组
|
||||
const devIdArray = ref<string[]>([])//系数校准所选设备ID数组
|
||||
const select_Plan = ref<Plan.ReqPlan>()
|
||||
const planId = ref('')
|
||||
const isButtonDisabled = ref(false);
|
||||
const CurV = ref<number>()//额定电压
|
||||
// 在 setup 函数中
|
||||
const errorStates = ref(new Array(name.value.length).fill(false));
|
||||
//const loadingStates = ref(new Array(name.value.length).fill(false)); // 初始化 loading 状态
|
||||
const big_V_loadingStates = ref(false); // 初始化 大电压大电流下装loading 状态
|
||||
const small_V_loadingStates = ref(false); // 初始化 小电压小电流下装loading 状态
|
||||
const big_V_loadingStates2 = ref(false); // 初始化 大电压大电流校准loading 状态
|
||||
const small_V_loadingStates2 = ref(false); // 初始化 小电压小电流校准loading 状态
|
||||
const editableTabsValue = ref('0')
|
||||
const big_V_Download = ref('')
|
||||
const big_I_Download = ref('')
|
||||
const small_V_Download = ref('')
|
||||
const small_I_Download = ref('')
|
||||
const big_V_Adjust = ref('')
|
||||
const big_I_Adjust = ref('')
|
||||
const small_V_Adjust = ref('')
|
||||
const small_I_Adjust = ref('')
|
||||
const props = defineProps({
|
||||
testStatus: {
|
||||
type: String,
|
||||
default: 'wait'
|
||||
},
|
||||
webMsgSend: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
})
|
||||
const userStore = useUserStore()
|
||||
const testStatus = toRef(props, 'testStatus');
|
||||
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
|
||||
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||
const webMsgSend = toRef(props, 'webMsgSend');
|
||||
|
||||
onBeforeMount(() => {
|
||||
// 初始化
|
||||
initData()
|
||||
})
|
||||
const initData = () => {
|
||||
|
||||
CurV.value = checkStore.devices[0]?.devVolt || 57.74;
|
||||
isButtonDisabled.value = false; // 恢复按钮
|
||||
select_Plan.value = checkStore.plan
|
||||
planId.value = checkStore.devices[0]?.planId || '';
|
||||
devIdArray.value = checkStore.devices.map(item => item.deviceId);
|
||||
name.value = checkStore.devices.map(item => item.deviceName)
|
||||
channel.value = checkStore.devices.map(item => item.chnNum)
|
||||
dialogVisible.value = true;
|
||||
total.value = name.value.length
|
||||
|
||||
|
||||
// 初始化 loadingStates 为 false
|
||||
// loadingStates.value = new Array(selection.length).fill(false);
|
||||
errorStates.value = new Array(checkStore.devices.length).fill(false);
|
||||
|
||||
for (let i = 0; i < channel.value.length; i++) {
|
||||
const currentTableData = initializeTableData(dataTemplates, i);
|
||||
tableDataMap.set(i, currentTableData)
|
||||
}
|
||||
//console.log('tableDataMap',tableDataMap);
|
||||
}
|
||||
|
||||
|
||||
watch(testStatus, function (newValue, oldValue) {
|
||||
if (newValue === 'start') {
|
||||
// 开始系数校准操作
|
||||
handleSubmit()
|
||||
}
|
||||
})
|
||||
|
||||
watch(webMsgSend, function (newValue, oldValue) {
|
||||
console.log('webMsgSend---code', newValue.code)
|
||||
console.log('webMsgSend---requestId', newValue.requestId)
|
||||
if (testStatus.value !== 'waiting') {
|
||||
if (newValue.code == 10520) {
|
||||
ElMessageBox.alert('报文解析异常!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10521) {
|
||||
ElMessageBox.alert('程控源參数有误!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10522) {
|
||||
ElMessageBox.alert('测试项解析有误!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10523) {
|
||||
ElMessageBox.alert('源连接失败!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10524) {
|
||||
ElMessageBox.alert('获取源控制权失败!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10525) {
|
||||
ElMessageBox.alert('重置源失败!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10527) {
|
||||
ElMessageBox.alert('源未进行初始化!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10528) {
|
||||
ElMessageBox.alert('目标源有误(该用户已控制其他源,在关闭前无法操作新的源)!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10529) {
|
||||
ElMessageBox.alert('源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10550) {
|
||||
ElMessageBox.alert(`${newValue.data}设备连接异常!`, '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10551) {
|
||||
ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10552) { //todo 10552之后还会发送消息吗?
|
||||
ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else {
|
||||
console.log('显示东西code', newValue.code)
|
||||
console.log('显示东西requestId', newValue.requestId)
|
||||
switch (newValue.requestId) {
|
||||
|
||||
case 'yjc_ytxjy':
|
||||
switch (newValue.operateCode) {
|
||||
case'INIT_GATHER':
|
||||
if (newValue.code == -1) {
|
||||
ElMessageBox.alert('源未知异常', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10523) {
|
||||
ElMessageBox.alert('源连接失败', '源连接失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'YJC_xujy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'OPER_GATHER':
|
||||
if (newValue.code == 10552) {
|
||||
ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10520) {
|
||||
ElMessageBox.alert('解析报文异常,执行自动关闭,请重新发起检测', '解析报文异常', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
}
|
||||
break;
|
||||
case 'DATA_REQUEST$02':
|
||||
if (newValue.code == 25003) {
|
||||
ElMessageBox.alert('相序校验未通过,执行自动关闭,请重新发起检测', '相序校验未通过', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'yjc_sbtxjy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$01':
|
||||
if (newValue.code == 10550) {
|
||||
ElMessageBox.alert('设备连接异常', '设备连接异常', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10551) {
|
||||
ElMessageBox.alert('设备触发报告异常', '设备触发报告异常', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
} else if (newValue.code == 10520) {
|
||||
ElMessageBox.alert('解析报文异常,执行自动关闭,请重新发起检测', '解析报文异常', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'yjc_xyjy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'VERIFY_MAPPING$01':
|
||||
if (newValue.code == 10200) {
|
||||
let data = JSON.parse(newValue.data)
|
||||
ElMessageBox.alert(`脚本与icd校验失败!icd名称:${data['icdType']} -> 校验项:${data['dataType']}`, '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
}
|
||||
if (newValue.code == 10500) {
|
||||
ElMessageBox.alert(`装置中未找到该icd!`, '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'Coefficient_Check':
|
||||
console.log("Coefficient_Checkactive", active.value);
|
||||
switch (newValue.operateCode) {
|
||||
case 'big_start'://大电压,电流下装
|
||||
big_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||
big_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||
break;
|
||||
case 'big_end'://大电压,电流下装
|
||||
active.value++;
|
||||
tableLoading('small', '系数下装')
|
||||
break;
|
||||
}
|
||||
switch (newValue.operateCode) {
|
||||
case 'small_start'://小电压,电流下装
|
||||
small_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||
small_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||
break;
|
||||
case 'small_end'://小电压,电流下装
|
||||
active.value++;
|
||||
tableLoading('big', '系数校准')
|
||||
break;
|
||||
}
|
||||
switch (newValue.operateCode) {
|
||||
case 'big_comp_start'://大电压,电流校准
|
||||
big_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||
big_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||
break;
|
||||
case 'big_comp_end'://大电压,电流校准
|
||||
active.value++;
|
||||
tableLoading('small', '系数校准')
|
||||
break;
|
||||
}
|
||||
switch (newValue.operateCode) {
|
||||
case 'small_comp_start'://小电压,电流校准
|
||||
small_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||
small_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||
break;
|
||||
case 'small_comp_end'://小电压,电流校准
|
||||
active.value++;
|
||||
active.value++;
|
||||
|
||||
for (let i = 0; i < name.value.length; i++) {
|
||||
const currentDataRef = tableDataMap.get(i);
|
||||
if (currentDataRef) {
|
||||
const currentData = currentDataRef.value;
|
||||
// 检查当前数据中有无不合格字段
|
||||
const hasError = checkForErrors(currentData);
|
||||
if (hasError) {
|
||||
} else {
|
||||
qualified.value++;
|
||||
}
|
||||
updateErrorState(i, hasError);
|
||||
}
|
||||
}
|
||||
|
||||
//editableTabsValue.value = (tabNumber.value).toString();//显示下一个tab
|
||||
isButtonDisabled.value = false; // 恢复按钮
|
||||
emit('update:testStatus', 'success')
|
||||
break;
|
||||
}
|
||||
switch (newValue.operateCode) {
|
||||
case 'DATA_CHNFACTOR$02'://表格
|
||||
// 输出 key 为 0 的数组中的第一条 ChannelsTest.CoefficientVO 对象
|
||||
console.log('表格', name.value)
|
||||
for (let i = 0; i < name.value.length; i++) {
|
||||
const targetArrayRef = tableDataMap.get(i);
|
||||
if (targetArrayRef) {
|
||||
const targetArray = targetArrayRef.value;
|
||||
if (targetArray.length > 0) {
|
||||
const firstCoefficientVO = targetArray.find(item => item.monitorNum === newValue.data.monitorNum &&
|
||||
item.type === newValue.data.type &&
|
||||
item.desc === newValue.data.desc &&
|
||||
item.devName === newValue.data.devName);
|
||||
if (firstCoefficientVO) { // 检查 firstCoefficientVO 是否存在
|
||||
firstCoefficientVO.aVuData = parseFloat(newValue.data.aVuData).toFixed(4);
|
||||
|
||||
if (!isNaN(parseFloat(newValue.data.aVuXi)) && isFinite(newValue.data.aVuXi)) {
|
||||
firstCoefficientVO.aVuXi = (parseFloat(newValue.data.aVuXi) / 10000).toFixed(4);
|
||||
} else {
|
||||
firstCoefficientVO.aVuXi = newValue.data.aVuXi;
|
||||
}
|
||||
|
||||
firstCoefficientVO.bVuData = parseFloat(newValue.data.bVuData).toFixed(4);
|
||||
|
||||
if (!isNaN(parseFloat(newValue.data.bVuXi)) && isFinite(newValue.data.bVuXi)) {
|
||||
firstCoefficientVO.bVuXi = (parseFloat(newValue.data.bVuXi) / 10000).toFixed(4);
|
||||
} else {
|
||||
firstCoefficientVO.bVuXi = newValue.data.bVuXi;
|
||||
}
|
||||
|
||||
firstCoefficientVO.cVuData = parseFloat(newValue.data.cVuData).toFixed(4);
|
||||
|
||||
if (!isNaN(parseFloat(newValue.data.cVuXi)) && isFinite(newValue.data.cVuXi)) {
|
||||
firstCoefficientVO.cVuXi = (parseFloat(newValue.data.cVuXi) / 10000).toFixed(4);
|
||||
} else {
|
||||
firstCoefficientVO.cVuXi = newValue.data.cVuXi;
|
||||
}
|
||||
|
||||
firstCoefficientVO.aIeData = parseFloat(newValue.data.aIeData).toFixed(4);
|
||||
|
||||
if (!isNaN(parseFloat(newValue.data.aIeXi)) && isFinite(newValue.data.aIeXi)) {
|
||||
firstCoefficientVO.aIeXi = (parseFloat(newValue.data.aIeXi) / 10000).toFixed(4);
|
||||
} else {
|
||||
firstCoefficientVO.aIeXi = newValue.data.aIeXi;
|
||||
}
|
||||
|
||||
firstCoefficientVO.bIeData = parseFloat(newValue.data.bIeData).toFixed(4);
|
||||
|
||||
if (!isNaN(parseFloat(newValue.data.bIeXi)) && isFinite(newValue.data.bIeXi)) {
|
||||
firstCoefficientVO.bIeXi = (parseFloat(newValue.data.bIeXi) / 10000).toFixed(4);
|
||||
} else {
|
||||
firstCoefficientVO.bIeXi = newValue.data.bIeXi;
|
||||
}
|
||||
|
||||
firstCoefficientVO.cIeData = parseFloat(newValue.data.cIeData).toFixed(4);
|
||||
|
||||
if (!isNaN(parseFloat(newValue.data.cIeXi)) && isFinite(newValue.data.cIeXi)) {
|
||||
firstCoefficientVO.cIeXi = (parseFloat(newValue.data.cIeXi) / 10000).toFixed(4);
|
||||
} else {
|
||||
firstCoefficientVO.cIeXi = newValue.data.cIeXi;
|
||||
}
|
||||
|
||||
firstCoefficientVO.aV = newValue.data.aV;
|
||||
firstCoefficientVO.bV = newValue.data.bV;
|
||||
firstCoefficientVO.cV = newValue.data.cV;
|
||||
firstCoefficientVO.aI = newValue.data.aI;
|
||||
firstCoefficientVO.bI = newValue.data.bI;
|
||||
firstCoefficientVO.cI = newValue.data.cI;
|
||||
console.log(newValue.data.devName + '对象:', firstCoefficientVO);
|
||||
activeIndex.value++;
|
||||
} else {
|
||||
console.log('未找到匹配的' + newValue.data.devName + '对象');
|
||||
}
|
||||
} else {
|
||||
console.log(newValue.data.devName + '数组为空');
|
||||
}
|
||||
} else {
|
||||
console.log('未找到' + newValue.data.devName + '对应的数组');
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'socket_timeout':
|
||||
switch (newValue.operateCode) {
|
||||
case 'VOLTAGE':
|
||||
ElMessageBox.alert('连接超时!', '连接超时', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'connect':
|
||||
switch (newValue.operateCode) {
|
||||
case "Source":
|
||||
ElMessageBox.alert('源服务端连接失败', '源服务端连接失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
break;
|
||||
case "Dev":
|
||||
ElMessageBox.alert('设备服务端连接失败', '设备服务端连接失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TableInit();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
//出错系数检测初始化
|
||||
const TableInit = () => {
|
||||
console.log("出错系数检测",active.value);
|
||||
emit('update:testStatus', 'test_init_fail')
|
||||
// isButtonDisabled.value = false; // 恢复按钮
|
||||
// for (let i = 0; i < channel.value.length; i++) {
|
||||
// const currentTableData = initializeTableData(dataTemplates, i);
|
||||
// tableDataMap.set(i, currentTableData)
|
||||
// }
|
||||
// activeIndex.value = 0
|
||||
// qualified.value = 0
|
||||
// active.value = 0
|
||||
|
||||
}
|
||||
|
||||
//按行图标转动
|
||||
const tableLoading = (type: string, desc: string) => {
|
||||
console.log('转动',channel.value)
|
||||
for (let i = 0; i < channel.value.length; i++) {
|
||||
|
||||
const targetArrayRef = tableDataMap.get(i);
|
||||
if (targetArrayRef) {
|
||||
const targetArray = targetArrayRef.value;
|
||||
if (targetArray.length > 0) {
|
||||
for (let j = 0; j < channel.value[i]; j++) {
|
||||
const firstCoefficientVO = targetArray.find(item => item.monitorNum === (j + 1).toString() &&
|
||||
item.type === type &&
|
||||
item.desc === desc);
|
||||
if (firstCoefficientVO) {
|
||||
firstCoefficientVO.loading = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
console.log('不转了')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const dataTemplates: ChannelsTest.CoefficientVO[] = [
|
||||
{
|
||||
monitorNum: '1',
|
||||
desc: '系数下装',
|
||||
type: 'big',
|
||||
aVuData: '—',
|
||||
aVuXi: '—',
|
||||
bVuData: '—',
|
||||
bVuXi: '—',
|
||||
cVuData: '—',
|
||||
cVuXi: '—',
|
||||
aIeData: '—',
|
||||
aIeXi: '—',
|
||||
bIeData: '—',
|
||||
bIeXi: '—',
|
||||
cIeData: '—',
|
||||
cIeXi: '—',
|
||||
loading: false,
|
||||
devName: '',
|
||||
aV: '—',
|
||||
bV: '—',
|
||||
cV: '—',
|
||||
aI: '—',
|
||||
bI: '—',
|
||||
cI: '—',
|
||||
},
|
||||
{
|
||||
monitorNum: '2',
|
||||
desc: '系数下装',
|
||||
type: 'small',
|
||||
aVuData: '—',
|
||||
aVuXi: '—',
|
||||
bVuData: '—',
|
||||
bVuXi: '—',
|
||||
cVuData: '—',
|
||||
cVuXi: '—',
|
||||
aIeData: '—',
|
||||
aIeXi: '—',
|
||||
bIeData: '—',
|
||||
bIeXi: '—',
|
||||
cIeData: '—',
|
||||
cIeXi: '—',
|
||||
loading: false,
|
||||
devName: '',
|
||||
aV: '—',
|
||||
bV: '—',
|
||||
cV: '—',
|
||||
aI: '—',
|
||||
bI: '—',
|
||||
cI: '—',
|
||||
},
|
||||
{
|
||||
monitorNum: '3',
|
||||
desc: '系数校准',
|
||||
type: 'big',
|
||||
aVuData: '—',
|
||||
aVuXi: '—',
|
||||
bVuData: '—',
|
||||
bVuXi: '—',
|
||||
cVuData: '—',
|
||||
cVuXi: '—',
|
||||
aIeData: '—',
|
||||
aIeXi: '—',
|
||||
bIeData: '—',
|
||||
bIeXi: '—',
|
||||
cIeData: '—',
|
||||
cIeXi: '—',
|
||||
loading: false,
|
||||
devName: '',
|
||||
aV: '—',
|
||||
bV: '—',
|
||||
cV: '—',
|
||||
aI: '—',
|
||||
bI: '—',
|
||||
cI: '—',
|
||||
},
|
||||
{
|
||||
monitorNum: '4',
|
||||
desc: '系数校准',
|
||||
type: 'small',
|
||||
aVuData: '—',
|
||||
aVuXi: '—',
|
||||
bVuData: '—',
|
||||
bVuXi: '—',
|
||||
cVuData: '—',
|
||||
cVuXi: '—',
|
||||
aIeData: '—',
|
||||
aIeXi: '—',
|
||||
bIeData: '—',
|
||||
bIeXi: '—',
|
||||
cIeData: '—',
|
||||
cIeXi: '—',
|
||||
loading: false,
|
||||
devName: '',
|
||||
aV: '—',
|
||||
bV: '—',
|
||||
cV: '—',
|
||||
aI: '—',
|
||||
bI: '—',
|
||||
cI: '—',
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
|
||||
// 更新错误状态的方法
|
||||
const updateErrorState = (index: number, hasError: boolean) => {
|
||||
errorStates.value[index] = hasError;
|
||||
};
|
||||
|
||||
|
||||
// const emit = defineEmits<{
|
||||
|
||||
// (e: 'submitClicked', callback: (resolve: (value: boolean) => void) => void): void;
|
||||
// }>();
|
||||
|
||||
const emit = defineEmits(['update:testStatus']);
|
||||
|
||||
const getTableDataForChannel = (index: number): any[] => {
|
||||
const data = tableDataMap.get(index);
|
||||
return data ? data.value : [];
|
||||
}
|
||||
|
||||
|
||||
watch(activeIndex, function (newValue, oldValue) {
|
||||
if (activeIndex.value === 1) {
|
||||
outputDsc.value = "电压误差为:±0.1Un%; 电流误差为:±0.5%";
|
||||
// 当前源输出为:Ua=Ub=Uc=57.74V Ia=Ib=Ic=1A"
|
||||
}
|
||||
})
|
||||
|
||||
// 示例的 checkForErrors 函数,根据实际需求进行调整
|
||||
const checkForErrors = (data: ChannelsTest.CoefficientVO[]): boolean => {
|
||||
// 这里假设不合格字段的标准是 status 为 '不合格' 或 isValid 为 false
|
||||
return data.some(item =>
|
||||
item.aVuXi === '不合格' ||
|
||||
item.bVuXi === '不合格' ||
|
||||
item.cVuXi === '不合格' ||
|
||||
item.aIeXi === '不合格' ||
|
||||
item.bIeXi === '不合格' ||
|
||||
item.cIeXi === '不合格'
|
||||
);
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
// 创建一个 Promise 来等待父组件的回调
|
||||
// const response = await new Promise<boolean>((resolve) => {
|
||||
// emit('submitClicked', resolve);
|
||||
// });
|
||||
|
||||
// if (!response) {
|
||||
// return;
|
||||
// }()
|
||||
|
||||
isButtonDisabled.value = true; // 禁用按钮
|
||||
tableLoading('big', '系数下装')
|
||||
/* await getCoefficientCheck({
|
||||
userPageId: "cdf",
|
||||
devIds: devIdArray.value,
|
||||
planId: planId.value,
|
||||
errorSysId: select_Plan.value?.errorSysId,
|
||||
scriptId: select_Plan.value?.scriptId,
|
||||
operateType: '0', // '0'为预检测、‘1‘为正式检测
|
||||
userId:userStore.userInfo.id
|
||||
})*/
|
||||
active.value++;
|
||||
|
||||
console.log('开始检测active.value', active.value)
|
||||
};
|
||||
|
||||
// 提取初始化并填充 currentTableData 的函数
|
||||
const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: number): Ref<ChannelsTest.CoefficientVO[]> => {
|
||||
const currentTableData = ref<ChannelsTest.CoefficientVO[]>([]);
|
||||
for (let j = 0; j < channel.value[index]; j++) {
|
||||
templates.forEach((template) => {
|
||||
// 使用解构赋值排除 id 和 MonitorIdx 属性
|
||||
const {devName, monitorNum: __, ...rest} = template;
|
||||
currentTableData.value.push({
|
||||
monitorNum: (j + 1).toString(),
|
||||
devName: name.value[index],
|
||||
...rest,
|
||||
});
|
||||
});
|
||||
}
|
||||
return currentTableData;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 确保 el-icon-loading 的动画效果没有被覆盖 */
|
||||
.loading-box {
|
||||
animation: rotate 2s linear infinite;
|
||||
font-size: 30px; /* 增大图标的大小 */
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.right-title {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
/* 横向排列 */
|
||||
justify-content: space-between;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.custom-tabs-label .el-icon {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.custom-tabs-label span {
|
||||
vertical-align: middle;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.dialog-content {
|
||||
height: 510px;
|
||||
}
|
||||
|
||||
.el-tabs--border-card {
|
||||
height: 470px;
|
||||
}
|
||||
|
||||
/* .el-icon svg {
|
||||
color: #ff7171;
|
||||
} */
|
||||
|
||||
.icon-style {
|
||||
color: #ff7171;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.dialog-left {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.right-content {
|
||||
flex: 6;
|
||||
}
|
||||
|
||||
.spanStyle {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -4,8 +4,7 @@
|
||||
<el-tab-pane label="预检测项目">
|
||||
<div class="form-grid">
|
||||
<el-checkbox v-for="(item, index) in detectionOptions" v-model="item.selected" :key="index"
|
||||
:label="item.name"></el-checkbox>
|
||||
<!-- disabled="true" -->
|
||||
:label="item.name" disabled></el-checkbox>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -18,7 +17,7 @@
|
||||
<el-step :status="step2" title="设备通讯校验"/>
|
||||
<el-step :status="step3" title="协议校验"/>
|
||||
<el-step :status="step4" title="相序校验"/>
|
||||
<el-step :status="step5" title="检测完成"/>
|
||||
<el-step :status="step5" :title="ts === 'error'? '检测失败':ts === 'process'? '检测中':ts === 'success'? '检测成功':'待检测'"/>
|
||||
</el-steps>
|
||||
</div>
|
||||
<div class="dialog-right">
|
||||
@@ -69,7 +68,7 @@
|
||||
</template>
|
||||
<script lang="tsx" setup name="preTest">
|
||||
import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import {defineExpose} from 'vue';
|
||||
import {defineExpose, ref, toRef, watch} from 'vue';
|
||||
|
||||
const step1InitLog = ref([
|
||||
{
|
||||
@@ -234,316 +233,380 @@ const webMsgSend = toRef(props, 'webMsgSend');
|
||||
const ts = ref('');
|
||||
|
||||
watch(webMsgSend, function (newValue, oldValue) {
|
||||
// console.log(newValue)
|
||||
|
||||
switch (newValue.requestId) {
|
||||
case 'yjc_ytxjy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER':
|
||||
if (newValue.code == 10200) {
|
||||
step1InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '源初始化成功!',
|
||||
})
|
||||
activeIndex.value = 1
|
||||
step1.value = 'success'
|
||||
step2.value = 'process'
|
||||
} else if (newValue.code == 10201) {
|
||||
step1.value = 'process'
|
||||
step1InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行源初始化!',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error(newValue.code)
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 10523) {
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
step1InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '源连接失败!',
|
||||
}];
|
||||
} else if (newValue.code == -1) {
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
step1InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '源未知异常!',
|
||||
}];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case 'yjc_sbtxjy':
|
||||
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$01':
|
||||
if (newValue.code == 10200) {
|
||||
step2InitLog.value.push({
|
||||
type: 'info',
|
||||
log: newValue.data + '设备通讯校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step2.value = 'process'
|
||||
step2InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行设备通讯校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10550) {
|
||||
step2InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step2.value = 'error'
|
||||
// ts.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step2InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step2.value = 'error'
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step2InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
step2.value = 'error'
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 25001) {
|
||||
activeIndex.value = 2
|
||||
step2.value = 'success'
|
||||
step3.value = 'process'
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'yjc_xyjy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$01':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '统计数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3.value = 'process'
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行通讯协议校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10550) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
// ts.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
step3.value = 'error'
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
}
|
||||
break;
|
||||
case 'INIT_GATHER$02':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '实时数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3.value = 'process'
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行通讯协议校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10550) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
// ts.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
step3.value = 'error'
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
}
|
||||
break;
|
||||
case 'INIT_GATHER$03':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '暂态数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3.value = 'process'
|
||||
} else if (newValue.code == 10550) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
// ts.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
//ElMessage.error("当前步骤已经初始化,执行自动关闭,请重新发起检测!")
|
||||
step3.value = 'error'
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 25001) {
|
||||
activeIndex.value = 3
|
||||
step3.value = 'success'
|
||||
step4.value = 'process'
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'YJC_xujy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'OPER_GATHER':
|
||||
if (newValue.code == 10200) {
|
||||
step4InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '源参数下发成功,等待校验中.....',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step4.value = 'process'
|
||||
step4InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '源参数下发中.....',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step4.value = 'error'
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 10520) {
|
||||
step4.value = 'error'
|
||||
step4InitLog.value.push({
|
||||
type: 'error',
|
||||
log: '解析报文异常',
|
||||
})
|
||||
ts.value = 'error'
|
||||
}
|
||||
break;
|
||||
|
||||
case 'DATA_REQUEST$02':
|
||||
if (newValue.code == 10200) {
|
||||
let type = 'info'
|
||||
if (newValue.data.includes('不合格')) {
|
||||
type = 'error'
|
||||
if (testStatus.value !== 'waiting') {
|
||||
switch (newValue.requestId) {
|
||||
case 'yjc_ytxjy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER':
|
||||
if (newValue.code == 10200) {
|
||||
step1InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '源初始化成功!',
|
||||
})
|
||||
activeIndex.value = 1
|
||||
step1.value = 'success'
|
||||
step2.value = 'process'
|
||||
} else if (newValue.code == 10201) {
|
||||
step1.value = 'process'
|
||||
step1InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行源初始化!',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error(newValue.code)
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10523) {
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
step1InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '源连接失败!',
|
||||
}];
|
||||
} else if (newValue.code == -1) {
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
step1InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '源未知异常!',
|
||||
}];
|
||||
}
|
||||
break;
|
||||
|
||||
newValue.data.split('<br/>')
|
||||
step4InitLog.value.push({
|
||||
type: type,
|
||||
log:newValue.data,
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step4.value = 'process'
|
||||
step4InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '获取数据相序校验数据!',
|
||||
}];
|
||||
} else if (newValue.code == 25003) {
|
||||
step4.value = 'error'
|
||||
step4InitLog.value.push({
|
||||
}
|
||||
break;
|
||||
case 'yjc_sbtxjy':
|
||||
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$01':
|
||||
if (newValue.code == 10200) {
|
||||
step2InitLog.value.push({
|
||||
type: 'info',
|
||||
log: newValue.data + '设备通讯校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step2.value = 'process'
|
||||
step2InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行设备通讯校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10550) {
|
||||
step2InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step2.value = 'error'
|
||||
// ts.value = 'error'
|
||||
// step5.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step2InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step2.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step2InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
step2.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 25001) {
|
||||
activeIndex.value = 2
|
||||
step2.value = 'success'
|
||||
step3.value = 'process'
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'yjc_xyjy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$01':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '统计数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3.value = 'process'
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行通讯协议校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10550) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
// ts.value = 'error'
|
||||
// step5.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
step3.value = 'error'
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
}
|
||||
break;
|
||||
case 'INIT_GATHER$02':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '实时数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3.value = 'process'
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行通讯协议校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10550) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
// ts.value = 'error'
|
||||
// step5.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
step3.value = 'error'
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
}
|
||||
break;
|
||||
case 'INIT_GATHER$03':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '暂态数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3.value = 'process'
|
||||
} else if (newValue.code == 10550) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备连接异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
// ts.value = 'error'
|
||||
// step5.value = 'error'
|
||||
} else if (newValue.code == 10551) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: newValue.data + '设备触发报告异常!',
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10552) {
|
||||
//ElMessage.error("当前步骤已经初始化,执行自动关闭,请重新发起检测!")
|
||||
step3.value = 'error'
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
}
|
||||
break;
|
||||
case 'VERIFY_MAPPING$01':
|
||||
if (newValue.code == 25001) {
|
||||
activeIndex.value = 3
|
||||
step3.value = 'success'
|
||||
step4.value = 'process'
|
||||
} else if (newValue.code == 10200) {
|
||||
let data = JSON.parse(newValue.data)
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: `脚本与icd检验失败! icd名称:${data['icdType']} -> 校验项:${data['dataType']}`,
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10500) {
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: `装置中未找到该icd!`,
|
||||
})
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'YJC_xujy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'OPER_GATHER':
|
||||
if (newValue.code == 10200) {
|
||||
step4InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '源参数下发成功,等待校验中.....',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step4.value = 'process'
|
||||
step4InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '源参数下发中.....',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step4.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 10520) {
|
||||
step4.value = 'error'
|
||||
step4InitLog.value.push({
|
||||
type: 'error',
|
||||
log: '解析报文异常',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
}
|
||||
break;
|
||||
|
||||
case 'DATA_REQUEST$02':
|
||||
if (newValue.code == 10200) {
|
||||
let type = 'info'
|
||||
if (newValue.data.includes('不合格')) {
|
||||
type = 'error'
|
||||
}
|
||||
|
||||
newValue.data.split('<br/>')
|
||||
step4InitLog.value.push({
|
||||
type: type,
|
||||
log: newValue.data,
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step4.value = 'process'
|
||||
step4InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '获取数据相序校验数据!',
|
||||
}];
|
||||
} else if (newValue.code == 25003) {
|
||||
step4.value = 'error'
|
||||
step4InitLog.value.push({
|
||||
type: 'error',
|
||||
log: '相序校验未通过!',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
} else if (newValue.code == 25001) {
|
||||
step4.value = 'success'
|
||||
step5.value = 'success'
|
||||
step4InitLog.value.push({
|
||||
type: 'wait',
|
||||
log: '相序校验成功!',
|
||||
})
|
||||
ts.value = 'success'
|
||||
}
|
||||
activeIndex.value = 5
|
||||
console.log("@@@@", ts.value)
|
||||
break
|
||||
}
|
||||
|
||||
break;
|
||||
case 'quit':
|
||||
break;
|
||||
case 'connect':
|
||||
switch (newValue.operateCode) {
|
||||
case "Source":
|
||||
step1.value = 'error'
|
||||
step1InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '相序校验未通过!',
|
||||
})
|
||||
log: '源服务端连接失败!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 25001) {
|
||||
step4.value = 'success'
|
||||
step5.value = 'success'
|
||||
step4InitLog.value.push({
|
||||
type: 'wait',
|
||||
log: '相序校验成功!',
|
||||
})
|
||||
}
|
||||
activeIndex.value = 5
|
||||
ts.value = 'success'
|
||||
break
|
||||
}
|
||||
step5.value = 'error'
|
||||
break;
|
||||
case "Dev":
|
||||
step2.value = 'error'
|
||||
step2InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '设备服务端连接失败!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'unknown_operate':
|
||||
|
||||
break;
|
||||
case 'quit':
|
||||
break;
|
||||
case 'connect':
|
||||
switch (newValue.operateCode) {
|
||||
case "Source":
|
||||
step1.value = 'error'
|
||||
step1InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '源服务端连接失败!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
break;
|
||||
case "Dev":
|
||||
step2.value = 'error'
|
||||
step2InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '设备服务端连接失败!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'unknown_operate':
|
||||
|
||||
break;
|
||||
case 'error_flow_end':
|
||||
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
ts.value = 'error'
|
||||
break;
|
||||
break;
|
||||
case 'error_flow_end':
|
||||
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
break;
|
||||
case 'socket_timeout':
|
||||
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
break;
|
||||
case 'server_error':
|
||||
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
break;
|
||||
case 'device_error':
|
||||
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
watch(activeIndex, function (newValue, oldValue) {
|
||||
@@ -556,7 +619,6 @@ watch(activeIndex, function (newValue, oldValue) {
|
||||
|
||||
//监听goods_sn的变化
|
||||
watch(testStatus, function (newValue, oldValue) {
|
||||
|
||||
ts.value = props.testStatus;
|
||||
if (ts.value === 'start') {
|
||||
ts.value = 'process'
|
||||
|
||||
134
frontend/src/views/home/components/realTimeDataAlign.vue
Normal file
134
frontend/src/views/home/components/realTimeDataAlign.vue
Normal file
@@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<el-dialog title="实时数据详情" v-model='dialogVisible' @close="handleClose" v-bind="dialogBig" >
|
||||
<el-tabs v-model="activeTab" type="card">
|
||||
<el-tab-pane label="被检设备1" name="channel1">
|
||||
<div class="table-toolbar">
|
||||
<el-form-item label="被检设备通道号" prop="createId">
|
||||
<el-select v-model="timeRange" placeholder="选择时间范围" style="width: 150px;">
|
||||
<el-option label="通道1" value="1"></el-option>
|
||||
<el-option label="通道2" value="2"></el-option>
|
||||
<el-option label="通道3" value="3"></el-option>
|
||||
<el-option label="通道4" value="4"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-button type="primary" @click="exportData">导出数据</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:header-cell-style="{ textAlign: 'center',backgroundColor: 'var(--el-color-primary)',color: '#fff' } "
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
style="width: 100%"
|
||||
:style="{ height: '400px',maxHeight: '400px',overflow:'hidden'}">
|
||||
<el-table-column prop="monitorNum" label="数据时标" width="180"/>
|
||||
<el-table-column label="被检设备1-通道1">
|
||||
<el-table-column prop="Ua" label="A相(V)">
|
||||
</el-table-column>
|
||||
<el-table-column prop="Ub" label="B相(V)">
|
||||
</el-table-column>
|
||||
<el-table-column prop="Uc" label="C相(V)">
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="标准设备-通道1">
|
||||
<el-table-column prop="Ua" label="A相(V)">
|
||||
</el-table-column>
|
||||
<el-table-column prop="Ub" label="B相(V)">
|
||||
</el-table-column>
|
||||
<el-table-column prop="Uc" label="C相(V)">
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="被检设备2" name="channel2"></el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='realTimeDataAlign'>
|
||||
import { dialogBig } from "@/utils/elementBind";
|
||||
import { ref, reactive } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const dialogVisible = ref(false);
|
||||
const activeTab = ref('channel1');
|
||||
const timeRange = ref('1');
|
||||
|
||||
|
||||
// 表格数据示例
|
||||
const tableData = ref([
|
||||
{
|
||||
monitorNum: '2023-05-20 10:30:01',
|
||||
Ua: '220.5V',
|
||||
Ub: '219.8V',
|
||||
Uc: '220.2V',
|
||||
Ia: '4.98A',
|
||||
Ib: '5.01A',
|
||||
Ic: '4.99A'
|
||||
},
|
||||
{
|
||||
monitorNum: '2023-05-20 10:30:04',
|
||||
Ua: '220.3V',
|
||||
Ub: '220.1V',
|
||||
Uc: '219.9V',
|
||||
Ia: '5.02A',
|
||||
Ib: '4.99A',
|
||||
Ic: '5.00A'
|
||||
},
|
||||
{
|
||||
monitorNum: '2023-05-20 10:30:07',
|
||||
Ua: '220.5V',
|
||||
Ub: '219.8V',
|
||||
Uc: '220.2V',
|
||||
Ia: '4.98A',
|
||||
Ib: '5.01A',
|
||||
Ic: '4.99A'
|
||||
},
|
||||
{
|
||||
monitorNum: '2023-05-20 10:30:10',
|
||||
Ua: '220.3V',
|
||||
Ub: '220.1V',
|
||||
Uc: '219.9V',
|
||||
Ia: '5.02A',
|
||||
Ib: '4.99A',
|
||||
Ic: '5.00A'
|
||||
}
|
||||
]);
|
||||
|
||||
const open = async () => {
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
|
||||
// 刷新数据
|
||||
const refreshData = () => {
|
||||
ElMessage.info('正在刷新数据...');
|
||||
// 这里可以添加实际的数据刷新逻辑
|
||||
};
|
||||
|
||||
// 导出数据
|
||||
const exportData = () => {
|
||||
ElMessage.success('数据导出成功');
|
||||
// 这里可以添加实际的数据导出逻辑
|
||||
};
|
||||
|
||||
// 关闭弹窗
|
||||
const handleClose = () => {
|
||||
dialogVisible.value = false;
|
||||
};
|
||||
|
||||
defineExpose({ open });
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.table-toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between; // 关键修改:将子元素分布到两端
|
||||
}
|
||||
|
||||
// 移除这个样式,避免影响布局
|
||||
// .table-toolbar .el-button {
|
||||
// margin-right: 10px;
|
||||
// }
|
||||
|
||||
:deep(.el-dialog__body) {
|
||||
padding: 10px 20px 20px 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="tabs-title ">
|
||||
<el-button type="primary" :icon="Download" >报告下载</el-button>
|
||||
<span style=" font-size: 18px;font-weight: 600;">
|
||||
已生成 <span style="color: #67C23A">2</span> 台/共 <span style="color: green">3</span> 台
|
||||
已生成 <span style="color: #91cc75">2</span> 台/共 <span style="color: green">3</span> 台
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
124
frontend/src/views/home/components/selectTestItemPopup.vue
Normal file
124
frontend/src/views/home/components/selectTestItemPopup.vue
Normal file
@@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<el-dialog title="选择测试内容" v-model='dialogVisible' @close="handleClose" v-bind="dialogSmall" >
|
||||
<div>
|
||||
<el-form ref="dialogFormRef" :model="formContent" class="form-three">
|
||||
<el-form-item prop="preTest" :label-width="100">
|
||||
<el-checkbox v-model="formContent.preTest" label="预检测"/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="checkStore.plan.timeCheck===1" prop="timeTest" :label-width="100">
|
||||
<el-checkbox v-model="formContent.timeTest" label="守时检测"/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="channelsTestShow" prop="channelsTest" :label-width="100">
|
||||
<el-checkbox v-model="formContent.channelsTest" label="系数校准"/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="test" :label-width="100">
|
||||
<el-checkbox v-model="formContent.test" label="正式检测"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleStart">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='selectTestItemPopup'>
|
||||
import {dialogSmall} from "@/utils/elementBind";
|
||||
import {reactive, ref} from "vue";
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import type {CheckData} from "@/api/check/interface";
|
||||
import {ElMessageBox} from "element-plus";
|
||||
import {useAppSceneStore,useModeStore} from "@/stores/modules/mode";
|
||||
const AppSceneStore = useAppSceneStore()
|
||||
const emit = defineEmits(['openTestDialog'])
|
||||
const checkStore = useCheckStore();
|
||||
const modeStore = useModeStore()
|
||||
const dialogFormRef = ref()
|
||||
const channelsTestShow = ref(false)
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const formContent = reactive<CheckData.SelectTestItem>({preTest: true, timeTest: false, channelsTest: false, test: false})
|
||||
const sourceIdArray = ref<string[]>()
|
||||
const open = async (sourcesIds: string[]) => {
|
||||
|
||||
sourceIdArray.value = sourcesIds
|
||||
resetFormContent()
|
||||
checkStore.setSelectTestItems(formContent)
|
||||
dialogVisible.value = true
|
||||
if(modeStore.currentMode === '比对式'){
|
||||
channelsTestShow.value = false
|
||||
}else{
|
||||
if(AppSceneStore.currentScene === '1'){
|
||||
channelsTestShow.value = true
|
||||
}else{
|
||||
channelsTestShow.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 清空表单内容
|
||||
const resetFormContent = () => {
|
||||
let hasResult = checkStore.devices.some((device) => device.checkResult === 0)
|
||||
Object.assign(formContent, {preTest: !hasResult, channelsTest: false, timeTest: false, test: hasResult})
|
||||
}
|
||||
|
||||
const handleStart = () => {
|
||||
let count = 0
|
||||
for (let key in formContent) {
|
||||
if (formContent[key]) {
|
||||
count++
|
||||
}
|
||||
}
|
||||
if (count === 0) {
|
||||
ElMessage.warning('请选择测试内容!')
|
||||
} else {
|
||||
if(formContent.channelsTest){
|
||||
const factorFlagArray = ref<string[]>([]) // 初始化为空数组
|
||||
for (let i = 0; i < checkStore.devices.length; i++) {
|
||||
const factorFlag = checkStore.devices[i].factorFlag
|
||||
if (factorFlag !== undefined && factorFlag !== null && factorFlag === 0) {
|
||||
factorFlagArray.value.push(checkStore.devices[i].deviceName.toString())
|
||||
}
|
||||
}
|
||||
if (factorFlagArray.value.length > 0) {
|
||||
const factorFlags = factorFlagArray.value.join(', ')
|
||||
ElMessageBox.confirm(
|
||||
factorFlags + '设备不支持系数校准,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
checkStore.setCheckType(0)
|
||||
checkStore.setSelectTestItems({...formContent})
|
||||
handleClose()
|
||||
|
||||
emit('openTestDialog',checkStore.selectTestItems.test)
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const handleClose = () => {
|
||||
dialogVisible.value = false
|
||||
// 清空dialogForm中的值
|
||||
resetFormContent()
|
||||
dialogFormRef.value?.resetFields()
|
||||
}
|
||||
|
||||
defineExpose({open})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:row-class-name="tableRowClassName" row-key="id" height="300px" :header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%" border v-on:cell-click="handleClick"
|
||||
:row-class-name="tableRowClassName" row-key="id" height="300px" :header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' } " style="width: 100%" border v-on:cell-click="handleClick"
|
||||
>
|
||||
<el-table-column prop="date" label="Date" width="180" />
|
||||
<el-table-column prop="name" label="Name" width="180" />
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,58 +1,66 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" :model-value="dialogVisible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px"
|
||||
draggable>
|
||||
<el-dialog :title="dialogTitle" width="1550px" :model-value="dialogVisible" :before-close="beforeClose" @close="handleClose" height="1000px" draggable>
|
||||
|
||||
<div class="steps-container">
|
||||
<!-- simple -->
|
||||
<!-- :style="{color:node.label=='未检'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" -->
|
||||
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
|
||||
<!-- style="height:100px" -->
|
||||
<!-- <el-step title="预检测" :icon="getIcon(0)" /> -->
|
||||
<el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit"/>
|
||||
<el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled" v-if="isTimeCheck"/>
|
||||
<!-- <el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" /> -->
|
||||
<el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin"/>
|
||||
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key"/>
|
||||
<el-steps v-if="showSteps" class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
|
||||
<el-step v-if="preTestSelected" title="预检测" :icon="stepsActive > 1 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Edit" @click="handleStepClick(1)"/>
|
||||
<el-step v-if="timeTestSelected" title="守时检测" :icon="stepsActive > 2 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :UploadFilled"
|
||||
@click="handleStepClick(2)"/>
|
||||
<el-step v-if="channelsTestSelected" title="系数校准" :icon="stepsActive > 3 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Odometer"
|
||||
@click="handleStepClick(3)"/>
|
||||
<el-step v-if="testSelected" title="正式检测" :icon="stepsActive > 4 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Coin" @click="handleStepClick(4)"/>
|
||||
<el-step title="检测完成" :icon="stepsActiveIndex > stepsTotalNum-1 ? SuccessFilled :Key"/>
|
||||
</el-steps>
|
||||
</div>
|
||||
<preTest ref="preTestRef" v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest>
|
||||
<timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
|
||||
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
|
||||
<test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"
|
||||
@sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck"></test>
|
||||
|
||||
<preTest v-if="showComponent&&preTestSelected" v-show="preTestSelected && stepsActiveView==1" ref="preTestRef" v-model:testStatus="preTestStatus"
|
||||
:webMsgSend="webMsgSend"/>
|
||||
<timeTest v-if="showComponent&&timeTestSelected" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/>
|
||||
<!-- <channelsTest v-if="stepsActiveIndex === 3" v-model:testStatus="channelsTestStatus"></channelsTest>-->
|
||||
<factorTest v-if="showComponent&&channelsTestSelected" v-show="channelsTestSelected && stepsActiveView==3" v-model:testStatus="channelsTestStatus"
|
||||
:webMsgSend="webMsgSend"/>
|
||||
<test v-if="showComponent&&testSelected" ref="testRef" v-show="testSelected && stepsActiveView==4" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend"
|
||||
@update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck" @closeWebSocket="closeWebSocket"
|
||||
:stepsActive="stepsActive"/>
|
||||
|
||||
<template #footer>
|
||||
<div>
|
||||
<!-- <el-button @click="handleCancel">取 消</el-button> -->
|
||||
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled"
|
||||
@click="nextStep">跳过
|
||||
</el-button>
|
||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit" :disabled="btnState">开始检测</el-button>
|
||||
<el-button type="primary" v-if="TestStatus === 'process'" @click="handleSubmit" disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
检测中
|
||||
</el-button>
|
||||
<el-button type="warning" :icon="VideoPlay" v-if="TestStatus === 'paused'" @click="handleSubmit">继续检测</el-button>
|
||||
<el-button type="primary" :icon="RefreshLeft" v-if="TestStatus === 'test_recheck'" @click="handleSubmit">重新检测</el-button>
|
||||
<!-- <el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < stepsTotalNum && ActiveStatue != 'success'" @click="nextStep">跳过</el-button>-->
|
||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmitFast">开始检测</el-button>
|
||||
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
初始化中
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="TestStatus=='process'"
|
||||
:icon="VideoPause"
|
||||
@click="handlePause()">停止检测
|
||||
</el-button>
|
||||
<el-button type="warning" v-if="TestStatus === 'paused_ing'" disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
暂停中
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
v-if="(TestStatus =='paused')"
|
||||
:icon="VideoPlay"
|
||||
@click="sendResume"
|
||||
>继续检测
|
||||
</el-button>
|
||||
|
||||
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
||||
v-if="ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout'"
|
||||
v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
|
||||
@click="nextStep">
|
||||
{{ nextStepText }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="handleQuit" v-else>
|
||||
退出检测
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -61,108 +69,28 @@
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup name="testPopup">
|
||||
import {h, reactive, ref, watch} from 'vue';
|
||||
import {reactive, ref, watch} from 'vue';
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
||||
import {
|
||||
Close,
|
||||
Coin,
|
||||
DArrowRight,
|
||||
Edit,
|
||||
Key,
|
||||
Odometer,
|
||||
Refresh,
|
||||
Right,
|
||||
SuccessFilled,
|
||||
UploadFilled,
|
||||
VideoPlay,
|
||||
RefreshLeft, Loading
|
||||
} from '@element-plus/icons-vue'
|
||||
import {Coin, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPause, VideoPlay} from '@element-plus/icons-vue'
|
||||
import preTest from './preTest.vue'
|
||||
import timeTest from './timeTest.vue'
|
||||
import {Device} from '@/api/device/interface/device';
|
||||
import factorTest from './factorTest.vue'
|
||||
import test from './test.vue'
|
||||
import socketClient from '@/utils/webSocketClient';
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {startPreTest, pauseTest, resumeTest} from '@/api/socket/socket'
|
||||
import {showFullScreenLoading} from "@/components/Loading/fullScreen";
|
||||
import {pauseTest, resumeTest, startPreTest} from '@/api/socket/socket'
|
||||
import {useUserStore} from "@/stores/modules/user";
|
||||
|
||||
|
||||
//import SvgIcon from '@/components/SvgIcon.vue';
|
||||
|
||||
// import preTestIcon from '@/assets/icons/preTest.svg'
|
||||
|
||||
// const preTestIcon = `
|
||||
// <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
|
||||
// </svg>
|
||||
// `;
|
||||
// const props = defineProps<{
|
||||
// visible: boolean;
|
||||
// dialogTitle: string;
|
||||
|
||||
// formData: {
|
||||
// id: string;//误差体系表Id
|
||||
// name: string;//误差体系名称
|
||||
// standard_Name:string;//参照标准名称
|
||||
// standard_Time:string;//标准推行时间
|
||||
// dev_Level:string;//使用设备等级
|
||||
// enable:number;//状态:0-不启用 1-启用
|
||||
// state:number;//0-删除 1-正常
|
||||
// };
|
||||
// }>();
|
||||
|
||||
// const emit = defineEmits<{
|
||||
// (e: 'update:visible', value: boolean): void;
|
||||
// (e: 'submit', data: any): void;
|
||||
// }>();
|
||||
const btnState = ref(false)
|
||||
const userStore = useUserStore()
|
||||
const checkStore = useCheckStore();
|
||||
const skipDisabled = ref(false);
|
||||
const nextStepText = ref('下一步');
|
||||
const dialogVisible = ref(false)
|
||||
//定义与预检测配置数组
|
||||
const detectionOptions = ref([
|
||||
{
|
||||
id: 0,
|
||||
name: "源通讯检测",//判断源通讯是否正常
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: "设备通讯检测",//判断设备的IP、Port、识别码、秘钥是否正常
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "协议校验",//ICD报告触发测试
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "相序校验",//判断装置的接线是否正确
|
||||
selected: true,
|
||||
},
|
||||
// {
|
||||
// id: 4,
|
||||
// name: "守时校验",//判断装置24小时内的守时误差是否小于1s
|
||||
// selected: true,
|
||||
// },
|
||||
// {
|
||||
// id: 5,
|
||||
// name: "通道系数校准",//通过私有协议与装置进行通讯,校准三相电压电流的通道系数
|
||||
// selected: true,
|
||||
// },
|
||||
// {
|
||||
// id: 6,
|
||||
// name: "实时数据比对",
|
||||
// },
|
||||
// {
|
||||
// id: 7,
|
||||
// name: "录波数据比对",
|
||||
// },
|
||||
]);
|
||||
|
||||
const stepsTotalNum = ref(4);//步骤总数
|
||||
const stepsActiveIndex = ref(0); //当前正在执行的步骤索引
|
||||
const showSteps = ref(false)
|
||||
const stepsTotalNum = ref(-1);//步骤总数
|
||||
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
|
||||
const stepsActiveView = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
|
||||
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态,用于切换步骤
|
||||
const ActiveStatue = ref('waiting');//当前步骤状态
|
||||
const preTestStatus = ref('waiting');//预检测执行状态
|
||||
const timeTestStatus = ref('waiting');//守时校验执行状态
|
||||
@@ -170,159 +98,196 @@ const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
||||
const TestStatus = ref('waiting');//正式检测执行状态
|
||||
const webMsgSend = ref();//webSocket推送的数据
|
||||
|
||||
const dialogTitle = ref('');
|
||||
const isTimeCheck = ref(false)
|
||||
const preTestRef = ref(null);
|
||||
|
||||
|
||||
// const devIdArr = ref([])
|
||||
// const planId = ref('')
|
||||
const dialogTitle = ref('')
|
||||
const showComponent = ref(true)
|
||||
const preTestRef = ref(null)
|
||||
const testRef = ref(null)
|
||||
|
||||
const dataSocket = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
});
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (selection: Device.ResPqDev[], title: string, time: boolean) => {
|
||||
|
||||
// 勾选的检测内容
|
||||
const preTestSelected = ref(false)
|
||||
const timeTestSelected = ref(false)
|
||||
const channelsTestSelected = ref(false)
|
||||
const testSelected = ref(false)
|
||||
|
||||
const checkStates = selection.map(item => item.checkState);
|
||||
// devIdArr.value = selection.map(item => item.id);
|
||||
// planId.value =selection[0].planId
|
||||
// console.log('wwwwwwwwwwwwwwwww',selection)
|
||||
const initOperate = () => {
|
||||
ActiveStatue.value = 'waiting'
|
||||
preTestStatus.value = 'waiting'
|
||||
timeTestStatus.value = 'waiting'
|
||||
channelsTestStatus.value = 'waiting'
|
||||
TestStatus.value = 'waiting'
|
||||
|
||||
const allCheckStatesEqual = new Set(checkStates).size <= 1;
|
||||
stepsActiveIndex.value = 1
|
||||
showComponent.value = true
|
||||
// 初始化勾选的检测内容
|
||||
preTestSelected.value = checkStore.selectTestItems.preTest
|
||||
timeTestSelected.value = checkStore.selectTestItems.timeTest
|
||||
channelsTestSelected.value = checkStore.selectTestItems.channelsTest
|
||||
testSelected.value = checkStore.selectTestItems.test
|
||||
|
||||
if (!allCheckStatesEqual) {
|
||||
ElMessageBox.confirm(
|
||||
'所勾选设备检测状态不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
let count = 0
|
||||
for (let key in checkStore.selectTestItems) {
|
||||
if (checkStore.selectTestItems[key]) {
|
||||
count++
|
||||
}
|
||||
}
|
||||
stepsTotalNum.value = count + 1
|
||||
|
||||
if (preTestSelected.value) {
|
||||
stepsActiveView.value = 1
|
||||
stepsActive.value = 1
|
||||
return
|
||||
}
|
||||
if (timeTestSelected.value) {
|
||||
stepsActiveView.value = 2
|
||||
stepsActive.value = 2
|
||||
return
|
||||
}
|
||||
if (channelsTestSelected.value) {
|
||||
stepsActiveView.value = 3
|
||||
stepsActive.value = 3
|
||||
return
|
||||
}
|
||||
if (testSelected.value) {
|
||||
stepsActiveView.value = 4
|
||||
stepsActive.value = 4
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const open = (title: string) => {
|
||||
showSteps.value = true
|
||||
initOperate()
|
||||
dialogTitle.value = title;
|
||||
dialogVisible.value = true;
|
||||
isTimeCheck.value = time
|
||||
|
||||
if (preTestRef.value) {
|
||||
preTestRef.value.initializeParameters();
|
||||
}
|
||||
|
||||
preTestStatus.value = 'waiting';//预检测执行状态
|
||||
//开始创建webSocket客户端
|
||||
|
||||
socketClient.Instance.connect();
|
||||
dataSocket.socketServe = socketClient.Instance;
|
||||
dataSocket.socketServe.registerCallBack('aaa', (res) => {
|
||||
// 处理来自服务器的消息
|
||||
// console.log('Received message:', res);
|
||||
// 根据需要在这里添加更多的处理逻辑
|
||||
|
||||
if (res.code === 20000) {
|
||||
ElMessage.error(message.message)
|
||||
loading.close()
|
||||
//ElMessage.error(message.message)
|
||||
// loading.close()
|
||||
} else {
|
||||
webMsgSend.value = res
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
let loading;
|
||||
const handleSubmit = () => {
|
||||
skipDisabled.value = true
|
||||
//btnState.value = true
|
||||
console.log('=============', stepsActiveIndex.value)
|
||||
|
||||
const handleSubmitFast = () => {
|
||||
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
||||
let planId = checkStore.planId
|
||||
let planId = checkStore.plan.id
|
||||
|
||||
|
||||
if(!dataSocket.socketServe.connected){
|
||||
if (!dataSocket.socketServe.connected) {
|
||||
ElMessage.error('webSocket连接中断!')
|
||||
return
|
||||
}
|
||||
|
||||
switch (stepsActiveIndex.value) {
|
||||
case 0:
|
||||
// preTestStatus.value = 'start'
|
||||
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: '1' // '1'为预检测、‘2‘为正式检测
|
||||
}).then(res => {
|
||||
if (res.code === 'A001014') {
|
||||
ElMessageBox.alert('装置配置异常', '检测失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TestStatus.value = 'error'
|
||||
}
|
||||
})
|
||||
preTestStatus.value = 'start'
|
||||
break;
|
||||
console.log("handleSubmit", stepsActive.value, TestStatus.value)
|
||||
switch (stepsActive.value) {
|
||||
case 1:
|
||||
if (preTestStatus.value == 'waiting') {
|
||||
if (checkStore.selectTestItems.preTest) {
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: checkStore.reCheckType == 1 ? '1' : '2',
|
||||
userId: userStore.userInfo.id,
|
||||
temperature: checkStore.temperature,
|
||||
humidity: checkStore.humidity,
|
||||
testItemList: [checkStore.selectTestItems.preTest, checkStore.selectTestItems.channelsTest, checkStore.selectTestItems.test]
|
||||
}).then(res => {
|
||||
if (res.code === 'A001014') {
|
||||
ElMessageBox.alert('装置配置异常', '检测失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
preTestStatus.value = 'error'
|
||||
}
|
||||
})
|
||||
preTestStatus.value = 'start'
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
timeTestStatus.value = 'start'
|
||||
break;
|
||||
// case 2:
|
||||
// channelsTestStatus.value = 'start'
|
||||
// break;
|
||||
case 2:
|
||||
case 3:
|
||||
if (channelsTestStatus.value == 'waiting') {
|
||||
if (!checkStore.selectTestItems.preTest && checkStore.selectTestItems.channelsTest) {
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: checkStore.reCheckType == 1 ? '1' : '2',
|
||||
userId: userStore.userInfo.id,
|
||||
temperature: checkStore.temperature,
|
||||
humidity: checkStore.humidity,
|
||||
testItemList: [checkStore.selectTestItems.preTest, checkStore.selectTestItems.channelsTest, checkStore.selectTestItems.test]
|
||||
}).then(res => {
|
||||
if (res.code === 'A001014') {
|
||||
ElMessageBox.alert('装置配置异常', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
channelsTestStatus.value = 'test_init_fail'
|
||||
}
|
||||
})
|
||||
// 调用系数校准组件的handleSubmit方法
|
||||
}
|
||||
channelsTestStatus.value = 'start'
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (TestStatus.value == "waiting") {
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 'A001014') {
|
||||
ElMessageBox.alert('装置配置异常', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TestStatus.value = 'test_init_fail'
|
||||
}
|
||||
/* if (res.code === 20000) {
|
||||
TestStatus.value = 'start'
|
||||
webMsgSend.value = ''
|
||||
} else {
|
||||
ElMessage.error(res.message)
|
||||
}*/
|
||||
})
|
||||
if (!checkStore.selectTestItems.preTest && !checkStore.selectTestItems.channelsTest && checkStore.selectTestItems.test) {
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: checkStore.reCheckType == 1 ? '1' : '2',
|
||||
userId: userStore.userInfo.id,
|
||||
temperature: checkStore.temperature,
|
||||
humidity: checkStore.humidity,
|
||||
testItemList: [checkStore.selectTestItems.preTest, checkStore.selectTestItems.channelsTest, checkStore.selectTestItems.test]
|
||||
}).then(res => {
|
||||
if (res.code === 'A001014') {
|
||||
ElMessageBox.alert('装置配置异常', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TestStatus.value = 'test_init_fail'
|
||||
}
|
||||
})
|
||||
}
|
||||
TestStatus.value = 'start'
|
||||
} else if (TestStatus.value == 'paused') {
|
||||
// 发送继续指令
|
||||
sendResume()
|
||||
} else if (TestStatus.value == 'test_recheck') {
|
||||
// 发送重新检测指令
|
||||
sendReCheck()
|
||||
|
||||
|
||||
}else if (TestStatus.value == 'success') {
|
||||
emit('quitClicked'); // 触发事件
|
||||
}
|
||||
// else if (TestStatus.value == 'recheck') {
|
||||
// // 发送重新检测指令
|
||||
// sendReCheck()
|
||||
// }
|
||||
// else if (TestStatus.value == 'success') {
|
||||
// handleClose()
|
||||
// }
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -351,43 +316,61 @@ watch(TestStatus, function (newValue, oldValue) {
|
||||
})
|
||||
|
||||
watch(ActiveStatue, function (newValue, oldValue) {
|
||||
|
||||
if (newValue === 'success' || newValue === 'error') {
|
||||
skipDisabled.value = false
|
||||
}
|
||||
|
||||
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
nextStepText.value = '检测完成'
|
||||
}
|
||||
if (newValue === 'error' && stepsActiveIndex.value === stepsTotalNum.value - 3) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
if (newValue === 'error') {
|
||||
stepsActiveIndex.value = stepsTotalNum.value + 1
|
||||
nextStepText.value = '检测失败'
|
||||
}
|
||||
if (newValue === 'test_init_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 1) {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '检测完成'
|
||||
}
|
||||
if (newValue === 'test_init_fail') {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '初始化失败'
|
||||
}
|
||||
if (newValue === 'connect_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
if (newValue === 'connect_timeout') {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '连接超时'
|
||||
}
|
||||
if (newValue === 'pause_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
nextStepText.value = '结束测试'
|
||||
if (newValue === 'pause_timeout') {
|
||||
stepsActiveIndex.value += 2
|
||||
// nextStepText.value = '结束测试'
|
||||
nextStepText.value = '暂停超时'
|
||||
}
|
||||
if (newValue === 'success' && stepsActiveIndex.value < stepsTotalNum.value - 1) {
|
||||
nextStep() // 实现自动点击,进入下一个测试内容
|
||||
//handleSubmit()
|
||||
handleSubmitFast()
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
const handleQuit = () => {
|
||||
console.log('handleQuit', ActiveStatue.value)
|
||||
if (ActiveStatue.value !== 'success' && ActiveStatue.value !== 'waiting' && ActiveStatue.value !== 'paused' && ActiveStatue.value !== 'test_init_fail' && ActiveStatue.value !== 'connect_timeout' && ActiveStatue.value !== 'pause_timeout') {
|
||||
beforeClose(() => {
|
||||
})
|
||||
} else {
|
||||
handleClose()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handlePause = () => {
|
||||
sendPause()
|
||||
testRef.value?.handlePause()
|
||||
}
|
||||
const sendPause = () => {
|
||||
console.log('发起暂停请求')
|
||||
|
||||
TestStatus.value = 'paused_ing'
|
||||
pauseTest()
|
||||
// setTimeout(() => {
|
||||
// Object.assign(webMsgSend.value, {
|
||||
// requestId: 'preStopTest',
|
||||
// operateCode: 'stop'
|
||||
// })
|
||||
// }, 5000)
|
||||
}
|
||||
const sendResume = () => {
|
||||
console.log('发起继续检测请求')
|
||||
@@ -395,12 +378,14 @@ const sendResume = () => {
|
||||
resumeTest({
|
||||
userPageId: "cdf",
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.planId,
|
||||
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
||||
}).then(res => {
|
||||
Object.assign(webMsgSend.value, {
|
||||
requestId: 'Resume_Success'
|
||||
})
|
||||
planId: checkStore.plan.id,
|
||||
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId: userStore.userInfo.id,
|
||||
temperature: checkStore.temperature,
|
||||
humidity: checkStore.humidity
|
||||
})
|
||||
Object.assign(webMsgSend.value, {
|
||||
requestId: 'Resume_Success'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -409,8 +394,12 @@ const sendReCheck = () => {
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.planId,
|
||||
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测
|
||||
planId: checkStore.plan.id,
|
||||
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId: userStore.userInfo.id,
|
||||
temperature: checkStore.temperature,
|
||||
humidity: checkStore.humidity,
|
||||
testItemList: [checkStore.selectTestItems.preTest, checkStore.selectTestItems.channelsTest, checkStore.selectTestItems.test]
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 'A001014') {
|
||||
@@ -424,97 +413,91 @@ const sendReCheck = () => {
|
||||
TestStatus.value = 'start'
|
||||
}
|
||||
|
||||
const getIcon = (index: number) => {
|
||||
if (stepsActiveIndex.value > index) return SuccessFilled;
|
||||
switch (index) {
|
||||
case 0:
|
||||
return h(<svg-icon name="preTest"></svg-icon>);
|
||||
case 1:
|
||||
return UploadFilled;
|
||||
case 2:
|
||||
return Odometer;
|
||||
case 3:
|
||||
return Coin;
|
||||
case 4:
|
||||
return Key;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
const closeWebSocket = () => {
|
||||
dataSocket.socketServe.closeWs()
|
||||
}
|
||||
|
||||
const nextStep = () => {
|
||||
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||
stepsActiveIndex.value++
|
||||
if (!isTimeCheck.value) {//不具备守时检测,预检测后直接跳正式检测
|
||||
stepsActiveIndex.value++
|
||||
}
|
||||
|
||||
ActiveStatue.value = 'waiting'
|
||||
} else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
||||
//emit('update:visible', false); // 关闭对话框
|
||||
clearData()
|
||||
dialogVisible.value = false;
|
||||
if (stepsActiveIndex.value == stepsTotalNum.value + 1 || ActiveStatue.value === 'error' || ActiveStatue.value === 'test_init_fail' || ActiveStatue.value === 'connect_timeout' || ActiveStatue.value === 'pause_timeout') {
|
||||
handleClose()
|
||||
return
|
||||
}
|
||||
};
|
||||
if (ActiveStatue.value != 'error') {
|
||||
ActiveStatue.value = 'waiting'
|
||||
let tempStep = stepsActiveIndex.value
|
||||
let idx = 1
|
||||
stepsActiveIndex.value++
|
||||
for (let selectTestItemsKey in checkStore.selectTestItems) {
|
||||
if (tempStep == 0 && checkStore.selectTestItems[selectTestItemsKey]) {
|
||||
stepsActiveView.value = idx
|
||||
stepsActive.value = idx
|
||||
return
|
||||
}
|
||||
if (checkStore.selectTestItems[selectTestItemsKey] && tempStep != 0) {
|
||||
tempStep--
|
||||
}
|
||||
idx++
|
||||
}
|
||||
}
|
||||
|
||||
// if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||
// stepsActiveIndex.value++
|
||||
// if (!checkStore.selectTestItems.timeTest) { // 不具备守时检测
|
||||
// stepsActiveIndex.value++
|
||||
// }
|
||||
//
|
||||
// ActiveStatue.value = 'waiting'
|
||||
// } else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
||||
// //emit('update:visible', false); // 关闭对话框
|
||||
// clearData()
|
||||
// dialogVisible.value = false;
|
||||
// }
|
||||
}
|
||||
|
||||
const handleStepClick = (step: number) => {
|
||||
if (step > stepsActive.value) {
|
||||
return
|
||||
} else {
|
||||
stepsActiveView.value = step
|
||||
}
|
||||
}
|
||||
|
||||
function clearData() {
|
||||
stepsActiveIndex.value = 0;
|
||||
stepsTotalNum.value = -1
|
||||
stepsActiveIndex.value = 1
|
||||
stepsActiveView.value = -1
|
||||
preTestStatus.value = "waiting"
|
||||
timeTestStatus.value = "waiting"
|
||||
channelsTestStatus.value = "waiting"
|
||||
TestStatus.value = "waiting"
|
||||
ActiveStatue.value = "waiting"
|
||||
skipDisabled.value = false
|
||||
nextStepText.value = "下一步"
|
||||
}
|
||||
|
||||
const beforeClose = (done: () => void) => {
|
||||
console.log(stepsActiveIndex.value, stepsTotalNum.value)
|
||||
if (stepsActiveIndex.value < stepsTotalNum.value) {
|
||||
ElMessageBox.confirm(
|
||||
'检测未完成,是否退出当前检测流程?',
|
||||
'提示',
|
||||
{
|
||||
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||
ElMessageBox.confirm('检测未完成,是否退出当前检测流程?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
clearData()
|
||||
// todo 关闭弹窗,终止整个检测流程
|
||||
//emit('update:visible', false); // 关闭对话框
|
||||
dialogVisible.value = false;
|
||||
})
|
||||
).then(() => {
|
||||
handleClose()
|
||||
})
|
||||
} else {
|
||||
clearData()
|
||||
//emit('update:visible', false); // 关闭对话框
|
||||
dialogVisible.value = false;
|
||||
handleClose()
|
||||
}
|
||||
// ElMessageBox.confirm('Are you sure to close this dialog?')
|
||||
// .then(() => {
|
||||
// done()
|
||||
// })
|
||||
// .catch(() => {
|
||||
// // catch error
|
||||
// })
|
||||
}
|
||||
const handleCancel = () => {
|
||||
|
||||
const handleClose = () => {
|
||||
showSteps.value = false
|
||||
dataSocket.socketServe.closeWs()
|
||||
dialogVisible.value = false;
|
||||
clearData()
|
||||
showComponent.value = false;
|
||||
|
||||
emit('quitClicked'); // 触发事件
|
||||
// clearData()
|
||||
// emit('update:visible', false); // 关闭对话框
|
||||
};
|
||||
|
||||
|
||||
// // 当 props.visible 改变时,更新 formData
|
||||
// watch(() => props.visible, (newVal) => {
|
||||
// if (!newVal) {
|
||||
// // 这里可以重置表单数据,如果需要的话
|
||||
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({open})
|
||||
@@ -522,17 +505,22 @@ defineExpose({open})
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
.test-head-steps {
|
||||
::v-deep .el-step {
|
||||
.el-step__head.is-success {
|
||||
color: #91cc75;
|
||||
}
|
||||
|
||||
.el-step__title.is-success {
|
||||
color: #91cc75;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.dialog-big .el-dialog__body) {
|
||||
max-height: 840px !important;
|
||||
}
|
||||
|
||||
// :deep(.dialog-big){
|
||||
// max-height: 840px !important;
|
||||
// }
|
||||
// :deep(.el-dialog__body){
|
||||
// max-height: 840px !important;
|
||||
// }
|
||||
|
||||
.steps-container :deep(.test-head-steps) {
|
||||
height: 80px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="right-title" >
|
||||
<span v-if="activeIndex <= 1"> </span>
|
||||
<span v-if="activeIndex > 1" class="time-text">
|
||||
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
|
||||
标准时间: <span style="color: var(--el-color-primary)">{{ gpsTime }}</span>
|
||||
</span>
|
||||
<div class="error-dsc">
|
||||
<div class="green-div"></div>
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
<!-- <span v-if="activeIndex <= 1"> </span>
|
||||
<span v-if="activeIndex > 1" style=" font-size: 18px;font-weight: 600;">
|
||||
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
|
||||
标准时间: <span style="color: var(--el-color-primary)">{{ gpsTime }}</span>
|
||||
</span>
|
||||
<div class="error-dsc">
|
||||
<div class="green-div"></div>
|
||||
@@ -423,7 +423,7 @@ watch(ts, function (newValue, oldValue) {
|
||||
}
|
||||
|
||||
.right-title .gps-time {
|
||||
color: #003078;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.error-dsc {
|
||||
@@ -440,7 +440,7 @@ watch(ts, function (newValue, oldValue) {
|
||||
}
|
||||
|
||||
.error-dsc .green-div {
|
||||
background-color: #67C23A;
|
||||
background-color: #91cc75;
|
||||
}
|
||||
|
||||
.error-dsc .red-div {
|
||||
|
||||
@@ -5,9 +5,13 @@
|
||||
placeholder='请输入计划名称'
|
||||
clearable
|
||||
v-model='searchForm.planName'
|
||||
show-word-limit
|
||||
maxlength="32"
|
||||
></el-input>
|
||||
<el-tooltip content="检测计划列表" placement="top">
|
||||
<Menu style='width: 26px;height: 26px; margin-left: 8px;cursor: pointer;color:var(--el-color-primary)'
|
||||
@click.stop='detail()' />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div class='tree_container'>
|
||||
<el-tree
|
||||
@@ -24,28 +28,47 @@
|
||||
>
|
||||
<template #default='{ node, data }'>
|
||||
<span class='custom-tree-node' style='display: flex;align-items: center;'>
|
||||
<!-- 父节点图标 -->
|
||||
<Platform v-if='!data.pid' style='width:18px;height: 18px;margin-right:8px;'
|
||||
:style="{color:node.label=='未检'?'#fac858':node.label=='检测中'?'#ee6666':'#91cc75'}" />
|
||||
<!-- 节点名称 -->
|
||||
<span>{{ node.label }}</span>
|
||||
<!-- <Menu v-if="data.pid" @click.stop="detail(data)" style="width: 12px;margin-left: 8px;"/> -->
|
||||
<!-- 子节点右侧图标 + tooltip -->
|
||||
<el-tooltip
|
||||
v-if="node.label!='未检' && node.label!='检测中' && node.label!='检测完成'"
|
||||
placement="top"
|
||||
:manual="true"
|
||||
content="子计划信息">
|
||||
<Menu
|
||||
@click.stop="childDetail(node.data)"
|
||||
style="width: 16px; height: 16px; margin-left: 8px; cursor: pointer; color: var(--el-color-primary)"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
</el-tree>
|
||||
</div>
|
||||
</div>
|
||||
<SourceOpen ref='openSourceView' :width="width" :height="height + 175"></SourceOpen>
|
||||
|
||||
</template>
|
||||
<script lang='ts' setup>
|
||||
import { type Plan } from '@/api/plan/interface';
|
||||
import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue'
|
||||
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||
import { nextTick, onMounted, PropType, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router'
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import { ElTooltip } from 'element-plus';
|
||||
import SourceOpen from '@/views/plan/planList/components/childrenPlan.vue'
|
||||
|
||||
|
||||
const openSourceView = ref()
|
||||
const router = useRouter()
|
||||
const checkStore = useCheckStore()
|
||||
const filterText = ref('')
|
||||
const treeRef = ref()
|
||||
const data: any = ref([])
|
||||
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
@@ -58,16 +81,13 @@ const defaultChecked = ref<string[]>([]) // 明确类型为 number[]
|
||||
const tree = ref(false)//确保左侧树高凉只执行一次
|
||||
const getTreeData = (val: any) => {
|
||||
defaultChecked.value = [];
|
||||
data.value = val;
|
||||
|
||||
// 遍历 val 的每个 children,过滤掉 pid !== '0'
|
||||
data.value = val
|
||||
for (let item of data.value) {
|
||||
if (item.children.length > 0) {
|
||||
let node = item.children[0];
|
||||
defaultChecked.value.push(node.id);
|
||||
checkStore.setPlanId(node.id);
|
||||
checkStore.setPlanCode(node.code);
|
||||
checkStore.setScriptId(node.scriptId);
|
||||
checkStore.setErrorSysId(node.errorSysId);
|
||||
checkStore.setPlan(node);
|
||||
// 高亮显示第一个节点
|
||||
// 使用 nextTick 确保在 DOM 更新后调用 setCurrentKey
|
||||
nextTick(() => {
|
||||
@@ -82,7 +102,6 @@ const getTreeData = (val: any) => {
|
||||
|
||||
//点击表格后左侧树刷新,高亮显示对应节点
|
||||
const clickTableToTree = (val: any,id:any) => {
|
||||
|
||||
defaultChecked.value = []
|
||||
data.value = val
|
||||
let node = ref('')
|
||||
@@ -105,9 +124,13 @@ const clickTableToTree = (val: any,id:any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const {updateSelectedTreeNode} = defineProps<{
|
||||
const {updateSelectedTreeNode,width,height,planArray} = defineProps<{
|
||||
updateSelectedTreeNode:Function;
|
||||
width: number;
|
||||
height: number;
|
||||
planArray?: Plan.ReqPlan[];
|
||||
}>();
|
||||
|
||||
watch(
|
||||
() => searchForm.value.planName,
|
||||
(val) => {
|
||||
@@ -132,11 +155,8 @@ const handleNodeClick = (data: Plan.ResPlan) => {
|
||||
}
|
||||
|
||||
idd.value = data.id
|
||||
|
||||
checkStore.setPlanId(data.id)
|
||||
checkStore.setPlanCode(data.code)
|
||||
checkStore.setScriptId(data.scriptId)
|
||||
checkStore.setErrorSysId(data.errorSysId)
|
||||
|
||||
checkStore.setPlan(data);
|
||||
updateSelectedTreeNode(data.id)
|
||||
}
|
||||
const filterNode = (value: string, data: any) => {
|
||||
@@ -144,11 +164,18 @@ const filterNode = (value: string, data: any) => {
|
||||
return data.name.includes(value)
|
||||
}
|
||||
|
||||
|
||||
// 点击详情
|
||||
const detail = () => {
|
||||
router.push('/plan')
|
||||
router.push('/plan/planList')
|
||||
}
|
||||
|
||||
|
||||
|
||||
const childDetail = (data: Plan.ResPlan) => {
|
||||
console.log('planArray',planArray)
|
||||
openSourceView.value.open("检测计划详情",data)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// console.log()
|
||||
})
|
||||
|
||||
95
frontend/src/views/home/components/writeTHPopup.vue
Normal file
95
frontend/src/views/home/components/writeTHPopup.vue
Normal file
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<el-dialog title="填写实验室环境" v-model='dialogVisible' @close="handleClose" v-bind="dialogSmall" >
|
||||
<div>
|
||||
<el-form ref="dialogFormRef" :model="formContent" :rules='rules' >
|
||||
<el-form-item label="温度(℃)" prop="temperature" :label-width="110">
|
||||
<el-input v-model="formContent.temperature" placeholder="请输入温度" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item label="相对湿度(%)" prop="humidity" :label-width="110">
|
||||
<el-input v-model="formContent.humidity" placeholder="请输入湿度" maxlength="32" show-word-limit/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleStart">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='selectTestItemPopup'>
|
||||
import {dialogSmall} from "@/utils/elementBind";
|
||||
import {reactive, Ref, ref} from "vue";
|
||||
import type {Device} from "@/api/device/interface/device.ts";
|
||||
import {ElMessageBox, FormItemRule} from "element-plus";
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
|
||||
const emit = defineEmits(['openTestDialog2'])
|
||||
const dialogFormRef = ref()
|
||||
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const formContent = reactive<Device.ResTH>({temperature:0,humidity:0})
|
||||
const checkStore = useCheckStore();
|
||||
const open = async () => {
|
||||
resetFormContent()
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
// 清空表单内容
|
||||
const resetFormContent = () => {
|
||||
Object.assign(formContent,{temperature:'22',humidity:'50'})
|
||||
}
|
||||
|
||||
|
||||
//定义校验规则
|
||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
temperature: [{ required: true, message: '温度必填!', trigger: 'blur' },
|
||||
// 指定正则,此处是数字正则
|
||||
{ pattern: /^(?:(?:-50)|-?[1-4][0-9]|-?[0-9]|[1-4][0-9]|50)(\.[0-9]+)?$/,
|
||||
message: '温度必须为 -50 到 50 之间的合法数字',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
humidity: [{ required: true, message: '湿度必填!', trigger: 'blur' },
|
||||
{ pattern: /^(?:100(?:\.0+)?|\d{1,2}(?:\.\d+)?|0?\.\d+)$/ , message: '湿度必须为 0 到 100 之间的合法数字', trigger: 'blur' },
|
||||
],
|
||||
|
||||
})
|
||||
|
||||
|
||||
const handleStart = () => {
|
||||
try {
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
|
||||
checkStore.setTemperature(formContent.temperature)
|
||||
checkStore.setHumidity(formContent.humidity)
|
||||
emit('openTestDialog2')
|
||||
handleClose()
|
||||
}
|
||||
})
|
||||
} catch (err) {
|
||||
console.error('验证过程中出现错误', err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const handleClose = () => {
|
||||
dialogVisible.value = false
|
||||
// 清空dialogForm中的值
|
||||
resetFormContent()
|
||||
dialogFormRef.value?.resetFields()
|
||||
}
|
||||
|
||||
defineExpose({open})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
@@ -70,14 +70,14 @@ const modeList = [
|
||||
const handelOpen = async (isActive: any) => {
|
||||
await authStore.setShowMenu();
|
||||
return;
|
||||
if (isActive) {
|
||||
router.push({ path: "/static" });
|
||||
} else {
|
||||
ElMessage({
|
||||
message: "当前模式未配置",
|
||||
type: "warning",
|
||||
});
|
||||
}
|
||||
// if (isActive) {
|
||||
// router.push({ path: "/static" });
|
||||
// } else {
|
||||
// ElMessage({
|
||||
// message: "当前模式未配置",
|
||||
// type: "warning",
|
||||
// });
|
||||
// }
|
||||
};
|
||||
const handleSelect = (key: string, keyPath: string[]) => {
|
||||
//console.log(key, keyPath);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!-- 真正的首页 -->
|
||||
<template>
|
||||
<div class='static'>
|
||||
<div class='static' ref='popupBaseView'>
|
||||
<el-row :gutter='10'>
|
||||
<el-col :lg='4' :xl='4' :md='4' :sm='4'>
|
||||
<div class='left_tree'>
|
||||
<!-- <tree ref='treeRef' :updateSelectedTreeNode='getPieData || (() => {})' /> -->
|
||||
<tree ref='treeRef' :updateSelectedTreeNode='updateData|| (() => {})' />
|
||||
<tree ref='treeRef' :updateSelectedTreeNode='updateData|| (() => {})' :width="viewWidth" :height="viewHeight" :planArray = 'planList2?.data'/>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :lg='20' :xl='20' :md='20' :sm='20'>
|
||||
@@ -29,8 +29,8 @@
|
||||
</div>
|
||||
<!--检测计划统计 饼图统计-->
|
||||
<div class='container_pieShow'>
|
||||
<el-collapse model-value='1' accordion @change='handleCollapseChange'>
|
||||
<el-collapse-item name='1'>
|
||||
<el-collapse model-value='1' accordion @change='handleCollapseChange' >
|
||||
<el-collapse-item name='1' >
|
||||
<template #title>
|
||||
<div class='container_pieShow_title'>
|
||||
<span>检测计划统计</span>
|
||||
@@ -95,7 +95,7 @@
|
||||
<el-tab-pane :label='tabLabel1' :style='{ height: tabPaneHeight}'>
|
||||
<!-- 列表数据 -->
|
||||
<div class='container_table' :style='{ height: tableHeight }'>
|
||||
<Table ref='tableRef1' :id='currentId' :isTimeCheck='isTimeCheck' :plan = 'select_Plan' @batchGenerateClicked="handleBatchGenerate"></Table>
|
||||
<Table ref='tableRef1' :id='currentId' :plan ='select_Plan' :planArray = 'planList2?.data' @batchGenerateClicked="handleBatchGenerate"></Table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -118,6 +118,8 @@ import { type Plan } from '@/api/plan/interface'
|
||||
import type { CollapseModelValue } from 'element-plus/es/components/collapse/src/collapse.mjs'
|
||||
import { type Device } from '@/api/device/interface/device'
|
||||
import { ResultData } from '@/api/interface'
|
||||
import { useViewSize } from '@/hooks/useViewSize'
|
||||
import { map } from 'lodash'
|
||||
|
||||
const planName = ref('')
|
||||
const dictStore = useDictStore()
|
||||
@@ -145,10 +147,11 @@ const tabsHeight = ref('calc(100vh - 522px)') // 初始高度
|
||||
const tabPaneHeight = ref('calc(100% - 5px)') // 初始高度
|
||||
const tableHeight = ref('calc(100% - 50px)') // 初始高度
|
||||
|
||||
const isTimeCheck = ref<boolean>(false)
|
||||
const planList = ref<ResultData<Plan.ReqPlan[]>>()
|
||||
const planList2 = ref<ResultData<Plan.ReqPlan[]>>()//备份含子计划的结构
|
||||
const select_Plan = ref<Plan.ReqPlan>()
|
||||
const isLabelLineShow = ref(true)
|
||||
const { popupBaseView,viewWidth, viewHeight } = useViewSize()
|
||||
const handleCollapseChange = (val: CollapseModelValue) => {
|
||||
|
||||
// 计算新的高度
|
||||
@@ -169,7 +172,7 @@ const handleTabsChange = (val: any) => {
|
||||
form.value.activeChildTabs = Number(val)
|
||||
|
||||
}
|
||||
localStorage.setItem('color', 'red')
|
||||
localStorage.setItem('color', '#91cc75')
|
||||
//功能选择数据
|
||||
const tabsList = ref([
|
||||
{
|
||||
@@ -203,7 +206,6 @@ const tableRef1 = ref()
|
||||
const tableRef2 = ref()
|
||||
const currentId = ref('')
|
||||
|
||||
|
||||
watch(
|
||||
() => form.value,
|
||||
(val, oldVal) => {
|
||||
@@ -242,15 +244,13 @@ watch(
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
|
||||
const pieRef1 = ref(),
|
||||
pieRef2 = ref(),
|
||||
pieRef3 = ref()
|
||||
pieRef2 = ref(),
|
||||
pieRef3 = ref()
|
||||
|
||||
const chartsData1: any = ref([]),
|
||||
chartsData2: any = ref([]),
|
||||
chartsData3: any = ref([])
|
||||
chartsData2: any = ref([]),
|
||||
chartsData3: any = ref([])
|
||||
|
||||
const findPlanById = (plans: Plan.ReqPlan[], id: string): Plan.ReqPlan | undefined => {
|
||||
for (const plan of plans) {
|
||||
@@ -298,19 +298,14 @@ const getPieData = async (id: string) => {
|
||||
const reportStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 }
|
||||
if (id) {
|
||||
const boundPqDevList = ref<Device.ResPqDev[]>([])//根据检测计划id查询出所有已绑定的设备
|
||||
const plan = findPlanById(planList.value?.data || [], id)
|
||||
const plan = findPlanById(planList.value, id)
|
||||
|
||||
planName.value = '所选计划:' + plan.name
|
||||
|
||||
|
||||
select_Plan.value = plan
|
||||
if (plan) {
|
||||
//isTimeCheck.value = plan.timeCheck === 1; // 将 1 转换为 true,0 转换为 false
|
||||
isTimeCheck.value = false // 将 1 转换为 true,0 转换为 false ----目前不用守时检测,先去除
|
||||
} else {
|
||||
// 处理未找到计划的情况
|
||||
isTimeCheck.value = false // 或者其他默认值
|
||||
}
|
||||
|
||||
const pqDevList_Result2 = await getBoundPqDevList({ 'planId': id, 'checkStateList': [0, 1, 2, 3] })
|
||||
console.log('所选计划:',plan)
|
||||
|
||||
const pqDevList_Result2 = await getBoundPqDevList({ 'planIdList': [id], 'checkStateList': [0, 1, 2, 3] })
|
||||
boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[]
|
||||
// 遍历 boundPqDevList 并更新计数对象
|
||||
boundPqDevList.value.forEach(t => {
|
||||
@@ -329,7 +324,6 @@ const getPieData = async (id: string) => {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 检查 checkStateCount 是否全为 0
|
||||
if(boundPqDevList.value.length != 0){
|
||||
|
||||
@@ -383,12 +377,7 @@ const getPieData = async (id: string) => {
|
||||
{ value: 0 , itemStyle: { color: '#eeeeee' } },
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
planName.value = '所选计划:'
|
||||
}
|
||||
|
||||
@@ -417,7 +406,6 @@ const planDetail = () => {
|
||||
|
||||
//功能选择css切换
|
||||
const handleCheckFunction = (val: any) => {
|
||||
|
||||
editableTabsValue.value = '0'
|
||||
form.value.activeChildTabs = 0
|
||||
tabsList.value.map((item: any, index: any) => {
|
||||
@@ -462,8 +450,7 @@ const handleCheckFunction = (val: any) => {
|
||||
const resizeObserver = new ResizeObserver(entries => {
|
||||
for (let entry of entries) {
|
||||
chartsWidth.value = entry.contentRect.width
|
||||
//console.log('Charts Info Width:', chartsWidth.value);
|
||||
|
||||
|
||||
pieRef1.value?.reSize(chartsWidth.value * 0.95, 180, true)
|
||||
pieRef2.value?.reSize(chartsWidth.value * 0.95, 180, true)
|
||||
pieRef3.value?.reSize(chartsWidth.value * 0.95, 180, true)
|
||||
@@ -493,19 +480,37 @@ const initPlan = async () => {
|
||||
result: 0,
|
||||
code: 0,
|
||||
state: 0,
|
||||
standardDevNameStr: '',
|
||||
associateReport: 0,
|
||||
reportTemplateName: '',
|
||||
reportTemplateVersion: '',
|
||||
dataRule: '',
|
||||
testItemNameStr:'',
|
||||
testItems: [],
|
||||
standardDevIds:[],
|
||||
standardDevMap: new Map<string, number>(),
|
||||
}
|
||||
planList.value = (await getPlanListByPattern(reqPlan)) as ResultData<Plan.ReqPlan[]>
|
||||
planList2.value = (await getPlanListByPattern(reqPlan)) as ResultData<Plan.ReqPlan[]>
|
||||
planList.value = JSON.parse(JSON.stringify(planList2.value));
|
||||
planList.value = planList.value.data.map((item: any) => {
|
||||
if (item.children) {
|
||||
item.children = item.children.filter(child => child.pid === '0');
|
||||
}
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
|
||||
await initPlan()
|
||||
for (let i = 0; i < planList.value.data.length; i++) {
|
||||
if (Array.isArray(planList.value.data[i].children) && planList.value.data[i].children.length > 0) {
|
||||
currentId.value = planList.value.data[i].children[0].id; // 直接赋值第一个 children 的 id
|
||||
console.log(planList.value)
|
||||
for (let i = 0; i < planList.value.length; i++) {
|
||||
if (Array.isArray(planList.value[i].children) && planList.value[i].children.length > 0) {
|
||||
currentId.value = planList.value[i].children[0].id; // 直接赋值第一个 children 的 id
|
||||
break; // 确保只执行一次
|
||||
}
|
||||
}
|
||||
|
||||
console.log('planList.valuecurrentId.value', currentId.value)
|
||||
// if (planList.value.data[0].children[0]) {
|
||||
// currentId.value = planList.value.data[0].children[0].id
|
||||
// console.log('currentId.value',planList.value.data[0])
|
||||
@@ -514,8 +519,7 @@ onBeforeMount(async () => {
|
||||
if (chartsInfoRef.value) {
|
||||
resizeObserver.observe(chartsInfoRef.value)
|
||||
}
|
||||
getTree(planList.value.data)
|
||||
|
||||
getTree(planList.value)
|
||||
getPieData(currentId.value)
|
||||
})
|
||||
|
||||
@@ -529,7 +533,7 @@ const handleBatchGenerate = async () => {
|
||||
// console.log('批量生成按钮被点击了');
|
||||
// 在这里添加其他逻辑,比如显示对话框、更新状态等
|
||||
await initPlan()
|
||||
treeRef.value.clickTableToTree(planList.value.data,currentId.value)
|
||||
treeRef.value.clickTableToTree(planList.value,currentId.value)
|
||||
getPieData(currentId.value)
|
||||
|
||||
if (form.value.activeTabs === 0)//设备检测
|
||||
@@ -654,7 +658,7 @@ const handleBatchGenerate = async () => {
|
||||
justify-content: space-between;
|
||||
padding: 0 15px;
|
||||
font-weight: bold;
|
||||
width: 100%;
|
||||
width: 99%;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ import { ElMessage } from "element-plus";
|
||||
import { useAuthStore } from "@/stores/modules/auth";
|
||||
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
|
||||
import { ref } from "vue";
|
||||
import {getCurrentScene} from "@/api/user/login";
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const modeStore = useModeStore(); // 使用模式 store
|
||||
const AppSceneStore = useAppSceneStore();
|
||||
@@ -70,20 +72,23 @@ const modeList = [
|
||||
code: "数字式",
|
||||
subName: "启用数字检测计划",
|
||||
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
|
||||
isActive: false,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
name: "比对式模块",
|
||||
code: "比对式",
|
||||
subName: "启用比对式检测计划",
|
||||
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
|
||||
isActive: false,
|
||||
isActive: true,
|
||||
},
|
||||
];
|
||||
const handelOpen = async (item: any) => {
|
||||
modeStore.setCurrentMode(item.code); // 将模式code存入 store
|
||||
AppSceneStore.setCurrentMode('1');//0:省级平台,1:设备出厂,2:研发自测
|
||||
const {data:scene} = await getCurrentScene(); // 获取当前场景
|
||||
// AppSceneStore.setCurrentMode(scene+'');//0:省级平台,1:设备出厂,2:研发自测
|
||||
AppSceneStore.setCurrentMode(scene+'');//0:省级平台,1:设备出厂,2:研发自测
|
||||
await authStore.setShowMenu();
|
||||
await authStore.getAuthMenuList();
|
||||
return;
|
||||
// if (isActive) {
|
||||
// router.push({ path: "/static" });
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
<template>
|
||||
<div class='table-box'>
|
||||
<ProTable
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:data='logData'
|
||||
@selection-change='handleSelectionChange'
|
||||
type='selection'
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:request-api='getTableList'
|
||||
>
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader>
|
||||
<el-button type='primary' :icon='DataAnalysis' >分析</el-button>
|
||||
<el-button type='primary' :icon='Upload'>导出csv</el-button>
|
||||
<el-button type='primary' :icon='DataAnalysis'>分析</el-button>
|
||||
<el-button type='primary' :icon='Upload' @click='handleExport'>导出csv</el-button>
|
||||
</template>
|
||||
</ProTable>
|
||||
|
||||
@@ -21,43 +19,41 @@
|
||||
<script setup lang='tsx' name='useProTable'>
|
||||
// 根据实际路径调整
|
||||
import TimeControl from '@/components/TimeControl/index.vue'
|
||||
import { type Sys_Log_Audit } from '@/api/system/interface/log'
|
||||
import {type AuditLog} from '@/api/system/log/interface/log.ts'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import { Upload ,DataAnalysis} from '@element-plus/icons-vue'
|
||||
import logDataList from '@/api/system/log/logData'
|
||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||
import { reactive,ref,watch } from 'vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import {DataAnalysis, Upload} from '@element-plus/icons-vue'
|
||||
import type {ColumnProps, ProTableInstance} from '@/components/ProTable/interface'
|
||||
import {reactive, ref} from 'vue'
|
||||
import {getAuditLog, exportCsv} from '@/api/system/log/index.ts'
|
||||
import {useDownload} from "@/hooks/useDownload";
|
||||
import {exportPqDev} from "@/api/device/device";
|
||||
|
||||
defineOptions({
|
||||
name: 'log'
|
||||
})
|
||||
|
||||
let multipleSelection = ref<string[]>([])
|
||||
const logData = logDataList
|
||||
const dictStore = useDictStore()
|
||||
// 定义包含和排除的单位
|
||||
const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
|
||||
const excludedUnits = ['季度','年']; // 要排除的单位
|
||||
const defaultUnits = '日'; // 默认的单位
|
||||
// defineOptions({
|
||||
// name: 'log'
|
||||
// })
|
||||
|
||||
const startDate = ref('')
|
||||
const endDate = ref('')
|
||||
// ProTable 实例
|
||||
const proTable = ref<ProTableInstance>()
|
||||
|
||||
|
||||
const getTableList = async (params: any) => {
|
||||
let newParams = JSON.parse(JSON.stringify(params))
|
||||
newParams.searchEndTime = endDate.value
|
||||
newParams.searchBeginTime = startDate.value
|
||||
return getAuditLog(newParams)
|
||||
}
|
||||
|
||||
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
const columns = reactive<ColumnProps<AuditLog.ReqAuditLogParams>[]>([
|
||||
{type: 'selection', fixed: 'left', width: 70},
|
||||
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||
{
|
||||
prop: 'id',
|
||||
label: '序号',
|
||||
width: 70,
|
||||
},
|
||||
{
|
||||
prop: 'create_By',
|
||||
prop: 'userName',
|
||||
label: '操作用户',
|
||||
search: { el: 'input' },
|
||||
search: {el: 'input'},
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
@@ -66,28 +62,29 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
prop: 'create_Time',
|
||||
prop: 'logTime',
|
||||
label: '记录时间',
|
||||
minWidth: 180,
|
||||
search: {
|
||||
span: 2,
|
||||
render: () => {
|
||||
return (
|
||||
<div class='flx-flex-start'>
|
||||
<TimeControl
|
||||
include={includedUnits}
|
||||
exclude={excludedUnits}
|
||||
default={defaultUnits}
|
||||
/>
|
||||
</div>
|
||||
<div class='flx-flex-start'>
|
||||
<TimeControl
|
||||
include={['日', '周', '月', '自定义']}
|
||||
default={'月'}
|
||||
onUpdate-dates={handleDateChange}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '事件描述',
|
||||
minWidth: 400,
|
||||
minWidth: 450,
|
||||
render: (scope) => {
|
||||
return (scope.row.userName + '在' + scope.row.logTime + '执行了' + scope.row.operateType + scope.row.operate + '操作,结果为' + scope.row.result + '。')
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'result',
|
||||
@@ -97,28 +94,36 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
||||
{
|
||||
prop: 'warn',
|
||||
label: '告警标志',
|
||||
minWidth: 100,
|
||||
render: scope => {
|
||||
return (
|
||||
<el-tag type={scope.row.warn ? 'danger' : 'success'}>{scope.row.warn ? '告警' : '未告警'}</el-tag>
|
||||
)
|
||||
},
|
||||
minWidth: 100,
|
||||
render: scope => {
|
||||
return (
|
||||
<el-tag type={scope.row.warn == 1 ? 'danger' : 'success'}>{scope.row.warn == 1 ? '已告警' : '未告警'}</el-tag>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'operate_Type',
|
||||
prop: 'operateType',
|
||||
label: '日志类型',
|
||||
width: 100,
|
||||
search: { el: 'select', props: { filterable: true } },
|
||||
},
|
||||
])
|
||||
|
||||
//选中
|
||||
// 处理选择变化
|
||||
const handleSelectionChange = (selection: Sys_Log_Audit.Audit_LogList[]) => {
|
||||
multipleSelection.value = selection.map(row => row.id) // 更新选中的行
|
||||
|
||||
// 处理日期变化的回调函数
|
||||
const handleDateChange = (startDateTemp: string, endDateTemp: string) => {
|
||||
startDate.value = startDateTemp
|
||||
endDate.value = endDateTemp
|
||||
}
|
||||
|
||||
const handleExport = () => {
|
||||
// 获取当前的搜索参数
|
||||
let searchParam = proTable.value?.searchParam || {}
|
||||
|
||||
// 将开始时间和结束时间添加到搜索参数中
|
||||
searchParam.searchBeginTime = startDate.value
|
||||
searchParam.searchEndTime = endDate.value
|
||||
|
||||
useDownload(exportCsv, '日志列表', searchParam, false, '.csv')
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<el-input v-model='loginForm.username' placeholder='用户名'>
|
||||
<template #prefix>
|
||||
<el-icon class='el-input__icon'>
|
||||
<user />
|
||||
<user/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
@@ -24,11 +24,14 @@
|
||||
>
|
||||
<template #prefix>
|
||||
<el-icon class='el-input__icon'>
|
||||
<lock />
|
||||
<lock/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop='checked'>
|
||||
<el-checkbox v-model="loginForm.checked">记住我</el-checkbox>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class='login-btn'>
|
||||
<el-button
|
||||
@@ -53,21 +56,22 @@
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
import { useRouter } from 'vue-router'
|
||||
import { HOME_URL } from '@/config'
|
||||
import { getTimeState } from '@/utils'
|
||||
import { type Dict } from '@/api/interface'
|
||||
import { type Login } from '@/api/user/interface/user'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import { getDictList, loginApi } from '@/api/user/login'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { useTabsStore } from '@/stores/modules/tabs'
|
||||
import { useKeepAliveStore } from '@/stores/modules/keepAlive'
|
||||
import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
||||
import { CircleClose, UserFilled } from '@element-plus/icons-vue'
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
import type { ElForm } from 'element-plus'
|
||||
import {useRouter} from 'vue-router'
|
||||
import {HOME_URL} from '@/config'
|
||||
import {getTimeState} from '@/utils'
|
||||
import {type Dict} from '@/api/interface'
|
||||
import {type Login} from '@/api/user/interface/user'
|
||||
import type {ElForm} from 'element-plus'
|
||||
import {ElNotification} from 'element-plus'
|
||||
import {getDictList, getPublicKey, loginApi} from '@/api/user/login'
|
||||
import {useUserStore} from '@/stores/modules/user'
|
||||
import {useTabsStore} from '@/stores/modules/tabs'
|
||||
import {useKeepAliveStore} from '@/stores/modules/keepAlive'
|
||||
import {initDynamicRouter} from '@/routers/modules/dynamicRouter'
|
||||
import {CircleClose, UserFilled} from '@element-plus/icons-vue'
|
||||
import {useAuthStore} from '@/stores/modules/auth'
|
||||
import {useDictStore} from "@/stores/modules/dict";
|
||||
import forge from 'node-forge'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const router = useRouter()
|
||||
@@ -76,19 +80,21 @@ const tabsStore = useTabsStore()
|
||||
const keepAliveStore = useKeepAliveStore()
|
||||
|
||||
const dictStore = useDictStore()
|
||||
let publicKey: any = null;
|
||||
|
||||
|
||||
type FormInstance = InstanceType<typeof ElForm>;
|
||||
const loginFormRef = ref<FormInstance>()
|
||||
const loginRules = reactive({
|
||||
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
||||
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
|
||||
username: [{required: true, message: '请输入用户名', trigger: 'blur'}],
|
||||
password: [{required: true, message: '请输入密码', trigger: 'blur'}],
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const loginForm = reactive<Login.ReqLoginForm>({
|
||||
username: '',
|
||||
password: '',
|
||||
checked: false,
|
||||
})
|
||||
|
||||
// login
|
||||
@@ -98,14 +104,22 @@ const login = (formEl: FormInstance | undefined) => {
|
||||
if (!valid) return
|
||||
loading.value = true
|
||||
try {
|
||||
let {data: publicKeyBase64}: { data: string } = await getPublicKey(loginForm.username)
|
||||
//将base64格式的公钥转换为Forge可以使用的格式
|
||||
const publicKeyDer = forge.util.decode64(publicKeyBase64);
|
||||
publicKey = forge.pki.publicKeyFromPem(forge.pki.publicKeyToPem(forge.pki.publicKeyFromAsn1(forge.asn1.fromDer(publicKeyDer))));
|
||||
|
||||
// 1.执行登录接口
|
||||
const { data } = await loginApi({
|
||||
...loginForm,
|
||||
password: loginForm.password,
|
||||
const {data} = await loginApi({
|
||||
username: forge.util.encode64(loginForm.username),
|
||||
password: encryptPassword(loginForm.password),
|
||||
})
|
||||
userStore.setAccessToken(data.accessToken)
|
||||
userStore.setRefreshToken(data.refreshToken)
|
||||
userStore.setUserInfo(data.userInfo)
|
||||
if(loginForm.checked){
|
||||
userStore.setExp(Date.now() + 1000 * 60 * 60 * 24 * 30)
|
||||
}
|
||||
const response = await getDictList()
|
||||
const dictData = response.data as unknown as Dict[]
|
||||
await dictStore.initDictData(dictData)
|
||||
@@ -148,6 +162,13 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const encryptPassword = (password: string) => {
|
||||
const encrypted = publicKey.encrypt(password, 'RSAES-PKCS1-V1_5');
|
||||
// 将加密后的数据转换为base64格式以便传输
|
||||
return forge.util.encode64(encrypted);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user