Compare commits
208 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1a740f8bf | ||
|
|
56d035253b | ||
|
|
e7348107d0 | ||
|
|
ea38b4eb21 | ||
| 67ef976739 | |||
| 60145ec4f7 | |||
|
|
81600ddc69 | ||
|
|
e0941d628b | ||
|
|
760dcbf723 | ||
|
|
b75ecb8c66 | ||
|
|
39f4cfa670 | ||
|
|
862251b83c | ||
|
|
312490ce59 | ||
|
|
d7df999cf2 | ||
|
|
e0b1b5907b | ||
|
|
f06ca03881 | ||
|
|
a9b80ed33c | ||
|
|
834230b26a | ||
|
|
403ddbfb6e | ||
|
|
ffb44ea909 | ||
|
|
b729e4efa1 | ||
|
|
962c286fd5 | ||
|
|
c215f51554 | ||
| 859c85b427 | |||
|
|
5fe637e84f | ||
|
|
5f68071c77 | ||
|
|
1675a5af31 | ||
|
|
ec1d09dbd0 | ||
|
|
eda7b516f6 | ||
|
|
630eb48d28 | ||
|
|
0d2f8a7788 | ||
| 230c68f454 | |||
| 68934060e6 | |||
| 846e7514b7 | |||
| 410cfb0f7a | |||
|
|
c892410b07 | ||
|
|
7caa4a5303 | ||
|
|
c17efbf9f6 | ||
| c46abeecf5 | |||
|
|
0947097932 | ||
|
|
50fc02d4eb | ||
|
|
a122e9e1b3 | ||
|
|
d7cfcc7855 | ||
|
|
05948aebf5 | ||
|
|
cca214aaf7 | ||
|
|
0111954c5e | ||
|
|
ce31499964 | ||
|
|
059864d193 | ||
|
|
6d2fb4dde8 | ||
|
|
49059d9c59 | ||
|
|
d2f7041988 | ||
|
|
f94372d20b | ||
|
|
9af98b034f | ||
|
|
341b8df5a9 | ||
|
|
7470f697bd | ||
|
|
c058b99a0d | ||
|
|
d5eed13f38 | ||
|
|
c27ee88182 | ||
|
|
e2559ffa65 | ||
|
|
a0bd32453c | ||
|
|
54e7a91841 | ||
|
|
042f6eef51 | ||
| c9857326c6 | |||
| 9c4e0094f9 | |||
| 781b27af51 | |||
|
|
37e257afc8 | ||
| 4d4fdd6190 | |||
|
|
0fd2d8252d | ||
|
|
3cf5019880 | ||
|
|
258d3d692f | ||
|
|
667ed3bcc0 | ||
|
|
a882189022 | ||
|
|
686e009243 | ||
|
|
30d5f3390c | ||
|
|
3398b414ca | ||
|
|
b6a2c42feb | ||
|
|
cb5a9050f2 | ||
|
|
661b27abd0 | ||
|
|
59a24c9ea2 | ||
|
|
6cf5da5d48 | ||
|
|
537f5e2f4c | ||
|
|
70531a0729 | ||
|
|
ded15e5c8b | ||
|
|
3021f7e4d3 | ||
|
|
876d9cfa00 | ||
|
|
8f28825162 | ||
|
|
0e6612f6bd | ||
|
|
39183fde5d | ||
|
|
b967419cb1 | ||
|
|
0712698638 | ||
|
|
d3a74e830f | ||
|
|
f68da773ab | ||
|
|
8db814dba4 | ||
|
|
7dcff99de5 | ||
|
|
97100dfa63 | ||
|
|
d41707fcf9 | ||
|
|
2377916f29 | ||
|
|
be2f40715a | ||
|
|
489c0882ac | ||
|
|
492db88b45 | ||
|
|
3b198eb4ed | ||
|
|
5efc27d4b6 | ||
|
|
ec9f270d04 | ||
|
|
afd2d467f3 | ||
|
|
ff0798450d | ||
|
|
fbefc70368 | ||
|
|
faa0bc54a6 | ||
|
|
bf5f4eab77 | ||
| 188456c970 | |||
|
|
c06334e96f | ||
| 82e8bf2e0b | |||
| 30382fb34d | |||
| c7e5ee0862 | |||
|
|
d6ac63586b | ||
|
|
e0fd42199f | ||
|
|
d9e3168484 | ||
|
|
dc7e91ca66 | ||
|
|
692358d278 | ||
| 3750031d6b | |||
| 0bae200241 | |||
|
|
61bd1a0d6a | ||
|
|
37cf3dfdd7 | ||
|
|
8be96ca64e | ||
|
|
d225391248 | ||
|
|
f2fd0b078e | ||
|
|
f71963ea3b | ||
|
|
6a635246bb | ||
|
|
d338ca6b25 | ||
|
|
193c3b963c | ||
|
|
cad4965b1b | ||
|
|
79306d846f | ||
|
|
f4ea510c5d | ||
|
|
07cc26fa8d | ||
|
|
f87e268242 | ||
|
|
1aeceffe0b | ||
|
|
fc97087767 | ||
|
|
61be97b04b | ||
|
|
934162875c | ||
|
|
4b3991099a | ||
|
|
b14a961c1a | ||
|
|
cbe41d80ce | ||
|
|
28203f2621 | ||
|
|
b8492dfbe6 | ||
|
|
15faac8079 | ||
|
|
ad850ca4ee | ||
|
|
6c05c6e06e | ||
|
|
8b2cda80b1 | ||
|
|
3f7756b417 | ||
|
|
5004e319b6 | ||
|
|
19035f2dc9 | ||
|
|
9d8a5c76b2 | ||
|
|
6300eb2f43 | ||
|
|
da58ffb621 | ||
|
|
1500fafb92 | ||
|
|
df53eea432 | ||
|
|
cc1771c208 | ||
|
|
5e881c0804 | ||
|
|
5666e01ae0 | ||
|
|
4acec8a2d6 | ||
|
|
426a511099 | ||
|
|
89303b44ae | ||
|
|
ffb82066bb | ||
|
|
f46b8c0a56 | ||
|
|
280289af37 | ||
| a0c7f79302 | |||
| bd1eecc106 | |||
|
|
1a23bcb510 | ||
|
|
942c28d3bd | ||
| 034b31ba47 | |||
|
|
7a76c2da8a | ||
|
|
1a9d8e8606 | ||
| 14583d919d | |||
|
|
629fd174e4 | ||
|
|
9080fe06a4 | ||
|
|
0e183bb5c1 | ||
| 8caf856d2d | |||
|
|
d28669e6b0 | ||
| 700884d01a | |||
| c06bd9fa24 | |||
| ce92a1d645 | |||
|
|
4f622da52c | ||
| 7d3e86a5fc | |||
|
|
c66d181b98 | ||
| f860630bfb | |||
|
|
6db4d79839 | ||
| e2924d5e57 | |||
| 92b9a82f21 | |||
|
|
c3f89ca1f8 | ||
|
|
8c435c91dd | ||
|
|
6e6cfa5be0 | ||
|
|
ea203d0ccc | ||
|
|
370cd52774 | ||
|
|
942bae3045 | ||
|
|
356548c8fb | ||
| 5c012c2bc9 | |||
| 9c9b8015a0 | |||
| bba0ced7f9 | |||
|
|
e8de7b56d9 | ||
|
|
95022f62a8 | ||
|
|
1d918f3335 | ||
|
|
f992637ad2 | ||
|
|
40f18bbdf8 | ||
|
|
3bb9cec08a | ||
|
|
6842260f59 | ||
|
|
305c30d725 | ||
|
|
e799dd2f08 | ||
| 1e83172e9a | |||
|
|
475d236b7e |
@@ -1,112 +0,0 @@
|
||||
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from "axios";
|
||||
import { showFullScreenLoading, tryHideFullScreenLoading } from "@/components/Loading/fullScreen";
|
||||
import { LOGIN_URL } from "@/config";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { ResultData } from "@/api/interface";
|
||||
import { ResultEnum } from "@/enums/httpEnum";
|
||||
import { checkStatus } from "./helper/checkStatus";
|
||||
import { useUserStore } from "@/stores/modules/user";
|
||||
import router from "@/routers";
|
||||
|
||||
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
|
||||
loading?: boolean;
|
||||
}
|
||||
|
||||
const config = {
|
||||
// 默认地址请求地址,可在 .env.** 文件中修改
|
||||
baseURL: import.meta.env.VITE_API_URL as string,
|
||||
// 设置超时时间
|
||||
timeout: ResultEnum.TIMEOUT as number,
|
||||
// 跨域时候允许携带凭证
|
||||
withCredentials: true,
|
||||
// post请求指定数据类型以及编码
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' }
|
||||
};
|
||||
|
||||
class RequestHttp {
|
||||
service: AxiosInstance;
|
||||
public constructor(config: AxiosRequestConfig) {
|
||||
// 创建实例
|
||||
this.service = axios.create(config);
|
||||
|
||||
/**
|
||||
* @description 请求拦截器
|
||||
* 客户端发送请求 -> [请求拦截器] -> 服务器
|
||||
* token校验(JWT) : 接受服务器返回的 token,存储到 vuex/pinia/本地储存当中
|
||||
*/
|
||||
this.service.interceptors.request.use(
|
||||
(config: CustomAxiosRequestConfig) => {
|
||||
const userStore = useUserStore();
|
||||
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制
|
||||
config.loading ?? (config.loading = true);
|
||||
config.loading && showFullScreenLoading();
|
||||
if (config.headers && typeof config.headers.set === "function") {
|
||||
config.headers.set("x-access-token", userStore.token);
|
||||
}
|
||||
return config;
|
||||
},
|
||||
(error: AxiosError) => {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* @description 响应拦截器
|
||||
* 服务器换返回信息 -> [拦截统一处理] -> 客户端JS获取到信息
|
||||
*/
|
||||
this.service.interceptors.response.use(
|
||||
(response: AxiosResponse) => {
|
||||
const { data } = response;
|
||||
const userStore = useUserStore();
|
||||
tryHideFullScreenLoading();
|
||||
// 登陆失效
|
||||
if (data.code == ResultEnum.OVERDUE) {
|
||||
userStore.setToken("");
|
||||
router.replace(LOGIN_URL);
|
||||
ElMessage.error(data.message);
|
||||
return Promise.reject(data);
|
||||
}
|
||||
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
||||
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
||||
ElMessage.error(data.message);
|
||||
return Promise.reject(data);
|
||||
}
|
||||
// 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑)
|
||||
return data;
|
||||
},
|
||||
async (error: AxiosError) => {
|
||||
const { response } = error;
|
||||
tryHideFullScreenLoading();
|
||||
// 请求超时 && 网络错误单独判断,没有 response
|
||||
if (error.message.indexOf("timeout") !== -1) ElMessage.error("请求超时!请您稍后重试");
|
||||
if (error.message.indexOf("Network Error") !== -1) ElMessage.error("网络错误!请您稍后重试");
|
||||
// 根据服务器响应的错误状态码,做不同的处理
|
||||
if (response) checkStatus(response.status);
|
||||
// 服务器结果都没有返回(可能服务器错误可能客户端断网),断网处理:可以跳转到断网页面
|
||||
if (!window.navigator.onLine) router.replace("/500");
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 常用请求方法封装
|
||||
*/
|
||||
get<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
||||
return this.service.get(url, { params, ..._object });
|
||||
}
|
||||
post<T>(url: string, params?: object | string, _object = {}): Promise<ResultData<T>> {
|
||||
return this.service.post(url, params, _object);
|
||||
}
|
||||
put<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
||||
return this.service.put(url, params, _object);
|
||||
}
|
||||
delete<T>(url: string, params?: any, _object = {}): Promise<ResultData<T>> {
|
||||
return this.service.delete(url, { params, ..._object });
|
||||
}
|
||||
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||
return this.service.post(url, params, { ..._object, responseType: "blob" });
|
||||
}
|
||||
}
|
||||
|
||||
export default new RequestHttp(config);
|
||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"Analyse",
|
||||
"CHNFACTOR",
|
||||
"CHNPACTOR",
|
||||
"Chns",
|
||||
|
||||
@@ -19,6 +19,7 @@ VITE_API_URL=/api
|
||||
|
||||
# 开发环境跨域代理,支持配置多个
|
||||
|
||||
#VITE_PROXY=[["/api","http://127.0.0.1:18092/"]]
|
||||
VITE_PROXY=[["/api","http://192.168.1.124:18092/"]]
|
||||
#VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
||||
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文
|
||||
|
||||
@@ -22,4 +22,5 @@ VITE_DROP_CONSOLE=true
|
||||
VITE_PWA=true
|
||||
|
||||
# 线上环境接口地址
|
||||
#VITE_API_URL="/api" # 打包时用
|
||||
VITE_API_URL="http://192.168.1.125:18092/"
|
||||
|
||||
11
frontend/.prettierrc
Normal file
11
frontend/.prettierrc
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"tabWidth": 4,
|
||||
"printWidth": 120,
|
||||
"useTabs": false,
|
||||
"semi": false,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf",
|
||||
"htmlWhitespaceSensitivity": "ignore"
|
||||
}
|
||||
@@ -22,9 +22,11 @@
|
||||
"echarts": "^5.4.3",
|
||||
"echarts-liquidfill": "^3.1.0",
|
||||
"element-plus": "^2.7.8",
|
||||
"html2canvas": "^1.4.1",
|
||||
"md5": "^2.3.0",
|
||||
"mitt": "^3.0.1",
|
||||
"mkdirp": "^3.0.1",
|
||||
"node-forge": "^1.3.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^2.2.1",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
@@ -41,11 +43,14 @@
|
||||
"devDependencies": {
|
||||
"@rushstack/eslint-patch": "^1.8.0",
|
||||
"@tsconfig/node20": "^20.1.4",
|
||||
"@types/html2canvas": "^1.0.0",
|
||||
"@types/md5": "^2.3.2",
|
||||
"@types/node": "^20.14.14",
|
||||
"@types/node-forge": "^1.3.11",
|
||||
"@types/nprogress": "^0.2.0",
|
||||
"@types/qs": "^6.9.8",
|
||||
"@types/sortablejs": "^1.15.2",
|
||||
"@types/xlsx": "^0.0.36",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
||||
"@typescript-eslint/parser": "^6.7.0",
|
||||
"@vitejs/plugin-vue": "^5.0.5",
|
||||
@@ -71,7 +76,7 @@
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-eslint": "^1.8.1",
|
||||
"vite-plugin-html": "^3.2.0",
|
||||
"vite-plugin-node-polyfills": "^0.22.0",
|
||||
"vite-plugin-node-polyfills": "^0.23.0",
|
||||
"vite-plugin-pwa": "^0.16.5",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vue-tsc": "^2.0.21"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export namespace CheckData {
|
||||
export interface DataCheck {
|
||||
scriptName: string,
|
||||
errorSysName: string,
|
||||
errorSysId: string,
|
||||
dataRule: string,
|
||||
deviceName: string,
|
||||
chnNum: string,
|
||||
@@ -13,13 +13,15 @@ export namespace CheckData {
|
||||
// 装置原始数据-被检值
|
||||
data: number,
|
||||
|
||||
|
||||
// 误差值
|
||||
errorData: number,
|
||||
// 第几次谐波
|
||||
num?: number,
|
||||
//符合、不符合
|
||||
isData?: number,
|
||||
//最大误差值
|
||||
radius?: string,
|
||||
unit?: string,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,21 +52,25 @@ export namespace CheckData {
|
||||
errorA?: string,
|
||||
maxErrorA?: string,
|
||||
isDataA?: number,
|
||||
unitA?: string,
|
||||
stdB?: string,
|
||||
dataB?: string,
|
||||
errorB?: string,
|
||||
maxErrorB?: string,
|
||||
isDataB?: number,
|
||||
unitB?: string,
|
||||
stdC?: string,
|
||||
dataC?: string,
|
||||
errorC?: string,
|
||||
maxErrorC?: string,
|
||||
isDataC?: number,
|
||||
unitC?: string,
|
||||
stdT?: string,
|
||||
dataT?: string,
|
||||
errorT?: string,
|
||||
maxErrorT?: string,
|
||||
isDataT?: number,
|
||||
unitT?: string,
|
||||
|
||||
//最大误差值
|
||||
maxError?: string,
|
||||
@@ -90,6 +96,12 @@ export namespace CheckData {
|
||||
deviceId: string; //装置序号Id
|
||||
deviceName: string; //设备名称
|
||||
chnNum: number; //设备通道数
|
||||
|
||||
planId: string; //计划Id
|
||||
devType: string; //设备类型
|
||||
devVolt: number; //设备电压
|
||||
devCurr: number; //设备电流
|
||||
factorFlag: number; //是否支持系数校准
|
||||
}
|
||||
|
||||
// 用来描述检测脚本类型
|
||||
@@ -101,6 +113,7 @@ export namespace CheckData {
|
||||
|
||||
// 用来描述 检测数据-左侧树结构
|
||||
export interface TreeItem {
|
||||
id: string | null,
|
||||
scriptTypeName: string | null,
|
||||
sourceDesc: string | null,
|
||||
harmNum: number | null,
|
||||
@@ -116,7 +129,8 @@ export namespace CheckData {
|
||||
SUCCESS = 1,
|
||||
FAIL = 2,
|
||||
TIMEOUT = 3,
|
||||
ERRORDATA = 4
|
||||
ERRORDATA = 4,
|
||||
NOT_PART_IN_ERROR = 5
|
||||
}
|
||||
|
||||
export interface DeviceCheckResult {
|
||||
@@ -136,8 +150,8 @@ export namespace CheckData {
|
||||
|
||||
export enum ButtonColorEnum {
|
||||
INFO = '#909399',
|
||||
LOADING = '#003078',
|
||||
SUCCESS = '#67c23a',
|
||||
LOADING = 'var(--el-color-primary)',
|
||||
SUCCESS = '#91cc75',
|
||||
WARNING = '#e6a23c',
|
||||
DANGER = '#f56c6c',
|
||||
}
|
||||
@@ -147,7 +161,7 @@ export namespace CheckData {
|
||||
*/
|
||||
export interface ButtonResult {
|
||||
color: ButtonColorEnum
|
||||
icon: 'Minus' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled'
|
||||
icon: 'More' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled' | 'Minus'
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,6 +187,16 @@ export namespace CheckData {
|
||||
type: 'info' | 'warning' | 'error'
|
||||
log: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义手动检测时,勾选的测试项
|
||||
*/
|
||||
export interface SelectTestItem {
|
||||
preTest: boolean,
|
||||
timeTest: boolean,
|
||||
channelsTest: boolean,
|
||||
test: boolean
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import http from "@/api";
|
||||
import {CheckData} from "@/api/check/interface";
|
||||
|
||||
export const getBigTestItem = (planId: string) => {
|
||||
return http.get(`/adPlan/getBigTestItem?planId=${planId}`, {loading: false});
|
||||
export const getBigTestItem = (params: {
|
||||
reCheckType: number,
|
||||
planId: string,
|
||||
devId: string,
|
||||
}) => {
|
||||
return http.post(`/adPlan/getBigTestItem`, params, {loading: false});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,13 +27,13 @@ export const getFormData = (params: {
|
||||
* @param params
|
||||
*/
|
||||
export const getTreeData = (params: {
|
||||
scriptId: string,
|
||||
devId: string,
|
||||
devNum: string,
|
||||
scriptType: string | null,
|
||||
code: number,
|
||||
scriptId?: string,
|
||||
devId?: string,
|
||||
devNum?: string,
|
||||
scriptType?: string | null,
|
||||
code?: string,
|
||||
}) => {
|
||||
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true});
|
||||
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: false});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +45,7 @@ export const getTableData = (params: {
|
||||
scriptId: string,
|
||||
devId: string,
|
||||
devNum: string,
|
||||
code: number,
|
||||
code: string,
|
||||
index: number,
|
||||
}) => {
|
||||
return http.post("/result/resultData/", params, {loading: false});
|
||||
@@ -52,8 +56,44 @@ export const exportRawData = (params: {
|
||||
scriptId: string,
|
||||
devId: string,
|
||||
devNum: string,
|
||||
code: number,
|
||||
code: string,
|
||||
index: number,
|
||||
}) => {
|
||||
return http.download("/result/exportRawData", params, {loading: false});
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新计算
|
||||
* @param params
|
||||
*/
|
||||
export const reCalculate = (params: {
|
||||
planId: string,
|
||||
scriptId: string,
|
||||
errorSysId: string,
|
||||
deviceId: string,
|
||||
code: string
|
||||
}) => {
|
||||
return http.post("/result/reCalculate", params, {loading: true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更换误差体系
|
||||
* @param params
|
||||
*/
|
||||
export const changeErrorSystem = (params: {
|
||||
planId: string,
|
||||
scriptId: string,
|
||||
errorSysId: string,
|
||||
deviceId: string,
|
||||
code: string
|
||||
}) => {
|
||||
return http.post("/result/changeErrorSystem", params, {loading: true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除(误差体系切换时产生的)临时表
|
||||
* @param code
|
||||
*/
|
||||
export const deleteTempTable = (code: string) => {
|
||||
return http.get(`/result/deleteTempTable?code=${code}`, null, {loading: false})
|
||||
}
|
||||
24
frontend/src/api/device/controlSource/index.ts
Normal file
24
frontend/src/api/device/controlSource/index.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
import type { controlSource } from '@/api/device/interface/controlSource'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
* @name 程控源管理模块
|
||||
*/
|
||||
|
||||
//通讯校验
|
||||
export const checkSimulate = (params: controlSource.ResControl) => {
|
||||
return http.post(`/prepare/ytxCheckSimulate`,params)
|
||||
}
|
||||
|
||||
//启动
|
||||
export const startSimulateTest = (params: controlSource.ResControl) => {
|
||||
return http.post(`prepare/startSimulateTest`,params,{loading:false})
|
||||
}
|
||||
|
||||
//停止
|
||||
export const closeSimulateTest = (params: controlSource.ResControl) => {
|
||||
return http.post(`/prepare/closeSimulateTest`,params,{loading:false})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Device } from '@/api/device/interface/device'
|
||||
import type {Device} from '@/api/device/interface/device'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
@@ -25,33 +25,41 @@ export const deletePqDev = (params: string[]) => {
|
||||
return http.post(`/pqDev/delete`, params)
|
||||
}
|
||||
|
||||
// export const downloadTemplate = () => {
|
||||
// return http.download(`/pqDev/downloadTemplate`)
|
||||
// }
|
||||
|
||||
// //导入被检设备(比对)
|
||||
// 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 exportPqDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.download(`/pqDev/export`, params)
|
||||
}
|
||||
// 下载导入文件模板
|
||||
export const downloadTemplate = () => {
|
||||
return http.download(`/pqDev/downloadTemplate`)
|
||||
}
|
||||
|
||||
// 下载灿能二楼设备导入文件模板
|
||||
export const downloadCNDevTemplate = () => {
|
||||
return http.download(`/pqDev/downloadCNDevTemplate`)
|
||||
//导入被检设备
|
||||
export const importPqDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.uploadExcel(`/pqDev/import`, params)
|
||||
}
|
||||
|
||||
//导入灿能二楼设备
|
||||
export const importCNDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.uploadExcel(`/pqDev/importCNDev`, 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`)
|
||||
|
||||
@@ -30,5 +30,7 @@ export const deletePqErrSys = (params: string[]) => {
|
||||
return http.post(`/pqErrSys/delete`, params)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//复制误差体系
|
||||
export const copyPqErrSys = (params: ErrorSystem.ErrorSystemList) => {
|
||||
return http.get(`/pqErrSys/copy?id=${params.id}`)
|
||||
}
|
||||
15
frontend/src/api/device/interface/controlSource.ts
Normal file
15
frontend/src/api/device/interface/controlSource.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { ReqPage,ResPage } from '@/api/interface'
|
||||
|
||||
// 被检设备模块
|
||||
export namespace controlSource {
|
||||
|
||||
/**
|
||||
* 被检设备新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResControl {
|
||||
userPageId: string;
|
||||
scriptId: string;
|
||||
scriptIndex: number;
|
||||
sourceId: string;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ReqPage,ResPage } from '@/api/interface'
|
||||
import type {ReqPage, ResPage} from '@/api/interface'
|
||||
|
||||
// 被检设备模块
|
||||
export namespace Device {
|
||||
@@ -6,20 +6,22 @@ export namespace Device {
|
||||
/**
|
||||
* 被检设备表格分页查询参数
|
||||
*/
|
||||
export interface ReqPqDevParams extends ReqPage{
|
||||
export interface ReqPqDevParams extends ReqPage {
|
||||
id: string; // 装置序号id 必填
|
||||
name: string; //设备名称
|
||||
devType?: string; // 设备名称
|
||||
createTime?:string; //创建时间
|
||||
pattern:string;
|
||||
createTime?: string; //创建时间
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备表格分页查询参数
|
||||
*/
|
||||
export interface ReqDevReportParams extends ReqPage{
|
||||
planId?:string; // 计划id
|
||||
devId?:string; // 装置id
|
||||
export interface ReqDevReportParams extends ReqPage {
|
||||
planId?: string; // 计划id
|
||||
devId?: string; // 装置id
|
||||
scriptId?: string; // 脚本id
|
||||
planCode?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,54 +40,53 @@ export namespace Device {
|
||||
createId: string; //出厂编号
|
||||
hardwareVersion: string; //固件版本
|
||||
softwareVersion: string; //软件版本
|
||||
protocol:string; //通讯协议
|
||||
protocol: string; //通讯协议
|
||||
ip: string; //IP地址
|
||||
port: number; //端口号
|
||||
encryptionFlag: number; //装置是否为加密版本
|
||||
series?: string| null; //装置识别码(3ds加密)
|
||||
devKey?: string| null; //装置秘钥(3ds加密)
|
||||
sampleID?: string| null; //样品编号
|
||||
series?: string | null; //装置识别码(3ds加密)
|
||||
devKey?: string | null; //装置秘钥(3ds加密)
|
||||
sampleId?: string | null; //样品编号
|
||||
arrivedDate?: string; //送样日期
|
||||
cityName?: string| null; //所属地市名称
|
||||
gDName?: string| null; //所属供电公司名称
|
||||
subName?: string| null; //所属电站名称
|
||||
checkState?: number| null; //检测状态
|
||||
checkResult?: number| null; //检测结果
|
||||
reportState?: number| null; //报告状态
|
||||
reportPath?: string| null; //报告路径
|
||||
qRCode?: string| null; //设备关键信息二维码
|
||||
cityName?: string | null; //所属地市名称
|
||||
gDName?: string | null; //所属供电公司名称
|
||||
subName?: string | null; //所属电站名称
|
||||
checkState?: number | null; //检测状态
|
||||
checkResult?: number | null; //检测结果
|
||||
reportState?: number | null; //报告状态
|
||||
reportPath?: string | null; //报告路径
|
||||
qRCode?: string | null; //设备关键信息二维码
|
||||
reCheckNum: number; //复检次数
|
||||
planId?:string;//检测计划Id
|
||||
timeCheckResult?:number;//守时检测结果(0:不符合1:符合)
|
||||
factorFlag?:number;//是否支持系数校准(0:不支持,1:支持)
|
||||
planId?: string;//检测计划Id
|
||||
timeCheckResult?: number;//守时检测结果(0:不符合1:符合)
|
||||
factorFlag?: number;//是否支持系数校准(0:不支持,1:支持)
|
||||
factorCheckResult?: number;//系数校准结果(0:不合格,1:合格,2:/表示没有做系数校准)
|
||||
state: number; //状态
|
||||
createBy?: string| null; //创建用户
|
||||
createTime?: string| null; //创建时间
|
||||
updateBy?: string| null; //更新用户
|
||||
updateTime?: string| null; //更新时间
|
||||
icdId: string| null;
|
||||
power: string| null;//工作电源
|
||||
preinvestmentPlan: string| null;
|
||||
createBy?: string | null; //创建用户
|
||||
createTime?: string | null; //创建时间
|
||||
updateBy?: string | null; //更新用户
|
||||
updateTime?: string | null; //更新时间
|
||||
icdId: string | null;
|
||||
power: string | null;//工作电源
|
||||
preinvestmentPlan: string | null;
|
||||
}
|
||||
|
||||
|
||||
export interface ResDev{
|
||||
export interface ResDev {
|
||||
id: string;
|
||||
name: string ,
|
||||
icd:string ,
|
||||
power:string,
|
||||
devVolt:number,
|
||||
devCurr:number,
|
||||
devChns:number,
|
||||
name: string,
|
||||
icd: string,
|
||||
power: string,
|
||||
devVolt: number,
|
||||
devCurr: number,
|
||||
devChns: number,
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 被检设备表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResPqDevPage extends ResPage<ResPqDev> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
39
frontend/src/api/device/interface/report.ts
Normal file
39
frontend/src/api/device/interface/report.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { ReqPage, ResPage } from '@/api/interface'
|
||||
import type { UploadFile } from 'element-plus';
|
||||
|
||||
// 报告模版接口
|
||||
export namespace PqReport {
|
||||
|
||||
/**
|
||||
* 报告模版表格分页查询参数
|
||||
*/
|
||||
export interface ReqReportParams extends ReqPage {
|
||||
id: string; // 装置序号id 必填
|
||||
name?: string; // 设备名称
|
||||
createTime?: string; //创建时间
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告模版新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResReport {
|
||||
id: string; //报告模板id
|
||||
name: string;//报告模板名称
|
||||
version:string;//版本号
|
||||
baseFile?:string;//基础模板文件路径
|
||||
detailFile?:string;//检测项模版文件路径
|
||||
description:string;//描述信息
|
||||
state:number;//状态:8-删除 1-正常
|
||||
createBy?: string| null; //创建用户
|
||||
createTime?: string| null; //创建时间
|
||||
updateBy?: string| null; //更新用户
|
||||
updateTime?: string| null; //更新时间
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告模版表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResReportPage extends ResPage<ResReport> {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,38 +2,37 @@ import type { ReqPage, ResPage } from '@/api/interface'
|
||||
|
||||
// 检测脚本模块
|
||||
export namespace TestScript {
|
||||
|
||||
|
||||
/**
|
||||
* 检测脚本表格分页查询参数
|
||||
*/
|
||||
export interface ReqTestScriptParams extends ReqPage{
|
||||
id: string; // 装置序号id 必填
|
||||
name: string;
|
||||
type: string;
|
||||
pattern:string;
|
||||
export interface ReqTestScriptParams extends ReqPage {
|
||||
id: string // 装置序号id 必填
|
||||
name: string
|
||||
type: string
|
||||
pattern: string
|
||||
}
|
||||
|
||||
// 检测脚本接口
|
||||
export interface ResTestScript {
|
||||
id?: string; //检测脚本ID
|
||||
name: string; //检测脚本名称
|
||||
type: string; //设定0为脚本,1为模板
|
||||
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
||||
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||
standardName: string;//参照标准名称
|
||||
standardTime: string;//标准推行时间
|
||||
state:number;//
|
||||
createBy?: string;
|
||||
createTime?: string;
|
||||
updateBy?: string;
|
||||
updateTime?: string;
|
||||
id?: string //检测脚本ID
|
||||
name: string //检测脚本名称
|
||||
type: string //设定0为脚本,1为模板
|
||||
pattern: string //检测脚本模式(字典表Code字段,数字、模拟、比对)
|
||||
valueType?: string //脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||
standardName: string //参照标准名称
|
||||
standardTime: string //标准推行时间
|
||||
state?: number //
|
||||
createBy?: string
|
||||
createTime?: string
|
||||
updateBy?: string
|
||||
updateTime?: string
|
||||
selectedValue?: string
|
||||
ratedCurr?: number
|
||||
ratedVolt?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测脚本查询分页返回的对象;
|
||||
*/
|
||||
export interface ResTestScriptPage extends ResPage<ResTestScript> {
|
||||
|
||||
}
|
||||
}
|
||||
export interface ResTestScriptPage extends ResPage<ResTestScript> {}
|
||||
}
|
||||
|
||||
42
frontend/src/api/device/report/index.ts
Normal file
42
frontend/src/api/device/report/index.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import type {PqReport} from '@/api/device/interface/report'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
* @name 报告模版模块
|
||||
*/
|
||||
|
||||
//获取报告模版
|
||||
export const getPqReportList = (params: PqReport.ReqReportParams) => {
|
||||
return http.post(`/report/list`, params)
|
||||
}
|
||||
|
||||
//新增报告模版
|
||||
export const addPqReport = (params: PqReport.ResReport) => {
|
||||
return http.upload(`/report/add`, params)
|
||||
}
|
||||
|
||||
//删除报告模版
|
||||
export const deletePqReport = (params: string[]) => {
|
||||
return http.post(`/report/delete`, params)
|
||||
}
|
||||
|
||||
//查询报告模板详情
|
||||
export const getPqReportById = (params: PqReport.ResReport) => {
|
||||
return http.get(`/report/getById?id=${params.id}`)
|
||||
}
|
||||
|
||||
//修改报告模板
|
||||
export const updatePqReport = (params: PqReport.ResReport) => {
|
||||
return http.upload(`/report/update`, params)
|
||||
}
|
||||
|
||||
//查询所有报告模板名称
|
||||
export const getPqReportAllName = () => {
|
||||
return http.get(`/report/listAllName`)
|
||||
}
|
||||
|
||||
//根据名称查询指定报告模板的所有版本
|
||||
export const getPqReportAllVersion = (params:any) => {
|
||||
return http.get(`/report/listAllVersion?name=${params.name}`)
|
||||
}
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
import type { TestScript } from '@/api/device/interface/testScript'
|
||||
import http from '@/api'
|
||||
import { Loading } from '@element-plus/icons-vue'
|
||||
|
||||
/**
|
||||
* @name 检测脚本管理模块
|
||||
*/
|
||||
// 新增脚本
|
||||
export const pqScriptAdd = (params: TestScript.ResTestScript) => {
|
||||
return http.post(`/pqScript/add`, params)
|
||||
}
|
||||
// 修改脚本
|
||||
export const pqScriptUpdate = (params: TestScript.ResTestScript) => {
|
||||
return http.post(`/pqScript/update`, params)
|
||||
}
|
||||
// 获取检测脚本列表
|
||||
export const getPqScriptList = (params: TestScript.ReqTestScriptParams) => {
|
||||
return http.post(`/pqScript/list`, params)
|
||||
}
|
||||
|
||||
|
||||
//升级为模版
|
||||
export const updatePqScript = (params: TestScript.ResTestScript) => {
|
||||
return http.get(`/pqScript/upgradeToTemplate?id=${params.id}`)
|
||||
@@ -19,3 +27,27 @@ export const updatePqScript = (params: TestScript.ResTestScript) => {
|
||||
export const deletePqScript = (params: string[]) => {
|
||||
return http.post(`/pqScript/delete`, params)
|
||||
}
|
||||
//添加检测脚本
|
||||
export const addScriptDtls = (params: any) => {
|
||||
return http.post(`/pqScript/addScriptDtls`, params)
|
||||
}
|
||||
//根据脚本id查询检测脚本详情
|
||||
export const dlsDetails = (params: any) => {
|
||||
return http.post(`/pqScript/dlsDetails`, params)
|
||||
}
|
||||
// 删除脚本
|
||||
export const deleteDtls = (params: any) => {
|
||||
return http.post(`/pqScript/deleteDtls`, params)
|
||||
}
|
||||
// 启用关闭脚本
|
||||
export const updateDtls = (params: any) => {
|
||||
return http.post(`/pqScript/updateDtls`, params)
|
||||
}
|
||||
// 根据通讯参数生成装置下发原始数据公式
|
||||
export const scriptDtlsCheckDataList = (params: any) => {
|
||||
return http.post(`/pqScript/scriptDtlsCheckDataList`, params,{loading: false})
|
||||
}
|
||||
// 通讯脚本回显
|
||||
export const checkDataList = (params: any) => {
|
||||
return http.post(`/pqScript/checkDataList`, params, { loading: true })
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ import http from "@/api";
|
||||
|
||||
//系数校准发送基本信息
|
||||
export const getCoefficientCheck = (params: any) => {
|
||||
return http.post(`/prepare/coefficientCheck`, params)
|
||||
return http.post(`/prepare/coefficientCheck`, params,{loading: false})
|
||||
}
|
||||
@@ -39,13 +39,14 @@ class RequestHttp {
|
||||
*/
|
||||
this.service.interceptors.request.use(
|
||||
(config: CustomAxiosRequestConfig) => {
|
||||
isFirst = true
|
||||
const userStore = useUserStore()
|
||||
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制
|
||||
config.loading ?? (config.loading = true)
|
||||
config.loading && showFullScreenLoading()
|
||||
if (config.headers && typeof config.headers.set === 'function') {
|
||||
config.headers.set('Authorization', 'Bearer ' + userStore.accessToken)
|
||||
config.headers.set('Refresh-Token', userStore.refreshToken)
|
||||
config.headers.set('Is-Refresh-Token', userStore.isRefreshToken+"")
|
||||
}
|
||||
return config
|
||||
},
|
||||
@@ -67,11 +68,14 @@ class RequestHttp {
|
||||
|
||||
if(data.code === ResultEnum.ACCESSTOKEN_EXPIRED){
|
||||
// 用长token去换短token
|
||||
userStore.setAccessToken(userStore.refreshToken)
|
||||
userStore.setIsRefreshToken(true)
|
||||
const result = await refreshToken()
|
||||
if (result) { //获取新token成功的话
|
||||
// 有新的token后,重新请求
|
||||
userStore.setAccessToken(result.data.accessToken)
|
||||
userStore.setRefreshToken(result.data.refreshToken)
|
||||
userStore.setIsRefreshToken(false)
|
||||
response.config.headers.Authorization = `Bearer ${result.data.accessToken}`//重新请求前需要将更新后的新token更换掉之前无效的token,不然会死循环
|
||||
const resp = await this.service.request(response.config)
|
||||
return resp
|
||||
@@ -80,15 +84,14 @@ class RequestHttp {
|
||||
}
|
||||
}
|
||||
// 登陆失效
|
||||
if (data.code == ResultEnum.OVERDUE) {
|
||||
if (data.code === ResultEnum.OVERDUE) {
|
||||
console.log("登陆失效")
|
||||
userStore.setAccessToken('')
|
||||
userStore.setRefreshToken('')
|
||||
userStore.setUserInfo({ name: '' })
|
||||
router.replace(LOGIN_URL)
|
||||
if(data.code != ResultEnum.OVERDUE){//临时处理token失效弹窗多次
|
||||
ElMessage.error(data.message)
|
||||
}else if(isFirst){
|
||||
userStore.setIsRefreshToken(false)
|
||||
userStore.setUserInfo({ id:'',name: '' })
|
||||
await router.replace(LOGIN_URL)
|
||||
if(isFirst){//临时处理token失效弹窗多次
|
||||
ElMessage.error(data.message)
|
||||
isFirst = false
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ export namespace Plan {
|
||||
export interface ResPlan {
|
||||
id: string; //检测计划ID
|
||||
name: string; //检测计划名称
|
||||
pattern: string; //模式,字典表(数字、模拟、比对)
|
||||
pattern?: string; //模式,字典表(数字、模拟、比对)
|
||||
fatherPlanId?: string; //父计划ID
|
||||
dataSourceId: string; //数据源ID
|
||||
scriptId: string; //检测脚本ID
|
||||
@@ -22,6 +22,10 @@ export namespace Plan {
|
||||
createTime?:string; //创建时间
|
||||
updateBy?:string; //更新用户
|
||||
updateTime?:string; //更新时间
|
||||
|
||||
associateReport:number;//是否关联报告模板 0否 1是
|
||||
reportTemplateName:string;
|
||||
reportTemplateVersion:string
|
||||
}
|
||||
|
||||
// 检测计划 + 分页
|
||||
|
||||
@@ -73,7 +73,7 @@ export const downloadTemplate = () => {
|
||||
}
|
||||
// 导入检测计划
|
||||
export const importPlan = (params: Device.ReqPqDevParams) => {
|
||||
return http.upload(`/adPlan/import`, params)
|
||||
return http.uploadExcel(`/adPlan/import`, params)
|
||||
}
|
||||
|
||||
// 装置检测报告生成
|
||||
@@ -85,3 +85,8 @@ export const generateDevReport = (params: Device.ReqDevReportParams) => {
|
||||
export const downloadDevData = (params: Device.ReqDevReportParams) => {
|
||||
return http.download(`/report/downloadReport`, params)
|
||||
}
|
||||
|
||||
export const staticsAnalyse = (params: { id: string[] }) => {
|
||||
return http.download('/adPlan/analyse', params)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ export const closePreTest = (params) => {
|
||||
* 开始正式检测
|
||||
* @param params
|
||||
*/
|
||||
export const startTest = (params) => {
|
||||
return http.post(`/prepare/startTest`, params, {loading: false})
|
||||
}
|
||||
// export const startTest = (params) => {
|
||||
// return http.post(`/prepare/startTest`, params, {loading: false})
|
||||
// }
|
||||
|
||||
/**
|
||||
* 暂停正式检测
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import http from '@/api'
|
||||
import { type Dict } from '@/api/system/dictionary/interface'
|
||||
import { c } from 'vite/dist/node/types.d-aGj9QkWt'
|
||||
|
||||
//获取字典类型
|
||||
export const getDictTreeList = (params: Dict.ResDictTree) => {
|
||||
const name = params.name || '';
|
||||
return http.get(`/dictTree/getTree?keyword=${name}`, params)
|
||||
export const getDictTreeByCode = (params: Dict.ResDictTree) => {
|
||||
const code = params.code || ''
|
||||
return http.get(`/dictTree/getTreeByCode?code=${code}`, { loading: true })
|
||||
}
|
||||
|
||||
export const getDictTreeByName = (params: Dict.ResDictTree) => {
|
||||
const name = params.name || ''
|
||||
return http.get(`/dictTree/getTreeByName?name=${name}`)
|
||||
}
|
||||
|
||||
//添加字典类型
|
||||
@@ -21,4 +27,3 @@ export const updateDictTree = (params: Dict.ResDictTree) => {
|
||||
export const deleteDictTree = (params: Dict.ResDictTree) => {
|
||||
return http.post(`/dictTree/delete?id=${params.id}`)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,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 interface Audit_LogList {
|
||||
id: string;//日志表Id
|
||||
operate_Type:string;//日志类型
|
||||
export namespace AuditLog {
|
||||
|
||||
/**
|
||||
* 设备类型数据表格分页查询参数
|
||||
*/
|
||||
export interface ReqAuditLogParams extends ReqPage {
|
||||
id: string; //审计日志Id 必填
|
||||
createTime?: string; //创建时间
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备类型新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResAuditLog {
|
||||
id: string;//审计日志Id
|
||||
operate_Type:string;//操作类型
|
||||
ip:string;//操作IP
|
||||
result: string;//事件结果
|
||||
remark: string;//事件描述
|
||||
level:number;//告警等级
|
||||
warn:number;//告警标志
|
||||
create_By:string;//创建用户
|
||||
create_Time:string;//创建时间
|
||||
sort:number;//排序
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备类型表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResAuditLogPage extends ResPage<ResAuditLog> {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ export namespace Login {
|
||||
export interface ReqLoginForm {
|
||||
username: string;
|
||||
password: string;
|
||||
checked: boolean;
|
||||
}
|
||||
export interface ResLogin {
|
||||
accessToken: string;
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
import type { Login } from '@/api/user/interface/user'
|
||||
import { ADMIN as rePrefix } from '@/api/system/config/serviceName'
|
||||
import type {Login} from '@/api/user/interface/user'
|
||||
import {ADMIN as rePrefix} from '@/api/system/config/serviceName'
|
||||
import http from '@/api'
|
||||
import type { Dict } from '@/api/interface'
|
||||
import type {Dict} from '@/api/interface'
|
||||
|
||||
/**
|
||||
* @name 登录模块
|
||||
*/
|
||||
// 用户登录
|
||||
export const loginApi = (params: Login.ReqLoginForm) => {
|
||||
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false })
|
||||
export const loginApi = (params: { username: string; password: string,checked: boolean }) => {
|
||||
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, {loading: false})
|
||||
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
||||
}
|
||||
// 获取菜单列表
|
||||
export const getAuthMenuListApi = () => {
|
||||
return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, { loading: false })
|
||||
return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, {loading: false})
|
||||
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
||||
}
|
||||
// 获取按钮权限
|
||||
export const getAuthButtonListApi = () => {
|
||||
return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, { loading: false })
|
||||
return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, {loading: false})
|
||||
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
||||
}
|
||||
// 用户退出登录
|
||||
@@ -26,7 +27,7 @@ export const logoutApi = () => {
|
||||
}
|
||||
|
||||
//获取下拉框列表
|
||||
export const getDictList = () =>{
|
||||
export const getDictList = () => {
|
||||
return http.get<Dict>('/dictData/dictDataCache')
|
||||
}
|
||||
|
||||
@@ -34,7 +35,25 @@ export const getDictList = () =>{
|
||||
export const refreshToken = () => {
|
||||
return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`,
|
||||
{},
|
||||
{ loading: false }
|
||||
{loading: false}
|
||||
)
|
||||
}
|
||||
|
||||
//获取场景
|
||||
export const getCurrentScene = () => {
|
||||
return http.get('/sysTestConfig/getCurrentScene', {}, {loading: false})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取RSA公钥
|
||||
*/
|
||||
export const getPublicKey = (username: string, checked: boolean) => {
|
||||
return http.get(`/admin/getPublicKey?username=${username}&checked=${checked}`, {}, {loading: false})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否在检测中自动生成报告
|
||||
*/
|
||||
export const getAutoGenerate = () => {
|
||||
return http.get('/sysTestConfig/getAutoGenerate', {}, {loading: false})
|
||||
}
|
||||
|
||||
BIN
frontend/src/assets/images/transient.png
Normal file
BIN
frontend/src/assets/images/transient.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
@@ -97,6 +97,8 @@ const uploadExcel = async (param: UploadRequestOptions) => {
|
||||
|
||||
|
||||
async function handleImportResponse(res: any) {
|
||||
console.log(res)
|
||||
|
||||
if (res.type === 'application/json') {
|
||||
const fileReader = new FileReader()
|
||||
fileReader.onloadend = () => {
|
||||
@@ -118,7 +120,7 @@ async function handleImportResponse(res: any) {
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = '终端入网检测失败列表'
|
||||
link.download = '导入失败数据'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
|
||||
282
frontend/src/components/echarts/line/index.vue
Normal file
282
frontend/src/components/echarts/line/index.vue
Normal file
@@ -0,0 +1,282 @@
|
||||
<template>
|
||||
<div class="chart">
|
||||
<div ref="chartRef" class="my-chart" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount, onMounted, ref, defineExpose, watch, nextTick } from 'vue'
|
||||
// import echarts from './echarts'
|
||||
import * as echarts from 'echarts' // 全引入
|
||||
// import 'echarts/lib/component/dataZoom'
|
||||
|
||||
const color = [
|
||||
'var(--el-color-primary)',
|
||||
'#07CCCA',
|
||||
'#00BFF5',
|
||||
'#FFBF00',
|
||||
'#77DA63',
|
||||
'#D5FF6B',
|
||||
'#Ff6600',
|
||||
'#FF9100',
|
||||
'#5B6E96',
|
||||
'#66FFCC',
|
||||
'#B3B3B3'
|
||||
]
|
||||
|
||||
const chartRef = ref<HTMLDivElement>()
|
||||
|
||||
const props = defineProps(['options', 'isInterVal', 'pieInterVal'])
|
||||
let chart: echarts.ECharts | any = null
|
||||
const resizeHandler = () => {
|
||||
// 不在视野中的时候不进行resize
|
||||
if (!chartRef.value) return
|
||||
if (chartRef.value.offsetHeight == 0) return
|
||||
chart.getZr().painter.getViewportRoot().style.display = 'none'
|
||||
requestAnimationFrame(() => {
|
||||
chart.resize()
|
||||
chart.getZr().painter.getViewportRoot().style.display = ''
|
||||
})
|
||||
}
|
||||
const initChart = () => {
|
||||
if (!props.isInterVal && !props.pieInterVal) {
|
||||
chart?.dispose()
|
||||
}
|
||||
// chart?.dispose()
|
||||
chart = echarts.init(chartRef.value as HTMLDivElement)
|
||||
const options = {
|
||||
title: {
|
||||
left: 'center',
|
||||
// textStyle: {
|
||||
color: '#000',
|
||||
fontSize: 18,
|
||||
// },
|
||||
...(props.options?.title || null)
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow',
|
||||
label: {
|
||||
color: '#fff',
|
||||
fontSize: 16
|
||||
}
|
||||
},
|
||||
textStyle: {
|
||||
color: '#fff',
|
||||
fontStyle: 'normal',
|
||||
opacity: 0.35,
|
||||
fontSize: 14
|
||||
},
|
||||
backgroundColor: 'rgba(0,0,0,0.55)',
|
||||
borderWidth: 0,
|
||||
confine: true,
|
||||
...(props.options?.tooltip || null)
|
||||
},
|
||||
|
||||
legend: {
|
||||
right: 20,
|
||||
top: 0,
|
||||
itemGap: 10,
|
||||
itemStyle: {},
|
||||
// textStyle: {
|
||||
fontSize: 12,
|
||||
padding: [2, 0, 0, 0], //[上、右、下、左]
|
||||
// },
|
||||
itemWidth: 15,
|
||||
itemHeight: 10,
|
||||
...(props.options?.legend || null)
|
||||
},
|
||||
grid: {
|
||||
top: '60px',
|
||||
left: '30px',
|
||||
right: '70px',
|
||||
bottom: props.options?.options?.dataZoom === null ? '10px' : '40px',
|
||||
containLabel: true,
|
||||
...(props.options?.grid || null)
|
||||
},
|
||||
xAxis: props.options?.xAxis ? handlerXAxis() : null,
|
||||
yAxis: props.options?.yAxis ? handlerYAxis() : null,
|
||||
dataZoom: props.options?.dataZoom || [
|
||||
{
|
||||
type: 'inside',
|
||||
height: 13,
|
||||
start: 0,
|
||||
bottom: '20px',
|
||||
end: 100
|
||||
},
|
||||
{
|
||||
start: 0,
|
||||
height: 13,
|
||||
bottom: '20px',
|
||||
end: 100
|
||||
}
|
||||
],
|
||||
color: props.options?.color || color,
|
||||
series: props.options?.series,
|
||||
...props.options?.options
|
||||
}
|
||||
// console.log(options.series,"获取x轴");
|
||||
handlerBar(options)
|
||||
|
||||
// 处理柱状图
|
||||
chart.setOption(options, true)
|
||||
|
||||
setTimeout(() => {
|
||||
chart.resize()
|
||||
}, 0)
|
||||
}
|
||||
const handlerBar = (options: any) => {
|
||||
if (Array.isArray(options.series)) {
|
||||
options.series.forEach((item: any) => {
|
||||
if (item.type === 'bar') {
|
||||
item.barMinHeight = 10
|
||||
item.barMaxWidth = 20
|
||||
item.itemStyle = Object.assign(
|
||||
{
|
||||
color: (params: any) => {
|
||||
if (params.value == 0 || params.value == 3.14159) {
|
||||
return '#ccc'
|
||||
} else {
|
||||
return props.options?.color
|
||||
? props.options?.color[params.seriesIndex]
|
||||
: color[params.seriesIndex]
|
||||
}
|
||||
}
|
||||
},
|
||||
item.itemStyle
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
const handlerYAxis = () => {
|
||||
let temp = {
|
||||
type: 'value',
|
||||
nameGap: 15,
|
||||
nameTextStyle: {
|
||||
color: '#000'
|
||||
},
|
||||
splitNumber: 5,
|
||||
minInterval: 1,
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: '#000'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
color: '#000',
|
||||
fontSize: 14,
|
||||
formatter: function (value) {
|
||||
return value.toFixed(0) // 格式化显示为一位小数
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
// 使用深浅的间隔色
|
||||
color: ['#ccc'],
|
||||
type: 'dashed',
|
||||
opacity: 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
// props.options?.xAxis 是数组还是对象
|
||||
if (Array.isArray(props.options?.yAxis)) {
|
||||
return props.options?.yAxis.map((item: any) => {
|
||||
return {
|
||||
...temp,
|
||||
...item
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return {
|
||||
...temp,
|
||||
...props.options?.yAxis
|
||||
}
|
||||
}
|
||||
}
|
||||
const handlerXAxis = () => {
|
||||
let temp = {
|
||||
type: 'category',
|
||||
axisTick: { show: false },
|
||||
nameTextStyle: {
|
||||
color: '#000'
|
||||
},
|
||||
axisLine: {
|
||||
// lineStyle: {
|
||||
color: '#000'
|
||||
// }
|
||||
},
|
||||
axisLabel: {
|
||||
// textStyle: {
|
||||
fontFamily: 'dinproRegular',
|
||||
color: '#000',
|
||||
fontSize: '12'
|
||||
// }
|
||||
}
|
||||
// boundaryGap: false,
|
||||
}
|
||||
// props.options?.xAxis 是数组还是对象
|
||||
if (Array.isArray(props.options?.xAxis)) {
|
||||
return props.options?.xAxis.map((item: any) => {
|
||||
return {
|
||||
...temp,
|
||||
...item
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return {
|
||||
...temp,
|
||||
...props.options?.xAxis
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let throttle: ReturnType<typeof setTimeout>
|
||||
// 动态计算table高度
|
||||
const resizeObserver = new ResizeObserver(entries => {
|
||||
for (const entry of entries) {
|
||||
if (throttle) {
|
||||
clearTimeout(throttle)
|
||||
}
|
||||
throttle = setTimeout(() => {
|
||||
resizeHandler()
|
||||
}, 100)
|
||||
}
|
||||
})
|
||||
onMounted(() => {
|
||||
initChart()
|
||||
resizeObserver.observe(chartRef.value!)
|
||||
})
|
||||
defineExpose({ initChart })
|
||||
onBeforeUnmount(() => {
|
||||
resizeObserver.unobserve(chartRef.value!)
|
||||
chart?.dispose()
|
||||
})
|
||||
watch(
|
||||
() => props.options,
|
||||
(newVal, oldVal) => {
|
||||
initChart()
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.chart {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
|
||||
.el-button {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: -60px;
|
||||
}
|
||||
|
||||
.my-chart {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -3,11 +3,13 @@
|
||||
// 首页地址(默认)
|
||||
export const HOME_URL: string = "/home/index";
|
||||
|
||||
// export const HOME_URL: string = "/machine/controlSource";
|
||||
|
||||
// 登录页地址(默认)
|
||||
export const LOGIN_URL: string = "/login";
|
||||
|
||||
// 默认主题颜色
|
||||
export const DEFAULT_PRIMARY: string = "#003078";
|
||||
export const DEFAULT_PRIMARY: string = "#526ADE";
|
||||
|
||||
// 路由白名单地址(本地存在的路由 staticRouter.ts 中)
|
||||
export const ROUTER_WHITE_LIST: string[] = ["/500"];
|
||||
@@ -17,3 +19,5 @@ export const AMAP_MAP_KEY: string = "";
|
||||
|
||||
// 百度地图 key
|
||||
export const BAIDU_MAP_KEY: string = "";
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
export enum ResultEnum {
|
||||
SUCCESS = "A0000",
|
||||
ERROR = 500,
|
||||
ACCESSTOKEN_EXPIRED = 401,
|
||||
OVERDUE = 4001,
|
||||
ACCESSTOKEN_EXPIRED = "A0024",
|
||||
OVERDUE = "A0025",
|
||||
TIMEOUT = 30000,
|
||||
TYPE = "success"
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ export const useTheme = () => {
|
||||
|
||||
// 修改主题颜色
|
||||
const changePrimary = (val: string | null) => {
|
||||
|
||||
if (!val) {
|
||||
val = DEFAULT_PRIMARY;
|
||||
ElMessage({ type: "success", message: `主题颜色已重置为 ${DEFAULT_PRIMARY}` });
|
||||
@@ -40,10 +41,13 @@ export const useTheme = () => {
|
||||
for (let i = 1; i <= 9; i++) {
|
||||
const primaryColor = isDark.value ? `${getDarkColor(val, i / 10)}` : `${getLightColor(val, i / 10)}`;
|
||||
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, primaryColor);
|
||||
|
||||
// const colorValue = document.documentElement.style.getPropertyValue(`--el-color-primary-light-${i}`).trim();
|
||||
// console.log(`--el-color-primary-light-${i}: ${colorValue}`);
|
||||
}
|
||||
globalStore.setGlobalState("primary", val);
|
||||
};
|
||||
|
||||
}
|
||||
// 灰色和弱色切换
|
||||
const changeGreyOrWeak = (type: Theme.GreyOrWeakType, value: boolean) => {
|
||||
const body = document.body as HTMLElement;
|
||||
|
||||
@@ -26,6 +26,7 @@ export default {
|
||||
changePassword: "Change Password",
|
||||
changeMode:"Change Mode",
|
||||
versionRegister:"Version Register",
|
||||
changeTheme: "Change Theme",
|
||||
logout: "Logout"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@ export default {
|
||||
changePassword: "修改密码",
|
||||
changeMode:"模式切换",
|
||||
versionRegister:"版本注册",
|
||||
changeTheme:"主题切换",
|
||||
logout: "退出登录"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
}
|
||||
.el-menu-item:hover {
|
||||
color: #fff; //一级导航划过颜色
|
||||
background-color: #5274a5 !important; //一级导航划过背景色
|
||||
//background-color: #5274a5 !important; //一级导航划过背景色
|
||||
background-color:var(--el-color-primary-light-3) !important;
|
||||
|
||||
}
|
||||
.el-sub-menu__hide-arrow {
|
||||
width: 65px;
|
||||
@@ -47,7 +49,9 @@
|
||||
}
|
||||
.el-menu-item.is-active {
|
||||
color: #fff !important; //一级导航文字选中颜色
|
||||
background-color: #5274a5 !important; //一级导航选中背景色
|
||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
border-bottom: 0 !important;
|
||||
}
|
||||
.el-sub-menu__title {
|
||||
@@ -67,7 +71,9 @@
|
||||
color: #fff !important; //二级导航文字选中颜色
|
||||
// background-color: var(--el-color-primary) !important;
|
||||
// background-color: #5274a5 !important;//二级导航选中背景色
|
||||
background-color: #5274a5 !important;
|
||||
|
||||
//background-color: #7588e5 !important;
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
border-bottom-color: var(--el-color-primary) !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<p style="margin: 0;">
|
||||
<p style="margin: 0;" >
|
||||
<a href="http://www.shining-electric.com/" target="_blank">
|
||||
2024 © 南京灿能电力自动化股份有限公司
|
||||
</a>
|
||||
@@ -117,10 +117,11 @@ const handelOpen = async (item: string) => {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
text-align: right;
|
||||
line-height: 40px;
|
||||
a {
|
||||
color: #fff;
|
||||
margin-right: 25px; // 增加右边距
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<template>
|
||||
<!-- <div class="userInfo">-->
|
||||
<!-- <div class="icon">-->
|
||||
<!-- <Avatar/>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="username">-->
|
||||
<!-- {{ username }}-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<el-dropdown trigger="click">
|
||||
<div class="userInfo">
|
||||
<div class="icon">
|
||||
@@ -10,17 +18,20 @@
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="openDialog('themeRef')">
|
||||
<el-icon><Sunny /></el-icon>{{ t("header.changeTheme") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDialog('infoRef')">
|
||||
<el-icon><User /></el-icon>{{ $t("header.personalData") }}
|
||||
<el-icon><User /></el-icon>{{ t("header.personalData") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDialog('passwordRef')">
|
||||
<el-icon><Edit /></el-icon>{{ $t("header.changePassword") }}
|
||||
<el-icon><Edit /></el-icon>{{ t("header.changePassword") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="changeMode">
|
||||
<el-icon><Edit /></el-icon>{{ $t("header.changeMode") }}
|
||||
<el-icon><Switch /></el-icon>{{ t("header.changeMode") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDialog('versionRegisterRef')">
|
||||
<el-icon><SetUp /></el-icon>{{ $t("header.versionRegister") }}
|
||||
<el-icon><SetUp /></el-icon>{{ t("header.versionRegister") }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
@@ -34,6 +45,9 @@
|
||||
<PasswordDialog ref="passwordRef"></PasswordDialog>
|
||||
<!-- versionRegisterDialog -->
|
||||
<VersionDialog ref="versionRegisterRef"></VersionDialog>
|
||||
<!-- ThemeDialog -->
|
||||
<ThemeDialog ref="themeRef"></ThemeDialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -42,12 +56,13 @@ import { LOGIN_URL } from "@/config";
|
||||
import { useRouter } from "vue-router";
|
||||
import { logoutApi } from "@/api/user/login";
|
||||
import { useUserStore } from "@/stores/modules/user";
|
||||
import { ElMessageBox, ElMessage } from "element-plus";
|
||||
import { ElMessageBox, ElMessage, CHANGE_EVENT } from "element-plus";
|
||||
import InfoDialog from "./InfoDialog.vue";
|
||||
import PasswordDialog from "./PasswordDialog.vue";
|
||||
import ThemeDialog from "./ThemeDialog.vue";
|
||||
import VersionDialog from "@/views/system/versionRegister/index.vue";
|
||||
import { computed } from "vue";
|
||||
import { Avatar } from "@element-plus/icons-vue";
|
||||
import { Avatar, Delete, Document, Sunny, Switch } from "@element-plus/icons-vue";
|
||||
import AssemblySize from "./components/AssemblySize.vue";
|
||||
import Language from "./components/Language.vue";
|
||||
import SearchMenu from "./components/SearchMenu.vue";
|
||||
@@ -64,6 +79,14 @@ const router = useRouter();
|
||||
const authStore = useAuthStore();
|
||||
const modeStore = useModeStore();
|
||||
const AppSceneStore = useAppSceneStore();
|
||||
import { useTheme } from "@/hooks/useTheme";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import {getPublicKey} from "@/api/user/login"; // 引入 vue-i18n 钩子
|
||||
const { changePrimary} = useTheme();
|
||||
|
||||
// 初始化 i18n
|
||||
const { t } = useI18n(); // 使用 t 方法替代 $t
|
||||
|
||||
// 退出登录
|
||||
const logout = () => {
|
||||
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
|
||||
@@ -76,7 +99,8 @@ const logout = () => {
|
||||
// 2.清除 Token
|
||||
userStore.setAccessToken("");
|
||||
userStore.setRefreshToken("");
|
||||
userStore.setUserInfo({name: ""});
|
||||
userStore.setUserInfo({id: "", name: ""});
|
||||
userStore.setIsRefreshToken(false)
|
||||
dictStore.setDictData([]);
|
||||
modeStore.setCurrentMode('');
|
||||
AppSceneStore.setCurrentMode('');
|
||||
@@ -92,12 +116,19 @@ const logout = () => {
|
||||
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
|
||||
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
|
||||
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null);
|
||||
|
||||
const themeRef = ref<InstanceType<typeof ThemeDialog> | null>(null);
|
||||
const openDialog = (ref: string) => {
|
||||
if (ref == "infoRef") infoRef.value?.openDialog();
|
||||
if (ref == "passwordRef") passwordRef.value?.openDialog();
|
||||
if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog();
|
||||
if (ref == "themeRef") themeRef.value?.openDialog();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//模式切换
|
||||
const changeMode = () => {
|
||||
authStore.changeModel();
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" title="主题切换" width="500px" draggable>
|
||||
<el-divider content-position="center">主题颜色</el-divider>
|
||||
<div style="display: flex; justify-content: center;">
|
||||
<el-color-picker v-model="color" />
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="sure">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useTheme } from "@/hooks/useTheme";
|
||||
import { on } from "events";
|
||||
const color = ref('')
|
||||
const { changePrimary} = useTheme();
|
||||
|
||||
const dialogVisible = ref(false);
|
||||
const openDialog = () => {
|
||||
// 修复:使用可选链和空值合并运算符确保不会出现 null 或 undefined
|
||||
const storedColor = JSON.parse(localStorage.getItem('cn-global') ?? '{}').primary;
|
||||
color.value = storedColor ?? '#526ADE'; // 默认值为 '#526ADE'
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
|
||||
const sure = () => {
|
||||
changePrimary(color.value); // 切换主题
|
||||
dialogVisible.value = false;
|
||||
};
|
||||
|
||||
// onMounted(() => {
|
||||
// // 修复:使用可选链和空值合并运算符确保不会出现 null 或 undefined
|
||||
// const storedColor = JSON.parse(localStorage.getItem('cn-global') ?? '{}').primary;
|
||||
// console.log('123',storedColor)
|
||||
// color.value = storedColor ?? '#526ADE'; // 默认值为 '#526ADE'
|
||||
// })
|
||||
|
||||
defineExpose({ openDialog });
|
||||
</script>
|
||||
|
||||
@@ -33,14 +33,19 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
||||
// color: var(--el-menu-hover-text-color) !important;
|
||||
// background-color: transparent !important;
|
||||
color: #fff !important;//一级导航文字选中颜色
|
||||
background-color: #5274a5 !important; //一级导航选中背景色
|
||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
}
|
||||
.el-menu--collapse {
|
||||
.is-active {
|
||||
.el-sub-menu__title {
|
||||
color: #ffffff !important;
|
||||
// background-color: var(--el-color-primary) !important;
|
||||
background-color: #5274a5 !important;
|
||||
//background-color: #5274a5 !important;
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
border-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
@@ -53,7 +58,9 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
||||
// color: var(--el-menu-active-color) !important;
|
||||
// background-color: var(--el-menu-active-bg-color) !important;
|
||||
color: #fff !important;//一级导航文字选中颜色
|
||||
background-color: #5274a5 !important; //一级导航选中背景色
|
||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
<template>
|
||||
<div class='tabs-box'>
|
||||
<div class='tabs-menu'>
|
||||
<el-tabs v-model='tabsMenuValue' type='card' @tab-click='tabClick' @tab-remove='tabRemove'>
|
||||
<el-tab-pane v-for='item in tabsMenuList' :key='item.path' :label='item.title' :name='item.path'
|
||||
:closable='item.close'>
|
||||
<div class="tabs-box">
|
||||
<div class="tabs-menu">
|
||||
<el-tabs v-model="tabsMenuValue" type="card" @tab-click="tabClick" @tab-remove="tabRemove">
|
||||
<el-tab-pane
|
||||
v-for="item in tabsMenuList"
|
||||
:key="item.path"
|
||||
:label="item.title"
|
||||
:name="item.path"
|
||||
:closable="item.close"
|
||||
>
|
||||
<template #label>
|
||||
<el-icon v-show='item.icon && tabsIcon' class='tabs-icon'>
|
||||
<component :is='item.icon'></component>
|
||||
<el-icon v-show="item.icon && tabsIcon" class="tabs-icon">
|
||||
<component :is="item.icon"></component>
|
||||
</el-icon>
|
||||
{{ item.title }}
|
||||
</template>
|
||||
@@ -17,7 +22,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
<script setup lang="ts">
|
||||
import Sortable from 'sortablejs'
|
||||
import { ref, computed, watch, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
@@ -42,15 +47,14 @@ onMounted(() => {
|
||||
initTabs()
|
||||
})
|
||||
|
||||
|
||||
// 监听路由的变化(防止浏览器后退/前进不变化 tabsMenuValue)
|
||||
watch(
|
||||
() => route.fullPath,
|
||||
() => {
|
||||
if (route.meta.isFull) return
|
||||
if (route.meta.hideTab){
|
||||
if (route.meta.hideTab) {
|
||||
tabsMenuValue.value = route.meta.parentPath as string
|
||||
}else{
|
||||
} else {
|
||||
tabsMenuValue.value = route.fullPath
|
||||
const tabsParams = {
|
||||
icon: route.meta.icon as string,
|
||||
@@ -58,12 +62,12 @@ watch(
|
||||
path: route.fullPath,
|
||||
name: route.name as string,
|
||||
close: !route.meta.isAffix,
|
||||
isKeepAlive: route.meta.isKeepAlive as boolean,
|
||||
isKeepAlive: route.meta.isKeepAlive as boolean
|
||||
}
|
||||
tabStore.addTabs(tabsParams)
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
// 初始化需要固定的 tabs
|
||||
@@ -77,7 +81,7 @@ const initTabs = () => {
|
||||
name: item.name,
|
||||
close: !item.meta.isAffix,
|
||||
isKeepAlive: item.meta.isKeepAlive,
|
||||
unshift:true
|
||||
unshift: true
|
||||
}
|
||||
tabStore.addTabs(tabsParams)
|
||||
}
|
||||
@@ -94,7 +98,7 @@ const tabsDrop = () => {
|
||||
const currRow = tabsList.splice(oldIndex as number, 1)[0]
|
||||
tabsList.splice(newIndex as number, 0, currRow)
|
||||
tabStore.setTabs(tabsList)
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -107,10 +111,12 @@ const tabClick = (tabItem: TabsPaneContext) => {
|
||||
|
||||
// Remove Tab
|
||||
const tabRemove = (fullPath: TabPaneName) => {
|
||||
tabStore.removeTabs(fullPath as string, fullPath == route.fullPath)
|
||||
|
||||
|
||||
tabStore.removeTabs(fullPath as string, fullPath == route.fullPath || '/machine/testScriptAdd' == route.fullPath)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
@import "./index.scss";
|
||||
<style scoped lang="scss">
|
||||
@import './index.scss';
|
||||
</style>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
border-radius: 3px;
|
||||
}
|
||||
.layout-light {
|
||||
background-color: var(--el-color-primary-light-5);
|
||||
background-color: var(--el-color-primary-light-3);
|
||||
border-radius: 3px;
|
||||
}
|
||||
.layout-content {
|
||||
|
||||
@@ -65,5 +65,6 @@ const setupAll = async () => {
|
||||
|
||||
//挂载app
|
||||
setupAll().then(() => {
|
||||
|
||||
app.mount('#app')
|
||||
})
|
||||
|
||||
@@ -30,6 +30,7 @@ const routerMode = {
|
||||
* @param meta.isKeepAlive ==> 当前路由是否缓存
|
||||
* */
|
||||
const router = createRouter({
|
||||
|
||||
history: routerMode[mode](),
|
||||
routes: [...staticRouter],
|
||||
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
|
||||
@@ -68,10 +69,9 @@ router.beforeEach(async (to, from, next) => {
|
||||
await initDynamicRouter()
|
||||
return next({ ...to, replace: true })
|
||||
}
|
||||
//console.log(to)
|
||||
|
||||
// 7.存储 routerName 做按钮权限筛选
|
||||
authStore.setRouteName(to.name as string)
|
||||
|
||||
// 8.正常访问页面
|
||||
next()
|
||||
})
|
||||
|
||||
@@ -41,6 +41,7 @@ export const initDynamicRouter = async () => {
|
||||
if (item.component && typeof item.component == "string") {
|
||||
item.component = modules["/src/views" + item.component + ".vue"];
|
||||
}
|
||||
|
||||
if (item.meta.isFull) {
|
||||
router.addRoute(item as unknown as RouteRecordRaw);
|
||||
} else {
|
||||
|
||||
@@ -1,122 +1,139 @@
|
||||
import { RouteRecordRaw } from "vue-router";
|
||||
import { HOME_URL, LOGIN_URL } from "@/config";
|
||||
export const Layout = () => import('@/layouts/index.vue');
|
||||
import { RouteRecordRaw } from 'vue-router'
|
||||
import { HOME_URL, LOGIN_URL } from '@/config'
|
||||
export const Layout = () => import('@/layouts/index.vue')
|
||||
/**
|
||||
* staticRouter (静态路由)
|
||||
*/
|
||||
export const staticRouter: RouteRecordRaw[] = [
|
||||
{
|
||||
path: "/",
|
||||
redirect: HOME_URL,
|
||||
path: '/',
|
||||
redirect: HOME_URL
|
||||
},
|
||||
{
|
||||
path: LOGIN_URL,
|
||||
name: "login",
|
||||
component: () => import("@/views/login/index.vue"),
|
||||
name: 'login',
|
||||
component: () => import('@/views/login/index.vue'),
|
||||
meta: {
|
||||
title: "登录",
|
||||
},
|
||||
title: '登录'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/layout",
|
||||
name: "layout",
|
||||
path: '/layout',
|
||||
name: 'layout',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: "/plan",
|
||||
name: "plan",
|
||||
redirect: "/plan/planList",
|
||||
path: '/plan',
|
||||
name: 'plan',
|
||||
redirect: '/plan/planList',
|
||||
children: [
|
||||
{
|
||||
path: "/plan/planList",
|
||||
name: "planList",
|
||||
component: () => import("@/views/plan/planList/index.vue"),
|
||||
meta: {
|
||||
title: "检测计划列表",
|
||||
icon: "List",
|
||||
isLink: "",
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: true,//缓存改成true
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/plan/singlePlanList",
|
||||
name: "singlePlanList",
|
||||
component: () => import("@/views/plan/singlePlanList/index.vue"),
|
||||
meta: {
|
||||
title: "单个计划列表",
|
||||
icon: "List",
|
||||
isLink: "",
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/plan/preTest",
|
||||
name: "preTest",
|
||||
component: () => import("@/views/plan/preTest/index.vue"),
|
||||
meta: {
|
||||
title: "预检测",
|
||||
icon: "List",
|
||||
isLink: "",
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/plan/autoTest",
|
||||
name: "autoTest",
|
||||
component: () => import("@/views/plan/autoTest/index.vue"),
|
||||
meta: {
|
||||
title: "自动检测",
|
||||
icon: "List",
|
||||
isLink: "",
|
||||
hideTab:true,
|
||||
parentPath:'/system/proTable',
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: true,
|
||||
},
|
||||
},
|
||||
// {
|
||||
// path: "/plan/planList",
|
||||
// name: "planList",
|
||||
// component: () => import("@/views/plan/planList/index.vue"),
|
||||
// meta: {
|
||||
// title: "检测计划列表",
|
||||
// icon: "List",
|
||||
// isLink: "",
|
||||
// isHide: false,
|
||||
// isFull: false,
|
||||
// isAffix: false,
|
||||
// isKeepAlive: true,//缓存改成true
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: "/plan/singlePlanList",
|
||||
// name: "singlePlanList",
|
||||
// component: () => import("@/views/plan/singlePlanList/index.vue"),
|
||||
// meta: {
|
||||
// title: "单个计划列表",
|
||||
// icon: "List",
|
||||
// isLink: "",
|
||||
// isHide: false,
|
||||
// isFull: false,
|
||||
// isAffix: false,
|
||||
// isKeepAlive: true,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: "/plan/preTest",
|
||||
// name: "preTest",
|
||||
// component: () => import("@/views/plan/preTest/index.vue"),
|
||||
// meta: {
|
||||
// title: "预检测",
|
||||
// icon: "List",
|
||||
// isLink: "",
|
||||
// isHide: false,
|
||||
// isFull: false,
|
||||
// isAffix: false,
|
||||
// isKeepAlive: false,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: "/plan/autoTest",
|
||||
// name: "autoTest",
|
||||
// component: () => import("@/views/plan/autoTest/index.vue"),
|
||||
// meta: {
|
||||
// title: "自动检测",
|
||||
// icon: "List",
|
||||
// isLink: "",
|
||||
// hideTab:true,
|
||||
// parentPath:'/system/proTable',
|
||||
// isHide: false,
|
||||
// isFull: false,
|
||||
// isAffix: false,
|
||||
// isKeepAlive: true,
|
||||
// },
|
||||
// },
|
||||
|
||||
// 错误页面路由
|
||||
{
|
||||
path: "/403",
|
||||
name: "403",
|
||||
component: () => import("@/components/ErrorMessage/403.vue"),
|
||||
path: '/403',
|
||||
name: '403',
|
||||
component: () => import('@/components/ErrorMessage/403.vue'),
|
||||
meta: {
|
||||
title: "403页面",
|
||||
},
|
||||
title: '403页面'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/404",
|
||||
name: "404",
|
||||
component: () => import("@/components/ErrorMessage/404.vue"),
|
||||
path: '/404',
|
||||
name: '404',
|
||||
component: () => import('@/components/ErrorMessage/404.vue'),
|
||||
meta: {
|
||||
title: "404页面",
|
||||
},
|
||||
title: '404页面'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/500",
|
||||
name: "500",
|
||||
component: () => import("@/components/ErrorMessage/500.vue"),
|
||||
path: '/500',
|
||||
name: '500',
|
||||
component: () => import('@/components/ErrorMessage/500.vue'),
|
||||
meta: {
|
||||
title: "500页面",
|
||||
},
|
||||
title: '500页面'
|
||||
}
|
||||
},
|
||||
// Resolve refresh page, route warnings
|
||||
{
|
||||
path: "/:pathMatch(.*)*",
|
||||
component: () => import("@/components/ErrorMessage/404.vue"),
|
||||
},
|
||||
],
|
||||
path: '/:pathMatch(.*)*',
|
||||
component: () => import('@/components/ErrorMessage/404.vue')
|
||||
}
|
||||
],
|
||||
]
|
||||
},
|
||||
];
|
||||
{
|
||||
path: '/machine/testScriptAdd',
|
||||
name: 'testScriptAdd',
|
||||
component: () => import('@/views/machine/testScript/components/testScriptPopup.vue'),
|
||||
meta: {
|
||||
title: '检测脚本配置',
|
||||
icon: 'List',
|
||||
isLink: '',
|
||||
hideTab: true,
|
||||
parentPath: '/machine/testScript',
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -27,8 +27,10 @@ export interface GlobalState {
|
||||
|
||||
/* UserState */
|
||||
export interface UserState {
|
||||
token: string;
|
||||
userInfo: { name: string };
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
isRefreshToken: boolean;
|
||||
userInfo: { id: string, name: string };
|
||||
}
|
||||
|
||||
/* tabsMenuProps */
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import {defineStore} from "pinia";
|
||||
import {CHECK_STORE_KEY} from "@/stores/constant";
|
||||
import type {CheckData} from "@/api/check/interface";
|
||||
import type {Plan} from '@/api/plan/interface'
|
||||
import {useAppSceneStore} from "@/stores/modules/mode";
|
||||
|
||||
|
||||
const AppSceneStore = useAppSceneStore()
|
||||
export const useCheckStore = defineStore("check", {
|
||||
id: CHECK_STORE_KEY,
|
||||
|
||||
state: () => ({
|
||||
devices: Array<CheckData.Device>(),
|
||||
planId: String(""),
|
||||
planCode: String(""),
|
||||
scriptId: String(""),
|
||||
errorSysId: String(""),
|
||||
plan: Object<Plan.ResPlan>(),
|
||||
selectTestItems: Object<CheckData.SelectTestItem>({preTest: true, timeTest: true, channelsTest: false, test: true}),
|
||||
checkType:1, // 0:手动检测 1:自动检测
|
||||
reCheckType: 1, // 0:不合格项复检 1:全部复检
|
||||
showDetailType: 0 // 0:数据查询 1:误差体系跟换 2:正式检测
|
||||
}),
|
||||
|
||||
getters: {},
|
||||
@@ -20,25 +23,32 @@ export const useCheckStore = defineStore("check", {
|
||||
addDevices(device: CheckData.Device[]) {
|
||||
this.devices.push(...device);
|
||||
},
|
||||
|
||||
setPlan(plan: Plan.ResPlan) {
|
||||
this.plan = plan
|
||||
},
|
||||
clearDevices() {
|
||||
this.devices = [];
|
||||
},
|
||||
|
||||
setPlanId(planId: string) {
|
||||
this.planId = planId
|
||||
initSelectTestItems() {
|
||||
this.selectTestItems.preTest = true
|
||||
if (AppSceneStore.currentScene === '1') {
|
||||
this.selectTestItems.channelsTest = true
|
||||
} else {
|
||||
this.selectTestItems.timeTest = true
|
||||
}
|
||||
this.selectTestItems.test = true
|
||||
},
|
||||
|
||||
setPlanCode(planCode: string) {
|
||||
this.planCode = planCode
|
||||
setSelectTestItems(selectTestItems: CheckData.SelectTestItem) {
|
||||
this.selectTestItems = selectTestItems
|
||||
},
|
||||
|
||||
setScriptId(scriptId: string) {
|
||||
this.scriptId = scriptId
|
||||
setCheckType(checkType: number) {
|
||||
this.checkType = checkType
|
||||
},
|
||||
|
||||
setErrorSysId(errorSysId: string) {
|
||||
this.errorSysId = errorSysId
|
||||
setReCheckType(reCheckType: number) {
|
||||
this.reCheckType = reCheckType
|
||||
},
|
||||
setShowDetailType(showDetailType: number) {
|
||||
this.showDetailType = showDetailType
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { GlobalState } from "@/stores/interface";
|
||||
import { DEFAULT_PRIMARY } from "@/config";
|
||||
import { DEFAULT_PRIMARY} from "@/config";
|
||||
import piniaPersistConfig from "@/stores/helper/persist";
|
||||
import {GLOBAL_STORE_KEY} from "@/stores/constant";
|
||||
|
||||
@@ -31,7 +31,7 @@ export const useGlobalStore = defineStore({
|
||||
// 折叠菜单
|
||||
isCollapse: false,
|
||||
// 菜单手风琴
|
||||
accordion: true,
|
||||
accordion: false,
|
||||
// 面包屑导航
|
||||
breadcrumb: true,
|
||||
// 面包屑导航图标
|
||||
@@ -42,12 +42,14 @@ export const useGlobalStore = defineStore({
|
||||
tabsIcon: true,
|
||||
// 页脚
|
||||
footer: false
|
||||
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
// Set GlobalState
|
||||
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
|
||||
this.$patch({ [args[0]]: args[1] });
|
||||
console.log(DEFAULT_PRIMARY);
|
||||
}
|
||||
},
|
||||
persist: piniaPersistConfig(GLOBAL_STORE_KEY)
|
||||
|
||||
@@ -8,7 +8,8 @@ export const useUserStore = defineStore({
|
||||
state: (): UserState => ({
|
||||
accessToken: "",
|
||||
refreshToken: "",
|
||||
userInfo: { name: "admin" },
|
||||
isRefreshToken:false,
|
||||
userInfo: {id:"", name: "admin" },
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
@@ -19,10 +20,13 @@ export const useUserStore = defineStore({
|
||||
setRefreshToken(refreshToken: string) {
|
||||
this.refreshToken = refreshToken;
|
||||
},
|
||||
setIsRefreshToken(isRefreshToken: boolean) {
|
||||
this.isRefreshToken = isRefreshToken;
|
||||
},
|
||||
// Set setUserInfo
|
||||
setUserInfo(userInfo: UserState["userInfo"]) {
|
||||
this.userInfo = userInfo;
|
||||
},
|
||||
}
|
||||
},
|
||||
persist: piniaPersistConfig(USER_STORE_KEY),
|
||||
});
|
||||
|
||||
@@ -578,6 +578,26 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.form-four {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
// justify-content: space-between;
|
||||
.el-form-item {
|
||||
display: flex;
|
||||
width: 24%;
|
||||
|
||||
.el-form-item__content {
|
||||
flex: 1;
|
||||
|
||||
.el-select,
|
||||
.el-cascader,
|
||||
.el-input__inner,
|
||||
.el-date-editor {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.el-table__cell {
|
||||
border-right: 1px solid #ebeef5 !important;
|
||||
|
||||
@@ -37,6 +37,7 @@ export function rgbToHex(r: any, g: any, b: any) {
|
||||
* @returns {String} 返回处理后的颜色值
|
||||
*/
|
||||
export function getDarkColor(color: string, level: number) {
|
||||
|
||||
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
||||
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
||||
let rgb = hexToRgb(color);
|
||||
@@ -51,6 +52,7 @@ export function getDarkColor(color: string, level: number) {
|
||||
* @returns {String} 返回处理后的颜色值
|
||||
*/
|
||||
export function getLightColor(color: string, level: number) {
|
||||
|
||||
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
||||
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
||||
let rgb = hexToRgb(color);
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export default class SocketService {
|
||||
static instance = null;
|
||||
static get Instance() {
|
||||
@@ -23,9 +20,10 @@ export default class SocketService {
|
||||
// 重新连接尝试的次数
|
||||
connectRetryCount = 0;
|
||||
work:any;
|
||||
heartbeatTimer;
|
||||
heartbeatInterval = 6000; // 心跳间隔,单位毫秒
|
||||
workerBlobUrl:any;
|
||||
lastActivityTime= 0; // 上次活动时间戳
|
||||
lastResponseHeartTime = Date.now();//最后一次收到心跳回复时间
|
||||
|
||||
reconnectDelay= 5000; // 重新连接延迟,单位毫秒
|
||||
|
||||
// 定义连接服务器的方法
|
||||
@@ -40,7 +38,7 @@ export default class SocketService {
|
||||
// let token = '4E6EF539AAF119D82AC4C2BC84FBA21F';
|
||||
|
||||
|
||||
const url = 'ws://localhost:7777/hello?name=cdf'
|
||||
const url = 'ws://127.0.0.1:7777/hello?name=cdf'
|
||||
this.ws = new WebSocket(url);
|
||||
// 连接成功的事件
|
||||
this.ws.onopen = () => {
|
||||
@@ -55,13 +53,13 @@ export default class SocketService {
|
||||
// 1.连接服务端失败
|
||||
// 2.当连接成功之后, 服务器关闭的情况
|
||||
this.ws.onclose = () => {
|
||||
console.log('连接服务端失败');
|
||||
console.log('连接webSocket服务端关闭');
|
||||
this.connected = false;
|
||||
this.connectRetryCount++;
|
||||
this.clearHeartbeat();
|
||||
setTimeout(() => {
|
||||
// this.connect();
|
||||
}, 500 * this.connectRetryCount);
|
||||
/* setTimeout(() => {
|
||||
this.connect();
|
||||
}, 500 * this.connectRetryCount);*/
|
||||
|
||||
|
||||
};
|
||||
@@ -72,18 +70,23 @@ export default class SocketService {
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 得到服务端发送过来的数据
|
||||
this.ws.onmessage = (event) => {
|
||||
// console.log('🚀 ~ SocketService ~ connect ~ event:', event)
|
||||
if(event.data == 'over') {
|
||||
//心跳消息处理
|
||||
this.lastResponseHeartTime = Date.now();
|
||||
this.updateLastActivityTime(); // 收到心跳响应时更新活动时间
|
||||
}else {
|
||||
let message: { [key: string]: any };
|
||||
|
||||
|
||||
try {
|
||||
console.log('Received message:',event.data)
|
||||
message = JSON.parse(event.data);
|
||||
} catch (e) {
|
||||
return console.error("消息解析失败", event.data, e);
|
||||
}
|
||||
//console.log(message, "从服务端获取到了数据");
|
||||
|
||||
/* 通过接受服务端发送的type字段来回调函数 */
|
||||
if (message?.type && this.callBackMapping[message.type]) {
|
||||
this.callBackMapping[message.type](message);
|
||||
@@ -92,6 +95,9 @@ export default class SocketService {
|
||||
console.log(event.data)
|
||||
/* 丢弃或继续写你的逻辑 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -100,25 +106,26 @@ export default class SocketService {
|
||||
|
||||
|
||||
startHeartbeat() {
|
||||
let _this = this
|
||||
var url = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},3000)})()']));
|
||||
this.work = new Worker(url)
|
||||
this.lastResponseHeartTime = Date.now();
|
||||
const _this = this
|
||||
_this.workerBlobUrl = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},9000)})()']));
|
||||
|
||||
this.work = new Worker(_this.workerBlobUrl);
|
||||
this.work.onmessage = function(e){
|
||||
if ((Date.now() - _this.lastActivityTime) > _this.heartbeatInterval) {
|
||||
// 如果超过心跳间隔没有活动,发送心跳消息
|
||||
//判断多久没收到心跳响应
|
||||
|
||||
if(_this.lastActivityTime - _this.lastResponseHeartTime > 30000){
|
||||
//说明已经三轮心跳没收到回复了,关闭检测,提示用户。
|
||||
ElMessage.error("业务主体模块发生未知异常,请尝试重新启动!");
|
||||
_this.clearHeartbeat();
|
||||
return;
|
||||
}
|
||||
_this.sendHeartbeat();
|
||||
}
|
||||
|
||||
}
|
||||
// this.heartbeatTimer = setInterval(() => {
|
||||
// if ((Date.now() - this.lastActivityTime) > this.heartbeatInterval) {
|
||||
// // 如果超过心跳间隔没有活动,发送心跳消息
|
||||
// this.sendHeartbeat();
|
||||
// }
|
||||
// }, this.heartbeatInterval/2); // 每半个心跳间隔检查一次
|
||||
}
|
||||
sendHeartbeat() {
|
||||
console.log("进入心跳消息发送。。。。。。。。。。。。。")
|
||||
console.log(new Date()+"进入心跳消息发送。。。。。。。。。。。。。")
|
||||
this.ws.send('alive');
|
||||
this.updateLastActivityTime(); // 发送心跳后更新活动时间
|
||||
}
|
||||
@@ -129,11 +136,14 @@ export default class SocketService {
|
||||
}
|
||||
|
||||
clearHeartbeat() {
|
||||
this.work.terminate();
|
||||
if (this.heartbeatTimer) {
|
||||
|
||||
clearInterval(this.heartbeatTimer);
|
||||
this.heartbeatTimer = null;
|
||||
const _this = this
|
||||
if (_this.work) {
|
||||
_this.work.terminate();
|
||||
_this.work = null;
|
||||
}
|
||||
if (_this.workerBlobUrl) {
|
||||
window.URL.revokeObjectURL(_this.workerBlobUrl); // 释放临时的Blob URL
|
||||
_this.workerBlobUrl = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +180,6 @@ export default class SocketService {
|
||||
if (this.connected) {
|
||||
this.ws.close()
|
||||
}
|
||||
console.log('WS关闭中..');
|
||||
console.log('执行WS关闭命令..');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<!-- :requestApi="getRoleList" -->
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader='scope'>
|
||||
<el-button v-auth.role="'add'" type='primary' :icon='CirclePlus' @click="openDrawer('新增角色')">新增</el-button>
|
||||
<el-button v-auth.role="'add'" type='primary' :icon='CirclePlus' @click="openDrawer('add')">新增</el-button>
|
||||
<el-button v-auth.role="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||
@click='batchDelete(scope.selectedListIds)'>
|
||||
删除
|
||||
@@ -16,7 +16,7 @@
|
||||
</template>
|
||||
<!-- 表格操作 -->
|
||||
<template #operation='scope'>
|
||||
<el-button v-auth.role="'edit'" type='primary' link :icon='EditPen' @click="openDrawer('编辑角色', scope.row)">编辑</el-button>
|
||||
<el-button v-auth.role="'edit'" type='primary' link :icon='EditPen' @click="openDrawer('edit', scope.row)">编辑</el-button>
|
||||
<el-button v-auth.role="'delete'" v-if="scope.row.type !== 0 && scope.row.type !== 1" type='primary' link :icon='Delete' @click='deleteAccount(scope.row)'>删除</el-button>
|
||||
<el-button v-auth.role="'SetPermissions'" type='primary' link :icon='Share' @click="openDrawer('设置权限', scope.row)">设置权限</el-button>
|
||||
</template>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<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 style="color: #91cc75">{{ qualified }}</span> 台/共 <span style="color: green">{{ total }}</span>
|
||||
台
|
||||
</span>
|
||||
<!-- <el-button type="primary" loading
|
||||
@@ -98,6 +98,9 @@ import { getCoefficientCheck } from '@/api/home/channelsTest/index'
|
||||
import type { ChannelsTest } from '@/api/home/interface/channelsTest';
|
||||
import type { Plan } from '@/api/plan/interface';
|
||||
import { fa } from 'element-plus/es/locale';
|
||||
import {useUserStore} from "@/stores/modules/user";
|
||||
|
||||
|
||||
const activeIndex = ref(0)
|
||||
const activeTotalNum = ref(4)
|
||||
const qualified = ref(0)
|
||||
@@ -136,7 +139,7 @@ const props = defineProps({
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
|
||||
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||
const webMsgSend = toRef(props, 'webMsgSend');
|
||||
@@ -726,7 +729,10 @@ const updateErrorState = (index: number, hasError: boolean) => {
|
||||
(e: 'submitClicked', callback: (resolve: (value: boolean) => void) => void): void;
|
||||
}>();
|
||||
|
||||
|
||||
const handleCancel=() => {
|
||||
|
||||
//dataSocket.socketServe.closeWs()
|
||||
// 清空 name, channel, total
|
||||
name.value = [];
|
||||
channel.value = [];
|
||||
@@ -782,9 +788,10 @@ const handleSubmit = async () => {
|
||||
userPageId: "cdf",
|
||||
devIds:devIdArray.value,
|
||||
planId:planId.value,
|
||||
errorSysId: select_Plan.value?.errorSysId,
|
||||
scriptId: select_Plan.value?.scriptId,
|
||||
operateType:'0' // '0'为预检测、‘1‘为正式检测
|
||||
errorSysId:select_Plan.value?.errorSysId,
|
||||
scriptId:select_Plan.value?.scriptId,
|
||||
operateType:'0', // '0'为预检测、‘1‘为正式检测
|
||||
userId:userStore.userInfo.id
|
||||
})
|
||||
active.value++;
|
||||
|
||||
|
||||
@@ -38,13 +38,13 @@
|
||||
<!-- <el-button type="primary" loading v-if="activeIndex > 0 && activeIndex < activeTotalNum">合格92项/共103项</el-button>
|
||||
<el-button type="primary" v-if="activeIndex >= activeTotalNum" disabled>合格92项/共103项</el-button> -->
|
||||
<span style=" font-size: 18px;font-weight: 600;">
|
||||
数据已合格 <span style="color: #67C23A">{{ qualified }}</span> 项/共 <span style="color: green">{{ 103 }}</span>
|
||||
数据已合格 <span style="color: #91cc75">{{ qualified }}</span> 项/共 <span style="color: green">{{ 103 }}</span>
|
||||
项
|
||||
</span>
|
||||
</div>
|
||||
<div class="dialog-content">
|
||||
<el-table :data="tableData" :cell-class-name="tableCell" row-key="id" height="450px"
|
||||
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' }" style="width: 100%"
|
||||
:header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' }" style="width: 100%"
|
||||
border>
|
||||
<el-table-column fixed prop="scriptItemName" label="检测项目" width="210px" />
|
||||
<el-table-column label="被检通道1" :min-width="minwidth" align="center">
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
v-model="scriptSwitch"
|
||||
class="ml-2"
|
||||
inline-prompt
|
||||
style="--el-switch-on-color: #003078; --el-switch-off-color: #5a79a9"
|
||||
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #5a79a9"
|
||||
active-text="不合格测试项"
|
||||
inactive-text="全部测试项"
|
||||
/> -->
|
||||
|
||||
@@ -10,52 +10,55 @@
|
||||
<!-- </el-table-column>-->
|
||||
<template v-if="phaseT === 0">
|
||||
<el-table-column label="A相">
|
||||
<el-table-column prop="stdA" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataA" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="stdA" width="105" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataA" width="105" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataA" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围:{{ scope.row.maxErrorA }} <br/>
|
||||
误差值:{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }}
|
||||
误差值:{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? innerUnitA : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataA === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="B相">
|
||||
<el-table-column prop="stdB" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataB" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="stdB" width="105" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataB" width="105" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataB" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围:{{ scope.row.maxErrorB }}<br/>
|
||||
误差值:{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }}
|
||||
误差值:{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? innerUnitB : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataB === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="C相">
|
||||
<el-table-column prop="stdC" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataC" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="stdC" width="105" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataC" width="105" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataC" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围: {{ scope.row.maxErrorC }}<br/>
|
||||
误差值:{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }}
|
||||
误差值:{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? innerUnitC : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataC === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -64,18 +67,19 @@
|
||||
|
||||
<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="stdT" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataT" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataT" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围: {{ scope.row.maxErrorT }}<br/>
|
||||
误差值:{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }}
|
||||
误差值:{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? innerUnitT : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataT === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataT === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -105,10 +109,23 @@ const {tableData, currentScriptTypeName} = defineProps<{
|
||||
}>();
|
||||
|
||||
|
||||
const unit = computed(() => {
|
||||
const outerUnit = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unit : '';
|
||||
})
|
||||
|
||||
const innerUnitA = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitA : '';
|
||||
})
|
||||
const innerUnitB = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitB : '';
|
||||
})
|
||||
const innerUnitC = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitC : '';
|
||||
})
|
||||
const innerUnitT = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitT : '';
|
||||
})
|
||||
|
||||
const phaseT = computed(() => {
|
||||
return tableData[0].dataT == null || tableData[0].dataT == undefined ? 0 : 1
|
||||
})
|
||||
@@ -125,7 +142,7 @@ const tableHeader = computed(() => {
|
||||
// let result = tableData[0].maxError ?? '/'
|
||||
// let idx = result.indexOf('~');
|
||||
// if (idx > 0) {
|
||||
// result = result.substring(0, idx) + unit.value + result.substring(idx, result.length) + unit.value;
|
||||
// result = result.substring(0, idx) + outerUnit.value + result.substring(idx, result.length) + outerUnit.value;
|
||||
// }
|
||||
// return result;
|
||||
// })
|
||||
|
||||
@@ -8,7 +8,14 @@
|
||||
<el-input v-model='formContent.scriptName' :disabled="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="误差体系">
|
||||
<el-input v-model='formContent.errorSysName' :disabled="true"/>
|
||||
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="checkStore.showDetailType===0"
|
||||
@change="handleErrorSysChange">
|
||||
<el-option
|
||||
v-for="(option) in pqErrorList"
|
||||
:key="option.id"
|
||||
:label="option.name"
|
||||
:value="option.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据原则">
|
||||
<el-input v-model='formContent.dataRule' :disabled="true"/>
|
||||
@@ -21,6 +28,12 @@
|
||||
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="checkStore.showDetailType===1">
|
||||
<el-button type="primary" :icon="Postcard" @click="handleGenerateReport">报告生成</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="checkStore.showDetailType===0">
|
||||
<el-button type="primary" :icon="Histogram" @click="handleReCalculate">重新计算</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
@@ -98,9 +111,12 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
||||
import {CheckData} from "@/api/check/interface";
|
||||
import {useDictStore} from "@/stores/modules/dict";
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {getFormData, getTreeData, getTableData} from "@/api/check/test";
|
||||
import {changeErrorSystem, deleteTempTable, exportRawData, getFormData, getTableData, getTreeData, reCalculate} from "@/api/check/test";
|
||||
import {getPqErrSysList} from '@/api/plan/plan'
|
||||
import {useDownload} from "@/hooks/useDownload";
|
||||
import {exportRawData} from "@/api/check/test"
|
||||
import {Histogram, Postcard} from "@element-plus/icons-vue";
|
||||
import {ResultEnum} from "@/enums/httpEnum";
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
const {appendToBody} = withDefaults(defineProps<{
|
||||
appendToBody: boolean
|
||||
@@ -117,6 +133,7 @@ const checkStore = useCheckStore()
|
||||
const visible = ref(false)
|
||||
const treeRef = ref()
|
||||
const searchValue = ref<string>('')
|
||||
const pqErrorList = reactive<{ id: string; name: string; }[]>([])
|
||||
watch(searchValue, (val) => {
|
||||
treeRef.value!.filter(val)
|
||||
})
|
||||
@@ -127,13 +144,14 @@ const fixed = 4;
|
||||
// 表单数据
|
||||
const formContent = reactive<CheckData.DataCheck>({
|
||||
scriptName: '',
|
||||
errorSysName: '',
|
||||
errorSysId: '',
|
||||
dataRule: '',
|
||||
deviceName: '',
|
||||
chnNum: '',
|
||||
})
|
||||
// 当前选中的谐波次数
|
||||
// const currentHarmNum = ref<string>("-1")
|
||||
// 原始误差体系id
|
||||
let originErrorSysId: string = ''
|
||||
let planCode: string = ''
|
||||
// 谐波次数列表
|
||||
// const harmNumList = reactive<{ value: string, label: string }[]>([])
|
||||
// 当前选中的检测项
|
||||
@@ -193,24 +211,56 @@ const handleNodeClick = async (data: any) => {
|
||||
currentDesc.value = data.sourceDesc
|
||||
scriptType = data.scriptType ?? scriptType
|
||||
|
||||
if (checkIndex.value) {
|
||||
console.log("点击左侧树节点触发事件handleNodeClick", checkIndex.value)
|
||||
if (checkIndex.value !== '') {
|
||||
await updateTableData()
|
||||
activeTab.value = 'resultTab'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleErrorSysChange = async () => {
|
||||
console.log("切换误差体系", formContent.errorSysId);
|
||||
changeErrorSystem({
|
||||
planId: checkStore.plan.id,
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
errorSysId: formContent.errorSysId,
|
||||
deviceId: deviceId,
|
||||
code: checkStore.plan.code + '',
|
||||
}).then((res) => {
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
ElMessage.success('切换误差体系成功')
|
||||
if (originErrorSysId != formContent.errorSysId) {
|
||||
planCode = checkStore.plan.code + "_temp"
|
||||
} else {
|
||||
planCode = checkStore.plan.code + ''
|
||||
}
|
||||
if (formContent.chnNum != chnList[0].value) {
|
||||
formContent.chnNum = chnList[0].value
|
||||
} else {
|
||||
handleChnNumChange()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||
// console.log("通道号", newVal);
|
||||
if (newVal != '') {
|
||||
handleChnNumChange()
|
||||
}
|
||||
})
|
||||
|
||||
if (newVal) {
|
||||
const handleChnNumChange = async () => {
|
||||
console.log("通道号", formContent.chnNum);
|
||||
// 发起请求,查询该测试项的检测结果
|
||||
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
|
||||
scriptId: checkStore.scriptId,
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
devId: deviceId,
|
||||
devNum: formContent.chnNum + '',
|
||||
scriptType: originScriptType,
|
||||
code: parseInt(checkStore.planCode)
|
||||
code: planCode
|
||||
})
|
||||
updateTreeFly(resTreeDataTemp, 4)
|
||||
updateTreeFly(resTreeDataTemp, 2)
|
||||
@@ -221,9 +271,9 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||
|
||||
defaultOperate()
|
||||
await updateTableData()
|
||||
}
|
||||
activeTab.value = 'resultTab'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// watch(currentHarmNum, (newVal, oldVal) => {
|
||||
// console.log("谐波次数", newVal);
|
||||
@@ -244,7 +294,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||
|
||||
watch(currentCheckItem, (newVal, oldVal) => {
|
||||
console.log("当前检测项", newVal);
|
||||
if (newVal) {
|
||||
if (newVal !== '') {
|
||||
doCurrentCheckItemUpdate(newVal)
|
||||
} else {
|
||||
activeTab.value = 'resultTab'
|
||||
@@ -272,16 +322,16 @@ const defaultOperate = () => {
|
||||
}
|
||||
|
||||
const updateTableData = async () => {
|
||||
// console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
||||
if (checkIndex.value) {
|
||||
console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
||||
if (checkIndex.value !== '') {
|
||||
// console.log("更新表格数据");
|
||||
// 发起请求,查询该测试项的检测结果
|
||||
const {data} = await getTableData({
|
||||
scriptType,
|
||||
scriptId: checkStore.scriptId,
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
devId: deviceId,
|
||||
devNum: formContent.chnNum + '',
|
||||
code: parseInt(checkStore.planCode),
|
||||
code: planCode,
|
||||
index: parseInt(checkIndex.value),
|
||||
})
|
||||
|
||||
@@ -321,14 +371,20 @@ const updateTableData = async () => {
|
||||
setCheckResultData(resCheckResult)
|
||||
setRawData(resRawData)
|
||||
checkList.length = 0
|
||||
currentCheckItem.value = ''
|
||||
let key = formatHarmNum(keys1[0])
|
||||
checkList.push({value: keys1[0], label: resCheckResult.isData === 1 ? `${key}` : resCheckResult.isData === 4 ? `${key}(/)` : resCheckResult.isData === 5? `${key}(-)`:`${key}(不符合)`})
|
||||
if (currentCheckItem.value == checkList[0].value) {
|
||||
doCurrentCheckItemUpdate(checkList[0].value)
|
||||
} else {
|
||||
currentCheckItem.value = checkList[0].value
|
||||
}
|
||||
} else if (keys1.length != 0) {
|
||||
let tempCheckList = []
|
||||
for (let [key, value] of resTableData.resultData) {
|
||||
let hum = formatHarmNum(key)
|
||||
tempCheckList.push({
|
||||
value: key,
|
||||
label: value.isData === 1 ? hum : value.isData === 4 ? `${hum}(/)` : `${hum}(不符合)`
|
||||
label: value.isData === 1 ? `${hum}`: value.isData === 4 ? `${hum}(/)` : value.isData === 5? `${hum}(-)`:`${hum}(不符合)`
|
||||
})
|
||||
}
|
||||
|
||||
@@ -366,13 +422,14 @@ const doCurrentCheckItemUpdate = (newVal: string) => {
|
||||
}
|
||||
|
||||
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
|
||||
planCode = checkStore.plan.code + ''
|
||||
deviceId = _deviceId
|
||||
originScriptType = _scriptType
|
||||
scriptType = _scriptType
|
||||
|
||||
// 发起后端请求,查询详细信息 当chnNum为-1时,查询所有通道号
|
||||
const {data: resFormContent}: { data: any } = await getFormData({
|
||||
planId: checkStore.planId,
|
||||
planId: checkStore.plan.id,
|
||||
deviceId,
|
||||
chnNum,
|
||||
scriptType
|
||||
@@ -380,8 +437,8 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
|
||||
|
||||
chnList = resFormContent.chnList.map((item: { value: string, label: string }) => ({
|
||||
value: item.value,
|
||||
// label: item.value
|
||||
label: item.label == '1' ? `${item.value}` : item.label == '2' ? `${item.value}(不符合)` : `${item.value}`
|
||||
label: item.value
|
||||
//label: item.label == '1' ? `${item.value}` : item.label == '2' ? `${item.value}(不符合)` : `${item.value}`
|
||||
}))
|
||||
|
||||
let dataRuleName = dictStore.getDictData('Data_Rule').find(item => item.id == resFormContent.dataRule)?.name
|
||||
@@ -391,12 +448,42 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
|
||||
dataRule: dataRuleName,
|
||||
chnNum: chnList.length > 0 ? chnList[0].value : '',
|
||||
})
|
||||
originErrorSysId = formContent.errorSysId
|
||||
|
||||
pqErrorList.length = 0
|
||||
let {data: resPqErrorList} = await getPqErrSysList()
|
||||
Object.assign(pqErrorList, resPqErrorList)
|
||||
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
const handleGenerateReport = () => {
|
||||
console.log("生成报告", checkStore.plan.id, deviceId)
|
||||
}
|
||||
|
||||
const handleReCalculate = async () => {
|
||||
reCalculate({
|
||||
planId: checkStore.plan.id,
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
errorSysId: formContent.errorSysId,
|
||||
deviceId: deviceId,
|
||||
code: checkStore.plan.code + ''
|
||||
}).then((res) => {
|
||||
ElMessage.success('重新计算成功!')
|
||||
// if (originErrorSysId != formContent.errorSysId) {
|
||||
// planCode = checkStore.plan.code + "_temp"
|
||||
// } else {
|
||||
// planCode = checkStore.plan.code + ''
|
||||
// }
|
||||
if (formContent.chnNum != chnList[0].value) {
|
||||
formContent.chnNum = chnList[0].value
|
||||
} else {
|
||||
handleChnNumChange()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const close = async () => {
|
||||
//数据清空
|
||||
Object.assign(formContent, {
|
||||
scriptName: '',
|
||||
@@ -417,8 +504,14 @@ const close = () => {
|
||||
activeTab.value = 'resultTab'
|
||||
currentScriptTypeName.value = ''
|
||||
currentDesc.value = ''
|
||||
pqErrorList.length = 0
|
||||
planCode = ''
|
||||
|
||||
visible.value = false;
|
||||
|
||||
if (checkStore.showDetailType === 1) {
|
||||
await deleteTempTable(checkStore.plan.code + '')
|
||||
}
|
||||
};
|
||||
|
||||
const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||
@@ -432,19 +525,22 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||
result.push({
|
||||
stdA: numberToFixed(data.dataA.resultData),
|
||||
dataA: numberToFixed(data.dataA.data),
|
||||
errorA: getError(data.dataA.resultData, data.dataA.data),
|
||||
maxErrorA: toMaxErrorStr(data.dataA.radius, data.unit),
|
||||
errorA: numberToFixed(data.dataA.errorData),
|
||||
maxErrorA: toMaxErrorStr(data.dataA.radius, data.dataA.unit),
|
||||
unitA: data.dataA.unit,
|
||||
isDataA: data.dataA.isData,
|
||||
stdB: numberToFixed(data.dataB.resultData),
|
||||
dataB: numberToFixed(data.dataB.data),
|
||||
errorB: getError(data.dataB.resultData, data.dataB.data),
|
||||
maxErrorB: toMaxErrorStr(data.dataB.radius, data.unit),
|
||||
errorB: numberToFixed(data.dataB.errorData),
|
||||
maxErrorB: toMaxErrorStr(data.dataB.radius, data.dataB.unit),
|
||||
isDataB: data.dataB.isData,
|
||||
unitB: data.dataB.unit,
|
||||
stdC: numberToFixed(data.dataC.resultData),
|
||||
dataC: numberToFixed(data.dataC.data),
|
||||
errorC: getError(data.dataC.resultData, data.dataC.data),
|
||||
maxErrorC: toMaxErrorStr(data.dataC.radius, data.unit),
|
||||
errorC: numberToFixed(data.dataC.errorData),
|
||||
maxErrorC: toMaxErrorStr(data.dataC.radius, data.dataC.unit),
|
||||
isDataC: data.dataC.isData,
|
||||
unitC: data.dataC.unit,
|
||||
|
||||
maxError: data.radius,
|
||||
unit: data.unit,
|
||||
@@ -456,9 +552,10 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||
result.push({
|
||||
stdT: numberToFixed(data.dataT.resultData),
|
||||
dataT: numberToFixed(data.dataT.data),
|
||||
errorT: getError(data.dataT.resultData, data.dataT.data),
|
||||
maxErrorT: toMaxErrorStr(data.dataT.radius, data.unit),
|
||||
errorT: numberToFixed(data.dataT.errorData),
|
||||
maxErrorT: toMaxErrorStr(data.dataT.radius, data.dataT.unit),
|
||||
isDataT: data.dataT?.isData,
|
||||
unitT: data.dataT.unit,
|
||||
|
||||
maxError: data.radius,
|
||||
unit: data.unit,
|
||||
@@ -471,10 +568,10 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||
const exportRawDataHandler = () => {
|
||||
useDownload(exportRawData, '原始数据.xlsx', {
|
||||
scriptType,
|
||||
scriptId: checkStore.scriptId,
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
devId: deviceId,
|
||||
devNum: formContent.chnNum + '',
|
||||
code: parseInt(checkStore.planCode),
|
||||
code: checkStore.plan.code + '',
|
||||
index: parseInt(checkIndex.value),
|
||||
}, false, '.xlsx')
|
||||
}
|
||||
@@ -496,6 +593,7 @@ const setRawData = (data: CheckData.RawDataItem[]) => {
|
||||
item.dataC = stringToFixed(item.dataC)
|
||||
item.dataT = stringToFixed(item.dataT)
|
||||
})
|
||||
rawTableData.length = 0
|
||||
Object.assign(rawTableData, data)
|
||||
console.log("原始数据", rawTableData)
|
||||
}
|
||||
@@ -742,7 +840,7 @@ defineExpose({
|
||||
<!--.el-popover.popover-class {-->
|
||||
<!-- .el-popover__title {-->
|
||||
<!-- color: #fff;-->
|
||||
<!-- background-color: #003078 !important;-->
|
||||
<!-- background-color: var(--el-color-primary) !important;-->
|
||||
<!-- }-->
|
||||
<!--}-->
|
||||
<!--</style>-->
|
||||
816
frontend/src/views/home/components/factorTest.vue
Normal file
816
frontend/src/views/home/components/factorTest.vue
Normal file
@@ -0,0 +1,816 @@
|
||||
<template>
|
||||
<div class="dialog" v-bind="dialogBig">
|
||||
<div class="dialog-content">
|
||||
<div class="right-title">
|
||||
<!-- <div>系数校准表</div> -->
|
||||
<div>{{ outputDsc }}</div>
|
||||
<div>
|
||||
<span style=" font-size: 18px;font-weight: 600;">
|
||||
设备已合格 <span style="color: #91cc75">{{ qualified }}</span> 台/共 <span style="color: green">{{ total }}</span>
|
||||
台
|
||||
</span>
|
||||
<!-- <el-button type="primary" loading
|
||||
v-if="activeIndex > 0 && activeIndex < activeTotalNum">通道系数已校准3台/共3台</el-button>
|
||||
<el-button type="primary" :disabled="true" v-if="activeIndex === activeTotalNum">通道系数已校准3台/共3台</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="dialog-left">
|
||||
<el-steps direction="vertical" :active="active" :process-status="currentStepStatus" finish-status="success">
|
||||
<el-step title="开始"/>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>大电压/电流系数下装</span><br/>
|
||||
<span class="spanStyle">源输出为:</span><br/>
|
||||
<span class="spanStyle" v-if="active > 0">{{ big_V_Download }}</span><br/>
|
||||
<span class="spanStyle" v-if="active > 0">{{ big_I_Download }}</span>
|
||||
<el-icon v-if="active === 1 " class="loading-box">
|
||||
<el-icon-loading/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-step>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>小电压/电流系数下装</span><br/>
|
||||
<span class="spanStyle">源输出为:</span><br/>
|
||||
<span class="spanStyle" v-if="active > 1">{{ small_V_Download }}</span><br/>
|
||||
<span class="spanStyle" v-if="active > 1">{{ small_I_Download }}</span>
|
||||
<el-icon v-if="active === 2" class="loading-box">
|
||||
<el-icon-loading/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-step>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>大电压/电流校准</span><br/>
|
||||
<span class="spanStyle">源输出为:</span><br/>
|
||||
<span class="spanStyle" v-if="active > 2">{{ big_V_Adjust }}</span><br/>
|
||||
<span class="spanStyle" v-if="active > 2">{{ big_I_Adjust }}</span>
|
||||
<el-icon v-if="active === 3" class="loading-box">
|
||||
<el-icon-loading/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-step>
|
||||
<el-step>
|
||||
<template #title>
|
||||
<span>小电压/电流校准</span><br/>
|
||||
<span class="spanStyle">源输出为:</span><br/>
|
||||
<span class="spanStyle" v-if="active > 3">{{ small_V_Adjust }}</span><br/>
|
||||
<span class="spanStyle" v-if="active > 3">{{ small_I_Adjust }}</span>
|
||||
<el-icon v-if="active === 4" class="loading-box">
|
||||
<el-icon-loading/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-step>
|
||||
<el-step title="结束"/>
|
||||
</el-steps>
|
||||
</div>
|
||||
<div class="right-content">
|
||||
<el-tabs type="border-card" v-model="editableTabsValue" :active-index="String(activeIndex)">
|
||||
<el-tab-pane v-for="(device, index) in name" :key="index" :label="device">
|
||||
<template #label>
|
||||
<span class="custom-tabs-label">
|
||||
<span>{{ device }}</span>
|
||||
<el-icon v-if="errorStates[index]" class="icon-style">
|
||||
<Failed/>
|
||||
</el-icon>
|
||||
</span>
|
||||
</template>
|
||||
<channelsTestTable
|
||||
:tableData="getTableDataForChannel(index)"
|
||||
:big_V_loading="big_V_loadingStates"
|
||||
:curV="CurV">
|
||||
</channelsTestTable>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup name="FactorTest">
|
||||
import {type Device} from '@/api/device/interface/device';
|
||||
import {Failed} from '@element-plus/icons-vue'
|
||||
import {onBeforeMount, type Ref, ref, toRef, watch} from 'vue'
|
||||
import {dialogBig} from '@/utils/elementBind'
|
||||
import {ElMessageBox} from 'element-plus';
|
||||
import {getCoefficientCheck} from '@/api/home/channelsTest/index'
|
||||
import type {ChannelsTest} from '@/api/home/interface/channelsTest';
|
||||
import type {Plan} from '@/api/plan/interface';
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {useUserStore} from "@/stores/modules/user";
|
||||
|
||||
const checkStore = useCheckStore()
|
||||
const activeIndex = ref(0)
|
||||
const activeTotalNum = ref(4)
|
||||
const qualified = ref(0)
|
||||
const outputDsc = ref('电压误差为:±0.1Un%; 电流误差为:±0.5%')
|
||||
const total = ref(0)
|
||||
const dialogVisible = ref(false)
|
||||
const active = ref(0)
|
||||
let timer1: NodeJS.Timeout | null = null; // 声明并初始化 timer1
|
||||
let timer2: NodeJS.Timeout | null = null; // 同样声明并初始化 timer2
|
||||
const name = ref<string[]>([])//系数校准所选设备名字数组
|
||||
const channel = ref<number[]>([])//系数校准所选设备通道数组
|
||||
const devIdArray = ref<string[]>([])//系数校准所选设备ID数组
|
||||
const select_Plan = ref<Plan.ReqPlan>()
|
||||
const planId = ref('')
|
||||
const isButtonDisabled = ref(false);
|
||||
const CurV = ref<number>()//额定电压
|
||||
// 在 setup 函数中
|
||||
const errorStates = ref(new Array(name.value.length).fill(false));
|
||||
//const loadingStates = ref(new Array(name.value.length).fill(false)); // 初始化 loading 状态
|
||||
const big_V_loadingStates = ref(false); // 初始化 大电压大电流下装loading 状态
|
||||
const small_V_loadingStates = ref(false); // 初始化 小电压小电流下装loading 状态
|
||||
const big_V_loadingStates2 = ref(false); // 初始化 大电压大电流校准loading 状态
|
||||
const small_V_loadingStates2 = ref(false); // 初始化 小电压小电流校准loading 状态
|
||||
const editableTabsValue = ref('0')
|
||||
const big_V_Download = ref('')
|
||||
const big_I_Download = ref('')
|
||||
const small_V_Download = ref('')
|
||||
const small_I_Download = ref('')
|
||||
const big_V_Adjust = ref('')
|
||||
const big_I_Adjust = ref('')
|
||||
const small_V_Adjust = ref('')
|
||||
const small_I_Adjust = ref('')
|
||||
const props = defineProps({
|
||||
testStatus: {
|
||||
type: String,
|
||||
default: 'wait'
|
||||
},
|
||||
webMsgSend: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
})
|
||||
const userStore = useUserStore()
|
||||
const testStatus = toRef(props, 'testStatus');
|
||||
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
|
||||
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||
const webMsgSend = toRef(props, 'webMsgSend');
|
||||
|
||||
onBeforeMount(() => {
|
||||
// 初始化
|
||||
initData()
|
||||
})
|
||||
const initData = () => {
|
||||
|
||||
CurV.value = checkStore.devices[0]?.devVolt || 57.74;
|
||||
isButtonDisabled.value = false; // 恢复按钮
|
||||
select_Plan.value = checkStore.plan
|
||||
planId.value = checkStore.devices[0]?.planId || '';
|
||||
devIdArray.value = checkStore.devices.map(item => item.deviceId);
|
||||
name.value = checkStore.devices.map(item => item.deviceName)
|
||||
channel.value = checkStore.devices.map(item => item.chnNum)
|
||||
dialogVisible.value = true;
|
||||
total.value = name.value.length
|
||||
|
||||
|
||||
// 初始化 loadingStates 为 false
|
||||
// loadingStates.value = new Array(selection.length).fill(false);
|
||||
errorStates.value = new Array(checkStore.devices.length).fill(false);
|
||||
|
||||
for (let i = 0; i < channel.value.length; i++) {
|
||||
const currentTableData = initializeTableData(dataTemplates, i);
|
||||
tableDataMap.set(i, currentTableData)
|
||||
}
|
||||
//console.log('tableDataMap',tableDataMap);
|
||||
}
|
||||
|
||||
|
||||
watch(testStatus, function (newValue, oldValue) {
|
||||
if (newValue === 'start') {
|
||||
// 开始系数校准操作
|
||||
handleSubmit()
|
||||
}
|
||||
})
|
||||
|
||||
watch(webMsgSend, function (newValue, oldValue) {
|
||||
console.log('webMsgSend---code', newValue.code)
|
||||
console.log('webMsgSend---requestId', newValue.requestId)
|
||||
if (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‘为正式检测
|
||||
userId:userStore.userInfo.id
|
||||
})
|
||||
active.value++;
|
||||
|
||||
console.log('开始检测active.value', active.value)
|
||||
};
|
||||
|
||||
// 提取初始化并填充 currentTableData 的函数
|
||||
const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: number): Ref<ChannelsTest.CoefficientVO[]> => {
|
||||
const currentTableData = ref<ChannelsTest.CoefficientVO[]>([]);
|
||||
for (let j = 0; j < channel.value[index]; j++) {
|
||||
templates.forEach((template) => {
|
||||
// 使用解构赋值排除 id 和 MonitorIdx 属性
|
||||
const {devName, monitorNum: __, ...rest} = template;
|
||||
currentTableData.value.push({
|
||||
monitorNum: (j + 1).toString(),
|
||||
devName: name.value[index],
|
||||
...rest,
|
||||
});
|
||||
});
|
||||
}
|
||||
return currentTableData;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 确保 el-icon-loading 的动画效果没有被覆盖 */
|
||||
.loading-box {
|
||||
animation: rotate 2s linear infinite;
|
||||
font-size: 30px; /* 增大图标的大小 */
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.right-title {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
/* 横向排列 */
|
||||
justify-content: space-between;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.custom-tabs-label .el-icon {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.custom-tabs-label span {
|
||||
vertical-align: middle;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.dialog-content {
|
||||
height: 510px;
|
||||
}
|
||||
|
||||
.el-tabs--border-card {
|
||||
height: 470px;
|
||||
}
|
||||
|
||||
/* .el-icon svg {
|
||||
color: #ff7171;
|
||||
} */
|
||||
|
||||
.icon-style {
|
||||
color: #ff7171;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.dialog-left {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.right-content {
|
||||
flex: 6;
|
||||
}
|
||||
|
||||
.spanStyle {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -69,7 +69,7 @@
|
||||
</template>
|
||||
<script lang="tsx" setup name="preTest">
|
||||
import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import {defineExpose} from 'vue';
|
||||
import {defineExpose, toRef} from 'vue';
|
||||
|
||||
const step1InitLog = ref([
|
||||
{
|
||||
@@ -506,6 +506,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
}
|
||||
activeIndex.value = 5
|
||||
ts.value = 'success'
|
||||
console.log("@@@@",ts.value)
|
||||
break
|
||||
}
|
||||
|
||||
@@ -556,7 +557,6 @@ watch(activeIndex, function (newValue, oldValue) {
|
||||
|
||||
//监听goods_sn的变化
|
||||
watch(testStatus, function (newValue, oldValue) {
|
||||
|
||||
ts.value = props.testStatus;
|
||||
if (ts.value === 'start') {
|
||||
ts.value = 'process'
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="tabs-title ">
|
||||
<el-button type="primary" :icon="Download" >报告下载</el-button>
|
||||
<span style=" font-size: 18px;font-weight: 600;">
|
||||
已生成 <span style="color: #67C23A">2</span> 台/共 <span style="color: green">3</span> 台
|
||||
已生成 <span style="color: #91cc75">2</span> 台/共 <span style="color: green">3</span> 台
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
111
frontend/src/views/home/components/selectTestItemPopup.vue
Normal file
111
frontend/src/views/home/components/selectTestItemPopup.vue
Normal file
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<el-dialog title="选择测试内容" v-model='dialogVisible' @close="handleClose" v-bind="dialogSmall" >
|
||||
<div>
|
||||
<el-form ref="dialogFormRef" :model="formContent" class="form-three">
|
||||
<el-form-item prop="preTest" :label-width="100">
|
||||
<el-checkbox v-model="formContent.preTest" label="预检测"/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="checkStore.plan.timeCheck===1" prop="timeTest" :label-width="100">
|
||||
<el-checkbox v-model="formContent.timeTest" label="守时检测"/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="AppSceneStore.currentScene === '1'" prop="channelsTest" :label-width="100">
|
||||
<el-checkbox v-model="formContent.channelsTest" label="系数校准"/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="test" :label-width="100">
|
||||
<el-checkbox v-model="formContent.test" label="正式检测"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleStart">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='selectTestItemPopup'>
|
||||
import {dialogSmall} from "@/utils/elementBind";
|
||||
import {ref} from "vue";
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import type {CheckData} from "@/api/check/interface";
|
||||
import {ElMessageBox} from "element-plus";
|
||||
import {useAppSceneStore} from "@/stores/modules/mode";
|
||||
const AppSceneStore = useAppSceneStore()
|
||||
const emit = defineEmits(['openTestDialog'])
|
||||
const checkStore = useCheckStore();
|
||||
|
||||
const dialogFormRef = ref()
|
||||
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const formContent = reactive<CheckData.SelectTestItem>({preTest: true, timeTest: false, channelsTest: false, test: false})
|
||||
|
||||
const open = async () => {
|
||||
resetFormContent()
|
||||
checkStore.setSelectTestItems(formContent)
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
// 清空表单内容
|
||||
const resetFormContent = () => {
|
||||
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>
|
||||
@@ -61,7 +61,8 @@
|
||||
</el-button
|
||||
>
|
||||
<el-button :icon="Delete" @click="handleRefresh"
|
||||
>重置</el-button
|
||||
>重置
|
||||
</el-button
|
||||
>
|
||||
<!-- :disabled='!scope.isSelected' -->
|
||||
<el-button
|
||||
@@ -77,20 +78,12 @@
|
||||
<el-button
|
||||
type='primary'
|
||||
:icon='ChatLineRound'
|
||||
@click="handleTest('自动检测')"
|
||||
@click="handleTest('一键检测')"
|
||||
v-if='form.activeTabs === 0'
|
||||
>自动检测
|
||||
</el-button
|
||||
>
|
||||
<el-button type='primary' :icon='ChatLineSquare' @click="handleTest('不合格项复检')"
|
||||
v-if='form.activeTabs === 2'
|
||||
>不合格项复检
|
||||
</el-button
|
||||
>
|
||||
<el-button type='primary' :icon='ChatDotSquare' @click="handleTest('全部复检')" v-if='form.activeTabs === 2'
|
||||
>全部复检
|
||||
</el-button
|
||||
>
|
||||
>一键检测
|
||||
</el-button>
|
||||
<!-- <el-button type='primary' :icon='ChatLineSquare' @click="handleTest('不合格项复检')" v-if='form.activeTabs === 2'>不合格项复检</el-button>-->
|
||||
<!-- <el-button type='primary' :icon='ChatDotSquare' @click="handleTest('全部复检')" v-if='form.activeTabs === 2'>全部复检</el-button>-->
|
||||
|
||||
<!-- :disabled='!scope.isSelected' -->
|
||||
<!-- <el-button type="primary" :icon="Download" @click="handleTest('批量下载')" v-if="form.activeTabs === 3"
|
||||
@@ -102,9 +95,7 @@
|
||||
> -->
|
||||
|
||||
<!-- :disabled="!scope.isSelected || scope.selectedList.filter((item) => item.check_State === '检测完成').length === 0" -->
|
||||
<el-button type='primary' :icon='Notebook' @click="handleTest('批量归档')" v-if='form.activeTabs === 4'
|
||||
>归档
|
||||
</el-button>
|
||||
<el-button type='primary' :icon='Notebook' @click="handleTest('批量归档')" v-if='form.activeTabs === 4'>归档</el-button>
|
||||
<!-- <el-button type="primary" :icon="CirclePlus" @click="addDevice('设备新增')" v-if="form.activeTabs === 0"
|
||||
>设备新增</el-button> -->
|
||||
|
||||
@@ -225,19 +216,14 @@
|
||||
:dialogTitle="dialogTitle"
|
||||
@update:visible="dialogFormVisible = $event"
|
||||
/> -->
|
||||
<TestPopup ref='testPopup' @quitClicked='handleQuitClicked' ></TestPopup>
|
||||
<TestPopup ref='testPopup' @quitClicked='handleQuitClicked'></TestPopup>
|
||||
|
||||
<reportPopup
|
||||
:visible='reportDialogVisible'
|
||||
@update:visible='reportDialogVisible = $event'
|
||||
></reportPopup>
|
||||
|
||||
<dataCheckPopup ref='dataCheckPopupRef' />
|
||||
|
||||
<dataCheckChangeErrSysPopup
|
||||
:visible='dataCheckChangeErrSysDialogVisible'
|
||||
@update:visible='dataCheckChangeErrSysDialogVisible = $event'
|
||||
></dataCheckChangeErrSysPopup>
|
||||
<dataCheckPopup ref='dataCheckPopupRef'/>
|
||||
|
||||
<matchPopup
|
||||
:visible='matchDialogVisible'
|
||||
@@ -245,17 +231,19 @@
|
||||
></matchPopup>
|
||||
|
||||
<!--系数校准-->
|
||||
<ChannelsTest ref='channelsTest' :webMsgSend='webMsgSend' @quitClicked='handleQuitClicked' @submitClicked = 'handleSubmitClicked'></ChannelsTest>
|
||||
<ChannelsTest ref='channelsTest' :webMsgSend='webMsgSend' @quitClicked='handleQuitClicked' @submitClicked='handleSubmitClicked'></ChannelsTest>
|
||||
<!-- 手动检测-勾选检测项弹窗 -->
|
||||
<SelectTestItemPopup ref="selectTestItemPopupRef" @openTestDialog="openTestDialog"></SelectTestItemPopup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='useProTable'>
|
||||
import { useRouter } from 'vue-router'
|
||||
import type { Device } from '@/api/device/interface/device'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { ElMessage, ElMessageBox, ElLoading, Action } from 'element-plus'
|
||||
import {useRouter} from 'vue-router'
|
||||
import type {Device} from '@/api/device/interface/device'
|
||||
import {useHandleData} from '@/hooks/useHandleData'
|
||||
import {ElMessage, ElMessageBox, ElLoading, Action} from 'element-plus'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||
import {type ProTableInstance, type ColumnProps} from '@/components/ProTable/interface'
|
||||
import {
|
||||
Search,
|
||||
View,
|
||||
@@ -273,27 +261,28 @@ import {
|
||||
CirclePlus,
|
||||
Odometer,
|
||||
} from '@element-plus/icons-vue'
|
||||
import { getPlanList } from '@/api/plan/planList'
|
||||
import {getPlanList} from '@/api/plan/planList'
|
||||
import deviceDataList from '@/api/device/device/deviceData'
|
||||
import TestPopup from './testPopup.vue'
|
||||
import reportPopup from './reportPopup.vue'
|
||||
import dataCheckPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
||||
import dataCheckChangeErrSysPopup from './dataCheckChangeErrSysPopup.vue'
|
||||
import { generateDevReport, getBoundPqDevList } from '@/api/plan/plan.ts'
|
||||
import { onBeforeMount, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import {generateDevReport, getBoundPqDevList} from '@/api/plan/plan.ts'
|
||||
import {onBeforeMount, onMounted, reactive, ref, watch} from 'vue'
|
||||
import {useDictStore} from '@/stores/modules/dict'
|
||||
import ChannelsTest from './channelsTest.vue'
|
||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||
import { useCheckStore } from '@/stores/modules/check'
|
||||
import { CheckData } from '@/api/check/interface'
|
||||
import {useModeStore} from '@/stores/modules/mode' // 引入模式 store
|
||||
import {useCheckStore} from '@/stores/modules/check'
|
||||
import {CheckData} from '@/api/check/interface'
|
||||
import socketClient from '@/utils/webSocketClient'
|
||||
import auth from '@/directives/modules/auth'
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
import { downloadDevData } from '@/api/plan/plan.ts'
|
||||
import { documentedPqDev } from '@/api/device/device'
|
||||
import { getPqDev } from '@/api/device/device/index.ts'
|
||||
import { ResultEnum } from '@/enums/httpEnum'
|
||||
import {useAuthStore} from '@/stores/modules/auth'
|
||||
import {useDownload} from '@/hooks/useDownload'
|
||||
import {downloadDevData} from '@/api/plan/plan.ts'
|
||||
import {documentedPqDev} from '@/api/device/device'
|
||||
import {getPqDev} from '@/api/device/device/index.ts'
|
||||
import {ResultEnum} from '@/enums/httpEnum'
|
||||
import SelectTestItemPopup from "@/views/home/components/selectTestItemPopup.vue";
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const checkStore = useCheckStore()
|
||||
@@ -309,8 +298,8 @@ const tableHeight = ref(0)
|
||||
const reportDialogVisible = ref(false)
|
||||
|
||||
const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>()
|
||||
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
|
||||
|
||||
const dataCheckChangeErrSysDialogVisible = ref(false)
|
||||
const matchDialogVisible = ref(false)
|
||||
const dialogTitle = ref('手动检测')
|
||||
const checkStateTable = ref<number[]>([0, 1, 2])
|
||||
@@ -338,7 +327,7 @@ const shouldShowOption = (item) => {
|
||||
//开始创建webSocket客户端
|
||||
const dataSocket = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
});
|
||||
});
|
||||
|
||||
tableHeight.value = window.innerHeight - 600
|
||||
const deviceData = ref<Device.ResPqDev[]>([])
|
||||
@@ -513,7 +502,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
return true
|
||||
},
|
||||
},
|
||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '设备名称',
|
||||
@@ -609,7 +598,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
return ''
|
||||
},
|
||||
},
|
||||
{ prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow },
|
||||
{prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow},
|
||||
])
|
||||
// 跳转详情页
|
||||
const toDetail = () => {
|
||||
@@ -651,8 +640,12 @@ const handleSelectionChange = (selection: any[]) => {
|
||||
return {
|
||||
deviceId: item.id,
|
||||
deviceName: item.name,
|
||||
deviceType: item.devType,
|
||||
chnNum: item.devChns,
|
||||
planId: item.planId,
|
||||
deviceType: item.devType,
|
||||
devVolt: item.devVolt,
|
||||
devCurr: item.devCurr,
|
||||
factorFlag: item.factorFlag,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -845,6 +838,7 @@ const addDevice = (val: string) => {
|
||||
path: '/machine/device',
|
||||
})
|
||||
}
|
||||
|
||||
const handleTest = async (val: string) => {
|
||||
|
||||
if (devNum == 0) {
|
||||
@@ -891,7 +885,7 @@ const handleTest = async (val: string) => {
|
||||
}
|
||||
|
||||
|
||||
if (val === '手动检测' || val === '自动检测' || val === '不合格项复检' || val === '全部复检') {
|
||||
if (val === '手动检测' || val === '一键检测' || val === '系数校准') {
|
||||
// if (devNum > 6) {
|
||||
// ElMessageBox.confirm(
|
||||
// '每次检测最多只能选择6台设备,请重新选择',
|
||||
@@ -904,6 +898,31 @@ const handleTest = async (val: string) => {
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// if (devTestedNum == 0) {
|
||||
// ElMessageBox.confirm('请先选择检测完成状态的被检设备', '提示',
|
||||
// {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// type: 'warning',
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
const checkStates = channelsSelection.value.map(item => item.checkState)
|
||||
const allCheckStatesEqual = new Set(checkStates).size <= 1
|
||||
|
||||
if (!allCheckStatesEqual) {
|
||||
// ElMessageBox.confirm(
|
||||
// '所勾选设备检测状态不一致,请重新选择',
|
||||
// '提示',
|
||||
// {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// type: 'warning',
|
||||
// },
|
||||
// )
|
||||
// return
|
||||
checkStore.setReCheckType(1)
|
||||
}
|
||||
if (devChannelsNum > 12) {
|
||||
ElMessageBox.confirm(
|
||||
'每次检测最多只能检测12个设备通道,请重新选择',
|
||||
@@ -916,80 +935,43 @@ const handleTest = async (val: string) => {
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
dialogTitle.value = val
|
||||
if (val === '手动检测') {
|
||||
checkStore.setShowDetailType(2)
|
||||
|
||||
if (testType === 'reTest') {
|
||||
ElMessageBox.confirm(
|
||||
'请选择复检检测方式',
|
||||
'设备复检',
|
||||
ElMessageBox.confirm('请选择复检检测方式', '设备复检',
|
||||
{
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: '不合格项复检',
|
||||
cancelButtonText: '全部复检',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
})
|
||||
.then(() => {
|
||||
ElMessage.success('不合格项复检')
|
||||
dialogTitle.value = val
|
||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck)// 打开对话框
|
||||
if (checkStore.devices.length > 1) {
|
||||
checkStore.setReCheckType(1)
|
||||
} else {
|
||||
checkStore.setReCheckType(0)
|
||||
}
|
||||
selectTestItemPopupRef.value?.open()
|
||||
})
|
||||
.catch((action: Action) => {
|
||||
ElMessage.success('全部复检')
|
||||
dialogTitle.value = val
|
||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck) // 打开对话框
|
||||
checkStore.setReCheckType(1)
|
||||
selectTestItemPopupRef.value?.open()
|
||||
})
|
||||
} else {
|
||||
dialogTitle.value = val
|
||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck)
|
||||
selectTestItemPopupRef.value?.open()
|
||||
}
|
||||
return
|
||||
|
||||
} else if (val === '系数校准') {
|
||||
// 检查 socketClient.Instance 是否存在
|
||||
if (!socketClient.Instance) {
|
||||
console.error('WebSocket 客户端实例不存在');
|
||||
return;
|
||||
}
|
||||
|
||||
if (val === '系数校准') {
|
||||
const checkStates = channelsSelection.value.map(item => item.checkState)
|
||||
const allCheckStatesEqual = new Set(checkStates).size <= 1
|
||||
|
||||
if (!allCheckStatesEqual) {
|
||||
ElMessageBox.confirm(
|
||||
'所勾选设备检测状态不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const factorFlagArray = ref<string[]>([]) // 初始化为空数组
|
||||
for (let i = 0; i < channelsSelection.value.length; i++) {
|
||||
const factorFlag = channelsSelection.value[i].factorFlag
|
||||
if (factorFlag !== undefined && factorFlag !== null && factorFlag === 0) {
|
||||
factorFlagArray.value.push(channelsSelection.value[i].name.toString())
|
||||
}
|
||||
}
|
||||
if (factorFlagArray.value.length > 0) {
|
||||
const factorFlags = factorFlagArray.value.join(', ')
|
||||
ElMessageBox.confirm(
|
||||
factorFlags + '设备不支持系数校准,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// // 检查 socketClient.Instance 是否存在
|
||||
// if (!socketClient.Instance) {
|
||||
// console.error('WebSocket 客户端实例不存在');
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
socketClient.Instance.connect();
|
||||
dataSocket.socketServe = socketClient.Instance;
|
||||
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
||||
@@ -1006,23 +988,40 @@ const handleTest = async (val: string) => {
|
||||
|
||||
channelsTest.value?.open(channelsSelection.value, props.plan)
|
||||
return
|
||||
}
|
||||
|
||||
if (devTestedNum == 0) {
|
||||
ElMessageBox.confirm(
|
||||
'请先选择检测完成状态的被检设备',
|
||||
'提示',
|
||||
} else {
|
||||
checkStore.setShowDetailType(2)
|
||||
checkStore.setCheckType(1)
|
||||
checkStore.initSelectTestItems()
|
||||
// 一键检测
|
||||
if (testType === 'reTest') {
|
||||
ElMessageBox.confirm('请选择复检检测方式', '设备复检',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: '不合格项复检',
|
||||
cancelButtonText: '全部复检',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
})
|
||||
.then(() => {
|
||||
ElMessage.success('不合格项复检')
|
||||
if (checkStore.devices.length > 1) {
|
||||
checkStore.setReCheckType(1)
|
||||
} else {
|
||||
checkStore.setReCheckType(0)
|
||||
}
|
||||
openTestDialog()
|
||||
})
|
||||
.catch((action: Action) => {
|
||||
ElMessage.success('全部复检')
|
||||
checkStore.setReCheckType(1)
|
||||
openTestDialog()
|
||||
})
|
||||
} else {
|
||||
openTestDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val === '批量下载') {
|
||||
reportDialogVisible.value = true
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1046,8 +1045,10 @@ const handleTest = async (val: string) => {
|
||||
|
||||
emit('batchGenerateClicked') // 触发事件
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const openTestDialog = () => {
|
||||
testPopup.value?.open(dialogTitle.value)
|
||||
}
|
||||
|
||||
// 打开 drawer(新增、查看、编辑)
|
||||
@@ -1063,24 +1064,26 @@ const openDrawer = async (title: string, row: any) => {
|
||||
|
||||
|
||||
if (title === '报告生成') {
|
||||
await generateDevReport({ 'planId': checkStore.planId, 'devId': row.id })
|
||||
await generateDevReport({'planId': checkStore.plan.id, 'devId': row.id,'scriptId':checkStore.plan.scriptId,'planCode':checkStore.plan.code+''})
|
||||
emit('batchGenerateClicked') // 触发事件
|
||||
ElMessage.success({ message: `报告生成成功!` })
|
||||
ElMessage.success({message: `报告生成成功!`})
|
||||
}
|
||||
|
||||
if (title === '报告下载') {
|
||||
await useDownload(downloadDevData, row.createId, {
|
||||
planId: checkStore.planId,
|
||||
planId: checkStore.plan.id,
|
||||
devId: row.id,
|
||||
}, false, '.docx')
|
||||
emit('batchGenerateClicked') // 触发事件
|
||||
}
|
||||
|
||||
if (title === '检测数据查询') {
|
||||
checkStore.setShowDetailType(0)
|
||||
dataCheckPopupRef.value?.open(row.id, '-1', null)
|
||||
}
|
||||
if (title === '误差体系更换') {
|
||||
dataCheckChangeErrSysDialogVisible.value = true
|
||||
checkStore.setShowDetailType(1)
|
||||
dataCheckPopupRef.value?.open(row.id, '-1', null)
|
||||
}
|
||||
|
||||
|
||||
@@ -1121,7 +1124,7 @@ watch(
|
||||
handleRefresh()
|
||||
// 调用获取数据的方法
|
||||
},
|
||||
{ immediate: true }, // 立即执行一次
|
||||
{immediate: true}, // 立即执行一次
|
||||
)
|
||||
|
||||
onBeforeMount(async () => {
|
||||
@@ -1153,7 +1156,7 @@ const handleSubmitClicked = async (resolve: (value: boolean) => void) => {
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({ changeActiveTabs })
|
||||
defineExpose({changeActiveTabs})
|
||||
</script>
|
||||
<style lang='scss' scoped>
|
||||
/* 当屏幕宽度小于或等于1300像素时 */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:row-class-name="tableRowClassName" row-key="id" height="300px" :header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%" border v-on:cell-click="handleClick"
|
||||
:row-class-name="tableRowClassName" row-key="id" height="300px" :header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' } " style="width: 100%" border v-on:cell-click="handleClick"
|
||||
>
|
||||
<el-table-column prop="date" label="Date" width="180" />
|
||||
<el-table-column prop="name" label="Name" width="180" />
|
||||
|
||||
@@ -1,65 +1,81 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="dialog" v-bind="dialogBig">
|
||||
<div class="dialog-title">
|
||||
<div class="timeView">
|
||||
<el-icon style="margin: 0px 5px;">
|
||||
<Clock/>
|
||||
</el-icon>
|
||||
<span>检测用时:{{ timeView }}</span>
|
||||
</div>
|
||||
<el-progress
|
||||
style="width: 90%"
|
||||
style="width: 82%; margin-right: 3%;"
|
||||
:percentage="percentage"
|
||||
:color="customColors"/>
|
||||
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="testStatus=='process' && percentage < 100"
|
||||
:icon="VideoPause"
|
||||
@click="handlePause()">停止检测
|
||||
</el-button>
|
||||
<el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>
|
||||
<el-icon class="loading-box" style="margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
暂停中
|
||||
</el-button>
|
||||
<!-- <el-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-if="testStatus=='test_init'"-->
|
||||
<!-- :icon="VideoPause"-->
|
||||
<!-- disabled>初始化中-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="danger"-->
|
||||
<!-- v-if="testStatus=='test_init_fail'"-->
|
||||
<!-- :icon="Failed"-->
|
||||
<!-- disabled>初始化失败-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="danger"-->
|
||||
<!-- v-if="testStatus=='connect_timeout'"-->
|
||||
<!-- :icon="Failed"-->
|
||||
<!-- disabled>连接超时-->
|
||||
<!-- </el-button>-->
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="RefreshLeft"
|
||||
v-if="testStatus === 'test_recheck'"
|
||||
@click="emit('sendReCheck')">重新检测
|
||||
</el-button>
|
||||
<!-- <div style="width: 15%">-->
|
||||
<!-- <el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">-->
|
||||
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
|
||||
<!-- <component :is="Refresh"/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- 初始化中-->
|
||||
<!-- </el-button>-->
|
||||
|
||||
<!-- <el-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-if="testStatus=='process' && percentage < 100"-->
|
||||
<!-- :icon="VideoPause"-->
|
||||
<!-- @click="handlePause()">停止检测-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>-->
|
||||
<!-- <el-icon class="loading-box" style="margin-right: 8px;">-->
|
||||
<!-- <component :is="Refresh"/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- 暂停中-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <!– <el-button–>-->
|
||||
<!-- <!– type="primary"–>-->
|
||||
<!-- <!– v-if="testStatus=='test_init'"–>-->
|
||||
<!-- <!– :icon="VideoPause"–>-->
|
||||
<!-- <!– disabled>初始化中–>-->
|
||||
<!-- <!– </el-button>–>-->
|
||||
<!-- <!– <el-button–>-->
|
||||
<!-- <!– type="danger"–>-->
|
||||
<!-- <!– v-if="testStatus=='test_init_fail'"–>-->
|
||||
<!-- <!– :icon="Failed"–>-->
|
||||
<!-- <!– disabled>初始化失败–>-->
|
||||
<!-- <!– </el-button>–>-->
|
||||
<!-- <!– <el-button–>-->
|
||||
<!-- <!– type="danger"–>-->
|
||||
<!-- <!– v-if="testStatus=='connect_timeout'"–>-->
|
||||
<!-- <!– :icon="Failed"–>-->
|
||||
<!-- <!– disabled>连接超时–>-->
|
||||
<!-- <!– </el-button>–>-->
|
||||
<!-- <!– <el-button–>-->
|
||||
<!-- <!– type="primary"–>-->
|
||||
<!-- <!– :icon="RefreshLeft"–>-->
|
||||
<!-- <!– v-if="testStatus === 'recheck'"–>-->
|
||||
<!-- <!– @click="emit('sendReCheck')">重新检测–>-->
|
||||
<!-- <!– </el-button>–>-->
|
||||
|
||||
|
||||
<el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>
|
||||
<!-- <el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>-->
|
||||
|
||||
<el-button
|
||||
type="warning"
|
||||
v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"
|
||||
:icon="VideoPlay"
|
||||
:disabled="testStatus === 'pause_timeout'"
|
||||
@click="emit('sendResume')"
|
||||
>继续检测
|
||||
</el-button>
|
||||
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
|
||||
<!-- <el-button-->
|
||||
<!-- type="warning"-->
|
||||
<!-- v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"-->
|
||||
<!-- :icon="VideoPlay"-->
|
||||
<!-- :disabled="testStatus === 'pause_timeout'"-->
|
||||
<!-- @click="emit('sendResume')"-->
|
||||
<!-- >继续检测-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </div>-->
|
||||
<el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
|
||||
</div>
|
||||
|
||||
<div class="dialog-content">
|
||||
<el-table :data="checkResultView" row-key="scriptType" height="450px"
|
||||
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%"
|
||||
:header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' } " style="width: 100%"
|
||||
border>
|
||||
<el-table-column fixed prop="scriptName" label="检测项目" width="150px" align="center">
|
||||
</el-table-column>
|
||||
@@ -95,37 +111,37 @@
|
||||
</el-table-column>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<el-table-column v-for="(item,index1) in deviceList" :key="item.deviceId" :label="item.deviceName" :min-width="110" align="center">
|
||||
<template #default="{row}">
|
||||
<el-tooltip
|
||||
:content="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
|
||||
placement="top">
|
||||
<el-button
|
||||
:disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.LOADING"
|
||||
:color="row.devices[index1].chnResult[0].color"
|
||||
size="small"
|
||||
@click="handleClick(item,-1,row.scriptType)"
|
||||
>
|
||||
<el-icon v-if="row.devices[index1].chnResult[0].icon==='Loading'" class="loading-box"
|
||||
style="color: #fff">
|
||||
<component :is="Loading"/>
|
||||
</el-icon>
|
||||
<el-icon v-else style="color: #fff">
|
||||
<component :is="row.devices[index1].chnResult[0].icon"/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<!-- <template v-else>-->
|
||||
<!-- <el-table-column v-for="(item,index1) in deviceList" :key="item.deviceId" :label="item.deviceName" :min-width="110" align="center">-->
|
||||
<!-- <template #default="{row}">-->
|
||||
<!-- <el-tooltip-->
|
||||
<!-- :content="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"-->
|
||||
<!-- placement="top">-->
|
||||
<!-- <el-button-->
|
||||
<!-- :disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.LOADING"-->
|
||||
<!-- :color="row.devices[index1].chnResult[0].color"-->
|
||||
<!-- size="small"-->
|
||||
<!-- @click="handleClick(item,-1,row.scriptType)"-->
|
||||
<!-- >-->
|
||||
<!-- <el-icon v-if="row.devices[index1].chnResult[0].icon==='Loading'" class="loading-box"-->
|
||||
<!-- style="color: #fff">-->
|
||||
<!-- <component :is="Loading"/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon v-else style="color: #fff">-->
|
||||
<!-- <component :is="row.devices[index1].chnResult[0].icon"/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-tooltip>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- </template>-->
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="drawer-container">
|
||||
<el-drawer v-model="drawer" title="检测项进度">
|
||||
<el-drawer v-model="drawer" title="检测项进度" direction="btt">
|
||||
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;">
|
||||
<p v-for="(item, index) in testLogList"
|
||||
:key="index"
|
||||
@@ -136,15 +152,15 @@
|
||||
</el-drawer>
|
||||
</div>
|
||||
|
||||
<resultPopup
|
||||
:visible="resultDialogVisible"
|
||||
@update:visible="resultDialogVisible = $event"
|
||||
></resultPopup>
|
||||
<!-- <resultPopup-->
|
||||
<!-- :visible="resultDialogVisible"-->
|
||||
<!-- @update:visible="resultDialogVisible = $event"-->
|
||||
<!-- ></resultPopup>-->
|
||||
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="tsx" setup name="test">
|
||||
import {Check, Failed, InfoFilled, Loading, Refresh, RefreshLeft, VideoPause, VideoPlay} from '@element-plus/icons-vue'
|
||||
import resultPopup from './resultPopup.vue'
|
||||
import {Check, InfoFilled, Loading, Refresh, VideoPause, VideoPlay} from '@element-plus/icons-vue'
|
||||
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
||||
import {computed, reactive, ref, toRef, watch} from "vue";
|
||||
import {dialogBig} from "@/utils/elementBind";
|
||||
@@ -152,7 +168,9 @@ import {CheckData} from "@/api/check/interface"
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import {getBigTestItem} from "@/api/check/test";
|
||||
import {tryHideFullScreenLoading} from "@/components/Loading/fullScreen";
|
||||
import {getAutoGenerate} from "@/api/user/login";
|
||||
import {generateDevReport} from "@/api/plan/plan";
|
||||
|
||||
|
||||
const checkStore = useCheckStore()
|
||||
|
||||
@@ -167,6 +185,9 @@ const props = defineProps({
|
||||
type: String,
|
||||
default: 'waiting'
|
||||
},
|
||||
stepsActive: {
|
||||
type: Number,
|
||||
},
|
||||
webMsgSend: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
@@ -178,7 +199,7 @@ const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause',
|
||||
// 用来保存测试项进度抽屉是否打开
|
||||
const drawer = ref(false)
|
||||
// 进度条颜色
|
||||
const customColors = [{color: "#5cb87a", percentage: 100}]
|
||||
const customColors = [{color: "#91cc75", percentage: 100}]
|
||||
// 检测脚本数据
|
||||
let scriptData: CheckData.ScriptItem[] = []
|
||||
// 用来保存被检设备
|
||||
@@ -187,6 +208,10 @@ const deviceList = reactive<CheckData.Device[]>([])
|
||||
let activeIndex = 0
|
||||
// 百分比
|
||||
const percentage = ref(0);
|
||||
// 时间计数器
|
||||
let timer: any = null
|
||||
const timeCount = ref(0)
|
||||
const timeView = ref('00:00:00')
|
||||
//测试项开始检测时间(或继续检测时间)
|
||||
const startData = ref(new Date())
|
||||
//测试项检测结束时间(或暂停时的时间)
|
||||
@@ -202,7 +227,7 @@ const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无
|
||||
const testStatus = toRef(props, 'testStatus')
|
||||
const webMsgSend = toRef(props, 'webMsgSend')
|
||||
|
||||
const resultDialogVisible = ref(false)
|
||||
// const resultDialogVisible = ref(false)
|
||||
const scrollContainerRef = ref();
|
||||
const dataCheckSingleChannelSingleTestPopupRef = ref<InstanceType<typeof dataCheckSingleChannelSingleTestPopup>>()
|
||||
|
||||
@@ -232,7 +257,7 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
|
||||
for (let j = 0; j < device.chnResult.length; j++) {
|
||||
switch (device.chnResult[j]) {
|
||||
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'More'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.LOADING:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
||||
@@ -249,44 +274,48 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
|
||||
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let tempChnResult: CheckData.ChnCheckResultEnum = device.chnResult[0]
|
||||
if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.ERRORDATA)) {
|
||||
tempChnResult = CheckData.ChnCheckResultEnum.ERRORDATA
|
||||
}
|
||||
if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.FAIL)) {
|
||||
tempChnResult = CheckData.ChnCheckResultEnum.FAIL
|
||||
}
|
||||
if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.TIMEOUT)) {
|
||||
tempChnResult = CheckData.ChnCheckResultEnum.TIMEOUT
|
||||
}
|
||||
switch (tempChnResult) {
|
||||
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
||||
case CheckData.ChnCheckResultEnum.NOT_PART_IN_ERROR:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.LOADING:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.SUCCESS:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.SUCCESS, icon: 'CircleCheckFilled'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.FAIL:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.DANGER, icon: 'Close'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.TIMEOUT:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// let tempChnResult: CheckData.ChnCheckResultEnum = device.chnResult[0]
|
||||
// if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.ERRORDATA)) {
|
||||
// tempChnResult = CheckData.ChnCheckResultEnum.ERRORDATA
|
||||
// }
|
||||
// if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.FAIL)) {
|
||||
// tempChnResult = CheckData.ChnCheckResultEnum.FAIL
|
||||
// }
|
||||
// if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.TIMEOUT)) {
|
||||
// tempChnResult = CheckData.ChnCheckResultEnum.TIMEOUT
|
||||
// }
|
||||
// switch (tempChnResult) {
|
||||
// case CheckData.ChnCheckResultEnum.UNKNOWN:
|
||||
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
||||
// break;
|
||||
// case CheckData.ChnCheckResultEnum.LOADING:
|
||||
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
||||
// break;
|
||||
// case CheckData.ChnCheckResultEnum.SUCCESS:
|
||||
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.SUCCESS, icon: 'CircleCheckFilled'})
|
||||
// break;
|
||||
// case CheckData.ChnCheckResultEnum.FAIL:
|
||||
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.DANGER, icon: 'Close'})
|
||||
// break;
|
||||
// case CheckData.ChnCheckResultEnum.TIMEOUT:
|
||||
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'})
|
||||
// break;
|
||||
// case CheckData.ChnCheckResultEnum.ERRORDATA:
|
||||
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
temp.devices.push({
|
||||
deviceId: device.deviceId,
|
||||
@@ -303,28 +332,30 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
|
||||
watch(testStatus, function (newValue, oldValue) {
|
||||
if (newValue == 'start') {
|
||||
ElMessage.success('初始化开始!')
|
||||
startTimeCount()
|
||||
|
||||
showTestLog()
|
||||
|
||||
if (oldValue == 'error') {
|
||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!`})
|
||||
|
||||
initCheckResult()
|
||||
activeIndex = 0
|
||||
percentage.value = 0
|
||||
}
|
||||
// if (oldValue == 'recheck' || oldValue == 'error' || oldValue == 'test_init_fail' || oldValue == 'connect_timeout' || oldValue == 'pause_timeout' || oldValue == 'error_flow_end') {
|
||||
// handleReCheck()
|
||||
// }
|
||||
emit('update:testStatus', 'test_init')
|
||||
//startTimer() // todo 可移除
|
||||
startData.value = new Date();
|
||||
timeDifference.value = 0;
|
||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`})
|
||||
}
|
||||
|
||||
if (newValue == 'recheck' || newValue == 'error' || newValue == 'test_init_fail' || newValue == 'connect_timeout' || newValue == 'pause_timeout' || oldValue == 'error_flow_end') {
|
||||
stopTimeCount()
|
||||
}
|
||||
})
|
||||
|
||||
// 次数
|
||||
let count = 0
|
||||
|
||||
watch(webMsgSend, function (newValue, oldValue) {
|
||||
if (props.stepsActive === 4) {
|
||||
if (newValue.code == 10520) {
|
||||
ElMessageBox.alert('报文解析异常!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
@@ -410,7 +441,8 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
type: 'error',
|
||||
log: `${new Date().toLocaleString()}:存在已经初始化步骤,执行自动关闭,请重新发起检测!`
|
||||
})
|
||||
emit('update:testStatus', 'test_recheck')
|
||||
// emit('update:testStatus', 'recheck')
|
||||
emit('update:testStatus', 'test_init_fail')
|
||||
} else {
|
||||
switch (newValue.requestId) {
|
||||
case 'server_error':
|
||||
@@ -615,7 +647,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}, {deep: true})
|
||||
|
||||
const handleStartItem = (code: string, desc: string | undefined) => {
|
||||
@@ -624,8 +656,8 @@ const handleStartItem = (code: string, desc: string | undefined) => {
|
||||
updateCheckResultView(code, true)
|
||||
updateLog(true)
|
||||
} else {
|
||||
if (desc.length > 60) {
|
||||
desc = desc.substring(0, 60) + '...'
|
||||
if (desc.length > 150) {
|
||||
desc = desc.substring(0, 150) + '...'
|
||||
}
|
||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:${desc}准确度检测:开始`})
|
||||
}
|
||||
@@ -642,8 +674,8 @@ const handleEndItem = (code: string, desc: string | undefined, devices: CheckDat
|
||||
}
|
||||
} else {
|
||||
let result = getResult(devices)
|
||||
if (desc.length > 60) {
|
||||
desc = desc.substring(0, 60) + '...'
|
||||
if (desc.length > 150) {
|
||||
desc = desc.substring(0, 150) + '...'
|
||||
}
|
||||
if (result === 1) {
|
||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:${desc}检测结束:符合`})
|
||||
@@ -658,12 +690,19 @@ const handleEndItem = (code: string, desc: string | undefined, devices: CheckDat
|
||||
}
|
||||
|
||||
// 更新进度条
|
||||
const updatePercentage = () => {
|
||||
const updatePercentage = async () => {
|
||||
if (activeIndex < checkTotal) {
|
||||
percentage.value = Math.trunc(activeIndex / checkTotal * 100);
|
||||
} else {
|
||||
percentage.value = 100;
|
||||
emit('update:testStatus', 'success')
|
||||
|
||||
let {data: autoGenerate} = await getAutoGenerate()
|
||||
if (autoGenerate == 1) {
|
||||
//调用自动生成报告接口
|
||||
let deviceIds = checkStore.devices.map(item => item.deviceId)
|
||||
// await generateDevReport({'planId': checkStore.plan.id, 'devId':deviceIds[0] ,'scriptId':checkStore.plan.scriptId,'planCode':checkStore.plan.code+''})
|
||||
}
|
||||
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
|
||||
confirmButtonText: '确定',
|
||||
})
|
||||
@@ -700,7 +739,7 @@ const showTestLog = () => {
|
||||
// 初始化检测脚本数据
|
||||
const initScriptData = async () => {
|
||||
|
||||
let response: any = await getBigTestItem(checkStore.planId)
|
||||
let response: any = await getBigTestItem({reCheckType:checkStore.reCheckType, planId:checkStore.plan.id,devId:checkStore.devices[0].deviceId})
|
||||
|
||||
let temp = response.data.map(item => {
|
||||
return {
|
||||
@@ -767,7 +806,7 @@ const updateCheckResult = (data: CheckData.ScriptChnItem) => {
|
||||
|
||||
const scrollToBottom = () => {
|
||||
if (scrollContainerRef.value) {
|
||||
scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight;
|
||||
scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight + 70;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -850,11 +889,13 @@ const updateLog = (isStart: boolean) => {
|
||||
break
|
||||
}
|
||||
|
||||
timeView.value = secondToTime(timeDifference.value / 1000)
|
||||
if (activeIndex === checkTotal) {
|
||||
testLogList.push({
|
||||
type: 'info',
|
||||
log: currentTime.value + ' :检测结束,总用时' + getTimeDifference(timeDifference.value),
|
||||
})
|
||||
stopTimeCount()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -893,6 +934,11 @@ const setErrorCheckItem = (scriptType: string, devices: CheckData.DeviceCheckRes
|
||||
type: 'warning',
|
||||
log: `${new Date().toLocaleString()} :${devices[i].deviceName}连接超时`,
|
||||
})
|
||||
ElMessageBox.alert('连接超时!', '连接超时', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
emit('update:testStatus', 'connect_timeout')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -914,9 +960,9 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch
|
||||
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
|
||||
// devices = [
|
||||
// {
|
||||
// chnResult: [3, 4],
|
||||
// deviceId: "80b4b4f52a4c4064a18319525f8ac13c",
|
||||
// deviceName: "240002"
|
||||
// chnResult: [1, 1, 1, 1],
|
||||
// deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||
// deviceName: "250226001"
|
||||
// },
|
||||
// {
|
||||
// chnResult: [1, 1, 1, 1],
|
||||
@@ -927,7 +973,7 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch
|
||||
// chnResult: [1, 1, 1, 1],
|
||||
// deviceId: "ae5a7628260349c0a5e7c86c81fbd417",
|
||||
// deviceName: "240004"
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// chnResult: [1, 1, 1, 1],
|
||||
// deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
||||
@@ -1084,6 +1130,7 @@ const handleClick = (item: any, chnNum: number, scriptType: string) => {
|
||||
})
|
||||
}
|
||||
if (flag === -1 || flag === 1) {
|
||||
checkStore.setShowDetailType(2)
|
||||
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType);
|
||||
}
|
||||
};
|
||||
@@ -1209,7 +1256,7 @@ const startTimer = () => {
|
||||
}
|
||||
};
|
||||
const handlePause = () => {
|
||||
emit('sendPause')
|
||||
//emit('sendPause')
|
||||
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`})
|
||||
}
|
||||
|
||||
@@ -1222,6 +1269,7 @@ const pauseSuccessCallback = () => {
|
||||
type: 'info',
|
||||
log: `${new Date().toLocaleString()}:暂停检测`,
|
||||
})
|
||||
stopTimeCount()
|
||||
console.log('暂停中')
|
||||
};
|
||||
|
||||
@@ -1233,7 +1281,7 @@ const todoItem = (code: string) => {
|
||||
if (testStatus.value !== 'paused') {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: `${code}_Start`,
|
||||
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||
})
|
||||
}
|
||||
}, 1000)
|
||||
@@ -1241,11 +1289,11 @@ const todoItem = (code: string) => {
|
||||
if (testStatus.value !== 'paused') {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: `${code}_End`,
|
||||
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||
data: [{
|
||||
chnResult: [1, 1, 1, 1],
|
||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
||||
deviceName: "25011407"
|
||||
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||
deviceName: "250226001"
|
||||
}]
|
||||
})
|
||||
}
|
||||
@@ -1254,7 +1302,7 @@ const todoItem = (code: string) => {
|
||||
if (testStatus.value !== 'paused') {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: `${code}_Start`,
|
||||
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||
})
|
||||
}
|
||||
}, 3000)
|
||||
@@ -1262,11 +1310,11 @@ const todoItem = (code: string) => {
|
||||
if (testStatus.value !== 'paused') {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: `${code}_End`,
|
||||
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||
data: [{
|
||||
chnResult: [1, 1, 1, 1],
|
||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
||||
deviceName: "25011407"
|
||||
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||
deviceName: "250226001"
|
||||
}]
|
||||
})
|
||||
}
|
||||
@@ -1275,7 +1323,7 @@ const todoItem = (code: string) => {
|
||||
if (testStatus.value !== 'paused') {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: `${code}_Start`,
|
||||
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||
})
|
||||
}
|
||||
}, 6000)
|
||||
@@ -1283,11 +1331,11 @@ const todoItem = (code: string) => {
|
||||
if (testStatus.value !== 'paused') {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: `${code}_End`,
|
||||
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||
data: [{
|
||||
chnResult: [1, 2, 1, 1],
|
||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
||||
deviceName: "25011407"
|
||||
chnResult: [1, 1, 1, 1],
|
||||
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||
deviceName: "250226001"
|
||||
}]
|
||||
})
|
||||
}
|
||||
@@ -1298,8 +1346,8 @@ const todoItem = (code: string) => {
|
||||
requestId: `${code}_End`,
|
||||
data: [{
|
||||
chnResult: [1, 2, 1, 1],
|
||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
||||
deviceName: "25011407"
|
||||
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||
deviceName: "250226001"
|
||||
}]
|
||||
})
|
||||
}
|
||||
@@ -1309,20 +1357,26 @@ const todoItem = (code: string) => {
|
||||
const handleResumeTest = () => {
|
||||
//activeIndex++
|
||||
startData.value = new Date();
|
||||
testLogList.push({
|
||||
type: 'info',
|
||||
log: `${new Date().toLocaleString()}:继续检测`,
|
||||
})
|
||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!`})
|
||||
//startTimer()
|
||||
resumeTimeCount()
|
||||
console.log('开始继续检测')
|
||||
};
|
||||
|
||||
const handleReCheck = () => {
|
||||
initCheckResult()
|
||||
activeIndex = 0
|
||||
percentage.value = 0
|
||||
timeCount.value = 0
|
||||
timeView.value = '00:00:00'
|
||||
timeDifference.value = 0
|
||||
testLogList.length = 0
|
||||
|
||||
errorCheckItem.length = 0
|
||||
count = 0
|
||||
|
||||
showTestLog()
|
||||
//handleResumeTest()
|
||||
}
|
||||
|
||||
// 获取当前执行的大测试项序号
|
||||
@@ -1347,7 +1401,51 @@ const getNextActiveIndex = (code: string = ''): number => {
|
||||
}
|
||||
return -1
|
||||
}
|
||||
const startTimeCount = () => {
|
||||
if (!timer) {
|
||||
timer = setInterval(() => {
|
||||
timeCount.value = timeCount.value + 1
|
||||
timeView.value = secondToTime(timeCount.value)
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
const stopTimeCount = () => {
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
}
|
||||
}
|
||||
|
||||
const resumeTimeCount = () => {
|
||||
timer = setInterval(() => {
|
||||
timeCount.value = timeCount.value + 1
|
||||
timeView.value = secondToTime(timeCount.value)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
|
||||
const secondToTime = (second: number) => {
|
||||
//将秒数转换成时分秒
|
||||
let h: string | number = Math.floor(second / 3600)
|
||||
let m: string | number = Math.floor((second - h * 3600) / 60)
|
||||
let s: string | number = Math.floor(second % 60);
|
||||
|
||||
h = h < 10 ? '0' + h : h;
|
||||
m = m < 10 ? '0' + m : m;
|
||||
s = s < 10 ? '0' + s : s;
|
||||
return h + ':' + m + ':' + s;
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
}
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
handlePause
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -1389,11 +1487,23 @@ const getNextActiveIndex = (code: string = ''): number => {
|
||||
}
|
||||
|
||||
.dialog-title {
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.timeView {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #91cc75;
|
||||
width: 28%;
|
||||
margin-right: 0px;
|
||||
text-align: left;
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-content {
|
||||
@@ -1421,8 +1531,7 @@ const getNextActiveIndex = (code: string = ''): number => {
|
||||
.drawer-container {
|
||||
:deep(header.el-drawer__header) {
|
||||
color: #fff !important;
|
||||
background-color: #003078 !important;
|
||||
|
||||
background-color: var(--el-color-primary) !important;
|
||||
.el-drawer__close-btn svg:hover {
|
||||
color: #ccc !important;
|
||||
}
|
||||
@@ -1448,7 +1557,7 @@ const getNextActiveIndex = (code: string = ''): number => {
|
||||
|
||||
|
||||
//:deep(.el-drawer .el-drawer__title){
|
||||
// background-color: #003078 !important;
|
||||
// background-color: var(--el-color-primary) !important;
|
||||
//}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -1,58 +1,80 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" :model-value="dialogVisible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px"
|
||||
draggable>
|
||||
<el-dialog :title="dialogTitle" width="1550px" :model-value="dialogVisible" :before-close="beforeClose" @close="handleClose" height="1000px" draggable>
|
||||
|
||||
<div class="steps-container">
|
||||
<!-- simple -->
|
||||
<!-- :style="{color:node.label=='未检'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" -->
|
||||
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
|
||||
<!-- style="height:100px" -->
|
||||
<!-- <el-step title="预检测" :icon="getIcon(0)" /> -->
|
||||
<el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit"/>
|
||||
<el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled" v-if="isTimeCheck"/>
|
||||
<!-- <el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" /> -->
|
||||
<el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin"/>
|
||||
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key"/>
|
||||
<el-step v-if="preTestSelected" title="预检测" :icon="stepsActive > 1 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Edit" @click="handleStepClick(1)"/>
|
||||
<el-step v-if="timeTestSelected" title="守时检测" :icon="stepsActive > 2 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :UploadFilled" @click="handleStepClick(2)"/>
|
||||
<el-step v-if="channelsTestSelected" title="系数校准" :icon="stepsActive > 3 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Odometer" @click="handleStepClick(3)"/>
|
||||
<el-step v-if="testSelected" title="正式检测" :icon="stepsActive > 4 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Coin" @click="handleStepClick(4)"/>
|
||||
<el-step title="检测完成" :icon="stepsActiveIndex > stepsTotalNum-1 ? SuccessFilled :Key"/>
|
||||
</el-steps>
|
||||
</div>
|
||||
<preTest ref="preTestRef" v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest>
|
||||
<timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
|
||||
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
|
||||
<test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"
|
||||
@sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck"></test>
|
||||
|
||||
<preTest v-if="showComponent&&preTestSelected" v-show="preTestSelected && stepsActiveView==1" ref="preTestRef" v-model:testStatus="preTestStatus"
|
||||
:webMsgSend="webMsgSend"/>
|
||||
<timeTest v-if="showComponent&&timeTestSelected" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/>
|
||||
<!-- <channelsTest v-if="stepsActiveIndex === 3" v-model:testStatus="channelsTestStatus"></channelsTest>-->
|
||||
<factorTest v-if="showComponent&&channelsTestSelected" v-show="channelsTestSelected && stepsActiveView==3" v-model:testStatus="channelsTestStatus" :webMsgSend="webMsgSend"/>
|
||||
<test v-if="showComponent&&testSelected" ref="testRef" v-show="testSelected && stepsActiveView==4" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend"
|
||||
@update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck" :stepsActive="stepsActive"/>
|
||||
|
||||
<template #footer>
|
||||
<div>
|
||||
<!-- <el-button @click="handleCancel">取 消</el-button> -->
|
||||
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled"
|
||||
@click="nextStep">跳过
|
||||
</el-button>
|
||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit" :disabled="btnState">开始检测</el-button>
|
||||
<el-button type="primary" v-if="TestStatus === 'process'" @click="handleSubmit" disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
检测中
|
||||
</el-button>
|
||||
<el-button type="warning" :icon="VideoPlay" v-if="TestStatus === 'paused'" @click="handleSubmit">继续检测</el-button>
|
||||
<el-button type="primary" :icon="RefreshLeft" v-if="TestStatus === 'test_recheck'" @click="handleSubmit">重新检测</el-button>
|
||||
<!-- <el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < stepsTotalNum && ActiveStatue != 'success'" @click="nextStep">跳过</el-button>-->
|
||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="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="primary"
|
||||
v-if="TestStatus=='process'"
|
||||
:icon="VideoPause"
|
||||
@click="handlePause()">停止检测
|
||||
</el-button>
|
||||
<el-button type="warning" v-if="TestStatus === 'paused_ing'" disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
暂停中
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
v-if="(TestStatus =='paused')"
|
||||
:icon="VideoPlay"
|
||||
@click="sendResume"
|
||||
>继续检测
|
||||
</el-button>
|
||||
|
||||
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
||||
v-if="ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout'"
|
||||
v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
|
||||
@click="nextStep">
|
||||
{{ nextStepText }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="handleQuit" v-else>
|
||||
退出检测
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -61,108 +83,27 @@
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup name="testPopup">
|
||||
import {h, reactive, ref, watch} from 'vue';
|
||||
import {reactive, ref, watch} from 'vue';
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
||||
import {
|
||||
Close,
|
||||
Coin,
|
||||
DArrowRight,
|
||||
Edit,
|
||||
Key,
|
||||
Odometer,
|
||||
Refresh,
|
||||
Right,
|
||||
SuccessFilled,
|
||||
UploadFilled,
|
||||
VideoPlay,
|
||||
RefreshLeft, Loading
|
||||
} from '@element-plus/icons-vue'
|
||||
import {Coin, DArrowRight, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPlay,VideoPause} from '@element-plus/icons-vue'
|
||||
import preTest from './preTest.vue'
|
||||
import timeTest from './timeTest.vue'
|
||||
import {Device} from '@/api/device/interface/device';
|
||||
import factorTest from './factorTest.vue'
|
||||
import test from './test.vue'
|
||||
import socketClient from '@/utils/webSocketClient';
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {startPreTest, pauseTest, resumeTest} from '@/api/socket/socket'
|
||||
import {showFullScreenLoading} from "@/components/Loading/fullScreen";
|
||||
import {pauseTest, resumeTest, startPreTest} from '@/api/socket/socket'
|
||||
import {useUserStore} from "@/stores/modules/user";
|
||||
|
||||
|
||||
//import SvgIcon from '@/components/SvgIcon.vue';
|
||||
|
||||
// import preTestIcon from '@/assets/icons/preTest.svg'
|
||||
|
||||
// const preTestIcon = `
|
||||
// <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
|
||||
// </svg>
|
||||
// `;
|
||||
// const props = defineProps<{
|
||||
// visible: boolean;
|
||||
// dialogTitle: string;
|
||||
|
||||
// formData: {
|
||||
// id: string;//误差体系表Id
|
||||
// name: string;//误差体系名称
|
||||
// standard_Name:string;//参照标准名称
|
||||
// standard_Time:string;//标准推行时间
|
||||
// dev_Level:string;//使用设备等级
|
||||
// enable:number;//状态:0-不启用 1-启用
|
||||
// state:number;//0-删除 1-正常
|
||||
// };
|
||||
// }>();
|
||||
|
||||
// const emit = defineEmits<{
|
||||
// (e: 'update:visible', value: boolean): void;
|
||||
// (e: 'submit', data: any): void;
|
||||
// }>();
|
||||
const btnState = ref(false)
|
||||
const userStore = useUserStore()
|
||||
const checkStore = useCheckStore();
|
||||
const skipDisabled = ref(false);
|
||||
const nextStepText = ref('下一步');
|
||||
const dialogVisible = ref(false)
|
||||
//定义与预检测配置数组
|
||||
const detectionOptions = ref([
|
||||
{
|
||||
id: 0,
|
||||
name: "源通讯检测",//判断源通讯是否正常
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: "设备通讯检测",//判断设备的IP、Port、识别码、秘钥是否正常
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "协议校验",//ICD报告触发测试
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "相序校验",//判断装置的接线是否正确
|
||||
selected: true,
|
||||
},
|
||||
// {
|
||||
// id: 4,
|
||||
// name: "守时校验",//判断装置24小时内的守时误差是否小于1s
|
||||
// selected: true,
|
||||
// },
|
||||
// {
|
||||
// id: 5,
|
||||
// name: "通道系数校准",//通过私有协议与装置进行通讯,校准三相电压电流的通道系数
|
||||
// selected: true,
|
||||
// },
|
||||
// {
|
||||
// id: 6,
|
||||
// name: "实时数据比对",
|
||||
// },
|
||||
// {
|
||||
// id: 7,
|
||||
// name: "录波数据比对",
|
||||
// },
|
||||
]);
|
||||
|
||||
const stepsTotalNum = ref(4);//步骤总数
|
||||
const stepsActiveIndex = ref(0); //当前正在执行的步骤索引
|
||||
const stepsTotalNum = ref(-1);//步骤总数
|
||||
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
|
||||
const stepsActiveView = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
|
||||
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态,用于切换步骤
|
||||
const ActiveStatue = ref('waiting');//当前步骤状态
|
||||
const preTestStatus = ref('waiting');//预检测执行状态
|
||||
const timeTestStatus = ref('waiting');//守时校验执行状态
|
||||
@@ -170,124 +111,138 @@ const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
||||
const TestStatus = ref('waiting');//正式检测执行状态
|
||||
const webMsgSend = ref();//webSocket推送的数据
|
||||
|
||||
const dialogTitle = ref('');
|
||||
const isTimeCheck = ref(false)
|
||||
const preTestRef = ref(null);
|
||||
|
||||
|
||||
// const devIdArr = ref([])
|
||||
// const planId = ref('')
|
||||
const dialogTitle = ref('')
|
||||
const showComponent = ref(true)
|
||||
const preTestRef = ref(null)
|
||||
const testRef = ref(null)
|
||||
|
||||
const dataSocket = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
});
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (selection: Device.ResPqDev[], title: string, time: boolean) => {
|
||||
|
||||
// 勾选的检测内容
|
||||
const preTestSelected = ref(false)
|
||||
const timeTestSelected = ref(false)
|
||||
const channelsTestSelected = ref(false)
|
||||
const testSelected = ref(false)
|
||||
|
||||
const checkStates = selection.map(item => item.checkState);
|
||||
// devIdArr.value = selection.map(item => item.id);
|
||||
// planId.value =selection[0].planId
|
||||
// console.log('wwwwwwwwwwwwwwwww',selection)
|
||||
const initOperate = () => {
|
||||
ActiveStatue.value = 'waiting'
|
||||
preTestStatus.value = 'waiting'
|
||||
timeTestStatus.value = 'waiting'
|
||||
channelsTestStatus.value = 'waiting'
|
||||
TestStatus.value = 'waiting'
|
||||
|
||||
const allCheckStatesEqual = new Set(checkStates).size <= 1;
|
||||
stepsActiveIndex.value = 1
|
||||
showComponent.value = true
|
||||
// 初始化勾选的检测内容
|
||||
preTestSelected.value = checkStore.selectTestItems.preTest
|
||||
timeTestSelected.value = checkStore.selectTestItems.timeTest
|
||||
channelsTestSelected.value = checkStore.selectTestItems.channelsTest
|
||||
testSelected.value = checkStore.selectTestItems.test
|
||||
|
||||
if (!allCheckStatesEqual) {
|
||||
ElMessageBox.confirm(
|
||||
'所勾选设备检测状态不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
let count = 0
|
||||
for (let key in checkStore.selectTestItems) {
|
||||
if (checkStore.selectTestItems[key]) {
|
||||
count++
|
||||
}
|
||||
)
|
||||
}
|
||||
stepsTotalNum.value = count + 1
|
||||
|
||||
if (preTestSelected.value) {
|
||||
stepsActiveView.value = 1
|
||||
stepsActive.value = 1
|
||||
return
|
||||
}
|
||||
if (timeTestSelected.value) {
|
||||
stepsActiveView.value = 2
|
||||
stepsActive.value = 2
|
||||
return
|
||||
}
|
||||
if (channelsTestSelected.value) {
|
||||
stepsActiveView.value = 3
|
||||
stepsActive.value = 3
|
||||
return
|
||||
}
|
||||
if (testSelected.value) {
|
||||
stepsActiveView.value = 4
|
||||
stepsActive.value = 4
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const open = (title: string) => {
|
||||
initOperate()
|
||||
dialogTitle.value = title;
|
||||
dialogVisible.value = true;
|
||||
isTimeCheck.value = time
|
||||
|
||||
if (preTestRef.value) {
|
||||
preTestRef.value.initializeParameters();
|
||||
}
|
||||
|
||||
preTestStatus.value = 'waiting';//预检测执行状态
|
||||
//开始创建webSocket客户端
|
||||
|
||||
socketClient.Instance.connect();
|
||||
dataSocket.socketServe = socketClient.Instance;
|
||||
dataSocket.socketServe.registerCallBack('aaa', (res) => {
|
||||
// 处理来自服务器的消息
|
||||
// console.log('Received message:', res);
|
||||
// 根据需要在这里添加更多的处理逻辑
|
||||
|
||||
if (res.code === 20000) {
|
||||
ElMessage.error(message.message)
|
||||
loading.close()
|
||||
//ElMessage.error(message.message)
|
||||
// loading.close()
|
||||
} else {
|
||||
webMsgSend.value = res
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
let loading;
|
||||
// let loading;
|
||||
const handleSubmit = () => {
|
||||
skipDisabled.value = true
|
||||
//btnState.value = true
|
||||
console.log('=============', stepsActiveIndex.value)
|
||||
|
||||
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
||||
let planId = checkStore.planId
|
||||
let planId = checkStore.plan.id
|
||||
|
||||
|
||||
if(!dataSocket.socketServe.connected){
|
||||
if (!dataSocket.socketServe.connected) {
|
||||
ElMessage.error('webSocket连接中断!')
|
||||
return
|
||||
}
|
||||
|
||||
switch (stepsActiveIndex.value) {
|
||||
case 0:
|
||||
// preTestStatus.value = 'start'
|
||||
|
||||
console.log("handleSubmit",stepsActive.value,TestStatus.value)
|
||||
switch (stepsActive.value) {
|
||||
case 1:
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: '1' // '1'为预检测、‘2‘为正式检测
|
||||
operateType: '1', // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
}).then(res => {
|
||||
if (res.code === 'A001014') {
|
||||
ElMessageBox.alert('装置配置异常', '检测失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
TestStatus.value = 'error'
|
||||
preTestStatus.value = 'error'
|
||||
}
|
||||
})
|
||||
preTestStatus.value = 'start'
|
||||
// setTimeout(() => {
|
||||
// preTestStatus.value = 'success'
|
||||
// }, 5000)
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
timeTestStatus.value = 'start'
|
||||
break;
|
||||
// case 2:
|
||||
// channelsTestStatus.value = 'start'
|
||||
// break;
|
||||
case 2:
|
||||
case 3:
|
||||
// 调用系数校准组件的handleSubmit方法
|
||||
channelsTestStatus.value = 'start'
|
||||
break;
|
||||
case 4:
|
||||
if (TestStatus.value == "waiting") {
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
||||
operateType: checkStore.reCheckType ==1 ?'2':'8', // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 'A001014') {
|
||||
@@ -297,31 +252,23 @@ const handleSubmit = () => {
|
||||
})
|
||||
TestStatus.value = 'test_init_fail'
|
||||
}
|
||||
/* if (res.code === 20000) {
|
||||
TestStatus.value = 'start'
|
||||
webMsgSend.value = ''
|
||||
} else {
|
||||
ElMessage.error(res.message)
|
||||
}*/
|
||||
})
|
||||
TestStatus.value = 'start'
|
||||
} else if (TestStatus.value == 'paused') {
|
||||
// 发送继续指令
|
||||
sendResume()
|
||||
} else if (TestStatus.value == 'test_recheck') {
|
||||
// 发送重新检测指令
|
||||
sendReCheck()
|
||||
|
||||
|
||||
}else if (TestStatus.value == 'success') {
|
||||
emit('quitClicked'); // 触发事件
|
||||
}
|
||||
// else if (TestStatus.value == 'recheck') {
|
||||
// // 发送重新检测指令
|
||||
// sendReCheck()
|
||||
// }
|
||||
// else if (TestStatus.value == 'success') {
|
||||
// handleClose()
|
||||
// }
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -351,43 +298,64 @@ watch(TestStatus, function (newValue, oldValue) {
|
||||
})
|
||||
|
||||
watch(ActiveStatue, function (newValue, oldValue) {
|
||||
|
||||
if (newValue === 'success' || newValue === 'error') {
|
||||
skipDisabled.value = false
|
||||
}
|
||||
|
||||
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
nextStepText.value = '检测完成'
|
||||
}
|
||||
if (newValue === 'error' && stepsActiveIndex.value === stepsTotalNum.value - 3) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
if (newValue === 'error') {
|
||||
// stepsActiveIndex.value = stepsTotalNum.value + 2
|
||||
nextStepText.value = '检测失败'
|
||||
}
|
||||
if (newValue === 'test_init_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 1) {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '检测完成'
|
||||
}
|
||||
if (newValue === 'test_init_fail') {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '初始化失败'
|
||||
}
|
||||
if (newValue === 'connect_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
if (newValue === 'connect_timeout') {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '连接超时'
|
||||
}
|
||||
if (newValue === 'pause_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
nextStepText.value = '结束测试'
|
||||
if (newValue === 'pause_timeout') {
|
||||
stepsActiveIndex.value += 2
|
||||
// nextStepText.value = '结束测试'
|
||||
nextStepText.value = '暂停超时'
|
||||
}
|
||||
if (newValue === 'success' && stepsActiveIndex.value < stepsTotalNum.value - 1) {
|
||||
nextStep() // 实现自动点击,进入下一个测试内容
|
||||
handleSubmit()
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
const handleQuit = () => {
|
||||
console.log('handleQuit',ActiveStatue.value)
|
||||
if (ActiveStatue.value !== 'success' && ActiveStatue.value !== 'waiting' && ActiveStatue.value !== 'paused' && ActiveStatue.value !== 'test_init_fail' && ActiveStatue.value !== 'connect_timeout' && ActiveStatue.value !== 'pause_timeout') {
|
||||
beforeClose(() => {})
|
||||
} else {
|
||||
handleClose()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handlePause=()=>{
|
||||
sendPause()
|
||||
testRef.value?.handlePause()
|
||||
}
|
||||
const sendPause = () => {
|
||||
console.log('发起暂停请求')
|
||||
|
||||
TestStatus.value = 'paused_ing'
|
||||
pauseTest()
|
||||
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('发起继续检测请求')
|
||||
@@ -395,13 +363,13 @@ const sendResume = () => {
|
||||
resumeTest({
|
||||
userPageId: "cdf",
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.planId,
|
||||
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
||||
}).then(res => {
|
||||
planId: checkStore.plan.id,
|
||||
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
})
|
||||
Object.assign(webMsgSend.value, {
|
||||
requestId: 'Resume_Success'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const sendReCheck = () => {
|
||||
@@ -409,8 +377,9 @@ const sendReCheck = () => {
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.planId,
|
||||
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测
|
||||
planId: checkStore.plan.id,
|
||||
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 'A001014') {
|
||||
@@ -424,97 +393,86 @@ const sendReCheck = () => {
|
||||
TestStatus.value = 'start'
|
||||
}
|
||||
|
||||
const getIcon = (index: number) => {
|
||||
if (stepsActiveIndex.value > index) return SuccessFilled;
|
||||
switch (index) {
|
||||
case 0:
|
||||
return h(<svg-icon name="preTest"></svg-icon>);
|
||||
case 1:
|
||||
return UploadFilled;
|
||||
case 2:
|
||||
return Odometer;
|
||||
case 3:
|
||||
return Coin;
|
||||
case 4:
|
||||
return Key;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const nextStep = () => {
|
||||
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||
stepsActiveIndex.value++
|
||||
if (!isTimeCheck.value) {//不具备守时检测,预检测后直接跳正式检测
|
||||
if (stepsActiveIndex.value == stepsTotalNum.value + 1 || ActiveStatue.value === 'error' || ActiveStatue.value === 'test_init_fail' || ActiveStatue.value === 'connect_timeout' || ActiveStatue.value === 'pause_timeout') {
|
||||
handleClose()
|
||||
return
|
||||
}
|
||||
if (ActiveStatue.value != 'error') {
|
||||
ActiveStatue.value = 'waiting'
|
||||
let tempStep = stepsActiveIndex.value
|
||||
let idx = 1
|
||||
stepsActiveIndex.value++
|
||||
for (let selectTestItemsKey in checkStore.selectTestItems) {
|
||||
if (tempStep == 0 && checkStore.selectTestItems[selectTestItemsKey]) {
|
||||
stepsActiveView.value = idx
|
||||
stepsActive.value = idx
|
||||
return
|
||||
}
|
||||
if (checkStore.selectTestItems[selectTestItemsKey] && tempStep != 0) {
|
||||
tempStep--
|
||||
}
|
||||
idx++
|
||||
}
|
||||
}
|
||||
|
||||
ActiveStatue.value = 'waiting'
|
||||
} else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
||||
//emit('update:visible', false); // 关闭对话框
|
||||
clearData()
|
||||
dialogVisible.value = false;
|
||||
// if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||
// stepsActiveIndex.value++
|
||||
// if (!checkStore.selectTestItems.timeTest) { // 不具备守时检测
|
||||
// stepsActiveIndex.value++
|
||||
// }
|
||||
//
|
||||
// ActiveStatue.value = 'waiting'
|
||||
// } else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
||||
// //emit('update:visible', false); // 关闭对话框
|
||||
// clearData()
|
||||
// dialogVisible.value = false;
|
||||
// }
|
||||
}
|
||||
|
||||
const handleStepClick = (step: number) => {
|
||||
if (step > stepsActive.value) {
|
||||
return
|
||||
} else {
|
||||
stepsActiveView.value = step
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function clearData() {
|
||||
stepsActiveIndex.value = 0;
|
||||
stepsTotalNum.value = -1
|
||||
stepsActiveIndex.value = 1
|
||||
stepsActiveView.value = -1
|
||||
preTestStatus.value = "waiting"
|
||||
timeTestStatus.value = "waiting"
|
||||
channelsTestStatus.value = "waiting"
|
||||
TestStatus.value = "waiting"
|
||||
ActiveStatue.value = "waiting"
|
||||
skipDisabled.value = false
|
||||
nextStepText.value = "下一步"
|
||||
}
|
||||
|
||||
const beforeClose = (done: () => void) => {
|
||||
console.log(stepsActiveIndex.value, stepsTotalNum.value)
|
||||
if (stepsActiveIndex.value < stepsTotalNum.value) {
|
||||
ElMessageBox.confirm(
|
||||
'检测未完成,是否退出当前检测流程?',
|
||||
'提示',
|
||||
{
|
||||
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||
ElMessageBox.confirm('检测未完成,是否退出当前检测流程?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
clearData()
|
||||
// todo 关闭弹窗,终止整个检测流程
|
||||
//emit('update:visible', false); // 关闭对话框
|
||||
dialogVisible.value = false;
|
||||
).then(() => {
|
||||
handleClose()
|
||||
})
|
||||
} else {
|
||||
clearData()
|
||||
//emit('update:visible', false); // 关闭对话框
|
||||
dialogVisible.value = false;
|
||||
handleClose()
|
||||
}
|
||||
// ElMessageBox.confirm('Are you sure to close this dialog?')
|
||||
// .then(() => {
|
||||
// done()
|
||||
// })
|
||||
// .catch(() => {
|
||||
// // catch error
|
||||
// })
|
||||
}
|
||||
const handleCancel = () => {
|
||||
|
||||
const handleClose = () => {
|
||||
dataSocket.socketServe.closeWs()
|
||||
dialogVisible.value = false;
|
||||
clearData()
|
||||
showComponent.value = false;
|
||||
|
||||
emit('quitClicked'); // 触发事件
|
||||
// clearData()
|
||||
// emit('update:visible', false); // 关闭对话框
|
||||
};
|
||||
|
||||
|
||||
// // 当 props.visible 改变时,更新 formData
|
||||
// watch(() => props.visible, (newVal) => {
|
||||
// if (!newVal) {
|
||||
// // 这里可以重置表单数据,如果需要的话
|
||||
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({open})
|
||||
@@ -522,17 +480,21 @@ defineExpose({open})
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
.test-head-steps {
|
||||
::v-deep .el-step {
|
||||
.el-step__head.is-success {
|
||||
color: #91cc75;
|
||||
}
|
||||
.el-step__title.is-success{
|
||||
color: #91cc75;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.dialog-big .el-dialog__body) {
|
||||
max-height: 840px !important;
|
||||
}
|
||||
|
||||
// :deep(.dialog-big){
|
||||
// max-height: 840px !important;
|
||||
// }
|
||||
// :deep(.el-dialog__body){
|
||||
// max-height: 840px !important;
|
||||
// }
|
||||
|
||||
.steps-container :deep(.test-head-steps) {
|
||||
height: 80px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="right-title" >
|
||||
<span v-if="activeIndex <= 1"> </span>
|
||||
<span v-if="activeIndex > 1" class="time-text">
|
||||
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
|
||||
标准时间: <span style="color: var(--el-color-primary)">{{ gpsTime }}</span>
|
||||
</span>
|
||||
<div class="error-dsc">
|
||||
<div class="green-div"></div>
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
<!-- <span v-if="activeIndex <= 1"> </span>
|
||||
<span v-if="activeIndex > 1" style=" font-size: 18px;font-weight: 600;">
|
||||
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
|
||||
标准时间: <span style="color: var(--el-color-primary)">{{ gpsTime }}</span>
|
||||
</span>
|
||||
<div class="error-dsc">
|
||||
<div class="green-div"></div>
|
||||
@@ -423,7 +423,7 @@ watch(ts, function (newValue, oldValue) {
|
||||
}
|
||||
|
||||
.right-title .gps-time {
|
||||
color: #003078;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.error-dsc {
|
||||
@@ -440,7 +440,7 @@ watch(ts, function (newValue, oldValue) {
|
||||
}
|
||||
|
||||
.error-dsc .green-div {
|
||||
background-color: #67C23A;
|
||||
background-color: #91cc75;
|
||||
}
|
||||
|
||||
.error-dsc .red-div {
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
clearable
|
||||
v-model='searchForm.planName'
|
||||
></el-input>
|
||||
<el-tooltip content="检测计划列表" placement="top">
|
||||
<Menu style='width: 26px;height: 26px; margin-left: 8px;cursor: pointer;color:var(--el-color-primary)'
|
||||
@click.stop='detail()' />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div class='tree_container'>
|
||||
<el-tree
|
||||
@@ -40,6 +42,7 @@ import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue'
|
||||
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router'
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import { ElTooltip } from 'element-plus';
|
||||
|
||||
const router = useRouter()
|
||||
const checkStore = useCheckStore()
|
||||
@@ -64,10 +67,7 @@ const getTreeData = (val: any) => {
|
||||
if (item.children.length > 0) {
|
||||
let node = item.children[0];
|
||||
defaultChecked.value.push(node.id);
|
||||
checkStore.setPlanId(node.id);
|
||||
checkStore.setPlanCode(node.code);
|
||||
checkStore.setScriptId(node.scriptId);
|
||||
checkStore.setErrorSysId(node.errorSysId);
|
||||
checkStore.setPlan(node);
|
||||
// 高亮显示第一个节点
|
||||
// 使用 nextTick 确保在 DOM 更新后调用 setCurrentKey
|
||||
nextTick(() => {
|
||||
@@ -133,10 +133,7 @@ const handleNodeClick = (data: Plan.ResPlan) => {
|
||||
|
||||
idd.value = data.id
|
||||
|
||||
checkStore.setPlanId(data.id)
|
||||
checkStore.setPlanCode(data.code)
|
||||
checkStore.setScriptId(data.scriptId)
|
||||
checkStore.setErrorSysId(data.errorSysId)
|
||||
checkStore.setPlan(data);
|
||||
updateSelectedTreeNode(data.id)
|
||||
}
|
||||
const filterNode = (value: string, data: any) => {
|
||||
@@ -147,7 +144,7 @@ const filterNode = (value: string, data: any) => {
|
||||
|
||||
// 点击详情
|
||||
const detail = () => {
|
||||
router.push('/plan')
|
||||
router.push('/plan/planList')
|
||||
}
|
||||
onMounted(() => {
|
||||
// console.log()
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<el-tab-pane :label='tabLabel1' :style='{ height: tabPaneHeight}'>
|
||||
<!-- 列表数据 -->
|
||||
<div class='container_table' :style='{ height: tableHeight }'>
|
||||
<Table ref='tableRef1' :id='currentId' :isTimeCheck='isTimeCheck' :plan = 'select_Plan' @batchGenerateClicked="handleBatchGenerate"></Table>
|
||||
<Table ref='tableRef1' :id='currentId' :plan = 'select_Plan' @batchGenerateClicked="handleBatchGenerate"></Table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -145,7 +145,6 @@ const tabsHeight = ref('calc(100vh - 522px)') // 初始高度
|
||||
const tabPaneHeight = ref('calc(100% - 5px)') // 初始高度
|
||||
const tableHeight = ref('calc(100% - 50px)') // 初始高度
|
||||
|
||||
const isTimeCheck = ref<boolean>(false)
|
||||
const planList = ref<ResultData<Plan.ReqPlan[]>>()
|
||||
const select_Plan = ref<Plan.ReqPlan>()
|
||||
const isLabelLineShow = ref(true)
|
||||
@@ -169,7 +168,7 @@ const handleTabsChange = (val: any) => {
|
||||
form.value.activeChildTabs = Number(val)
|
||||
|
||||
}
|
||||
localStorage.setItem('color', 'red')
|
||||
localStorage.setItem('color', '#91cc75')
|
||||
//功能选择数据
|
||||
const tabsList = ref([
|
||||
{
|
||||
@@ -302,13 +301,6 @@ const getPieData = async (id: string) => {
|
||||
planName.value = '所选计划:' + plan.name
|
||||
|
||||
select_Plan.value = plan
|
||||
if (plan) {
|
||||
//isTimeCheck.value = plan.timeCheck === 1; // 将 1 转换为 true,0 转换为 false
|
||||
isTimeCheck.value = false // 将 1 转换为 true,0 转换为 false ----目前不用守时检测,先去除
|
||||
} else {
|
||||
// 处理未找到计划的情况
|
||||
isTimeCheck.value = false // 或者其他默认值
|
||||
}
|
||||
|
||||
const pqDevList_Result2 = await getBoundPqDevList({ 'planId': id, 'checkStateList': [0, 1, 2, 3] })
|
||||
boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[]
|
||||
|
||||
@@ -52,6 +52,7 @@ import { ElMessage } from "element-plus";
|
||||
import { useAuthStore } from "@/stores/modules/auth";
|
||||
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
|
||||
import { ref } from "vue";
|
||||
import {getCurrentScene} from "@/api/user/login";
|
||||
const authStore = useAuthStore();
|
||||
const modeStore = useModeStore(); // 使用模式 store
|
||||
const AppSceneStore = useAppSceneStore();
|
||||
@@ -82,7 +83,9 @@ const modeList = [
|
||||
];
|
||||
const handelOpen = async (item: any) => {
|
||||
modeStore.setCurrentMode(item.code); // 将模式code存入 store
|
||||
AppSceneStore.setCurrentMode('1');//0:省级平台,1:设备出厂,2:研发自测
|
||||
const {data:scene} = await getCurrentScene(); // 获取当前场景
|
||||
// AppSceneStore.setCurrentMode(scene+'');//0:省级平台,1:设备出厂,2:研发自测
|
||||
AppSceneStore.setCurrentMode(scene+'');//0:省级平台,1:设备出厂,2:研发自测
|
||||
await authStore.setShowMenu();
|
||||
return;
|
||||
// if (isActive) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<ProTable
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:data='logData'
|
||||
:request-api='getTableList'
|
||||
@selection-change='handleSelectionChange'
|
||||
type='selection'
|
||||
>
|
||||
@@ -21,41 +21,39 @@
|
||||
<script setup lang='tsx' name='useProTable'>
|
||||
// 根据实际路径调整
|
||||
import TimeControl from '@/components/TimeControl/index.vue'
|
||||
import { type Sys_Log_Audit } from '@/api/system/interface/log'
|
||||
import { type AuditLog} from '@/api/system/log/interface/log.ts'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import { Upload ,DataAnalysis} from '@element-plus/icons-vue'
|
||||
import logDataList from '@/api/system/log/logData'
|
||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||
import { reactive,ref,watch } from 'vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import {
|
||||
getAuditLog,
|
||||
} from '@/api/system/log/index.ts'
|
||||
|
||||
defineOptions({
|
||||
name: 'log'
|
||||
})
|
||||
|
||||
let multipleSelection = ref<string[]>([])
|
||||
const logData = logDataList
|
||||
const dictStore = useDictStore()
|
||||
// 定义包含和排除的单位
|
||||
const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
|
||||
const excludedUnits = ['季度','年']; // 要排除的单位
|
||||
const defaultUnits = '日'; // 默认的单位
|
||||
// defineOptions({
|
||||
// name: 'log'
|
||||
// })
|
||||
|
||||
const startDate = ref('')
|
||||
const endDate = ref('')
|
||||
// ProTable 实例
|
||||
const proTable = ref<ProTableInstance>()
|
||||
|
||||
|
||||
const getTableList = async (params: any) => {
|
||||
let newParams = JSON.parse(JSON.stringify(params))
|
||||
newParams.searchEndTime = endDate.value
|
||||
newParams.searchBeginTime = startDate.value
|
||||
return getAuditLog(newParams)
|
||||
}
|
||||
|
||||
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
||||
const columns = reactive<ColumnProps<AuditLog.ReqAuditLogParams>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||
{
|
||||
prop: 'id',
|
||||
label: '序号',
|
||||
width: 70,
|
||||
},
|
||||
{
|
||||
prop: 'create_By',
|
||||
prop: 'createBy',
|
||||
label: '操作用户',
|
||||
search: { el: 'input' },
|
||||
minWidth: 100,
|
||||
@@ -66,18 +64,17 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
prop: 'create_Time',
|
||||
prop: 'createTime',
|
||||
label: '记录时间',
|
||||
minWidth: 180,
|
||||
search: {
|
||||
span: 2,
|
||||
render: () => {
|
||||
return (
|
||||
<div class='flx-flex-start'>
|
||||
<TimeControl
|
||||
include={includedUnits}
|
||||
exclude={excludedUnits}
|
||||
default={defaultUnits}
|
||||
include={['日', '周', '月', '自定义']}
|
||||
default={'月'}
|
||||
onUpdate-dates={handleDateChange}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
@@ -105,21 +102,20 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'operate_Type',
|
||||
prop: 'operateType',
|
||||
label: '日志类型',
|
||||
width: 100,
|
||||
search: { el: 'select', props: { filterable: true } },
|
||||
},
|
||||
])
|
||||
|
||||
//选中
|
||||
// 处理选择变化
|
||||
const handleSelectionChange = (selection: Sys_Log_Audit.Audit_LogList[]) => {
|
||||
multipleSelection.value = selection.map(row => row.id) // 更新选中的行
|
||||
|
||||
// 处理日期变化的回调函数
|
||||
const handleDateChange = (startDateTemp: string, endDateTemp: string) => {
|
||||
startDate.value = startDateTemp
|
||||
endDate.value = endDateTemp
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<el-input v-model='loginForm.username' placeholder='用户名'>
|
||||
<template #prefix>
|
||||
<el-icon class='el-input__icon'>
|
||||
<user />
|
||||
<user/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
@@ -24,11 +24,14 @@
|
||||
>
|
||||
<template #prefix>
|
||||
<el-icon class='el-input__icon'>
|
||||
<lock />
|
||||
<lock/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop='checked'>
|
||||
<el-checkbox v-model="loginForm.checked">记住我</el-checkbox>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class='login-btn'>
|
||||
<el-button
|
||||
@@ -53,21 +56,22 @@
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
import { useRouter } from 'vue-router'
|
||||
import { HOME_URL } from '@/config'
|
||||
import { getTimeState } from '@/utils'
|
||||
import { type Dict } from '@/api/interface'
|
||||
import { type Login } from '@/api/user/interface/user'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import { getDictList, loginApi } from '@/api/user/login'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { useTabsStore } from '@/stores/modules/tabs'
|
||||
import { useKeepAliveStore } from '@/stores/modules/keepAlive'
|
||||
import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
||||
import { CircleClose, UserFilled } from '@element-plus/icons-vue'
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
import type { ElForm } from 'element-plus'
|
||||
import {useRouter} from 'vue-router'
|
||||
import {HOME_URL} from '@/config'
|
||||
import {getTimeState} from '@/utils'
|
||||
import {type Dict} from '@/api/interface'
|
||||
import {type Login} from '@/api/user/interface/user'
|
||||
import type {ElForm} from 'element-plus'
|
||||
import {ElNotification} from 'element-plus'
|
||||
import {getDictList, getPublicKey, loginApi} from '@/api/user/login'
|
||||
import {useUserStore} from '@/stores/modules/user'
|
||||
import {useTabsStore} from '@/stores/modules/tabs'
|
||||
import {useKeepAliveStore} from '@/stores/modules/keepAlive'
|
||||
import {initDynamicRouter} from '@/routers/modules/dynamicRouter'
|
||||
import {CircleClose, UserFilled} from '@element-plus/icons-vue'
|
||||
import {useAuthStore} from '@/stores/modules/auth'
|
||||
import {useDictStore} from "@/stores/modules/dict";
|
||||
import forge from 'node-forge'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const router = useRouter()
|
||||
@@ -76,19 +80,22 @@ const tabsStore = useTabsStore()
|
||||
const keepAliveStore = useKeepAliveStore()
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const isAutoLogin = ref(false)
|
||||
let publicKey: any = null;
|
||||
|
||||
|
||||
type FormInstance = InstanceType<typeof ElForm>;
|
||||
const loginFormRef = ref<FormInstance>()
|
||||
const loginRules = reactive({
|
||||
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
||||
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
|
||||
username: [{required: true, message: '请输入用户名', trigger: 'blur'}],
|
||||
password: [{required: true, message: '请输入密码', trigger: 'blur'}],
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const loginForm = reactive<Login.ReqLoginForm>({
|
||||
username: '',
|
||||
password: '',
|
||||
checked: false,
|
||||
})
|
||||
|
||||
// login
|
||||
@@ -98,11 +105,28 @@ const login = (formEl: FormInstance | undefined) => {
|
||||
if (!valid) return
|
||||
loading.value = true
|
||||
try {
|
||||
if (!isAutoLogin.value) {
|
||||
let {data: publicKeyBase64}: { data: string } = await getPublicKey(loginForm.username, loginForm.checked)
|
||||
//将base64格式的公钥转换为Forge可以使用的格式
|
||||
const publicKeyDer = forge.util.decode64(publicKeyBase64);
|
||||
publicKey = forge.pki.publicKeyFromPem(forge.pki.publicKeyToPem(forge.pki.publicKeyFromAsn1(forge.asn1.fromDer(publicKeyDer))));
|
||||
}
|
||||
|
||||
// 1.执行登录接口
|
||||
const { data } = await loginApi({
|
||||
...loginForm,
|
||||
password: loginForm.password,
|
||||
const {data} = await loginApi({
|
||||
username: forge.util.encode64(loginForm.username),
|
||||
password: isAutoLogin.value ? loginForm.password : encryptPassword(loginForm.password),
|
||||
checked: loginForm.checked
|
||||
})
|
||||
if (loginForm.checked) {
|
||||
localStorage.setItem("loginInfo", JSON.stringify({
|
||||
username: forge.util.encode64(loginForm.username),
|
||||
password: isAutoLogin.value ? loginForm.password : encryptPassword(loginForm.password),
|
||||
exp: Date.now() + 1000 * 60 * 60 * 24 * 30
|
||||
}))
|
||||
} else {
|
||||
localStorage.removeItem("loginInfo")
|
||||
}
|
||||
userStore.setAccessToken(data.accessToken)
|
||||
userStore.setRefreshToken(data.refreshToken)
|
||||
userStore.setUserInfo(data.userInfo)
|
||||
@@ -148,6 +172,27 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const encryptPassword = (password: string) => {
|
||||
const encrypted = publicKey.encrypt(password, 'RSAES-PKCS1-V1_5');
|
||||
// 将加密后的数据转换为base64格式以便传输
|
||||
return forge.util.encode64(encrypted);
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
let loginInfoJSON = localStorage.getItem("loginInfo")
|
||||
if (loginInfoJSON) {
|
||||
const loginInfo = JSON.parse(loginInfoJSON)
|
||||
if (loginInfo.exp < Date.now()) {
|
||||
localStorage.removeItem("loginInfo")
|
||||
} else {
|
||||
isAutoLogin.value = true
|
||||
loginForm.username = forge.util.decode64(loginInfo.username)
|
||||
loginForm.password = loginInfo.password
|
||||
loginForm.checked = true
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
height: 100%;
|
||||
min-height: 550px;
|
||||
// background-color: #eeeeee;
|
||||
background-color: #003078;
|
||||
background-color: var(--el-color-primary);
|
||||
background-image: url("@/assets/images/login_bg.svg");
|
||||
background-size: 100% 100%;
|
||||
background-size: cover;
|
||||
|
||||
@@ -0,0 +1,715 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="divider-container">
|
||||
<el-divider style="width: 260px" content-position="left">检测脚本信息</el-divider>
|
||||
<el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider>
|
||||
</div>
|
||||
<div class="data-check-content">
|
||||
<div class="content-tree">
|
||||
<Tree ref="treeRef" :treeData="treeData" @setTab="setTab" />
|
||||
</div>
|
||||
|
||||
<div class="content-right-Tabs" style="height: calc(100vh - 315px); width: 100px">
|
||||
<el-tabs type="border-card" style="height: 100%" v-model="activeName" @tab-change="tabChange">
|
||||
<el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
|
||||
<div v-if="activeName == tab.value">
|
||||
<div class="dialog-footer">
|
||||
<!-- <el-button :icon="CirclePlus" type="primary" @click="openDialog('add')">新增</el-button>-->
|
||||
</div>
|
||||
<div style="display: flex">
|
||||
<!-- 通信脚本 -->
|
||||
<el-tabs type="border-card" v-model="firstName" style="height: 100%" class="hidden-tab">
|
||||
<el-tab-pane label="通讯脚本" name="first">
|
||||
<Commun
|
||||
:activeName="activeName"
|
||||
:formContent="props.formContent"
|
||||
:options="props.options"
|
||||
style="width: 360px"
|
||||
:disabled="tab.children.length == 0 ? false : true"
|
||||
ref="communRef"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<!-- 2级tab -->
|
||||
<el-tabs
|
||||
type="border-card"
|
||||
style="flex: 1; margin-left: 10px"
|
||||
v-model="childActiveName"
|
||||
@tab-change="inquireTable"
|
||||
>
|
||||
<el-tab-pane
|
||||
v-for="subTab in tab.children || []"
|
||||
:key="subTab.value"
|
||||
:label="subTab.label"
|
||||
:name="subTab.value"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
height="calc(100vh - 480px)"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column type="index" label="组次" width="60" />
|
||||
<el-table-column prop="ffreq" label="频率(Hz)" width="90" />
|
||||
<el-table-column
|
||||
:label="item.label"
|
||||
v-for="item in column"
|
||||
:key="item.label"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<table class="tableL">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="theFirst">V</td>
|
||||
<td>
|
||||
{{
|
||||
row.channelList[item.num].famp == null
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num]?.famp +
|
||||
(valueCode == 'Absolute' ? 'V' : '%')
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
row.channelList[item.num].fphase == null
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num].fphase +
|
||||
'°'
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="theFirst">I</td>
|
||||
<td>
|
||||
{{
|
||||
row.channelList[item.num + 1].famp == null
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num + 1].famp +
|
||||
(valueCode == 'Absolute' ? 'A' : '%')
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
row.channelList[item.num + 1].fphase == null
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num + 1].fphase +
|
||||
'°'
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="165">
|
||||
<template #default="{ row }">
|
||||
<div class="actionButtons">
|
||||
<el-button type="primary" link :icon="View" @click="view(row)">
|
||||
查看
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div class="page">
|
||||
<div class="black-container">
|
||||
<!-- <el-progress-->
|
||||
<!-- v-if="loading"-->
|
||||
<!-- type="circle"-->
|
||||
<!-- >-->
|
||||
<!-- <template #default="{}">-->
|
||||
<!-- <span class="Loading">Loading</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-progress>-->
|
||||
<div class="loading-container" v-if="showLoading">
|
||||
<div style="width: 80%; height: 80%" class="loading-box">
|
||||
<div class="loading-circle"></div>
|
||||
<div class="loading-text">Loading...</div>
|
||||
</div>
|
||||
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||
</div>
|
||||
<div class="loading-container" v-else>
|
||||
<div style="width: 80%; height: 80%" class="loading-box">
|
||||
<div class="loading-circle static"></div>
|
||||
<div class="loading-text">Loading</div>
|
||||
</div>
|
||||
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 10px">
|
||||
<span>标准源加量输出:{{ hour }}时{{ minute }}分{{ second }}秒</span>
|
||||
</div>
|
||||
<div style="margin-top: 10px">
|
||||
<el-button
|
||||
:icon="VideoPlay"
|
||||
type="primary"
|
||||
size="large"
|
||||
@click="startLoading"
|
||||
:disabled="pauseDisabled"
|
||||
>
|
||||
启动
|
||||
</el-button>
|
||||
<el-button
|
||||
:icon="VideoPause"
|
||||
type="primary"
|
||||
size="large"
|
||||
@click="stopLoading"
|
||||
:disabled="pauseDisabled"
|
||||
>
|
||||
停止
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<TestProjectPopup
|
||||
ref="testProjectPopupRef"
|
||||
:options="props.options"
|
||||
:activeName="activeName"
|
||||
:childActiveName="childActiveName"
|
||||
:formContent="props.formContent"
|
||||
:communicationList="communicationList"
|
||||
@addTab="addTab"
|
||||
@getCommunication="getCommunication"
|
||||
@close="showDialog = false"
|
||||
v-if="showDialog"
|
||||
/>
|
||||
<!-- 查看 -->
|
||||
<ViewRow
|
||||
ref="viewRowRef"
|
||||
:activeName="activeName"
|
||||
:formContent="props.formContent"
|
||||
@close="viewDialog = false"
|
||||
v-if="viewDialog"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { type PropType, ref, nextTick, onMounted, watch } from 'vue'
|
||||
import Tree from './tree.vue'
|
||||
import Commun from '@/views/machine/testScript/components//communication.vue'
|
||||
import { type CascaderOption, ElMessage } from 'element-plus'
|
||||
import { getTreeData } from '@/api/check/test'
|
||||
import {
|
||||
CirclePlus,
|
||||
Delete,
|
||||
Check,
|
||||
CopyDocument,
|
||||
View,
|
||||
EditPen,
|
||||
VideoPlay,
|
||||
VideoPause,
|
||||
Loading
|
||||
} from '@element-plus/icons-vue'
|
||||
import type { TestScript } from '@/api/device/interface/testScript'
|
||||
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
|
||||
import { CheckData } from '@/api/check/interface'
|
||||
import { dlsDetails, deleteDtls, updateDtls, addScriptDtls, checkDataList } from '@/api/device/testScript'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { scriptDtlsCheckDataList } from '@/api/device/testScript/index'
|
||||
import ViewRow from '@/views/machine/testScript/components/viewRow.vue'
|
||||
import { startSimulateTest, closeSimulateTest } from '@/api/device/controlSource/index.ts'
|
||||
import { controlSource } from '@/api/device/interface/controlSource'
|
||||
interface TabOption {
|
||||
label?: string
|
||||
name?: string
|
||||
value?: string
|
||||
code?: string
|
||||
children?: TabOption[]
|
||||
}
|
||||
|
||||
const treeRef = ref()
|
||||
const communRef = ref()
|
||||
const treeData = ref<CheckData.TreeItem[]>([])
|
||||
const valueCode = ref('') //Absolute绝对值
|
||||
const props = defineProps({
|
||||
options: {
|
||||
type: Array as PropType<TabOption[]>,
|
||||
required: true
|
||||
},
|
||||
formContent: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
formControl: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
startDisabeld: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
pauseDisabled: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const showDialog = ref(false)
|
||||
const viewDialog = ref(false)
|
||||
const dictStore = useDictStore()
|
||||
const activeName = ref('')
|
||||
const childActiveName = ref('')
|
||||
const childActiveIndex = ref(0)
|
||||
const firstName = 'first'
|
||||
const viewRowRef = ref()
|
||||
const communicationList = ref<[]>([])
|
||||
const testProjectPopupRef = ref()
|
||||
const tableData: any = ref([])
|
||||
const tabData: any = ref([])
|
||||
|
||||
const showLoading = ref(false)
|
||||
const column = ref([
|
||||
{
|
||||
label: 'L1',
|
||||
num: 0
|
||||
},
|
||||
{
|
||||
label: 'L2',
|
||||
num: 2
|
||||
},
|
||||
{
|
||||
label: 'L3',
|
||||
num: 4
|
||||
}
|
||||
])
|
||||
|
||||
// 时间计数器
|
||||
let timer: any = null
|
||||
const timeCount = ref(0)
|
||||
const hour = ref(0)
|
||||
const minute = ref(0)
|
||||
const second = ref(0)
|
||||
|
||||
const emit = defineEmits(['update:activeName', 'update:activeIndex', 'update:startDisabeld', 'update:pauseDisabled'])
|
||||
|
||||
watch(
|
||||
() => props.formControl.scriptId,
|
||||
async () => {
|
||||
if (props.formControl.scriptId != '') {
|
||||
nextTick(async () => {
|
||||
await getTree()
|
||||
console.log('props.formControl.scriptId')
|
||||
treeRef.value.checkTree()
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
const controlContent = ref<controlSource.ResControl>({
|
||||
userPageId: '',
|
||||
scriptId: '',
|
||||
scriptIndex: 0,
|
||||
sourceId: ''
|
||||
})
|
||||
// 获取树
|
||||
const getTree = () => {
|
||||
getTreeData({
|
||||
scriptId: props.formControl.scriptId
|
||||
}).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
treeData.value = res.data
|
||||
//console.log('tree',res.data)
|
||||
// 为 treeData 及其子节点添加 id
|
||||
let idCounter = 0
|
||||
const addIdToTree = (nodes: any[]) => {
|
||||
nodes.forEach(node => {
|
||||
node.id = idCounter++ // 为每个节点添加唯一的 id
|
||||
if (node.children && node.children.length > 0) {
|
||||
node.disabled = true
|
||||
addIdToTree(node.children) // 递归为子节点添加 id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
addIdToTree(treeData.value)
|
||||
|
||||
// 添加tab子项
|
||||
props.options.forEach((k: any, i: number) => {
|
||||
tabData.value[i].children = []
|
||||
treeData.value.forEach((item: any) => {
|
||||
if (k.value == item.scriptTypeCode) {
|
||||
item.children.forEach((s: any) => {
|
||||
k.children.forEach((P: any) => {
|
||||
if (P.code == s.scriptTypeCode) {
|
||||
tabData.value[i].children.push({
|
||||
label: P.label,
|
||||
value: P.code,
|
||||
children: []
|
||||
})
|
||||
} else {
|
||||
s.children.forEach((j: any) => {
|
||||
if (j.scriptTypeCode == P.code) {
|
||||
tabData.value[i].children.push({
|
||||
label: P.label,
|
||||
value: P.code,
|
||||
children: []
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
//console.log('2222',treeData.value)
|
||||
|
||||
tabChange()
|
||||
}
|
||||
})
|
||||
//console.log('获取树')
|
||||
}
|
||||
|
||||
// 设置树点击tab
|
||||
const setTab = row => {
|
||||
activeName.value = row.activeName
|
||||
childActiveName.value = row.childActiveName
|
||||
childActiveIndex.value = row.activeIndex
|
||||
getTree()
|
||||
emit('update:activeName', activeName.value) // 触发事件并传递 activeName.value
|
||||
emit('update:activeIndex', row.activeIndex) // 触发事件并传递 activeName.value
|
||||
}
|
||||
const copyActiveName = ref('')
|
||||
// 获取通讯脚本点击
|
||||
const getCommunication = () => {
|
||||
//console.log('controlSourceDetail',communRef.value[0]?.getData())
|
||||
communicationList.value = communRef.value[0]?.getData()
|
||||
}
|
||||
// 切换大tab控制小tab
|
||||
const tabChange = () => {
|
||||
if (copyActiveName.value != activeName.value) {
|
||||
copyActiveName.value == activeName.value
|
||||
|
||||
if (
|
||||
tabData.value
|
||||
.filter((item: any) => item.value == activeName.value)[0]
|
||||
?.children.filter((item: any) => item.value == childActiveName.value).length == 0
|
||||
) {
|
||||
childActiveName.value =
|
||||
tabData.value.filter((item: any) => item.value == activeName.value)[0]?.children[0]?.value || ''
|
||||
}
|
||||
}
|
||||
inquireTable()
|
||||
}
|
||||
//根据脚本id查询检测脚本详情
|
||||
const inquireTable = () => {
|
||||
const sortOrder = ['Ua', 'Ia', 'Ub', 'Ib', 'Uc', 'Ic']
|
||||
dlsDetails({
|
||||
scriptId: props.formControl.scriptId,
|
||||
scriptType: activeName.value,
|
||||
scriptSubType: childActiveName.value
|
||||
}).then((res: any) => {
|
||||
if (res.code === 'A0000') {
|
||||
res.data.forEach((item: any) => {
|
||||
item.channelList = item.channelList.sort((a: any, b: any) => {
|
||||
const indexA = sortOrder.indexOf(a.channelType)
|
||||
const indexB = sortOrder.indexOf(b.channelType)
|
||||
return indexA - indexB
|
||||
})
|
||||
})
|
||||
|
||||
tableData.value = res.data
|
||||
}
|
||||
})
|
||||
|
||||
//console.log('treeData',treeData.value)
|
||||
}
|
||||
|
||||
// 查看
|
||||
const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||
getCommunication()
|
||||
//当前点击的一级tab
|
||||
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'
|
||||
//当前点击的二级tab
|
||||
const childrenTabName = ref('')
|
||||
tabData.value.forEach((item: any) => {
|
||||
if (item.value == activeName.value) {
|
||||
item.children.forEach((k: any) => {
|
||||
if (k.value == childActiveName.value) {
|
||||
childrenTabName.value = k.label
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
viewDialog.value = true
|
||||
setTimeout(() => {
|
||||
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
|
||||
}, 0)
|
||||
}
|
||||
|
||||
// 定义 startLoading 方法
|
||||
const startLoading = async () => {
|
||||
emit('update:startDisabeld', true)
|
||||
emit('update:pauseDisabled', true)
|
||||
ElMessage.success({ message: '启动中...', duration: 6000 })
|
||||
// 启动加载逻辑
|
||||
controlContent.value.userPageId = 'cdf'
|
||||
controlContent.value.scriptId = props.formControl.scriptId
|
||||
controlContent.value.scriptIndex = childActiveIndex.value
|
||||
controlContent.value.sourceId = props.formControl.sourceId
|
||||
setTimeout(async () => {
|
||||
await startSimulateTest(controlContent.value)
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
// 定义 startLoading 方法
|
||||
const stopLoading = async () => {
|
||||
// 启动加载逻辑
|
||||
controlContent.value.userPageId = 'cdf'
|
||||
controlContent.value.scriptId = props.formControl.scriptId
|
||||
controlContent.value.scriptIndex = childActiveIndex.value
|
||||
controlContent.value.sourceId = props.formControl.sourceId
|
||||
await closeSimulateTest(controlContent.value)
|
||||
emit('update:pauseDisabled', true)
|
||||
emit('update:startDisabeld', true)
|
||||
ElMessage.success({ message: '停止中...', duration: 5000 })
|
||||
}
|
||||
|
||||
const startTimeCount = () => {
|
||||
// Loading效果展示
|
||||
showLoading.value = true
|
||||
|
||||
if (!timer) {
|
||||
hour.value = 0
|
||||
minute.value = 0
|
||||
second.value = 0
|
||||
timeCount.value = 0
|
||||
timer = setInterval(() => {
|
||||
timeCount.value = timeCount.value + 1
|
||||
secondToTime(timeCount.value)
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
const secondToTime = (secd: number) => {
|
||||
//将秒数转换成时分秒
|
||||
hour.value = Math.floor(secd / 3600)
|
||||
minute.value = Math.floor((secd - hour.value * 3600) / 60)
|
||||
second.value = Math.floor(secd % 60)
|
||||
}
|
||||
|
||||
const stopTimeCount = () => {
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
//Loading效果关闭
|
||||
showLoading.value = false
|
||||
}
|
||||
|
||||
// 获取左边树数据
|
||||
// 新增保存
|
||||
const addTab = (row: any) => {
|
||||
getTree()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getTree()
|
||||
props.options.forEach((item: any) => {
|
||||
tabData.value.push({
|
||||
label: item.label.replace(/准确度|检测/g, ''),
|
||||
value: item.value,
|
||||
code: item.code,
|
||||
children: []
|
||||
})
|
||||
})
|
||||
activeName.value = tabData.value[0].value
|
||||
|
||||
valueCode.value = dictStore
|
||||
.getDictData('Script_Value_Type')
|
||||
.filter(item => item.id == props.formContent.valueType)[0].code
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
startTimeCount,
|
||||
stopTimeCount
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.data-check-content {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.content-tree {
|
||||
width: 260px;
|
||||
height: calc(100vh - 315px);
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
// margin-right: 10px;
|
||||
overflow: auto; /* 同时启用垂直和水平滚动 */
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.scriptTree {
|
||||
height: calc(100vh - 520px);
|
||||
}
|
||||
|
||||
/* 确保 el-tree 内容可以超出容器宽度 */
|
||||
.el-tree {
|
||||
width: fit-content; /* 根据内容自适应宽度 */
|
||||
}
|
||||
|
||||
.content-right-Tabs {
|
||||
flex: 1; /* 根据需要调整宽度比例 */
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
display: flex;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.divider-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.divider-container .el-divider {
|
||||
margin-right: 30px; /* 根据需要调整间距 */
|
||||
}
|
||||
:deep(.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell) {
|
||||
padding: 3px 11px;
|
||||
}
|
||||
:deep(.el-loading-mask) {
|
||||
z-index: 3000;
|
||||
}
|
||||
.tableL {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
|
||||
td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 5px;
|
||||
width: 45%;
|
||||
}
|
||||
.theFirst {
|
||||
background-color: var(--el-color-primary);
|
||||
color: #fff;
|
||||
width: 20px !important;
|
||||
}
|
||||
}
|
||||
.actionButtons {
|
||||
.el-button {
|
||||
margin-left: 0px;
|
||||
margin: 5px 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.black-container {
|
||||
background-color: #000;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
position: relative; /* 设置为相对定位 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.loading-box {
|
||||
position: relative; /* 设置为相对定位 */
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.loading-circle {
|
||||
border: 8px solid rgba(255, 255, 255, 0.932);
|
||||
border-top: 8px solid var(--el-color-primary); /* 蓝色 */
|
||||
border-bottom: 8px solid var(--el-color-primary); /* 蓝色 */
|
||||
border-radius: 50%;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
position: absolute; /* 设置为绝对定位 */
|
||||
animation: spin 2s linear infinite;
|
||||
}
|
||||
|
||||
.loading-circle.static {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
position: absolute; /* 设置为绝对定位 */
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
color: #fff;
|
||||
font-size: 20px; /* 根据需要调整字体大小 */
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.hidden-tab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
input::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none !important;
|
||||
}
|
||||
|
||||
input::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none !important;
|
||||
}
|
||||
.el-divider--horizontal {
|
||||
margin: 4px 0 24px 0;
|
||||
}
|
||||
.el-tabs--border-card > .el-tabs__content {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
166
frontend/src/views/machine/controlSource/components/tree.vue
Normal file
166
frontend/src/views/machine/controlSource/components/tree.vue
Normal file
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<el-tree
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
:data="props.treeData"
|
||||
:props="defaultProps"
|
||||
style="width: 100%"
|
||||
:expand-on-click-node="false"
|
||||
:highlight-current="true"
|
||||
@node-click="handleNodeClick"
|
||||
show-checkbox
|
||||
:check-strictly="true"
|
||||
@check-change="handleCheckChange"
|
||||
ref="treeRef"
|
||||
>
|
||||
<template #default="{ node, data }">
|
||||
<el-tooltip effect="dark" :content="data.sourceDesc || data.scriptTypeName" placement="top" :hide-after="0">
|
||||
<div class="custom-tree-node">
|
||||
{{ data.scriptTypeName || data.sourceDesc }}
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-tree>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, watch, nextTick } from 'vue'
|
||||
|
||||
import { CheckData } from '@/api/check/interface'
|
||||
import { da } from 'element-plus/es/locale'
|
||||
import { on } from 'events'
|
||||
const props = defineProps({
|
||||
treeData: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
|
||||
})
|
||||
const emit = defineEmits(['setTab'])
|
||||
const dataTree = ref<CheckData.TreeItem[]>([])
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'scriptTypeName',
|
||||
pid: 'pid'
|
||||
}
|
||||
const activeName = ref('')
|
||||
const childActiveName = ref('')
|
||||
const activeIndex = ref()
|
||||
const treeRef = ref()
|
||||
const handleNodeClick = (data, node) => {
|
||||
if(data.index!= null){
|
||||
let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
|
||||
const parents = getParentNodes(node, [])
|
||||
parents.pop()
|
||||
parents.unshift(node.data)
|
||||
parents.reverse()
|
||||
let active = parents[0].scriptTypeCode
|
||||
let childActive = findTargetCodes(parents, code)[0] || ''
|
||||
// 获取当前节点的直接父节点
|
||||
if (activeName.value != active || childActiveName.value != childActive || activeIndex.value != data.index) {
|
||||
activeName.value = active
|
||||
childActiveName.value = childActive
|
||||
emit('setTab', {
|
||||
activeName: active,
|
||||
childActiveName: childActive,
|
||||
activeIndex:data.index
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 返回父级
|
||||
const getParentNodes = (node, parents) => {
|
||||
if (node.parent) {
|
||||
// 将父节点添加到数组中
|
||||
parents.push(node.parent.data)
|
||||
// 递归获取更高层级的父节点
|
||||
getParentNodes(node.parent, parents)
|
||||
}
|
||||
return parents
|
||||
}
|
||||
// 判断childActiveName值
|
||||
function findTargetCodes(data: any[], targetCodes: string[]) {
|
||||
let result: string[] = []
|
||||
data.forEach(item => {
|
||||
if (item.scriptTypeCode != null) {
|
||||
if (targetCodes.includes(item.scriptTypeCode)) {
|
||||
result.push(item.scriptTypeCode)
|
||||
}
|
||||
}
|
||||
})
|
||||
return result
|
||||
// for (let item of data) {
|
||||
// // 判断当前项的 scriptTypeCode 是否包含目标值
|
||||
// if (item.scriptTypeCode !=null && targetCodes.includes(item.scriptTypeCode)) {
|
||||
// console.log("🚀 ~ findTargetCodes ~ targetCodes.includes(item.scriptTypeCode):",item.scriptTypeCode, targetCodes.includes(item.scriptTypeCode))
|
||||
// result.push(item.scriptTypeCode)
|
||||
// return result
|
||||
// }
|
||||
// // 如果存在 children,递归检查
|
||||
// if (item.children && item.children.length > 0) {
|
||||
// result = result.concat(findTargetCodes(item.children, targetCodes))
|
||||
// }
|
||||
// }
|
||||
// return result
|
||||
}
|
||||
|
||||
function handleCheckChange(data,isChecked) {
|
||||
if (isChecked)
|
||||
{
|
||||
// 如果没有子节点,允许勾选
|
||||
const checked = [data.id]; // id为tree的node-key属性
|
||||
treeRef.value?.setCheckedKeys(checked);
|
||||
emit('setTab', {
|
||||
activeName: data.scriptType,
|
||||
childActiveName: data.scriptTypeCode,
|
||||
activeIndex:data.index
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 递归查找第一个节点的最后一层子节点
|
||||
function findFirstLeafNode(node: any): any {
|
||||
if (node.children && node.children.length > 0) {
|
||||
return findFirstLeafNode(node.children[0]);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
const checkTree = () => {
|
||||
console.log('checkTree11')
|
||||
console.log('checkTree22',props.treeData.length)
|
||||
console.log('checkTree33',treeRef.value)
|
||||
if (props.treeData.length > 0 && treeRef.value) {
|
||||
console.log('checkTree44')
|
||||
const firstNode = props.treeData[0];
|
||||
const firstLeafNode = findFirstLeafNode(firstNode);
|
||||
const firstLeafNodeId = firstLeafNode.id;
|
||||
treeRef.value.setCheckedKeys([firstLeafNodeId]);
|
||||
}
|
||||
}
|
||||
|
||||
// 确保在组件挂载后也执行一次
|
||||
onMounted(() => {
|
||||
console.log('onMounted',props.treeData);
|
||||
nextTick(() => {
|
||||
checkTree()
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// // 对外映射
|
||||
defineExpose({ checkTree })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.custom-tree-node {
|
||||
max-width: 230px;
|
||||
overflow-x: hidden !important;
|
||||
white-space: nowrap !important;
|
||||
text-overflow: ellipsis !important;
|
||||
}
|
||||
</style>
|
||||
366
frontend/src/views/machine/controlSource/index.vue
Normal file
366
frontend/src/views/machine/controlSource/index.vue
Normal file
@@ -0,0 +1,366 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card style="margin-bottom: 10px" class="cardTop">
|
||||
<el-form
|
||||
:inline="true"
|
||||
label-width="auto"
|
||||
ref="dialogFormRef"
|
||||
class="form-four"
|
||||
>
|
||||
<el-form-item label='检测源' prop='sourceId' >
|
||||
<el-select v-model="controlContent.sourceId" collapse-tags placeholder="请选择检测源">
|
||||
<el-option
|
||||
v-for="(option, index) in pqSourceArray"
|
||||
:key="index"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label='检测脚本' prop='scriptId'>
|
||||
<el-select v-model="controlContent.scriptId" collapse-tags placeholder="请选择检测脚本" @change="handleScriptChange">
|
||||
<el-option
|
||||
v-for="(option, index) in scriptArray"
|
||||
:key="index"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<!-- <div class="formBut">-->
|
||||
<el-button type="primary" :icon="Select" @click="start()" :disabled="connectDisabeld">通讯校验</el-button>
|
||||
<el-button v-if="!connectDisabeld" type="text" style="color: #303133" disabled>源未连接</el-button>
|
||||
<el-button v-else type="text" style="color: #91cc75" disabled>源连接成功</el-button>
|
||||
<!-- </div>-->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card v-if="show">
|
||||
<ControlSourceDetail v-if="secondLevelOptions.length > 0" :options="secondLevelOptions" :formContent="formContent" :formControl="controlContent"
|
||||
@update:activeName="handleActiveNameChange"
|
||||
@update:active-index="handleActiveIndexChange"
|
||||
|
||||
v-model:startDisabeld="startDisabeld"
|
||||
@update:startDisabeld="startDisabeld=$event"
|
||||
v-model:pauseDisabled="pauseDisabled"
|
||||
@update:pauseDisabled="pauseDisabled=$event"
|
||||
ref="controlSourceDetailRef"/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, nextTick, onMounted, onBeforeMount, reactive, watch } from 'vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import ControlSourceDetail from '@/views/machine/controlSource/components/controlSourceDetail.vue'
|
||||
import { type TestScript } from '@/api/device/interface/testScript'
|
||||
import type { Dict } from '@/api/system/dictionary/interface'
|
||||
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||
import { Select } from '@element-plus/icons-vue'
|
||||
import { pqScriptAdd } from '@/api/device/testScript'
|
||||
import { getTestSourceList } from '@/api/plan/plan.ts'
|
||||
import { TestSource } from '@/api/device/interface/testSource'
|
||||
import { CascaderOption, ElMessage } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||
import socketClient from '@/utils/webSocketClient'
|
||||
import { checkSimulate } from '@/api/device/controlSource/index.ts'
|
||||
import { controlSource } from '@/api/device/interface/controlSource'
|
||||
import {getPqScriptList} from '@/api/plan/plan.ts'
|
||||
|
||||
const show = ref(false)
|
||||
const router = useRouter()
|
||||
const modeId = ref()
|
||||
const sourceValue = ref([])
|
||||
const secondLevelOptions: any[] = []
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
const dictStore = useDictStore()
|
||||
const pqSourceList=ref<TestSource.ResTestSource[]>([])//获取指定模式下所有检测源
|
||||
const modeStore = useModeStore()
|
||||
const pqSourceArray = ref<{ label: string; value: string; }[]>()
|
||||
const scriptArray = reactive<{label: string, value: string}[]>([])
|
||||
// const formContent = ref<TestScript.ResTestScript>({
|
||||
// id : '9ff96807cf8c7524587982ed8baa8b57',
|
||||
// name: '测试',
|
||||
// type: '1',
|
||||
// valueType: '2973cb938b591b93d0df2547599b87d8',
|
||||
// pattern: modeId.value,
|
||||
// standardName: 'GBT 19862',
|
||||
// standardTime: '2025',
|
||||
// state: 1
|
||||
// })
|
||||
const formContent = ref<TestScript.ResTestScript>({
|
||||
id : '',
|
||||
name: '',
|
||||
type: '',
|
||||
valueType: '',
|
||||
pattern: modeId.value,
|
||||
standardName: '',
|
||||
standardTime: '',
|
||||
state: 1
|
||||
})
|
||||
const connectDisabeld = ref(false)
|
||||
const startDisabeld = ref(true)
|
||||
const pauseDisabled = ref(true)
|
||||
const controlSourceDetailRef=ref<InstanceType<typeof ControlSourceDetail>>()
|
||||
|
||||
const controlContent = ref<controlSource.ResControl>({
|
||||
userPageId: '',
|
||||
scriptId: '',
|
||||
scriptIndex: 0,
|
||||
sourceId: '',
|
||||
})
|
||||
//开始创建webSocket客户端
|
||||
const dataSocket = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
});
|
||||
const webMsgSend = ref()//webSocket推送的数据
|
||||
|
||||
onMounted(async () => {
|
||||
// 检查 socketClient.Instance 是否存在
|
||||
if (!socketClient.Instance) {
|
||||
console.error('WebSocket 客户端实例不存在');
|
||||
return;
|
||||
}
|
||||
socketClient.Instance.connect();
|
||||
dataSocket.socketServe = socketClient.Instance;
|
||||
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
||||
// 处理来自服务器的消息
|
||||
//console.log('Received message:', res)
|
||||
// 根据需要在这里添加更多的处理逻辑
|
||||
if (res.code === 20000) {
|
||||
ElMessage.error(message.message)
|
||||
loading.close()
|
||||
} else {
|
||||
webMsgSend.value = res
|
||||
}
|
||||
})
|
||||
|
||||
const pqSource_Result = await getTestSourceList({
|
||||
pattern: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ,
|
||||
datasourceIds: '',
|
||||
sourceIds: '',
|
||||
planId: '',
|
||||
scriptName: '',
|
||||
errorSysName: '',
|
||||
sourceName: '',
|
||||
devIds: [],
|
||||
id: '',
|
||||
name: '',
|
||||
dataSourceId: '',
|
||||
scriptId: '',
|
||||
errorSysId: '',
|
||||
timeCheck: 0,
|
||||
testState: 0,
|
||||
reportState: 0,
|
||||
result: 0,
|
||||
code: 0,
|
||||
state: 1
|
||||
})
|
||||
pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[];
|
||||
const sourceArray1 = Array.isArray(pqSourceList.value) ? pqSourceList.value : []
|
||||
// 将 pqSource_Result 转换成 { label, value } 数组
|
||||
pqSourceArray.value = sourceArray1.map(item => ({
|
||||
label: item.name || '',
|
||||
value: item.id
|
||||
}));
|
||||
controlContent.value.sourceId = pqSourceArray.value[0].value
|
||||
|
||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id //获取数据字典中对应的id
|
||||
const {data} = await getPqScriptList({pattern:patternId})
|
||||
scriptArray.push(...data.map(item => ({ label: item.name, value: item.id})))
|
||||
if(scriptArray.length > 0){
|
||||
controlContent.value.scriptId = scriptArray[0].value
|
||||
}
|
||||
|
||||
nextTick(async () => {
|
||||
await treeInfo(modeStore.currentMode)
|
||||
formContent.value.pattern = modeId.value
|
||||
formContent.value.id = controlContent.value.scriptId
|
||||
show.value = true
|
||||
})
|
||||
})
|
||||
|
||||
watch(webMsgSend, function (newValue, oldValue) {
|
||||
console.log('webMsgSend:', newValue)
|
||||
if (newValue.requestId.includes('formal_real&&') && newValue.operateCode === 'OPER_GATHER') {
|
||||
if (newValue.code === 10200) {
|
||||
ElMessage.success('启动成功!')
|
||||
startDisabeld.value = false
|
||||
pauseDisabled.value = false
|
||||
controlSourceDetailRef.value?.startTimeCount()
|
||||
}else if(newValue.code !== 10201){
|
||||
ElMessage.error('启动失败!')
|
||||
startDisabeld.value = false
|
||||
pauseDisabled.value = true
|
||||
console.log('错误信息:',webMsgSend)
|
||||
}
|
||||
}
|
||||
if (newValue.requestId.includes('close_source') && newValue.operateCode === 'CLOSE_GATHER') {
|
||||
if (newValue.code === 10200) {
|
||||
setTimeout(() => {
|
||||
ElMessage.success('停止成功!')
|
||||
connectDisabeld.value = false
|
||||
startDisabeld.value = true
|
||||
pauseDisabled.value = true
|
||||
controlSourceDetailRef.value?.stopTimeCount()
|
||||
}, 5000)
|
||||
} else {
|
||||
ElMessage.error('停止失败!')
|
||||
startDisabeld.value = true
|
||||
pauseDisabled.value = false
|
||||
console.log('错误信息:',webMsgSend)
|
||||
}
|
||||
}
|
||||
switch (newValue.requestId) {
|
||||
case 'yjc_ytxjy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER':
|
||||
if (newValue.code == 10200) {
|
||||
ElMessage.success('源连接成功!')
|
||||
connectDisabeld.value = true
|
||||
startDisabeld.value = false
|
||||
pauseDisabled.value = false
|
||||
} else if(newValue.code !== 10201) {
|
||||
ElMessage.error('源连接失败!')
|
||||
console.log('错误信息:',webMsgSend)
|
||||
connectDisabeld.value = false
|
||||
startDisabeld.value = true
|
||||
pauseDisabled.value = true
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case 'connect':
|
||||
switch (newValue.operateCode) {
|
||||
case "Source":
|
||||
ElMessage.error('源连接失败!')
|
||||
connectDisabeld.value = false
|
||||
startDisabeld.value = true
|
||||
pauseDisabled.value = true
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'server_error':
|
||||
if(newValue.operateCode === 'server_error'){
|
||||
ElMessage.error('服务端主动关闭连接,请20秒后重试!')
|
||||
connectDisabeld.value = true
|
||||
startDisabeld.value = true
|
||||
pauseDisabled.value = true
|
||||
setTimeout(() => {
|
||||
connectDisabeld.value = false
|
||||
startDisabeld.value = true
|
||||
pauseDisabled.value = true
|
||||
}, 20000)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
})
|
||||
// 获取树字典
|
||||
const treeInfo = async (currentMode: string) => {
|
||||
const data: Dict.ResDictTree = {
|
||||
name: '',
|
||||
id: '',
|
||||
pid: '',
|
||||
pids: '',
|
||||
code: 'Script_Indicator_Items',
|
||||
sort: 0
|
||||
}
|
||||
const result = await getDictTreeByCode(data)
|
||||
const result1 = (await getDictTreeByCode({ ...data, code: 'Script_Error' })).data[0].children
|
||||
const allOptions = await convertToOptions(result.data as Dict.ResDictTree[])
|
||||
const setAllTree = await setTree(allOptions[0]?.children, result1)
|
||||
secondLevelOptions.push(...(setAllTree || []))
|
||||
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id
|
||||
}
|
||||
|
||||
const setTree = async (data, data1) => {
|
||||
data.forEach(item => {
|
||||
data1.forEach(item1 => {
|
||||
if (item.label.replace(/准确度|检测/g, '') == item1.name) {
|
||||
item.value = item1.id
|
||||
}
|
||||
})
|
||||
})
|
||||
return data
|
||||
}
|
||||
|
||||
// 转换函数
|
||||
const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
|
||||
return dictTree.map(item => ({
|
||||
value: item.id,
|
||||
code: item.code.split('-')[1] || item.code.split('-')[0],
|
||||
label: item.name,
|
||||
children: item.children ? convertToOptions(item.children) : undefined
|
||||
}))
|
||||
}
|
||||
|
||||
const scriptId = ref('')
|
||||
const scriptIndex = ref(0)
|
||||
const handleActiveNameChange = (newActiveName: string) => {
|
||||
scriptId.value = newActiveName
|
||||
}
|
||||
|
||||
const handleActiveIndexChange = (newActiveIndex: number) => {
|
||||
|
||||
scriptIndex.value = newActiveIndex
|
||||
}
|
||||
|
||||
|
||||
// 定义 handleScriptChange 方法
|
||||
const handleScriptChange = (value: string) => {
|
||||
// 根据业务需求实现具体逻辑
|
||||
//console.log('检测脚本变更:', value);
|
||||
router.push({
|
||||
path: '/machine/controlSource',
|
||||
state: { title: '新增检测脚本', row: '', mode: modeStore.currentMode }
|
||||
})
|
||||
}
|
||||
const start = async () => {
|
||||
|
||||
controlContent.value.userPageId = 'cdf'
|
||||
controlContent.value.scriptIndex = scriptIndex.value
|
||||
await checkSimulate(controlContent.value)
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/* .dialog-content {
|
||||
padding: 10px;
|
||||
} */
|
||||
:deep(.cardTop) {
|
||||
.el-card__body {
|
||||
padding: 20px 0 0 20px;
|
||||
}
|
||||
}
|
||||
//.formBut {
|
||||
// width: 50%;
|
||||
// display: flex;
|
||||
// justify-content: end;
|
||||
//}
|
||||
.form-four {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
// justify-content: space-between;
|
||||
.el-form-item {
|
||||
display: flex;
|
||||
width: 24.0%;
|
||||
|
||||
.el-form-item__content {
|
||||
flex: 1;
|
||||
.el-select,
|
||||
.el-cascader,
|
||||
.el-input__inner,
|
||||
.el-date-editor {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -50,9 +50,9 @@
|
||||
<el-select v-model="formContent.reportName" clearable placeholder="请选择报告模版">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Report_Template')"
|
||||
:key="item.code"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
@@ -96,6 +96,8 @@ import type { ICD } from '@/api/device/interface/icd'
|
||||
prop: 'reportName',
|
||||
label: '报告模版名称',
|
||||
minWidth: 150,
|
||||
enum: dictStore.getDictData('Report_Template'),
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
},
|
||||
{
|
||||
prop: 'icd',
|
||||
@@ -136,18 +138,15 @@ import type { ICD } from '@/api/device/interface/icd'
|
||||
}
|
||||
|
||||
|
||||
// 批量删除设备
|
||||
// 批量删除设备类型
|
||||
const batchDelete = async (id: string[]) => {
|
||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
||||
await useHandleData(deleteDevType, id, '删除所选设备类型')
|
||||
|
||||
proTable.value?.clearSelection()
|
||||
proTable.value?.getTableList()
|
||||
}
|
||||
|
||||
// 删除设备
|
||||
// 删除设备类型
|
||||
const handleDelete = async (params: DevType.ResPqDevType) => {
|
||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||
await useHandleData(deleteDevType, [params.id] , `删除【${params.name}】设备类型`)
|
||||
proTable.value?.getTableList()
|
||||
|
||||
|
||||
@@ -103,8 +103,8 @@
|
||||
<el-form-item label='密钥' prop='devKey' clearable v-if="formContent.encryptionFlag">
|
||||
<el-input v-model='formContent.devKey' placeholder="请输入密钥" show-password/>
|
||||
</el-form-item>
|
||||
<el-form-item label='样品编号' prop='sampleID' clearable v-if="DevIsShow && scene === '0'">
|
||||
<el-input v-model='formContent.sampleID' placeholder="请输入样品编号" />
|
||||
<el-form-item label='样品编号' prop='sampleId' clearable v-if="DevIsShow && scene === '0'">
|
||||
<el-input v-model='formContent.sampleId' placeholder="请输入样品编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label='送样日期' prop='arrivedDate' v-if="scene === '0'">
|
||||
<el-date-picker
|
||||
@@ -194,7 +194,7 @@ const disabledDate = (time: Date) => {
|
||||
encryptionFlag: 0,
|
||||
reCheckNum:0,
|
||||
state: 1,
|
||||
factorFlag:0,
|
||||
factorFlag:1,
|
||||
icdId:'',
|
||||
power:'',
|
||||
preinvestmentPlan:''
|
||||
@@ -224,7 +224,7 @@ const disabledDate = (time: Date) => {
|
||||
encryptionFlag: 0,
|
||||
reCheckNum:0,
|
||||
state: 1,
|
||||
factorFlag:0,
|
||||
factorFlag:1,
|
||||
icdId:'',
|
||||
power:'',
|
||||
preinvestmentPlan:''
|
||||
@@ -428,10 +428,20 @@ const handleDevTypeChange = (value: string) => {
|
||||
formContent.value.devVolt = dev.devVolt; // 默认值为1
|
||||
formContent.value.icdId = dev.icd
|
||||
formContent.value.power = dev.power
|
||||
if(dev.name.includes('882B')){
|
||||
formContent.value.ip = '172.17.102.220'
|
||||
}else if(dev.name.includes('882A')){
|
||||
formContent.value.ip = '172.17.102.221'
|
||||
}else{
|
||||
formContent.value.ip = '172.17.102.200'
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
formContent.value.devChns = 1; // 默认值为1
|
||||
formContent.value.devCurr = 1; // 默认值为1
|
||||
formContent.value.devVolt = 57.74; // 默认值为1
|
||||
formContent.value.ip = '172.17.102.200'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,32 +32,25 @@
|
||||
|
||||
</ProTable>
|
||||
</div>
|
||||
<DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup' />
|
||||
<ImportExcel ref='deviceImportExcel' />
|
||||
<DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup'/>
|
||||
<ImportExcel ref='deviceImportExcel'/>
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='useRole'>
|
||||
import TimeControl from '@/components/TimeControl/index.vue'
|
||||
import { type Device } from '@/api/device/interface/device.ts'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
import {type Device} from '@/api/device/interface/device.ts'
|
||||
import {useHandleData} from '@/hooks/useHandleData'
|
||||
import {useDownload} from '@/hooks/useDownload'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||
import {type ColumnProps, type ProTableInstance} from '@/components/ProTable/interface'
|
||||
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
||||
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import {
|
||||
getPqDevList,
|
||||
deletePqDev,
|
||||
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'
|
||||
import {CirclePlus, Delete, Download, EditPen, Upload} from '@element-plus/icons-vue'
|
||||
import {useDictStore} from '@/stores/modules/dict'
|
||||
import {deletePqDev, downloadTemplate, exportPqDev, getPqDev, getPqDevList, importPqDev} from '@/api/device/device/index.ts'
|
||||
import {ElMessageBox} from 'element-plus'
|
||||
import {onBeforeMount, reactive, ref} from 'vue'
|
||||
import {useAppSceneStore, useModeStore} from '@/stores/modules/mode'
|
||||
|
||||
// defineOptions({
|
||||
// name: 'device',
|
||||
@@ -72,6 +65,7 @@ const boundPqDevList = ref<Device.ReqPqDevParams[]>([])//根据检测计划id查
|
||||
// 存储设备类型选项
|
||||
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||
|
||||
|
||||
const getTableList = async (params: any) => {
|
||||
let newParams = JSON.parse(JSON.stringify(params))
|
||||
newParams.searchEndTime = endDate.value
|
||||
@@ -84,12 +78,12 @@ const getTableList = async (params: any) => {
|
||||
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||
{type: 'selection', fixed: 'left', width: 70},
|
||||
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '名称',
|
||||
search: { el: 'input' },
|
||||
search: {el: 'input'},
|
||||
// isShow: appSceneStore.currentScene != '1',
|
||||
// ...(appSceneStore.currentScene != '1' ? {
|
||||
// search: { el: 'input' },
|
||||
@@ -163,8 +157,8 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
enum: dictStore.getDictData('Dev_Manufacturers'),
|
||||
isShow: appSceneStore.currentScene != '1',
|
||||
...(appSceneStore.currentScene != '1' ? {
|
||||
search: { el: 'select', props: { filterable: true }, order: 1 },
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
search: {el: 'select', props: {filterable: true}, order: 1},
|
||||
fieldNames: {label: 'name', value: 'id'},
|
||||
} : {}),
|
||||
minWidth: 200,
|
||||
},
|
||||
@@ -186,7 +180,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
return '';
|
||||
}
|
||||
},
|
||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
||||
{prop: 'operation', label: '操作', fixed: 'right', width: 200},
|
||||
])
|
||||
|
||||
|
||||
@@ -206,7 +200,7 @@ const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
||||
// 批量删除设备
|
||||
const batchDelete = async (id: string[]) => {
|
||||
const 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?.getTableList()
|
||||
@@ -215,7 +209,7 @@ const batchDelete = async (id: string[]) => {
|
||||
// 删除设备
|
||||
const handleDelete = async (params: Device.ResPqDev) => {
|
||||
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()
|
||||
|
||||
}
|
||||
@@ -229,9 +223,9 @@ const downloadFile = async () => {
|
||||
searchParam.searchBeginTime = startDate.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
|
||||
useDownload(exportCNDev, '被检设备导出数据', { ...proTable.value?.searchParam, pattern: patternId }, false, '.xlsx')
|
||||
useDownload(exportPqDev, '被检设备导出数据', {...proTable.value?.searchParam, pattern: patternId}, false, '.xlsx')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -254,8 +248,8 @@ const importFile = async (pattern: string) => {
|
||||
title: '被检设备',
|
||||
showCover: false,
|
||||
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id,
|
||||
tempApi: downloadCNDevTemplate,
|
||||
importApi: importCNDev,
|
||||
tempApi: downloadTemplate,
|
||||
importApi: importPqDev,
|
||||
// importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev,
|
||||
getTableList: proTable.value?.getTableList,
|
||||
}
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
>
|
||||
<el-table-column label="被测量">
|
||||
<el-table-column prop="col1" width="150"/>
|
||||
<el-table-column prop="col2" width="120" />
|
||||
<el-table-column prop="col2" width="120"/>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deviceLevel" label="检测装置级别" width="120"/>
|
||||
<el-table-column prop="measurementType" label="测量类型" />
|
||||
<el-table-column prop="condition" label="测量条件" />
|
||||
<el-table-column prop="maxErrorValue" label="最大误差" />
|
||||
<el-table-column prop="measurementType" label="测量类型"/>
|
||||
<el-table-column prop="condition" label="测量条件"/>
|
||||
<el-table-column prop="maxErrorValue" label="最大误差"/>
|
||||
</el-table>
|
||||
</div>
|
||||
<div>
|
||||
@@ -30,34 +30,33 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="IndicatorTypeDialog">
|
||||
import { defineProps, defineEmits, reactive,watch,ref,computed, type CSSProperties } from 'vue';
|
||||
import { dialogBig} from '@/utils/elementBind'
|
||||
import type { ColumnProps } from '@/components/ProTable/interface'
|
||||
import type { ErrorSystem } from '@/api/device/interface/error'
|
||||
import errorDataList from '@/api/device/error/errorData'
|
||||
import type { TableColumnCtx } from 'element-plus'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
<script lang="ts" setup name="IndicatorTypeDialog">
|
||||
import {computed, type CSSProperties, defineProps, ref} from 'vue';
|
||||
import {dialogBig} from '@/utils/elementBind'
|
||||
import type {ErrorSystem} from '@/api/device/interface/error'
|
||||
import errorDataList from '@/api/device/error/errorData'
|
||||
import type {TableColumnCtx} from 'element-plus'
|
||||
import {useDictStore} from '@/stores/modules/dict'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const errorData = ref<ErrorSystem.Error_detail[]>([]);
|
||||
const dialogTitle = ref()
|
||||
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref
|
||||
function useMetaInfo() {
|
||||
const dictStore = useDictStore()
|
||||
const errorData = ref<ErrorSystem.Error_detail[]>([]);
|
||||
const dialogTitle = ref()
|
||||
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref
|
||||
function useMetaInfo() {
|
||||
const dialogVisible = ref(false)
|
||||
const formContent = ref<ErrorSystem.ErrorSystemList>({
|
||||
id: '',
|
||||
name: '',
|
||||
standardName:'',
|
||||
standardTime:'',
|
||||
devLevel:'',
|
||||
enable:1,
|
||||
state:1,
|
||||
standardName: '',
|
||||
standardTime: '',
|
||||
devLevel: '',
|
||||
enable: 1,
|
||||
state: 1,
|
||||
})
|
||||
return { dialogVisible, formContent }
|
||||
}
|
||||
return {dialogVisible, formContent}
|
||||
}
|
||||
|
||||
const { dialogVisible, formContent } = useMetaInfo()
|
||||
const {dialogVisible, formContent} = useMetaInfo()
|
||||
|
||||
interface SpanMethodProps {
|
||||
row: ErrorSystem.ErrorSystemDetail
|
||||
@@ -66,14 +65,14 @@ interface SpanMethodProps {
|
||||
columnIndex: number
|
||||
}
|
||||
|
||||
const rowClass = ({ row, column, rowIndex, columnIndex }: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
|
||||
const rowClass = ({row, column, rowIndex, columnIndex}: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
|
||||
let res: CSSProperties = {
|
||||
textAlign: 'center' as CSSProperties['textAlign'],
|
||||
backgroundColor: '#003078',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}
|
||||
if (rowIndex === 1) {
|
||||
res = { ...res, display: 'none' }
|
||||
res = {...res, display: 'none'}
|
||||
}
|
||||
return res
|
||||
}
|
||||
@@ -88,7 +87,7 @@ const spanAMethod = ({
|
||||
column,
|
||||
rowIndex,
|
||||
columnIndex,
|
||||
}: SpanMethodProps) => {
|
||||
}: SpanMethodProps) => {
|
||||
if (columnIndex === 0) {
|
||||
if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
||||
return {
|
||||
@@ -170,7 +169,7 @@ const spanSMethod = ({
|
||||
column,
|
||||
rowIndex,
|
||||
columnIndex,
|
||||
}: SpanMethodProps) => {
|
||||
}: SpanMethodProps) => {
|
||||
if (columnIndex === 0) {
|
||||
if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
||||
return {
|
||||
@@ -205,7 +204,7 @@ const spanSMethod = ({
|
||||
colspan: 2,
|
||||
}
|
||||
}
|
||||
if (rowIndex === 18 ) {//电流跨两行两列
|
||||
if (rowIndex === 18) {//电流跨两行两列
|
||||
return {
|
||||
rowspan: 2,
|
||||
colspan: 2,
|
||||
@@ -245,18 +244,18 @@ const spanSMethod = ({
|
||||
}
|
||||
}
|
||||
}
|
||||
if(columnIndex === 3){
|
||||
if (columnIndex === 3) {
|
||||
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
|
||||
rowIndex === 11 || rowIndex === 13 ||rowIndex === 15 ||
|
||||
rowIndex === 18 || rowIndex === 21){
|
||||
rowIndex === 11 || rowIndex === 13 || rowIndex === 15 ||
|
||||
rowIndex === 18 || rowIndex === 21) {
|
||||
return {
|
||||
rowspan: 2,
|
||||
colspan: 1,
|
||||
}
|
||||
}
|
||||
if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 ||
|
||||
rowIndex === 12 || rowIndex === 14 ||rowIndex === 16 ||
|
||||
rowIndex === 19 || rowIndex === 22){
|
||||
rowIndex === 12 || rowIndex === 14 || rowIndex === 16 ||
|
||||
rowIndex === 19 || rowIndex === 22) {
|
||||
return {
|
||||
rowspan: 0,
|
||||
colspan: 0,
|
||||
@@ -270,31 +269,31 @@ const close = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
||||
dialogTitle.value = sign + ' 误差体系'
|
||||
dialogVisible.value = true
|
||||
|
||||
if (data.id) {
|
||||
formContent.value = data as ErrorSystem.ErrorSystemList;
|
||||
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';
|
||||
|
||||
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';;
|
||||
|
||||
if(devLevelName.value === 'A级'){
|
||||
if (devLevelName.value === 'A级' || data.devLevel === 'A级') {
|
||||
errorData.value = errorDataList.errorADetail as unknown as ErrorSystem.Error_detail[];
|
||||
}else{
|
||||
} else {
|
||||
errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
// 对外映射
|
||||
defineExpose({open})
|
||||
const props = defineProps<{
|
||||
refreshTable: (() => Promise<void>) | undefined;
|
||||
}>()
|
||||
</script>
|
||||
<style>
|
||||
</script>
|
||||
<style>
|
||||
.table-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -316,4 +315,4 @@ const props = defineProps<{
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
</div>
|
||||
<div class="table-container">
|
||||
<el-table :data="tableData"
|
||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
||||
:header-cell-style="{ textAlign: 'center',backgroundColor: 'var(--el-color-primary)',color: '#fff' } "
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
style="width: 100%"
|
||||
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}"
|
||||
:style="{ height: '400px',maxHeight: '400px',overflow:'hidden'}"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="sort" label="序号" width="60" />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane label="基础信息">
|
||||
<div >
|
||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' label-width="auto" class="form-three">
|
||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' label-width="auto" class="form-four">
|
||||
<el-form-item label="标准号" prop="standardName" >
|
||||
<el-input v-model='formContent.standardName' placeholder="请填写标准号"/>
|
||||
</el-form-item>
|
||||
@@ -26,7 +26,7 @@
|
||||
<el-form-item label="状态" prop="enable" >
|
||||
<el-select v-model='formContent.enable' placeholder="请选择状态">
|
||||
<el-option label="启用" :value="1"></el-option>
|
||||
<el-option label="不启用" :value="0"></el-option>
|
||||
<el-option label="停用" :value="0"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -57,7 +57,7 @@
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { type ErrorSystem } from '@/api/device/interface/error';
|
||||
import ErrorSystemDetailTable from '@/views/machine/errorSystem/components/errorSystemDetailTable.vue';
|
||||
import {getDictTreeList} from '@/api/system/dictionary/dictTree'
|
||||
import {getDictTreeByCode} from '@/api/system/dictionary/dictTree'
|
||||
import { type Dict } from '@/api/system/dictionary/interface';
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
@@ -156,31 +156,31 @@ const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) =>
|
||||
}
|
||||
// 封装提取第二层节点的逻辑
|
||||
const loadSecondLevelOptions = async () => {
|
||||
const dictCode = '误差体系指标项'; // 替换为实际需要的字典代码
|
||||
const dictCode2 = '脚本-误差'; // 替换为实际需要的字典代码
|
||||
const dictCode = 'Err_Sys_Items'; // 替换为实际需要的字典代码
|
||||
const dictCode2 = 'Script_Error'; // 替换为实际需要的字典代码
|
||||
|
||||
const resDictTree: Dict.ResDictTree = {
|
||||
name: dictCode,
|
||||
name: '',
|
||||
id: '',
|
||||
pid: '',
|
||||
pids: '',
|
||||
code: '',
|
||||
code: dictCode,
|
||||
sort: 0
|
||||
};
|
||||
|
||||
const resDictTree2: Dict.ResDictTree = {
|
||||
name: dictCode2,
|
||||
name: '',
|
||||
id: '',
|
||||
pid: '',
|
||||
pids: '',
|
||||
code: '',
|
||||
code: dictCode2,
|
||||
sort: 0
|
||||
};
|
||||
|
||||
// 并行请求两个字典树列表
|
||||
const [result, result2] = await Promise.all([
|
||||
getDictTreeList(resDictTree),
|
||||
getDictTreeList(resDictTree2)
|
||||
getDictTreeByCode(resDictTree),
|
||||
getDictTreeByCode(resDictTree2)
|
||||
]);
|
||||
|
||||
const allOptions = convertToOptions(result.data as Dict.ResDictTree[]);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<!-- 表格操作 -->
|
||||
<template #operation='scope'>
|
||||
<el-button v-auth.device="'view'" type='primary' link :icon='View' @click="openDialog('view', scope.row)">查看</el-button>
|
||||
<el-button v-auth.device="'view'" type='primary' link :icon='View' @click="copy(scope.row)">复制</el-button>
|
||||
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||
</template>
|
||||
@@ -26,7 +27,7 @@
|
||||
<ErrorStandardPopup :refresh-table='proTable?.getTableList' ref='errorStandardPopup' />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name='useProTable'>
|
||||
<script setup lang="tsx" name='useProTable'>
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||
import { CirclePlus, Delete,EditPen,View} from '@element-plus/icons-vue'
|
||||
@@ -36,7 +37,8 @@ import ErrorSystemPopup from '@/views/machine/errorSystem/components/errorSystem
|
||||
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue'
|
||||
import type { ErrorSystem } from '@/api/device/interface/error'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { getPqErrSysList, deletePqErrSys} from '@/api/device/error/index'
|
||||
import { getPqErrSysList, deletePqErrSys,copyPqErrSys} from '@/api/device/error/index'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
defineOptions({
|
||||
name: 'errorSystem'
|
||||
})
|
||||
@@ -71,7 +73,15 @@ const columns = ref<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
|
||||
search: { el: 'select', props: { filterable: true } },
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
},
|
||||
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 250,},
|
||||
{
|
||||
prop: 'enable',
|
||||
label: '启用状态',
|
||||
width: 120,
|
||||
render: scope => {
|
||||
return (scope.row.enable ? <el-tag type='success'>启用</el-tag> : <el-tag type='danger'>停用</el-tag>)
|
||||
},
|
||||
},
|
||||
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 300,},
|
||||
])
|
||||
|
||||
// 打开 drawer(新增、编辑)
|
||||
@@ -86,19 +96,33 @@ const openDialog = (titleType: string, row: Partial<ErrorSystem.ErrorSystemList>
|
||||
}
|
||||
|
||||
|
||||
// 批量删除设备
|
||||
// 批量误差体系
|
||||
const batchDelete = async (id: string[]) => {
|
||||
await useHandleData(deletePqErrSys, id, '删除所选误差体系')
|
||||
proTable.value?.clearSelection()
|
||||
proTable.value?.getTableList()
|
||||
}
|
||||
|
||||
// 删除设备
|
||||
// 删除误差体系
|
||||
const handleDelete = async (params: ErrorSystem.ErrorSystemList) => {
|
||||
await useHandleData(deletePqErrSys, [params.id], `删除【${params.name}】误差体系`)
|
||||
proTable.value?.getTableList()
|
||||
}
|
||||
|
||||
|
||||
// 复制误差体系
|
||||
const copy = async (params: ErrorSystem.ErrorSystemList) => {
|
||||
ElMessageBox.confirm('是否复制当前误差体系?', '提示', {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: 'warning',
|
||||
draggable: true
|
||||
}).then(async () => {
|
||||
copyPqErrSys(params).then(() => {
|
||||
proTable.value?.getTableList()
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -29,26 +29,21 @@
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='useRole'>
|
||||
import TimeControl from '@/components/TimeControl/index.vue'
|
||||
import { type ICD } from '@/api/device/interface/icd'
|
||||
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 {
|
||||
getICDList,
|
||||
deleteICD,
|
||||
} from '@/api/device/icd/index.ts'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
|
||||
|
||||
defineOptions({
|
||||
name: 'devType',
|
||||
})
|
||||
const modeStore = useModeStore()
|
||||
const dictStore = useDictStore()
|
||||
|
||||
// ProTable 实例
|
||||
const proTable = ref<ProTableInstance>()
|
||||
const icdPopup = ref()
|
||||
@@ -101,14 +96,14 @@
|
||||
}
|
||||
|
||||
|
||||
// 批量删除设备
|
||||
// 批量删除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()
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`"
|
||||
:style="{ overflow: 'hidden' }"
|
||||
row-key="id"
|
||||
:expand-row-keys="[props.activeName]"
|
||||
>
|
||||
<el-table-column prop="name" label="指标" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="参与误差比较" width="110px">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
v-model="row.errorFlag"
|
||||
v-if="row.show"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
:disabled="row.disabled || disabled"
|
||||
>
|
||||
<template #active-action>
|
||||
<span>√</span>
|
||||
</template>
|
||||
<template #inactive-action>
|
||||
<span>×</span>
|
||||
</template>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否启用" width="85px">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
v-model="row.enable"
|
||||
v-if="row.show"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
:disabled="row.disabled || disabled"
|
||||
>
|
||||
<template #active-action>
|
||||
<span>√</span>
|
||||
</template>
|
||||
<template #inactive-action>
|
||||
<span>×</span>
|
||||
</template>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import type { Dict } from '@/api/system/dictionary/interface'
|
||||
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||
import { checkDataList } from '@/api/device/testScript'
|
||||
|
||||
const props = defineProps({
|
||||
activeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
formContent: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
options: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
shrink: {
|
||||
type: Boolean
|
||||
}
|
||||
})
|
||||
const tableData = ref<any[]>([])
|
||||
const info = async () => {
|
||||
let checkData: any = []
|
||||
let title = props.options.filter((i: any) => i.value == props.activeName)[0]
|
||||
|
||||
await checkDataList({
|
||||
scriptId: props.formContent.id,
|
||||
scriptType: props.activeName
|
||||
}).then((res: any) => {
|
||||
checkData = res.data
|
||||
})
|
||||
|
||||
let { data } = await getDictTreeByCode({
|
||||
name: '',
|
||||
id: '',
|
||||
pid: '',
|
||||
pids: '',
|
||||
code: 'Script_Error',
|
||||
sort: 0
|
||||
})
|
||||
|
||||
data[0].children.forEach((item: any, i: number) => {
|
||||
tableData.value.push({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
show: false,
|
||||
children: []
|
||||
})
|
||||
item.children.forEach((k: any) => {
|
||||
let childrenList: any = []
|
||||
checkData.forEach((j: any) => {
|
||||
if (j.valueType == k.id) {
|
||||
childrenList.push(j)
|
||||
}
|
||||
})
|
||||
if (childrenList.length > 0) {
|
||||
tableData.value[i].children.push({
|
||||
id: k.id,
|
||||
pid: item.id,
|
||||
name: k.name,
|
||||
pname: item.name,
|
||||
dataType:
|
||||
item.name == '谐波有功功率'
|
||||
? 'avg'
|
||||
: item.name == '闪变'
|
||||
? 'avg'
|
||||
: item.name == '暂态'
|
||||
? 'avg'
|
||||
: 'real',
|
||||
show: true,
|
||||
errorFlag: childrenList[0].errorFlag,
|
||||
enable: childrenList[0].enable
|
||||
})
|
||||
} else {
|
||||
tableData.value[i].children.push({
|
||||
id: k.id,
|
||||
pid: item.id,
|
||||
name: k.name,
|
||||
disabled: false,
|
||||
pname: item.name,
|
||||
dataType: '谐波有功功率'
|
||||
? 'avg'
|
||||
: item.name == '闪变'
|
||||
? 'avg'
|
||||
: item.name == '暂态'
|
||||
? 'avg'
|
||||
: 'real',
|
||||
show: true,
|
||||
errorFlag: 0,
|
||||
enable: 0
|
||||
})
|
||||
}
|
||||
})
|
||||
// 默认够选通讯脚本
|
||||
if (item.name == title.label.replace(/准确度|检测/g, '')) {
|
||||
if (item.name == '暂态') {
|
||||
tableData.value[i].children.forEach((k: any) => {
|
||||
k.disabled = true
|
||||
k.enable = 1
|
||||
k.errorFlag = 1
|
||||
})
|
||||
} else {
|
||||
tableData.value[i].children[0].disabled = true
|
||||
tableData.value[i].children[0].enable = 1
|
||||
tableData.value[i].children[0].errorFlag = 1
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
//console.log('🚀 ~ item.children.forEach ~ tableData.value:', tableData.value)
|
||||
}
|
||||
const getData = () => {
|
||||
return tableData.value
|
||||
}
|
||||
onMounted(() => {
|
||||
info()
|
||||
// tableData.value = data.data[0].children || []
|
||||
})
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ getData })
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
198
frontend/src/views/machine/testScript/components/scriptForm.ts
Normal file
198
frontend/src/views/machine/testScript/components/scriptForm.ts
Normal file
@@ -0,0 +1,198 @@
|
||||
|
||||
|
||||
let scriptForm: any = {
|
||||
subType: '', //tabcode
|
||||
ffreq: 50, //频率
|
||||
channelList: [
|
||||
{
|
||||
channelType: 'Ua',
|
||||
channelFlag: false, //通道使能
|
||||
harmFlag: false, //谐波使能
|
||||
inHarmFlag: false, //间谐波使能
|
||||
flickerFlag: false, //闪变使能
|
||||
dipFlag: false, //暂态使能
|
||||
famp: 100, //幅值
|
||||
fphase: 0, //相角
|
||||
harmList: [
|
||||
// {
|
||||
// harm: 2, //谐波次数
|
||||
// famp: 0, //谐波含有率
|
||||
// fphase: 0 // 谐波相角
|
||||
// },
|
||||
], //谐波
|
||||
inharmList: [
|
||||
// {
|
||||
// inharm: '', //间谐波次数
|
||||
// famp: 0, //间谐波含有率
|
||||
// fphase: 0 // 间谐波相角
|
||||
// }
|
||||
], //间谐波
|
||||
flickerData: {
|
||||
flickerValue: '1', //标准值
|
||||
fchagValue: '2.724', //变动量
|
||||
fchagFre: '1', //波动频度
|
||||
waveType: 'CPM', // 波动类型
|
||||
waveFluType: 'SQU', //波类型
|
||||
fdutyCycle: 50 //占空比
|
||||
}, //闪变
|
||||
dipData: {
|
||||
ftransValue: '', // 暂态幅值
|
||||
retainTime: '' // 暂态持续时间
|
||||
} //暂态
|
||||
},
|
||||
{
|
||||
channelType: 'Ia',
|
||||
channelFlag: false, //通道使能
|
||||
harmFlag: false, //谐波使能
|
||||
inHarmFlag: false, //间谐波使能
|
||||
flickerFlag: false, //闪变使能
|
||||
dipFlag: false, //暂态使能
|
||||
famp: 100, //幅值
|
||||
fphase: 0, //相角
|
||||
harmList: [], //谐波
|
||||
inharmList: [
|
||||
// {
|
||||
// inharm: '', //间谐波次数
|
||||
// famp: 0, //间谐波含有率
|
||||
// fphase: 0 // 间谐波相角
|
||||
// }
|
||||
], //间谐波
|
||||
flickerData: {
|
||||
flickerValue: '1', //标准值
|
||||
fchagValue: '2.724', //变动量
|
||||
fchagFre: '1', //波动频度
|
||||
waveType: 'CPM', // 波动类型
|
||||
waveFluType: 'SQU', //波类型
|
||||
fdutyCycle: 50 //占空比
|
||||
}, //闪变
|
||||
dipData: {
|
||||
ftransValue: '', // 暂态幅值
|
||||
retainTime: '' // 暂态持续时间
|
||||
} //暂态
|
||||
},
|
||||
{
|
||||
channelType: 'Ub',
|
||||
channelFlag: false, //通道使能
|
||||
harmFlag: false, //谐波使能
|
||||
inHarmFlag: false, //间谐波使能
|
||||
flickerFlag: false, //闪变使能
|
||||
dipFlag: false, //暂态使能
|
||||
famp: 100, //幅值
|
||||
fphase: -120, //相角
|
||||
harmList: [], //谐波
|
||||
inharmList: [
|
||||
// {
|
||||
// inharm: '', //间谐波次数
|
||||
// famp: 0, //间谐波含有率
|
||||
// fphase: 0 // 间谐波相角
|
||||
// }
|
||||
], //间谐波
|
||||
flickerData: {
|
||||
flickerValue: '1', //标准值
|
||||
fchagValue: '2.724', //变动量
|
||||
fchagFre: '1', //波动频度
|
||||
waveType: 'CPM', // 波动类型
|
||||
waveFluType: 'SQU', //波类型
|
||||
fdutyCycle: 50 //占空比
|
||||
}, //闪变
|
||||
dipData: {
|
||||
ftransValue: '', // 暂态幅值
|
||||
retainTime: '' // 暂态持续时间
|
||||
} //暂态
|
||||
},
|
||||
{
|
||||
channelType: 'Ib',
|
||||
channelFlag: false, //通道使能
|
||||
harmFlag: false, //谐波使能
|
||||
inHarmFlag: false, //间谐波使能
|
||||
flickerFlag: false, //闪变使能
|
||||
dipFlag: false, //暂态使能
|
||||
famp: 100, //幅值
|
||||
fphase:-120, //相角
|
||||
harmList: [], //谐波
|
||||
inharmList: [
|
||||
// {
|
||||
// inharm: '', //间谐波次数
|
||||
// famp: 0, //间谐波含有率
|
||||
// fphase: 0 // 间谐波相角
|
||||
// }
|
||||
], //间谐波
|
||||
flickerData: {
|
||||
flickerValue: '1', //标准值
|
||||
fchagValue: '2.724', //变动量
|
||||
fchagFre: '1', //波动频度
|
||||
waveType: 'CPM', // 波动类型
|
||||
waveFluType: 'SQU', //波类型
|
||||
fdutyCycle: 50 //占空比
|
||||
}, //闪变
|
||||
dipData: {
|
||||
ftransValue: '', // 暂态幅值
|
||||
retainTime: '' // 暂态持续时间
|
||||
} //暂态
|
||||
},
|
||||
{
|
||||
channelType: 'Uc',
|
||||
channelFlag: false, //通道使能
|
||||
harmFlag: false, //谐波使能
|
||||
inHarmFlag: false, //间谐波使能
|
||||
flickerFlag: false, //闪变使能
|
||||
dipFlag: false, //暂态使能
|
||||
famp: 100, //幅值
|
||||
fphase: 120, //相角
|
||||
harmList: [], //谐波
|
||||
inharmList: [
|
||||
// {
|
||||
// inharm: '', //间谐波次数
|
||||
// famp: 0, //间谐波含有率
|
||||
// fphase: 0 // 间谐波相角
|
||||
// }
|
||||
], //间谐波
|
||||
flickerData: {
|
||||
flickerValue: '1', //标准值
|
||||
fchagValue: '2.724', //变动量
|
||||
fchagFre: '1', //波动频度
|
||||
waveType: 'CPM', // 波动类型
|
||||
waveFluType: 'SQU', //波类型
|
||||
fdutyCycle: 50 //占空比
|
||||
}, //闪变
|
||||
dipData: {
|
||||
ftransValue: '', // 暂态幅值
|
||||
retainTime: '' // 暂态持续时间
|
||||
} //暂态
|
||||
},
|
||||
{
|
||||
channelType: 'Ic',
|
||||
channelFlag: false, //通道使能
|
||||
harmFlag: false, //谐波使能
|
||||
inHarmFlag: false, //间谐波使能
|
||||
flickerFlag: false, //闪变使能
|
||||
dipFlag: false, //暂态使能
|
||||
famp: 100, //幅值
|
||||
fphase: 120, //相角
|
||||
harmList: [], //谐波
|
||||
inharmList: [
|
||||
// {
|
||||
// inharm: '', //间谐波次数
|
||||
// famp: 0, //间谐波含有率
|
||||
// fphase: 0 // 间谐波相角
|
||||
// }
|
||||
], //间谐波
|
||||
flickerData: {
|
||||
flickerValue: '1', //标准值
|
||||
fchagValue: '2.724', //变动量
|
||||
fchagFre: '1', //波动频度
|
||||
waveType: 'CPM', // 波动类型
|
||||
waveFluType: 'SQU', //波类型
|
||||
fdutyCycle: 50 //占空比
|
||||
}, //闪变
|
||||
dipData: {
|
||||
ftransValue: '', // 暂态幅值
|
||||
retainTime: '' // 暂态持续时间
|
||||
} //暂态
|
||||
}
|
||||
]
|
||||
}
|
||||
// 追加谐波
|
||||
|
||||
|
||||
export default scriptForm
|
||||
@@ -1,95 +1,351 @@
|
||||
import { ref } from "vue"
|
||||
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" >
|
||||
<div class='table-box'>
|
||||
<ProTable
|
||||
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 class="table-container">
|
||||
<div class="recalculation">
|
||||
<el-button type="primary" :icon="Refresh" @click="recalculation">一键重算</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
height="550px"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="60" />
|
||||
<el-table-column prop="pname" label="参考设定值类型" />
|
||||
<el-table-column prop="name" label="参考设定值子类型" width="250">
|
||||
<template #default="{ row }">{{ row.harmNum ? `(${row.harmNum}次)` : '' }} {{ row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dataType" label="值类型">
|
||||
<template #default="{ row }">
|
||||
<el-select v-model="row.dataType" v-if="!row.show">
|
||||
<el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<span v-else>
|
||||
{{ typeList.find(item => item.value == row.dataType)?.label || row.dataType }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="phase" label="相别" />
|
||||
<el-table-column prop="value" label="参考设定值">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.show">{{ parseFloat((row.value - 0).toFixed(4)) }}{{ setUnit(row) || '' }}</span>
|
||||
<el-input type="number" v-else v-model="row.value" placeholder="请输入值" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="value" label="参与误差比较">
|
||||
<template #default="{ row }">
|
||||
{{ row.errorFlag == 0 ? '否' : '是' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link :icon="EditPen" @click="row.show = !row.show" v-if="row.show">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="primary" link :icon="Check" @click="row.show = !row.show" v-else>保存</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<el-dialog :title="dialogTitle" v-model="showForm" @close="close" width="500">
|
||||
<el-form ref="form" :model="form" label-width="auto">
|
||||
<el-form-item label="参考设定值类型" prop="name">
|
||||
<el-input v-model="form.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="参考设定值子类型" prop="standardName">
|
||||
<el-input v-model="form.standardName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="参考设定值" prop="standardTime">
|
||||
<el-input v-model="form.standardTime" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div >
|
||||
<el-button @click='close()'>取 消</el-button>
|
||||
<el-button type="primary" @click='save()'>保存</el-button>
|
||||
<div>
|
||||
<el-button @click="close()">取 消</el-button>
|
||||
<el-button type="primary" @click="save">保 存</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<SetValuePopup ref='setValuePopup' />
|
||||
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { TestScript } from '@/api/device/interface/testScript'
|
||||
import type { ColumnProps } from '@/components/ProTable/interface'
|
||||
import {reactive, ref } from 'vue'
|
||||
import { Refresh, EditPen, Check, Share } from '@element-plus/icons-vue'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||
import { dialogBig } from '@/utils/elementBind'
|
||||
|
||||
import { checkDataList, scriptDtlsCheckDataList } from '@/api/device/testScript/index'
|
||||
const showForm = ref(false)
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const props = defineProps({
|
||||
activeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
|
||||
|
||||
formContent: {
|
||||
type: [Object, Array],
|
||||
required: true
|
||||
},
|
||||
form: {
|
||||
type: [Object, Array],
|
||||
required: true
|
||||
},
|
||||
valueCode: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['recalculation'])
|
||||
const tableData: any = ref([])
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||
const typeList = [
|
||||
{
|
||||
prop: 'name',
|
||||
label: '参考设定值类型',
|
||||
minWidth: 350,
|
||||
label: '实时',
|
||||
value: 'real'
|
||||
},
|
||||
{
|
||||
prop: 'standardName',
|
||||
label: '参考设定值子类型',
|
||||
minWidth: 150,
|
||||
label: 'CP95值',
|
||||
value: 'cp95'
|
||||
},
|
||||
{
|
||||
prop: 'standardTime',
|
||||
label: '参考设定值',
|
||||
minWidth: 150,
|
||||
label: '平均值',
|
||||
value: 'avg'
|
||||
},
|
||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
||||
])
|
||||
{
|
||||
label: '最小值',
|
||||
value: 'min'
|
||||
},
|
||||
{
|
||||
label: '最大值',
|
||||
value: 'max'
|
||||
}
|
||||
]
|
||||
const form = ref({
|
||||
name: 220,
|
||||
standardName: 0,
|
||||
standardTime: 0
|
||||
})
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (sign: string,row: any) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = sign === 'add'? '新增检测项目信息' : '编辑检测项目信息'
|
||||
}
|
||||
|
||||
const open = async (row: any, copyRowList: any) => {
|
||||
let treeData: any = []
|
||||
await getDictTreeByCode({
|
||||
name: '',
|
||||
id: '',
|
||||
pid: '',
|
||||
pids: '',
|
||||
code: 'Script_Error',
|
||||
sort: 0
|
||||
}).then((res: any) => {
|
||||
treeData = res.data[0].children
|
||||
})
|
||||
let checkDataList: any = []
|
||||
await row.forEach((item: any) => {
|
||||
item.children.forEach((k: any) => {
|
||||
if (k.enable != 0 || k.errorFlag != 0) {
|
||||
checkDataList.push({
|
||||
pid: k.pid,
|
||||
valueType: k.id,
|
||||
dataType: k.dataType,
|
||||
enable: k.enable,
|
||||
errorFlag: k.errorFlag
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
let form = handleHarmData(JSON.parse(JSON.stringify(props.form)))
|
||||
let retryCompute = isEqual(form, copyRowList)
|
||||
await scriptDtlsCheckDataList({
|
||||
...form,
|
||||
scriptId: props.formContent?.id,
|
||||
scriptType: props.activeName,
|
||||
checkDataList: checkDataList,
|
||||
retryCompute: retryCompute
|
||||
}).then((res: any) => {
|
||||
res.data.forEach((item: any) => {
|
||||
let pList = treeData.filter((i: any) => i.id == item.pid)[0]
|
||||
item.pname = pList.name
|
||||
item.name = pList.children.filter((i: any) => i.id == item.valueType)[0].name
|
||||
item.show = true
|
||||
})
|
||||
tableData.value = res.data
|
||||
})
|
||||
}
|
||||
// 重算
|
||||
const recalculation = () => {
|
||||
emit('recalculation')
|
||||
}
|
||||
// 处理多余数据
|
||||
const handleHarmData = (row: any) => {
|
||||
row.channelList.forEach((channel: any) => {
|
||||
// 筛选出 famp 和 fphase 不同时为 0 的对象
|
||||
channel.harmList = channel.harmList.filter((item: any) => item.famp != 0 || item.fphase != 0)
|
||||
channel.inharmList = channel.inharmList.filter(
|
||||
(item: any) => item.inharm !== '' || item.famp !== 0 || item.fphase !== 0
|
||||
)
|
||||
})
|
||||
return row
|
||||
}
|
||||
// 判断数据是否变化
|
||||
const isEqual = (obj1: any, obj2: any) => {
|
||||
// 如果两个对象是同一个引用,直接返回 true
|
||||
if (obj1 == obj2) return true
|
||||
// 如果其中一个是 null 或者不是对象,返回 false
|
||||
if (obj1 === null || typeof obj1 !== 'object' || obj2 === null || typeof obj2 !== 'object') {
|
||||
return false
|
||||
}
|
||||
// 获取两个对象的键
|
||||
const keys1 = Object.keys(obj1)
|
||||
const keys2 = Object.keys(obj2)
|
||||
// 如果键的数量不同,返回 false
|
||||
if (keys1.length !== keys2.length) return false
|
||||
// 遍历所有键,递归比较值
|
||||
for (const key of keys1) {
|
||||
if (!keys2.includes(key) || !isEqual(obj1[key], obj2[key])) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
const unit = [
|
||||
{
|
||||
label: '频率',
|
||||
unit: 'Hz'
|
||||
},
|
||||
{
|
||||
label: '相电压有效值',
|
||||
unit: 'V'
|
||||
},
|
||||
{
|
||||
label: '电压偏差',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '电压相角',
|
||||
unit: '°'
|
||||
},
|
||||
{
|
||||
label: '基波电压有效值',
|
||||
unit: ''
|
||||
},
|
||||
{
|
||||
label: '电流有效值',
|
||||
unit: 'A'
|
||||
},
|
||||
{
|
||||
label: '电流相角',
|
||||
unit: '°'
|
||||
},
|
||||
{
|
||||
label: '基波电流有效值',
|
||||
unit: ''
|
||||
},
|
||||
{
|
||||
label: '谐波电压',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '谐波电流',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '谐波电流幅值',
|
||||
unit: 'A'
|
||||
},
|
||||
{
|
||||
label: '谐波有功功率',
|
||||
unit: 'W'
|
||||
},
|
||||
{
|
||||
label: '间谐波电压',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '间谐波电流',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '电压幅值',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '持续时间',
|
||||
unit: '周波'
|
||||
},
|
||||
{
|
||||
label: '三相电压不平衡度',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '三相电流不平衡度',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '闪变',
|
||||
unit: ''
|
||||
},
|
||||
|
||||
{
|
||||
label: '电流',
|
||||
unit: props.valueCode == 'Absolute' ? 'A' : '%'
|
||||
},
|
||||
|
||||
]
|
||||
// 参考设定值添加单位
|
||||
const setUnit = (row: any) => {
|
||||
console.log('🚀 ~ setUnit ~ row:', row)
|
||||
let text = ''
|
||||
if (row.pname == '暂态') {
|
||||
row.name == '电压幅值' ? (text = '%') : ''
|
||||
row.name == '持续时间' ? (text = '周波') : ''
|
||||
} else if (row.pname == '电压') {
|
||||
let o = props.valueCode == 'Absolute' ? 'V' : '%'
|
||||
row.name == '相电压有效值' ? (text = o) : ''
|
||||
row.name == '电压偏差' ? (text = '%') : ''
|
||||
row.name == '电压相角' ? (text = '°') : ''
|
||||
}else if (row.pname == '电流') {
|
||||
let o = props.valueCode == 'Absolute' ? 'A' : '%'
|
||||
row.name == '电流有效值' ? (text = o) : ''
|
||||
row.name == '电流相角' ? (text = '°') : ''
|
||||
} else {
|
||||
text = unit.filter(item => item.label == row.pname)[0]?.unit
|
||||
}
|
||||
|
||||
return text || ''
|
||||
}
|
||||
const save = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
const getTableData = () => {
|
||||
return tableData.value
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
defineExpose({ open, getTableData })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.recalculation {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,178 +1,619 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1400px">
|
||||
<div class="dialog-content" >
|
||||
<el-tabs type="border-card" class="left-tabs" style="height: 100%;">
|
||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1450px">
|
||||
<el-carousel height="600px" :autoplay="false" ref="carouselRef" indicator-position="none">
|
||||
<el-carousel-item :name="0" style="height: 100%; overflow-y: auto">
|
||||
<div class="dialog-content">
|
||||
<el-tabs type="border-card" class="right-tabs">
|
||||
<el-tab-pane label="检测">
|
||||
<!-- 全局设置菜单内容 -->
|
||||
<div style="height: 295px">
|
||||
<el-radio-group v-model="form.subType">
|
||||
<el-radio
|
||||
v-for="item in tabChildren"
|
||||
:key="item"
|
||||
:label="item.label"
|
||||
:value="item.code"
|
||||
border
|
||||
style="margin: 0 0 10px 10px"
|
||||
/>
|
||||
<!-- <el-radio v-for="item in tabChildren" :value="item.value" border>{{ item.label }}</el-radio> -->
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-tabs type="border-card" class="left-tabs" style="height: 100%">
|
||||
<el-tab-pane label="输出菜单">
|
||||
<!-- 输出菜单内容 -->
|
||||
<el-table :data="tableData"
|
||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%"
|
||||
:style="{ height: '295px',overflow:'hidden'}"
|
||||
:style="{ height: '295px', overflow: 'hidden' }"
|
||||
:show-header="false"
|
||||
:span-method="arraySpanMethod">
|
||||
<el-table-column prop="sort" label="相别" width="60" />
|
||||
<el-table-column prop="frequency" label="电压/电流" width="90" />
|
||||
<el-table-column prop="L1" label="值" width="180"/>
|
||||
<el-table-column label="操作" width="80">
|
||||
<template #default="{ }">
|
||||
<el-button type="info" :icon="Bottom"></el-button>
|
||||
:span-method="arraySpanMethod"
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="{ textAlign: 'center', backgroundColor: 'var(--el-color-primary)', color: '#fff' }"
|
||||
@cell-click="handleRowClick"
|
||||
:key="key"
|
||||
>
|
||||
<el-table-column prop="name" label="相别" width="60" align="center" />
|
||||
<el-table-column prop="frequency" label="电压/电流" align="center" width="60" />
|
||||
<el-table-column prop="L1" label="值" width="180" align="center">
|
||||
<template #default="{ row, $index }">
|
||||
<span>
|
||||
{{ row.type === 'V' ? '电压' : '电流' }}{{ form.channelList[$index].famp
|
||||
}}{{
|
||||
valueCode == 'Absolute' ? (row.type === 'V' ? 'V' : 'A') : '%'
|
||||
}}
|
||||
相角{{ form.channelList[$index].fphase }}°
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<el-table-column label="操作" width="85">
|
||||
<template #default="{ row, $index }">
|
||||
<el-button :type="buttonTypes[$index].channel || 'info'" @click="toggleType(row, $index,'channel')">通道使能</el-button>
|
||||
<el-button :type="buttonTypes[$index]?.harmonic || 'info'" @click="toggleType(row, $index, 'harmonic')">谐波使能</el-button>
|
||||
<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-button :type="buttonTypes[$index]?.transient || 'info'" @click="toggleType(row, $index, 'transient')">暂态使能</el-button>
|
||||
<!-- <el-button
|
||||
type="primary"
|
||||
v-if="$index != 4"
|
||||
link
|
||||
:icon="CopyDocument"
|
||||
@click="copyRow($index)"
|
||||
>
|
||||
复制
|
||||
</el-button> -->
|
||||
<el-dropdown placement="top-start">
|
||||
<el-button type="primary" link :icon="CopyDocument">复制</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<div v-if="$index == 0">
|
||||
<el-dropdown-item @click="copyRow(0, 2)">L2</el-dropdown-item>
|
||||
<el-dropdown-item @click="copyRow(0, 4)">L3</el-dropdown-item>
|
||||
</div>
|
||||
<div v-if="$index == 2">
|
||||
<el-dropdown-item @click="copyRow(2, 0)">L1</el-dropdown-item>
|
||||
<el-dropdown-item @click="copyRow(2, 4)">L3</el-dropdown-item>
|
||||
</div>
|
||||
<div v-if="$index == 4">
|
||||
<el-dropdown-item @click="copyRow(4, 0)">L1</el-dropdown-item>
|
||||
<el-dropdown-item @click="copyRow(4, 2)">L2</el-dropdown-item>
|
||||
</div>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="{ row, $index }">
|
||||
<el-checkbox-button
|
||||
v-model="form.channelList[$index].channelFlag"
|
||||
label="通道使能"
|
||||
/>
|
||||
<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-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'>
|
||||
<el-form-item label="频率:" prop="name">
|
||||
<div class="input-label-container">
|
||||
<el-input style="width: 100px;" />
|
||||
<el-input type="number" style="width: 100px" v-model="form.ffreq" />
|
||||
<label>Hz</label>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="button-label-container">
|
||||
<!-- <div class="button-label-container">
|
||||
<label>参考设定值列表:</label>
|
||||
<el-button type="primary" :icon='EditPen' @click="openDialog">编辑</el-button>
|
||||
<el-button type="primary" :icon="EditPen" @click="openDialog">编辑</el-button>
|
||||
</div> -->
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div style="margin-top: 20px;">
|
||||
<div style="margin-top: 10px; height: 234px">
|
||||
<el-tabs type="border-card" class="custom-tabs">
|
||||
<el-tab-pane label="电压/电流编辑">
|
||||
<TestScriptVolCurTab/>
|
||||
<el-tab-pane label="电压/电流编辑" v-if="childForm[0].channelFlag || childForm[1].channelFlag">
|
||||
<TestScriptVolCurTab :childForm="childForm" :valueCode="valueCode" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="谐波编辑">
|
||||
<TestScriptHarmTab/>
|
||||
<el-tab-pane label="谐波编辑" v-if="childForm[0].harmFlag || childForm[1].harmFlag">
|
||||
<TestScriptHarmTab :childForm="childForm" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="间谐波编辑">
|
||||
<TestScriptInHarmTab/>
|
||||
<el-tab-pane label="间谐波编辑" v-if="childForm[0].inHarmFlag || childForm[1].inHarmFlag">
|
||||
<TestScriptInHarmTab :childForm="childForm" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="闪变编辑">
|
||||
<TestScriptFlickerTab/>
|
||||
<el-tab-pane label="闪变编辑" v-if="childForm[0].flickerFlag || childForm[1].flickerFlag">
|
||||
<TestScriptFlickerTab :childForm="childForm" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="暂态编辑">
|
||||
<TestScriptDipTab/>
|
||||
<el-tab-pane label="暂态编辑" v-if="childForm[0].dipFlag || childForm[1].dipFlag">
|
||||
<TestScriptDipTab :childForm="childForm" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
<SetValueTable ref="setValueTable"/>
|
||||
</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"
|
||||
:valueCode=valueCode
|
||||
@recalculation="recalculation"
|
||||
/>
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
|
||||
<template #footer>
|
||||
<div >
|
||||
<el-button @click='close()'>取 消</el-button>
|
||||
<el-button type="primary" @click='save()'>保存</el-button>
|
||||
<div>
|
||||
<el-button @click="close">取 消</el-button>
|
||||
<el-button type="primary" @click="next" v-if="!showSetValueTable">下一步</el-button>
|
||||
<el-button type="primary" @click="previous" v-if="showSetValueTable">上一步</el-button>
|
||||
<el-button type="primary" @click="save" v-if="showSetValueTable">保存</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dialogBig } from '@/utils/elementBind'
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import SetValueTable from '@/views/machine/testScript/components/setValueTable.vue';
|
||||
import {EditPen,ArrowDown, Bottom} from '@element-plus/icons-vue'
|
||||
import { type TabsInstance } from 'element-plus';
|
||||
import TestScriptVolCurTab from '@/views/machine/testScript/components/testScriptVolCurTab.vue';
|
||||
import TestScriptHarmTab from '@/views/machine/testScript/components/testScriptHarmTab.vue';
|
||||
import TestScriptInHarmTab from '@/views/machine/testScript/components/testScriptInHarmTab.vue';
|
||||
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue';
|
||||
import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue';
|
||||
|
||||
import SetValueTable from '@/views/machine/testScript/components/setValueTable.vue'
|
||||
import { EditPen, ArrowDown, Bottom, CopyDocument } from '@element-plus/icons-vue'
|
||||
import { type TabsInstance } from 'element-plus'
|
||||
import TestScriptVolCurTab from '@/views/machine/testScript/components/testScriptVolCurTab.vue'
|
||||
import TestScriptHarmTab from '@/views/machine/testScript/components/testScriptHarmTab.vue'
|
||||
import TestScriptInHarmTab from '@/views/machine/testScript/components/testScriptInHarmTab.vue'
|
||||
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.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 dialogTitle = ref()
|
||||
const setValueTable = ref()
|
||||
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 valueCode = ref('') //Absolute绝对值
|
||||
|
||||
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= [
|
||||
{ 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°'},
|
||||
]
|
||||
|
||||
const tabChildren: any = ref([])
|
||||
// 定义 span-method 逻辑
|
||||
const arraySpanMethod = ({ rowIndex, columnIndex }: { rowIndex: number; columnIndex: number }) => {
|
||||
if (columnIndex === 0 || columnIndex === 3) { // 第一列
|
||||
if (columnIndex === 0 || columnIndex === 3) {
|
||||
// 第一列
|
||||
if (rowIndex % 2 === 0) {
|
||||
return {
|
||||
rowspan: 2,
|
||||
colspan: 1
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
// 切换按钮类型
|
||||
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';
|
||||
}
|
||||
};
|
||||
// childForm.value = row
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
emit('close')
|
||||
}
|
||||
|
||||
// 保存数据
|
||||
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
|
||||
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 || [])
|
||||
)
|
||||
|
||||
// 初始化按钮类型
|
||||
tableData.forEach((_, index) => {
|
||||
buttonTypes[index] = {
|
||||
channel: 'info',
|
||||
harmonic: 'info',
|
||||
interHarmonic: 'info',
|
||||
flicker: 'info',
|
||||
transient: 'info'
|
||||
};
|
||||
});
|
||||
// 判断是否存在 code 在 targetCodes 中
|
||||
const hasTargetCode = tabChildren.value.some(item =>
|
||||
['Base_0_10', 'Base_20_85', 'Base_110_200'].includes(item.code)
|
||||
)
|
||||
if (hasTargetCode) {
|
||||
tabChildren.value.unshift({
|
||||
code: 'Base',
|
||||
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(新增、编辑)
|
||||
const openDialog = () => {
|
||||
setValueTable.value?.open()
|
||||
}
|
||||
|
||||
const openDialog = () => {}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
@@ -183,7 +624,6 @@ defineExpose({ open })
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: stretch;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.tabs-container {
|
||||
@@ -194,12 +634,12 @@ defineExpose({ open })
|
||||
}
|
||||
|
||||
.left-tabs {
|
||||
flex: 3; /* 左侧 tab 占据 3/4 的宽度 */
|
||||
margin-right: 10px; /* 可选:添加间距 */
|
||||
width: 900px;
|
||||
margin: 0 10px; /* 可选:添加间距 */
|
||||
}
|
||||
|
||||
.right-tabs {
|
||||
flex: 1; /* 右侧 tab 占据 1/4 的宽度 */
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.form-item-container {
|
||||
@@ -225,5 +665,16 @@ defineExpose({ open })
|
||||
.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>
|
||||
@@ -1,240 +1,495 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="divider-container">
|
||||
<el-divider style="width: 400px">检测脚本信息</el-divider>
|
||||
<el-divider style="width: 1300px">检测项目概要信息</el-divider>
|
||||
<el-divider style="width: 260px" content-position="left">检测脚本信息</el-divider>
|
||||
<!-- <el-divider style="width: 400px" 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" >
|
||||
<el-tree
|
||||
:default-expanded-keys="['0', '0-1', '0-2', '0-3', '1']"
|
||||
node-key="id"
|
||||
:data="data"
|
||||
:props="defaultProps"
|
||||
@node-click="handleNodeClick" />
|
||||
<div class="content-tree" :style="{ height: `calc(100vh - ${props.shrink ? '370px' : '315px'})` }">
|
||||
<Tree :treeData="treeData" @setTab="setTab" />
|
||||
</div>
|
||||
|
||||
<div class="content-right-Tabs" style="height: 470px;width: 100px;">
|
||||
<el-tabs type="border-card" style="height: 100%;">
|
||||
<el-tab-pane
|
||||
v-for="tab in props.options"
|
||||
:key="tab.name"
|
||||
:label="tab.label.replace(/准确度|检测/g, '')"
|
||||
:name="tab.name">
|
||||
<!-- 频率tab -->
|
||||
<el-tabs type="border-card" style="height: 400px;">
|
||||
<div
|
||||
class="content-right-Tabs"
|
||||
style="width: 100px"
|
||||
:style="{ height: `calc(100vh - ${props.shrink ? '370px' : '315px'})` }"
|
||||
>
|
||||
<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%">
|
||||
<el-tab-pane label="通讯脚本" name="first">
|
||||
<Commun
|
||||
:activeName="activeName"
|
||||
:formContent="props.formContent"
|
||||
:options="props.options"
|
||||
style="width: 360px"
|
||||
:shrink="props.shrink"
|
||||
: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.name"
|
||||
:key="subTab.value"
|
||||
:label="subTab.label"
|
||||
:name="subTab.name">
|
||||
<!-- 子标签页内容 -->
|
||||
<div class="dialog-footer">
|
||||
<el-button :icon='CirclePlus' type="primary" @click="openDialog('add')">新增</el-button>
|
||||
</div>
|
||||
<div class="table-container">
|
||||
<el-table :data="tableData"
|
||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
:name="subTab.value"
|
||||
style="width: 100%"
|
||||
:style="{ height: '240px',overflow:'hidden'}">
|
||||
<el-table-column prop="sort" label="组次" width="60" />
|
||||
<el-table-column prop="frequency" label="频率(Hz)" width="100" />
|
||||
<el-table-column prop="L1" label="L1"/>
|
||||
<el-table-column prop="L2" label="L2"/>
|
||||
<el-table-column prop="L3" label="L3"/>
|
||||
<el-table-column label="操作" min-width="100">
|
||||
>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
highlight-current-row
|
||||
:height="`calc(100vh - ${props.shrink ? '535px' : '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 }">
|
||||
<el-button type="primary" link :icon='CopyDocument' @click="copyRow(row)">复制</el-button>
|
||||
<el-button type="primary" link :icon='CopyDocument' @click="openAddDialog('edit',row)">编辑</el-button>
|
||||
<el-button type='primary' link :icon='Delete' @click="deleteRow(row)">删除</el-button>
|
||||
<table class="tableL">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="theFirst">V</td>
|
||||
<td>
|
||||
{{
|
||||
row.channelList[item.num].famp == null
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num]?.famp +
|
||||
(valueCode == 'Absolute' ? 'V' : '%')
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
row.channelList[item.num].fphase == null
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num].fphase +
|
||||
'°'
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="theFirst">I</td>
|
||||
<td>
|
||||
{{
|
||||
row.channelList[item.num + 1].famp == null
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num + 1].famp +
|
||||
(valueCode == 'Absolute' ? 'A' : '%')
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
row.channelList[item.num + 1].fphase == null
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num + 1].fphase +
|
||||
'°'
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否启用" width="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>
|
||||
</div>
|
||||
<div class="dialog-footer" style="margin-top: 20px;">
|
||||
<el-button :icon='CirclePlus' type="primary" @click="openAddDialog()">保存测试项</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<TestProjectPopup ref="testProjectPopup" />
|
||||
|
||||
<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 } from 'vue';
|
||||
import { data } from "@/api/plan/autoTest.json";
|
||||
import type { CascaderOption } from 'element-plus';
|
||||
import {CirclePlus, Delete, EditPen,CopyDocument} from '@element-plus/icons-vue'
|
||||
import type { TestScript } from '@/api/device/interface/testScript';
|
||||
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue';
|
||||
|
||||
const testProjectPopup = ref()
|
||||
|
||||
import { type PropType, ref, nextTick } from 'vue'
|
||||
import Tree from './tree.vue'
|
||||
import Commun from './communication.vue'
|
||||
import { type CascaderOption, ElMessageBox } from 'element-plus'
|
||||
import { getTreeData } from '@/api/check/test'
|
||||
import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } 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'
|
||||
interface TabOption {
|
||||
label: string;
|
||||
name: string;
|
||||
children?: TabOption[];
|
||||
label?: string
|
||||
name?: string
|
||||
value?: string
|
||||
code?: string
|
||||
children?: TabOption[]
|
||||
}
|
||||
|
||||
const communRef = ref()
|
||||
const treeData = ref<CheckData.TreeItem[]>([])
|
||||
const valueCode = ref('') //Absolute绝对值
|
||||
const props = defineProps({
|
||||
options: {
|
||||
type: Array as PropType<TabOption[]>,
|
||||
required: true
|
||||
},
|
||||
});
|
||||
|
||||
const tableData= [
|
||||
{ sort: 1, frequency: 42.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
||||
{ sort: 2, frequency: 50, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
||||
{ sort: 3, frequency: 50.05, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
||||
{ 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°' },
|
||||
{ sort: 6, frequency: 57.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
||||
]
|
||||
|
||||
|
||||
const tabs = ref([
|
||||
{
|
||||
label: '频率',
|
||||
name: 'resultTab',
|
||||
subTabs: [
|
||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab' },
|
||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab' },
|
||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab' }
|
||||
]
|
||||
formContent: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
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' }
|
||||
]
|
||||
shrink: {
|
||||
type: Boolean
|
||||
}
|
||||
]);
|
||||
})
|
||||
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 defaultProps = {
|
||||
children: "children",
|
||||
label: "name",
|
||||
pid: "pid",
|
||||
};
|
||||
|
||||
const handleNodeClick = (data: any) => {
|
||||
console.log(data);
|
||||
};
|
||||
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.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
|
||||
}
|
||||
})
|
||||
}
|
||||
// 打开 drawer(新增、编辑)
|
||||
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>
|
||||
<style scoped>
|
||||
<style lang="scss" scoped>
|
||||
.data-check-content {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.content-tree {
|
||||
width: 300px;
|
||||
height: 470px;
|
||||
width: 260px;
|
||||
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
margin-right: 10px;
|
||||
// margin-right: 10px;
|
||||
overflow: auto; /* 同时启用垂直和水平滚动 */
|
||||
overflow-x: auto; /* 确保水平滚动条生效 */
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
|
||||
/* 确保 el-tree 内容可以超出容器宽度 */
|
||||
.el-tree {
|
||||
width: fit-content; /* 根据内容自适应宽度 */
|
||||
@@ -244,7 +499,7 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
|
||||
flex: 1; /* 根据需要调整宽度比例 */
|
||||
}
|
||||
|
||||
.dialog-footer{
|
||||
.dialog-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-bottom: 10px;
|
||||
@@ -252,15 +507,51 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
|
||||
|
||||
.divider-container {
|
||||
display: flex;
|
||||
|
||||
}
|
||||
|
||||
.divider-container .el-divider {
|
||||
margin-right: 30px; /* 根据需要调整间距 */
|
||||
}
|
||||
:deep(.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell) {
|
||||
padding: 3px 11px;
|
||||
}
|
||||
:deep(.el-loading-mask) {
|
||||
z-index: 3000;
|
||||
}
|
||||
.tableL {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
|
||||
td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 5px;
|
||||
width: 45%;
|
||||
}
|
||||
.theFirst {
|
||||
background-color: var(--el-color-primary);
|
||||
color: #fff;
|
||||
width: 20px !important;
|
||||
}
|
||||
}
|
||||
.actionButtons {
|
||||
.el-button {
|
||||
margin-left: 0px;
|
||||
margin: 5px 6px;
|
||||
}
|
||||
}
|
||||
</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>
|
||||
|
||||
@@ -3,24 +3,74 @@
|
||||
<div class="left-editor">
|
||||
<!-- 左侧编辑区域内容 -->
|
||||
|
||||
<img src="@/assets/images/transient.png" />
|
||||
<!-- <div class="inputTop">
|
||||
<el-input v-model="form[0].dipData.fValue" style="width: 150px; left: 4%" :disabled="!form[0].dipFlag">
|
||||
<template #append>S</template>
|
||||
</el-input>
|
||||
<el-input v-model="form[0].dipData.fValue" style="width: 150px; left: 22%" :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 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="设定幅度(%)">
|
||||
<el-input v-model="input1" />
|
||||
<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="持续时间(周波)">
|
||||
<el-input v-model="input2" />
|
||||
<el-form-item label-width="120px" label="持续时间(周波)">
|
||||
<el-input
|
||||
type="number"
|
||||
v-model="form[0].dipData.retainTime"
|
||||
style="width: 150px"
|
||||
:disabled="!form[0].dipFlag"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<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>
|
||||
|
||||
<style scoped>
|
||||
<style lang="scss" scoped>
|
||||
canvas {
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
@@ -28,16 +78,31 @@ canvas {
|
||||
.editor-container {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.left-editor {
|
||||
flex: 3; /* 左侧区域占据 3/4 的宽度 */
|
||||
margin-left: 150px; /* 可选:添加间距 */
|
||||
flex: 1; /* 左侧区域占据 3/4 的宽度 */
|
||||
position: relative;
|
||||
img {
|
||||
width: 90%;
|
||||
height: 140px;
|
||||
margin: 0 10px 20px;
|
||||
}
|
||||
.inputTop {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
width: 100%;
|
||||
}
|
||||
.inputBottom {
|
||||
position: absolute;
|
||||
bottom: -5px;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.right-editor {
|
||||
flex: 1; /* 右侧区域占据 1/4 的宽度 */
|
||||
margin-right: 250px; /* 向左侧移动一点 */
|
||||
width: 400px;
|
||||
/* margin-right: 250px; 向左侧移动一点 */
|
||||
}
|
||||
</style>
|
||||
@@ -1,41 +1,77 @@
|
||||
<template>
|
||||
<div class="tabs-container">
|
||||
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%;">
|
||||
<el-tab-pane label="Modulation">
|
||||
<!-- 全局设置菜单内容 -->
|
||||
<div>
|
||||
<el-form-item label="电压变动幅度(%)" prop='name'>
|
||||
<el-input style="width: 200px;" />
|
||||
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%">
|
||||
<el-tab-pane label="短闪">
|
||||
<!-- 全局设置菜单内容 Modulation-->
|
||||
|
||||
<div style="display: flex">
|
||||
<el-form-item abel-width="180px">
|
||||
<template #label>
|
||||
<el-select
|
||||
v-model="form[0].flickerData.waveType"
|
||||
@change="changeLable"
|
||||
style="width: 170px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in waveList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<el-select
|
||||
placeholder="请选择波动类型"
|
||||
style="width: 180px"
|
||||
filterable
|
||||
v-model="form[0].flickerData.fchagFre"
|
||||
@change="changeWaveType"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, i) in waveChildrenList"
|
||||
:key="item.fchagFre"
|
||||
:value="item.fchagFre"
|
||||
:label="item.fchagFre"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="form-container">
|
||||
<el-form-item label="波动频度(/min/Hz)" prop='name'>
|
||||
<el-input />
|
||||
</el-form-item>
|
||||
<el-form-item label="波动类型" prop='name'>
|
||||
<el-select placeholder="请选择波动类型" style="width: 150px;">
|
||||
<el-option label="Hz" :value="1"></el-option>
|
||||
<el-option label="CPM" :value="0"></el-option>
|
||||
</el-select>
|
||||
<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="波类型" prop='name'>
|
||||
<el-select placeholder="请选择波类型">
|
||||
<el-option label="RECT" :value="2"></el-option>
|
||||
<el-option label="SIN" :value="1"></el-option>
|
||||
<el-option label="SQU" :value="0"></el-option>
|
||||
<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="占空比(%)" prop='name'>
|
||||
<el-input />
|
||||
<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>
|
||||
@@ -44,7 +80,291 @@
|
||||
</template>
|
||||
|
||||
<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>
|
||||
|
||||
<style scoped>
|
||||
@@ -63,7 +383,6 @@
|
||||
}
|
||||
|
||||
.fixed-width-tabs {
|
||||
|
||||
margin-right: 100px; /* 可选:添加右侧间距 */
|
||||
}
|
||||
|
||||
|
||||
@@ -1,89 +1,157 @@
|
||||
<template>
|
||||
<div class="tabs-container">
|
||||
<el-tabs type="border-card" class="right-tabs" style="height: 100%;">
|
||||
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
|
||||
<el-tab-pane label="电压通道">
|
||||
<el-form :inline="true" :model="formInline" :disabled="!props.childForm[0].harmFlag">
|
||||
<el-form-item label="次数">
|
||||
<el-select
|
||||
v-model="formInline.harm"
|
||||
multiple
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
style="width: 160px"
|
||||
filterable
|
||||
clearable
|
||||
>
|
||||
<el-option label="全部" value="0" />
|
||||
<el-option v-for="item in 49" :key="item" :label="item + 1" :value="item + 1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="含有率">
|
||||
<el-input
|
||||
v-model="formInline.famp"
|
||||
type="number"
|
||||
placeholder="含有率"
|
||||
style="width: 80px"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="相角">
|
||||
<el-input
|
||||
v-model="formInline.fphase"
|
||||
type="number"
|
||||
placeholder="相角"
|
||||
style="width: 80px"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :icon="Check" @click="onSubmit" size="small">确定</el-button>
|
||||
<el-button type="primary" :icon="Delete" @click="empty(0)" size="small">清空表格</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 电压通道内容 -->
|
||||
<div class="table-container">
|
||||
<el-table :data="tableData1" border class="half-width-table">
|
||||
<el-table-column prop="date" label="次数" width="60"/>
|
||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
||||
<template #default="scope">
|
||||
<div class="input-label-container">
|
||||
<el-input />
|
||||
<label>%</label>
|
||||
</div>
|
||||
<el-table :data="form[0].harmList" border stripe size="small">
|
||||
<el-table-column prop="harm" align="center" label="次数" width="60" />
|
||||
<el-table-column prop="famp" align="center" label="谐波含有率">
|
||||
<template #default="{ row }">
|
||||
<el-input type="number" v-if="row.show" v-model="row.famp" />
|
||||
<span v-else>{{ row.famp }}%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="谐波相角" width="120">
|
||||
<template #default="scope">
|
||||
<div class="input-label-container">
|
||||
<el-input />
|
||||
<label>°</label>
|
||||
</div>
|
||||
<el-table-column prop="fphase" label="谐波相角" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input type="number" v-if="row.show" v-model="row.fphase" />
|
||||
<span v-else>{{ row.fphase }}°</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table :data="tableData2" border class="half-width-table">
|
||||
<el-table-column prop="date" label="次数" width="60"/>
|
||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
||||
<template #default="scope">
|
||||
<div class="input-label-container">
|
||||
<el-input />
|
||||
<label>%</label>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="谐波相角" width="120">
|
||||
<template #default="scope">
|
||||
<div class="input-label-container">
|
||||
<el-input />
|
||||
<label>°</label>
|
||||
</div>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="{ row, $index }">
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
:icon="EditPen"
|
||||
v-if="!row.show"
|
||||
@click="row.show = true"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="primary" link :icon="Check" v-else @click="row.show = false">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button type="primary" link :icon="Delete" @click="HarmFlagDelete(0, $index)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-tabs type="border-card" style="height: 100%;">
|
||||
<el-tabs type="border-card" style="height: 100%">
|
||||
<el-tab-pane label="电流通道">
|
||||
<el-form :inline="true" :model="formInline1" :disabled="!props.childForm[1].harmFlag">
|
||||
<el-form-item label="次数">
|
||||
<el-select
|
||||
v-model="formInline1.harm"
|
||||
multiple
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
style="width: 160px"
|
||||
filterable
|
||||
clearable
|
||||
>
|
||||
<el-option label="全部" value="0" />
|
||||
<el-option v-for="item in 49" :key="item" :label="item + 1" :value="item + 1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="含有率">
|
||||
<el-input
|
||||
v-model="formInline1.famp"
|
||||
type="number"
|
||||
placeholder="含有率"
|
||||
style="width: 80px"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="相角">
|
||||
<el-input
|
||||
v-model="formInline1.fphase"
|
||||
type="number"
|
||||
placeholder="相角"
|
||||
style="width: 80px"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :icon="Check" @click="onSubmit1" size="small">确定</el-button>
|
||||
<el-button type="primary" :icon="Delete" @click="empty(1)" size="small">清空表格</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 电流通道内容 -->
|
||||
<div class="table-container">
|
||||
<el-table :data="tableData1" border class="half-width-table">
|
||||
<el-table-column prop="date" label="次数" width="60"/>
|
||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
||||
<template #default="scope">
|
||||
<div class="input-label-container">
|
||||
<el-input />
|
||||
<label>%</label>
|
||||
</div>
|
||||
<el-table :data="form[1].harmList" border stripe size="small">
|
||||
<el-table-column prop="harm" align="center" label="次数" width="60" />
|
||||
<el-table-column prop="famp" align="center" label="谐波含有率">
|
||||
<template #default="{ row }">
|
||||
<el-input type="number" v-if="row.show" v-model="row.famp" />
|
||||
<span v-else>{{ row.famp }}%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="谐波相角" width="120">
|
||||
<template #default="scope">
|
||||
<div class="input-label-container">
|
||||
<el-input />
|
||||
<label>°</label>
|
||||
</div>
|
||||
<el-table-column prop="fphase" label="谐波相角" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input type="number" v-if="row.show" v-model="row.fphase" />
|
||||
<span v-else>{{ row.fphase }}°</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table :data="tableData2" border class="half-width-table">
|
||||
<el-table-column prop="date" label="次数" width="60"/>
|
||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
||||
<template #default="scope">
|
||||
<div class="input-label-container">
|
||||
<el-input />
|
||||
<label>%</label>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="谐波相角" width="120">
|
||||
<template #default="scope">
|
||||
<div class="input-label-container">
|
||||
<el-input />
|
||||
<label>°</label>
|
||||
</div>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="{ row, $index }">
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
:icon="EditPen"
|
||||
v-if="!row.show"
|
||||
@click="row.show = true"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="primary" link :icon="Check" v-else @click="row.show = false">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button type="primary" link :icon="Delete" @click="HarmFlagDelete(1, $index)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -91,40 +159,126 @@
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { Check, Delete, EditPen, CopyDocument } from '@element-plus/icons-vue'
|
||||
import { ref } from 'vue'
|
||||
const props = defineProps({
|
||||
childForm: {
|
||||
type: Array as any,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const form: any = computed({
|
||||
get() {
|
||||
return props.childForm
|
||||
},
|
||||
set(value) {}
|
||||
})
|
||||
const formInline = ref({
|
||||
harm: [],
|
||||
famp: '',
|
||||
fphase: ''
|
||||
})
|
||||
const formInline1 = ref({
|
||||
harm: [],
|
||||
famp: '',
|
||||
fphase: ''
|
||||
})
|
||||
// 定义表格数据项的类型
|
||||
interface TableItem {
|
||||
date: string;
|
||||
harmonicRate?: string;
|
||||
harmonicPhase?: string;
|
||||
name?: string;
|
||||
date: string
|
||||
harmonicRate?: string
|
||||
harmonicPhase?: string
|
||||
name?: string
|
||||
}
|
||||
|
||||
// 定义并初始化 tableData
|
||||
const tableData1 = ref<TableItem[]>([]);
|
||||
const tableData2 = ref<TableItem[]>([]);
|
||||
|
||||
for (let i = 1; i <= 25; i++) {
|
||||
tableData1.value.push({
|
||||
date: i.toString(),
|
||||
harmonicRate: `谐波含有率${i}`,
|
||||
harmonicPhase: `谐波相角${i}`
|
||||
});
|
||||
const empty = (index: number) => {
|
||||
props.childForm[index].harmList = []
|
||||
}
|
||||
for (let i = 26; i <= 50; i++) {
|
||||
tableData2.value.push({
|
||||
date: i.toString(),
|
||||
harmonicRate: `谐波含有率${i}`,
|
||||
harmonicPhase: `谐波相角${i}`
|
||||
});
|
||||
const onSubmit = () => {
|
||||
console.log('🚀 ~ onSubmit ~ props.childForm[0]:', props.childForm[0].harmList)
|
||||
if (formInline.value.harm.length == 0 || formInline.value.famp == '' || formInline.value.fphase == '') {
|
||||
ElMessage.warning('请填写值!')
|
||||
return
|
||||
}
|
||||
if (formInline.value.harm.includes('0')) {
|
||||
props.childForm[0].harmList = []
|
||||
for (let i = 2; i < 51; i++) {
|
||||
props.childForm[0].harmList.push({
|
||||
harm: i, //间谐波次数
|
||||
famp: formInline.value.famp, //间谐波含有率
|
||||
fphase: formInline.value.fphase // 间谐波相角
|
||||
})
|
||||
}
|
||||
} else {
|
||||
formInline.value.harm.forEach((item: any) => {
|
||||
props.childForm[0].harmList.push({
|
||||
harm: item, //间谐波次数
|
||||
famp: formInline.value.famp, //间谐波含有率
|
||||
fphase: formInline.value.fphase // 间谐波相角
|
||||
})
|
||||
})
|
||||
const seen = new Set()
|
||||
const uniqueData = []
|
||||
|
||||
// 反向遍历数组
|
||||
for (let i = props.childForm[0].harmList.length - 1; i >= 0; i--) {
|
||||
const item = props.childForm[0].harmList[i]
|
||||
// 如果 harm 还未出现过,则添加到结果数组
|
||||
if (!seen.has(item.harm)) {
|
||||
seen.add(item.harm)
|
||||
uniqueData.unshift(item) // 添加到结果数组的开头
|
||||
}
|
||||
}
|
||||
props.childForm[0].harmList = uniqueData.sort((a, b) => a.harm - b.harm)
|
||||
}
|
||||
}
|
||||
const onSubmit1 = () => {
|
||||
if (formInline1.value.harm.length == 0 || formInline1.value.famp == '' || formInline1.value.fphase == '') {
|
||||
ElMessage.warning('请填写值!')
|
||||
return
|
||||
}
|
||||
if (formInline1.value.harm.includes('0')) {
|
||||
props.childForm[1].harmList = []
|
||||
for (let i = 2; i < 51; i++) {
|
||||
props.childForm[1].harmList.push({
|
||||
harm: i, //间谐波次数
|
||||
famp: formInline1.value.famp, //间谐波含有率
|
||||
fphase: formInline1.value.fphase // 间谐波相角
|
||||
})
|
||||
}
|
||||
} else {
|
||||
formInline1.value.harm.forEach((item: any) => {
|
||||
props.childForm[1].harmList.push({
|
||||
harm: item, //间谐波次数
|
||||
famp: formInline1.value.famp, //间谐波含有率
|
||||
fphase: formInline1.value.fphase // 间谐波相角
|
||||
})
|
||||
})
|
||||
const seen = new Set()
|
||||
const uniqueData = []
|
||||
|
||||
// 反向遍历数组
|
||||
for (let i = props.childForm[1].harmList.length - 1; i >= 0; i--) {
|
||||
const item = props.childForm[1].harmList[i]
|
||||
// 如果 harm 还未出现过,则添加到结果数组
|
||||
if (!seen.has(item.harm)) {
|
||||
seen.add(item.harm)
|
||||
uniqueData.unshift(item) // 添加到结果数组的开头
|
||||
}
|
||||
}
|
||||
props.childForm[1].harmList = uniqueData.sort((a, b) => a.harm - b.harm)
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
const HarmFlagDelete = (index: number, number: number) => {
|
||||
props.childForm[index].harmList.splice(number, 1)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style lang="scss" scoped>
|
||||
.tabs-container {
|
||||
display: flex;
|
||||
justify-content: space-between; /* 使两个 el-tabs 之间有间距 */
|
||||
@@ -163,4 +317,7 @@ for (let i = 26; i <= 50; i++) {
|
||||
.input-label-container label {
|
||||
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
||||
}
|
||||
// 全局css 加上以下代码,可以隐藏上下箭头
|
||||
|
||||
// 取消input的上下箭头
|
||||
</style>
|
||||
@@ -1,32 +1,160 @@
|
||||
<template>
|
||||
<div class="tabs-container">
|
||||
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%;">
|
||||
<el-tab-pane label="间谐波A">
|
||||
<!-- 全局设置菜单内容 -->
|
||||
<div>
|
||||
<el-form-item label="含有率(%)" prop='name'>
|
||||
<el-input />
|
||||
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
|
||||
<el-tab-pane label="电压通道">
|
||||
<el-form :inline="true" :model="formInline" :disabled="!props.childForm[0].inHarmFlag">
|
||||
<el-form-item label="次数">
|
||||
<el-select
|
||||
v-model="formInline.inharm"
|
||||
multiple
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
style="width: 160px"
|
||||
filterable
|
||||
clearable
|
||||
>
|
||||
<el-option label="全部" value="0" />
|
||||
<el-option v-for="item in 50" :key="item" :label="item - 0.5" :value="item - 0.5" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div>
|
||||
<el-form-item label="间谐波次数" prop='name'>
|
||||
<el-input />
|
||||
<el-form-item label="含有率">
|
||||
<el-input
|
||||
v-model="formInline.famp"
|
||||
type="number"
|
||||
placeholder="含有率"
|
||||
style="width: 80px"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="相角">
|
||||
<el-input
|
||||
v-model="formInline.fphase"
|
||||
type="number"
|
||||
placeholder="相角"
|
||||
style="width: 80px"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :icon="Check" @click="onSubmit" size="small">确定</el-button>
|
||||
<el-button type="primary" :icon="Delete" @click="empty(0)" size="small">清空表格</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 电压通道内容 -->
|
||||
<div class="table-container">
|
||||
<el-table :data="form[0].inharmList" border stripe size="small">
|
||||
<el-table-column prop="inharm" align="center" label="次数" width="60" />
|
||||
<el-table-column prop="famp" align="center" label="间谐波含有率">
|
||||
<template #default="{ row }">
|
||||
<el-input type="number" v-if="row.show" v-model="row.famp" />
|
||||
<span v-else>{{ row.famp }}%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="fphase" label="间谐波相角" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input type="number" v-if="row.show" v-model="row.fphase" />
|
||||
<span v-else>{{ row.fphase }}°</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="{ row, $index }">
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
:icon="EditPen"
|
||||
v-if="!row.show"
|
||||
@click="row.show = true"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="primary" link :icon="Check" v-else @click="row.show = false">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button type="primary" link :icon="Delete" @click="inHarmFlagDelete(0, $index)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%;">
|
||||
<el-tab-pane label="间谐波B">
|
||||
<!-- 全局设置菜单内容 -->
|
||||
<div>
|
||||
<el-form-item label="含有率(%)" prop='name'>
|
||||
<el-input />
|
||||
<el-tabs type="border-card" style="height: 100%">
|
||||
<el-tab-pane label="电流通道">
|
||||
<el-form :inline="true" :model="formInline1" :disabled="!props.childForm[1].inHarmFlag">
|
||||
<el-form-item label="次数">
|
||||
<el-select
|
||||
v-model="formInline1.inharm"
|
||||
multiple
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
style="width: 160px"
|
||||
filterable
|
||||
clearable
|
||||
>
|
||||
<el-option label="全部" value="0" />
|
||||
<el-option v-for="item in 50" :key="item" :label="item - 0.5" :value="item - 0.5" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div>
|
||||
<el-form-item label="间谐波次数" prop='name'>
|
||||
<el-input />
|
||||
<el-form-item label="含有率">
|
||||
<el-input
|
||||
v-model="formInline1.famp"
|
||||
type="number"
|
||||
placeholder="含有率"
|
||||
style="width: 80px"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="相角">
|
||||
<el-input
|
||||
v-model="formInline1.fphase"
|
||||
type="number"
|
||||
placeholder="相角"
|
||||
style="width: 80px"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :icon="Check" @click="onSubmit1" size="small">确定</el-button>
|
||||
<el-button type="primary" :icon="Delete" @click="empty(1)" size="small">清空表格</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 电流通道内容 -->
|
||||
<div class="table-container">
|
||||
<el-table :data="form[1].inharmList" border stripe size="small">
|
||||
<el-table-column prop="inharm" align="center" label="次数" width="60" />
|
||||
<el-table-column prop="famp" align="center" label="间谐波含有率">
|
||||
<template #default="{ row }">
|
||||
<el-input type="number" v-if="row.show" v-model="row.famp" />
|
||||
<span v-else>{{ row.famp }}%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="fphase" label="间谐波相角" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input type="number" v-if="row.show" v-model="row.fphase" />
|
||||
<span v-else>{{ row.fphase }}°</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="{ row, $index }">
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
:icon="EditPen"
|
||||
v-if="!row.show"
|
||||
@click="row.show = true"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="primary" link :icon="Check" v-else @click="row.show = false">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button type="primary" link :icon="Delete" @click="inHarmFlagDelete(1, $index)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -34,33 +162,162 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Delete, EditPen, CopyDocument } from '@element-plus/icons-vue'
|
||||
import { ref } from 'vue'
|
||||
const props = defineProps({
|
||||
childForm: {
|
||||
type: Array as any,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const form: any = computed({
|
||||
get() {
|
||||
return props.childForm
|
||||
},
|
||||
set(value) {}
|
||||
})
|
||||
const formInline = ref({
|
||||
inharm: [],
|
||||
famp: '',
|
||||
fphase: ''
|
||||
})
|
||||
const formInline1 = ref({
|
||||
inharm: [],
|
||||
famp: '',
|
||||
fphase: ''
|
||||
})
|
||||
// 定义表格数据项的类型
|
||||
interface TableItem {
|
||||
date: string
|
||||
inharmonicRate?: string
|
||||
inharmonicPhase?: string
|
||||
name?: string
|
||||
}
|
||||
const empty = (index: number) => {
|
||||
props.childForm[index].inharmList = []
|
||||
}
|
||||
const onSubmit = () => {
|
||||
console.log('🚀 ~ onSubmit ~ props.childForm[0]:', props.childForm[0].inharmList)
|
||||
if (formInline.value.inharm.length == 0 || formInline.value.famp == '' || formInline.value.fphase == '') {
|
||||
ElMessage.warning('请填写值!')
|
||||
return
|
||||
}
|
||||
if (formInline.value.inharm.includes('0')) {
|
||||
props.childForm[0].inharmList = []
|
||||
for (let i = 2; i < 51; i++) {
|
||||
props.childForm[0].inharmList.push({
|
||||
inharm: i, //间间谐波次数
|
||||
famp: formInline.value.famp, //间间谐波含有率
|
||||
fphase: formInline.value.fphase // 间间谐波相角
|
||||
})
|
||||
}
|
||||
} else {
|
||||
formInline.value.inharm.forEach((item: any) => {
|
||||
props.childForm[0].inharmList.push({
|
||||
inharm: item, //间间谐波次数
|
||||
famp: formInline.value.famp, //间间谐波含有率
|
||||
fphase: formInline.value.fphase // 间间谐波相角
|
||||
})
|
||||
})
|
||||
const seen = new Set()
|
||||
const uniqueData = []
|
||||
|
||||
// 反向遍历数组
|
||||
for (let i = props.childForm[0].inharmList.length - 1; i >= 0; i--) {
|
||||
const item = props.childForm[0].inharmList[i]
|
||||
// 如果 inharm 还未出现过,则添加到结果数组
|
||||
if (!seen.has(item.inharm)) {
|
||||
seen.add(item.inharm)
|
||||
uniqueData.unshift(item) // 添加到结果数组的开头
|
||||
}
|
||||
}
|
||||
props.childForm[0].inharmList = uniqueData.sort((a, b) => a.inharm - b.inharm)
|
||||
}
|
||||
}
|
||||
const onSubmit1 = () => {
|
||||
if (formInline1.value.inharm.length == 0 || formInline1.value.famp == '' || formInline1.value.fphase == '') {
|
||||
ElMessage.warning('请填写值!')
|
||||
return
|
||||
}
|
||||
if (formInline1.value.inharm.includes('0')) {
|
||||
props.childForm[1].inharmList = []
|
||||
for (let i = 2; i < 51; i++) {
|
||||
props.childForm[1].inharmList.push({
|
||||
inharm: i, //间间谐波次数
|
||||
famp: formInline1.value.famp, //间间谐波含有率
|
||||
fphase: formInline1.value.fphase // 间间谐波相角
|
||||
})
|
||||
}
|
||||
} else {
|
||||
formInline1.value.inharm.forEach((item: any) => {
|
||||
props.childForm[1].inharmList.push({
|
||||
inharm: item, //间间谐波次数
|
||||
famp: formInline1.value.famp, //间间谐波含有率
|
||||
fphase: formInline1.value.fphase // 间间谐波相角
|
||||
})
|
||||
})
|
||||
const seen = new Set()
|
||||
const uniqueData = []
|
||||
|
||||
// 反向遍历数组
|
||||
for (let i = props.childForm[1].inharmList.length - 1; i >= 0; i--) {
|
||||
const item = props.childForm[1].inharmList[i]
|
||||
// 如果 inharm 还未出现过,则添加到结果数组
|
||||
if (!seen.has(item.inharm)) {
|
||||
seen.add(item.inharm)
|
||||
uniqueData.unshift(item) // 添加到结果数组的开头
|
||||
}
|
||||
}
|
||||
props.childForm[1].inharmList = uniqueData.sort((a, b) => a.inharm - b.inharm)
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
const inHarmFlagDelete = (index: number, number: number) => {
|
||||
props.childForm[index].inharmList.splice(number, 1)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style lang="scss" scoped>
|
||||
.tabs-container {
|
||||
display: flex;
|
||||
justify-content: center; /* 使两个 el-tabs 居中对齐 */
|
||||
align-items: stretch; /* 使两个 el-tabs 高度拉伸 */
|
||||
justify-content: space-between; /* 使两个 el-tabs 之间有间距 */
|
||||
height: 100%;
|
||||
padding: 0 20px; /* 可选:添加左右间距 */
|
||||
}
|
||||
|
||||
.fixed-width-tabs {
|
||||
width: 400px; /* 设置固定的宽度 */
|
||||
margin-right: 100px; /* 可选:添加右侧间距 */
|
||||
.right-tabs {
|
||||
flex: 1; /* 使两个 el-tabs 占据相同的空间 */
|
||||
margin-right: 10px; /* 可选:添加右侧间距 */
|
||||
}
|
||||
|
||||
.fixed-width-tabs:last-child {
|
||||
margin-right: 0; /* 最后一个 el-tabs 不需要右侧间距 */
|
||||
.el-tabs {
|
||||
flex: 1; /* 使两个 el-tabs 占据相同的空间 */
|
||||
}
|
||||
|
||||
.el-tab-pane {
|
||||
.table-container {
|
||||
display: flex;
|
||||
flex-direction: column; /* 确保内容上下排列 */
|
||||
justify-content: space-between; /* 使两个表格之间有间距 */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 20px; /* 可选:添加表单项之间的间距 */
|
||||
.half-width-table {
|
||||
flex: 1; /* 使两个表格占据相同的空间 */
|
||||
margin-right: 10px; /* 可选:添加表格之间的间距 */
|
||||
}
|
||||
|
||||
.half-width-table:last-child {
|
||||
margin-right: 0; /* 最后一个表格不需要右侧间距 */
|
||||
}
|
||||
|
||||
.input-label-container {
|
||||
display: flex;
|
||||
align-items: center; /* 垂直居中对齐 */
|
||||
}
|
||||
|
||||
.input-label-container label {
|
||||
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
||||
}
|
||||
// 全局css 加上以下代码,可以隐藏上下箭头
|
||||
|
||||
// 取消input的上下箭头
|
||||
</style>
|
||||
@@ -1,158 +1,316 @@
|
||||
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle"
|
||||
v-model='dialogVisible'
|
||||
@close="close"
|
||||
v-bind="dialogBig"
|
||||
width="1400px">
|
||||
<div class="dialog-content" >
|
||||
<el-form :model='formContent' label-width="auto" class="form-three ">
|
||||
<el-divider >基础信息</el-divider>
|
||||
<el-form-item label="脚本名称" prop='name'>
|
||||
<el-input v-model='formContent.name' />
|
||||
<div>
|
||||
<el-card style="margin-bottom: 10px" class="cardTop" :style="{ height: height }">
|
||||
<el-form
|
||||
:model="formContent"
|
||||
:inline="true"
|
||||
label-width="auto"
|
||||
ref="dialogFormRef"
|
||||
:rules="rules"
|
||||
class="form-five"
|
||||
>
|
||||
<el-form-item label="脚本名称" prop="name">
|
||||
<el-input v-model.trim="formContent.name" placeholder="请输入脚本名称" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="参照标准名称" prop='standardName'>
|
||||
<el-input v-model='formContent.standardName' />
|
||||
<el-form-item label="参照标准名称" prop="standardName">
|
||||
<!-- <el-input v-model.trim="formContent.standardName" placeholder="请输入参照标准名称" clearable />-->
|
||||
<el-select v-model="formContent.standardName" filterable placeholder="请选择参照标准名称" @change="setStandardTimeList">
|
||||
<el-option v-for="item in standardNameList" :key="item.label" :label="item.label" :value="item.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="标准推行年份" prop='standardTime'>
|
||||
<el-date-picker
|
||||
v-model="formContent.standardTime"
|
||||
type="year"
|
||||
placeholder="请选择标准推行年份"
|
||||
<el-form-item label="标准推行年份" prop="standardTime">
|
||||
<!-- <el-date-picker-->
|
||||
<!-- v-model="formContent.standardTime"-->
|
||||
<!-- style="width: 100%"-->
|
||||
<!-- type="year"-->
|
||||
<!-- format="YYYY"-->
|
||||
<!-- value-format="YYYY"-->
|
||||
<!-- placeholder="请选择标准推行年份"-->
|
||||
<!-- />-->
|
||||
<el-select v-model="formContent.standardTime" filterable placeholder="请选择标准推行年份">
|
||||
<el-option v-for="item in standardTimeList" :key="item" :value="item" :label="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="模版类型" prop="type">
|
||||
<el-select v-model="formContent.type" filterable clearable placeholder="请选择模版类型">
|
||||
<el-option v-for="item in stencil" :key="item.value" :label="item.name" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<div class="formBut">
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="shrink ? ArrowUpBold : ArrowDownBold"
|
||||
@click="shrinkChange"
|
||||
></el-button>
|
||||
<el-button type="primary" :icon="Select" @click="save">保存</el-button>
|
||||
<el-button :icon="Close" @click="close">返回</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测脚本值类型" prop="valueType">
|
||||
<el-select
|
||||
v-model="formContent.valueType"
|
||||
:disabled="titleType == '编辑检测脚本'"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择值类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Script_Value_Type')"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="额定电流" prop="ratedCurr">
|
||||
<el-input-number
|
||||
v-model.trim="formContent.ratedCurr"
|
||||
min="0"
|
||||
max="20"
|
||||
style="width: 100%"
|
||||
placeholder="请输入额定电流"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="额定电压" prop="ratedVolt">
|
||||
<el-input-number
|
||||
v-model.trim="formContent.ratedVolt"
|
||||
min="0"
|
||||
max="380"
|
||||
style="width: 100%"
|
||||
placeholder="请输入额定电压"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card v-if="show">
|
||||
<TestScriptDetail :options="secondLevelOptions" :formContent="formContent" :shrink="shrink" />
|
||||
</el-card>
|
||||
</div>
|
||||
<TestScriptDetail :options="secondLevelOptions" />
|
||||
<template #footer>
|
||||
<div >
|
||||
<el-button @click='close()'>取 消</el-button>
|
||||
<el-button type="primary" @click='save()'>保存脚本</el-button>
|
||||
<el-button type="primary" @click='save()'>脚本另存为</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
</template>
|
||||
<script setup lang='ts'>
|
||||
import { dialogBig } from '@/utils/elementBind'
|
||||
import { computed, ref } from 'vue'
|
||||
<script setup lang="ts">
|
||||
import { ref, nextTick } from 'vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import TestScriptDetail from '@/views/machine/testScript/components/testScriptDetail.vue';
|
||||
import { type TestScript } from '@/api/device/interface/testScript';
|
||||
import type { Dict } from '@/api/system/dictionary/interface';
|
||||
import {getDictTreeList} from '@/api/system/dictionary/dictTree'
|
||||
import type { CascaderOption } from 'element-plus';
|
||||
import TestScriptDetail from '@/views/machine/testScript/components/testScriptDetail.vue'
|
||||
import { type TestScript } from '@/api/device/interface/testScript'
|
||||
import type { Dict } from '@/api/system/dictionary/interface'
|
||||
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||
import type { CascaderOption } from 'element-plus'
|
||||
import { Select, Close, ArrowDownBold, ArrowUpBold } from '@element-plus/icons-vue'
|
||||
import { pqScriptAdd, pqScriptUpdate } from '@/api/device/testScript'
|
||||
import { useRouter } from 'vue-router'
|
||||
const modeId = ref()
|
||||
const secondLevelOptions: any[] = [];
|
||||
const show = ref(false)
|
||||
const height = ref('125px')
|
||||
const router = useRouter()
|
||||
const standardNameList = reactive<{id:string,label: string, value: string}[]>([])
|
||||
const standardTimeList = reactive<Array<string>>([])
|
||||
|
||||
const secondLevelOptions: any[] = []
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
const dictStore = useDictStore()
|
||||
function useMetaInfo() {
|
||||
const dialogVisible = ref(false)
|
||||
function useMetaInfo() {
|
||||
const titleType = ref('add')
|
||||
const formContent = ref<TestScript.ResTestScript>({
|
||||
name: '',
|
||||
type: '',
|
||||
valueType:'',
|
||||
valueType: '',
|
||||
pattern: modeId.value,
|
||||
standardName: '',
|
||||
standardTime: '',
|
||||
state:1,
|
||||
|
||||
state: 1,
|
||||
ratedCurr: 0,
|
||||
ratedVolt: 0
|
||||
})
|
||||
return { dialogVisible, titleType,formContent }
|
||||
}
|
||||
return { titleType, formContent }
|
||||
}
|
||||
const shrink = ref(true)
|
||||
const stencil = [
|
||||
{ name: '脚本', value: 0 },
|
||||
{ name: '模版', value: 1 }
|
||||
]
|
||||
const rules = {
|
||||
name: [{ required: true, message: '请输入脚本名称', trigger: 'blur' }],
|
||||
standardName: [{ required: true, message: '请输入参照标准名称', trigger: 'blur' }],
|
||||
standardTime: [{ required: true, message: '请选择标准推行年份', trigger: 'change' }],
|
||||
type: [{ required: true, message: '请选择模版类型', trigger: 'change' }],
|
||||
valueType: [{ required: true, message: '请选择检测脚本值类型', trigger: 'change' }],
|
||||
ratedCurr: [{ required: true, message: '请填写额定电流', trigger: 'change' }],
|
||||
ratedVolt: [{ required: true, message: '请填写额定电压', trigger: 'change' }]
|
||||
}
|
||||
|
||||
const { dialogVisible, titleType,formContent } = useMetaInfo()
|
||||
|
||||
let dialogTitle = computed(() => {
|
||||
return titleType.value === 'add' ? '新增检测脚本' : '编辑检测脚本'
|
||||
})
|
||||
|
||||
// 清空formContent
|
||||
const resetFormContent = () => {
|
||||
const { titleType, formContent } = useMetaInfo()
|
||||
// 收缩
|
||||
const shrinkChange = () => {
|
||||
shrink.value = !shrink.value
|
||||
shrink.value ? (height.value = '125px') : (height.value = '70px')
|
||||
}
|
||||
// 清空formContent
|
||||
const resetFormContent = () => {
|
||||
formContent.value = {
|
||||
name: '',
|
||||
type: '',
|
||||
valueType:'',
|
||||
pattern: modeId.value,
|
||||
valueType: '',
|
||||
pattern: '',
|
||||
standardName: '',
|
||||
standardTime: '',
|
||||
state:1,
|
||||
state: 1,
|
||||
ratedCurr: 0,
|
||||
ratedVolt: 0
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
router.go(-1)
|
||||
}
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
// 清空dialogForm中的值
|
||||
resetFormContent()
|
||||
// 重置表单
|
||||
dialogFormRef.value?.resetFields()
|
||||
}
|
||||
// 关闭信息弹框
|
||||
const closeInformation = () => {}
|
||||
|
||||
const setStandardTimeList = ()=>{
|
||||
let checkStandard = standardNameList.find(item => item.label === formContent.value.standardName)
|
||||
if (checkStandard) {
|
||||
standardTimeList.push(...checkStandard.value.split(','))
|
||||
} else {
|
||||
standardTimeList.push('2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024', '2025')
|
||||
}
|
||||
|
||||
// 保存数据
|
||||
const save = () => {
|
||||
|
||||
}
|
||||
|
||||
// 保存数据
|
||||
const save = () => {
|
||||
// dialogFormRef
|
||||
dialogFormRef.value.validate((valid: boolean) => {
|
||||
if (valid) {
|
||||
if (titleType.value == '新增检测脚本') {
|
||||
formContent.value.pattern = modeId.value
|
||||
pqScriptAdd(formContent.value).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
ElMessage.success({ message: res.message })
|
||||
formContent.value.id = res.data
|
||||
titleType.value = '编辑检测脚本'
|
||||
show.value = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
pqScriptUpdate(formContent.value).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
ElMessage.success({ message: res.message })
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
shrink.value = true
|
||||
height.value = '125px'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = async (sign: string,row: any,currentMode: string,id:string) => {
|
||||
const dictCode = '测试脚本字典表'; // 替换为实际需要的字典代码
|
||||
const resDictTree: Dict.ResDictTree = {
|
||||
name: dictCode,
|
||||
const open = async (title: string, row: any) => {
|
||||
dictStore.getDictData("Script_Standard_Name").forEach(item => {
|
||||
standardNameList.push({id: item.id, label: item.name, value: item.value})
|
||||
})
|
||||
|
||||
titleType.value = title
|
||||
if (title == '新增检测脚本') {
|
||||
show.value = false
|
||||
} else {
|
||||
let list = JSON.parse(row)
|
||||
formContent.value = list
|
||||
console.log('🚀 ~ open ~ list:', formContent.value)
|
||||
show.value = true
|
||||
}
|
||||
// 重置表单
|
||||
dialogFormRef.value?.resetFields()
|
||||
}
|
||||
// 获取树字典
|
||||
const treeInfo = async (currentMode: string) => {
|
||||
const data: Dict.ResDictTree = {
|
||||
name: '',
|
||||
id: '',
|
||||
pid: '',
|
||||
pids: '',
|
||||
code: '',
|
||||
code: 'Script_Indicator_Items',
|
||||
sort: 0
|
||||
};
|
||||
const result = await getDictTreeList(resDictTree);
|
||||
//allOptions.value = convertToOptions(result.data as Dict.ResDictTree[]);
|
||||
const allOptions = convertToOptions(result.data as Dict.ResDictTree[]);
|
||||
// 提取第二层节点
|
||||
allOptions.forEach(option => {
|
||||
if (option.children && option.children.length > 0) {
|
||||
secondLevelOptions.push(...option.children);
|
||||
}
|
||||
});
|
||||
|
||||
//console.log('secondLevelOptions',secondLevelOptions);
|
||||
|
||||
if(id != ''){//新增的时候才会重新赋值值类型
|
||||
formContent.value.valueType = id
|
||||
}
|
||||
titleType.value = sign
|
||||
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id;
|
||||
|
||||
|
||||
// 重置表单
|
||||
dialogFormRef.value?.resetFields()
|
||||
dialogVisible.value = true
|
||||
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[])
|
||||
//console.log('🚀 ~ treeInfo ~ result1:', allOptions[0]?.children)
|
||||
const setallTree = await setTree(allOptions[0]?.children, result1)
|
||||
secondLevelOptions.push(...(setallTree || []))
|
||||
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id
|
||||
}
|
||||
|
||||
// 转换函数
|
||||
const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
|
||||
onMounted(() => {
|
||||
let data: any = router.options.history.state
|
||||
if (data.title == null) return
|
||||
nextTick(async () => {
|
||||
await treeInfo(data.mode)
|
||||
await open(data.title, data.row)
|
||||
})
|
||||
})
|
||||
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
|
||||
}));
|
||||
};
|
||||
}))
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
<style lang="scss" scoped>
|
||||
/* .dialog-content {
|
||||
padding: 10px;
|
||||
} */
|
||||
:deep(.cardTop) {
|
||||
.el-card__body {
|
||||
padding: 20px 0 0 20px;
|
||||
}
|
||||
}
|
||||
.formBut {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
}
|
||||
.form-five {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
// justify-content: space-between;
|
||||
.el-form-item {
|
||||
display: flex;
|
||||
width: 18.8%;
|
||||
|
||||
.el-form-item__content {
|
||||
flex: 1;
|
||||
.el-select,
|
||||
.el-cascader,
|
||||
.el-input__inner,
|
||||
.el-date-editor {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -2,99 +2,112 @@
|
||||
<div class="editor-container">
|
||||
<div class="left-editor">
|
||||
<!-- 左侧编辑区域内容 -->
|
||||
<canvas ref="canvas" width="600" height="165"></canvas>
|
||||
<!-- <canvas ref="canvas" width="700" height="165"></canvas> -->
|
||||
<Line :options="chartsData" style="width: 700px; height: 165px" ref="lineRef" />
|
||||
</div>
|
||||
<div class="right-editor">
|
||||
<!-- 右侧编辑区域内容 -->
|
||||
<el-form-item label="电压有效值(V)">
|
||||
<el-input v-model="input1" />
|
||||
<el-form :inline="true" label-width="auto" :model="form" class="form-two">
|
||||
<el-form-item :label="`电压有效值(${valueCode == 'Absolute' ? 'V' : '%'})`">
|
||||
<el-input type="number" v-model="form[0].famp" :disabled="!form[0].channelFlag" />
|
||||
</el-form-item>
|
||||
<el-form-item label="电流有效值(A)">
|
||||
<el-input v-model="input1" />
|
||||
<el-form-item label="电压相角(°)">
|
||||
<el-input type="number" v-model="form[0].fphase" :disabled="!form[0].channelFlag" />
|
||||
</el-form-item>
|
||||
<el-form-item label="相角(°)">
|
||||
<el-input v-model="input2" />
|
||||
<el-form-item :label="`电流有效值(${valueCode == 'Absolute' ? 'A' : '%'})`">
|
||||
<el-input type="number" v-model="form[1].famp" :disabled="!form[1].channelFlag" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="电流相角(°)">
|
||||
<el-input type="number" v-model="form[1].fphase" :disabled="!form[1].channelFlag" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
import Line from '@/components/echarts/line/index.vue'
|
||||
// const emit = defineEmits(['update'])
|
||||
const props = defineProps({
|
||||
childForm: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
valueCode: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const canvas = ref<HTMLCanvasElement | null>(null);
|
||||
const lineRef: any = ref()
|
||||
const chartsData = ref({})
|
||||
// 解构并创建响应式变量
|
||||
const form: any = computed({
|
||||
get() {
|
||||
return props.childForm
|
||||
},
|
||||
set(value) {}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (canvas.value) {
|
||||
const ctx = canvas.value.getContext('2d');
|
||||
if (ctx) {
|
||||
drawSineWave(ctx);
|
||||
drawSineWave()
|
||||
})
|
||||
|
||||
function drawSineWave() {
|
||||
chartsData.value = {
|
||||
tooltip: {
|
||||
show: false
|
||||
},
|
||||
legend: {
|
||||
show: false
|
||||
},
|
||||
grid: {
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: '10px',
|
||||
bottom: '10px'
|
||||
},
|
||||
xAxis: {
|
||||
name: '',
|
||||
|
||||
boundaryGap: false,
|
||||
splitLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
type: 'dashed',
|
||||
color: ['#cfcfcf']
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
name: '',
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
// 使用深浅的间隔色
|
||||
color: ['#ccc'],
|
||||
type: 'solid',
|
||||
opacity: 1
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function drawSineWave(ctx: CanvasRenderingContext2D) {
|
||||
const width = canvas.value!.width;
|
||||
const height = canvas.value!.height;
|
||||
const amplitude = 50; // 振幅
|
||||
const frequency = 0.02; // 频率
|
||||
const offset = height / 2; // 偏移量
|
||||
|
||||
// 绘制横轴
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, offset);
|
||||
ctx.lineTo(width, offset);
|
||||
ctx.strokeStyle = 'black';
|
||||
ctx.stroke();
|
||||
|
||||
// 绘制纵轴
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, 0);
|
||||
ctx.lineTo(0, height);
|
||||
ctx.stroke();
|
||||
|
||||
// 绘制横轴刻度
|
||||
const xStep = width / 10;
|
||||
for (let x = 0; x <= width; x += xStep) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x, offset - 5);
|
||||
ctx.lineTo(x, offset + 5);
|
||||
ctx.stroke();
|
||||
|
||||
// 添加横轴刻度标签
|
||||
ctx.font = '12px Arial';
|
||||
ctx.fillStyle = 'black';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText((x / xStep).toFixed(0), x, offset + 20);
|
||||
},
|
||||
options: {
|
||||
dataZoom: null,
|
||||
series: [
|
||||
{
|
||||
name: '',
|
||||
type: 'line',
|
||||
data: [10, -10, 10, -10, 10, -10, 10, -10, 10, -10, 10],
|
||||
showSymbol: false,
|
||||
smooth: true
|
||||
}
|
||||
|
||||
// 绘制纵轴刻度
|
||||
const yStep = height / 10;
|
||||
for (let y = 0; y <= height; y += yStep) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(-5, y);
|
||||
ctx.lineTo(5, y);
|
||||
ctx.stroke();
|
||||
|
||||
// 添加纵轴刻度标签
|
||||
ctx.font = '12px Arial';
|
||||
ctx.fillStyle = 'black';
|
||||
ctx.textAlign = 'right';
|
||||
ctx.fillText(((offset - y) / yStep - 5).toFixed(1), -10, y + 5);
|
||||
]
|
||||
}
|
||||
|
||||
// 绘制正弦波
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, offset);
|
||||
|
||||
for (let x = 0; x < width; x++) {
|
||||
const y = offset + amplitude * Math.sin(frequency * x);
|
||||
ctx.lineTo(x, y);
|
||||
}
|
||||
|
||||
ctx.strokeStyle = 'red';
|
||||
ctx.lineWidth = 2;
|
||||
ctx.stroke();
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -109,12 +122,13 @@ canvas {
|
||||
}
|
||||
|
||||
.left-editor {
|
||||
flex: 3; /* 左侧区域占据 3/4 的宽度 */
|
||||
margin-left: 150px; /* 可选:添加间距 */
|
||||
flex: 1;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.right-editor {
|
||||
flex: 1; /* 右侧区域占据 1/4 的宽度 */
|
||||
margin-right: 250px; /* 向左侧移动一点 */
|
||||
width: 600px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
106
frontend/src/views/machine/testScript/components/tree.vue
Normal file
106
frontend/src/views/machine/testScript/components/tree.vue
Normal file
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<el-tree
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
:data="props.treeData"
|
||||
:props="defaultProps"
|
||||
style="width: 100%"
|
||||
:expand-on-click-node="false"
|
||||
@node-click="handleNodeClick"
|
||||
>
|
||||
<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 } from 'vue'
|
||||
|
||||
import { CheckData } from '@/api/check/interface'
|
||||
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 handleNodeClick = (data, node) => {
|
||||
console.log('handleNodeClick', data, node)
|
||||
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) {
|
||||
activeName.value = active
|
||||
childActiveName.value = childActive
|
||||
emit('setTab', {
|
||||
activeName: active,
|
||||
childActiveName: childActive
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 返回父级
|
||||
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
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
// // 对外映射
|
||||
// defineExpose({ init })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.custom-tree-node {
|
||||
max-width: 230px;
|
||||
overflow-x: hidden !important;
|
||||
white-space: nowrap !important;
|
||||
text-overflow: ellipsis !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,13 +1,8 @@
|
||||
|
||||
<template>
|
||||
<el-dialog title="请确认检测脚本值类型"
|
||||
v-model='dialogVisible'
|
||||
@close="close"
|
||||
v-bind="dialogSmall"
|
||||
>
|
||||
<div class="dialog-content" >
|
||||
<el-dialog title="请确认检测脚本值类型" v-model="dialogVisible" @close="close" v-bind="dialogSmall">
|
||||
<div class="dialog-content">
|
||||
<el-form>
|
||||
<el-form-item label='值类型'>
|
||||
<el-form-item label="值类型">
|
||||
<el-select v-model="selectedValue" filterable clearable placeholder="请选择值类型">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Script_Value_Type')"
|
||||
@@ -19,60 +14,54 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<TestScriptPopup ref='testScriptPopup' />
|
||||
<TestScriptPopup ref="testScriptPopup" />
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button @click='close()'>取 消</el-button>
|
||||
<el-button type="primary" @click='save()'>新增</el-button>
|
||||
<el-button @click="close()">取 消</el-button>
|
||||
<el-button type="primary" @click="save()">新增</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { dialogSmall } from '@/utils/elementBind'
|
||||
import { ref } from 'vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { type TestScript } from '@/api/device/interface/testScript'
|
||||
|
||||
const mode = ref()
|
||||
const testScriptPopup = ref()
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
const dictStore = useDictStore()
|
||||
const dialogVisible = ref(false)
|
||||
const selectedValue = ref()
|
||||
|
||||
</template>
|
||||
<script setup lang='ts'>
|
||||
import { dialogSmall } from '@/utils/elementBind'
|
||||
import { ref } from 'vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { type TestScript } from '@/api/device/interface/testScript';
|
||||
|
||||
const mode = ref()
|
||||
const testScriptPopup = ref()
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
const dictStore = useDictStore()
|
||||
const dialogVisible = ref(false)
|
||||
const selectedValue = ref()
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
// 重置表单
|
||||
dialogFormRef.value?.resetFields()
|
||||
}
|
||||
}
|
||||
|
||||
// 保存数据
|
||||
const save = () => {
|
||||
testScriptPopup.value?.open('新增检测脚本', {}, mode.value,selectedValue.value)
|
||||
}
|
||||
// 保存数据
|
||||
const save = () => {
|
||||
testScriptPopup.value?.open('新增检测脚本', {}, mode.value, selectedValue.value)
|
||||
}
|
||||
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (sign: string,row: any,currentMode: string) => {
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (sign: string, row: any, currentMode: string) => {
|
||||
mode.value = currentMode
|
||||
// 重置表单
|
||||
dialogFormRef.value?.resetFields()
|
||||
dialogVisible.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
/* .dialog-content {
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style scoped>
|
||||
/* .dialog-content {
|
||||
padding: 10px;
|
||||
} */
|
||||
</style>
|
||||
</style>
|
||||
|
||||
405
frontend/src/views/machine/testScript/components/viewRow.vue
Normal file
405
frontend/src/views/machine/testScript/components/viewRow.vue
Normal file
@@ -0,0 +1,405 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" :title= "titleType" v-bind="dialogBig" @close="close">
|
||||
<!-- <el-descriptions :column="5" border>
|
||||
<el-descriptions-item label="脚本名称">测试</el-descriptions-item>
|
||||
<el-descriptions-item label="参照标准名称">GBT 19862</el-descriptions-item>
|
||||
<el-descriptions-item label="标准推行年份">2025</el-descriptions-item>
|
||||
<el-descriptions-item label="模板类型">模版</el-descriptions-item>
|
||||
<el-descriptions-item label="值类型">相对值</el-descriptions-item>
|
||||
</el-descriptions> -->
|
||||
<!-- tableData?.channelList -->
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane :label="`L${item}`" v-for="item in 3" :key="item" >
|
||||
<div class="tabPane">
|
||||
<el-descriptions :column="4" border>
|
||||
<el-descriptions-item label-align="right" label="电压有效值(%)">
|
||||
{{
|
||||
tableData?.channelList[item * 2 - 2].famp == null
|
||||
? '/'
|
||||
: tableData?.channelList[item * 2 - 2].famp
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="电压相角(°)">
|
||||
{{
|
||||
tableData?.channelList[item * 2 - 2].fphase == null
|
||||
? '/'
|
||||
: tableData?.channelList[item * 2 - 2].fphase
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="电流有效值(%)">
|
||||
{{
|
||||
tableData?.channelList[item * 2 - 1].famp == null
|
||||
? '/'
|
||||
: tableData?.channelList[item * 2 - 1].famp
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="电流相角(°)">
|
||||
{{
|
||||
tableData?.channelList[item * 2 - 1].fphase == null
|
||||
? '/'
|
||||
: tableData?.channelList[item * 2 - 1].fphase
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="变动频度(次/min)">
|
||||
{{ tableData?.channelList[item * 2 - 2].flickerData.fchagFre || '/' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="变动量(%)">
|
||||
{{ tableData?.channelList[item * 2 - 2].flickerData.fchagValue || '/' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="波类型">
|
||||
{{
|
||||
tableData?.channelList[item * 2 - 2].flickerData.fchagValue == ''
|
||||
? '/'
|
||||
: tableData?.channelList[item * 2 - 2].flickerData.waveFluType
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="占空比(%)">
|
||||
{{
|
||||
tableData?.channelList[item * 2 - 2].flickerData.fchagValue == ''
|
||||
? '/'
|
||||
: tableData?.channelList[item * 2 - 2].flickerData.fdutyCycle
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="设定幅度(%)">
|
||||
{{ tableData?.channelList[item * 2 - 2].dipData.ftransValue || '/' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="持续时间(s)">
|
||||
{{ tableData?.channelList[item * 2 - 2].dipData.retainTime || '/' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<!-- <el-descriptions :column="3" title="谐波电压" border class="mt10">
|
||||
<div v-for="k in tableData?.channelList[item * 2 - 2].harmList">
|
||||
<el-descriptions-item label-align="right" label="次数">{{ k.harm }}</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="谐波含有率(%)">{{k.famp}}</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="谐波相角(°)">{{k.fphase}}</el-descriptions-item>
|
||||
</div>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="3" title="谐波电流" border class="mt10">
|
||||
<div v-for="k in tableData?.channelList[item * 2 - 2].harmList">
|
||||
<el-descriptions-item label-align="right" label="次数">{{ k.harm }}</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="谐波含有率(%)">{{k.famp}}</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right" label="谐波相角(°)">{{k.fphase}}</el-descriptions-item>
|
||||
</div>
|
||||
</el-descriptions> -->
|
||||
<div style="display: flex" class="mt10">
|
||||
<el-tabs type="border-card" style="flex: 1" v-if="harmVIsShow">
|
||||
<el-tab-pane label="谐波电压" >
|
||||
<el-table
|
||||
:data="tableData?.channelList[item * 2 - 2].harmList"
|
||||
border
|
||||
size="small"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
height="250px"
|
||||
>
|
||||
<el-table-column prop="harm" label="次数" />
|
||||
<el-table-column prop="famp" label="谐波含有率(%)" />
|
||||
<el-table-column prop="fphase" label="谐波相角(°)" />
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-tabs type="border-card" class="ml10" style="flex: 1" v-if="harmAIsShow">
|
||||
<el-tab-pane label="谐波电流">
|
||||
<el-table
|
||||
:data="tableData?.channelList[item * 2 - 1].harmList"
|
||||
border
|
||||
size="small"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
height="250px"
|
||||
>
|
||||
<el-table-column prop="harm" label="次数" />
|
||||
<el-table-column prop="famp" label="谐波含有率(%)" />
|
||||
<el-table-column prop="fphase" label="谐波相角(°)" />
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div style="display: flex" class="mt10">
|
||||
<el-tabs type="border-card" style="flex: 1" v-if="iHarmVIsShow">
|
||||
<el-tab-pane label="间谐波电压">
|
||||
<el-table
|
||||
:data="tableData?.channelList[item * 2 - 2].inharmList"
|
||||
border
|
||||
size="small"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
height="250px"
|
||||
>
|
||||
<el-table-column prop="inharm" label="次数" />
|
||||
<el-table-column prop="famp" label="间谐波含有率(%)" />
|
||||
<el-table-column prop="fphase" label="间谐波相角(°)" />
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-tabs type="border-card" class="ml10" style="flex: 1" v-if="iHarmAIsShow">
|
||||
<el-tab-pane label="间谐波电流">
|
||||
<el-table
|
||||
:data="tableData?.channelList[item * 2 - 1].inharmList"
|
||||
border
|
||||
size="small"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
height="250px"
|
||||
>
|
||||
<el-table-column prop="inharm" label="次数" />
|
||||
<el-table-column prop="famp" label="间谐波含有率(%)" />
|
||||
<el-table-column prop="fphase" label="间谐波相角(°)" />
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="参考设定值列表" >
|
||||
<div class="tabPane">
|
||||
<el-table
|
||||
:data="setValue_TableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
height="450px"
|
||||
>
|
||||
<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">{{ row.value }}</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>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { dialogBig } from '@/utils/elementBind'
|
||||
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||
import { scriptDtlsCheckDataList } from '@/api/device/testScript/index'
|
||||
import { Dictionary } from 'lodash'
|
||||
import { on } from 'events'
|
||||
const dialogVisible = ref(false)
|
||||
const titleType = ref('')
|
||||
const tableData: any = ref({})
|
||||
const setValue_TableData: any = ref([])
|
||||
const copyRowList = ref({})
|
||||
const harmVIsShow = ref(false)
|
||||
const harmAIsShow = ref(false)
|
||||
const iHarmVIsShow = ref(false)
|
||||
const iHarmAIsShow = ref(false)
|
||||
const emit = defineEmits(['close'])
|
||||
const props = defineProps({
|
||||
|
||||
activeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
|
||||
formContent: {
|
||||
type: [Object, Array],
|
||||
required: true
|
||||
},
|
||||
|
||||
})
|
||||
// 表格配置项
|
||||
const typeList = [
|
||||
{
|
||||
label: '实时',
|
||||
value: 'real'
|
||||
},
|
||||
{
|
||||
label: 'CP95值',
|
||||
value: 'cp95'
|
||||
},
|
||||
{
|
||||
label: '平均值',
|
||||
value: 'avg'
|
||||
},
|
||||
{
|
||||
label: '最小值',
|
||||
value: 'min'
|
||||
},
|
||||
{
|
||||
label: '最大值',
|
||||
value: 'max'
|
||||
}
|
||||
]
|
||||
|
||||
const tabVisibilityMap: { [key: string]: { harmVIsShow: boolean, harmAIsShow: boolean, iHarmVIsShow: boolean, iHarmAIsShow: boolean } } = {
|
||||
'谐波电压': { harmVIsShow: true, harmAIsShow: false, iHarmVIsShow: false, iHarmAIsShow: false },
|
||||
'谐波电流': { harmVIsShow: false, harmAIsShow: true, iHarmVIsShow: false, iHarmAIsShow: false },
|
||||
'间谐波电压': { harmVIsShow: false, harmAIsShow: false, iHarmVIsShow: true, iHarmAIsShow: false },
|
||||
'间谐波电流': { harmVIsShow: false, harmAIsShow: false, iHarmVIsShow: false, iHarmAIsShow: true },
|
||||
'谐波有功功率': { harmVIsShow: true, harmAIsShow: true, iHarmVIsShow: false, iHarmAIsShow: false },
|
||||
};
|
||||
const open = async (row: any,communicationList:any,parentTabName:string,childrenTabName:string) => {
|
||||
|
||||
console.log('🚀 ~ open ~ parentTabName:', parentTabName)
|
||||
//对应表格显示隐藏
|
||||
const visibilitySettings = tabVisibilityMap[parentTabName] || { harmVIsShow: false, harmAIsShow: false, iHarmVIsShow: false, iHarmAIsShow: false };
|
||||
harmVIsShow.value = visibilitySettings.harmVIsShow;
|
||||
harmAIsShow.value = visibilitySettings.harmAIsShow;
|
||||
iHarmVIsShow.value = visibilitySettings.iHarmVIsShow;
|
||||
iHarmAIsShow.value = visibilitySettings.iHarmAIsShow;
|
||||
|
||||
titleType.value = parentTabName + '_' + childrenTabName+ '_详情'
|
||||
//console.log('🚀 ~ open ~ row:', row)
|
||||
tableData.value = row
|
||||
copyRowList.value = JSON.parse(JSON.stringify(row))
|
||||
|
||||
|
||||
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 communicationList.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(row)))
|
||||
let retryCompute = isEqual(form, copyRowList)
|
||||
|
||||
|
||||
console.log('🚀 ~ open ~ 1:', form)
|
||||
console.log('🚀 ~ open ~ 2:', props.formContent?.id)
|
||||
console.log('🚀 ~ open ~ 3:', props.activeName)
|
||||
console.log('🚀 ~ open ~ 4:', checkDataList)
|
||||
console.log('🚀 ~ open ~ 5:', retryCompute)
|
||||
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
|
||||
})
|
||||
setValue_TableData.value = res.data
|
||||
console.log('🚀 ~ open ~ res.data:', res.data)
|
||||
})
|
||||
dialogVisible.value = true
|
||||
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
emit('close')
|
||||
}
|
||||
|
||||
// 处理多余数据
|
||||
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
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-descriptions__cell) {
|
||||
width: 12.5%;
|
||||
}
|
||||
:deep(.tabPane) {
|
||||
height: 450px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user