Compare commits
266 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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": [
|
"cSpell.words": [
|
||||||
|
"Analyse",
|
||||||
"CHNFACTOR",
|
"CHNFACTOR",
|
||||||
"CHNPACTOR",
|
"CHNPACTOR",
|
||||||
"Chns",
|
"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.124:18092/"]]
|
||||||
#VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
#VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
||||||
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文
|
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文
|
||||||
|
|||||||
@@ -22,4 +22,5 @@ VITE_DROP_CONSOLE=true
|
|||||||
VITE_PWA=true
|
VITE_PWA=true
|
||||||
|
|
||||||
# 线上环境接口地址
|
# 线上环境接口地址
|
||||||
|
#VITE_API_URL="/api" # 打包时用
|
||||||
VITE_API_URL="http://192.168.1.125:18092/"
|
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"
|
||||||
|
}
|
||||||
@@ -22,9 +22,11 @@
|
|||||||
"echarts": "^5.4.3",
|
"echarts": "^5.4.3",
|
||||||
"echarts-liquidfill": "^3.1.0",
|
"echarts-liquidfill": "^3.1.0",
|
||||||
"element-plus": "^2.7.8",
|
"element-plus": "^2.7.8",
|
||||||
|
"html2canvas": "^1.4.1",
|
||||||
"md5": "^2.3.0",
|
"md5": "^2.3.0",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
"mkdirp": "^3.0.1",
|
"mkdirp": "^3.0.1",
|
||||||
|
"node-forge": "^1.3.1",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"pinia": "^2.2.1",
|
"pinia": "^2.2.1",
|
||||||
"pinia-plugin-persistedstate": "^3.2.1",
|
"pinia-plugin-persistedstate": "^3.2.1",
|
||||||
@@ -41,11 +43,14 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rushstack/eslint-patch": "^1.8.0",
|
"@rushstack/eslint-patch": "^1.8.0",
|
||||||
"@tsconfig/node20": "^20.1.4",
|
"@tsconfig/node20": "^20.1.4",
|
||||||
|
"@types/html2canvas": "^1.0.0",
|
||||||
"@types/md5": "^2.3.2",
|
"@types/md5": "^2.3.2",
|
||||||
"@types/node": "^20.14.14",
|
"@types/node": "^20.14.14",
|
||||||
|
"@types/node-forge": "^1.3.11",
|
||||||
"@types/nprogress": "^0.2.0",
|
"@types/nprogress": "^0.2.0",
|
||||||
"@types/qs": "^6.9.8",
|
"@types/qs": "^6.9.8",
|
||||||
"@types/sortablejs": "^1.15.2",
|
"@types/sortablejs": "^1.15.2",
|
||||||
|
"@types/xlsx": "^0.0.36",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
||||||
"@typescript-eslint/parser": "^6.7.0",
|
"@typescript-eslint/parser": "^6.7.0",
|
||||||
"@vitejs/plugin-vue": "^5.0.5",
|
"@vitejs/plugin-vue": "^5.0.5",
|
||||||
@@ -71,7 +76,7 @@
|
|||||||
"vite-plugin-compression": "^0.5.1",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-eslint": "^1.8.1",
|
"vite-plugin-eslint": "^1.8.1",
|
||||||
"vite-plugin-html": "^3.2.0",
|
"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-pwa": "^0.16.5",
|
||||||
"vite-plugin-svg-icons": "^2.0.1",
|
"vite-plugin-svg-icons": "^2.0.1",
|
||||||
"vue-tsc": "^2.0.21"
|
"vue-tsc": "^2.0.21"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export namespace CheckData {
|
export namespace CheckData {
|
||||||
export interface DataCheck {
|
export interface DataCheck {
|
||||||
scriptName: string,
|
scriptName: string,
|
||||||
errorSysName: string,
|
errorSysId: string,
|
||||||
dataRule: string,
|
dataRule: string,
|
||||||
deviceName: string,
|
deviceName: string,
|
||||||
chnNum: string,
|
chnNum: string,
|
||||||
@@ -13,13 +13,15 @@ export namespace CheckData {
|
|||||||
// 装置原始数据-被检值
|
// 装置原始数据-被检值
|
||||||
data: number,
|
data: number,
|
||||||
|
|
||||||
|
// 误差值
|
||||||
|
errorData: number,
|
||||||
// 第几次谐波
|
// 第几次谐波
|
||||||
num?: number,
|
num?: number,
|
||||||
//符合、不符合
|
//符合、不符合
|
||||||
isData?: number,
|
isData?: number,
|
||||||
//最大误差值
|
//最大误差值
|
||||||
radius?: string,
|
radius?: string,
|
||||||
|
unit?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,21 +52,25 @@ export namespace CheckData {
|
|||||||
errorA?: string,
|
errorA?: string,
|
||||||
maxErrorA?: string,
|
maxErrorA?: string,
|
||||||
isDataA?: number,
|
isDataA?: number,
|
||||||
|
unitA?: string,
|
||||||
stdB?: string,
|
stdB?: string,
|
||||||
dataB?: string,
|
dataB?: string,
|
||||||
errorB?: string,
|
errorB?: string,
|
||||||
maxErrorB?: string,
|
maxErrorB?: string,
|
||||||
isDataB?: number,
|
isDataB?: number,
|
||||||
|
unitB?: string,
|
||||||
stdC?: string,
|
stdC?: string,
|
||||||
dataC?: string,
|
dataC?: string,
|
||||||
errorC?: string,
|
errorC?: string,
|
||||||
maxErrorC?: string,
|
maxErrorC?: string,
|
||||||
isDataC?: number,
|
isDataC?: number,
|
||||||
|
unitC?: string,
|
||||||
stdT?: string,
|
stdT?: string,
|
||||||
dataT?: string,
|
dataT?: string,
|
||||||
errorT?: string,
|
errorT?: string,
|
||||||
maxErrorT?: string,
|
maxErrorT?: string,
|
||||||
isDataT?: number,
|
isDataT?: number,
|
||||||
|
unitT?: string,
|
||||||
|
|
||||||
//最大误差值
|
//最大误差值
|
||||||
maxError?: string,
|
maxError?: string,
|
||||||
@@ -90,6 +96,13 @@ export namespace CheckData {
|
|||||||
deviceId: string; //装置序号Id
|
deviceId: string; //装置序号Id
|
||||||
deviceName: string; //设备名称
|
deviceName: string; //设备名称
|
||||||
chnNum: number; //设备通道数
|
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 {
|
export interface TreeItem {
|
||||||
|
id: string | null,
|
||||||
scriptTypeName: string | null,
|
scriptTypeName: string | null,
|
||||||
sourceDesc: string | null,
|
sourceDesc: string | null,
|
||||||
harmNum: number | null,
|
harmNum: number | null,
|
||||||
@@ -116,7 +130,8 @@ export namespace CheckData {
|
|||||||
SUCCESS = 1,
|
SUCCESS = 1,
|
||||||
FAIL = 2,
|
FAIL = 2,
|
||||||
TIMEOUT = 3,
|
TIMEOUT = 3,
|
||||||
ERRORDATA = 4
|
ERRORDATA = 4,
|
||||||
|
NOT_PART_IN_ERROR = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeviceCheckResult {
|
export interface DeviceCheckResult {
|
||||||
@@ -136,8 +151,8 @@ export namespace CheckData {
|
|||||||
|
|
||||||
export enum ButtonColorEnum {
|
export enum ButtonColorEnum {
|
||||||
INFO = '#909399',
|
INFO = '#909399',
|
||||||
LOADING = '#003078',
|
LOADING = 'var(--el-color-primary)',
|
||||||
SUCCESS = '#67c23a',
|
SUCCESS = '#91cc75',
|
||||||
WARNING = '#e6a23c',
|
WARNING = '#e6a23c',
|
||||||
DANGER = '#f56c6c',
|
DANGER = '#f56c6c',
|
||||||
}
|
}
|
||||||
@@ -147,7 +162,7 @@ export namespace CheckData {
|
|||||||
*/
|
*/
|
||||||
export interface ButtonResult {
|
export interface ButtonResult {
|
||||||
color: ButtonColorEnum
|
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'
|
type: 'info' | 'warning' | 'error'
|
||||||
log: string
|
log: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义手动检测时,勾选的测试项
|
||||||
|
*/
|
||||||
|
export interface SelectTestItem {
|
||||||
|
preTest: boolean,
|
||||||
|
timeTest: boolean,
|
||||||
|
channelsTest: boolean,
|
||||||
|
test: boolean
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import http from "@/api";
|
import http from "@/api";
|
||||||
import {CheckData} from "@/api/check/interface";
|
import {CheckData} from "@/api/check/interface";
|
||||||
|
|
||||||
export const getBigTestItem = (planId: string) => {
|
export const getBigTestItem = (params: {
|
||||||
return http.get(`/adPlan/getBigTestItem?planId=${planId}`, {loading: false});
|
reCheckType: number,
|
||||||
|
planId: string,
|
||||||
|
devIds: string[],
|
||||||
|
}) => {
|
||||||
|
return http.post(`/adPlan/getBigTestItem`, params, {loading: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,13 +27,13 @@ export const getFormData = (params: {
|
|||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const getTreeData = (params: {
|
export const getTreeData = (params: {
|
||||||
scriptId: string,
|
scriptId?: string,
|
||||||
devId: string,
|
devId?: string,
|
||||||
devNum: string,
|
devNum?: string,
|
||||||
scriptType: string | null,
|
scriptType?: string | null,
|
||||||
code: number,
|
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,
|
scriptId: string,
|
||||||
devId: string,
|
devId: string,
|
||||||
devNum: string,
|
devNum: string,
|
||||||
code: number,
|
code: string,
|
||||||
index: number,
|
index: number,
|
||||||
}) => {
|
}) => {
|
||||||
return http.post("/result/resultData/", params, {loading: false});
|
return http.post("/result/resultData/", params, {loading: false});
|
||||||
@@ -52,8 +56,44 @@ export const exportRawData = (params: {
|
|||||||
scriptId: string,
|
scriptId: string,
|
||||||
devId: string,
|
devId: string,
|
||||||
devNum: string,
|
devNum: string,
|
||||||
code: number,
|
code: string,
|
||||||
index: number,
|
index: number,
|
||||||
}) => {
|
}) => {
|
||||||
return http.download("/result/exportRawData", params, {loading: false});
|
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,4 @@
|
|||||||
import type { Device } from '@/api/device/interface/device'
|
import type {Device} from '@/api/device/interface/device'
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,39 +25,42 @@ 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 importPqDev=(params: Device.ReqPqDevParams)=>{
|
export const downloadTemplate = () => {
|
||||||
// return http.upload(`/pqDev/import`, params)
|
return http.download(`/pqDev/downloadTemplate`)
|
||||||
// }
|
|
||||||
// //导入比对式被检设备
|
|
||||||
// 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 = () => {
|
export const importPqDev = (params: Device.ReqPqDevParams) => {
|
||||||
return http.download(`/pqDev/downloadCNDevTemplate`)
|
return http.uploadExcel(`/pqDev/import`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
//导入灿能二楼设备
|
//导入比对式被检设备
|
||||||
export const importCNDev = (params: Device.ReqPqDevParams) => {
|
export const importContrastPqDev = (params: Device.ReqPqDevParams) => {
|
||||||
return http.uploadExcel(`/pqDev/importCNDev`, params)
|
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)
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
//根据设备类型决定(电源、icd、模板、通道数、额定电压、额定电流);
|
//根据设备类型决定(电源、icd、模板、通道数、额定电压、额定电流);
|
||||||
export const getPqDev = () => {
|
export const getPqDev = () => {
|
||||||
return http.get(`/devType/listAll`)
|
return http.get(`/devType/listAll`)
|
||||||
}
|
}
|
||||||
|
|
||||||
//被检设备归档
|
|
||||||
export const documentedPqDev = (ids: string[]) => {
|
|
||||||
return http.post(`/pqDev/documented`, ids)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -30,5 +30,7 @@ export const deletePqErrSys = (params: string[]) => {
|
|||||||
return http.post(`/pqErrSys/delete`, params)
|
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,4 +1,4 @@
|
|||||||
import type { ReqPage,ResPage } from '@/api/interface'
|
import type {ReqPage, ResPage} from '@/api/interface'
|
||||||
|
|
||||||
// 被检设备模块
|
// 被检设备模块
|
||||||
export namespace Device {
|
export namespace Device {
|
||||||
@@ -6,20 +6,23 @@ export namespace Device {
|
|||||||
/**
|
/**
|
||||||
* 被检设备表格分页查询参数
|
* 被检设备表格分页查询参数
|
||||||
*/
|
*/
|
||||||
export interface ReqPqDevParams extends ReqPage{
|
export interface ReqPqDevParams extends ReqPage {
|
||||||
id: string; // 装置序号id 必填
|
id: string; // 装置序号id 必填
|
||||||
name: string; //设备名称
|
name: string; //设备名称
|
||||||
devType?: string; // 设备名称
|
devType?: string; // 设备名称
|
||||||
createTime?:string; //创建时间
|
createTime?: string; //创建时间
|
||||||
pattern:string;
|
pattern: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 被检设备表格分页查询参数
|
* 被检设备表格分页查询参数
|
||||||
*/
|
*/
|
||||||
export interface ReqDevReportParams extends ReqPage{
|
export interface ReqDevReportParams extends ReqPage {
|
||||||
planId?:string; // 计划id
|
planId?: string; // 计划id
|
||||||
devId?:string; // 装置id
|
devId?: string; // 装置id
|
||||||
|
scriptId?: string; // 脚本id
|
||||||
|
planCode?: string;
|
||||||
|
devIdList?: string[]; // 装置id列表
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,54 +41,57 @@ export namespace Device {
|
|||||||
createId: string; //出厂编号
|
createId: string; //出厂编号
|
||||||
hardwareVersion: string; //固件版本
|
hardwareVersion: string; //固件版本
|
||||||
softwareVersion: string; //软件版本
|
softwareVersion: string; //软件版本
|
||||||
protocol:string; //通讯协议
|
protocol: string; //通讯协议
|
||||||
ip: string; //IP地址
|
ip: string; //IP地址
|
||||||
port: number; //端口号
|
port: number; //端口号
|
||||||
encryptionFlag: number; //装置是否为加密版本
|
encryptionFlag: number; //装置是否为加密版本
|
||||||
series?: string| null; //装置识别码(3ds加密)
|
series?: string | null; //装置识别码(3ds加密)
|
||||||
devKey?: string| null; //装置秘钥(3ds加密)
|
devKey?: string | null; //装置秘钥(3ds加密)
|
||||||
sampleID?: string| null; //样品编号
|
sampleId?: string | null; //样品编号
|
||||||
arrivedDate?: string; //送样日期
|
arrivedDate?: string; //送样日期
|
||||||
cityName?: string| null; //所属地市名称
|
cityName?: string | null; //所属地市名称
|
||||||
gDName?: string| null; //所属供电公司名称
|
gDName?: string | null; //所属供电公司名称
|
||||||
subName?: string| null; //所属电站名称
|
subName?: string | null; //所属电站名称
|
||||||
checkState?: number| null; //检测状态
|
checkState?: number | null; //检测状态
|
||||||
checkResult?: number| null; //检测结果
|
checkResult?: number | null; //检测结果
|
||||||
reportState?: number| null; //报告状态
|
reportState?: number | null; //报告状态
|
||||||
reportPath?: string| null; //报告路径
|
reportPath?: string | null; //报告路径
|
||||||
qRCode?: string| null; //设备关键信息二维码
|
qRCode?: string | null; //设备关键信息二维码
|
||||||
reCheckNum: number; //复检次数
|
reCheckNum: number; //复检次数
|
||||||
planId?:string;//检测计划Id
|
planId?: string;//检测计划Id
|
||||||
timeCheckResult?:number;//守时检测结果(0:不符合1:符合)
|
timeCheckResult?: number;//守时检测结果(0:不符合1:符合)
|
||||||
factorFlag?:number;//是否支持系数校准(0:不支持,1:支持)
|
factorFlag?: number;//是否支持系数校准(0:不支持,1:支持)
|
||||||
factorCheckResult?: number;//系数校准结果(0:不合格,1:合格,2:/表示没有做系数校准)
|
factorCheckResult?: number;//系数校准结果(0:不合格,1:合格,2:/表示没有做系数校准)
|
||||||
state: number; //状态
|
state: number; //状态
|
||||||
createBy?: string| null; //创建用户
|
createBy?: string | null; //创建用户
|
||||||
createTime?: string| null; //创建时间
|
createTime?: string | null; //创建时间
|
||||||
updateBy?: string| null; //更新用户
|
updateBy?: string | null; //更新用户
|
||||||
updateTime?: string| null; //更新时间
|
updateTime?: string | null; //更新时间
|
||||||
icdId: string| null;
|
icdId: string | null;
|
||||||
power: string| null;//工作电源
|
power: string | null;//工作电源
|
||||||
preinvestmentPlan: string| null;
|
preinvestmentPlan: string | null;
|
||||||
|
delegate: string | null; //委托方
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface ResDev{
|
export interface ResDev {
|
||||||
id: string;
|
id: string;
|
||||||
name: string ,
|
name: string,
|
||||||
icd:string ,
|
icd: string,
|
||||||
power:string,
|
power: string,
|
||||||
devVolt:number,
|
devVolt: number,
|
||||||
devCurr:number,
|
devCurr: number,
|
||||||
devChns:number,
|
devChns: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ResTH {
|
||||||
|
temperature :number | null;//温度
|
||||||
|
humidity:number | null;//湿度
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 被检设备表格查询分页返回的对象;
|
* 被检设备表格查询分页返回的对象;
|
||||||
*/
|
*/
|
||||||
export interface ResPqDevPage extends ResPage<ResPqDev> {
|
export interface ResPqDevPage extends ResPage<ResPqDev> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,9 @@ export namespace ErrorSystem {
|
|||||||
endFlag?:number;//是否包含结束值
|
endFlag?:number;//是否包含结束值
|
||||||
conditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值)
|
conditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值)
|
||||||
maxErrorValue:number;//误差最大值
|
maxErrorValue:number;//误差最大值
|
||||||
errorValueType:string;//误差值类型(包括值类型,绝对值、相对值1、相对值2)
|
errorValueType:any;//误差值类型(0标称值、1标准值、2值类型)
|
||||||
|
valueType:number;//值类型(1绝对值、2相对值)
|
||||||
|
errorUnit:string;//误差单位
|
||||||
}
|
}
|
||||||
|
|
||||||
//查看详细误差体系
|
//查看详细误差体系
|
||||||
|
|||||||
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> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,38 +2,37 @@ import type { ReqPage, ResPage } from '@/api/interface'
|
|||||||
|
|
||||||
// 检测脚本模块
|
// 检测脚本模块
|
||||||
export namespace TestScript {
|
export namespace TestScript {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测脚本表格分页查询参数
|
* 检测脚本表格分页查询参数
|
||||||
*/
|
*/
|
||||||
export interface ReqTestScriptParams extends ReqPage{
|
export interface ReqTestScriptParams extends ReqPage {
|
||||||
id: string; // 装置序号id 必填
|
id: string // 装置序号id 必填
|
||||||
name: string;
|
name: string
|
||||||
type: string;
|
type: string
|
||||||
pattern:string;
|
pattern: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测脚本接口
|
// 检测脚本接口
|
||||||
export interface ResTestScript {
|
export interface ResTestScript {
|
||||||
id?: string; //检测脚本ID
|
id?: string //检测脚本ID
|
||||||
name: string; //检测脚本名称
|
name: string //检测脚本名称
|
||||||
type: string; //设定0为脚本,1为模板
|
type: string //设定0为脚本,1为模板
|
||||||
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
pattern: string //检测脚本模式(字典表Code字段,数字、模拟、比对)
|
||||||
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
valueType?: string //脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||||
standardName: string;//参照标准名称
|
standardName: string //参照标准名称
|
||||||
standardTime: string;//标准推行时间
|
standardTime: string //标准推行时间
|
||||||
state:number;//
|
state?: number //
|
||||||
createBy?: string;
|
createBy?: string
|
||||||
createTime?: string;
|
createTime?: string
|
||||||
updateBy?: string;
|
updateBy?: string
|
||||||
updateTime?: string;
|
updateTime?: string
|
||||||
|
selectedValue?: string
|
||||||
|
ratedCurr?: number
|
||||||
|
ratedVolt?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测脚本查询分页返回的对象;
|
* 检测脚本查询分页返回的对象;
|
||||||
*/
|
*/
|
||||||
export interface ResTestScriptPage extends ResPage<ResTestScript> {
|
export interface ResTestScriptPage extends ResPage<ResTestScript> {}
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
46
frontend/src/api/device/report/index.ts
Normal file
46
frontend/src/api/device/report/index.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
@@ -1,15 +1,23 @@
|
|||||||
import type { TestScript } from '@/api/device/interface/testScript'
|
import type { TestScript } from '@/api/device/interface/testScript'
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
|
import { Loading } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name 检测脚本管理模块
|
* @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) => {
|
export const getPqScriptList = (params: TestScript.ReqTestScriptParams) => {
|
||||||
return http.post(`/pqScript/list`, params)
|
return http.post(`/pqScript/list`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//升级为模版
|
//升级为模版
|
||||||
export const updatePqScript = (params: TestScript.ResTestScript) => {
|
export const updatePqScript = (params: TestScript.ResTestScript) => {
|
||||||
return http.get(`/pqScript/upgradeToTemplate?id=${params.id}`)
|
return http.get(`/pqScript/upgradeToTemplate?id=${params.id}`)
|
||||||
@@ -19,3 +27,27 @@ export const updatePqScript = (params: TestScript.ResTestScript) => {
|
|||||||
export const deletePqScript = (params: string[]) => {
|
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) => {
|
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(
|
this.service.interceptors.request.use(
|
||||||
(config: CustomAxiosRequestConfig) => {
|
(config: CustomAxiosRequestConfig) => {
|
||||||
|
isFirst = true
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制
|
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制
|
||||||
config.loading ?? (config.loading = true)
|
config.loading ?? (config.loading = true)
|
||||||
config.loading && showFullScreenLoading()
|
config.loading && showFullScreenLoading()
|
||||||
if (config.headers && typeof config.headers.set === 'function') {
|
if (config.headers && typeof config.headers.set === 'function') {
|
||||||
config.headers.set('Authorization', 'Bearer ' + userStore.accessToken)
|
config.headers.set('Authorization', 'Bearer ' + userStore.accessToken)
|
||||||
config.headers.set('Refresh-Token', userStore.refreshToken)
|
config.headers.set('Is-Refresh-Token', userStore.isRefreshToken+"")
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
@@ -67,11 +68,15 @@ class RequestHttp {
|
|||||||
|
|
||||||
if(data.code === ResultEnum.ACCESSTOKEN_EXPIRED){
|
if(data.code === ResultEnum.ACCESSTOKEN_EXPIRED){
|
||||||
// 用长token去换短token
|
// 用长token去换短token
|
||||||
|
userStore.setAccessToken(userStore.refreshToken)
|
||||||
|
userStore.setIsRefreshToken(true)
|
||||||
const result = await refreshToken()
|
const result = await refreshToken()
|
||||||
if (result) { //获取新token成功的话
|
if (result) { //获取新token成功的话
|
||||||
// 有新的token后,重新请求
|
// 有新的token后,重新请求
|
||||||
userStore.setAccessToken(result.data.accessToken)
|
userStore.setAccessToken(result.data.accessToken)
|
||||||
userStore.setRefreshToken(result.data.refreshToken)
|
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,不然会死循环
|
response.config.headers.Authorization = `Bearer ${result.data.accessToken}`//重新请求前需要将更新后的新token更换掉之前无效的token,不然会死循环
|
||||||
const resp = await this.service.request(response.config)
|
const resp = await this.service.request(response.config)
|
||||||
return resp
|
return resp
|
||||||
@@ -80,15 +85,15 @@ class RequestHttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 登陆失效
|
// 登陆失效
|
||||||
if (data.code == ResultEnum.OVERDUE) {
|
if (data.code === ResultEnum.OVERDUE) {
|
||||||
console.log("登陆失效")
|
console.log("登陆失效")
|
||||||
userStore.setAccessToken('')
|
userStore.setAccessToken('')
|
||||||
userStore.setRefreshToken('')
|
userStore.setRefreshToken('')
|
||||||
userStore.setUserInfo({ name: '' })
|
userStore.setIsRefreshToken(false)
|
||||||
router.replace(LOGIN_URL)
|
userStore.setUserInfo({ id:'',name: '' })
|
||||||
if(data.code != ResultEnum.OVERDUE){//临时处理token失效弹窗多次
|
userStore.setExp(0)
|
||||||
ElMessage.error(data.message)
|
await router.replace(LOGIN_URL)
|
||||||
}else if(isFirst){
|
if(isFirst){//临时处理token失效弹窗多次
|
||||||
ElMessage.error(data.message)
|
ElMessage.error(data.message)
|
||||||
isFirst = false
|
isFirst = false
|
||||||
}
|
}
|
||||||
@@ -97,14 +102,29 @@ class RequestHttp {
|
|||||||
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
||||||
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
||||||
if(data.message.includes('&')){
|
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 });
|
ElMessage.error({ message: formattedMessage, dangerouslyUseHTMLString: true });
|
||||||
return Promise.reject(data)
|
return Promise.reject(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
ElMessage.error(data.message)
|
ElMessage.error(data.message)
|
||||||
return Promise.reject(data)
|
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
|
return data
|
||||||
},
|
},
|
||||||
async (error: AxiosError) => {
|
async (error: AxiosError) => {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export namespace Plan {
|
|||||||
export interface ResPlan {
|
export interface ResPlan {
|
||||||
id: string; //检测计划ID
|
id: string; //检测计划ID
|
||||||
name: string; //检测计划名称
|
name: string; //检测计划名称
|
||||||
pattern: string; //模式,字典表(数字、模拟、比对)
|
pattern?: string; //模式,字典表(数字、模拟、比对)
|
||||||
fatherPlanId?: string; //父计划ID
|
fatherPlanId?: string; //父计划ID
|
||||||
dataSourceId: string; //数据源ID
|
dataSourceId: string; //数据源ID
|
||||||
scriptId: string; //检测脚本ID
|
scriptId: string; //检测脚本ID
|
||||||
@@ -22,6 +22,11 @@ export namespace Plan {
|
|||||||
createTime?:string; //创建时间
|
createTime?:string; //创建时间
|
||||||
updateBy?:string; //更新用户
|
updateBy?:string; //更新用户
|
||||||
updateTime?:string; //更新时间
|
updateTime?:string; //更新时间
|
||||||
|
|
||||||
|
associateReport:number;//是否关联报告模板 0否 1是
|
||||||
|
reportTemplateName:string;
|
||||||
|
reportTemplateVersion:string;
|
||||||
|
dataRule:string //数据处理原则
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测计划 + 分页
|
// 检测计划 + 分页
|
||||||
|
|||||||
@@ -68,12 +68,12 @@ export const exportPlan = (params: Device.ReqPqDevParams) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 下载模板
|
// 下载模板
|
||||||
export const downloadTemplate = () => {
|
export const downloadTemplate = (params: { patternId: string }) => {
|
||||||
return http.download(`/adPlan/downloadTemplate`)
|
return http.download(`/adPlan/downloadTemplate`, params)
|
||||||
}
|
}
|
||||||
// 导入检测计划
|
// 导入检测计划
|
||||||
export const importPlan = (params: Device.ReqPqDevParams) => {
|
export const importPlan = (params: Device.ReqPqDevParams) => {
|
||||||
return http.upload(`/adPlan/import`, params)
|
return http.uploadExcel(`/adPlan/import`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 装置检测报告生成
|
// 装置检测报告生成
|
||||||
@@ -85,3 +85,8 @@ export const generateDevReport = (params: Device.ReqDevReportParams) => {
|
|||||||
export const downloadDevData = (params: Device.ReqDevReportParams) => {
|
export const downloadDevData = (params: Device.ReqDevReportParams) => {
|
||||||
return http.download(`/report/downloadReport`, params)
|
return http.download(`/report/downloadReport`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const staticsAnalyse = (params: { id: string[] }) => {
|
||||||
|
return http.download('/adPlan/analyse', params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ export const closePreTest = (params) => {
|
|||||||
* 开始正式检测
|
* 开始正式检测
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const startTest = (params) => {
|
// export const startTest = (params) => {
|
||||||
return http.post(`/prepare/startTest`, params, {loading: false})
|
// return http.post(`/prepare/startTest`, params, {loading: false})
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 暂停正式检测
|
* 暂停正式检测
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ export namespace Base {
|
|||||||
id: string; //系统配置表Id
|
id: string; //系统配置表Id
|
||||||
autoGenerate:number;//检测报告是否自动生成0 否;1是
|
autoGenerate:number;//检测报告是否自动生成0 否;1是
|
||||||
maxTime:number;//最大复检次数,默认3次
|
maxTime:number;//最大复检次数,默认3次
|
||||||
dataRule:string;//数据处理原则,关联字典(所有值、部分值、cp95值、平均值、任意值),默认任意值
|
|
||||||
state: number; //状态
|
state: number; //状态
|
||||||
createBy?: string| null; //创建用户
|
createBy?: string| null; //创建用户
|
||||||
createTime?: string| null; //创建时间
|
createTime?: string| null; //创建时间
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
import { type Dict } from '@/api/system/dictionary/interface'
|
import { type Dict } from '@/api/system/dictionary/interface'
|
||||||
|
import { c } from 'vite/dist/node/types.d-aGj9QkWt'
|
||||||
|
|
||||||
//获取字典类型
|
//获取字典类型
|
||||||
export const getDictTreeList = (params: Dict.ResDictTree) => {
|
export const getDictTreeByCode = (params: Dict.ResDictTree) => {
|
||||||
const name = params.name || '';
|
const code = params.code || ''
|
||||||
return http.get(`/dictTree/getTree?keyword=${name}`, params)
|
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) => {
|
export const deleteDictTree = (params: Dict.ResDictTree) => {
|
||||||
return http.post(`/dictTree/delete?id=${params.id}`)
|
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 @@
|
|||||||
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
// 审计日志管理模块
|
// 审计日志管理模块
|
||||||
export namespace Sys_Log_Audit {
|
export namespace AuditLog {
|
||||||
// 日志列表
|
|
||||||
export interface Audit_LogList {
|
/**
|
||||||
id: string;//日志表Id
|
* 设备类型数据表格分页查询参数
|
||||||
operate_Type:string;//日志类型
|
*/
|
||||||
|
export interface ReqAuditLogParams extends ReqPage {
|
||||||
|
id: string; //审计日志Id 必填
|
||||||
|
createTime?: string; //创建时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResAuditLog {
|
||||||
|
id: string;//审计日志Id
|
||||||
|
operate_Type:string;//操作类型
|
||||||
ip:string;//操作IP
|
ip:string;//操作IP
|
||||||
result: string;//事件结果
|
result: string;//事件结果
|
||||||
remark: string;//事件描述
|
remark: string;//事件描述
|
||||||
|
level:number;//告警等级
|
||||||
warn:number;//告警标志
|
warn:number;//告警标志
|
||||||
create_By:string;//创建用户
|
create_By:string;//创建用户
|
||||||
create_Time:string;//创建时间
|
create_Time:string;//创建时间
|
||||||
|
sort:number;//排序
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResAuditLogPage extends ResPage<ResAuditLog> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -5,11 +5,13 @@ export namespace Login {
|
|||||||
export interface ReqLoginForm {
|
export interface ReqLoginForm {
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
|
checked: boolean;
|
||||||
}
|
}
|
||||||
export interface ResLogin {
|
export interface ResLogin {
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
refreshToken: string;
|
refreshToken: string;
|
||||||
userInfo:{
|
userInfo:{
|
||||||
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,24 @@
|
|||||||
import type { Login } from '@/api/user/interface/user'
|
import type {Login} from '@/api/user/interface/user'
|
||||||
import { ADMIN as rePrefix } from '@/api/system/config/serviceName'
|
import {ADMIN as rePrefix} from '@/api/system/config/serviceName'
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
import type { Dict } from '@/api/interface'
|
import type {Dict} from '@/api/interface'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name 登录模块
|
* @name 登录模块
|
||||||
*/
|
*/
|
||||||
// 用户登录
|
// 用户登录
|
||||||
export const loginApi = (params: Login.ReqLoginForm) => {
|
export const loginApi = (params: { username: string; password: string}) => {
|
||||||
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false })
|
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, {loading: false})
|
||||||
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
||||||
}
|
}
|
||||||
// 获取菜单列表
|
// 获取菜单列表
|
||||||
export const getAuthMenuListApi = () => {
|
export const getAuthMenuListApi = () => {
|
||||||
return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, { loading: false })
|
return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, {loading: false})
|
||||||
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
||||||
}
|
}
|
||||||
// 获取按钮权限
|
// 获取按钮权限
|
||||||
export const getAuthButtonListApi = () => {
|
export const getAuthButtonListApi = () => {
|
||||||
return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, { loading: false })
|
return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, {loading: false})
|
||||||
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
||||||
}
|
}
|
||||||
// 用户退出登录
|
// 用户退出登录
|
||||||
@@ -26,7 +27,7 @@ export const logoutApi = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取下拉框列表
|
//获取下拉框列表
|
||||||
export const getDictList = () =>{
|
export const getDictList = () => {
|
||||||
return http.get<Dict>('/dictData/dictDataCache')
|
return http.get<Dict>('/dictData/dictDataCache')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +35,25 @@ export const getDictList = () =>{
|
|||||||
export const refreshToken = () => {
|
export const refreshToken = () => {
|
||||||
return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`,
|
return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`,
|
||||||
{},
|
{},
|
||||||
{ loading: false }
|
{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})
|
||||||
|
}
|
||||||
|
|||||||
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 |
@@ -77,7 +77,7 @@ const acceptParams = (params: ExcelParameterProps) => {
|
|||||||
// Excel 导入模板下载
|
// Excel 导入模板下载
|
||||||
const downloadTemp = () => {
|
const downloadTemp = () => {
|
||||||
if (!parameter.value.tempApi) return
|
if (!parameter.value.tempApi) return
|
||||||
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, {}, false)
|
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, {'patternId':parameter.value.patternId}, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文件上传
|
// 文件上传
|
||||||
@@ -97,6 +97,8 @@ const uploadExcel = async (param: UploadRequestOptions) => {
|
|||||||
|
|
||||||
|
|
||||||
async function handleImportResponse(res: any) {
|
async function handleImportResponse(res: any) {
|
||||||
|
console.log(res)
|
||||||
|
|
||||||
if (res.type === 'application/json') {
|
if (res.type === 'application/json') {
|
||||||
const fileReader = new FileReader()
|
const fileReader = new FileReader()
|
||||||
fileReader.onloadend = () => {
|
fileReader.onloadend = () => {
|
||||||
@@ -118,7 +120,7 @@ async function handleImportResponse(res: any) {
|
|||||||
const url = window.URL.createObjectURL(blob)
|
const url = window.URL.createObjectURL(blob)
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
link.href = url
|
link.href = url
|
||||||
link.download = '终端入网检测失败列表'
|
link.download = '导入失败数据'
|
||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click()
|
link.click()
|
||||||
link.remove()
|
link.remove()
|
||||||
|
|||||||
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 = "/home/index";
|
||||||
|
|
||||||
|
// export const HOME_URL: string = "/machine/controlSource";
|
||||||
|
|
||||||
// 登录页地址(默认)
|
// 登录页地址(默认)
|
||||||
export const LOGIN_URL: string = "/login";
|
export const LOGIN_URL: string = "/login";
|
||||||
|
|
||||||
// 默认主题颜色
|
// 默认主题颜色
|
||||||
export const DEFAULT_PRIMARY: string = "#003078";
|
export const DEFAULT_PRIMARY: string = "#526ADE";
|
||||||
|
|
||||||
// 路由白名单地址(本地存在的路由 staticRouter.ts 中)
|
// 路由白名单地址(本地存在的路由 staticRouter.ts 中)
|
||||||
export const ROUTER_WHITE_LIST: string[] = ["/500"];
|
export const ROUTER_WHITE_LIST: string[] = ["/500"];
|
||||||
@@ -17,3 +19,5 @@ export const AMAP_MAP_KEY: string = "";
|
|||||||
|
|
||||||
// 百度地图 key
|
// 百度地图 key
|
||||||
export const BAIDU_MAP_KEY: string = "";
|
export const BAIDU_MAP_KEY: string = "";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
export enum ResultEnum {
|
export enum ResultEnum {
|
||||||
SUCCESS = "A0000",
|
SUCCESS = "A0000",
|
||||||
ERROR = 500,
|
ERROR = 500,
|
||||||
ACCESSTOKEN_EXPIRED = 401,
|
ACCESSTOKEN_EXPIRED = "A0024",
|
||||||
OVERDUE = 4001,
|
OVERDUE = "A0025",
|
||||||
TIMEOUT = 30000,
|
TIMEOUT = 30000,
|
||||||
TYPE = "success"
|
TYPE = "success"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export const useTheme = () => {
|
|||||||
|
|
||||||
// 修改主题颜色
|
// 修改主题颜色
|
||||||
const changePrimary = (val: string | null) => {
|
const changePrimary = (val: string | null) => {
|
||||||
|
|
||||||
if (!val) {
|
if (!val) {
|
||||||
val = DEFAULT_PRIMARY;
|
val = DEFAULT_PRIMARY;
|
||||||
ElMessage({ type: "success", message: `主题颜色已重置为 ${DEFAULT_PRIMARY}` });
|
ElMessage({ type: "success", message: `主题颜色已重置为 ${DEFAULT_PRIMARY}` });
|
||||||
@@ -40,10 +41,13 @@ export const useTheme = () => {
|
|||||||
for (let i = 1; i <= 9; i++) {
|
for (let i = 1; i <= 9; i++) {
|
||||||
const primaryColor = isDark.value ? `${getDarkColor(val, i / 10)}` : `${getLightColor(val, i / 10)}`;
|
const primaryColor = isDark.value ? `${getDarkColor(val, i / 10)}` : `${getLightColor(val, i / 10)}`;
|
||||||
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, primaryColor);
|
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);
|
globalStore.setGlobalState("primary", val);
|
||||||
};
|
|
||||||
|
|
||||||
|
}
|
||||||
// 灰色和弱色切换
|
// 灰色和弱色切换
|
||||||
const changeGreyOrWeak = (type: Theme.GreyOrWeakType, value: boolean) => {
|
const changeGreyOrWeak = (type: Theme.GreyOrWeakType, value: boolean) => {
|
||||||
const body = document.body as HTMLElement;
|
const body = document.body as HTMLElement;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export default {
|
|||||||
changePassword: "Change Password",
|
changePassword: "Change Password",
|
||||||
changeMode:"Change Mode",
|
changeMode:"Change Mode",
|
||||||
versionRegister:"Version Register",
|
versionRegister:"Version Register",
|
||||||
|
changeTheme: "Change Theme",
|
||||||
logout: "Logout"
|
logout: "Logout"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export default {
|
|||||||
changePassword: "修改密码",
|
changePassword: "修改密码",
|
||||||
changeMode:"模式切换",
|
changeMode:"模式切换",
|
||||||
versionRegister:"版本注册",
|
versionRegister:"版本注册",
|
||||||
|
changeTheme:"主题切换",
|
||||||
logout: "退出登录"
|
logout: "退出登录"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,7 +39,9 @@
|
|||||||
}
|
}
|
||||||
.el-menu-item:hover {
|
.el-menu-item:hover {
|
||||||
color: #fff; //一级导航划过颜色
|
color: #fff; //一级导航划过颜色
|
||||||
background-color: #5274a5 !important; //一级导航划过背景色
|
//background-color: #5274a5 !important; //一级导航划过背景色
|
||||||
|
background-color:var(--el-color-primary-light-3) !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
.el-sub-menu__hide-arrow {
|
.el-sub-menu__hide-arrow {
|
||||||
width: 65px;
|
width: 65px;
|
||||||
@@ -47,7 +49,9 @@
|
|||||||
}
|
}
|
||||||
.el-menu-item.is-active {
|
.el-menu-item.is-active {
|
||||||
color: #fff !important; //一级导航文字选中颜色
|
color: #fff !important; //一级导航文字选中颜色
|
||||||
background-color: #5274a5 !important; //一级导航选中背景色
|
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||||
|
background-color: var(--el-color-primary-light-3) !important;
|
||||||
|
|
||||||
border-bottom: 0 !important;
|
border-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
.el-sub-menu__title {
|
.el-sub-menu__title {
|
||||||
@@ -67,7 +71,9 @@
|
|||||||
color: #fff !important; //二级导航文字选中颜色
|
color: #fff !important; //二级导航文字选中颜色
|
||||||
// background-color: var(--el-color-primary) !important;
|
// background-color: var(--el-color-primary) !important;
|
||||||
// background-color: #5274a5 !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;
|
border-bottom-color: var(--el-color-primary) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,12 @@
|
|||||||
>数字式模块</el-dropdown-item
|
>数字式模块</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item @click="handelOpen('比对式')"
|
<el-dropdown-item @click="handelOpen('比对式')"
|
||||||
>比对式模块</el-dropdown-item
|
disabled>比对式模块</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<p style="margin: 0;">
|
<p style="margin: 0;" >
|
||||||
<a href="http://www.shining-electric.com/" target="_blank">
|
<a href="http://www.shining-electric.com/" target="_blank">
|
||||||
2024 © 南京灿能电力自动化股份有限公司
|
2024 © 南京灿能电力自动化股份有限公司
|
||||||
</a>
|
</a>
|
||||||
@@ -42,25 +42,12 @@ import { ref, reactive, computed, onMounted, watch } from "vue";
|
|||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from "@/stores/modules/auth";
|
||||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
const title = ref("模拟式模块");
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const modeStore = useModeStore();
|
const modeStore = useModeStore();
|
||||||
|
|
||||||
onMounted(() => {
|
const title = computed(() => {
|
||||||
switch (modeStore.currentMode) {
|
return modeStore.currentMode=== ''? '模拟式模块' : modeStore.currentMode+'模块';
|
||||||
case '模拟式':
|
|
||||||
title.value = '模拟式模块';
|
|
||||||
break;
|
|
||||||
case '数字式':
|
|
||||||
title.value = '数字式模块';
|
|
||||||
break;
|
|
||||||
case '比对式':
|
|
||||||
title.value = '比对式模块';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
title.value = '模拟式模块';
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const handelOpen = async (item: string) => {
|
const handelOpen = async (item: string) => {
|
||||||
@@ -117,10 +104,11 @@ const handelOpen = async (item: string) => {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
text-align: center;
|
text-align: right;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
a {
|
a {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
margin-right: 25px; // 增加右边距
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<!-- <div class="userInfo">-->
|
||||||
|
<!-- <div class="icon">-->
|
||||||
|
<!-- <Avatar/>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div class="username">-->
|
||||||
|
<!-- {{ username }}-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<div class="userInfo">
|
<div class="userInfo">
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
@@ -10,17 +18,20 @@
|
|||||||
</div>
|
</div>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<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-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>
|
||||||
<el-dropdown-item @click="openDialog('passwordRef')">
|
<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>
|
||||||
<el-dropdown-item @click="changeMode">
|
<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>
|
||||||
<el-dropdown-item @click="openDialog('versionRegisterRef')">
|
<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-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
@@ -34,6 +45,9 @@
|
|||||||
<PasswordDialog ref="passwordRef"></PasswordDialog>
|
<PasswordDialog ref="passwordRef"></PasswordDialog>
|
||||||
<!-- versionRegisterDialog -->
|
<!-- versionRegisterDialog -->
|
||||||
<VersionDialog ref="versionRegisterRef"></VersionDialog>
|
<VersionDialog ref="versionRegisterRef"></VersionDialog>
|
||||||
|
<!-- ThemeDialog -->
|
||||||
|
<ThemeDialog ref="themeRef"></ThemeDialog>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -42,12 +56,13 @@ import { LOGIN_URL } from "@/config";
|
|||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { logoutApi } from "@/api/user/login";
|
import { logoutApi } from "@/api/user/login";
|
||||||
import { useUserStore } from "@/stores/modules/user";
|
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 InfoDialog from "./InfoDialog.vue";
|
||||||
import PasswordDialog from "./PasswordDialog.vue";
|
import PasswordDialog from "./PasswordDialog.vue";
|
||||||
|
import ThemeDialog from "./ThemeDialog.vue";
|
||||||
import VersionDialog from "@/views/system/versionRegister/index.vue";
|
import VersionDialog from "@/views/system/versionRegister/index.vue";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import { Avatar } from "@element-plus/icons-vue";
|
import { Avatar, Delete, Document, Sunny, Switch } from "@element-plus/icons-vue";
|
||||||
import AssemblySize from "./components/AssemblySize.vue";
|
import AssemblySize from "./components/AssemblySize.vue";
|
||||||
import Language from "./components/Language.vue";
|
import Language from "./components/Language.vue";
|
||||||
import SearchMenu from "./components/SearchMenu.vue";
|
import SearchMenu from "./components/SearchMenu.vue";
|
||||||
@@ -64,6 +79,13 @@ const router = useRouter();
|
|||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const modeStore = useModeStore();
|
const modeStore = useModeStore();
|
||||||
const AppSceneStore = useAppSceneStore();
|
const AppSceneStore = useAppSceneStore();
|
||||||
|
import { useTheme } from "@/hooks/useTheme";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
const { changePrimary} = useTheme();
|
||||||
|
|
||||||
|
// 初始化 i18n
|
||||||
|
const { t } = useI18n(); // 使用 t 方法替代 $t
|
||||||
|
|
||||||
// 退出登录
|
// 退出登录
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
|
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
|
||||||
@@ -76,7 +98,9 @@ const logout = () => {
|
|||||||
// 2.清除 Token
|
// 2.清除 Token
|
||||||
userStore.setAccessToken("");
|
userStore.setAccessToken("");
|
||||||
userStore.setRefreshToken("");
|
userStore.setRefreshToken("");
|
||||||
userStore.setUserInfo({name: ""});
|
userStore.setExp(0)
|
||||||
|
userStore.setUserInfo({id: "", name: ""});
|
||||||
|
userStore.setIsRefreshToken(false)
|
||||||
dictStore.setDictData([]);
|
dictStore.setDictData([]);
|
||||||
modeStore.setCurrentMode('');
|
modeStore.setCurrentMode('');
|
||||||
AppSceneStore.setCurrentMode('');
|
AppSceneStore.setCurrentMode('');
|
||||||
@@ -92,12 +116,19 @@ const logout = () => {
|
|||||||
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
|
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
|
||||||
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
|
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
|
||||||
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null);
|
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null);
|
||||||
|
const themeRef = ref<InstanceType<typeof ThemeDialog> | null>(null);
|
||||||
const openDialog = (ref: string) => {
|
const openDialog = (ref: string) => {
|
||||||
if (ref == "infoRef") infoRef.value?.openDialog();
|
if (ref == "infoRef") infoRef.value?.openDialog();
|
||||||
if (ref == "passwordRef") passwordRef.value?.openDialog();
|
if (ref == "passwordRef") passwordRef.value?.openDialog();
|
||||||
if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog();
|
if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog();
|
||||||
|
if (ref == "themeRef") themeRef.value?.openDialog();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//模式切换
|
//模式切换
|
||||||
const changeMode = () => {
|
const changeMode = () => {
|
||||||
authStore.changeModel();
|
authStore.changeModel();
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|
||||||
@@ -33,14 +33,19 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
|||||||
// color: var(--el-menu-hover-text-color) !important;
|
// color: var(--el-menu-hover-text-color) !important;
|
||||||
// background-color: transparent !important;
|
// background-color: transparent !important;
|
||||||
color: #fff !important;//一级导航文字选中颜色
|
color: #fff !important;//一级导航文字选中颜色
|
||||||
background-color: #5274a5 !important; //一级导航选中背景色
|
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||||
|
|
||||||
|
background-color: var(--el-color-primary-light-3) !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
.el-menu--collapse {
|
.el-menu--collapse {
|
||||||
.is-active {
|
.is-active {
|
||||||
.el-sub-menu__title {
|
.el-sub-menu__title {
|
||||||
color: #ffffff !important;
|
color: #ffffff !important;
|
||||||
// background-color: var(--el-color-primary) !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;
|
border-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,7 +58,9 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
|||||||
// color: var(--el-menu-active-color) !important;
|
// color: var(--el-menu-active-color) !important;
|
||||||
// background-color: var(--el-menu-active-bg-color) !important;
|
// background-color: var(--el-menu-active-bg-color) !important;
|
||||||
color: #fff !important;//一级导航文字选中颜色
|
color: #fff !important;//一级导航文字选中颜色
|
||||||
background-color: #5274a5 !important; //一级导航选中背景色
|
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||||
|
background-color: var(--el-color-primary-light-3) !important;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class='tabs-box'>
|
<div class="tabs-box">
|
||||||
<div class='tabs-menu'>
|
<div class="tabs-menu">
|
||||||
<el-tabs v-model='tabsMenuValue' type='card' @tab-click='tabClick' @tab-remove='tabRemove'>
|
<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'
|
<el-tab-pane
|
||||||
:closable='item.close'>
|
v-for="item in tabsMenuList"
|
||||||
|
:key="item.path"
|
||||||
|
:label="item.title"
|
||||||
|
:name="item.path"
|
||||||
|
:closable="item.close"
|
||||||
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<el-icon v-show='item.icon && tabsIcon' class='tabs-icon'>
|
<el-icon v-show="item.icon && tabsIcon" class="tabs-icon">
|
||||||
<component :is='item.icon'></component>
|
<component :is="item.icon"></component>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
</template>
|
</template>
|
||||||
@@ -17,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='ts'>
|
<script setup lang="ts">
|
||||||
import Sortable from 'sortablejs'
|
import Sortable from 'sortablejs'
|
||||||
import { ref, computed, watch, onMounted } from 'vue'
|
import { ref, computed, watch, onMounted } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
@@ -42,15 +47,14 @@ onMounted(() => {
|
|||||||
initTabs()
|
initTabs()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 监听路由的变化(防止浏览器后退/前进不变化 tabsMenuValue)
|
// 监听路由的变化(防止浏览器后退/前进不变化 tabsMenuValue)
|
||||||
watch(
|
watch(
|
||||||
() => route.fullPath,
|
() => route.fullPath,
|
||||||
() => {
|
() => {
|
||||||
if (route.meta.isFull) return
|
if (route.meta.isFull) return
|
||||||
if (route.meta.hideTab){
|
if (route.meta.hideTab) {
|
||||||
tabsMenuValue.value = route.meta.parentPath as string
|
tabsMenuValue.value = route.meta.parentPath as string
|
||||||
}else{
|
} else {
|
||||||
tabsMenuValue.value = route.fullPath
|
tabsMenuValue.value = route.fullPath
|
||||||
const tabsParams = {
|
const tabsParams = {
|
||||||
icon: route.meta.icon as string,
|
icon: route.meta.icon as string,
|
||||||
@@ -58,12 +62,12 @@ watch(
|
|||||||
path: route.fullPath,
|
path: route.fullPath,
|
||||||
name: route.name as string,
|
name: route.name as string,
|
||||||
close: !route.meta.isAffix,
|
close: !route.meta.isAffix,
|
||||||
isKeepAlive: route.meta.isKeepAlive as boolean,
|
isKeepAlive: route.meta.isKeepAlive as boolean
|
||||||
}
|
}
|
||||||
tabStore.addTabs(tabsParams)
|
tabStore.addTabs(tabsParams)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
// 初始化需要固定的 tabs
|
// 初始化需要固定的 tabs
|
||||||
@@ -77,7 +81,7 @@ const initTabs = () => {
|
|||||||
name: item.name,
|
name: item.name,
|
||||||
close: !item.meta.isAffix,
|
close: !item.meta.isAffix,
|
||||||
isKeepAlive: item.meta.isKeepAlive,
|
isKeepAlive: item.meta.isKeepAlive,
|
||||||
unshift:true
|
unshift: true
|
||||||
}
|
}
|
||||||
tabStore.addTabs(tabsParams)
|
tabStore.addTabs(tabsParams)
|
||||||
}
|
}
|
||||||
@@ -94,7 +98,7 @@ const tabsDrop = () => {
|
|||||||
const currRow = tabsList.splice(oldIndex as number, 1)[0]
|
const currRow = tabsList.splice(oldIndex as number, 1)[0]
|
||||||
tabsList.splice(newIndex as number, 0, currRow)
|
tabsList.splice(newIndex as number, 0, currRow)
|
||||||
tabStore.setTabs(tabsList)
|
tabStore.setTabs(tabsList)
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,10 +111,12 @@ const tabClick = (tabItem: TabsPaneContext) => {
|
|||||||
|
|
||||||
// Remove Tab
|
// Remove Tab
|
||||||
const tabRemove = (fullPath: TabPaneName) => {
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped lang='scss'>
|
<style scoped lang="scss">
|
||||||
@import "./index.scss";
|
@import './index.scss';
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
.layout-light {
|
.layout-light {
|
||||||
background-color: var(--el-color-primary-light-5);
|
background-color: var(--el-color-primary-light-3);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
.layout-content {
|
.layout-content {
|
||||||
|
|||||||
@@ -65,5 +65,6 @@ const setupAll = async () => {
|
|||||||
|
|
||||||
//挂载app
|
//挂载app
|
||||||
setupAll().then(() => {
|
setupAll().then(() => {
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ const routerMode = {
|
|||||||
* @param meta.isKeepAlive ==> 当前路由是否缓存
|
* @param meta.isKeepAlive ==> 当前路由是否缓存
|
||||||
* */
|
* */
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
|
|
||||||
history: routerMode[mode](),
|
history: routerMode[mode](),
|
||||||
routes: [...staticRouter],
|
routes: [...staticRouter],
|
||||||
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
|
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
|
||||||
@@ -68,10 +69,9 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
await initDynamicRouter()
|
await initDynamicRouter()
|
||||||
return next({ ...to, replace: true })
|
return next({ ...to, replace: true })
|
||||||
}
|
}
|
||||||
//console.log(to)
|
|
||||||
// 7.存储 routerName 做按钮权限筛选
|
// 7.存储 routerName 做按钮权限筛选
|
||||||
authStore.setRouteName(to.name as string)
|
authStore.setRouteName(to.name as string)
|
||||||
|
|
||||||
// 8.正常访问页面
|
// 8.正常访问页面
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export const initDynamicRouter = async () => {
|
|||||||
});
|
});
|
||||||
userStore.setAccessToken("");
|
userStore.setAccessToken("");
|
||||||
userStore.setRefreshToken("");
|
userStore.setRefreshToken("");
|
||||||
|
userStore.setExp(0)
|
||||||
router.replace(LOGIN_URL);
|
router.replace(LOGIN_URL);
|
||||||
return Promise.reject("No permission");
|
return Promise.reject("No permission");
|
||||||
}
|
}
|
||||||
@@ -41,6 +42,7 @@ export const initDynamicRouter = async () => {
|
|||||||
if (item.component && typeof item.component == "string") {
|
if (item.component && typeof item.component == "string") {
|
||||||
item.component = modules["/src/views" + item.component + ".vue"];
|
item.component = modules["/src/views" + item.component + ".vue"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.meta.isFull) {
|
if (item.meta.isFull) {
|
||||||
router.addRoute(item as unknown as RouteRecordRaw);
|
router.addRoute(item as unknown as RouteRecordRaw);
|
||||||
} else {
|
} else {
|
||||||
@@ -51,6 +53,7 @@ export const initDynamicRouter = async () => {
|
|||||||
// 当按钮 || 菜单请求出错时,重定向到登陆页
|
// 当按钮 || 菜单请求出错时,重定向到登陆页
|
||||||
userStore.setAccessToken("");
|
userStore.setAccessToken("");
|
||||||
userStore.setRefreshToken("");
|
userStore.setRefreshToken("");
|
||||||
|
userStore.setExp(0)
|
||||||
router.replace(LOGIN_URL);
|
router.replace(LOGIN_URL);
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,122 +1,139 @@
|
|||||||
import { RouteRecordRaw } from "vue-router";
|
import { RouteRecordRaw } from 'vue-router'
|
||||||
import { HOME_URL, LOGIN_URL } from "@/config";
|
import { HOME_URL, LOGIN_URL } from '@/config'
|
||||||
export const Layout = () => import('@/layouts/index.vue');
|
export const Layout = () => import('@/layouts/index.vue')
|
||||||
/**
|
/**
|
||||||
* staticRouter (静态路由)
|
* staticRouter (静态路由)
|
||||||
*/
|
*/
|
||||||
export const staticRouter: RouteRecordRaw[] = [
|
export const staticRouter: RouteRecordRaw[] = [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: '/',
|
||||||
redirect: HOME_URL,
|
redirect: HOME_URL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: LOGIN_URL,
|
path: LOGIN_URL,
|
||||||
name: "login",
|
name: 'login',
|
||||||
component: () => import("@/views/login/index.vue"),
|
component: () => import('@/views/login/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: "登录",
|
title: '登录'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/layout",
|
path: '/layout',
|
||||||
name: "layout",
|
name: 'layout',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "/plan",
|
path: '/plan',
|
||||||
name: "plan",
|
name: 'plan',
|
||||||
redirect: "/plan/planList",
|
redirect: '/plan/planList',
|
||||||
children: [
|
children: [
|
||||||
{
|
// {
|
||||||
path: "/plan/planList",
|
// path: "/plan/planList",
|
||||||
name: "planList",
|
// name: "planList",
|
||||||
component: () => import("@/views/plan/planList/index.vue"),
|
// component: () => import("@/views/plan/planList/index.vue"),
|
||||||
meta: {
|
// meta: {
|
||||||
title: "检测计划列表",
|
// title: "检测计划列表",
|
||||||
icon: "List",
|
// icon: "List",
|
||||||
isLink: "",
|
// isLink: "",
|
||||||
isHide: false,
|
// isHide: false,
|
||||||
isFull: false,
|
// isFull: false,
|
||||||
isAffix: false,
|
// isAffix: false,
|
||||||
isKeepAlive: true,//缓存改成true
|
// isKeepAlive: true,//缓存改成true
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "/plan/singlePlanList",
|
// path: "/plan/singlePlanList",
|
||||||
name: "singlePlanList",
|
// name: "singlePlanList",
|
||||||
component: () => import("@/views/plan/singlePlanList/index.vue"),
|
// component: () => import("@/views/plan/singlePlanList/index.vue"),
|
||||||
meta: {
|
// meta: {
|
||||||
title: "单个计划列表",
|
// title: "单个计划列表",
|
||||||
icon: "List",
|
// icon: "List",
|
||||||
isLink: "",
|
// isLink: "",
|
||||||
isHide: false,
|
// isHide: false,
|
||||||
isFull: false,
|
// isFull: false,
|
||||||
isAffix: false,
|
// isAffix: false,
|
||||||
isKeepAlive: true,
|
// isKeepAlive: true,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "/plan/preTest",
|
// path: "/plan/preTest",
|
||||||
name: "preTest",
|
// name: "preTest",
|
||||||
component: () => import("@/views/plan/preTest/index.vue"),
|
// component: () => import("@/views/plan/preTest/index.vue"),
|
||||||
meta: {
|
// meta: {
|
||||||
title: "预检测",
|
// title: "预检测",
|
||||||
icon: "List",
|
// icon: "List",
|
||||||
isLink: "",
|
// isLink: "",
|
||||||
isHide: false,
|
// isHide: false,
|
||||||
isFull: false,
|
// isFull: false,
|
||||||
isAffix: false,
|
// isAffix: false,
|
||||||
isKeepAlive: false,
|
// isKeepAlive: false,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "/plan/autoTest",
|
// path: "/plan/autoTest",
|
||||||
name: "autoTest",
|
// name: "autoTest",
|
||||||
component: () => import("@/views/plan/autoTest/index.vue"),
|
// component: () => import("@/views/plan/autoTest/index.vue"),
|
||||||
meta: {
|
// meta: {
|
||||||
title: "自动检测",
|
// title: "自动检测",
|
||||||
icon: "List",
|
// icon: "List",
|
||||||
isLink: "",
|
// isLink: "",
|
||||||
hideTab:true,
|
// hideTab:true,
|
||||||
parentPath:'/system/proTable',
|
// parentPath:'/system/proTable',
|
||||||
isHide: false,
|
// isHide: false,
|
||||||
isFull: false,
|
// isFull: false,
|
||||||
isAffix: false,
|
// isAffix: false,
|
||||||
isKeepAlive: true,
|
// isKeepAlive: true,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
|
|
||||||
// 错误页面路由
|
// 错误页面路由
|
||||||
{
|
{
|
||||||
path: "/403",
|
path: '/403',
|
||||||
name: "403",
|
name: '403',
|
||||||
component: () => import("@/components/ErrorMessage/403.vue"),
|
component: () => import('@/components/ErrorMessage/403.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: "403页面",
|
title: '403页面'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/404",
|
path: '/404',
|
||||||
name: "404",
|
name: '404',
|
||||||
component: () => import("@/components/ErrorMessage/404.vue"),
|
component: () => import('@/components/ErrorMessage/404.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: "404页面",
|
title: '404页面'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/500",
|
path: '/500',
|
||||||
name: "500",
|
name: '500',
|
||||||
component: () => import("@/components/ErrorMessage/500.vue"),
|
component: () => import('@/components/ErrorMessage/500.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: "500页面",
|
title: '500页面'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
// Resolve refresh page, route warnings
|
// Resolve refresh page, route warnings
|
||||||
{
|
{
|
||||||
path: "/:pathMatch(.*)*",
|
path: '/:pathMatch(.*)*',
|
||||||
component: () => import("@/components/ErrorMessage/404.vue"),
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ export interface GlobalState {
|
|||||||
|
|
||||||
/* UserState */
|
/* UserState */
|
||||||
export interface UserState {
|
export interface UserState {
|
||||||
token: string;
|
accessToken: string;
|
||||||
userInfo: { name: string };
|
refreshToken: string;
|
||||||
|
isRefreshToken: boolean;
|
||||||
|
userInfo: { id: string, name: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tabsMenuProps */
|
/* tabsMenuProps */
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
import {defineStore} from "pinia";
|
import {defineStore} from "pinia";
|
||||||
import {CHECK_STORE_KEY} from "@/stores/constant";
|
import {CHECK_STORE_KEY} from "@/stores/constant";
|
||||||
import type {CheckData} from "@/api/check/interface";
|
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", {
|
export const useCheckStore = defineStore("check", {
|
||||||
id: CHECK_STORE_KEY,
|
id: CHECK_STORE_KEY,
|
||||||
|
|
||||||
state: () => ({
|
state: () => ({
|
||||||
devices: Array<CheckData.Device>(),
|
devices: Array<CheckData.Device>(),
|
||||||
planId: String(""),
|
plan: Object<Plan.ResPlan>(),
|
||||||
planCode: String(""),
|
selectTestItems: Object<CheckData.SelectTestItem>({preTest: true, timeTest: false, channelsTest: false, test: true}),
|
||||||
scriptId: String(""),
|
checkType:1, // 0:手动检测 1:自动检测
|
||||||
errorSysId: String(""),
|
reCheckType: 1, // 0:不合格项复检 1:全部复检
|
||||||
|
showDetailType: 0 ,// 0:数据查询 1:误差体系跟换 2:正式检测
|
||||||
|
temperature: 0,
|
||||||
|
humidity: 0
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getters: {},
|
getters: {},
|
||||||
@@ -20,25 +26,38 @@ export const useCheckStore = defineStore("check", {
|
|||||||
addDevices(device: CheckData.Device[]) {
|
addDevices(device: CheckData.Device[]) {
|
||||||
this.devices.push(...device);
|
this.devices.push(...device);
|
||||||
},
|
},
|
||||||
|
setPlan(plan: Plan.ResPlan) {
|
||||||
|
this.plan = plan
|
||||||
|
},
|
||||||
clearDevices() {
|
clearDevices() {
|
||||||
this.devices = [];
|
this.devices = [];
|
||||||
},
|
},
|
||||||
|
initSelectTestItems() {
|
||||||
setPlanId(planId: string) {
|
this.selectTestItems.preTest = true
|
||||||
this.planId = planId
|
if (AppSceneStore.currentScene === '1') {
|
||||||
|
this.selectTestItems.channelsTest = true
|
||||||
|
} else {
|
||||||
|
this.selectTestItems.channelsTest = false
|
||||||
|
}
|
||||||
|
this.selectTestItems.test = true
|
||||||
},
|
},
|
||||||
|
setSelectTestItems(selectTestItems: CheckData.SelectTestItem) {
|
||||||
setPlanCode(planCode: string) {
|
this.selectTestItems = selectTestItems
|
||||||
this.planCode = planCode
|
|
||||||
},
|
},
|
||||||
|
setCheckType(checkType: number) {
|
||||||
setScriptId(scriptId: string) {
|
this.checkType = checkType
|
||||||
this.scriptId = scriptId
|
|
||||||
},
|
},
|
||||||
|
setReCheckType(reCheckType: number) {
|
||||||
setErrorSysId(errorSysId: string) {
|
this.reCheckType = reCheckType
|
||||||
this.errorSysId = errorSysId
|
},
|
||||||
|
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 { defineStore } from "pinia";
|
||||||
import { GlobalState } from "@/stores/interface";
|
import { GlobalState } from "@/stores/interface";
|
||||||
import { DEFAULT_PRIMARY } from "@/config";
|
import { DEFAULT_PRIMARY} from "@/config";
|
||||||
import piniaPersistConfig from "@/stores/helper/persist";
|
import piniaPersistConfig from "@/stores/helper/persist";
|
||||||
import {GLOBAL_STORE_KEY} from "@/stores/constant";
|
import {GLOBAL_STORE_KEY} from "@/stores/constant";
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ export const useGlobalStore = defineStore({
|
|||||||
// 折叠菜单
|
// 折叠菜单
|
||||||
isCollapse: false,
|
isCollapse: false,
|
||||||
// 菜单手风琴
|
// 菜单手风琴
|
||||||
accordion: true,
|
accordion: false,
|
||||||
// 面包屑导航
|
// 面包屑导航
|
||||||
breadcrumb: true,
|
breadcrumb: true,
|
||||||
// 面包屑导航图标
|
// 面包屑导航图标
|
||||||
@@ -42,12 +42,14 @@ export const useGlobalStore = defineStore({
|
|||||||
tabsIcon: true,
|
tabsIcon: true,
|
||||||
// 页脚
|
// 页脚
|
||||||
footer: false
|
footer: false
|
||||||
|
|
||||||
}),
|
}),
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
// Set GlobalState
|
// Set GlobalState
|
||||||
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
|
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
|
||||||
this.$patch({ [args[0]]: args[1] });
|
this.$patch({ [args[0]]: args[1] });
|
||||||
|
console.log(DEFAULT_PRIMARY);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
persist: piniaPersistConfig(GLOBAL_STORE_KEY)
|
persist: piniaPersistConfig(GLOBAL_STORE_KEY)
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ export const useUserStore = defineStore({
|
|||||||
state: (): UserState => ({
|
state: (): UserState => ({
|
||||||
accessToken: "",
|
accessToken: "",
|
||||||
refreshToken: "",
|
refreshToken: "",
|
||||||
userInfo: { name: "admin" },
|
isRefreshToken:false,
|
||||||
|
exp: Number(0),
|
||||||
|
userInfo: {id:"", name: "admin" },
|
||||||
}),
|
}),
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
@@ -19,10 +21,16 @@ export const useUserStore = defineStore({
|
|||||||
setRefreshToken(refreshToken: string) {
|
setRefreshToken(refreshToken: string) {
|
||||||
this.refreshToken = refreshToken;
|
this.refreshToken = refreshToken;
|
||||||
},
|
},
|
||||||
|
setIsRefreshToken(isRefreshToken: boolean) {
|
||||||
|
this.isRefreshToken = isRefreshToken;
|
||||||
|
},
|
||||||
// Set setUserInfo
|
// Set setUserInfo
|
||||||
setUserInfo(userInfo: UserState["userInfo"]) {
|
setUserInfo(userInfo: UserState["userInfo"]) {
|
||||||
this.userInfo = userInfo;
|
this.userInfo = userInfo;
|
||||||
},
|
},
|
||||||
|
setExp(exp: number) {
|
||||||
|
this.exp = exp;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
persist: piniaPersistConfig(USER_STORE_KEY),
|
persist: piniaPersistConfig(USER_STORE_KEY),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -445,7 +445,7 @@
|
|||||||
|
|
||||||
.dialog-small {
|
.dialog-small {
|
||||||
.el-dialog__body {
|
.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 {
|
.el-table__cell {
|
||||||
border-right: 1px solid #ebeef5 !important;
|
border-right: 1px solid #ebeef5 !important;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export function rgbToHex(r: any, g: any, b: any) {
|
|||||||
* @returns {String} 返回处理后的颜色值
|
* @returns {String} 返回处理后的颜色值
|
||||||
*/
|
*/
|
||||||
export function getDarkColor(color: string, level: number) {
|
export function getDarkColor(color: string, level: number) {
|
||||||
|
|
||||||
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
||||||
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
||||||
let rgb = hexToRgb(color);
|
let rgb = hexToRgb(color);
|
||||||
@@ -51,6 +52,7 @@ export function getDarkColor(color: string, level: number) {
|
|||||||
* @returns {String} 返回处理后的颜色值
|
* @returns {String} 返回处理后的颜色值
|
||||||
*/
|
*/
|
||||||
export function getLightColor(color: string, level: number) {
|
export function getLightColor(color: string, level: number) {
|
||||||
|
|
||||||
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
||||||
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
||||||
let rgb = hexToRgb(color);
|
let rgb = hexToRgb(color);
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default class SocketService {
|
export default class SocketService {
|
||||||
static instance = null;
|
static instance = null;
|
||||||
static get Instance() {
|
static get Instance() {
|
||||||
@@ -23,9 +20,10 @@ export default class SocketService {
|
|||||||
// 重新连接尝试的次数
|
// 重新连接尝试的次数
|
||||||
connectRetryCount = 0;
|
connectRetryCount = 0;
|
||||||
work:any;
|
work:any;
|
||||||
heartbeatTimer;
|
workerBlobUrl:any;
|
||||||
heartbeatInterval = 6000; // 心跳间隔,单位毫秒
|
|
||||||
lastActivityTime= 0; // 上次活动时间戳
|
lastActivityTime= 0; // 上次活动时间戳
|
||||||
|
lastResponseHeartTime = Date.now();//最后一次收到心跳回复时间
|
||||||
|
|
||||||
reconnectDelay= 5000; // 重新连接延迟,单位毫秒
|
reconnectDelay= 5000; // 重新连接延迟,单位毫秒
|
||||||
|
|
||||||
// 定义连接服务器的方法
|
// 定义连接服务器的方法
|
||||||
@@ -40,7 +38,7 @@ export default class SocketService {
|
|||||||
// let token = '4E6EF539AAF119D82AC4C2BC84FBA21F';
|
// 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 = new WebSocket(url);
|
||||||
// 连接成功的事件
|
// 连接成功的事件
|
||||||
this.ws.onopen = () => {
|
this.ws.onopen = () => {
|
||||||
@@ -55,13 +53,13 @@ export default class SocketService {
|
|||||||
// 1.连接服务端失败
|
// 1.连接服务端失败
|
||||||
// 2.当连接成功之后, 服务器关闭的情况
|
// 2.当连接成功之后, 服务器关闭的情况
|
||||||
this.ws.onclose = () => {
|
this.ws.onclose = () => {
|
||||||
console.log('连接服务端失败');
|
console.log('连接webSocket服务端关闭');
|
||||||
this.connected = false;
|
this.connected = false;
|
||||||
this.connectRetryCount++;
|
this.connectRetryCount++;
|
||||||
this.clearHeartbeat();
|
this.clearHeartbeat();
|
||||||
setTimeout(() => {
|
/* setTimeout(() => {
|
||||||
// this.connect();
|
this.connect();
|
||||||
}, 500 * this.connectRetryCount);
|
}, 500 * this.connectRetryCount);*/
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -72,18 +70,23 @@ export default class SocketService {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 得到服务端发送过来的数据
|
// 得到服务端发送过来的数据
|
||||||
this.ws.onmessage = (event) => {
|
this.ws.onmessage = (event) => {
|
||||||
|
// console.log('🚀 ~ SocketService ~ connect ~ event:', event)
|
||||||
|
if(event.data == 'over') {
|
||||||
|
//心跳消息处理
|
||||||
|
this.lastResponseHeartTime = Date.now();
|
||||||
|
this.updateLastActivityTime(); // 收到心跳响应时更新活动时间
|
||||||
|
}else {
|
||||||
let message: { [key: string]: any };
|
let message: { [key: string]: any };
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('Received message:',event.data)
|
console.log('Received message:',event.data)
|
||||||
message = JSON.parse(event.data);
|
message = JSON.parse(event.data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return console.error("消息解析失败", event.data, e);
|
return console.error("消息解析失败", event.data, e);
|
||||||
}
|
}
|
||||||
//console.log(message, "从服务端获取到了数据");
|
|
||||||
/* 通过接受服务端发送的type字段来回调函数 */
|
/* 通过接受服务端发送的type字段来回调函数 */
|
||||||
if (message?.type && this.callBackMapping[message.type]) {
|
if (message?.type && this.callBackMapping[message.type]) {
|
||||||
this.callBackMapping[message.type](message);
|
this.callBackMapping[message.type](message);
|
||||||
@@ -92,6 +95,9 @@ export default class SocketService {
|
|||||||
console.log(event.data)
|
console.log(event.data)
|
||||||
/* 丢弃或继续写你的逻辑 */
|
/* 丢弃或继续写你的逻辑 */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,25 +106,26 @@ export default class SocketService {
|
|||||||
|
|
||||||
|
|
||||||
startHeartbeat() {
|
startHeartbeat() {
|
||||||
let _this = this
|
this.lastResponseHeartTime = Date.now();
|
||||||
var url = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},3000)})()']));
|
const _this = this
|
||||||
this.work = new Worker(url)
|
_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){
|
this.work.onmessage = function(e){
|
||||||
if ((Date.now() - _this.lastActivityTime) > _this.heartbeatInterval) {
|
//判断多久没收到心跳响应
|
||||||
// 如果超过心跳间隔没有活动,发送心跳消息
|
|
||||||
|
if(_this.lastActivityTime - _this.lastResponseHeartTime > 30000){
|
||||||
|
//说明已经三轮心跳没收到回复了,关闭检测,提示用户。
|
||||||
|
ElMessage.error("业务主体模块发生未知异常,请尝试重新启动!");
|
||||||
|
_this.clearHeartbeat();
|
||||||
|
return;
|
||||||
|
}
|
||||||
_this.sendHeartbeat();
|
_this.sendHeartbeat();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// this.heartbeatTimer = setInterval(() => {
|
|
||||||
// if ((Date.now() - this.lastActivityTime) > this.heartbeatInterval) {
|
|
||||||
// // 如果超过心跳间隔没有活动,发送心跳消息
|
|
||||||
// this.sendHeartbeat();
|
|
||||||
// }
|
|
||||||
// }, this.heartbeatInterval/2); // 每半个心跳间隔检查一次
|
|
||||||
}
|
|
||||||
sendHeartbeat() {
|
sendHeartbeat() {
|
||||||
console.log("进入心跳消息发送。。。。。。。。。。。。。")
|
console.log(new Date()+"进入心跳消息发送。。。。。。。。。。。。。")
|
||||||
this.ws.send('alive');
|
this.ws.send('alive');
|
||||||
this.updateLastActivityTime(); // 发送心跳后更新活动时间
|
this.updateLastActivityTime(); // 发送心跳后更新活动时间
|
||||||
}
|
}
|
||||||
@@ -129,11 +136,14 @@ export default class SocketService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearHeartbeat() {
|
clearHeartbeat() {
|
||||||
this.work.terminate();
|
const _this = this
|
||||||
if (this.heartbeatTimer) {
|
if (_this.work) {
|
||||||
|
_this.work.terminate();
|
||||||
clearInterval(this.heartbeatTimer);
|
_this.work = null;
|
||||||
this.heartbeatTimer = 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) {
|
if (this.connected) {
|
||||||
this.ws.close()
|
this.ws.close()
|
||||||
}
|
}
|
||||||
console.log('WS关闭中..');
|
console.log('执行WS关闭命令..');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="名称" prop="name" :label-width="100">
|
<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>
|
||||||
<el-form-item label="编码" prop="code" :label-width="100">
|
<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>
|
||||||
<el-form-item v-if="!formContent.type" label="图标" prop="icon" :label-width="100">
|
<el-form-item v-if="!formContent.type" label="图标" prop="icon" :label-width="100">
|
||||||
<IconSelect
|
<IconSelect
|
||||||
@@ -27,11 +27,11 @@
|
|||||||
placeholder="选择一个图标"
|
placeholder="选择一个图标"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="!formContent.type" label="路由地址" prop="path" :label-width="100">
|
<el-form-item v-if="!formContent.type" label="路由地址" prop="path" :label-width="100" >
|
||||||
<el-input v-model="formContent.path" />
|
<el-input v-model="formContent.path" maxlength="32" show-word-limit/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="!formContent.type" label="组件地址" prop="component" :label-width="100">
|
<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>
|
||||||
<el-form-item label="排序" prop="sort" :label-width="100">
|
<el-form-item label="排序" prop="sort" :label-width="100">
|
||||||
<el-input-number v-model="formContent.sort" :min='1' :max='999' />
|
<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[]
|
functionList.value = response.data as unknown as Function.ResFunction[]
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
rules.value.path = [{ required: true, trigger: 'blur', message: '路由地址必填!' }];
|
||||||
|
rules.value.component = [{ required: true, trigger: 'blur', message: '组件地址必填!' }];
|
||||||
|
|
||||||
if (formContent.value.pid ==='0') {
|
if (formContent.value.pid ==='0') {
|
||||||
formContent.value.pid = '';
|
formContent.value.pid = '';
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
:rules='rules'
|
:rules='rules'
|
||||||
>
|
>
|
||||||
<el-form-item label="名称" prop='name' :label-width="100" >
|
<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>
|
||||||
|
|
||||||
<el-form-item label="编码" prop='code' :label-width="100">
|
<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>
|
||||||
<el-form-item label='类型' prop='type' :label-width="100">
|
<el-form-item label='类型' prop='type' :label-width="100">
|
||||||
<el-select v-model="formContent.type" clearable placeholder="请选择类型" :disabled="rootIsEdit">
|
<el-select v-model="formContent.type" clearable placeholder="请选择类型" :disabled="rootIsEdit">
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<!-- :requestApi="getRoleList" -->
|
<!-- :requestApi="getRoleList" -->
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<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'
|
<el-button v-auth.role="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
删除
|
删除
|
||||||
@@ -16,9 +16,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<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="'edit'" type='primary' link :icon='EditPen' @click="openDrawer('edit', scope.row)" :disabled="scope.row.code == 'root'">编辑</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="'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)">设置权限</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>
|
</template>
|
||||||
|
|
||||||
</ProTable>
|
</ProTable>
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
:rules='rules'
|
:rules='rules'
|
||||||
>
|
>
|
||||||
<el-form-item label="原密码" prop='oldPassword' :label-width="100">
|
<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>
|
||||||
<el-form-item label="新密码" prop='newPassword' :label-width="100">
|
<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>
|
||||||
<el-form-item label="确认密码" prop='surePassword' :label-width="100">
|
<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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
:rules='rules'
|
:rules='rules'
|
||||||
>
|
>
|
||||||
<el-form-item label="用户名" prop='name' :label-width="100">
|
<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>
|
||||||
<el-form-item label="登录名" prop='loginName' :label-width="100" >
|
<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>
|
||||||
<el-form-item label="密码" prop='password' :label-width="100" v-if="IsPasswordShow">
|
<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>
|
||||||
<el-form-item label='角色' :label-width='100' prop='roles'>
|
<el-form-item label='角色' :label-width='100' prop='roles'>
|
||||||
<el-select v-model="formContent.roleIds" multiple placeholder="请选择角色">
|
<el-select v-model="formContent.roleIds" multiple placeholder="请选择角色">
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<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="'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)'>删除</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)'>修改密码</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>
|
</template>
|
||||||
|
|
||||||
</ProTable>
|
</ProTable>
|
||||||
@@ -91,6 +91,7 @@
|
|||||||
render: (scope) => {
|
render: (scope) => {
|
||||||
const roleNames = scope.row.roleNames;
|
const roleNames = scope.row.roleNames;
|
||||||
const roleArray = Array.isArray(roleNames) ? roleNames : [roleNames];
|
const roleArray = Array.isArray(roleNames) ? roleNames : [roleNames];
|
||||||
|
|
||||||
if (roleArray.length > 1) {
|
if (roleArray.length > 1) {
|
||||||
return roleArray.join(', ');
|
return roleArray.join(', ');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model='dialogVisible' title="系数校准" v-bind="dialogBig" width="1550px" @close="handleCancel">
|
<el-dialog v-model='dialogVisible' title="系数校准" v-bind="dialogBig" width="1550px" @close="handleCancel" :before-close="beforeClose">
|
||||||
<div class="test-dialog" >
|
<div class="test-dialog">
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<div class="right-title">
|
<div class="right-title">
|
||||||
<!-- <div>系数校准表</div> -->
|
<!-- <div>系数校准表</div> -->
|
||||||
<div>{{ outputDsc }}</div>
|
<div>{{ outputDsc }}</div>
|
||||||
<div>
|
<div>
|
||||||
<span style=" font-size: 18px;font-weight: 600;">
|
<span style=" font-size: 18px;font-weight: 600;">
|
||||||
设备已合格 <span style="color: #67C23A">{{ qualified }}</span> 台/共 <span style="color: green">{{ total }}</span>
|
设备已合格 <span style="color: #91cc75">{{ qualified }}</span> 台/共 <span style="color: green">{{ total }}</span>
|
||||||
台
|
台
|
||||||
</span>
|
</span>
|
||||||
<!-- <el-button type="primary" loading
|
<!-- <el-button type="primary" loading
|
||||||
@@ -18,14 +18,16 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="dialog-left">
|
<div class="dialog-left">
|
||||||
<el-steps direction="vertical" :active="active" :process-status="currentStepStatus" finish-status="success">
|
<el-steps direction="vertical" :active="active" :process-status="currentStepStatus" finish-status="success">
|
||||||
<el-step title="开始" />
|
<el-step title="开始"/>
|
||||||
<el-step>
|
<el-step>
|
||||||
<template #title>
|
<template #title>
|
||||||
<span>大电压/电流系数下装</span><br/>
|
<span>大电压/电流系数下装</span><br/>
|
||||||
<span class="spanStyle">源输出为:</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_V_Download }}</span><br/>
|
||||||
<span class="spanStyle" v-if="active > 0">{{big_I_Download}}</span>
|
<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>
|
<el-icon v-if="active === 1 " class="loading-box">
|
||||||
|
<el-icon-loading/>
|
||||||
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-step>
|
</el-step>
|
||||||
<el-step>
|
<el-step>
|
||||||
@@ -34,7 +36,9 @@
|
|||||||
<span class="spanStyle">源输出为:</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_V_Download }}</span><br/>
|
||||||
<span class="spanStyle" v-if="active > 1">{{ small_I_Download }}</span>
|
<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>
|
<el-icon v-if="active === 2" class="loading-box">
|
||||||
|
<el-icon-loading/>
|
||||||
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-step>
|
</el-step>
|
||||||
<el-step>
|
<el-step>
|
||||||
@@ -43,7 +47,9 @@
|
|||||||
<span class="spanStyle">源输出为:</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_V_Adjust }}</span><br/>
|
||||||
<span class="spanStyle" v-if="active > 2">{{ big_I_Adjust }}</span>
|
<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>
|
<el-icon v-if="active === 3" class="loading-box">
|
||||||
|
<el-icon-loading/>
|
||||||
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-step>
|
</el-step>
|
||||||
<el-step>
|
<el-step>
|
||||||
@@ -52,20 +58,22 @@
|
|||||||
<span class="spanStyle">源输出为:</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_V_Adjust }}</span><br/>
|
||||||
<span class="spanStyle" v-if="active > 3">{{ small_I_Adjust }}</span>
|
<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>
|
<el-icon v-if="active === 4" class="loading-box">
|
||||||
|
<el-icon-loading/>
|
||||||
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-step>
|
</el-step>
|
||||||
<el-step title="结束"/>
|
<el-step title="结束"/>
|
||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-content">
|
<div class="right-content">
|
||||||
<el-tabs type="border-card" v-model="editableTabsValue" :active-index="String(activeIndex)" >
|
<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">
|
<el-tab-pane v-for="(device, index) in name" :key="index" :label="device">
|
||||||
<template #label>
|
<template #label>
|
||||||
<span class="custom-tabs-label">
|
<span class="custom-tabs-label">
|
||||||
<span>{{ device }}</span>
|
<span>{{ device }}</span>
|
||||||
<el-icon v-if="errorStates[index]" class ="icon-style" >
|
<el-icon v-if="errorStates[index]" class="icon-style">
|
||||||
<Failed />
|
<Failed/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -78,7 +86,7 @@
|
|||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
@@ -89,15 +97,17 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup name="channelsTest">
|
<script lang="tsx" setup name="channelsTest">
|
||||||
import { type Device } from '@/api/device/interface/device';
|
import {type Device} from '@/api/device/interface/device';
|
||||||
import { SuccessFilled, Failed, Message, MessageBox } from '@element-plus/icons-vue'
|
import {Failed} from '@element-plus/icons-vue'
|
||||||
import { type Ref, ref, toRef, watch } from 'vue'
|
import {type Ref, ref, toRef, watch} from 'vue'
|
||||||
import {dialogBig} from '@/utils/elementBind'
|
import {dialogBig} from '@/utils/elementBind'
|
||||||
import { ElMessage, ElMessageBox, TabsPaneContext } from 'element-plus';
|
import {ElMessageBox} from 'element-plus';
|
||||||
import { getCoefficientCheck } from '@/api/home/channelsTest/index'
|
import {getCoefficientCheck} from '@/api/home/channelsTest/index'
|
||||||
import type { ChannelsTest } from '@/api/home/interface/channelsTest';
|
import type {ChannelsTest} from '@/api/home/interface/channelsTest';
|
||||||
import type { Plan } from '@/api/plan/interface';
|
import type {Plan} from '@/api/plan/interface';
|
||||||
import { fa } from 'element-plus/es/locale';
|
import {useUserStore} from "@/stores/modules/user";
|
||||||
|
|
||||||
|
|
||||||
const activeIndex = ref(0)
|
const activeIndex = ref(0)
|
||||||
const activeTotalNum = ref(4)
|
const activeTotalNum = ref(4)
|
||||||
const qualified = ref(0)
|
const qualified = ref(0)
|
||||||
@@ -113,7 +123,7 @@ const devIdArray = ref<string[]>([])//系数校准所选设备ID数组
|
|||||||
const select_Plan = ref<Plan.ReqPlan>()
|
const select_Plan = ref<Plan.ReqPlan>()
|
||||||
const planId = ref('')
|
const planId = ref('')
|
||||||
const isButtonDisabled = ref(false);
|
const isButtonDisabled = ref(false);
|
||||||
const CurV= ref<number>()//额定电压
|
const CurV = ref<number>()//额定电压
|
||||||
// 在 setup 函数中
|
// 在 setup 函数中
|
||||||
const errorStates = ref(new Array(name.value.length).fill(false));
|
const errorStates = ref(new Array(name.value.length).fill(false));
|
||||||
//const loadingStates = ref(new Array(name.value.length).fill(false)); // 初始化 loading 状态
|
//const loadingStates = ref(new Array(name.value.length).fill(false)); // 初始化 loading 状态
|
||||||
@@ -136,12 +146,12 @@ const props = defineProps({
|
|||||||
default: () => ({})
|
default: () => ({})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const userStore = useUserStore()
|
||||||
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
|
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
|
||||||
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||||
const webMsgSend = toRef(props, 'webMsgSend');
|
const webMsgSend = toRef(props, 'webMsgSend');
|
||||||
|
|
||||||
watch(webMsgSend,function (newValue,oldValue){
|
watch(webMsgSend, function (newValue, oldValue) {
|
||||||
if (newValue.code == 10520) {
|
if (newValue.code == 10520) {
|
||||||
ElMessageBox.alert('报文解析异常!', '初始化失败', {
|
ElMessageBox.alert('报文解析异常!', '初始化失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@@ -215,17 +225,17 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
})
|
})
|
||||||
TableInit();
|
TableInit();
|
||||||
} else {
|
} else {
|
||||||
switch (newValue.requestId){
|
switch (newValue.requestId) {
|
||||||
case 'yjc_ytxjy':
|
case 'yjc_ytxjy':
|
||||||
switch (newValue.operateCode) {
|
switch (newValue.operateCode) {
|
||||||
case'INIT_GATHER':
|
case'INIT_GATHER':
|
||||||
if(newValue.code ==-1){
|
if (newValue.code == -1) {
|
||||||
ElMessageBox.alert('源未知异常', '初始化失败', {
|
ElMessageBox.alert('源未知异常', '初始化失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
TableInit();
|
TableInit();
|
||||||
}else if (newValue.code == 10523) {
|
} else if (newValue.code == 10523) {
|
||||||
ElMessageBox.alert('源连接失败', '源连接失败', {
|
ElMessageBox.alert('源连接失败', '源连接失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@@ -271,7 +281,7 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
TableInit();
|
TableInit();
|
||||||
}else if (newValue.code == 10551) {
|
} else if (newValue.code == 10551) {
|
||||||
ElMessageBox.alert('设备触发报告异常', '设备触发报告异常', {
|
ElMessageBox.alert('设备触发报告异常', '设备触发报告异常', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@@ -294,40 +304,66 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
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':
|
case 'Coefficient_Check':
|
||||||
console.log("Coefficient_Checkactive",active.value);
|
console.log("Coefficient_Checkactive", active.value);
|
||||||
switch (newValue.operateCode){
|
switch (newValue.operateCode) {
|
||||||
case 'big_end'://大电压,电流下装
|
case 'big_start'://大电压,电流下装
|
||||||
active.value++;
|
|
||||||
big_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
big_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
big_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
big_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
break;
|
||||||
tableLoading('small','系数下装')
|
case 'big_end'://大电压,电流下装
|
||||||
|
active.value++;
|
||||||
|
tableLoading('small', '系数下装')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (newValue.operateCode){
|
switch (newValue.operateCode) {
|
||||||
case 'small_end'://小电压,电流下装
|
case 'small_start'://小电压,电流下装
|
||||||
active.value++;
|
|
||||||
small_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
small_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
small_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
small_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
break;
|
||||||
tableLoading('big','系数校准')
|
case 'small_end'://小电压,电流下装
|
||||||
|
active.value++;
|
||||||
|
tableLoading('big', '系数校准')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (newValue.operateCode){
|
switch (newValue.operateCode) {
|
||||||
case 'big_comp_end'://大电压,电流校准
|
case 'big_comp_start'://大电压,电流校准
|
||||||
active.value++;
|
|
||||||
big_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
big_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
big_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
big_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
break;
|
||||||
tableLoading('small','系数校准')
|
case 'big_comp_end'://大电压,电流校准
|
||||||
|
active.value++;
|
||||||
|
tableLoading('small', '系数校准')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (newValue.operateCode){
|
switch (newValue.operateCode) {
|
||||||
case 'small_comp_end'://小电压,电流校准
|
case 'small_comp_start'://小电压,电流校准
|
||||||
active.value++;
|
|
||||||
small_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
small_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
small_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
small_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
break;
|
||||||
|
case 'small_comp_end'://小电压,电流校准
|
||||||
|
active.value++;
|
||||||
active.value++;
|
active.value++;
|
||||||
|
|
||||||
for (let i = 0; i < name.value.length; i++) {
|
for (let i = 0; i < name.value.length; i++) {
|
||||||
@@ -348,7 +384,7 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
isButtonDisabled.value = false; // 恢复按钮
|
isButtonDisabled.value = false; // 恢复按钮
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (newValue.operateCode){
|
switch (newValue.operateCode) {
|
||||||
case 'DATA_CHNFACTOR$02'://表格
|
case 'DATA_CHNFACTOR$02'://表格
|
||||||
// 输出 key 为 0 的数组中的第一条 ChannelsTest.CoefficientVO 对象
|
// 输出 key 为 0 的数组中的第一条 ChannelsTest.CoefficientVO 对象
|
||||||
for (let i = 0; i < name.value.length; i++) {
|
for (let i = 0; i < name.value.length; i++) {
|
||||||
@@ -431,7 +467,7 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'socket_timeout':
|
case 'socket_timeout':
|
||||||
switch(newValue.operateCode){
|
switch (newValue.operateCode) {
|
||||||
case 'VOLTAGE':
|
case 'VOLTAGE':
|
||||||
ElMessageBox.alert('连接超时!', '连接超时', {
|
ElMessageBox.alert('连接超时!', '连接超时', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@@ -442,7 +478,7 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'connect':
|
case 'connect':
|
||||||
switch (newValue.operateCode){
|
switch (newValue.operateCode) {
|
||||||
case "Source":
|
case "Source":
|
||||||
ElMessageBox.alert('源服务端连接失败', '源服务端连接失败', {
|
ElMessageBox.alert('源服务端连接失败', '源服务端连接失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@@ -466,11 +502,11 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
|
|
||||||
//出错系数检测初始化
|
//出错系数检测初始化
|
||||||
const TableInit = () => {
|
const TableInit = () => {
|
||||||
console.log("TableInitactive",active.value);
|
console.log("TableInitactive", active.value);
|
||||||
isButtonDisabled.value = false; // 恢复按钮
|
isButtonDisabled.value = false; // 恢复按钮
|
||||||
for (let i = 0; i < channel.value.length; i++) {
|
for (let i = 0; i < channel.value.length; i++) {
|
||||||
const currentTableData = initializeTableData(dataTemplates, i);
|
const currentTableData = initializeTableData(dataTemplates, i);
|
||||||
tableDataMap.set(i,currentTableData)
|
tableDataMap.set(i, currentTableData)
|
||||||
|
|
||||||
// const targetArrayRef = tableDataMap.get(i);
|
// const targetArrayRef = tableDataMap.get(i);
|
||||||
// if (targetArrayRef) {
|
// if (targetArrayRef) {
|
||||||
@@ -498,7 +534,7 @@ const tableLoading = (type: string, desc: string) => {
|
|||||||
const firstCoefficientVO = targetArray.find(item => item.monitorNum === (j + 1).toString() &&
|
const firstCoefficientVO = targetArray.find(item => item.monitorNum === (j + 1).toString() &&
|
||||||
item.type === type &&
|
item.type === type &&
|
||||||
item.desc === desc);
|
item.desc === desc);
|
||||||
if (firstCoefficientVO){
|
if (firstCoefficientVO) {
|
||||||
firstCoefficientVO.loading = true;
|
firstCoefficientVO.loading = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -507,13 +543,13 @@ const tableLoading = (type: string, desc: string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataTemplates : ChannelsTest.CoefficientVO[]= [
|
const dataTemplates: ChannelsTest.CoefficientVO[] = [
|
||||||
{
|
{
|
||||||
monitorNum: '1',
|
monitorNum: '1',
|
||||||
desc: '系数下装',
|
desc: '系数下装',
|
||||||
type:'big',
|
type: 'big',
|
||||||
aVuData: '—',
|
aVuData: '—',
|
||||||
aVuXi:'—',
|
aVuXi: '—',
|
||||||
bVuData: '—',
|
bVuData: '—',
|
||||||
bVuXi: '—',
|
bVuXi: '—',
|
||||||
cVuData: '—',
|
cVuData: '—',
|
||||||
@@ -524,21 +560,21 @@ const dataTemplates : ChannelsTest.CoefficientVO[]= [
|
|||||||
bIeXi: '—',
|
bIeXi: '—',
|
||||||
cIeData: '—',
|
cIeData: '—',
|
||||||
cIeXi: '—',
|
cIeXi: '—',
|
||||||
loading:false,
|
loading: false,
|
||||||
devName:'',
|
devName: '',
|
||||||
aV:'—',
|
aV: '—',
|
||||||
bV:'—',
|
bV: '—',
|
||||||
cV:'—',
|
cV: '—',
|
||||||
aI:'—',
|
aI: '—',
|
||||||
bI:'—',
|
bI: '—',
|
||||||
cI:'—',
|
cI: '—',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
monitorNum: '2',
|
monitorNum: '2',
|
||||||
desc: '系数下装',
|
desc: '系数下装',
|
||||||
type:'small',
|
type: 'small',
|
||||||
aVuData: '—',
|
aVuData: '—',
|
||||||
aVuXi:'—',
|
aVuXi: '—',
|
||||||
bVuData: '—',
|
bVuData: '—',
|
||||||
bVuXi: '—',
|
bVuXi: '—',
|
||||||
cVuData: '—',
|
cVuData: '—',
|
||||||
@@ -549,21 +585,21 @@ const dataTemplates : ChannelsTest.CoefficientVO[]= [
|
|||||||
bIeXi: '—',
|
bIeXi: '—',
|
||||||
cIeData: '—',
|
cIeData: '—',
|
||||||
cIeXi: '—',
|
cIeXi: '—',
|
||||||
loading:false,
|
loading: false,
|
||||||
devName:'',
|
devName: '',
|
||||||
aV:'—',
|
aV: '—',
|
||||||
bV:'—',
|
bV: '—',
|
||||||
cV:'—',
|
cV: '—',
|
||||||
aI:'—',
|
aI: '—',
|
||||||
bI:'—',
|
bI: '—',
|
||||||
cI:'—',
|
cI: '—',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
monitorNum: '3',
|
monitorNum: '3',
|
||||||
desc: '系数校准',
|
desc: '系数校准',
|
||||||
type:'big',
|
type: 'big',
|
||||||
aVuData: '—',
|
aVuData: '—',
|
||||||
aVuXi:'—',
|
aVuXi: '—',
|
||||||
bVuData: '—',
|
bVuData: '—',
|
||||||
bVuXi: '—',
|
bVuXi: '—',
|
||||||
cVuData: '—',
|
cVuData: '—',
|
||||||
@@ -574,21 +610,21 @@ const dataTemplates : ChannelsTest.CoefficientVO[]= [
|
|||||||
bIeXi: '—',
|
bIeXi: '—',
|
||||||
cIeData: '—',
|
cIeData: '—',
|
||||||
cIeXi: '—',
|
cIeXi: '—',
|
||||||
loading:false,
|
loading: false,
|
||||||
devName:'',
|
devName: '',
|
||||||
aV:'—',
|
aV: '—',
|
||||||
bV:'—',
|
bV: '—',
|
||||||
cV:'—',
|
cV: '—',
|
||||||
aI:'—',
|
aI: '—',
|
||||||
bI:'—',
|
bI: '—',
|
||||||
cI:'—',
|
cI: '—',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
monitorNum: '4',
|
monitorNum: '4',
|
||||||
desc: '系数校准',
|
desc: '系数校准',
|
||||||
type:'small',
|
type: 'small',
|
||||||
aVuData: '—',
|
aVuData: '—',
|
||||||
aVuXi:'—',
|
aVuXi: '—',
|
||||||
bVuData: '—',
|
bVuData: '—',
|
||||||
bVuXi: '—',
|
bVuXi: '—',
|
||||||
cVuData: '—',
|
cVuData: '—',
|
||||||
@@ -599,25 +635,25 @@ const dataTemplates : ChannelsTest.CoefficientVO[]= [
|
|||||||
bIeXi: '—',
|
bIeXi: '—',
|
||||||
cIeData: '—',
|
cIeData: '—',
|
||||||
cIeXi: '—',
|
cIeXi: '—',
|
||||||
loading:false,
|
loading: false,
|
||||||
devName:'',
|
devName: '',
|
||||||
aV:'—',
|
aV: '—',
|
||||||
bV:'—',
|
bV: '—',
|
||||||
cV:'—',
|
cV: '—',
|
||||||
aI:'—',
|
aI: '—',
|
||||||
bI:'—',
|
bI: '—',
|
||||||
cI:'—',
|
cI: '—',
|
||||||
},
|
},
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const dataTemplates2 : ChannelsTest.CoefficientVO[]= [
|
const dataTemplates2: ChannelsTest.CoefficientVO[] = [
|
||||||
{
|
{
|
||||||
monitorNum: '1',
|
monitorNum: '1',
|
||||||
desc: '系数下装',
|
desc: '系数下装',
|
||||||
type:'big',
|
type: 'big',
|
||||||
aVuData: '—',
|
aVuData: '—',
|
||||||
aVuXi:'—',
|
aVuXi: '—',
|
||||||
bVuData: '—',
|
bVuData: '—',
|
||||||
bVuXi: '—',
|
bVuXi: '—',
|
||||||
cVuData: '—',
|
cVuData: '—',
|
||||||
@@ -628,15 +664,15 @@ const dataTemplates2 : ChannelsTest.CoefficientVO[]= [
|
|||||||
bIeXi: '—',
|
bIeXi: '—',
|
||||||
cIeData: '—',
|
cIeData: '—',
|
||||||
cIeXi: '—',
|
cIeXi: '—',
|
||||||
loading:false,
|
loading: false,
|
||||||
devName:''
|
devName: ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
monitorNum: '2',
|
monitorNum: '2',
|
||||||
desc: '系数下装',
|
desc: '系数下装',
|
||||||
type:'small',
|
type: 'small',
|
||||||
aVuData: '—',
|
aVuData: '—',
|
||||||
aVuXi:'—',
|
aVuXi: '—',
|
||||||
bVuData: '—',
|
bVuData: '—',
|
||||||
bVuXi: '—',
|
bVuXi: '—',
|
||||||
cVuData: '—',
|
cVuData: '—',
|
||||||
@@ -647,15 +683,15 @@ const dataTemplates2 : ChannelsTest.CoefficientVO[]= [
|
|||||||
bIeXi: '—',
|
bIeXi: '—',
|
||||||
cIeData: '—',
|
cIeData: '—',
|
||||||
cIeXi: '—',
|
cIeXi: '—',
|
||||||
loading:false,
|
loading: false,
|
||||||
devName:''
|
devName: ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
monitorNum: '3',
|
monitorNum: '3',
|
||||||
desc: '系数校准',
|
desc: '系数校准',
|
||||||
type:'big',
|
type: 'big',
|
||||||
aVuData: '—',
|
aVuData: '—',
|
||||||
aVuXi:'不合格',
|
aVuXi: '不合格',
|
||||||
bVuData: '—',
|
bVuData: '—',
|
||||||
bVuXi: '—',
|
bVuXi: '—',
|
||||||
cVuData: '—',
|
cVuData: '—',
|
||||||
@@ -666,15 +702,15 @@ const dataTemplates2 : ChannelsTest.CoefficientVO[]= [
|
|||||||
bIeXi: '—',
|
bIeXi: '—',
|
||||||
cIeData: '—',
|
cIeData: '—',
|
||||||
cIeXi: '—',
|
cIeXi: '—',
|
||||||
loading:false,
|
loading: false,
|
||||||
devName:''
|
devName: ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
monitorNum: '4',
|
monitorNum: '4',
|
||||||
desc: '系数校准',
|
desc: '系数校准',
|
||||||
type:'small',
|
type: 'small',
|
||||||
aVuData: '—',
|
aVuData: '—',
|
||||||
aVuXi:'—',
|
aVuXi: '—',
|
||||||
bVuData: '—',
|
bVuData: '—',
|
||||||
bVuXi: '—',
|
bVuXi: '—',
|
||||||
cVuData: '—',
|
cVuData: '—',
|
||||||
@@ -685,8 +721,8 @@ const dataTemplates2 : ChannelsTest.CoefficientVO[]= [
|
|||||||
bIeXi: '—',
|
bIeXi: '—',
|
||||||
cIeData: '—',
|
cIeData: '—',
|
||||||
cIeXi: '—',
|
cIeXi: '—',
|
||||||
loading:false,
|
loading: false,
|
||||||
devName:''
|
devName: ''
|
||||||
},
|
},
|
||||||
|
|
||||||
];
|
];
|
||||||
@@ -696,8 +732,8 @@ const updateErrorState = (index: number, hasError: boolean) => {
|
|||||||
errorStates.value[index] = hasError;
|
errorStates.value[index] = hasError;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = (selection: Device.ResPqDev[],plan:Plan.ReqPlan) => {
|
const open = (selection: Device.ResPqDev[], plan: Plan.ReqPlan) => {
|
||||||
CurV.value = selection[0]?.devVolt || 57.74;
|
CurV.value = selection[0]?.devVolt || 57.74;
|
||||||
isButtonDisabled.value = false; // 恢复按钮
|
isButtonDisabled.value = false; // 恢复按钮
|
||||||
select_Plan.value = plan
|
select_Plan.value = plan
|
||||||
@@ -715,18 +751,32 @@ const updateErrorState = (index: number, hasError: boolean) => {
|
|||||||
|
|
||||||
for (let i = 0; i < channel.value.length; i++) {
|
for (let i = 0; i < channel.value.length; i++) {
|
||||||
const currentTableData = initializeTableData(dataTemplates, i);
|
const currentTableData = initializeTableData(dataTemplates, i);
|
||||||
tableDataMap.set(i,currentTableData)
|
tableDataMap.set(i, currentTableData)
|
||||||
}
|
}
|
||||||
//console.log('tableDataMap',tableDataMap);
|
//console.log('tableDataMap',tableDataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'quitClicked'): void;
|
(e: 'quitClicked'): void;
|
||||||
(e: 'submitClicked', callback: (resolve: (value: boolean) => void) => void): void;
|
(e: 'submitClicked', callback: (resolve: (value: boolean) => void) => void): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const handleCancel=() => {
|
|
||||||
|
|
||||||
|
const beforeClose = (done: () => void) => {
|
||||||
|
ElMessageBox.confirm('是否退出系数校准?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
handleCancel()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
//dataSocket.socketServe.closeWs()
|
||||||
// 清空 name, channel, total
|
// 清空 name, channel, total
|
||||||
name.value = [];
|
name.value = [];
|
||||||
channel.value = [];
|
channel.value = [];
|
||||||
@@ -737,7 +787,11 @@ const updateErrorState = (index: number, hasError: boolean) => {
|
|||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
editableTabsValue.value = '0'
|
editableTabsValue.value = '0'
|
||||||
emit('quitClicked'); // 触发事件
|
emit('quitClicked'); // 触发事件
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const getTableDataForChannel = (index: number): any[] => {
|
const getTableDataForChannel = (index: number): any[] => {
|
||||||
const data = tableDataMap.get(index);
|
const data = tableDataMap.get(index);
|
||||||
@@ -746,8 +800,7 @@ const getTableDataForChannel = (index: number): any[] => {
|
|||||||
|
|
||||||
|
|
||||||
watch(activeIndex, function (newValue, oldValue) {
|
watch(activeIndex, function (newValue, oldValue) {
|
||||||
if(activeIndex.value === 1)
|
if (activeIndex.value === 1) {
|
||||||
{
|
|
||||||
outputDsc.value = "电压误差为:±0.1Un%; 电流误差为:±0.5%";
|
outputDsc.value = "电压误差为:±0.1Un%; 电流误差为:±0.5%";
|
||||||
// 当前源输出为:Ua=Ub=Uc=57.74V Ia=Ib=Ic=1A"
|
// 当前源输出为:Ua=Ub=Uc=57.74V Ia=Ib=Ic=1A"
|
||||||
}
|
}
|
||||||
@@ -777,14 +830,15 @@ const handleSubmit = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isButtonDisabled.value = true; // 禁用按钮
|
isButtonDisabled.value = true; // 禁用按钮
|
||||||
tableLoading('big','系数下装')
|
tableLoading('big', '系数下装')
|
||||||
await getCoefficientCheck({
|
await getCoefficientCheck({
|
||||||
userPageId: "cdf",
|
userPageId: "cdf",
|
||||||
devIds:devIdArray.value,
|
devIds: devIdArray.value,
|
||||||
planId:planId.value,
|
planId: planId.value,
|
||||||
errorSysId: select_Plan.value?.errorSysId,
|
errorSysId: select_Plan.value?.errorSysId,
|
||||||
scriptId: select_Plan.value?.scriptId,
|
scriptId: select_Plan.value?.scriptId,
|
||||||
operateType:'0' // '0'为预检测、‘1‘为正式检测
|
operateType: '0', // '0'为预检测、‘1‘为正式检测
|
||||||
|
userId: userStore.userInfo.id
|
||||||
})
|
})
|
||||||
active.value++;
|
active.value++;
|
||||||
|
|
||||||
@@ -793,65 +847,65 @@ const handleSubmit = async () => {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
// 初始化 currentTableData
|
// 初始化 currentTableData
|
||||||
let isTimer2Completed = false;
|
// let isTimer2Completed = false;
|
||||||
|
|
||||||
|
|
||||||
//"80b4b4f52a4c4064a18319525f8ac13c",
|
// //"80b4b4f52a4c4064a18319525f8ac13c",
|
||||||
for (let i = 0; i < channel.value.length; i++) {
|
// for (let i = 0; i < channel.value.length; i++) {
|
||||||
// 重置状态变量
|
// // 重置状态变量
|
||||||
active.value = 0;
|
// active.value = 0;
|
||||||
//activeIndex.value = 0;
|
// //activeIndex.value = 0;
|
||||||
editableTabsValue.value = i.toString();
|
// editableTabsValue.value = i.toString();
|
||||||
// 初始化并填充 currentTableData
|
// // 初始化并填充 currentTableData
|
||||||
const currentTableData = initializeTableData(dataTemplates2, i);
|
// const currentTableData = initializeTableData(dataTemplates2, i);
|
||||||
tableDataMap.set(i, currentTableData);
|
// tableDataMap.set(i, currentTableData);
|
||||||
//activeIndex.value++;
|
// //activeIndex.value++;
|
||||||
|
|
||||||
// 清除之前的 timer1
|
// // 清除之前的 timer1
|
||||||
clearInterval(timer1);
|
// clearInterval(timer1);
|
||||||
// 启动 timer1
|
// // 启动 timer1
|
||||||
timer1 = setInterval(() => {
|
// timer1 = setInterval(() => {
|
||||||
active.value++;
|
// active.value++;
|
||||||
if (active.value > 5) {
|
// if (active.value > 5) {
|
||||||
clearInterval(timer1);
|
// clearInterval(timer1);
|
||||||
}
|
// }
|
||||||
}, 3000);
|
// }, 3000);
|
||||||
|
|
||||||
// 清除之前的 timer2
|
// // 清除之前的 timer2
|
||||||
clearInterval(timer2);
|
// clearInterval(timer2);
|
||||||
// 启动 timer2
|
// // 启动 timer2
|
||||||
timer2 = setInterval(() => {
|
// timer2 = setInterval(() => {
|
||||||
// 初始化并填充 currentTableData
|
// // 初始化并填充 currentTableData
|
||||||
const currentTableData = initializeTableData(i > 0 ? dataTemplates2 : dataTemplates2, i);
|
// const currentTableData = initializeTableData(i > 0 ? dataTemplates2 : dataTemplates2, i);
|
||||||
tableDataMap.set(i, currentTableData);
|
// tableDataMap.set(i, currentTableData);
|
||||||
activeIndex.value++;
|
// activeIndex.value++;
|
||||||
|
|
||||||
clearInterval(timer2);
|
// clearInterval(timer2);
|
||||||
const currentDataRef = tableDataMap.get(i);
|
// const currentDataRef = tableDataMap.get(i);
|
||||||
if (currentDataRef) {
|
// if (currentDataRef) {
|
||||||
const currentData = currentDataRef.value;
|
// const currentData = currentDataRef.value;
|
||||||
// 检查当前数据中有无不合格字段
|
// // 检查当前数据中有无不合格字段
|
||||||
const hasError = checkForErrors(currentData);
|
// const hasError = checkForErrors(currentData);
|
||||||
if (hasError) {
|
// if (hasError) {
|
||||||
} else {
|
// } else {
|
||||||
qualified.value++;
|
// qualified.value++;
|
||||||
}
|
// }
|
||||||
updateErrorState(i, hasError);
|
// updateErrorState(i, hasError);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 设置标志变量为 true,表示 timer2 已经完成
|
// // 设置标志变量为 true,表示 timer2 已经完成
|
||||||
isTimer2Completed = true;
|
// isTimer2Completed = true;
|
||||||
}, 3000);
|
// }, 3000);
|
||||||
|
|
||||||
// 等待 timer2 完成
|
// // 等待 timer2 完成
|
||||||
while (!isTimer2Completed) {
|
// while (!isTimer2Completed) {
|
||||||
// 这里可以添加一个短暂的等待,避免死循环
|
// // 这里可以添加一个短暂的等待,避免死循环
|
||||||
await new Promise(resolve => setTimeout(resolve, 100));
|
// await new Promise(resolve => setTimeout(resolve, 100));
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 重置标志变量
|
// // 重置标志变量
|
||||||
isTimer2Completed = false;
|
// isTimer2Completed = false;
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
// 提取初始化并填充 currentTableData 的函数
|
// 提取初始化并填充 currentTableData 的函数
|
||||||
@@ -860,7 +914,7 @@ const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: num
|
|||||||
for (let j = 0; j < channel.value[index]; j++) {
|
for (let j = 0; j < channel.value[index]; j++) {
|
||||||
templates.forEach((template) => {
|
templates.forEach((template) => {
|
||||||
// 使用解构赋值排除 id 和 MonitorIdx 属性
|
// 使用解构赋值排除 id 和 MonitorIdx 属性
|
||||||
const { devName,monitorNum: __, ...rest } = template;
|
const {devName, monitorNum: __, ...rest} = template;
|
||||||
currentTableData.value.push({
|
currentTableData.value.push({
|
||||||
monitorNum: (j + 1).toString(),
|
monitorNum: (j + 1).toString(),
|
||||||
devName: name.value[index],
|
devName: name.value[index],
|
||||||
@@ -872,8 +926,8 @@ const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: num
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({open})
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
@@ -899,6 +953,7 @@ const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: num
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-tabs-label .el-icon {
|
.custom-tabs-label .el-icon {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
@@ -915,13 +970,15 @@ const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: num
|
|||||||
.el-tabs--border-card {
|
.el-tabs--border-card {
|
||||||
height: 470px;
|
height: 470px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* .el-icon svg {
|
/* .el-icon svg {
|
||||||
color: #ff7171;
|
color: #ff7171;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
.icon-style{
|
.icon-style {
|
||||||
color: #ff7171;
|
color: #ff7171;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
@@ -934,7 +991,7 @@ const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: num
|
|||||||
flex: 6;
|
flex: 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spanStyle{
|
.spanStyle {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,13 +38,13 @@
|
|||||||
<!-- <el-button type="primary" loading v-if="activeIndex > 0 && activeIndex < activeTotalNum">合格92项/共103项</el-button>
|
<!-- <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> -->
|
<el-button type="primary" v-if="activeIndex >= activeTotalNum" disabled>合格92项/共103项</el-button> -->
|
||||||
<span style=" font-size: 18px;font-weight: 600;">
|
<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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<el-table :data="tableData" :cell-class-name="tableCell" row-key="id" height="450px"
|
<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>
|
border>
|
||||||
<el-table-column fixed prop="scriptItemName" label="检测项目" width="210px" />
|
<el-table-column fixed prop="scriptItemName" label="检测项目" width="210px" />
|
||||||
<el-table-column label="被检通道1" :min-width="minwidth" align="center">
|
<el-table-column label="被检通道1" :min-width="minwidth" align="center">
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
v-model="scriptSwitch"
|
v-model="scriptSwitch"
|
||||||
class="ml-2"
|
class="ml-2"
|
||||||
inline-prompt
|
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="不合格测试项"
|
active-text="不合格测试项"
|
||||||
inactive-text="全部测试项"
|
inactive-text="全部测试项"
|
||||||
/> -->
|
/> -->
|
||||||
|
|||||||
@@ -1,22 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-button v-if="tableData.length > 0" type="primary" @click="exportData" style="margin-bottom: 10px">导出</el-button>
|
<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' } "
|
<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%;">
|
style="width: 100%;">
|
||||||
<el-table-column type="index" label="序号" width="70" fixed="left"/>
|
<el-table-column type="index" label="序号" width="70" fixed="left"/>
|
||||||
<el-table-column prop="time" label="数据时间"/>
|
<el-table-column prop="time" label="数据时间"/>
|
||||||
<template v-if="!isThreePhase && phaseT === 0">
|
<el-table-column v-if="!isThreePhase && phaseA==1" prop="dataA" :label="'A相'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="dataA" :label="'A相'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column v-if="!isThreePhase && phaseB==1" prop="dataB" :label="'B相'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="dataB" :label="'B相'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column v-if="!isThreePhase && phaseC==1" prop="dataC" :label="'C相'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="dataC" :label="'C相'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column v-if="!isThreePhase && phaseT === 1" prop="dataT" :label="tableHeader+(unit==''?'':'('+unit+')')"/>
|
||||||
</template>
|
<el-table-column v-if="isThreePhase" prop="dataB" :label="'负序不平衡度'+(unit==''?'':'('+unit+')')"/>
|
||||||
<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>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -37,6 +31,16 @@ const unit = computed(() => {
|
|||||||
return tableData.length > 0 ? tableData[0].unit : '';
|
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(() => {
|
const phaseT = computed(() => {
|
||||||
return tableData[0].dataT == '/' ? 0 : 1
|
return tableData[0].dataT == '/' ? 0 : 1
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,88 +8,79 @@
|
|||||||
<!-- {{ '通道' + row.chnNum }}-->
|
<!-- {{ '通道' + row.chnNum }}-->
|
||||||
<!-- </template>-->
|
<!-- </template>-->
|
||||||
<!-- </el-table-column>-->
|
<!-- </el-table-column>-->
|
||||||
<template v-if="phaseT === 0">
|
<el-table-column label="A相" v-if="phaseA === 1">
|
||||||
<el-table-column label="A相">
|
<el-table-column prop="stdA" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||||
<el-table-column prop="stdA" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="dataA" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||||
<el-table-column prop="dataA" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
|
||||||
<el-table-column prop="isDataA" label="检测结果">
|
<el-table-column prop="isDataA" label="检测结果">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip effect="dark" placement="bottom">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
<template #content>
|
<template #content>
|
||||||
误差范围:{{ scope.row.maxErrorA }} <br/>
|
误差范围:{{ scope.row.maxErrorA }} <br/>
|
||||||
误差值:{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }}
|
误差值:{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? innerUnitA : '' }}
|
||||||
</template>
|
</template>
|
||||||
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
|
<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="danger" v-if="scope.row.isDataA === 2">不符合</el-tag>
|
||||||
<el-tag type="warning" v-if="scope.row.isDataA === 4">/</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>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="B相">
|
<el-table-column label="B相" v-if="phaseB === 1">
|
||||||
<el-table-column prop="stdB" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="stdB" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||||
<el-table-column prop="dataB" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="dataB" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||||
<el-table-column prop="isDataB" label="检测结果">
|
<el-table-column prop="isDataB" label="检测结果">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip effect="dark" placement="bottom">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
<template #content>
|
<template #content>
|
||||||
误差范围:{{ scope.row.maxErrorB }}<br/>
|
误差范围:{{ scope.row.maxErrorB }}<br/>
|
||||||
误差值:{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }}
|
误差值:{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? innerUnitB : '' }}
|
||||||
</template>
|
</template>
|
||||||
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
|
<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="danger" v-if="scope.row.isDataB === 2">不符合</el-tag>
|
||||||
<el-tag type="warning" v-if="scope.row.isDataB === 4">/</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>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="C相">
|
<el-table-column label="C相" v-if="phaseC === 1">
|
||||||
<el-table-column prop="stdC" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="stdC" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||||
<el-table-column prop="dataC" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="dataC" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||||
<el-table-column prop="isDataC" label="检测结果">
|
<el-table-column prop="isDataC" label="检测结果">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip effect="dark" placement="bottom">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
<template #content>
|
<template #content>
|
||||||
误差范围: {{ scope.row.maxErrorC }}<br/>
|
误差范围: {{ scope.row.maxErrorC }}<br/>
|
||||||
误差值:{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }}
|
误差值:{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? innerUnitC : '' }}
|
||||||
</template>
|
</template>
|
||||||
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
|
<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="danger" v-if="scope.row.isDataC === 2">不符合</el-tag>
|
||||||
<el-tag type="warning" v-if="scope.row.isDataC === 4">/</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>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="phaseT === 1">
|
<el-table-column :label="tableHeader" v-if="phaseT === 1">
|
||||||
<el-table-column :label="tableHeader">
|
<el-table-column prop="stdT" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||||
<el-table-column prop="stdT" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="dataT" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||||
<el-table-column prop="dataT" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
|
||||||
<el-table-column prop="isDataT" label="检测结果">
|
<el-table-column prop="isDataT" label="检测结果">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip effect="dark" placement="bottom">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
<template #content>
|
<template #content>
|
||||||
误差范围: {{ scope.row.maxErrorT }}<br/>
|
误差范围: {{ scope.row.maxErrorT }}<br/>
|
||||||
误差值:{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }}
|
误差值:{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? innerUnitT : '' }}
|
||||||
</template>
|
</template>
|
||||||
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
|
<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="danger" v-if="scope.row.isDataT === 2">不符合</el-tag>
|
||||||
<el-tag type="warning" v-if="scope.row.isDataT === 4">/</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>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</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>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -105,16 +96,39 @@ const {tableData, currentScriptTypeName} = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
||||||
const unit = computed(() => {
|
const outerUnit = computed(() => {
|
||||||
return tableData.length > 0 ? tableData[0].unit : '';
|
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(() => {
|
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(() => {
|
const tableHeader = computed(() => {
|
||||||
if (phaseT.value === 1){
|
if (phaseT.value === 1) {
|
||||||
let index = currentScriptTypeName.indexOf('=');
|
let index = currentScriptTypeName.indexOf('=');
|
||||||
return currentScriptTypeName.substring(0, index);
|
return currentScriptTypeName.substring(0, index);
|
||||||
}
|
}
|
||||||
@@ -125,7 +139,7 @@ const tableHeader = computed(() => {
|
|||||||
// let result = tableData[0].maxError ?? '/'
|
// let result = tableData[0].maxError ?? '/'
|
||||||
// let idx = result.indexOf('~');
|
// let idx = result.indexOf('~');
|
||||||
// if (idx > 0) {
|
// 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;
|
// return result;
|
||||||
// })
|
// })
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :append-to-body="appendToBody" class="dialog" title="数据查询" :model-value='visible' @close="close"
|
<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-dialog">
|
||||||
<div class="data-check-head">
|
<div class="data-check-head">
|
||||||
<el-form :model='formContent' label-width="auto" class="form-three ">
|
<el-form :model='formContent' label-width="auto" class="form-three ">
|
||||||
@@ -8,7 +8,14 @@
|
|||||||
<el-input v-model='formContent.scriptName' :disabled="true"/>
|
<el-input v-model='formContent.scriptName' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="误差体系">
|
<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>
|
||||||
<el-form-item label="数据原则">
|
<el-form-item label="数据原则">
|
||||||
<el-input v-model='formContent.dataRule' :disabled="true"/>
|
<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-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</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>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -40,7 +53,7 @@
|
|||||||
:props="defaultProps"
|
:props="defaultProps"
|
||||||
@node-click="handleNodeClick" class="custom-tree" ref="treeRef">
|
@node-click="handleNodeClick" class="custom-tree" ref="treeRef">
|
||||||
<template #default="{ node, data }">
|
<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;':''">{{
|
<span class="custom-tree-node" :style="data.fly===2? 'color: #F56C6C;':data.fly===4? 'color: #e6a23c;':''">{{
|
||||||
data.scriptTypeName
|
data.scriptTypeName
|
||||||
}}</span>
|
}}</span>
|
||||||
@@ -52,7 +65,7 @@
|
|||||||
|
|
||||||
<div class="content-right">
|
<div class="content-right">
|
||||||
<div class="content-right-title">
|
<div class="content-right-title">
|
||||||
<div style="width: 750px;">
|
<div style="width: 840px;">
|
||||||
<span class="content-right-title-text">当前检测项目:
|
<span class="content-right-title-text">当前检测项目:
|
||||||
<el-popover trigger="hover" :content="currentDesc" :width="popoverWidth" placement="right">
|
<el-popover trigger="hover" :content="currentDesc" :width="popoverWidth" placement="right">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
@@ -63,15 +76,13 @@
|
|||||||
</el-popover>
|
</el-popover>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- <el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 210px;" v-if="harmNumList.length" label='次数'>-->
|
<el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 280px;" v-if="checkListLevel.length" label='测试项'>
|
||||||
<!-- <el-select v-model="currentHarmNum">-->
|
<el-cascader
|
||||||
<!-- <el-option v-for="item in harmNumList" :key="item.value" :label="item.label" :value="item.value"/>-->
|
v-model="currentCheckItem"
|
||||||
<!-- </el-select>-->
|
:options="checkListLevel"
|
||||||
<!-- </el-form-item>-->
|
:props="{expandTrigger: 'click' as const}"
|
||||||
<el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 230px;" v-if="checkList.length" label='测试项'>
|
placement="bottom-end"
|
||||||
<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>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-right-Tabs">
|
<div class="content-right-Tabs">
|
||||||
@@ -98,9 +109,12 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
|||||||
import {CheckData} from "@/api/check/interface";
|
import {CheckData} from "@/api/check/interface";
|
||||||
import {useDictStore} from "@/stores/modules/dict";
|
import {useDictStore} from "@/stores/modules/dict";
|
||||||
import {useCheckStore} from "@/stores/modules/check";
|
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 {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<{
|
const {appendToBody} = withDefaults(defineProps<{
|
||||||
appendToBody: boolean
|
appendToBody: boolean
|
||||||
@@ -117,6 +131,7 @@ const checkStore = useCheckStore()
|
|||||||
const visible = ref(false)
|
const visible = ref(false)
|
||||||
const treeRef = ref()
|
const treeRef = ref()
|
||||||
const searchValue = ref<string>('')
|
const searchValue = ref<string>('')
|
||||||
|
const pqErrorList = reactive<{ id: string; name: string; }[]>([])
|
||||||
watch(searchValue, (val) => {
|
watch(searchValue, (val) => {
|
||||||
treeRef.value!.filter(val)
|
treeRef.value!.filter(val)
|
||||||
})
|
})
|
||||||
@@ -127,19 +142,22 @@ const fixed = 4;
|
|||||||
// 表单数据
|
// 表单数据
|
||||||
const formContent = reactive<CheckData.DataCheck>({
|
const formContent = reactive<CheckData.DataCheck>({
|
||||||
scriptName: '',
|
scriptName: '',
|
||||||
errorSysName: '',
|
errorSysId: '',
|
||||||
dataRule: '',
|
dataRule: '',
|
||||||
deviceName: '',
|
deviceName: '',
|
||||||
chnNum: '',
|
chnNum: '',
|
||||||
})
|
})
|
||||||
// 当前选中的谐波次数
|
// 原始误差体系id
|
||||||
// const currentHarmNum = ref<string>("-1")
|
let originErrorSysId: string = ''
|
||||||
|
let planCode: string = ''
|
||||||
// 谐波次数列表
|
// 谐波次数列表
|
||||||
// const harmNumList = reactive<{ value: string, label: 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 deviceId: string = ''
|
||||||
let originScriptType: string | null = null
|
let originScriptType: string | null = null
|
||||||
@@ -163,14 +181,13 @@ const currentDesc = ref('');
|
|||||||
const activeTab = ref<string>('resultTab')
|
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 checkResultData = reactive<CheckData.CheckResult[]>([])
|
||||||
|
|
||||||
const popoverWidth: ComputedRef<string> = computed(() => {
|
const popoverWidth: ComputedRef<string> = computed(() => {
|
||||||
// return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (harmNumList.length || checkList.length ? 160 : 0)}px`
|
return `${1140 - (currentScriptTypeName.value.length + 7 + 3) * 14 - (checkListLevel.length ? 280 : 0)}px`
|
||||||
return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (checkList.length ? 220 : 0)}px`
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -193,24 +210,56 @@ const handleNodeClick = async (data: any) => {
|
|||||||
currentDesc.value = data.sourceDesc
|
currentDesc.value = data.sourceDesc
|
||||||
scriptType = data.scriptType ?? scriptType
|
scriptType = data.scriptType ?? scriptType
|
||||||
|
|
||||||
if (checkIndex.value) {
|
console.log("点击左侧树节点触发事件handleNodeClick", checkIndex.value)
|
||||||
|
if (checkIndex.value !== '') {
|
||||||
await updateTableData()
|
await updateTableData()
|
||||||
activeTab.value = 'resultTab'
|
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) => {
|
watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||||
// console.log("通道号", newVal);
|
// console.log("通道号", newVal);
|
||||||
|
if (newVal != '') {
|
||||||
|
handleChnNumChange()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
if (newVal) {
|
const handleChnNumChange = async () => {
|
||||||
|
console.log("通道号", formContent.chnNum);
|
||||||
// 发起请求,查询该测试项的检测结果
|
// 发起请求,查询该测试项的检测结果
|
||||||
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
|
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
|
||||||
scriptId: checkStore.scriptId,
|
scriptId: checkStore.plan.scriptId,
|
||||||
devId: deviceId,
|
devId: deviceId,
|
||||||
devNum: formContent.chnNum + '',
|
devNum: formContent.chnNum + '',
|
||||||
scriptType: originScriptType,
|
scriptType: originScriptType,
|
||||||
code: parseInt(checkStore.planCode)
|
code: planCode
|
||||||
})
|
})
|
||||||
updateTreeFly(resTreeDataTemp, 4)
|
updateTreeFly(resTreeDataTemp, 4)
|
||||||
updateTreeFly(resTreeDataTemp, 2)
|
updateTreeFly(resTreeDataTemp, 2)
|
||||||
@@ -221,31 +270,18 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
|||||||
|
|
||||||
defaultOperate()
|
defaultOperate()
|
||||||
await updateTableData()
|
await updateTableData()
|
||||||
}
|
|
||||||
activeTab.value = 'resultTab'
|
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'
|
|
||||||
// })
|
|
||||||
|
|
||||||
|
|
||||||
watch(currentCheckItem, (newVal, oldVal) => {
|
watch(currentCheckItem, (newVal, oldVal) => {
|
||||||
console.log("当前检测项", newVal);
|
if (newVal !== '') {
|
||||||
if (newVal) {
|
let key = newVal[0]
|
||||||
doCurrentCheckItemUpdate(newVal)
|
if (newVal.length == 2) {
|
||||||
|
key += "_" + newVal[1]
|
||||||
|
}
|
||||||
|
console.log("当前检测项", key);
|
||||||
|
doCurrentCheckItemUpdate(key)
|
||||||
} else {
|
} else {
|
||||||
activeTab.value = 'resultTab'
|
activeTab.value = 'resultTab'
|
||||||
}
|
}
|
||||||
@@ -272,80 +308,85 @@ const defaultOperate = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const updateTableData = async () => {
|
const updateTableData = async () => {
|
||||||
// console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
||||||
if (checkIndex.value) {
|
if (checkIndex.value !== '') {
|
||||||
|
|
||||||
|
checkListLevel.length = 0
|
||||||
|
checkResultData.length = 0
|
||||||
|
rawTableData.length = 0
|
||||||
|
currentCheckItem.value = ''
|
||||||
|
|
||||||
// console.log("更新表格数据");
|
// console.log("更新表格数据");
|
||||||
// 发起请求,查询该测试项的检测结果
|
// 发起请求,查询该测试项的检测结果
|
||||||
const {data} = await getTableData({
|
const {data} = await getTableData({
|
||||||
scriptType,
|
scriptType,
|
||||||
scriptId: checkStore.scriptId,
|
scriptId: checkStore.plan.scriptId,
|
||||||
devId: deviceId,
|
devId: deviceId,
|
||||||
devNum: formContent.chnNum + '',
|
devNum: formContent.chnNum + '',
|
||||||
code: parseInt(checkStore.planCode),
|
code: planCode,
|
||||||
index: parseInt(checkIndex.value),
|
index: parseInt(checkIndex.value),
|
||||||
})
|
})
|
||||||
|
|
||||||
let keys1 = Object.keys(data.resultData)
|
let keys1 = Object.keys(data.resultData)
|
||||||
let resultData = new Map()
|
let resultData = new Map()
|
||||||
for (let key of keys1) {
|
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 keys2 = Object.keys(data.rawData)
|
||||||
let rawData = new Map()
|
let rawData = new Map()
|
||||||
for (let key of keys2) {
|
for (let key of keys2) {
|
||||||
|
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 {
|
||||||
rawData.set(key, data.rawData[key])
|
rawData.set(key, data.rawData[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
resTableData = {
|
|
||||||
resultData,
|
|
||||||
rawData
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let resCheckResult: CheckData.ResCheckResult = {}
|
|
||||||
let resRawData: CheckData.RawDataItem[] = []
|
|
||||||
|
|
||||||
if (keys1.length === 0) {
|
resTableData.resultData = resultData
|
||||||
checkList.length = 0
|
resTableData.rawData = rawData
|
||||||
checkResultData.length = 0
|
|
||||||
rawTableData.length = 0
|
|
||||||
currentCheckItem.value = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keys1.length === 1) {
|
toAngleLast()
|
||||||
resCheckResult = resTableData.resultData.get(keys1[0])
|
|
||||||
resRawData = resTableData.rawData.get(keys2[0])
|
|
||||||
|
|
||||||
resRawData = (resRawData == null || resRawData == undefined ? [] : resRawData)
|
if (checkListLevel.length !== 0) {
|
||||||
resCheckResult = (resCheckResult == null || resCheckResult == undefined ? {} : resCheckResult)
|
if (checkListLevel[0].children.length !== 0) {
|
||||||
setCheckResultData(resCheckResult)
|
currentCheckItem.value = [checkListLevel[0].value + '', checkListLevel[0].children[0].value + '']
|
||||||
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)
|
|
||||||
} else {
|
} else {
|
||||||
currentCheckItem.value = tempCheckList[0].value
|
currentCheckItem.value = [checkListLevel[0].value + '']
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// setCheckResultData(resCheckResult)
|
|
||||||
else {
|
} else {
|
||||||
checkResultData.length = 0
|
checkResultData.length = 0
|
||||||
rawTableData.length = 0
|
rawTableData.length = 0
|
||||||
}
|
}
|
||||||
@@ -366,13 +407,14 @@ const doCurrentCheckItemUpdate = (newVal: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
|
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
|
||||||
|
planCode = checkStore.plan.code + ''
|
||||||
deviceId = _deviceId
|
deviceId = _deviceId
|
||||||
originScriptType = _scriptType
|
originScriptType = _scriptType
|
||||||
scriptType = _scriptType
|
scriptType = _scriptType
|
||||||
|
|
||||||
// 发起后端请求,查询详细信息 当chnNum为-1时,查询所有通道号
|
// 发起后端请求,查询详细信息 当chnNum为-1时,查询所有通道号
|
||||||
const {data: resFormContent}: { data: any } = await getFormData({
|
const {data: resFormContent}: { data: any } = await getFormData({
|
||||||
planId: checkStore.planId,
|
planId: checkStore.plan.id,
|
||||||
deviceId,
|
deviceId,
|
||||||
chnNum,
|
chnNum,
|
||||||
scriptType
|
scriptType
|
||||||
@@ -380,23 +422,51 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
|
|||||||
|
|
||||||
chnList = resFormContent.chnList.map((item: { value: string, label: string }) => ({
|
chnList = resFormContent.chnList.map((item: { value: string, label: string }) => ({
|
||||||
value: item.value,
|
value: item.value,
|
||||||
// label: item.value
|
label: item.value
|
||||||
label: item.label == '1' ? `${item.value}` : item.label == '2' ? `${item.value}(不符合)` : `${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, {
|
Object.assign(formContent, {
|
||||||
...resFormContent,
|
...resFormContent,
|
||||||
dataRule: dataRuleName,
|
|
||||||
chnNum: chnList.length > 0 ? chnList[0].value : '',
|
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;
|
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, {
|
Object.assign(formContent, {
|
||||||
scriptName: '',
|
scriptName: '',
|
||||||
@@ -411,18 +481,23 @@ const close = () => {
|
|||||||
currentCheckItem.value = ''
|
currentCheckItem.value = ''
|
||||||
checkResultData.length = 0
|
checkResultData.length = 0
|
||||||
rawTableData.length = 0
|
rawTableData.length = 0
|
||||||
checkList.length = 0
|
//checkList.length = 0
|
||||||
defaultExpandedKeys = []
|
defaultExpandedKeys = []
|
||||||
checkIndex.value = ''
|
checkIndex.value = ''
|
||||||
activeTab.value = 'resultTab'
|
activeTab.value = 'resultTab'
|
||||||
currentScriptTypeName.value = ''
|
currentScriptTypeName.value = ''
|
||||||
currentDesc.value = ''
|
currentDesc.value = ''
|
||||||
|
pqErrorList.length = 0
|
||||||
|
planCode = ''
|
||||||
|
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
|
|
||||||
|
if (checkStore.showDetailType === 1) {
|
||||||
|
await deleteTempTable(checkStore.plan.code + '')
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||||
// console.log("检测结果", data);
|
|
||||||
let result: CheckData.CheckResult[] = []
|
let result: CheckData.CheckResult[] = []
|
||||||
if (data == null || data == undefined) {
|
if (data == null || data == undefined) {
|
||||||
Object.assign(checkResultData, [])
|
Object.assign(checkResultData, [])
|
||||||
@@ -430,21 +505,30 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
|||||||
}
|
}
|
||||||
if (data.dataA != null && data.dataB != null && data.dataC != null) {
|
if (data.dataA != null && data.dataB != null && data.dataC != null) {
|
||||||
result.push({
|
result.push({
|
||||||
stdA: numberToFixed(data.dataA.resultData),
|
// stdA: numberToFixed(data.dataA.resultData),
|
||||||
dataA: numberToFixed(data.dataA.data),
|
// dataA: numberToFixed(data.dataA.data),
|
||||||
errorA: getError(data.dataA.resultData, data.dataA.data),
|
stdA: dataToShow(data.dataA.resultData),
|
||||||
maxErrorA: toMaxErrorStr(data.dataA.radius, data.unit),
|
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,
|
isDataA: data.dataA.isData,
|
||||||
stdB: numberToFixed(data.dataB.resultData),
|
// stdB: numberToFixed(data.dataB.resultData),
|
||||||
dataB: numberToFixed(data.dataB.data),
|
// dataB: numberToFixed(data.dataB.data),
|
||||||
errorB: getError(data.dataB.resultData, data.dataB.data),
|
stdB: dataToShow(data.dataB.resultData),
|
||||||
maxErrorB: toMaxErrorStr(data.dataB.radius, data.unit),
|
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,
|
isDataB: data.dataB.isData,
|
||||||
stdC: numberToFixed(data.dataC.resultData),
|
unitB: data.dataB.unit,
|
||||||
dataC: numberToFixed(data.dataC.data),
|
// stdC: numberToFixed(data.dataC.resultData),
|
||||||
errorC: getError(data.dataC.resultData, data.dataC.data),
|
// dataC: numberToFixed(data.dataC.data),
|
||||||
maxErrorC: toMaxErrorStr(data.dataC.radius, data.unit),
|
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,
|
isDataC: data.dataC.isData,
|
||||||
|
unitC: data.dataC.unit,
|
||||||
|
|
||||||
maxError: data.radius,
|
maxError: data.radius,
|
||||||
unit: data.unit,
|
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({
|
result.push({
|
||||||
stdT: numberToFixed(data.dataT.resultData),
|
// stdT: numberToFixed(data.dataT.resultData),
|
||||||
dataT: numberToFixed(data.dataT.data),
|
// dataT: numberToFixed(data.dataT.data),
|
||||||
errorT: getError(data.dataT.resultData, data.dataT.data),
|
stdT: dataToShow(data.dataT.resultData),
|
||||||
maxErrorT: toMaxErrorStr(data.dataT.radius, data.unit),
|
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,
|
isDataT: data.dataT?.isData,
|
||||||
|
unitT: data.dataT.unit,
|
||||||
|
|
||||||
maxError: data.radius,
|
maxError: data.radius,
|
||||||
unit: data.unit,
|
unit: data.unit,
|
||||||
@@ -466,15 +553,16 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
Object.assign(checkResultData, result)
|
Object.assign(checkResultData, result)
|
||||||
|
console.log("检测结果", checkResultData);
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportRawDataHandler = () => {
|
const exportRawDataHandler = () => {
|
||||||
useDownload(exportRawData, '原始数据.xlsx', {
|
useDownload(exportRawData, '原始数据', {
|
||||||
scriptType,
|
scriptType,
|
||||||
scriptId: checkStore.scriptId,
|
scriptId: checkStore.plan.scriptId,
|
||||||
devId: deviceId,
|
devId: deviceId,
|
||||||
devNum: formContent.chnNum + '',
|
devNum: formContent.chnNum + '',
|
||||||
code: parseInt(checkStore.planCode),
|
code: checkStore.plan.code + '',
|
||||||
index: parseInt(checkIndex.value),
|
index: parseInt(checkIndex.value),
|
||||||
}, false, '.xlsx')
|
}, false, '.xlsx')
|
||||||
}
|
}
|
||||||
@@ -491,14 +579,26 @@ const formatHarmNum = (num: string) => {
|
|||||||
|
|
||||||
const setRawData = (data: CheckData.RawDataItem[]) => {
|
const setRawData = (data: CheckData.RawDataItem[]) => {
|
||||||
data.forEach((item: CheckData.RawDataItem) => {
|
data.forEach((item: CheckData.RawDataItem) => {
|
||||||
item.dataA = stringToFixed(item.dataA)
|
// item.dataA = stringToFixed(item.dataA)
|
||||||
item.dataB = stringToFixed(item.dataB)
|
// item.dataB = stringToFixed(item.dataB)
|
||||||
item.dataC = stringToFixed(item.dataC)
|
// item.dataC = stringToFixed(item.dataC)
|
||||||
item.dataT = stringToFixed(item.dataT)
|
// 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)
|
Object.assign(rawTableData, data)
|
||||||
console.log("原始数据", rawTableData)
|
console.log("原始数据", rawTableData)
|
||||||
}
|
}
|
||||||
|
const dataToShow = (num: number): string => {
|
||||||
|
if (num == null || num == undefined) {
|
||||||
|
return '/'
|
||||||
|
}
|
||||||
|
return num+''
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const numberToFixed = (num: number): string => {
|
const numberToFixed = (num: number): string => {
|
||||||
if (num == null || num == undefined) {
|
if (num == null || num == undefined) {
|
||||||
@@ -564,18 +664,18 @@ const getDefaultNode = (data: any[]) => {
|
|||||||
return findFirstLeafNode(firstElement);
|
return findFirstLeafNode(firstElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
const toAngleLast = (data: any[]) => {
|
const toAngleLast = () => {
|
||||||
let angleIndex = -1
|
let angleIndex = -1
|
||||||
for (let i = 0; i < data.length; i++) {
|
for (let i = 0; i < checkListLevel.length; i++) {
|
||||||
if (data[i].value.toString().includes('相角')) {
|
if (checkListLevel[i].value.toString().includes('相角')) {
|
||||||
angleIndex = i
|
angleIndex = i
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (angleIndex != -1) {
|
if (angleIndex != -1) {
|
||||||
let temp = data[angleIndex]
|
let temp = checkListLevel[angleIndex]
|
||||||
data.splice(angleIndex, 1)
|
checkListLevel.splice(angleIndex, 1)
|
||||||
data.push(temp)
|
checkListLevel.push(temp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,7 +747,6 @@ defineExpose({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
.dialog {
|
.dialog {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -742,7 +841,7 @@ defineExpose({
|
|||||||
<!--.el-popover.popover-class {-->
|
<!--.el-popover.popover-class {-->
|
||||||
<!-- .el-popover__title {-->
|
<!-- .el-popover__title {-->
|
||||||
<!-- color: #fff;-->
|
<!-- color: #fff;-->
|
||||||
<!-- background-color: #003078 !important;-->
|
<!-- background-color: var(--el-color-primary) !important;-->
|
||||||
<!-- }-->
|
<!-- }-->
|
||||||
<!--}-->
|
<!--}-->
|
||||||
<!--</style>-->
|
<!--</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="预检测项目">
|
<el-tab-pane label="预检测项目">
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<el-checkbox v-for="(item, index) in detectionOptions" v-model="item.selected" :key="index"
|
<el-checkbox v-for="(item, index) in detectionOptions" v-model="item.selected" :key="index"
|
||||||
:label="item.name"></el-checkbox>
|
:label="item.name" disabled></el-checkbox>
|
||||||
<!-- disabled="true" -->
|
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
@@ -18,7 +17,7 @@
|
|||||||
<el-step :status="step2" title="设备通讯校验"/>
|
<el-step :status="step2" title="设备通讯校验"/>
|
||||||
<el-step :status="step3" title="协议校验"/>
|
<el-step :status="step3" title="协议校验"/>
|
||||||
<el-step :status="step4" title="相序校验"/>
|
<el-step :status="step4" title="相序校验"/>
|
||||||
<el-step :status="step5" title="检测完成"/>
|
<el-step :status="step5" :title="ts === 'error'? '检测失败':ts === 'process'? '检测中':ts === 'success'? '检测成功':'待检测'"/>
|
||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog-right">
|
<div class="dialog-right">
|
||||||
@@ -69,7 +68,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup name="preTest">
|
<script lang="tsx" setup name="preTest">
|
||||||
import {ElMessage, ElMessageBox} from "element-plus";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
import {defineExpose} from 'vue';
|
import {defineExpose, toRef} from 'vue';
|
||||||
|
|
||||||
const step1InitLog = ref([
|
const step1InitLog = ref([
|
||||||
{
|
{
|
||||||
@@ -234,8 +233,7 @@ const webMsgSend = toRef(props, 'webMsgSend');
|
|||||||
const ts = ref('');
|
const ts = ref('');
|
||||||
|
|
||||||
watch(webMsgSend, function (newValue, oldValue) {
|
watch(webMsgSend, function (newValue, oldValue) {
|
||||||
// console.log(newValue)
|
if (testStatus.value !== 'waiting') {
|
||||||
|
|
||||||
switch (newValue.requestId) {
|
switch (newValue.requestId) {
|
||||||
case 'yjc_ytxjy':
|
case 'yjc_ytxjy':
|
||||||
switch (newValue.operateCode) {
|
switch (newValue.operateCode) {
|
||||||
@@ -258,9 +256,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
ElMessage.error(newValue.code)
|
ElMessage.error(newValue.code)
|
||||||
step1.value = 'error'
|
step1.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
} else if (newValue.code == 10523) {
|
} else if (newValue.code == 10523) {
|
||||||
step1.value = 'error'
|
step1.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
step1InitLog.value = [{
|
step1InitLog.value = [{
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: '源连接失败!',
|
log: '源连接失败!',
|
||||||
@@ -268,6 +268,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
} else if (newValue.code == -1) {
|
} else if (newValue.code == -1) {
|
||||||
step1.value = 'error'
|
step1.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
step1InitLog.value = [{
|
step1InitLog.value = [{
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: '源未知异常!',
|
log: '源未知异常!',
|
||||||
@@ -301,6 +302,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
})
|
})
|
||||||
step2.value = 'error'
|
step2.value = 'error'
|
||||||
// ts.value = 'error'
|
// ts.value = 'error'
|
||||||
|
// step5.value = 'error'
|
||||||
} else if (newValue.code == 10551) {
|
} else if (newValue.code == 10551) {
|
||||||
step2InitLog.value.push({
|
step2InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@@ -308,6 +310,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
})
|
})
|
||||||
step2.value = 'error'
|
step2.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
} else if (newValue.code == 10552) {
|
} else if (newValue.code == 10552) {
|
||||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||||
step2InitLog.value = [{
|
step2InitLog.value = [{
|
||||||
@@ -316,6 +319,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
}];
|
}];
|
||||||
step2.value = 'error'
|
step2.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
} else if (newValue.code == 25001) {
|
} else if (newValue.code == 25001) {
|
||||||
activeIndex.value = 2
|
activeIndex.value = 2
|
||||||
step2.value = 'success'
|
step2.value = 'success'
|
||||||
@@ -347,6 +351,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
// ts.value = 'error'
|
// ts.value = 'error'
|
||||||
|
// step5.value = 'error'
|
||||||
} else if (newValue.code == 10551) {
|
} else if (newValue.code == 10551) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@@ -354,6 +359,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
} else if (newValue.code == 10552) {
|
} else if (newValue.code == 10552) {
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||||
@@ -362,6 +368,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||||
}];
|
}];
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'INIT_GATHER$02':
|
case 'INIT_GATHER$02':
|
||||||
@@ -384,6 +391,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
// ts.value = 'error'
|
// ts.value = 'error'
|
||||||
|
// step5.value = 'error'
|
||||||
} else if (newValue.code == 10551) {
|
} else if (newValue.code == 10551) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@@ -391,6 +399,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
} else if (newValue.code == 10552) {
|
} else if (newValue.code == 10552) {
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||||
@@ -399,6 +408,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||||
}];
|
}];
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'INIT_GATHER$03':
|
case 'INIT_GATHER$03':
|
||||||
@@ -417,6 +427,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
// ts.value = 'error'
|
// ts.value = 'error'
|
||||||
|
// step5.value = 'error'
|
||||||
} else if (newValue.code == 10551) {
|
} else if (newValue.code == 10551) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@@ -424,6 +435,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
} else if (newValue.code == 10552) {
|
} else if (newValue.code == 10552) {
|
||||||
//ElMessage.error("当前步骤已经初始化,执行自动关闭,请重新发起检测!")
|
//ElMessage.error("当前步骤已经初始化,执行自动关闭,请重新发起检测!")
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
@@ -432,14 +444,34 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||||
}];
|
}];
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
} else if (newValue.code == 25001) {
|
step5.value = 'error'
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'VERIFY_MAPPING$01':
|
||||||
|
if (newValue.code == 25001) {
|
||||||
activeIndex.value = 3
|
activeIndex.value = 3
|
||||||
step3.value = 'success'
|
step3.value = 'success'
|
||||||
step4.value = 'process'
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'YJC_xujy':
|
case 'YJC_xujy':
|
||||||
switch (newValue.operateCode) {
|
switch (newValue.operateCode) {
|
||||||
@@ -460,6 +492,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||||
step4.value = 'error'
|
step4.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
} else if (newValue.code == 10520) {
|
} else if (newValue.code == 10520) {
|
||||||
step4.value = 'error'
|
step4.value = 'error'
|
||||||
step4InitLog.value.push({
|
step4InitLog.value.push({
|
||||||
@@ -467,6 +500,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
log: '解析报文异常',
|
log: '解析报文异常',
|
||||||
})
|
})
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -480,7 +514,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
newValue.data.split('<br/>')
|
newValue.data.split('<br/>')
|
||||||
step4InitLog.value.push({
|
step4InitLog.value.push({
|
||||||
type: type,
|
type: type,
|
||||||
log:newValue.data,
|
log: newValue.data,
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if (newValue.code == 10201) {
|
} else if (newValue.code == 10201) {
|
||||||
@@ -496,6 +530,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
log: '相序校验未通过!',
|
log: '相序校验未通过!',
|
||||||
})
|
})
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
} else if (newValue.code == 25001) {
|
} else if (newValue.code == 25001) {
|
||||||
step4.value = 'success'
|
step4.value = 'success'
|
||||||
step5.value = 'success'
|
step5.value = 'success'
|
||||||
@@ -503,9 +538,10 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
type: 'wait',
|
type: 'wait',
|
||||||
log: '相序校验成功!',
|
log: '相序校验成功!',
|
||||||
})
|
})
|
||||||
|
ts.value = 'success'
|
||||||
}
|
}
|
||||||
activeIndex.value = 5
|
activeIndex.value = 5
|
||||||
ts.value = 'success'
|
console.log("@@@@", ts.value)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,6 +557,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
log: '源服务端连接失败!',
|
log: '源服务端连接失败!',
|
||||||
}];
|
}];
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
break;
|
break;
|
||||||
case "Dev":
|
case "Dev":
|
||||||
step2.value = 'error'
|
step2.value = 'error'
|
||||||
@@ -529,6 +566,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
log: '设备服务端连接失败!',
|
log: '设备服务端连接失败!',
|
||||||
}];
|
}];
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -541,9 +579,34 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
ts.value = '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;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(activeIndex, function (newValue, oldValue) {
|
watch(activeIndex, function (newValue, oldValue) {
|
||||||
@@ -556,7 +619,6 @@ watch(activeIndex, function (newValue, oldValue) {
|
|||||||
|
|
||||||
//监听goods_sn的变化
|
//监听goods_sn的变化
|
||||||
watch(testStatus, function (newValue, oldValue) {
|
watch(testStatus, function (newValue, oldValue) {
|
||||||
|
|
||||||
ts.value = props.testStatus;
|
ts.value = props.testStatus;
|
||||||
if (ts.value === 'start') {
|
if (ts.value === 'start') {
|
||||||
ts.value = 'process'
|
ts.value = 'process'
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<div class="tabs-title ">
|
<div class="tabs-title ">
|
||||||
<el-button type="primary" :icon="Download" >报告下载</el-button>
|
<el-button type="primary" :icon="Download" >报告下载</el-button>
|
||||||
<span style=" font-size: 18px;font-weight: 600;">
|
<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>
|
</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
113
frontend/src/views/home/components/selectTestItemPopup.vue
Normal file
113
frontend/src/views/home/components/selectTestItemPopup.vue
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<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="AppSceneStore.currentScene === '1'" 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 {ref} from "vue";
|
||||||
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
|
import type {CheckData} from "@/api/check/interface";
|
||||||
|
import {ElMessageBox} from "element-plus";
|
||||||
|
import {useAppSceneStore} from "@/stores/modules/mode";
|
||||||
|
const AppSceneStore = useAppSceneStore()
|
||||||
|
const emit = defineEmits(['openTestDialog'])
|
||||||
|
const checkStore = useCheckStore();
|
||||||
|
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
|
||||||
|
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const formContent = reactive<CheckData.SelectTestItem>({preTest: true, timeTest: false, channelsTest: false, test: false})
|
||||||
|
|
||||||
|
const open = async () => {
|
||||||
|
resetFormContent()
|
||||||
|
checkStore.setSelectTestItems(formContent)
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清空表单内容
|
||||||
|
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>
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<template #tableHeader=''>
|
<template #tableHeader=''>
|
||||||
<el-form :model='form' :inline='true'>
|
<el-form :model='form' :inline='true'>
|
||||||
<el-form-item label='关键字'>
|
<el-form-item label='关键字'>
|
||||||
<el-input v-model='form.search' placeholder='请输入设备名称' clearable style='width: 140px;'></el-input>
|
<el-input v-model='form.search' placeholder='请输入设备名称' clearable style='width: 170px;' show-word-limit maxlength="32"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='检测状态' v-if='form.activeTabs != 3 && form.activeTabs != 4 && form.activeTabs != 5'>
|
<el-form-item label='检测状态' v-if='form.activeTabs != 3 && form.activeTabs != 4 && form.activeTabs != 5'>
|
||||||
<el-select v-model='form.checkStatus' clearable>
|
<el-select v-model='form.checkStatus' clearable>
|
||||||
@@ -61,7 +61,8 @@
|
|||||||
</el-button
|
</el-button
|
||||||
>
|
>
|
||||||
<el-button :icon="Delete" @click="handleRefresh"
|
<el-button :icon="Delete" @click="handleRefresh"
|
||||||
>重置</el-button
|
>重置
|
||||||
|
</el-button
|
||||||
>
|
>
|
||||||
<!-- :disabled='!scope.isSelected' -->
|
<!-- :disabled='!scope.isSelected' -->
|
||||||
<el-button
|
<el-button
|
||||||
@@ -77,39 +78,27 @@
|
|||||||
<el-button
|
<el-button
|
||||||
type='primary'
|
type='primary'
|
||||||
:icon='ChatLineRound'
|
:icon='ChatLineRound'
|
||||||
@click="handleTest('自动检测')"
|
@click="handleTest('一键检测')"
|
||||||
v-if='form.activeTabs === 0'
|
v-if='form.activeTabs === 0'
|
||||||
>自动检测
|
>一键检测
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
<!-- <el-button type='primary' :icon='ChatLineSquare' @click="handleTest('不合格项复检')" v-if='form.activeTabs === 2'>不合格项复检</el-button>-->
|
||||||
<el-button type='primary' :icon='ChatLineSquare' @click="handleTest('不合格项复检')"
|
<!-- <el-button type='primary' :icon='ChatDotSquare' @click="handleTest('全部复检')" v-if='form.activeTabs === 2'>全部复检</el-button>-->
|
||||||
v-if='form.activeTabs === 2'
|
|
||||||
>不合格项复检
|
|
||||||
</el-button
|
|
||||||
>
|
|
||||||
<el-button type='primary' :icon='ChatDotSquare' @click="handleTest('全部复检')" v-if='form.activeTabs === 2'
|
|
||||||
>全部复检
|
|
||||||
</el-button
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- :disabled='!scope.isSelected' -->
|
<!-- :disabled='!scope.isSelected' -->
|
||||||
<!-- <el-button type="primary" :icon="Download" @click="handleTest('批量下载')" v-if="form.activeTabs === 3"
|
<!-- <el-button type="primary" :icon="Download" @click="handleTest('批量下载')" v-if="form.activeTabs === 3"
|
||||||
>报告下载</el-button
|
>报告下载</el-button
|
||||||
> -->
|
> -->
|
||||||
<!-- :disabled='!scope.isSelected' -->
|
<!-- :disabled='!scope.isSelected' -->
|
||||||
<!-- <el-button type="primary" :icon="Postcard" @click="handleTest('批量生成')" v-if="form.activeTabs === 3"
|
<el-button type="primary" :icon="Postcard" @click="handleTest('批量生成')" v-if="form.activeTabs === 3">报告生成</el-button>
|
||||||
>报告生成</el-button
|
|
||||||
> -->
|
|
||||||
|
|
||||||
<!-- :disabled="!scope.isSelected || scope.selectedList.filter((item) => item.check_State === '检测完成').length === 0" -->
|
<!-- :disabled="!scope.isSelected || scope.selectedList.filter((item) => item.check_State === '检测完成').length === 0" -->
|
||||||
<el-button type='primary' :icon='Notebook' @click="handleTest('批量归档')" v-if='form.activeTabs === 4'
|
<el-button type='primary' :icon='Notebook' @click="handleTest('批量归档')" v-if='form.activeTabs === 4'>归档</el-button>
|
||||||
>归档
|
|
||||||
</el-button>
|
|
||||||
<!-- <el-button type="primary" :icon="CirclePlus" @click="addDevice('设备新增')" v-if="form.activeTabs === 0"
|
<!-- <el-button type="primary" :icon="CirclePlus" @click="addDevice('设备新增')" v-if="form.activeTabs === 0"
|
||||||
>设备新增</el-button> -->
|
>设备新增</el-button> -->
|
||||||
|
|
||||||
<el-button type='primary' v-auth.role="'channelsTest'" :icon='Odometer' @click="handleTest('系数校准')"
|
<el-button type='primary' v-auth.role="'channelsTest'" :icon='Odometer' @click="handleTest('系数校准')"
|
||||||
v-if='form.activeTabs === 0'
|
v-if='form.activeTabs === 0 && appSceneStore.currentScene === "1" '
|
||||||
>系数校准
|
>系数校准
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -172,7 +161,6 @@
|
|||||||
:icon='Notebook'
|
:icon='Notebook'
|
||||||
@click="openDrawer('归档', scope.row)"
|
@click="openDrawer('归档', scope.row)"
|
||||||
v-if='form.activeTabs === 4'
|
v-if='form.activeTabs === 4'
|
||||||
:disabled='scope.row.reportState != 1'
|
|
||||||
>归档
|
>归档
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
@@ -225,19 +213,14 @@
|
|||||||
:dialogTitle="dialogTitle"
|
:dialogTitle="dialogTitle"
|
||||||
@update:visible="dialogFormVisible = $event"
|
@update:visible="dialogFormVisible = $event"
|
||||||
/> -->
|
/> -->
|
||||||
<TestPopup ref='testPopup' @quitClicked='handleQuitClicked' ></TestPopup>
|
<TestPopup ref='testPopup' @quitClicked='handleQuitClicked'></TestPopup>
|
||||||
|
|
||||||
<reportPopup
|
<reportPopup
|
||||||
:visible='reportDialogVisible'
|
:visible='reportDialogVisible'
|
||||||
@update:visible='reportDialogVisible = $event'
|
@update:visible='reportDialogVisible = $event'
|
||||||
></reportPopup>
|
></reportPopup>
|
||||||
|
|
||||||
<dataCheckPopup ref='dataCheckPopupRef' />
|
<dataCheckPopup ref='dataCheckPopupRef'/>
|
||||||
|
|
||||||
<dataCheckChangeErrSysPopup
|
|
||||||
:visible='dataCheckChangeErrSysDialogVisible'
|
|
||||||
@update:visible='dataCheckChangeErrSysDialogVisible = $event'
|
|
||||||
></dataCheckChangeErrSysPopup>
|
|
||||||
|
|
||||||
<matchPopup
|
<matchPopup
|
||||||
:visible='matchDialogVisible'
|
:visible='matchDialogVisible'
|
||||||
@@ -245,17 +228,22 @@
|
|||||||
></matchPopup>
|
></matchPopup>
|
||||||
|
|
||||||
<!--系数校准-->
|
<!--系数校准-->
|
||||||
<ChannelsTest ref='channelsTest' :webMsgSend='webMsgSend' @quitClicked='handleQuitClicked' @submitClicked = 'handleSubmitClicked'></ChannelsTest>
|
<ChannelsTest ref='channelsTest' :webMsgSend='webMsgSend' @quitClicked='handleQuitClicked' @submitClicked='handleSubmitClicked'></ChannelsTest>
|
||||||
|
<!-- 手动检测-勾选检测项弹窗 -->
|
||||||
|
<SelectTestItemPopup ref="selectTestItemPopupRef" @openTestDialog="openTestDialog"></SelectTestItemPopup>
|
||||||
|
<!-- 省平台-填写温度湿度弹窗 -->
|
||||||
|
<WriteTHPopup ref="writeTHPopupRef" @openTestDialog2="openTestDialog2"></WriteTHPopup>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='useProTable'>
|
<script setup lang='tsx' name='useProTable'>
|
||||||
import { useRouter } from 'vue-router'
|
import {useRouter} from 'vue-router'
|
||||||
import type { Device } from '@/api/device/interface/device'
|
import type {Device} from '@/api/device/interface/device'
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import {useHandleData} from '@/hooks/useHandleData'
|
||||||
import { ElMessage, ElMessageBox, ElLoading, Action } from 'element-plus'
|
import {ElMessage, ElMessageBox, ElLoading, Action} from 'element-plus'
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
import {type ProTableInstance, type ColumnProps} from '@/components/ProTable/interface'
|
||||||
import {
|
import {
|
||||||
Search,
|
Search,
|
||||||
View,
|
View,
|
||||||
@@ -273,27 +261,31 @@ import {
|
|||||||
CirclePlus,
|
CirclePlus,
|
||||||
Odometer,
|
Odometer,
|
||||||
} from '@element-plus/icons-vue'
|
} from '@element-plus/icons-vue'
|
||||||
import { getPlanList } from '@/api/plan/planList'
|
import {getPlanList} from '@/api/plan/planList'
|
||||||
import deviceDataList from '@/api/device/device/deviceData'
|
import deviceDataList from '@/api/device/device/deviceData'
|
||||||
import TestPopup from './testPopup.vue'
|
import TestPopup from './testPopup.vue'
|
||||||
import reportPopup from './reportPopup.vue'
|
import reportPopup from './reportPopup.vue'
|
||||||
import dataCheckPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
import dataCheckPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
||||||
import dataCheckChangeErrSysPopup from './dataCheckChangeErrSysPopup.vue'
|
import dataCheckChangeErrSysPopup from './dataCheckChangeErrSysPopup.vue'
|
||||||
import { generateDevReport, getBoundPqDevList } from '@/api/plan/plan.ts'
|
import {generateDevReport, getBoundPqDevList} from '@/api/plan/plan.ts'
|
||||||
import { onBeforeMount, onMounted, reactive, ref, watch } from 'vue'
|
import {onBeforeMount, onMounted, reactive, ref, watch} from 'vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
import ChannelsTest from './channelsTest.vue'
|
import ChannelsTest from './channelsTest.vue'
|
||||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
import {useModeStore,useAppSceneStore} from '@/stores/modules/mode' // 引入模式 store
|
||||||
import { useCheckStore } from '@/stores/modules/check'
|
|
||||||
import { CheckData } from '@/api/check/interface'
|
import {useCheckStore} from '@/stores/modules/check'
|
||||||
|
import {CheckData} from '@/api/check/interface'
|
||||||
import socketClient from '@/utils/webSocketClient'
|
import socketClient from '@/utils/webSocketClient'
|
||||||
import auth from '@/directives/modules/auth'
|
import auth from '@/directives/modules/auth'
|
||||||
import { useAuthStore } from '@/stores/modules/auth'
|
import {useAuthStore} from '@/stores/modules/auth'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
import {useDownload} from '@/hooks/useDownload'
|
||||||
import { downloadDevData } from '@/api/plan/plan.ts'
|
import {downloadDevData} from '@/api/plan/plan.ts'
|
||||||
import { documentedPqDev } from '@/api/device/device'
|
import {documentedPqDev} from '@/api/device/report'
|
||||||
import { getPqDev } from '@/api/device/device/index.ts'
|
import {getPqDev} from '@/api/device/device/index.ts'
|
||||||
import { ResultEnum } from '@/enums/httpEnum'
|
import {ResultEnum} from '@/enums/httpEnum'
|
||||||
|
import SelectTestItemPopup from "@/views/home/components/selectTestItemPopup.vue";
|
||||||
|
import WriteTHPopup from "@/views/home/components/writeTHPopup.vue";
|
||||||
|
import { fa } from 'element-plus/es/locale'
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const checkStore = useCheckStore()
|
const checkStore = useCheckStore()
|
||||||
@@ -309,8 +301,9 @@ const tableHeight = ref(0)
|
|||||||
const reportDialogVisible = ref(false)
|
const reportDialogVisible = ref(false)
|
||||||
|
|
||||||
const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>()
|
const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>()
|
||||||
|
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
|
||||||
|
const writeTHPopupRef = ref<InstanceType<typeof WriteTHPopup>>()
|
||||||
|
|
||||||
const dataCheckChangeErrSysDialogVisible = ref(false)
|
|
||||||
const matchDialogVisible = ref(false)
|
const matchDialogVisible = ref(false)
|
||||||
const dialogTitle = ref('手动检测')
|
const dialogTitle = ref('手动检测')
|
||||||
const checkStateTable = ref<number[]>([0, 1, 2])
|
const checkStateTable = ref<number[]>([0, 1, 2])
|
||||||
@@ -338,7 +331,7 @@ const shouldShowOption = (item) => {
|
|||||||
//开始创建webSocket客户端
|
//开始创建webSocket客户端
|
||||||
const dataSocket = reactive({
|
const dataSocket = reactive({
|
||||||
socketServe: socketClient.Instance,
|
socketServe: socketClient.Instance,
|
||||||
});
|
});
|
||||||
|
|
||||||
tableHeight.value = window.innerHeight - 600
|
tableHeight.value = window.innerHeight - 600
|
||||||
const deviceData = ref<Device.ResPqDev[]>([])
|
const deviceData = ref<Device.ResPqDev[]>([])
|
||||||
@@ -366,6 +359,7 @@ const props = defineProps({
|
|||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
const appSceneStore = useAppSceneStore()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'batchGenerateClicked'): void;
|
(e: 'batchGenerateClicked'): void;
|
||||||
@@ -513,7 +507,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '设备名称',
|
label: '设备名称',
|
||||||
@@ -597,7 +591,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
label: '系数校准结果',
|
label: '系数校准结果',
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
isShow: factorCheckShow,
|
isShow: factorCheckShow && appSceneStore.currentScene === "1" ,
|
||||||
render: scope => {
|
render: scope => {
|
||||||
if (scope.row.factorCheckResult === 0) {
|
if (scope.row.factorCheckResult === 0) {
|
||||||
return '不合格'
|
return '不合格'
|
||||||
@@ -609,7 +603,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
return ''
|
return ''
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow },
|
{prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow},
|
||||||
])
|
])
|
||||||
// 跳转详情页
|
// 跳转详情页
|
||||||
const toDetail = () => {
|
const toDetail = () => {
|
||||||
@@ -651,8 +645,13 @@ const handleSelectionChange = (selection: any[]) => {
|
|||||||
return {
|
return {
|
||||||
deviceId: item.id,
|
deviceId: item.id,
|
||||||
deviceName: item.name,
|
deviceName: item.name,
|
||||||
deviceType: item.devType,
|
|
||||||
chnNum: item.devChns,
|
chnNum: item.devChns,
|
||||||
|
planId: item.planId,
|
||||||
|
deviceType: item.devType,
|
||||||
|
devVolt: item.devVolt,
|
||||||
|
devCurr: item.devCurr,
|
||||||
|
factorFlag: item.factorFlag,
|
||||||
|
checkResult: item.checkResult,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -845,6 +844,7 @@ const addDevice = (val: string) => {
|
|||||||
path: '/machine/device',
|
path: '/machine/device',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleTest = async (val: string) => {
|
const handleTest = async (val: string) => {
|
||||||
|
|
||||||
if (devNum == 0) {
|
if (devNum == 0) {
|
||||||
@@ -891,7 +891,7 @@ const handleTest = async (val: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (val === '手动检测' || val === '自动检测' || val === '不合格项复检' || val === '全部复检') {
|
if (val === '手动检测' || val === '一键检测' || val === '系数校准') {
|
||||||
// if (devNum > 6) {
|
// if (devNum > 6) {
|
||||||
// ElMessageBox.confirm(
|
// ElMessageBox.confirm(
|
||||||
// '每次检测最多只能选择6台设备,请重新选择',
|
// '每次检测最多只能选择6台设备,请重新选择',
|
||||||
@@ -904,6 +904,31 @@ const handleTest = async (val: string) => {
|
|||||||
// )
|
// )
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
|
// if (devTestedNum == 0) {
|
||||||
|
// ElMessageBox.confirm('请先选择检测完成状态的被检设备', '提示',
|
||||||
|
// {
|
||||||
|
// confirmButtonText: '确定',
|
||||||
|
// cancelButtonText: '取消',
|
||||||
|
// type: 'warning',
|
||||||
|
// })
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
const checkStates = channelsSelection.value.map(item => item.checkState)
|
||||||
|
const allCheckStatesEqual = new Set(checkStates).size <= 1
|
||||||
|
|
||||||
|
if (!allCheckStatesEqual) {
|
||||||
|
// ElMessageBox.confirm(
|
||||||
|
// '所勾选设备检测状态不一致,请重新选择',
|
||||||
|
// '提示',
|
||||||
|
// {
|
||||||
|
// confirmButtonText: '确定',
|
||||||
|
// cancelButtonText: '取消',
|
||||||
|
// type: 'warning',
|
||||||
|
// },
|
||||||
|
// )
|
||||||
|
// return
|
||||||
|
checkStore.setReCheckType(1)
|
||||||
|
}
|
||||||
if (devChannelsNum > 12) {
|
if (devChannelsNum > 12) {
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
'每次检测最多只能检测12个设备通道,请重新选择',
|
'每次检测最多只能检测12个设备通道,请重新选择',
|
||||||
@@ -916,80 +941,59 @@ const handleTest = async (val: string) => {
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dialogTitle.value = val
|
||||||
|
if (val === '手动检测') {
|
||||||
|
checkStore.setShowDetailType(2)
|
||||||
|
|
||||||
if (testType === 'reTest') {
|
if (testType === 'reTest') {
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm('请选择复检检测方式', '设备复检',
|
||||||
'请选择复检检测方式',
|
|
||||||
'设备复检',
|
|
||||||
{
|
{
|
||||||
distinguishCancelAndClose: true,
|
distinguishCancelAndClose: true,
|
||||||
confirmButtonText: '不合格项复检',
|
confirmButtonText: '不合格项复检',
|
||||||
cancelButtonText: '全部复检',
|
cancelButtonText: '全部复检',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
ElMessage.success('不合格项复检')
|
ElMessage.success('不合格项复检')
|
||||||
dialogTitle.value = val
|
// if (checkStore.devices.length > 1) {
|
||||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck)// 打开对话框
|
// checkStore.setReCheckType(1)
|
||||||
|
// } else {
|
||||||
|
checkStore.setReCheckType(0)
|
||||||
|
// }
|
||||||
|
//selectTestItemPopupRef.value?.open()
|
||||||
|
if(appSceneStore.currentScene === '0'){
|
||||||
|
writeTHPopupRef.value?.open()
|
||||||
|
}else{
|
||||||
|
openTestDialog(true)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((action: Action) => {
|
.catch((action: Action) => {
|
||||||
|
if(action === 'cancel'){
|
||||||
ElMessage.success('全部复检')
|
ElMessage.success('全部复检')
|
||||||
dialogTitle.value = val
|
checkStore.setReCheckType(1)
|
||||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck) // 打开对话框
|
//selectTestItemPopupRef.value?.open()
|
||||||
|
if(appSceneStore.currentScene === '0'){
|
||||||
|
writeTHPopupRef.value?.open()
|
||||||
|
}else{
|
||||||
|
openTestDialog(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
checkStore.setSelectTestItems({preTest: false, timeTest: false, channelsTest: false, test: true})
|
||||||
} else {
|
} else {
|
||||||
dialogTitle.value = val
|
|
||||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
|
|
||||||
|
checkStore.setReCheckType(1)
|
||||||
|
selectTestItemPopupRef.value?.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val === '系数校准') {
|
} else if (val === '系数校准') {
|
||||||
const checkStates = channelsSelection.value.map(item => item.checkState)
|
// 检查 socketClient.Instance 是否存在
|
||||||
const allCheckStatesEqual = new Set(checkStates).size <= 1
|
if (!socketClient.Instance) {
|
||||||
|
console.error('WebSocket 客户端实例不存在');
|
||||||
if (!allCheckStatesEqual) {
|
return;
|
||||||
ElMessageBox.confirm(
|
|
||||||
'所勾选设备检测状态不一致,请重新选择',
|
|
||||||
'提示',
|
|
||||||
{
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
|
||||||
},
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const factorFlagArray = ref<string[]>([]) // 初始化为空数组
|
|
||||||
for (let i = 0; i < channelsSelection.value.length; i++) {
|
|
||||||
const factorFlag = channelsSelection.value[i].factorFlag
|
|
||||||
if (factorFlag !== undefined && factorFlag !== null && factorFlag === 0) {
|
|
||||||
factorFlagArray.value.push(channelsSelection.value[i].name.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (factorFlagArray.value.length > 0) {
|
|
||||||
const factorFlags = factorFlagArray.value.join(', ')
|
|
||||||
ElMessageBox.confirm(
|
|
||||||
factorFlags + '设备不支持系数校准,请重新选择',
|
|
||||||
'提示',
|
|
||||||
{
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
|
||||||
},
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// // 检查 socketClient.Instance 是否存在
|
|
||||||
// if (!socketClient.Instance) {
|
|
||||||
// console.error('WebSocket 客户端实例不存在');
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
socketClient.Instance.connect();
|
socketClient.Instance.connect();
|
||||||
dataSocket.socketServe = socketClient.Instance;
|
dataSocket.socketServe = socketClient.Instance;
|
||||||
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
||||||
@@ -1006,23 +1010,53 @@ const handleTest = async (val: string) => {
|
|||||||
|
|
||||||
channelsTest.value?.open(channelsSelection.value, props.plan)
|
channelsTest.value?.open(channelsSelection.value, props.plan)
|
||||||
return
|
return
|
||||||
}
|
} else {
|
||||||
|
checkStore.setShowDetailType(2)
|
||||||
if (devTestedNum == 0) {
|
checkStore.setCheckType(1)
|
||||||
ElMessageBox.confirm(
|
checkStore.initSelectTestItems()
|
||||||
'请先选择检测完成状态的被检设备',
|
// 一键检测
|
||||||
'提示',
|
if (testType === 'reTest') {
|
||||||
|
ElMessageBox.confirm('请选择复检检测方式', '设备复检',
|
||||||
{
|
{
|
||||||
confirmButtonText: '确定',
|
distinguishCancelAndClose: true,
|
||||||
cancelButtonText: '取消',
|
confirmButtonText: '不合格项复检',
|
||||||
|
cancelButtonText: '全部复检',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
},
|
})
|
||||||
)
|
.then(() => {
|
||||||
return
|
ElMessage.success('不合格项复检')
|
||||||
|
// if (checkStore.devices.length > 1) {
|
||||||
|
// checkStore.setReCheckType(1)
|
||||||
|
// } else {
|
||||||
|
checkStore.setReCheckType(0)
|
||||||
|
// }
|
||||||
|
//openTestDialog(false)
|
||||||
|
if(appSceneStore.currentScene === '0'){
|
||||||
|
writeTHPopupRef.value?.open()
|
||||||
|
}else{
|
||||||
|
openTestDialog(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((action: Action) => {
|
||||||
|
if (action === 'cancel') {
|
||||||
|
ElMessage.success('全部复检')
|
||||||
|
checkStore.setReCheckType(1)
|
||||||
|
//openTestDialog(false)
|
||||||
|
if (appSceneStore.currentScene === '0') {
|
||||||
|
writeTHPopupRef.value?.open()
|
||||||
|
} else {
|
||||||
|
openTestDialog(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
checkStore.setSelectTestItems({preTest: false, timeTest: false, channelsTest: false, test: true})
|
||||||
|
} else {
|
||||||
|
openTestDialog(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (val === '批量下载') {
|
if (val === '批量下载') {
|
||||||
reportDialogVisible.value = true
|
reportDialogVisible.value = true
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1037,7 +1071,7 @@ const handleTest = async (val: string) => {
|
|||||||
// ElMessage.success("归档成功");
|
// ElMessage.success("归档成功");
|
||||||
// }, 2000)
|
// }, 2000)
|
||||||
documentedPqDev(checkStore.devices.map(item => {
|
documentedPqDev(checkStore.devices.map(item => {
|
||||||
item.deviceId
|
return item.deviceId
|
||||||
})).then((res) => {
|
})).then((res) => {
|
||||||
if (res.code === ResultEnum.SUCCESS) {
|
if (res.code === ResultEnum.SUCCESS) {
|
||||||
ElMessage.success('归档成功!')
|
ElMessage.success('归档成功!')
|
||||||
@@ -1046,8 +1080,37 @@ const handleTest = async (val: string) => {
|
|||||||
|
|
||||||
emit('batchGenerateClicked') // 触发事件
|
emit('batchGenerateClicked') // 触发事件
|
||||||
}
|
}
|
||||||
|
if(val === '批量生成'){
|
||||||
|
let devIdList=checkStore.devices.map(item => {
|
||||||
|
return item.deviceId
|
||||||
|
})
|
||||||
|
|
||||||
|
await generateDevReport({
|
||||||
|
'planId': checkStore.plan.id,
|
||||||
|
'devIdList':devIdList,
|
||||||
|
'scriptId':checkStore.plan.scriptId,
|
||||||
|
'planCode':checkStore.plan.code+''
|
||||||
|
})
|
||||||
|
ElMessage.success({message: `报告生成成功!`})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const openTestDialog = (testData:any) => {
|
||||||
|
if (appSceneStore.currentScene === '0') {
|
||||||
|
if(testData)
|
||||||
|
writeTHPopupRef.value?.open()
|
||||||
|
else
|
||||||
|
testPopup.value?.open(dialogTitle.value)
|
||||||
|
} else {
|
||||||
|
testPopup.value?.open(dialogTitle.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const openTestDialog2 = () => {
|
||||||
|
testPopup.value?.open(dialogTitle.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开 drawer(新增、查看、编辑)
|
// 打开 drawer(新增、查看、编辑)
|
||||||
@@ -1063,24 +1126,26 @@ const openDrawer = async (title: string, row: any) => {
|
|||||||
|
|
||||||
|
|
||||||
if (title === '报告生成') {
|
if (title === '报告生成') {
|
||||||
await generateDevReport({ 'planId': checkStore.planId, 'devId': row.id })
|
await generateDevReport({'planId': checkStore.plan.id, 'devIdList': [row.id],'scriptId':checkStore.plan.scriptId,'planCode':checkStore.plan.code+''})
|
||||||
emit('batchGenerateClicked') // 触发事件
|
emit('batchGenerateClicked') // 触发事件
|
||||||
ElMessage.success({ message: `报告生成成功!` })
|
ElMessage.success({message: `报告生成成功!`})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title === '报告下载') {
|
if (title === '报告下载') {
|
||||||
await useDownload(downloadDevData, row.createId, {
|
await useDownload(downloadDevData, row.createId, {
|
||||||
planId: checkStore.planId,
|
planId: checkStore.plan.id,
|
||||||
devId: row.id,
|
devId: row.id,
|
||||||
}, false, '.docx')
|
}, false, '.docx')
|
||||||
emit('batchGenerateClicked') // 触发事件
|
emit('batchGenerateClicked') // 触发事件
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title === '检测数据查询') {
|
if (title === '检测数据查询') {
|
||||||
|
checkStore.setShowDetailType(0)
|
||||||
dataCheckPopupRef.value?.open(row.id, '-1', null)
|
dataCheckPopupRef.value?.open(row.id, '-1', null)
|
||||||
}
|
}
|
||||||
if (title === '误差体系更换') {
|
if (title === '误差体系更换') {
|
||||||
dataCheckChangeErrSysDialogVisible.value = true
|
checkStore.setShowDetailType(1)
|
||||||
|
dataCheckPopupRef.value?.open(row.id, '-1', null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1121,10 +1186,11 @@ watch(
|
|||||||
handleRefresh()
|
handleRefresh()
|
||||||
// 调用获取数据的方法
|
// 调用获取数据的方法
|
||||||
},
|
},
|
||||||
{ immediate: true }, // 立即执行一次
|
{immediate: true}, // 立即执行一次
|
||||||
)
|
)
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
|
|
||||||
const response = await getPqDev()
|
const response = await getPqDev()
|
||||||
devTypeOptions.value = response.data.map(item => ({
|
devTypeOptions.value = response.data.map(item => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
@@ -1153,7 +1219,7 @@ const handleSubmitClicked = async (resolve: (value: boolean) => void) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({ changeActiveTabs })
|
defineExpose({changeActiveTabs})
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
/* 当屏幕宽度小于或等于1300像素时 */
|
/* 当屏幕宽度小于或等于1300像素时 */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-table
|
<el-table
|
||||||
:data="tableData"
|
: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="date" label="Date" width="180" />
|
||||||
<el-table-column prop="name" label="Name" width="180" />
|
<el-table-column prop="name" label="Name" width="180" />
|
||||||
|
|||||||
@@ -1,65 +1,81 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
<div class="dialog" v-bind="dialogBig">
|
<div class="dialog" v-bind="dialogBig">
|
||||||
<div class="dialog-title">
|
<div class="dialog-title">
|
||||||
|
<div class="timeView">
|
||||||
|
<el-icon style="margin: 0px 5px;">
|
||||||
|
<Clock/>
|
||||||
|
</el-icon>
|
||||||
|
<span>检测用时:{{ timeView }}</span>
|
||||||
|
</div>
|
||||||
<el-progress
|
<el-progress
|
||||||
style="width: 90%"
|
style="width: 82%; margin-right: 3%;"
|
||||||
:percentage="percentage"
|
:percentage="percentage"
|
||||||
:color="customColors"/>
|
:color="customColors"/>
|
||||||
|
|
||||||
<el-button
|
<!-- <div style="width: 15%">-->
|
||||||
type="primary"
|
<!-- <el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">-->
|
||||||
v-if="testStatus=='process' && percentage < 100"
|
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
|
||||||
:icon="VideoPause"
|
<!-- <component :is="Refresh"/>-->
|
||||||
@click="handlePause()">停止检测
|
<!-- </el-icon>-->
|
||||||
</el-button>
|
<!-- 初始化中-->
|
||||||
<el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>
|
<!-- </el-button>-->
|
||||||
<el-icon class="loading-box" style="margin-right: 8px;">
|
|
||||||
<component :is="Refresh"/>
|
|
||||||
</el-icon>
|
|
||||||
暂停中
|
|
||||||
</el-button>
|
|
||||||
<!-- <el-button-->
|
<!-- <el-button-->
|
||||||
<!-- type="primary"-->
|
<!-- type="primary"-->
|
||||||
<!-- v-if="testStatus=='test_init'"-->
|
<!-- v-if="testStatus=='process' && percentage < 100"-->
|
||||||
<!-- :icon="VideoPause"-->
|
<!-- :icon="VideoPause"-->
|
||||||
<!-- disabled>初始化中-->
|
<!-- @click="handlePause()">停止检测-->
|
||||||
<!-- </el-button>-->
|
<!-- </el-button>-->
|
||||||
|
<!-- <el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>-->
|
||||||
|
<!-- <el-icon class="loading-box" style="margin-right: 8px;">-->
|
||||||
|
<!-- <component :is="Refresh"/>-->
|
||||||
|
<!-- </el-icon>-->
|
||||||
|
<!-- 暂停中-->
|
||||||
|
<!-- </el-button>-->
|
||||||
|
<!-- <!– <el-button–>-->
|
||||||
|
<!-- <!– type="primary"–>-->
|
||||||
|
<!-- <!– v-if="testStatus=='test_init'"–>-->
|
||||||
|
<!-- <!– :icon="VideoPause"–>-->
|
||||||
|
<!-- <!– disabled>初始化中–>-->
|
||||||
|
<!-- <!– </el-button>–>-->
|
||||||
|
<!-- <!– <el-button–>-->
|
||||||
|
<!-- <!– type="danger"–>-->
|
||||||
|
<!-- <!– v-if="testStatus=='test_init_fail'"–>-->
|
||||||
|
<!-- <!– :icon="Failed"–>-->
|
||||||
|
<!-- <!– disabled>初始化失败–>-->
|
||||||
|
<!-- <!– </el-button>–>-->
|
||||||
|
<!-- <!– <el-button–>-->
|
||||||
|
<!-- <!– type="danger"–>-->
|
||||||
|
<!-- <!– v-if="testStatus=='connect_timeout'"–>-->
|
||||||
|
<!-- <!– :icon="Failed"–>-->
|
||||||
|
<!-- <!– disabled>连接超时–>-->
|
||||||
|
<!-- <!– </el-button>–>-->
|
||||||
|
<!-- <!– <el-button–>-->
|
||||||
|
<!-- <!– type="primary"–>-->
|
||||||
|
<!-- <!– :icon="RefreshLeft"–>-->
|
||||||
|
<!-- <!– v-if="testStatus === 'recheck'"–>-->
|
||||||
|
<!-- <!– @click="emit('sendReCheck')">重新检测–>-->
|
||||||
|
<!-- <!– </el-button>–>-->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>-->
|
||||||
|
|
||||||
<!-- <el-button-->
|
<!-- <el-button-->
|
||||||
<!-- type="danger"-->
|
<!-- type="warning"-->
|
||||||
<!-- v-if="testStatus=='test_init_fail'"-->
|
<!-- v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"-->
|
||||||
<!-- :icon="Failed"-->
|
<!-- :icon="VideoPlay"-->
|
||||||
<!-- disabled>初始化失败-->
|
<!-- :disabled="testStatus === 'pause_timeout'"-->
|
||||||
|
<!-- @click="emit('sendResume')"-->
|
||||||
|
<!-- >继续检测-->
|
||||||
<!-- </el-button>-->
|
<!-- </el-button>-->
|
||||||
<!-- <el-button-->
|
<!-- </div>-->
|
||||||
<!-- type="danger"-->
|
<el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
|
||||||
<!-- v-if="testStatus=='connect_timeout'"-->
|
|
||||||
<!-- :icon="Failed"-->
|
|
||||||
<!-- disabled>连接超时-->
|
|
||||||
<!-- </el-button>-->
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
:icon="RefreshLeft"
|
|
||||||
v-if="testStatus === 'test_recheck'"
|
|
||||||
@click="emit('sendReCheck')">重新检测
|
|
||||||
</el-button>
|
|
||||||
|
|
||||||
|
|
||||||
<el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>
|
|
||||||
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"
|
|
||||||
:icon="VideoPlay"
|
|
||||||
:disabled="testStatus === 'pause_timeout'"
|
|
||||||
@click="emit('sendResume')"
|
|
||||||
>继续检测
|
|
||||||
</el-button>
|
|
||||||
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<el-table :data="checkResultView" row-key="scriptType" height="450px"
|
<el-table :data="checkResultView" row-key="scriptType" 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>
|
border>
|
||||||
<el-table-column fixed prop="scriptName" label="检测项目" width="150px" align="center">
|
<el-table-column fixed prop="scriptName" label="检测项目" width="150px" align="center">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -71,8 +87,12 @@
|
|||||||
:label="'通道'+chnItem" align="center">
|
:label="'通道'+chnItem" align="center">
|
||||||
<template #default="{row}">
|
<template #default="{row}">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
:content="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
|
:content="row.devices[index1].chnResult[index2].icon==='More' ? '暂无数据'
|
||||||
placement="top">
|
: row.devices[index1].chnResult[index2].icon==='CircleCheckFilled' ? '符合'
|
||||||
|
: row.devices[index1].chnResult[index2].icon==='Close' ? '不符合'
|
||||||
|
: row.devices[index1].chnResult[index2].icon==='WarnTriangleFilled' ? '数据异常'
|
||||||
|
: row.devices[index1].chnResult[index2].icon==='Loading'? '检测中':'连接中断'"
|
||||||
|
placement="right">
|
||||||
<el-button
|
<el-button
|
||||||
:disabled="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.LOADING"
|
:disabled="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.LOADING"
|
||||||
:color="row.devices[index1].chnResult[index2].color"
|
:color="row.devices[index1].chnResult[index2].color"
|
||||||
@@ -95,37 +115,37 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else>
|
<!-- <template v-else>-->
|
||||||
<el-table-column v-for="(item,index1) in deviceList" :key="item.deviceId" :label="item.deviceName" :min-width="110" align="center">
|
<!-- <el-table-column v-for="(item,index1) in deviceList" :key="item.deviceId" :label="item.deviceName" :min-width="110" align="center">-->
|
||||||
<template #default="{row}">
|
<!-- <template #default="{row}">-->
|
||||||
<el-tooltip
|
<!-- <el-tooltip-->
|
||||||
:content="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
|
<!-- :content="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"-->
|
||||||
placement="top">
|
<!-- placement="top">-->
|
||||||
<el-button
|
<!-- <el-button-->
|
||||||
:disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.LOADING"
|
<!-- :disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.LOADING"-->
|
||||||
:color="row.devices[index1].chnResult[0].color"
|
<!-- :color="row.devices[index1].chnResult[0].color"-->
|
||||||
size="small"
|
<!-- size="small"-->
|
||||||
@click="handleClick(item,-1,row.scriptType)"
|
<!-- @click="handleClick(item,-1,row.scriptType)"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-icon v-if="row.devices[index1].chnResult[0].icon==='Loading'" class="loading-box"
|
<!-- <el-icon v-if="row.devices[index1].chnResult[0].icon==='Loading'" class="loading-box"-->
|
||||||
style="color: #fff">
|
<!-- style="color: #fff">-->
|
||||||
<component :is="Loading"/>
|
<!-- <component :is="Loading"/>-->
|
||||||
</el-icon>
|
<!-- </el-icon>-->
|
||||||
<el-icon v-else style="color: #fff">
|
<!-- <el-icon v-else style="color: #fff">-->
|
||||||
<component :is="row.devices[index1].chnResult[0].icon"/>
|
<!-- <component :is="row.devices[index1].chnResult[0].icon"/>-->
|
||||||
</el-icon>
|
<!-- </el-icon>-->
|
||||||
</el-button>
|
<!-- </el-button>-->
|
||||||
</el-tooltip>
|
<!-- </el-tooltip>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-table-column>
|
<!-- </el-table-column>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="drawer-container">
|
<div class="drawer-container">
|
||||||
<el-drawer v-model="drawer" title="检测项进度">
|
<el-drawer v-model="drawer" title="检测项进度" direction="btt" :size="'38%'">
|
||||||
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;">
|
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;">
|
||||||
<p v-for="(item, index) in testLogList"
|
<p v-for="(item, index) in testLogList"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -136,15 +156,15 @@
|
|||||||
</el-drawer>
|
</el-drawer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<resultPopup
|
<!-- <resultPopup-->
|
||||||
:visible="resultDialogVisible"
|
<!-- :visible="resultDialogVisible"-->
|
||||||
@update:visible="resultDialogVisible = $event"
|
<!-- @update:visible="resultDialogVisible = $event"-->
|
||||||
></resultPopup>
|
<!-- ></resultPopup>-->
|
||||||
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
|
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup name="test">
|
<script lang="tsx" setup name="test">
|
||||||
import {Check, Failed, InfoFilled, Loading, Refresh, RefreshLeft, VideoPause, VideoPlay} from '@element-plus/icons-vue'
|
import {InfoFilled, Loading} from '@element-plus/icons-vue'
|
||||||
import resultPopup from './resultPopup.vue'
|
|
||||||
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
||||||
import {computed, reactive, ref, toRef, watch} from "vue";
|
import {computed, reactive, ref, toRef, watch} from "vue";
|
||||||
import {dialogBig} from "@/utils/elementBind";
|
import {dialogBig} from "@/utils/elementBind";
|
||||||
@@ -152,7 +172,9 @@ import {CheckData} from "@/api/check/interface"
|
|||||||
import {useCheckStore} from "@/stores/modules/check";
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
import {ElMessage, ElMessageBox} from "element-plus";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
import {getBigTestItem} from "@/api/check/test";
|
import {getBigTestItem} from "@/api/check/test";
|
||||||
import {tryHideFullScreenLoading} from "@/components/Loading/fullScreen";
|
import {getAutoGenerate} from "@/api/user/login";
|
||||||
|
import {generateDevReport} from "@/api/plan/plan";
|
||||||
|
|
||||||
|
|
||||||
const checkStore = useCheckStore()
|
const checkStore = useCheckStore()
|
||||||
|
|
||||||
@@ -167,18 +189,21 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'waiting'
|
default: 'waiting'
|
||||||
},
|
},
|
||||||
|
stepsActive: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
webMsgSend: {
|
webMsgSend: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause', 'sendResume', 'sendReCheck']);
|
const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause', 'sendResume', 'sendReCheck', 'closeWebSocket']);
|
||||||
|
|
||||||
// 用来保存测试项进度抽屉是否打开
|
// 用来保存测试项进度抽屉是否打开
|
||||||
const drawer = ref(false)
|
const drawer = ref(false)
|
||||||
// 进度条颜色
|
// 进度条颜色
|
||||||
const customColors = [{color: "#5cb87a", percentage: 100}]
|
const customColors = [{color: "#91cc75", percentage: 100}]
|
||||||
// 检测脚本数据
|
// 检测脚本数据
|
||||||
let scriptData: CheckData.ScriptItem[] = []
|
let scriptData: CheckData.ScriptItem[] = []
|
||||||
// 用来保存被检设备
|
// 用来保存被检设备
|
||||||
@@ -187,6 +212,10 @@ const deviceList = reactive<CheckData.Device[]>([])
|
|||||||
let activeIndex = 0
|
let activeIndex = 0
|
||||||
// 百分比
|
// 百分比
|
||||||
const percentage = ref(0);
|
const percentage = ref(0);
|
||||||
|
// 时间计数器
|
||||||
|
let timer: any = null
|
||||||
|
const timeCount = ref(0)
|
||||||
|
const timeView = ref('00:00:00')
|
||||||
//测试项开始检测时间(或继续检测时间)
|
//测试项开始检测时间(或继续检测时间)
|
||||||
const startData = ref(new Date())
|
const startData = ref(new Date())
|
||||||
//测试项检测结束时间(或暂停时的时间)
|
//测试项检测结束时间(或暂停时的时间)
|
||||||
@@ -202,7 +231,7 @@ const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无
|
|||||||
const testStatus = toRef(props, 'testStatus')
|
const testStatus = toRef(props, 'testStatus')
|
||||||
const webMsgSend = toRef(props, 'webMsgSend')
|
const webMsgSend = toRef(props, 'webMsgSend')
|
||||||
|
|
||||||
const resultDialogVisible = ref(false)
|
// const resultDialogVisible = ref(false)
|
||||||
const scrollContainerRef = ref();
|
const scrollContainerRef = ref();
|
||||||
const dataCheckSingleChannelSingleTestPopupRef = ref<InstanceType<typeof dataCheckSingleChannelSingleTestPopup>>()
|
const dataCheckSingleChannelSingleTestPopupRef = ref<InstanceType<typeof dataCheckSingleChannelSingleTestPopup>>()
|
||||||
|
|
||||||
@@ -232,7 +261,7 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
|
|||||||
for (let j = 0; j < device.chnResult.length; j++) {
|
for (let j = 0; j < device.chnResult.length; j++) {
|
||||||
switch (device.chnResult[j]) {
|
switch (device.chnResult[j]) {
|
||||||
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'More'})
|
||||||
break;
|
break;
|
||||||
case CheckData.ChnCheckResultEnum.LOADING:
|
case CheckData.ChnCheckResultEnum.LOADING:
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
||||||
@@ -249,44 +278,48 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
|
|||||||
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
||||||
break;
|
break;
|
||||||
default:
|
case CheckData.ChnCheckResultEnum.NOT_PART_IN_ERROR:
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let tempChnResult: CheckData.ChnCheckResultEnum = device.chnResult[0]
|
|
||||||
if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.ERRORDATA)) {
|
|
||||||
tempChnResult = CheckData.ChnCheckResultEnum.ERRORDATA
|
|
||||||
}
|
|
||||||
if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.FAIL)) {
|
|
||||||
tempChnResult = CheckData.ChnCheckResultEnum.FAIL
|
|
||||||
}
|
|
||||||
if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.TIMEOUT)) {
|
|
||||||
tempChnResult = CheckData.ChnCheckResultEnum.TIMEOUT
|
|
||||||
}
|
|
||||||
switch (tempChnResult) {
|
|
||||||
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
||||||
break;
|
break;
|
||||||
case CheckData.ChnCheckResultEnum.LOADING:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
|
||||||
break;
|
|
||||||
case CheckData.ChnCheckResultEnum.SUCCESS:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.SUCCESS, icon: 'CircleCheckFilled'})
|
|
||||||
break;
|
|
||||||
case CheckData.ChnCheckResultEnum.FAIL:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.DANGER, icon: 'Close'})
|
|
||||||
break;
|
|
||||||
case CheckData.ChnCheckResultEnum.TIMEOUT:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'})
|
|
||||||
break;
|
|
||||||
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// else {
|
||||||
|
// let tempChnResult: CheckData.ChnCheckResultEnum = device.chnResult[0]
|
||||||
|
// if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.ERRORDATA)) {
|
||||||
|
// tempChnResult = CheckData.ChnCheckResultEnum.ERRORDATA
|
||||||
|
// }
|
||||||
|
// if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.FAIL)) {
|
||||||
|
// tempChnResult = CheckData.ChnCheckResultEnum.FAIL
|
||||||
|
// }
|
||||||
|
// if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.TIMEOUT)) {
|
||||||
|
// tempChnResult = CheckData.ChnCheckResultEnum.TIMEOUT
|
||||||
|
// }
|
||||||
|
// switch (tempChnResult) {
|
||||||
|
// case CheckData.ChnCheckResultEnum.UNKNOWN:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
||||||
|
// break;
|
||||||
|
// case CheckData.ChnCheckResultEnum.LOADING:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
||||||
|
// break;
|
||||||
|
// case CheckData.ChnCheckResultEnum.SUCCESS:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.SUCCESS, icon: 'CircleCheckFilled'})
|
||||||
|
// break;
|
||||||
|
// case CheckData.ChnCheckResultEnum.FAIL:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.DANGER, icon: 'Close'})
|
||||||
|
// break;
|
||||||
|
// case CheckData.ChnCheckResultEnum.TIMEOUT:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'})
|
||||||
|
// break;
|
||||||
|
// case CheckData.ChnCheckResultEnum.ERRORDATA:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
temp.devices.push({
|
temp.devices.push({
|
||||||
deviceId: device.deviceId,
|
deviceId: device.deviceId,
|
||||||
@@ -303,28 +336,31 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
|
|||||||
watch(testStatus, function (newValue, oldValue) {
|
watch(testStatus, function (newValue, oldValue) {
|
||||||
if (newValue == 'start') {
|
if (newValue == 'start') {
|
||||||
ElMessage.success('初始化开始!')
|
ElMessage.success('初始化开始!')
|
||||||
|
startTimeCount()
|
||||||
|
|
||||||
showTestLog()
|
showTestLog()
|
||||||
|
|
||||||
if (oldValue == 'error') {
|
// if (oldValue == 'recheck' || oldValue == 'error' || oldValue == 'test_init_fail' || oldValue == 'connect_timeout' || oldValue == 'pause_timeout' || oldValue == 'error_flow_end') {
|
||||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!`})
|
// handleReCheck()
|
||||||
|
// }
|
||||||
initCheckResult()
|
|
||||||
activeIndex = 0
|
|
||||||
percentage.value = 0
|
|
||||||
}
|
|
||||||
emit('update:testStatus', 'test_init')
|
emit('update:testStatus', 'test_init')
|
||||||
//startTimer() // todo 可移除
|
//startTimer() // todo 可移除
|
||||||
startData.value = new Date();
|
startData.value = new Date();
|
||||||
timeDifference.value = 0;
|
timeDifference.value = 0;
|
||||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`})
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newValue == 'recheck' || newValue == 'error' || newValue == 'test_init_fail' || newValue == 'connect_timeout' || newValue == 'pause_timeout' || oldValue == 'error_flow_end') {
|
||||||
|
stopTimeCount()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 次数
|
// 次数
|
||||||
let count = 0
|
let count = 0
|
||||||
|
|
||||||
watch(webMsgSend, function (newValue, oldValue) {
|
watch(webMsgSend, function (newValue, oldValue) {
|
||||||
|
if (testStatus.value !== 'waiting') {
|
||||||
|
if (props.stepsActive === 4) {
|
||||||
if (newValue.code == 10520) {
|
if (newValue.code == 10520) {
|
||||||
ElMessageBox.alert('报文解析异常!', '初始化失败', {
|
ElMessageBox.alert('报文解析异常!', '初始化失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@@ -410,16 +446,28 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
log: `${new Date().toLocaleString()}:存在已经初始化步骤,执行自动关闭,请重新发起检测!`
|
log: `${new Date().toLocaleString()}:存在已经初始化步骤,执行自动关闭,请重新发起检测!`
|
||||||
})
|
})
|
||||||
emit('update:testStatus', 'test_recheck')
|
// emit('update:testStatus', 'recheck')
|
||||||
|
emit('update:testStatus', 'test_init_fail')
|
||||||
} else {
|
} else {
|
||||||
switch (newValue.requestId) {
|
switch (newValue.requestId) {
|
||||||
case 'server_error':
|
case 'server_error':
|
||||||
if (newValue.operateCode === 'server_error' && count === 0) {
|
if (newValue.operateCode === 'server_error' && count === 0) {
|
||||||
ElMessageBox.alert('源连接失败!', '初始化失败', {
|
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源连接失败!`})
|
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:服务端主动关闭连接!`})
|
||||||
|
emit('update:testStatus', 'test_init_fail')
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'device_error':
|
||||||
|
if (newValue.operateCode === 'device_error' && count === 0) {
|
||||||
|
ElMessageBox.alert('设备端主动关闭连接!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备端主动关闭连接!`})
|
||||||
emit('update:testStatus', 'test_init_fail')
|
emit('update:testStatus', 'test_init_fail')
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
@@ -503,7 +551,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
break;
|
break;
|
||||||
case 'yjc_xyjy':
|
case 'yjc_xyjy':
|
||||||
switch (newValue.operateCode) {
|
switch (newValue.operateCode) {
|
||||||
case 'INIT_GATHER$03':
|
case 'VERIFY_MAPPING$01':
|
||||||
if (newValue.code == 25001) {
|
if (newValue.code == 25001) {
|
||||||
ElMessage.success('初始化成功!')
|
ElMessage.success('初始化成功!')
|
||||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:协议校验成功!`})
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:协议校验成功!`})
|
||||||
@@ -511,11 +559,31 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`})
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`})
|
||||||
percentage.value = 3
|
percentage.value = 3
|
||||||
|
|
||||||
|
|
||||||
activeIndex = getNextActiveIndex() + 2
|
activeIndex = getNextActiveIndex() + 2
|
||||||
//startTimer()
|
//startTimer()
|
||||||
|
|
||||||
emit('update:testStatus', 'process')
|
emit('update:testStatus', 'process')
|
||||||
|
} else if (newValue.code == 10200) {
|
||||||
|
let data = JSON.parse(newValue.data)
|
||||||
|
ElMessageBox.alert(`脚本与icd校验失败!icd名称:${data['icdType']} -> 校验项:${data['dataType']}`, '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
testLogList.push({
|
||||||
|
type: 'error',
|
||||||
|
log: `${new Date().toLocaleString()}:脚本与icd校验失败!icd名称:${data['icdType']} -> 校验项:${data['dataType']}`
|
||||||
|
})
|
||||||
|
emit('update:testStatus', 'test_init_fail')
|
||||||
|
} else if (newValue.code == 10500) {
|
||||||
|
ElMessageBox.alert(`装置中未找到该icd!`, '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
testLogList.push({
|
||||||
|
type: 'error',
|
||||||
|
log: `${new Date().toLocaleString()}:装置中未找到该icd!`
|
||||||
|
})
|
||||||
|
emit('update:testStatus', 'test_init_fail')
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -615,7 +683,8 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}, {deep: true})
|
}, {deep: true})
|
||||||
|
|
||||||
const handleStartItem = (code: string, desc: string | undefined) => {
|
const handleStartItem = (code: string, desc: string | undefined) => {
|
||||||
@@ -624,9 +693,9 @@ const handleStartItem = (code: string, desc: string | undefined) => {
|
|||||||
updateCheckResultView(code, true)
|
updateCheckResultView(code, true)
|
||||||
updateLog(true)
|
updateLog(true)
|
||||||
} else {
|
} else {
|
||||||
if (desc.length > 60) {
|
// if (desc.length > 150) {
|
||||||
desc = desc.substring(0, 60) + '...'
|
// desc = desc.substring(0, 150) + '...'
|
||||||
}
|
// }
|
||||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:${desc}准确度检测:开始`})
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:${desc}准确度检测:开始`})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -642,9 +711,9 @@ const handleEndItem = (code: string, desc: string | undefined, devices: CheckDat
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let result = getResult(devices)
|
let result = getResult(devices)
|
||||||
if (desc.length > 60) {
|
// if (desc.length > 150) {
|
||||||
desc = desc.substring(0, 60) + '...'
|
// desc = desc.substring(0, 150) + '...'
|
||||||
}
|
// }
|
||||||
if (result === 1) {
|
if (result === 1) {
|
||||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:${desc}检测结束:符合`})
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:${desc}检测结束:符合`})
|
||||||
}
|
}
|
||||||
@@ -658,15 +727,32 @@ const handleEndItem = (code: string, desc: string | undefined, devices: CheckDat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新进度条
|
// 更新进度条
|
||||||
const updatePercentage = () => {
|
const updatePercentage = async () => {
|
||||||
if (activeIndex < checkTotal) {
|
if (activeIndex < checkTotal) {
|
||||||
percentage.value = Math.trunc(activeIndex / checkTotal * 100);
|
percentage.value = Math.trunc(activeIndex / checkTotal * 100);
|
||||||
} else {
|
} else {
|
||||||
percentage.value = 100;
|
percentage.value = 100;
|
||||||
emit('update:testStatus', 'success')
|
emit('update:testStatus', 'success')
|
||||||
|
|
||||||
|
let {data: autoGenerate} = await getAutoGenerate()
|
||||||
|
if (autoGenerate == 1) {
|
||||||
|
//调用自动生成报告接口
|
||||||
|
let devIdList = checkStore.devices.map(item => {
|
||||||
|
return item.deviceId
|
||||||
|
})
|
||||||
|
|
||||||
|
await generateDevReport({
|
||||||
|
'planId': checkStore.plan.id,
|
||||||
|
'devIdList': devIdList,
|
||||||
|
'scriptId': checkStore.plan.scriptId,
|
||||||
|
'planCode': checkStore.plan.code + ''
|
||||||
|
})
|
||||||
|
}
|
||||||
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
|
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
})
|
})
|
||||||
|
// 关闭WebSocket连接
|
||||||
|
emit('closeWebSocket')
|
||||||
//clear();
|
//clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -700,7 +786,7 @@ const showTestLog = () => {
|
|||||||
// 初始化检测脚本数据
|
// 初始化检测脚本数据
|
||||||
const initScriptData = async () => {
|
const initScriptData = async () => {
|
||||||
|
|
||||||
let response: any = await getBigTestItem(checkStore.planId)
|
let response: any = await getBigTestItem({reCheckType: checkStore.reCheckType, planId: checkStore.plan.id, devIds: checkStore.devices.map(item => item.deviceId)})
|
||||||
|
|
||||||
let temp = response.data.map(item => {
|
let temp = response.data.map(item => {
|
||||||
return {
|
return {
|
||||||
@@ -767,7 +853,7 @@ const updateCheckResult = (data: CheckData.ScriptChnItem) => {
|
|||||||
|
|
||||||
const scrollToBottom = () => {
|
const scrollToBottom = () => {
|
||||||
if (scrollContainerRef.value) {
|
if (scrollContainerRef.value) {
|
||||||
scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight;
|
scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight + 70;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -850,11 +936,13 @@ const updateLog = (isStart: boolean) => {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timeView.value = secondToTime(timeDifference.value / 1000)
|
||||||
if (activeIndex === checkTotal) {
|
if (activeIndex === checkTotal) {
|
||||||
testLogList.push({
|
testLogList.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log: currentTime.value + ' :检测结束,总用时' + getTimeDifference(timeDifference.value),
|
log: currentTime.value + ' :检测结束,总用时' + getTimeDifference(timeDifference.value),
|
||||||
})
|
})
|
||||||
|
stopTimeCount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -893,6 +981,11 @@ const setErrorCheckItem = (scriptType: string, devices: CheckData.DeviceCheckRes
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
log: `${new Date().toLocaleString()} :${devices[i].deviceName}连接超时`,
|
log: `${new Date().toLocaleString()} :${devices[i].deviceName}连接超时`,
|
||||||
})
|
})
|
||||||
|
ElMessageBox.alert('连接超时!', '连接超时', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
emit('update:testStatus', 'connect_timeout')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -914,9 +1007,9 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch
|
|||||||
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
|
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
|
||||||
// devices = [
|
// devices = [
|
||||||
// {
|
// {
|
||||||
// chnResult: [3, 4],
|
// chnResult: [1, 1, 1, 1],
|
||||||
// deviceId: "80b4b4f52a4c4064a18319525f8ac13c",
|
// deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||||
// deviceName: "240002"
|
// deviceName: "250226001"
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// chnResult: [1, 1, 1, 1],
|
// chnResult: [1, 1, 1, 1],
|
||||||
@@ -927,7 +1020,7 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch
|
|||||||
// chnResult: [1, 1, 1, 1],
|
// chnResult: [1, 1, 1, 1],
|
||||||
// deviceId: "ae5a7628260349c0a5e7c86c81fbd417",
|
// deviceId: "ae5a7628260349c0a5e7c86c81fbd417",
|
||||||
// deviceName: "240004"
|
// deviceName: "240004"
|
||||||
// }
|
// },
|
||||||
// {
|
// {
|
||||||
// chnResult: [1, 1, 1, 1],
|
// chnResult: [1, 1, 1, 1],
|
||||||
// deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
// deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
||||||
@@ -1084,6 +1177,7 @@ const handleClick = (item: any, chnNum: number, scriptType: string) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (flag === -1 || flag === 1) {
|
if (flag === -1 || flag === 1) {
|
||||||
|
checkStore.setShowDetailType(2)
|
||||||
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType);
|
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1209,7 +1303,7 @@ const startTimer = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handlePause = () => {
|
const handlePause = () => {
|
||||||
emit('sendPause')
|
//emit('sendPause')
|
||||||
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`})
|
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1222,6 +1316,7 @@ const pauseSuccessCallback = () => {
|
|||||||
type: 'info',
|
type: 'info',
|
||||||
log: `${new Date().toLocaleString()}:暂停检测`,
|
log: `${new Date().toLocaleString()}:暂停检测`,
|
||||||
})
|
})
|
||||||
|
stopTimeCount()
|
||||||
console.log('暂停中')
|
console.log('暂停中')
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1233,7 +1328,7 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_Start`,
|
requestId: `${code}_Start`,
|
||||||
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
@@ -1241,11 +1336,11 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_End`,
|
requestId: `${code}_End`,
|
||||||
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||||
data: [{
|
data: [{
|
||||||
chnResult: [1, 1, 1, 1],
|
chnResult: [1, 1, 1, 1],
|
||||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||||
deviceName: "25011407"
|
deviceName: "250226001"
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1254,7 +1349,7 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_Start`,
|
requestId: `${code}_Start`,
|
||||||
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, 3000)
|
}, 3000)
|
||||||
@@ -1262,11 +1357,11 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_End`,
|
requestId: `${code}_End`,
|
||||||
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||||
data: [{
|
data: [{
|
||||||
chnResult: [1, 1, 1, 1],
|
chnResult: [1, 1, 1, 1],
|
||||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||||
deviceName: "25011407"
|
deviceName: "250226001"
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1275,7 +1370,7 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_Start`,
|
requestId: `${code}_Start`,
|
||||||
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, 6000)
|
}, 6000)
|
||||||
@@ -1283,11 +1378,11 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_End`,
|
requestId: `${code}_End`,
|
||||||
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||||
data: [{
|
data: [{
|
||||||
chnResult: [1, 2, 1, 1],
|
chnResult: [1, 1, 1, 1],
|
||||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||||
deviceName: "25011407"
|
deviceName: "250226001"
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1298,8 +1393,8 @@ const todoItem = (code: string) => {
|
|||||||
requestId: `${code}_End`,
|
requestId: `${code}_End`,
|
||||||
data: [{
|
data: [{
|
||||||
chnResult: [1, 2, 1, 1],
|
chnResult: [1, 2, 1, 1],
|
||||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||||
deviceName: "25011407"
|
deviceName: "250226001"
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1309,20 +1404,26 @@ const todoItem = (code: string) => {
|
|||||||
const handleResumeTest = () => {
|
const handleResumeTest = () => {
|
||||||
//activeIndex++
|
//activeIndex++
|
||||||
startData.value = new Date();
|
startData.value = new Date();
|
||||||
testLogList.push({
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!`})
|
||||||
type: 'info',
|
|
||||||
log: `${new Date().toLocaleString()}:继续检测`,
|
|
||||||
})
|
|
||||||
//startTimer()
|
//startTimer()
|
||||||
|
resumeTimeCount()
|
||||||
console.log('开始继续检测')
|
console.log('开始继续检测')
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleReCheck = () => {
|
const handleReCheck = () => {
|
||||||
|
initCheckResult()
|
||||||
activeIndex = 0
|
activeIndex = 0
|
||||||
percentage.value = 0
|
percentage.value = 0
|
||||||
|
timeCount.value = 0
|
||||||
|
timeView.value = '00:00:00'
|
||||||
|
timeDifference.value = 0
|
||||||
testLogList.length = 0
|
testLogList.length = 0
|
||||||
|
|
||||||
errorCheckItem.length = 0
|
errorCheckItem.length = 0
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
|
showTestLog()
|
||||||
|
//handleResumeTest()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前执行的大测试项序号
|
// 获取当前执行的大测试项序号
|
||||||
@@ -1347,7 +1448,51 @@ const getNextActiveIndex = (code: string = ''): number => {
|
|||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
const startTimeCount = () => {
|
||||||
|
if (!timer) {
|
||||||
|
timer = setInterval(() => {
|
||||||
|
timeCount.value = timeCount.value + 1
|
||||||
|
timeView.value = secondToTime(timeCount.value)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const stopTimeCount = () => {
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const resumeTimeCount = () => {
|
||||||
|
timer = setInterval(() => {
|
||||||
|
timeCount.value = timeCount.value + 1
|
||||||
|
timeView.value = secondToTime(timeCount.value)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const secondToTime = (second: number) => {
|
||||||
|
//将秒数转换成时分秒
|
||||||
|
let h: string | number = Math.floor(second / 3600)
|
||||||
|
let m: string | number = Math.floor((second - h * 3600) / 60)
|
||||||
|
let s: string | number = Math.floor(second % 60);
|
||||||
|
|
||||||
|
h = h < 10 ? '0' + h : h;
|
||||||
|
m = m < 10 ? '0' + m : m;
|
||||||
|
s = s < 10 ? '0' + s : s;
|
||||||
|
return h + ':' + m + ':' + s;
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handlePause
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -1389,11 +1534,23 @@ const getNextActiveIndex = (code: string = ''): number => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dialog-title {
|
.dialog-title {
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.timeView {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
color: #91cc75;
|
||||||
|
width: 28%;
|
||||||
|
margin-right: 0px;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-content {
|
.dialog-content {
|
||||||
@@ -1421,7 +1578,7 @@ const getNextActiveIndex = (code: string = ''): number => {
|
|||||||
.drawer-container {
|
.drawer-container {
|
||||||
:deep(header.el-drawer__header) {
|
:deep(header.el-drawer__header) {
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
background-color: #003078 !important;
|
background-color: var(--el-color-primary) !important;
|
||||||
|
|
||||||
.el-drawer__close-btn svg:hover {
|
.el-drawer__close-btn svg:hover {
|
||||||
color: #ccc !important;
|
color: #ccc !important;
|
||||||
@@ -1448,7 +1605,7 @@ const getNextActiveIndex = (code: string = ''): number => {
|
|||||||
|
|
||||||
|
|
||||||
//:deep(.el-drawer .el-drawer__title){
|
//:deep(.el-drawer .el-drawer__title){
|
||||||
// background-color: #003078 !important;
|
// background-color: var(--el-color-primary) !important;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,58 +1,80 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" :model-value="dialogVisible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px"
|
<el-dialog :title="dialogTitle" width="1550px" :model-value="dialogVisible" :before-close="beforeClose" @close="handleClose" height="1000px" draggable>
|
||||||
draggable>
|
|
||||||
|
|
||||||
<div class="steps-container">
|
<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">
|
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
|
||||||
<!-- style="height:100px" -->
|
<el-step v-if="preTestSelected" title="预检测" :icon="stepsActive > 1 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Edit" @click="handleStepClick(1)"/>
|
||||||
<!-- <el-step title="预检测" :icon="getIcon(0)" /> -->
|
<el-step v-if="timeTestSelected" title="守时检测" :icon="stepsActive > 2 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :UploadFilled" @click="handleStepClick(2)"/>
|
||||||
<el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit"/>
|
<el-step v-if="channelsTestSelected" title="系数校准" :icon="stepsActive > 3 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Odometer" @click="handleStepClick(3)"/>
|
||||||
<el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled" v-if="isTimeCheck"/>
|
<el-step v-if="testSelected" title="正式检测" :icon="stepsActive > 4 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Coin" @click="handleStepClick(4)"/>
|
||||||
<!-- <el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" /> -->
|
<el-step title="检测完成" :icon="stepsActiveIndex > stepsTotalNum-1 ? SuccessFilled :Key"/>
|
||||||
<el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin"/>
|
|
||||||
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key"/>
|
|
||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</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>
|
<preTest v-if="showComponent&&preTestSelected" v-show="preTestSelected && stepsActiveView==1" ref="preTestRef" v-model:testStatus="preTestStatus"
|
||||||
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
|
:webMsgSend="webMsgSend"/>
|
||||||
<test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"
|
<timeTest v-if="showComponent&&timeTestSelected" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/>
|
||||||
@sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck"></test>
|
<!-- <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>
|
<template #footer>
|
||||||
<div>
|
<div>
|
||||||
<!-- <el-button @click="handleCancel">取 消</el-button> -->
|
<!-- <el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < stepsTotalNum && ActiveStatue != 'success'" @click="nextStep">跳过</el-button>-->
|
||||||
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled"
|
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
|
||||||
@click="nextStep">跳过
|
<!-- <el-button type="primary"-->
|
||||||
</el-button>
|
<!-- v-if="(stepsActiveIndex <= stepsTotalNum - 1) && (ActiveStatue !== 'success' &&ActiveStatue !== 'test_init' && ActiveStatue !=='paused_ing' && ActiveStatue !=='paused' && ActiveStatue !== 'waiting' && ActiveStatue !== 'error' && ActiveStatue !== 'test_init_fail' && ActiveStatue !== 'connect_timeout' && ActiveStatue!=='pause_timeout')"-->
|
||||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit" :disabled="btnState">开始检测</el-button>
|
<!-- disabled>-->
|
||||||
<el-button type="primary" v-if="TestStatus === 'process'" @click="handleSubmit" disabled>
|
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
|
||||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
<!-- <component :is="Refresh"/>-->
|
||||||
<component :is="Refresh"/>
|
<!-- </el-icon>-->
|
||||||
</el-icon>
|
<!-- 检测中-->
|
||||||
检测中
|
<!-- </el-button>-->
|
||||||
</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" v-if="ActiveStatue === 'process'" 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="ActiveStatue === 'recheck' || ActiveStatue ==='error' || ActiveStatue ==='test_init_fail' || ActiveStatue === 'pause_timeout' || ActiveStatue === 'connect_timeout'" @click="handleSubmit">重新检测</el-button>-->
|
||||||
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
|
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
|
||||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||||
<component :is="Refresh"/>
|
<component :is="Refresh"/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
初始化中
|
初始化中
|
||||||
</el-button>
|
</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-button type="warning" v-if="TestStatus === 'paused_ing'" disabled>
|
||||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||||
<component :is="Refresh"/>
|
<component :is="Refresh"/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
暂停中
|
暂停中
|
||||||
</el-button>
|
</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"
|
<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">
|
@click="nextStep">
|
||||||
{{ nextStepText }}
|
{{ nextStepText }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button type="primary" @click="handleQuit" v-else>
|
||||||
|
退出检测
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@@ -61,108 +83,28 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="tsx" setup name="testPopup">
|
<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 {ElMessage, ElMessageBox} from 'element-plus'
|
||||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
import {Coin, DArrowRight, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPlay,VideoPause} from '@element-plus/icons-vue'
|
||||||
import {
|
|
||||||
Close,
|
|
||||||
Coin,
|
|
||||||
DArrowRight,
|
|
||||||
Edit,
|
|
||||||
Key,
|
|
||||||
Odometer,
|
|
||||||
Refresh,
|
|
||||||
Right,
|
|
||||||
SuccessFilled,
|
|
||||||
UploadFilled,
|
|
||||||
VideoPlay,
|
|
||||||
RefreshLeft, Loading
|
|
||||||
} from '@element-plus/icons-vue'
|
|
||||||
import preTest from './preTest.vue'
|
import preTest from './preTest.vue'
|
||||||
import timeTest from './timeTest.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 socketClient from '@/utils/webSocketClient';
|
||||||
import {useCheckStore} from "@/stores/modules/check";
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
import {startPreTest, pauseTest, resumeTest} from '@/api/socket/socket'
|
import {pauseTest, resumeTest, startPreTest} from '@/api/socket/socket'
|
||||||
import {showFullScreenLoading} from "@/components/Loading/fullScreen";
|
import {useUserStore} from "@/stores/modules/user";
|
||||||
|
import { Device } from '@/api/device/interface/device';
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
//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 checkStore = useCheckStore();
|
const checkStore = useCheckStore();
|
||||||
const skipDisabled = ref(false);
|
|
||||||
const nextStepText = ref('下一步');
|
const nextStepText = ref('下一步');
|
||||||
const dialogVisible = ref(false)
|
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 stepsTotalNum = ref(-1);//步骤总数
|
||||||
const stepsActiveIndex = ref(0); //当前正在执行的步骤索引
|
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
|
||||||
|
const stepsActiveView = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
|
||||||
|
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态,用于切换步骤
|
||||||
const ActiveStatue = ref('waiting');//当前步骤状态
|
const ActiveStatue = ref('waiting');//当前步骤状态
|
||||||
const preTestStatus = ref('waiting');//预检测执行状态
|
const preTestStatus = ref('waiting');//预检测执行状态
|
||||||
const timeTestStatus = ref('waiting');//守时校验执行状态
|
const timeTestStatus = ref('waiting');//守时校验执行状态
|
||||||
@@ -170,124 +112,143 @@ const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
|||||||
const TestStatus = ref('waiting');//正式检测执行状态
|
const TestStatus = ref('waiting');//正式检测执行状态
|
||||||
const webMsgSend = ref();//webSocket推送的数据
|
const webMsgSend = ref();//webSocket推送的数据
|
||||||
|
|
||||||
const dialogTitle = ref('');
|
|
||||||
const isTimeCheck = ref(false)
|
|
||||||
const preTestRef = ref(null);
|
|
||||||
|
|
||||||
|
const dialogTitle = ref('')
|
||||||
// const devIdArr = ref([])
|
const showComponent = ref(true)
|
||||||
// const planId = ref('')
|
const preTestRef = ref(null)
|
||||||
|
const testRef = ref(null)
|
||||||
|
|
||||||
const dataSocket = reactive({
|
const dataSocket = reactive({
|
||||||
socketServe: socketClient.Instance,
|
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);
|
const initOperate = () => {
|
||||||
// devIdArr.value = selection.map(item => item.id);
|
ActiveStatue.value = 'waiting'
|
||||||
// planId.value =selection[0].planId
|
preTestStatus.value = 'waiting'
|
||||||
// console.log('wwwwwwwwwwwwwwwww',selection)
|
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) {
|
let count = 0
|
||||||
ElMessageBox.confirm(
|
for (let key in checkStore.selectTestItems) {
|
||||||
'所勾选设备检测状态不一致,请重新选择',
|
if (checkStore.selectTestItems[key]) {
|
||||||
'提示',
|
count++
|
||||||
{
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
stepsTotalNum.value = count + 1
|
||||||
|
|
||||||
|
if (preTestSelected.value) {
|
||||||
|
stepsActiveView.value = 1
|
||||||
|
stepsActive.value = 1
|
||||||
return
|
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) => {
|
||||||
|
initOperate()
|
||||||
dialogTitle.value = title;
|
dialogTitle.value = title;
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
isTimeCheck.value = time
|
|
||||||
|
|
||||||
if (preTestRef.value) {
|
if (preTestRef.value) {
|
||||||
preTestRef.value.initializeParameters();
|
preTestRef.value.initializeParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
preTestStatus.value = 'waiting';//预检测执行状态
|
|
||||||
//开始创建webSocket客户端
|
//开始创建webSocket客户端
|
||||||
|
|
||||||
socketClient.Instance.connect();
|
socketClient.Instance.connect();
|
||||||
dataSocket.socketServe = socketClient.Instance;
|
dataSocket.socketServe = socketClient.Instance;
|
||||||
dataSocket.socketServe.registerCallBack('aaa', (res) => {
|
dataSocket.socketServe.registerCallBack('aaa', (res) => {
|
||||||
// 处理来自服务器的消息
|
// 处理来自服务器的消息
|
||||||
// console.log('Received message:', res);
|
// console.log('Received message:', res);
|
||||||
// 根据需要在这里添加更多的处理逻辑
|
// 根据需要在这里添加更多的处理逻辑
|
||||||
|
|
||||||
if (res.code === 20000) {
|
if (res.code === 20000) {
|
||||||
ElMessage.error(message.message)
|
//ElMessage.error(message.message)
|
||||||
loading.close()
|
// loading.close()
|
||||||
} else {
|
} else {
|
||||||
webMsgSend.value = res
|
webMsgSend.value = res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let loading;
|
// let loading;
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
skipDisabled.value = true
|
|
||||||
//btnState.value = true
|
|
||||||
console.log('=============', stepsActiveIndex.value)
|
|
||||||
|
|
||||||
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
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连接中断!')
|
ElMessage.error('webSocket连接中断!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
console.log("handleSubmit",stepsActive.value,TestStatus.value)
|
||||||
switch (stepsActiveIndex.value) {
|
switch (stepsActive.value) {
|
||||||
case 0:
|
case 1:
|
||||||
// preTestStatus.value = 'start'
|
|
||||||
|
|
||||||
startPreTest({
|
startPreTest({
|
||||||
userPageId: "cdf",
|
userPageId: "cdf",
|
||||||
devIds: deviceIds,
|
devIds: deviceIds,
|
||||||
planId: planId,
|
planId: planId,
|
||||||
operateType: '1' // '1'为预检测、‘2‘为正式检测
|
operateType: '1', // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
|
userId:userStore.userInfo.id,
|
||||||
|
temperature:checkStore.temperature,
|
||||||
|
humidity:checkStore.humidity
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 'A001014') {
|
if (res.code === 'A001014') {
|
||||||
ElMessageBox.alert('装置配置异常', '检测失败', {
|
ElMessageBox.alert('装置配置异常', '检测失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
TestStatus.value = 'error'
|
preTestStatus.value = 'error'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
preTestStatus.value = 'start'
|
preTestStatus.value = 'start'
|
||||||
|
// setTimeout(() => {
|
||||||
|
// preTestStatus.value = 'success'
|
||||||
|
// }, 5000)
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 2:
|
||||||
timeTestStatus.value = 'start'
|
timeTestStatus.value = 'start'
|
||||||
break;
|
break;
|
||||||
// case 2:
|
case 3:
|
||||||
// channelsTestStatus.value = 'start'
|
// 调用系数校准组件的handleSubmit方法
|
||||||
// break;
|
channelsTestStatus.value = 'start'
|
||||||
case 2:
|
break;
|
||||||
|
case 4:
|
||||||
if (TestStatus.value == "waiting") {
|
if (TestStatus.value == "waiting") {
|
||||||
startPreTest({
|
startPreTest({
|
||||||
userPageId: "cdf",
|
userPageId: "cdf",
|
||||||
devIds: deviceIds,
|
devIds: deviceIds,
|
||||||
planId: planId,
|
planId: planId,
|
||||||
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
operateType: checkStore.reCheckType ==1 ?'2':'8', // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
|
userId:userStore.userInfo.id,
|
||||||
|
temperature:checkStore.temperature,
|
||||||
|
humidity:checkStore.humidity
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.code === 'A001014') {
|
if (res.code === 'A001014') {
|
||||||
@@ -297,31 +258,23 @@ const handleSubmit = () => {
|
|||||||
})
|
})
|
||||||
TestStatus.value = 'test_init_fail'
|
TestStatus.value = 'test_init_fail'
|
||||||
}
|
}
|
||||||
/* if (res.code === 20000) {
|
|
||||||
TestStatus.value = 'start'
|
|
||||||
webMsgSend.value = ''
|
|
||||||
} else {
|
|
||||||
ElMessage.error(res.message)
|
|
||||||
}*/
|
|
||||||
})
|
})
|
||||||
TestStatus.value = 'start'
|
TestStatus.value = 'start'
|
||||||
} else if (TestStatus.value == 'paused') {
|
} else if (TestStatus.value == 'paused') {
|
||||||
// 发送继续指令
|
// 发送继续指令
|
||||||
sendResume()
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -351,43 +304,59 @@ watch(TestStatus, function (newValue, oldValue) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
watch(ActiveStatue, function (newValue, oldValue) {
|
watch(ActiveStatue, function (newValue, oldValue) {
|
||||||
|
if (newValue === 'error') {
|
||||||
if (newValue === 'success' || newValue === 'error') {
|
stepsActiveIndex.value = stepsTotalNum.value + 1
|
||||||
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++;
|
|
||||||
nextStepText.value = '检测失败'
|
nextStepText.value = '检测失败'
|
||||||
}
|
}
|
||||||
if (newValue === 'test_init_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 1) {
|
||||||
stepsActiveIndex.value++;
|
stepsActiveIndex.value += 2
|
||||||
stepsActiveIndex.value++;
|
nextStepText.value = '检测完成'
|
||||||
|
}
|
||||||
|
if (newValue === 'test_init_fail') {
|
||||||
|
stepsActiveIndex.value += 2
|
||||||
nextStepText.value = '初始化失败'
|
nextStepText.value = '初始化失败'
|
||||||
}
|
}
|
||||||
if (newValue === 'connect_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
if (newValue === 'connect_timeout') {
|
||||||
stepsActiveIndex.value++;
|
stepsActiveIndex.value += 2
|
||||||
stepsActiveIndex.value++;
|
|
||||||
nextStepText.value = '连接超时'
|
nextStepText.value = '连接超时'
|
||||||
}
|
}
|
||||||
if (newValue === 'pause_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
if (newValue === 'pause_timeout') {
|
||||||
stepsActiveIndex.value++;
|
stepsActiveIndex.value += 2
|
||||||
stepsActiveIndex.value++;
|
// nextStepText.value = '结束测试'
|
||||||
nextStepText.value = '结束测试'
|
nextStepText.value = '暂停超时'
|
||||||
}
|
}
|
||||||
|
if (newValue === 'success' && stepsActiveIndex.value < stepsTotalNum.value - 1) {
|
||||||
|
nextStep() // 实现自动点击,进入下一个测试内容
|
||||||
|
handleSubmit()
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
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 = () => {
|
const sendPause = () => {
|
||||||
console.log('发起暂停请求')
|
console.log('发起暂停请求')
|
||||||
|
|
||||||
TestStatus.value = 'paused_ing'
|
TestStatus.value = 'paused_ing'
|
||||||
pauseTest()
|
pauseTest()
|
||||||
|
// setTimeout(() => {
|
||||||
|
// Object.assign(webMsgSend.value, {
|
||||||
|
// requestId: 'preStopTest',
|
||||||
|
// operateCode: 'stop'
|
||||||
|
// })
|
||||||
|
// }, 5000)
|
||||||
}
|
}
|
||||||
const sendResume = () => {
|
const sendResume = () => {
|
||||||
console.log('发起继续检测请求')
|
console.log('发起继续检测请求')
|
||||||
@@ -395,13 +364,15 @@ const sendResume = () => {
|
|||||||
resumeTest({
|
resumeTest({
|
||||||
userPageId: "cdf",
|
userPageId: "cdf",
|
||||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||||
planId: checkStore.planId,
|
planId: checkStore.plan.id,
|
||||||
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
}).then(res => {
|
userId:userStore.userInfo.id,
|
||||||
|
temperature:checkStore.temperature,
|
||||||
|
humidity:checkStore.humidity
|
||||||
|
})
|
||||||
Object.assign(webMsgSend.value, {
|
Object.assign(webMsgSend.value, {
|
||||||
requestId: 'Resume_Success'
|
requestId: 'Resume_Success'
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const sendReCheck = () => {
|
const sendReCheck = () => {
|
||||||
@@ -409,8 +380,11 @@ const sendReCheck = () => {
|
|||||||
startPreTest({
|
startPreTest({
|
||||||
userPageId: "cdf",
|
userPageId: "cdf",
|
||||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||||
planId: checkStore.planId,
|
planId: checkStore.plan.id,
|
||||||
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测
|
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
|
userId:userStore.userInfo.id,
|
||||||
|
temperature:checkStore.temperature,
|
||||||
|
humidity:checkStore.humidity
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.code === 'A001014') {
|
if (res.code === 'A001014') {
|
||||||
@@ -424,97 +398,90 @@ const sendReCheck = () => {
|
|||||||
TestStatus.value = 'start'
|
TestStatus.value = 'start'
|
||||||
}
|
}
|
||||||
|
|
||||||
const getIcon = (index: number) => {
|
const closeWebSocket = () => {
|
||||||
if (stepsActiveIndex.value > index) return SuccessFilled;
|
dataSocket.socketServe.closeWs()
|
||||||
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 nextStep = () => {
|
const nextStep = () => {
|
||||||
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
if (stepsActiveIndex.value == stepsTotalNum.value + 1 || ActiveStatue.value === 'error' || ActiveStatue.value === 'test_init_fail' || ActiveStatue.value === 'connect_timeout' || ActiveStatue.value === 'pause_timeout') {
|
||||||
stepsActiveIndex.value++
|
handleClose()
|
||||||
if (!isTimeCheck.value) {//不具备守时检测,预检测后直接跳正式检测
|
return
|
||||||
|
}
|
||||||
|
if (ActiveStatue.value != 'error') {
|
||||||
|
ActiveStatue.value = 'waiting'
|
||||||
|
let tempStep = stepsActiveIndex.value
|
||||||
|
let idx = 1
|
||||||
stepsActiveIndex.value++
|
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++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveStatue.value = 'waiting'
|
// if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||||
} else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
// stepsActiveIndex.value++
|
||||||
//emit('update:visible', false); // 关闭对话框
|
// if (!checkStore.selectTestItems.timeTest) { // 不具备守时检测
|
||||||
clearData()
|
// stepsActiveIndex.value++
|
||||||
dialogVisible.value = false;
|
// }
|
||||||
|
//
|
||||||
|
// 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() {
|
function clearData() {
|
||||||
stepsActiveIndex.value = 0;
|
stepsTotalNum.value = -1
|
||||||
|
stepsActiveIndex.value = 1
|
||||||
|
stepsActiveView.value = -1
|
||||||
preTestStatus.value = "waiting"
|
preTestStatus.value = "waiting"
|
||||||
timeTestStatus.value = "waiting"
|
timeTestStatus.value = "waiting"
|
||||||
channelsTestStatus.value = "waiting"
|
channelsTestStatus.value = "waiting"
|
||||||
TestStatus.value = "waiting"
|
TestStatus.value = "waiting"
|
||||||
ActiveStatue.value = "waiting"
|
ActiveStatue.value = "waiting"
|
||||||
skipDisabled.value = false
|
|
||||||
nextStepText.value = "下一步"
|
nextStepText.value = "下一步"
|
||||||
}
|
}
|
||||||
|
|
||||||
const beforeClose = (done: () => void) => {
|
const beforeClose = (done: () => void) => {
|
||||||
console.log(stepsActiveIndex.value, stepsTotalNum.value)
|
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||||
if (stepsActiveIndex.value < stepsTotalNum.value) {
|
ElMessageBox.confirm('检测未完成,是否退出当前检测流程?', '提示', {
|
||||||
ElMessageBox.confirm(
|
|
||||||
'检测未完成,是否退出当前检测流程?',
|
|
||||||
'提示',
|
|
||||||
{
|
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}
|
}
|
||||||
)
|
).then(() => {
|
||||||
.then(() => {
|
handleClose()
|
||||||
clearData()
|
|
||||||
// todo 关闭弹窗,终止整个检测流程
|
|
||||||
//emit('update:visible', false); // 关闭对话框
|
|
||||||
dialogVisible.value = false;
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
clearData()
|
handleClose()
|
||||||
//emit('update:visible', false); // 关闭对话框
|
|
||||||
dialogVisible.value = false;
|
|
||||||
}
|
}
|
||||||
// ElMessageBox.confirm('Are you sure to close this dialog?')
|
|
||||||
// .then(() => {
|
|
||||||
// done()
|
|
||||||
// })
|
|
||||||
// .catch(() => {
|
|
||||||
// // catch error
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
const handleCancel = () => {
|
|
||||||
|
const handleClose = () => {
|
||||||
dataSocket.socketServe.closeWs()
|
dataSocket.socketServe.closeWs()
|
||||||
|
dialogVisible.value = false;
|
||||||
|
clearData()
|
||||||
|
showComponent.value = false;
|
||||||
|
|
||||||
emit('quitClicked'); // 触发事件
|
emit('quitClicked'); // 触发事件
|
||||||
// clearData()
|
}
|
||||||
// emit('update:visible', false); // 关闭对话框
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// // 当 props.visible 改变时,更新 formData
|
|
||||||
// watch(() => props.visible, (newVal) => {
|
|
||||||
// if (!newVal) {
|
|
||||||
// // 这里可以重置表单数据,如果需要的话
|
|
||||||
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({open})
|
defineExpose({open})
|
||||||
@@ -522,17 +489,21 @@ defineExpose({open})
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<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) {
|
:deep(.dialog-big .el-dialog__body) {
|
||||||
max-height: 840px !important;
|
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) {
|
.steps-container :deep(.test-head-steps) {
|
||||||
height: 80px;
|
height: 80px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<div class="right-title" >
|
<div class="right-title" >
|
||||||
<span v-if="activeIndex <= 1"> </span>
|
<span v-if="activeIndex <= 1"> </span>
|
||||||
<span v-if="activeIndex > 1" class="time-text">
|
<span v-if="activeIndex > 1" class="time-text">
|
||||||
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
|
标准时间: <span style="color: var(--el-color-primary)">{{ gpsTime }}</span>
|
||||||
</span>
|
</span>
|
||||||
<div class="error-dsc">
|
<div class="error-dsc">
|
||||||
<div class="green-div"></div>
|
<div class="green-div"></div>
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<!-- <span v-if="activeIndex <= 1"> </span>
|
<!-- <span v-if="activeIndex <= 1"> </span>
|
||||||
<span v-if="activeIndex > 1" style=" font-size: 18px;font-weight: 600;">
|
<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>
|
</span>
|
||||||
<div class="error-dsc">
|
<div class="error-dsc">
|
||||||
<div class="green-div"></div>
|
<div class="green-div"></div>
|
||||||
@@ -423,7 +423,7 @@ watch(ts, function (newValue, oldValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.right-title .gps-time {
|
.right-title .gps-time {
|
||||||
color: #003078;
|
color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-dsc {
|
.error-dsc {
|
||||||
@@ -440,7 +440,7 @@ watch(ts, function (newValue, oldValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.error-dsc .green-div {
|
.error-dsc .green-div {
|
||||||
background-color: #67C23A;
|
background-color: #91cc75;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-dsc .red-div {
|
.error-dsc .red-div {
|
||||||
|
|||||||
@@ -5,9 +5,13 @@
|
|||||||
placeholder='请输入计划名称'
|
placeholder='请输入计划名称'
|
||||||
clearable
|
clearable
|
||||||
v-model='searchForm.planName'
|
v-model='searchForm.planName'
|
||||||
|
show-word-limit
|
||||||
|
maxlength="32"
|
||||||
></el-input>
|
></el-input>
|
||||||
|
<el-tooltip content="检测计划列表" placement="top">
|
||||||
<Menu style='width: 26px;height: 26px; margin-left: 8px;cursor: pointer;color:var(--el-color-primary)'
|
<Menu style='width: 26px;height: 26px; margin-left: 8px;cursor: pointer;color:var(--el-color-primary)'
|
||||||
@click.stop='detail()' />
|
@click.stop='detail()' />
|
||||||
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div class='tree_container'>
|
<div class='tree_container'>
|
||||||
<el-tree
|
<el-tree
|
||||||
@@ -40,6 +44,7 @@ import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue'
|
|||||||
import { nextTick, onMounted, ref, watch } from 'vue';
|
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import {useCheckStore} from "@/stores/modules/check";
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
|
import { ElTooltip } from 'element-plus';
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const checkStore = useCheckStore()
|
const checkStore = useCheckStore()
|
||||||
@@ -64,10 +69,7 @@ const getTreeData = (val: any) => {
|
|||||||
if (item.children.length > 0) {
|
if (item.children.length > 0) {
|
||||||
let node = item.children[0];
|
let node = item.children[0];
|
||||||
defaultChecked.value.push(node.id);
|
defaultChecked.value.push(node.id);
|
||||||
checkStore.setPlanId(node.id);
|
checkStore.setPlan(node);
|
||||||
checkStore.setPlanCode(node.code);
|
|
||||||
checkStore.setScriptId(node.scriptId);
|
|
||||||
checkStore.setErrorSysId(node.errorSysId);
|
|
||||||
// 高亮显示第一个节点
|
// 高亮显示第一个节点
|
||||||
// 使用 nextTick 确保在 DOM 更新后调用 setCurrentKey
|
// 使用 nextTick 确保在 DOM 更新后调用 setCurrentKey
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@@ -133,10 +135,7 @@ const handleNodeClick = (data: Plan.ResPlan) => {
|
|||||||
|
|
||||||
idd.value = data.id
|
idd.value = data.id
|
||||||
|
|
||||||
checkStore.setPlanId(data.id)
|
checkStore.setPlan(data);
|
||||||
checkStore.setPlanCode(data.code)
|
|
||||||
checkStore.setScriptId(data.scriptId)
|
|
||||||
checkStore.setErrorSysId(data.errorSysId)
|
|
||||||
updateSelectedTreeNode(data.id)
|
updateSelectedTreeNode(data.id)
|
||||||
}
|
}
|
||||||
const filterNode = (value: string, data: any) => {
|
const filterNode = (value: string, data: any) => {
|
||||||
@@ -147,7 +146,7 @@ const filterNode = (value: string, data: any) => {
|
|||||||
|
|
||||||
// 点击详情
|
// 点击详情
|
||||||
const detail = () => {
|
const detail = () => {
|
||||||
router.push('/plan')
|
router.push('/plan/planList')
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// console.log()
|
// 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:'',humidity:''})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//定义校验规则
|
||||||
|
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>
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
<el-tab-pane :label='tabLabel1' :style='{ height: tabPaneHeight}'>
|
<el-tab-pane :label='tabLabel1' :style='{ height: tabPaneHeight}'>
|
||||||
<!-- 列表数据 -->
|
<!-- 列表数据 -->
|
||||||
<div class='container_table' :style='{ height: tableHeight }'>
|
<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' @batchGenerateClicked="handleBatchGenerate"></Table>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
@@ -145,7 +145,6 @@ const tabsHeight = ref('calc(100vh - 522px)') // 初始高度
|
|||||||
const tabPaneHeight = ref('calc(100% - 5px)') // 初始高度
|
const tabPaneHeight = ref('calc(100% - 5px)') // 初始高度
|
||||||
const tableHeight = ref('calc(100% - 50px)') // 初始高度
|
const tableHeight = ref('calc(100% - 50px)') // 初始高度
|
||||||
|
|
||||||
const isTimeCheck = ref<boolean>(false)
|
|
||||||
const planList = ref<ResultData<Plan.ReqPlan[]>>()
|
const planList = ref<ResultData<Plan.ReqPlan[]>>()
|
||||||
const select_Plan = ref<Plan.ReqPlan>()
|
const select_Plan = ref<Plan.ReqPlan>()
|
||||||
const isLabelLineShow = ref(true)
|
const isLabelLineShow = ref(true)
|
||||||
@@ -169,7 +168,7 @@ const handleTabsChange = (val: any) => {
|
|||||||
form.value.activeChildTabs = Number(val)
|
form.value.activeChildTabs = Number(val)
|
||||||
|
|
||||||
}
|
}
|
||||||
localStorage.setItem('color', 'red')
|
localStorage.setItem('color', '#91cc75')
|
||||||
//功能选择数据
|
//功能选择数据
|
||||||
const tabsList = ref([
|
const tabsList = ref([
|
||||||
{
|
{
|
||||||
@@ -302,13 +301,6 @@ const getPieData = async (id: string) => {
|
|||||||
planName.value = '所选计划:' + plan.name
|
planName.value = '所选计划:' + plan.name
|
||||||
|
|
||||||
select_Plan.value = plan
|
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] })
|
const pqDevList_Result2 = await getBoundPqDevList({ 'planId': id, 'checkStateList': [0, 1, 2, 3] })
|
||||||
boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[]
|
boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[]
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import { ElMessage } from "element-plus";
|
|||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from "@/stores/modules/auth";
|
||||||
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
|
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
import {getCurrentScene} from "@/api/user/login";
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const modeStore = useModeStore(); // 使用模式 store
|
const modeStore = useModeStore(); // 使用模式 store
|
||||||
const AppSceneStore = useAppSceneStore();
|
const AppSceneStore = useAppSceneStore();
|
||||||
@@ -70,7 +71,7 @@ const modeList = [
|
|||||||
code: "数字式",
|
code: "数字式",
|
||||||
subName: "启用数字检测计划",
|
subName: "启用数字检测计划",
|
||||||
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
|
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
|
||||||
isActive: false,
|
isActive: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "比对式模块",
|
name: "比对式模块",
|
||||||
@@ -82,7 +83,10 @@ const modeList = [
|
|||||||
];
|
];
|
||||||
const handelOpen = async (item: any) => {
|
const handelOpen = async (item: any) => {
|
||||||
modeStore.setCurrentMode(item.code); // 将模式code存入 store
|
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.setShowMenu();
|
||||||
return;
|
return;
|
||||||
// if (isActive) {
|
// if (isActive) {
|
||||||
|
|||||||
@@ -3,14 +3,12 @@
|
|||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
:data='logData'
|
:request-api='getTableList'
|
||||||
@selection-change='handleSelectionChange'
|
|
||||||
type='selection'
|
|
||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader>
|
<template #tableHeader>
|
||||||
<el-button type='primary' :icon='DataAnalysis' >分析</el-button>
|
<el-button type='primary' :icon='DataAnalysis'>分析</el-button>
|
||||||
<el-button type='primary' :icon='Upload'>导出csv</el-button>
|
<el-button type='primary' :icon='Upload' @click='handleExport'>导出csv</el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
|
|
||||||
@@ -21,43 +19,41 @@
|
|||||||
<script setup lang='tsx' name='useProTable'>
|
<script setup lang='tsx' name='useProTable'>
|
||||||
// 根据实际路径调整
|
// 根据实际路径调整
|
||||||
import TimeControl from '@/components/TimeControl/index.vue'
|
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 ProTable from '@/components/ProTable/index.vue'
|
||||||
import { Upload ,DataAnalysis} from '@element-plus/icons-vue'
|
import {DataAnalysis, Upload} from '@element-plus/icons-vue'
|
||||||
import logDataList from '@/api/system/log/logData'
|
import type {ColumnProps, ProTableInstance} from '@/components/ProTable/interface'
|
||||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
import {reactive, ref} from 'vue'
|
||||||
import { reactive,ref,watch } from 'vue'
|
import {getAuditLog, exportCsv} from '@/api/system/log/index.ts'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import {useDownload} from "@/hooks/useDownload";
|
||||||
|
import {exportPqDev} from "@/api/device/device";
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
name: 'log'
|
|
||||||
})
|
|
||||||
|
|
||||||
let multipleSelection = ref<string[]>([])
|
// defineOptions({
|
||||||
const logData = logDataList
|
// name: 'log'
|
||||||
const dictStore = useDictStore()
|
// })
|
||||||
// 定义包含和排除的单位
|
|
||||||
const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
|
const startDate = ref('')
|
||||||
const excludedUnits = ['季度','年']; // 要排除的单位
|
const endDate = ref('')
|
||||||
const defaultUnits = '日'; // 默认的单位
|
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
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>[]>([
|
const columns = reactive<ColumnProps<AuditLog.ReqAuditLogParams>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{type: 'selection', fixed: 'left', width: 70},
|
||||||
|
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||||
{
|
{
|
||||||
prop: 'id',
|
prop: 'userName',
|
||||||
label: '序号',
|
|
||||||
width: 70,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'create_By',
|
|
||||||
label: '操作用户',
|
label: '操作用户',
|
||||||
search: { el: 'input' },
|
search: {el: 'input'},
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -66,18 +62,17 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
|||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'create_Time',
|
prop: 'logTime',
|
||||||
label: '记录时间',
|
label: '记录时间',
|
||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
search: {
|
search: {
|
||||||
span: 2,
|
|
||||||
render: () => {
|
render: () => {
|
||||||
return (
|
return (
|
||||||
<div class='flx-flex-start'>
|
<div class='flx-flex-start'>
|
||||||
<TimeControl
|
<TimeControl
|
||||||
include={includedUnits}
|
include={['日', '周', '月', '自定义']}
|
||||||
exclude={excludedUnits}
|
default={'月'}
|
||||||
default={defaultUnits}
|
onUpdate-dates={handleDateChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -85,9 +80,11 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'remark',
|
|
||||||
label: '事件描述',
|
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',
|
prop: 'result',
|
||||||
@@ -100,25 +97,33 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
|||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return (
|
||||||
<el-tag type={scope.row.warn ? 'danger' : 'success'}>{scope.row.warn ? '告警' : '未告警'}</el-tag>
|
<el-tag type={scope.row.warn == 1 ? 'danger' : 'success'}>{scope.row.warn == 1 ? '已告警' : '未告警'}</el-tag>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'operate_Type',
|
prop: 'operateType',
|
||||||
label: '日志类型',
|
label: '日志类型',
|
||||||
width: 100,
|
width: 100,
|
||||||
search: { el: 'select', props: { filterable: true } },
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
//选中
|
// 处理日期变化的回调函数
|
||||||
// 处理选择变化
|
const handleDateChange = (startDateTemp: string, endDateTemp: string) => {
|
||||||
const handleSelectionChange = (selection: Sys_Log_Audit.Audit_LogList[]) => {
|
startDate.value = startDateTemp
|
||||||
multipleSelection.value = selection.map(row => row.id) // 更新选中的行
|
endDate.value = endDateTemp
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleExport = () => {
|
||||||
|
// 获取当前的搜索参数
|
||||||
|
let searchParam = proTable.value?.searchParam || {}
|
||||||
|
|
||||||
|
// 将开始时间和结束时间添加到搜索参数中
|
||||||
|
searchParam.searchBeginTime = startDate.value
|
||||||
|
searchParam.searchEndTime = endDate.value
|
||||||
|
|
||||||
|
useDownload(exportCsv, '日志列表', searchParam, false, '.csv')
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<el-input v-model='loginForm.username' placeholder='用户名'>
|
<el-input v-model='loginForm.username' placeholder='用户名'>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<el-icon class='el-input__icon'>
|
<el-icon class='el-input__icon'>
|
||||||
<user />
|
<user/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
@@ -24,11 +24,14 @@
|
|||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<el-icon class='el-input__icon'>
|
<el-icon class='el-input__icon'>
|
||||||
<lock />
|
<lock/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item prop='checked'>
|
||||||
|
<el-checkbox v-model="loginForm.checked">记住我</el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div class='login-btn'>
|
<div class='login-btn'>
|
||||||
<el-button
|
<el-button
|
||||||
@@ -53,21 +56,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
import { useRouter } from 'vue-router'
|
import {useRouter} from 'vue-router'
|
||||||
import { HOME_URL } from '@/config'
|
import {HOME_URL} from '@/config'
|
||||||
import { getTimeState } from '@/utils'
|
import {getTimeState} from '@/utils'
|
||||||
import { type Dict } from '@/api/interface'
|
import {type Dict} from '@/api/interface'
|
||||||
import { type Login } from '@/api/user/interface/user'
|
import {type Login} from '@/api/user/interface/user'
|
||||||
import { ElNotification } from 'element-plus'
|
import type {ElForm} from 'element-plus'
|
||||||
import { getDictList, loginApi } from '@/api/user/login'
|
import {ElNotification} from 'element-plus'
|
||||||
import { useUserStore } from '@/stores/modules/user'
|
import {getDictList, getPublicKey, loginApi} from '@/api/user/login'
|
||||||
import { useTabsStore } from '@/stores/modules/tabs'
|
import {useUserStore} from '@/stores/modules/user'
|
||||||
import { useKeepAliveStore } from '@/stores/modules/keepAlive'
|
import {useTabsStore} from '@/stores/modules/tabs'
|
||||||
import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
import {useKeepAliveStore} from '@/stores/modules/keepAlive'
|
||||||
import { CircleClose, UserFilled } from '@element-plus/icons-vue'
|
import {initDynamicRouter} from '@/routers/modules/dynamicRouter'
|
||||||
import { useAuthStore } from '@/stores/modules/auth'
|
import {CircleClose, UserFilled} from '@element-plus/icons-vue'
|
||||||
import type { ElForm } from 'element-plus'
|
import {useAuthStore} from '@/stores/modules/auth'
|
||||||
import {useDictStore} from "@/stores/modules/dict";
|
import {useDictStore} from "@/stores/modules/dict";
|
||||||
|
import forge from 'node-forge'
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -76,19 +80,21 @@ const tabsStore = useTabsStore()
|
|||||||
const keepAliveStore = useKeepAliveStore()
|
const keepAliveStore = useKeepAliveStore()
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
let publicKey: any = null;
|
||||||
|
|
||||||
|
|
||||||
type FormInstance = InstanceType<typeof ElForm>;
|
type FormInstance = InstanceType<typeof ElForm>;
|
||||||
const loginFormRef = ref<FormInstance>()
|
const loginFormRef = ref<FormInstance>()
|
||||||
const loginRules = reactive({
|
const loginRules = reactive({
|
||||||
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
username: [{required: true, message: '请输入用户名', trigger: 'blur'}],
|
||||||
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
|
password: [{required: true, message: '请输入密码', trigger: 'blur'}],
|
||||||
})
|
})
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const loginForm = reactive<Login.ReqLoginForm>({
|
const loginForm = reactive<Login.ReqLoginForm>({
|
||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
|
checked: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
// login
|
// login
|
||||||
@@ -98,14 +104,22 @@ const login = (formEl: FormInstance | undefined) => {
|
|||||||
if (!valid) return
|
if (!valid) return
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
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.执行登录接口
|
// 1.执行登录接口
|
||||||
const { data } = await loginApi({
|
const {data} = await loginApi({
|
||||||
...loginForm,
|
username: forge.util.encode64(loginForm.username),
|
||||||
password: loginForm.password,
|
password: encryptPassword(loginForm.password),
|
||||||
})
|
})
|
||||||
userStore.setAccessToken(data.accessToken)
|
userStore.setAccessToken(data.accessToken)
|
||||||
userStore.setRefreshToken(data.refreshToken)
|
userStore.setRefreshToken(data.refreshToken)
|
||||||
userStore.setUserInfo(data.userInfo)
|
userStore.setUserInfo(data.userInfo)
|
||||||
|
if(loginForm.checked){
|
||||||
|
userStore.setExp(Date.now() + 1000 * 60 * 60 * 24 * 30)
|
||||||
|
}
|
||||||
const response = await getDictList()
|
const response = await getDictList()
|
||||||
const dictData = response.data as unknown as Dict[]
|
const dictData = response.data as unknown as Dict[]
|
||||||
await dictStore.initDictData(dictData)
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped lang='scss'>
|
<style scoped lang='scss'>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 550px;
|
min-height: 550px;
|
||||||
// background-color: #eeeeee;
|
// background-color: #eeeeee;
|
||||||
background-color: #003078;
|
background-color: var(--el-color-primary);
|
||||||
background-image: url("@/assets/images/login_bg.svg");
|
background-image: url("@/assets/images/login_bg.svg");
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
|
|||||||
@@ -0,0 +1,715 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="divider-container">
|
||||||
|
<el-divider style="width: 260px" content-position="left">检测脚本信息</el-divider>
|
||||||
|
<el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider>
|
||||||
|
</div>
|
||||||
|
<div class="data-check-content">
|
||||||
|
<div class="content-tree">
|
||||||
|
<Tree ref="treeRef" :treeData="treeData" @setTab="setTab" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content-right-Tabs" style="height: calc(100vh - 315px); width: 100px">
|
||||||
|
<el-tabs type="border-card" style="height: 100%" v-model="activeName" @tab-change="tabChange">
|
||||||
|
<el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
|
||||||
|
<div v-if="activeName == tab.value">
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<!-- <el-button :icon="CirclePlus" type="primary" @click="openDialog('add')">新增</el-button>-->
|
||||||
|
</div>
|
||||||
|
<div style="display: flex">
|
||||||
|
<!-- 通信脚本 -->
|
||||||
|
<el-tabs type="border-card" v-model="firstName" style="height: 100%" class="hidden-tab">
|
||||||
|
<el-tab-pane label="通讯脚本" name="first">
|
||||||
|
<Commun
|
||||||
|
:activeName="activeName"
|
||||||
|
:formContent="props.formContent"
|
||||||
|
:options="props.options"
|
||||||
|
style="width: 360px"
|
||||||
|
:disabled="tab.children.length == 0 ? false : true"
|
||||||
|
ref="communRef"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<!-- 2级tab -->
|
||||||
|
<el-tabs
|
||||||
|
type="border-card"
|
||||||
|
style="flex: 1; margin-left: 10px"
|
||||||
|
v-model="childActiveName"
|
||||||
|
@tab-change="inquireTable"
|
||||||
|
>
|
||||||
|
<el-tab-pane
|
||||||
|
v-for="subTab in tab.children || []"
|
||||||
|
:key="subTab.value"
|
||||||
|
:label="subTab.label"
|
||||||
|
:name="subTab.value"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
:header-cell-style="{
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: 'var(--el-color-primary)',
|
||||||
|
color: '#fff'
|
||||||
|
}"
|
||||||
|
stripe
|
||||||
|
:cell-style="{ textAlign: 'center' }"
|
||||||
|
height="calc(100vh - 480px)"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" label="组次" width="60" />
|
||||||
|
<el-table-column prop="ffreq" label="频率(Hz)" width="90" />
|
||||||
|
<el-table-column
|
||||||
|
:label="item.label"
|
||||||
|
v-for="item in column"
|
||||||
|
:key="item.label"
|
||||||
|
>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<table class="tableL">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="theFirst">V</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num].famp == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num]?.famp +
|
||||||
|
(valueCode == 'Absolute' ? 'V' : '%')
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num].fphase == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num].fphase +
|
||||||
|
'°'
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="theFirst">I</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num + 1].famp == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num + 1].famp +
|
||||||
|
(valueCode == 'Absolute' ? 'A' : '%')
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num + 1].fphase == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num + 1].fphase +
|
||||||
|
'°'
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="165">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="actionButtons">
|
||||||
|
<el-button type="primary" link :icon="View" @click="view(row)">
|
||||||
|
查看
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<div class="page">
|
||||||
|
<div class="black-container">
|
||||||
|
<!-- <el-progress-->
|
||||||
|
<!-- v-if="loading"-->
|
||||||
|
<!-- type="circle"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <template #default="{}">-->
|
||||||
|
<!-- <span class="Loading">Loading</span>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- </el-progress>-->
|
||||||
|
<div class="loading-container" v-if="showLoading">
|
||||||
|
<div style="width: 80%; height: 80%" class="loading-box">
|
||||||
|
<div class="loading-circle"></div>
|
||||||
|
<div class="loading-text">Loading...</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||||
|
</div>
|
||||||
|
<div class="loading-container" v-else>
|
||||||
|
<div style="width: 80%; height: 80%" class="loading-box">
|
||||||
|
<div class="loading-circle static"></div>
|
||||||
|
<div class="loading-text">Loading</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 10px">
|
||||||
|
<span>标准源加量输出:{{ hour }}时{{ minute }}分{{ second }}秒</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 10px">
|
||||||
|
<el-button
|
||||||
|
:icon="VideoPlay"
|
||||||
|
type="primary"
|
||||||
|
size="large"
|
||||||
|
@click="startLoading"
|
||||||
|
:disabled="pauseDisabled"
|
||||||
|
>
|
||||||
|
启动
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
:icon="VideoPause"
|
||||||
|
type="primary"
|
||||||
|
size="large"
|
||||||
|
@click="stopLoading"
|
||||||
|
:disabled="pauseDisabled"
|
||||||
|
>
|
||||||
|
停止
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<TestProjectPopup
|
||||||
|
ref="testProjectPopupRef"
|
||||||
|
:options="props.options"
|
||||||
|
:activeName="activeName"
|
||||||
|
:childActiveName="childActiveName"
|
||||||
|
:formContent="props.formContent"
|
||||||
|
:communicationList="communicationList"
|
||||||
|
@addTab="addTab"
|
||||||
|
@getCommunication="getCommunication"
|
||||||
|
@close="showDialog = false"
|
||||||
|
v-if="showDialog"
|
||||||
|
/>
|
||||||
|
<!-- 查看 -->
|
||||||
|
<ViewRow
|
||||||
|
ref="viewRowRef"
|
||||||
|
:activeName="activeName"
|
||||||
|
:formContent="props.formContent"
|
||||||
|
@close="viewDialog = false"
|
||||||
|
v-if="viewDialog"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { type PropType, ref, nextTick, onMounted, watch } from 'vue'
|
||||||
|
import Tree from './tree.vue'
|
||||||
|
import Commun from '@/views/machine/testScript/components//communication.vue'
|
||||||
|
import { type CascaderOption, ElMessage } from 'element-plus'
|
||||||
|
import { getTreeData } from '@/api/check/test'
|
||||||
|
import {
|
||||||
|
CirclePlus,
|
||||||
|
Delete,
|
||||||
|
Check,
|
||||||
|
CopyDocument,
|
||||||
|
View,
|
||||||
|
EditPen,
|
||||||
|
VideoPlay,
|
||||||
|
VideoPause,
|
||||||
|
Loading
|
||||||
|
} from '@element-plus/icons-vue'
|
||||||
|
import type { TestScript } from '@/api/device/interface/testScript'
|
||||||
|
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
|
||||||
|
import { CheckData } from '@/api/check/interface'
|
||||||
|
import { dlsDetails, deleteDtls, updateDtls, addScriptDtls, checkDataList } from '@/api/device/testScript'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { scriptDtlsCheckDataList } from '@/api/device/testScript/index'
|
||||||
|
import ViewRow from '@/views/machine/testScript/components/viewRow.vue'
|
||||||
|
import { startSimulateTest, closeSimulateTest } from '@/api/device/controlSource/index.ts'
|
||||||
|
import { controlSource } from '@/api/device/interface/controlSource'
|
||||||
|
interface TabOption {
|
||||||
|
label?: string
|
||||||
|
name?: string
|
||||||
|
value?: string
|
||||||
|
code?: string
|
||||||
|
children?: TabOption[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const treeRef = ref()
|
||||||
|
const communRef = ref()
|
||||||
|
const treeData = ref<CheckData.TreeItem[]>([])
|
||||||
|
const valueCode = ref('') //Absolute绝对值
|
||||||
|
const props = defineProps({
|
||||||
|
options: {
|
||||||
|
type: Array as PropType<TabOption[]>,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
formContent: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
formControl: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
startDisabeld: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
pauseDisabled: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const viewDialog = ref(false)
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const activeName = ref('')
|
||||||
|
const childActiveName = ref('')
|
||||||
|
const childActiveIndex = ref(0)
|
||||||
|
const firstName = 'first'
|
||||||
|
const viewRowRef = ref()
|
||||||
|
const communicationList = ref<[]>([])
|
||||||
|
const testProjectPopupRef = ref()
|
||||||
|
const tableData: any = ref([])
|
||||||
|
const tabData: any = ref([])
|
||||||
|
|
||||||
|
const showLoading = ref(false)
|
||||||
|
const column = ref([
|
||||||
|
{
|
||||||
|
label: 'L1',
|
||||||
|
num: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'L2',
|
||||||
|
num: 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'L3',
|
||||||
|
num: 4
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// 时间计数器
|
||||||
|
let timer: any = null
|
||||||
|
const timeCount = ref(0)
|
||||||
|
const hour = ref(0)
|
||||||
|
const minute = ref(0)
|
||||||
|
const second = ref(0)
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:activeName', 'update:activeIndex', 'update:startDisabeld', 'update:pauseDisabled'])
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.formControl.scriptId,
|
||||||
|
async () => {
|
||||||
|
if (props.formControl.scriptId != '') {
|
||||||
|
nextTick(async () => {
|
||||||
|
await getTree()
|
||||||
|
console.log('props.formControl.scriptId')
|
||||||
|
treeRef.value.checkTree()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
const controlContent = ref<controlSource.ResControl>({
|
||||||
|
userPageId: '',
|
||||||
|
scriptId: '',
|
||||||
|
scriptIndex: 0,
|
||||||
|
sourceId: ''
|
||||||
|
})
|
||||||
|
// 获取树
|
||||||
|
const getTree = () => {
|
||||||
|
getTreeData({
|
||||||
|
scriptId: props.formControl.scriptId
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 'A0000') {
|
||||||
|
treeData.value = res.data
|
||||||
|
//console.log('tree',res.data)
|
||||||
|
// 为 treeData 及其子节点添加 id
|
||||||
|
let idCounter = 0
|
||||||
|
const addIdToTree = (nodes: any[]) => {
|
||||||
|
nodes.forEach(node => {
|
||||||
|
node.id = idCounter++ // 为每个节点添加唯一的 id
|
||||||
|
if (node.children && node.children.length > 0) {
|
||||||
|
node.disabled = true
|
||||||
|
addIdToTree(node.children) // 递归为子节点添加 id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
addIdToTree(treeData.value)
|
||||||
|
|
||||||
|
// 添加tab子项
|
||||||
|
props.options.forEach((k: any, i: number) => {
|
||||||
|
tabData.value[i].children = []
|
||||||
|
treeData.value.forEach((item: any) => {
|
||||||
|
if (k.value == item.scriptTypeCode) {
|
||||||
|
item.children.forEach((s: any) => {
|
||||||
|
k.children.forEach((P: any) => {
|
||||||
|
if (P.code == s.scriptTypeCode) {
|
||||||
|
tabData.value[i].children.push({
|
||||||
|
label: P.label,
|
||||||
|
value: P.code,
|
||||||
|
children: []
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
s.children.forEach((j: any) => {
|
||||||
|
if (j.scriptTypeCode == P.code) {
|
||||||
|
tabData.value[i].children.push({
|
||||||
|
label: P.label,
|
||||||
|
value: P.code,
|
||||||
|
children: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
//console.log('2222',treeData.value)
|
||||||
|
|
||||||
|
tabChange()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//console.log('获取树')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置树点击tab
|
||||||
|
const setTab = row => {
|
||||||
|
activeName.value = row.activeName
|
||||||
|
childActiveName.value = row.childActiveName
|
||||||
|
childActiveIndex.value = row.activeIndex
|
||||||
|
getTree()
|
||||||
|
emit('update:activeName', activeName.value) // 触发事件并传递 activeName.value
|
||||||
|
emit('update:activeIndex', row.activeIndex) // 触发事件并传递 activeName.value
|
||||||
|
}
|
||||||
|
const copyActiveName = ref('')
|
||||||
|
// 获取通讯脚本点击
|
||||||
|
const getCommunication = () => {
|
||||||
|
//console.log('controlSourceDetail',communRef.value[0]?.getData())
|
||||||
|
communicationList.value = communRef.value[0]?.getData()
|
||||||
|
}
|
||||||
|
// 切换大tab控制小tab
|
||||||
|
const tabChange = () => {
|
||||||
|
if (copyActiveName.value != activeName.value) {
|
||||||
|
copyActiveName.value == activeName.value
|
||||||
|
|
||||||
|
if (
|
||||||
|
tabData.value
|
||||||
|
.filter((item: any) => item.value == activeName.value)[0]
|
||||||
|
?.children.filter((item: any) => item.value == childActiveName.value).length == 0
|
||||||
|
) {
|
||||||
|
childActiveName.value =
|
||||||
|
tabData.value.filter((item: any) => item.value == activeName.value)[0]?.children[0]?.value || ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inquireTable()
|
||||||
|
}
|
||||||
|
//根据脚本id查询检测脚本详情
|
||||||
|
const inquireTable = () => {
|
||||||
|
const sortOrder = ['Ua', 'Ia', 'Ub', 'Ib', 'Uc', 'Ic']
|
||||||
|
dlsDetails({
|
||||||
|
scriptId: props.formControl.scriptId,
|
||||||
|
scriptType: activeName.value,
|
||||||
|
scriptSubType: childActiveName.value
|
||||||
|
}).then((res: any) => {
|
||||||
|
if (res.code === 'A0000') {
|
||||||
|
res.data.forEach((item: any) => {
|
||||||
|
item.channelList = item.channelList.sort((a: any, b: any) => {
|
||||||
|
const indexA = sortOrder.indexOf(a.channelType)
|
||||||
|
const indexB = sortOrder.indexOf(b.channelType)
|
||||||
|
return indexA - indexB
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
tableData.value = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
//console.log('treeData',treeData.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查看
|
||||||
|
const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||||
|
getCommunication()
|
||||||
|
//当前点击的一级tab
|
||||||
|
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'
|
||||||
|
//当前点击的二级tab
|
||||||
|
const childrenTabName = ref('')
|
||||||
|
tabData.value.forEach((item: any) => {
|
||||||
|
if (item.value == activeName.value) {
|
||||||
|
item.children.forEach((k: any) => {
|
||||||
|
if (k.value == childActiveName.value) {
|
||||||
|
childrenTabName.value = k.label
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
viewDialog.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义 startLoading 方法
|
||||||
|
const startLoading = async () => {
|
||||||
|
emit('update:startDisabeld', true)
|
||||||
|
emit('update:pauseDisabled', true)
|
||||||
|
ElMessage.success({ message: '启动中...', duration: 6000 })
|
||||||
|
// 启动加载逻辑
|
||||||
|
controlContent.value.userPageId = 'cdf'
|
||||||
|
controlContent.value.scriptId = props.formControl.scriptId
|
||||||
|
controlContent.value.scriptIndex = childActiveIndex.value
|
||||||
|
controlContent.value.sourceId = props.formControl.sourceId
|
||||||
|
setTimeout(async () => {
|
||||||
|
await startSimulateTest(controlContent.value)
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义 startLoading 方法
|
||||||
|
const stopLoading = async () => {
|
||||||
|
// 启动加载逻辑
|
||||||
|
controlContent.value.userPageId = 'cdf'
|
||||||
|
controlContent.value.scriptId = props.formControl.scriptId
|
||||||
|
controlContent.value.scriptIndex = childActiveIndex.value
|
||||||
|
controlContent.value.sourceId = props.formControl.sourceId
|
||||||
|
await closeSimulateTest(controlContent.value)
|
||||||
|
emit('update:pauseDisabled', true)
|
||||||
|
emit('update:startDisabeld', true)
|
||||||
|
ElMessage.success({ message: '停止中...', duration: 5000 })
|
||||||
|
}
|
||||||
|
|
||||||
|
const startTimeCount = () => {
|
||||||
|
// Loading效果展示
|
||||||
|
showLoading.value = true
|
||||||
|
|
||||||
|
if (!timer) {
|
||||||
|
hour.value = 0
|
||||||
|
minute.value = 0
|
||||||
|
second.value = 0
|
||||||
|
timeCount.value = 0
|
||||||
|
timer = setInterval(() => {
|
||||||
|
timeCount.value = timeCount.value + 1
|
||||||
|
secondToTime(timeCount.value)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const secondToTime = (secd: number) => {
|
||||||
|
//将秒数转换成时分秒
|
||||||
|
hour.value = Math.floor(secd / 3600)
|
||||||
|
minute.value = Math.floor((secd - hour.value * 3600) / 60)
|
||||||
|
second.value = Math.floor(secd % 60)
|
||||||
|
}
|
||||||
|
|
||||||
|
const stopTimeCount = () => {
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer)
|
||||||
|
timer = null
|
||||||
|
}
|
||||||
|
//Loading效果关闭
|
||||||
|
showLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取左边树数据
|
||||||
|
// 新增保存
|
||||||
|
const addTab = (row: any) => {
|
||||||
|
getTree()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getTree()
|
||||||
|
props.options.forEach((item: any) => {
|
||||||
|
tabData.value.push({
|
||||||
|
label: item.label.replace(/准确度|检测/g, ''),
|
||||||
|
value: item.value,
|
||||||
|
code: item.code,
|
||||||
|
children: []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
activeName.value = tabData.value[0].value
|
||||||
|
|
||||||
|
valueCode.value = dictStore
|
||||||
|
.getDictData('Script_Value_Type')
|
||||||
|
.filter(item => item.id == props.formContent.valueType)[0].code
|
||||||
|
})
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
startTimeCount,
|
||||||
|
stopTimeCount
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.data-check-content {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-tree {
|
||||||
|
width: 260px;
|
||||||
|
height: calc(100vh - 315px);
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
border-radius: 4px;
|
||||||
|
// margin-right: 10px;
|
||||||
|
overflow: auto; /* 同时启用垂直和水平滚动 */
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
.scriptTree {
|
||||||
|
height: calc(100vh - 520px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确保 el-tree 内容可以超出容器宽度 */
|
||||||
|
.el-tree {
|
||||||
|
width: fit-content; /* 根据内容自适应宽度 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-right-Tabs {
|
||||||
|
flex: 1; /* 根据需要调整宽度比例 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider-container {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider-container .el-divider {
|
||||||
|
margin-right: 30px; /* 根据需要调整间距 */
|
||||||
|
}
|
||||||
|
:deep(.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell) {
|
||||||
|
padding: 3px 11px;
|
||||||
|
}
|
||||||
|
:deep(.el-loading-mask) {
|
||||||
|
z-index: 3000;
|
||||||
|
}
|
||||||
|
.tableL {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
td {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 5px;
|
||||||
|
width: 45%;
|
||||||
|
}
|
||||||
|
.theFirst {
|
||||||
|
background-color: var(--el-color-primary);
|
||||||
|
color: #fff;
|
||||||
|
width: 20px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.actionButtons {
|
||||||
|
.el-button {
|
||||||
|
margin-left: 0px;
|
||||||
|
margin: 5px 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.black-container {
|
||||||
|
background-color: #000;
|
||||||
|
width: 300px;
|
||||||
|
height: 300px;
|
||||||
|
position: relative; /* 设置为相对定位 */
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-box {
|
||||||
|
position: relative; /* 设置为相对定位 */
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-circle {
|
||||||
|
border: 8px solid rgba(255, 255, 255, 0.932);
|
||||||
|
border-top: 8px solid var(--el-color-primary); /* 蓝色 */
|
||||||
|
border-bottom: 8px solid var(--el-color-primary); /* 蓝色 */
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
position: absolute; /* 设置为绝对定位 */
|
||||||
|
animation: spin 2s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-circle.static {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-text {
|
||||||
|
position: absolute; /* 设置为绝对定位 */
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 20px; /* 根据需要调整字体大小 */
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden-tab {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rotate {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style>
|
||||||
|
input::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
input::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none !important;
|
||||||
|
}
|
||||||
|
.el-divider--horizontal {
|
||||||
|
margin: 4px 0 24px 0;
|
||||||
|
}
|
||||||
|
.el-tabs--border-card > .el-tabs__content {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
166
frontend/src/views/machine/controlSource/components/tree.vue
Normal file
166
frontend/src/views/machine/controlSource/components/tree.vue
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
<template>
|
||||||
|
<el-tree
|
||||||
|
node-key="id"
|
||||||
|
default-expand-all
|
||||||
|
:data="props.treeData"
|
||||||
|
:props="defaultProps"
|
||||||
|
style="width: 100%"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
:highlight-current="true"
|
||||||
|
@node-click="handleNodeClick"
|
||||||
|
show-checkbox
|
||||||
|
:check-strictly="true"
|
||||||
|
@check-change="handleCheckChange"
|
||||||
|
ref="treeRef"
|
||||||
|
>
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<el-tooltip effect="dark" :content="data.sourceDesc || data.scriptTypeName" placement="top" :hide-after="0">
|
||||||
|
<div class="custom-tree-node">
|
||||||
|
{{ data.scriptTypeName || data.sourceDesc }}
|
||||||
|
</div>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-tree>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, onMounted, watch, nextTick } from 'vue'
|
||||||
|
|
||||||
|
import { CheckData } from '@/api/check/interface'
|
||||||
|
import { da } from 'element-plus/es/locale'
|
||||||
|
import { on } from 'events'
|
||||||
|
const props = defineProps({
|
||||||
|
treeData: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['setTab'])
|
||||||
|
const dataTree = ref<CheckData.TreeItem[]>([])
|
||||||
|
const defaultProps = {
|
||||||
|
children: 'children',
|
||||||
|
label: 'scriptTypeName',
|
||||||
|
pid: 'pid'
|
||||||
|
}
|
||||||
|
const activeName = ref('')
|
||||||
|
const childActiveName = ref('')
|
||||||
|
const activeIndex = ref()
|
||||||
|
const treeRef = ref()
|
||||||
|
const handleNodeClick = (data, node) => {
|
||||||
|
if(data.index!= null){
|
||||||
|
let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
|
||||||
|
const parents = getParentNodes(node, [])
|
||||||
|
parents.pop()
|
||||||
|
parents.unshift(node.data)
|
||||||
|
parents.reverse()
|
||||||
|
let active = parents[0].scriptTypeCode
|
||||||
|
let childActive = findTargetCodes(parents, code)[0] || ''
|
||||||
|
// 获取当前节点的直接父节点
|
||||||
|
if (activeName.value != active || childActiveName.value != childActive || activeIndex.value != data.index) {
|
||||||
|
activeName.value = active
|
||||||
|
childActiveName.value = childActive
|
||||||
|
emit('setTab', {
|
||||||
|
activeName: active,
|
||||||
|
childActiveName: childActive,
|
||||||
|
activeIndex:data.index
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回父级
|
||||||
|
const getParentNodes = (node, parents) => {
|
||||||
|
if (node.parent) {
|
||||||
|
// 将父节点添加到数组中
|
||||||
|
parents.push(node.parent.data)
|
||||||
|
// 递归获取更高层级的父节点
|
||||||
|
getParentNodes(node.parent, parents)
|
||||||
|
}
|
||||||
|
return parents
|
||||||
|
}
|
||||||
|
// 判断childActiveName值
|
||||||
|
function findTargetCodes(data: any[], targetCodes: string[]) {
|
||||||
|
let result: string[] = []
|
||||||
|
data.forEach(item => {
|
||||||
|
if (item.scriptTypeCode != null) {
|
||||||
|
if (targetCodes.includes(item.scriptTypeCode)) {
|
||||||
|
result.push(item.scriptTypeCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
// for (let item of data) {
|
||||||
|
// // 判断当前项的 scriptTypeCode 是否包含目标值
|
||||||
|
// if (item.scriptTypeCode !=null && targetCodes.includes(item.scriptTypeCode)) {
|
||||||
|
// console.log("🚀 ~ findTargetCodes ~ targetCodes.includes(item.scriptTypeCode):",item.scriptTypeCode, targetCodes.includes(item.scriptTypeCode))
|
||||||
|
// result.push(item.scriptTypeCode)
|
||||||
|
// return result
|
||||||
|
// }
|
||||||
|
// // 如果存在 children,递归检查
|
||||||
|
// if (item.children && item.children.length > 0) {
|
||||||
|
// result = result.concat(findTargetCodes(item.children, targetCodes))
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return result
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCheckChange(data,isChecked) {
|
||||||
|
if (isChecked)
|
||||||
|
{
|
||||||
|
// 如果没有子节点,允许勾选
|
||||||
|
const checked = [data.id]; // id为tree的node-key属性
|
||||||
|
treeRef.value?.setCheckedKeys(checked);
|
||||||
|
emit('setTab', {
|
||||||
|
activeName: data.scriptType,
|
||||||
|
childActiveName: data.scriptTypeCode,
|
||||||
|
activeIndex:data.index
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 递归查找第一个节点的最后一层子节点
|
||||||
|
function findFirstLeafNode(node: any): any {
|
||||||
|
if (node.children && node.children.length > 0) {
|
||||||
|
return findFirstLeafNode(node.children[0]);
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkTree = () => {
|
||||||
|
console.log('checkTree11')
|
||||||
|
console.log('checkTree22',props.treeData.length)
|
||||||
|
console.log('checkTree33',treeRef.value)
|
||||||
|
if (props.treeData.length > 0 && treeRef.value) {
|
||||||
|
console.log('checkTree44')
|
||||||
|
const firstNode = props.treeData[0];
|
||||||
|
const firstLeafNode = findFirstLeafNode(firstNode);
|
||||||
|
const firstLeafNodeId = firstLeafNode.id;
|
||||||
|
treeRef.value.setCheckedKeys([firstLeafNodeId]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保在组件挂载后也执行一次
|
||||||
|
onMounted(() => {
|
||||||
|
console.log('onMounted',props.treeData);
|
||||||
|
nextTick(() => {
|
||||||
|
checkTree()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// // 对外映射
|
||||||
|
defineExpose({ checkTree })
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.custom-tree-node {
|
||||||
|
max-width: 230px;
|
||||||
|
overflow-x: hidden !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
text-overflow: ellipsis !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
366
frontend/src/views/machine/controlSource/index.vue
Normal file
366
frontend/src/views/machine/controlSource/index.vue
Normal file
@@ -0,0 +1,366 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-card style="margin-bottom: 10px" class="cardTop">
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
label-width="auto"
|
||||||
|
ref="dialogFormRef"
|
||||||
|
class="form-four"
|
||||||
|
>
|
||||||
|
<el-form-item label='检测源' prop='sourceId' >
|
||||||
|
<el-select v-model="controlContent.sourceId" collapse-tags placeholder="请选择检测源">
|
||||||
|
<el-option
|
||||||
|
v-for="(option, index) in pqSourceArray"
|
||||||
|
:key="index"
|
||||||
|
:label="option.label"
|
||||||
|
:value="option.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='检测脚本' prop='scriptId'>
|
||||||
|
<el-select v-model="controlContent.scriptId" collapse-tags placeholder="请选择检测脚本" @change="handleScriptChange">
|
||||||
|
<el-option
|
||||||
|
v-for="(option, index) in scriptArray"
|
||||||
|
:key="index"
|
||||||
|
:label="option.label"
|
||||||
|
:value="option.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<!-- <div class="formBut">-->
|
||||||
|
<el-button type="primary" :icon="Select" @click="start()" :disabled="connectDisabeld">通讯校验</el-button>
|
||||||
|
<el-button v-if="!connectDisabeld" type="text" style="color: #303133" disabled>源未连接</el-button>
|
||||||
|
<el-button v-else type="text" style="color: #91cc75" disabled>源连接成功</el-button>
|
||||||
|
<!-- </div>-->
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
<el-card v-if="show">
|
||||||
|
<ControlSourceDetail v-if="secondLevelOptions.length > 0" :options="secondLevelOptions" :formContent="formContent" :formControl="controlContent"
|
||||||
|
@update:activeName="handleActiveNameChange"
|
||||||
|
@update:active-index="handleActiveIndexChange"
|
||||||
|
|
||||||
|
v-model:startDisabeld="startDisabeld"
|
||||||
|
@update:startDisabeld="startDisabeld=$event"
|
||||||
|
v-model:pauseDisabled="pauseDisabled"
|
||||||
|
@update:pauseDisabled="pauseDisabled=$event"
|
||||||
|
ref="controlSourceDetailRef"/>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, nextTick, onMounted, onBeforeMount, reactive, watch } from 'vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import ControlSourceDetail from '@/views/machine/controlSource/components/controlSourceDetail.vue'
|
||||||
|
import { type TestScript } from '@/api/device/interface/testScript'
|
||||||
|
import type { Dict } from '@/api/system/dictionary/interface'
|
||||||
|
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||||
|
import { Select } from '@element-plus/icons-vue'
|
||||||
|
import { pqScriptAdd } from '@/api/device/testScript'
|
||||||
|
import { getTestSourceList } from '@/api/plan/plan.ts'
|
||||||
|
import { TestSource } from '@/api/device/interface/testSource'
|
||||||
|
import { CascaderOption, ElMessage } from 'element-plus'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||||
|
import socketClient from '@/utils/webSocketClient'
|
||||||
|
import { checkSimulate } from '@/api/device/controlSource/index.ts'
|
||||||
|
import { controlSource } from '@/api/device/interface/controlSource'
|
||||||
|
import {getPqScriptList} from '@/api/plan/plan.ts'
|
||||||
|
|
||||||
|
const show = ref(false)
|
||||||
|
const router = useRouter()
|
||||||
|
const modeId = ref()
|
||||||
|
const sourceValue = ref([])
|
||||||
|
const secondLevelOptions: any[] = []
|
||||||
|
// 定义弹出组件元信息
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const pqSourceList=ref<TestSource.ResTestSource[]>([])//获取指定模式下所有检测源
|
||||||
|
const modeStore = useModeStore()
|
||||||
|
const pqSourceArray = ref<{ label: string; value: string; }[]>()
|
||||||
|
const scriptArray = reactive<{label: string, value: string}[]>([])
|
||||||
|
// const formContent = ref<TestScript.ResTestScript>({
|
||||||
|
// id : '9ff96807cf8c7524587982ed8baa8b57',
|
||||||
|
// name: '测试',
|
||||||
|
// type: '1',
|
||||||
|
// valueType: '2973cb938b591b93d0df2547599b87d8',
|
||||||
|
// pattern: modeId.value,
|
||||||
|
// standardName: 'GBT 19862',
|
||||||
|
// standardTime: '2025',
|
||||||
|
// state: 1
|
||||||
|
// })
|
||||||
|
const formContent = ref<TestScript.ResTestScript>({
|
||||||
|
id : '',
|
||||||
|
name: '',
|
||||||
|
type: '',
|
||||||
|
valueType: '',
|
||||||
|
pattern: modeId.value,
|
||||||
|
standardName: '',
|
||||||
|
standardTime: '',
|
||||||
|
state: 1
|
||||||
|
})
|
||||||
|
const connectDisabeld = ref(false)
|
||||||
|
const startDisabeld = ref(true)
|
||||||
|
const pauseDisabled = ref(true)
|
||||||
|
const controlSourceDetailRef=ref<InstanceType<typeof ControlSourceDetail>>()
|
||||||
|
|
||||||
|
const controlContent = ref<controlSource.ResControl>({
|
||||||
|
userPageId: '',
|
||||||
|
scriptId: '',
|
||||||
|
scriptIndex: 0,
|
||||||
|
sourceId: '',
|
||||||
|
})
|
||||||
|
//开始创建webSocket客户端
|
||||||
|
const dataSocket = reactive({
|
||||||
|
socketServe: socketClient.Instance,
|
||||||
|
});
|
||||||
|
const webMsgSend = ref()//webSocket推送的数据
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
// 检查 socketClient.Instance 是否存在
|
||||||
|
if (!socketClient.Instance) {
|
||||||
|
console.error('WebSocket 客户端实例不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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 pqSource_Result = await getTestSourceList({
|
||||||
|
pattern: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ,
|
||||||
|
datasourceIds: '',
|
||||||
|
sourceIds: '',
|
||||||
|
planId: '',
|
||||||
|
scriptName: '',
|
||||||
|
errorSysName: '',
|
||||||
|
sourceName: '',
|
||||||
|
devIds: [],
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
dataSourceId: '',
|
||||||
|
scriptId: '',
|
||||||
|
errorSysId: '',
|
||||||
|
timeCheck: 0,
|
||||||
|
testState: 0,
|
||||||
|
reportState: 0,
|
||||||
|
result: 0,
|
||||||
|
code: 0,
|
||||||
|
state: 1
|
||||||
|
})
|
||||||
|
pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[];
|
||||||
|
const sourceArray1 = Array.isArray(pqSourceList.value) ? pqSourceList.value : []
|
||||||
|
// 将 pqSource_Result 转换成 { label, value } 数组
|
||||||
|
pqSourceArray.value = sourceArray1.map(item => ({
|
||||||
|
label: item.name || '',
|
||||||
|
value: item.id
|
||||||
|
}));
|
||||||
|
controlContent.value.sourceId = pqSourceArray.value[0].value
|
||||||
|
|
||||||
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id //获取数据字典中对应的id
|
||||||
|
const {data} = await getPqScriptList({pattern:patternId})
|
||||||
|
scriptArray.push(...data.map(item => ({ label: item.name, value: item.id})))
|
||||||
|
if(scriptArray.length > 0){
|
||||||
|
controlContent.value.scriptId = scriptArray[0].value
|
||||||
|
}
|
||||||
|
|
||||||
|
nextTick(async () => {
|
||||||
|
await treeInfo(modeStore.currentMode)
|
||||||
|
formContent.value.pattern = modeId.value
|
||||||
|
formContent.value.id = controlContent.value.scriptId
|
||||||
|
show.value = true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(webMsgSend, function (newValue, oldValue) {
|
||||||
|
console.log('webMsgSend:', newValue)
|
||||||
|
if (newValue.requestId.includes('formal_real&&') && newValue.operateCode === 'OPER_GATHER') {
|
||||||
|
if (newValue.code === 10200) {
|
||||||
|
ElMessage.success('启动成功!')
|
||||||
|
startDisabeld.value = false
|
||||||
|
pauseDisabled.value = false
|
||||||
|
controlSourceDetailRef.value?.startTimeCount()
|
||||||
|
}else if(newValue.code !== 10201){
|
||||||
|
ElMessage.error('启动失败!')
|
||||||
|
startDisabeld.value = false
|
||||||
|
pauseDisabled.value = true
|
||||||
|
console.log('错误信息:',webMsgSend)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (newValue.requestId.includes('close_source') && newValue.operateCode === 'CLOSE_GATHER') {
|
||||||
|
if (newValue.code === 10200) {
|
||||||
|
setTimeout(() => {
|
||||||
|
ElMessage.success('停止成功!')
|
||||||
|
connectDisabeld.value = false
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = true
|
||||||
|
controlSourceDetailRef.value?.stopTimeCount()
|
||||||
|
}, 5000)
|
||||||
|
} else {
|
||||||
|
ElMessage.error('停止失败!')
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = false
|
||||||
|
console.log('错误信息:',webMsgSend)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (newValue.requestId) {
|
||||||
|
case 'yjc_ytxjy':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'INIT_GATHER':
|
||||||
|
if (newValue.code == 10200) {
|
||||||
|
ElMessage.success('源连接成功!')
|
||||||
|
connectDisabeld.value = true
|
||||||
|
startDisabeld.value = false
|
||||||
|
pauseDisabled.value = false
|
||||||
|
} else if(newValue.code !== 10201) {
|
||||||
|
ElMessage.error('源连接失败!')
|
||||||
|
console.log('错误信息:',webMsgSend)
|
||||||
|
connectDisabeld.value = false
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = true
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'connect':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case "Source":
|
||||||
|
ElMessage.error('源连接失败!')
|
||||||
|
connectDisabeld.value = false
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = true
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'server_error':
|
||||||
|
if(newValue.operateCode === 'server_error'){
|
||||||
|
ElMessage.error('服务端主动关闭连接,请20秒后重试!')
|
||||||
|
connectDisabeld.value = true
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
connectDisabeld.value = false
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = true
|
||||||
|
}, 20000)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
// 获取树字典
|
||||||
|
const treeInfo = async (currentMode: string) => {
|
||||||
|
const data: Dict.ResDictTree = {
|
||||||
|
name: '',
|
||||||
|
id: '',
|
||||||
|
pid: '',
|
||||||
|
pids: '',
|
||||||
|
code: 'Script_Indicator_Items',
|
||||||
|
sort: 0
|
||||||
|
}
|
||||||
|
const result = await getDictTreeByCode(data)
|
||||||
|
const result1 = (await getDictTreeByCode({ ...data, code: 'Script_Error' })).data[0].children
|
||||||
|
const allOptions = await convertToOptions(result.data as Dict.ResDictTree[])
|
||||||
|
const setAllTree = await setTree(allOptions[0]?.children, result1)
|
||||||
|
secondLevelOptions.push(...(setAllTree || []))
|
||||||
|
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id
|
||||||
|
}
|
||||||
|
|
||||||
|
const setTree = async (data, data1) => {
|
||||||
|
data.forEach(item => {
|
||||||
|
data1.forEach(item1 => {
|
||||||
|
if (item.label.replace(/准确度|检测/g, '') == item1.name) {
|
||||||
|
item.value = item1.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换函数
|
||||||
|
const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
|
||||||
|
return dictTree.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
code: item.code.split('-')[1] || item.code.split('-')[0],
|
||||||
|
label: item.name,
|
||||||
|
children: item.children ? convertToOptions(item.children) : undefined
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
const scriptId = ref('')
|
||||||
|
const scriptIndex = ref(0)
|
||||||
|
const handleActiveNameChange = (newActiveName: string) => {
|
||||||
|
scriptId.value = newActiveName
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleActiveIndexChange = (newActiveIndex: number) => {
|
||||||
|
|
||||||
|
scriptIndex.value = newActiveIndex
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 定义 handleScriptChange 方法
|
||||||
|
const handleScriptChange = (value: string) => {
|
||||||
|
// 根据业务需求实现具体逻辑
|
||||||
|
//console.log('检测脚本变更:', value);
|
||||||
|
router.push({
|
||||||
|
path: '/machine/controlSource',
|
||||||
|
state: { title: '新增检测脚本', row: '', mode: modeStore.currentMode }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const start = async () => {
|
||||||
|
|
||||||
|
controlContent.value.userPageId = 'cdf'
|
||||||
|
controlContent.value.scriptIndex = scriptIndex.value
|
||||||
|
await checkSimulate(controlContent.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
/* .dialog-content {
|
||||||
|
padding: 10px;
|
||||||
|
} */
|
||||||
|
:deep(.cardTop) {
|
||||||
|
.el-card__body {
|
||||||
|
padding: 20px 0 0 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//.formBut {
|
||||||
|
// width: 50%;
|
||||||
|
// display: flex;
|
||||||
|
// justify-content: end;
|
||||||
|
//}
|
||||||
|
.form-four {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
// justify-content: space-between;
|
||||||
|
.el-form-item {
|
||||||
|
display: flex;
|
||||||
|
width: 24.0%;
|
||||||
|
|
||||||
|
.el-form-item__content {
|
||||||
|
flex: 1;
|
||||||
|
.el-select,
|
||||||
|
.el-cascader,
|
||||||
|
.el-input__inner,
|
||||||
|
.el-date-editor {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
||||||
<el-form-item label="名称" prop="name" >
|
<el-form-item label="名称" prop="name" >
|
||||||
<el-input v-model='formContent.name' placeholder="请输入设备类型名称"/>
|
<el-input v-model='formContent.name' placeholder="请输入设备类型名称" maxlength="32" show-word-limit/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="工作电源" prop="power" >
|
<el-form-item label="工作电源" prop="power" >
|
||||||
<el-select v-model="formContent.power" clearable placeholder="请选择工作电源">
|
<el-select v-model="formContent.power" clearable placeholder="请选择工作电源">
|
||||||
@@ -46,13 +46,13 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="报告模版名称" prop="reportName" >
|
<el-form-item label="报告模版名称" prop="reportName" v-if="scene == '1'">
|
||||||
<el-select v-model="formContent.reportName" clearable placeholder="请选择报告模版">
|
<el-select v-model="formContent.reportName" clearable placeholder="请选择报告模版">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Report_Template')"
|
v-for="item in dictStore.getDictData('Report_Template')"
|
||||||
:key="item.code"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.code"
|
:value="item.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -93,6 +93,7 @@
|
|||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
|
const scene = ref('')
|
||||||
const icdOptions = ref<ICD.ResICD[]>([])
|
const icdOptions = ref<ICD.ResICD[]>([])
|
||||||
function useMetaInfo() {
|
function useMetaInfo() {
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
@@ -138,8 +139,19 @@ const resetFormContent = () => {
|
|||||||
|
|
||||||
//定义规则
|
//定义规则
|
||||||
const formRuleRef = ref<FormInstance>()
|
const formRuleRef = ref<FormInstance>()
|
||||||
|
|
||||||
|
// 使用计算属性根据 scene 动态生成规则
|
||||||
|
const rules = computed(() => {
|
||||||
|
const dynamicRules = { ...baseRules };
|
||||||
|
|
||||||
|
if (scene.value === '1'){//只有楼下出厂需要展示
|
||||||
|
dynamicRules.reportName = [{ required: true, message: '报告模版名称必选!', trigger: 'change' }];
|
||||||
|
}
|
||||||
|
return dynamicRules;
|
||||||
|
});
|
||||||
|
|
||||||
//定义校验规则
|
//定义校验规则
|
||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
const baseRules: Record<string, Array<FormItemRule>> = {
|
||||||
name: [{ required: true, message: '设备类型名称必填!', trigger: 'blur' }],
|
name: [{ required: true, message: '设备类型名称必填!', trigger: 'blur' }],
|
||||||
power: [
|
power: [
|
||||||
{ required: true, message: '工作电源必选!', trigger: 'change' }
|
{ required: true, message: '工作电源必选!', trigger: 'change' }
|
||||||
@@ -153,13 +165,10 @@ const resetFormContent = () => {
|
|||||||
devCurr: [
|
devCurr: [
|
||||||
{ required: true, message: '额定电流必选!', trigger: 'change' }
|
{ required: true, message: '额定电流必选!', trigger: 'change' }
|
||||||
],
|
],
|
||||||
reportName: [
|
|
||||||
{ required: true, message: '报告模版名称必选!', trigger: 'change' }
|
|
||||||
],
|
|
||||||
icd: [
|
icd: [
|
||||||
{ required: true, message: '设备关联ICD必选!', trigger: 'change' }
|
{ required: true, message: '设备关联ICD必选!', trigger: 'change' }
|
||||||
],
|
]
|
||||||
})
|
};
|
||||||
|
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
@@ -193,12 +202,12 @@ const close = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = async (sign: string, data: DevType.ResPqDevType,icd: ICD.ResICD[]) => {
|
const open = async (sign: string, data: DevType.ResPqDevType,icd: ICD.ResICD[],currentScene: string) => {
|
||||||
// 重置表单
|
// 重置表单
|
||||||
dialogFormRef.value?.resetFields()
|
dialogFormRef.value?.resetFields()
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
scene.value = currentScene
|
||||||
icdOptions.value = icd
|
icdOptions.value = icd
|
||||||
|
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import type { ICD } from '@/api/device/interface/icd'
|
|||||||
// })
|
// })
|
||||||
const modeStore = useModeStore()
|
const modeStore = useModeStore()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
const appSceneStore = useAppSceneStore()
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
const devTypePopup = ref()
|
const devTypePopup = ref()
|
||||||
@@ -96,6 +97,9 @@ import type { ICD } from '@/api/device/interface/icd'
|
|||||||
prop: 'reportName',
|
prop: 'reportName',
|
||||||
label: '报告模版名称',
|
label: '报告模版名称',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
|
isShow: appSceneStore.currentScene == '1',
|
||||||
|
enum: dictStore.getDictData('Report_Template'),
|
||||||
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'icd',
|
prop: 'icd',
|
||||||
@@ -132,22 +136,19 @@ import type { ICD } from '@/api/device/interface/icd'
|
|||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<DevType.ResPqDevType> = {}) => {
|
const openDialog = (titleType: string, row: Partial<DevType.ResPqDevType> = {}) => {
|
||||||
devTypePopup.value?.open(titleType, row,icdOptions.value)
|
devTypePopup.value?.open(titleType, row,icdOptions.value,appSceneStore.currentScene)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 批量删除设备
|
// 批量删除设备类型
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
|
||||||
await useHandleData(deleteDevType, id, '删除所选设备类型')
|
await useHandleData(deleteDevType, id, '删除所选设备类型')
|
||||||
|
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除设备
|
// 删除设备类型
|
||||||
const handleDelete = async (params: DevType.ResPqDevType) => {
|
const handleDelete = async (params: DevType.ResPqDevType) => {
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
|
||||||
await useHandleData(deleteDevType, [params.id] , `删除【${params.name}】设备类型`)
|
await useHandleData(deleteDevType, [params.id] , `删除【${params.name}】设备类型`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="设备台账信息">
|
<el-tab-pane label="设备台账信息">
|
||||||
<div >
|
<div>
|
||||||
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' :disabled="false" label-width="auto" class="form-three">
|
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' :disabled="false" label-width="auto" class="form-three">
|
||||||
<el-divider >设备信息</el-divider>
|
<el-divider>设备信息</el-divider>
|
||||||
<el-form-item label="装置编号" prop="createId" >
|
<el-form-item label="装置编号" prop="createId">
|
||||||
<el-input v-model="formContent.createId" placeholder="请输入装置编号" @input="handleInput" />
|
<el-input v-model="formContent.createId" placeholder="请输入装置编号" @input="handleInput" maxlength="32" show-word-limit/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="设备名称" prop="name" >
|
<el-form-item label="设备名称" prop="name">
|
||||||
<el-input v-model='formContent.name' placeholder="请输入设备名称" :disabled="scene === '1'"/>
|
<el-input v-model='formContent.name' placeholder="请输入设备名称" :disabled="scene === '1'" maxlength="32" show-word-limit/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='设备类型' prop='devType' >
|
<el-form-item label='设备类型' prop='devType'>
|
||||||
<el-select v-model="formContent.devType" filterable clearable placeholder="请选择设备类型" @change="handleDevTypeChange">
|
<el-select v-model="formContent.devType" filterable clearable placeholder="请选择设备类型" @change="handleDevTypeChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in devTypeOptions"
|
v-for="item in devTypeOptions"
|
||||||
@@ -31,16 +31,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label='设备模式' prop='pattern' >-->
|
<!-- <el-form-item label='设备模式' prop='pattern' >-->
|
||||||
<!-- <el-select v-model="formContent.pattern" clearable placeholder="请选择设备模式" disabled>-->
|
<!-- <el-select v-model="formContent.pattern" clearable placeholder="请选择设备模式" disabled>-->
|
||||||
<!-- <el-option -->
|
<!-- <el-option -->
|
||||||
<!-- v-for="item in dictStore.getDictData('Pattern')"-->
|
<!-- v-for="item in dictStore.getDictData('Pattern')"-->
|
||||||
<!-- :key="item.id"-->
|
<!-- :key="item.id"-->
|
||||||
<!-- :label="item.name"-->
|
<!-- :label="item.name"-->
|
||||||
<!-- :value="item.id"-->
|
<!-- :value="item.id"-->
|
||||||
<!-- />-->
|
<!-- />-->
|
||||||
<!-- </el-select>-->
|
<!-- </el-select>-->
|
||||||
<!-- </el-form-item> -->
|
<!-- </el-form-item> -->
|
||||||
<el-form-item label='设备厂家' prop='manufacturer' v-if="scene != '1'">
|
<el-form-item label='设备厂家' prop='manufacturer' v-if="scene != '1'">
|
||||||
<el-select v-model="formContent.manufacturer" clearable placeholder="请选择设备厂家">
|
<el-select v-model="formContent.manufacturer" clearable placeholder="请选择设备厂家">
|
||||||
<el-option
|
<el-option
|
||||||
@@ -65,18 +65,18 @@
|
|||||||
<el-form-item label="软件版本" prop="softwareVersion" v-if="scene === '0'">
|
<el-form-item label="软件版本" prop="softwareVersion" v-if="scene === '0'">
|
||||||
<el-input v-model="formContent.softwareVersion" placeholder="请输入软件版本"/>
|
<el-input v-model="formContent.softwareVersion" placeholder="请输入软件版本"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-divider >参数信息</el-divider>
|
<el-divider>参数信息</el-divider>
|
||||||
<el-form-item label="通道数" prop="devChns" >
|
<el-form-item label="通道数" prop="devChns">
|
||||||
<el-input v-model='formContent.devChns' :disabled="true"/>
|
<el-input v-model='formContent.devChns' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="额定电压(V)" prop="devVolt" >
|
<el-form-item label="额定电压(V)" prop="devVolt">
|
||||||
<el-input v-model='formContent.devVolt' :disabled="true"/>
|
<el-input v-model='formContent.devVolt' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="额定电流(A)" prop="devCurr" >
|
<el-form-item label="额定电流(A)" prop="devCurr">
|
||||||
<el-input v-model='formContent.devCurr' :disabled="true"/>
|
<el-input v-model='formContent.devCurr' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='通讯协议' prop='protocol' >
|
<el-form-item label='通讯协议' prop='protocol'>
|
||||||
<el-select v-model="formContent.protocol" clearable placeholder="请选择通讯协议" >
|
<el-select v-model="formContent.protocol" clearable placeholder="请选择通讯协议">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Protocol')"
|
v-for="item in dictStore.getDictData('Protocol')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@@ -85,13 +85,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="IP地址" prop="ip" >
|
<!-- <el-form-item label="IP地址" prop="ip">
|
||||||
<IPAddress v-model:value="formContent.ip"/>
|
<IPAddress v-model:value="formContent.ip"/>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="IP地址" prop="ip" placeholder="请输入IP地址">
|
||||||
|
<el-input v-model="formContent.ip"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="端口号" prop="port" placeholder="请输入端口号" >
|
<el-form-item label="端口号" prop="port" placeholder="请输入端口号">
|
||||||
<el-input v-model="formContent.port" />
|
<el-input v-model="formContent.port"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='是否加密' prop='encryptionFlag' >
|
<el-form-item label='是否加密' prop='encryptionFlag'>
|
||||||
<el-select v-model="formContent.encryptionFlag" clearable placeholder="请选择是否加密">
|
<el-select v-model="formContent.encryptionFlag" clearable placeholder="请选择是否加密">
|
||||||
<el-option label="是" :value="1"></el-option>
|
<el-option label="是" :value="1"></el-option>
|
||||||
<el-option label="否" :value="0"></el-option>
|
<el-option label="否" :value="0"></el-option>
|
||||||
@@ -103,8 +106,8 @@
|
|||||||
<el-form-item label='密钥' prop='devKey' clearable v-if="formContent.encryptionFlag">
|
<el-form-item label='密钥' prop='devKey' clearable v-if="formContent.encryptionFlag">
|
||||||
<el-input v-model='formContent.devKey' placeholder="请输入密钥" show-password/>
|
<el-input v-model='formContent.devKey' placeholder="请输入密钥" show-password/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='样品编号' prop='sampleID' clearable v-if="DevIsShow && scene === '0'">
|
<el-form-item label='样品编号' prop='sampleId' clearable v-if="DevIsShow && scene === '0'">
|
||||||
<el-input v-model='formContent.sampleID' placeholder="请输入样品编号" />
|
<el-input v-model='formContent.sampleId' placeholder="请输入样品编号"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='送样日期' prop='arrivedDate' v-if="scene === '0'">
|
<el-form-item label='送样日期' prop='arrivedDate' v-if="scene === '0'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@@ -113,17 +116,27 @@
|
|||||||
:disabled-date="disabledDate"
|
:disabled-date="disabledDate"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label='委托方' prop='delegate' v-if="scene === '0'">
|
||||||
|
<el-select v-model="formContent.delegate" clearable placeholder="请选择委托方">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Delegate')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label='所属地市' prop='cityName' clearable placeholder="请输入所属地市" v-if="MonIsShow">
|
<el-form-item label='所属地市' prop='cityName' clearable placeholder="请输入所属地市" v-if="MonIsShow">
|
||||||
<el-input v-model='formContent.cityName' />
|
<el-input v-model='formContent.cityName'/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='所属供电公司' prop='gDName' clearable placeholder="请输入所属供电公司" v-if="MonIsShow">
|
<el-form-item label='所属供电公司' prop='gDName' clearable placeholder="请输入所属供电公司" v-if="MonIsShow">
|
||||||
<el-input v-model='formContent.gDName' />
|
<el-input v-model='formContent.gDName'/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='所属电站' prop='subName' clearable placeholder="请输入所属电站" v-if="MonIsShow">
|
<el-form-item label='所属电站' prop='subName' clearable placeholder="请输入所属电站" v-if="MonIsShow">
|
||||||
<el-input v-model='formContent.subName' />
|
<el-input v-model='formContent.subName'/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-auth.device="'factorFlag'" label="是否支持系数校准" prop='factorFlag'>
|
<el-form-item v-auth.device="'factorFlag'" label="是否支持系数校准" prop='factorFlag' v-if="scene === '1'">
|
||||||
<el-radio-group v-model="formContent.factorFlag" >
|
<el-radio-group v-model="formContent.factorFlag">
|
||||||
<el-radio :value="1">是</el-radio>
|
<el-radio :value="1">是</el-radio>
|
||||||
<el-radio :value="0">否</el-radio>
|
<el-radio :value="0">否</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
@@ -136,7 +149,7 @@
|
|||||||
<MonitorTable :MonIsShow="MonIsShow"/>
|
<MonitorTable :MonIsShow="MonIsShow"/>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div >
|
<div>
|
||||||
<el-button @click='close()'>取 消</el-button>
|
<el-button @click='close()'>取 消</el-button>
|
||||||
<el-button type="primary" @click='save()'>保存</el-button>
|
<el-button type="primary" @click='save()'>保存</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -147,17 +160,19 @@
|
|||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
|
|
||||||
import IPAddress from '@/components/IpAddress/index.vue'
|
import IPAddress from '@/components/IpAddress/index.vue'
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
import {dialogBig} from '@/utils/elementBind'
|
||||||
import { type Device } from '@/api/device/interface/device'
|
import {type Device} from '@/api/device/interface/device'
|
||||||
import { ElMessage, type FormItemRule } from 'element-plus'
|
import {ElMessage, type FormItemRule} from 'element-plus'
|
||||||
import { addPqDev, updatePqDev } from '@/api/device/device'
|
import {addPqDev, updatePqDev} from '@/api/device/device'
|
||||||
import { computed, reactive, type Ref, ref } from 'vue'
|
import {computed, reactive, type Ref, ref} from 'vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
import { CirclePlus, Delete, EditPen } from '@element-plus/icons-vue'
|
import {CirclePlus, Delete, EditPen} from '@element-plus/icons-vue'
|
||||||
// 使用 dayjs 库格式化
|
// 使用 dayjs 库格式化
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import MonitorTable from '@/views/machine/device/components/monitorTab.vue';
|
import MonitorTable from '@/views/machine/device/components/monitorTab.vue';
|
||||||
|
import {useAppSceneStore} from "@/stores/modules/mode";
|
||||||
|
|
||||||
|
const AppSceneStore = useAppSceneStore()
|
||||||
const MonIsShow = ref(false)
|
const MonIsShow = ref(false)
|
||||||
const DevIsShow = ref(false)
|
const DevIsShow = ref(false)
|
||||||
// 存储设备类型选项
|
// 存储设备类型选项
|
||||||
@@ -172,147 +187,148 @@ const disabledDate = (time: Date) => {
|
|||||||
return time.getTime() > Date.now()
|
return time.getTime() > Date.now()
|
||||||
}
|
}
|
||||||
|
|
||||||
function useMetaInfo() {
|
function useMetaInfo() {
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const titleType = ref('add')
|
const titleType = ref('add')
|
||||||
const formContent = ref<Device.ResPqDev>({
|
const formContent = ref<Device.ResPqDev>({
|
||||||
id: '',
|
id: '',
|
||||||
name: '',
|
name: '',
|
||||||
pattern:mode.value,
|
pattern: mode.value,
|
||||||
devType:'',
|
devType: '',
|
||||||
devChns:1,
|
devChns: 1,
|
||||||
devVolt:57.74,
|
devVolt: 57.74,
|
||||||
devCurr:5,
|
devCurr: 5,
|
||||||
manufacturer:'',
|
|
||||||
createDate: dayjs().format('YYYY-MM-DD'),
|
|
||||||
createId: '',
|
|
||||||
hardwareVersion: '',
|
|
||||||
softwareVersion: '',
|
|
||||||
protocol: 'MMS',
|
|
||||||
ip: '172.17.102.200',
|
|
||||||
port: 102,
|
|
||||||
encryptionFlag: 0,
|
|
||||||
reCheckNum:0,
|
|
||||||
state: 1,
|
|
||||||
factorFlag:0,
|
|
||||||
icdId:'',
|
|
||||||
power:'',
|
|
||||||
preinvestmentPlan:''
|
|
||||||
})
|
|
||||||
return { dialogVisible, titleType, formContent }
|
|
||||||
}
|
|
||||||
|
|
||||||
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
|
||||||
// 清空formContent
|
|
||||||
const resetFormContent = () => {
|
|
||||||
formContent.value = {
|
|
||||||
id: '',
|
|
||||||
name: '',
|
|
||||||
pattern:mode.value,
|
|
||||||
devType:'',
|
|
||||||
devChns:1,
|
|
||||||
devVolt:57.74,
|
|
||||||
devCurr:5,
|
|
||||||
manufacturer: '',
|
manufacturer: '',
|
||||||
createDate: dayjs().format('YYYY-MM-DD'),
|
createDate: dayjs().format('YYYY-MM-DD'),
|
||||||
createId: '',
|
createId: '',
|
||||||
hardwareVersion: '',
|
hardwareVersion: '',
|
||||||
softwareVersion: '',
|
softwareVersion: '',
|
||||||
protocol: 'MMS',
|
protocol: 'MMS',
|
||||||
ip: '172.17.102.200',
|
ip: '',
|
||||||
port: 102,
|
port: 102,
|
||||||
encryptionFlag: 0,
|
encryptionFlag: 0,
|
||||||
reCheckNum:0,
|
reCheckNum: 0,
|
||||||
state: 1,
|
state: 1,
|
||||||
factorFlag:0,
|
factorFlag: 1,
|
||||||
icdId:'',
|
icdId: '',
|
||||||
power:'',
|
power: '',
|
||||||
preinvestmentPlan:''
|
preinvestmentPlan: '',
|
||||||
}
|
delegate:''
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let dialogTitle = computed(() => {
|
|
||||||
return titleType.value === 'add' ? '新增被检设备' : '编辑被检设备'
|
|
||||||
})
|
})
|
||||||
|
return {dialogVisible, titleType, formContent}
|
||||||
|
}
|
||||||
|
|
||||||
|
const {dialogVisible, titleType, formContent} = useMetaInfo()
|
||||||
|
// 清空formContent
|
||||||
|
const resetFormContent = () => {
|
||||||
|
formContent.value = {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
pattern: mode.value,
|
||||||
|
devType: '',
|
||||||
|
devChns: 1,
|
||||||
|
devVolt: 57.74,
|
||||||
|
devCurr: 5,
|
||||||
|
manufacturer: '',
|
||||||
|
createDate: dayjs().format('YYYY-MM-DD'),
|
||||||
|
createId: '',
|
||||||
|
hardwareVersion: '',
|
||||||
|
softwareVersion: '',
|
||||||
|
protocol: 'MMS',
|
||||||
|
ip: '',
|
||||||
|
port: 102,
|
||||||
|
encryptionFlag: 0,
|
||||||
|
reCheckNum: 0,
|
||||||
|
state: 1,
|
||||||
|
factorFlag: 1,
|
||||||
|
icdId: '',
|
||||||
|
power: '',
|
||||||
|
preinvestmentPlan: '',
|
||||||
|
delegate:''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let dialogTitle = computed(() => {
|
||||||
|
return titleType.value === 'add' ? '新增被检设备' : '编辑被检设备'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
// 定义表单校验规则
|
// 定义表单校验规则
|
||||||
const baseRules: Record<string, Array<FormItemRule>> = {
|
const baseRules: Record<string, Array<FormItemRule>> = {
|
||||||
devType: [{ required: true, message: '设备类型必选!', trigger: 'change' }],
|
devType: [{required: true, message: '设备类型必选!', trigger: 'change'}],
|
||||||
pattern: [{ required: true, message: '设备模式必填!', trigger: 'blur' }],
|
pattern: [{required: true, message: '设备模式必填!', trigger: 'blur'}],
|
||||||
devChns: [
|
devChns: [
|
||||||
{ required: true, message: '设备通道数必填!', trigger: 'blur' },
|
{required: true, message: '设备通道数必填!', trigger: 'blur'},
|
||||||
{ pattern: /^[1-9]\d*$/, message: '设备通道数为大于1的整数', trigger: 'blur' }
|
{pattern: /^[1-9]\d*$/, message: '设备通道数为大于1的整数', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
devVolt: [
|
devVolt: [
|
||||||
{ required: true, message: '额定电压必填!', trigger: 'blur' },
|
{required: true, message: '额定电压必填!', trigger: 'blur'},
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: '额定电压格式错误', trigger: 'blur' }
|
{pattern: /^\d+(\.\d+)?$/, message: '额定电压格式错误', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
devCurr: [
|
devCurr: [
|
||||||
{ required: true, message: '额定电流必填!', trigger: 'blur' },
|
{required: true, message: '额定电流必填!', trigger: 'blur'},
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: '额定电流格式错误', trigger: 'blur' }
|
{pattern: /^\d+(\.\d+)?$/, message: '额定电流格式错误', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
createId: [{ required: true, message: '装置编号必填!', trigger: 'blur' }
|
createId: [{required: true, message: '装置编号必填!', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
ip: [
|
ip: [
|
||||||
{ required: true, message: 'IP地址必填!', trigger: 'blur' },
|
{required: true, message: 'IP地址必填!', trigger: 'blur'},
|
||||||
{ pattern: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, message: 'IP地址格式错误', trigger: 'blur' }
|
{pattern: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, message: 'IP地址格式错误', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
port: [
|
port: [
|
||||||
{ required: true, message: '端口号必填!', trigger: 'blur' },
|
{required: true, message: '端口号必填!', trigger: 'blur'},
|
||||||
{ pattern: /^(6553[0-5]|655[0-2][0-9]|64[0-9]{3}|[1-5]?[0-9]{1,4})$/, message: '端口号范围0到65535的整数', trigger: 'blur' }
|
{pattern: /^(6553[0-5]|655[0-2][0-9]|64[0-9]{3}|[1-5]?[0-9]{1,4})$/, message: '端口号范围0到65535的整数', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
encryptionFlag: [{ required: true, message: '是否加密必选!', trigger: 'change' }],
|
encryptionFlag: [{required: true, message: '是否加密必选!', trigger: 'change'}],
|
||||||
protocol: [{ required: true, message: '通讯协议必选!', trigger: 'change' }],
|
protocol: [{required: true, message: '通讯协议必选!', trigger: 'change'}],
|
||||||
series: [{ required: true, message: '请输入识别码', trigger: 'blur' }],
|
series: [{required: true, message: '请输入识别码', trigger: 'blur'}],
|
||||||
devKey: [{ required: true, message: '请输入密钥', trigger: 'blur' }]
|
devKey: [{required: true, message: '请输入密钥', trigger: 'blur'}]
|
||||||
};
|
};
|
||||||
|
|
||||||
// 使用计算属性根据 scene 动态生成规则
|
// 使用计算属性根据 scene 动态生成规则
|
||||||
const rules = computed(() => {
|
const rules = computed(() => {
|
||||||
const dynamicRules = { ...baseRules };
|
const dynamicRules = {...baseRules};
|
||||||
|
|
||||||
if (scene.value === '0'){//只有电科院需要展示
|
if (scene.value === '0') {//只有电科院需要展示
|
||||||
dynamicRules.createDate= [{ required: true, message: '出厂日期必填!', trigger: 'blur' }];
|
dynamicRules.createDate = [{required: true, message: '出厂日期必填!', trigger: 'blur'}];
|
||||||
}
|
}
|
||||||
if (scene.value === '1'){//只有楼下出厂需要展示
|
if (scene.value === '1') {//只有楼下出厂需要展示
|
||||||
dynamicRules.preinvestmentPlan= [{ required: true, message: '预投计划必选!', trigger: 'change' }];
|
dynamicRules.preinvestmentPlan = [{required: true, message: '预投计划必选!', trigger: 'change'}];
|
||||||
dynamicRules.createId= [{ required: true, message: '装置编号必填!', trigger: 'blur' },
|
dynamicRules.createId = [{required: true, message: '装置编号必填!', trigger: 'blur'},
|
||||||
{ pattern: /^\d+$/, message: '装置编号为数字', trigger: 'blur' }
|
{pattern: /^\d+$/, message: '装置编号为数字', trigger: 'blur'}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (scene.value !== '0') {
|
if (scene.value !== '0') {
|
||||||
dynamicRules.name = [{ required: true, message: '设备名称必填!', trigger: 'blur' }];
|
dynamicRules.name = [{required: true, message: '设备名称必填!', trigger: 'blur'}];
|
||||||
dynamicRules.hardwareVersion = [{ required: true, message: '固件版本必填!', trigger: 'blur' }];
|
dynamicRules.hardwareVersion = [{required: true, message: '固件版本必填!', trigger: 'blur'}];
|
||||||
dynamicRules.softwareVersion = [{ required: true, message: '软件版本必填!', trigger: 'blur' }];
|
dynamicRules.softwareVersion = [{required: true, message: '软件版本必填!', trigger: 'blur'}];
|
||||||
dynamicRules.manufacturer = [{ required: true, message: '生产厂家必选!', trigger: 'change' }];
|
dynamicRules.manufacturer = [{required: true, message: '生产厂家必选!', trigger: 'change'}];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scene.value !== '2') {
|
if (scene.value !== '2') {
|
||||||
dynamicRules.name = [{ required: true, message: '设备名称必填!', trigger: 'blur' }];
|
dynamicRules.name = [{required: true, message: '设备名称必填!', trigger: 'blur'}];
|
||||||
dynamicRules.manufacturer = [{ required: true, message: '生产厂家必选!', trigger: 'change' }];
|
dynamicRules.manufacturer = [{required: true, message: '生产厂家必选!', trigger: 'change'}];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return dynamicRules;
|
return dynamicRules;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
// 清空dialogForm中的值
|
// 清空dialogForm中的值
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
// 重置表单
|
// 重置表单
|
||||||
dialogFormRef.value?.resetFields()
|
dialogFormRef.value?.resetFields()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
const save = () => {
|
const save = () => {
|
||||||
try {
|
try {
|
||||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
|
||||||
@@ -322,21 +338,23 @@ const rules = computed(() => {
|
|||||||
}
|
}
|
||||||
if (valid) {
|
if (valid) {
|
||||||
formContent.value.createDate = dayjs(formContent.value.createDate).format('YYYY-MM-DD');
|
formContent.value.createDate = dayjs(formContent.value.createDate).format('YYYY-MM-DD');
|
||||||
|
if (AppSceneStore.currentScene === '1') {
|
||||||
formContent.value.name = formContent.value.createId
|
formContent.value.name = formContent.value.createId
|
||||||
if (formContent.value.arrivedDate)
|
}
|
||||||
{
|
|
||||||
|
if (formContent.value.arrivedDate) {
|
||||||
formContent.value.arrivedDate = dayjs(formContent.value.arrivedDate).format('YYYY-MM-DD');
|
formContent.value.arrivedDate = dayjs(formContent.value.arrivedDate).format('YYYY-MM-DD');
|
||||||
}
|
}
|
||||||
|
|
||||||
//保存时判是否加密,把识别码密钥字段清空
|
//保存时判是否加密,把识别码密钥字段清空
|
||||||
if(formContent.value.encryptionFlag === 0){
|
if (formContent.value.encryptionFlag === 0) {
|
||||||
formContent.value.series = null
|
formContent.value.series = null
|
||||||
formContent.value.devKey = null
|
formContent.value.devKey = null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formContent.value.id) {
|
if (formContent.value.id) {
|
||||||
await updatePqDev(formContent.value);
|
await updatePqDev(formContent.value);
|
||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
ElMessage.success({message: `${dialogTitle.value}成功!`})
|
||||||
} else {
|
} else {
|
||||||
// 新增需要把设备模式转成字典ID
|
// 新增需要把设备模式转成字典ID
|
||||||
const patternItem = dictStore.getDictData('Pattern').find(item => item.name === formContent.value.pattern);
|
const patternItem = dictStore.getDictData('Pattern').find(item => item.name === formContent.value.pattern);
|
||||||
@@ -349,7 +367,7 @@ const rules = computed(() => {
|
|||||||
formContent.value.protocol = protocolItem.id;
|
formContent.value.protocol = protocolItem.id;
|
||||||
}
|
}
|
||||||
await addPqDev(formContent.value);
|
await addPqDev(formContent.value);
|
||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
ElMessage.success({message: `${dialogTitle.value}成功!`})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,17 +384,17 @@ const rules = computed(() => {
|
|||||||
|
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = async (sign: string, data: Device.ResPqDev,currentMode: string,currentScene: string,devType:Device.ResDev[] ) => {
|
const open = async (sign: string, data: Device.ResPqDev, currentMode: string, currentScene: string, devType: Device.ResDev[]) => {
|
||||||
devTypeOptions.value = devType
|
devTypeOptions.value = devType
|
||||||
mode.value = currentMode
|
mode.value = currentMode
|
||||||
scene.value = currentScene
|
scene.value = currentScene
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
|
||||||
if( currentMode ==='比对式'){
|
if (currentMode === '比对式') {
|
||||||
DevIsShow.value = false
|
DevIsShow.value = false
|
||||||
MonIsShow.value = true
|
MonIsShow.value = true
|
||||||
}else{
|
} else {
|
||||||
DevIsShow.value = true
|
DevIsShow.value = true
|
||||||
MonIsShow.value = false
|
MonIsShow.value = false
|
||||||
}
|
}
|
||||||
@@ -387,13 +405,13 @@ const open = async (sign: string, data: Device.ResPqDev,currentMode: string,curr
|
|||||||
//handleEncryptionChange(0)
|
//handleEncryptionChange(0)
|
||||||
}
|
}
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
formContent.value = { ...data }
|
formContent.value = {...data}
|
||||||
} else {
|
} else {
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
if(scene.value === '2'){
|
if (scene.value === '2') {
|
||||||
const manufacturers = dictStore.getDictData('Dev_Manufacturers');
|
const manufacturers = dictStore.getDictData('Dev_Manufacturers');
|
||||||
const nanjingCanxuan = manufacturers.find(item => item.name === '南京灿能');
|
const nanjingCanxuan = manufacturers.find(item => item.name === '南京灿能');
|
||||||
if(nanjingCanxuan){
|
if (nanjingCanxuan) {
|
||||||
formContent.value.manufacturer = nanjingCanxuan.id;
|
formContent.value.manufacturer = nanjingCanxuan.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -421,17 +439,27 @@ const open = async (sign: string, data: Device.ResPqDev,currentMode: string,curr
|
|||||||
|
|
||||||
const handleDevTypeChange = (value: string) => {
|
const handleDevTypeChange = (value: string) => {
|
||||||
// 在这里处理选中事件的逻辑
|
// 在这里处理选中事件的逻辑
|
||||||
const dev = devTypeOptions.value.find(t =>t.id === value)
|
const dev = devTypeOptions.value.find(t => t.id === value)
|
||||||
if (dev) {
|
if (dev) {
|
||||||
formContent.value.devChns = dev.devChns; // 默认值为1
|
formContent.value.devChns = dev.devChns; // 默认值为1
|
||||||
formContent.value.devCurr = dev.devCurr; // 默认值为1
|
formContent.value.devCurr = dev.devCurr; // 默认值为1
|
||||||
formContent.value.devVolt = dev.devVolt; // 默认值为1
|
formContent.value.devVolt = dev.devVolt; // 默认值为1
|
||||||
formContent.value.icdId = dev.icd
|
formContent.value.icdId = dev.icd
|
||||||
formContent.value.power = dev.power
|
formContent.value.power = dev.power
|
||||||
|
// if (dev.name.includes('882B')) {
|
||||||
|
// formContent.value.ip = '172.17.102.220'
|
||||||
|
// } else if (dev.name.includes('882A')) {
|
||||||
|
// formContent.value.ip = '172.17.102.221'
|
||||||
|
// } else {
|
||||||
|
// formContent.value.ip = '172.17.102.200'
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
formContent.value.devChns = 1; // 默认值为1
|
formContent.value.devChns = 1; // 默认值为1
|
||||||
formContent.value.devCurr = 1; // 默认值为1
|
formContent.value.devCurr = 1; // 默认值为1
|
||||||
formContent.value.devVolt = 57.74; // 默认值为1
|
formContent.value.devVolt = 57.74; // 默认值为1
|
||||||
|
//formContent.value.ip = '172.17.102.200'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -439,22 +467,18 @@ const handleDevTypeChange = (value: string) => {
|
|||||||
|
|
||||||
const handleInput = (value: string) => {
|
const handleInput = (value: string) => {
|
||||||
// 在这里处理选中事件的逻辑
|
// 在这里处理选中事件的逻辑
|
||||||
if(scene.value === '1'){
|
if (scene.value === '1') {
|
||||||
formContent.value.name = value
|
formContent.value.name = value
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({open})
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
refreshTable: (() => Promise<void>) | undefined;
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -32,32 +32,25 @@
|
|||||||
|
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
<DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup' />
|
<DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup'/>
|
||||||
<ImportExcel ref='deviceImportExcel' />
|
<ImportExcel ref='deviceImportExcel'/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='useRole'>
|
<script setup lang='tsx' name='useRole'>
|
||||||
import TimeControl from '@/components/TimeControl/index.vue'
|
import TimeControl from '@/components/TimeControl/index.vue'
|
||||||
import { type Device } from '@/api/device/interface/device.ts'
|
import {type Device} from '@/api/device/interface/device.ts'
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import {useHandleData} from '@/hooks/useHandleData'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
import {useDownload} from '@/hooks/useDownload'
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import ImportExcel from '@/components/ImportExcel/index.vue'
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
import {type ColumnProps, type ProTableInstance} from '@/components/ProTable/interface'
|
||||||
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
||||||
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
import {CirclePlus, Delete, Download, EditPen, Upload} from '@element-plus/icons-vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
import {
|
import {deletePqDev, downloadTemplate, exportPqDev, getPqDev, getPqDevList, importPqDev} from '@/api/device/device/index.ts'
|
||||||
getPqDevList,
|
import {ElMessageBox} from 'element-plus'
|
||||||
deletePqDev,
|
import {onBeforeMount, reactive, ref} from 'vue'
|
||||||
getPqDev,
|
import {useAppSceneStore, useModeStore} from '@/stores/modules/mode'
|
||||||
exportCNDev,
|
|
||||||
downloadCNDevTemplate,
|
|
||||||
importCNDev,
|
|
||||||
} from '@/api/device/device/index.ts'
|
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
||||||
import { onBeforeMount, reactive, ref } from 'vue'
|
|
||||||
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
|
|
||||||
|
|
||||||
// defineOptions({
|
// defineOptions({
|
||||||
// name: 'device',
|
// name: 'device',
|
||||||
@@ -72,6 +65,7 @@ const boundPqDevList = ref<Device.ReqPqDevParams[]>([])//根据检测计划id查
|
|||||||
// 存储设备类型选项
|
// 存储设备类型选项
|
||||||
const devTypeOptions = ref<Device.ResDev[]>([])
|
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||||
|
|
||||||
|
|
||||||
const getTableList = async (params: any) => {
|
const getTableList = async (params: any) => {
|
||||||
let newParams = JSON.parse(JSON.stringify(params))
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
newParams.searchEndTime = endDate.value
|
newParams.searchEndTime = endDate.value
|
||||||
@@ -84,12 +78,12 @@ const getTableList = async (params: any) => {
|
|||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{type: 'selection', fixed: 'left', width: 70},
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
search: { el: 'input' },
|
search: {el: 'input'},
|
||||||
// isShow: appSceneStore.currentScene != '1',
|
// isShow: appSceneStore.currentScene != '1',
|
||||||
// ...(appSceneStore.currentScene != '1' ? {
|
// ...(appSceneStore.currentScene != '1' ? {
|
||||||
// search: { el: 'input' },
|
// search: { el: 'input' },
|
||||||
@@ -163,8 +157,8 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
enum: dictStore.getDictData('Dev_Manufacturers'),
|
enum: dictStore.getDictData('Dev_Manufacturers'),
|
||||||
isShow: appSceneStore.currentScene != '1',
|
isShow: appSceneStore.currentScene != '1',
|
||||||
...(appSceneStore.currentScene != '1' ? {
|
...(appSceneStore.currentScene != '1' ? {
|
||||||
search: { el: 'select', props: { filterable: true }, order: 1 },
|
search: {el: 'select', props: {filterable: true}, order: 1},
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
fieldNames: {label: 'name', value: 'id'},
|
||||||
} : {}),
|
} : {}),
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
},
|
},
|
||||||
@@ -186,7 +180,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
{prop: 'operation', label: '操作', fixed: 'right', width: 200},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +200,7 @@ const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
|||||||
// 批量删除设备
|
// 批量删除设备
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
||||||
await useHandleData(deletePqDev, { 'ids': id, 'pattern': patternId }, '删除所选设备')
|
await useHandleData(deletePqDev, {'ids': id, 'pattern': patternId}, '删除所选设备')
|
||||||
|
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
@@ -215,7 +209,7 @@ const batchDelete = async (id: string[]) => {
|
|||||||
// 删除设备
|
// 删除设备
|
||||||
const handleDelete = async (params: Device.ResPqDev) => {
|
const handleDelete = async (params: Device.ResPqDev) => {
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||||
await useHandleData(deletePqDev, { 'ids': [params.id], 'pattern': patternId }, `删除【${params.name}】设备`)
|
await useHandleData(deletePqDev, {'ids': [params.id], 'pattern': patternId}, `删除【${params.name}】设备`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -229,9 +223,9 @@ const downloadFile = async () => {
|
|||||||
searchParam.searchBeginTime = startDate.value
|
searchParam.searchBeginTime = startDate.value
|
||||||
searchParam.searchEndTime = endDate.value
|
searchParam.searchEndTime = endDate.value
|
||||||
|
|
||||||
ElMessageBox.confirm('确认导出被检设备?', '温馨提示', { type: 'warning' }).then(() => {
|
ElMessageBox.confirm('确认导出被检设备?', '温馨提示', {type: 'warning'}).then(() => {
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||||
useDownload(exportCNDev, '被检设备导出数据', { ...proTable.value?.searchParam, pattern: patternId }, false, '.xlsx')
|
useDownload(exportPqDev, '被检设备导出数据', {...proTable.value?.searchParam, pattern: patternId}, false, '.xlsx')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,8 +248,8 @@ const importFile = async (pattern: string) => {
|
|||||||
title: '被检设备',
|
title: '被检设备',
|
||||||
showCover: false,
|
showCover: false,
|
||||||
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id,
|
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id,
|
||||||
tempApi: downloadCNDevTemplate,
|
tempApi: downloadTemplate,
|
||||||
importApi: importCNDev,
|
importApi: importPqDev,
|
||||||
// importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev,
|
// importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev,
|
||||||
getTableList: proTable.value?.getTableList,
|
getTableList: proTable.value?.getTableList,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,12 +13,12 @@
|
|||||||
>
|
>
|
||||||
<el-table-column label="被测量">
|
<el-table-column label="被测量">
|
||||||
<el-table-column prop="col1" width="150"/>
|
<el-table-column prop="col1" width="150"/>
|
||||||
<el-table-column prop="col2" width="120" />
|
<el-table-column prop="col2" width="120"/>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="deviceLevel" label="检测装置级别" width="120"/>
|
<el-table-column prop="deviceLevel" label="检测装置级别" width="120"/>
|
||||||
<el-table-column prop="measurementType" label="测量类型" />
|
<el-table-column prop="measurementType" label="测量类型"/>
|
||||||
<el-table-column prop="condition" label="测量条件" />
|
<el-table-column prop="condition" label="测量条件"/>
|
||||||
<el-table-column prop="maxErrorValue" label="最大误差" />
|
<el-table-column prop="maxErrorValue" label="最大误差"/>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -30,34 +30,33 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="IndicatorTypeDialog">
|
<script lang="ts" setup name="IndicatorTypeDialog">
|
||||||
import { defineProps, defineEmits, reactive,watch,ref,computed, type CSSProperties } from 'vue';
|
import {computed, type CSSProperties, defineProps, ref} from 'vue';
|
||||||
import { dialogBig} from '@/utils/elementBind'
|
import {dialogBig} from '@/utils/elementBind'
|
||||||
import type { ColumnProps } from '@/components/ProTable/interface'
|
import type {ErrorSystem} from '@/api/device/interface/error'
|
||||||
import type { ErrorSystem } from '@/api/device/interface/error'
|
import errorDataList from '@/api/device/error/errorData'
|
||||||
import errorDataList from '@/api/device/error/errorData'
|
import type {TableColumnCtx} from 'element-plus'
|
||||||
import type { TableColumnCtx } from 'element-plus'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const errorData = ref<ErrorSystem.Error_detail[]>([]);
|
const errorData = ref<ErrorSystem.Error_detail[]>([]);
|
||||||
const dialogTitle = ref()
|
const dialogTitle = ref()
|
||||||
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref
|
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref
|
||||||
function useMetaInfo() {
|
function useMetaInfo() {
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const formContent = ref<ErrorSystem.ErrorSystemList>({
|
const formContent = ref<ErrorSystem.ErrorSystemList>({
|
||||||
id: '',
|
id: '',
|
||||||
name: '',
|
name: '',
|
||||||
standardName:'',
|
standardName: '',
|
||||||
standardTime:'',
|
standardTime: '',
|
||||||
devLevel:'',
|
devLevel: '',
|
||||||
enable:1,
|
enable: 1,
|
||||||
state:1,
|
state: 1,
|
||||||
})
|
})
|
||||||
return { dialogVisible, formContent }
|
return {dialogVisible, formContent}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { dialogVisible, formContent } = useMetaInfo()
|
const {dialogVisible, formContent} = useMetaInfo()
|
||||||
|
|
||||||
interface SpanMethodProps {
|
interface SpanMethodProps {
|
||||||
row: ErrorSystem.ErrorSystemDetail
|
row: ErrorSystem.ErrorSystemDetail
|
||||||
@@ -66,14 +65,14 @@ interface SpanMethodProps {
|
|||||||
columnIndex: number
|
columnIndex: number
|
||||||
}
|
}
|
||||||
|
|
||||||
const rowClass = ({ row, column, rowIndex, columnIndex }: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
|
const rowClass = ({row, column, rowIndex, columnIndex}: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
|
||||||
let res: CSSProperties = {
|
let res: CSSProperties = {
|
||||||
textAlign: 'center' as CSSProperties['textAlign'],
|
textAlign: 'center' as CSSProperties['textAlign'],
|
||||||
backgroundColor: '#003078',
|
backgroundColor: 'var(--el-color-primary)',
|
||||||
color: '#fff'
|
color: '#fff'
|
||||||
}
|
}
|
||||||
if (rowIndex === 1) {
|
if (rowIndex === 1) {
|
||||||
res = { ...res, display: 'none' }
|
res = {...res, display: 'none'}
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
@@ -88,7 +87,7 @@ const spanAMethod = ({
|
|||||||
column,
|
column,
|
||||||
rowIndex,
|
rowIndex,
|
||||||
columnIndex,
|
columnIndex,
|
||||||
}: SpanMethodProps) => {
|
}: SpanMethodProps) => {
|
||||||
if (columnIndex === 0) {
|
if (columnIndex === 0) {
|
||||||
if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
||||||
return {
|
return {
|
||||||
@@ -170,7 +169,7 @@ const spanSMethod = ({
|
|||||||
column,
|
column,
|
||||||
rowIndex,
|
rowIndex,
|
||||||
columnIndex,
|
columnIndex,
|
||||||
}: SpanMethodProps) => {
|
}: SpanMethodProps) => {
|
||||||
if (columnIndex === 0) {
|
if (columnIndex === 0) {
|
||||||
if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
||||||
return {
|
return {
|
||||||
@@ -205,7 +204,7 @@ const spanSMethod = ({
|
|||||||
colspan: 2,
|
colspan: 2,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rowIndex === 18 ) {//电流跨两行两列
|
if (rowIndex === 18) {//电流跨两行两列
|
||||||
return {
|
return {
|
||||||
rowspan: 2,
|
rowspan: 2,
|
||||||
colspan: 2,
|
colspan: 2,
|
||||||
@@ -245,18 +244,18 @@ const spanSMethod = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(columnIndex === 3){
|
if (columnIndex === 3) {
|
||||||
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
|
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
|
||||||
rowIndex === 11 || rowIndex === 13 ||rowIndex === 15 ||
|
rowIndex === 11 || rowIndex === 13 || rowIndex === 15 ||
|
||||||
rowIndex === 18 || rowIndex === 21){
|
rowIndex === 18 || rowIndex === 21) {
|
||||||
return {
|
return {
|
||||||
rowspan: 2,
|
rowspan: 2,
|
||||||
colspan: 1,
|
colspan: 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 ||
|
if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 ||
|
||||||
rowIndex === 12 || rowIndex === 14 ||rowIndex === 16 ||
|
rowIndex === 12 || rowIndex === 14 || rowIndex === 16 ||
|
||||||
rowIndex === 19 || rowIndex === 22){
|
rowIndex === 19 || rowIndex === 22) {
|
||||||
return {
|
return {
|
||||||
rowspan: 0,
|
rowspan: 0,
|
||||||
colspan: 0,
|
colspan: 0,
|
||||||
@@ -270,31 +269,31 @@ const close = () => {
|
|||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
||||||
dialogTitle.value = sign + ' 误差体系'
|
dialogTitle.value = sign + ' 误差体系'
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
formContent.value = data as ErrorSystem.ErrorSystemList;
|
formContent.value = data as ErrorSystem.ErrorSystemList;
|
||||||
|
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';
|
||||||
|
|
||||||
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';;
|
if (devLevelName.value === 'A级' || data.devLevel === 'A级') {
|
||||||
|
|
||||||
if(devLevelName.value === 'A级'){
|
|
||||||
errorData.value = errorDataList.errorADetail as unknown as ErrorSystem.Error_detail[];
|
errorData.value = errorDataList.errorADetail as unknown as ErrorSystem.Error_detail[];
|
||||||
}else{
|
} else {
|
||||||
errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];
|
errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({open})
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
refreshTable: (() => Promise<void>) | undefined;
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
}>()
|
}>()
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.table-container {
|
.table-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -316,4 +315,4 @@ const props = defineProps<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<el-table :data="tableData"
|
<el-table :data="tableData"
|
||||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
:header-cell-style="{ textAlign: 'center',backgroundColor: 'var(--el-color-primary)',color: '#fff' } "
|
||||||
:cell-style="{ textAlign: 'center' }"
|
:cell-style="{ textAlign: 'center' }"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}"
|
:style="{ height: '400px',maxHeight: '400px',overflow:'hidden'}"
|
||||||
@selection-change="handleSelectionChange">
|
@selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55"/>
|
||||||
<el-table-column prop="sort" label="序号" width="60" />
|
<el-table-column prop="sort" label="序号" width="60"/>
|
||||||
<el-table-column prop="type" label="误差类型" min-width="180">
|
<el-table-column prop="type" label="误差类型" min-width="180">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-cascader style="min-width: 180px;"
|
<el-cascader style="min-width: 180px;"
|
||||||
@@ -29,10 +29,10 @@
|
|||||||
v-model="row.scriptType"
|
v-model="row.scriptType"
|
||||||
:props="{ checkStrictly: false, emitPath: false }"
|
:props="{ checkStrictly: false, emitPath: false }"
|
||||||
placeholder="请选择脚本类型"
|
placeholder="请选择脚本类型"
|
||||||
/>
|
@change="handleScriptTypeChange(row)"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="起止范围" >
|
<el-table-column label="起止范围">
|
||||||
<el-table-column label="起始" width="150">
|
<el-table-column label="起始" width="150">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-row type="flex" :gutter="24">
|
<el-row type="flex" :gutter="24">
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-input v-model= "row.startValue" style="width: 60px;" :disabled="isStartValueDisabled[row.sort]"
|
<el-input v-model="row.startValue" style="width: 60px;" :disabled="isStartValueDisabled[row.sort]"
|
||||||
/>
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="结束" width="150">
|
<el-table-column label="结束" width="150">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-row type="flex" :gutter="24" >
|
<el-row type="flex" :gutter="24">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-select v-model="row.endFlag" placeholder="选择结束值" style="width: 70px;" @change="(value) => handleEndFlagChange(row, value)">
|
<el-select v-model="row.endFlag" placeholder="选择结束值" style="width: 70px;" @change="(value) => handleEndFlagChange(row, value)">
|
||||||
<el-option label="无" :value="2"></el-option>
|
<el-option label="无" :value="2"></el-option>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-input v-model= "row.endValue" style="width: 60px;" :disabled="isEndValueDisabled[row.sort]"/>
|
<el-input v-model="row.endValue" style="width: 60px;" :disabled="isEndValueDisabled[row.sort]"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-select v-model="row.conditionType" placeholder="选择单位">
|
<el-select v-model="row.conditionType" placeholder="选择单位">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Condition_Type')"
|
v-for="item in conditionTypes"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="Number(item.value)"
|
:value="Number(item.value)"
|
||||||
@@ -82,19 +82,19 @@
|
|||||||
<el-table-column label="最大误差">
|
<el-table-column label="最大误差">
|
||||||
<el-table-column prop="maxErrorValue" label="最大误差值" width="100">
|
<el-table-column prop="maxErrorValue" label="最大误差值" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-input v-model= "row.maxErrorValue" style="width: 70px;"/>
|
<el-input v-model="row.maxErrorValue" style="width: 70px;"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="误差类型" width="180">
|
<el-table-column label="误差类型" width="170">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-select v-model="row.errorValueType" placeholder="选择误差类型">
|
<el-cascader :options="errorValueTypeOptions"
|
||||||
<el-option
|
v-model="row.errorValueType"
|
||||||
v-for="item in dictStore.getDictData('Error_Value_Type')"
|
@change="handleErrorValueTypeChange(row)"/>
|
||||||
:key="item.id"
|
</template>
|
||||||
:label="item.name"
|
</el-table-column>
|
||||||
:value="Number(item.value)"
|
<el-table-column label="误差单位" width="100" prop="errorUnit">
|
||||||
/>
|
<template #default="{ row }">
|
||||||
</el-select>
|
<span>{{ row.errorUnit }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -109,19 +109,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type ErrorSystem } from '@/api/device/interface/error';
|
import {type ErrorSystem} from '@/api/device/interface/error';
|
||||||
import { useDictStore, } from '@/stores/modules/dict'
|
import {useDictStore,} from '@/stores/modules/dict'
|
||||||
import {CirclePlus, Delete, EditPen,CopyDocument} from '@element-plus/icons-vue'
|
import {CirclePlus, CopyDocument, Delete} from '@element-plus/icons-vue'
|
||||||
import { type CascaderOption, type FormItemRule } from 'element-plus';
|
import {type CascaderOption} from 'element-plus';
|
||||||
import { el } from 'element-plus/es/locale';
|
import {defineEmits, type PropType, reactive, ref, watch} from 'vue';
|
||||||
import { type PropType, type Ref, ref, watch } from 'vue';
|
|
||||||
import { defineEmits } from 'vue';
|
const emit = defineEmits(['updateTableData']);
|
||||||
const emit = defineEmits(['updateTableData']);
|
const multipleSelection = ref<number[]>([])
|
||||||
const multipleSelection = ref<number[]>([])
|
const dictStore = useDictStore()
|
||||||
const dictStore = useDictStore()
|
const isStartValueDisabled = ref<{ [key: number]: boolean }>({});
|
||||||
const isStartValueDisabled = ref<{ [key: number]: boolean }>({});
|
const isEndValueDisabled = ref<{ [key: number]: boolean }>({});
|
||||||
const isEndValueDisabled = ref<{ [key: number]: boolean }>({});
|
const props = defineProps({
|
||||||
const props = defineProps({
|
|
||||||
errorOptions: {
|
errorOptions: {
|
||||||
type: Array as PropType<CascaderOption[]>,
|
type: Array as PropType<CascaderOption[]>,
|
||||||
required: true
|
required: true
|
||||||
@@ -138,32 +137,25 @@ import { el } from 'element-plus/es/locale';
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const errorValueTypeOptions = reactive<{ value: number, label: string, children: { value: number, label: string }[] }[]>([])
|
||||||
|
const conditionTypes = dictStore.getDictData('Condition_Type')
|
||||||
|
const errorValueTypes = dictStore.getDictData('Error_Value_Type')
|
||||||
|
const valueTypes = dictStore.getDictData('Script_Value_Type')
|
||||||
|
|
||||||
// 定义一个 Map 来存储误差和脚本系统信息
|
|
||||||
const errSysAndScriptMap = new Map<string, string>([
|
|
||||||
['Freq_Deviation_Freq','FREQ'],//频率偏差/频率---频率
|
|
||||||
['Vol_Deviation_Vol','VRMS'],//电压偏差/电压---电压/相电压有效值
|
|
||||||
['MSQI_V','V_UNBAN'],//三相不平衡/电压---电压/三相电压负序不平衡度
|
|
||||||
['MSQI_CUR','I_UNBAN'],//三相不平衡/电流---电流/三相电流负序不平衡度
|
|
||||||
['Voltage Fluctuation_Voltage Amplitude',''],//电压波动/电压幅值---
|
|
||||||
['Voltage Fluctuation_Duration',''],//电压波动/持续时间---
|
|
||||||
['Short Time Flicker Item','PST'],//闪变/短时间闪变---闪变/短时间闪变
|
|
||||||
['Harmonic_Voltage','V2-50'],//谐波/电压---谐波/谐波电压含有率
|
|
||||||
['Harmonic_Current','I2-50'],//谐波/电流---谐波/谐波电流幅值
|
|
||||||
['Harmonic_Angle','VA2-50'],//谐波/相角---谐波/谐波电压相角
|
|
||||||
['Harmonic_Angle','IA2-50'],//谐波/相角---谐波/谐波电流相角
|
|
||||||
['Harmonic_Power','P2-50'],//谐波/功率---谐波/谐波有功功率
|
|
||||||
['Interharmonic_Voltage','SV_1-49'],//间谐波/电压---谐波/间谐波电压含有率
|
|
||||||
['Interharmonic_Current','SI_1-49'],//间谐波/电流---谐波/间谐波电流幅值
|
|
||||||
['High Frequency Harmonic_Voltage',''],//高频次谐波/电压
|
|
||||||
['High Frequency Harmonic_Current',''],//高频次谐波/电流
|
|
||||||
['Power Item','P'],//功率/功率---功率
|
|
||||||
['Current Item','IRMS'],//电流/电流---电流/电流有效值
|
|
||||||
['Dip & Swell & Short duration interruption_Voltage','MAG'],//暂态/电压幅值/电压---暂态/电压幅值
|
|
||||||
['Dip & Swell & Short duration interruption_Duration','DUR'],//暂态/持续时间/时间---暂态/持续时间
|
|
||||||
]);
|
|
||||||
|
|
||||||
const handleErrorTypeChange = (value: any, row: any) =>{
|
onBeforeMount(() => {
|
||||||
|
valueTypes.forEach(item1 => {
|
||||||
|
let children = []
|
||||||
|
for (let i = 0; i < errorValueTypes.length; i++) {
|
||||||
|
if (item1.value === '2' && errorValueTypes[i].value === '2') {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
children.push({label: errorValueTypes[i].name, value: Number(errorValueTypes[i].value)})
|
||||||
|
}
|
||||||
|
errorValueTypeOptions.push({label: item1.name, value: Number(item1.value), children: children})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
const handleErrorTypeChange = (value: any, row: any) => {
|
||||||
|
|
||||||
// const matchedRow = findRowById(row.errorType, props.errorOptions);//选中误差id找对应结构中的含chilren的code
|
// const matchedRow = findRowById(row.errorType, props.errorOptions);//选中误差id找对应结构中的含chilren的code
|
||||||
// console.log('matchedRow.code',matchedRow.code)
|
// console.log('matchedRow.code',matchedRow.code)
|
||||||
@@ -182,6 +174,31 @@ const handleErrorTypeChange = (value: any, row: any) =>{
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleScriptTypeChange = (row: any) => {
|
||||||
|
handleErrorValueTypeChange(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleErrorValueTypeChange = (row: any) => {
|
||||||
|
let scriptType = findRowById(row.scriptType, props.scriptOptions)
|
||||||
|
if (scriptType) {
|
||||||
|
const errorValueType = row.errorValueType
|
||||||
|
let level1 = errorValueType[0]
|
||||||
|
|
||||||
|
switch (level1) {
|
||||||
|
case 1: // 绝对值
|
||||||
|
row.valueType = 1
|
||||||
|
row.errorUnit = scriptType.remark
|
||||||
|
break;
|
||||||
|
case 2: // 相对值
|
||||||
|
row.valueType = 2
|
||||||
|
row.errorUnit = "%"
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 假设 props.errorOptions 是一个数组,每个元素可能包含 children 属性
|
// 假设 props.errorOptions 是一个数组,每个元素可能包含 children 属性
|
||||||
const findRowById = (id: string, options: any[]): any | null => {
|
const findRowById = (id: string, options: any[]): any | null => {
|
||||||
@@ -236,7 +253,7 @@ watch(() => props.tableData, async (newTableData) => {
|
|||||||
props.tableData.forEach(row => {
|
props.tableData.forEach(row => {
|
||||||
isEndValueDisabled.value[row.sort] = row.endFlag === 2;
|
isEndValueDisabled.value[row.sort] = row.endFlag === 2;
|
||||||
});
|
});
|
||||||
}, { immediate: true });
|
}, {immediate: true});
|
||||||
|
|
||||||
|
|
||||||
// 处理 startFlag 变化的方法
|
// 处理 startFlag 变化的方法
|
||||||
@@ -259,41 +276,43 @@ const handleEndFlagChange = (row: ErrorSystem.ErrorSystemDetail, value: number)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//选中
|
//选中
|
||||||
const handleSelectionChange = (selection: ErrorSystem.ErrorSystemDetail[]) => {
|
const handleSelectionChange = (selection: ErrorSystem.ErrorSystemDetail[]) => {
|
||||||
multipleSelection.value = selection.map(row => row.sort); // 更新选中的行
|
multipleSelection.value = selection.map(row => row.sort); // 更新选中的行
|
||||||
};
|
};
|
||||||
//新增
|
//新增
|
||||||
const openAddDialog = () => {
|
const openAddDialog = () => {
|
||||||
// 获取字典数据
|
// 获取字典数据
|
||||||
const conditionTypes = dictStore.getDictData('Condition_Type');
|
|
||||||
const errorValueTypes = dictStore.getDictData('Error_Value_Type');
|
|
||||||
const newRow = {
|
const newRow = {
|
||||||
sort: props.tableData.length + 1,
|
sort: props.tableData.length + 1,
|
||||||
id: '',
|
id: '',
|
||||||
startFlag:2,
|
startFlag: 2,
|
||||||
endFlag:2,
|
endFlag: 2,
|
||||||
conditionType: conditionTypes.length > 0 ? Number(conditionTypes[3].value) : 0, // 设置默认值为第一个选项的值
|
conditionType: conditionTypes.length > 0 ? Number(conditionTypes[0].value) : 0, // 设置默认值为第一个选项的值
|
||||||
errorValueType:errorValueTypes.length > 0 ? Number(errorValueTypes[0].value) : 0, // 设置默认值为第一个选项的值
|
valueType: valueTypes.length > 0 ? Number(valueTypes[0].value) : 1,
|
||||||
|
errorValueType: [errorValueTypeOptions[0].value, errorValueTypeOptions[0].children[0].value],
|
||||||
errorSysId: "",
|
errorSysId: "",
|
||||||
errorType: "",
|
errorType: "",
|
||||||
scriptType: "",
|
scriptType: "",
|
||||||
maxErrorValue: 0
|
maxErrorValue: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
emit('updateTableData', [...props.tableData, newRow]);
|
emit('updateTableData', [...props.tableData, newRow]);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const copyRow = (row: ErrorSystem.ErrorSystemDetail) => {
|
const copyRow = (row: ErrorSystem.ErrorSystemDetail) => {
|
||||||
// 深拷贝行数据
|
// 深拷贝行数据
|
||||||
const newRow = { ...row };
|
const newRow = {...row};
|
||||||
const maxNextId = Math.max(...props.tableData.map(item => item.sort), 0);
|
const maxNextId = Math.max(...props.tableData.map(item => item.sort), 0);
|
||||||
newRow.sort = maxNextId + 1;
|
newRow.sort = maxNextId + 1;
|
||||||
emit('updateTableData', [...props.tableData, newRow]);
|
emit('updateTableData', [...props.tableData, newRow]);
|
||||||
};
|
};
|
||||||
//删除行
|
//删除行
|
||||||
const deleteRow = (row:ErrorSystem.ErrorSystemDetail) => {
|
const deleteRow = (row: ErrorSystem.ErrorSystemDetail) => {
|
||||||
const index = props.tableData.indexOf(row);
|
const index = props.tableData.indexOf(row);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
const newTableData = [...props.tableData];
|
const newTableData = [...props.tableData];
|
||||||
@@ -322,6 +341,7 @@ const deleteSelectedRows = () => {
|
|||||||
.el-table th, .el-table td {
|
.el-table th, .el-table td {
|
||||||
text-align: center; /* 所有单元格文字居中 */
|
text-align: center; /* 所有单元格文字居中 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-container {
|
.table-container {
|
||||||
max-height: 400px; /* 根据需要调整高度 */
|
max-height: 400px; /* 根据需要调整高度 */
|
||||||
overflow-y: auto; /* 允许垂直滚动 */
|
overflow-y: auto; /* 允许垂直滚动 */
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1500px">
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1660px">
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="基础信息">
|
<el-tab-pane label="基础信息">
|
||||||
<div >
|
<div>
|
||||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' label-width="auto" class="form-three">
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' label-width="auto" class="form-four">
|
||||||
<el-form-item label="标准号" prop="standardName" >
|
<el-form-item label="标准号" prop="standardName" >
|
||||||
<el-input v-model='formContent.standardName' placeholder="请填写标准号"/>
|
<el-input v-model='formContent.standardName' placeholder="请填写标准号" maxlength="32" show-word-limit/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="标准推行年份" prop="standardTime" >
|
<el-form-item label="标准推行年份" prop="standardTime" >
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<el-form-item label="状态" prop="enable" >
|
<el-form-item label="状态" prop="enable" >
|
||||||
<el-select v-model='formContent.enable' placeholder="请选择状态">
|
<el-select v-model='formContent.enable' placeholder="请选择状态">
|
||||||
<el-option label="启用" :value="1"></el-option>
|
<el-option label="启用" :value="1"></el-option>
|
||||||
<el-option label="不启用" :value="0"></el-option>
|
<el-option label="停用" :value="0"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { type ErrorSystem } from '@/api/device/interface/error';
|
import { type ErrorSystem } from '@/api/device/interface/error';
|
||||||
import ErrorSystemDetailTable from '@/views/machine/errorSystem/components/errorSystemDetailTable.vue';
|
import ErrorSystemDetailTable from '@/views/machine/errorSystem/components/errorSystemDetailTable.vue';
|
||||||
import {getDictTreeList} from '@/api/system/dictionary/dictTree'
|
import {getDictTreeByCode} from '@/api/system/dictionary/dictTree'
|
||||||
import { type Dict } from '@/api/system/dictionary/interface';
|
import { type Dict } from '@/api/system/dictionary/interface';
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
@@ -137,6 +137,9 @@ const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
formContent.value.pqErrSysDtlsList = tableData.value
|
formContent.value.pqErrSysDtlsList = tableData.value
|
||||||
|
formContent.value.pqErrSysDtlsList.forEach((item) => {
|
||||||
|
item.errorValueType=item.errorValueType[1]
|
||||||
|
})
|
||||||
if (formContent.value.id) {
|
if (formContent.value.id) {
|
||||||
await updatePqErrSys(formContent.value);
|
await updatePqErrSys(formContent.value);
|
||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
@@ -156,31 +159,31 @@ const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) =>
|
|||||||
}
|
}
|
||||||
// 封装提取第二层节点的逻辑
|
// 封装提取第二层节点的逻辑
|
||||||
const loadSecondLevelOptions = async () => {
|
const loadSecondLevelOptions = async () => {
|
||||||
const dictCode = '误差体系指标项'; // 替换为实际需要的字典代码
|
const dictCode = 'Err_Sys_Items'; // 替换为实际需要的字典代码
|
||||||
const dictCode2 = '脚本-误差'; // 替换为实际需要的字典代码
|
const dictCode2 = 'Script_Error'; // 替换为实际需要的字典代码
|
||||||
|
|
||||||
const resDictTree: Dict.ResDictTree = {
|
const resDictTree: Dict.ResDictTree = {
|
||||||
name: dictCode,
|
name: '',
|
||||||
id: '',
|
id: '',
|
||||||
pid: '',
|
pid: '',
|
||||||
pids: '',
|
pids: '',
|
||||||
code: '',
|
code: dictCode,
|
||||||
sort: 0
|
sort: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
const resDictTree2: Dict.ResDictTree = {
|
const resDictTree2: Dict.ResDictTree = {
|
||||||
name: dictCode2,
|
name: '',
|
||||||
id: '',
|
id: '',
|
||||||
pid: '',
|
pid: '',
|
||||||
pids: '',
|
pids: '',
|
||||||
code: '',
|
code: dictCode2,
|
||||||
sort: 0
|
sort: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
// 并行请求两个字典树列表
|
// 并行请求两个字典树列表
|
||||||
const [result, result2] = await Promise.all([
|
const [result, result2] = await Promise.all([
|
||||||
getDictTreeList(resDictTree),
|
getDictTreeByCode(resDictTree),
|
||||||
getDictTreeList(resDictTree2)
|
getDictTreeByCode(resDictTree2)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const allOptions = convertToOptions(result.data as Dict.ResDictTree[]);
|
const allOptions = convertToOptions(result.data as Dict.ResDictTree[]);
|
||||||
@@ -212,7 +215,8 @@ const loadSecondLevelOptions = async () => {
|
|||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.name,
|
label: item.name,
|
||||||
code: item.code,
|
code: item.code,
|
||||||
children: item.children ? convertToOptions(item.children) : undefined
|
children: item.children ? convertToOptions(item.children) : undefined,
|
||||||
|
remark: item.remark
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -230,6 +234,9 @@ const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
|||||||
if (result && result.data) {
|
if (result && result.data) {
|
||||||
formContent.value = result.data as ErrorSystem.ErrorSystemList;
|
formContent.value = result.data as ErrorSystem.ErrorSystemList;
|
||||||
tableData.value = formContent.value.pqErrSysDtlsList || [];
|
tableData.value = formContent.value.pqErrSysDtlsList || [];
|
||||||
|
tableData.value.forEach((item) => {
|
||||||
|
item.errorValueType=[item.valueType,item.errorValueType]
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
resetFormContent();
|
resetFormContent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<template #operation='scope'>
|
||||||
<el-button v-auth.device="'view'" type='primary' link :icon='View' @click="openDialog('view', scope.row)">查看</el-button>
|
<el-button v-auth.device="'view'" type='primary' link :icon='View' @click="openDialog('view', scope.row)">查看</el-button>
|
||||||
|
<el-button v-auth.device="'view'" type='primary' link :icon='View' @click="copy(scope.row)">复制</el-button>
|
||||||
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||||
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -26,7 +27,7 @@
|
|||||||
<ErrorStandardPopup :refresh-table='proTable?.getTableList' ref='errorStandardPopup' />
|
<ErrorStandardPopup :refresh-table='proTable?.getTableList' ref='errorStandardPopup' />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name='useProTable'>
|
<script setup lang="tsx" name='useProTable'>
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import { CirclePlus, Delete,EditPen,View} from '@element-plus/icons-vue'
|
import { CirclePlus, Delete,EditPen,View} from '@element-plus/icons-vue'
|
||||||
@@ -36,7 +37,8 @@ import ErrorSystemPopup from '@/views/machine/errorSystem/components/errorSystem
|
|||||||
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue'
|
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue'
|
||||||
import type { ErrorSystem } from '@/api/device/interface/error'
|
import type { ErrorSystem } from '@/api/device/interface/error'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { getPqErrSysList, deletePqErrSys} from '@/api/device/error/index'
|
import { getPqErrSysList, deletePqErrSys,copyPqErrSys} from '@/api/device/error/index'
|
||||||
|
import { ElMessageBox } from 'element-plus'
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'errorSystem'
|
name: 'errorSystem'
|
||||||
})
|
})
|
||||||
@@ -71,7 +73,15 @@ const columns = ref<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
|
|||||||
search: { el: 'select', props: { filterable: true } },
|
search: { el: 'select', props: { filterable: true } },
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 250,},
|
{
|
||||||
|
prop: 'enable',
|
||||||
|
label: '启用状态',
|
||||||
|
width: 120,
|
||||||
|
render: scope => {
|
||||||
|
return (scope.row.enable ? <el-tag type='success'>启用</el-tag> : <el-tag type='danger'>停用</el-tag>)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 300,},
|
||||||
])
|
])
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
@@ -86,19 +96,33 @@ const openDialog = (titleType: string, row: Partial<ErrorSystem.ErrorSystemList>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 批量删除设备
|
// 批量误差体系
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
await useHandleData(deletePqErrSys, id, '删除所选误差体系')
|
await useHandleData(deletePqErrSys, id, '删除所选误差体系')
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除设备
|
// 删除误差体系
|
||||||
const handleDelete = async (params: ErrorSystem.ErrorSystemList) => {
|
const handleDelete = async (params: ErrorSystem.ErrorSystemList) => {
|
||||||
await useHandleData(deletePqErrSys, [params.id], `删除【${params.name}】误差体系`)
|
await useHandleData(deletePqErrSys, [params.id], `删除【${params.name}】误差体系`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 复制误差体系
|
||||||
|
const copy = async (params: ErrorSystem.ErrorSystemList) => {
|
||||||
|
ElMessageBox.confirm('是否复制当前误差体系?', '提示', {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: 'warning',
|
||||||
|
draggable: true
|
||||||
|
}).then(async () => {
|
||||||
|
copyPqErrSys(params).then(() => {
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules'>
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules'>
|
||||||
<el-form-item label="名称" prop="name" >
|
<el-form-item label="名称" prop="name" >
|
||||||
<el-input v-model='formContent.name' placeholder="请输入icd名称"/>
|
<el-input v-model='formContent.name' placeholder="请输入icd名称" maxlength="32" show-word-limit/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="存储地址" prop="path" >
|
<el-form-item label="存储地址" prop="path" >
|
||||||
<el-input v-model='formContent.path' placeholder="请输入icd存储地址"/>
|
<el-input v-model='formContent.path' placeholder="请输入icd存储地址" maxlength="32" show-word-limit/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -29,26 +29,21 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='useRole'>
|
<script setup lang='tsx' name='useRole'>
|
||||||
import TimeControl from '@/components/TimeControl/index.vue'
|
|
||||||
import { type ICD } from '@/api/device/interface/icd'
|
import { type ICD } from '@/api/device/interface/icd'
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||||
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
import {
|
import {
|
||||||
getICDList,
|
getICDList,
|
||||||
deleteICD,
|
deleteICD,
|
||||||
} from '@/api/device/icd/index.ts'
|
} from '@/api/device/icd/index.ts'
|
||||||
import { reactive, ref } from 'vue'
|
import { reactive, ref } from 'vue'
|
||||||
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'devType',
|
name: 'devType',
|
||||||
})
|
})
|
||||||
const modeStore = useModeStore()
|
|
||||||
const dictStore = useDictStore()
|
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
const icdPopup = ref()
|
const icdPopup = ref()
|
||||||
@@ -101,14 +96,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 批量删除设备
|
// 批量删除icd
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
await useHandleData(deleteICD, id, '删除所选icd')
|
await useHandleData(deleteICD, id, '删除所选icd')
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除设备
|
// 删除设备icd
|
||||||
const handleDelete = async (params: ICD.ResICD) => {
|
const handleDelete = async (params: ICD.ResICD) => {
|
||||||
await useHandleData(deleteICD, [params.id] , `删除【${params.name}】icd`)
|
await useHandleData(deleteICD, [params.id] , `删除【${params.name}】icd`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
|
|||||||
@@ -0,0 +1,185 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
:header-cell-style="{
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: 'var(--el-color-primary)',
|
||||||
|
color: '#fff'
|
||||||
|
}"
|
||||||
|
stripe
|
||||||
|
:height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`"
|
||||||
|
:style="{ overflow: 'hidden' }"
|
||||||
|
row-key="id"
|
||||||
|
:expand-row-keys="[props.activeName]"
|
||||||
|
>
|
||||||
|
<el-table-column prop="name" label="指标" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" label="参与误差比较" width="110px">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-switch
|
||||||
|
v-model="row.errorFlag"
|
||||||
|
v-if="row.show"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
:disabled="row.disabled || disabled"
|
||||||
|
>
|
||||||
|
<template #active-action>
|
||||||
|
<span>√</span>
|
||||||
|
</template>
|
||||||
|
<template #inactive-action>
|
||||||
|
<span>×</span>
|
||||||
|
</template>
|
||||||
|
</el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="是否启用" width="85px">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-switch
|
||||||
|
v-model="row.enable"
|
||||||
|
v-if="row.show"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
:disabled="row.disabled || disabled"
|
||||||
|
>
|
||||||
|
<template #active-action>
|
||||||
|
<span>√</span>
|
||||||
|
</template>
|
||||||
|
<template #inactive-action>
|
||||||
|
<span>×</span>
|
||||||
|
</template>
|
||||||
|
</el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import type { Dict } from '@/api/system/dictionary/interface'
|
||||||
|
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||||
|
import { checkDataList } from '@/api/device/testScript'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
activeName: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
formContent: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
shrink: {
|
||||||
|
type: Boolean
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const tableData = ref<any[]>([])
|
||||||
|
const info = async () => {
|
||||||
|
let checkData: any = []
|
||||||
|
let title = props.options.filter((i: any) => i.value == props.activeName)[0]
|
||||||
|
|
||||||
|
await checkDataList({
|
||||||
|
scriptId: props.formContent.id,
|
||||||
|
scriptType: props.activeName
|
||||||
|
}).then((res: any) => {
|
||||||
|
checkData = res.data
|
||||||
|
})
|
||||||
|
|
||||||
|
let { data } = await getDictTreeByCode({
|
||||||
|
name: '',
|
||||||
|
id: '',
|
||||||
|
pid: '',
|
||||||
|
pids: '',
|
||||||
|
code: 'Script_Error',
|
||||||
|
sort: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
data[0].children.forEach((item: any, i: number) => {
|
||||||
|
tableData.value.push({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
show: false,
|
||||||
|
children: []
|
||||||
|
})
|
||||||
|
item.children.forEach((k: any) => {
|
||||||
|
let childrenList: any = []
|
||||||
|
checkData.forEach((j: any) => {
|
||||||
|
if (j.valueType == k.id) {
|
||||||
|
childrenList.push(j)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (childrenList.length > 0) {
|
||||||
|
tableData.value[i].children.push({
|
||||||
|
id: k.id,
|
||||||
|
pid: item.id,
|
||||||
|
name: k.name,
|
||||||
|
pname: item.name,
|
||||||
|
dataType:
|
||||||
|
item.name == '谐波有功功率'
|
||||||
|
? 'avg'
|
||||||
|
: item.name == '闪变'
|
||||||
|
? 'avg'
|
||||||
|
: item.name == '暂态'
|
||||||
|
? 'avg'
|
||||||
|
: 'real',
|
||||||
|
show: true,
|
||||||
|
errorFlag: childrenList[0].errorFlag,
|
||||||
|
enable: childrenList[0].enable
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
tableData.value[i].children.push({
|
||||||
|
id: k.id,
|
||||||
|
pid: item.id,
|
||||||
|
name: k.name,
|
||||||
|
disabled: false,
|
||||||
|
pname: item.name,
|
||||||
|
dataType: item.name =='谐波有功功率'
|
||||||
|
? 'avg'
|
||||||
|
: item.name == '闪变'
|
||||||
|
? 'avg'
|
||||||
|
: item.name == '暂态'
|
||||||
|
? 'avg'
|
||||||
|
: 'real',
|
||||||
|
show: true,
|
||||||
|
errorFlag: 0,
|
||||||
|
enable: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 默认够选通讯脚本
|
||||||
|
if (item.name == title.label.replace(/准确度|检测/g, '')) {
|
||||||
|
if (item.name == '暂态') {
|
||||||
|
tableData.value[i].children.forEach((k: any) => {
|
||||||
|
k.disabled = true
|
||||||
|
k.enable = 1
|
||||||
|
k.errorFlag = 1
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
tableData.value[i].children[0].disabled = true
|
||||||
|
tableData.value[i].children[0].enable = 1
|
||||||
|
tableData.value[i].children[0].errorFlag = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
//console.log('🚀 ~ item.children.forEach ~ tableData.value:', tableData.value)
|
||||||
|
}
|
||||||
|
const getData = () => {
|
||||||
|
return tableData.value
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
info()
|
||||||
|
// tableData.value = data.data[0].children || []
|
||||||
|
})
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ getData })
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
198
frontend/src/views/machine/testScript/components/scriptForm.ts
Normal file
198
frontend/src/views/machine/testScript/components/scriptForm.ts
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
|
||||||
|
|
||||||
|
let scriptForm: any = {
|
||||||
|
subType: '', //tabcode
|
||||||
|
ffreq: 50, //频率
|
||||||
|
channelList: [
|
||||||
|
{
|
||||||
|
channelType: 'Ua',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase: 0, //相角
|
||||||
|
harmList: [
|
||||||
|
// {
|
||||||
|
// harm: 2, //谐波次数
|
||||||
|
// famp: 0, //谐波含有率
|
||||||
|
// fphase: 0 // 谐波相角
|
||||||
|
// },
|
||||||
|
], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
},
|
||||||
|
{
|
||||||
|
channelType: 'Ia',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase: 0, //相角
|
||||||
|
harmList: [], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
},
|
||||||
|
{
|
||||||
|
channelType: 'Ub',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase: -120, //相角
|
||||||
|
harmList: [], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
},
|
||||||
|
{
|
||||||
|
channelType: 'Ib',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase:-120, //相角
|
||||||
|
harmList: [], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
},
|
||||||
|
{
|
||||||
|
channelType: 'Uc',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase: 120, //相角
|
||||||
|
harmList: [], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
},
|
||||||
|
{
|
||||||
|
channelType: 'Ic',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase: 120, //相角
|
||||||
|
harmList: [], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
// 追加谐波
|
||||||
|
|
||||||
|
|
||||||
|
export default scriptForm
|
||||||
@@ -1,95 +1,351 @@
|
|||||||
import { ref } from "vue"
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" >
|
<div class="table-container">
|
||||||
<div class='table-box'>
|
<div class="recalculation">
|
||||||
<ProTable
|
<el-button type="primary" :icon="Refresh" @click="recalculation">一键重算</el-button>
|
||||||
ref='proTable'
|
|
||||||
:columns='columns'
|
|
||||||
:request-api="getTableList"
|
|
||||||
:pagination="false"
|
|
||||||
:toolButton ='false'
|
|
||||||
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}"
|
|
||||||
>
|
|
||||||
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
|
||||||
<!-- 表格 header 按钮 -->
|
|
||||||
<template #tableHeader='scope'>
|
|
||||||
<el-button v-auth.testScript="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
|
||||||
<el-button v-auth.testScript="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
|
||||||
删除
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
<!-- 表格操作 -->
|
|
||||||
<template #operation='scope'>
|
|
||||||
<el-button v-auth.testScript="'upgrade'" type='primary' v-if="scope.row.type !== 1" link :icon='Share' @click='updateType(scope.row)'>复制</el-button>
|
|
||||||
<el-button v-auth.testScript="'edit'" type='primary' link :icon='EditPen' :model-value="false" @click="openDialog('edit', scope.row)">编辑</el-button>
|
|
||||||
<el-button v-auth.testScript="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</ProTable>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
:header-cell-style="{
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: 'var(--el-color-primary)',
|
||||||
|
color: '#fff'
|
||||||
|
}"
|
||||||
|
stripe
|
||||||
|
:cell-style="{ textAlign: 'center' }"
|
||||||
|
height="550px"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" label="序号" width="60" />
|
||||||
|
<el-table-column prop="pname" label="参考设定值类型" />
|
||||||
|
<el-table-column prop="name" label="参考设定值子类型" width="250">
|
||||||
|
<template #default="{ row }">{{ row.harmNum ? `(${row.harmNum}次)` : '' }} {{ row.name }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column prop="dataType" label="值类型">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-select v-model="row.dataType" v-if="!row.show">
|
||||||
|
<el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
<span v-else>
|
||||||
|
{{ typeList.find(item => item.value == row.dataType)?.label || row.dataType }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
<el-table-column prop="phase" label="相别" />
|
||||||
|
<el-table-column prop="value" label="参考设定值">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="row.show">{{ parseFloat((row.value - 0).toFixed(4)) }}{{ setUnit(row) || '' }}</span>
|
||||||
|
<el-input type="number" v-else v-model="row.value" placeholder="请输入值" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="value" label="参与误差比较">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.errorFlag == 0 ? '否' : '是' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" link :icon="EditPen" @click="row.show = !row.show" v-if="row.show">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" link :icon="Check" @click="row.show = !row.show" v-else>保存</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog :title="dialogTitle" v-model="showForm" @close="close" width="500">
|
||||||
|
<el-form ref="form" :model="form" label-width="auto">
|
||||||
|
<el-form-item label="参考设定值类型" prop="name">
|
||||||
|
<el-input v-model="form.name" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="参考设定值子类型" prop="standardName">
|
||||||
|
<el-input v-model="form.standardName" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="参考设定值" prop="standardTime">
|
||||||
|
<el-input v-model="form.standardTime" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div >
|
<div>
|
||||||
<el-button @click='close()'>取 消</el-button>
|
<el-button @click="close()">取 消</el-button>
|
||||||
<el-button type="primary" @click='save()'>保存</el-button>
|
<el-button type="primary" @click="save">保 存</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
</template>
|
||||||
<SetValuePopup ref='setValuePopup' />
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { TestScript } from '@/api/device/interface/testScript'
|
import { Refresh, EditPen, Check, Share } from '@element-plus/icons-vue'
|
||||||
import type { ColumnProps } from '@/components/ProTable/interface'
|
import { reactive, ref } from 'vue'
|
||||||
import {reactive, ref } from 'vue'
|
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
|
import { checkDataList, scriptDtlsCheckDataList } from '@/api/device/testScript/index'
|
||||||
|
const showForm = ref(false)
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const dialogTitle = ref('')
|
const dialogTitle = ref('')
|
||||||
|
const props = defineProps({
|
||||||
|
activeName: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
|
formContent: {
|
||||||
|
type: [Object, Array],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
type: [Object, Array],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
valueCode: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['recalculation'])
|
||||||
|
const tableData: any = ref([])
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
const typeList = [
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
|
||||||
{
|
{
|
||||||
prop: 'name',
|
label: '实时',
|
||||||
label: '参考设定值类型',
|
value: 'real'
|
||||||
minWidth: 350,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardName',
|
label: 'CP95值',
|
||||||
label: '参考设定值子类型',
|
value: 'cp95'
|
||||||
minWidth: 150,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardTime',
|
label: '平均值',
|
||||||
label: '参考设定值',
|
value: 'avg'
|
||||||
minWidth: 150,
|
|
||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
{
|
||||||
])
|
label: '最小值',
|
||||||
|
value: 'min'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '最大值',
|
||||||
|
value: 'max'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const form = ref({
|
||||||
|
name: 220,
|
||||||
|
standardName: 0,
|
||||||
|
standardTime: 0
|
||||||
|
})
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = (sign: string,row: any) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
dialogTitle.value = sign === 'add'? '新增检测项目信息' : '编辑检测项目信息'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const open = async (row: any, copyRowList: any) => {
|
||||||
|
let treeData: any = []
|
||||||
|
await getDictTreeByCode({
|
||||||
|
name: '',
|
||||||
|
id: '',
|
||||||
|
pid: '',
|
||||||
|
pids: '',
|
||||||
|
code: 'Script_Error',
|
||||||
|
sort: 0
|
||||||
|
}).then((res: any) => {
|
||||||
|
treeData = res.data[0].children
|
||||||
|
})
|
||||||
|
let checkDataList: any = []
|
||||||
|
await row.forEach((item: any) => {
|
||||||
|
item.children.forEach((k: any) => {
|
||||||
|
if (k.enable != 0 || k.errorFlag != 0) {
|
||||||
|
checkDataList.push({
|
||||||
|
pid: k.pid,
|
||||||
|
valueType: k.id,
|
||||||
|
dataType: k.dataType,
|
||||||
|
enable: k.enable,
|
||||||
|
errorFlag: k.errorFlag
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
let form = handleHarmData(JSON.parse(JSON.stringify(props.form)))
|
||||||
|
let retryCompute = isEqual(form, copyRowList)
|
||||||
|
await scriptDtlsCheckDataList({
|
||||||
|
...form,
|
||||||
|
scriptId: props.formContent?.id,
|
||||||
|
scriptType: props.activeName,
|
||||||
|
checkDataList: checkDataList,
|
||||||
|
retryCompute: retryCompute
|
||||||
|
}).then((res: any) => {
|
||||||
|
res.data.forEach((item: any) => {
|
||||||
|
let pList = treeData.filter((i: any) => i.id == item.pid)[0]
|
||||||
|
item.pname = pList.name
|
||||||
|
item.name = pList.children.filter((i: any) => i.id == item.valueType)[0].name
|
||||||
|
item.show = true
|
||||||
|
})
|
||||||
|
tableData.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 重算
|
||||||
|
const recalculation = () => {
|
||||||
|
emit('recalculation')
|
||||||
|
}
|
||||||
|
// 处理多余数据
|
||||||
|
const handleHarmData = (row: any) => {
|
||||||
|
row.channelList.forEach((channel: any) => {
|
||||||
|
// 筛选出 famp 和 fphase 不同时为 0 的对象
|
||||||
|
channel.harmList = channel.harmList.filter((item: any) => item.famp != 0 || item.fphase != 0)
|
||||||
|
channel.inharmList = channel.inharmList.filter(
|
||||||
|
(item: any) => item.inharm !== '' || item.famp !== 0 || item.fphase !== 0
|
||||||
|
)
|
||||||
|
})
|
||||||
|
return row
|
||||||
|
}
|
||||||
|
// 判断数据是否变化
|
||||||
|
const isEqual = (obj1: any, obj2: any) => {
|
||||||
|
// 如果两个对象是同一个引用,直接返回 true
|
||||||
|
if (obj1 == obj2) return true
|
||||||
|
// 如果其中一个是 null 或者不是对象,返回 false
|
||||||
|
if (obj1 === null || typeof obj1 !== 'object' || obj2 === null || typeof obj2 !== 'object') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 获取两个对象的键
|
||||||
|
const keys1 = Object.keys(obj1)
|
||||||
|
const keys2 = Object.keys(obj2)
|
||||||
|
// 如果键的数量不同,返回 false
|
||||||
|
if (keys1.length !== keys2.length) return false
|
||||||
|
// 遍历所有键,递归比较值
|
||||||
|
for (const key of keys1) {
|
||||||
|
if (!keys2.includes(key) || !isEqual(obj1[key], obj2[key])) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
const unit = [
|
||||||
|
{
|
||||||
|
label: '频率',
|
||||||
|
unit: 'Hz'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '相电压有效值',
|
||||||
|
unit: 'V'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '电压偏差',
|
||||||
|
unit: '%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '电压相角',
|
||||||
|
unit: '°'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '基波电压有效值',
|
||||||
|
unit: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '电流有效值',
|
||||||
|
unit: 'A'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '电流相角',
|
||||||
|
unit: '°'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '基波电流有效值',
|
||||||
|
unit: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '谐波电压',
|
||||||
|
unit: '%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '谐波电流',
|
||||||
|
unit: '%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '谐波电流幅值',
|
||||||
|
unit: 'A'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '谐波有功功率',
|
||||||
|
unit: 'W'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '间谐波电压',
|
||||||
|
unit: '%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '间谐波电流',
|
||||||
|
unit: '%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '电压幅值',
|
||||||
|
unit: '%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '持续时间',
|
||||||
|
unit: '周波'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '三相电压不平衡度',
|
||||||
|
unit: '%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '三相电流不平衡度',
|
||||||
|
unit: '%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '闪变',
|
||||||
|
unit: ''
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: '电流',
|
||||||
|
unit: props.valueCode == 'Absolute' ? 'A' : '%'
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
|
// 参考设定值添加单位
|
||||||
|
const setUnit = (row: any) => {
|
||||||
|
console.log('🚀 ~ setUnit ~ row:', row)
|
||||||
|
let text = ''
|
||||||
|
if (row.pname == '暂态') {
|
||||||
|
row.name == '电压幅值' ? (text = '%') : ''
|
||||||
|
row.name == '持续时间' ? (text = '周波') : ''
|
||||||
|
} else if (row.pname == '电压') {
|
||||||
|
let o = props.valueCode == 'Absolute' ? 'V' : '%'
|
||||||
|
row.name == '相电压有效值' ? (text = o) : ''
|
||||||
|
row.name == '电压偏差' ? (text = '%') : ''
|
||||||
|
row.name == '电压相角' ? (text = '°') : ''
|
||||||
|
}else if (row.pname == '电流') {
|
||||||
|
let o = props.valueCode == 'Absolute' ? 'A' : '%'
|
||||||
|
row.name == '电流有效值' ? (text = o) : ''
|
||||||
|
row.name == '电流相角' ? (text = '°') : ''
|
||||||
|
} else {
|
||||||
|
text = unit.filter(item => item.label == row.pname)[0]?.unit
|
||||||
|
}
|
||||||
|
|
||||||
|
return text || ''
|
||||||
|
}
|
||||||
|
const save = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
const getTableData = () => {
|
||||||
|
return tableData.value
|
||||||
|
}
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {})
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open, getTableData })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.recalculation {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: end;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,178 +1,660 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1400px">
|
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1450px">
|
||||||
<div class="dialog-content" >
|
<el-carousel height="600px" :autoplay="false" ref="carouselRef" indicator-position="none">
|
||||||
<el-tabs type="border-card" class="left-tabs" style="height: 100%;">
|
<el-carousel-item :name="0" style="height: 100%; overflow-y: auto">
|
||||||
|
<div class="dialog-content">
|
||||||
|
<el-tabs type="border-card" class="right-tabs">
|
||||||
|
<el-tab-pane label="检测">
|
||||||
|
<!-- 全局设置菜单内容 -->
|
||||||
|
<div style="height: 295px">
|
||||||
|
<el-radio-group v-model="form.subType">
|
||||||
|
<el-radio
|
||||||
|
v-for="item in tabChildren"
|
||||||
|
:key="item"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.code"
|
||||||
|
border
|
||||||
|
style="margin: 0 0 10px 10px"
|
||||||
|
/>
|
||||||
|
<!-- <el-radio v-for="item in tabChildren" :value="item.value" border>{{ item.label }}</el-radio> -->
|
||||||
|
</el-radio-group>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<el-tabs type="border-card" class="left-tabs" style="height: 100%">
|
||||||
<el-tab-pane label="输出菜单">
|
<el-tab-pane label="输出菜单">
|
||||||
<!-- 输出菜单内容 -->
|
<!-- 输出菜单内容 -->
|
||||||
<el-table :data="tableData"
|
<el-table
|
||||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
:data="tableData"
|
||||||
:cell-style="{ textAlign: 'center' }"
|
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:style="{ height: '295px',overflow:'hidden'}"
|
:style="{ height: '295px', overflow: 'hidden' }"
|
||||||
:show-header="false"
|
:show-header="false"
|
||||||
:span-method="arraySpanMethod">
|
:span-method="arraySpanMethod"
|
||||||
<el-table-column prop="sort" label="相别" width="60" />
|
:cell-style="tableStyle.cellStyle"
|
||||||
<el-table-column prop="frequency" label="电压/电流" width="90" />
|
:header-cell-style="{
|
||||||
<el-table-column prop="L1" label="值" width="180"/>
|
textAlign: 'center',
|
||||||
<el-table-column label="操作" width="80">
|
backgroundColor: 'var(--el-color-primary)',
|
||||||
<template #default="{ }">
|
color: '#fff'
|
||||||
<el-button type="info" :icon="Bottom"></el-button>
|
}"
|
||||||
|
@cell-click="handleRowClick"
|
||||||
|
:key="key"
|
||||||
|
>
|
||||||
|
<el-table-column prop="name" label="相别" width="60" align="center" />
|
||||||
|
<el-table-column prop="frequency" label="电压/电流" align="center" width="60" />
|
||||||
|
<el-table-column prop="L1" label="值" width="180" align="center">
|
||||||
|
<template #default="{ row, $index }">
|
||||||
|
<span>
|
||||||
|
{{ row.type === 'V' ? '电压' : '电流' }}{{ form.channelList[$index].famp
|
||||||
|
}}{{
|
||||||
|
valueCode == 'Absolute' ? (row.type === 'V' ? 'V' : 'A') : '%'
|
||||||
|
}}
|
||||||
|
相角{{ form.channelList[$index].fphase }}°
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作">
|
<el-table-column label="操作" width="85">
|
||||||
<template #default="{ row, $index }">
|
<template #default="{ row, $index }">
|
||||||
<el-button :type="buttonTypes[$index].channel || 'info'" @click="toggleType(row, $index,'channel')">通道使能</el-button>
|
<!-- <el-button
|
||||||
<el-button :type="buttonTypes[$index]?.harmonic || 'info'" @click="toggleType(row, $index, 'harmonic')">谐波使能</el-button>
|
type="primary"
|
||||||
<el-button :type="buttonTypes[$index]?.interHarmonic || 'info'" @click="toggleType(row, $index, 'interHarmonic')">间谐波使能</el-button>
|
v-if="$index != 4"
|
||||||
<el-button :type="buttonTypes[$index]?.flicker || 'info'" @click="toggleType(row, $index, 'flicker')">闪变使能</el-button>
|
link
|
||||||
<el-button :type="buttonTypes[$index]?.transient || 'info'" @click="toggleType(row, $index, 'transient')">暂态使能</el-button>
|
:icon="CopyDocument"
|
||||||
|
@click="copyRow($index)"
|
||||||
|
>
|
||||||
|
复制
|
||||||
|
</el-button> -->
|
||||||
|
<el-dropdown placement="top-start">
|
||||||
|
<el-button type="primary" link :icon="CopyDocument">复制</el-button>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu>
|
||||||
|
<div v-if="$index == 0">
|
||||||
|
<el-dropdown-item @click="copyRow(0, 2)">L2</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click="copyRow(0, 4)">L3</el-dropdown-item>
|
||||||
|
</div>
|
||||||
|
<div v-if="$index == 2">
|
||||||
|
<el-dropdown-item @click="copyRow(2, 0)">L1</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click="copyRow(2, 4)">L3</el-dropdown-item>
|
||||||
|
</div>
|
||||||
|
<div v-if="$index == 4">
|
||||||
|
<el-dropdown-item @click="copyRow(4, 0)">L1</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click="copyRow(4, 2)">L2</el-dropdown-item>
|
||||||
|
</div>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center">
|
||||||
|
<template #default="{ row, $index }">
|
||||||
|
<el-checkbox-button
|
||||||
|
v-model="form.channelList[$index].channelFlag"
|
||||||
|
label="通道使能"
|
||||||
|
:disabled="
|
||||||
|
form.channelList[$index].harmFlag ||
|
||||||
|
form.channelList[$index].inHarmFlag ||
|
||||||
|
form.channelList[$index].flickerFlag ||
|
||||||
|
form.channelList[$index].dipFlag
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<el-checkbox-button
|
||||||
|
v-model="form.channelList[$index].harmFlag"
|
||||||
|
label="谐波使能"
|
||||||
|
@change="handleHarmFlag($event, $index)"
|
||||||
|
/>
|
||||||
|
<el-checkbox-button
|
||||||
|
v-model="form.channelList[$index].inHarmFlag"
|
||||||
|
label="间谐波使能"
|
||||||
|
@change="handleHarmFlag($event, $index)"
|
||||||
|
/>
|
||||||
|
<el-checkbox-button
|
||||||
|
v-model="form.channelList[$index].flickerFlag"
|
||||||
|
label="闪变使能"
|
||||||
|
@change="handleHarmFlag($event, $index)"
|
||||||
|
/>
|
||||||
|
<el-checkbox-button
|
||||||
|
v-model="form.channelList[$index].dipFlag"
|
||||||
|
label="暂态使能"
|
||||||
|
@change="handleHarmFlag($event, $index)"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<el-tabs type="border-card" class="right-tabs" style="height: 100%;">
|
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
|
||||||
<el-tab-pane label="全局设置菜单">
|
<el-tab-pane label="全局设置菜单">
|
||||||
<!-- 全局设置菜单内容 -->
|
<!-- 全局设置菜单内容 -->
|
||||||
|
<div style="height: 295px; width: 170px">
|
||||||
<div class="form-item-container">
|
<div class="form-item-container">
|
||||||
<el-form-item label="频率:" prop='name'>
|
<el-form-item label="频率:" prop="name">
|
||||||
<div class="input-label-container">
|
<div class="input-label-container">
|
||||||
<el-input style="width: 100px;" />
|
<el-input
|
||||||
|
type="number"
|
||||||
|
style="width: 100px"
|
||||||
|
v-model="form.ffreq"
|
||||||
|
onkeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"
|
||||||
|
@change="validateFreq"
|
||||||
|
/>
|
||||||
<label>Hz</label>
|
<label>Hz</label>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-label-container">
|
<!-- <div class="button-label-container">
|
||||||
<label>参考设定值列表:</label>
|
<label>参考设定值列表:</label>
|
||||||
<el-button type="primary" :icon='EditPen' @click="openDialog">编辑</el-button>
|
<el-button type="primary" :icon="EditPen" @click="openDialog">编辑</el-button>
|
||||||
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top: 20px;">
|
<div style="margin-top: 10px; height: 234px">
|
||||||
<el-tabs type="border-card" class="custom-tabs">
|
<el-tabs type="border-card" class="custom-tabs">
|
||||||
<el-tab-pane label="电压/电流编辑">
|
<el-tab-pane label="电压/电流编辑" v-if="childForm[0].channelFlag || childForm[1].channelFlag">
|
||||||
<TestScriptVolCurTab/>
|
<TestScriptVolCurTab :childForm="childForm" :valueCode="valueCode" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="谐波编辑">
|
<el-tab-pane label="谐波编辑" v-if="childForm[0].harmFlag || childForm[1].harmFlag">
|
||||||
<TestScriptHarmTab/>
|
<TestScriptHarmTab :childForm="childForm" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="间谐波编辑">
|
<el-tab-pane label="间谐波编辑" v-if="childForm[0].inHarmFlag || childForm[1].inHarmFlag">
|
||||||
<TestScriptInHarmTab/>
|
<TestScriptInHarmTab :childForm="childForm" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="闪变编辑">
|
<el-tab-pane label="闪变编辑" v-if="childForm[0].flickerFlag || childForm[1].flickerFlag">
|
||||||
<TestScriptFlickerTab/>
|
<TestScriptFlickerTab :childForm="childForm" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="暂态编辑">
|
<el-tab-pane label="暂态编辑" v-if="childForm[0].dipFlag || childForm[1].dipFlag">
|
||||||
<TestScriptDipTab/>
|
<TestScriptDipTab :childForm="childForm" @setRetainTime="setRetainTime" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
</el-carousel-item>
|
||||||
<SetValueTable ref="setValueTable"/>
|
<el-carousel-item :name="1" style="height: 100%; overflow-y: auto" v-if="showSetValueTable">
|
||||||
|
<SetValueTable
|
||||||
|
ref="setValueTableRef"
|
||||||
|
:activeName="props.activeName"
|
||||||
|
:formContent="props.formContent"
|
||||||
|
:form="form"
|
||||||
|
:key="initial"
|
||||||
|
:valueCode="valueCode"
|
||||||
|
@recalculation="recalculation"
|
||||||
|
/>
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div >
|
<div>
|
||||||
<el-button @click='close()'>取 消</el-button>
|
<el-button @click="close">取 消</el-button>
|
||||||
<el-button type="primary" @click='save()'>保存</el-button>
|
<el-button type="primary" @click="next" v-if="!showSetValueTable">下一步</el-button>
|
||||||
|
<el-button type="primary" @click="previous" v-if="showSetValueTable">上一步</el-button>
|
||||||
|
<el-button type="primary" @click="save" v-if="showSetValueTable">保存</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { onMounted, reactive, ref } from 'vue'
|
||||||
import SetValueTable from '@/views/machine/testScript/components/setValueTable.vue';
|
import SetValueTable from '@/views/machine/testScript/components/setValueTable.vue'
|
||||||
import {EditPen,ArrowDown, Bottom} from '@element-plus/icons-vue'
|
import { EditPen, ArrowDown, Bottom, CopyDocument } from '@element-plus/icons-vue'
|
||||||
import { type TabsInstance } from 'element-plus';
|
import { type TabsInstance } from 'element-plus'
|
||||||
import TestScriptVolCurTab from '@/views/machine/testScript/components/testScriptVolCurTab.vue';
|
import TestScriptVolCurTab from '@/views/machine/testScript/components/testScriptVolCurTab.vue'
|
||||||
import TestScriptHarmTab from '@/views/machine/testScript/components/testScriptHarmTab.vue';
|
import TestScriptHarmTab from '@/views/machine/testScript/components/testScriptHarmTab.vue'
|
||||||
import TestScriptInHarmTab from '@/views/machine/testScript/components/testScriptInHarmTab.vue';
|
import TestScriptInHarmTab from '@/views/machine/testScript/components/testScriptInHarmTab.vue'
|
||||||
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue';
|
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue'
|
||||||
import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue';
|
import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { addScriptDtls } from '@/api/device/testScript'
|
||||||
|
import scriptForm from './scriptForm'
|
||||||
|
import { on } from 'events'
|
||||||
|
|
||||||
|
const emit = defineEmits(['addTab', 'close', 'getCommunication'])
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const props = defineProps({
|
||||||
|
options: {
|
||||||
|
type: [Array, Object],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
activeName: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
childActiveName: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
formContent: {
|
||||||
|
type: [Object, Array],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
communicationList: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const copyRowList = ref({})
|
||||||
|
const key = ref(0)
|
||||||
|
// let valueType
|
||||||
|
const showSetValueTable = ref(false)
|
||||||
|
const form: any = ref(JSON.parse(JSON.stringify(scriptForm)))
|
||||||
|
const childForm: any = ref([])
|
||||||
|
const ScriptValueType = ref('')
|
||||||
|
const initial = ref(0) //轮播图索引
|
||||||
|
const carouselRef = ref()
|
||||||
|
const setValueTableRef = ref()
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const dialogTitle = ref()
|
const dialogTitle = ref()
|
||||||
const setValueTable = ref()
|
const valueCode = ref('') //Absolute绝对值
|
||||||
const buttonTypeOptions = ['default', 'text', 'success', 'warning', 'info', 'primary', 'danger'] as const;
|
|
||||||
type ButtonType = typeof buttonTypeOptions[number];
|
|
||||||
// 初始化按钮类型
|
|
||||||
const buttonTypes = reactive<{ [key: number]: { channel: ButtonType, harmonic: ButtonType, interHarmonic: ButtonType, flicker: ButtonType, transient: ButtonType } }>({});
|
|
||||||
|
|
||||||
|
const tableData = [
|
||||||
|
{ name: 'L1', frequency: 'Ua', type: 'V', electricity: 0, fphase: 0, sort: 0 },
|
||||||
|
{ name: 'L1', frequency: 'Ia', type: 'I', electricity: 0, fphase: 0, sort: 0 },
|
||||||
|
{ name: 'L2', frequency: 'Ub', type: 'V', electricity: 0, fphase: 0, sort: 1 },
|
||||||
|
{ name: 'L2', frequency: 'Ib', type: 'I', electricity: 0, fphase: 0, sort: 1 },
|
||||||
|
{ name: 'L3', frequency: 'Uc', type: 'V', electricity: 0, fphase: 0, sort: 2 },
|
||||||
|
{ name: 'L3', frequency: 'Ic', type: 'I', electricity: 0, fphase: 0, sort: 2 }
|
||||||
|
]
|
||||||
|
|
||||||
const tableData= [
|
const tabChildren: any = ref([])
|
||||||
{ sort: 'L1', frequency: 'V', L1: '电压:57.75V 相角:0°'},
|
|
||||||
{ sort: 'L1', frequency: 'I', L1: '电压:57.75V 相角:0°'},
|
|
||||||
{ sort: 'L2', frequency: 'V', L1: '电压:57.75V 相角:0°'},
|
|
||||||
{ sort: 'L2', frequency: 'I', L1: '电压:57.75V 相角:0°'},
|
|
||||||
{ sort: 'L3', frequency: 'V', L1: '电压:57.75V 相角:0°'},
|
|
||||||
{ sort: 'L3', frequency: 'I', L1: '电压:57.75V 相角:0°'},
|
|
||||||
]
|
|
||||||
|
|
||||||
// 定义 span-method 逻辑
|
// 定义 span-method 逻辑
|
||||||
const arraySpanMethod = ({ rowIndex, columnIndex }: { rowIndex: number; columnIndex: number }) => {
|
const arraySpanMethod = ({ rowIndex, columnIndex }: { rowIndex: number; columnIndex: number }) => {
|
||||||
if (columnIndex === 0 || columnIndex === 3) { // 第一列
|
if (columnIndex === 0 || columnIndex === 3) {
|
||||||
|
// 第一列
|
||||||
if (rowIndex % 2 === 0) {
|
if (rowIndex % 2 === 0) {
|
||||||
return {
|
return {
|
||||||
rowspan: 2,
|
rowspan: 2,
|
||||||
colspan: 1
|
colspan: 1
|
||||||
};
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
rowspan: 0,
|
rowspan: 0,
|
||||||
colspan: 0
|
colspan: 0
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
const selectedRow = ref('')
|
||||||
|
const tableStyle = {
|
||||||
|
cellStyle: ({ row }: { row: any }) => {
|
||||||
|
return row.name === selectedRow.value
|
||||||
|
? { backgroundColor: '#dcdcdc' } // 设置选中行的背景颜色
|
||||||
|
: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const handleRowClick = async (row: any, column: any) => {
|
||||||
|
if (column.label == '相别' || column.label == '操作') {
|
||||||
|
childForm.value = []
|
||||||
|
selectedRow.value = row.name
|
||||||
|
childForm.value.push(form.value.channelList[row.sort * 2])
|
||||||
|
childForm.value.push(form.value.channelList[row.sort * 2 + 1])
|
||||||
|
console.log('🚀 ~ handleRowClick ~ childForm.value:', childForm.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// childForm.value = row
|
||||||
// 切换按钮类型
|
}
|
||||||
const toggleType = (row: any, $index: number, buttonType: 'channel' | 'harmonic' | 'interHarmonic' | 'flicker' | 'transient') => {
|
|
||||||
if ($index !== undefined) {
|
|
||||||
const currentType = buttonTypes[$index][buttonType];
|
|
||||||
buttonTypes[$index][buttonType] = currentType === 'info' ? 'primary' : 'info';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
// 设置持续时间
|
||||||
|
const setRetainTime = (val: any) => {
|
||||||
|
form.value.channelList.forEach((item: any) => {
|
||||||
|
item.dipData.retainTime = val
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
const save = () => {
|
const save = () => {
|
||||||
|
let copyForm = handleHarmData()
|
||||||
|
copyForm.checkDataList = setValueTableRef.value?.getTableData()
|
||||||
|
if (copyForm.checkDataList.some(item => item.value === null || item.value === '')) {
|
||||||
|
return ElMessage.warning({
|
||||||
|
message: '请填写所有参考设定值',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
addScriptDtls({ ...copyForm, scriptId: props.formContent.id, scriptType: props.activeName }).then(res => {
|
||||||
|
if (res.code === 'A0000') {
|
||||||
|
ElMessage.success({
|
||||||
|
message: dialogTitle.value == '新增检测项目信息' ? '添加检测脚本成功!' : '编辑检测脚本成功!',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
dialogVisible.value = false
|
||||||
|
emit('addTab', form.value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// emit('addTab', form.value)
|
||||||
|
}
|
||||||
|
// 上一步
|
||||||
|
const previous = () => {
|
||||||
|
carouselRef.value.setActiveItem(0)
|
||||||
|
showSetValueTable.value = false
|
||||||
|
}
|
||||||
|
// 下一步
|
||||||
|
const next = () => {
|
||||||
|
emit('getCommunication')
|
||||||
|
setTimeout(() => {
|
||||||
|
// 判断通讯脚本
|
||||||
|
if (form.value.ffreq == '') {
|
||||||
|
ElMessage.warning({
|
||||||
|
message: '请填写频率!',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let { flag, message } = checkFlags()
|
||||||
|
// // 判断勾选通道
|
||||||
|
if (!flag) {
|
||||||
|
ElMessage.warning({
|
||||||
|
message: message,
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
showSetValueTable.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
setValueTableRef.value?.open(props.communicationList, copyRowList.value)
|
||||||
|
|
||||||
|
carouselRef.value.setActiveItem(1)
|
||||||
|
}, 100)
|
||||||
|
}, 100)
|
||||||
|
// 切换轮播图
|
||||||
|
}
|
||||||
|
// 重新计算
|
||||||
|
const recalculation = () => {
|
||||||
|
setValueTableRef.value?.open(props.communicationList, {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断勾选通道
|
||||||
|
const checkFlags = () => {
|
||||||
|
let list: any = []
|
||||||
|
let flag = true
|
||||||
|
let message = ''
|
||||||
|
props.communicationList.forEach((item: any) => {
|
||||||
|
list.push(...item.children.filter((item: any) => item.enable != 0 || item.errorFlag != 0))
|
||||||
|
})
|
||||||
|
|
||||||
|
for (const item of list) {
|
||||||
|
switch (item.pname) {
|
||||||
|
case '频率':
|
||||||
|
flag = form.value.channelList.some(item => item.channelFlag == true)
|
||||||
|
message = '请选择通道使能'
|
||||||
|
break
|
||||||
|
case '电压':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].channelFlag == false &&
|
||||||
|
form.value.channelList[2].channelFlag == false &&
|
||||||
|
form.value.channelList[4].channelFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中勾选了电压,请选择电压通道使能' }
|
||||||
|
|
||||||
|
break
|
||||||
|
case '谐波电压':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].harmFlag == false &&
|
||||||
|
form.value.channelList[2].harmFlag == false &&
|
||||||
|
form.value.channelList[4].harmFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中勾选了谐波电压,请选择谐波电压通道使能' }
|
||||||
|
break
|
||||||
|
case '谐波电流':
|
||||||
|
if (
|
||||||
|
form.value.channelList[1].harmFlag == false &&
|
||||||
|
form.value.channelList[3].harmFlag == false &&
|
||||||
|
form.value.channelList[5].harmFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中勾选了谐波电流,请选择谐波电流通道使能' }
|
||||||
|
break
|
||||||
|
case '谐波有功功率':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].harmFlag == false &&
|
||||||
|
form.value.channelList[1].harmFlag == false &&
|
||||||
|
form.value.channelList[2].harmFlag == false &&
|
||||||
|
form.value.channelList[3].harmFlag == false &&
|
||||||
|
form.value.channelList[4].harmFlag == false &&
|
||||||
|
form.value.channelList[5].harmFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中勾选了谐波有功功率,请选择间电压、电流谐波通道使能' }
|
||||||
|
break
|
||||||
|
case '间谐波电压':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].inHarmFlag == false &&
|
||||||
|
form.value.channelList[2].inHarmFlag == false &&
|
||||||
|
form.value.channelList[4].inHarmFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中勾选了间谐波电压,请选择间谐波电压通道使能' }
|
||||||
|
break
|
||||||
|
case '间谐波电流':
|
||||||
|
if (
|
||||||
|
form.value.channelList[1].inHarmFlag == false &&
|
||||||
|
form.value.channelList[3].inHarmFlag == false &&
|
||||||
|
form.value.channelList[5].inHarmFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中勾选了间谐波电流,请选择间谐波电流通道使能' }
|
||||||
|
break
|
||||||
|
case '暂态':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].dipFlag == false &&
|
||||||
|
form.value.channelList[2].dipFlag == false &&
|
||||||
|
form.value.channelList[4].dipFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中勾选了暂态,请选择电压暂态通道使能' }
|
||||||
|
break
|
||||||
|
case '电流':
|
||||||
|
if (
|
||||||
|
form.value.channelList[1].channelFlag == false &&
|
||||||
|
form.value.channelList[3].channelFlag == false &&
|
||||||
|
form.value.channelList[5].channelFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中勾选了电流,请选择电流通道使能' }
|
||||||
|
break
|
||||||
|
case '三相电压不平衡度':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].channelFlag == false ||
|
||||||
|
form.value.channelList[2].channelFlag == false ||
|
||||||
|
form.value.channelList[4].channelFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中勾选了三相电压不平衡度,请选择电压A、B、C通道使能' }
|
||||||
|
break
|
||||||
|
case '三相电流不平衡度':
|
||||||
|
if (
|
||||||
|
form.value.channelList[1].channelFlag == false ||
|
||||||
|
form.value.channelList[3].channelFlag == false ||
|
||||||
|
form.value.channelList[5].channelFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中勾选了三相电流不平衡度,请选择电流A、B、C通道使能' }
|
||||||
|
break
|
||||||
|
case '闪变':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].flickerFlag == false &&
|
||||||
|
form.value.channelList[2].flickerFlag == false &&
|
||||||
|
form.value.channelList[4].flickerFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中勾选了闪变,请选择电压闪变通道使能' }
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let index = 0; index < form.value.channelList.length; index++) {
|
||||||
|
const item = form.value.channelList[index]
|
||||||
|
const result = checkChannelValues(item, index)
|
||||||
|
|
||||||
|
if (!result.flag) {
|
||||||
|
flag = result.flag
|
||||||
|
message = result.message
|
||||||
|
break // 如果发现错误,直接退出循环
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { flag, message }
|
||||||
|
}
|
||||||
|
// 判断通道值
|
||||||
|
const checkChannelValues = (item: any, index: number) => {
|
||||||
|
const channelNames = ['L1/Ua', 'L1/Ia', 'L2/Ub', 'L2/Ib', 'L3/Uc', 'L3/Ic']
|
||||||
|
const channelName = channelNames[index] || ''
|
||||||
|
|
||||||
|
// 检查通道使能
|
||||||
|
if (item.channelFlag === false && (item.harmFlag || item.inHarmFlag || item.flickerFlag || item.dipFlag)) {
|
||||||
|
return { flag: false, message: `请选择${channelName}通道使能` }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查通道使能值
|
||||||
|
if (item.channelFlag === true && (item.famp === '' || item.fphase === '')) {
|
||||||
|
return { flag: false, message: '请填写通道使能值' }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查谐波使能值
|
||||||
|
if (item.harmFlag === true && item.harmList.filter(harm => harm.famp != 0 || harm.fphase != 0).length == 0) {
|
||||||
|
return { flag: false, message: '请填写谐波使能值' }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查间谐波使能值
|
||||||
|
if (
|
||||||
|
item.inHarmFlag === true &&
|
||||||
|
item.inharmList.filter(harm => harm.inharm !== '' || harm.famp !== 0 || harm.fphase !== 0).length === 0
|
||||||
|
) {
|
||||||
|
return { flag: false, message: '请填写间谐波使能值' }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查闪变使能值
|
||||||
|
if (
|
||||||
|
item.flickerFlag === true &&
|
||||||
|
(item.flickerData.fchagFre === '' || item.flickerData.fchagValue === '') &&
|
||||||
|
index != 1 &&
|
||||||
|
index != 3 &&
|
||||||
|
index != 5
|
||||||
|
) {
|
||||||
|
return { flag: false, message: '请填写闪变使能值' }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查暂态使能值
|
||||||
|
if (
|
||||||
|
item.dipFlag === true &&
|
||||||
|
(item.dipData.ftransValue === '' || item.dipData.retainTime === '') &&
|
||||||
|
index != 1 &&
|
||||||
|
index != 3 &&
|
||||||
|
index != 5
|
||||||
|
) {
|
||||||
|
return { flag: false, message: '请填写暂态使能值' }
|
||||||
|
}
|
||||||
|
|
||||||
|
return { flag: true, message: '' }
|
||||||
|
}
|
||||||
|
//处理谐波数据
|
||||||
|
const handleHarmData = () => {
|
||||||
|
let copyForm = JSON.parse(JSON.stringify(form.value))
|
||||||
|
|
||||||
|
copyForm.channelList.forEach((channel: any) => {
|
||||||
|
// 筛选出 famp 和 fphase 不同时为 0 的对象
|
||||||
|
channel.harmList = channel.harmList.filter((item: any) => item.famp != 0 || item.fphase != 0)
|
||||||
|
channel.inharmList = channel.inharmList.filter(
|
||||||
|
(item: any) => item.inharm !== '' || item.famp !== 0 || item.fphase !== 0
|
||||||
|
)
|
||||||
|
})
|
||||||
|
return copyForm
|
||||||
|
}
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = (sign: string,row: any) => {
|
const open = (sign: string, row: any) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = sign === 'add'? '新增检测项目信息' : '编辑检测项目信息'
|
valueCode.value = dictStore
|
||||||
|
.getDictData('Script_Value_Type')
|
||||||
|
.filter(item => item.id == props.formContent.valueType)[0].code
|
||||||
|
dialogTitle.value = sign === 'add' ? '新增检测项目信息' : '编辑检测项目信息'
|
||||||
|
// 添加选择检测项目
|
||||||
|
tabChildren.value = JSON.parse(
|
||||||
|
JSON.stringify(props.options.filter(item => item.value == props.activeName)[0].children || [])
|
||||||
|
)
|
||||||
|
|
||||||
// 初始化按钮类型
|
// 判断是否存在 code 在 targetCodes 中
|
||||||
tableData.forEach((_, index) => {
|
const hasTargetCode = tabChildren.value.some(item =>
|
||||||
buttonTypes[index] = {
|
['Base_0_10', 'Base_20_85', 'Base_110_200'].includes(item.code)
|
||||||
channel: 'info',
|
)
|
||||||
harmonic: 'info',
|
if (hasTargetCode) {
|
||||||
interHarmonic: 'info',
|
tabChildren.value.unshift({
|
||||||
flicker: 'info',
|
code: 'Base',
|
||||||
transient: 'info'
|
label: '额定工作条件下的检测',
|
||||||
};
|
value: '999999999999999999'
|
||||||
});
|
})
|
||||||
|
tabChildren.value = tabChildren.value.filter(
|
||||||
|
item => item.code !== 'Base_0_10' && item.code !== 'Base_20_85' && item.code !== 'Base_110_200'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// subType.value = tabChildren.value[0].code || ''
|
||||||
|
if (sign == 'add') {
|
||||||
|
form.value.subType =
|
||||||
|
props.childActiveName == ''
|
||||||
|
? JSON.parse(JSON.stringify(tabChildren.value[0].code)) || ''
|
||||||
|
: JSON.parse(JSON.stringify(props.childActiveName))
|
||||||
|
|
||||||
|
if (valueCode.value == 'Absolute') {
|
||||||
|
form.value.channelList.forEach((item: any) => {
|
||||||
|
item.famp = 0
|
||||||
|
item.fphase = 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
form.value = JSON.parse(JSON.stringify(row))
|
||||||
|
copyRowList.value = JSON.parse(JSON.stringify(row))
|
||||||
|
}
|
||||||
|
if (['Base_0_10', 'Base_20_85', 'Base_110_200'].includes(form.value.subType)) {
|
||||||
|
form.value.subType = 'Base'
|
||||||
|
}
|
||||||
|
|
||||||
|
handleRowClick({ name: 'L1', sort: 0 }, { label: '相别' })
|
||||||
|
dictStore.getDictData('Script_Value_Type')
|
||||||
|
//console.log('🚀 ~ open ~ tabChildren.value:', tabChildren.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断后台没有谐波,简谐波值 用于回显
|
||||||
|
|
||||||
|
const setharmList = (row: any) => {
|
||||||
|
row.channelList.forEach((item: any) => {
|
||||||
|
if (item.inharmList.length == 0) {
|
||||||
|
item.inharmList.push({ inharm: '', famp: 0, fphase: 0 })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return row
|
||||||
|
}
|
||||||
|
// 复制
|
||||||
|
const copyRow = (num: number, index: number) => {
|
||||||
|
form.value.channelList[index] = JSON.parse(JSON.stringify(form.value.channelList[num]))
|
||||||
|
form.value.channelList[index + 1] = JSON.parse(JSON.stringify(form.value.channelList[num + 1]))
|
||||||
|
form.value.channelList[0].channelType = 'Ua'
|
||||||
|
form.value.channelList[1].channelType = 'Ia'
|
||||||
|
form.value.channelList[2].channelType = 'Ub'
|
||||||
|
form.value.channelList[3].channelType = 'Ib'
|
||||||
|
form.value.channelList[4].channelType = 'Uc'
|
||||||
|
form.value.channelList[5].channelType = 'Ic'
|
||||||
|
key.value += 1
|
||||||
|
ElMessage.success({
|
||||||
|
message: '复制成功!',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const validateFreq = () => {
|
||||||
|
if (form.value.ffreq < 40) {
|
||||||
|
ElMessage.warning('频率不能低于40Hz')
|
||||||
|
form.value.ffreq = 40
|
||||||
|
} else if (form.value.ffreq > 60) {
|
||||||
|
ElMessage.warning('频率不能高于60Hz')
|
||||||
|
form.value.ffreq = 60
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 点击使能按钮
|
||||||
|
const handleHarmFlag = (e: boolean, i: number) => {
|
||||||
|
if (e) {
|
||||||
|
form.value.channelList[i].channelFlag = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = () => {
|
const openDialog = () => {}
|
||||||
setValueTable.value?.open()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
@@ -183,7 +665,6 @@ defineExpose({ open })
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
height: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs-container {
|
.tabs-container {
|
||||||
@@ -194,12 +675,12 @@ defineExpose({ open })
|
|||||||
}
|
}
|
||||||
|
|
||||||
.left-tabs {
|
.left-tabs {
|
||||||
flex: 3; /* 左侧 tab 占据 3/4 的宽度 */
|
width: 900px;
|
||||||
margin-right: 10px; /* 可选:添加间距 */
|
margin: 0 10px; /* 可选:添加间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-tabs {
|
.right-tabs {
|
||||||
flex: 1; /* 右侧 tab 占据 1/4 的宽度 */
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-item-container {
|
.form-item-container {
|
||||||
@@ -225,5 +706,20 @@ defineExpose({ open })
|
|||||||
.input-label-container label {
|
.input-label-container label {
|
||||||
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
||||||
}
|
}
|
||||||
|
:deep(.el-carousel__indicators) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
:deep(.el-carousel__arrow) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
:deep(.el-tabs--border-card > .el-tabs__content) {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
:deep(.el-table__body) {
|
||||||
|
border-top: var(--el-table-border);
|
||||||
|
}
|
||||||
|
:deep(.el-checkbox-button.is-disabled .el-checkbox-button__inner) {
|
||||||
|
background-color: var(--el-color-primary);
|
||||||
|
color: var(--el-color-white);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user