Compare commits
327 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
ddeb84fcfe | ||
|
|
b3aeebb7c7 | ||
|
|
b11f4839f4 | ||
|
|
4adc28a055 | ||
|
|
e46e9e1d3a | ||
|
|
4fcb26bbde | ||
|
|
6bd0e891fa | ||
|
|
15f1308557 | ||
|
|
9689197db9 | ||
|
|
4ad490657f | ||
|
|
9f8f8244e3 | ||
|
|
9206be2562 | ||
|
|
6065fd1f67 | ||
|
|
c16560a0ca | ||
|
|
440cfe1ac5 | ||
|
|
1ad1a0198e | ||
|
|
b603ac9bdb | ||
|
|
68aa4c409b | ||
|
|
f22b4e7fb8 | ||
|
|
400328d5fa | ||
|
|
cce3e6861a | ||
|
|
55368ce9b8 | ||
|
|
c6ef54f7d3 | ||
| 6f97c48226 | |||
| 5f45bc98fb | |||
|
|
5738594be2 | ||
|
|
ce47831992 | ||
| 634c2d84fc | |||
| 70855c5a21 | |||
|
|
b1e5e70411 | ||
|
|
bf2e3219fc | ||
|
|
2f5aeb9ffc | ||
| 9e8ed310fc | |||
| 07a5e32579 | |||
|
|
fe1bb04922 | ||
| a75e964adc | |||
|
|
87d22032e6 | ||
|
|
55ae64b3e1 | ||
|
|
891c6d8e93 | ||
|
|
ba7747dfe9 | ||
| b148c04059 | |||
|
|
4e179d61b5 | ||
|
|
b23ee84543 | ||
|
|
d02f85cea5 | ||
| ab02f8f1b3 | |||
| 8fc1d1ffc9 | |||
|
|
44b1da94c1 | ||
|
|
c2b63a7a3f | ||
|
|
56619c9140 | ||
|
|
99bbb5434d | ||
| 40c9c5fdad | |||
|
|
3ea2c93e43 | ||
|
|
6369c8ee63 | ||
|
|
da4bbf1e2c | ||
|
|
14e5535fd8 | ||
|
|
4e53bb3b27 | ||
| e793fdbe42 | |||
| 0e41a5b9f1 | |||
|
|
ac9dfd1669 | ||
|
|
72eb3e189b | ||
| 0cace11975 | |||
| b8e502b168 | |||
|
|
15502d0107 | ||
| cb4e4646bd | |||
| 93ce1b4994 | |||
|
|
1c452b5574 | ||
|
|
876c06ef54 | ||
|
|
37d65a944d | ||
|
|
7bc9321c86 | ||
|
|
ee564dccb6 | ||
| cdbb386c7c | |||
| 325ade7cdc | |||
|
|
fcd8c1a0dd | ||
|
|
fa1cb02a51 | ||
|
|
40fe12cd96 | ||
|
|
d83c04dc8b | ||
|
|
23b2974597 | ||
|
|
f5e78316ef | ||
|
|
cc2020f3d6 | ||
|
|
26cda335c5 | ||
|
|
171533cef0 | ||
|
|
69de6dd7a3 | ||
|
|
9039ed4bdc | ||
|
|
131d3b7018 | ||
|
|
454aabdc97 | ||
|
|
089c97d859 | ||
|
|
9ff5423368 | ||
|
|
f29d6e8d88 | ||
|
|
5199ee2db0 | ||
|
|
6de9e22b4c | ||
|
|
52968d9aaa | ||
|
|
b584142f5e | ||
|
|
edea30a406 | ||
|
|
1f3024eb91 | ||
| 8b9abba74b | |||
|
|
4dec1392f7 | ||
|
|
e54cbfbc0a | ||
|
|
505cd93446 | ||
|
|
f3ee11ebab | ||
|
|
45295ef898 | ||
|
|
0635dda6a0 | ||
|
|
f58f7b97e5 | ||
|
|
7556f0e5bc | ||
|
|
17fe29cb1b | ||
|
|
4bb4eb80d9 | ||
| ae1507e775 | |||
|
|
85d8a57bf7 | ||
|
|
42cf23a516 | ||
|
|
858cf75b46 | ||
|
|
de8a392d2c | ||
|
|
b614767b2d | ||
|
|
5ebb8549bf | ||
|
|
ead1feb379 | ||
|
|
1474c15bd9 | ||
|
|
f24f87dcc8 | ||
|
|
d416f46b3a | ||
| 352df35205 | |||
|
|
e5f201515e | ||
|
|
40520a7d30 | ||
|
|
cffbfe1380 | ||
|
|
839777ea4d | ||
|
|
5be1d22115 | ||
|
|
80d1912fd5 | ||
|
|
b94e0323d9 | ||
|
|
90f4e53e9f | ||
|
|
7ebad7d6b9 | ||
|
|
34534a1dbf | ||
| 645fac0681 | |||
| 0a23700403 | |||
|
|
c00f8843c0 | ||
|
|
8869974471 | ||
|
|
8125d60105 | ||
|
|
5a32d5b7a8 | ||
|
|
a1d113562b | ||
|
|
4a7535e4f5 | ||
|
|
de5548bbbd | ||
|
|
87c46e8477 | ||
|
|
edda224847 | ||
|
|
5ac6bbf04b | ||
|
|
b0a5329937 | ||
|
|
7a0626413d | ||
| fe04ad1573 | |||
|
|
689cc39bbc | ||
|
|
ba0c577514 | ||
|
|
a629907196 | ||
|
|
bf60bcfe12 | ||
|
|
27eb9a7d93 | ||
|
|
336ee843cc | ||
|
|
9eac101794 | ||
|
|
085fcc62aa | ||
|
|
99e6abbcfd | ||
| a4b96066e0 | |||
|
|
c4e2da8d67 | ||
|
|
1be15ee849 | ||
|
|
99bc54349b | ||
|
|
bf823ddff0 | ||
|
|
23e72f38a6 | ||
|
|
2d993b2f73 | ||
| 9703d35a3a | |||
|
|
d10a7a4884 | ||
|
|
938b9054d3 |
@@ -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);
|
|
||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
|
"Analyse",
|
||||||
|
"CHNFACTOR",
|
||||||
|
"CHNPACTOR",
|
||||||
"Chns",
|
"Chns",
|
||||||
"Combox",
|
"Combox",
|
||||||
"Datasource",
|
"Datasource",
|
||||||
@@ -14,6 +17,7 @@
|
|||||||
"Pids",
|
"Pids",
|
||||||
"plandata",
|
"plandata",
|
||||||
"PQDIF",
|
"PQDIF",
|
||||||
|
"Preinvestment",
|
||||||
"resourcedata",
|
"resourcedata",
|
||||||
"resourcename",
|
"resourcename",
|
||||||
"rmark",
|
"rmark",
|
||||||
|
|||||||
@@ -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,6 +22,7 @@
|
|||||||
"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",
|
||||||
@@ -41,11 +42,13 @@
|
|||||||
"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/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",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
:size='assemblySize'
|
:size='assemblySize'
|
||||||
:button='buttonConfig'
|
:button='buttonConfig'
|
||||||
>
|
>
|
||||||
<router-view :key='$route.fullPath' />
|
<router-view />
|
||||||
</el-config-provider>
|
</el-config-provider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1,79 +1,149 @@
|
|||||||
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,
|
||||||
monitorIdx: string,
|
chnNum: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PhaseCheckResult {
|
||||||
|
// 检测源定值-标准值
|
||||||
|
resultData: number,
|
||||||
|
// 装置原始数据-被检值
|
||||||
|
data: number,
|
||||||
|
|
||||||
|
|
||||||
|
// 第几次谐波
|
||||||
|
num?: number,
|
||||||
|
//符合、不符合
|
||||||
|
isData?: number,
|
||||||
|
//最大误差值
|
||||||
|
radius?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用于定义 查看(设备)通道检测结果 类型
|
* 用于定义 查看(设备)通道检测结果响应数据 类型
|
||||||
|
*/
|
||||||
|
export interface ResCheckResult {
|
||||||
|
dataA?: PhaseCheckResult | null,
|
||||||
|
dataB?: PhaseCheckResult | null,
|
||||||
|
dataC?: PhaseCheckResult | null,
|
||||||
|
dataT?: PhaseCheckResult | null,
|
||||||
|
|
||||||
|
// 第几次谐波
|
||||||
|
//num: number | null,
|
||||||
|
//符合、不符合
|
||||||
|
isData?: number,
|
||||||
|
//最大误差值
|
||||||
|
radius?: string,
|
||||||
|
//单位
|
||||||
|
unit?: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于定义 查看(设备)通道检测结果表格展示数据 类型
|
||||||
*/
|
*/
|
||||||
export interface CheckResult {
|
export interface CheckResult {
|
||||||
chnNum: string,
|
stdA?: string,
|
||||||
standardValue: number,
|
dataA?: string,
|
||||||
A?: number,
|
errorA?: string,
|
||||||
A_errValue?: number,
|
maxErrorA?: string,
|
||||||
B?: number,
|
isDataA?: number,
|
||||||
B_errValue?: number,
|
stdB?: string,
|
||||||
C?: number,
|
dataB?: string,
|
||||||
C_errValue?: number,
|
errorB?: string,
|
||||||
T?: number,
|
maxErrorB?: string,
|
||||||
T_errValue?: number,
|
isDataB?: number,
|
||||||
maxErrVaule: number,
|
stdC?: string,
|
||||||
result: string,
|
dataC?: string,
|
||||||
|
errorC?: string,
|
||||||
|
maxErrorC?: string,
|
||||||
|
isDataC?: number,
|
||||||
|
stdT?: string,
|
||||||
|
dataT?: string,
|
||||||
|
errorT?: string,
|
||||||
|
maxErrorT?: string,
|
||||||
|
isDataT?: number,
|
||||||
|
|
||||||
|
//最大误差值
|
||||||
|
maxError?: string,
|
||||||
|
unit?: string,
|
||||||
|
//符合、不符合
|
||||||
|
result?: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用于定义 具体通道的原始数据类型
|
* 用于定义 具体通道的原始数据类型
|
||||||
*/
|
*/
|
||||||
export interface RawDataItem {
|
export interface RawDataItem {
|
||||||
updateTime: string,
|
time?: string,
|
||||||
A?: number,
|
harmNum?: number | null,
|
||||||
B?: number,
|
dataA?: string,
|
||||||
C?: number
|
dataB?: string,
|
||||||
T?: number
|
dataC?: string,
|
||||||
|
dataT?: string,
|
||||||
|
unit?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Device {
|
export interface Device {
|
||||||
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; //是否支持系数校准
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用来描述检测脚本类型
|
// 用来描述检测脚本类型
|
||||||
export interface ScriptItem{
|
export interface ScriptItem {
|
||||||
|
id: string,
|
||||||
|
code: string,
|
||||||
scriptName: string,
|
scriptName: string,
|
||||||
scriptType?: string,
|
|
||||||
children?: ScriptItem1[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 用来描述 检测数据-左侧树结构
|
||||||
|
export interface TreeItem {
|
||||||
|
id:string | null,
|
||||||
|
scriptTypeName: string | null,
|
||||||
|
sourceDesc: string | null,
|
||||||
|
harmNum: number | null,
|
||||||
|
index: number | null,
|
||||||
|
fly: number | null,
|
||||||
|
children: TreeItem[] | null,
|
||||||
|
}
|
||||||
|
|
||||||
// 用来描述 通道检测结果
|
// 用来描述 通道检测结果
|
||||||
export enum ChnCheckResultEnum {
|
export enum ChnCheckResultEnum {
|
||||||
UNKNOWN = -1,
|
UNKNOWN = -1,
|
||||||
LOADING = 0,
|
LOADING = 0,
|
||||||
SUCCESS = 1,
|
SUCCESS = 1,
|
||||||
FAIL = 2,
|
FAIL = 2,
|
||||||
UNCONNECTED = 3,
|
TIMEOUT = 3,
|
||||||
ERRORDATA = 4
|
ERRORDATA = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DeviceCheckResult {
|
||||||
|
deviceId: string,
|
||||||
|
deviceName: string,
|
||||||
|
chnResult: ChnCheckResultEnum[] //通道检测结果
|
||||||
|
}
|
||||||
|
|
||||||
//用来描述 某个脚本测试项对所有通道的检测结果
|
//用来描述 某个脚本测试项对所有通道的检测结果
|
||||||
export interface ScriptChnItem {
|
export interface ScriptChnItem {
|
||||||
scriptType: string
|
scriptType: string
|
||||||
scriptName?: string //可以不要该属性,有点多余
|
scriptName?: string //可以不要该属性,有点多余
|
||||||
|
|
||||||
// 设备
|
// 设备
|
||||||
devices: Array<{
|
devices: Array<DeviceCheckResult>
|
||||||
deviceId: string,
|
|
||||||
deviceName: string,
|
|
||||||
chnResult: ChnCheckResultEnum[] //通道检测结果
|
|
||||||
}>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ButtonColorEnum {
|
export enum ButtonColorEnum {
|
||||||
INFO = '#909399',
|
INFO = '#909399',
|
||||||
LOADING = '#607eab',
|
LOADING = '#003078',
|
||||||
SUCCESS = '#67c23a',
|
SUCCESS = '#67c23a',
|
||||||
WARNING = '#e6a23c',
|
WARNING = '#e6a23c',
|
||||||
DANGER = '#f56c6c',
|
DANGER = '#f56c6c',
|
||||||
@@ -110,6 +180,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,7 +1,12 @@
|
|||||||
import http from "@/api";
|
import http from "@/api";
|
||||||
|
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,
|
||||||
|
devId: string,
|
||||||
|
}) => {
|
||||||
|
return http.post(`/adPlan/getBigTestItem`, params, {loading: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,13 +27,13 @@ export const getFormData = (params: {
|
|||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const getTreeData = (params: {
|
export const getTreeData = (params: {
|
||||||
scriptId: string,
|
scriptId?: string,
|
||||||
deviceId: string,
|
devId?: string,
|
||||||
devNum: string,
|
devNum?: string,
|
||||||
scriptType: string | null,
|
scriptType?: string | null,
|
||||||
code: string
|
code?: number,
|
||||||
}) => {
|
}) => {
|
||||||
return http.post("/result/treeData/", params, {loading: false});
|
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,10 +41,23 @@ export const getTreeData = (params: {
|
|||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const getTableData = (params: {
|
export const getTableData = (params: {
|
||||||
|
scriptType: string | null,
|
||||||
scriptId: string,
|
scriptId: string,
|
||||||
deviceId: string,
|
devId: string,
|
||||||
chnNum: string,
|
devNum: string,
|
||||||
scriptType: string | null
|
code: number,
|
||||||
|
index: number,
|
||||||
}) => {
|
}) => {
|
||||||
return http.post("/result/tableData/", params, {loading: false});
|
return http.post("/result/resultData/", params, {loading: false});
|
||||||
|
}
|
||||||
|
|
||||||
|
export const exportRawData = (params: {
|
||||||
|
scriptType: string | null,
|
||||||
|
scriptId: string,
|
||||||
|
devId: string,
|
||||||
|
devNum: string,
|
||||||
|
code: number,
|
||||||
|
index: number,
|
||||||
|
}) => {
|
||||||
|
return http.download("/result/exportRawData", params, {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})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
29
frontend/src/api/device/devType/index.ts
Normal file
29
frontend/src/api/device/devType/index.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import type { DevType } from '@/api/device/interface/devType'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 设备类型管理模块
|
||||||
|
*/
|
||||||
|
|
||||||
|
//获取设备类型
|
||||||
|
export const getDevTypeList = (params: DevType.ReqPqDevTypeParams) => {
|
||||||
|
return http.post(`/devType/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加设备类型
|
||||||
|
export const addDevType = (params: DevType.ResPqDevType) => {
|
||||||
|
return http.post(`/devType/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑设备类型
|
||||||
|
export const updateDevType = (params: DevType.ResPqDevType) => {
|
||||||
|
return http.post(`/devType/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除设备类型
|
||||||
|
export const deleteDevType = (params: string[]) => {
|
||||||
|
return http.post(`/devType/delete`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -25,15 +25,39 @@ export const deletePqDev = (params: string[]) => {
|
|||||||
return http.post(`/pqDev/delete`, params)
|
return http.post(`/pqDev/delete`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
//导出被检设备
|
// export const downloadTemplate = () => {
|
||||||
export const exportPqDev=(params: Device.ReqPqDevParams)=>{
|
// return http.download(`/pqDev/downloadTemplate`)
|
||||||
return http.download(`/pqDev/export`, params)
|
// }
|
||||||
}
|
|
||||||
export const downloadTemplate = () => {
|
// //导入被检设备(比对)
|
||||||
return http.download(`/pqDev/downloadTemplate`)
|
// export const importPqDev=(params: Device.ReqPqDevParams)=>{
|
||||||
}
|
// return http.upload(`/pqDev/import`, params)
|
||||||
//导入被检设备
|
// }
|
||||||
export const importPqDev=(params: Device.ReqPqDevParams)=>{
|
// //导入比对式被检设备
|
||||||
return http.upload(`/pqDev/import`, params)
|
// export const importContrastPqDev=(params: Device.ReqPqDevParams)=>{
|
||||||
|
// return http.upload(`/pqDev/importContrast`, params)
|
||||||
|
// }
|
||||||
|
|
||||||
|
//导出灿能二楼设备
|
||||||
|
export const exportCNDev = (params: Device.ReqPqDevParams) => {
|
||||||
|
return http.download(`/pqDev/exportCNDev`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 下载灿能二楼设备导入文件模板
|
||||||
|
export const downloadCNDevTemplate = () => {
|
||||||
|
return http.download(`/pqDev/downloadCNDevTemplate`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//导入灿能二楼设备
|
||||||
|
export const importCNDev = (params: Device.ReqPqDevParams) => {
|
||||||
|
return http.uploadExcel(`/pqDev/importCNDev`, params)
|
||||||
|
}
|
||||||
|
//根据设备类型决定(电源、icd、模板、通道数、额定电压、额定电流);
|
||||||
|
export const getPqDev = () => {
|
||||||
|
return http.get(`/devType/listAll`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//被检设备归档
|
||||||
|
export const documentedPqDev = (ids: string[]) => {
|
||||||
|
return http.post(`/pqDev/documented`, ids)
|
||||||
|
}
|
||||||
|
|||||||
38
frontend/src/api/device/icd/index.ts
Normal file
38
frontend/src/api/device/icd/index.ts
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import type { ICD } from '@/api/device/interface/icd'
|
||||||
|
import http from '@/api'
|
||||||
|
import { pa } from 'element-plus/es/locale/index.mjs'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name ICD管理模块
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//获取ICD分页
|
||||||
|
export const getICDList = (params: ICD.ReqICDParams) => {
|
||||||
|
return http.post(`/icd/list`,params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取ICD
|
||||||
|
export const getICDAllList = (params: ICD.ResICD) => {
|
||||||
|
return http.get(`/icd/listAll`,params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加ICD
|
||||||
|
export const addICD = (params: ICD.ResICD) => {
|
||||||
|
return http.post(`/icd/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑ICD
|
||||||
|
export const updateICD = (params: ICD.ResICD) => {
|
||||||
|
return http.post(`/icd/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除ICD
|
||||||
|
export const deleteICD = (params: string[]) => {
|
||||||
|
return http.post(`/icd/delete`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
40
frontend/src/api/device/interface/devType.ts
Normal file
40
frontend/src/api/device/interface/devType.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
|
// 设备类型模块
|
||||||
|
export namespace DevType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型数据表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqPqDevTypeParams extends ReqPage {
|
||||||
|
id: string; // 装置序号id 必填
|
||||||
|
devType?: string; // 设备名称
|
||||||
|
createTime?: string; //创建时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResPqDevType {
|
||||||
|
id: string; //设备类型ID
|
||||||
|
name: string;//设备类型名称
|
||||||
|
icd: string| null;//设备关联的ICD
|
||||||
|
power: string| null;//工作电源
|
||||||
|
devVolt: number; //额定电压(V)
|
||||||
|
devCurr: number; //额定电流(A)
|
||||||
|
devChns: number; //设备通道数
|
||||||
|
reportName: string| null;//报告模版名称
|
||||||
|
state: number;
|
||||||
|
createBy?: string| null; //创建用户
|
||||||
|
createTime?: string| null; //创建时间
|
||||||
|
updateBy?: string| null; //更新用户
|
||||||
|
updateTime?: string| null; //更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResPqDevTypePage extends ResPage<ResPqDevType> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,14 @@ export namespace Device {
|
|||||||
pattern:string;
|
pattern:string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被检设备表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqDevReportParams extends ReqPage{
|
||||||
|
planId?:string; // 计划id
|
||||||
|
devId?:string; // 装置id
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 被检设备新增、修改、根据id查询返回的对象
|
* 被检设备新增、修改、根据id查询返回的对象
|
||||||
*/
|
*/
|
||||||
@@ -25,7 +33,7 @@ export namespace Device {
|
|||||||
devChns: number; //设备通道数
|
devChns: number; //设备通道数
|
||||||
devVolt: number; //额定电压(V)
|
devVolt: number; //额定电压(V)
|
||||||
devCurr: number; //额定电流(A)
|
devCurr: number; //额定电流(A)
|
||||||
manufacturer: string;//生产厂家
|
manufacturer?: string | null;//生产厂家
|
||||||
createDate: string; //生产日期
|
createDate: string; //生产日期
|
||||||
createId: string; //出厂编号
|
createId: string; //出厂编号
|
||||||
hardwareVersion: string; //固件版本
|
hardwareVersion: string; //固件版本
|
||||||
@@ -44,22 +52,36 @@ export namespace Device {
|
|||||||
checkState?: number| null; //检测状态
|
checkState?: number| null; //检测状态
|
||||||
checkResult?: number| null; //检测结果
|
checkResult?: number| null; //检测结果
|
||||||
reportState?: number| null; //报告状态
|
reportState?: number| null; //报告状态
|
||||||
documentState?: 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:符合)
|
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;
|
||||||
|
power: string| null;//工作电源
|
||||||
|
preinvestmentPlan: string| null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface ResDev{
|
||||||
|
id: string;
|
||||||
|
name: string ,
|
||||||
|
icd:string ,
|
||||||
|
power:string,
|
||||||
|
devVolt:number,
|
||||||
|
devCurr:number,
|
||||||
|
devChns:number,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 被检设备表格查询分页返回的对象;
|
* 被检设备表格查询分页返回的对象;
|
||||||
*/
|
*/
|
||||||
|
|||||||
35
frontend/src/api/device/interface/icd.ts
Normal file
35
frontend/src/api/device/interface/icd.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
|
// ICD模块
|
||||||
|
export namespace ICD {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ICD表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqICDParams extends ReqPage {
|
||||||
|
id: string; // 装置序号id 必填
|
||||||
|
devType?: string; // 设备名称
|
||||||
|
createTime?: string; //创建时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ICD新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResICD {
|
||||||
|
id: string; //icdID
|
||||||
|
name: string;//icd名称
|
||||||
|
path: string;//icd存储地址
|
||||||
|
state: number;
|
||||||
|
createBy?: string| null; //创建用户
|
||||||
|
createTime?: string| null; //创建时间
|
||||||
|
updateBy?: string| null; //更新用户
|
||||||
|
updateTime?: string| null; //更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ICD表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResICDPage extends ResPage<ResICD> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,11 +23,12 @@ export namespace TestScript {
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,21 +1,53 @@
|
|||||||
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}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除检测脚本
|
//删除检测脚本
|
||||||
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 })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ export const checkStatus = (status: number) => {
|
|||||||
case 400:
|
case 400:
|
||||||
ElMessage.error("请求失败!请您稍后重试");
|
ElMessage.error("请求失败!请您稍后重试");
|
||||||
break;
|
break;
|
||||||
case 401:
|
// case 401:
|
||||||
ElMessage.error("登录失效!请您重新登录");
|
// ElMessage.error("登录失效!请您重新登录");
|
||||||
break;
|
// break;
|
||||||
case 403:
|
case 403:
|
||||||
ElMessage.error("当前账号无权限访问!");
|
ElMessage.error("当前账号无权限访问!");
|
||||||
break;
|
break;
|
||||||
|
|||||||
6
frontend/src/api/home/channelsTest/index.ts
Normal file
6
frontend/src/api/home/channelsTest/index.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import http from "@/api";
|
||||||
|
|
||||||
|
//系数校准发送基本信息
|
||||||
|
export const getCoefficientCheck = (params: any) => {
|
||||||
|
return http.post(`/prepare/coefficientCheck`, params,{loading: false})
|
||||||
|
}
|
||||||
31
frontend/src/api/home/interface/channelsTest.ts
Normal file
31
frontend/src/api/home/interface/channelsTest.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// 系数校准模块
|
||||||
|
export namespace ChannelsTest {
|
||||||
|
|
||||||
|
// 系数校准列表
|
||||||
|
export interface CoefficientVO {
|
||||||
|
devName?: string;//设备名称
|
||||||
|
type?:string;//区分大小电压
|
||||||
|
monitorNum: string;//监测点序号
|
||||||
|
desc: string;//描述
|
||||||
|
aVuData:string;//电压通道A数据
|
||||||
|
aVuXi:string;//电压通道A系数
|
||||||
|
bVuData:string;//电压通道B数据
|
||||||
|
bVuXi:string;//电压通道B系数
|
||||||
|
cVuData:string;//电压通道C数据
|
||||||
|
cVuXi:string;//电压通道C系数
|
||||||
|
aIeData:string;//电流通道A数据
|
||||||
|
aIeXi:string;//电流通道A系数
|
||||||
|
bIeData:string;//电流通道B数据
|
||||||
|
bIeXi:string;//电流通道B系数
|
||||||
|
cIeData:string;//电流通道C数据
|
||||||
|
cIeXi:string;//电流通道C系数
|
||||||
|
loading: boolean;
|
||||||
|
aV:string;
|
||||||
|
bV:string;
|
||||||
|
cV:string;
|
||||||
|
aI:string;
|
||||||
|
bI:string;
|
||||||
|
cI:string;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { ElMessage, ElTreeSelect } from 'element-plus';
|
||||||
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from 'axios'
|
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from 'axios'
|
||||||
import { showFullScreenLoading, tryHideFullScreenLoading } from '@/components/Loading/fullScreen'
|
import { showFullScreenLoading, tryHideFullScreenLoading } from '@/components/Loading/fullScreen'
|
||||||
import { LOGIN_URL } from '@/config'
|
import { LOGIN_URL } from '@/config'
|
||||||
@@ -7,6 +8,7 @@ import { ResultEnum } from '@/enums/httpEnum'
|
|||||||
import { checkStatus } from './helper/checkStatus'
|
import { checkStatus } from './helper/checkStatus'
|
||||||
import { useUserStore } from '@/stores/modules/user'
|
import { useUserStore } from '@/stores/modules/user'
|
||||||
import router from '@/routers'
|
import router from '@/routers'
|
||||||
|
import {refreshToken} from '@/api/user/login'
|
||||||
|
|
||||||
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
|
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
@@ -37,12 +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.token)
|
config.headers.set('Authorization', 'Bearer ' + userStore.accessToken)
|
||||||
|
config.headers.set('Is-Refresh-Token', userStore.isRefreshToken+"")
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
@@ -51,25 +55,55 @@ class RequestHttp {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
let isFirst = true
|
||||||
/**
|
/**
|
||||||
* @description 响应拦截器
|
* @description 响应拦截器
|
||||||
* 服务器换返回信息 -> [拦截统一处理] -> 客户端JS获取到信息
|
* 服务器换返回信息 -> [拦截统一处理] -> 客户端JS获取到信息
|
||||||
*/
|
*/
|
||||||
this.service.interceptors.response.use(
|
this.service.interceptors.response.use(
|
||||||
(response: AxiosResponse) => {
|
async (response: AxiosResponse) => {
|
||||||
const { data } = response
|
const { data } = response
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
tryHideFullScreenLoading()
|
tryHideFullScreenLoading()
|
||||||
|
|
||||||
|
if(data.code === ResultEnum.ACCESSTOKEN_EXPIRED){
|
||||||
|
// 用长token去换短token
|
||||||
|
userStore.setAccessToken(userStore.refreshToken)
|
||||||
|
userStore.setIsRefreshToken(true)
|
||||||
|
const result = await refreshToken()
|
||||||
|
if (result) { //获取新token成功的话
|
||||||
|
// 有新的token后,重新请求
|
||||||
|
userStore.setAccessToken(result.data.accessToken)
|
||||||
|
userStore.setRefreshToken(result.data.refreshToken)
|
||||||
|
userStore.setIsRefreshToken(false)
|
||||||
|
response.config.headers.Authorization = `Bearer ${result.data.accessToken}`//重新请求前需要将更新后的新token更换掉之前无效的token,不然会死循环
|
||||||
|
const resp = await this.service.request(response.config)
|
||||||
|
return resp
|
||||||
|
} else {
|
||||||
|
// 刷新失效,跳转登录页
|
||||||
|
}
|
||||||
|
}
|
||||||
// 登陆失效
|
// 登陆失效
|
||||||
if (data.code == ResultEnum.OVERDUE) {
|
if (data.code == ResultEnum.OVERDUE) {
|
||||||
userStore.setToken('')
|
console.log("登陆失效")
|
||||||
userStore.setUserInfo({name: ''})
|
userStore.setAccessToken('')
|
||||||
router.replace(LOGIN_URL)
|
userStore.setRefreshToken('')
|
||||||
ElMessage.error(data.message)
|
userStore.setIsRefreshToken(false)
|
||||||
|
userStore.setUserInfo({ name: '' })
|
||||||
|
await router.replace(LOGIN_URL)
|
||||||
|
if(isFirst){//临时处理token失效弹窗多次
|
||||||
|
ElMessage.error(data.message)
|
||||||
|
isFirst = false
|
||||||
|
}
|
||||||
return Promise.reject(data)
|
return Promise.reject(data)
|
||||||
}
|
}
|
||||||
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
||||||
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
||||||
|
if(data.message.includes('&')){
|
||||||
|
const formattedMessage = data.message.split('&').join('<br>');
|
||||||
|
ElMessage.error({ message: formattedMessage, dangerouslyUseHTMLString: true });
|
||||||
|
return Promise.reject(data)
|
||||||
|
}
|
||||||
ElMessage.error(data.message)
|
ElMessage.error(data.message)
|
||||||
return Promise.reject(data)
|
return Promise.reject(data)
|
||||||
}
|
}
|
||||||
@@ -79,6 +113,7 @@ class RequestHttp {
|
|||||||
async (error: AxiosError) => {
|
async (error: AxiosError) => {
|
||||||
const { response } = error
|
const { response } = error
|
||||||
tryHideFullScreenLoading()
|
tryHideFullScreenLoading()
|
||||||
|
console.log('error', error.message)
|
||||||
// 请求超时 && 网络错误单独判断,没有 response
|
// 请求超时 && 网络错误单独判断,没有 response
|
||||||
if (error.message.indexOf('timeout') !== -1) ElMessage.error('请求超时!请您稍后重试')
|
if (error.message.indexOf('timeout') !== -1) ElMessage.error('请求超时!请您稍后重试')
|
||||||
if (error.message.indexOf('Network Error') !== -1) ElMessage.error('网络错误!请您稍后重试')
|
if (error.message.indexOf('Network Error') !== -1) ElMessage.error('网络错误!请您稍后重试')
|
||||||
@@ -115,9 +150,24 @@ class RequestHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
upload(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
upload(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||||
return this.service.post(url, params, { ..._object, headers: { 'Content-Type': 'multipart/form-data' } })
|
return this.service.post(url, params, {
|
||||||
|
..._object,
|
||||||
|
headers: { 'Content-Type': 'multipart/form-data' }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对excel的上传,默认返回的是blob类型,Excel没问题时返回json特殊处理
|
||||||
|
*/
|
||||||
|
uploadExcel(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||||
|
return this.service.post(url, params, {
|
||||||
|
..._object,
|
||||||
|
headers: { 'Content-Type': 'multipart/form-data' },
|
||||||
|
responseType: 'blob',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new RequestHttp(config)
|
export default new RequestHttp(config)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
import type { ResPage } from '@/api/interface'
|
|
||||||
import type { Plan } from './interface'
|
import type { Plan } from './interface'
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
import type { TestSource } from '../device/interface/testSource'
|
|
||||||
import type { TestScript } from '../device/interface/testScript'
|
|
||||||
import type { ErrorSystem } from '../device/interface/error'
|
import type { ErrorSystem } from '../device/interface/error'
|
||||||
import type { Device } from '../device/interface/device'
|
import type { Device } from '../device/interface/device'
|
||||||
|
import { ReqDevReportParams } from '@/api/device/interface/device'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name 检测计划管理模块
|
* @name 检测计划管理模块
|
||||||
*/
|
*/
|
||||||
// 获取检测计划列表
|
// 获取检测计划列表
|
||||||
export const getPlanList = (params: Plan.ReqPlanParams) => {
|
export const getPlanList = (params: Plan.ReqPlanParams) => {
|
||||||
return http.post(`/adPlan/list`, params)
|
return http.post(`/adPlan/list`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增检测计划
|
// 新增检测计划
|
||||||
export const addPlan = (params:any) => {
|
export const addPlan = (params: any) => {
|
||||||
return http.post(`/adPlan/add`, params)
|
return http.post(`/adPlan/add`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +49,7 @@ export const getUnboundPqDevList = (params: Plan.ReqPlan) => {
|
|||||||
|
|
||||||
//根据检测计划id查询出所有已绑定的设备
|
//根据检测计划id查询出所有已绑定的设备
|
||||||
export const getBoundPqDevList = (params: any) => {
|
export const getBoundPqDevList = (params: any) => {
|
||||||
return http.post(`/pqDev/listByPlanId`,params)
|
return http.post(`/pqDev/listByPlanId`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
//检测计划绑定设备
|
//检测计划绑定设备
|
||||||
@@ -60,20 +58,35 @@ export const getBoundPqDevList = (params: any) => {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 按照模式查询检测计划(用于首页展示)
|
// 按照模式查询检测计划(用于首页展示)
|
||||||
export const getPlanListByPattern = (params:Plan.ReqPlan) => {
|
export const getPlanListByPattern = (params: Plan.ReqPlan) => {
|
||||||
return http.get(`/adPlan/listByPattern?pattern=${params.pattern}`)
|
return http.get(`/adPlan/listByPattern?pattern=${params.pattern}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出检测计划
|
// 导出检测计划
|
||||||
export const exportPlan=(params: Device.ReqPqDevParams)=>{
|
export const exportCNPlan = (params: Device.ReqPqDevParams) => {
|
||||||
return http.download(`/adPlan/export`, params)
|
return http.download(`/adPlan/exportCNPlan`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下载模板
|
// 下载模板
|
||||||
export const downloadTemplate = () => {
|
export const downloadCNPlanTemplate = () => {
|
||||||
return http.download(`/adPlan/downloadTemplate`)
|
return http.download(`/adPlan/downloadCNPlanTemplate`)
|
||||||
}
|
}
|
||||||
// 导入检测计划
|
// 导入检测计划
|
||||||
export const importPlan=(params: Device.ReqPqDevParams)=>{
|
export const importCNPlan = (params: Device.ReqPqDevParams) => {
|
||||||
return http.upload(`/adPlan/import`, params)
|
return http.uploadExcel(`/adPlan/importCNPlan`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 装置检测报告生成
|
||||||
|
export const generateDevReport = (params: Device.ReqDevReportParams) => {
|
||||||
|
return http.post(`/report/generateReport`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 装置检测报告下载
|
||||||
|
export const downloadDevData = (params: Device.ReqDevReportParams) => {
|
||||||
|
return http.download(`/report/downloadReport`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const staticsAnalyse = (params: { id: string[] }) => {
|
||||||
|
return http.download('/adPlan/analyse', params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ export const startTest = (params) => {
|
|||||||
* 暂停正式检测
|
* 暂停正式检测
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const pauseTest = (params) => {
|
export const pauseTest = () => {
|
||||||
return http.post(`/test/pauseTest`, params, {loading: false})
|
return http.get(`/prepare/closePreTest`, {loading: false})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,5 +30,5 @@ export const pauseTest = (params) => {
|
|||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const resumeTest = (params) => {
|
export const resumeTest = (params) => {
|
||||||
return http.post(`/test/resumeTest`, params, {loading: false})
|
return http.post(`/prepare/restartTemTest/`, params, {loading: false})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ export namespace Dict {
|
|||||||
name: string; // 名称
|
name: string; // 名称
|
||||||
code: string; // 编码
|
code: string; // 编码
|
||||||
sort: number; // 排序
|
sort: number; // 排序
|
||||||
|
openValue?: number | null;
|
||||||
level?: number | null; // 事件等级:0-普通;1-中等;2-严重 (默认为0)
|
level?: number | null; // 事件等级:0-普通;1-中等;2-严重 (默认为0)
|
||||||
algoDescribe?: number | null; // 与高级算法内部Id描述对应
|
algoDescribe?: number | null; // 与高级算法内部Id描述对应
|
||||||
value?: string | null; // 字典针对电压等级
|
value?: string | null; // 字典针对电压等级
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;//日志类型
|
*/
|
||||||
ip:string;//操作IP
|
export interface ReqAuditLogParams extends ReqPage {
|
||||||
result: string;//事件结果
|
id: string; //审计日志Id 必填
|
||||||
remark: string;//事件描述
|
createTime?: string; //创建时间
|
||||||
warn:number;//告警标志
|
}
|
||||||
create_By:string;//创建用户
|
|
||||||
create_Time:string;//创建时间
|
/**
|
||||||
}
|
* 设备类型新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResAuditLog {
|
||||||
|
id: string;//审计日志Id
|
||||||
|
operate_Type:string;//操作类型
|
||||||
|
ip:string;//操作IP
|
||||||
|
result: string;//事件结果
|
||||||
|
remark: string;//事件描述
|
||||||
|
level:number;//告警等级
|
||||||
|
warn:number;//告警标志
|
||||||
|
create_By:string;//创建用户
|
||||||
|
create_Time:string;//创建时间
|
||||||
|
sort:number;//排序
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResAuditLogPage extends ResPage<ResAuditLog> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ export namespace Login {
|
|||||||
}
|
}
|
||||||
export interface ResLogin {
|
export interface ResLogin {
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
|
refreshToken: string;
|
||||||
userInfo:{
|
userInfo:{
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,3 +30,11 @@ export const getDictList = () =>{
|
|||||||
return http.get<Dict>('/dictData/dictDataCache')
|
return http.get<Dict>('/dictData/dictDataCache')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//token刷新
|
||||||
|
export const refreshToken = () => {
|
||||||
|
return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`,
|
||||||
|
{},
|
||||||
|
{ 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 |
@@ -1,49 +1,48 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="dialogVisible" :title="`批量添加${parameter.title}`" :destroy-on-close="true" width="580px" draggable>
|
<el-dialog v-model='dialogVisible' :title='`批量添加${parameter.title}`' :destroy-on-close='true' width='580px'
|
||||||
<el-form class="drawer-multiColumn-form" label-width="100px">
|
draggable>
|
||||||
<el-form-item label="模板下载 :">
|
<el-form class='drawer-multiColumn-form' label-width='100px'>
|
||||||
<el-button type="primary" :icon="Download" @click="downloadTemp"> 点击下载 </el-button>
|
<el-form-item label='模板下载 :'>
|
||||||
|
<el-button type='primary' :icon='Download' @click='downloadTemp'> 点击下载</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="文件上传 :">
|
<el-form-item label='文件上传 :'>
|
||||||
<el-upload
|
<el-upload
|
||||||
action="#"
|
action='#'
|
||||||
class="upload"
|
class='upload'
|
||||||
:drag="true"
|
:drag='true'
|
||||||
:limit="excelLimit"
|
:limit='excelLimit'
|
||||||
:multiple="true"
|
:multiple='true'
|
||||||
:show-file-list="true"
|
:show-file-list='true'
|
||||||
:http-request="uploadExcel"
|
:http-request='uploadExcel'
|
||||||
:before-upload="beforeExcelUpload"
|
:before-upload='beforeExcelUpload'
|
||||||
:on-exceed="handleExceed"
|
:on-exceed='handleExceed'
|
||||||
:on-success="excelUploadSuccess"
|
|
||||||
:on-error="excelUploadError"
|
|
||||||
:accept="parameter.fileType!.join(',')"
|
:accept="parameter.fileType!.join(',')"
|
||||||
>
|
>
|
||||||
<slot name="empty">
|
<slot name='empty'>
|
||||||
<el-icon class="el-icon--upload">
|
<el-icon class='el-icon--upload'>
|
||||||
<upload-filled />
|
<upload-filled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
<div class='el-upload__text'>将文件拖到此处,或<em>点击上传</em></div>
|
||||||
</slot>
|
</slot>
|
||||||
<template #tip>
|
<template #tip>
|
||||||
<slot name="tip">
|
<slot name='tip'>
|
||||||
<div class="el-upload__tip">请上传 .xls , .xlsx 标准格式文件,文件最大为 {{ parameter.fileSize }}M</div>
|
<div class='el-upload__tip'>请上传 .xls , .xlsx 标准格式文件,文件最大为 {{ parameter.fileSize }}M</div>
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="parameter.showCover" label="数据覆盖 :">
|
<el-form-item v-if='parameter.showCover' label='数据覆盖 :'>
|
||||||
<el-switch v-model="isCover" />
|
<el-switch v-model='isCover' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="ImportExcel">
|
<script setup lang='ts' name='ImportExcel'>
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue'
|
||||||
import { useDownload } from "@/hooks/useDownload";
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
import { Download } from "@element-plus/icons-vue";
|
import { Download } from '@element-plus/icons-vue'
|
||||||
import { ElNotification, UploadRequestOptions, UploadRawFile } from "element-plus";
|
import { ElNotification, UploadRequestOptions, UploadRawFile, ElMessage } from 'element-plus'
|
||||||
|
|
||||||
export interface ExcelParameterProps {
|
export interface ExcelParameterProps {
|
||||||
title: string; // 标题
|
title: string; // 标题
|
||||||
@@ -57,98 +56,132 @@ export interface ExcelParameterProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 是否覆盖数据
|
// 是否覆盖数据
|
||||||
const isCover = ref(false);
|
const isCover = ref(false)
|
||||||
// 最大文件上传数
|
// 最大文件上传数
|
||||||
const excelLimit = ref(1);
|
const excelLimit = ref(1)
|
||||||
// dialog状态
|
// dialog状态
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false)
|
||||||
// 父组件传过来的参数
|
// 父组件传过来的参数
|
||||||
const parameter = ref<ExcelParameterProps>({
|
const parameter = ref<ExcelParameterProps>({
|
||||||
title: "",
|
title: '',
|
||||||
fileSize: 5,
|
fileSize: 5,
|
||||||
fileType: ["application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]
|
fileType: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
||||||
});
|
})
|
||||||
|
|
||||||
// 接收父组件参数
|
// 接收父组件参数
|
||||||
const acceptParams = (params: ExcelParameterProps) => {
|
const acceptParams = (params: ExcelParameterProps) => {
|
||||||
parameter.value = { ...parameter.value, ...params };
|
parameter.value = { ...parameter.value, ...params }
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true
|
||||||
};
|
}
|
||||||
|
|
||||||
// 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}模板`, {}, false)
|
||||||
};
|
}
|
||||||
|
|
||||||
// 文件上传
|
// 文件上传
|
||||||
const uploadExcel = async (param: UploadRequestOptions) => {
|
const uploadExcel = async (param: UploadRequestOptions) => {
|
||||||
let excelFormData = new FormData();
|
let excelFormData = new FormData()
|
||||||
excelFormData.append("file", param.file);
|
excelFormData.append('file', param.file)
|
||||||
if(parameter.value.patternId){
|
if (parameter.value.patternId) {
|
||||||
excelFormData.append("patternId",parameter.value.patternId)
|
excelFormData.append('patternId', parameter.value.patternId)
|
||||||
}
|
}
|
||||||
isCover.value && excelFormData.append("isCover", isCover.value as unknown as Blob);
|
isCover.value && excelFormData.append('isCover', isCover.value as unknown as Blob)
|
||||||
await parameter.value.importApi!(excelFormData);
|
//await parameter.value.importApi!(excelFormData);
|
||||||
parameter.value.getTableList && parameter.value.getTableList();
|
await parameter.value.importApi!(excelFormData)
|
||||||
dialogVisible.value = false;
|
.then(res => handleImportResponse(res))
|
||||||
};
|
parameter.value.getTableList && parameter.value.getTableList()
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function handleImportResponse(res: any) {
|
||||||
|
console.log(res)
|
||||||
|
|
||||||
|
if (res.type === 'application/json') {
|
||||||
|
const fileReader = new FileReader()
|
||||||
|
fileReader.onloadend = () => {
|
||||||
|
try {
|
||||||
|
const jsonData = JSON.parse(fileReader.result)
|
||||||
|
if (jsonData.code === 'A0000') {
|
||||||
|
ElMessage.success('导入成功')
|
||||||
|
} else {
|
||||||
|
ElMessage.error(jsonData.message)
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fileReader.readAsText(res)
|
||||||
|
} else {
|
||||||
|
ElMessage.error('导入失败,请查看下载附件!')
|
||||||
|
let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
|
||||||
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = '导入失败数据'
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
link.remove()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 文件上传之前判断
|
* @description 文件上传之前判断
|
||||||
* @param file 上传的文件
|
* @param file 上传的文件
|
||||||
* */
|
* */
|
||||||
const beforeExcelUpload = (file: UploadRawFile) => {
|
const beforeExcelUpload = (file: UploadRawFile) => {
|
||||||
const isExcel = parameter.value.fileType!.includes(file.type as File.ExcelMimeType);
|
const isExcel = parameter.value.fileType!.includes(file.type as File.ExcelMimeType)
|
||||||
const fileSize = file.size / 1024 / 1024 < parameter.value.fileSize!;
|
const fileSize = file.size / 1024 / 1024 < parameter.value.fileSize!
|
||||||
if (!isExcel)
|
if (!isExcel)
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: "温馨提示",
|
title: '温馨提示',
|
||||||
message: "上传文件只能是 xls / xlsx 格式!",
|
message: '上传文件只能是 xls / xlsx 格式!',
|
||||||
type: "warning"
|
type: 'warning',
|
||||||
});
|
})
|
||||||
if (!fileSize)
|
if (!fileSize)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: "温馨提示",
|
title: '温馨提示',
|
||||||
message: `上传文件大小不能超过 ${parameter.value.fileSize}MB!`,
|
message: `上传文件大小不能超过 ${parameter.value.fileSize}MB!`,
|
||||||
type: "warning"
|
type: 'warning',
|
||||||
});
|
})
|
||||||
}, 0);
|
}, 0)
|
||||||
return isExcel && fileSize;
|
return isExcel && fileSize
|
||||||
};
|
}
|
||||||
|
|
||||||
// 文件数超出提示
|
// 文件数超出提示
|
||||||
const handleExceed = () => {
|
const handleExceed = () => {
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: "温馨提示",
|
title: '温馨提示',
|
||||||
message: "最多只能上传一个文件!",
|
message: '最多只能上传一个文件!',
|
||||||
type: "warning"
|
type: 'warning',
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
// 上传错误提示
|
// 上传错误提示
|
||||||
const excelUploadError = () => {
|
// const excelUploadError = () => {
|
||||||
ElNotification({
|
// ElNotification({
|
||||||
title: "温馨提示",
|
// title: '温馨提示',
|
||||||
message: `批量添加${parameter.value.title}失败,请您重新上传!`,
|
// message: `批量添加${parameter.value.title}失败,请您重新上传!`,
|
||||||
type: "error"
|
// type: 'error',
|
||||||
});
|
// })
|
||||||
};
|
// }
|
||||||
|
|
||||||
// 上传成功提示
|
// 上传成功提示
|
||||||
const excelUploadSuccess = () => {
|
// const excelUploadSuccess = () => {
|
||||||
ElNotification({
|
// ElNotification({
|
||||||
title: "温馨提示",
|
// title: '温馨提示',
|
||||||
message: `批量添加${parameter.value.title}成功!`,
|
// message: `批量添加${parameter.value.title}成功!`,
|
||||||
type: "success"
|
// type: 'success',
|
||||||
});
|
// })
|
||||||
};
|
// }
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
acceptParams
|
acceptParams,
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang='scss' scoped>
|
||||||
@import "./index.scss";
|
@import "./index.scss";
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -313,7 +313,7 @@
|
|||||||
border: 1px solid #dcdfe6;
|
border: 1px solid #dcdfe6;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
width: 110%;
|
width: 100%;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
padding-inline-start: 0px;
|
padding-inline-start: 0px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
|
|||||||
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>
|
||||||
@@ -22,11 +22,16 @@ const props = defineProps({
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
const customData: any = ref({}),
|
const customData: any = ref({}),
|
||||||
legendData: any = ref({}),
|
legendData: any = ref({}),
|
||||||
chart: any = ref();
|
chart: any = ref();
|
||||||
|
|
||||||
|
const labelIsShow = ref(true)//引导线台数和鼠标点击饼图是否弹出提示显示
|
||||||
const init = () => {
|
const init = () => {
|
||||||
|
|
||||||
|
|
||||||
customData.value = {
|
customData.value = {
|
||||||
title: "", //标题
|
title: "", //标题
|
||||||
textAlign: "left", //标题位置可选属性left 可选属性值 left,right,center
|
textAlign: "left", //标题位置可选属性left 可选属性值 left,right,center
|
||||||
@@ -35,7 +40,10 @@ const init = () => {
|
|||||||
isRadius: false, //是否圆角
|
isRadius: false, //是否圆角
|
||||||
isSpace: false, //是否显示间隔
|
isSpace: false, //是否显示间隔
|
||||||
isLabelLine: true, //是否显示引导线
|
isLabelLine: true, //是否显示引导线
|
||||||
|
titleFontSize: '14px', //标题字体大小
|
||||||
|
|
||||||
...props.customData,
|
...props.customData,
|
||||||
|
|
||||||
};
|
};
|
||||||
legendData.value = {
|
legendData.value = {
|
||||||
icon: "roundRect", // 图例项的icon,类型包括 circle(圆形),rect(正方形),//roundRect(圆角正方形),triangle(三角形),diamond(菱形),//pin(大头针行),arrow(箭头形),none(无图例项的icon)
|
icon: "roundRect", // 图例项的icon,类型包括 circle(圆形),rect(正方形),//roundRect(圆角正方形),triangle(三角形),diamond(菱形),//pin(大头针行),arrow(箭头形),none(无图例项的icon)
|
||||||
@@ -49,6 +57,9 @@ const init = () => {
|
|||||||
title: {
|
title: {
|
||||||
text: customData.value.title,
|
text: customData.value.title,
|
||||||
left: customData.value.textAlign,
|
left: customData.value.textAlign,
|
||||||
|
textStyle: {
|
||||||
|
fontSize: customData.value.titleFontSize, // 使用 titleFontSize 属性
|
||||||
|
},
|
||||||
},
|
},
|
||||||
legend:legendData.value,
|
legend:legendData.value,
|
||||||
// legend: {
|
// legend: {
|
||||||
@@ -66,7 +77,7 @@ const init = () => {
|
|||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
tooltip: {
|
tooltip: {
|
||||||
show: true,
|
show: labelIsShow.value,
|
||||||
trigger: "item",
|
trigger: "item",
|
||||||
formatter: customData.value.ratio ? `{b} : {c} ({d}%)` : "{b} :{c} ",
|
formatter: customData.value.ratio ? `{b} : {c} ({d}%)` : "{b} :{c} ",
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
@@ -82,7 +93,7 @@ const init = () => {
|
|||||||
if(item)
|
if(item)
|
||||||
return item[0].value;
|
return item[0].value;
|
||||||
},
|
},
|
||||||
center: ["55%", "50%"], // 设置饼图的中心位置
|
center: ["55%", "55%"], // 设置饼图的中心位置
|
||||||
// padAngle: 2,
|
// padAngle: 2,
|
||||||
minAngle: 15, //最小角度
|
minAngle: 15, //最小角度
|
||||||
startAngle: 270, //起始角度
|
startAngle: 270, //起始角度
|
||||||
@@ -95,14 +106,14 @@ const init = () => {
|
|||||||
},
|
},
|
||||||
label: {
|
label: {
|
||||||
normal: {
|
normal: {
|
||||||
show: true,
|
show: labelIsShow.value,
|
||||||
position: "outside",
|
position: "outside",
|
||||||
textStyle: {
|
textStyle: {
|
||||||
//color: "#fff",
|
//color: "#fff",
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
},
|
},
|
||||||
formatter: function (data) {
|
formatter: function (data) {
|
||||||
return data.value +'台'
|
return labelIsShow.value ? data.value + '台' : '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -117,6 +128,7 @@ const init = () => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
option && chart.value && chart.value.setOption(option);
|
option && chart.value && chart.value.setOption(option);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
chart.value.resize();
|
chart.value.resize();
|
||||||
@@ -152,6 +164,12 @@ watch(
|
|||||||
() => props.chartsData,
|
() => props.chartsData,
|
||||||
(val, oldVal) => {
|
(val, oldVal) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
|
const item = props.chartsData.find(item => item.value === 0);
|
||||||
|
if(item != undefined){
|
||||||
|
labelIsShow.value = false;
|
||||||
|
}else{
|
||||||
|
labelIsShow.value = true;
|
||||||
|
}
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
// 首页地址(默认)
|
// 首页地址(默认)
|
||||||
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";
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ const auth: Directive = {
|
|||||||
const { value } = binding
|
const { value } = binding
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? []
|
const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? []
|
||||||
// console.log('1234',authStore.routeName)
|
// console.log('1234',authStore.routeName)
|
||||||
// console.log('123',currentPageRoles)
|
// console.log('123',currentPageRoles)
|
||||||
if (value instanceof Array && value.length) {
|
if (value instanceof Array && value.length) {
|
||||||
|
//console.log('123456',value)
|
||||||
const hasPermission = value.every(item => currentPageRoles.includes(item))
|
const hasPermission = value.every(item => currentPageRoles.includes(item))
|
||||||
if (!hasPermission) el.remove()
|
if (!hasPermission) el.remove()
|
||||||
} else {
|
} else {
|
||||||
|
//console.log('12345',value)
|
||||||
if (!currentPageRoles.includes(value)) el.remove()
|
if (!currentPageRoles.includes(value)) el.remove()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
export enum ResultEnum {
|
export enum ResultEnum {
|
||||||
SUCCESS = "A0000",
|
SUCCESS = "A0000",
|
||||||
ERROR = 500,
|
ERROR = 500,
|
||||||
OVERDUE = "401",
|
ACCESSTOKEN_EXPIRED = 401,
|
||||||
|
OVERDUE = 4001,
|
||||||
TIMEOUT = 30000,
|
TIMEOUT = 30000,
|
||||||
TYPE = "success"
|
TYPE = "success"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,12 +66,14 @@ onMounted(() => {
|
|||||||
const handelOpen = async (item: string) => {
|
const handelOpen = async (item: string) => {
|
||||||
await authStore.setShowMenu();
|
await authStore.setShowMenu();
|
||||||
modeStore.setCurrentMode(item); // 将模式code存入 store
|
modeStore.setCurrentMode(item); // 将模式code存入 store
|
||||||
if (router.currentRoute.value.path === '/home/index') {
|
|
||||||
|
//if (router.currentRoute.value.path === '/home/index') {
|
||||||
// 强制刷新页面
|
// 强制刷新页面
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} else {
|
//} else {
|
||||||
router.push({ path: '/home/index' });
|
// router.push({ path: '/home/index' });
|
||||||
}
|
//}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -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">
|
||||||
@@ -56,14 +64,14 @@ import Message from "./components/Message.vue";
|
|||||||
import Fullscreen from "./components/Fullscreen.vue";
|
import Fullscreen from "./components/Fullscreen.vue";
|
||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from "@/stores/modules/auth";
|
||||||
import {useDictStore} from "@/stores/modules/dict";
|
import {useDictStore} from "@/stores/modules/dict";
|
||||||
import { useModeStore } from "@/stores/modules/mode";
|
import { useModeStore,useAppSceneStore } from "@/stores/modules/mode";
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const dictStore = useDictStore();
|
const dictStore = useDictStore();
|
||||||
const username = computed(() => userStore.userInfo.name);
|
const username = computed(() => userStore.userInfo.name);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const modeStore = useModeStore();
|
const modeStore = useModeStore();
|
||||||
|
const AppSceneStore = useAppSceneStore();
|
||||||
// 退出登录
|
// 退出登录
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
|
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
|
||||||
@@ -74,10 +82,13 @@ const logout = () => {
|
|||||||
// 1.执行退出登录接口
|
// 1.执行退出登录接口
|
||||||
await logoutApi();
|
await logoutApi();
|
||||||
// 2.清除 Token
|
// 2.清除 Token
|
||||||
userStore.setToken("");
|
userStore.setAccessToken("");
|
||||||
|
userStore.setRefreshToken("");
|
||||||
userStore.setUserInfo({name: ""});
|
userStore.setUserInfo({name: ""});
|
||||||
|
userStore.setIsRefreshToken(false)
|
||||||
dictStore.setDictData([]);
|
dictStore.setDictData([]);
|
||||||
modeStore.setCurrentMode('');
|
modeStore.setCurrentMode('');
|
||||||
|
AppSceneStore.setCurrentMode('');
|
||||||
// 3.重定向到登陆页
|
// 3.重定向到登陆页
|
||||||
router.replace(LOGIN_URL);
|
router.replace(LOGIN_URL);
|
||||||
ElMessage.success("退出登录成功!");
|
ElMessage.success("退出登录成功!");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.el-main {
|
.el-main {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 20px;//主体padding
|
padding: 15px;//主体padding
|
||||||
overflow-x: hidden;
|
overflow: hidden;
|
||||||
background-color: var(--el-bg-color-page);
|
background-color: var(--el-bg-color-page);
|
||||||
}
|
}
|
||||||
.el-footer {
|
.el-footer {
|
||||||
|
|||||||
@@ -2,21 +2,16 @@
|
|||||||
<Maximize v-show="maximize" />
|
<Maximize v-show="maximize" />
|
||||||
<Tabs v-if="tabs && showMenuFlag" />
|
<Tabs v-if="tabs && showMenuFlag" />
|
||||||
<el-main>
|
<el-main>
|
||||||
<!-- style="height: calc(100vh - 157px);overflow-y:auto; overflow-x:hidden;" :style='{height:showMenuFlag?"calc(100vh - 157px)":" calc(100vh - 120px)"}' -->
|
|
||||||
<router-view v-slot="{ Component, route }" style="height:100%;">
|
<router-view v-slot="{ Component, route }" style="height:100%;">
|
||||||
<transition appear name="fade-transform" mode="out-in">
|
<!-- {{ keepAliveName}} -->
|
||||||
<keep-alive :include="keepAliveName">
|
<!-- <transition name="slide-right" mode="out-in"> -->
|
||||||
<component
|
<keep-alive :include="tabsMenuList" >
|
||||||
:is="Component"
|
<component :is="Component" :key="route.fullPath" />
|
||||||
v-if="isRouterShow"
|
|
||||||
:key="route.fullPath"
|
|
||||||
/>
|
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</transition>
|
<!-- </transition> -->
|
||||||
</router-view>
|
</router-view>
|
||||||
</el-main>
|
</el-main>
|
||||||
<el-footer >
|
<el-footer>
|
||||||
<!-- v-show="footer" -->
|
|
||||||
<Footer />
|
<Footer />
|
||||||
</el-footer>
|
</el-footer>
|
||||||
</template>
|
</template>
|
||||||
@@ -31,12 +26,15 @@ import Maximize from "./components/Maximize.vue";
|
|||||||
import Tabs from "@/layouts/components/Tabs/index.vue";
|
import Tabs from "@/layouts/components/Tabs/index.vue";
|
||||||
import Footer from "@/layouts/components/Footer/index.vue";
|
import Footer from "@/layouts/components/Footer/index.vue";
|
||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from "@/stores/modules/auth";
|
||||||
|
import { useTabsStore } from '@/stores/modules/tabs'
|
||||||
|
const tabStore = useTabsStore()
|
||||||
const globalStore = useGlobalStore();
|
const globalStore = useGlobalStore();
|
||||||
|
const tabsMenuList = computed(() => tabStore.tabsMenuList.map(item => item.name))
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const { maximize, isCollapse, layout, tabs, footer } = storeToRefs(globalStore);
|
const { maximize, isCollapse, layout, tabs, footer } = storeToRefs(globalStore);
|
||||||
|
|
||||||
const keepAliveStore = useKeepAliveStore();
|
const keepAliveStore = useKeepAliveStore();
|
||||||
const { keepAliveName } = storeToRefs(keepAliveStore);
|
const { keepAliveName } = storeToRefs(keepAliveStore);
|
||||||
|
// console.log("🚀 ~ keepAliveName:", keepAliveName)
|
||||||
//是否显示导航栏
|
//是否显示导航栏
|
||||||
const showMenuFlag = computed(() => authStore.showMenuFlagGet);
|
const showMenuFlag = computed(() => authStore.showMenuFlagGet);
|
||||||
// 注入刷新页面方法
|
// 注入刷新页面方法
|
||||||
@@ -65,6 +63,7 @@ watch(
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// 监听窗口大小变化,折叠侧边栏
|
// 监听窗口大小变化,折叠侧边栏
|
||||||
const screenWidth = ref(0);
|
const screenWidth = ref(0);
|
||||||
const listeningWindow = useDebounceFn(() => {
|
const listeningWindow = useDebounceFn(() => {
|
||||||
|
|||||||
@@ -77,6 +77,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
|
||||||
}
|
}
|
||||||
tabStore.addTabs(tabsParams)
|
tabStore.addTabs(tabsParams)
|
||||||
}
|
}
|
||||||
@@ -100,6 +101,7 @@ const tabsDrop = () => {
|
|||||||
// Tab Click
|
// Tab Click
|
||||||
const tabClick = (tabItem: TabsPaneContext) => {
|
const tabClick = (tabItem: TabsPaneContext) => {
|
||||||
const fullPath = tabItem.props.name as string
|
const fullPath = tabItem.props.name as string
|
||||||
|
// console.log("🚀 ~ tabClick ~ fullPath:", tabItem)
|
||||||
router.push(fullPath)
|
router.push(fullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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],
|
||||||
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
|
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
|
||||||
@@ -46,14 +47,13 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
// 1.NProgress 开始
|
// 1.NProgress 开始
|
||||||
NProgress.start()
|
NProgress.start()
|
||||||
|
|
||||||
// 2.动态设置标题
|
// 2.动态设置标题
|
||||||
const title = import.meta.env.VITE_GLOB_APP_TITLE
|
const title = import.meta.env.VITE_GLOB_APP_TITLE
|
||||||
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title
|
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title
|
||||||
|
|
||||||
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
|
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
|
||||||
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
|
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
|
||||||
if (userStore.token) return next(from.fullPath)
|
if (userStore.accessToken) return next(from.fullPath)
|
||||||
resetRouter()
|
resetRouter()
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
@@ -62,17 +62,16 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
if (ROUTER_WHITE_LIST.includes(to.path)) return next()
|
if (ROUTER_WHITE_LIST.includes(to.path)) return next()
|
||||||
|
|
||||||
// 5.判断是否有 Token,没有重定向到 login 页面
|
// 5.判断是否有 Token,没有重定向到 login 页面
|
||||||
if (!userStore.token) return next({ path: LOGIN_URL, replace: true })
|
if (!userStore.accessToken) return next({ path: LOGIN_URL, replace: true })
|
||||||
|
|
||||||
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
|
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
|
||||||
if (!authStore.authMenuListGet.length) {
|
if (!authStore.authMenuListGet.length) {
|
||||||
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()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ export const initDynamicRouter = async () => {
|
|||||||
type: "warning",
|
type: "warning",
|
||||||
duration: 3000
|
duration: 3000
|
||||||
});
|
});
|
||||||
userStore.setToken("");
|
userStore.setAccessToken("");
|
||||||
|
userStore.setRefreshToken("");
|
||||||
router.replace(LOGIN_URL);
|
router.replace(LOGIN_URL);
|
||||||
return Promise.reject("No permission");
|
return Promise.reject("No permission");
|
||||||
}
|
}
|
||||||
@@ -36,9 +37,11 @@ export const initDynamicRouter = async () => {
|
|||||||
// 3.添加动态路由
|
// 3.添加动态路由
|
||||||
authStore.flatMenuListGet.forEach(item => {
|
authStore.flatMenuListGet.forEach(item => {
|
||||||
item.children && delete item.children;
|
item.children && delete item.children;
|
||||||
|
|
||||||
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 {
|
||||||
@@ -47,7 +50,8 @@ export const initDynamicRouter = async () => {
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 当按钮 || 菜单请求出错时,重定向到登陆页
|
// 当按钮 || 菜单请求出错时,重定向到登陆页
|
||||||
userStore.setToken("");
|
userStore.setAccessToken("");
|
||||||
|
userStore.setRefreshToken("");
|
||||||
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,
|
|
||||||
name: "login",
|
|
||||||
component: () => import("@/views/login/index.vue"),
|
|
||||||
meta: {
|
|
||||||
title: "登录",
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
path: LOGIN_URL,
|
||||||
path: "/layout",
|
name: 'login',
|
||||||
name: "layout",
|
component: () => import('@/views/login/index.vue'),
|
||||||
component: Layout,
|
meta: {
|
||||||
children: [
|
title: '登录'
|
||||||
{
|
}
|
||||||
path: "/plan",
|
},
|
||||||
name: "plan",
|
{
|
||||||
redirect: "/plan/planList",
|
path: '/layout',
|
||||||
|
name: 'layout',
|
||||||
|
component: Layout,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "/plan/planList",
|
path: '/plan',
|
||||||
name: "planList",
|
name: 'plan',
|
||||||
component: () => import("@/views/plan/planList/index.vue"),
|
redirect: '/plan/planList',
|
||||||
meta: {
|
children: [
|
||||||
title: "检测计划列表",
|
// {
|
||||||
icon: "List",
|
// path: "/plan/planList",
|
||||||
isLink: "",
|
// name: "planList",
|
||||||
isHide: false,
|
// component: () => import("@/views/plan/planList/index.vue"),
|
||||||
isFull: false,
|
// meta: {
|
||||||
isAffix: false,
|
// title: "检测计划列表",
|
||||||
isKeepAlive: false,
|
// icon: "List",
|
||||||
|
// isLink: "",
|
||||||
|
// isHide: false,
|
||||||
|
// isFull: false,
|
||||||
|
// isAffix: false,
|
||||||
|
// isKeepAlive: true,//缓存改成true
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// path: "/plan/singlePlanList",
|
||||||
|
// name: "singlePlanList",
|
||||||
|
// component: () => import("@/views/plan/singlePlanList/index.vue"),
|
||||||
|
// meta: {
|
||||||
|
// title: "单个计划列表",
|
||||||
|
// icon: "List",
|
||||||
|
// isLink: "",
|
||||||
|
// isHide: false,
|
||||||
|
// isFull: false,
|
||||||
|
// isAffix: false,
|
||||||
|
// isKeepAlive: true,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// path: "/plan/preTest",
|
||||||
|
// name: "preTest",
|
||||||
|
// component: () => import("@/views/plan/preTest/index.vue"),
|
||||||
|
// meta: {
|
||||||
|
// title: "预检测",
|
||||||
|
// icon: "List",
|
||||||
|
// isLink: "",
|
||||||
|
// isHide: false,
|
||||||
|
// isFull: false,
|
||||||
|
// isAffix: false,
|
||||||
|
// isKeepAlive: false,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// path: "/plan/autoTest",
|
||||||
|
// name: "autoTest",
|
||||||
|
// component: () => import("@/views/plan/autoTest/index.vue"),
|
||||||
|
// meta: {
|
||||||
|
// title: "自动检测",
|
||||||
|
// icon: "List",
|
||||||
|
// isLink: "",
|
||||||
|
// hideTab:true,
|
||||||
|
// parentPath:'/system/proTable',
|
||||||
|
// isHide: false,
|
||||||
|
// isFull: false,
|
||||||
|
// isAffix: false,
|
||||||
|
// isKeepAlive: true,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
|
||||||
|
// 错误页面路由
|
||||||
|
{
|
||||||
|
path: '/403',
|
||||||
|
name: '403',
|
||||||
|
component: () => import('@/components/ErrorMessage/403.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '403页面'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/404',
|
||||||
|
name: '404',
|
||||||
|
component: () => import('@/components/ErrorMessage/404.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '404页面'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/500',
|
||||||
|
name: '500',
|
||||||
|
component: () => import('@/components/ErrorMessage/500.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '500页面'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Resolve refresh page, route warnings
|
||||||
|
{
|
||||||
|
path: '/:pathMatch(.*)*',
|
||||||
|
component: () => import('@/components/ErrorMessage/404.vue')
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
path: '/machine/testScriptAdd',
|
||||||
path: "/plan/singlePlanList",
|
name: 'testScriptAdd',
|
||||||
name: "singlePlanList",
|
component: () => import('@/views/machine/testScript/components/testScriptPopup.vue'),
|
||||||
component: () => import("@/views/plan/singlePlanList/index.vue"),
|
meta: {
|
||||||
meta: {
|
title: '检测脚本配置',
|
||||||
title: "单个计划列表",
|
icon: 'List',
|
||||||
icon: "List",
|
isLink: '',
|
||||||
isLink: "",
|
hideTab: true,
|
||||||
isHide: false,
|
parentPath: '/machine/testScript',
|
||||||
isFull: false,
|
isHide: false,
|
||||||
isAffix: false,
|
isFull: false,
|
||||||
isKeepAlive: false,
|
isAffix: false,
|
||||||
},
|
isKeepAlive: true
|
||||||
},
|
}
|
||||||
{
|
}
|
||||||
path: "/plan/preTest",
|
]
|
||||||
name: "preTest",
|
}
|
||||||
component: () => import("@/views/plan/preTest/index.vue"),
|
]
|
||||||
meta: {
|
|
||||||
title: "预检测",
|
|
||||||
icon: "List",
|
|
||||||
isLink: "",
|
|
||||||
isHide: false,
|
|
||||||
isFull: false,
|
|
||||||
isAffix: false,
|
|
||||||
isKeepAlive: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/plan/autoTest",
|
|
||||||
name: "autoTest",
|
|
||||||
component: () => import("@/views/plan/autoTest/index.vue"),
|
|
||||||
meta: {
|
|
||||||
title: "自动检测",
|
|
||||||
icon: "List",
|
|
||||||
isLink: "",
|
|
||||||
hideTab:true,
|
|
||||||
parentPath:'/system/proTable',
|
|
||||||
isHide: false,
|
|
||||||
isFull: false,
|
|
||||||
isAffix: false,
|
|
||||||
isKeepAlive: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// 错误页面路由
|
|
||||||
{
|
|
||||||
path: "/403",
|
|
||||||
name: "403",
|
|
||||||
component: () => import("@/components/ErrorMessage/403.vue"),
|
|
||||||
meta: {
|
|
||||||
title: "403页面",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/404",
|
|
||||||
name: "404",
|
|
||||||
component: () => import("@/components/ErrorMessage/404.vue"),
|
|
||||||
meta: {
|
|
||||||
title: "404页面",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/500",
|
|
||||||
name: "500",
|
|
||||||
component: () => import("@/components/ErrorMessage/500.vue"),
|
|
||||||
meta: {
|
|
||||||
title: "500页面",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// Resolve refresh page, route warnings
|
|
||||||
{
|
|
||||||
path: "/:pathMatch(.*)*",
|
|
||||||
component: () => import("@/components/ErrorMessage/404.vue"),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ export interface GlobalState {
|
|||||||
|
|
||||||
/* UserState */
|
/* UserState */
|
||||||
export interface UserState {
|
export interface UserState {
|
||||||
token: string;
|
accessToken: string;
|
||||||
|
refreshToken: string;
|
||||||
|
isRefreshToken: boolean;
|
||||||
userInfo: { name: string };
|
userInfo: { name: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +41,7 @@ export interface TabsMenuProps {
|
|||||||
name: string;
|
name: string;
|
||||||
close: boolean;
|
close: boolean;
|
||||||
isKeepAlive: boolean;
|
isKeepAlive: boolean;
|
||||||
|
unshift?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TabsState */
|
/* TabsState */
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
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'
|
||||||
|
|
||||||
|
|
||||||
export const useCheckStore = defineStore("check", {
|
export const useCheckStore = defineStore("check", {
|
||||||
@@ -8,9 +9,11 @@ export const useCheckStore = defineStore("check", {
|
|||||||
|
|
||||||
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: true, channelsTest: false, test: true}),
|
||||||
scriptId: String(""),
|
checkType:1, // 0:手动检测 1:自动检测
|
||||||
|
reCheckType: 1, // 0:不合格项复检 1:全部复检
|
||||||
|
showDetailType: 0 // 0:数据查询 1:误差体系跟换
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getters: {},
|
getters: {},
|
||||||
@@ -19,21 +22,28 @@ 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
|
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) {
|
||||||
|
this.reCheckType = reCheckType
|
||||||
|
},
|
||||||
|
setShowDetailType(showDetailType: number) {
|
||||||
|
this.showDetailType = showDetailType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -24,3 +24,16 @@ export const useModeStore = defineStore('mode', {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const useAppSceneStore = defineStore('scene', {
|
||||||
|
state: () => ({
|
||||||
|
currentScene: localStorage.getItem('currentScene') || '' as string,
|
||||||
|
}),
|
||||||
|
actions: {
|
||||||
|
setCurrentMode(sceneName: string) {
|
||||||
|
this.currentScene = sceneName;
|
||||||
|
localStorage.setItem('currentScene', sceneName); // 保存到 localStorage
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,14 @@ export const useTabsStore = defineStore({
|
|||||||
actions: {
|
actions: {
|
||||||
// Add Tabs
|
// Add Tabs
|
||||||
async addTabs(tabItem: TabsMenuProps) {
|
async addTabs(tabItem: TabsMenuProps) {
|
||||||
|
|
||||||
if (this.tabsMenuList.every(item => item.path !== tabItem.path)) {
|
if (this.tabsMenuList.every(item => item.path !== tabItem.path)) {
|
||||||
this.tabsMenuList.push(tabItem);
|
if (tabItem?.unshift) {
|
||||||
|
this.tabsMenuList.unshift(tabItem);
|
||||||
|
}else{
|
||||||
|
this.tabsMenuList.push(tabItem);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!keepAliveStore.keepAliveName.includes(tabItem.name) && tabItem.isKeepAlive) {
|
if (!keepAliveStore.keepAliveName.includes(tabItem.name) && tabItem.isKeepAlive) {
|
||||||
keepAliveStore.addKeepAliveName(tabItem.name);
|
keepAliveStore.addKeepAliveName(tabItem.name);
|
||||||
|
|||||||
@@ -1,19 +1,27 @@
|
|||||||
import { defineStore } from "pinia";
|
import {defineStore} from "pinia";
|
||||||
import { UserState } from "@/stores/interface";
|
import {UserState} from "@/stores/interface";
|
||||||
import piniaPersistConfig from "@/stores/helper/persist";
|
import piniaPersistConfig from "@/stores/helper/persist";
|
||||||
import { USER_STORE_KEY } from "@/stores/constant";
|
import {USER_STORE_KEY} from "@/stores/constant";
|
||||||
|
|
||||||
export const useUserStore = defineStore({
|
export const useUserStore = defineStore({
|
||||||
id: USER_STORE_KEY,
|
id: USER_STORE_KEY,
|
||||||
state: (): UserState => ({
|
state: (): UserState => ({
|
||||||
token: "",
|
accessToken: "",
|
||||||
|
refreshToken: "",
|
||||||
|
isRefreshToken:false,
|
||||||
userInfo: { name: "admin" },
|
userInfo: { name: "admin" },
|
||||||
}),
|
}),
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
// Set Token
|
// Set Token
|
||||||
setToken(token: string) {
|
setAccessToken(accessToken: string) {
|
||||||
this.token = token;
|
this.accessToken = accessToken;
|
||||||
|
},
|
||||||
|
setRefreshToken(refreshToken: string) {
|
||||||
|
this.refreshToken = refreshToken;
|
||||||
|
},
|
||||||
|
setIsRefreshToken(isRefreshToken: boolean) {
|
||||||
|
this.isRefreshToken = isRefreshToken;
|
||||||
},
|
},
|
||||||
// Set setUserInfo
|
// Set setUserInfo
|
||||||
setUserInfo(userInfo: UserState["userInfo"]) {
|
setUserInfo(userInfo: UserState["userInfo"]) {
|
||||||
|
|||||||
@@ -4,24 +4,24 @@ import { ElNotification } from "element-plus";
|
|||||||
* @description 全局代码错误捕捉
|
* @description 全局代码错误捕捉
|
||||||
* */
|
* */
|
||||||
const errorHandler = (error: any) => {
|
const errorHandler = (error: any) => {
|
||||||
// 过滤 HTTP 请求错误
|
// // 过滤 HTTP 请求错误
|
||||||
if (error.status || error.status == 0) return false;
|
// if (error.status || error.status == 0) return false;
|
||||||
let errorMap: { [key: string]: string } = {
|
// let errorMap: { [key: string]: string } = {
|
||||||
InternalError: "Javascript引擎内部错误",
|
// InternalError: "Javascript引擎内部错误",
|
||||||
ReferenceError: "未找到对象",
|
// ReferenceError: "未找到对象",
|
||||||
TypeError: "使用了错误的类型或对象",
|
// TypeError: "使用了错误的类型或对象",
|
||||||
RangeError: "使用内置对象时,参数超范围",
|
// RangeError: "使用内置对象时,参数超范围",
|
||||||
SyntaxError: "语法错误",
|
// SyntaxError: "语法错误",
|
||||||
EvalError: "错误的使用了Eval",
|
// EvalError: "错误的使用了Eval",
|
||||||
URIError: "URI错误"
|
// URIError: "URI错误"
|
||||||
};
|
// };
|
||||||
let errorName = errorMap[error.name] || "未知错误";
|
// let errorName = errorMap[error.name] || "未知错误";
|
||||||
ElNotification({
|
// ElNotification({
|
||||||
title: errorName,
|
// title: errorName,
|
||||||
message: error,
|
// message: error,
|
||||||
type: "error",
|
// type: "error",
|
||||||
duration: 3000
|
// duration: 3000
|
||||||
});
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
export default errorHandler;
|
export default errorHandler;
|
||||||
|
|||||||
@@ -1,5 +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() {
|
||||||
@@ -18,18 +19,25 @@ export default class SocketService {
|
|||||||
sendRetryCount = 0;
|
sendRetryCount = 0;
|
||||||
// 重新连接尝试的次数
|
// 重新连接尝试的次数
|
||||||
connectRetryCount = 0;
|
connectRetryCount = 0;
|
||||||
|
work:any;
|
||||||
|
lastActivityTime= 0; // 上次活动时间戳
|
||||||
|
lastResponseHeartTime = Date.now();//最后一次收到心跳回复时间
|
||||||
|
|
||||||
|
reconnectDelay= 5000; // 重新连接延迟,单位毫秒
|
||||||
|
|
||||||
// 定义连接服务器的方法
|
// 定义连接服务器的方法
|
||||||
connect(url) {
|
connect() {
|
||||||
|
|
||||||
// 连接服务器
|
// 连接服务器
|
||||||
if (!window.WebSocket) {
|
if (!window.WebSocket) {
|
||||||
return console.log('您的浏览器不支持WebSocket');
|
return console.log('您的浏览器不支持WebSocket');
|
||||||
}
|
}
|
||||||
console.log(url)
|
|
||||||
// let token = $.cookie('123');
|
// let token = $.cookie('123');
|
||||||
// let token = '4E6EF539AAF119D82AC4C2BC84FBA21F';
|
// let token = '4E6EF539AAF119D82AC4C2BC84FBA21F';
|
||||||
|
|
||||||
|
|
||||||
|
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 = () => {
|
||||||
@@ -38,35 +46,107 @@ export default class SocketService {
|
|||||||
this.connected = true;
|
this.connected = true;
|
||||||
// 重置重新连接的次数
|
// 重置重新连接的次数
|
||||||
this.connectRetryCount = 0;
|
this.connectRetryCount = 0;
|
||||||
|
this.updateLastActivityTime();
|
||||||
|
this.startHeartbeat();
|
||||||
};
|
};
|
||||||
// 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++;
|
||||||
setTimeout(() => {
|
this.clearHeartbeat();
|
||||||
// this.connect();
|
/* setTimeout(() => {
|
||||||
}, 500 * this.connectRetryCount);
|
this.connect();
|
||||||
|
}, 500 * this.connectRetryCount);*/
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.ws.onerror = () => {
|
||||||
|
ElMessage.error("webSocket连接异常!");
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// 得到服务端发送过来的数据
|
// 得到服务端发送过来的数据
|
||||||
this.ws.onmessage = (event) => {
|
this.ws.onmessage = (event) => {
|
||||||
let message: { [key: string]: any };
|
// console.log('🚀 ~ SocketService ~ connect ~ event:', event)
|
||||||
try {
|
if(event.data == 'over') {
|
||||||
message = JSON.parse(event.data);
|
//心跳消息处理
|
||||||
} catch (e) {
|
this.lastResponseHeartTime = Date.now();
|
||||||
return console.error("消息解析失败", event.data, e);
|
this.updateLastActivityTime(); // 收到心跳响应时更新活动时间
|
||||||
}
|
}else {
|
||||||
//console.log(message, "从服务端获取到了数据");
|
let message: { [key: string]: any };
|
||||||
/* 通过接受服务端发送的type字段来回调函数 */
|
try {
|
||||||
if (message?.type && this.callBackMapping[message.type]) {
|
console.log('Received message:',event.data)
|
||||||
this.callBackMapping[message.type](message);
|
message = JSON.parse(event.data);
|
||||||
} else {
|
} catch (e) {
|
||||||
console.log("抛弃====>"+message)
|
return console.error("消息解析失败", event.data, e);
|
||||||
/* 丢弃或继续写你的逻辑 */
|
}
|
||||||
|
|
||||||
|
/* 通过接受服务端发送的type字段来回调函数 */
|
||||||
|
if (message?.type && this.callBackMapping[message.type]) {
|
||||||
|
this.callBackMapping[message.type](message);
|
||||||
|
} else {
|
||||||
|
console.log("抛弃====>")
|
||||||
|
console.log(event.data)
|
||||||
|
/* 丢弃或继续写你的逻辑 */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
startHeartbeat() {
|
||||||
|
this.lastResponseHeartTime = Date.now();
|
||||||
|
const _this = this
|
||||||
|
const url = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},9000)})()']));
|
||||||
|
this.workerBlobUrl = url; // 存储临时的Blob URL
|
||||||
|
this.work = new Worker(url);
|
||||||
|
this.work.onmessage = function(e){
|
||||||
|
//判断多久没收到心跳响应
|
||||||
|
|
||||||
|
if(_this.lastActivityTime - _this.lastResponseHeartTime > 30000){
|
||||||
|
//说明已经三轮心跳没收到回复了,关闭检测,提示用户。
|
||||||
|
ElMessage.error("业务主体模块发生未知异常,请尝试重新启动!");
|
||||||
|
_this.clearHeartbeat();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_this.sendHeartbeat();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
sendHeartbeat() {
|
||||||
|
console.log(new Date()+"进入心跳消息发送。。。。。。。。。。。。。")
|
||||||
|
this.ws.send('alive');
|
||||||
|
this.updateLastActivityTime(); // 发送心跳后更新活动时间
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updateLastActivityTime() {
|
||||||
|
this.lastActivityTime = Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
clearHeartbeat() {
|
||||||
|
if (this.work) {
|
||||||
|
this.work.terminate();
|
||||||
|
this.work = null;
|
||||||
|
}
|
||||||
|
if (this.workerBlobUrl) {
|
||||||
|
window.URL.revokeObjectURL(this.workerBlobUrl); // 释放临时的Blob URL
|
||||||
|
this.workerBlobUrl = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 回调函数的注册
|
// 回调函数的注册
|
||||||
registerCallBack(socketType, callBack) {
|
registerCallBack(socketType, callBack) {
|
||||||
this.callBackMapping[socketType] = callBack;
|
this.callBackMapping[socketType] = callBack;
|
||||||
@@ -98,6 +178,6 @@ export default class SocketService {
|
|||||||
if (this.connected) {
|
if (this.connected) {
|
||||||
this.ws.close()
|
this.ws.close()
|
||||||
}
|
}
|
||||||
console.log('WS关闭中..');
|
console.log('执行WS关闭命令..');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
import ResourcePopup from './components/resourcePopup.vue'
|
import ResourcePopup from './components/resourcePopup.vue'
|
||||||
import {deleteFunction,getFunctionList} from '@/api/user/function/index'
|
import {deleteFunction,getFunctionList} from '@/api/user/function/index'
|
||||||
import * as Icons from '@element-plus/icons-vue'
|
import * as Icons from '@element-plus/icons-vue'
|
||||||
|
defineOptions({
|
||||||
|
name: 'resource'
|
||||||
|
})
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const resourcePopup = ref()
|
const resourcePopup = ref()
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ import RolePopup from './components/rolePopup.vue'
|
|||||||
import RoleResourcePopup from './components/roleResourcePopup.vue'
|
import RoleResourcePopup from './components/roleResourcePopup.vue'
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { onMounted, reactive, ref } from 'vue'
|
||||||
import {useDictStore} from '@/stores/modules/dict'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
|
defineOptions({
|
||||||
|
name: 'role'
|
||||||
|
})
|
||||||
const rolePopup = ref()
|
const rolePopup = ref()
|
||||||
const roleResourcePopup = ref()
|
const roleResourcePopup = ref()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
|||||||
@@ -43,6 +43,9 @@
|
|||||||
import {getUserList, deleteUser,getRoleList} from '@/api/user/user'
|
import {getUserList, deleteUser,getRoleList} from '@/api/user/user'
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { onMounted, reactive, ref } from 'vue'
|
||||||
import { type Role } from '@/api/user/interface/role'
|
import { type Role } from '@/api/user/interface/role'
|
||||||
|
defineOptions({
|
||||||
|
name: 'user'
|
||||||
|
})
|
||||||
const roleList = ref<Role.RoleBO[]>([])
|
const roleList = ref<Role.RoleBO[]>([])
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const userPopup = ref()
|
const userPopup = ref()
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
<!--双列-->
|
|
||||||
<template>
|
|
||||||
<el-dialog v-model='dialogVisible' :title='title' v-bind='dialogMiddle' >
|
|
||||||
<el-scrollbar>
|
|
||||||
<el-form :inline="false" label-width="auto" ref="formRef" class='form-two'>
|
|
||||||
<el-form-item label="姓名" prop="username" >
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="性别" prop="gender">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="年龄" prop="age">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="身份证号" prop="id">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="邮箱" prop="email">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="居住地址" prop="address">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="手机" prop="phone">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="来源" prop="source">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
</el-scrollbar>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<div class='dialog-footer'>
|
|
||||||
<el-button @click='close()'>取消</el-button>
|
|
||||||
<el-button type='primary' @click='confirmForm()'>确定</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
<script setup lang='ts'>
|
|
||||||
import { dialogMiddle } from '@/utils/elementBind'
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const title = ref('单列弹出框')
|
|
||||||
const open = (textTitle: string) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
title.value = textTitle
|
|
||||||
}
|
|
||||||
|
|
||||||
const close = () => {
|
|
||||||
dialogVisible.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
const confirmForm = () => {
|
|
||||||
ElMessage.info('业务数据提交')
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({ open })
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,200 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class='table-box' ref='popupBaseView'>
|
|
||||||
<ProTable
|
|
||||||
ref='proTable'
|
|
||||||
:columns='columns'
|
|
||||||
:data='userData'
|
|
||||||
>
|
|
||||||
<!-- 表格 header 按钮 -->
|
|
||||||
<template #tableHeader='scope'>
|
|
||||||
<el-button type='primary' :icon='CirclePlus' @click="openDrawer('新增')">新增用户</el-button>
|
|
||||||
<el-button type='primary' :icon='Upload' plain @click='batchAdd'>批量添加用户</el-button>
|
|
||||||
<el-button type='primary' :icon='Download' plain @click='downloadFile'>导出用户数据</el-button>
|
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
|
||||||
删除用户
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
<!-- 表格操作 -->
|
|
||||||
<template #operation='scope'>
|
|
||||||
<el-button type='primary' link :icon='View'
|
|
||||||
@click="openDrawer('查看', scope.row)">查看
|
|
||||||
</el-button>
|
|
||||||
<el-button type='primary' link :icon='EditPen' @click="openDrawer('编辑', scope.row)">编辑</el-button>
|
|
||||||
<el-button type='primary' link :icon='Refresh' @click='resetPass(scope.row)'>重置密码</el-button>
|
|
||||||
<el-button type='primary' link :icon='CirclePlus' @click='deleteAccount()'>下钻</el-button>
|
|
||||||
</template>
|
|
||||||
</ProTable>
|
|
||||||
</div>
|
|
||||||
<single-column ref='singleColumn' />
|
|
||||||
<double-column ref='doubleColumn' />
|
|
||||||
<open :width='viewWidth' :height='viewHeight' ref='openView' />
|
|
||||||
</template>
|
|
||||||
<script setup lang='tsx' name='useProTable'>
|
|
||||||
import { ref, reactive } from 'vue'
|
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
|
||||||
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
|
||||||
import ImportExcel from '@/components/ImportExcel/index.vue'
|
|
||||||
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
|
||||||
import { CirclePlus, Delete, EditPen, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
|
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
import SingleColumn from '@/views/demo/proTable/singleColumn.vue'
|
|
||||||
import Open from '@/views/demo/proTable/Open.vue'
|
|
||||||
import DoubleColumn from '@/views/demo/proTable/doubleColumn.vue'
|
|
||||||
import { useViewSize } from '@/hooks/useViewSize'
|
|
||||||
|
|
||||||
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
|
||||||
import {
|
|
||||||
getUserList,
|
|
||||||
deleteUser,
|
|
||||||
} from '@/api/user/user'
|
|
||||||
import { ElMessageBox } from 'element-plus'
|
|
||||||
|
|
||||||
const userData = userDataList
|
|
||||||
const singleColumn = ref()
|
|
||||||
const doubleColumn = ref()
|
|
||||||
const openView = ref()
|
|
||||||
// ProTable 实例
|
|
||||||
const proTable = ref<ProTableInstance>()
|
|
||||||
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
|
||||||
const initParam = reactive({ type: 1 })
|
|
||||||
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
|
|
||||||
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
|
||||||
const dataCallback = (data: any) => {
|
|
||||||
return {
|
|
||||||
list: data.list,
|
|
||||||
total: data.total,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
|
|
||||||
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
|
|
||||||
const getTableList = (params: any) => {
|
|
||||||
let newParams = JSON.parse(JSON.stringify(params))
|
|
||||||
newParams.createTime && (newParams.startTime = newParams.createTime[0])
|
|
||||||
newParams.createTime && (newParams.endTime = newParams.createTime[1])
|
|
||||||
delete newParams.createTime
|
|
||||||
return getUserList(newParams)
|
|
||||||
}
|
|
||||||
// 页面按钮权限(按钮权限既可以使用 hooks,也可以直接使用 v-auth 指令,指令适合直接绑定在按钮上,hooks 适合根据按钮权限显示不同的内容)
|
|
||||||
const { BUTTONS } = useAuthButtons()
|
|
||||||
// 表格配置项
|
|
||||||
const columns = reactive<ColumnProps<any>[]>([
|
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
|
||||||
{
|
|
||||||
prop: 'username',
|
|
||||||
label: '姓名',
|
|
||||||
width: 120,
|
|
||||||
search: { el: 'input' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'gender',
|
|
||||||
label: '性别',
|
|
||||||
// 字典数据(本地数据)
|
|
||||||
enum: dictStore.getDictData('sex'),
|
|
||||||
search: { el: 'select', props: { filterable: true } },
|
|
||||||
fieldNames: { label: 'label', value: 'code' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'age',
|
|
||||||
label: '年龄',
|
|
||||||
search: {
|
|
||||||
// 自定义 search 显示内容
|
|
||||||
render: ({ searchParam }) => {
|
|
||||||
return (
|
|
||||||
<div class='flx-center'>
|
|
||||||
<el-input vModel_trim={searchParam.minAge} placeholder='最小年龄' />
|
|
||||||
<span class='mr10 ml10'>-</span>
|
|
||||||
<el-input vModel_trim={searchParam.maxAge} placeholder='最大年龄' />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ prop: 'idCard', label: '身份证号' },
|
|
||||||
{ prop: 'email', label: '邮箱' },
|
|
||||||
{ prop: 'address', label: '居住地址', width: 120 },
|
|
||||||
{
|
|
||||||
prop: 'status',
|
|
||||||
label: '状态',
|
|
||||||
enum: dictStore.getDictData('status'),
|
|
||||||
search: { el: 'tree-select', props: { filterable: true } },
|
|
||||||
fieldNames: { label: 'userLabel', value: 'userStatus' },
|
|
||||||
render: scope => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{BUTTONS.value.status ? (
|
|
||||||
<el-switch
|
|
||||||
model-value={scope.row.status}
|
|
||||||
active-text={scope.row.status ? '启用' : '禁用'}
|
|
||||||
active-value={1}
|
|
||||||
inactive-value={0}
|
|
||||||
onClick={() => changeStatus(scope.row)}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<el-tag type={scope.row.status ? 'success' : 'danger'}>{scope.row.status ? '启用' : '禁用'}</el-tag>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
width: 180,
|
|
||||||
search: {
|
|
||||||
el: 'date-picker',
|
|
||||||
span: 1,
|
|
||||||
props: { type: 'daterange', valueFormat: 'YYYY-MM-DD' },
|
|
||||||
defaultValue: ['2024-11-12', '2024-12-12'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
// 下钻
|
|
||||||
const deleteAccount = async () => {
|
|
||||||
openView.value.open('测试弹出框')
|
|
||||||
}
|
|
||||||
// 批量删除用户信息
|
|
||||||
const batchDelete = async (id: string[]) => {
|
|
||||||
await useHandleData(deleteUser, { id }, '删除所选用户信息')
|
|
||||||
proTable.value?.clearSelection()
|
|
||||||
proTable.value?.getTableList()
|
|
||||||
}
|
|
||||||
// 重置用户密码
|
|
||||||
const resetPass = async (params: any) => {
|
|
||||||
// await useHandleData(resetUserPassWord, { id: params.id }, `重置【${params.username}】用户密码`)
|
|
||||||
// proTable.value?.getTableList()
|
|
||||||
doubleColumn.value.open('双列弹出框')
|
|
||||||
}
|
|
||||||
// 切换用户状态
|
|
||||||
const changeStatus = async (row: any) => {
|
|
||||||
// await useHandleData(changeUserStatus, {
|
|
||||||
// id: row.id,
|
|
||||||
// status: row.status == 1 ? 0 : 1,
|
|
||||||
// }, `切换【${row.username}】用户状态`)
|
|
||||||
proTable.value?.getTableList()
|
|
||||||
}
|
|
||||||
// 导出用户列表
|
|
||||||
const downloadFile = async () => {
|
|
||||||
|
|
||||||
}
|
|
||||||
// 批量添加用户
|
|
||||||
const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
|
|
||||||
const batchAdd = () => {
|
|
||||||
const params = {
|
|
||||||
title: '用户',
|
|
||||||
getTableList: proTable.value?.getTableList,
|
|
||||||
}
|
|
||||||
dialogRef.value?.acceptParams(params)
|
|
||||||
}
|
|
||||||
// 打开 drawer(新增、查看、编辑)
|
|
||||||
const openDrawer = (title: string, row: Partial<any> = {}) => {
|
|
||||||
singleColumn.value.open('单列弹出框')
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
<!--单列-->
|
|
||||||
<template>
|
|
||||||
<el-dialog class='table-box'
|
|
||||||
v-model='dialogVisible'
|
|
||||||
top='114px'
|
|
||||||
:style="{height:height+'px',maxHeight:height+'px',overflow:'hidden'}"
|
|
||||||
:title='title'
|
|
||||||
:width='width'
|
|
||||||
:modal='false'>
|
|
||||||
<div class='table-box' :style="{height:(height-64)+'px',maxHeight:(height-64)+'px',overflow:'hidden'}">
|
|
||||||
<ProTable
|
|
||||||
ref='proTable'
|
|
||||||
:columns='columns'
|
|
||||||
:data='userData'
|
|
||||||
>
|
|
||||||
<!-- 表格 header 按钮 -->
|
|
||||||
<template #tableHeader='scope'>
|
|
||||||
<el-button type='primary' :icon='CirclePlus' @click="openDrawer('新增')">新增用户</el-button>
|
|
||||||
</template>
|
|
||||||
<!-- 表格操作 -->
|
|
||||||
<template #operation='scope'>
|
|
||||||
<el-button type='primary' link :icon='View'
|
|
||||||
@click="openDrawer('查看', scope.row)">查看
|
|
||||||
</el-button>
|
|
||||||
<el-button type='primary' link :icon='EditPen' @click="openDrawer('编辑', scope.row)">编辑</el-button>
|
|
||||||
<el-button type='primary' link :icon='Refresh' @click='resetPass(scope.row)'>重置密码</el-button>
|
|
||||||
<el-button type='primary' link :icon='Delete' @click='deleteAccount(scope.row)'>删除</el-button>
|
|
||||||
</template>
|
|
||||||
</ProTable>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
<script setup lang='tsx'>
|
|
||||||
import { CirclePlus, Delete, EditPen, Refresh, View } from '@element-plus/icons-vue'
|
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
|
||||||
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
|
||||||
import { reactive } from 'vue'
|
|
||||||
import { ColumnProps } from '@/components/ProTable/interface'
|
|
||||||
import { User } from '@/api/user/interface'
|
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
|
||||||
import {
|
|
||||||
changeUserStatus,
|
|
||||||
} from '@/api/user/user'
|
|
||||||
import userDataList from '@/api/user/userData'
|
|
||||||
|
|
||||||
const userData = userDataList
|
|
||||||
const proTable = ref()
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const title = ref('单列弹出框')
|
|
||||||
|
|
||||||
const { BUTTONS } = useAuthButtons()
|
|
||||||
// 表格配置项
|
|
||||||
const columns = reactive<ColumnProps<User.ResUserList>[]>([
|
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
|
||||||
{
|
|
||||||
prop: 'username',
|
|
||||||
label: '姓名',
|
|
||||||
width: 120,
|
|
||||||
search: { el: 'input' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'gender',
|
|
||||||
label: '性别',
|
|
||||||
// 字典数据(本地数据)
|
|
||||||
enum: dictStore.getDictData('sex'),
|
|
||||||
search: { el: 'select', props: { filterable: true } },
|
|
||||||
fieldNames: { label: 'label', value: 'code' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'age',
|
|
||||||
label: '年龄',
|
|
||||||
search: {
|
|
||||||
// 自定义 search 显示内容
|
|
||||||
render: ({ searchParam }) => {
|
|
||||||
return (
|
|
||||||
<div class='flx-center'>
|
|
||||||
<el-input vModel_trim={searchParam.minAge} placeholder='最小年龄' />
|
|
||||||
<span class='mr10 ml10'>-</span>
|
|
||||||
<el-input vModel_trim={searchParam.maxAge} placeholder='最大年龄' />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ prop: 'idCard', label: '身份证号', search: { el: 'input' } },
|
|
||||||
{ prop: 'email', label: '邮箱' },
|
|
||||||
{ prop: 'address', label: '居住地址', width: 120 },
|
|
||||||
{
|
|
||||||
prop: 'status',
|
|
||||||
label: '状态',
|
|
||||||
enum: dictStore.getDictData('status'),
|
|
||||||
search: { el: 'tree-select', props: { filterable: true } },
|
|
||||||
fieldNames: { label: 'userLabel', value: 'userStatus' },
|
|
||||||
render: scope => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{BUTTONS.value.status ? (
|
|
||||||
<el-switch
|
|
||||||
model-value={scope.row.status}
|
|
||||||
active-text={scope.row.status ? '启用' : '禁用'}
|
|
||||||
active-value={1}
|
|
||||||
inactive-value={0}
|
|
||||||
onClick={() => changeStatus(scope.row)}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<el-tag type={scope.row.status ? 'success' : 'danger'}>{scope.row.status ? '启用' : '禁用'}</el-tag>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
width: 180,
|
|
||||||
search: {
|
|
||||||
el: 'date-picker',
|
|
||||||
span: 1,
|
|
||||||
props: { type: 'daterange', valueFormat: 'YYYY-MM-DD' },
|
|
||||||
defaultValue: ['2024-11-12', '2024-12-12'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
const open = (textTitle: string) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
title.value = textTitle
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
defineExpose({ open })
|
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
width: {
|
|
||||||
type: Number,
|
|
||||||
default: 800,
|
|
||||||
},
|
|
||||||
height: {
|
|
||||||
type: Number,
|
|
||||||
default: 744,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// 切换用户状态
|
|
||||||
const changeStatus = async (row: User.ResUserList) => {
|
|
||||||
await useHandleData(changeUserStatus, {
|
|
||||||
id: row.id,
|
|
||||||
status: row.status == 1 ? 0 : 1,
|
|
||||||
}, `切换【${row.username}】用户状态`)
|
|
||||||
proTable.value?.getTableList()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除用户信息
|
|
||||||
const deleteAccount = async (params: User.ResUserList) => {
|
|
||||||
|
|
||||||
}
|
|
||||||
// 重置用户密码
|
|
||||||
const resetPass = async (params: User.ResUserList) => {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 打开 drawer(新增、查看、编辑)
|
|
||||||
const openDrawer = (title: string, row: Partial<User.ResUserList> = {}) => {
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
<!--单列-->
|
|
||||||
<template>
|
|
||||||
<el-dialog v-model='dialogVisible' :title='title' v-bind='dialogSmall'>
|
|
||||||
<el-scrollbar>
|
|
||||||
<el-form
|
|
||||||
:model='form'
|
|
||||||
:inline='false'
|
|
||||||
label-width='auto'
|
|
||||||
ref='formRuleRef'
|
|
||||||
:rules='rules'
|
|
||||||
>
|
|
||||||
<el-form-item label='姓名' prop='username'>
|
|
||||||
<el-input
|
|
||||||
v-model='form.username'
|
|
||||||
placeholder='请输入姓名'
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label='性别' prop='gender'>
|
|
||||||
<el-radio-group v-model='form.gender'>
|
|
||||||
<el-radio-button :label='0'>男</el-radio-button>
|
|
||||||
<el-radio-button :label='1'>女</el-radio-button>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label='年龄' prop='age'>
|
|
||||||
<el-input
|
|
||||||
v-model='form.age'
|
|
||||||
placeholder='年龄'
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label='身份证号' prop='idCard'>
|
|
||||||
<el-input
|
|
||||||
v-model='form.idCard'
|
|
||||||
placeholder='身份证号'
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label='邮箱' prop='email'>
|
|
||||||
<el-input
|
|
||||||
v-model='form.email'
|
|
||||||
placeholder='邮箱'
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label='居住地址' prop='address'>
|
|
||||||
<el-input
|
|
||||||
v-model='form.address'
|
|
||||||
placeholder='居住地址'
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
</el-scrollbar>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<div class='dialog-footer'>
|
|
||||||
<el-button @click='close()'>取消</el-button>
|
|
||||||
<el-button type='primary' @click='confirmForm()'>确定</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
<script setup lang='ts'>
|
|
||||||
import { dialogSmall } from '@/utils/elementBind'
|
|
||||||
import { FormInstance, FormItemRule } from 'element-plus'
|
|
||||||
|
|
||||||
interface userForm {
|
|
||||||
id?: string; //用户ID,作为唯一标识
|
|
||||||
username: string; //用户名
|
|
||||||
gender: number; // 性别
|
|
||||||
age: number; // 年龄
|
|
||||||
idCard: string; // 身份证
|
|
||||||
email: string; // 邮箱
|
|
||||||
address?: string; // 地址
|
|
||||||
}
|
|
||||||
|
|
||||||
const form: Ref<userForm> = ref({
|
|
||||||
username: '',
|
|
||||||
gender: 0,
|
|
||||||
age: 1,
|
|
||||||
idCard: '',
|
|
||||||
email: '',
|
|
||||||
})
|
|
||||||
|
|
||||||
const formRuleRef = ref<FormInstance>()
|
|
||||||
//定义校验规则
|
|
||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
|
||||||
username: [{ required: true, message: '用户名必填!', trigger: 'blur' }],
|
|
||||||
age: [
|
|
||||||
{ required: true, message: '年龄必填!', trigger: 'blur' },
|
|
||||||
// 指定正则,此处是数字正则
|
|
||||||
{ pattern: /^[1-9][0-9]?$|^100$/, message: '年龄必须在1到100之间', trigger: 'blur' },
|
|
||||||
],
|
|
||||||
idCard: [
|
|
||||||
{ required: true, message: '身份证必填!', trigger: 'blur' },
|
|
||||||
// 指定正则,此处是身份证正则
|
|
||||||
{ pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, message: '请输入正确的身份证号码', trigger: 'blur' },
|
|
||||||
],
|
|
||||||
email: [
|
|
||||||
{ required: true, message: '邮箱必填!', trigger: 'blur' },
|
|
||||||
// 指定校验类型
|
|
||||||
{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] },
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 重置表单
|
|
||||||
*/
|
|
||||||
const resetForm = () => {
|
|
||||||
form.value = {
|
|
||||||
username: '',
|
|
||||||
gender: 0,
|
|
||||||
age: 1,
|
|
||||||
idCard: '',
|
|
||||||
email: '',
|
|
||||||
address: '',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const title = ref('单列弹出框')
|
|
||||||
const open = (textTitle: string) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
title.value = textTitle
|
|
||||||
}
|
|
||||||
|
|
||||||
// 关闭弹出框
|
|
||||||
const close = () => {
|
|
||||||
//重置表单内容
|
|
||||||
//取消表单校验状态
|
|
||||||
formRuleRef.value && formRuleRef.value.resetFields()
|
|
||||||
dialogVisible.value = false
|
|
||||||
resetForm()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验表单数据
|
|
||||||
* 数据没问题,提交数据,并根据业务情况请求新增接口还是修改接口
|
|
||||||
*/
|
|
||||||
const confirmForm = () => {
|
|
||||||
ElMessage.info('业务数据提交')
|
|
||||||
try {
|
|
||||||
formRuleRef.value?.validate((valid: boolean) => {
|
|
||||||
if (valid) {
|
|
||||||
// 将表单数据转为json,发送到后端
|
|
||||||
let confirmFormData = JSON.parse(JSON.stringify(form.value))
|
|
||||||
|
|
||||||
if ('是否新增') {
|
|
||||||
// 执行新增接口
|
|
||||||
} else {
|
|
||||||
// 执行修改接口
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ElMessage.error('表单验证失败!')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
console.error('验证过程中发生错误', error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({ open })
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -6,202 +6,309 @@
|
|||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
max-height="400px"
|
max-height="400px"
|
||||||
:span-method="objectSpanMethod">
|
:span-method="objectSpanMethod">
|
||||||
<el-table-column prop="MonitorIdx" label="监测点序号" width="80"/>
|
<el-table-column prop="monitorNum" label="监测点序号" width="80"/>
|
||||||
<!-- <el-table-column prop="updateTime" label="上送时刻" width="180"/> -->
|
<el-table-column prop="desc" label="描述" width="90"/>
|
||||||
<el-table-column prop="deviceName" label="描述" width="90"/>
|
|
||||||
<el-table-column label="电压通道" >
|
<el-table-column label="电压通道" >
|
||||||
<el-table-column prop="Ua" label="L1">
|
<el-table-column prop="Ua" label="A相">
|
||||||
<el-table-column prop="UaData" label="数据(V)">
|
<el-table-column prop="aVuData" label="被检值(V)" width="100px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-icon v-if="scope.row.UaData === '—'&& loading" class="loading-box">
|
<el-icon v-if="scope.row.aVuData === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ scope.row.UaData }}
|
{{ scope.row.aVuData }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="UaChannel" label="系数">
|
<el-table-column prop="aVuXi" label="检测结果" width="90px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag type="danger" v-if="scope.row.UaChannel === '不合格'">
|
<el-tooltip
|
||||||
{{ scope.row.UaChannel }}
|
v-if="scope.row.aVuXi === '不合格'"
|
||||||
</el-tag>
|
class="item"
|
||||||
<el-icon v-else-if="scope.row.UaChannel === '—'&& loading" class="loading-box">
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.aV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.aVuXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.aVuXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.aV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.aVuXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<!-- <el-tag type="danger" v-if="scope.row.aVuXi === '不合格'">
|
||||||
|
{{ scope.row.aVuXi }}
|
||||||
|
</el-tag> -->
|
||||||
|
<el-icon v-else-if="scope.row.aVuXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
<!-- <span v-else>
|
||||||
{{ scope.row.UaChannel }}
|
{{ scope.row.aVuXi }}
|
||||||
</span>
|
</span> -->
|
||||||
<!-- <el-tag type="danger" v-if="scope.row.UaChannel === '不合格'">{{ scope.row.UaChannel }}</el-tag> -->
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="Ub" label="L2">
|
<el-table-column prop="Ub" label="B相">
|
||||||
<el-table-column prop="UbData" label="数据(V)">
|
<el-table-column prop="bVuData" label="被检值(V)" width="100px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-icon v-if="scope.row.UbData === '—'&& loading" class="loading-box">
|
<el-icon v-if="scope.row.bVuData === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ scope.row.UbData }}
|
{{ scope.row.bVuData }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="UbChannel" label="系数">
|
<el-table-column prop="bVuXi" label="检测结果" width="90px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag type="danger" v-if="scope.row.UbChannel === '不合格'">
|
<el-tooltip
|
||||||
{{ scope.row.UbChannel }}
|
v-if="scope.row.bVuXi === '不合格'"
|
||||||
</el-tag>
|
class="item"
|
||||||
<el-icon v-else-if="scope.row.UbChannel === '—'&& loading" class="loading-box">
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.bV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.bVuXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.bVuXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.bV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.bVuXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-icon v-else-if="scope.row.bVuXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
|
||||||
{{ scope.row.UbChannel }}
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="Uc" label="L3">
|
<el-table-column prop="Uc" label="C相">
|
||||||
<el-table-column prop="UcData" label="数据(V)">
|
<el-table-column prop="cVuData" label="被检值(V)" width="100px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-icon v-if="scope.row.UcData === '—'&& loading" class="loading-box">
|
<el-icon v-if="scope.row.cVuData === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ scope.row.UcData }}
|
{{ scope.row.cVuData }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="UcChannel" label="系数">
|
<el-table-column prop="cVuXi" label="检测结果" width="90px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag type="danger" v-if="scope.row.UcChannel === '不合格'">
|
<el-tooltip
|
||||||
{{ scope.row.UcChannel }}
|
v-if="scope.row.cVuXi === '不合格'"
|
||||||
</el-tag>
|
class="item"
|
||||||
<el-icon v-else-if="scope.row.UcChannel === '—'&& loading" class="loading-box">
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.cV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.cVuXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.cVuXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4) + 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.cV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.cVuXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-icon v-else-if="scope.row.cVuXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
|
||||||
{{ scope.row.UcChannel }}
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="电流通道" >
|
<el-table-column label="电流通道" >
|
||||||
<el-table-column prop="Ia" label="L1">
|
<el-table-column prop="Ia" label="A相">
|
||||||
<el-table-column prop="IaData" label="数据(A)">
|
<el-table-column prop="aIeData" label="被检值(A)" width="100px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-icon v-if="scope.row.IaData === '—'&& loading" class="loading-box">
|
<el-icon v-if="scope.row.aIeData === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ scope.row.IaData }}
|
{{ scope.row.aIeData }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="IaChannel" label="系数">
|
<el-table-column prop="aIeXi" label="检测结果" width="90px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag type="danger" v-if="scope.row.IaChannel === '不合格'">
|
<el-tooltip
|
||||||
{{ scope.row.IaChannel }}
|
v-if="scope.row.aIeXi === '不合格'"
|
||||||
</el-tag>
|
class="item"
|
||||||
<el-icon v-else-if="scope.row.IaChannel === '—'&& loading" class="loading-box">
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{-0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.aI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.aIeXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.aIeXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ -0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.aI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.aIeXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-icon v-else-if="scope.row.aIeXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
|
||||||
{{ scope.row.IaChannel }}
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="Ib" label="L2">
|
<el-table-column prop="Ib" label="B相">
|
||||||
<el-table-column prop="IbData" label="数据(A)">
|
<el-table-column prop="bIeData" label="被检值(A)" width="100px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-icon v-if="scope.row.IbData === '—'&& loading" class="loading-box">
|
<el-icon v-if="scope.row.bIeData === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ scope.row.IbData }}
|
{{ scope.row.bIeData }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="IbChannel" label="系数">
|
<el-table-column prop="bIeXi" label="检测结果" width="90px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag type="danger" v-if="scope.row.IbChannel === '不合格'">
|
<el-tooltip
|
||||||
{{ scope.row.IbChannel }}
|
v-if="scope.row.bIeXi === '不合格'"
|
||||||
</el-tag>
|
class="item"
|
||||||
<el-icon v-else-if="scope.row.IbChannel === '—'&& loading" class="loading-box">
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ -0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.bI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.bIeXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.bIeXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ -0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.bI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.bIeXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-icon v-else-if="scope.row.bIeXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
|
||||||
{{ scope.row.IbChannel }}
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="Ic" label="L3">
|
<el-table-column prop="Ic" label="C相">
|
||||||
<el-table-column prop="IcData" label="数据(A)">
|
<el-table-column prop="cIeData" label="被检值(A)" width="100px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-icon v-if="scope.row.IcData === '—'&& loading" class="loading-box">
|
<el-icon v-if="scope.row.cIeData === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ scope.row.IcData }}
|
{{ scope.row.cIeData }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="IcChannel" label="系数">
|
<el-table-column prop="cIeXi" label="检测结果" width="90px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag type="danger" v-if="scope.row.IcChannel === '不合格'">
|
<el-tooltip
|
||||||
{{ scope.row.IcChannel }}
|
v-if="scope.row.cIeXi === '不合格'"
|
||||||
</el-tag>
|
class="item"
|
||||||
<el-icon v-else-if="scope.row.IcChannel === '—'&& loading" class="loading-box">
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ -0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.cI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.cIeXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.cIeXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ -0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.cI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.cIeXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-icon v-else-if="scope.row.cIeXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
<el-icon-loading />
|
<el-icon-loading />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-else>
|
|
||||||
{{ scope.row.IcChannel }}
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column label="校准结果">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag type="danger" v-if="scope.row.Result === '不合格'">{{ scope.row.Result }}</el-tag>
|
|
||||||
<span v-if="scope.row.Result != '不合格'">{{ scope.row.Result }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column> -->
|
|
||||||
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="ErrorSystemDialog">
|
<script lang="ts" setup name="ErrorSystemDialog">
|
||||||
import { defineProps } from 'vue';
|
import { defineProps, type PropType } from 'vue';
|
||||||
import { ElIcon, ElLoading, ElTag } from 'element-plus';
|
import { ElIcon, ElLoading, ElTag } from 'element-plus';
|
||||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
import type { ChannelsTest } from '@/api/home/interface/channelsTest';
|
||||||
|
import { number } from 'echarts';
|
||||||
|
|
||||||
const props = defineProps<{
|
interface Props {
|
||||||
tableData: Array<{
|
tableData: ChannelsTest.CoefficientVO[];
|
||||||
id: string;
|
big_V_loading: boolean;
|
||||||
deviceName?: string;
|
curV: number;
|
||||||
MonitorIdx: number;
|
}
|
||||||
UaData?: number | string;
|
|
||||||
UaChannel?: number | string;
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
UbData?: number | string;
|
tableData: () => [],
|
||||||
UbChannel?: number | string;
|
big_V_loading: false,
|
||||||
UcData?: number | string;
|
curV: 0,
|
||||||
UcChannel?: number | string;
|
});
|
||||||
IaData?: number | string;
|
|
||||||
IaChannel?: number | string;
|
|
||||||
IbData?: number | string;
|
|
||||||
IbChannel?: number | string;
|
|
||||||
IcData?: number | string;
|
|
||||||
IcChannel?: number | string;
|
|
||||||
Result?: string | string;
|
|
||||||
updateTime?: string;
|
|
||||||
}>
|
|
||||||
loading: boolean; // 定义 loading 属性
|
|
||||||
}>();
|
|
||||||
|
|
||||||
function objectSpanMethod({ row, column, rowIndex, columnIndex }: { row: any, column: any, rowIndex: number, columnIndex: number }) {
|
function objectSpanMethod({ row, column, rowIndex, columnIndex }: { row: any, column: any, rowIndex: number, columnIndex: number }) {
|
||||||
if (columnIndex === 0) {
|
if (columnIndex === 0) {
|
||||||
@@ -232,64 +339,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const tableData = ref([
|
|
||||||
// {
|
|
||||||
// id: '1',
|
|
||||||
// updateTime: '2024-10-10 10:30:00',
|
|
||||||
// deviceName:'被检设备1',
|
|
||||||
// MonitorIdx: 1,
|
|
||||||
// Ua:1.0003,
|
|
||||||
// Ub:1.0003,
|
|
||||||
// Uc:0.0096,
|
|
||||||
// Ia:1.0003,
|
|
||||||
// Ib:1.0003,
|
|
||||||
// Ic:1.0008,
|
|
||||||
// Result: '合格',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: '2',
|
|
||||||
// updateTime: '2024-10-10 10:30:00',
|
|
||||||
// deviceName:'被检设备1',
|
|
||||||
// MonitorIdx: 2,
|
|
||||||
// Ua:1.0003,
|
|
||||||
// Ub:1.0003,
|
|
||||||
// Uc:0.0096,
|
|
||||||
// Ia:1.0003,
|
|
||||||
// Ib:1.0003,
|
|
||||||
// Ic:1.0008,
|
|
||||||
// Result: '合格',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: '3',
|
|
||||||
// updateTime: '2024-10-10 10:30:00',
|
|
||||||
// deviceName:'被检设备1',
|
|
||||||
// MonitorIdx: 3,
|
|
||||||
// Ua:1.0003,
|
|
||||||
// Ub:1.0003,
|
|
||||||
// Uc:0.0096,
|
|
||||||
// Ia:1.0003,
|
|
||||||
// Ib:1.0003,
|
|
||||||
// Ic:1.0008,
|
|
||||||
// Result: '合格',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: '4',
|
|
||||||
// updateTime: '2024-10-10 10:30:00',
|
|
||||||
// deviceName:'被检设备1',
|
|
||||||
// MonitorIdx: 4,
|
|
||||||
// Ua:1.0003,
|
|
||||||
// Ub:1.0003,
|
|
||||||
// Uc:0.0096,
|
|
||||||
// Ia:1.0003,
|
|
||||||
// Ib:1.0003,
|
|
||||||
// Ic:1.0008,
|
|
||||||
// Result: '合格',
|
|
||||||
// },
|
|
||||||
// ])
|
|
||||||
|
|
||||||
|
|
||||||
// 监听 tableData 的变化
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -330,6 +379,19 @@
|
|||||||
animation: rotate 2s linear infinite;
|
animation: rotate 2s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-margin {
|
||||||
|
margin-left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-align {
|
||||||
|
vertical-align: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tooltip-content {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@keyframes rotate {
|
@keyframes rotate {
|
||||||
from {
|
from {
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
|
|||||||
@@ -422,9 +422,9 @@ const scrollContainer = ref<HTMLElement | null>(null); // 声明 scrollContainer
|
|||||||
|
|
||||||
const scrollToBottom = () => {
|
const scrollToBottom = () => {
|
||||||
if (scrollContainer.value) {
|
if (scrollContainer.value) {
|
||||||
console.log(scrollContainer.value)
|
//console.log(scrollContainer.value)
|
||||||
scrollContainer.value.scrollTop = scrollContainer.value.scrollHeight;
|
scrollContainer.value.scrollTop = scrollContainer.value.scrollHeight;
|
||||||
console.log(scrollContainer.value)
|
//console.log(scrollContainer.value)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -541,7 +541,7 @@ function traverseTableData(data: any[], id: string): void {
|
|||||||
item[field1] = "danger";
|
item[field1] = "danger";
|
||||||
item[field2] = "×";
|
item[field2] = "×";
|
||||||
columnList.value.push(activeIndex.value.toString());
|
columnList.value.push(activeIndex.value.toString());
|
||||||
console.log(id,activeIndex.value,columnList.value)
|
// console.log(id,activeIndex.value,columnList.value)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
item[field1] = "success";
|
item[field1] = "success";
|
||||||
@@ -561,7 +561,7 @@ function traverseTableData(data: any[], id: string): void {
|
|||||||
const updateTableData = (id: string) => {
|
const updateTableData = (id: string) => {
|
||||||
|
|
||||||
traverseTableData(tableData.value, id);
|
traverseTableData(tableData.value, id);
|
||||||
console.log(id)
|
// console.log(id)
|
||||||
};
|
};
|
||||||
|
|
||||||
let timer: any = ref("");
|
let timer: any = ref("");
|
||||||
@@ -582,7 +582,7 @@ const handleFinishTest = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = (row: any) => {
|
const handleClick = (row: any) => {
|
||||||
console.log(111, row)
|
// console.log(111, row)
|
||||||
dataCheckSingleChannelSingleTestDialogVisable.value = true;
|
dataCheckSingleChannelSingleTestDialogVisable.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1885,7 +1885,7 @@ const startTimer = () => {
|
|||||||
//if (timer.value !== null) return; // 如果定时器已经启动,则不再重复启动
|
//if (timer.value !== null) return; // 如果定时器已经启动,则不再重复启动
|
||||||
timer.value = setInterval(() => {
|
timer.value = setInterval(() => {
|
||||||
|
|
||||||
console.log(activeIndex.value, 111)
|
// console.log(activeIndex.value, 111)
|
||||||
if (activeIndex.value <= activeTotalNum.value) {
|
if (activeIndex.value <= activeTotalNum.value) {
|
||||||
activeIndex.value++;
|
activeIndex.value++;
|
||||||
|
|
||||||
@@ -1943,10 +1943,10 @@ const startTimer = () => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log(activeIndex.value, 222)
|
// console.log(activeIndex.value, 222)
|
||||||
clearInterval(timer.value)
|
clearInterval(timer.value)
|
||||||
reportDisabled.value = false;
|
reportDisabled.value = false;
|
||||||
console.log(activeIndex.value, 333)
|
// console.log(activeIndex.value, 333)
|
||||||
}
|
}
|
||||||
qualified.value = 92
|
qualified.value = 92
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ const monitorIdxList = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
const handleNodeClick = (data) => {
|
const handleNodeClick = (data) => {
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
};
|
};
|
||||||
const MonIsShow = ref(false)
|
const MonIsShow = ref(false)
|
||||||
const DevIsShow = ref(false)
|
const DevIsShow = ref(false)
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<el-button v-if="tableData.length > 0" type="primary" @click="exportData" style="margin-bottom: 10px">导出</el-button>
|
||||||
<div class="table-main">
|
<div class="table-main">
|
||||||
<el-table :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="335px"
|
:cell-style="{ textAlign: 'center' }" height="315px"
|
||||||
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="updateTime" label="数据时间"/>
|
<el-table-column prop="time" label="数据时间"/>
|
||||||
<template v-if="phaseFlag === 0">
|
<template v-if="!isThreePhase && phaseT === 0">
|
||||||
<el-table-column prop="A" :label="`A(${unit})`"/>
|
<el-table-column prop="dataA" :label="'A相'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="B" :label="`B(${unit})`"/>
|
<el-table-column prop="dataB" :label="'B相'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="C" :label="`C(${unit})`"/>
|
<el-table-column prop="dataC" :label="'C相'+(unit==''?'':'('+unit+')')"/>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="phaseFlag === 1">
|
<template v-if="!isThreePhase && phaseT === 1">
|
||||||
<el-table-column prop="T" :label="`T(${unit})`"/>
|
<el-table-column prop="dataT" :label="tableHeader+(unit==''?'':'('+unit+')')"/>
|
||||||
|
</template>
|
||||||
|
<template v-if="isThreePhase">
|
||||||
|
<el-table-column prop="dataB" :label="'负序不平衡度'+(unit==''?'':'('+unit+')')"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,26 +23,39 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="tsx" setup>
|
<script lang="tsx" setup>
|
||||||
|
|
||||||
import {CheckData} from "@/api/check/interface";
|
import {CheckData} from "@/api/check/interface";
|
||||||
|
import {computed} from "vue";
|
||||||
|
|
||||||
const {tableData} = defineProps<{
|
const {tableData, currentScriptTypeName} = defineProps<{
|
||||||
tableData: CheckData.RawDataItem[]
|
tableData: CheckData.RawDataItem[]
|
||||||
|
currentScriptTypeName: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits(['exportRawDataHandler'])
|
||||||
|
|
||||||
const unit = computed(() => {
|
const unit = computed(() => {
|
||||||
return "V"
|
return tableData.length > 0 ? tableData[0].unit : '';
|
||||||
})
|
})
|
||||||
|
|
||||||
const phaseFlag = computed(() => {
|
const phaseT = computed(() => {
|
||||||
let result = 0;
|
return tableData[0].dataT == '/' ? 0 : 1
|
||||||
if (tableData.length > 0) {
|
})
|
||||||
result = !tableData[0].T ? 0 : 1;
|
|
||||||
|
const tableHeader = computed(() => {
|
||||||
|
if (phaseT.value === 1) {
|
||||||
|
let index = currentScriptTypeName.indexOf('=');
|
||||||
|
return currentScriptTypeName.substring(0, index);
|
||||||
}
|
}
|
||||||
return result;
|
return currentScriptTypeName
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const isThreePhase = computed(() => {
|
||||||
|
return currentScriptTypeName.includes('三相电压不平衡度') || currentScriptTypeName.includes('三相电流不平衡度')
|
||||||
|
})
|
||||||
|
|
||||||
|
const exportData = () => {
|
||||||
|
emit('exportRawDataHandler')
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -1,74 +1,96 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="table-main">
|
<div class="table-main">
|
||||||
<el-table :data="tableData" height="335px" :header-cell-style="{ textAlign: 'center' } "
|
<el-table v-if="tableData.length > 0" :data="tableData" height="357px" :header-cell-style="{ textAlign: 'center' } "
|
||||||
:cell-style="{ textAlign: 'center' }">
|
:cell-style="{ textAlign: 'center' }">
|
||||||
<!-- <el-table-column prop="chnNum" label="通道号" width="80">-->
|
<!-- <el-table-column prop="chnNum" label="通道号" width="80">-->
|
||||||
<!-- <template #default="{row}">-->
|
<!-- <template #default="{row}">-->
|
||||||
<!-- {{ '通道' + row.chnNum }}-->
|
<!-- {{ '通道' + row.chnNum }}-->
|
||||||
<!-- </template>-->
|
<!-- </template>-->
|
||||||
<!-- </el-table-column>-->
|
<!-- </el-table-column>-->
|
||||||
<template v-if="phaseFlag === 0">
|
<template v-if="phaseT === 0">
|
||||||
<el-table-column :label="`A(${unit})`">
|
<el-table-column label="A相">
|
||||||
<el-table-column prop="standardValue" width="74" label="标准值(V)"/>
|
<el-table-column prop="stdA" width="105" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="A" width="74" label="被检值">
|
<el-table-column prop="dataA" width="105" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
<el-table-column prop="isDataA" label="检测结果">
|
||||||
</el-table-column>
|
<template #default="scope">
|
||||||
<el-table-column prop="A_errValue" width="74" label="误差值">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
|
<template #content>
|
||||||
|
误差范围:{{ scope.row.maxErrorA }} <br/>
|
||||||
|
误差值:{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
|
||||||
|
<el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag>
|
||||||
|
<el-tag type="warning" v-if="scope.row.isDataA === 4">/</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="`B(${unit})`">
|
<el-table-column label="B相">
|
||||||
<el-table-column prop="standardValue" width="74" label="标准值(V)"/>
|
<el-table-column prop="stdB" width="105" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="B" width="74" label="被检值">
|
<el-table-column prop="dataB" width="105" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
<el-table-column prop="isDataB" label="检测结果">
|
||||||
</el-table-column>
|
<template #default="scope">
|
||||||
<el-table-column prop="B_errValue" width="74" label="误差值">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
|
<template #content>
|
||||||
|
误差范围:{{ scope.row.maxErrorB }}<br/>
|
||||||
|
误差值:{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
|
||||||
|
<el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag>
|
||||||
|
<el-tag type="warning" v-if="scope.row.isDataB === 4">/</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="`C(${unit})`">
|
<el-table-column label="C相">
|
||||||
<el-table-column prop="standardValue" width="74" label="标准值(V)"/>
|
<el-table-column prop="stdC" width="105" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="C" width="74" label="被检值">
|
<el-table-column prop="dataC" width="105" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
<el-table-column prop="isDataC" label="检测结果">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ scope.row.maxErrorC }}<br/>
|
||||||
|
误差值:{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
|
||||||
|
<el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag>
|
||||||
|
<el-tag type="warning" v-if="scope.row.isDataC === 4">/</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="C_errValue" width="74" label="误差值">
|
|
||||||
|
|
||||||
</el-table-column>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="maxErrVaule" label="最大误差(V)">
|
|
||||||
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="result" label="检测结果" width="70">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag type="danger" v-if="scope.row.result === '不合格'">{{ scope.row.result }}</el-tag>
|
|
||||||
<span v-if="scope.row.result != '不合格'">{{ scope.row.result }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="phaseFlag === 1">
|
|
||||||
<el-table-column :label="`T(${unit})`">
|
|
||||||
<el-table-column prop="standardValue" label="标准值(V)"/>
|
|
||||||
<el-table-column prop="T" label="被检值">
|
|
||||||
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="T_errValue" label="误差值">
|
|
||||||
|
|
||||||
|
<template v-if="phaseT === 1">
|
||||||
|
<el-table-column :label="tableHeader">
|
||||||
|
<el-table-column prop="stdT" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
<el-table-column prop="dataT" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
<el-table-column prop="isDataT" label="检测结果">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ scope.row.maxErrorT }}<br/>
|
||||||
|
误差值:{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
|
||||||
|
<el-tag type="danger" v-if="scope.row.isDataT === 2">不符合</el-tag>
|
||||||
|
<el-tag type="warning" v-if="scope.row.isDataT === 4">/</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="maxErrVaule" label="最大误差(V)">
|
<!-- <el-table-column prop="maxError" label="误差范围"/>-->
|
||||||
|
<!-- <el-table-column prop="result" label="检测结果">-->
|
||||||
</el-table-column>
|
<!-- <template #default="scope">-->
|
||||||
<el-table-column prop="result" label="检测结果">
|
<!-- <span v-if="scope.row.result === 1">符合</span>-->
|
||||||
<template #default="scope">
|
<!-- <el-tag type="danger" v-if="scope.row.result === 2">不符合</el-tag>-->
|
||||||
<el-tag type="danger" v-if="scope.row.result === '不合格'">{{ scope.row.result }}</el-tag>
|
<!-- <span v-if="scope.row.result === 4">/</span>-->
|
||||||
<span v-if="scope.row.result != '不合格'">{{ scope.row.result }}</span>
|
<!-- </template>-->
|
||||||
</template>
|
<!-- </el-table-column>-->
|
||||||
</el-table-column>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@@ -77,22 +99,37 @@
|
|||||||
import {defineProps} from 'vue';
|
import {defineProps} from 'vue';
|
||||||
import {CheckData} from "@/api/check/interface";
|
import {CheckData} from "@/api/check/interface";
|
||||||
|
|
||||||
const {tableData} = defineProps<{
|
const {tableData, currentScriptTypeName} = defineProps<{
|
||||||
tableData: CheckData.CheckResult[],
|
tableData: CheckData.CheckResult[],
|
||||||
|
currentScriptTypeName: string
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
||||||
const unit = computed(() => {
|
const unit = computed(() => {
|
||||||
return "V"
|
return tableData.length > 0 ? tableData[0].unit : '';
|
||||||
})
|
})
|
||||||
|
|
||||||
const phaseFlag = computed(() => {
|
const phaseT = computed(() => {
|
||||||
let result = 0;
|
return tableData[0].dataT == null || tableData[0].dataT == undefined ? 0 : 1
|
||||||
if (tableData.length > 0) {
|
|
||||||
result = !tableData[0].T ? 0:1;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const tableHeader = computed(() => {
|
||||||
|
if (phaseT.value === 1){
|
||||||
|
let index = currentScriptTypeName.indexOf('=');
|
||||||
|
return currentScriptTypeName.substring(0, index);
|
||||||
|
}
|
||||||
|
return currentScriptTypeName
|
||||||
|
})
|
||||||
|
|
||||||
|
// const maxErrorStr = computed((data) => {
|
||||||
|
// let result = tableData[0].maxError ?? '/'
|
||||||
|
// let idx = result.indexOf('~');
|
||||||
|
// if (idx > 0) {
|
||||||
|
// result = result.substring(0, idx) + unit.value + result.substring(idx, result.length) + unit.value;
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// })
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
814
frontend/src/views/home/components/factorTest.vue
Normal file
814
frontend/src/views/home/components/factorTest.vue
Normal file
@@ -0,0 +1,814 @@
|
|||||||
|
<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: #67C23A">{{ 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";
|
||||||
|
|
||||||
|
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 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 (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 'Coefficient_Check':
|
||||||
|
console.log("Coefficient_Checkactive", active.value);
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'big_end'://大电压,电流下装
|
||||||
|
console.log('大电压,电流下装')
|
||||||
|
active.value++;
|
||||||
|
big_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
|
big_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
|
||||||
|
tableLoading('small', '系数下装')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'small_end'://小电压,电流下装
|
||||||
|
console.log('小电压,电流下装')
|
||||||
|
active.value++;
|
||||||
|
small_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
|
small_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
|
||||||
|
tableLoading('big', '系数校准')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'big_comp_end'://大电压,电流校准
|
||||||
|
console.log('大电压,电流校准')
|
||||||
|
active.value++;
|
||||||
|
big_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
|
big_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
|
||||||
|
tableLoading('small', '系数校准')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'small_comp_end'://小电压,电流校准
|
||||||
|
console.log('小电压,电流校准')
|
||||||
|
active.value++;
|
||||||
|
small_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
|
small_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
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‘为正式检测
|
||||||
|
})
|
||||||
|
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,7 +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"></el-checkbox>
|
||||||
<!-- disabled="true" -->
|
<!-- disabled="true" -->
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -14,11 +14,11 @@
|
|||||||
<div class="dialog-left">
|
<div class="dialog-left">
|
||||||
<el-steps direction="vertical" :active="activeIndex" :process-status="currentStepStatus"
|
<el-steps direction="vertical" :active="activeIndex" :process-status="currentStepStatus"
|
||||||
finish-status="success">
|
finish-status="success">
|
||||||
<el-step :status="step1" title="源通讯校验" />
|
<el-step :status="step1" title="源通讯校验"/>
|
||||||
<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="检测完成"/>
|
||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog-right">
|
<div class="dialog-right">
|
||||||
@@ -26,32 +26,38 @@
|
|||||||
<el-collapse-item title="源通讯校验" name="1">
|
<el-collapse-item title="源通讯校验" name="1">
|
||||||
<div class="div-log">
|
<div class="div-log">
|
||||||
<p v-for="(item, index) in step1InitLog" :key="index"
|
<p v-for="(item, index) in step1InitLog" :key="index"
|
||||||
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||||
{{ item.log }} <br />
|
{{ item.log }} <br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item title="设备通讯校验" name="2">
|
<el-collapse-item title="设备通讯校验" name="2">
|
||||||
<div class="div-log">
|
<div class="div-log">
|
||||||
<p v-for="(item, index) in step2InitLog" :key="index"
|
<p v-for="(item, index) in step2InitLog" :key="index"
|
||||||
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||||
{{ item.log }} <br />
|
{{ item.log }} <br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item title="协议校验" name="3">
|
<el-collapse-item title="协议校验" name="3">
|
||||||
<div class="div-log">
|
<div class="div-log">
|
||||||
<p v-for="(item, index) in step3InitLog" :key="index"
|
<p v-for="(item, index) in step3InitLog" :key="index"
|
||||||
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||||
{{ item.log }} <br />
|
{{ item.log }} <br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item title="相序校验" name="4">
|
<el-collapse-item title="相序校验" name="4">
|
||||||
<div class="div-log">
|
<div class="div-log">
|
||||||
<p v-for="(item, index) in step4InitLog" :key="index"
|
<p v-for="(item, index) in step4InitLog" :key="index"
|
||||||
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||||
{{ item.log }} <br />
|
{{ item.log.split('&&')[0] }}
|
||||||
|
<br v-if="item.log.includes('&&')"/>
|
||||||
|
{{ item.log.split('&&')[1] }}
|
||||||
|
|
||||||
|
<br v-if="item.log.includes('&&')"/>
|
||||||
|
{{ item.log.split('&&')[2] }}
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
@@ -62,8 +68,9 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup name="preTest">
|
<script lang="tsx" setup name="preTest">
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
import { defineExpose } from 'vue';
|
import {defineExpose, toRef} from 'vue';
|
||||||
|
|
||||||
const step1InitLog = ref([
|
const step1InitLog = ref([
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
@@ -222,44 +229,53 @@ const props = defineProps({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const testStatus = toRef(props, 'testStatus');
|
const testStatus = toRef(props, 'testStatus');
|
||||||
const webMsgSend = toRef(props, 'webMsgSend');
|
const webMsgSend = toRef(props, 'webMsgSend');
|
||||||
const ts = ref('');
|
const ts = ref('');
|
||||||
|
|
||||||
watch(webMsgSend,function (newValue,oldValue){
|
watch(webMsgSend, function (newValue, oldValue) {
|
||||||
// console.log(newValue)
|
// console.log(newValue)
|
||||||
|
|
||||||
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 == 10200) {
|
if (newValue.code == 10200) {
|
||||||
step1InitLog.value.push({
|
step1InitLog.value.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log: '源校验成功!',
|
log: '源初始化成功!',
|
||||||
})
|
})
|
||||||
activeIndex.value = 1
|
activeIndex.value = 1
|
||||||
step1.value = 'success'
|
step1.value = 'success'
|
||||||
step2.value = 'process'
|
step2.value = 'process'
|
||||||
}else if(newValue.code == 10201){
|
} else if (newValue.code == 10201) {
|
||||||
step1.value = 'process'
|
step1.value = 'process'
|
||||||
step1InitLog.value = [{
|
step1InitLog.value = [{
|
||||||
type: 'wait',
|
type: 'wait',
|
||||||
log: '正在进行源校验!',
|
log: '正在进行源初始化!',
|
||||||
}];
|
}];
|
||||||
}else if(newValue.code == 10552){
|
} else if (newValue.code == 10552) {
|
||||||
ElMessage.error(newValue.code)
|
ElMessage.error(newValue.code)
|
||||||
step1.value = 'error'
|
step1.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
|
} else if (newValue.code == 10523) {
|
||||||
|
step1.value = 'error'
|
||||||
|
ts.value = 'error'
|
||||||
|
step1InitLog.value = [{
|
||||||
|
type: 'error',
|
||||||
|
log: '源连接失败!',
|
||||||
|
}];
|
||||||
|
} else if (newValue.code == -1) {
|
||||||
|
step1.value = 'error'
|
||||||
|
ts.value = 'error'
|
||||||
|
step1InitLog.value = [{
|
||||||
|
type: 'error',
|
||||||
|
log: '源未知异常!',
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'yjc_sbtxjy':
|
case 'yjc_sbtxjy':
|
||||||
@@ -269,7 +285,7 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
if (newValue.code == 10200) {
|
if (newValue.code == 10200) {
|
||||||
step2InitLog.value.push({
|
step2InitLog.value.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log: newValue.data+'设备通讯校验成功!',
|
log: newValue.data + '设备通讯校验成功!',
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if (newValue.code == 10201) {
|
} else if (newValue.code == 10201) {
|
||||||
@@ -281,14 +297,14 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
} else if (newValue.code == 10550) {
|
} else if (newValue.code == 10550) {
|
||||||
step2InitLog.value.push({
|
step2InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: newValue.data+'设备连接异常!',
|
log: newValue.data + '设备连接异常!',
|
||||||
})
|
})
|
||||||
step2.value = 'error'
|
step2.value = 'error'
|
||||||
ts.value = 'error'
|
// ts.value = 'error'
|
||||||
}else if (newValue.code == 10551) {
|
} else if (newValue.code == 10551) {
|
||||||
step2InitLog.value.push({
|
step2InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: newValue.data+'设备触发报告异常!',
|
log: newValue.data + '设备触发报告异常!',
|
||||||
})
|
})
|
||||||
step2.value = 'error'
|
step2.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
@@ -315,7 +331,7 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
if (newValue.code == 10200) {
|
if (newValue.code == 10200) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log: '统计数据协议校验:'+newValue.data+'通讯协议校验成功!',
|
log: '统计数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if (newValue.code == 10201) {
|
} else if (newValue.code == 10201) {
|
||||||
@@ -327,18 +343,18 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
} else if (newValue.code == 10550) {
|
} else if (newValue.code == 10550) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: newValue.data+'设备连接异常!',
|
log: newValue.data + '设备连接异常!',
|
||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
// ts.value = 'error'
|
||||||
}else if (newValue.code == 10551) {
|
} else if (newValue.code == 10551) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: newValue.data+'设备触发报告异常!',
|
log: newValue.data + '设备触发报告异常!',
|
||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
}else if (newValue.code == 10552) {
|
} else if (newValue.code == 10552) {
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||||
step3InitLog.value = [{
|
step3InitLog.value = [{
|
||||||
@@ -352,7 +368,7 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
if (newValue.code == 10200) {
|
if (newValue.code == 10200) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log: '实时数据协议校验:'+newValue.data+'通讯协议校验成功!',
|
log: '实时数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if (newValue.code == 10201) {
|
} else if (newValue.code == 10201) {
|
||||||
@@ -361,17 +377,17 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
type: 'wait',
|
type: 'wait',
|
||||||
log: '正在进行通讯协议校验.....',
|
log: '正在进行通讯协议校验.....',
|
||||||
}];
|
}];
|
||||||
}else if (newValue.code == 10550) {
|
} else if (newValue.code == 10550) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: newValue.data+'设备连接异常!',
|
log: newValue.data + '设备连接异常!',
|
||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
// ts.value = 'error'
|
||||||
}else if (newValue.code == 10551) {
|
} else if (newValue.code == 10551) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: newValue.data+'设备触发报告异常!',
|
log: newValue.data + '设备触发报告异常!',
|
||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
@@ -389,22 +405,22 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
if (newValue.code == 10200) {
|
if (newValue.code == 10200) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log: '暂态数据协议校验:'+newValue.data+'通讯协议校验成功!',
|
log: '暂态数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if (newValue.code == 10201) {
|
} else if (newValue.code == 10201) {
|
||||||
step3.value = 'process'
|
step3.value = 'process'
|
||||||
}else if (newValue.code == 10550) {
|
} else if (newValue.code == 10550) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: newValue.data+'设备连接异常!',
|
log: newValue.data + '设备连接异常!',
|
||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
// ts.value = 'error'
|
||||||
}else if (newValue.code == 10551) {
|
} else if (newValue.code == 10551) {
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: newValue.data+'设备触发报告异常!',
|
log: newValue.data + '设备触发报告异常!',
|
||||||
})
|
})
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
@@ -431,14 +447,14 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
if (newValue.code == 10200) {
|
if (newValue.code == 10200) {
|
||||||
step4InitLog.value.push({
|
step4InitLog.value.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log: '源已接通!',
|
log: '源参数下发成功,等待校验中.....',
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if (newValue.code == 10201) {
|
} else if (newValue.code == 10201) {
|
||||||
step4.value = 'process'
|
step4.value = 'process'
|
||||||
step4InitLog.value = [{
|
step4InitLog.value = [{
|
||||||
type: 'wait',
|
type: 'wait',
|
||||||
log: '正在接通源.....',
|
log: '源参数下发中.....',
|
||||||
}];
|
}];
|
||||||
} else if (newValue.code == 10552) {
|
} else if (newValue.code == 10552) {
|
||||||
ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||||
@@ -456,9 +472,15 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
|
|
||||||
case 'DATA_REQUEST$02':
|
case 'DATA_REQUEST$02':
|
||||||
if (newValue.code == 10200) {
|
if (newValue.code == 10200) {
|
||||||
|
let type = 'info'
|
||||||
|
if (newValue.data.includes('不合格')) {
|
||||||
|
type = 'error'
|
||||||
|
}
|
||||||
|
|
||||||
|
newValue.data.split('<br/>')
|
||||||
step4InitLog.value.push({
|
step4InitLog.value.push({
|
||||||
type: 'info',
|
type: type,
|
||||||
log: '相序校验:'+newValue.data,
|
log:newValue.data,
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if (newValue.code == 10201) {
|
} else if (newValue.code == 10201) {
|
||||||
@@ -467,8 +489,14 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
type: 'wait',
|
type: 'wait',
|
||||||
log: '获取数据相序校验数据!',
|
log: '获取数据相序校验数据!',
|
||||||
}];
|
}];
|
||||||
}
|
} else if (newValue.code == 25003) {
|
||||||
else if (newValue.code == 25001) {
|
step4.value = 'error'
|
||||||
|
step4InitLog.value.push({
|
||||||
|
type: 'error',
|
||||||
|
log: '相序校验未通过!',
|
||||||
|
})
|
||||||
|
ts.value = 'error'
|
||||||
|
} else if (newValue.code == 25001) {
|
||||||
step4.value = 'success'
|
step4.value = 'success'
|
||||||
step5.value = 'success'
|
step5.value = 'success'
|
||||||
step4InitLog.value.push({
|
step4InitLog.value.push({
|
||||||
@@ -478,6 +506,7 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
}
|
}
|
||||||
activeIndex.value = 5
|
activeIndex.value = 5
|
||||||
ts.value = 'success'
|
ts.value = 'success'
|
||||||
|
console.log("@@@@",ts.value)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,7 +514,7 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
case 'quit':
|
case 'quit':
|
||||||
break;
|
break;
|
||||||
case 'connect':
|
case 'connect':
|
||||||
switch (newValue.operateCode){
|
switch (newValue.operateCode) {
|
||||||
case "Source":
|
case "Source":
|
||||||
step1.value = 'error'
|
step1.value = 'error'
|
||||||
step1InitLog.value = [{
|
step1InitLog.value = [{
|
||||||
@@ -504,25 +533,34 @@ watch(webMsgSend,function (newValue,oldValue){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'unknown_operate':
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'error_flow_end':
|
||||||
|
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
ts.value = 'error'
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(activeIndex, function (newValue, oldValue) {
|
watch(activeIndex, function (newValue, oldValue) {
|
||||||
if (newValue <= activeTotalNum.value - 2){
|
if (newValue <= activeTotalNum.value - 2) {
|
||||||
collapseActiveName.value = (newValue+1).toString()
|
collapseActiveName.value = (newValue + 1).toString()
|
||||||
} else{
|
} else {
|
||||||
collapseActiveName.value = (newValue - 1).toString()
|
collapseActiveName.value = (newValue - 1).toString()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
//监听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'
|
||||||
}else if(ts.value === 'waiting'){
|
} else if (ts.value === 'waiting') {
|
||||||
activeIndex.value = 0
|
activeIndex.value = 0
|
||||||
step1InitLog.value = [
|
step1InitLog.value = [
|
||||||
{
|
{
|
||||||
@@ -546,8 +584,6 @@ watch(ts, function (newValue, oldValue) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 定义一个初始化参数的方法
|
// 定义一个初始化参数的方法
|
||||||
function initializeParameters() {
|
function initializeParameters() {
|
||||||
activeIndex.value = 0
|
activeIndex.value = 0
|
||||||
@@ -585,9 +621,6 @@ function initializeParameters() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
initializeParameters,
|
initializeParameters,
|
||||||
});
|
});
|
||||||
|
|||||||
110
frontend/src/views/home/components/selectTestItemPopup.vue
Normal file
110
frontend/src/views/home/components/selectTestItemPopup.vue
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<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 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";
|
||||||
|
|
||||||
|
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 = () => {
|
||||||
|
Object.assign(formContent, {preTest: true, channelsTest: false, timeTest: false, test: false})
|
||||||
|
}
|
||||||
|
|
||||||
|
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')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const handleClose = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 清空dialogForm中的值
|
||||||
|
resetFormContent()
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({open})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,490 +1,488 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" :model-value="dialogVisible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px" draggable>
|
<el-dialog :title="dialogTitle" width="1550px" :model-value="dialogVisible" :before-close="beforeClose" @close="handleClose" height="1000px" draggable>
|
||||||
|
|
||||||
<div class="steps-container">
|
<div class="steps-container">
|
||||||
<!-- simple -->
|
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
|
||||||
<!-- :style="{color:node.label=='未检'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" -->
|
<el-step v-if="preTestSelected" title="预检测" :icon="stepsActive > 1 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Edit" @click="handleStepClick(1)"/>
|
||||||
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success" >
|
<el-step v-if="timeTestSelected" title="守时检测" :icon="stepsActive > 2 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :UploadFilled" @click="handleStepClick(2)"/>
|
||||||
<!-- style="height:100px" -->
|
<el-step v-if="channelsTestSelected" title="系数校准" :icon="stepsActive > 3 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Odometer" @click="handleStepClick(3)"/>
|
||||||
<!-- <el-step title="预检测" :icon="getIcon(0)" /> -->
|
<el-step v-if="testSelected" title="正式检测" :icon="stepsActive > 4 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Coin" @click="handleStepClick(4)"/>
|
||||||
<el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit" />
|
<el-step title="检测完成" :icon="stepsActiveIndex > stepsTotalNum-1 ? SuccessFilled :Key"/>
|
||||||
<el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled" v-if="isTimeCheck"/>
|
</el-steps>
|
||||||
<!-- <el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" /> -->
|
</div>
|
||||||
<el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin" />
|
|
||||||
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key" />
|
<preTest v-if="showComponent&&preTestSelected" v-show="preTestSelected && stepsActiveView==1" ref="preTestRef" v-model:testStatus="preTestStatus"
|
||||||
</el-steps>
|
:webMsgSend="webMsgSend"/>
|
||||||
|
<timeTest v-if="showComponent&&timeTestSelected" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/>
|
||||||
|
<!-- <channelsTest v-if="stepsActiveIndex === 3" v-model:testStatus="channelsTestStatus"></channelsTest>-->
|
||||||
|
<factorTest v-if="showComponent&&channelsTestSelected" v-show="channelsTestSelected && stepsActiveView==3" v-model:testStatus="channelsTestStatus" :webMsgSend="webMsgSend"/>
|
||||||
|
<test v-if="showComponent&&testSelected" v-show="testSelected && stepsActiveView==4" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend"
|
||||||
|
@update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck" :stepsActive="stepsActive"/>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div>
|
||||||
|
<!-- <el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < stepsTotalNum && ActiveStatue != 'success'" @click="nextStep">跳过</el-button>-->
|
||||||
|
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
|
||||||
|
<el-button type="primary"
|
||||||
|
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')"
|
||||||
|
disabled>
|
||||||
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||||
|
<component :is="Refresh"/>
|
||||||
|
</el-icon>
|
||||||
|
检测中
|
||||||
|
</el-button>
|
||||||
|
<!-- <el-button type="primary" v-if="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-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||||
|
<component :is="Refresh"/>
|
||||||
|
</el-icon>
|
||||||
|
初始化中
|
||||||
|
</el-button>
|
||||||
|
<el-button type="warning" v-if="TestStatus === 'paused_ing'" disabled>
|
||||||
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||||
|
<component :is="Refresh"/>
|
||||||
|
</el-icon>
|
||||||
|
暂停中
|
||||||
|
</el-button>
|
||||||
|
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
||||||
|
v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
|
||||||
|
@click="nextStep">
|
||||||
|
{{ nextStepText }}
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<preTest ref="preTestRef" v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest>
|
</template>
|
||||||
<timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
|
</el-dialog>
|
||||||
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
|
|
||||||
<test ref="testRef" v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume"></test>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<div>
|
|
||||||
<!-- <el-button @click="handleCancel">取 消</el-button> -->
|
|
||||||
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled" @click="nextStep">跳过</el-button>
|
|
||||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
|
|
||||||
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'process'" @click="handleSubmit">停止检测</el-button>
|
|
||||||
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'paused'" @click="handleSubmit">继续检测</el-button>
|
|
||||||
<el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button>
|
|
||||||
<el-button type="primary" :icon="Refresh" v-if="ActiveStatue === 'preTest_process'" disabled>预检测中</el-button>
|
|
||||||
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
|
||||||
v-if="ActiveStatue === 'success'||ActiveStatue==='preTest_fail'" @click="nextStep">
|
|
||||||
{{ nextStepText }}
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
|
|
||||||
</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} from '@element-plus/icons-vue'
|
||||||
import {
|
import preTest from './preTest.vue'
|
||||||
Close,
|
import timeTest from './timeTest.vue'
|
||||||
Coin,
|
import factorTest from './factorTest.vue'
|
||||||
DArrowRight,
|
import test from './test.vue'
|
||||||
Edit,
|
import socketClient from '@/utils/webSocketClient';
|
||||||
Key,
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
Odometer,
|
import {pauseTest, resumeTest, startPreTest} from '@/api/socket/socket'
|
||||||
Refresh,
|
|
||||||
Right,
|
const checkStore = useCheckStore();
|
||||||
SuccessFilled,
|
const nextStepText = ref('下一步');
|
||||||
UploadFilled,
|
const dialogVisible = ref(false)
|
||||||
VideoPlay,
|
|
||||||
RefreshLeft
|
const stepsTotalNum = ref(-1);//步骤总数
|
||||||
} from '@element-plus/icons-vue'
|
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
|
||||||
import preTest from './preTest.vue'
|
const stepsActiveView = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
|
||||||
import timeTest from './timeTest.vue'
|
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态,用于切换步骤
|
||||||
import { Device } from '@/api/device/interface/device';
|
const ActiveStatue = ref('waiting');//当前步骤状态
|
||||||
import socketClient from '@/utils/webSocketClient';
|
const preTestStatus = ref('waiting');//预检测执行状态
|
||||||
import {useCheckStore} from "@/stores/modules/check";
|
const timeTestStatus = ref('waiting');//守时校验执行状态
|
||||||
import {startPreTest,startTest,pauseTest,resumeTest} from '@/api/socket/socket'
|
const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
||||||
|
const TestStatus = ref('waiting');//正式检测执行状态
|
||||||
|
const webMsgSend = ref();//webSocket推送的数据
|
||||||
|
|
||||||
|
const dialogTitle = ref('')
|
||||||
|
const showComponent = ref(true)
|
||||||
|
const preTestRef = ref(null)
|
||||||
|
|
||||||
|
const dataSocket = reactive({
|
||||||
|
socketServe: socketClient.Instance,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 勾选的检测内容
|
||||||
|
const preTestSelected = ref(false)
|
||||||
|
const timeTestSelected = ref(false)
|
||||||
|
const channelsTestSelected = ref(false)
|
||||||
|
const testSelected = ref(false)
|
||||||
|
|
||||||
|
const initOperate = () => {
|
||||||
|
ActiveStatue.value = 'waiting'
|
||||||
|
preTestStatus.value = 'waiting'
|
||||||
|
timeTestStatus.value = 'waiting'
|
||||||
|
channelsTestStatus.value = 'waiting'
|
||||||
|
TestStatus.value = 'waiting'
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
let count = 0
|
||||||
|
for (let key in checkStore.selectTestItems) {
|
||||||
|
if (checkStore.selectTestItems[key]) {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stepsTotalNum.value = count + 1
|
||||||
|
|
||||||
|
if (preTestSelected.value) {
|
||||||
|
stepsActiveView.value = 1
|
||||||
|
stepsActive.value = 1
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (timeTestSelected.value) {
|
||||||
|
stepsActiveView.value = 2
|
||||||
|
stepsActive.value = 2
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (channelsTestSelected.value) {
|
||||||
|
stepsActiveView.value = 3
|
||||||
|
stepsActive.value = 3
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (testSelected.value) {
|
||||||
|
stepsActiveView.value = 4
|
||||||
|
stepsActive.value = 4
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const open = (title: string) => {
|
||||||
|
initOperate()
|
||||||
|
dialogTitle.value = title;
|
||||||
|
dialogVisible.value = true;
|
||||||
|
|
||||||
|
if (preTestRef.value) {
|
||||||
|
preTestRef.value.initializeParameters();
|
||||||
|
}
|
||||||
|
|
||||||
|
//开始创建webSocket客户端
|
||||||
|
socketClient.Instance.connect();
|
||||||
|
dataSocket.socketServe = socketClient.Instance;
|
||||||
|
dataSocket.socketServe.registerCallBack('aaa', (res) => {
|
||||||
|
// 处理来自服务器的消息
|
||||||
|
// console.log('Received message:', res);
|
||||||
|
// 根据需要在这里添加更多的处理逻辑
|
||||||
|
if (res.code === 20000) {
|
||||||
|
//ElMessage.error(message.message)
|
||||||
|
// loading.close()
|
||||||
|
} else {
|
||||||
|
webMsgSend.value = res
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// let loading;
|
||||||
|
const handleSubmit = () => {
|
||||||
|
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
||||||
|
let planId = checkStore.plan.id
|
||||||
|
|
||||||
|
if (!dataSocket.socketServe.connected) {
|
||||||
|
ElMessage.error('webSocket连接中断!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log("handleSubmit",stepsActive.value,TestStatus.value)
|
||||||
|
switch (stepsActive.value) {
|
||||||
|
case 1:
|
||||||
|
startPreTest({
|
||||||
|
userPageId: "cdf",
|
||||||
|
devIds: deviceIds,
|
||||||
|
planId: planId,
|
||||||
|
operateType: '1' // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 'A001014') {
|
||||||
|
ElMessageBox.alert('装置配置异常', '检测失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
preTestStatus.value = 'error'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
preTestStatus.value = 'start'
|
||||||
|
// setTimeout(() => {
|
||||||
|
// preTestStatus.value = 'success'
|
||||||
|
// }, 5000)
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
timeTestStatus.value = 'start'
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// 调用系数校准组件的handleSubmit方法
|
||||||
|
channelsTestStatus.value = 'start'
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if (TestStatus.value == "waiting") {
|
||||||
|
startPreTest({
|
||||||
|
userPageId: "cdf",
|
||||||
|
devIds: deviceIds,
|
||||||
|
planId: planId,
|
||||||
|
operateType: checkStore.reCheckType ==1 ?'2':'8' // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.code === 'A001014') {
|
||||||
|
ElMessageBox.alert('装置配置异常', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TestStatus.value = 'test_init_fail'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
TestStatus.value = 'start'
|
||||||
|
} else if (TestStatus.value == 'paused') {
|
||||||
|
// 发送继续指令
|
||||||
|
sendResume()
|
||||||
|
}
|
||||||
|
// else if (TestStatus.value == 'recheck') {
|
||||||
|
// // 发送重新检测指令
|
||||||
|
// sendReCheck()
|
||||||
|
// }
|
||||||
|
// else if (TestStatus.value == 'success') {
|
||||||
|
// handleClose()
|
||||||
|
// }
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//import SvgIcon from '@/components/SvgIcon.vue';
|
const emit = defineEmits<{
|
||||||
|
(e: 'quitClicked'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
// import preTestIcon from '@/assets/icons/preTest.svg'
|
watch(preTestStatus, function (newValue, oldValue) {
|
||||||
|
console.log(newValue, oldValue);
|
||||||
|
|
||||||
// const preTestIcon = `
|
ActiveStatue.value = newValue
|
||||||
// <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
|
})
|
||||||
// </svg>
|
watch(timeTestStatus, function (newValue, oldValue) {
|
||||||
// `;
|
console.log(newValue, oldValue);
|
||||||
// const props = defineProps<{
|
|
||||||
// visible: boolean;
|
|
||||||
// dialogTitle: string;
|
|
||||||
|
|
||||||
// formData: {
|
ActiveStatue.value = newValue
|
||||||
// id: string;//误差体系表Id
|
})
|
||||||
// name: string;//误差体系名称
|
watch(channelsTestStatus, function (newValue, oldValue) {
|
||||||
// standard_Name:string;//参照标准名称
|
console.log(newValue, oldValue);
|
||||||
// standard_Time:string;//标准推行时间
|
|
||||||
// dev_Level:string;//使用设备等级
|
|
||||||
// enable:number;//状态:0-不启用 1-启用
|
|
||||||
// state:number;//0-删除 1-正常
|
|
||||||
// };
|
|
||||||
// }>();
|
|
||||||
|
|
||||||
// const emit = defineEmits<{
|
ActiveStatue.value = newValue
|
||||||
// (e: 'update:visible', value: boolean): void;
|
})
|
||||||
// (e: 'submit', data: any): void;
|
watch(TestStatus, function (newValue, oldValue) {
|
||||||
// }>();
|
console.log(newValue, oldValue);
|
||||||
|
|
||||||
const checkStore = useCheckStore();
|
ActiveStatue.value = newValue
|
||||||
const skipDisabled = ref(false);
|
})
|
||||||
const nextStepText = ref('下一步');
|
|
||||||
const dialogVisible = ref(false)
|
|
||||||
//定义与预检测配置数组
|
|
||||||
const detectionOptions = ref([
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: "源通讯检测",//判断源通讯是否正常
|
|
||||||
selected: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "设备通讯检测",//判断设备的IP、Port、识别码、秘钥是否正常
|
|
||||||
selected: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "协议校验",//ICD报告触发测试
|
|
||||||
selected: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: "相序校验",//判断装置的接线是否正确
|
|
||||||
selected: true,
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// id: 4,
|
|
||||||
// name: "守时校验",//判断装置24小时内的守时误差是否小于1s
|
|
||||||
// selected: true,
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 5,
|
|
||||||
// name: "通道系数校准",//通过私有协议与装置进行通讯,校准三相电压电流的通道系数
|
|
||||||
// selected: true,
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 6,
|
|
||||||
// name: "实时数据比对",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 7,
|
|
||||||
// name: "录波数据比对",
|
|
||||||
// },
|
|
||||||
]);
|
|
||||||
|
|
||||||
const stepsTotalNum = ref(4);//步骤总数
|
watch(ActiveStatue, function (newValue, oldValue) {
|
||||||
const stepsActiveIndex = ref(0); //当前正在执行的步骤索引
|
if (newValue === 'error') {
|
||||||
const ActiveStatue = ref('waiting');//当前步骤状态
|
// stepsActiveIndex.value = stepsTotalNum.value + 2
|
||||||
const preTestStatus = ref('waiting');//预检测执行状态
|
nextStepText.value = '检测失败'
|
||||||
const timeTestStatus = ref('waiting');//守时校验执行状态
|
}
|
||||||
const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 1) {
|
||||||
const TestStatus = ref('waiting');//正式检测执行状态
|
stepsActiveIndex.value += 2
|
||||||
const webMsgSend = ref();//webSocket推送的数据
|
nextStepText.value = '检测完成'
|
||||||
|
}
|
||||||
|
if (newValue === 'test_init_fail') {
|
||||||
|
stepsActiveIndex.value += 2
|
||||||
|
nextStepText.value = '初始化失败'
|
||||||
|
}
|
||||||
|
if (newValue === 'connect_timeout') {
|
||||||
|
stepsActiveIndex.value += 2
|
||||||
|
nextStepText.value = '连接超时'
|
||||||
|
}
|
||||||
|
if (newValue === 'pause_timeout') {
|
||||||
|
stepsActiveIndex.value += 2
|
||||||
|
// nextStepText.value = '结束测试'
|
||||||
|
nextStepText.value = '暂停超时'
|
||||||
|
}
|
||||||
|
if (newValue === 'success' && stepsActiveIndex.value < stepsTotalNum.value - 1) {
|
||||||
|
nextStep() // 实现自动点击,进入下一个测试内容
|
||||||
|
handleSubmit()
|
||||||
|
}
|
||||||
|
|
||||||
const dialogTitle = ref('');
|
})
|
||||||
const isTimeCheck = ref(false)
|
|
||||||
const preTestRef = ref(null);
|
|
||||||
const testRef = ref(null);
|
|
||||||
|
|
||||||
// const devIdArr = ref([])
|
const sendPause = () => {
|
||||||
// const planId = ref('')
|
console.log('发起暂停请求')
|
||||||
|
|
||||||
|
TestStatus.value = 'paused_ing'
|
||||||
|
pauseTest().then(res => {
|
||||||
|
Object.assign(webMsgSend.value, {
|
||||||
|
requestId: 'preStopTest',
|
||||||
|
operateCode: 'stop'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// setTimeout(() => {
|
||||||
|
// Object.assign(webMsgSend.value, {
|
||||||
|
// requestId: 'preStopTest',
|
||||||
|
// operateCode: 'stop'
|
||||||
|
// })
|
||||||
|
// }, 5000)
|
||||||
|
}
|
||||||
|
const sendResume = () => {
|
||||||
|
console.log('发起继续检测请求')
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
resumeTest({
|
||||||
const open = (selection: Device.ResPqDev[],title: string,time:boolean) => {
|
userPageId: "cdf",
|
||||||
|
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||||
|
planId: checkStore.plan.id,
|
||||||
|
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
|
})
|
||||||
|
Object.assign(webMsgSend.value, {
|
||||||
|
requestId: 'Resume_Success'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendReCheck = () => {
|
||||||
|
console.log('发送重新检测指令')
|
||||||
|
startPreTest({
|
||||||
|
userPageId: "cdf",
|
||||||
|
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||||
|
planId: checkStore.plan.id,
|
||||||
|
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.code === 'A001014') {
|
||||||
|
ElMessageBox.alert('装置配置异常', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TestStatus.value = 'test_init_fail'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
TestStatus.value = 'start'
|
||||||
|
}
|
||||||
|
|
||||||
const checkStates = selection.map(item => item.checkState);
|
const nextStep = () => {
|
||||||
// devIdArr.value = selection.map(item => item.id);
|
if (stepsActiveIndex.value == stepsTotalNum.value + 1 || ActiveStatue.value === 'error' || ActiveStatue.value === 'test_init_fail' || ActiveStatue.value === 'connect_timeout' || ActiveStatue.value === 'pause_timeout') {
|
||||||
// planId.value =selection[0].planId
|
handleClose()
|
||||||
// console.log('wwwwwwwwwwwwwwwww',selection)
|
return
|
||||||
|
}
|
||||||
|
if (ActiveStatue.value != 'error') {
|
||||||
|
ActiveStatue.value = 'waiting'
|
||||||
|
let tempStep = stepsActiveIndex.value
|
||||||
|
let idx = 1
|
||||||
|
stepsActiveIndex.value++
|
||||||
|
for (let selectTestItemsKey in checkStore.selectTestItems) {
|
||||||
|
if (tempStep == 0 && checkStore.selectTestItems[selectTestItemsKey]) {
|
||||||
|
stepsActiveView.value = idx
|
||||||
|
stepsActive.value = idx
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (checkStore.selectTestItems[selectTestItemsKey] && tempStep != 0) {
|
||||||
|
tempStep--
|
||||||
|
}
|
||||||
|
idx++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const allCheckStatesEqual = new Set(checkStates).size <= 1;
|
// if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||||
|
// stepsActiveIndex.value++
|
||||||
|
// if (!checkStore.selectTestItems.timeTest) { // 不具备守时检测
|
||||||
|
// stepsActiveIndex.value++
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ActiveStatue.value = 'waiting'
|
||||||
|
// } else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
||||||
|
// //emit('update:visible', false); // 关闭对话框
|
||||||
|
// clearData()
|
||||||
|
// dialogVisible.value = false;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
if (!allCheckStatesEqual) {
|
const handleStepClick = (step: number) => {
|
||||||
ElMessageBox.confirm(
|
if (step > stepsActive.value) {
|
||||||
'所勾选设备检测状态不一致,请重新选择',
|
return
|
||||||
'提示',
|
} else {
|
||||||
{
|
stepsActiveView.value = step
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearData() {
|
||||||
|
stepsTotalNum.value = -1
|
||||||
|
stepsActiveIndex.value = 1
|
||||||
|
stepsActiveView.value = -1
|
||||||
|
preTestStatus.value = "waiting"
|
||||||
|
timeTestStatus.value = "waiting"
|
||||||
|
channelsTestStatus.value = "waiting"
|
||||||
|
TestStatus.value = "waiting"
|
||||||
|
ActiveStatue.value = "waiting"
|
||||||
|
nextStepText.value = "下一步"
|
||||||
|
}
|
||||||
|
|
||||||
|
const beforeClose = (done: () => void) => {
|
||||||
|
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||||
|
ElMessageBox.confirm('检测未完成,是否退出当前检测流程?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}
|
}
|
||||||
)
|
).then(() => {
|
||||||
return
|
handleClose()
|
||||||
}
|
})
|
||||||
|
} else {
|
||||||
dialogTitle.value = title;
|
handleClose()
|
||||||
dialogVisible.value = true;
|
|
||||||
isTimeCheck.value = time
|
|
||||||
|
|
||||||
if (preTestRef.value) {
|
|
||||||
preTestRef.value.initializeParameters();
|
|
||||||
}
|
|
||||||
|
|
||||||
preTestStatus.value = 'waiting';//预检测执行状态
|
|
||||||
//开始创建webSocket客户端
|
|
||||||
const data = reactive({
|
|
||||||
socketServe: socketClient.Instance,
|
|
||||||
});
|
|
||||||
const url = 'ws://localhost:7777/hello?name=cdf';
|
|
||||||
socketClient.Instance.connect(url);
|
|
||||||
data.socketServe = socketClient.Instance;
|
|
||||||
data.socketServe.registerCallBack('aaa', (res) => {
|
|
||||||
// 处理来自服务器的消息
|
|
||||||
console.log('Received message:', res);
|
|
||||||
// 根据需要在这里添加更多的处理逻辑
|
|
||||||
|
|
||||||
if(res.code === 20000){
|
|
||||||
ElMessage.error(message.message)
|
|
||||||
loading.close()
|
|
||||||
}else {
|
|
||||||
webMsgSend.value = res
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let loading;
|
|
||||||
const handleSubmit = () => {
|
|
||||||
skipDisabled.value = true
|
|
||||||
console.log('=============',stepsActiveIndex.value)
|
|
||||||
|
|
||||||
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
|
||||||
let planId = checkStore.planId
|
|
||||||
|
|
||||||
switch (stepsActiveIndex.value) {
|
|
||||||
case 0:
|
|
||||||
preTestStatus.value = 'start'
|
|
||||||
|
|
||||||
|
|
||||||
/* loading = ElLoading.service({
|
|
||||||
lock: true,
|
|
||||||
text: '',
|
|
||||||
background: 'rgb(255, 255, 255, 0)',
|
|
||||||
})*/
|
|
||||||
startPreTest({
|
|
||||||
userPageId: "cdf",
|
|
||||||
devIds:deviceIds,
|
|
||||||
planId:planId,
|
|
||||||
operateType:'0' // '0'为预检测、‘1‘为正式检测
|
|
||||||
}).then(res=>{
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
timeTestStatus.value = 'start'
|
|
||||||
break;
|
|
||||||
// case 2:
|
|
||||||
// channelsTestStatus.value = 'start'
|
|
||||||
// break;
|
|
||||||
case 2:
|
|
||||||
if (TestStatus.value == "waiting") {
|
|
||||||
// startTest({
|
|
||||||
// userPageId: "cdf",
|
|
||||||
// devIds:deviceIds,
|
|
||||||
// planId:planId,
|
|
||||||
// operateType:'1' // '0'为预检测、‘1‘为正式检测
|
|
||||||
// }).then(res => {
|
|
||||||
// console.log(res)
|
|
||||||
// if (res.code === 20000) {
|
|
||||||
// TestStatus.value = 'start'
|
|
||||||
// webMsgSend.value = ''
|
|
||||||
// } else {
|
|
||||||
// ElMessage.error(res.message)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
TestStatus.value = 'start'
|
|
||||||
} else if (TestStatus.value == 'process') {
|
|
||||||
// 发送暂停指令
|
|
||||||
// pauseTest({deviceIds}).then(res => {
|
|
||||||
// console.log(res)
|
|
||||||
// if (res.code === 20000) {
|
|
||||||
// TestStatus.value = 'paused'
|
|
||||||
// webMsgSend.value = ''
|
|
||||||
// } else {
|
|
||||||
// ElMessage.error(res.message)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
TestStatus.value = 'paused'
|
|
||||||
} else if (TestStatus.value == 'paused') {
|
|
||||||
// 发送继续指令
|
|
||||||
// resumeTest({deviceIds}).then(res => {
|
|
||||||
// console.log(res)
|
|
||||||
// if (res.code === 20000) {
|
|
||||||
// TestStatus.value = 'process'
|
|
||||||
// webMsgSend.value = ''
|
|
||||||
// } else {
|
|
||||||
// ElMessage.error(res.message)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
TestStatus.value = 'process'
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
watch(preTestStatus,function(newValue,oldValue){
|
|
||||||
console.log(newValue,oldValue);
|
|
||||||
|
|
||||||
ActiveStatue.value = newValue
|
|
||||||
})
|
|
||||||
watch(timeTestStatus,function(newValue,oldValue){
|
|
||||||
console.log(newValue,oldValue);
|
|
||||||
|
|
||||||
ActiveStatue.value = newValue
|
|
||||||
})
|
|
||||||
watch(channelsTestStatus,function(newValue,oldValue){
|
|
||||||
console.log(newValue,oldValue);
|
|
||||||
|
|
||||||
ActiveStatue.value = newValue
|
|
||||||
})
|
|
||||||
watch(TestStatus,function(newValue,oldValue){
|
|
||||||
console.log(newValue,oldValue);
|
|
||||||
|
|
||||||
ActiveStatue.value = newValue
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(ActiveStatue,function(newValue,oldValue){
|
|
||||||
|
|
||||||
if(newValue === 'success' || newValue === 'error'){
|
|
||||||
skipDisabled.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 2)
|
|
||||||
{
|
|
||||||
stepsActiveIndex.value++;
|
|
||||||
stepsActiveIndex.value++;
|
|
||||||
nextStepText.value = '检测完成'
|
|
||||||
}
|
|
||||||
if(newValue === 'preTest_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2)
|
|
||||||
{
|
|
||||||
stepsActiveIndex.value++;
|
|
||||||
stepsActiveIndex.value++;
|
|
||||||
nextStepText.value = '预检测失败'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const sendPause = () => {
|
|
||||||
console.log('发送暂停指令')
|
|
||||||
|
|
||||||
}
|
|
||||||
const sendResume = () => {
|
|
||||||
console.log('发送继续检测指令')
|
|
||||||
}
|
|
||||||
|
|
||||||
const getIcon = (index: number) => {
|
|
||||||
if (stepsActiveIndex.value > index) return SuccessFilled;
|
|
||||||
switch (index) {
|
|
||||||
case 0: return h(<svg-icon name="preTest"></svg-icon>);
|
|
||||||
case 1: return UploadFilled;
|
|
||||||
case 2: return Odometer;
|
|
||||||
case 3: return Coin;
|
|
||||||
case 4: return Key;
|
|
||||||
default: return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const nextStep = () => {
|
|
||||||
if(stepsActiveIndex.value < stepsTotalNum.value )
|
|
||||||
{
|
|
||||||
stepsActiveIndex.value++
|
|
||||||
if(!isTimeCheck.value){//不具备守时检测,预检测后直接跳正式检测
|
|
||||||
stepsActiveIndex.value++
|
|
||||||
}
|
|
||||||
|
|
||||||
ActiveStatue.value = 'waiting'
|
|
||||||
}
|
|
||||||
else if(stepsActiveIndex.value === stepsTotalNum.value)
|
|
||||||
{
|
|
||||||
//emit('update:visible', false); // 关闭对话框
|
|
||||||
clearData()
|
|
||||||
dialogVisible.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function clearData(){
|
|
||||||
stepsActiveIndex.value = 0;
|
|
||||||
preTestStatus.value = "waiting"
|
|
||||||
timeTestStatus.value = "waiting"
|
|
||||||
channelsTestStatus.value = "waiting"
|
|
||||||
TestStatus.value = "waiting"
|
|
||||||
ActiveStatue.value = "waiting"
|
|
||||||
skipDisabled.value = false
|
|
||||||
nextStepText.value = "下一步"
|
|
||||||
}
|
|
||||||
const beforeClose = (done: () => void) => {
|
|
||||||
console.log(stepsActiveIndex.value,stepsTotalNum.value)
|
|
||||||
if(stepsActiveIndex.value < stepsTotalNum.value)
|
|
||||||
{
|
|
||||||
ElMessageBox.confirm(
|
|
||||||
'检测未完成,是否退出当前检测流程?',
|
|
||||||
'提示',
|
|
||||||
{
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.then(() => {
|
|
||||||
clearData()
|
|
||||||
// todo 关闭弹窗,终止整个检测流程
|
|
||||||
//emit('update:visible', false); // 关闭对话框
|
|
||||||
dialogVisible.value = false;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
clearData()
|
|
||||||
//emit('update:visible', false); // 关闭对话框
|
|
||||||
dialogVisible.value = false;
|
|
||||||
}
|
|
||||||
// ElMessageBox.confirm('Are you sure to close this dialog?')
|
|
||||||
// .then(() => {
|
|
||||||
// done()
|
|
||||||
// })
|
|
||||||
// .catch(() => {
|
|
||||||
// // catch error
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
const handleCancel = () => {
|
|
||||||
// clearData()
|
|
||||||
// emit('update:visible', false); // 关闭对话框
|
|
||||||
testRef.value?.clear()
|
|
||||||
};
|
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
dataSocket.socketServe.closeWs()
|
||||||
|
dialogVisible.value = false;
|
||||||
|
clearData()
|
||||||
|
showComponent.value = false;
|
||||||
|
|
||||||
|
emit('quitClicked'); // 触发事件
|
||||||
// // 当 props.visible 改变时,更新 formData
|
|
||||||
// watch(() => props.visible, (newVal) => {
|
|
||||||
// if (!newVal) {
|
|
||||||
// // 这里可以重置表单数据,如果需要的话
|
|
||||||
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// 对外映射
|
|
||||||
defineExpose({ open })
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
|
|
||||||
:deep(.dialog-big .el-dialog__body){
|
|
||||||
max-height: 840px !important;
|
|
||||||
}
|
}
|
||||||
// :deep(.dialog-big){
|
|
||||||
// max-height: 840px !important;
|
|
||||||
// }
|
|
||||||
// :deep(.el-dialog__body){
|
|
||||||
// max-height: 840px !important;
|
|
||||||
// }
|
|
||||||
|
|
||||||
.steps-container :deep(.test-head-steps){
|
// 对外映射
|
||||||
height: 80px;
|
defineExpose({open})
|
||||||
margin-bottom: 10px;
|
</script>
|
||||||
}
|
|
||||||
|
|
||||||
.steps-container :deep(.el-step__title) {
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
:deep(.dialog-big .el-dialog__body) {
|
||||||
|
max-height: 840px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps-container :deep(.test-head-steps) {
|
||||||
|
height: 80px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps-container :deep(.el-step__title) {
|
||||||
font-size: 20px !important; /* 设置标题字体大小 */
|
font-size: 20px !important; /* 设置标题字体大小 */
|
||||||
vertical-align:baseline !important;
|
vertical-align: baseline !important;
|
||||||
display: inline-block; /* 确保文字和图标在同一行 */
|
display: inline-block; /* 确保文字和图标在同一行 */
|
||||||
line-height: 1; /* 调整行高以确保底部对齐 */
|
line-height: 1; /* 调整行高以确保底部对齐 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.steps-container :deep(.el-step__icon-inner) {
|
.steps-container :deep(.el-step__icon-inner) {
|
||||||
font-size: 18px !important;
|
font-size: 18px !important;
|
||||||
vertical-align:baseline !important;
|
vertical-align: baseline !important;
|
||||||
display: inline-block; /* 确保文字和图标在同一行 */
|
display: inline-block; /* 确保文字和图标在同一行 */
|
||||||
line-height: 1; /* 调整行高以确保底部对齐 */
|
line-height: 1; /* 调整行高以确保底部对齐 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.steps-container :deep(.el-step__icon) {
|
.steps-container :deep(.el-step__icon) {
|
||||||
font-size: 18px !important;
|
font-size: 18px !important;
|
||||||
vertical-align:baseline !important;
|
vertical-align: baseline !important;
|
||||||
display: inline-block; /* 确保文字和图标在同一行 */
|
display: inline-block; /* 确保文字和图标在同一行 */
|
||||||
line-height: 1; /* 调整行高以确保底部对齐 */
|
line-height: 1; /* 调整行高以确保底部对齐 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading-box {
|
||||||
|
animation: loading 1.5s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes loading {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// :deep(.test-head-steps){
|
// :deep(.test-head-steps){
|
||||||
// height: 100px;
|
// height: 100px;
|
||||||
// margin-bottom: 20px;
|
// margin-bottom: 20px;
|
||||||
|
|||||||
@@ -4,17 +4,17 @@
|
|||||||
<el-tab-pane label="守时误差">
|
<el-tab-pane label="守时误差">
|
||||||
<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" style=" font-size: 18px;font-weight: 600;">
|
<span v-if="activeIndex > 1" class="time-text">
|
||||||
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
|
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
|
||||||
</span>
|
</span>
|
||||||
<div class="error-dsc">
|
<div class="error-dsc">
|
||||||
<div class="green-div"></div>
|
<div class="green-div"></div>
|
||||||
<span style=" color: #606266; font-size: 16px;font-weight: 600;">
|
<span class="description-text">
|
||||||
合格≤1000ms
|
合格≤1000ms
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="red-div"></div>
|
<div class="red-div"></div>
|
||||||
<span style=" color: #F56C6c; font-size: 16px;font-weight: 600;">
|
<span class="description-text unqualified">
|
||||||
不合格>1000ms
|
不合格>1000ms
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -78,7 +78,14 @@
|
|||||||
:cell-style="{ textAlign: 'center' }" style="width: 100%; height:435px" border>
|
:cell-style="{ textAlign: 'center' }" style="width: 100%; height:435px" border>
|
||||||
</ProTable> -->
|
</ProTable> -->
|
||||||
|
|
||||||
<el-table v-if="activeIndex > 0" :data="deviceOperatorData" stripe :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="margin-top: -30px;width: 100%" border>
|
<el-table
|
||||||
|
v-if="activeIndex > 0"
|
||||||
|
:data="deviceOperatorData"
|
||||||
|
stripe
|
||||||
|
:header-cell-class-name="'el-table-header'"
|
||||||
|
:cell-class-name="'el-table-cell'"
|
||||||
|
class="el-table"
|
||||||
|
border>
|
||||||
<el-table-column prop="deviceName" label="设备名称" />
|
<el-table-column prop="deviceName" label="设备名称" />
|
||||||
<el-table-column prop="updataTime" label="上送时刻" />
|
<el-table-column prop="updataTime" label="上送时刻" />
|
||||||
<el-table-column prop="ErrorValue" label="守时误差(ms)">
|
<el-table-column prop="ErrorValue" label="守时误差(ms)">
|
||||||
@@ -110,6 +117,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup name="timeTest">
|
<script lang="tsx" setup name="timeTest">
|
||||||
import { SuccessFilled } from '@element-plus/icons-vue'
|
import { SuccessFilled } from '@element-plus/icons-vue'
|
||||||
|
import { reactive, ref, toRef, watch } from 'vue'
|
||||||
|
|
||||||
const stepsIndex = ref(0)
|
const stepsIndex = ref(0)
|
||||||
const activeIndex = ref(0)
|
const activeIndex = ref(0)
|
||||||
@@ -196,7 +204,7 @@ const columns = reactive([
|
|||||||
prop: 'Result',
|
prop: 'Result',
|
||||||
label: '检测结果',
|
label: '检测结果',
|
||||||
// width: 100,
|
// width: 100,
|
||||||
render: (scope) => {
|
render: (scope: { row: { Result: string } }) => {
|
||||||
if (scope.row.Result === '不合格') {
|
if (scope.row.Result === '不合格') {
|
||||||
return (
|
return (
|
||||||
<el-tag type='danger'>{scope.row.Result}</el-tag>
|
<el-tag type='danger'>{scope.row.Result}</el-tag>
|
||||||
@@ -231,7 +239,7 @@ watch(testStatus, function (newValue, oldValue) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function formatDateTime(date) {
|
function formatDateTime(date: Date) {
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
const day = String(date.getDate()).padStart(2, '0');
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
@@ -408,4 +416,70 @@ watch(ts, function (newValue, oldValue) {
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
padding: 10px 20px 10px 20px;
|
padding: 10px 20px 10px 20px;
|
||||||
box-sizing: border-box; */
|
box-sizing: border-box; */
|
||||||
|
|
||||||
|
.right-title .time-text {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-title .gps-time {
|
||||||
|
color: #003078;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 10px; /* 根据需要调整 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc .green-div,
|
||||||
|
.error-dsc .red-div {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc .green-div {
|
||||||
|
background-color: #67C23A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc .red-div {
|
||||||
|
background-color: #F56C6C;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc .description-text {
|
||||||
|
color: #606266;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc .description-text.unqualified {
|
||||||
|
color: #F56C6C;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table-header {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table-cell {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table {
|
||||||
|
margin-top: -30px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tooltip-icon {
|
||||||
|
margin-left: 4px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-tag {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-text {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -3,10 +3,13 @@
|
|||||||
<div class='search_view'>
|
<div class='search_view'>
|
||||||
<el-input
|
<el-input
|
||||||
placeholder='请输入计划名称'
|
placeholder='请输入计划名称'
|
||||||
|
clearable
|
||||||
v-model='searchForm.planName'
|
v-model='searchForm.planName'
|
||||||
></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
|
||||||
@@ -15,7 +18,8 @@
|
|||||||
:filter-node-method='filterNode'
|
:filter-node-method='filterNode'
|
||||||
:props='defaultProps'
|
:props='defaultProps'
|
||||||
node-key='id'
|
node-key='id'
|
||||||
class="filter-tree"
|
class="filter-tree"
|
||||||
|
:highlight-current="true"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
:default-checked-keys='defaultChecked'
|
:default-checked-keys='defaultChecked'
|
||||||
@node-click='handleNodeClick'
|
@node-click='handleNodeClick'
|
||||||
@@ -23,7 +27,7 @@
|
|||||||
<template #default='{ node, data }'>
|
<template #default='{ node, data }'>
|
||||||
<span class='custom-tree-node' style='display: flex;align-items: center;'>
|
<span class='custom-tree-node' style='display: flex;align-items: center;'>
|
||||||
<Platform v-if='!data.pid' style='width:18px;height: 18px;margin-right:8px;'
|
<Platform v-if='!data.pid' style='width:18px;height: 18px;margin-right:8px;'
|
||||||
:style="{color:node.label=='未检'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" />
|
:style="{color:node.label=='未检'?'#fac858':node.label=='检测中'?'#ee6666':'#91cc75'}" />
|
||||||
<span>{{ node.label }}</span>
|
<span>{{ node.label }}</span>
|
||||||
<!-- <Menu v-if="data.pid" @click.stop="detail(data)" style="width: 12px;margin-left: 8px;"/> -->
|
<!-- <Menu v-if="data.pid" @click.stop="detail(data)" style="width: 12px;margin-left: 8px;"/> -->
|
||||||
</span>
|
</span>
|
||||||
@@ -35,13 +39,15 @@
|
|||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import { type Plan } from '@/api/plan/interface';
|
import { type Plan } from '@/api/plan/interface';
|
||||||
import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue'
|
import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue'
|
||||||
import { 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()
|
||||||
|
const filterText = ref('')
|
||||||
|
const treeRef = ref()
|
||||||
const data: any = ref([])
|
const data: any = ref([])
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
@@ -51,18 +57,54 @@ const defaultProps = {
|
|||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
planName: '',
|
planName: '',
|
||||||
})
|
})
|
||||||
const defaultChecked = ref<number[]>([]) // 明确类型为 number[]
|
const defaultChecked = ref<string[]>([]) // 明确类型为 number[]
|
||||||
|
const tree = ref(false)//确保左侧树高凉只执行一次
|
||||||
const getTreeData = (val: any) => {
|
const getTreeData = (val: any) => {
|
||||||
|
defaultChecked.value = [];
|
||||||
|
data.value = val;
|
||||||
|
|
||||||
|
for (let item of data.value) {
|
||||||
|
if (item.children.length > 0) {
|
||||||
|
let node = item.children[0];
|
||||||
|
defaultChecked.value.push(node.id);
|
||||||
|
checkStore.setPlan(node);
|
||||||
|
// 高亮显示第一个节点
|
||||||
|
// 使用 nextTick 确保在 DOM 更新后调用 setCurrentKey
|
||||||
|
nextTick(() => {
|
||||||
|
treeRef.value?.setCurrentKey(node.id);
|
||||||
|
idd.value = node.id;
|
||||||
|
});
|
||||||
|
// 找到第一个符合条件的 children 后跳出循环
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//点击表格后左侧树刷新,高亮显示对应节点
|
||||||
|
const clickTableToTree = (val: any,id:any) => {
|
||||||
|
|
||||||
defaultChecked.value = []
|
defaultChecked.value = []
|
||||||
data.value = val
|
data.value = val
|
||||||
if (data.value.length > 0 && data.value[0].children.length > 0) {
|
let node = ref('')
|
||||||
defaultChecked.value.push(data.value[0].children[0].id as number)
|
if (data.value.length > 0) {
|
||||||
|
for (let i = 0; i < data.value.length; i++){
|
||||||
|
for (let j = 0; j < data.value[i].children.length; j++) {
|
||||||
|
if (data.value[i].children[j].id == id) {
|
||||||
|
node.value = data.value[i].children[j].id
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用 nextTick 确保在 DOM 更新后调用 setCurrentKey
|
||||||
|
nextTick(() => {
|
||||||
|
treeRef.value?.setCurrentKey(node.value);
|
||||||
|
idd.value = node.value
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
checkStore.setPlanId(defaultChecked.value[0])
|
|
||||||
checkStore.setPlanCode(data.value[0].code)
|
|
||||||
}
|
}
|
||||||
const filterText = ref('')
|
|
||||||
const treeRef = ref()
|
|
||||||
const {updateSelectedTreeNode} = defineProps<{
|
const {updateSelectedTreeNode} = defineProps<{
|
||||||
updateSelectedTreeNode:Function;
|
updateSelectedTreeNode:Function;
|
||||||
}>();
|
}>();
|
||||||
@@ -75,33 +117,47 @@ watch(
|
|||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const idd = ref('')
|
||||||
const handleNodeClick = (data: Plan.ResPlan) => {
|
const handleNodeClick = (data: Plan.ResPlan) => {
|
||||||
checkStore.setPlanId(data.id)
|
|
||||||
checkStore.setPlanCode(data.code)
|
if (data.name === '未检' || data.name === '检测中' || data.name === '检测完成') {
|
||||||
checkStore.setScriptId(data.scriptId)
|
// 如果是父节点,不执行任何操作
|
||||||
|
//console.log('父节点不执行任何操作');
|
||||||
|
// 设置当前高亮节点
|
||||||
|
nextTick(() => {
|
||||||
|
treeRef.value?.setCurrentKey(idd.value);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
idd.value = data.id
|
||||||
|
|
||||||
|
checkStore.setPlan(data);
|
||||||
updateSelectedTreeNode(data.id)
|
updateSelectedTreeNode(data.id)
|
||||||
}
|
}
|
||||||
const filterNode = (value: string, data: any) => {
|
const filterNode = (value: string, data: any) => {
|
||||||
if (!value) return true
|
if (!value) return true
|
||||||
return data.name.includes(value)
|
return data.name.includes(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 点击详情
|
// 点击详情
|
||||||
const detail = () => {
|
const detail = () => {
|
||||||
router.push('/plan')
|
router.push('/plan/planList')
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// console.log()
|
// console.log()
|
||||||
})
|
})
|
||||||
defineExpose({ getTreeData })
|
defineExpose({ getTreeData ,clickTableToTree})
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
.plan_tree {
|
.plan_tree {
|
||||||
// width: 200px;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 5px;
|
|
||||||
// height: calc(100% - 70px);
|
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
|
||||||
.search_view {
|
.search_view {
|
||||||
@@ -136,13 +192,16 @@ defineExpose({ getTreeData })
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.filter-tree {
|
.filter-tree {
|
||||||
// border: 1px solid #dcdfe6;
|
// border: 1px solid #dcdfe6;
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
height: 97%;
|
height: 97%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//.filter-tree span {
|
//.filter-tree span {
|
||||||
@@ -154,7 +213,6 @@ defineExpose({ getTreeData })
|
|||||||
// text-overflow:ellipsis;
|
// text-overflow:ellipsis;
|
||||||
// padding-right: 12px;
|
// padding-right: 12px;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
.leftBox {
|
.leftBox {
|
||||||
// float: left;
|
// float: left;
|
||||||
// width: 20%;
|
// width: 20%;
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ import { useAuthStore } from "@/stores/modules/auth";
|
|||||||
|
|
||||||
import model from "./tabs/model.vue";
|
import model from "./tabs/model.vue";
|
||||||
import dashboard from "./tabs/dashboard.vue";
|
import dashboard from "./tabs/dashboard.vue";
|
||||||
import { onMounted } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
|
// defineOptions({
|
||||||
|
// name: 'home'
|
||||||
|
// })
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
|
|
||||||
const activeIndex = ref("1-1");
|
const activeIndex = ref("1-1");
|
||||||
@@ -46,22 +49,21 @@ const modeList = [
|
|||||||
{
|
{
|
||||||
name: "模拟式模式",
|
name: "模拟式模式",
|
||||||
code:"模拟式",
|
code:"模拟式",
|
||||||
subName: "未启用模拟式检测计划",
|
img: new URL('/src/assets/images/dashboard/1.svg', import.meta.url).href,
|
||||||
img: "/src/assets/images/dashboard/1.svg",
|
|
||||||
isActive: true,
|
isActive: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "数字式模式",
|
name: "数字式模式",
|
||||||
code:"数字式",
|
code:"数字式",
|
||||||
subName: "启用数字检测计划",
|
subName: "启用数字检测计划",
|
||||||
img: "/src/assets/images/dashboard/2.svg",
|
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
|
||||||
isActive: false,
|
isActive: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "比对式模式",
|
name: "比对式模式",
|
||||||
code:"比对式",
|
code:"比对式",
|
||||||
subName: "启用比对式检测计划",
|
subName: "启用比对式检测计划",
|
||||||
img: "/src/assets/images/dashboard/3.svg",
|
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
|
||||||
isActive: false,
|
isActive: false,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,34 @@
|
|||||||
<!-- 模式切换页面 -->
|
<!-- 模式切换页面 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="main_container">
|
<div class="main_container box">
|
||||||
<!-- :style="{
|
<!-- :style="{
|
||||||
height: authStore?.showMenuFlag
|
height: authStore?.showMenuFlag
|
||||||
? 'calc(100vh - 165px)'
|
? 'calc(100vh - 165px)'
|
||||||
: 'calc(100vh - 125px)',
|
: 'calc(100vh - 125px)',
|
||||||
}" -->
|
}" -->
|
||||||
<div class="mode" v-for="(item, index) in modeList" :key="index">
|
|
||||||
|
<el-carousel :interval="5000" type="card" style="width: 60%;margin-left: 20%;height: 70%;">
|
||||||
|
<el-carousel-item class="mode" :class="{ modeBG: index != 0 }" v-for="(item, index) in modeList" :key="index">
|
||||||
|
|
||||||
|
<div class="mode_top">
|
||||||
|
<div class="mode_name">
|
||||||
|
{{ item.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mode_img">
|
||||||
|
<img :src="item.img" />
|
||||||
|
</div>
|
||||||
|
<div class="test_button">
|
||||||
|
<el-button size="large" type="primary" @click="handelOpen(item)"
|
||||||
|
:disabled="item.isActive == false">进入检测</el-button>
|
||||||
|
</div>
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <div class="mode" :class="{ modeBG: index != 0 }" v-for="(item, index) in modeList" :key="index">
|
||||||
<div class="mode_top">
|
<div class="mode_top">
|
||||||
<div class="mode_name">
|
<div class="mode_name">
|
||||||
<p>
|
<p>
|
||||||
@@ -14,55 +36,53 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="test_button">
|
<div class="test_button">
|
||||||
<el-button
|
<el-button size="small" type="primary" @click="handelOpen(item)"
|
||||||
size="small"
|
:disabled="item.isActive == false">进入检测</el-button>
|
||||||
type="primary"
|
|
||||||
@click="handelOpen(item)"
|
|
||||||
:disabled="item.isActive == false"
|
|
||||||
>进入检测</el-button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mode_img">
|
<div class="mode_img">
|
||||||
<img :src="item.img" />
|
<img :src="item.img" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from "@/stores/modules/auth";
|
||||||
import { useModeStore } from "@/stores/modules/mode"; // 引入模式 store
|
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
|
||||||
|
import { ref } from "vue";
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const modeStore = useModeStore(); // 使用模式 store
|
const modeStore = useModeStore(); // 使用模式 store
|
||||||
|
const AppSceneStore = useAppSceneStore();
|
||||||
const activeIndex = ref("1-1");
|
const activeIndex = ref("1-1");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const modeList = [
|
const modeList = [
|
||||||
{
|
{
|
||||||
name: "模拟式模块",
|
name: "模拟式模块",
|
||||||
code:"模拟式",
|
code: "模拟式",
|
||||||
subName: "未启用模拟式检测计划",
|
subName: "未启用模拟式检测计划",
|
||||||
img: "/src/assets/images/dashboard/1.svg",
|
img: new URL('/src/assets/images/dashboard/1.svg', import.meta.url).href,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "数字式模块",
|
name: "数字式模块",
|
||||||
code:"数字式",
|
code: "数字式",
|
||||||
subName: "启用数字检测计划",
|
subName: "启用数字检测计划",
|
||||||
img: "/src/assets/images/dashboard/2.svg",
|
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
|
||||||
isActive: true,
|
isActive: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "比对式模块",
|
name: "比对式模块",
|
||||||
code:"比对式",
|
code: "比对式",
|
||||||
subName: "启用比对式检测计划",
|
subName: "启用比对式检测计划",
|
||||||
img: "/src/assets/images/dashboard/3.svg",
|
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
|
||||||
isActive: true,
|
isActive: false,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
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:研发自测
|
||||||
await authStore.setShowMenu();
|
await authStore.setShowMenu();
|
||||||
return;
|
return;
|
||||||
// if (isActive) {
|
// if (isActive) {
|
||||||
@@ -82,7 +102,23 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.box {
|
||||||
|
background: #ededed;
|
||||||
|
// background-image: url("/src/assets/images/dashboard/DT.jpg");
|
||||||
|
// /* 背景图垂直、水平均居中 */
|
||||||
|
// // background-position: center center;
|
||||||
|
// /* 背景图不平铺 */
|
||||||
|
// background-repeat: no-repeat;
|
||||||
|
// /* 当内容高度大于图片高度时,背景图像的位置相对于viewport固定 */
|
||||||
|
// background-attachment: fixed;
|
||||||
|
// /* 让背景图基于容器大小伸缩 */
|
||||||
|
// background-size: cover;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.main_container {
|
.main_container {
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
// height: calc(100vh - 165px);
|
// height: calc(100vh - 165px);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -91,55 +127,45 @@ onMounted(() => {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
// padding: 20px 2%;
|
|
||||||
.mode {
|
.mode {
|
||||||
flex: none;
|
|
||||||
margin-top: 3px;
|
|
||||||
width: 32.5%;
|
|
||||||
height: 99.5% !important;
|
height: 99.5% !important;
|
||||||
border: 1px solid #eee;
|
border: 1px solid #eee;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: linear-gradient(
|
background: linear-gradient(180deg,
|
||||||
180deg,
|
rgba(0, 153, 255, 1) 0%,
|
||||||
rgba(0, 153, 255, 1) 0%,
|
rgba(0, 153, 255, 1) 0%,
|
||||||
rgba(0, 153, 255, 1) 0%,
|
rgba(0, 102, 255, 1) 65%,
|
||||||
rgba(0, 102, 255, 1) 65%,
|
rgba(0, 51, 255, 1) 100%,
|
||||||
rgba(0, 51, 255, 1) 100%,
|
rgba(0, 51, 255, 1) 100%);
|
||||||
rgba(0, 51, 255, 1) 100%
|
|
||||||
);
|
position: absolute;
|
||||||
|
|
||||||
|
|
||||||
// padding: 40px 0;
|
// padding: 40px 0;
|
||||||
.mode_top {
|
.mode_top {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: #008aff;
|
background: #008aff;
|
||||||
border-radius: 6px 6px 0 0;
|
border-radius: 6px 6px 0 0;
|
||||||
|
|
||||||
.mode_name {
|
.mode_name {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
flex: 1;
|
font-family: "微软雅黑 Bold", "微软雅黑", "微软雅黑", sans-serif;
|
||||||
display: flex;
|
font-weight: 700;
|
||||||
align-items: center;
|
font-style: normal;
|
||||||
justify-content: flex-start;
|
font-size: 20px;
|
||||||
p {
|
color: #ffffff;
|
||||||
font-family: "微软雅黑 Bold", "微软雅黑", "微软雅黑", sans-serif;
|
text-align: center;
|
||||||
font-weight: 700;
|
line-height: 40px;
|
||||||
font-style: normal;
|
padding-left: 10px;
|
||||||
font-size: 16px;
|
// margin-top: 20px;
|
||||||
color: #ffffff;
|
|
||||||
text-align: center;
|
|
||||||
// background: #fff;
|
|
||||||
line-height: 40px;
|
|
||||||
text-align: left;
|
|
||||||
padding-left: 10px;
|
|
||||||
// margin-top: 20px;
|
|
||||||
}
|
|
||||||
.mode_subName {
|
.mode_subName {
|
||||||
font-family: "微软雅黑", sans-serif;
|
font-family: "微软雅黑", sans-serif;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
@@ -154,14 +180,16 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.test_button {
|
.test_button {
|
||||||
width: 150px;
|
display: flex;
|
||||||
height: 100%;
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode_img {
|
.mode_img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
@@ -170,71 +198,107 @@ onMounted(() => {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
// padding: 30px 0 50px;
|
// padding: 30px 0 50px;
|
||||||
margin-top: 100px;
|
margin-top: 100px;
|
||||||
|
// margin-bottom: 100px;
|
||||||
|
|
||||||
img:nth-child(1) {
|
img:nth-child(1) {
|
||||||
width: 60%;
|
width: 60%;
|
||||||
height: auto;
|
height: auto;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
img:nth-child(2) {
|
img:nth-child(2) {
|
||||||
width: 70%;
|
width: 70%;
|
||||||
height: auto;
|
height: auto;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
img:nth-child(3) {
|
img:nth-child(3) {
|
||||||
width: 60%;
|
width: 60%;
|
||||||
height: auto;
|
height: auto;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode_test {
|
.mode_test {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
.test_button {
|
|
||||||
width: 120px;
|
|
||||||
height: 100%;
|
|
||||||
border: 1px solid rgba(121, 121, 121, 1);
|
|
||||||
border-radius: 5px;
|
|
||||||
font-family: "微软雅黑", sans-serif;
|
|
||||||
font-weight: 400;
|
|
||||||
font-style: normal;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 40px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.test_button:hover {
|
.test_button:hover {
|
||||||
background: rgba(0, 0, 0, 0.2);
|
background: rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode:nth-child(3n + 3) {
|
.test_button {
|
||||||
background: linear-gradient(
|
position: absolute;
|
||||||
180deg,
|
bottom: 30px;
|
||||||
rgba(0, 153, 255, 1) 0%,
|
left: 50%;
|
||||||
rgba(0, 153, 255, 1) 0%,
|
transform: translateX(-50%);
|
||||||
rgba(0, 102, 255, 1) 39%,
|
border-radius: 5px;
|
||||||
rgba(102, 51, 204, 1) 100%,
|
font-family: "微软雅黑", sans-serif;
|
||||||
rgba(102, 51, 204, 1) 100%
|
font-weight: 400;
|
||||||
);
|
font-style: normal;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 40px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.mode:nth-child(3n + 3) {
|
||||||
|
background: linear-gradient(180deg,
|
||||||
|
rgba(0, 153, 255, 1) 0%,
|
||||||
|
rgba(0, 153, 255, 1) 0%,
|
||||||
|
rgba(0, 102, 255, 1) 39%,
|
||||||
|
rgba(102, 51, 204, 1) 100%,
|
||||||
|
rgba(102, 51, 204, 1) 100%);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.mode_off {
|
.mode_off {
|
||||||
|
|
||||||
.mode_name,
|
.mode_name,
|
||||||
.mode_subName,
|
.mode_subName,
|
||||||
.test_button {
|
.test_button {
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.test_button:hover {
|
.test_button:hover {
|
||||||
// background: rgba(0, 0, 0, 0.2) !important;
|
// background: rgba(0, 0, 0, 0.2) !important;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-sub-menu__title) {
|
:deep(.el-sub-menu__title) {
|
||||||
border-bottom: 0 !important;
|
border-bottom: 0 !important;
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// .modeBG {
|
||||||
|
// &::before {
|
||||||
|
// content: "";
|
||||||
|
// position: absolute;
|
||||||
|
// top: 0;
|
||||||
|
// left: 0;
|
||||||
|
// width: 100%;
|
||||||
|
// height: 100%;
|
||||||
|
// background-color: #70707080;
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
:deep(.el-carousel__container) {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-carousel__item) {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
:data='logData'
|
:request-api='getTableList'
|
||||||
@selection-change='handleSelectionChange'
|
@selection-change='handleSelectionChange'
|
||||||
type='selection'
|
type='selection'
|
||||||
>
|
>
|
||||||
@@ -21,32 +21,39 @@
|
|||||||
<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 { Upload ,DataAnalysis} 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,watch } from 'vue'
|
import { reactive,ref,watch } from 'vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import {
|
||||||
let multipleSelection = ref<string[]>([])
|
getAuditLog,
|
||||||
const logData = logDataList
|
} from '@/api/system/log/index.ts'
|
||||||
const dictStore = useDictStore()
|
|
||||||
// 定义包含和排除的单位
|
|
||||||
const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
|
// defineOptions({
|
||||||
const excludedUnits = ['季度','年']; // 要排除的单位
|
// name: 'log'
|
||||||
const defaultUnits = '日'; // 默认的单位
|
// })
|
||||||
|
|
||||||
|
const startDate = ref('')
|
||||||
|
const endDate = ref('')
|
||||||
// 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: 'createBy',
|
||||||
label: '序号',
|
|
||||||
width: 70,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'create_By',
|
|
||||||
label: '操作用户',
|
label: '操作用户',
|
||||||
search: { el: 'input' },
|
search: { el: 'input' },
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
@@ -57,20 +64,19 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
|||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'create_Time',
|
prop: 'createTime',
|
||||||
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>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -96,21 +102,20 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ const login = (formEl: FormInstance | undefined) => {
|
|||||||
...loginForm,
|
...loginForm,
|
||||||
password: loginForm.password,
|
password: loginForm.password,
|
||||||
})
|
})
|
||||||
userStore.setToken(data.accessToken)
|
userStore.setAccessToken(data.accessToken)
|
||||||
|
userStore.setRefreshToken(data.refreshToken)
|
||||||
userStore.setUserInfo(data.userInfo)
|
userStore.setUserInfo(data.userInfo)
|
||||||
const response = await getDictList()
|
const response = await getDictList()
|
||||||
const dictData = response.data as unknown as Dict[]
|
const dictData = response.data as unknown as Dict[]
|
||||||
|
|||||||
@@ -0,0 +1,709 @@
|
|||||||
|
<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: '#003078',
|
||||||
|
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' ? 'V' : '%')
|
||||||
|
}}
|
||||||
|
</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: #003078;
|
||||||
|
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: #67c23a" 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>
|
||||||
217
frontend/src/views/machine/devType/components/devTypePopup.vue
Normal file
217
frontend/src/views/machine/devType/components/devTypePopup.vue
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 基础信息弹出框 -->
|
||||||
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" >
|
||||||
|
<div>
|
||||||
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
||||||
|
<el-form-item label="名称" prop="name" >
|
||||||
|
<el-input v-model='formContent.name' placeholder="请输入设备类型名称"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="工作电源" prop="power" >
|
||||||
|
<el-select v-model="formContent.power" clearable placeholder="请选择工作电源">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Dev_Power')"
|
||||||
|
:key="item.code"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="通道数" prop="devChns" >
|
||||||
|
<el-select v-model="formContent.devChns" clearable placeholder="请选择设备通道数">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Dev_Chns')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="额定电压(V)" prop="devVolt" >
|
||||||
|
<el-select v-model="formContent.devVolt" clearable placeholder="请选择额定电压">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Dev_Volt')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="额定电流(A)" prop="devCurr" >
|
||||||
|
<el-select v-model="formContent.devCurr" clearable placeholder="请选择额定电流">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Dev_Curr')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="报告模版名称" prop="reportName" >
|
||||||
|
<el-select v-model="formContent.reportName" clearable placeholder="请选择报告模版">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Report_Template')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备关联ICD" prop="icd" >
|
||||||
|
<el-select v-model="formContent.icd" clearable placeholder="请选择ICD">
|
||||||
|
<el-option
|
||||||
|
v-for="item in icdOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="close()">取消</el-button>
|
||||||
|
<el-button type="primary" @click="save()" >
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import{ ElMessage, type FormInstance,type FormItemRule } from 'element-plus'
|
||||||
|
import type { ProTableInstance } from '@/components/ProTable/interface'
|
||||||
|
import { ref,computed, Ref } from 'vue'
|
||||||
|
import { type DevType } from '@/api/device/interface/devType'
|
||||||
|
import { type ICD } from '@/api/device/interface/icd'
|
||||||
|
import {dialogMiddle} from '@/utils/elementBind'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {addDevType,updateDevType} from '@/api/device/devType'
|
||||||
|
import {getICDAllList} from '@/api/device/icd'
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
// 定义弹出组件元信息
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
const icdOptions = ref<ICD.ResICD[]>([])
|
||||||
|
function useMetaInfo() {
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const titleType = ref('add')
|
||||||
|
const formContent = ref<DevType.ResPqDevType>({
|
||||||
|
id: '', //设备类型ID
|
||||||
|
name: '',//设备类型名称
|
||||||
|
icd: '',//设备关联的ICD
|
||||||
|
power: 'AC/DC 110V-220V',//工作电源
|
||||||
|
devVolt: 57.74, //额定电压(V)
|
||||||
|
devCurr: 5, //额定电流(A)
|
||||||
|
devChns: 1, //设备通道数
|
||||||
|
reportName: '',//报告模版名称
|
||||||
|
state: 1,
|
||||||
|
})
|
||||||
|
return { dialogVisible, titleType, formContent }
|
||||||
|
}
|
||||||
|
|
||||||
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
|
|
||||||
|
|
||||||
|
// 清空formContent
|
||||||
|
const resetFormContent = () => {
|
||||||
|
formContent.value = {
|
||||||
|
id: '', //设备类型ID
|
||||||
|
name: '',//设备类型名称
|
||||||
|
icd: '',//设备关联的ICD
|
||||||
|
power: 'AC/DC 110V-220V',//工作电源
|
||||||
|
devVolt: 57.74, //额定电压(V)
|
||||||
|
devCurr: 5, //额定电流(A)
|
||||||
|
devChns: 1, //设备通道数
|
||||||
|
reportName: '',//报告模版名称
|
||||||
|
state: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let dialogTitle = computed(() => {
|
||||||
|
return titleType.value === 'add' ? '新增设备类型' : '编辑设备类型'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//定义规则
|
||||||
|
const formRuleRef = ref<FormInstance>()
|
||||||
|
//定义校验规则
|
||||||
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
|
name: [{ required: true, message: '设备类型名称必填!', trigger: 'blur' }],
|
||||||
|
power: [
|
||||||
|
{ required: true, message: '工作电源必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
devChns: [
|
||||||
|
{ required: true, message: '设备通道数必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
devVolt: [
|
||||||
|
{ required: true, message: '额定电压必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
devCurr: [
|
||||||
|
{ required: true, message: '额定电流必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
reportName: [
|
||||||
|
{ required: true, message: '报告模版名称必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
icd: [
|
||||||
|
{ required: true, message: '设备关联ICD必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 清空dialogForm中的值
|
||||||
|
resetFormContent()
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
|
try {
|
||||||
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
if (formContent.value.id) {
|
||||||
|
await updateDevType(formContent.value);
|
||||||
|
} else {
|
||||||
|
await addDevType(formContent.value);
|
||||||
|
}
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
close()
|
||||||
|
// 刷新表格
|
||||||
|
await props.refreshTable!()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
//error('验证过程中出现错误', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string, data: DevType.ResPqDevType,icd: ICD.ResICD[]) => {
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
titleType.value = sign
|
||||||
|
dialogVisible.value = true
|
||||||
|
|
||||||
|
icdOptions.value = icd
|
||||||
|
|
||||||
|
if (data.id) {
|
||||||
|
formContent.value = { ...data }
|
||||||
|
} else {
|
||||||
|
resetFormContent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
const props = defineProps<{
|
||||||
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
|
}>()
|
||||||
|
|
||||||
|
</script>
|
||||||
172
frontend/src/views/machine/devType/index.vue
Normal file
172
frontend/src/views/machine/devType/index.vue
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
<template>
|
||||||
|
<div class='table-box' ref='popupBaseView'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:request-api='getTableList'
|
||||||
|
>
|
||||||
|
<!-- :requestApi="getRoleList" -->
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader='scope'>
|
||||||
|
<el-button v-auth.devType="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
|
<el-button v-auth.devType="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 表格操作 -->
|
||||||
|
<template #operation='scope'>
|
||||||
|
<el-button v-auth.devType="'edit'" type='primary' link :icon='EditPen' :model-value='false'
|
||||||
|
@click="openDialog('edit', scope.row)">编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button v-auth.devType="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
<DevTypePopup :refresh-table='proTable?.getTableList' ref='devTypePopup' />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='useRole'>
|
||||||
|
import TimeControl from '@/components/TimeControl/index.vue'
|
||||||
|
import { type DevType } from '@/api/device/interface/devType'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {
|
||||||
|
getDevTypeList,
|
||||||
|
deleteDevType,
|
||||||
|
} from '@/api/device/devType/index.ts'
|
||||||
|
import { onBeforeMount, reactive, ref } from 'vue'
|
||||||
|
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
|
||||||
|
import { getICDAllList } from '@/api/device/icd'
|
||||||
|
import type { ICD } from '@/api/device/interface/icd'
|
||||||
|
|
||||||
|
// defineOptions({
|
||||||
|
// name: 'devType',
|
||||||
|
// })
|
||||||
|
const modeStore = useModeStore()
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
const devTypePopup = ref()
|
||||||
|
const icdOptions = ref<ICD.ResICD[]>([])
|
||||||
|
|
||||||
|
const getTableList = async (params: any) => {
|
||||||
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
|
return getDevTypeList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<DevType.ResPqDevType>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'name',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'power',
|
||||||
|
label: '工作电源',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'devChns',
|
||||||
|
label: '通道数',
|
||||||
|
minWidth: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'devVolt',
|
||||||
|
label: '额定电压(V)',
|
||||||
|
minWidth: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'devCurr',
|
||||||
|
label: '额定电流(A)',
|
||||||
|
minWidth: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'reportName',
|
||||||
|
label: '报告模版名称',
|
||||||
|
minWidth: 150,
|
||||||
|
enum: dictStore.getDictData('Report_Template'),
|
||||||
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'icd',
|
||||||
|
label: '设备关联ICD',
|
||||||
|
minWidth: 200,
|
||||||
|
render: (scope) => {
|
||||||
|
// 查找ICD名称
|
||||||
|
const name = icdOptions.value.find(option => option.id === scope.row.icd)
|
||||||
|
return <span>{name?.name}</span>
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'createTime',
|
||||||
|
label: '创建时间',
|
||||||
|
width: 200,
|
||||||
|
render: scope => {
|
||||||
|
if (scope.row.createTime) {
|
||||||
|
const date = new Date(scope.row.createTime);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 打开 drawer(新增、编辑)
|
||||||
|
const openDialog = (titleType: string, row: Partial<DevType.ResPqDevType> = {}) => {
|
||||||
|
devTypePopup.value?.open(titleType, row,icdOptions.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 批量删除设备类型
|
||||||
|
const batchDelete = async (id: string[]) => {
|
||||||
|
await useHandleData(deleteDevType, id, '删除所选设备类型')
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除设备类型
|
||||||
|
const handleDelete = async (params: DevType.ResPqDevType) => {
|
||||||
|
await useHandleData(deleteDevType, [params.id] , `删除【${params.name}】设备类型`)
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
const response = await getICDAllList({
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
path: '',
|
||||||
|
state: 1
|
||||||
|
})
|
||||||
|
icdOptions.value = (response.data as ICD.ResICD[]).map(item => ({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
path: item.path,
|
||||||
|
state: item.state,
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -5,31 +5,44 @@
|
|||||||
<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-input v-model="formContent.createId" placeholder="请输入装置编号" @input="handleInput" />
|
||||||
|
</el-form-item>
|
||||||
<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="请输入设备名称" :disabled="scene === '1'"/>
|
||||||
</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="请选择设备类型">
|
<el-select v-model="formContent.devType" filterable clearable placeholder="请选择设备类型" @change="handleDevTypeChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Dev_Type')"
|
v-for="item in devTypeOptions"
|
||||||
: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='pattern' >
|
<el-form-item label='预投计划' prop='preinvestmentPlan' v-if="scene ==='1'">
|
||||||
<el-select v-model="formContent.pattern" clearable placeholder="请选择设备模式" disabled>
|
<el-select v-model="formContent.preinvestmentPlan" clearable placeholder="请选择预投计划">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Pattern')"
|
v-for="item in dictStore.getDictData('Preinvestment_Plan')"
|
||||||
: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' >
|
<!-- <el-form-item label='设备模式' prop='pattern' >-->
|
||||||
<el-select v-model="formContent.manufacturer" clearable placeholder="请选择生产厂商">
|
<!-- <el-select v-model="formContent.pattern" clearable placeholder="请选择设备模式" disabled>-->
|
||||||
|
<!-- <el-option -->
|
||||||
|
<!-- v-for="item in dictStore.getDictData('Pattern')"-->
|
||||||
|
<!-- :key="item.id"-->
|
||||||
|
<!-- :label="item.name"-->
|
||||||
|
<!-- :value="item.id"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- </el-select>-->
|
||||||
|
<!-- </el-form-item> -->
|
||||||
|
<el-form-item label='设备厂家' prop='manufacturer' v-if="scene != '1'">
|
||||||
|
<el-select v-model="formContent.manufacturer" clearable placeholder="请选择设备厂家">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Dev_Manufacturers')"
|
v-for="item in dictStore.getDictData('Dev_Manufacturers')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@@ -38,52 +51,29 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="出厂日期" prop="createDate" >
|
<el-form-item label="出厂日期" prop="createDate" v-if="scene === '0'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="formContent.createDate"
|
v-model="formContent.createDate"
|
||||||
placeholder="请选择出厂日期"
|
placeholder="请选择出厂日期"
|
||||||
:disabled-date="disabledDate"
|
:disabled-date="disabledDate"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="设备序列号" prop="createId" >
|
|
||||||
<el-input v-model="formContent.createId" placeholder="请输入设备序列号"/>
|
<el-form-item label="固件版本" prop="hardwareVersion" v-if="scene === '0'">
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="固件版本" prop="hardwareVersion" >
|
|
||||||
<el-input v-model="formContent.hardwareVersion" placeholder="请输入固件版本"/>
|
<el-input v-model="formContent.hardwareVersion" placeholder="请输入固件版本"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="软件版本" prop="softwareVersion" >
|
<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-select v-model="formContent.devChns" clearable placeholder="请选择设备通道数">
|
<el-input v-model='formContent.devChns' :disabled="true"/>
|
||||||
<el-option
|
|
||||||
v-for="item in dictStore.getDictData('Dev_Chns')"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="额定电压(V)" prop="devVolt" >
|
<el-form-item label="额定电压(V)" prop="devVolt" >
|
||||||
<el-select v-model="formContent.devVolt" clearable placeholder="请选择额定电压">
|
<el-input v-model='formContent.devVolt' :disabled="true"/>
|
||||||
<el-option
|
|
||||||
v-for="item in dictStore.getDictData('Dev_Volt')"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="额定电流(A)" prop="devCurr" >
|
<el-form-item label="额定电流(A)" prop="devCurr" >
|
||||||
<el-select v-model="formContent.devCurr" clearable placeholder="请选择额定电流">
|
<el-input v-model='formContent.devCurr' :disabled="true"/>
|
||||||
<el-option
|
|
||||||
v-for="item in dictStore.getDictData('Dev_Curr')"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</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="请选择通讯协议" >
|
||||||
@@ -113,10 +103,10 @@
|
|||||||
<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">
|
<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' >
|
<el-form-item label='送样日期' prop='arrivedDate' v-if="scene === '0'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="formContent.arrivedDate"
|
v-model="formContent.arrivedDate"
|
||||||
placeholder="请选择送样日期"
|
placeholder="请选择送样日期"
|
||||||
@@ -170,9 +160,12 @@ import MonitorTable from '@/views/machine/device/components/monitorTab.vue';
|
|||||||
|
|
||||||
const MonIsShow = ref(false)
|
const MonIsShow = ref(false)
|
||||||
const DevIsShow = ref(false)
|
const DevIsShow = ref(false)
|
||||||
|
// 存储设备类型选项
|
||||||
|
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||||
// const IsPasswordShow = ref(false)
|
// const IsPasswordShow = ref(false)
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const mode = ref()
|
const mode = ref()
|
||||||
|
const scene = ref('')
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
const disabledDate = (time: Date) => {
|
const disabledDate = (time: Date) => {
|
||||||
@@ -189,19 +182,22 @@ const disabledDate = (time: Date) => {
|
|||||||
devType:'',
|
devType:'',
|
||||||
devChns:1,
|
devChns:1,
|
||||||
devVolt:57.74,
|
devVolt:57.74,
|
||||||
devCurr:1,
|
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: '192.168.1.200',
|
ip: '172.17.102.200',
|
||||||
port: 102,
|
port: 102,
|
||||||
encryptionFlag: 0,
|
encryptionFlag: 0,
|
||||||
reCheckNum:0,
|
reCheckNum:0,
|
||||||
state: 1,
|
state: 1,
|
||||||
factorFlag:0,
|
factorFlag:1,
|
||||||
|
icdId:'',
|
||||||
|
power:'',
|
||||||
|
preinvestmentPlan:''
|
||||||
})
|
})
|
||||||
return { dialogVisible, titleType, formContent }
|
return { dialogVisible, titleType, formContent }
|
||||||
}
|
}
|
||||||
@@ -216,19 +212,22 @@ const disabledDate = (time: Date) => {
|
|||||||
devType:'',
|
devType:'',
|
||||||
devChns:1,
|
devChns:1,
|
||||||
devVolt:57.74,
|
devVolt:57.74,
|
||||||
devCurr:1,
|
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: '192.168.1.200',
|
ip: '172.17.102.200',
|
||||||
port: 102,
|
port: 102,
|
||||||
encryptionFlag: 0,
|
encryptionFlag: 0,
|
||||||
reCheckNum:0,
|
reCheckNum:0,
|
||||||
state: 1,
|
state: 1,
|
||||||
factorFlag:0,
|
factorFlag:1,
|
||||||
|
icdId:'',
|
||||||
|
power:'',
|
||||||
|
preinvestmentPlan:''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,38 +237,69 @@ const disabledDate = (time: Date) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 定义表单校验规则
|
// 定义表单校验规则
|
||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
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' }],
|
||||||
name: [{ 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: [{ required: true, message: '额定电压必填!', trigger: 'blur' },
|
devVolt: [
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: '额定电压格式错误', trigger: 'blur' }],
|
{ required: true, message: '额定电压必填!', trigger: 'blur' },
|
||||||
devCurr: [{ required: true, message: '额定电流必填!', trigger: 'blur' },
|
{ pattern: /^\d+(\.\d+)?$/, message: '额定电压格式错误', trigger: 'blur' }
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: '额定电流格式错误', trigger: 'blur' }],
|
],
|
||||||
createDate: [{ required: true, message: '生产日期必填!', trigger: 'blur' }],
|
devCurr: [
|
||||||
createId: [{ required: true, message: '出厂编号必填!', trigger: 'blur' }],
|
{ required: true, message: '额定电流必填!', trigger: 'blur' },
|
||||||
hardwareVersion: [{ required: true, message: '固件版本必填!', trigger: 'blur' }],
|
{ pattern: /^\d+(\.\d+)?$/, message: '额定电流格式错误', trigger: 'blur' }
|
||||||
softwareVersion: [{ required: true, message: '软件版本必填!', trigger: 'blur' }],
|
],
|
||||||
ip:[{ required: true, message: 'IP地址必填!', trigger: 'blur' } ,
|
createId: [{ required: true, message: '装置编号必填!', 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:[{ required: true, message: '端口号必填!', trigger: 'blur' },
|
ip: [
|
||||||
{ pattern: /^(6553[0-5]|655[0-2][0-9]|64[0-9]{3}|[1-5]?[0-9]{1,4})$/, message: '端口号范围0到65535的整数', trigger: 'blur' }],
|
{ required: true, message: 'IP地址必填!', trigger: 'blur' },
|
||||||
manufacturer: [{ required: true, message: '生产厂家必选!', trigger: 'change' }],
|
{ 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' }
|
||||||
encryptionFlag: [{ required: true, message: '是否加密必选!', trigger: 'change' }],
|
],
|
||||||
protocol: [{ required: true, message: '通讯协议必选!', trigger: 'change' }],
|
port: [
|
||||||
// series: [],
|
{ required: true, message: '端口号必填!', trigger: 'blur' },
|
||||||
// devKey: []
|
{ pattern: /^(6553[0-5]|655[0-2][0-9]|64[0-9]{3}|[1-5]?[0-9]{1,4})$/, message: '端口号范围0到65535的整数', trigger: 'blur' }
|
||||||
series : [
|
],
|
||||||
{ required: true, message: '请输入识别码', trigger: 'blur' }
|
encryptionFlag: [{ required: true, message: '是否加密必选!', trigger: 'change' }],
|
||||||
],
|
protocol: [{ required: true, message: '通讯协议必选!', trigger: 'change' }],
|
||||||
devKey : [
|
series: [{ required: true, message: '请输入识别码', trigger: 'blur' }],
|
||||||
{ required: true, message: '请输入密钥', trigger: 'blur' }
|
devKey: [{ required: true, message: '请输入密钥', trigger: 'blur' }]
|
||||||
],
|
};
|
||||||
})
|
|
||||||
|
// 使用计算属性根据 scene 动态生成规则
|
||||||
|
const rules = computed(() => {
|
||||||
|
const dynamicRules = { ...baseRules };
|
||||||
|
|
||||||
|
if (scene.value === '0'){//只有电科院需要展示
|
||||||
|
dynamicRules.createDate= [{ required: true, message: '出厂日期必填!', trigger: 'blur' }];
|
||||||
|
}
|
||||||
|
if (scene.value === '1'){//只有楼下出厂需要展示
|
||||||
|
dynamicRules.preinvestmentPlan= [{ required: true, message: '预投计划必选!', trigger: 'change' }];
|
||||||
|
dynamicRules.createId= [{ required: true, message: '装置编号必填!', trigger: 'blur' },
|
||||||
|
{ pattern: /^\d+$/, message: '装置编号为数字', trigger: 'blur' }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (scene.value !== '0') {
|
||||||
|
dynamicRules.name = [{ required: true, message: '设备名称必填!', trigger: 'blur' }];
|
||||||
|
dynamicRules.hardwareVersion = [{ required: true, message: '固件版本必填!', trigger: 'blur' }];
|
||||||
|
dynamicRules.softwareVersion = [{ required: true, message: '软件版本必填!', trigger: 'blur' }];
|
||||||
|
dynamicRules.manufacturer = [{ required: true, message: '生产厂家必选!', trigger: 'change' }];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scene.value !== '2') {
|
||||||
|
dynamicRules.name = [{ required: true, message: '设备名称必填!', trigger: 'blur' }];
|
||||||
|
dynamicRules.manufacturer = [{ required: true, message: '生产厂家必选!', trigger: 'change' }];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return dynamicRules;
|
||||||
|
});
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
@@ -292,10 +322,18 @@ const disabledDate = (time: Date) => {
|
|||||||
}
|
}
|
||||||
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');
|
||||||
|
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){
|
||||||
|
formContent.value.series = 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}成功!` })
|
||||||
@@ -314,6 +352,7 @@ const disabledDate = (time: Date) => {
|
|||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close()
|
close()
|
||||||
// 刷新表格
|
// 刷新表格
|
||||||
await props.refreshTable!()
|
await props.refreshTable!()
|
||||||
@@ -327,8 +366,10 @@ const disabledDate = (time: Date) => {
|
|||||||
|
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = (sign: string, data: Device.ResPqDev,currentMode: string) => {
|
const open = async (sign: string, data: Device.ResPqDev,currentMode: string,currentScene: string,devType:Device.ResDev[] ) => {
|
||||||
|
devTypeOptions.value = devType
|
||||||
mode.value = currentMode
|
mode.value = currentMode
|
||||||
|
scene.value = currentScene
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
|
||||||
@@ -349,6 +390,14 @@ const open = (sign: string, data: Device.ResPqDev,currentMode: string) => {
|
|||||||
formContent.value = { ...data }
|
formContent.value = { ...data }
|
||||||
} else {
|
} else {
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
|
if(scene.value === '2'){
|
||||||
|
const manufacturers = dictStore.getDictData('Dev_Manufacturers');
|
||||||
|
const nanjingCanxuan = manufacturers.find(item => item.name === '南京灿能');
|
||||||
|
if(nanjingCanxuan){
|
||||||
|
formContent.value.manufacturer = nanjingCanxuan.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//handleEncryptionChange(1)
|
//handleEncryptionChange(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,6 +419,45 @@ const open = (sign: string, data: Device.ResPqDev,currentMode: string) => {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
const handleDevTypeChange = (value: string) => {
|
||||||
|
// 在这里处理选中事件的逻辑
|
||||||
|
const dev = devTypeOptions.value.find(t =>t.id === value)
|
||||||
|
if (dev) {
|
||||||
|
formContent.value.devChns = dev.devChns; // 默认值为1
|
||||||
|
formContent.value.devCurr = dev.devCurr; // 默认值为1
|
||||||
|
formContent.value.devVolt = dev.devVolt; // 默认值为1
|
||||||
|
formContent.value.icdId = dev.icd
|
||||||
|
formContent.value.power = dev.power
|
||||||
|
if(dev.name.includes('882B')){
|
||||||
|
formContent.value.ip = '172.17.102.220'
|
||||||
|
}else if(dev.name.includes('882A')){
|
||||||
|
formContent.value.ip = '172.17.102.221'
|
||||||
|
}else{
|
||||||
|
formContent.value.ip = '172.17.102.200'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
formContent.value.devChns = 1; // 默认值为1
|
||||||
|
formContent.value.devCurr = 1; // 默认值为1
|
||||||
|
formContent.value.devVolt = 57.74; // 默认值为1
|
||||||
|
formContent.value.ip = '172.17.102.200'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleInput = (value: string) => {
|
||||||
|
// 在这里处理选中事件的逻辑
|
||||||
|
if(scene.value === '1'){
|
||||||
|
formContent.value.name = value
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|||||||
@@ -10,7 +10,12 @@
|
|||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button v-auth.device="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
<el-button v-auth.device="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
<el-button v-auth.device="'export'" type='primary' :icon='Upload' plain @click='downloadFile()'>导出</el-button>
|
<el-button v-auth.device="'export'" type='primary' :icon='Upload' plain @click='downloadFile()'>导出</el-button>
|
||||||
<el-button v-auth.device="'import'" type='primary' :icon='Download' plain @click='importFile()' v-if='modeStore.currentMode === "比对式"'>导入</el-button>
|
<el-button v-auth.device="'import'" type='primary' :icon='Download' plain @click="importFile('')"
|
||||||
|
v-if='modeStore.currentMode != "比对式"'>导入
|
||||||
|
</el-button>
|
||||||
|
<el-button v-auth.device="'import'" type='primary' :icon='Download' plain @click="importFile('比对式')"
|
||||||
|
v-if='modeStore.currentMode === "比对式"'>导入
|
||||||
|
</el-button>
|
||||||
<el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
<el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
删除
|
删除
|
||||||
@@ -18,8 +23,11 @@
|
|||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<template #operation='scope'>
|
||||||
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' :model-value="false" @click="openDialog('edit', scope.row)">编辑</el-button>
|
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' :model-value='false'
|
||||||
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
@click="openDialog('edit', scope.row)">编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</ProTable>
|
</ProTable>
|
||||||
@@ -39,26 +47,36 @@ import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/i
|
|||||||
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, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { getPqDevList, deletePqDev, exportPqDev, downloadTemplate, importPqDev } from '@/api/device/device/index.ts'
|
import {
|
||||||
import { ElMessageBox } from 'element-plus'
|
getPqDevList,
|
||||||
import { computed, reactive, ref } from 'vue'
|
deletePqDev,
|
||||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
getPqDev,
|
||||||
|
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'
|
||||||
|
|
||||||
const modeStore = useModeStore();
|
// defineOptions({
|
||||||
|
// name: 'device',
|
||||||
|
// })
|
||||||
|
const modeStore = useModeStore()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
const appSceneStore = useAppSceneStore()
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
const devicePopup = ref()
|
const devicePopup = ref()
|
||||||
// 定义包含和排除的单位
|
const boundPqDevList = ref<Device.ReqPqDevParams[]>([])//根据检测计划id查询出所有已绑定的设备
|
||||||
|
// 存储设备类型选项
|
||||||
|
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||||
const boundPqDevList=ref<Device.ReqPqDevParams[]>([])//根据检测计划id查询出所有已绑定的设备
|
|
||||||
|
|
||||||
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
|
||||||
newParams.searchBeginTime = startDate.value
|
newParams.searchBeginTime = startDate.value
|
||||||
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
|
||||||
newParams.pattern = patternId
|
newParams.pattern = patternId
|
||||||
return getPqDevList(newParams)
|
return getPqDevList(newParams)
|
||||||
}
|
}
|
||||||
@@ -72,32 +90,54 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
search: { el: 'input' },
|
search: { el: 'input' },
|
||||||
|
// isShow: appSceneStore.currentScene != '1',
|
||||||
|
// ...(appSceneStore.currentScene != '1' ? {
|
||||||
|
// search: { el: 'input' },
|
||||||
|
// } : {}),
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'devType',
|
prop: 'devType',
|
||||||
label: '设备类型',
|
label: '设备类型',
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
enum: dictStore.getDictData('Dev_Type'),
|
render: (scope) => {
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
// 查找设备类型名称
|
||||||
|
const name = devTypeOptions.value.find(option => option.id === scope.row.devType)
|
||||||
|
return <span>{name?.name}</span>
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'createDate',
|
prop: 'createDate',
|
||||||
label: '出厂日期',
|
label: '出厂日期',
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
search: {
|
isShow: appSceneStore.currentScene === '0',
|
||||||
span: 2,
|
...(appSceneStore.currentScene === '0' ? {
|
||||||
render: () => {
|
search: {
|
||||||
return (
|
render: () => {
|
||||||
<div class='flx-flex-start'>
|
return (
|
||||||
<TimeControl
|
<div class='flx-flex-start'>
|
||||||
default={'月'}
|
<TimeControl
|
||||||
onUpdate-dates={handleDateChange}
|
default={'月'}
|
||||||
/>
|
onUpdate-dates={handleDateChange}
|
||||||
</div>
|
/>
|
||||||
)
|
</div>
|
||||||
|
)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
} : {}),
|
||||||
|
// search: {
|
||||||
|
// span: 2,
|
||||||
|
// render: () => {
|
||||||
|
// return (
|
||||||
|
// <div class='flx-flex-start'>
|
||||||
|
// <TimeControl
|
||||||
|
// default={'月'}
|
||||||
|
// onUpdate-dates={handleDateChange}
|
||||||
|
// />
|
||||||
|
// </div>
|
||||||
|
// )
|
||||||
|
// },
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'devChns',
|
prop: 'devChns',
|
||||||
@@ -121,10 +161,31 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
prop: 'manufacturer',
|
prop: 'manufacturer',
|
||||||
label: '设备厂家',
|
label: '设备厂家',
|
||||||
enum: dictStore.getDictData('Dev_Manufacturers'),
|
enum: dictStore.getDictData('Dev_Manufacturers'),
|
||||||
search: { el: 'select', props: { filterable: true }, order: 1 },
|
isShow: appSceneStore.currentScene != '1',
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
...(appSceneStore.currentScene != '1' ? {
|
||||||
|
search: { el: 'select', props: { filterable: true }, order: 1 },
|
||||||
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
|
} : {}),
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'createTime',
|
||||||
|
label: '创建时间',
|
||||||
|
width: 200,
|
||||||
|
render: scope => {
|
||||||
|
if (scope.row.createTime) {
|
||||||
|
const date = new Date(scope.row.createTime);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -138,55 +199,82 @@ const handleDateChange = (startDateTemp: string, endDateTemp: string) => {
|
|||||||
}
|
}
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
||||||
devicePopup.value?.open(titleType, row,modeStore.currentMode)
|
devicePopup.value?.open(titleType, row, modeStore.currentMode, appSceneStore.currentScene, devTypeOptions.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 批量删除设备
|
// 批量删除设备
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除设备
|
// 删除设备
|
||||||
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()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出设备
|
// 导出设备
|
||||||
const downloadFile = async () => {
|
const downloadFile = async () => {
|
||||||
// 获取当前的搜索参数
|
// 获取当前的搜索参数
|
||||||
const searchParam = proTable.value?.searchParam || {};
|
const searchParam = proTable.value?.searchParam || {}
|
||||||
|
|
||||||
// 将开始时间和结束时间添加到搜索参数中
|
// 将开始时间和结束时间添加到搜索参数中
|
||||||
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(exportPqDev,'被检设备导出数据', {...proTable.value?.searchParam,pattern:patternId}, false,'.xlsx')
|
useDownload(exportCNDev, '被检设备导出数据', { ...proTable.value?.searchParam, pattern: patternId }, false, '.xlsx')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//导入设备
|
//导入设备
|
||||||
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
||||||
|
|
||||||
const importFile = async () => {
|
const importFile = async (pattern: string) => {
|
||||||
const params = {
|
|
||||||
title: '被检设备',
|
if (pattern === '比对式') {
|
||||||
showCover: false,
|
// const params = {
|
||||||
tempApi: downloadTemplate,
|
// title: '被检设备',
|
||||||
importApi: importPqDev,
|
// showCover: false,
|
||||||
getTableList: proTable.value?.getTableList,
|
// tempApi: downloadTemplate,
|
||||||
|
// importApi: importPqDev,
|
||||||
|
// getTableList: proTable.value?.getTableList,
|
||||||
|
// }
|
||||||
|
// deviceImportExcel.value?.acceptParams(params)
|
||||||
|
} else {
|
||||||
|
const params = {
|
||||||
|
title: '被检设备',
|
||||||
|
showCover: false,
|
||||||
|
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id,
|
||||||
|
tempApi: downloadCNDevTemplate,
|
||||||
|
importApi: importCNDev,
|
||||||
|
// importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev,
|
||||||
|
getTableList: proTable.value?.getTableList,
|
||||||
|
}
|
||||||
|
deviceImportExcel.value?.acceptParams(params)
|
||||||
}
|
}
|
||||||
deviceImportExcel.value?.acceptParams(params)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
const response = await getPqDev()
|
||||||
|
devTypeOptions.value = (response.data as Device.ResDev[]).map(item => ({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
icd: item.icd,
|
||||||
|
power: item.power,
|
||||||
|
devVolt: item.devVolt,
|
||||||
|
devCurr: item.devCurr,
|
||||||
|
devChns: item.devChns,
|
||||||
|
}))
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -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()
|
||||||
@@ -156,31 +156,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[]);
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStan
|
|||||||
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} from '@/api/device/error/index'
|
||||||
|
defineOptions({
|
||||||
|
name: 'errorSystem'
|
||||||
|
})
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|||||||
127
frontend/src/views/machine/icd/components/icdPopup.vue
Normal file
127
frontend/src/views/machine/icd/components/icdPopup.vue
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 基础信息弹出框 -->
|
||||||
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogSmall" @close="close" >
|
||||||
|
<div>
|
||||||
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules'>
|
||||||
|
<el-form-item label="名称" prop="name" >
|
||||||
|
<el-input v-model='formContent.name' placeholder="请输入icd名称"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="存储地址" prop="path" >
|
||||||
|
<el-input v-model='formContent.path' placeholder="请输入icd存储地址"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="close()">取消</el-button>
|
||||||
|
<el-button type="primary" @click="save()" >
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import{ ElMessage, type FormInstance,type FormItemRule } from 'element-plus'
|
||||||
|
import type { ProTableInstance } from '@/components/ProTable/interface'
|
||||||
|
import { ref,computed, Ref} from 'vue'
|
||||||
|
import { type ICD } from '@/api/device/interface/icd'
|
||||||
|
import {dialogSmall} from '@/utils/elementBind'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {addICD,updateICD} from '@/api/device/icd'
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
// 定义弹出组件元信息
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
function useMetaInfo() {
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const titleType = ref('add')
|
||||||
|
const formContent = ref<ICD.ResICD>({
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
path: '',
|
||||||
|
state: 1,
|
||||||
|
})
|
||||||
|
return { dialogVisible, titleType, formContent }
|
||||||
|
}
|
||||||
|
|
||||||
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
|
|
||||||
|
|
||||||
|
// 清空formContent
|
||||||
|
const resetFormContent = () => {
|
||||||
|
formContent.value = {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
path: '',
|
||||||
|
state: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let dialogTitle = computed(() => {
|
||||||
|
return titleType.value === 'add' ? '新增ICD' : '编辑ICD'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//定义规则
|
||||||
|
const formRuleRef = ref<FormInstance>()
|
||||||
|
//定义校验规则
|
||||||
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
|
name: [{ required: true, message: 'icd名称必填!', trigger: 'blur' }],
|
||||||
|
path: [{ required: true, message: 'icd存储地址必填!', trigger: 'blur' }],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 清空dialogForm中的值
|
||||||
|
resetFormContent()
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
|
try {
|
||||||
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
if (formContent.value.id) {
|
||||||
|
await updateICD(formContent.value);
|
||||||
|
} else {
|
||||||
|
await addICD(formContent.value);
|
||||||
|
}
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
close()
|
||||||
|
// 刷新表格
|
||||||
|
await props.refreshTable!()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
//error('验证过程中出现错误', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string, data: ICD.ResICD) => {
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
titleType.value = sign
|
||||||
|
dialogVisible.value = true
|
||||||
|
|
||||||
|
if (data.id) {
|
||||||
|
formContent.value = { ...data }
|
||||||
|
} else {
|
||||||
|
resetFormContent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
const props = defineProps<{
|
||||||
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
|
}>()
|
||||||
|
|
||||||
|
</script>
|
||||||
114
frontend/src/views/machine/icd/index.vue
Normal file
114
frontend/src/views/machine/icd/index.vue
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<template>
|
||||||
|
<div class='table-box' ref='popupBaseView'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:request-api='getTableList'
|
||||||
|
>
|
||||||
|
<!-- :requestApi="getRoleList" -->
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader='scope'>
|
||||||
|
<el-button v-auth.devType="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
|
<el-button v-auth.devType="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 表格操作 -->
|
||||||
|
<template #operation='scope'>
|
||||||
|
<el-button v-auth.devType="'edit'" type='primary' link :icon='EditPen' :model-value='false'
|
||||||
|
@click="openDialog('edit', scope.row)">编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button v-auth.devType="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
<IcdPopup :refresh-table='proTable?.getTableList' ref='icdPopup' />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='useRole'>
|
||||||
|
import { type ICD } from '@/api/device/interface/icd'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||||
|
import {
|
||||||
|
getICDList,
|
||||||
|
deleteICD,
|
||||||
|
} from '@/api/device/icd/index.ts'
|
||||||
|
import { reactive, ref } from 'vue'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'devType',
|
||||||
|
})
|
||||||
|
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
const icdPopup = ref()
|
||||||
|
|
||||||
|
|
||||||
|
const getTableList = async (params: any) => {
|
||||||
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
|
return getICDList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<ICD.ResICD>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'name',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'path',
|
||||||
|
label: '存储地址',
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'createTime',
|
||||||
|
label: '创建时间',
|
||||||
|
render: scope => {
|
||||||
|
if (scope.row.createTime) {
|
||||||
|
const date = new Date(scope.row.createTime);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
// 打开 drawer(新增、编辑)
|
||||||
|
const openDialog = (titleType: string, row: Partial<ICD.ResICD> = {}) => {
|
||||||
|
icdPopup.value?.open(titleType, row)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 批量删除icd
|
||||||
|
const batchDelete = async (id: string[]) => {
|
||||||
|
await useHandleData(deleteICD, id, '删除所选icd')
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除设备icd
|
||||||
|
const handleDelete = async (params: ICD.ResICD) => {
|
||||||
|
await useHandleData(deleteICD, [params.id] , `删除【${params.name}】icd`)
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
:header-cell-style="{
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: '#003078',
|
||||||
|
color: '#fff'
|
||||||
|
}"
|
||||||
|
stripe
|
||||||
|
height="calc(100vh - 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
|
||||||
|
}
|
||||||
|
})
|
||||||
|
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: '谐波有功功率'
|
||||||
|
? '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,240 @@
|
|||||||
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>
|
||||||
|
|
||||||
<template #footer>
|
<el-table
|
||||||
<div >
|
:data="tableData"
|
||||||
<el-button @click='close()'>取 消</el-button>
|
:header-cell-style="{
|
||||||
<el-button type="primary" @click='save()'>保存</el-button>
|
textAlign: 'center',
|
||||||
</div>
|
backgroundColor: '#003078',
|
||||||
</template>
|
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)) || '' }}</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>
|
||||||
|
<div>
|
||||||
|
<el-button @click="close()">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="save">保 存</el-button>
|
||||||
|
</div>
|
||||||
|
</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
|
||||||
|
}
|
||||||
|
})
|
||||||
|
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: '序号' },
|
label: '实时',
|
||||||
{
|
value: 'real'
|
||||||
prop: 'name',
|
},
|
||||||
label: '参考设定值类型',
|
{
|
||||||
minWidth: 350,
|
label: 'CP95值',
|
||||||
},
|
value: 'cp95'
|
||||||
{
|
},
|
||||||
prop: 'standardName',
|
{
|
||||||
label: '参考设定值子类型',
|
label: '平均值',
|
||||||
minWidth: 150,
|
value: 'avg'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardTime',
|
label: '最小值',
|
||||||
label: '参考设定值',
|
value: 'min'
|
||||||
minWidth: 150,
|
},
|
||||||
},
|
{
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
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 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,175 +1,618 @@
|
|||||||
<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">
|
||||||
<el-tab-pane label="输出菜单">
|
<div class="dialog-content">
|
||||||
<!-- 输出菜单内容 -->
|
<el-tabs type="border-card" class="right-tabs">
|
||||||
<el-table :data="tableData"
|
<el-tab-pane label="检测">
|
||||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
<!-- 全局设置菜单内容 -->
|
||||||
:cell-style="{ textAlign: 'center' }"
|
<div style="height: 295px">
|
||||||
style="width: 100%"
|
<el-radio-group v-model="form.subType">
|
||||||
:style="{ height: '295px',overflow:'hidden'}"
|
<el-radio
|
||||||
:show-header="false"
|
v-for="item in tabChildren"
|
||||||
:span-method="arraySpanMethod">
|
:key="item"
|
||||||
<el-table-column prop="sort" label="相别" width="60" />
|
:label="item.label"
|
||||||
<el-table-column prop="frequency" label="电压/电流" width="90" />
|
:value="item.code"
|
||||||
<el-table-column prop="L1" label="值" width="180"/>
|
border
|
||||||
<el-table-column label="操作" width="80">
|
style="margin: 0 0 10px 10px"
|
||||||
<template #default="{ }">
|
/>
|
||||||
<el-button type="info" :icon="Bottom"></el-button>
|
<!-- <el-radio v-for="item in tabChildren" :value="item.value" border>{{ item.label }}</el-radio> -->
|
||||||
</template>
|
</el-radio-group>
|
||||||
</el-table-column>
|
</div>
|
||||||
<el-table-column label="操作">
|
</el-tab-pane>
|
||||||
<template #default="{ row, $index }">
|
</el-tabs>
|
||||||
<el-button :type="buttonTypes[$index].channel || 'info'" @click="toggleType(row, $index,'channel')">通道使能</el-button>
|
<el-tabs type="border-card" class="left-tabs" style="height: 100%">
|
||||||
<el-button :type="buttonTypes[$index]?.harmonic || 'info'" @click="toggleType(row, $index, 'harmonic')">谐波使能</el-button>
|
<el-tab-pane label="输出菜单">
|
||||||
<el-button :type="buttonTypes[$index]?.interHarmonic || 'info'" @click="toggleType(row, $index, 'interHarmonic')">间谐波使能</el-button>
|
<!-- 输出菜单内容 -->
|
||||||
<el-button :type="buttonTypes[$index]?.flicker || 'info'" @click="toggleType(row, $index, 'flicker')">闪变使能</el-button>
|
<el-table
|
||||||
<el-button :type="buttonTypes[$index]?.transient || 'info'" @click="toggleType(row, $index, 'transient')">暂态使能</el-button>
|
:data="tableData"
|
||||||
</template>
|
style="width: 100%"
|
||||||
</el-table-column>
|
:style="{ height: '295px', overflow: 'hidden' }"
|
||||||
</el-table>
|
:show-header="false"
|
||||||
</el-tab-pane>
|
:span-method="arraySpanMethod"
|
||||||
</el-tabs>
|
:cell-style="tableStyle.cellStyle"
|
||||||
<el-tabs type="border-card" class="right-tabs" style="height: 100%;">
|
:header-cell-style="{ textAlign: 'center', backgroundColor: '#003078', color: '#fff' }"
|
||||||
<el-tab-pane label="全局设置菜单">
|
@cell-click="handleRowClick"
|
||||||
<!-- 全局设置菜单内容 -->
|
:key="key"
|
||||||
<div class="form-item-container">
|
>
|
||||||
<el-form-item label="频率(Hz)" prop='name'>
|
<el-table-column prop="name" label="相别" width="60" align="center" />
|
||||||
<el-input />
|
<el-table-column prop="frequency" label="电压/电流" align="center" width="60" />
|
||||||
</el-form-item>
|
<el-table-column prop="L1" label="值" width="180" align="center">
|
||||||
</div>
|
<template #default="{ row, $index }">
|
||||||
<div class="button-label-container">
|
<span>
|
||||||
<label>参考设定值列表:</label>
|
{{ row.type === 'V' ? '电压' : '电流' }}{{ form.channelList[$index].famp
|
||||||
<el-button type="primary" :icon='EditPen' @click="openDialog">编辑</el-button>
|
}}{{
|
||||||
</div>
|
valueCode == 'Absolute' ? (row.type === 'V' ? 'V' : 'A') : '%'
|
||||||
</el-tab-pane>
|
}}
|
||||||
</el-tabs>
|
相角{{ form.channelList[$index].fphase }}°
|
||||||
</div>
|
</span>
|
||||||
<div style="margin-top: 20px;">
|
</template>
|
||||||
<el-tabs type="border-card" class="custom-tabs">
|
</el-table-column>
|
||||||
<el-tab-pane label="电压/电流编辑">
|
<el-table-column label="操作" width="85">
|
||||||
<TestScriptVolCurTab/>
|
<template #default="{ row, $index }">
|
||||||
</el-tab-pane>
|
<!-- <el-button
|
||||||
<el-tab-pane label="谐波编辑">
|
type="primary"
|
||||||
<TestScriptHarmTab/>
|
v-if="$index != 4"
|
||||||
</el-tab-pane>
|
link
|
||||||
<el-tab-pane label="间谐波编辑">
|
:icon="CopyDocument"
|
||||||
<TestScriptInHarmTab/>
|
@click="copyRow($index)"
|
||||||
</el-tab-pane>
|
>
|
||||||
<el-tab-pane label="闪变编辑">
|
复制
|
||||||
<TestScriptFlickerTab/>
|
</el-button> -->
|
||||||
</el-tab-pane>
|
<el-dropdown placement="top-start">
|
||||||
<el-tab-pane label="暂态编辑">
|
<el-button type="primary" link :icon="CopyDocument">复制</el-button>
|
||||||
<TestScriptDipTab/>
|
<template #dropdown>
|
||||||
</el-tab-pane>
|
<el-dropdown-menu>
|
||||||
</el-tabs>
|
<div v-if="$index == 0">
|
||||||
</div>
|
<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="通道使能"
|
||||||
|
/>
|
||||||
|
<el-checkbox-button
|
||||||
|
v-model="form.channelList[$index].harmFlag"
|
||||||
|
label="谐波使能"
|
||||||
|
/>
|
||||||
|
<el-checkbox-button
|
||||||
|
v-model="form.channelList[$index].inHarmFlag"
|
||||||
|
label="间谐波使能"
|
||||||
|
/>
|
||||||
|
<el-checkbox-button
|
||||||
|
v-model="form.channelList[$index].flickerFlag"
|
||||||
|
label="闪变使能"
|
||||||
|
/>
|
||||||
|
<el-checkbox-button
|
||||||
|
v-model="form.channelList[$index].dipFlag"
|
||||||
|
label="暂态使能"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
|
||||||
|
<el-tab-pane label="全局设置菜单">
|
||||||
|
<!-- 全局设置菜单内容 -->
|
||||||
|
<div style="height: 295px; width: 170px">
|
||||||
|
<div class="form-item-container">
|
||||||
|
<el-form-item label="频率:" prop="name">
|
||||||
|
<div class="input-label-container">
|
||||||
|
<el-input type="number" style="width: 100px" v-model="form.ffreq" />
|
||||||
|
<label>Hz</label>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="button-label-container">
|
||||||
|
<label>参考设定值列表:</label>
|
||||||
|
<el-button type="primary" :icon="EditPen" @click="openDialog">编辑</el-button>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 10px; height: 234px">
|
||||||
|
<el-tabs type="border-card" class="custom-tabs">
|
||||||
|
<el-tab-pane label="电压/电流编辑" v-if="childForm[0].channelFlag || childForm[1].channelFlag">
|
||||||
|
<TestScriptVolCurTab :childForm="childForm" :valueCode="valueCode" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="谐波编辑" v-if="childForm[0].harmFlag || childForm[1].harmFlag">
|
||||||
|
<TestScriptHarmTab :childForm="childForm" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="间谐波编辑" v-if="childForm[0].inHarmFlag || childForm[1].inHarmFlag">
|
||||||
|
<TestScriptInHarmTab :childForm="childForm" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="闪变编辑" v-if="childForm[0].flickerFlag || childForm[1].flickerFlag">
|
||||||
|
<TestScriptFlickerTab :childForm="childForm" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="暂态编辑" v-if="childForm[0].dipFlag || childForm[1].dipFlag">
|
||||||
|
<TestScriptDipTab :childForm="childForm" />
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</el-carousel-item>
|
||||||
|
<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"
|
||||||
|
@recalculation="recalculation"
|
||||||
|
/>
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
|
||||||
<SetValueTable ref="setValueTable"/>
|
<template #footer>
|
||||||
|
<div>
|
||||||
<template #footer>
|
<el-button @click="close">取 消</el-button>
|
||||||
<div >
|
<el-button type="primary" @click="next" v-if="!showSetValueTable">下一步</el-button>
|
||||||
<el-button @click='close()'>取 消</el-button>
|
<el-button type="primary" @click="previous" v-if="showSetValueTable">上一步</el-button>
|
||||||
<el-button type="primary" @click='save()'>保存</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) {
|
// 第一列
|
||||||
return {
|
if (rowIndex % 2 === 0) {
|
||||||
rowspan: 2,
|
return {
|
||||||
colspan: 1
|
rowspan: 2,
|
||||||
};
|
colspan: 1
|
||||||
} else {
|
}
|
||||||
return {
|
} else {
|
||||||
rowspan: 0,
|
return {
|
||||||
colspan: 0
|
rowspan: 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 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 = 'Ia'
|
||||||
|
form.value.channelList[4].channelType = 'Uc'
|
||||||
|
form.value.channelList[5].channelType = 'Ic'
|
||||||
|
key.value += 1
|
||||||
|
ElMessage.success({
|
||||||
|
message: '复制成功!',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = () => {
|
const openDialog = () => {}
|
||||||
setValueTable.value?.open()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
@@ -177,43 +620,60 @@ defineExpose({ open })
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.dialog-content {
|
.dialog-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
height: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs-container {
|
.tabs-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.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 {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center; /* 水平居中 */
|
justify-content: center; /* 水平居中 */
|
||||||
margin-bottom: 10px; /* 可选:添加间距 */
|
margin-bottom: 10px; /* 可选:添加间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-label-container {
|
.button-label-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center; /* 水平居中 */
|
justify-content: center; /* 水平居中 */
|
||||||
align-items: center; /* 垂直居中 */
|
align-items: center; /* 垂直居中 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-label-container label {
|
.button-label-container label {
|
||||||
margin-right: 10px; /* 按钮和文字之间的距离 */
|
margin-right: 10px; /* 按钮和文字之间的距离 */
|
||||||
|
}
|
||||||
|
.input-label-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center; /* 垂直居中对齐 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input-label-container label {
|
||||||
|
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);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,266 +1,555 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="divider-container">
|
<div>
|
||||||
<el-divider style="width: 400px">检测脚本信息</el-divider>
|
<div class="divider-container">
|
||||||
<el-divider style="width: 1300px">检测项目概要信息</el-divider>
|
<el-divider style="width: 260px" content-position="left">检测脚本信息</el-divider>
|
||||||
</div>
|
<!-- <el-divider style="width: 400px" content-position="left">通讯脚本</el-divider> -->
|
||||||
<div class="data-check-content">
|
<el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider>
|
||||||
<div class="content-tree" >
|
|
||||||
<el-tree
|
|
||||||
:default-expanded-keys="['0', '0-1', '0-2', '0-3', '1']"
|
|
||||||
node-key="id"
|
|
||||||
:data="data"
|
|
||||||
:props="defaultProps"
|
|
||||||
@node-click="handleNodeClick" />
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="data-check-content">
|
||||||
|
<div class="content-tree">
|
||||||
|
<Tree :treeData="treeData" @setTab="setTab" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="content-right-Tabs" style="height: 470px;width: 100px;">
|
<div class="content-right-Tabs" style="height: calc(100vh - 315px); width: 100px">
|
||||||
<el-tabs type="border-card" style="height: 100%;">
|
<el-tabs type="border-card" style="height: 100%" v-model="activeName" @tab-change="tabChange">
|
||||||
<el-tab-pane
|
<el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
|
||||||
v-for="tab in props.options"
|
<div v-if="activeName == tab.value">
|
||||||
:key="tab.name"
|
<div class="dialog-footer">
|
||||||
:label="tab.label.replace(/准确度|检测/g, '')"
|
<el-button :icon="CirclePlus" type="primary" @click="openDialog('add')">新增</el-button>
|
||||||
:name="tab.name">
|
</div>
|
||||||
<!-- 频率tab -->
|
<div style="display: flex">
|
||||||
<el-tabs type="border-card" style="height: 400px;">
|
<!-- 通信脚本 -->
|
||||||
|
<el-tabs type="border-card" v-model="firstName" style="height: 100%">
|
||||||
|
<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
|
<el-tab-pane
|
||||||
v-for="subTab in tab.children || []"
|
v-for="subTab in tab.children || []"
|
||||||
:key="subTab.name"
|
:key="subTab.value"
|
||||||
:label="subTab.label"
|
:label="subTab.label"
|
||||||
:name="subTab.name">
|
:name="subTab.value"
|
||||||
<!-- 子标签页内容 -->
|
style="width: 100%"
|
||||||
<div class="dialog-footer">
|
>
|
||||||
<el-button :icon='CirclePlus' type="primary" @click="openDialog('add')">新增</el-button>
|
<el-table
|
||||||
</div>
|
:data="tableData"
|
||||||
<div class="table-container">
|
:header-cell-style="{
|
||||||
<el-table :data="tableData"
|
textAlign: 'center',
|
||||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
backgroundColor: '#003078',
|
||||||
|
color: '#fff'
|
||||||
|
}"
|
||||||
|
stripe
|
||||||
:cell-style="{ textAlign: 'center' }"
|
:cell-style="{ textAlign: 'center' }"
|
||||||
|
highlight-current-row
|
||||||
|
height="calc(100vh - 480px)"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:style="{ height: '240px',overflow:'hidden'}">
|
>
|
||||||
<el-table-column prop="sort" label="组次" width="60" />
|
<el-table-column type="index" label="组次" width="60" />
|
||||||
<el-table-column prop="frequency" label="频率(Hz)" width="100" />
|
<el-table-column prop="ffreq" label="频率(Hz)" width="90" />
|
||||||
<el-table-column prop="L1" label="L1"/>
|
<el-table-column
|
||||||
<el-table-column prop="L2" label="L2"/>
|
:label="item.label"
|
||||||
<el-table-column prop="L3" label="L3"/>
|
v-for="item in column"
|
||||||
<el-table-column label="操作" min-width="100">
|
:key="item.label"
|
||||||
<template #default="{ row }">
|
>
|
||||||
<el-button type="primary" link :icon='CopyDocument' @click="copyRow(row)">复制</el-button>
|
<template #default="{ row }">
|
||||||
<el-button type="primary" link :icon='CopyDocument' @click="openAddDialog('edit',row)">编辑</el-button>
|
<table class="tableL">
|
||||||
<el-button type='primary' link :icon='Delete' @click="deleteRow(row)">删除</el-button>
|
<tbody>
|
||||||
</template>
|
<tr>
|
||||||
</el-table-column>
|
<td class="theFirst">V</td>
|
||||||
</el-table>
|
<td>
|
||||||
</div>
|
{{
|
||||||
<div class="dialog-footer" style="margin-top: 20px;">
|
row.channelList[item.num].famp == null
|
||||||
<el-button :icon='CirclePlus' type="primary" @click="openAddDialog()">保存测试项</el-button>
|
? '/'
|
||||||
</div>
|
: '' +
|
||||||
</el-tab-pane>
|
row.channelList[item.num]?.famp +
|
||||||
</el-tabs>
|
(valueCode == 'Absolute' ? 'V' : '%')
|
||||||
</el-tab-pane>
|
}}
|
||||||
</el-tabs>
|
</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' ? 'V' : '%')
|
||||||
|
}}
|
||||||
|
</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="85">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-switch
|
||||||
|
v-model="row.enable"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
@change="enableRow(row)"
|
||||||
|
>
|
||||||
|
<template #active-action>
|
||||||
|
<span>√</span>
|
||||||
|
</template>
|
||||||
|
<template #inactive-action>
|
||||||
|
<span>×</span>
|
||||||
|
</template>
|
||||||
|
</el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="165">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="actionButtons">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
:icon="CopyDocument"
|
||||||
|
@click="copyRow(row)"
|
||||||
|
>
|
||||||
|
复制
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" link :icon="View" @click="view(row)">
|
||||||
|
查看
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
:icon="EditPen"
|
||||||
|
@click="openDialog('edit', row)"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
:icon="Delete"
|
||||||
|
@click="deleteRow(row)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
</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>
|
</div>
|
||||||
|
|
||||||
<TestProjectPopup ref="testProjectPopup" />
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type PropType, ref } from 'vue';
|
import { type PropType, ref, nextTick } from 'vue'
|
||||||
import { data } from "@/api/plan/autoTest.json";
|
import Tree from './tree.vue'
|
||||||
import type { CascaderOption } from 'element-plus';
|
import Commun from './communication.vue'
|
||||||
import {CirclePlus, Delete, EditPen,CopyDocument} from '@element-plus/icons-vue'
|
import {type CascaderOption, ElMessageBox} from 'element-plus'
|
||||||
import type { TestScript } from '@/api/device/interface/testScript';
|
import { getTreeData } from '@/api/check/test'
|
||||||
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue';
|
import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue'
|
||||||
|
import type { TestScript } from '@/api/device/interface/testScript'
|
||||||
const testProjectPopup = ref()
|
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'
|
||||||
interface TabOption {
|
interface TabOption {
|
||||||
label: string;
|
label?: string
|
||||||
name: string;
|
name?: string
|
||||||
children?: TabOption[];
|
value?: string
|
||||||
|
code?: string
|
||||||
|
children?: TabOption[]
|
||||||
}
|
}
|
||||||
|
const communRef = ref()
|
||||||
|
const treeData = ref<CheckData.TreeItem[]>([])
|
||||||
|
const valueCode = ref('') //Absolute绝对值
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
options: {
|
options: {
|
||||||
type: Array as PropType<TabOption[]>,
|
type: Array as PropType<TabOption[]>,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
});
|
formContent: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const viewDialog = ref(false)
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const activeName = ref('')
|
||||||
|
const childActiveName = ref('')
|
||||||
|
const firstName = 'first'
|
||||||
|
const viewRowRef = ref()
|
||||||
|
const communicationList = ref([])
|
||||||
|
const testProjectPopupRef = ref()
|
||||||
|
const tableData: any = ref([])
|
||||||
|
const tabData: any = ref([])
|
||||||
|
const column = ref([
|
||||||
|
{
|
||||||
|
label: 'L1',
|
||||||
|
num: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'L2',
|
||||||
|
num: 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'L3',
|
||||||
|
num: 4
|
||||||
|
}
|
||||||
|
])
|
||||||
|
// 获取树
|
||||||
|
const getTree = () => {
|
||||||
|
console.log('props.formContent.id', props.formContent.id)
|
||||||
|
getTreeData({
|
||||||
|
scriptId: props.formContent.id
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 'A0000') {
|
||||||
|
treeData.value = res.data
|
||||||
|
console.log('tree',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: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
tabChange()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 设置树点击tab
|
||||||
|
const setTab = row => {
|
||||||
|
activeName.value = row.activeName
|
||||||
|
childActiveName.value = row.childActiveName
|
||||||
|
getTree()
|
||||||
|
}
|
||||||
|
const copyActiveName = ref('')
|
||||||
|
// 获取通讯脚本点击
|
||||||
|
const getCommunication = () => {
|
||||||
|
console.log('123123',communRef.value[0]?.getData())
|
||||||
|
communicationList.value = communRef.value[0]?.getData()
|
||||||
|
}
|
||||||
|
// 切换大tab控制小tab
|
||||||
|
const tabChange = () => {
|
||||||
|
if (copyActiveName.value != activeName.value) {
|
||||||
|
copyActiveName.value == activeName.value
|
||||||
|
|
||||||
const tableData= [
|
if (
|
||||||
{ sort: 1, frequency: 42.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
tabData.value
|
||||||
{ sort: 2, frequency: 50, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
.filter((item: any) => item.value == activeName.value)[0]
|
||||||
{ sort: 3, frequency: 50.05, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
?.children.filter((item: any) => item.value == childActiveName.value).length == 0
|
||||||
{ sort: 4, frequency: 57.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
) {
|
||||||
{ sort: 5, frequency: 57.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
childActiveName.value =
|
||||||
{ sort: 6, frequency: 57.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
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.formContent.id,
|
||||||
|
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
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
const tabs = ref([
|
}
|
||||||
{
|
|
||||||
label: '频率',
|
|
||||||
name: 'resultTab',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '电压',
|
|
||||||
name: 'resultTab1',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab1' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab1' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab1' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '电流',
|
|
||||||
name: 'resultTab2',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab2' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab2' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab2' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '电压不平衡度',
|
|
||||||
name: 'resultTab3',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab3' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab3' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab3' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '电流不平衡度',
|
|
||||||
name: 'resultTab4',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab4' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab4' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab4' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '谐波电压',
|
|
||||||
name: 'resultTab5',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab5' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab5' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab5' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '谐波电流',
|
|
||||||
name: 'resultTab6',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab6' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab6' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab6' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '间谐波电压',
|
|
||||||
name: 'resultTab7',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab7' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab7' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab7' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '间谐波电流',
|
|
||||||
name: 'resultTab8',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab8' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab8' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab8' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '电压暂升暂降',
|
|
||||||
name: 'resultTab9',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab9' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab9' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab9' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '闪变',
|
|
||||||
name: 'resultTab10',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab10' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab10' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab10' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
const defaultProps = {
|
|
||||||
children: "children",
|
|
||||||
label: "name",
|
|
||||||
pid: "pid",
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleNodeClick = (data: any) => {
|
|
||||||
console.log(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
||||||
testProjectPopup.value?.open(titleType, row)
|
showDialog.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
testProjectPopupRef.value?.open(titleType, row)
|
||||||
|
}, 0)
|
||||||
}
|
}
|
||||||
|
// 复制
|
||||||
|
const copyRow = async (row: any) => {
|
||||||
|
ElMessageBox.confirm('是否复制当前检测项目?', '提示', {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: 'warning',
|
||||||
|
draggable: true
|
||||||
|
}).then(async () => {
|
||||||
|
let checkDataList: any = []
|
||||||
|
await communRef.value[0]?.getData().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 { data } = await scriptDtlsCheckDataList({ checkDataList: checkDataList, ...row, retryCompute: true })
|
||||||
|
let copyRow = JSON.parse(JSON.stringify(row))
|
||||||
|
delete copyRow.index
|
||||||
|
|
||||||
|
await addScriptDtls({ ...copyRow, scriptType: activeName.value, checkDataList: data }).then(res => {
|
||||||
|
if (res.code === 'A0000') {
|
||||||
|
ElMessage.success({
|
||||||
|
message: '复制成功!',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
getTree()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 查看
|
||||||
|
const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||||
|
|
||||||
|
getCommunication()
|
||||||
|
console.log('communicationList',communicationList.value)
|
||||||
|
//当前点击的一级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)
|
||||||
|
|
||||||
|
}
|
||||||
|
// 删除
|
||||||
|
const deleteRow = async (row: any) => {
|
||||||
|
await useHandleData(deleteDtls, { enable: row.enable, index: row.index, scriptId: row.scriptId }, `删除`)
|
||||||
|
getTree()
|
||||||
|
}
|
||||||
|
// 启用
|
||||||
|
const enableRow = async (row: any) => {
|
||||||
|
ElMessageBox.confirm(`是否${row.enable == 0 ? `禁用` : `启用`}?`, '温馨提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
draggable: true
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
updateDtls({ enable: row.enable, index: row.index, scriptId: row.scriptId }).then(res => {
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: `${row.enable == 0 ? `禁用` : `启用`}成功!`
|
||||||
|
})
|
||||||
|
getTree()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
row.enable = row.enable == 0 ? 1 : 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 获取左边树数据
|
||||||
|
// 新增保存
|
||||||
|
const addTab = (row: any) => {
|
||||||
|
getTree()
|
||||||
|
}
|
||||||
|
// 保存通信脚本
|
||||||
|
const saveTheNewsletter = () => {}
|
||||||
|
onMounted(() => {
|
||||||
|
getTree()
|
||||||
|
console.log('testScriptDetail',props.options)
|
||||||
|
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
|
||||||
|
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.data-check-content {
|
.data-check-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-tree {
|
.content-tree {
|
||||||
width: 300px;
|
width: 260px;
|
||||||
height: 470px;
|
height: calc(100vh - 315px);
|
||||||
border: 1px solid #dcdfe6;
|
border: 1px solid #dcdfe6;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
margin-right: 10px;
|
// margin-right: 10px;
|
||||||
overflow: auto; /* 同时启用垂直和水平滚动 */
|
overflow: auto; /* 同时启用垂直和水平滚动 */
|
||||||
overflow-x: auto; /* 确保水平滚动条生效 */
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
.scriptTree {
|
||||||
|
height: calc(100vh - 520px);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 确保 el-tree 内容可以超出容器宽度 */
|
/* 确保 el-tree 内容可以超出容器宽度 */
|
||||||
.el-tree {
|
.el-tree {
|
||||||
width: fit-content; /* 根据内容自适应宽度 */
|
width: fit-content; /* 根据内容自适应宽度 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-right-Tabs {
|
.content-right-Tabs {
|
||||||
flex: 1; /* 根据需要调整宽度比例 */
|
flex: 1; /* 根据需要调整宽度比例 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-footer{
|
.dialog-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider-container {
|
.divider-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider-container .el-divider {
|
.divider-container .el-divider {
|
||||||
margin-right: 30px; /* 根据需要调整间距 */
|
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: #003078;
|
||||||
|
color: #fff;
|
||||||
|
width: 20px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.actionButtons {
|
||||||
|
.el-button {
|
||||||
|
margin-left: 0px;
|
||||||
|
margin: 5px 6px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</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>
|
||||||
|
|||||||
@@ -1,41 +1,108 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="editor-container">
|
<div class="editor-container">
|
||||||
<div class="left-editor">
|
<div class="left-editor">
|
||||||
<!-- 左侧编辑区域内容 -->
|
<!-- 左侧编辑区域内容 -->
|
||||||
<canvas ref="canvas" width="600" height="165"></canvas>
|
|
||||||
</div>
|
<img src="@/assets/images/transient.png" />
|
||||||
<div class="right-editor">
|
<!-- <div class="inputTop">
|
||||||
<!-- 右侧编辑区域内容 -->
|
<el-input v-model="form[0].dipData.fValue" style="width: 150px; left: 4%" :disabled="!form[0].dipFlag">
|
||||||
<el-form-item label="设定幅度(%)">
|
<template #append>S</template>
|
||||||
<el-input v-model="input1" />
|
</el-input>
|
||||||
</el-form-item>
|
<el-input v-model="form[0].dipData.fValue" style="width: 150px; left: 22%" :disabled="!form[0].dipFlag">
|
||||||
<el-form-item label="持续时间(周波)">
|
<template #append>S</template>
|
||||||
<el-input v-model="input2" />
|
</el-input>
|
||||||
</el-form-item>
|
<el-input v-model="form[0].dipData.fValue" style="width: 150px; left: 40%" :disabled="!form[0].dipFlag">
|
||||||
</div>
|
<template #append>S</template>
|
||||||
</div>
|
</el-input>
|
||||||
|
</div>
|
||||||
|
<div class="inputBottom">
|
||||||
|
<el-input v-model="form[0].dipData.fValue" style="width: 150px; left: 21%" :disabled="!form[0].dipFlag">
|
||||||
|
<template #append>S</template>
|
||||||
|
</el-input>
|
||||||
|
<el-input v-model="form[0].dipData.fValue" style="width: 150px; left: 40%" :disabled="!form[0].dipFlag">
|
||||||
|
<template #append>S</template>
|
||||||
|
</el-input>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
<div class="right-editor">
|
||||||
|
<!-- 右侧编辑区域内容 -->
|
||||||
|
<el-form-item label-width="120px" label="设定幅度(%)">
|
||||||
|
<el-input
|
||||||
|
type="number"
|
||||||
|
@input="handleInput"
|
||||||
|
v-model="form[0].dipData.ftransValue"
|
||||||
|
style="width: 150px"
|
||||||
|
:disabled="!form[0].dipFlag"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label-width="120px" label="持续时间(s)">
|
||||||
|
<el-input
|
||||||
|
type="number"
|
||||||
|
v-model="form[0].dipData.retainTime"
|
||||||
|
style="width: 150px"
|
||||||
|
:disabled="!form[0].dipFlag"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref, watch } from 'vue'
|
||||||
|
const props = defineProps({
|
||||||
|
childForm: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const form: any = computed({
|
||||||
|
get() {
|
||||||
|
return props.childForm
|
||||||
|
},
|
||||||
|
set(value) {}
|
||||||
|
})
|
||||||
|
const handleInput = value => {
|
||||||
|
if (value < 0) {
|
||||||
|
props.childForm[0].dipData.ftransValue = 0
|
||||||
|
} else if (value > 200) {
|
||||||
|
props.childForm[0].dipData.ftransValue = 200
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
canvas {
|
canvas {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-container {
|
.editor-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.left-editor {
|
.left-editor {
|
||||||
flex: 3; /* 左侧区域占据 3/4 的宽度 */
|
flex: 1; /* 左侧区域占据 3/4 的宽度 */
|
||||||
margin-right: 10px; /* 可选:添加间距 */
|
position: relative;
|
||||||
|
img {
|
||||||
|
width: 90%;
|
||||||
|
height: 150px;
|
||||||
|
margin: 0 10px 20px;
|
||||||
|
}
|
||||||
|
.inputTop {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.inputBottom {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -5px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-editor {
|
.right-editor {
|
||||||
flex: 1; /* 右侧区域占据 1/4 的宽度 */
|
width: 400px;
|
||||||
|
/* margin-right: 250px; 向左侧移动一点 */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,75 +1,401 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tabs-container">
|
<div class="tabs-container">
|
||||||
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%;">
|
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%">
|
||||||
<el-tab-pane label="Modulation">
|
<el-tab-pane label="短闪">
|
||||||
<!-- 全局设置菜单内容 -->
|
<!-- 全局设置菜单内容 Modulation-->
|
||||||
<div>
|
|
||||||
<el-form-item label="电压变动幅度(%)" prop='name'>
|
<div style="display: flex">
|
||||||
<el-input style="width: 200px;" />
|
<el-form-item abel-width="180px">
|
||||||
</el-form-item>
|
<template #label>
|
||||||
</div>
|
<el-select
|
||||||
<div class="form-container">
|
v-model="form[0].flickerData.waveType"
|
||||||
<el-form-item label="波动频度(/min/Hz)" prop='name'>
|
@change="changeLable"
|
||||||
<el-input />
|
style="width: 170px"
|
||||||
</el-form-item>
|
>
|
||||||
<el-form-item label="波动类型" prop='name'>
|
<el-option
|
||||||
<el-input />
|
v-for="item in waveList"
|
||||||
</el-form-item>
|
:key="item.value"
|
||||||
</div>
|
:label="item.label"
|
||||||
</el-tab-pane>
|
:value="item.value"
|
||||||
</el-tabs>
|
/>
|
||||||
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%;">
|
</el-select>
|
||||||
<el-tab-pane label="WaveForm">
|
</template>
|
||||||
<!-- 全局设置菜单内容 -->
|
|
||||||
<div >
|
<el-select
|
||||||
<el-form-item label="波类型" prop='name'>
|
placeholder="请选择波动类型"
|
||||||
<el-input />
|
style="width: 180px"
|
||||||
</el-form-item>
|
filterable
|
||||||
</div>
|
v-model="form[0].flickerData.fchagFre"
|
||||||
<div >
|
@change="changeWaveType"
|
||||||
<el-form-item label="占空比(%)" prop='name'>
|
>
|
||||||
<el-input />
|
<el-option
|
||||||
</el-form-item>
|
v-for="(item, i) in waveChildrenList"
|
||||||
</div>
|
:key="item.fchagFre"
|
||||||
</el-tab-pane>
|
:value="item.fchagFre"
|
||||||
</el-tabs>
|
:label="item.fchagFre"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: end">
|
||||||
|
<el-form-item label="变动量(%)" label-width="180px">
|
||||||
|
<el-input
|
||||||
|
placeholder="请输入变动量"
|
||||||
|
style="width: 180px"
|
||||||
|
v-model="form[0].flickerData.fchagValue"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%">
|
||||||
|
<el-tab-pane label="波形">
|
||||||
|
<!-- 全局设置菜单内容 WaveForm -->
|
||||||
|
<div>
|
||||||
|
<el-form-item label="波类型" label-width="100px">
|
||||||
|
<el-select
|
||||||
|
placeholder="请选择波类型"
|
||||||
|
style="width: 150px"
|
||||||
|
v-model="form[0].flickerData.waveFluType"
|
||||||
|
:disabled="!form[0].flickerFlag"
|
||||||
|
>
|
||||||
|
<el-option label="RECT" value="RECT"></el-option>
|
||||||
|
<el-option label="SIN" value="SIN"></el-option>
|
||||||
|
<el-option label="SQU" value="SQU"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-form-item label="占空比(%)" label-width="100px">
|
||||||
|
<el-input
|
||||||
|
style="width: 150px"
|
||||||
|
v-model="form[0].flickerData.fdutyCycle"
|
||||||
|
:disabled="!form[0].flickerFlag"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref, computed } from 'vue'
|
||||||
|
const props = defineProps({
|
||||||
|
childForm: {
|
||||||
|
type: [Array, Object] as any,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const waveList = [
|
||||||
|
{
|
||||||
|
label: '变动频度(次/min)',
|
||||||
|
value: 'CPM',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
fchagFre: '0.1',
|
||||||
|
fchagValue: '7.4'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.2',
|
||||||
|
fchagValue: '4.58'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.4',
|
||||||
|
fchagValue: '3.54'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.6',
|
||||||
|
fchagValue: '3.2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1',
|
||||||
|
fchagValue: '2.724'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '2',
|
||||||
|
fchagValue: '2.211'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '3',
|
||||||
|
fchagValue: '1.95'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '5',
|
||||||
|
fchagValue: '1.64'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '7',
|
||||||
|
fchagValue: '1.459'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '10',
|
||||||
|
fchagValue: '1.29'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '22',
|
||||||
|
fchagValue: '1.02'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '39',
|
||||||
|
fchagValue: '0.906'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '48',
|
||||||
|
fchagValue: '0.87'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '68',
|
||||||
|
fchagValue: '0.81'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '110',
|
||||||
|
fchagValue: '0.725'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '176',
|
||||||
|
fchagValue: '0.64'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '273',
|
||||||
|
fchagValue: '0.56'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '375',
|
||||||
|
fchagValue: '0.5'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '480',
|
||||||
|
fchagValue: '0.48'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '585',
|
||||||
|
fchagValue: '0.42'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '682',
|
||||||
|
fchagValue: '0.37'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '796',
|
||||||
|
fchagValue: '0.32'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1020',
|
||||||
|
fchagValue: '0.28'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1055',
|
||||||
|
fchagValue: '0.28'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1200',
|
||||||
|
fchagValue: '0.29'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1390',
|
||||||
|
fchagValue: '0.34'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1620',
|
||||||
|
fchagValue: '0.402'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '2400',
|
||||||
|
fchagValue: '0.77'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '变动频率(HZ)',
|
||||||
|
value: 'HZ',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
fchagFre: '0.000833',
|
||||||
|
fchagValue: '7.4'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.001667',
|
||||||
|
fchagValue: '4.58'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.003333',
|
||||||
|
fchagValue: '3.54'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.005000',
|
||||||
|
fchagValue: '3.2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.008333',
|
||||||
|
fchagValue: '2.724'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.016667',
|
||||||
|
fchagValue: '2.211'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.025000',
|
||||||
|
fchagValue: '1.95'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.041667',
|
||||||
|
fchagValue: '1.64'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.058333',
|
||||||
|
fchagValue: '1.459'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.083333',
|
||||||
|
fchagValue: '1.29'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.183333',
|
||||||
|
fchagValue: '1.02'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.325000',
|
||||||
|
fchagValue: '0.906'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.400000',
|
||||||
|
fchagValue: '0.87'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.566667',
|
||||||
|
fchagValue: '0.81'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.916667',
|
||||||
|
fchagValue: '0.725'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1.466667',
|
||||||
|
fchagValue: '0.64'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '2.275000',
|
||||||
|
fchagValue: '0.56'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '3.125000',
|
||||||
|
fchagValue: '0.5'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '4.000000',
|
||||||
|
fchagValue: '0.48'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '4.875000',
|
||||||
|
fchagValue: '0.42'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '5.683333',
|
||||||
|
fchagValue: '0.37'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '6.633333',
|
||||||
|
fchagValue: '0.32'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '8.500000',
|
||||||
|
fchagValue: '0.28'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '8.791667',
|
||||||
|
fchagValue: '0.28'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '10.000000',
|
||||||
|
fchagValue: '0.29'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '11.583333',
|
||||||
|
fchagValue: '0.34'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '13.500000',
|
||||||
|
fchagValue: '0.402'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '20.000000',
|
||||||
|
fchagValue: '0.77'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const waveChildrenList = computed(() => {
|
||||||
|
return waveList.filter((item: any) => item.value === form.value[0].flickerData.waveType)[0].children
|
||||||
|
})
|
||||||
|
const changeLable = e => {
|
||||||
|
setTimeout(() => {
|
||||||
|
let data = {
|
||||||
|
fchagFre: '',
|
||||||
|
fchagValue: ''
|
||||||
|
}
|
||||||
|
waveList.forEach((item: any, i: number) => {
|
||||||
|
item.children.forEach((item1: any, j: number) => {
|
||||||
|
if (item1.fchagFre == props.childForm[0].flickerData.fchagFre) {
|
||||||
|
data = waveList[i == 0 ? 1 : 0].children[j]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
props.childForm[0].flickerData.fchagFre = data.fchagFre
|
||||||
|
props.childForm[0].flickerData.fchagValue = data.fchagValue
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
// [频率变化]
|
||||||
|
const changeWaveType = e => {
|
||||||
|
props.childForm[0].flickerData.fchagValue = waveChildrenList.value.filter(
|
||||||
|
(item: any) => item.fchagFre == e
|
||||||
|
)[0].fchagValue
|
||||||
|
}
|
||||||
|
const form: any = computed({
|
||||||
|
get() {
|
||||||
|
if (props.childForm[0].flickerData.flickerValue == null) {
|
||||||
|
props.childForm[0].flickerData.fchagValue = ''
|
||||||
|
props.childForm[0].flickerData.fchagFre = ''
|
||||||
|
}
|
||||||
|
return props.childForm
|
||||||
|
},
|
||||||
|
set(value) {}
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.form-container {
|
.form-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between; /* 使两个 el-form-item 之间有间距 */
|
justify-content: space-between; /* 使两个 el-form-item 之间有间距 */
|
||||||
align-items: center; /* 使两个 el-form-item 垂直居中对齐 */
|
align-items: center; /* 使两个 el-form-item 垂直居中对齐 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs-container {
|
.tabs-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center; /* 使两个 el-tabs 居中对齐 */
|
justify-content: center; /* 使两个 el-tabs 居中对齐 */
|
||||||
align-items: stretch; /* 使两个 el-tabs 高度拉伸 */
|
align-items: stretch; /* 使两个 el-tabs 高度拉伸 */
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 0 20px; /* 可选:添加左右间距 */
|
padding: 0 20px; /* 可选:添加左右间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-width-tabs {
|
.fixed-width-tabs {
|
||||||
|
margin-right: 100px; /* 可选:添加右侧间距 */
|
||||||
margin-right: 100px; /* 可选:添加右侧间距 */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-width-tabs:last-child {
|
.fixed-width-tabs:last-child {
|
||||||
margin-right: 0; /* 最后一个 el-tabs 不需要右侧间距 */
|
margin-right: 0; /* 最后一个 el-tabs 不需要右侧间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-tab-pane {
|
.el-tab-pane {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column; /* 确保内容上下排列 */
|
flex-direction: column; /* 确保内容上下排列 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-form-item {
|
.el-form-item {
|
||||||
margin-bottom: 20px; /* 可选:添加表单项之间的间距 */
|
margin-bottom: 20px; /* 可选:添加表单项之间的间距 */
|
||||||
}
|
}
|
||||||
</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