Compare commits
166 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7cfcc7855 | ||
|
|
05948aebf5 | ||
|
|
cca214aaf7 | ||
|
|
0111954c5e | ||
|
|
ce31499964 | ||
|
|
059864d193 | ||
|
|
6d2fb4dde8 | ||
|
|
49059d9c59 | ||
|
|
d2f7041988 | ||
|
|
f94372d20b | ||
|
|
9af98b034f | ||
|
|
341b8df5a9 | ||
|
|
7470f697bd | ||
|
|
c058b99a0d | ||
|
|
d5eed13f38 | ||
|
|
c27ee88182 | ||
|
|
e2559ffa65 | ||
|
|
a0bd32453c | ||
|
|
54e7a91841 | ||
|
|
042f6eef51 | ||
| c9857326c6 | |||
| 9c4e0094f9 | |||
| 781b27af51 | |||
|
|
37e257afc8 | ||
| 4d4fdd6190 | |||
|
|
0fd2d8252d | ||
|
|
3cf5019880 | ||
|
|
258d3d692f | ||
|
|
667ed3bcc0 | ||
|
|
a882189022 | ||
|
|
686e009243 | ||
|
|
30d5f3390c | ||
|
|
3398b414ca | ||
|
|
b6a2c42feb | ||
|
|
cb5a9050f2 | ||
|
|
661b27abd0 | ||
|
|
59a24c9ea2 | ||
|
|
6cf5da5d48 | ||
|
|
537f5e2f4c | ||
|
|
70531a0729 | ||
|
|
ded15e5c8b | ||
|
|
3021f7e4d3 | ||
|
|
876d9cfa00 | ||
|
|
8f28825162 | ||
|
|
0e6612f6bd | ||
|
|
39183fde5d | ||
|
|
b967419cb1 | ||
|
|
0712698638 | ||
|
|
d3a74e830f | ||
|
|
f68da773ab | ||
|
|
8db814dba4 | ||
|
|
7dcff99de5 | ||
|
|
97100dfa63 | ||
|
|
d41707fcf9 | ||
|
|
2377916f29 | ||
|
|
be2f40715a | ||
|
|
489c0882ac | ||
|
|
492db88b45 | ||
|
|
3b198eb4ed | ||
|
|
5efc27d4b6 | ||
|
|
ec9f270d04 | ||
|
|
afd2d467f3 | ||
|
|
ff0798450d | ||
|
|
fbefc70368 | ||
|
|
faa0bc54a6 | ||
|
|
bf5f4eab77 | ||
| 188456c970 | |||
|
|
c06334e96f | ||
| 82e8bf2e0b | |||
| 30382fb34d | |||
| c7e5ee0862 | |||
|
|
d6ac63586b | ||
|
|
e0fd42199f | ||
|
|
d9e3168484 | ||
|
|
dc7e91ca66 | ||
|
|
692358d278 | ||
| 3750031d6b | |||
| 0bae200241 | |||
|
|
61bd1a0d6a | ||
|
|
37cf3dfdd7 | ||
|
|
8be96ca64e | ||
|
|
d225391248 | ||
|
|
f2fd0b078e | ||
|
|
f71963ea3b | ||
|
|
6a635246bb | ||
|
|
d338ca6b25 | ||
|
|
193c3b963c | ||
|
|
cad4965b1b | ||
|
|
79306d846f | ||
|
|
f4ea510c5d | ||
|
|
07cc26fa8d | ||
|
|
f87e268242 | ||
|
|
1aeceffe0b | ||
|
|
fc97087767 | ||
|
|
61be97b04b | ||
|
|
934162875c | ||
|
|
4b3991099a | ||
|
|
b14a961c1a | ||
|
|
cbe41d80ce | ||
|
|
28203f2621 | ||
|
|
b8492dfbe6 | ||
|
|
15faac8079 | ||
|
|
ad850ca4ee | ||
|
|
6c05c6e06e | ||
|
|
8b2cda80b1 | ||
|
|
3f7756b417 | ||
|
|
5004e319b6 | ||
|
|
19035f2dc9 | ||
|
|
9d8a5c76b2 | ||
|
|
6300eb2f43 | ||
|
|
da58ffb621 | ||
|
|
1500fafb92 | ||
|
|
df53eea432 | ||
|
|
cc1771c208 | ||
|
|
5e881c0804 | ||
|
|
5666e01ae0 | ||
|
|
4acec8a2d6 | ||
|
|
426a511099 | ||
|
|
89303b44ae | ||
|
|
ffb82066bb | ||
|
|
f46b8c0a56 | ||
|
|
280289af37 | ||
| a0c7f79302 | |||
| bd1eecc106 | |||
|
|
1a23bcb510 | ||
|
|
942c28d3bd | ||
| 034b31ba47 | |||
|
|
7a76c2da8a | ||
|
|
1a9d8e8606 | ||
| 14583d919d | |||
|
|
629fd174e4 | ||
|
|
9080fe06a4 | ||
|
|
0e183bb5c1 | ||
| 8caf856d2d | |||
|
|
d28669e6b0 | ||
| 700884d01a | |||
| c06bd9fa24 | |||
| ce92a1d645 | |||
|
|
4f622da52c | ||
| 7d3e86a5fc | |||
|
|
c66d181b98 | ||
| f860630bfb | |||
|
|
6db4d79839 | ||
| e2924d5e57 | |||
| 92b9a82f21 | |||
|
|
c3f89ca1f8 | ||
|
|
8c435c91dd | ||
|
|
6e6cfa5be0 | ||
|
|
ea203d0ccc | ||
|
|
370cd52774 | ||
|
|
942bae3045 | ||
|
|
356548c8fb | ||
| 5c012c2bc9 | |||
| 9c9b8015a0 | |||
| bba0ced7f9 | |||
|
|
e8de7b56d9 | ||
|
|
95022f62a8 | ||
|
|
1d918f3335 | ||
|
|
f992637ad2 | ||
|
|
40f18bbdf8 | ||
|
|
3bb9cec08a | ||
|
|
6842260f59 | ||
|
|
305c30d725 | ||
|
|
e799dd2f08 | ||
| 1e83172e9a | |||
|
|
475d236b7e |
@@ -1,112 +0,0 @@
|
|||||||
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from "axios";
|
|
||||||
import { showFullScreenLoading, tryHideFullScreenLoading } from "@/components/Loading/fullScreen";
|
|
||||||
import { LOGIN_URL } from "@/config";
|
|
||||||
import { ElMessage } from "element-plus";
|
|
||||||
import { ResultData } from "@/api/interface";
|
|
||||||
import { ResultEnum } from "@/enums/httpEnum";
|
|
||||||
import { checkStatus } from "./helper/checkStatus";
|
|
||||||
import { useUserStore } from "@/stores/modules/user";
|
|
||||||
import router from "@/routers";
|
|
||||||
|
|
||||||
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
|
|
||||||
loading?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const config = {
|
|
||||||
// 默认地址请求地址,可在 .env.** 文件中修改
|
|
||||||
baseURL: import.meta.env.VITE_API_URL as string,
|
|
||||||
// 设置超时时间
|
|
||||||
timeout: ResultEnum.TIMEOUT as number,
|
|
||||||
// 跨域时候允许携带凭证
|
|
||||||
withCredentials: true,
|
|
||||||
// post请求指定数据类型以及编码
|
|
||||||
headers: { 'Content-Type': 'application/json;charset=utf-8' }
|
|
||||||
};
|
|
||||||
|
|
||||||
class RequestHttp {
|
|
||||||
service: AxiosInstance;
|
|
||||||
public constructor(config: AxiosRequestConfig) {
|
|
||||||
// 创建实例
|
|
||||||
this.service = axios.create(config);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 请求拦截器
|
|
||||||
* 客户端发送请求 -> [请求拦截器] -> 服务器
|
|
||||||
* token校验(JWT) : 接受服务器返回的 token,存储到 vuex/pinia/本地储存当中
|
|
||||||
*/
|
|
||||||
this.service.interceptors.request.use(
|
|
||||||
(config: CustomAxiosRequestConfig) => {
|
|
||||||
const userStore = useUserStore();
|
|
||||||
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制
|
|
||||||
config.loading ?? (config.loading = true);
|
|
||||||
config.loading && showFullScreenLoading();
|
|
||||||
if (config.headers && typeof config.headers.set === "function") {
|
|
||||||
config.headers.set("x-access-token", userStore.token);
|
|
||||||
}
|
|
||||||
return config;
|
|
||||||
},
|
|
||||||
(error: AxiosError) => {
|
|
||||||
return Promise.reject(error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 响应拦截器
|
|
||||||
* 服务器换返回信息 -> [拦截统一处理] -> 客户端JS获取到信息
|
|
||||||
*/
|
|
||||||
this.service.interceptors.response.use(
|
|
||||||
(response: AxiosResponse) => {
|
|
||||||
const { data } = response;
|
|
||||||
const userStore = useUserStore();
|
|
||||||
tryHideFullScreenLoading();
|
|
||||||
// 登陆失效
|
|
||||||
if (data.code == ResultEnum.OVERDUE) {
|
|
||||||
userStore.setToken("");
|
|
||||||
router.replace(LOGIN_URL);
|
|
||||||
ElMessage.error(data.message);
|
|
||||||
return Promise.reject(data);
|
|
||||||
}
|
|
||||||
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
|
||||||
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
|
||||||
ElMessage.error(data.message);
|
|
||||||
return Promise.reject(data);
|
|
||||||
}
|
|
||||||
// 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑)
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
async (error: AxiosError) => {
|
|
||||||
const { response } = error;
|
|
||||||
tryHideFullScreenLoading();
|
|
||||||
// 请求超时 && 网络错误单独判断,没有 response
|
|
||||||
if (error.message.indexOf("timeout") !== -1) ElMessage.error("请求超时!请您稍后重试");
|
|
||||||
if (error.message.indexOf("Network Error") !== -1) ElMessage.error("网络错误!请您稍后重试");
|
|
||||||
// 根据服务器响应的错误状态码,做不同的处理
|
|
||||||
if (response) checkStatus(response.status);
|
|
||||||
// 服务器结果都没有返回(可能服务器错误可能客户端断网),断网处理:可以跳转到断网页面
|
|
||||||
if (!window.navigator.onLine) router.replace("/500");
|
|
||||||
return Promise.reject(error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 常用请求方法封装
|
|
||||||
*/
|
|
||||||
get<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
|
||||||
return this.service.get(url, { params, ..._object });
|
|
||||||
}
|
|
||||||
post<T>(url: string, params?: object | string, _object = {}): Promise<ResultData<T>> {
|
|
||||||
return this.service.post(url, params, _object);
|
|
||||||
}
|
|
||||||
put<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
|
||||||
return this.service.put(url, params, _object);
|
|
||||||
}
|
|
||||||
delete<T>(url: string, params?: any, _object = {}): Promise<ResultData<T>> {
|
|
||||||
return this.service.delete(url, { params, ..._object });
|
|
||||||
}
|
|
||||||
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
|
||||||
return this.service.post(url, params, { ..._object, responseType: "blob" });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default new RequestHttp(config);
|
|
||||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
|
"Analyse",
|
||||||
"CHNFACTOR",
|
"CHNFACTOR",
|
||||||
"CHNPACTOR",
|
"CHNPACTOR",
|
||||||
"Chns",
|
"Chns",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ VITE_API_URL=/api
|
|||||||
|
|
||||||
# 开发环境跨域代理,支持配置多个
|
# 开发环境跨域代理,支持配置多个
|
||||||
|
|
||||||
|
#VITE_PROXY=[["/api","http://127.0.0.1:18092/"]]
|
||||||
VITE_PROXY=[["/api","http://192.168.1.124:18092/"]]
|
VITE_PROXY=[["/api","http://192.168.1.124:18092/"]]
|
||||||
#VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
#VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
||||||
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文
|
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文
|
||||||
|
|||||||
@@ -22,4 +22,5 @@ VITE_DROP_CONSOLE=true
|
|||||||
VITE_PWA=true
|
VITE_PWA=true
|
||||||
|
|
||||||
# 线上环境接口地址
|
# 线上环境接口地址
|
||||||
|
#VITE_API_URL="/api" # 打包时用
|
||||||
VITE_API_URL="http://192.168.1.125:18092/"
|
VITE_API_URL="http://192.168.1.125:18092/"
|
||||||
|
|||||||
11
frontend/.prettierrc
Normal file
11
frontend/.prettierrc
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"tabWidth": 4,
|
||||||
|
"printWidth": 120,
|
||||||
|
"useTabs": false,
|
||||||
|
"semi": false,
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"endOfLine": "lf",
|
||||||
|
"htmlWhitespaceSensitivity": "ignore"
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
"echarts": "^5.4.3",
|
"echarts": "^5.4.3",
|
||||||
"echarts-liquidfill": "^3.1.0",
|
"echarts-liquidfill": "^3.1.0",
|
||||||
"element-plus": "^2.7.8",
|
"element-plus": "^2.7.8",
|
||||||
|
"html2canvas": "^1.4.1",
|
||||||
"md5": "^2.3.0",
|
"md5": "^2.3.0",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
"mkdirp": "^3.0.1",
|
"mkdirp": "^3.0.1",
|
||||||
@@ -41,11 +42,13 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rushstack/eslint-patch": "^1.8.0",
|
"@rushstack/eslint-patch": "^1.8.0",
|
||||||
"@tsconfig/node20": "^20.1.4",
|
"@tsconfig/node20": "^20.1.4",
|
||||||
|
"@types/html2canvas": "^1.0.0",
|
||||||
"@types/md5": "^2.3.2",
|
"@types/md5": "^2.3.2",
|
||||||
"@types/node": "^20.14.14",
|
"@types/node": "^20.14.14",
|
||||||
"@types/nprogress": "^0.2.0",
|
"@types/nprogress": "^0.2.0",
|
||||||
"@types/qs": "^6.9.8",
|
"@types/qs": "^6.9.8",
|
||||||
"@types/sortablejs": "^1.15.2",
|
"@types/sortablejs": "^1.15.2",
|
||||||
|
"@types/xlsx": "^0.0.36",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
||||||
"@typescript-eslint/parser": "^6.7.0",
|
"@typescript-eslint/parser": "^6.7.0",
|
||||||
"@vitejs/plugin-vue": "^5.0.5",
|
"@vitejs/plugin-vue": "^5.0.5",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export namespace CheckData {
|
export namespace CheckData {
|
||||||
export interface DataCheck {
|
export interface DataCheck {
|
||||||
scriptName: string,
|
scriptName: string,
|
||||||
errorSysName: string,
|
errorSysId: string,
|
||||||
dataRule: string,
|
dataRule: string,
|
||||||
deviceName: string,
|
deviceName: string,
|
||||||
chnNum: string,
|
chnNum: string,
|
||||||
@@ -90,6 +90,12 @@ export namespace CheckData {
|
|||||||
deviceId: string; //装置序号Id
|
deviceId: string; //装置序号Id
|
||||||
deviceName: string; //设备名称
|
deviceName: string; //设备名称
|
||||||
chnNum: number; //设备通道数
|
chnNum: number; //设备通道数
|
||||||
|
|
||||||
|
planId: string; //计划Id
|
||||||
|
devType: string; //设备类型
|
||||||
|
devVolt:number; //设备电压
|
||||||
|
devCurr:number; //设备电流
|
||||||
|
factorFlag:number; //是否支持系数校准
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用来描述检测脚本类型
|
// 用来描述检测脚本类型
|
||||||
@@ -101,6 +107,7 @@ export namespace CheckData {
|
|||||||
|
|
||||||
// 用来描述 检测数据-左侧树结构
|
// 用来描述 检测数据-左侧树结构
|
||||||
export interface TreeItem {
|
export interface TreeItem {
|
||||||
|
id:string | null,
|
||||||
scriptTypeName: string | null,
|
scriptTypeName: string | null,
|
||||||
sourceDesc: string | null,
|
sourceDesc: string | null,
|
||||||
harmNum: number | null,
|
harmNum: number | null,
|
||||||
@@ -173,6 +180,16 @@ export namespace CheckData {
|
|||||||
type: 'info' | 'warning' | 'error'
|
type: 'info' | 'warning' | 'error'
|
||||||
log: string
|
log: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义手动检测时,勾选的测试项
|
||||||
|
*/
|
||||||
|
export interface SelectTestItem {
|
||||||
|
preTest: boolean,
|
||||||
|
timeTest: boolean,
|
||||||
|
channelsTest: boolean,
|
||||||
|
test: boolean
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import http from "@/api";
|
import http from "@/api";
|
||||||
import {CheckData} from "@/api/check/interface";
|
import {CheckData} from "@/api/check/interface";
|
||||||
|
|
||||||
export const getBigTestItem = (planId: string) => {
|
export const getBigTestItem = (params: {
|
||||||
return http.get(`/adPlan/getBigTestItem?planId=${planId}`, {loading: false});
|
reCheckType:number,
|
||||||
|
planId: string,
|
||||||
|
devId: string,
|
||||||
|
}) => {
|
||||||
|
return http.post(`/adPlan/getBigTestItem`, params, {loading: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,11 +27,11 @@ export const getFormData = (params: {
|
|||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const getTreeData = (params: {
|
export const getTreeData = (params: {
|
||||||
scriptId: string,
|
scriptId?: string,
|
||||||
devId: string,
|
devId?: string,
|
||||||
devNum: string,
|
devNum?: string,
|
||||||
scriptType: string | null,
|
scriptType?: string | null,
|
||||||
code: number,
|
code?: number,
|
||||||
}) => {
|
}) => {
|
||||||
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true});
|
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true});
|
||||||
}
|
}
|
||||||
|
|||||||
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})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,11 +23,12 @@ export namespace TestScript {
|
|||||||
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||||
standardName: string;//参照标准名称
|
standardName: string;//参照标准名称
|
||||||
standardTime: string;//标准推行时间
|
standardTime: string;//标准推行时间
|
||||||
state:number;//
|
state?:number;//
|
||||||
createBy?: string;
|
createBy?: string;
|
||||||
createTime?: string;
|
createTime?: string;
|
||||||
updateBy?: string;
|
updateBy?: string;
|
||||||
updateTime?: string;
|
updateTime?: string;
|
||||||
|
selectedValue?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,15 +1,23 @@
|
|||||||
import type { TestScript } from '@/api/device/interface/testScript'
|
import type { TestScript } from '@/api/device/interface/testScript'
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
|
import { Loading } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name 检测脚本管理模块
|
* @name 检测脚本管理模块
|
||||||
*/
|
*/
|
||||||
|
// 新增脚本
|
||||||
|
export const pqScriptAdd = (params: TestScript.ResTestScript) => {
|
||||||
|
return http.post(`/pqScript/add`, params)
|
||||||
|
}
|
||||||
|
// 修改脚本
|
||||||
|
export const pqScriptUpdate = (params: TestScript.ResTestScript) => {
|
||||||
|
return http.post(`/pqScript/update`, params)
|
||||||
|
}
|
||||||
// 获取检测脚本列表
|
// 获取检测脚本列表
|
||||||
export const getPqScriptList = (params: TestScript.ReqTestScriptParams) => {
|
export const getPqScriptList = (params: TestScript.ReqTestScriptParams) => {
|
||||||
return http.post(`/pqScript/list`, params)
|
return http.post(`/pqScript/list`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//升级为模版
|
//升级为模版
|
||||||
export const updatePqScript = (params: TestScript.ResTestScript) => {
|
export const updatePqScript = (params: TestScript.ResTestScript) => {
|
||||||
return http.get(`/pqScript/upgradeToTemplate?id=${params.id}`)
|
return http.get(`/pqScript/upgradeToTemplate?id=${params.id}`)
|
||||||
@@ -19,3 +27,27 @@ export const updatePqScript = (params: TestScript.ResTestScript) => {
|
|||||||
export const deletePqScript = (params: string[]) => {
|
export const deletePqScript = (params: string[]) => {
|
||||||
return http.post(`/pqScript/delete`, params)
|
return http.post(`/pqScript/delete`, params)
|
||||||
}
|
}
|
||||||
|
//添加检测脚本
|
||||||
|
export const addScriptDtls = (params: any) => {
|
||||||
|
return http.post(`/pqScript/addScriptDtls`, params)
|
||||||
|
}
|
||||||
|
//根据脚本id查询检测脚本详情
|
||||||
|
export const dlsDetails = (params: any) => {
|
||||||
|
return http.post(`/pqScript/dlsDetails`, params)
|
||||||
|
}
|
||||||
|
// 删除脚本
|
||||||
|
export const deleteDtls = (params: any) => {
|
||||||
|
return http.post(`/pqScript/deleteDtls`, params)
|
||||||
|
}
|
||||||
|
// 启用关闭脚本
|
||||||
|
export const updateDtls = (params: any) => {
|
||||||
|
return http.post(`/pqScript/updateDtls`, params)
|
||||||
|
}
|
||||||
|
// 根据通讯参数生成装置下发原始数据公式
|
||||||
|
export const scriptDtlsCheckDataList = (params: any) => {
|
||||||
|
return http.post(`/pqScript/scriptDtlsCheckDataList`, params,{loading: false})
|
||||||
|
}
|
||||||
|
// 通讯脚本回显
|
||||||
|
export const checkDataList = (params: any) => {
|
||||||
|
return http.post(`/pqScript/checkDataList`, params, { loading: true })
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ import http from "@/api";
|
|||||||
|
|
||||||
//系数校准发送基本信息
|
//系数校准发送基本信息
|
||||||
export const getCoefficientCheck = (params: any) => {
|
export const getCoefficientCheck = (params: any) => {
|
||||||
return http.post(`/prepare/coefficientCheck`, params)
|
return http.post(`/prepare/coefficientCheck`, params,{loading: false})
|
||||||
}
|
}
|
||||||
@@ -39,13 +39,14 @@ class RequestHttp {
|
|||||||
*/
|
*/
|
||||||
this.service.interceptors.request.use(
|
this.service.interceptors.request.use(
|
||||||
(config: CustomAxiosRequestConfig) => {
|
(config: CustomAxiosRequestConfig) => {
|
||||||
|
isFirst = true
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制
|
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制
|
||||||
config.loading ?? (config.loading = true)
|
config.loading ?? (config.loading = true)
|
||||||
config.loading && showFullScreenLoading()
|
config.loading && showFullScreenLoading()
|
||||||
if (config.headers && typeof config.headers.set === 'function') {
|
if (config.headers && typeof config.headers.set === 'function') {
|
||||||
config.headers.set('Authorization', 'Bearer ' + userStore.accessToken)
|
config.headers.set('Authorization', 'Bearer ' + userStore.accessToken)
|
||||||
config.headers.set('Refresh-Token', userStore.refreshToken)
|
config.headers.set('Is-Refresh-Token', userStore.isRefreshToken+"")
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
@@ -67,11 +68,14 @@ class RequestHttp {
|
|||||||
|
|
||||||
if(data.code === ResultEnum.ACCESSTOKEN_EXPIRED){
|
if(data.code === ResultEnum.ACCESSTOKEN_EXPIRED){
|
||||||
// 用长token去换短token
|
// 用长token去换短token
|
||||||
|
userStore.setAccessToken(userStore.refreshToken)
|
||||||
|
userStore.setIsRefreshToken(true)
|
||||||
const result = await refreshToken()
|
const result = await refreshToken()
|
||||||
if (result) { //获取新token成功的话
|
if (result) { //获取新token成功的话
|
||||||
// 有新的token后,重新请求
|
// 有新的token后,重新请求
|
||||||
userStore.setAccessToken(result.data.accessToken)
|
userStore.setAccessToken(result.data.accessToken)
|
||||||
userStore.setRefreshToken(result.data.refreshToken)
|
userStore.setRefreshToken(result.data.refreshToken)
|
||||||
|
userStore.setIsRefreshToken(false)
|
||||||
response.config.headers.Authorization = `Bearer ${result.data.accessToken}`//重新请求前需要将更新后的新token更换掉之前无效的token,不然会死循环
|
response.config.headers.Authorization = `Bearer ${result.data.accessToken}`//重新请求前需要将更新后的新token更换掉之前无效的token,不然会死循环
|
||||||
const resp = await this.service.request(response.config)
|
const resp = await this.service.request(response.config)
|
||||||
return resp
|
return resp
|
||||||
@@ -84,11 +88,10 @@ class RequestHttp {
|
|||||||
console.log("登陆失效")
|
console.log("登陆失效")
|
||||||
userStore.setAccessToken('')
|
userStore.setAccessToken('')
|
||||||
userStore.setRefreshToken('')
|
userStore.setRefreshToken('')
|
||||||
|
userStore.setIsRefreshToken(false)
|
||||||
userStore.setUserInfo({ name: '' })
|
userStore.setUserInfo({ name: '' })
|
||||||
router.replace(LOGIN_URL)
|
await router.replace(LOGIN_URL)
|
||||||
if(data.code != ResultEnum.OVERDUE){//临时处理token失效弹窗多次
|
if(isFirst){//临时处理token失效弹窗多次
|
||||||
ElMessage.error(data.message)
|
|
||||||
}else if(isFirst){
|
|
||||||
ElMessage.error(data.message)
|
ElMessage.error(data.message)
|
||||||
isFirst = false
|
isFirst = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export namespace Plan {
|
|||||||
export interface ResPlan {
|
export interface ResPlan {
|
||||||
id: string; //检测计划ID
|
id: string; //检测计划ID
|
||||||
name: string; //检测计划名称
|
name: string; //检测计划名称
|
||||||
pattern: string; //模式,字典表(数字、模拟、比对)
|
pattern?: string; //模式,字典表(数字、模拟、比对)
|
||||||
fatherPlanId?: string; //父计划ID
|
fatherPlanId?: string; //父计划ID
|
||||||
dataSourceId: string; //数据源ID
|
dataSourceId: string; //数据源ID
|
||||||
scriptId: string; //检测脚本ID
|
scriptId: string; //检测脚本ID
|
||||||
|
|||||||
@@ -63,17 +63,17 @@ export const getPlanListByPattern = (params: Plan.ReqPlan) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 导出检测计划
|
// 导出检测计划
|
||||||
export const exportPlan = (params: Device.ReqPqDevParams) => {
|
export const exportCNPlan = (params: Device.ReqPqDevParams) => {
|
||||||
return http.download(`/adPlan/export`, params)
|
return http.download(`/adPlan/exportCNPlan`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下载模板
|
// 下载模板
|
||||||
export const downloadTemplate = () => {
|
export const downloadCNPlanTemplate = () => {
|
||||||
return http.download(`/adPlan/downloadTemplate`)
|
return http.download(`/adPlan/downloadCNPlanTemplate`)
|
||||||
}
|
}
|
||||||
// 导入检测计划
|
// 导入检测计划
|
||||||
export const importPlan = (params: Device.ReqPqDevParams) => {
|
export const importCNPlan = (params: Device.ReqPqDevParams) => {
|
||||||
return http.upload(`/adPlan/import`, params)
|
return http.uploadExcel(`/adPlan/importCNPlan`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 装置检测报告生成
|
// 装置检测报告生成
|
||||||
@@ -85,3 +85,8 @@ export const generateDevReport = (params: Device.ReqDevReportParams) => {
|
|||||||
export const downloadDevData = (params: Device.ReqDevReportParams) => {
|
export const downloadDevData = (params: Device.ReqDevReportParams) => {
|
||||||
return http.download(`/report/downloadReport`, params)
|
return http.download(`/report/downloadReport`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const staticsAnalyse = (params: { id: string[] }) => {
|
||||||
|
return http.download('/adPlan/analyse', params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
import { type Dict } from '@/api/system/dictionary/interface'
|
import { type Dict } from '@/api/system/dictionary/interface'
|
||||||
|
import { c } from 'vite/dist/node/types.d-aGj9QkWt'
|
||||||
|
|
||||||
//获取字典类型
|
//获取字典类型
|
||||||
export const getDictTreeList = (params: Dict.ResDictTree) => {
|
export const getDictTreeByCode = (params: Dict.ResDictTree) => {
|
||||||
const name = params.name || '';
|
const code = params.code || ''
|
||||||
return http.get(`/dictTree/getTree?keyword=${name}`, params)
|
return http.get(`/dictTree/getTreeByCode?code=${code}`, { loading: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getDictTreeByName = (params: Dict.ResDictTree) => {
|
||||||
|
const name = params.name || ''
|
||||||
|
return http.get(`/dictTree/getTreeByName?name=${name}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
//添加字典类型
|
//添加字典类型
|
||||||
@@ -21,4 +27,3 @@ export const updateDictTree = (params: Dict.ResDictTree) => {
|
|||||||
export const deleteDictTree = (params: Dict.ResDictTree) => {
|
export const deleteDictTree = (params: Dict.ResDictTree) => {
|
||||||
return http.post(`/dictTree/delete?id=${params.id}`)
|
return http.post(`/dictTree/delete?id=${params.id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import type {AuditLog } from '@/api/system/log/interface/log.ts'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 审计日志管理模块
|
||||||
|
*/
|
||||||
|
|
||||||
|
//获取审计日志
|
||||||
|
export const getAuditLog = (params: AuditLog.ReqAuditLogParams) => {
|
||||||
|
return http.post(`/sysLog/list`, params)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,15 +1,36 @@
|
|||||||
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
// 审计日志管理模块
|
// 审计日志管理模块
|
||||||
export namespace Sys_Log_Audit {
|
export namespace AuditLog {
|
||||||
// 日志列表
|
|
||||||
export interface Audit_LogList {
|
/**
|
||||||
id: string;//日志表Id
|
* 设备类型数据表格分页查询参数
|
||||||
operate_Type:string;//日志类型
|
*/
|
||||||
|
export interface ReqAuditLogParams extends ReqPage {
|
||||||
|
id: string; //审计日志Id 必填
|
||||||
|
createTime?: string; //创建时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResAuditLog {
|
||||||
|
id: string;//审计日志Id
|
||||||
|
operate_Type:string;//操作类型
|
||||||
ip:string;//操作IP
|
ip:string;//操作IP
|
||||||
result: string;//事件结果
|
result: string;//事件结果
|
||||||
remark: string;//事件描述
|
remark: string;//事件描述
|
||||||
|
level:number;//告警等级
|
||||||
warn:number;//告警标志
|
warn:number;//告警标志
|
||||||
create_By:string;//创建用户
|
create_By:string;//创建用户
|
||||||
create_Time:string;//创建时间
|
create_Time:string;//创建时间
|
||||||
|
sort:number;//排序
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResAuditLogPage extends ResPage<ResAuditLog> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
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) {
|
async function handleImportResponse(res: any) {
|
||||||
|
console.log(res)
|
||||||
|
|
||||||
if (res.type === 'application/json') {
|
if (res.type === 'application/json') {
|
||||||
const fileReader = new FileReader()
|
const fileReader = new FileReader()
|
||||||
fileReader.onloadend = () => {
|
fileReader.onloadend = () => {
|
||||||
@@ -118,7 +120,7 @@ async function handleImportResponse(res: any) {
|
|||||||
const url = window.URL.createObjectURL(blob)
|
const url = window.URL.createObjectURL(blob)
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
link.href = url
|
link.href = url
|
||||||
link.download = '终端入网检测失败列表'
|
link.download = '导入失败数据'
|
||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click()
|
link.click()
|
||||||
link.remove()
|
link.remove()
|
||||||
|
|||||||
282
frontend/src/components/echarts/line/index.vue
Normal file
282
frontend/src/components/echarts/line/index.vue
Normal file
@@ -0,0 +1,282 @@
|
|||||||
|
<template>
|
||||||
|
<div class="chart">
|
||||||
|
<div ref="chartRef" class="my-chart" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onBeforeUnmount, onMounted, ref, defineExpose, watch, nextTick } from 'vue'
|
||||||
|
// import echarts from './echarts'
|
||||||
|
import * as echarts from 'echarts' // 全引入
|
||||||
|
// import 'echarts/lib/component/dataZoom'
|
||||||
|
|
||||||
|
const color = [
|
||||||
|
'var(--el-color-primary)',
|
||||||
|
'#07CCCA',
|
||||||
|
'#00BFF5',
|
||||||
|
'#FFBF00',
|
||||||
|
'#77DA63',
|
||||||
|
'#D5FF6B',
|
||||||
|
'#Ff6600',
|
||||||
|
'#FF9100',
|
||||||
|
'#5B6E96',
|
||||||
|
'#66FFCC',
|
||||||
|
'#B3B3B3'
|
||||||
|
]
|
||||||
|
|
||||||
|
const chartRef = ref<HTMLDivElement>()
|
||||||
|
|
||||||
|
const props = defineProps(['options', 'isInterVal', 'pieInterVal'])
|
||||||
|
let chart: echarts.ECharts | any = null
|
||||||
|
const resizeHandler = () => {
|
||||||
|
// 不在视野中的时候不进行resize
|
||||||
|
if (!chartRef.value) return
|
||||||
|
if (chartRef.value.offsetHeight == 0) return
|
||||||
|
chart.getZr().painter.getViewportRoot().style.display = 'none'
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
chart.resize()
|
||||||
|
chart.getZr().painter.getViewportRoot().style.display = ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const initChart = () => {
|
||||||
|
if (!props.isInterVal && !props.pieInterVal) {
|
||||||
|
chart?.dispose()
|
||||||
|
}
|
||||||
|
// chart?.dispose()
|
||||||
|
chart = echarts.init(chartRef.value as HTMLDivElement)
|
||||||
|
const options = {
|
||||||
|
title: {
|
||||||
|
left: 'center',
|
||||||
|
// textStyle: {
|
||||||
|
color: '#000',
|
||||||
|
fontSize: 18,
|
||||||
|
// },
|
||||||
|
...(props.options?.title || null)
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: {
|
||||||
|
type: 'shadow',
|
||||||
|
label: {
|
||||||
|
color: '#fff',
|
||||||
|
fontSize: 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
textStyle: {
|
||||||
|
color: '#fff',
|
||||||
|
fontStyle: 'normal',
|
||||||
|
opacity: 0.35,
|
||||||
|
fontSize: 14
|
||||||
|
},
|
||||||
|
backgroundColor: 'rgba(0,0,0,0.55)',
|
||||||
|
borderWidth: 0,
|
||||||
|
confine: true,
|
||||||
|
...(props.options?.tooltip || null)
|
||||||
|
},
|
||||||
|
|
||||||
|
legend: {
|
||||||
|
right: 20,
|
||||||
|
top: 0,
|
||||||
|
itemGap: 10,
|
||||||
|
itemStyle: {},
|
||||||
|
// textStyle: {
|
||||||
|
fontSize: 12,
|
||||||
|
padding: [2, 0, 0, 0], //[上、右、下、左]
|
||||||
|
// },
|
||||||
|
itemWidth: 15,
|
||||||
|
itemHeight: 10,
|
||||||
|
...(props.options?.legend || null)
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
top: '60px',
|
||||||
|
left: '30px',
|
||||||
|
right: '70px',
|
||||||
|
bottom: props.options?.options?.dataZoom === null ? '10px' : '40px',
|
||||||
|
containLabel: true,
|
||||||
|
...(props.options?.grid || null)
|
||||||
|
},
|
||||||
|
xAxis: props.options?.xAxis ? handlerXAxis() : null,
|
||||||
|
yAxis: props.options?.yAxis ? handlerYAxis() : null,
|
||||||
|
dataZoom: props.options?.dataZoom || [
|
||||||
|
{
|
||||||
|
type: 'inside',
|
||||||
|
height: 13,
|
||||||
|
start: 0,
|
||||||
|
bottom: '20px',
|
||||||
|
end: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
start: 0,
|
||||||
|
height: 13,
|
||||||
|
bottom: '20px',
|
||||||
|
end: 100
|
||||||
|
}
|
||||||
|
],
|
||||||
|
color: props.options?.color || color,
|
||||||
|
series: props.options?.series,
|
||||||
|
...props.options?.options
|
||||||
|
}
|
||||||
|
// console.log(options.series,"获取x轴");
|
||||||
|
handlerBar(options)
|
||||||
|
|
||||||
|
// 处理柱状图
|
||||||
|
chart.setOption(options, true)
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
chart.resize()
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
const handlerBar = (options: any) => {
|
||||||
|
if (Array.isArray(options.series)) {
|
||||||
|
options.series.forEach((item: any) => {
|
||||||
|
if (item.type === 'bar') {
|
||||||
|
item.barMinHeight = 10
|
||||||
|
item.barMaxWidth = 20
|
||||||
|
item.itemStyle = Object.assign(
|
||||||
|
{
|
||||||
|
color: (params: any) => {
|
||||||
|
if (params.value == 0 || params.value == 3.14159) {
|
||||||
|
return '#ccc'
|
||||||
|
} else {
|
||||||
|
return props.options?.color
|
||||||
|
? props.options?.color[params.seriesIndex]
|
||||||
|
: color[params.seriesIndex]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
item.itemStyle
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const handlerYAxis = () => {
|
||||||
|
let temp = {
|
||||||
|
type: 'value',
|
||||||
|
nameGap: 15,
|
||||||
|
nameTextStyle: {
|
||||||
|
color: '#000'
|
||||||
|
},
|
||||||
|
splitNumber: 5,
|
||||||
|
minInterval: 1,
|
||||||
|
axisLine: {
|
||||||
|
show: true,
|
||||||
|
lineStyle: {
|
||||||
|
color: '#000'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
axisLabel: {
|
||||||
|
color: '#000',
|
||||||
|
fontSize: 14,
|
||||||
|
formatter: function (value) {
|
||||||
|
return value.toFixed(0) // 格式化显示为一位小数
|
||||||
|
}
|
||||||
|
},
|
||||||
|
splitLine: {
|
||||||
|
lineStyle: {
|
||||||
|
// 使用深浅的间隔色
|
||||||
|
color: ['#ccc'],
|
||||||
|
type: 'dashed',
|
||||||
|
opacity: 0.5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// props.options?.xAxis 是数组还是对象
|
||||||
|
if (Array.isArray(props.options?.yAxis)) {
|
||||||
|
return props.options?.yAxis.map((item: any) => {
|
||||||
|
return {
|
||||||
|
...temp,
|
||||||
|
...item
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
...temp,
|
||||||
|
...props.options?.yAxis
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const handlerXAxis = () => {
|
||||||
|
let temp = {
|
||||||
|
type: 'category',
|
||||||
|
axisTick: { show: false },
|
||||||
|
nameTextStyle: {
|
||||||
|
color: '#000'
|
||||||
|
},
|
||||||
|
axisLine: {
|
||||||
|
// lineStyle: {
|
||||||
|
color: '#000'
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
axisLabel: {
|
||||||
|
// textStyle: {
|
||||||
|
fontFamily: 'dinproRegular',
|
||||||
|
color: '#000',
|
||||||
|
fontSize: '12'
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// boundaryGap: false,
|
||||||
|
}
|
||||||
|
// props.options?.xAxis 是数组还是对象
|
||||||
|
if (Array.isArray(props.options?.xAxis)) {
|
||||||
|
return props.options?.xAxis.map((item: any) => {
|
||||||
|
return {
|
||||||
|
...temp,
|
||||||
|
...item
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
...temp,
|
||||||
|
...props.options?.xAxis
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let throttle: ReturnType<typeof setTimeout>
|
||||||
|
// 动态计算table高度
|
||||||
|
const resizeObserver = new ResizeObserver(entries => {
|
||||||
|
for (const entry of entries) {
|
||||||
|
if (throttle) {
|
||||||
|
clearTimeout(throttle)
|
||||||
|
}
|
||||||
|
throttle = setTimeout(() => {
|
||||||
|
resizeHandler()
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onMounted(() => {
|
||||||
|
initChart()
|
||||||
|
resizeObserver.observe(chartRef.value!)
|
||||||
|
})
|
||||||
|
defineExpose({ initChart })
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
resizeObserver.unobserve(chartRef.value!)
|
||||||
|
chart?.dispose()
|
||||||
|
})
|
||||||
|
watch(
|
||||||
|
() => props.options,
|
||||||
|
(newVal, oldVal) => {
|
||||||
|
initChart()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.chart {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.el-button {
|
||||||
|
position: absolute;
|
||||||
|
right: 0px;
|
||||||
|
top: -60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-chart {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -3,6 +3,8 @@
|
|||||||
// 首页地址(默认)
|
// 首页地址(默认)
|
||||||
export const HOME_URL: string = "/home/index";
|
export const HOME_URL: string = "/home/index";
|
||||||
|
|
||||||
|
// export const HOME_URL: string = "/machine/controlSource";
|
||||||
|
|
||||||
// 登录页地址(默认)
|
// 登录页地址(默认)
|
||||||
export const LOGIN_URL: string = "/login";
|
export const LOGIN_URL: string = "/login";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<!-- <div class="userInfo">-->
|
||||||
|
<!-- <div class="icon">-->
|
||||||
|
<!-- <Avatar/>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div class="username">-->
|
||||||
|
<!-- {{ username }}-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<div class="userInfo">
|
<div class="userInfo">
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
@@ -77,6 +85,7 @@ const logout = () => {
|
|||||||
userStore.setAccessToken("");
|
userStore.setAccessToken("");
|
||||||
userStore.setRefreshToken("");
|
userStore.setRefreshToken("");
|
||||||
userStore.setUserInfo({name: ""});
|
userStore.setUserInfo({name: ""});
|
||||||
|
userStore.setIsRefreshToken(false)
|
||||||
dictStore.setDictData([]);
|
dictStore.setDictData([]);
|
||||||
modeStore.setCurrentMode('');
|
modeStore.setCurrentMode('');
|
||||||
AppSceneStore.setCurrentMode('');
|
AppSceneStore.setCurrentMode('');
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ const routerMode = {
|
|||||||
* @param meta.isKeepAlive ==> 当前路由是否缓存
|
* @param meta.isKeepAlive ==> 当前路由是否缓存
|
||||||
* */
|
* */
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
|
|
||||||
history: routerMode[mode](),
|
history: routerMode[mode](),
|
||||||
routes: [...staticRouter],
|
routes: [...staticRouter],
|
||||||
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
|
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
|
||||||
@@ -68,10 +69,9 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
await initDynamicRouter()
|
await initDynamicRouter()
|
||||||
return next({ ...to, replace: true })
|
return next({ ...to, replace: true })
|
||||||
}
|
}
|
||||||
//console.log(to)
|
|
||||||
// 7.存储 routerName 做按钮权限筛选
|
// 7.存储 routerName 做按钮权限筛选
|
||||||
authStore.setRouteName(to.name as string)
|
authStore.setRouteName(to.name as string)
|
||||||
|
|
||||||
// 8.正常访问页面
|
// 8.正常访问页面
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export const initDynamicRouter = async () => {
|
|||||||
if (item.component && typeof item.component == "string") {
|
if (item.component && typeof item.component == "string") {
|
||||||
item.component = modules["/src/views" + item.component + ".vue"];
|
item.component = modules["/src/views" + item.component + ".vue"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.meta.isFull) {
|
if (item.meta.isFull) {
|
||||||
router.addRoute(item as unknown as RouteRecordRaw);
|
router.addRoute(item as unknown as RouteRecordRaw);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,122 +1,139 @@
|
|||||||
import { RouteRecordRaw } from "vue-router";
|
import { RouteRecordRaw } from 'vue-router'
|
||||||
import { HOME_URL, LOGIN_URL } from "@/config";
|
import { HOME_URL, LOGIN_URL } from '@/config'
|
||||||
export const Layout = () => import('@/layouts/index.vue');
|
export const Layout = () => import('@/layouts/index.vue')
|
||||||
/**
|
/**
|
||||||
* staticRouter (静态路由)
|
* staticRouter (静态路由)
|
||||||
*/
|
*/
|
||||||
export const staticRouter: RouteRecordRaw[] = [
|
export const staticRouter: RouteRecordRaw[] = [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: '/',
|
||||||
redirect: HOME_URL,
|
redirect: HOME_URL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: LOGIN_URL,
|
path: LOGIN_URL,
|
||||||
name: "login",
|
name: 'login',
|
||||||
component: () => import("@/views/login/index.vue"),
|
component: () => import('@/views/login/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: "登录",
|
title: '登录'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/layout",
|
path: '/layout',
|
||||||
name: "layout",
|
name: 'layout',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "/plan",
|
path: '/plan',
|
||||||
name: "plan",
|
name: 'plan',
|
||||||
redirect: "/plan/planList",
|
redirect: '/plan/planList',
|
||||||
children: [
|
children: [
|
||||||
{
|
// {
|
||||||
path: "/plan/planList",
|
// path: "/plan/planList",
|
||||||
name: "planList",
|
// name: "planList",
|
||||||
component: () => import("@/views/plan/planList/index.vue"),
|
// component: () => import("@/views/plan/planList/index.vue"),
|
||||||
meta: {
|
// meta: {
|
||||||
title: "检测计划列表",
|
// title: "检测计划列表",
|
||||||
icon: "List",
|
// icon: "List",
|
||||||
isLink: "",
|
// isLink: "",
|
||||||
isHide: false,
|
// isHide: false,
|
||||||
isFull: false,
|
// isFull: false,
|
||||||
isAffix: false,
|
// isAffix: false,
|
||||||
isKeepAlive: true,//缓存改成true
|
// isKeepAlive: true,//缓存改成true
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "/plan/singlePlanList",
|
// path: "/plan/singlePlanList",
|
||||||
name: "singlePlanList",
|
// name: "singlePlanList",
|
||||||
component: () => import("@/views/plan/singlePlanList/index.vue"),
|
// component: () => import("@/views/plan/singlePlanList/index.vue"),
|
||||||
meta: {
|
// meta: {
|
||||||
title: "单个计划列表",
|
// title: "单个计划列表",
|
||||||
icon: "List",
|
// icon: "List",
|
||||||
isLink: "",
|
// isLink: "",
|
||||||
isHide: false,
|
// isHide: false,
|
||||||
isFull: false,
|
// isFull: false,
|
||||||
isAffix: false,
|
// isAffix: false,
|
||||||
isKeepAlive: true,
|
// isKeepAlive: true,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "/plan/preTest",
|
// path: "/plan/preTest",
|
||||||
name: "preTest",
|
// name: "preTest",
|
||||||
component: () => import("@/views/plan/preTest/index.vue"),
|
// component: () => import("@/views/plan/preTest/index.vue"),
|
||||||
meta: {
|
// meta: {
|
||||||
title: "预检测",
|
// title: "预检测",
|
||||||
icon: "List",
|
// icon: "List",
|
||||||
isLink: "",
|
// isLink: "",
|
||||||
isHide: false,
|
// isHide: false,
|
||||||
isFull: false,
|
// isFull: false,
|
||||||
isAffix: false,
|
// isAffix: false,
|
||||||
isKeepAlive: false,
|
// isKeepAlive: false,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "/plan/autoTest",
|
// path: "/plan/autoTest",
|
||||||
name: "autoTest",
|
// name: "autoTest",
|
||||||
component: () => import("@/views/plan/autoTest/index.vue"),
|
// component: () => import("@/views/plan/autoTest/index.vue"),
|
||||||
meta: {
|
// meta: {
|
||||||
title: "自动检测",
|
// title: "自动检测",
|
||||||
icon: "List",
|
// icon: "List",
|
||||||
isLink: "",
|
// isLink: "",
|
||||||
hideTab:true,
|
// hideTab:true,
|
||||||
parentPath:'/system/proTable',
|
// parentPath:'/system/proTable',
|
||||||
isHide: false,
|
// isHide: false,
|
||||||
isFull: false,
|
// isFull: false,
|
||||||
isAffix: false,
|
// isAffix: false,
|
||||||
isKeepAlive: true,
|
// isKeepAlive: true,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
|
|
||||||
// 错误页面路由
|
// 错误页面路由
|
||||||
{
|
{
|
||||||
path: "/403",
|
path: '/403',
|
||||||
name: "403",
|
name: '403',
|
||||||
component: () => import("@/components/ErrorMessage/403.vue"),
|
component: () => import('@/components/ErrorMessage/403.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: "403页面",
|
title: '403页面'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/404",
|
path: '/404',
|
||||||
name: "404",
|
name: '404',
|
||||||
component: () => import("@/components/ErrorMessage/404.vue"),
|
component: () => import('@/components/ErrorMessage/404.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: "404页面",
|
title: '404页面'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/500",
|
path: '/500',
|
||||||
name: "500",
|
name: '500',
|
||||||
component: () => import("@/components/ErrorMessage/500.vue"),
|
component: () => import('@/components/ErrorMessage/500.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: "500页面",
|
title: '500页面'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
// Resolve refresh page, route warnings
|
// Resolve refresh page, route warnings
|
||||||
{
|
{
|
||||||
path: "/:pathMatch(.*)*",
|
path: '/:pathMatch(.*)*',
|
||||||
component: () => import("@/components/ErrorMessage/404.vue"),
|
component: () => import('@/components/ErrorMessage/404.vue')
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
];
|
{
|
||||||
|
path: '/machine/testScriptAdd',
|
||||||
|
name: 'testScriptAdd',
|
||||||
|
component: () => import('@/views/machine/testScript/components/testScriptPopup.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '检测脚本配置',
|
||||||
|
icon: 'List',
|
||||||
|
isLink: '',
|
||||||
|
hideTab: true,
|
||||||
|
parentPath: '/machine/testScript',
|
||||||
|
isHide: false,
|
||||||
|
isFull: false,
|
||||||
|
isAffix: false,
|
||||||
|
isKeepAlive: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ export interface GlobalState {
|
|||||||
|
|
||||||
/* UserState */
|
/* UserState */
|
||||||
export interface UserState {
|
export interface UserState {
|
||||||
token: string;
|
accessToken: string;
|
||||||
|
refreshToken: string;
|
||||||
|
isRefreshToken: boolean;
|
||||||
userInfo: { name: string };
|
userInfo: { name: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {defineStore} from "pinia";
|
import {defineStore} from "pinia";
|
||||||
import {CHECK_STORE_KEY} from "@/stores/constant";
|
import {CHECK_STORE_KEY} from "@/stores/constant";
|
||||||
import type {CheckData} from "@/api/check/interface";
|
import type {CheckData} from "@/api/check/interface";
|
||||||
|
import type {Plan} from '@/api/plan/interface'
|
||||||
|
|
||||||
|
|
||||||
export const useCheckStore = defineStore("check", {
|
export const useCheckStore = defineStore("check", {
|
||||||
@@ -8,10 +9,11 @@ export const useCheckStore = defineStore("check", {
|
|||||||
|
|
||||||
state: () => ({
|
state: () => ({
|
||||||
devices: Array<CheckData.Device>(),
|
devices: Array<CheckData.Device>(),
|
||||||
planId: String(""),
|
plan: Object<Plan.ResPlan>(),
|
||||||
planCode: String(""),
|
selectTestItems: Object<CheckData.SelectTestItem>({preTest: true, timeTest: true, channelsTest: false, test: true}),
|
||||||
scriptId: String(""),
|
checkType:1, // 0:手动检测 1:自动检测
|
||||||
errorSysId: String(""),
|
reCheckType: 1, // 0:不合格项复检 1:全部复检
|
||||||
|
showDetailType: 0 // 0:数据查询 1:误差体系跟换
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getters: {},
|
getters: {},
|
||||||
@@ -20,25 +22,28 @@ export const useCheckStore = defineStore("check", {
|
|||||||
addDevices(device: CheckData.Device[]) {
|
addDevices(device: CheckData.Device[]) {
|
||||||
this.devices.push(...device);
|
this.devices.push(...device);
|
||||||
},
|
},
|
||||||
|
setPlan(plan: Plan.ResPlan) {
|
||||||
|
this.plan = plan
|
||||||
|
},
|
||||||
clearDevices() {
|
clearDevices() {
|
||||||
this.devices = [];
|
this.devices = [];
|
||||||
},
|
},
|
||||||
|
initSelectTestItems() {
|
||||||
setPlanId(planId: string) {
|
this.selectTestItems.preTest = true
|
||||||
this.planId = planId
|
this.selectTestItems.channelsTest = false
|
||||||
|
this.selectTestItems.test = true
|
||||||
},
|
},
|
||||||
|
setSelectTestItems(selectTestItems: CheckData.SelectTestItem) {
|
||||||
setPlanCode(planCode: string) {
|
this.selectTestItems = selectTestItems
|
||||||
this.planCode = planCode
|
|
||||||
},
|
},
|
||||||
|
setCheckType(checkType: number) {
|
||||||
setScriptId(scriptId: string) {
|
this.checkType = checkType
|
||||||
this.scriptId = scriptId
|
|
||||||
},
|
},
|
||||||
|
setReCheckType(reCheckType: number) {
|
||||||
setErrorSysId(errorSysId: string) {
|
this.reCheckType = reCheckType
|
||||||
this.errorSysId = errorSysId
|
},
|
||||||
|
setShowDetailType(showDetailType: number) {
|
||||||
|
this.showDetailType = showDetailType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -8,6 +8,7 @@ export const useUserStore = defineStore({
|
|||||||
state: (): UserState => ({
|
state: (): UserState => ({
|
||||||
accessToken: "",
|
accessToken: "",
|
||||||
refreshToken: "",
|
refreshToken: "",
|
||||||
|
isRefreshToken:false,
|
||||||
userInfo: { name: "admin" },
|
userInfo: { name: "admin" },
|
||||||
}),
|
}),
|
||||||
getters: {},
|
getters: {},
|
||||||
@@ -19,6 +20,9 @@ export const useUserStore = defineStore({
|
|||||||
setRefreshToken(refreshToken: string) {
|
setRefreshToken(refreshToken: string) {
|
||||||
this.refreshToken = refreshToken;
|
this.refreshToken = refreshToken;
|
||||||
},
|
},
|
||||||
|
setIsRefreshToken(isRefreshToken: boolean) {
|
||||||
|
this.isRefreshToken = isRefreshToken;
|
||||||
|
},
|
||||||
// Set setUserInfo
|
// Set setUserInfo
|
||||||
setUserInfo(userInfo: UserState["userInfo"]) {
|
setUserInfo(userInfo: UserState["userInfo"]) {
|
||||||
this.userInfo = userInfo;
|
this.userInfo = userInfo;
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default class SocketService {
|
export default class SocketService {
|
||||||
static instance = null;
|
static instance = null;
|
||||||
static get Instance() {
|
static get Instance() {
|
||||||
@@ -23,9 +20,9 @@ export default class SocketService {
|
|||||||
// 重新连接尝试的次数
|
// 重新连接尝试的次数
|
||||||
connectRetryCount = 0;
|
connectRetryCount = 0;
|
||||||
work:any;
|
work:any;
|
||||||
heartbeatTimer;
|
|
||||||
heartbeatInterval = 6000; // 心跳间隔,单位毫秒
|
|
||||||
lastActivityTime= 0; // 上次活动时间戳
|
lastActivityTime= 0; // 上次活动时间戳
|
||||||
|
lastResponseHeartTime = Date.now();//最后一次收到心跳回复时间
|
||||||
|
|
||||||
reconnectDelay= 5000; // 重新连接延迟,单位毫秒
|
reconnectDelay= 5000; // 重新连接延迟,单位毫秒
|
||||||
|
|
||||||
// 定义连接服务器的方法
|
// 定义连接服务器的方法
|
||||||
@@ -40,7 +37,7 @@ export default class SocketService {
|
|||||||
// let token = '4E6EF539AAF119D82AC4C2BC84FBA21F';
|
// let token = '4E6EF539AAF119D82AC4C2BC84FBA21F';
|
||||||
|
|
||||||
|
|
||||||
const url = 'ws://localhost:7777/hello?name=cdf'
|
const url = 'ws://127.0.0.1:7777/hello?name=cdf'
|
||||||
this.ws = new WebSocket(url);
|
this.ws = new WebSocket(url);
|
||||||
// 连接成功的事件
|
// 连接成功的事件
|
||||||
this.ws.onopen = () => {
|
this.ws.onopen = () => {
|
||||||
@@ -55,13 +52,13 @@ export default class SocketService {
|
|||||||
// 1.连接服务端失败
|
// 1.连接服务端失败
|
||||||
// 2.当连接成功之后, 服务器关闭的情况
|
// 2.当连接成功之后, 服务器关闭的情况
|
||||||
this.ws.onclose = () => {
|
this.ws.onclose = () => {
|
||||||
console.log('连接服务端失败');
|
console.log('连接webSocket服务端关闭');
|
||||||
this.connected = false;
|
this.connected = false;
|
||||||
this.connectRetryCount++;
|
this.connectRetryCount++;
|
||||||
this.clearHeartbeat();
|
this.clearHeartbeat();
|
||||||
setTimeout(() => {
|
/* setTimeout(() => {
|
||||||
// this.connect();
|
this.connect();
|
||||||
}, 500 * this.connectRetryCount);
|
}, 500 * this.connectRetryCount);*/
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -72,18 +69,23 @@ export default class SocketService {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 得到服务端发送过来的数据
|
// 得到服务端发送过来的数据
|
||||||
this.ws.onmessage = (event) => {
|
this.ws.onmessage = (event) => {
|
||||||
|
// console.log('🚀 ~ SocketService ~ connect ~ event:', event)
|
||||||
|
if(event.data == 'over') {
|
||||||
|
//心跳消息处理
|
||||||
|
this.lastResponseHeartTime = Date.now();
|
||||||
|
this.updateLastActivityTime(); // 收到心跳响应时更新活动时间
|
||||||
|
}else {
|
||||||
let message: { [key: string]: any };
|
let message: { [key: string]: any };
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('Received message:',event.data)
|
console.log('Received message:',event.data)
|
||||||
message = JSON.parse(event.data);
|
message = JSON.parse(event.data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return console.error("消息解析失败", event.data, e);
|
return console.error("消息解析失败", event.data, e);
|
||||||
}
|
}
|
||||||
//console.log(message, "从服务端获取到了数据");
|
|
||||||
/* 通过接受服务端发送的type字段来回调函数 */
|
/* 通过接受服务端发送的type字段来回调函数 */
|
||||||
if (message?.type && this.callBackMapping[message.type]) {
|
if (message?.type && this.callBackMapping[message.type]) {
|
||||||
this.callBackMapping[message.type](message);
|
this.callBackMapping[message.type](message);
|
||||||
@@ -92,6 +94,9 @@ export default class SocketService {
|
|||||||
console.log(event.data)
|
console.log(event.data)
|
||||||
/* 丢弃或继续写你的逻辑 */
|
/* 丢弃或继续写你的逻辑 */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,25 +105,26 @@ export default class SocketService {
|
|||||||
|
|
||||||
|
|
||||||
startHeartbeat() {
|
startHeartbeat() {
|
||||||
let _this = this
|
this.lastResponseHeartTime = Date.now();
|
||||||
var url = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},3000)})()']));
|
const _this = this
|
||||||
this.work = new Worker(url)
|
const url = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},9000)})()']));
|
||||||
|
this.workerBlobUrl = url; // 存储临时的Blob URL
|
||||||
|
this.work = new Worker(url);
|
||||||
this.work.onmessage = function(e){
|
this.work.onmessage = function(e){
|
||||||
if ((Date.now() - _this.lastActivityTime) > _this.heartbeatInterval) {
|
//判断多久没收到心跳响应
|
||||||
// 如果超过心跳间隔没有活动,发送心跳消息
|
|
||||||
|
if(_this.lastActivityTime - _this.lastResponseHeartTime > 30000){
|
||||||
|
//说明已经三轮心跳没收到回复了,关闭检测,提示用户。
|
||||||
|
ElMessage.error("业务主体模块发生未知异常,请尝试重新启动!");
|
||||||
|
_this.clearHeartbeat();
|
||||||
|
return;
|
||||||
|
}
|
||||||
_this.sendHeartbeat();
|
_this.sendHeartbeat();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// this.heartbeatTimer = setInterval(() => {
|
|
||||||
// if ((Date.now() - this.lastActivityTime) > this.heartbeatInterval) {
|
|
||||||
// // 如果超过心跳间隔没有活动,发送心跳消息
|
|
||||||
// this.sendHeartbeat();
|
|
||||||
// }
|
|
||||||
// }, this.heartbeatInterval/2); // 每半个心跳间隔检查一次
|
|
||||||
}
|
|
||||||
sendHeartbeat() {
|
sendHeartbeat() {
|
||||||
console.log("进入心跳消息发送。。。。。。。。。。。。。")
|
console.log(new Date()+"进入心跳消息发送。。。。。。。。。。。。。")
|
||||||
this.ws.send('alive');
|
this.ws.send('alive');
|
||||||
this.updateLastActivityTime(); // 发送心跳后更新活动时间
|
this.updateLastActivityTime(); // 发送心跳后更新活动时间
|
||||||
}
|
}
|
||||||
@@ -129,11 +135,13 @@ export default class SocketService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearHeartbeat() {
|
clearHeartbeat() {
|
||||||
|
if (this.work) {
|
||||||
this.work.terminate();
|
this.work.terminate();
|
||||||
if (this.heartbeatTimer) {
|
this.work = null;
|
||||||
|
}
|
||||||
clearInterval(this.heartbeatTimer);
|
if (this.workerBlobUrl) {
|
||||||
this.heartbeatTimer = null;
|
window.URL.revokeObjectURL(this.workerBlobUrl); // 释放临时的Blob URL
|
||||||
|
this.workerBlobUrl = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +178,6 @@ export default class SocketService {
|
|||||||
if (this.connected) {
|
if (this.connected) {
|
||||||
this.ws.close()
|
this.ws.close()
|
||||||
}
|
}
|
||||||
console.log('WS关闭中..');
|
console.log('执行WS关闭命令..');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
<!-- </el-table-column>-->
|
<!-- </el-table-column>-->
|
||||||
<template v-if="phaseT === 0">
|
<template v-if="phaseT === 0">
|
||||||
<el-table-column label="A相">
|
<el-table-column label="A相">
|
||||||
<el-table-column prop="stdA" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="stdA" width="105" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="dataA" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="dataA" width="105" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="isDataA" label="检测结果">
|
<el-table-column prop="isDataA" label="检测结果">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip effect="dark" placement="bottom">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="B相">
|
<el-table-column label="B相">
|
||||||
<el-table-column prop="stdB" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="stdB" width="105" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="dataB" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="dataB" width="105" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="isDataB" label="检测结果">
|
<el-table-column prop="isDataB" label="检测结果">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip effect="dark" placement="bottom">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
@@ -44,8 +44,8 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="C相">
|
<el-table-column label="C相">
|
||||||
<el-table-column prop="stdC" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="stdC" width="105" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="dataC" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
<el-table-column prop="dataC" width="105" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||||
<el-table-column prop="isDataC" label="检测结果">
|
<el-table-column prop="isDataC" label="检测结果">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip effect="dark" placement="bottom">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
|
|||||||
@@ -8,7 +8,13 @@
|
|||||||
<el-input v-model='formContent.scriptName' :disabled="true"/>
|
<el-input v-model='formContent.scriptName' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="误差体系">
|
<el-form-item label="误差体系">
|
||||||
<el-input v-model='formContent.errorSysName' :disabled="true"/>
|
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="checkStore.showDetailType===0">
|
||||||
|
<el-option
|
||||||
|
v-for="(option) in pqErrorList"
|
||||||
|
:key="option.id"
|
||||||
|
:label="option.name"
|
||||||
|
:value="option.id"/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据原则">
|
<el-form-item label="数据原则">
|
||||||
<el-input v-model='formContent.dataRule' :disabled="true"/>
|
<el-input v-model='formContent.dataRule' :disabled="true"/>
|
||||||
@@ -21,6 +27,9 @@
|
|||||||
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
|
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label=" ">
|
||||||
|
<el-button type="primary" :icon="Postcard" v-if="checkStore.showDetailType===1" @click="handleGenerateReport">报告生成</el-button>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -98,9 +107,10 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
|||||||
import {CheckData} from "@/api/check/interface";
|
import {CheckData} from "@/api/check/interface";
|
||||||
import {useDictStore} from "@/stores/modules/dict";
|
import {useDictStore} from "@/stores/modules/dict";
|
||||||
import {useCheckStore} from "@/stores/modules/check";
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
import {getFormData, getTreeData, getTableData} from "@/api/check/test";
|
import {exportRawData, getFormData, getTableData, getTreeData} from "@/api/check/test";
|
||||||
|
import {getPqErrSysList} from '@/api/plan/plan'
|
||||||
import {useDownload} from "@/hooks/useDownload";
|
import {useDownload} from "@/hooks/useDownload";
|
||||||
import {exportRawData} from "@/api/check/test"
|
import {Postcard} from "@element-plus/icons-vue";
|
||||||
|
|
||||||
const {appendToBody} = withDefaults(defineProps<{
|
const {appendToBody} = withDefaults(defineProps<{
|
||||||
appendToBody: boolean
|
appendToBody: boolean
|
||||||
@@ -117,6 +127,7 @@ const checkStore = useCheckStore()
|
|||||||
const visible = ref(false)
|
const visible = ref(false)
|
||||||
const treeRef = ref()
|
const treeRef = ref()
|
||||||
const searchValue = ref<string>('')
|
const searchValue = ref<string>('')
|
||||||
|
const pqErrorList = reactive<{ id: string; name: string; }[]>([])
|
||||||
watch(searchValue, (val) => {
|
watch(searchValue, (val) => {
|
||||||
treeRef.value!.filter(val)
|
treeRef.value!.filter(val)
|
||||||
})
|
})
|
||||||
@@ -127,7 +138,7 @@ const fixed = 4;
|
|||||||
// 表单数据
|
// 表单数据
|
||||||
const formContent = reactive<CheckData.DataCheck>({
|
const formContent = reactive<CheckData.DataCheck>({
|
||||||
scriptName: '',
|
scriptName: '',
|
||||||
errorSysName: '',
|
errorSysId: '',
|
||||||
dataRule: '',
|
dataRule: '',
|
||||||
deviceName: '',
|
deviceName: '',
|
||||||
chnNum: '',
|
chnNum: '',
|
||||||
@@ -193,24 +204,32 @@ const handleNodeClick = async (data: any) => {
|
|||||||
currentDesc.value = data.sourceDesc
|
currentDesc.value = data.sourceDesc
|
||||||
scriptType = data.scriptType ?? scriptType
|
scriptType = data.scriptType ?? scriptType
|
||||||
|
|
||||||
if (checkIndex.value) {
|
console.log("点击左侧树节点触发事件handleNodeClick", checkIndex.value)
|
||||||
|
if (checkIndex.value !== '') {
|
||||||
await updateTableData()
|
await updateTableData()
|
||||||
activeTab.value = 'resultTab'
|
activeTab.value = 'resultTab'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(() => formContent.errorSysId, async (newVal, oldVal) => {
|
||||||
|
if (newVal != '') {
|
||||||
|
console.log("切换误差体系");
|
||||||
|
formContent.chnNum = chnList[0].value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||||
// console.log("通道号", newVal);
|
// console.log("通道号", newVal);
|
||||||
|
|
||||||
if (newVal) {
|
if (newVal != '') {
|
||||||
// 发起请求,查询该测试项的检测结果
|
// 发起请求,查询该测试项的检测结果
|
||||||
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
|
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
|
||||||
scriptId: checkStore.scriptId,
|
scriptId: checkStore.plan.scriptId,
|
||||||
devId: deviceId,
|
devId: deviceId,
|
||||||
devNum: formContent.chnNum + '',
|
devNum: formContent.chnNum + '',
|
||||||
scriptType: originScriptType,
|
scriptType: originScriptType,
|
||||||
code: parseInt(checkStore.planCode)
|
code: parseInt(checkStore.plan.code)
|
||||||
})
|
})
|
||||||
updateTreeFly(resTreeDataTemp, 4)
|
updateTreeFly(resTreeDataTemp, 4)
|
||||||
updateTreeFly(resTreeDataTemp, 2)
|
updateTreeFly(resTreeDataTemp, 2)
|
||||||
@@ -225,6 +244,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
|||||||
activeTab.value = 'resultTab'
|
activeTab.value = 'resultTab'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// watch(currentHarmNum, (newVal, oldVal) => {
|
// watch(currentHarmNum, (newVal, oldVal) => {
|
||||||
// console.log("谐波次数", newVal);
|
// console.log("谐波次数", newVal);
|
||||||
// if (newVal !== '-1') {
|
// if (newVal !== '-1') {
|
||||||
@@ -244,7 +264,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
|||||||
|
|
||||||
watch(currentCheckItem, (newVal, oldVal) => {
|
watch(currentCheckItem, (newVal, oldVal) => {
|
||||||
console.log("当前检测项", newVal);
|
console.log("当前检测项", newVal);
|
||||||
if (newVal) {
|
if (newVal !== '') {
|
||||||
doCurrentCheckItemUpdate(newVal)
|
doCurrentCheckItemUpdate(newVal)
|
||||||
} else {
|
} else {
|
||||||
activeTab.value = 'resultTab'
|
activeTab.value = 'resultTab'
|
||||||
@@ -272,16 +292,16 @@ const defaultOperate = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const updateTableData = async () => {
|
const updateTableData = async () => {
|
||||||
// console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
||||||
if (checkIndex.value) {
|
if (checkIndex.value !== '') {
|
||||||
// console.log("更新表格数据");
|
// console.log("更新表格数据");
|
||||||
// 发起请求,查询该测试项的检测结果
|
// 发起请求,查询该测试项的检测结果
|
||||||
const {data} = await getTableData({
|
const {data} = await getTableData({
|
||||||
scriptType,
|
scriptType,
|
||||||
scriptId: checkStore.scriptId,
|
scriptId: checkStore.plan.scriptId,
|
||||||
devId: deviceId,
|
devId: deviceId,
|
||||||
devNum: formContent.chnNum + '',
|
devNum: formContent.chnNum + '',
|
||||||
code: parseInt(checkStore.planCode),
|
code: parseInt(checkStore.plan.code),
|
||||||
index: parseInt(checkIndex.value),
|
index: parseInt(checkIndex.value),
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -321,7 +341,12 @@ const updateTableData = async () => {
|
|||||||
setCheckResultData(resCheckResult)
|
setCheckResultData(resCheckResult)
|
||||||
setRawData(resRawData)
|
setRawData(resRawData)
|
||||||
checkList.length = 0
|
checkList.length = 0
|
||||||
currentCheckItem.value = ''
|
checkList.push({value: keys1[0], label: resCheckResult.isData === 1? `${keys1[0]}`:resCheckResult.isData === 4? `${keys1[0]}(/)` :`${keys1[0]}(不符合)`})
|
||||||
|
if (currentCheckItem.value == checkList[0].value) {
|
||||||
|
doCurrentCheckItemUpdate(checkList[0].value)
|
||||||
|
} else {
|
||||||
|
currentCheckItem.value = checkList[0].value
|
||||||
|
}
|
||||||
} else if (keys1.length != 0) {
|
} else if (keys1.length != 0) {
|
||||||
let tempCheckList = []
|
let tempCheckList = []
|
||||||
for (let [key, value] of resTableData.resultData) {
|
for (let [key, value] of resTableData.resultData) {
|
||||||
@@ -372,7 +397,7 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
|
|||||||
|
|
||||||
// 发起后端请求,查询详细信息 当chnNum为-1时,查询所有通道号
|
// 发起后端请求,查询详细信息 当chnNum为-1时,查询所有通道号
|
||||||
const {data: resFormContent}: { data: any } = await getFormData({
|
const {data: resFormContent}: { data: any } = await getFormData({
|
||||||
planId: checkStore.planId,
|
planId: checkStore.plan.id,
|
||||||
deviceId,
|
deviceId,
|
||||||
chnNum,
|
chnNum,
|
||||||
scriptType
|
scriptType
|
||||||
@@ -380,8 +405,8 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
|
|||||||
|
|
||||||
chnList = resFormContent.chnList.map((item: { value: string, label: string }) => ({
|
chnList = resFormContent.chnList.map((item: { value: string, label: string }) => ({
|
||||||
value: item.value,
|
value: item.value,
|
||||||
// label: item.value
|
label: item.value
|
||||||
label: item.label == '1' ? `${item.value}` : item.label == '2' ? `${item.value}(不符合)` : `${item.value}`
|
//label: item.label == '1' ? `${item.value}` : item.label == '2' ? `${item.value}(不符合)` : `${item.value}`
|
||||||
}))
|
}))
|
||||||
|
|
||||||
let dataRuleName = dictStore.getDictData('Data_Rule').find(item => item.id == resFormContent.dataRule)?.name
|
let dataRuleName = dictStore.getDictData('Data_Rule').find(item => item.id == resFormContent.dataRule)?.name
|
||||||
@@ -392,10 +417,17 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
|
|||||||
chnNum: chnList.length > 0 ? chnList[0].value : '',
|
chnNum: chnList.length > 0 ? chnList[0].value : '',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
pqErrorList.length = 0
|
||||||
|
let {data: resPqErrorList} = await getPqErrSysList()
|
||||||
|
Object.assign(pqErrorList, resPqErrorList)
|
||||||
|
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleGenerateReport = () => {
|
||||||
|
console.log("生成报告", checkStore.plan.id, deviceId)
|
||||||
|
}
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
//数据清空
|
//数据清空
|
||||||
Object.assign(formContent, {
|
Object.assign(formContent, {
|
||||||
@@ -417,6 +449,7 @@ const close = () => {
|
|||||||
activeTab.value = 'resultTab'
|
activeTab.value = 'resultTab'
|
||||||
currentScriptTypeName.value = ''
|
currentScriptTypeName.value = ''
|
||||||
currentDesc.value = ''
|
currentDesc.value = ''
|
||||||
|
pqErrorList.length = 0
|
||||||
|
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
};
|
};
|
||||||
@@ -471,10 +504,10 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
|||||||
const exportRawDataHandler = () => {
|
const exportRawDataHandler = () => {
|
||||||
useDownload(exportRawData, '原始数据.xlsx', {
|
useDownload(exportRawData, '原始数据.xlsx', {
|
||||||
scriptType,
|
scriptType,
|
||||||
scriptId: checkStore.scriptId,
|
scriptId: checkStore.plan.scriptId,
|
||||||
devId: deviceId,
|
devId: deviceId,
|
||||||
devNum: formContent.chnNum + '',
|
devNum: formContent.chnNum + '',
|
||||||
code: parseInt(checkStore.planCode),
|
code: parseInt(checkStore.plan.code),
|
||||||
index: parseInt(checkIndex.value),
|
index: parseInt(checkIndex.value),
|
||||||
}, false, '.xlsx')
|
}, false, '.xlsx')
|
||||||
}
|
}
|
||||||
@@ -496,6 +529,7 @@ const setRawData = (data: CheckData.RawDataItem[]) => {
|
|||||||
item.dataC = stringToFixed(item.dataC)
|
item.dataC = stringToFixed(item.dataC)
|
||||||
item.dataT = stringToFixed(item.dataT)
|
item.dataT = stringToFixed(item.dataT)
|
||||||
})
|
})
|
||||||
|
rawTableData.length = 0
|
||||||
Object.assign(rawTableData, data)
|
Object.assign(rawTableData, data)
|
||||||
console.log("原始数据", rawTableData)
|
console.log("原始数据", rawTableData)
|
||||||
}
|
}
|
||||||
|
|||||||
814
frontend/src/views/home/components/factorTest.vue
Normal file
814
frontend/src/views/home/components/factorTest.vue
Normal file
@@ -0,0 +1,814 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dialog" v-bind="dialogBig">
|
||||||
|
<div class="dialog-content">
|
||||||
|
<div class="right-title">
|
||||||
|
<!-- <div>系数校准表</div> -->
|
||||||
|
<div>{{ outputDsc }}</div>
|
||||||
|
<div>
|
||||||
|
<span style=" font-size: 18px;font-weight: 600;">
|
||||||
|
设备已合格 <span style="color: #67C23A">{{ qualified }}</span> 台/共 <span style="color: green">{{ total }}</span>
|
||||||
|
台
|
||||||
|
</span>
|
||||||
|
<!-- <el-button type="primary" loading
|
||||||
|
v-if="activeIndex > 0 && activeIndex < activeTotalNum">通道系数已校准3台/共3台</el-button>
|
||||||
|
<el-button type="primary" :disabled="true" v-if="activeIndex === activeTotalNum">通道系数已校准3台/共3台</el-button> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<div class="dialog-left">
|
||||||
|
<el-steps direction="vertical" :active="active" :process-status="currentStepStatus" finish-status="success">
|
||||||
|
<el-step title="开始"/>
|
||||||
|
<el-step>
|
||||||
|
<template #title>
|
||||||
|
<span>大电压/电流系数下装</span><br/>
|
||||||
|
<span class="spanStyle">源输出为:</span><br/>
|
||||||
|
<span class="spanStyle" v-if="active > 0">{{ big_V_Download }}</span><br/>
|
||||||
|
<span class="spanStyle" v-if="active > 0">{{ big_I_Download }}</span>
|
||||||
|
<el-icon v-if="active === 1 " class="loading-box">
|
||||||
|
<el-icon-loading/>
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-step>
|
||||||
|
<el-step>
|
||||||
|
<template #title>
|
||||||
|
<span>小电压/电流系数下装</span><br/>
|
||||||
|
<span class="spanStyle">源输出为:</span><br/>
|
||||||
|
<span class="spanStyle" v-if="active > 1">{{ small_V_Download }}</span><br/>
|
||||||
|
<span class="spanStyle" v-if="active > 1">{{ small_I_Download }}</span>
|
||||||
|
<el-icon v-if="active === 2" class="loading-box">
|
||||||
|
<el-icon-loading/>
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-step>
|
||||||
|
<el-step>
|
||||||
|
<template #title>
|
||||||
|
<span>大电压/电流校准</span><br/>
|
||||||
|
<span class="spanStyle">源输出为:</span><br/>
|
||||||
|
<span class="spanStyle" v-if="active > 2">{{ big_V_Adjust }}</span><br/>
|
||||||
|
<span class="spanStyle" v-if="active > 2">{{ big_I_Adjust }}</span>
|
||||||
|
<el-icon v-if="active === 3" class="loading-box">
|
||||||
|
<el-icon-loading/>
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-step>
|
||||||
|
<el-step>
|
||||||
|
<template #title>
|
||||||
|
<span>小电压/电流校准</span><br/>
|
||||||
|
<span class="spanStyle">源输出为:</span><br/>
|
||||||
|
<span class="spanStyle" v-if="active > 3">{{ small_V_Adjust }}</span><br/>
|
||||||
|
<span class="spanStyle" v-if="active > 3">{{ small_I_Adjust }}</span>
|
||||||
|
<el-icon v-if="active === 4" class="loading-box">
|
||||||
|
<el-icon-loading/>
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-step>
|
||||||
|
<el-step title="结束"/>
|
||||||
|
</el-steps>
|
||||||
|
</div>
|
||||||
|
<div class="right-content">
|
||||||
|
<el-tabs type="border-card" v-model="editableTabsValue" :active-index="String(activeIndex)">
|
||||||
|
<el-tab-pane v-for="(device, index) in name" :key="index" :label="device">
|
||||||
|
<template #label>
|
||||||
|
<span class="custom-tabs-label">
|
||||||
|
<span>{{ device }}</span>
|
||||||
|
<el-icon v-if="errorStates[index]" class="icon-style">
|
||||||
|
<Failed/>
|
||||||
|
</el-icon>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<channelsTestTable
|
||||||
|
:tableData="getTableDataForChannel(index)"
|
||||||
|
:big_V_loading="big_V_loadingStates"
|
||||||
|
:curV="CurV">
|
||||||
|
</channelsTestTable>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="tsx" setup name="FactorTest">
|
||||||
|
import {type Device} from '@/api/device/interface/device';
|
||||||
|
import {Failed} from '@element-plus/icons-vue'
|
||||||
|
import {onBeforeMount, type Ref, ref, toRef, watch} from 'vue'
|
||||||
|
import {dialogBig} from '@/utils/elementBind'
|
||||||
|
import {ElMessageBox} from 'element-plus';
|
||||||
|
import {getCoefficientCheck} from '@/api/home/channelsTest/index'
|
||||||
|
import type {ChannelsTest} from '@/api/home/interface/channelsTest';
|
||||||
|
import type {Plan} from '@/api/plan/interface';
|
||||||
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
|
|
||||||
|
const checkStore = useCheckStore()
|
||||||
|
const activeIndex = ref(0)
|
||||||
|
const activeTotalNum = ref(4)
|
||||||
|
const qualified = ref(0)
|
||||||
|
const outputDsc = ref('电压误差为:±0.1Un%; 电流误差为:±0.5%')
|
||||||
|
const total = ref(0)
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const active = ref(0)
|
||||||
|
let timer1: NodeJS.Timeout | null = null; // 声明并初始化 timer1
|
||||||
|
let timer2: NodeJS.Timeout | null = null; // 同样声明并初始化 timer2
|
||||||
|
const name = ref<string[]>([])//系数校准所选设备名字数组
|
||||||
|
const channel = ref<number[]>([])//系数校准所选设备通道数组
|
||||||
|
const devIdArray = ref<string[]>([])//系数校准所选设备ID数组
|
||||||
|
const select_Plan = ref<Plan.ReqPlan>()
|
||||||
|
const planId = ref('')
|
||||||
|
const isButtonDisabled = ref(false);
|
||||||
|
const CurV = ref<number>()//额定电压
|
||||||
|
// 在 setup 函数中
|
||||||
|
const errorStates = ref(new Array(name.value.length).fill(false));
|
||||||
|
//const loadingStates = ref(new Array(name.value.length).fill(false)); // 初始化 loading 状态
|
||||||
|
const big_V_loadingStates = ref(false); // 初始化 大电压大电流下装loading 状态
|
||||||
|
const small_V_loadingStates = ref(false); // 初始化 小电压小电流下装loading 状态
|
||||||
|
const big_V_loadingStates2 = ref(false); // 初始化 大电压大电流校准loading 状态
|
||||||
|
const small_V_loadingStates2 = ref(false); // 初始化 小电压小电流校准loading 状态
|
||||||
|
const editableTabsValue = ref('0')
|
||||||
|
const big_V_Download = ref('')
|
||||||
|
const big_I_Download = ref('')
|
||||||
|
const small_V_Download = ref('')
|
||||||
|
const small_I_Download = ref('')
|
||||||
|
const big_V_Adjust = ref('')
|
||||||
|
const big_I_Adjust = ref('')
|
||||||
|
const small_V_Adjust = ref('')
|
||||||
|
const small_I_Adjust = ref('')
|
||||||
|
const props = defineProps({
|
||||||
|
testStatus: {
|
||||||
|
type: String,
|
||||||
|
default: 'wait'
|
||||||
|
},
|
||||||
|
webMsgSend: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const testStatus = toRef(props, 'testStatus');
|
||||||
|
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
|
||||||
|
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||||
|
const webMsgSend = toRef(props, 'webMsgSend');
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
// 初始化
|
||||||
|
initData()
|
||||||
|
})
|
||||||
|
const initData = () => {
|
||||||
|
|
||||||
|
CurV.value = checkStore.devices[0]?.devVolt || 57.74;
|
||||||
|
isButtonDisabled.value = false; // 恢复按钮
|
||||||
|
select_Plan.value = checkStore.plan
|
||||||
|
planId.value = checkStore.devices[0]?.planId || '';
|
||||||
|
devIdArray.value = checkStore.devices.map(item => item.deviceId);
|
||||||
|
name.value = checkStore.devices.map(item => item.deviceName)
|
||||||
|
channel.value = checkStore.devices.map(item => item.chnNum)
|
||||||
|
dialogVisible.value = true;
|
||||||
|
total.value = name.value.length
|
||||||
|
|
||||||
|
|
||||||
|
// 初始化 loadingStates 为 false
|
||||||
|
// loadingStates.value = new Array(selection.length).fill(false);
|
||||||
|
errorStates.value = new Array(checkStore.devices.length).fill(false);
|
||||||
|
|
||||||
|
for (let i = 0; i < channel.value.length; i++) {
|
||||||
|
const currentTableData = initializeTableData(dataTemplates, i);
|
||||||
|
tableDataMap.set(i, currentTableData)
|
||||||
|
}
|
||||||
|
//console.log('tableDataMap',tableDataMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
watch(testStatus, function (newValue, oldValue) {
|
||||||
|
if (newValue === 'start') {
|
||||||
|
// 开始系数校准操作
|
||||||
|
handleSubmit()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(webMsgSend, function (newValue, oldValue) {
|
||||||
|
console.log('webMsgSend---code', newValue.code)
|
||||||
|
console.log('webMsgSend---requestId', newValue.requestId)
|
||||||
|
if (newValue.code == 10520) {
|
||||||
|
ElMessageBox.alert('报文解析异常!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10521) {
|
||||||
|
ElMessageBox.alert('程控源參数有误!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10522) {
|
||||||
|
ElMessageBox.alert('测试项解析有误!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10523) {
|
||||||
|
ElMessageBox.alert('源连接失败!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10524) {
|
||||||
|
ElMessageBox.alert('获取源控制权失败!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10525) {
|
||||||
|
ElMessageBox.alert('重置源失败!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10527) {
|
||||||
|
ElMessageBox.alert('源未进行初始化!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10528) {
|
||||||
|
ElMessageBox.alert('目标源有误(该用户已控制其他源,在关闭前无法操作新的源)!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10529) {
|
||||||
|
ElMessageBox.alert('源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10550) {
|
||||||
|
ElMessageBox.alert(`${newValue.data}设备连接异常!`, '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10551) {
|
||||||
|
ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10552) { //todo 10552之后还会发送消息吗?
|
||||||
|
ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else {
|
||||||
|
console.log('显示东西code', newValue.code)
|
||||||
|
console.log('显示东西requestId', newValue.requestId)
|
||||||
|
switch (newValue.requestId) {
|
||||||
|
|
||||||
|
case 'yjc_ytxjy':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case'INIT_GATHER':
|
||||||
|
if (newValue.code == -1) {
|
||||||
|
ElMessageBox.alert('源未知异常', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10523) {
|
||||||
|
ElMessageBox.alert('源连接失败', '源连接失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'YJC_xujy':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'OPER_GATHER':
|
||||||
|
if (newValue.code == 10552) {
|
||||||
|
ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10520) {
|
||||||
|
ElMessageBox.alert('解析报文异常,执行自动关闭,请重新发起检测', '解析报文异常', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'DATA_REQUEST$02':
|
||||||
|
if (newValue.code == 25003) {
|
||||||
|
ElMessageBox.alert('相序校验未通过,执行自动关闭,请重新发起检测', '相序校验未通过', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'yjc_sbtxjy':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'INIT_GATHER$01':
|
||||||
|
if (newValue.code == 10550) {
|
||||||
|
ElMessageBox.alert('设备连接异常', '设备连接异常', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10551) {
|
||||||
|
ElMessageBox.alert('设备触发报告异常', '设备触发报告异常', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10552) {
|
||||||
|
ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
} else if (newValue.code == 10520) {
|
||||||
|
ElMessageBox.alert('解析报文异常,执行自动关闭,请重新发起检测', '解析报文异常', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Coefficient_Check':
|
||||||
|
console.log("Coefficient_Checkactive", active.value);
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'big_end'://大电压,电流下装
|
||||||
|
console.log('大电压,电流下装')
|
||||||
|
active.value++;
|
||||||
|
big_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
|
big_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
|
||||||
|
tableLoading('small', '系数下装')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'small_end'://小电压,电流下装
|
||||||
|
console.log('小电压,电流下装')
|
||||||
|
active.value++;
|
||||||
|
small_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
|
small_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
|
||||||
|
tableLoading('big', '系数校准')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'big_comp_end'://大电压,电流校准
|
||||||
|
console.log('大电压,电流校准')
|
||||||
|
active.value++;
|
||||||
|
big_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
|
big_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
|
||||||
|
tableLoading('small', '系数校准')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'small_comp_end'://小电压,电流校准
|
||||||
|
console.log('小电压,电流校准')
|
||||||
|
active.value++;
|
||||||
|
small_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
|
||||||
|
small_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
|
||||||
|
active.value++;
|
||||||
|
|
||||||
|
for (let i = 0; i < name.value.length; i++) {
|
||||||
|
const currentDataRef = tableDataMap.get(i);
|
||||||
|
if (currentDataRef) {
|
||||||
|
const currentData = currentDataRef.value;
|
||||||
|
// 检查当前数据中有无不合格字段
|
||||||
|
const hasError = checkForErrors(currentData);
|
||||||
|
if (hasError) {
|
||||||
|
} else {
|
||||||
|
qualified.value++;
|
||||||
|
}
|
||||||
|
updateErrorState(i, hasError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//editableTabsValue.value = (tabNumber.value).toString();//显示下一个tab
|
||||||
|
isButtonDisabled.value = false; // 恢复按钮
|
||||||
|
emit('update:testStatus', 'success')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'DATA_CHNFACTOR$02'://表格
|
||||||
|
// 输出 key 为 0 的数组中的第一条 ChannelsTest.CoefficientVO 对象
|
||||||
|
console.log('表格',name.value)
|
||||||
|
for (let i = 0; i < name.value.length; i++) {
|
||||||
|
const targetArrayRef = tableDataMap.get(i);
|
||||||
|
if (targetArrayRef) {
|
||||||
|
const targetArray = targetArrayRef.value;
|
||||||
|
if (targetArray.length > 0) {
|
||||||
|
const firstCoefficientVO = targetArray.find(item => item.monitorNum === newValue.data.monitorNum &&
|
||||||
|
item.type === newValue.data.type &&
|
||||||
|
item.desc === newValue.data.desc &&
|
||||||
|
item.devName === newValue.data.devName);
|
||||||
|
if (firstCoefficientVO) { // 检查 firstCoefficientVO 是否存在
|
||||||
|
firstCoefficientVO.aVuData = parseFloat(newValue.data.aVuData).toFixed(4);
|
||||||
|
|
||||||
|
if (!isNaN(parseFloat(newValue.data.aVuXi)) && isFinite(newValue.data.aVuXi)) {
|
||||||
|
firstCoefficientVO.aVuXi = (parseFloat(newValue.data.aVuXi) / 10000).toFixed(4);
|
||||||
|
} else {
|
||||||
|
firstCoefficientVO.aVuXi = newValue.data.aVuXi;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstCoefficientVO.bVuData = parseFloat(newValue.data.bVuData).toFixed(4);
|
||||||
|
|
||||||
|
if (!isNaN(parseFloat(newValue.data.bVuXi)) && isFinite(newValue.data.bVuXi)) {
|
||||||
|
firstCoefficientVO.bVuXi = (parseFloat(newValue.data.bVuXi) / 10000).toFixed(4);
|
||||||
|
} else {
|
||||||
|
firstCoefficientVO.bVuXi = newValue.data.bVuXi;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstCoefficientVO.cVuData = parseFloat(newValue.data.cVuData).toFixed(4);
|
||||||
|
|
||||||
|
if (!isNaN(parseFloat(newValue.data.cVuXi)) && isFinite(newValue.data.cVuXi)) {
|
||||||
|
firstCoefficientVO.cVuXi = (parseFloat(newValue.data.cVuXi) / 10000).toFixed(4);
|
||||||
|
} else {
|
||||||
|
firstCoefficientVO.cVuXi = newValue.data.cVuXi;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstCoefficientVO.aIeData = parseFloat(newValue.data.aIeData).toFixed(4);
|
||||||
|
|
||||||
|
if (!isNaN(parseFloat(newValue.data.aIeXi)) && isFinite(newValue.data.aIeXi)) {
|
||||||
|
firstCoefficientVO.aIeXi = (parseFloat(newValue.data.aIeXi) / 10000).toFixed(4);
|
||||||
|
} else {
|
||||||
|
firstCoefficientVO.aIeXi = newValue.data.aIeXi;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstCoefficientVO.bIeData = parseFloat(newValue.data.bIeData).toFixed(4);
|
||||||
|
|
||||||
|
if (!isNaN(parseFloat(newValue.data.bIeXi)) && isFinite(newValue.data.bIeXi)) {
|
||||||
|
firstCoefficientVO.bIeXi = (parseFloat(newValue.data.bIeXi) / 10000).toFixed(4);
|
||||||
|
} else {
|
||||||
|
firstCoefficientVO.bIeXi = newValue.data.bIeXi;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstCoefficientVO.cIeData = parseFloat(newValue.data.cIeData).toFixed(4);
|
||||||
|
|
||||||
|
if (!isNaN(parseFloat(newValue.data.cIeXi)) && isFinite(newValue.data.cIeXi)) {
|
||||||
|
firstCoefficientVO.cIeXi = (parseFloat(newValue.data.cIeXi) / 10000).toFixed(4);
|
||||||
|
} else {
|
||||||
|
firstCoefficientVO.cIeXi = newValue.data.cIeXi;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstCoefficientVO.aV = newValue.data.aV;
|
||||||
|
firstCoefficientVO.bV = newValue.data.bV;
|
||||||
|
firstCoefficientVO.cV = newValue.data.cV;
|
||||||
|
firstCoefficientVO.aI = newValue.data.aI;
|
||||||
|
firstCoefficientVO.bI = newValue.data.bI;
|
||||||
|
firstCoefficientVO.cI = newValue.data.cI;
|
||||||
|
console.log(newValue.data.devName + '对象:', firstCoefficientVO);
|
||||||
|
activeIndex.value++;
|
||||||
|
} else {
|
||||||
|
console.log('未找到匹配的'+ newValue.data.devName+'对象');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(newValue.data.devName + '数组为空');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('未找到'+newValue.data.devName+'对应的数组');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'socket_timeout':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'VOLTAGE':
|
||||||
|
ElMessageBox.alert('连接超时!', '连接超时', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'connect':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case "Source":
|
||||||
|
ElMessageBox.alert('源服务端连接失败', '源服务端连接失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
break;
|
||||||
|
case "Dev":
|
||||||
|
ElMessageBox.alert('设备服务端连接失败', '设备服务端连接失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TableInit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
//出错系数检测初始化
|
||||||
|
const TableInit = () => {
|
||||||
|
console.log("出错系数检测",active.value);
|
||||||
|
emit('update:testStatus', 'test_init_fail')
|
||||||
|
// isButtonDisabled.value = false; // 恢复按钮
|
||||||
|
// for (let i = 0; i < channel.value.length; i++) {
|
||||||
|
// const currentTableData = initializeTableData(dataTemplates, i);
|
||||||
|
// tableDataMap.set(i, currentTableData)
|
||||||
|
// }
|
||||||
|
// activeIndex.value = 0
|
||||||
|
// qualified.value = 0
|
||||||
|
// active.value = 0
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//按行图标转动
|
||||||
|
const tableLoading = (type: string, desc: string) => {
|
||||||
|
console.log('转动',channel.value)
|
||||||
|
for (let i = 0; i < channel.value.length; i++) {
|
||||||
|
|
||||||
|
const targetArrayRef = tableDataMap.get(i);
|
||||||
|
if (targetArrayRef) {
|
||||||
|
const targetArray = targetArrayRef.value;
|
||||||
|
if (targetArray.length > 0) {
|
||||||
|
for (let j = 0; j < channel.value[i]; j++) {
|
||||||
|
const firstCoefficientVO = targetArray.find(item => item.monitorNum === (j + 1).toString() &&
|
||||||
|
item.type === type &&
|
||||||
|
item.desc === desc);
|
||||||
|
if (firstCoefficientVO) {
|
||||||
|
firstCoefficientVO.loading = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
console.log('不转了')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const dataTemplates: ChannelsTest.CoefficientVO[] = [
|
||||||
|
{
|
||||||
|
monitorNum: '1',
|
||||||
|
desc: '系数下装',
|
||||||
|
type: 'big',
|
||||||
|
aVuData: '—',
|
||||||
|
aVuXi: '—',
|
||||||
|
bVuData: '—',
|
||||||
|
bVuXi: '—',
|
||||||
|
cVuData: '—',
|
||||||
|
cVuXi: '—',
|
||||||
|
aIeData: '—',
|
||||||
|
aIeXi: '—',
|
||||||
|
bIeData: '—',
|
||||||
|
bIeXi: '—',
|
||||||
|
cIeData: '—',
|
||||||
|
cIeXi: '—',
|
||||||
|
loading: false,
|
||||||
|
devName: '',
|
||||||
|
aV: '—',
|
||||||
|
bV: '—',
|
||||||
|
cV: '—',
|
||||||
|
aI: '—',
|
||||||
|
bI: '—',
|
||||||
|
cI: '—',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
monitorNum: '2',
|
||||||
|
desc: '系数下装',
|
||||||
|
type: 'small',
|
||||||
|
aVuData: '—',
|
||||||
|
aVuXi: '—',
|
||||||
|
bVuData: '—',
|
||||||
|
bVuXi: '—',
|
||||||
|
cVuData: '—',
|
||||||
|
cVuXi: '—',
|
||||||
|
aIeData: '—',
|
||||||
|
aIeXi: '—',
|
||||||
|
bIeData: '—',
|
||||||
|
bIeXi: '—',
|
||||||
|
cIeData: '—',
|
||||||
|
cIeXi: '—',
|
||||||
|
loading: false,
|
||||||
|
devName: '',
|
||||||
|
aV: '—',
|
||||||
|
bV: '—',
|
||||||
|
cV: '—',
|
||||||
|
aI: '—',
|
||||||
|
bI: '—',
|
||||||
|
cI: '—',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
monitorNum: '3',
|
||||||
|
desc: '系数校准',
|
||||||
|
type: 'big',
|
||||||
|
aVuData: '—',
|
||||||
|
aVuXi: '—',
|
||||||
|
bVuData: '—',
|
||||||
|
bVuXi: '—',
|
||||||
|
cVuData: '—',
|
||||||
|
cVuXi: '—',
|
||||||
|
aIeData: '—',
|
||||||
|
aIeXi: '—',
|
||||||
|
bIeData: '—',
|
||||||
|
bIeXi: '—',
|
||||||
|
cIeData: '—',
|
||||||
|
cIeXi: '—',
|
||||||
|
loading: false,
|
||||||
|
devName: '',
|
||||||
|
aV: '—',
|
||||||
|
bV: '—',
|
||||||
|
cV: '—',
|
||||||
|
aI: '—',
|
||||||
|
bI: '—',
|
||||||
|
cI: '—',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
monitorNum: '4',
|
||||||
|
desc: '系数校准',
|
||||||
|
type: 'small',
|
||||||
|
aVuData: '—',
|
||||||
|
aVuXi: '—',
|
||||||
|
bVuData: '—',
|
||||||
|
bVuXi: '—',
|
||||||
|
cVuData: '—',
|
||||||
|
cVuXi: '—',
|
||||||
|
aIeData: '—',
|
||||||
|
aIeXi: '—',
|
||||||
|
bIeData: '—',
|
||||||
|
bIeXi: '—',
|
||||||
|
cIeData: '—',
|
||||||
|
cIeXi: '—',
|
||||||
|
loading: false,
|
||||||
|
devName: '',
|
||||||
|
aV: '—',
|
||||||
|
bV: '—',
|
||||||
|
cV: '—',
|
||||||
|
aI: '—',
|
||||||
|
bI: '—',
|
||||||
|
cI: '—',
|
||||||
|
},
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// 更新错误状态的方法
|
||||||
|
const updateErrorState = (index: number, hasError: boolean) => {
|
||||||
|
errorStates.value[index] = hasError;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// const emit = defineEmits<{
|
||||||
|
|
||||||
|
// (e: 'submitClicked', callback: (resolve: (value: boolean) => void) => void): void;
|
||||||
|
// }>();
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:testStatus']);
|
||||||
|
|
||||||
|
const getTableDataForChannel = (index: number): any[] => {
|
||||||
|
const data = tableDataMap.get(index);
|
||||||
|
return data ? data.value : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
watch(activeIndex, function (newValue, oldValue) {
|
||||||
|
if (activeIndex.value === 1) {
|
||||||
|
outputDsc.value = "电压误差为:±0.1Un%; 电流误差为:±0.5%";
|
||||||
|
// 当前源输出为:Ua=Ub=Uc=57.74V Ia=Ib=Ic=1A"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 示例的 checkForErrors 函数,根据实际需求进行调整
|
||||||
|
const checkForErrors = (data: ChannelsTest.CoefficientVO[]): boolean => {
|
||||||
|
// 这里假设不合格字段的标准是 status 为 '不合格' 或 isValid 为 false
|
||||||
|
return data.some(item =>
|
||||||
|
item.aVuXi === '不合格' ||
|
||||||
|
item.bVuXi === '不合格' ||
|
||||||
|
item.cVuXi === '不合格' ||
|
||||||
|
item.aIeXi === '不合格' ||
|
||||||
|
item.bIeXi === '不合格' ||
|
||||||
|
item.cIeXi === '不合格'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
// 创建一个 Promise 来等待父组件的回调
|
||||||
|
// const response = await new Promise<boolean>((resolve) => {
|
||||||
|
// emit('submitClicked', resolve);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// if (!response) {
|
||||||
|
// return;
|
||||||
|
// }()
|
||||||
|
|
||||||
|
isButtonDisabled.value = true; // 禁用按钮
|
||||||
|
tableLoading('big', '系数下装')
|
||||||
|
await getCoefficientCheck({
|
||||||
|
userPageId: "cdf",
|
||||||
|
devIds: devIdArray.value,
|
||||||
|
planId: planId.value,
|
||||||
|
errorSysId: select_Plan.value?.errorSysId,
|
||||||
|
scriptId: select_Plan.value?.scriptId,
|
||||||
|
operateType: '0' // '0'为预检测、‘1‘为正式检测
|
||||||
|
})
|
||||||
|
active.value++;
|
||||||
|
|
||||||
|
console.log('开始检测active.value', active.value)
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提取初始化并填充 currentTableData 的函数
|
||||||
|
const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: number): Ref<ChannelsTest.CoefficientVO[]> => {
|
||||||
|
const currentTableData = ref<ChannelsTest.CoefficientVO[]>([]);
|
||||||
|
for (let j = 0; j < channel.value[index]; j++) {
|
||||||
|
templates.forEach((template) => {
|
||||||
|
// 使用解构赋值排除 id 和 MonitorIdx 属性
|
||||||
|
const {devName, monitorNum: __, ...rest} = template;
|
||||||
|
currentTableData.value.push({
|
||||||
|
monitorNum: (j + 1).toString(),
|
||||||
|
devName: name.value[index],
|
||||||
|
...rest,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return currentTableData;
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
/* 确保 el-icon-loading 的动画效果没有被覆盖 */
|
||||||
|
.loading-box {
|
||||||
|
animation: rotate 2s linear infinite;
|
||||||
|
font-size: 30px; /* 增大图标的大小 */
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rotate {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-title {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
/* 横向排列 */
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-tabs-label .el-icon {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-tabs-label span {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-content {
|
||||||
|
height: 510px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-tabs--border-card {
|
||||||
|
height: 470px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .el-icon svg {
|
||||||
|
color: #ff7171;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.icon-style {
|
||||||
|
color: #ff7171;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-left {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-content {
|
||||||
|
flex: 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spanStyle {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup name="preTest">
|
<script lang="tsx" setup name="preTest">
|
||||||
import {ElMessage, ElMessageBox} from "element-plus";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
import {defineExpose} from 'vue';
|
import {defineExpose, toRef} from 'vue';
|
||||||
|
|
||||||
const step1InitLog = ref([
|
const step1InitLog = ref([
|
||||||
{
|
{
|
||||||
@@ -506,6 +506,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
}
|
}
|
||||||
activeIndex.value = 5
|
activeIndex.value = 5
|
||||||
ts.value = 'success'
|
ts.value = 'success'
|
||||||
|
console.log("@@@@",ts.value)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -556,7 +557,6 @@ watch(activeIndex, function (newValue, oldValue) {
|
|||||||
|
|
||||||
//监听goods_sn的变化
|
//监听goods_sn的变化
|
||||||
watch(testStatus, function (newValue, oldValue) {
|
watch(testStatus, function (newValue, oldValue) {
|
||||||
|
|
||||||
ts.value = props.testStatus;
|
ts.value = props.testStatus;
|
||||||
if (ts.value === 'start') {
|
if (ts.value === 'start') {
|
||||||
ts.value = 'process'
|
ts.value = 'process'
|
||||||
|
|||||||
110
frontend/src/views/home/components/selectTestItemPopup.vue
Normal file
110
frontend/src/views/home/components/selectTestItemPopup.vue
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="选择测试内容" v-model='dialogVisible' @close="handleClose" v-bind="dialogSmall" >
|
||||||
|
<div>
|
||||||
|
<el-form ref="dialogFormRef" :model="formContent" class="form-three">
|
||||||
|
<el-form-item prop="preTest" :label-width="100">
|
||||||
|
<el-checkbox v-model="formContent.preTest" label="预检测"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="checkStore.plan.timeCheck===1" prop="timeTest" :label-width="100">
|
||||||
|
<el-checkbox v-model="formContent.timeTest" label="守时检测"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="channelsTest" :label-width="100">
|
||||||
|
<el-checkbox v-model="formContent.channelsTest" label="系数校准"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="test" :label-width="100">
|
||||||
|
<el-checkbox v-model="formContent.test" label="正式检测"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="handleClose">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleStart">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='selectTestItemPopup'>
|
||||||
|
import {dialogSmall} from "@/utils/elementBind";
|
||||||
|
import {ref} from "vue";
|
||||||
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
|
import type {CheckData} from "@/api/check/interface";
|
||||||
|
import {ElMessageBox} from "element-plus";
|
||||||
|
|
||||||
|
const emit = defineEmits(['openTestDialog'])
|
||||||
|
const checkStore = useCheckStore();
|
||||||
|
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
|
||||||
|
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const formContent = reactive<CheckData.SelectTestItem>({preTest: true, timeTest: false, channelsTest: false, test: false})
|
||||||
|
|
||||||
|
const open = async () => {
|
||||||
|
resetFormContent()
|
||||||
|
checkStore.setSelectTestItems(formContent)
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清空表单内容
|
||||||
|
const resetFormContent = () => {
|
||||||
|
Object.assign(formContent, {preTest: true, channelsTest: false, timeTest: false, test: false})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleStart = () => {
|
||||||
|
let count = 0
|
||||||
|
for (let key in formContent) {
|
||||||
|
if (formContent[key]) {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count === 0) {
|
||||||
|
ElMessage.warning('请选择测试内容!')
|
||||||
|
} else {
|
||||||
|
if(formContent.channelsTest){
|
||||||
|
const factorFlagArray = ref<string[]>([]) // 初始化为空数组
|
||||||
|
for (let i = 0; i < checkStore.devices.length; i++) {
|
||||||
|
const factorFlag = checkStore.devices[i].factorFlag
|
||||||
|
if (factorFlag !== undefined && factorFlag !== null && factorFlag === 0) {
|
||||||
|
factorFlagArray.value.push(checkStore.devices[i].deviceName.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (factorFlagArray.value.length > 0) {
|
||||||
|
const factorFlags = factorFlagArray.value.join(', ')
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
factorFlags + '设备不支持系数校准,请重新选择',
|
||||||
|
'提示',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checkStore.setCheckType(0)
|
||||||
|
checkStore.setSelectTestItems({...formContent})
|
||||||
|
handleClose()
|
||||||
|
emit('openTestDialog')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const handleClose = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 清空dialogForm中的值
|
||||||
|
resetFormContent()
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({open})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -61,7 +61,8 @@
|
|||||||
</el-button
|
</el-button
|
||||||
>
|
>
|
||||||
<el-button :icon="Delete" @click="handleRefresh"
|
<el-button :icon="Delete" @click="handleRefresh"
|
||||||
>重置</el-button
|
>重置
|
||||||
|
</el-button
|
||||||
>
|
>
|
||||||
<!-- :disabled='!scope.isSelected' -->
|
<!-- :disabled='!scope.isSelected' -->
|
||||||
<el-button
|
<el-button
|
||||||
@@ -77,20 +78,12 @@
|
|||||||
<el-button
|
<el-button
|
||||||
type='primary'
|
type='primary'
|
||||||
:icon='ChatLineRound'
|
:icon='ChatLineRound'
|
||||||
@click="handleTest('自动检测')"
|
@click="handleTest('一键检测')"
|
||||||
v-if='form.activeTabs === 0'
|
v-if='form.activeTabs === 0'
|
||||||
>自动检测
|
>一键检测
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
<!-- <el-button type='primary' :icon='ChatLineSquare' @click="handleTest('不合格项复检')" v-if='form.activeTabs === 2'>不合格项复检</el-button>-->
|
||||||
<el-button type='primary' :icon='ChatLineSquare' @click="handleTest('不合格项复检')"
|
<!-- <el-button type='primary' :icon='ChatDotSquare' @click="handleTest('全部复检')" v-if='form.activeTabs === 2'>全部复检</el-button>-->
|
||||||
v-if='form.activeTabs === 2'
|
|
||||||
>不合格项复检
|
|
||||||
</el-button
|
|
||||||
>
|
|
||||||
<el-button type='primary' :icon='ChatDotSquare' @click="handleTest('全部复检')" v-if='form.activeTabs === 2'
|
|
||||||
>全部复检
|
|
||||||
</el-button
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- :disabled='!scope.isSelected' -->
|
<!-- :disabled='!scope.isSelected' -->
|
||||||
<!-- <el-button type="primary" :icon="Download" @click="handleTest('批量下载')" v-if="form.activeTabs === 3"
|
<!-- <el-button type="primary" :icon="Download" @click="handleTest('批量下载')" v-if="form.activeTabs === 3"
|
||||||
@@ -102,9 +95,7 @@
|
|||||||
> -->
|
> -->
|
||||||
|
|
||||||
<!-- :disabled="!scope.isSelected || scope.selectedList.filter((item) => item.check_State === '检测完成').length === 0" -->
|
<!-- :disabled="!scope.isSelected || scope.selectedList.filter((item) => item.check_State === '检测完成').length === 0" -->
|
||||||
<el-button type='primary' :icon='Notebook' @click="handleTest('批量归档')" v-if='form.activeTabs === 4'
|
<el-button type='primary' :icon='Notebook' @click="handleTest('批量归档')" v-if='form.activeTabs === 4'>归档</el-button>
|
||||||
>归档
|
|
||||||
</el-button>
|
|
||||||
<!-- <el-button type="primary" :icon="CirclePlus" @click="addDevice('设备新增')" v-if="form.activeTabs === 0"
|
<!-- <el-button type="primary" :icon="CirclePlus" @click="addDevice('设备新增')" v-if="form.activeTabs === 0"
|
||||||
>设备新增</el-button> -->
|
>设备新增</el-button> -->
|
||||||
|
|
||||||
@@ -225,19 +216,14 @@
|
|||||||
:dialogTitle="dialogTitle"
|
:dialogTitle="dialogTitle"
|
||||||
@update:visible="dialogFormVisible = $event"
|
@update:visible="dialogFormVisible = $event"
|
||||||
/> -->
|
/> -->
|
||||||
<TestPopup ref='testPopup' @quitClicked='handleQuitClicked' ></TestPopup>
|
<TestPopup ref='testPopup' @quitClicked='handleQuitClicked'></TestPopup>
|
||||||
|
|
||||||
<reportPopup
|
<reportPopup
|
||||||
:visible='reportDialogVisible'
|
:visible='reportDialogVisible'
|
||||||
@update:visible='reportDialogVisible = $event'
|
@update:visible='reportDialogVisible = $event'
|
||||||
></reportPopup>
|
></reportPopup>
|
||||||
|
|
||||||
<dataCheckPopup ref='dataCheckPopupRef' />
|
<dataCheckPopup ref='dataCheckPopupRef'/>
|
||||||
|
|
||||||
<dataCheckChangeErrSysPopup
|
|
||||||
:visible='dataCheckChangeErrSysDialogVisible'
|
|
||||||
@update:visible='dataCheckChangeErrSysDialogVisible = $event'
|
|
||||||
></dataCheckChangeErrSysPopup>
|
|
||||||
|
|
||||||
<matchPopup
|
<matchPopup
|
||||||
:visible='matchDialogVisible'
|
:visible='matchDialogVisible'
|
||||||
@@ -245,17 +231,19 @@
|
|||||||
></matchPopup>
|
></matchPopup>
|
||||||
|
|
||||||
<!--系数校准-->
|
<!--系数校准-->
|
||||||
<ChannelsTest ref='channelsTest' :webMsgSend='webMsgSend' @quitClicked='handleQuitClicked' @submitClicked = 'handleSubmitClicked'></ChannelsTest>
|
<ChannelsTest ref='channelsTest' :webMsgSend='webMsgSend' @quitClicked='handleQuitClicked' @submitClicked='handleSubmitClicked'></ChannelsTest>
|
||||||
|
<!-- 手动检测-勾选检测项弹窗 -->
|
||||||
|
<SelectTestItemPopup ref="selectTestItemPopupRef" @openTestDialog="openTestDialog"></SelectTestItemPopup>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='useProTable'>
|
<script setup lang='tsx' name='useProTable'>
|
||||||
import { useRouter } from 'vue-router'
|
import {useRouter} from 'vue-router'
|
||||||
import type { Device } from '@/api/device/interface/device'
|
import type {Device} from '@/api/device/interface/device'
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import {useHandleData} from '@/hooks/useHandleData'
|
||||||
import { ElMessage, ElMessageBox, ElLoading, Action } from 'element-plus'
|
import {ElMessage, ElMessageBox, ElLoading, Action} from 'element-plus'
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
import {type ProTableInstance, type ColumnProps} from '@/components/ProTable/interface'
|
||||||
import {
|
import {
|
||||||
Search,
|
Search,
|
||||||
View,
|
View,
|
||||||
@@ -273,27 +261,28 @@ import {
|
|||||||
CirclePlus,
|
CirclePlus,
|
||||||
Odometer,
|
Odometer,
|
||||||
} from '@element-plus/icons-vue'
|
} from '@element-plus/icons-vue'
|
||||||
import { getPlanList } from '@/api/plan/planList'
|
import {getPlanList} from '@/api/plan/planList'
|
||||||
import deviceDataList from '@/api/device/device/deviceData'
|
import deviceDataList from '@/api/device/device/deviceData'
|
||||||
import TestPopup from './testPopup.vue'
|
import TestPopup from './testPopup.vue'
|
||||||
import reportPopup from './reportPopup.vue'
|
import reportPopup from './reportPopup.vue'
|
||||||
import dataCheckPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
import dataCheckPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
||||||
import dataCheckChangeErrSysPopup from './dataCheckChangeErrSysPopup.vue'
|
import dataCheckChangeErrSysPopup from './dataCheckChangeErrSysPopup.vue'
|
||||||
import { generateDevReport, getBoundPqDevList } from '@/api/plan/plan.ts'
|
import {generateDevReport, getBoundPqDevList} from '@/api/plan/plan.ts'
|
||||||
import { onBeforeMount, onMounted, reactive, ref, watch } from 'vue'
|
import {onBeforeMount, onMounted, reactive, ref, watch} from 'vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
import ChannelsTest from './channelsTest.vue'
|
import ChannelsTest from './channelsTest.vue'
|
||||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
import {useModeStore} from '@/stores/modules/mode' // 引入模式 store
|
||||||
import { useCheckStore } from '@/stores/modules/check'
|
import {useCheckStore} from '@/stores/modules/check'
|
||||||
import { CheckData } from '@/api/check/interface'
|
import {CheckData} from '@/api/check/interface'
|
||||||
import socketClient from '@/utils/webSocketClient'
|
import socketClient from '@/utils/webSocketClient'
|
||||||
import auth from '@/directives/modules/auth'
|
import auth from '@/directives/modules/auth'
|
||||||
import { useAuthStore } from '@/stores/modules/auth'
|
import {useAuthStore} from '@/stores/modules/auth'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
import {useDownload} from '@/hooks/useDownload'
|
||||||
import { downloadDevData } from '@/api/plan/plan.ts'
|
import {downloadDevData} from '@/api/plan/plan.ts'
|
||||||
import { documentedPqDev } from '@/api/device/device'
|
import {documentedPqDev} from '@/api/device/device'
|
||||||
import { getPqDev } from '@/api/device/device/index.ts'
|
import {getPqDev} from '@/api/device/device/index.ts'
|
||||||
import { ResultEnum } from '@/enums/httpEnum'
|
import {ResultEnum} from '@/enums/httpEnum'
|
||||||
|
import SelectTestItemPopup from "@/views/home/components/selectTestItemPopup.vue";
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const checkStore = useCheckStore()
|
const checkStore = useCheckStore()
|
||||||
@@ -309,8 +298,8 @@ const tableHeight = ref(0)
|
|||||||
const reportDialogVisible = ref(false)
|
const reportDialogVisible = ref(false)
|
||||||
|
|
||||||
const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>()
|
const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>()
|
||||||
|
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
|
||||||
|
|
||||||
const dataCheckChangeErrSysDialogVisible = ref(false)
|
|
||||||
const matchDialogVisible = ref(false)
|
const matchDialogVisible = ref(false)
|
||||||
const dialogTitle = ref('手动检测')
|
const dialogTitle = ref('手动检测')
|
||||||
const checkStateTable = ref<number[]>([0, 1, 2])
|
const checkStateTable = ref<number[]>([0, 1, 2])
|
||||||
@@ -338,7 +327,7 @@ const shouldShowOption = (item) => {
|
|||||||
//开始创建webSocket客户端
|
//开始创建webSocket客户端
|
||||||
const dataSocket = reactive({
|
const dataSocket = reactive({
|
||||||
socketServe: socketClient.Instance,
|
socketServe: socketClient.Instance,
|
||||||
});
|
});
|
||||||
|
|
||||||
tableHeight.value = window.innerHeight - 600
|
tableHeight.value = window.innerHeight - 600
|
||||||
const deviceData = ref<Device.ResPqDev[]>([])
|
const deviceData = ref<Device.ResPqDev[]>([])
|
||||||
@@ -513,7 +502,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '设备名称',
|
label: '设备名称',
|
||||||
@@ -609,7 +598,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
return ''
|
return ''
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow },
|
{prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow},
|
||||||
])
|
])
|
||||||
// 跳转详情页
|
// 跳转详情页
|
||||||
const toDetail = () => {
|
const toDetail = () => {
|
||||||
@@ -651,8 +640,12 @@ const handleSelectionChange = (selection: any[]) => {
|
|||||||
return {
|
return {
|
||||||
deviceId: item.id,
|
deviceId: item.id,
|
||||||
deviceName: item.name,
|
deviceName: item.name,
|
||||||
deviceType: item.devType,
|
|
||||||
chnNum: item.devChns,
|
chnNum: item.devChns,
|
||||||
|
planId: item.planId,
|
||||||
|
deviceType: item.devType,
|
||||||
|
devVolt: item.devVolt,
|
||||||
|
devCurr: item.devCurr,
|
||||||
|
factorFlag: item.factorFlag,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -845,6 +838,7 @@ const addDevice = (val: string) => {
|
|||||||
path: '/machine/device',
|
path: '/machine/device',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleTest = async (val: string) => {
|
const handleTest = async (val: string) => {
|
||||||
|
|
||||||
if (devNum == 0) {
|
if (devNum == 0) {
|
||||||
@@ -891,7 +885,7 @@ const handleTest = async (val: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (val === '手动检测' || val === '自动检测' || val === '不合格项复检' || val === '全部复检') {
|
if (val === '手动检测' || val === '一键检测' || val === '系数校准') {
|
||||||
// if (devNum > 6) {
|
// if (devNum > 6) {
|
||||||
// ElMessageBox.confirm(
|
// ElMessageBox.confirm(
|
||||||
// '每次检测最多只能选择6台设备,请重新选择',
|
// '每次检测最多只能选择6台设备,请重新选择',
|
||||||
@@ -904,6 +898,31 @@ const handleTest = async (val: string) => {
|
|||||||
// )
|
// )
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
|
// if (devTestedNum == 0) {
|
||||||
|
// ElMessageBox.confirm('请先选择检测完成状态的被检设备', '提示',
|
||||||
|
// {
|
||||||
|
// confirmButtonText: '确定',
|
||||||
|
// cancelButtonText: '取消',
|
||||||
|
// type: 'warning',
|
||||||
|
// })
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
const checkStates = channelsSelection.value.map(item => item.checkState)
|
||||||
|
const allCheckStatesEqual = new Set(checkStates).size <= 1
|
||||||
|
|
||||||
|
if (!allCheckStatesEqual) {
|
||||||
|
// ElMessageBox.confirm(
|
||||||
|
// '所勾选设备检测状态不一致,请重新选择',
|
||||||
|
// '提示',
|
||||||
|
// {
|
||||||
|
// confirmButtonText: '确定',
|
||||||
|
// cancelButtonText: '取消',
|
||||||
|
// type: 'warning',
|
||||||
|
// },
|
||||||
|
// )
|
||||||
|
// return
|
||||||
|
checkStore.setReCheckType(1)
|
||||||
|
}
|
||||||
if (devChannelsNum > 12) {
|
if (devChannelsNum > 12) {
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
'每次检测最多只能检测12个设备通道,请重新选择',
|
'每次检测最多只能检测12个设备通道,请重新选择',
|
||||||
@@ -916,80 +935,42 @@ const handleTest = async (val: string) => {
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dialogTitle.value = val
|
||||||
|
if (val === '手动检测') {
|
||||||
|
|
||||||
if (testType === 'reTest') {
|
if (testType === 'reTest') {
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm('请选择复检检测方式', '设备复检',
|
||||||
'请选择复检检测方式',
|
|
||||||
'设备复检',
|
|
||||||
{
|
{
|
||||||
distinguishCancelAndClose: true,
|
distinguishCancelAndClose: true,
|
||||||
confirmButtonText: '不合格项复检',
|
confirmButtonText: '不合格项复检',
|
||||||
cancelButtonText: '全部复检',
|
cancelButtonText: '全部复检',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
ElMessage.success('不合格项复检')
|
ElMessage.success('不合格项复检')
|
||||||
dialogTitle.value = val
|
if (checkStore.devices.length > 1) {
|
||||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck)// 打开对话框
|
checkStore.setReCheckType(1)
|
||||||
|
} else {
|
||||||
|
checkStore.setReCheckType(0)
|
||||||
|
}
|
||||||
|
selectTestItemPopupRef.value?.open()
|
||||||
})
|
})
|
||||||
.catch((action: Action) => {
|
.catch((action: Action) => {
|
||||||
ElMessage.success('全部复检')
|
ElMessage.success('全部复检')
|
||||||
dialogTitle.value = val
|
checkStore.setReCheckType(1)
|
||||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck) // 打开对话框
|
selectTestItemPopupRef.value?.open()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
dialogTitle.value = val
|
selectTestItemPopupRef.value?.open()
|
||||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck)
|
|
||||||
}
|
}
|
||||||
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();
|
socketClient.Instance.connect();
|
||||||
dataSocket.socketServe = socketClient.Instance;
|
dataSocket.socketServe = socketClient.Instance;
|
||||||
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
||||||
@@ -1006,23 +987,39 @@ const handleTest = async (val: string) => {
|
|||||||
|
|
||||||
channelsTest.value?.open(channelsSelection.value, props.plan)
|
channelsTest.value?.open(channelsSelection.value, props.plan)
|
||||||
return
|
return
|
||||||
}
|
} else {
|
||||||
|
checkStore.setCheckType(1)
|
||||||
if (devTestedNum == 0) {
|
checkStore.initSelectTestItems()
|
||||||
ElMessageBox.confirm(
|
// 一键检测
|
||||||
'请先选择检测完成状态的被检设备',
|
if (testType === 'reTest') {
|
||||||
'提示',
|
ElMessageBox.confirm('请选择复检检测方式', '设备复检',
|
||||||
{
|
{
|
||||||
confirmButtonText: '确定',
|
distinguishCancelAndClose: true,
|
||||||
cancelButtonText: '取消',
|
confirmButtonText: '不合格项复检',
|
||||||
|
cancelButtonText: '全部复检',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
},
|
})
|
||||||
)
|
.then(() => {
|
||||||
return
|
ElMessage.success('不合格项复检')
|
||||||
|
if (checkStore.devices.length > 1) {
|
||||||
|
checkStore.setReCheckType(1)
|
||||||
|
} else {
|
||||||
|
checkStore.setReCheckType(0)
|
||||||
|
}
|
||||||
|
openTestDialog()
|
||||||
|
})
|
||||||
|
.catch((action: Action) => {
|
||||||
|
ElMessage.success('全部复检')
|
||||||
|
checkStore.setReCheckType(1)
|
||||||
|
openTestDialog()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
openTestDialog()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (val === '批量下载') {
|
if (val === '批量下载') {
|
||||||
reportDialogVisible.value = true
|
reportDialogVisible.value = true
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1046,8 +1043,10 @@ const handleTest = async (val: string) => {
|
|||||||
|
|
||||||
emit('batchGenerateClicked') // 触发事件
|
emit('batchGenerateClicked') // 触发事件
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const openTestDialog = () => {
|
||||||
|
testPopup.value?.open(dialogTitle.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开 drawer(新增、查看、编辑)
|
// 打开 drawer(新增、查看、编辑)
|
||||||
@@ -1063,24 +1062,26 @@ const openDrawer = async (title: string, row: any) => {
|
|||||||
|
|
||||||
|
|
||||||
if (title === '报告生成') {
|
if (title === '报告生成') {
|
||||||
await generateDevReport({ 'planId': checkStore.planId, 'devId': row.id })
|
await generateDevReport({'planId': checkStore.plan.id, 'devId': row.id})
|
||||||
emit('batchGenerateClicked') // 触发事件
|
emit('batchGenerateClicked') // 触发事件
|
||||||
ElMessage.success({ message: `报告生成成功!` })
|
ElMessage.success({message: `报告生成成功!`})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title === '报告下载') {
|
if (title === '报告下载') {
|
||||||
await useDownload(downloadDevData, row.createId, {
|
await useDownload(downloadDevData, row.createId, {
|
||||||
planId: checkStore.planId,
|
planId: checkStore.plan.id,
|
||||||
devId: row.id,
|
devId: row.id,
|
||||||
}, false, '.docx')
|
}, false, '.docx')
|
||||||
emit('batchGenerateClicked') // 触发事件
|
emit('batchGenerateClicked') // 触发事件
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title === '检测数据查询') {
|
if (title === '检测数据查询') {
|
||||||
|
checkStore.setShowDetailType(0)
|
||||||
dataCheckPopupRef.value?.open(row.id, '-1', null)
|
dataCheckPopupRef.value?.open(row.id, '-1', null)
|
||||||
}
|
}
|
||||||
if (title === '误差体系更换') {
|
if (title === '误差体系更换') {
|
||||||
dataCheckChangeErrSysDialogVisible.value = true
|
checkStore.setShowDetailType(1)
|
||||||
|
dataCheckPopupRef.value?.open(row.id, '-1', null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1121,7 +1122,7 @@ watch(
|
|||||||
handleRefresh()
|
handleRefresh()
|
||||||
// 调用获取数据的方法
|
// 调用获取数据的方法
|
||||||
},
|
},
|
||||||
{ immediate: true }, // 立即执行一次
|
{immediate: true}, // 立即执行一次
|
||||||
)
|
)
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
@@ -1139,7 +1140,7 @@ onBeforeMount(async () => {
|
|||||||
|
|
||||||
const handleQuitClicked = () => {
|
const handleQuitClicked = () => {
|
||||||
//console.log('handleQuitClicked')
|
//console.log('handleQuitClicked')
|
||||||
dataSocket.socketServe.closeWs()
|
//dataSocket.socketServe.closeWs()
|
||||||
emit('batchGenerateClicked') // 触发事件
|
emit('batchGenerateClicked') // 触发事件
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1153,7 +1154,7 @@ const handleSubmitClicked = async (resolve: (value: boolean) => void) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({ changeActiveTabs })
|
defineExpose({changeActiveTabs})
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
/* 当屏幕宽度小于或等于1300像素时 */
|
/* 当屏幕宽度小于或等于1300像素时 */
|
||||||
|
|||||||
@@ -1,11 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
<div class="dialog" v-bind="dialogBig">
|
<div class="dialog" v-bind="dialogBig">
|
||||||
<div class="dialog-title">
|
<div class="dialog-title">
|
||||||
|
<div class="timeView">
|
||||||
|
<el-icon style="margin: 0px 5px;">
|
||||||
|
<Clock/>
|
||||||
|
</el-icon>
|
||||||
|
<span>检测用时:{{ timeView }}</span>
|
||||||
|
</div>
|
||||||
<el-progress
|
<el-progress
|
||||||
style="width: 90%"
|
style="width: 60%; margin-right: 4%;"
|
||||||
:percentage="percentage"
|
:percentage="percentage"
|
||||||
:color="customColors"/>
|
:color="customColors"/>
|
||||||
|
|
||||||
|
<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
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
v-if="testStatus=='process' && percentage < 100"
|
v-if="testStatus=='process' && percentage < 100"
|
||||||
@@ -36,12 +51,12 @@
|
|||||||
<!-- :icon="Failed"-->
|
<!-- :icon="Failed"-->
|
||||||
<!-- disabled>连接超时-->
|
<!-- disabled>连接超时-->
|
||||||
<!-- </el-button>-->
|
<!-- </el-button>-->
|
||||||
<el-button
|
<!-- <el-button-->
|
||||||
type="primary"
|
<!-- type="primary"-->
|
||||||
:icon="RefreshLeft"
|
<!-- :icon="RefreshLeft"-->
|
||||||
v-if="testStatus === 'test_recheck'"
|
<!-- v-if="testStatus === 'recheck'"-->
|
||||||
@click="emit('sendReCheck')">重新检测
|
<!-- @click="emit('sendReCheck')">重新检测-->
|
||||||
</el-button>
|
<!-- </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>
|
||||||
@@ -54,7 +69,8 @@
|
|||||||
@click="emit('sendResume')"
|
@click="emit('sendResume')"
|
||||||
>继续检测
|
>继续检测
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
|
</div>
|
||||||
|
<el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
@@ -95,37 +111,37 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else>
|
<!-- <template v-else>-->
|
||||||
<el-table-column v-for="(item,index1) in deviceList" :key="item.deviceId" :label="item.deviceName" :min-width="110" align="center">
|
<!-- <el-table-column v-for="(item,index1) in deviceList" :key="item.deviceId" :label="item.deviceName" :min-width="110" align="center">-->
|
||||||
<template #default="{row}">
|
<!-- <template #default="{row}">-->
|
||||||
<el-tooltip
|
<!-- <el-tooltip-->
|
||||||
:content="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
|
<!-- :content="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"-->
|
||||||
placement="top">
|
<!-- placement="top">-->
|
||||||
<el-button
|
<!-- <el-button-->
|
||||||
:disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.LOADING"
|
<!-- :disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.LOADING"-->
|
||||||
:color="row.devices[index1].chnResult[0].color"
|
<!-- :color="row.devices[index1].chnResult[0].color"-->
|
||||||
size="small"
|
<!-- size="small"-->
|
||||||
@click="handleClick(item,-1,row.scriptType)"
|
<!-- @click="handleClick(item,-1,row.scriptType)"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-icon v-if="row.devices[index1].chnResult[0].icon==='Loading'" class="loading-box"
|
<!-- <el-icon v-if="row.devices[index1].chnResult[0].icon==='Loading'" class="loading-box"-->
|
||||||
style="color: #fff">
|
<!-- style="color: #fff">-->
|
||||||
<component :is="Loading"/>
|
<!-- <component :is="Loading"/>-->
|
||||||
</el-icon>
|
<!-- </el-icon>-->
|
||||||
<el-icon v-else style="color: #fff">
|
<!-- <el-icon v-else style="color: #fff">-->
|
||||||
<component :is="row.devices[index1].chnResult[0].icon"/>
|
<!-- <component :is="row.devices[index1].chnResult[0].icon"/>-->
|
||||||
</el-icon>
|
<!-- </el-icon>-->
|
||||||
</el-button>
|
<!-- </el-button>-->
|
||||||
</el-tooltip>
|
<!-- </el-tooltip>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-table-column>
|
<!-- </el-table-column>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="drawer-container">
|
<div class="drawer-container">
|
||||||
<el-drawer v-model="drawer" title="检测项进度">
|
<el-drawer v-model="drawer" title="检测项进度" direction="btt">
|
||||||
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;">
|
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;">
|
||||||
<p v-for="(item, index) in testLogList"
|
<p v-for="(item, index) in testLogList"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -136,15 +152,15 @@
|
|||||||
</el-drawer>
|
</el-drawer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<resultPopup
|
<!-- <resultPopup-->
|
||||||
:visible="resultDialogVisible"
|
<!-- :visible="resultDialogVisible"-->
|
||||||
@update:visible="resultDialogVisible = $event"
|
<!-- @update:visible="resultDialogVisible = $event"-->
|
||||||
></resultPopup>
|
<!-- ></resultPopup>-->
|
||||||
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
|
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup name="test">
|
<script lang="tsx" setup name="test">
|
||||||
import {Check, Failed, InfoFilled, Loading, Refresh, RefreshLeft, VideoPause, VideoPlay} from '@element-plus/icons-vue'
|
import {Check, InfoFilled, Loading, Refresh, VideoPause, VideoPlay} from '@element-plus/icons-vue'
|
||||||
import resultPopup from './resultPopup.vue'
|
|
||||||
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
||||||
import {computed, reactive, ref, toRef, watch} from "vue";
|
import {computed, reactive, ref, toRef, watch} from "vue";
|
||||||
import {dialogBig} from "@/utils/elementBind";
|
import {dialogBig} from "@/utils/elementBind";
|
||||||
@@ -152,7 +168,6 @@ import {CheckData} from "@/api/check/interface"
|
|||||||
import {useCheckStore} from "@/stores/modules/check";
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
import {ElMessage, ElMessageBox} from "element-plus";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
import {getBigTestItem} from "@/api/check/test";
|
import {getBigTestItem} from "@/api/check/test";
|
||||||
import {tryHideFullScreenLoading} from "@/components/Loading/fullScreen";
|
|
||||||
|
|
||||||
const checkStore = useCheckStore()
|
const checkStore = useCheckStore()
|
||||||
|
|
||||||
@@ -167,6 +182,9 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'waiting'
|
default: 'waiting'
|
||||||
},
|
},
|
||||||
|
stepsActive: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
webMsgSend: {
|
webMsgSend: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
@@ -178,7 +196,7 @@ const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause',
|
|||||||
// 用来保存测试项进度抽屉是否打开
|
// 用来保存测试项进度抽屉是否打开
|
||||||
const drawer = ref(false)
|
const drawer = ref(false)
|
||||||
// 进度条颜色
|
// 进度条颜色
|
||||||
const customColors = [{color: "#5cb87a", percentage: 100}]
|
const customColors = [{color: "#67c23a", percentage: 100}]
|
||||||
// 检测脚本数据
|
// 检测脚本数据
|
||||||
let scriptData: CheckData.ScriptItem[] = []
|
let scriptData: CheckData.ScriptItem[] = []
|
||||||
// 用来保存被检设备
|
// 用来保存被检设备
|
||||||
@@ -187,6 +205,10 @@ const deviceList = reactive<CheckData.Device[]>([])
|
|||||||
let activeIndex = 0
|
let activeIndex = 0
|
||||||
// 百分比
|
// 百分比
|
||||||
const percentage = ref(0);
|
const percentage = ref(0);
|
||||||
|
// 时间计数器
|
||||||
|
let timer: any = null
|
||||||
|
const timeCount = ref(0)
|
||||||
|
const timeView = ref('00:00:00')
|
||||||
//测试项开始检测时间(或继续检测时间)
|
//测试项开始检测时间(或继续检测时间)
|
||||||
const startData = ref(new Date())
|
const startData = ref(new Date())
|
||||||
//测试项检测结束时间(或暂停时的时间)
|
//测试项检测结束时间(或暂停时的时间)
|
||||||
@@ -202,7 +224,7 @@ const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无
|
|||||||
const testStatus = toRef(props, 'testStatus')
|
const testStatus = toRef(props, 'testStatus')
|
||||||
const webMsgSend = toRef(props, 'webMsgSend')
|
const webMsgSend = toRef(props, 'webMsgSend')
|
||||||
|
|
||||||
const resultDialogVisible = ref(false)
|
// const resultDialogVisible = ref(false)
|
||||||
const scrollContainerRef = ref();
|
const scrollContainerRef = ref();
|
||||||
const dataCheckSingleChannelSingleTestPopupRef = ref<InstanceType<typeof dataCheckSingleChannelSingleTestPopup>>()
|
const dataCheckSingleChannelSingleTestPopupRef = ref<InstanceType<typeof dataCheckSingleChannelSingleTestPopup>>()
|
||||||
|
|
||||||
@@ -253,40 +275,41 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
let tempChnResult: CheckData.ChnCheckResultEnum = device.chnResult[0]
|
|
||||||
if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.ERRORDATA)) {
|
|
||||||
tempChnResult = CheckData.ChnCheckResultEnum.ERRORDATA
|
|
||||||
}
|
|
||||||
if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.FAIL)) {
|
|
||||||
tempChnResult = CheckData.ChnCheckResultEnum.FAIL
|
|
||||||
}
|
|
||||||
if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.TIMEOUT)) {
|
|
||||||
tempChnResult = CheckData.ChnCheckResultEnum.TIMEOUT
|
|
||||||
}
|
|
||||||
switch (tempChnResult) {
|
|
||||||
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
|
||||||
break;
|
|
||||||
case CheckData.ChnCheckResultEnum.LOADING:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
|
||||||
break;
|
|
||||||
case CheckData.ChnCheckResultEnum.SUCCESS:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.SUCCESS, icon: 'CircleCheckFilled'})
|
|
||||||
break;
|
|
||||||
case CheckData.ChnCheckResultEnum.FAIL:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.DANGER, icon: 'Close'})
|
|
||||||
break;
|
|
||||||
case CheckData.ChnCheckResultEnum.TIMEOUT:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'})
|
|
||||||
break;
|
|
||||||
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
|
||||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// let tempChnResult: CheckData.ChnCheckResultEnum = device.chnResult[0]
|
||||||
|
// if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.ERRORDATA)) {
|
||||||
|
// tempChnResult = CheckData.ChnCheckResultEnum.ERRORDATA
|
||||||
|
// }
|
||||||
|
// if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.FAIL)) {
|
||||||
|
// tempChnResult = CheckData.ChnCheckResultEnum.FAIL
|
||||||
|
// }
|
||||||
|
// if (device.chnResult.some(item => item == CheckData.ChnCheckResultEnum.TIMEOUT)) {
|
||||||
|
// tempChnResult = CheckData.ChnCheckResultEnum.TIMEOUT
|
||||||
|
// }
|
||||||
|
// switch (tempChnResult) {
|
||||||
|
// case CheckData.ChnCheckResultEnum.UNKNOWN:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
||||||
|
// break;
|
||||||
|
// case CheckData.ChnCheckResultEnum.LOADING:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
||||||
|
// break;
|
||||||
|
// case CheckData.ChnCheckResultEnum.SUCCESS:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.SUCCESS, icon: 'CircleCheckFilled'})
|
||||||
|
// break;
|
||||||
|
// case CheckData.ChnCheckResultEnum.FAIL:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.DANGER, icon: 'Close'})
|
||||||
|
// break;
|
||||||
|
// case CheckData.ChnCheckResultEnum.TIMEOUT:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'})
|
||||||
|
// break;
|
||||||
|
// case CheckData.ChnCheckResultEnum.ERRORDATA:
|
||||||
|
// tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
temp.devices.push({
|
temp.devices.push({
|
||||||
deviceId: device.deviceId,
|
deviceId: device.deviceId,
|
||||||
@@ -303,28 +326,30 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
|
|||||||
watch(testStatus, function (newValue, oldValue) {
|
watch(testStatus, function (newValue, oldValue) {
|
||||||
if (newValue == 'start') {
|
if (newValue == 'start') {
|
||||||
ElMessage.success('初始化开始!')
|
ElMessage.success('初始化开始!')
|
||||||
|
startTimeCount()
|
||||||
|
|
||||||
showTestLog()
|
showTestLog()
|
||||||
|
|
||||||
if (oldValue == 'error') {
|
// if (oldValue == 'recheck' || oldValue == 'error' || oldValue == 'test_init_fail' || oldValue == 'connect_timeout' || oldValue == 'pause_timeout' || oldValue == 'error_flow_end') {
|
||||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!`})
|
// handleReCheck()
|
||||||
|
// }
|
||||||
initCheckResult()
|
|
||||||
activeIndex = 0
|
|
||||||
percentage.value = 0
|
|
||||||
}
|
|
||||||
emit('update:testStatus', 'test_init')
|
emit('update:testStatus', 'test_init')
|
||||||
//startTimer() // todo 可移除
|
//startTimer() // todo 可移除
|
||||||
startData.value = new Date();
|
startData.value = new Date();
|
||||||
timeDifference.value = 0;
|
timeDifference.value = 0;
|
||||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`})
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newValue == 'recheck' || newValue == 'error' || newValue == 'test_init_fail' || newValue == 'connect_timeout' || newValue == 'pause_timeout' || oldValue == 'error_flow_end') {
|
||||||
|
stopTimeCount()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 次数
|
// 次数
|
||||||
let count = 0
|
let count = 0
|
||||||
|
|
||||||
watch(webMsgSend, function (newValue, oldValue) {
|
watch(webMsgSend, function (newValue, oldValue) {
|
||||||
|
if (props.stepsActive === 4) {
|
||||||
if (newValue.code == 10520) {
|
if (newValue.code == 10520) {
|
||||||
ElMessageBox.alert('报文解析异常!', '初始化失败', {
|
ElMessageBox.alert('报文解析异常!', '初始化失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@@ -410,7 +435,8 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
log: `${new Date().toLocaleString()}:存在已经初始化步骤,执行自动关闭,请重新发起检测!`
|
log: `${new Date().toLocaleString()}:存在已经初始化步骤,执行自动关闭,请重新发起检测!`
|
||||||
})
|
})
|
||||||
emit('update:testStatus', 'test_recheck')
|
// emit('update:testStatus', 'recheck')
|
||||||
|
emit('update:testStatus', 'test_init_fail')
|
||||||
} else {
|
} else {
|
||||||
switch (newValue.requestId) {
|
switch (newValue.requestId) {
|
||||||
case 'server_error':
|
case 'server_error':
|
||||||
@@ -615,7 +641,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, {deep: true})
|
}, {deep: true})
|
||||||
|
|
||||||
const handleStartItem = (code: string, desc: string | undefined) => {
|
const handleStartItem = (code: string, desc: string | undefined) => {
|
||||||
@@ -624,8 +650,8 @@ const handleStartItem = (code: string, desc: string | undefined) => {
|
|||||||
updateCheckResultView(code, true)
|
updateCheckResultView(code, true)
|
||||||
updateLog(true)
|
updateLog(true)
|
||||||
} else {
|
} else {
|
||||||
if (desc.length > 60) {
|
if (desc.length > 150) {
|
||||||
desc = desc.substring(0, 60) + '...'
|
desc = desc.substring(0, 150) + '...'
|
||||||
}
|
}
|
||||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:${desc}准确度检测:开始`})
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:${desc}准确度检测:开始`})
|
||||||
}
|
}
|
||||||
@@ -642,8 +668,8 @@ const handleEndItem = (code: string, desc: string | undefined, devices: CheckDat
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let result = getResult(devices)
|
let result = getResult(devices)
|
||||||
if (desc.length > 60) {
|
if (desc.length > 150) {
|
||||||
desc = desc.substring(0, 60) + '...'
|
desc = desc.substring(0, 150) + '...'
|
||||||
}
|
}
|
||||||
if (result === 1) {
|
if (result === 1) {
|
||||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:${desc}检测结束:符合`})
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:${desc}检测结束:符合`})
|
||||||
@@ -700,7 +726,7 @@ const showTestLog = () => {
|
|||||||
// 初始化检测脚本数据
|
// 初始化检测脚本数据
|
||||||
const initScriptData = async () => {
|
const initScriptData = async () => {
|
||||||
|
|
||||||
let response: any = await getBigTestItem(checkStore.planId)
|
let response: any = await getBigTestItem({reCheckType:checkStore.reCheckType, planId:checkStore.plan.id,devId:checkStore.devices[0].deviceId})
|
||||||
|
|
||||||
let temp = response.data.map(item => {
|
let temp = response.data.map(item => {
|
||||||
return {
|
return {
|
||||||
@@ -767,7 +793,7 @@ const updateCheckResult = (data: CheckData.ScriptChnItem) => {
|
|||||||
|
|
||||||
const scrollToBottom = () => {
|
const scrollToBottom = () => {
|
||||||
if (scrollContainerRef.value) {
|
if (scrollContainerRef.value) {
|
||||||
scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight;
|
scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight + 70;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -850,11 +876,13 @@ const updateLog = (isStart: boolean) => {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timeView.value = secondToTime(timeDifference.value / 1000)
|
||||||
if (activeIndex === checkTotal) {
|
if (activeIndex === checkTotal) {
|
||||||
testLogList.push({
|
testLogList.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log: currentTime.value + ' :检测结束,总用时' + getTimeDifference(timeDifference.value),
|
log: currentTime.value + ' :检测结束,总用时' + getTimeDifference(timeDifference.value),
|
||||||
})
|
})
|
||||||
|
stopTimeCount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -893,6 +921,11 @@ const setErrorCheckItem = (scriptType: string, devices: CheckData.DeviceCheckRes
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
log: `${new Date().toLocaleString()} :${devices[i].deviceName}连接超时`,
|
log: `${new Date().toLocaleString()} :${devices[i].deviceName}连接超时`,
|
||||||
})
|
})
|
||||||
|
ElMessageBox.alert('连接超时!', '连接超时', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
emit('update:testStatus', 'connect_timeout')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -914,9 +947,9 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch
|
|||||||
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
|
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
|
||||||
// devices = [
|
// devices = [
|
||||||
// {
|
// {
|
||||||
// chnResult: [3, 4],
|
// chnResult: [1, 1, 1, 1],
|
||||||
// deviceId: "80b4b4f52a4c4064a18319525f8ac13c",
|
// deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||||
// deviceName: "240002"
|
// deviceName: "250226001"
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// chnResult: [1, 1, 1, 1],
|
// chnResult: [1, 1, 1, 1],
|
||||||
@@ -927,7 +960,7 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch
|
|||||||
// chnResult: [1, 1, 1, 1],
|
// chnResult: [1, 1, 1, 1],
|
||||||
// deviceId: "ae5a7628260349c0a5e7c86c81fbd417",
|
// deviceId: "ae5a7628260349c0a5e7c86c81fbd417",
|
||||||
// deviceName: "240004"
|
// deviceName: "240004"
|
||||||
// }
|
// },
|
||||||
// {
|
// {
|
||||||
// chnResult: [1, 1, 1, 1],
|
// chnResult: [1, 1, 1, 1],
|
||||||
// deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
// deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
||||||
@@ -1084,6 +1117,7 @@ const handleClick = (item: any, chnNum: number, scriptType: string) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (flag === -1 || flag === 1) {
|
if (flag === -1 || flag === 1) {
|
||||||
|
checkStore.setShowDetailType(0)
|
||||||
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType);
|
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1222,6 +1256,7 @@ const pauseSuccessCallback = () => {
|
|||||||
type: 'info',
|
type: 'info',
|
||||||
log: `${new Date().toLocaleString()}:暂停检测`,
|
log: `${new Date().toLocaleString()}:暂停检测`,
|
||||||
})
|
})
|
||||||
|
stopTimeCount()
|
||||||
console.log('暂停中')
|
console.log('暂停中')
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1233,7 +1268,7 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_Start`,
|
requestId: `${code}_Start`,
|
||||||
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
@@ -1241,11 +1276,11 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_End`,
|
requestId: `${code}_End`,
|
||||||
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
desc: '输入:频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||||
data: [{
|
data: [{
|
||||||
chnResult: [1, 1, 1, 1],
|
chnResult: [1, 1, 1, 1],
|
||||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||||
deviceName: "25011407"
|
deviceName: "250226001"
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1254,7 +1289,7 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_Start`,
|
requestId: `${code}_Start`,
|
||||||
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, 3000)
|
}, 3000)
|
||||||
@@ -1262,11 +1297,11 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_End`,
|
requestId: `${code}_End`,
|
||||||
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
desc: '输入:频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||||
data: [{
|
data: [{
|
||||||
chnResult: [1, 1, 1, 1],
|
chnResult: [1, 1, 1, 1],
|
||||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||||
deviceName: "25011407"
|
deviceName: "250226001"
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1275,7 +1310,7 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_Start`,
|
requestId: `${code}_Start`,
|
||||||
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, 6000)
|
}, 6000)
|
||||||
@@ -1283,11 +1318,11 @@ const todoItem = (code: string) => {
|
|||||||
if (testStatus.value !== 'paused') {
|
if (testStatus.value !== 'paused') {
|
||||||
emit('update:webMsgSend', {
|
emit('update:webMsgSend', {
|
||||||
requestId: `${code}_End`,
|
requestId: `${code}_End`,
|
||||||
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
desc: '输入:频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
|
||||||
data: [{
|
data: [{
|
||||||
chnResult: [1, 2, 1, 1],
|
chnResult: [1, 1, 1, 1],
|
||||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||||
deviceName: "25011407"
|
deviceName: "250226001"
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1298,8 +1333,8 @@ const todoItem = (code: string) => {
|
|||||||
requestId: `${code}_End`,
|
requestId: `${code}_End`,
|
||||||
data: [{
|
data: [{
|
||||||
chnResult: [1, 2, 1, 1],
|
chnResult: [1, 2, 1, 1],
|
||||||
deviceId: "461813a4f30f4a34a1a273ecd0379458",
|
deviceId: "e90c09c0905248ad912e19e17a8672aa",
|
||||||
deviceName: "25011407"
|
deviceName: "250226001"
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1309,20 +1344,26 @@ const todoItem = (code: string) => {
|
|||||||
const handleResumeTest = () => {
|
const handleResumeTest = () => {
|
||||||
//activeIndex++
|
//activeIndex++
|
||||||
startData.value = new Date();
|
startData.value = new Date();
|
||||||
testLogList.push({
|
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!`})
|
||||||
type: 'info',
|
|
||||||
log: `${new Date().toLocaleString()}:继续检测`,
|
|
||||||
})
|
|
||||||
//startTimer()
|
//startTimer()
|
||||||
|
resumeTimeCount()
|
||||||
console.log('开始继续检测')
|
console.log('开始继续检测')
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleReCheck = () => {
|
const handleReCheck = () => {
|
||||||
|
initCheckResult()
|
||||||
activeIndex = 0
|
activeIndex = 0
|
||||||
percentage.value = 0
|
percentage.value = 0
|
||||||
|
timeCount.value = 0
|
||||||
|
timeView.value = '00:00:00'
|
||||||
|
timeDifference.value = 0
|
||||||
testLogList.length = 0
|
testLogList.length = 0
|
||||||
|
|
||||||
errorCheckItem.length = 0
|
errorCheckItem.length = 0
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
|
showTestLog()
|
||||||
|
//handleResumeTest()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前执行的大测试项序号
|
// 获取当前执行的大测试项序号
|
||||||
@@ -1347,7 +1388,46 @@ const getNextActiveIndex = (code: string = ''): number => {
|
|||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
const startTimeCount = () => {
|
||||||
|
if (!timer) {
|
||||||
|
timer = setInterval(() => {
|
||||||
|
timeCount.value = timeCount.value + 1
|
||||||
|
timeView.value = secondToTime(timeCount.value)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const stopTimeCount = () => {
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const resumeTimeCount = () => {
|
||||||
|
timer = setInterval(() => {
|
||||||
|
timeCount.value = timeCount.value + 1
|
||||||
|
timeView.value = secondToTime(timeCount.value)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const secondToTime = (second: number) => {
|
||||||
|
//将秒数转换成时分秒
|
||||||
|
let h: string | number = Math.floor(second / 3600)
|
||||||
|
let m: string | number = Math.floor((second - h * 3600) / 60)
|
||||||
|
let s: string | number = Math.floor(second % 60);
|
||||||
|
|
||||||
|
h = h < 10 ? '0' + h : h;
|
||||||
|
m = m < 10 ? '0' + m : m;
|
||||||
|
s = s < 10 ? '0' + s : s;
|
||||||
|
return h + ':' + m + ':' + s;
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer)
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -1389,11 +1469,24 @@ const getNextActiveIndex = (code: string = ''): number => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dialog-title {
|
.dialog-title {
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.timeView {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
color: #67c23a;;
|
||||||
|
width: 28%;
|
||||||
|
margin-right: 0px;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-content {
|
.dialog-content {
|
||||||
|
|||||||
@@ -1,41 +1,44 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" :model-value="dialogVisible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px"
|
<el-dialog :title="dialogTitle" width="1550px" :model-value="dialogVisible" :before-close="beforeClose" @close="handleClose" height="1000px" draggable>
|
||||||
draggable>
|
|
||||||
|
|
||||||
<div class="steps-container">
|
<div class="steps-container">
|
||||||
<!-- simple -->
|
|
||||||
<!-- :style="{color:node.label=='未检'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" -->
|
|
||||||
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
|
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
|
||||||
<!-- style="height:100px" -->
|
<el-step v-if="preTestSelected" title="预检测" :icon="stepsActive > 1 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Edit" @click="handleStepClick(1)"/>
|
||||||
<!-- <el-step title="预检测" :icon="getIcon(0)" /> -->
|
<el-step v-if="timeTestSelected" title="守时检测" :icon="stepsActive > 2 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :UploadFilled" @click="handleStepClick(2)"/>
|
||||||
<el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit"/>
|
<el-step v-if="channelsTestSelected" title="系数校准" :icon="stepsActive > 3 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Odometer" @click="handleStepClick(3)"/>
|
||||||
<el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled" v-if="isTimeCheck"/>
|
<el-step v-if="testSelected" title="正式检测" :icon="stepsActive > 4 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Coin" @click="handleStepClick(4)"/>
|
||||||
<!-- <el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" /> -->
|
<el-step title="检测完成" :icon="stepsActiveIndex > stepsTotalNum-1 ? SuccessFilled :Key"/>
|
||||||
<el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin"/>
|
|
||||||
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key"/>
|
|
||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</div>
|
||||||
<preTest ref="preTestRef" v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest>
|
|
||||||
<timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
|
<preTest v-if="showComponent&&preTestSelected" v-show="preTestSelected && stepsActiveView==1" ref="preTestRef" v-model:testStatus="preTestStatus"
|
||||||
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
|
:webMsgSend="webMsgSend"/>
|
||||||
<test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"
|
<timeTest v-if="showComponent&&timeTestSelected" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/>
|
||||||
@sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck"></test>
|
<!-- <channelsTest v-if="stepsActiveIndex === 3" v-model:testStatus="channelsTestStatus"></channelsTest>-->
|
||||||
|
<factorTest v-if="showComponent&&channelsTestSelected" v-show="channelsTestSelected && stepsActiveView==3" v-model:testStatus="channelsTestStatus" :webMsgSend="webMsgSend"/>
|
||||||
|
<test v-if="showComponent&&testSelected" 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>
|
<template #footer>
|
||||||
<div>
|
<div>
|
||||||
<!-- <el-button @click="handleCancel">取 消</el-button> -->
|
<!-- <el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < stepsTotalNum && ActiveStatue != 'success'" @click="nextStep">跳过</el-button>-->
|
||||||
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled"
|
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
|
||||||
@click="nextStep">跳过
|
<el-button type="primary"
|
||||||
</el-button>
|
v-if="(stepsActiveIndex <= stepsTotalNum - 1) && (ActiveStatue !== 'success' &&ActiveStatue !== 'test_init' && ActiveStatue !=='paused_ing' && ActiveStatue !=='paused' && ActiveStatue !== 'waiting' && ActiveStatue !== 'error' && ActiveStatue !== 'test_init_fail' && ActiveStatue !== 'connect_timeout' && ActiveStatue!=='pause_timeout')"
|
||||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit" :disabled="btnState">开始检测</el-button>
|
disabled>
|
||||||
<el-button type="primary" v-if="TestStatus === 'process'" @click="handleSubmit" disabled>
|
|
||||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||||
<component :is="Refresh"/>
|
<component :is="Refresh"/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
检测中
|
检测中
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<!-- <el-button type="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="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="RefreshLeft" v-if="ActiveStatue === 'recheck' || ActiveStatue ==='error' || ActiveStatue ==='test_init_fail' || ActiveStatue === 'pause_timeout' || ActiveStatue === 'connect_timeout'" @click="handleSubmit">重新检测</el-button>-->
|
||||||
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
|
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
|
||||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||||
<component :is="Refresh"/>
|
<component :is="Refresh"/>
|
||||||
@@ -49,7 +52,7 @@
|
|||||||
暂停中
|
暂停中
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
||||||
v-if="ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout'"
|
v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
|
||||||
@click="nextStep">
|
@click="nextStep">
|
||||||
{{ nextStepText }}
|
{{ nextStepText }}
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -61,108 +64,25 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="tsx" setup name="testPopup">
|
<script lang="tsx" setup name="testPopup">
|
||||||
import {h, reactive, ref, watch} from 'vue';
|
import {reactive, ref, watch} from 'vue';
|
||||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
import {Coin, DArrowRight, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPlay} from '@element-plus/icons-vue'
|
||||||
import {
|
|
||||||
Close,
|
|
||||||
Coin,
|
|
||||||
DArrowRight,
|
|
||||||
Edit,
|
|
||||||
Key,
|
|
||||||
Odometer,
|
|
||||||
Refresh,
|
|
||||||
Right,
|
|
||||||
SuccessFilled,
|
|
||||||
UploadFilled,
|
|
||||||
VideoPlay,
|
|
||||||
RefreshLeft, Loading
|
|
||||||
} from '@element-plus/icons-vue'
|
|
||||||
import preTest from './preTest.vue'
|
import preTest from './preTest.vue'
|
||||||
import timeTest from './timeTest.vue'
|
import timeTest from './timeTest.vue'
|
||||||
import {Device} from '@/api/device/interface/device';
|
import factorTest from './factorTest.vue'
|
||||||
|
import test from './test.vue'
|
||||||
import socketClient from '@/utils/webSocketClient';
|
import socketClient from '@/utils/webSocketClient';
|
||||||
import {useCheckStore} from "@/stores/modules/check";
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
import {startPreTest, pauseTest, resumeTest} from '@/api/socket/socket'
|
import {pauseTest, resumeTest, startPreTest} from '@/api/socket/socket'
|
||||||
import {showFullScreenLoading} from "@/components/Loading/fullScreen";
|
|
||||||
|
|
||||||
|
|
||||||
//import SvgIcon from '@/components/SvgIcon.vue';
|
|
||||||
|
|
||||||
// import preTestIcon from '@/assets/icons/preTest.svg'
|
|
||||||
|
|
||||||
// const preTestIcon = `
|
|
||||||
// <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
|
|
||||||
// </svg>
|
|
||||||
// `;
|
|
||||||
// const props = defineProps<{
|
|
||||||
// visible: boolean;
|
|
||||||
// dialogTitle: string;
|
|
||||||
|
|
||||||
// formData: {
|
|
||||||
// id: string;//误差体系表Id
|
|
||||||
// name: string;//误差体系名称
|
|
||||||
// standard_Name:string;//参照标准名称
|
|
||||||
// standard_Time:string;//标准推行时间
|
|
||||||
// dev_Level:string;//使用设备等级
|
|
||||||
// enable:number;//状态:0-不启用 1-启用
|
|
||||||
// state:number;//0-删除 1-正常
|
|
||||||
// };
|
|
||||||
// }>();
|
|
||||||
|
|
||||||
// const emit = defineEmits<{
|
|
||||||
// (e: 'update:visible', value: boolean): void;
|
|
||||||
// (e: 'submit', data: any): void;
|
|
||||||
// }>();
|
|
||||||
const btnState = ref(false)
|
|
||||||
const checkStore = useCheckStore();
|
const checkStore = useCheckStore();
|
||||||
const skipDisabled = ref(false);
|
|
||||||
const nextStepText = ref('下一步');
|
const nextStepText = ref('下一步');
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
//定义与预检测配置数组
|
|
||||||
const detectionOptions = ref([
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: "源通讯检测",//判断源通讯是否正常
|
|
||||||
selected: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "设备通讯检测",//判断设备的IP、Port、识别码、秘钥是否正常
|
|
||||||
selected: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "协议校验",//ICD报告触发测试
|
|
||||||
selected: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: "相序校验",//判断装置的接线是否正确
|
|
||||||
selected: true,
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// id: 4,
|
|
||||||
// name: "守时校验",//判断装置24小时内的守时误差是否小于1s
|
|
||||||
// selected: true,
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 5,
|
|
||||||
// name: "通道系数校准",//通过私有协议与装置进行通讯,校准三相电压电流的通道系数
|
|
||||||
// selected: true,
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 6,
|
|
||||||
// name: "实时数据比对",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 7,
|
|
||||||
// name: "录波数据比对",
|
|
||||||
// },
|
|
||||||
]);
|
|
||||||
|
|
||||||
const stepsTotalNum = ref(4);//步骤总数
|
const stepsTotalNum = ref(-1);//步骤总数
|
||||||
const stepsActiveIndex = ref(0); //当前正在执行的步骤索引
|
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
|
||||||
|
const stepsActiveView = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
|
||||||
|
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态,用于切换步骤
|
||||||
const ActiveStatue = ref('waiting');//当前步骤状态
|
const ActiveStatue = ref('waiting');//当前步骤状态
|
||||||
const preTestStatus = ref('waiting');//预检测执行状态
|
const preTestStatus = ref('waiting');//预检测执行状态
|
||||||
const timeTestStatus = ref('waiting');//守时校验执行状态
|
const timeTestStatus = ref('waiting');//守时校验执行状态
|
||||||
@@ -170,124 +90,135 @@ const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
|||||||
const TestStatus = ref('waiting');//正式检测执行状态
|
const TestStatus = ref('waiting');//正式检测执行状态
|
||||||
const webMsgSend = ref();//webSocket推送的数据
|
const webMsgSend = ref();//webSocket推送的数据
|
||||||
|
|
||||||
const dialogTitle = ref('');
|
const dialogTitle = ref('')
|
||||||
const isTimeCheck = ref(false)
|
const showComponent = ref(true)
|
||||||
const preTestRef = ref(null);
|
const preTestRef = ref(null)
|
||||||
|
|
||||||
|
|
||||||
// const devIdArr = ref([])
|
|
||||||
// const planId = ref('')
|
|
||||||
|
|
||||||
const dataSocket = reactive({
|
const dataSocket = reactive({
|
||||||
socketServe: socketClient.Instance,
|
socketServe: socketClient.Instance,
|
||||||
});
|
});
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
|
||||||
const open = (selection: Device.ResPqDev[], title: string, time: boolean) => {
|
|
||||||
|
|
||||||
|
// 勾选的检测内容
|
||||||
|
const preTestSelected = ref(false)
|
||||||
|
const timeTestSelected = ref(false)
|
||||||
|
const channelsTestSelected = ref(false)
|
||||||
|
const testSelected = ref(false)
|
||||||
|
|
||||||
const checkStates = selection.map(item => item.checkState);
|
const initOperate = () => {
|
||||||
// devIdArr.value = selection.map(item => item.id);
|
ActiveStatue.value = 'waiting'
|
||||||
// planId.value =selection[0].planId
|
preTestStatus.value = 'waiting'
|
||||||
// console.log('wwwwwwwwwwwwwwwww',selection)
|
timeTestStatus.value = 'waiting'
|
||||||
|
channelsTestStatus.value = 'waiting'
|
||||||
|
TestStatus.value = 'waiting'
|
||||||
|
|
||||||
const allCheckStatesEqual = new Set(checkStates).size <= 1;
|
stepsActiveIndex.value = 1
|
||||||
|
showComponent.value = true
|
||||||
|
// 初始化勾选的检测内容
|
||||||
|
preTestSelected.value = checkStore.selectTestItems.preTest
|
||||||
|
timeTestSelected.value = checkStore.selectTestItems.timeTest
|
||||||
|
channelsTestSelected.value = checkStore.selectTestItems.channelsTest
|
||||||
|
testSelected.value = checkStore.selectTestItems.test
|
||||||
|
|
||||||
if (!allCheckStatesEqual) {
|
let count = 0
|
||||||
ElMessageBox.confirm(
|
for (let key in checkStore.selectTestItems) {
|
||||||
'所勾选设备检测状态不一致,请重新选择',
|
if (checkStore.selectTestItems[key]) {
|
||||||
'提示',
|
count++
|
||||||
{
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
stepsTotalNum.value = count + 1
|
||||||
|
|
||||||
|
if (preTestSelected.value) {
|
||||||
|
stepsActiveView.value = 1
|
||||||
|
stepsActive.value = 1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (timeTestSelected.value) {
|
||||||
|
stepsActiveView.value = 2
|
||||||
|
stepsActive.value = 2
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (channelsTestSelected.value) {
|
||||||
|
stepsActiveView.value = 3
|
||||||
|
stepsActive.value = 3
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (testSelected.value) {
|
||||||
|
stepsActiveView.value = 4
|
||||||
|
stepsActive.value = 4
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const open = (title: string) => {
|
||||||
|
initOperate()
|
||||||
dialogTitle.value = title;
|
dialogTitle.value = title;
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
isTimeCheck.value = time
|
|
||||||
|
|
||||||
if (preTestRef.value) {
|
if (preTestRef.value) {
|
||||||
preTestRef.value.initializeParameters();
|
preTestRef.value.initializeParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
preTestStatus.value = 'waiting';//预检测执行状态
|
|
||||||
//开始创建webSocket客户端
|
//开始创建webSocket客户端
|
||||||
|
|
||||||
socketClient.Instance.connect();
|
socketClient.Instance.connect();
|
||||||
dataSocket.socketServe = socketClient.Instance;
|
dataSocket.socketServe = socketClient.Instance;
|
||||||
dataSocket.socketServe.registerCallBack('aaa', (res) => {
|
dataSocket.socketServe.registerCallBack('aaa', (res) => {
|
||||||
// 处理来自服务器的消息
|
// 处理来自服务器的消息
|
||||||
// console.log('Received message:', res);
|
// console.log('Received message:', res);
|
||||||
// 根据需要在这里添加更多的处理逻辑
|
// 根据需要在这里添加更多的处理逻辑
|
||||||
|
|
||||||
if (res.code === 20000) {
|
if (res.code === 20000) {
|
||||||
ElMessage.error(message.message)
|
//ElMessage.error(message.message)
|
||||||
loading.close()
|
// loading.close()
|
||||||
} else {
|
} else {
|
||||||
webMsgSend.value = res
|
webMsgSend.value = res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let loading;
|
// let loading;
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
skipDisabled.value = true
|
|
||||||
//btnState.value = true
|
|
||||||
console.log('=============', stepsActiveIndex.value)
|
|
||||||
|
|
||||||
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
||||||
let planId = checkStore.planId
|
let planId = checkStore.plan.id
|
||||||
|
|
||||||
|
if (!dataSocket.socketServe.connected) {
|
||||||
if(!dataSocket.socketServe.connected){
|
|
||||||
ElMessage.error('webSocket连接中断!')
|
ElMessage.error('webSocket连接中断!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
console.log("handleSubmit",stepsActive.value,TestStatus.value)
|
||||||
switch (stepsActiveIndex.value) {
|
switch (stepsActive.value) {
|
||||||
case 0:
|
case 1:
|
||||||
// preTestStatus.value = 'start'
|
|
||||||
|
|
||||||
startPreTest({
|
startPreTest({
|
||||||
userPageId: "cdf",
|
userPageId: "cdf",
|
||||||
devIds: deviceIds,
|
devIds: deviceIds,
|
||||||
planId: planId,
|
planId: planId,
|
||||||
operateType: '1' // '1'为预检测、‘2‘为正式检测
|
operateType: '1' // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 'A001014') {
|
if (res.code === 'A001014') {
|
||||||
ElMessageBox.alert('装置配置异常', '检测失败', {
|
ElMessageBox.alert('装置配置异常', '检测失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
TestStatus.value = 'error'
|
preTestStatus.value = 'error'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
preTestStatus.value = 'start'
|
preTestStatus.value = 'start'
|
||||||
|
// setTimeout(() => {
|
||||||
|
// preTestStatus.value = 'success'
|
||||||
|
// }, 5000)
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 2:
|
||||||
timeTestStatus.value = 'start'
|
timeTestStatus.value = 'start'
|
||||||
break;
|
break;
|
||||||
// case 2:
|
case 3:
|
||||||
// channelsTestStatus.value = 'start'
|
// 调用系数校准组件的handleSubmit方法
|
||||||
// break;
|
channelsTestStatus.value = 'start'
|
||||||
case 2:
|
break;
|
||||||
|
case 4:
|
||||||
if (TestStatus.value == "waiting") {
|
if (TestStatus.value == "waiting") {
|
||||||
startPreTest({
|
startPreTest({
|
||||||
userPageId: "cdf",
|
userPageId: "cdf",
|
||||||
devIds: deviceIds,
|
devIds: deviceIds,
|
||||||
planId: planId,
|
planId: planId,
|
||||||
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
operateType: checkStore.reCheckType ==1 ?'2':'8' // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.code === 'A001014') {
|
if (res.code === 'A001014') {
|
||||||
@@ -297,31 +228,23 @@ const handleSubmit = () => {
|
|||||||
})
|
})
|
||||||
TestStatus.value = 'test_init_fail'
|
TestStatus.value = 'test_init_fail'
|
||||||
}
|
}
|
||||||
/* if (res.code === 20000) {
|
|
||||||
TestStatus.value = 'start'
|
|
||||||
webMsgSend.value = ''
|
|
||||||
} else {
|
|
||||||
ElMessage.error(res.message)
|
|
||||||
}*/
|
|
||||||
})
|
})
|
||||||
TestStatus.value = 'start'
|
TestStatus.value = 'start'
|
||||||
} else if (TestStatus.value == 'paused') {
|
} else if (TestStatus.value == 'paused') {
|
||||||
// 发送继续指令
|
// 发送继续指令
|
||||||
sendResume()
|
sendResume()
|
||||||
} else if (TestStatus.value == 'test_recheck') {
|
|
||||||
// 发送重新检测指令
|
|
||||||
sendReCheck()
|
|
||||||
|
|
||||||
|
|
||||||
}else if (TestStatus.value == 'success') {
|
|
||||||
emit('quitClicked'); // 触发事件
|
|
||||||
}
|
}
|
||||||
|
// else if (TestStatus.value == 'recheck') {
|
||||||
|
// // 发送重新检测指令
|
||||||
|
// sendReCheck()
|
||||||
|
// }
|
||||||
|
// else if (TestStatus.value == 'success') {
|
||||||
|
// handleClose()
|
||||||
|
// }
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -351,43 +274,50 @@ watch(TestStatus, function (newValue, oldValue) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
watch(ActiveStatue, function (newValue, oldValue) {
|
watch(ActiveStatue, function (newValue, oldValue) {
|
||||||
|
if (newValue === 'error') {
|
||||||
if (newValue === 'success' || newValue === 'error') {
|
// stepsActiveIndex.value = stepsTotalNum.value + 2
|
||||||
skipDisabled.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
|
||||||
stepsActiveIndex.value++;
|
|
||||||
stepsActiveIndex.value++;
|
|
||||||
nextStepText.value = '检测完成'
|
|
||||||
}
|
|
||||||
if (newValue === 'error' && stepsActiveIndex.value === stepsTotalNum.value - 3) {
|
|
||||||
stepsActiveIndex.value++;
|
|
||||||
stepsActiveIndex.value++;
|
|
||||||
nextStepText.value = '检测失败'
|
nextStepText.value = '检测失败'
|
||||||
}
|
}
|
||||||
if (newValue === 'test_init_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 1) {
|
||||||
stepsActiveIndex.value++;
|
stepsActiveIndex.value += 2
|
||||||
stepsActiveIndex.value++;
|
nextStepText.value = '检测完成'
|
||||||
|
}
|
||||||
|
if (newValue === 'test_init_fail') {
|
||||||
|
stepsActiveIndex.value += 2
|
||||||
nextStepText.value = '初始化失败'
|
nextStepText.value = '初始化失败'
|
||||||
}
|
}
|
||||||
if (newValue === 'connect_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
if (newValue === 'connect_timeout') {
|
||||||
stepsActiveIndex.value++;
|
stepsActiveIndex.value += 2
|
||||||
stepsActiveIndex.value++;
|
|
||||||
nextStepText.value = '连接超时'
|
nextStepText.value = '连接超时'
|
||||||
}
|
}
|
||||||
if (newValue === 'pause_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
if (newValue === 'pause_timeout') {
|
||||||
stepsActiveIndex.value++;
|
stepsActiveIndex.value += 2
|
||||||
stepsActiveIndex.value++;
|
// nextStepText.value = '结束测试'
|
||||||
nextStepText.value = '结束测试'
|
nextStepText.value = '暂停超时'
|
||||||
}
|
}
|
||||||
|
if (newValue === 'success' && stepsActiveIndex.value < stepsTotalNum.value - 1) {
|
||||||
|
nextStep() // 实现自动点击,进入下一个测试内容
|
||||||
|
handleSubmit()
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const sendPause = () => {
|
const sendPause = () => {
|
||||||
console.log('发起暂停请求')
|
console.log('发起暂停请求')
|
||||||
|
|
||||||
TestStatus.value = 'paused_ing'
|
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 = () => {
|
const sendResume = () => {
|
||||||
console.log('发起继续检测请求')
|
console.log('发起继续检测请求')
|
||||||
@@ -395,13 +325,12 @@ const sendResume = () => {
|
|||||||
resumeTest({
|
resumeTest({
|
||||||
userPageId: "cdf",
|
userPageId: "cdf",
|
||||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||||
planId: checkStore.planId,
|
planId: checkStore.plan.id,
|
||||||
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
}).then(res => {
|
})
|
||||||
Object.assign(webMsgSend.value, {
|
Object.assign(webMsgSend.value, {
|
||||||
requestId: 'Resume_Success'
|
requestId: 'Resume_Success'
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const sendReCheck = () => {
|
const sendReCheck = () => {
|
||||||
@@ -409,8 +338,8 @@ const sendReCheck = () => {
|
|||||||
startPreTest({
|
startPreTest({
|
||||||
userPageId: "cdf",
|
userPageId: "cdf",
|
||||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||||
planId: checkStore.planId,
|
planId: checkStore.plan.id,
|
||||||
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测
|
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.code === 'A001014') {
|
if (res.code === 'A001014') {
|
||||||
@@ -424,97 +353,86 @@ const sendReCheck = () => {
|
|||||||
TestStatus.value = 'start'
|
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 = () => {
|
const nextStep = () => {
|
||||||
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
if (stepsActiveIndex.value == stepsTotalNum.value + 1 || ActiveStatue.value === 'error' || ActiveStatue.value === 'test_init_fail' || ActiveStatue.value === 'connect_timeout' || ActiveStatue.value === 'pause_timeout') {
|
||||||
stepsActiveIndex.value++
|
handleClose()
|
||||||
if (!isTimeCheck.value) {//不具备守时检测,预检测后直接跳正式检测
|
return
|
||||||
|
}
|
||||||
|
if (ActiveStatue.value != 'error') {
|
||||||
|
ActiveStatue.value = 'waiting'
|
||||||
|
let tempStep = stepsActiveIndex.value
|
||||||
|
let idx = 1
|
||||||
stepsActiveIndex.value++
|
stepsActiveIndex.value++
|
||||||
|
for (let selectTestItemsKey in checkStore.selectTestItems) {
|
||||||
|
if (tempStep == 0 && checkStore.selectTestItems[selectTestItemsKey]) {
|
||||||
|
stepsActiveView.value = idx
|
||||||
|
stepsActive.value = idx
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (checkStore.selectTestItems[selectTestItemsKey] && tempStep != 0) {
|
||||||
|
tempStep--
|
||||||
|
}
|
||||||
|
idx++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveStatue.value = 'waiting'
|
// if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||||
} else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
// stepsActiveIndex.value++
|
||||||
//emit('update:visible', false); // 关闭对话框
|
// if (!checkStore.selectTestItems.timeTest) { // 不具备守时检测
|
||||||
clearData()
|
// stepsActiveIndex.value++
|
||||||
dialogVisible.value = false;
|
// }
|
||||||
|
//
|
||||||
|
// ActiveStatue.value = 'waiting'
|
||||||
|
// } else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
||||||
|
// //emit('update:visible', false); // 关闭对话框
|
||||||
|
// clearData()
|
||||||
|
// dialogVisible.value = false;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleStepClick = (step: number) => {
|
||||||
|
if (step > stepsActive.value) {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
stepsActiveView.value = step
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function clearData() {
|
function clearData() {
|
||||||
stepsActiveIndex.value = 0;
|
stepsTotalNum.value = -1
|
||||||
|
stepsActiveIndex.value = 1
|
||||||
|
stepsActiveView.value = -1
|
||||||
preTestStatus.value = "waiting"
|
preTestStatus.value = "waiting"
|
||||||
timeTestStatus.value = "waiting"
|
timeTestStatus.value = "waiting"
|
||||||
channelsTestStatus.value = "waiting"
|
channelsTestStatus.value = "waiting"
|
||||||
TestStatus.value = "waiting"
|
TestStatus.value = "waiting"
|
||||||
ActiveStatue.value = "waiting"
|
ActiveStatue.value = "waiting"
|
||||||
skipDisabled.value = false
|
|
||||||
nextStepText.value = "下一步"
|
nextStepText.value = "下一步"
|
||||||
}
|
}
|
||||||
|
|
||||||
const beforeClose = (done: () => void) => {
|
const beforeClose = (done: () => void) => {
|
||||||
console.log(stepsActiveIndex.value, stepsTotalNum.value)
|
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||||
if (stepsActiveIndex.value < stepsTotalNum.value) {
|
ElMessageBox.confirm('检测未完成,是否退出当前检测流程?', '提示', {
|
||||||
ElMessageBox.confirm(
|
|
||||||
'检测未完成,是否退出当前检测流程?',
|
|
||||||
'提示',
|
|
||||||
{
|
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}
|
}
|
||||||
)
|
).then(() => {
|
||||||
.then(() => {
|
handleClose()
|
||||||
clearData()
|
|
||||||
// todo 关闭弹窗,终止整个检测流程
|
|
||||||
//emit('update:visible', false); // 关闭对话框
|
|
||||||
dialogVisible.value = false;
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
clearData()
|
handleClose()
|
||||||
//emit('update:visible', false); // 关闭对话框
|
|
||||||
dialogVisible.value = false;
|
|
||||||
}
|
}
|
||||||
// ElMessageBox.confirm('Are you sure to close this dialog?')
|
|
||||||
// .then(() => {
|
|
||||||
// done()
|
|
||||||
// })
|
|
||||||
// .catch(() => {
|
|
||||||
// // catch error
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
const handleCancel = () => {
|
|
||||||
|
const handleClose = () => {
|
||||||
dataSocket.socketServe.closeWs()
|
dataSocket.socketServe.closeWs()
|
||||||
|
dialogVisible.value = false;
|
||||||
|
clearData()
|
||||||
|
showComponent.value = false;
|
||||||
|
|
||||||
emit('quitClicked'); // 触发事件
|
emit('quitClicked'); // 触发事件
|
||||||
// clearData()
|
}
|
||||||
// emit('update:visible', false); // 关闭对话框
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// // 当 props.visible 改变时,更新 formData
|
|
||||||
// watch(() => props.visible, (newVal) => {
|
|
||||||
// if (!newVal) {
|
|
||||||
// // 这里可以重置表单数据,如果需要的话
|
|
||||||
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({open})
|
defineExpose({open})
|
||||||
@@ -526,13 +444,6 @@ defineExpose({open})
|
|||||||
max-height: 840px !important;
|
max-height: 840px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
// :deep(.dialog-big){
|
|
||||||
// max-height: 840px !important;
|
|
||||||
// }
|
|
||||||
// :deep(.el-dialog__body){
|
|
||||||
// max-height: 840px !important;
|
|
||||||
// }
|
|
||||||
|
|
||||||
.steps-container :deep(.test-head-steps) {
|
.steps-container :deep(.test-head-steps) {
|
||||||
height: 80px;
|
height: 80px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|||||||
@@ -6,8 +6,10 @@
|
|||||||
clearable
|
clearable
|
||||||
v-model='searchForm.planName'
|
v-model='searchForm.planName'
|
||||||
></el-input>
|
></el-input>
|
||||||
|
<el-tooltip content="检测计划列表" placement="top">
|
||||||
<Menu style='width: 26px;height: 26px; margin-left: 8px;cursor: pointer;color:var(--el-color-primary)'
|
<Menu style='width: 26px;height: 26px; margin-left: 8px;cursor: pointer;color:var(--el-color-primary)'
|
||||||
@click.stop='detail()' />
|
@click.stop='detail()' />
|
||||||
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div class='tree_container'>
|
<div class='tree_container'>
|
||||||
<el-tree
|
<el-tree
|
||||||
@@ -40,6 +42,7 @@ import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue'
|
|||||||
import { nextTick, onMounted, ref, watch } from 'vue';
|
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import {useCheckStore} from "@/stores/modules/check";
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
|
import { ElTooltip } from 'element-plus';
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const checkStore = useCheckStore()
|
const checkStore = useCheckStore()
|
||||||
@@ -64,10 +67,7 @@ const getTreeData = (val: any) => {
|
|||||||
if (item.children.length > 0) {
|
if (item.children.length > 0) {
|
||||||
let node = item.children[0];
|
let node = item.children[0];
|
||||||
defaultChecked.value.push(node.id);
|
defaultChecked.value.push(node.id);
|
||||||
checkStore.setPlanId(node.id);
|
checkStore.setPlan(node);
|
||||||
checkStore.setPlanCode(node.code);
|
|
||||||
checkStore.setScriptId(node.scriptId);
|
|
||||||
checkStore.setErrorSysId(node.errorSysId);
|
|
||||||
// 高亮显示第一个节点
|
// 高亮显示第一个节点
|
||||||
// 使用 nextTick 确保在 DOM 更新后调用 setCurrentKey
|
// 使用 nextTick 确保在 DOM 更新后调用 setCurrentKey
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@@ -133,10 +133,7 @@ const handleNodeClick = (data: Plan.ResPlan) => {
|
|||||||
|
|
||||||
idd.value = data.id
|
idd.value = data.id
|
||||||
|
|
||||||
checkStore.setPlanId(data.id)
|
checkStore.setPlan(data);
|
||||||
checkStore.setPlanCode(data.code)
|
|
||||||
checkStore.setScriptId(data.scriptId)
|
|
||||||
checkStore.setErrorSysId(data.errorSysId)
|
|
||||||
updateSelectedTreeNode(data.id)
|
updateSelectedTreeNode(data.id)
|
||||||
}
|
}
|
||||||
const filterNode = (value: string, data: any) => {
|
const filterNode = (value: string, data: any) => {
|
||||||
@@ -147,7 +144,7 @@ const filterNode = (value: string, data: any) => {
|
|||||||
|
|
||||||
// 点击详情
|
// 点击详情
|
||||||
const detail = () => {
|
const detail = () => {
|
||||||
router.push('/plan')
|
router.push('/plan/planList')
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// console.log()
|
// console.log()
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
<el-tab-pane :label='tabLabel1' :style='{ height: tabPaneHeight}'>
|
<el-tab-pane :label='tabLabel1' :style='{ height: tabPaneHeight}'>
|
||||||
<!-- 列表数据 -->
|
<!-- 列表数据 -->
|
||||||
<div class='container_table' :style='{ height: tableHeight }'>
|
<div class='container_table' :style='{ height: tableHeight }'>
|
||||||
<Table ref='tableRef1' :id='currentId' :isTimeCheck='isTimeCheck' :plan = 'select_Plan' @batchGenerateClicked="handleBatchGenerate"></Table>
|
<Table ref='tableRef1' :id='currentId' :plan = 'select_Plan' @batchGenerateClicked="handleBatchGenerate"></Table>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
@@ -145,7 +145,6 @@ const tabsHeight = ref('calc(100vh - 522px)') // 初始高度
|
|||||||
const tabPaneHeight = ref('calc(100% - 5px)') // 初始高度
|
const tabPaneHeight = ref('calc(100% - 5px)') // 初始高度
|
||||||
const tableHeight = ref('calc(100% - 50px)') // 初始高度
|
const tableHeight = ref('calc(100% - 50px)') // 初始高度
|
||||||
|
|
||||||
const isTimeCheck = ref<boolean>(false)
|
|
||||||
const planList = ref<ResultData<Plan.ReqPlan[]>>()
|
const planList = ref<ResultData<Plan.ReqPlan[]>>()
|
||||||
const select_Plan = ref<Plan.ReqPlan>()
|
const select_Plan = ref<Plan.ReqPlan>()
|
||||||
const isLabelLineShow = ref(true)
|
const isLabelLineShow = ref(true)
|
||||||
@@ -302,13 +301,6 @@ const getPieData = async (id: string) => {
|
|||||||
planName.value = '所选计划:' + plan.name
|
planName.value = '所选计划:' + plan.name
|
||||||
|
|
||||||
select_Plan.value = plan
|
select_Plan.value = plan
|
||||||
if (plan) {
|
|
||||||
//isTimeCheck.value = plan.timeCheck === 1; // 将 1 转换为 true,0 转换为 false
|
|
||||||
isTimeCheck.value = false // 将 1 转换为 true,0 转换为 false ----目前不用守时检测,先去除
|
|
||||||
} else {
|
|
||||||
// 处理未找到计划的情况
|
|
||||||
isTimeCheck.value = false // 或者其他默认值
|
|
||||||
}
|
|
||||||
|
|
||||||
const pqDevList_Result2 = await getBoundPqDevList({ 'planId': id, 'checkStateList': [0, 1, 2, 3] })
|
const pqDevList_Result2 = await getBoundPqDevList({ 'planId': id, 'checkStateList': [0, 1, 2, 3] })
|
||||||
boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[]
|
boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
:data='logData'
|
:request-api='getTableList'
|
||||||
@selection-change='handleSelectionChange'
|
@selection-change='handleSelectionChange'
|
||||||
type='selection'
|
type='selection'
|
||||||
>
|
>
|
||||||
@@ -21,41 +21,39 @@
|
|||||||
<script setup lang='tsx' name='useProTable'>
|
<script setup lang='tsx' name='useProTable'>
|
||||||
// 根据实际路径调整
|
// 根据实际路径调整
|
||||||
import TimeControl from '@/components/TimeControl/index.vue'
|
import TimeControl from '@/components/TimeControl/index.vue'
|
||||||
import { type Sys_Log_Audit } from '@/api/system/interface/log'
|
import { type AuditLog} from '@/api/system/log/interface/log.ts'
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import { Upload ,DataAnalysis} from '@element-plus/icons-vue'
|
import { Upload ,DataAnalysis} from '@element-plus/icons-vue'
|
||||||
import logDataList from '@/api/system/log/logData'
|
|
||||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import { reactive,ref,watch } from 'vue'
|
import { reactive,ref,watch } from 'vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import {
|
||||||
|
getAuditLog,
|
||||||
|
} from '@/api/system/log/index.ts'
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
name: 'log'
|
|
||||||
})
|
|
||||||
|
|
||||||
let multipleSelection = ref<string[]>([])
|
// defineOptions({
|
||||||
const logData = logDataList
|
// name: 'log'
|
||||||
const dictStore = useDictStore()
|
// })
|
||||||
// 定义包含和排除的单位
|
|
||||||
const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
|
const startDate = ref('')
|
||||||
const excludedUnits = ['季度','年']; // 要排除的单位
|
const endDate = ref('')
|
||||||
const defaultUnits = '日'; // 默认的单位
|
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
|
const getTableList = async (params: any) => {
|
||||||
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
|
newParams.searchEndTime = endDate.value
|
||||||
|
newParams.searchBeginTime = startDate.value
|
||||||
|
return getAuditLog(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
const columns = reactive<ColumnProps<AuditLog.ReqAuditLogParams>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: 'id',
|
prop: 'createBy',
|
||||||
label: '序号',
|
|
||||||
width: 70,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'create_By',
|
|
||||||
label: '操作用户',
|
label: '操作用户',
|
||||||
search: { el: 'input' },
|
search: { el: 'input' },
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
@@ -66,18 +64,17 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
|||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'create_Time',
|
prop: 'createTime',
|
||||||
label: '记录时间',
|
label: '记录时间',
|
||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
search: {
|
search: {
|
||||||
span: 2,
|
|
||||||
render: () => {
|
render: () => {
|
||||||
return (
|
return (
|
||||||
<div class='flx-flex-start'>
|
<div class='flx-flex-start'>
|
||||||
<TimeControl
|
<TimeControl
|
||||||
include={includedUnits}
|
include={['日', '周', '月', '自定义']}
|
||||||
exclude={excludedUnits}
|
default={'月'}
|
||||||
default={defaultUnits}
|
onUpdate-dates={handleDateChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -105,21 +102,20 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'operate_Type',
|
prop: 'operateType',
|
||||||
label: '日志类型',
|
label: '日志类型',
|
||||||
width: 100,
|
width: 100,
|
||||||
search: { el: 'select', props: { filterable: true } },
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
//选中
|
// 处理日期变化的回调函数
|
||||||
// 处理选择变化
|
const handleDateChange = (startDateTemp: string, endDateTemp: string) => {
|
||||||
const handleSelectionChange = (selection: Sys_Log_Audit.Audit_LogList[]) => {
|
startDate.value = startDateTemp
|
||||||
multipleSelection.value = selection.map(row => row.id) // 更新选中的行
|
endDate.value = endDateTemp
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -0,0 +1,709 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="divider-container">
|
||||||
|
<el-divider style="width: 260px" content-position="left">检测脚本信息</el-divider>
|
||||||
|
<el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider>
|
||||||
|
</div>
|
||||||
|
<div class="data-check-content">
|
||||||
|
<div class="content-tree">
|
||||||
|
<Tree ref="treeRef" :treeData="treeData" @setTab="setTab"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content-right-Tabs" style="height: calc(100vh - 315px); width: 100px">
|
||||||
|
<el-tabs type="border-card" style="height: 100%" v-model="activeName" @tab-change="tabChange">
|
||||||
|
<el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
|
||||||
|
<div v-if="activeName == tab.value">
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<!-- <el-button :icon="CirclePlus" type="primary" @click="openDialog('add')">新增</el-button>-->
|
||||||
|
</div>
|
||||||
|
<div style="display: flex">
|
||||||
|
<!-- 通信脚本 -->
|
||||||
|
<el-tabs type="border-card" v-model="firstName" style="height: 100%" class="hidden-tab">
|
||||||
|
<el-tab-pane label="通讯脚本" name="first">
|
||||||
|
<Commun
|
||||||
|
:activeName="activeName"
|
||||||
|
:formContent="props.formContent"
|
||||||
|
:options="props.options"
|
||||||
|
style="width: 360px"
|
||||||
|
:disabled="tab.children.length == 0 ? false : true"
|
||||||
|
ref="communRef"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<!-- 2级tab -->
|
||||||
|
<el-tabs
|
||||||
|
type="border-card"
|
||||||
|
style="flex: 1; margin-left: 10px"
|
||||||
|
v-model="childActiveName"
|
||||||
|
@tab-change="inquireTable"
|
||||||
|
>
|
||||||
|
<el-tab-pane
|
||||||
|
v-for="subTab in tab.children || []"
|
||||||
|
:key="subTab.value"
|
||||||
|
:label="subTab.label"
|
||||||
|
:name="subTab.value"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
:header-cell-style="{
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: '#003078',
|
||||||
|
color: '#fff'
|
||||||
|
}"
|
||||||
|
stripe
|
||||||
|
:cell-style="{ textAlign: 'center' }"
|
||||||
|
height="calc(100vh - 480px)"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" label="组次" width="60" />
|
||||||
|
<el-table-column prop="ffreq" label="频率(Hz)" width="90" />
|
||||||
|
<el-table-column
|
||||||
|
:label="item.label"
|
||||||
|
v-for="item in column"
|
||||||
|
:key="item.label"
|
||||||
|
>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<table class="tableL">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="theFirst">V</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num].famp == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num]?.famp +
|
||||||
|
(valueCode == 'Absolute' ? 'V' : '%')
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num].fphase == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num].fphase +
|
||||||
|
'°'
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="theFirst">I</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num + 1].famp == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num + 1].famp +
|
||||||
|
(valueCode == 'Absolute' ? 'V' : '%')
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num + 1].fphase == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num + 1].fphase +
|
||||||
|
'°'
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="165">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div class="actionButtons">
|
||||||
|
<el-button type="primary" link :icon="View" @click="view(row)">
|
||||||
|
查看
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<div class="page">
|
||||||
|
<div class="black-container">
|
||||||
|
<!-- <el-progress-->
|
||||||
|
<!-- v-if="loading"-->
|
||||||
|
<!-- type="circle"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <template #default="{}">-->
|
||||||
|
<!-- <span class="Loading">Loading</span>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- </el-progress>-->
|
||||||
|
<div class="loading-container" v-if="showLoading">
|
||||||
|
<div style="width: 80%; height: 80%;" class="loading-box">
|
||||||
|
<div class="loading-circle"></div>
|
||||||
|
<div class="loading-text">Loading...</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||||
|
</div>
|
||||||
|
<div class="loading-container" v-else>
|
||||||
|
<div style="width: 80%; height: 80%; " class="loading-box">
|
||||||
|
<div class="loading-circle static"></div>
|
||||||
|
<div class="loading-text">Loading</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 10px;">
|
||||||
|
<span>标准源加量输出:{{hour}}时{{minute}}分{{second}}秒</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 10px;">
|
||||||
|
<el-button :icon="VideoPlay"
|
||||||
|
type="primary"
|
||||||
|
size="large"
|
||||||
|
@click="startLoading"
|
||||||
|
:disabled="pauseDisabled"
|
||||||
|
>启动</el-button>
|
||||||
|
<el-button :icon="VideoPause"
|
||||||
|
type="primary"
|
||||||
|
size="large"
|
||||||
|
@click="stopLoading"
|
||||||
|
:disabled="pauseDisabled"
|
||||||
|
>停止</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<TestProjectPopup
|
||||||
|
ref="testProjectPopupRef"
|
||||||
|
:options="props.options"
|
||||||
|
:activeName="activeName"
|
||||||
|
:childActiveName="childActiveName"
|
||||||
|
:formContent="props.formContent"
|
||||||
|
:communicationList="communicationList"
|
||||||
|
@addTab="addTab"
|
||||||
|
@getCommunication="getCommunication"
|
||||||
|
@close="showDialog = false"
|
||||||
|
v-if="showDialog"
|
||||||
|
/>
|
||||||
|
<!-- 查看 -->
|
||||||
|
<ViewRow ref="viewRowRef"
|
||||||
|
:activeName="activeName"
|
||||||
|
:formContent="props.formContent"
|
||||||
|
@close="viewDialog = false"
|
||||||
|
v-if="viewDialog"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { type PropType, ref, nextTick, onMounted, watch } from 'vue'
|
||||||
|
import Tree from './tree.vue'
|
||||||
|
import Commun from '@/views/machine/testScript/components//communication.vue'
|
||||||
|
import {type CascaderOption, ElMessage} from 'element-plus'
|
||||||
|
import { getTreeData } from '@/api/check/test'
|
||||||
|
import {CirclePlus, Delete, Check, CopyDocument, View, EditPen, VideoPlay, VideoPause, Loading} from '@element-plus/icons-vue'
|
||||||
|
import type { TestScript } from '@/api/device/interface/testScript'
|
||||||
|
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
|
||||||
|
import { CheckData } from '@/api/check/interface'
|
||||||
|
import { dlsDetails, deleteDtls, updateDtls, addScriptDtls, checkDataList } from '@/api/device/testScript'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { scriptDtlsCheckDataList } from '@/api/device/testScript/index'
|
||||||
|
import ViewRow from '@/views/machine/testScript/components/viewRow.vue'
|
||||||
|
import { startSimulateTest,closeSimulateTest } from '@/api/device/controlSource/index.ts'
|
||||||
|
import { controlSource } from '@/api/device/interface/controlSource'
|
||||||
|
interface TabOption {
|
||||||
|
label?: string
|
||||||
|
name?: string
|
||||||
|
value?: string
|
||||||
|
code?: string
|
||||||
|
children?: TabOption[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const treeRef = ref()
|
||||||
|
const communRef = ref()
|
||||||
|
const treeData = ref<CheckData.TreeItem[]>([])
|
||||||
|
const valueCode = ref('') //Absolute绝对值
|
||||||
|
const props = defineProps({
|
||||||
|
options: {
|
||||||
|
type: Array as PropType<TabOption[]>,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
formContent: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
formControl: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
startDisabeld: {
|
||||||
|
type:Boolean,
|
||||||
|
required:true
|
||||||
|
},
|
||||||
|
pauseDisabled: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const viewDialog = ref(false)
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const activeName = ref('')
|
||||||
|
const childActiveName = ref('')
|
||||||
|
const childActiveIndex = ref(0)
|
||||||
|
const firstName = 'first'
|
||||||
|
const viewRowRef = ref()
|
||||||
|
const communicationList = ref<[]>([])
|
||||||
|
const testProjectPopupRef = ref()
|
||||||
|
const tableData: any = ref([])
|
||||||
|
const tabData: any = ref([])
|
||||||
|
|
||||||
|
const showLoading = ref(false)
|
||||||
|
const column = ref([
|
||||||
|
{
|
||||||
|
label: 'L1',
|
||||||
|
num: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'L2',
|
||||||
|
num: 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'L3',
|
||||||
|
num: 4
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// 时间计数器
|
||||||
|
let timer: any = null
|
||||||
|
const timeCount = ref(0)
|
||||||
|
const hour = ref(0)
|
||||||
|
const minute = ref(0)
|
||||||
|
const second = ref(0)
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:activeName','update:activeIndex','update:startDisabeld','update:pauseDisabled'])
|
||||||
|
|
||||||
|
watch(()=>props.formControl.scriptId,async ()=>{
|
||||||
|
if(props.formControl.scriptId!=''){
|
||||||
|
|
||||||
|
nextTick(async () => {
|
||||||
|
await getTree()
|
||||||
|
console.log('props.formControl.scriptId')
|
||||||
|
treeRef.value.checkTree()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const controlContent = ref<controlSource.ResControl>({
|
||||||
|
userPageId: '',
|
||||||
|
scriptId: '',
|
||||||
|
scriptIndex: 0,
|
||||||
|
sourceId: '',
|
||||||
|
})
|
||||||
|
// 获取树
|
||||||
|
const getTree = () => {
|
||||||
|
getTreeData({
|
||||||
|
scriptId: props.formControl.scriptId,
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 'A0000') {
|
||||||
|
treeData.value = res.data
|
||||||
|
//console.log('tree',res.data)
|
||||||
|
// 为 treeData 及其子节点添加 id
|
||||||
|
let idCounter = 0;
|
||||||
|
const addIdToTree = (nodes: any[]) => {
|
||||||
|
nodes.forEach(node => {
|
||||||
|
node.id = idCounter++; // 为每个节点添加唯一的 id
|
||||||
|
if (node.children && node.children.length > 0) {
|
||||||
|
node.disabled = true
|
||||||
|
addIdToTree(node.children); // 递归为子节点添加 id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
addIdToTree(treeData.value);
|
||||||
|
|
||||||
|
// 添加tab子项
|
||||||
|
props.options.forEach((k: any, i: number) => {
|
||||||
|
tabData.value[i].children = []
|
||||||
|
treeData.value.forEach((item: any) => {
|
||||||
|
if (k.value == item.scriptTypeCode) {
|
||||||
|
item.children.forEach((s: any) => {
|
||||||
|
k.children.forEach((P: any) => {
|
||||||
|
if (P.code == s.scriptTypeCode) {
|
||||||
|
|
||||||
|
tabData.value[i].children.push({
|
||||||
|
label: P.label,
|
||||||
|
value: P.code,
|
||||||
|
children: []
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
s.children.forEach((j: any) => {
|
||||||
|
if (j.scriptTypeCode == P.code) {
|
||||||
|
tabData.value[i].children.push({
|
||||||
|
label: P.label,
|
||||||
|
value: P.code,
|
||||||
|
children: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
//console.log('2222',treeData.value)
|
||||||
|
|
||||||
|
tabChange()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//console.log('获取树')
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 设置树点击tab
|
||||||
|
const setTab = row => {
|
||||||
|
activeName.value = row.activeName
|
||||||
|
childActiveName.value = row.childActiveName
|
||||||
|
childActiveIndex.value = row.activeIndex
|
||||||
|
getTree()
|
||||||
|
emit('update:activeName', activeName.value) // 触发事件并传递 activeName.value
|
||||||
|
emit('update:activeIndex', row.activeIndex) // 触发事件并传递 activeName.value
|
||||||
|
}
|
||||||
|
const copyActiveName = ref('')
|
||||||
|
// 获取通讯脚本点击
|
||||||
|
const getCommunication = () => {
|
||||||
|
//console.log('controlSourceDetail',communRef.value[0]?.getData())
|
||||||
|
communicationList.value = communRef.value[0]?.getData()
|
||||||
|
}
|
||||||
|
// 切换大tab控制小tab
|
||||||
|
const tabChange = () => {
|
||||||
|
if (copyActiveName.value != activeName.value) {
|
||||||
|
copyActiveName.value == activeName.value
|
||||||
|
|
||||||
|
if (
|
||||||
|
tabData.value
|
||||||
|
.filter((item: any) => item.value == activeName.value)[0]
|
||||||
|
?.children.filter((item: any) => item.value == childActiveName.value).length == 0
|
||||||
|
) {
|
||||||
|
childActiveName.value =
|
||||||
|
tabData.value.filter((item: any) => item.value == activeName.value)[0]?.children[0]?.value || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
inquireTable()
|
||||||
|
}
|
||||||
|
//根据脚本id查询检测脚本详情
|
||||||
|
const inquireTable = () => {
|
||||||
|
const sortOrder = ['Ua', 'Ia', 'Ub', 'Ib', 'Uc', 'Ic']
|
||||||
|
dlsDetails({
|
||||||
|
scriptId: props.formControl.scriptId,
|
||||||
|
scriptType: activeName.value,
|
||||||
|
scriptSubType: childActiveName.value
|
||||||
|
}).then((res: any) => {
|
||||||
|
if (res.code === 'A0000') {
|
||||||
|
res.data.forEach((item: any) => {
|
||||||
|
item.channelList = item.channelList.sort((a: any, b: any) => {
|
||||||
|
const indexA = sortOrder.indexOf(a.channelType)
|
||||||
|
const indexB = sortOrder.indexOf(b.channelType)
|
||||||
|
return indexA - indexB
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
tableData.value = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
//console.log('treeData',treeData.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 查看
|
||||||
|
const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||||
|
|
||||||
|
getCommunication()
|
||||||
|
//当前点击的一级tab
|
||||||
|
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称';
|
||||||
|
//当前点击的二级tab
|
||||||
|
const childrenTabName = ref('')
|
||||||
|
tabData.value.forEach((item: any) => {
|
||||||
|
if (item.value == activeName.value) {
|
||||||
|
item.children.forEach((k: any) => {
|
||||||
|
if (k.value == childActiveName.value) {
|
||||||
|
childrenTabName.value = k.label
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
viewDialog.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
|
||||||
|
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义 startLoading 方法
|
||||||
|
const startLoading = async () => {
|
||||||
|
emit('update:startDisabeld', true)
|
||||||
|
emit('update:pauseDisabled', true)
|
||||||
|
ElMessage.success({message:'启动中...',duration:6000})
|
||||||
|
// 启动加载逻辑
|
||||||
|
controlContent.value.userPageId = 'cdf'
|
||||||
|
controlContent.value.scriptId = props.formControl.scriptId
|
||||||
|
controlContent.value.scriptIndex = childActiveIndex.value
|
||||||
|
controlContent.value.sourceId = props.formControl.sourceId
|
||||||
|
setTimeout(async () => {
|
||||||
|
await startSimulateTest(controlContent.value)
|
||||||
|
},3000)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义 startLoading 方法
|
||||||
|
const stopLoading = async () => {
|
||||||
|
// 启动加载逻辑
|
||||||
|
controlContent.value.userPageId = 'cdf'
|
||||||
|
controlContent.value.scriptId = props.formControl.scriptId
|
||||||
|
controlContent.value.scriptIndex = childActiveIndex.value
|
||||||
|
controlContent.value.sourceId = props.formControl.sourceId
|
||||||
|
await closeSimulateTest(controlContent.value)
|
||||||
|
emit('update:pauseDisabled', true)
|
||||||
|
emit('update:startDisabeld', true)
|
||||||
|
ElMessage.success({message:'停止中...',duration:5000})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const startTimeCount = () => {
|
||||||
|
// Loading效果展示
|
||||||
|
showLoading.value = true
|
||||||
|
|
||||||
|
if (!timer) {
|
||||||
|
hour.value = 0
|
||||||
|
minute.value = 0
|
||||||
|
second.value = 0
|
||||||
|
timeCount.value = 0
|
||||||
|
timer = setInterval(() => {
|
||||||
|
timeCount.value = timeCount.value + 1
|
||||||
|
secondToTime(timeCount.value)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const secondToTime = (secd: number) => {
|
||||||
|
//将秒数转换成时分秒
|
||||||
|
hour.value = Math.floor(secd / 3600)
|
||||||
|
minute.value = Math.floor((secd - hour.value * 3600) / 60)
|
||||||
|
second.value = Math.floor(secd % 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
const stopTimeCount = () => {
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer)
|
||||||
|
timer = null
|
||||||
|
}
|
||||||
|
//Loading效果关闭
|
||||||
|
showLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取左边树数据
|
||||||
|
// 新增保存
|
||||||
|
const addTab = (row: any) => {
|
||||||
|
getTree()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
|
||||||
|
getTree()
|
||||||
|
props.options.forEach((item: any) => {
|
||||||
|
tabData.value.push({
|
||||||
|
label: item.label.replace(/准确度|检测/g, ''),
|
||||||
|
value: item.value,
|
||||||
|
code: item.code,
|
||||||
|
children: []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
activeName.value = tabData.value[0].value
|
||||||
|
|
||||||
|
valueCode.value = dictStore
|
||||||
|
.getDictData('Script_Value_Type')
|
||||||
|
.filter(item => item.id == props.formContent.valueType)[0].code
|
||||||
|
})
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
startTimeCount,
|
||||||
|
stopTimeCount
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.data-check-content {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-tree {
|
||||||
|
width: 260px;
|
||||||
|
height: calc(100vh - 315px);
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
border-radius: 4px;
|
||||||
|
// margin-right: 10px;
|
||||||
|
overflow: auto; /* 同时启用垂直和水平滚动 */
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
.scriptTree {
|
||||||
|
height: calc(100vh - 520px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确保 el-tree 内容可以超出容器宽度 */
|
||||||
|
.el-tree {
|
||||||
|
width: fit-content; /* 根据内容自适应宽度 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-right-Tabs {
|
||||||
|
flex: 1; /* 根据需要调整宽度比例 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider-container {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider-container .el-divider {
|
||||||
|
margin-right: 30px; /* 根据需要调整间距 */
|
||||||
|
}
|
||||||
|
:deep(.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell) {
|
||||||
|
padding: 3px 11px;
|
||||||
|
}
|
||||||
|
:deep(.el-loading-mask) {
|
||||||
|
z-index: 3000;
|
||||||
|
}
|
||||||
|
.tableL {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
td {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 5px;
|
||||||
|
width: 45%;
|
||||||
|
}
|
||||||
|
.theFirst {
|
||||||
|
background-color: #003078;
|
||||||
|
color: #fff;
|
||||||
|
width: 20px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.actionButtons {
|
||||||
|
.el-button {
|
||||||
|
margin-left: 0px;
|
||||||
|
margin: 5px 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.black-container {
|
||||||
|
background-color: #000;
|
||||||
|
width: 300px;
|
||||||
|
height: 300px;
|
||||||
|
position: relative; /* 设置为相对定位 */
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-box {
|
||||||
|
position: relative; /* 设置为相对定位 */
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-circle {
|
||||||
|
border: 8px solid rgba(255, 255, 255, 0.932);
|
||||||
|
border-top: 8px solid var(--el-color-primary); /* 蓝色 */
|
||||||
|
border-bottom: 8px solid var(--el-color-primary); /* 蓝色 */
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
position: absolute; /* 设置为绝对定位 */
|
||||||
|
animation: spin 2s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-circle.static {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-text {
|
||||||
|
position: absolute; /* 设置为绝对定位 */
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 20px; /* 根据需要调整字体大小 */
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% { transform: rotate(0deg); }
|
||||||
|
100% { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.hidden-tab {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rotate {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<style>
|
||||||
|
input::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
input::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none !important;
|
||||||
|
}
|
||||||
|
.el-divider--horizontal {
|
||||||
|
margin: 4px 0 24px 0;
|
||||||
|
}
|
||||||
|
.el-tabs--border-card > .el-tabs__content {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
166
frontend/src/views/machine/controlSource/components/tree.vue
Normal file
166
frontend/src/views/machine/controlSource/components/tree.vue
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
<template>
|
||||||
|
<el-tree
|
||||||
|
node-key="id"
|
||||||
|
default-expand-all
|
||||||
|
:data="props.treeData"
|
||||||
|
:props="defaultProps"
|
||||||
|
style="width: 100%"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
:highlight-current="true"
|
||||||
|
@node-click="handleNodeClick"
|
||||||
|
show-checkbox
|
||||||
|
:check-strictly="true"
|
||||||
|
@check-change="handleCheckChange"
|
||||||
|
ref="treeRef"
|
||||||
|
>
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<el-tooltip effect="dark" :content="data.sourceDesc || data.scriptTypeName" placement="top" :hide-after="0">
|
||||||
|
<div class="custom-tree-node">
|
||||||
|
{{ data.scriptTypeName || data.sourceDesc }}
|
||||||
|
</div>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-tree>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, onMounted, watch, nextTick } from 'vue'
|
||||||
|
|
||||||
|
import { CheckData } from '@/api/check/interface'
|
||||||
|
import { da } from 'element-plus/es/locale'
|
||||||
|
import { on } from 'events'
|
||||||
|
const props = defineProps({
|
||||||
|
treeData: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['setTab'])
|
||||||
|
const dataTree = ref<CheckData.TreeItem[]>([])
|
||||||
|
const defaultProps = {
|
||||||
|
children: 'children',
|
||||||
|
label: 'scriptTypeName',
|
||||||
|
pid: 'pid'
|
||||||
|
}
|
||||||
|
const activeName = ref('')
|
||||||
|
const childActiveName = ref('')
|
||||||
|
const activeIndex = ref()
|
||||||
|
const treeRef = ref()
|
||||||
|
const handleNodeClick = (data, node) => {
|
||||||
|
if(data.index!= null){
|
||||||
|
let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
|
||||||
|
const parents = getParentNodes(node, [])
|
||||||
|
parents.pop()
|
||||||
|
parents.unshift(node.data)
|
||||||
|
parents.reverse()
|
||||||
|
let active = parents[0].scriptTypeCode
|
||||||
|
let childActive = findTargetCodes(parents, code)[0] || ''
|
||||||
|
// 获取当前节点的直接父节点
|
||||||
|
if (activeName.value != active || childActiveName.value != childActive || activeIndex.value != data.index) {
|
||||||
|
activeName.value = active
|
||||||
|
childActiveName.value = childActive
|
||||||
|
emit('setTab', {
|
||||||
|
activeName: active,
|
||||||
|
childActiveName: childActive,
|
||||||
|
activeIndex:data.index
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回父级
|
||||||
|
const getParentNodes = (node, parents) => {
|
||||||
|
if (node.parent) {
|
||||||
|
// 将父节点添加到数组中
|
||||||
|
parents.push(node.parent.data)
|
||||||
|
// 递归获取更高层级的父节点
|
||||||
|
getParentNodes(node.parent, parents)
|
||||||
|
}
|
||||||
|
return parents
|
||||||
|
}
|
||||||
|
// 判断childActiveName值
|
||||||
|
function findTargetCodes(data: any[], targetCodes: string[]) {
|
||||||
|
let result: string[] = []
|
||||||
|
data.forEach(item => {
|
||||||
|
if (item.scriptTypeCode != null) {
|
||||||
|
if (targetCodes.includes(item.scriptTypeCode)) {
|
||||||
|
result.push(item.scriptTypeCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
// for (let item of data) {
|
||||||
|
// // 判断当前项的 scriptTypeCode 是否包含目标值
|
||||||
|
// if (item.scriptTypeCode !=null && targetCodes.includes(item.scriptTypeCode)) {
|
||||||
|
// console.log("🚀 ~ findTargetCodes ~ targetCodes.includes(item.scriptTypeCode):",item.scriptTypeCode, targetCodes.includes(item.scriptTypeCode))
|
||||||
|
// result.push(item.scriptTypeCode)
|
||||||
|
// return result
|
||||||
|
// }
|
||||||
|
// // 如果存在 children,递归检查
|
||||||
|
// if (item.children && item.children.length > 0) {
|
||||||
|
// result = result.concat(findTargetCodes(item.children, targetCodes))
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return result
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCheckChange(data,isChecked) {
|
||||||
|
if (isChecked)
|
||||||
|
{
|
||||||
|
// 如果没有子节点,允许勾选
|
||||||
|
const checked = [data.id]; // id为tree的node-key属性
|
||||||
|
treeRef.value?.setCheckedKeys(checked);
|
||||||
|
emit('setTab', {
|
||||||
|
activeName: data.scriptType,
|
||||||
|
childActiveName: data.scriptTypeCode,
|
||||||
|
activeIndex:data.index
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 递归查找第一个节点的最后一层子节点
|
||||||
|
function findFirstLeafNode(node: any): any {
|
||||||
|
if (node.children && node.children.length > 0) {
|
||||||
|
return findFirstLeafNode(node.children[0]);
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkTree = () => {
|
||||||
|
console.log('checkTree11')
|
||||||
|
console.log('checkTree22',props.treeData.length)
|
||||||
|
console.log('checkTree33',treeRef.value)
|
||||||
|
if (props.treeData.length > 0 && treeRef.value) {
|
||||||
|
console.log('checkTree44')
|
||||||
|
const firstNode = props.treeData[0];
|
||||||
|
const firstLeafNode = findFirstLeafNode(firstNode);
|
||||||
|
const firstLeafNodeId = firstLeafNode.id;
|
||||||
|
treeRef.value.setCheckedKeys([firstLeafNodeId]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保在组件挂载后也执行一次
|
||||||
|
onMounted(() => {
|
||||||
|
console.log('onMounted',props.treeData);
|
||||||
|
nextTick(() => {
|
||||||
|
checkTree()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// // 对外映射
|
||||||
|
defineExpose({ checkTree })
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.custom-tree-node {
|
||||||
|
max-width: 230px;
|
||||||
|
overflow-x: hidden !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
text-overflow: ellipsis !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
366
frontend/src/views/machine/controlSource/index.vue
Normal file
366
frontend/src/views/machine/controlSource/index.vue
Normal file
@@ -0,0 +1,366 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-card style="margin-bottom: 10px" class="cardTop">
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
label-width="auto"
|
||||||
|
ref="dialogFormRef"
|
||||||
|
class="form-four"
|
||||||
|
>
|
||||||
|
<el-form-item label='检测源' prop='sourceId' >
|
||||||
|
<el-select v-model="controlContent.sourceId" collapse-tags placeholder="请选择检测源">
|
||||||
|
<el-option
|
||||||
|
v-for="(option, index) in pqSourceArray"
|
||||||
|
:key="index"
|
||||||
|
:label="option.label"
|
||||||
|
:value="option.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='检测脚本' prop='scriptId'>
|
||||||
|
<el-select v-model="controlContent.scriptId" collapse-tags placeholder="请选择检测脚本" @change="handleScriptChange">
|
||||||
|
<el-option
|
||||||
|
v-for="(option, index) in scriptArray"
|
||||||
|
:key="index"
|
||||||
|
:label="option.label"
|
||||||
|
:value="option.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<!-- <div class="formBut">-->
|
||||||
|
<el-button type="primary" :icon="Select" @click="start()" :disabled="connectDisabeld">通讯校验</el-button>
|
||||||
|
<el-button v-if="!connectDisabeld" type="text" style="color: #303133" disabled>源未连接</el-button>
|
||||||
|
<el-button v-else type="text" style="color: #67c23a" disabled>源连接成功</el-button>
|
||||||
|
<!-- </div>-->
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
<el-card v-if="show">
|
||||||
|
<ControlSourceDetail v-if="secondLevelOptions.length > 0" :options="secondLevelOptions" :formContent="formContent" :formControl="controlContent"
|
||||||
|
@update:activeName="handleActiveNameChange"
|
||||||
|
@update:active-index="handleActiveIndexChange"
|
||||||
|
|
||||||
|
v-model:startDisabeld="startDisabeld"
|
||||||
|
@update:startDisabeld="startDisabeld=$event"
|
||||||
|
v-model:pauseDisabled="pauseDisabled"
|
||||||
|
@update:pauseDisabled="pauseDisabled=$event"
|
||||||
|
ref="controlSourceDetailRef"/>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, nextTick, onMounted, onBeforeMount, reactive, watch } from 'vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import ControlSourceDetail from '@/views/machine/controlSource/components/controlSourceDetail.vue'
|
||||||
|
import { type TestScript } from '@/api/device/interface/testScript'
|
||||||
|
import type { Dict } from '@/api/system/dictionary/interface'
|
||||||
|
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||||
|
import { Select } from '@element-plus/icons-vue'
|
||||||
|
import { pqScriptAdd } from '@/api/device/testScript'
|
||||||
|
import { getTestSourceList } from '@/api/plan/plan.ts'
|
||||||
|
import { TestSource } from '@/api/device/interface/testSource'
|
||||||
|
import { CascaderOption, ElMessage } from 'element-plus'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||||
|
import socketClient from '@/utils/webSocketClient'
|
||||||
|
import { checkSimulate } from '@/api/device/controlSource/index.ts'
|
||||||
|
import { controlSource } from '@/api/device/interface/controlSource'
|
||||||
|
import {getPqScriptList} from '@/api/plan/plan.ts'
|
||||||
|
|
||||||
|
const show = ref(false)
|
||||||
|
const router = useRouter()
|
||||||
|
const modeId = ref()
|
||||||
|
const sourceValue = ref([])
|
||||||
|
const secondLevelOptions: any[] = []
|
||||||
|
// 定义弹出组件元信息
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const pqSourceList=ref<TestSource.ResTestSource[]>([])//获取指定模式下所有检测源
|
||||||
|
const modeStore = useModeStore()
|
||||||
|
const pqSourceArray = ref<{ label: string; value: string; }[]>()
|
||||||
|
const scriptArray = reactive<{label: string, value: string}[]>([])
|
||||||
|
// const formContent = ref<TestScript.ResTestScript>({
|
||||||
|
// id : '9ff96807cf8c7524587982ed8baa8b57',
|
||||||
|
// name: '测试',
|
||||||
|
// type: '1',
|
||||||
|
// valueType: '2973cb938b591b93d0df2547599b87d8',
|
||||||
|
// pattern: modeId.value,
|
||||||
|
// standardName: 'GBT 19862',
|
||||||
|
// standardTime: '2025',
|
||||||
|
// state: 1
|
||||||
|
// })
|
||||||
|
const formContent = ref<TestScript.ResTestScript>({
|
||||||
|
id : '',
|
||||||
|
name: '',
|
||||||
|
type: '',
|
||||||
|
valueType: '',
|
||||||
|
pattern: modeId.value,
|
||||||
|
standardName: '',
|
||||||
|
standardTime: '',
|
||||||
|
state: 1
|
||||||
|
})
|
||||||
|
const connectDisabeld = ref(false)
|
||||||
|
const startDisabeld = ref(true)
|
||||||
|
const pauseDisabled = ref(true)
|
||||||
|
const controlSourceDetailRef=ref<InstanceType<typeof ControlSourceDetail>>()
|
||||||
|
|
||||||
|
const controlContent = ref<controlSource.ResControl>({
|
||||||
|
userPageId: '',
|
||||||
|
scriptId: '',
|
||||||
|
scriptIndex: 0,
|
||||||
|
sourceId: '',
|
||||||
|
})
|
||||||
|
//开始创建webSocket客户端
|
||||||
|
const dataSocket = reactive({
|
||||||
|
socketServe: socketClient.Instance,
|
||||||
|
});
|
||||||
|
const webMsgSend = ref()//webSocket推送的数据
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
// 检查 socketClient.Instance 是否存在
|
||||||
|
if (!socketClient.Instance) {
|
||||||
|
console.error('WebSocket 客户端实例不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
socketClient.Instance.connect();
|
||||||
|
dataSocket.socketServe = socketClient.Instance;
|
||||||
|
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
||||||
|
// 处理来自服务器的消息
|
||||||
|
//console.log('Received message:', res)
|
||||||
|
// 根据需要在这里添加更多的处理逻辑
|
||||||
|
if (res.code === 20000) {
|
||||||
|
ElMessage.error(message.message)
|
||||||
|
loading.close()
|
||||||
|
} else {
|
||||||
|
webMsgSend.value = res
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const pqSource_Result = await getTestSourceList({
|
||||||
|
pattern: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ,
|
||||||
|
datasourceIds: '',
|
||||||
|
sourceIds: '',
|
||||||
|
planId: '',
|
||||||
|
scriptName: '',
|
||||||
|
errorSysName: '',
|
||||||
|
sourceName: '',
|
||||||
|
devIds: [],
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
dataSourceId: '',
|
||||||
|
scriptId: '',
|
||||||
|
errorSysId: '',
|
||||||
|
timeCheck: 0,
|
||||||
|
testState: 0,
|
||||||
|
reportState: 0,
|
||||||
|
result: 0,
|
||||||
|
code: 0,
|
||||||
|
state: 1
|
||||||
|
})
|
||||||
|
pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[];
|
||||||
|
const sourceArray1 = Array.isArray(pqSourceList.value) ? pqSourceList.value : []
|
||||||
|
// 将 pqSource_Result 转换成 { label, value } 数组
|
||||||
|
pqSourceArray.value = sourceArray1.map(item => ({
|
||||||
|
label: item.name || '',
|
||||||
|
value: item.id
|
||||||
|
}));
|
||||||
|
controlContent.value.sourceId = pqSourceArray.value[0].value
|
||||||
|
|
||||||
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id //获取数据字典中对应的id
|
||||||
|
const {data} = await getPqScriptList({pattern:patternId})
|
||||||
|
scriptArray.push(...data.map(item => ({ label: item.name, value: item.id})))
|
||||||
|
if(scriptArray.length > 0){
|
||||||
|
controlContent.value.scriptId = scriptArray[0].value
|
||||||
|
}
|
||||||
|
|
||||||
|
nextTick(async () => {
|
||||||
|
await treeInfo(modeStore.currentMode)
|
||||||
|
formContent.value.pattern = modeId.value
|
||||||
|
formContent.value.id = controlContent.value.scriptId
|
||||||
|
show.value = true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(webMsgSend, function (newValue, oldValue) {
|
||||||
|
console.log('webMsgSend:', newValue)
|
||||||
|
if (newValue.requestId.includes('formal_real&&') && newValue.operateCode === 'OPER_GATHER') {
|
||||||
|
if (newValue.code === 10200) {
|
||||||
|
ElMessage.success('启动成功!')
|
||||||
|
startDisabeld.value = false
|
||||||
|
pauseDisabled.value = false
|
||||||
|
controlSourceDetailRef.value?.startTimeCount()
|
||||||
|
}else if(newValue.code !== 10201){
|
||||||
|
ElMessage.error('启动失败!')
|
||||||
|
startDisabeld.value = false
|
||||||
|
pauseDisabled.value = true
|
||||||
|
console.log('错误信息:',webMsgSend)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (newValue.requestId.includes('close_source') && newValue.operateCode === 'CLOSE_GATHER') {
|
||||||
|
if (newValue.code === 10200) {
|
||||||
|
setTimeout(() => {
|
||||||
|
ElMessage.success('停止成功!')
|
||||||
|
connectDisabeld.value = false
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = true
|
||||||
|
controlSourceDetailRef.value?.stopTimeCount()
|
||||||
|
}, 5000)
|
||||||
|
} else {
|
||||||
|
ElMessage.error('停止失败!')
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = false
|
||||||
|
console.log('错误信息:',webMsgSend)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (newValue.requestId) {
|
||||||
|
case 'yjc_ytxjy':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'INIT_GATHER':
|
||||||
|
if (newValue.code == 10200) {
|
||||||
|
ElMessage.success('源连接成功!')
|
||||||
|
connectDisabeld.value = true
|
||||||
|
startDisabeld.value = false
|
||||||
|
pauseDisabled.value = false
|
||||||
|
} else if(newValue.code !== 10201) {
|
||||||
|
ElMessage.error('源连接失败!')
|
||||||
|
console.log('错误信息:',webMsgSend)
|
||||||
|
connectDisabeld.value = false
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = true
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'connect':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case "Source":
|
||||||
|
ElMessage.error('源连接失败!')
|
||||||
|
connectDisabeld.value = false
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = true
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'server_error':
|
||||||
|
if(newValue.operateCode === 'server_error'){
|
||||||
|
ElMessage.error('服务端主动关闭连接,请20秒后重试!')
|
||||||
|
connectDisabeld.value = true
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
connectDisabeld.value = false
|
||||||
|
startDisabeld.value = true
|
||||||
|
pauseDisabled.value = true
|
||||||
|
}, 20000)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
// 获取树字典
|
||||||
|
const treeInfo = async (currentMode: string) => {
|
||||||
|
const data: Dict.ResDictTree = {
|
||||||
|
name: '',
|
||||||
|
id: '',
|
||||||
|
pid: '',
|
||||||
|
pids: '',
|
||||||
|
code: 'Script_Indicator_Items',
|
||||||
|
sort: 0
|
||||||
|
}
|
||||||
|
const result = await getDictTreeByCode(data)
|
||||||
|
const result1 = (await getDictTreeByCode({ ...data, code: 'Script_Error' })).data[0].children
|
||||||
|
const allOptions = await convertToOptions(result.data as Dict.ResDictTree[])
|
||||||
|
const setAllTree = await setTree(allOptions[0]?.children, result1)
|
||||||
|
secondLevelOptions.push(...(setAllTree || []))
|
||||||
|
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id
|
||||||
|
}
|
||||||
|
|
||||||
|
const setTree = async (data, data1) => {
|
||||||
|
data.forEach(item => {
|
||||||
|
data1.forEach(item1 => {
|
||||||
|
if (item.label.replace(/准确度|检测/g, '') == item1.name) {
|
||||||
|
item.value = item1.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换函数
|
||||||
|
const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
|
||||||
|
return dictTree.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
code: item.code.split('-')[1] || item.code.split('-')[0],
|
||||||
|
label: item.name,
|
||||||
|
children: item.children ? convertToOptions(item.children) : undefined
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
const scriptId = ref('')
|
||||||
|
const scriptIndex = ref(0)
|
||||||
|
const handleActiveNameChange = (newActiveName: string) => {
|
||||||
|
scriptId.value = newActiveName
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleActiveIndexChange = (newActiveIndex: number) => {
|
||||||
|
|
||||||
|
scriptIndex.value = newActiveIndex
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 定义 handleScriptChange 方法
|
||||||
|
const handleScriptChange = (value: string) => {
|
||||||
|
// 根据业务需求实现具体逻辑
|
||||||
|
//console.log('检测脚本变更:', value);
|
||||||
|
router.push({
|
||||||
|
path: '/machine/controlSource',
|
||||||
|
state: { title: '新增检测脚本', row: '', mode: modeStore.currentMode }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const start = async () => {
|
||||||
|
|
||||||
|
controlContent.value.userPageId = 'cdf'
|
||||||
|
controlContent.value.scriptIndex = scriptIndex.value
|
||||||
|
await checkSimulate(controlContent.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
/* .dialog-content {
|
||||||
|
padding: 10px;
|
||||||
|
} */
|
||||||
|
:deep(.cardTop) {
|
||||||
|
.el-card__body {
|
||||||
|
padding: 20px 0 0 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//.formBut {
|
||||||
|
// width: 50%;
|
||||||
|
// display: flex;
|
||||||
|
// justify-content: end;
|
||||||
|
//}
|
||||||
|
.form-four {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
// justify-content: space-between;
|
||||||
|
.el-form-item {
|
||||||
|
display: flex;
|
||||||
|
width: 24.0%;
|
||||||
|
|
||||||
|
.el-form-item__content {
|
||||||
|
flex: 1;
|
||||||
|
.el-select,
|
||||||
|
.el-cascader,
|
||||||
|
.el-input__inner,
|
||||||
|
.el-date-editor {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -50,9 +50,9 @@
|
|||||||
<el-select v-model="formContent.reportName" clearable placeholder="请选择报告模版">
|
<el-select v-model="formContent.reportName" clearable placeholder="请选择报告模版">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Report_Template')"
|
v-for="item in dictStore.getDictData('Report_Template')"
|
||||||
:key="item.code"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.code"
|
:value="item.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ import type { ICD } from '@/api/device/interface/icd'
|
|||||||
prop: 'reportName',
|
prop: 'reportName',
|
||||||
label: '报告模版名称',
|
label: '报告模版名称',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
|
enum: dictStore.getDictData('Report_Template'),
|
||||||
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'icd',
|
prop: 'icd',
|
||||||
@@ -136,18 +138,15 @@ import type { ICD } from '@/api/device/interface/icd'
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 批量删除设备
|
// 批量删除设备类型
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
|
||||||
await useHandleData(deleteDevType, id, '删除所选设备类型')
|
await useHandleData(deleteDevType, id, '删除所选设备类型')
|
||||||
|
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除设备
|
// 删除设备类型
|
||||||
const handleDelete = async (params: DevType.ResPqDevType) => {
|
const handleDelete = async (params: DevType.ResPqDevType) => {
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
|
||||||
await useHandleData(deleteDevType, [params.id] , `删除【${params.name}】设备类型`)
|
await useHandleData(deleteDevType, [params.id] , `删除【${params.name}】设备类型`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ const disabledDate = (time: Date) => {
|
|||||||
encryptionFlag: 0,
|
encryptionFlag: 0,
|
||||||
reCheckNum:0,
|
reCheckNum:0,
|
||||||
state: 1,
|
state: 1,
|
||||||
factorFlag:0,
|
factorFlag:1,
|
||||||
icdId:'',
|
icdId:'',
|
||||||
power:'',
|
power:'',
|
||||||
preinvestmentPlan:''
|
preinvestmentPlan:''
|
||||||
@@ -224,7 +224,7 @@ const disabledDate = (time: Date) => {
|
|||||||
encryptionFlag: 0,
|
encryptionFlag: 0,
|
||||||
reCheckNum:0,
|
reCheckNum:0,
|
||||||
state: 1,
|
state: 1,
|
||||||
factorFlag:0,
|
factorFlag:1,
|
||||||
icdId:'',
|
icdId:'',
|
||||||
power:'',
|
power:'',
|
||||||
preinvestmentPlan:''
|
preinvestmentPlan:''
|
||||||
@@ -428,10 +428,20 @@ const handleDevTypeChange = (value: string) => {
|
|||||||
formContent.value.devVolt = dev.devVolt; // 默认值为1
|
formContent.value.devVolt = dev.devVolt; // 默认值为1
|
||||||
formContent.value.icdId = dev.icd
|
formContent.value.icdId = dev.icd
|
||||||
formContent.value.power = dev.power
|
formContent.value.power = dev.power
|
||||||
|
if(dev.name.includes('882B')){
|
||||||
|
formContent.value.ip = '172.17.102.220'
|
||||||
|
}else if(dev.name.includes('882A')){
|
||||||
|
formContent.value.ip = '172.17.102.221'
|
||||||
|
}else{
|
||||||
|
formContent.value.ip = '172.17.102.200'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
formContent.value.devChns = 1; // 默认值为1
|
formContent.value.devChns = 1; // 默认值为1
|
||||||
formContent.value.devCurr = 1; // 默认值为1
|
formContent.value.devCurr = 1; // 默认值为1
|
||||||
formContent.value.devVolt = 57.74; // 默认值为1
|
formContent.value.devVolt = 57.74; // 默认值为1
|
||||||
|
formContent.value.ip = '172.17.102.200'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { type ErrorSystem } from '@/api/device/interface/error';
|
import { type ErrorSystem } from '@/api/device/interface/error';
|
||||||
import ErrorSystemDetailTable from '@/views/machine/errorSystem/components/errorSystemDetailTable.vue';
|
import ErrorSystemDetailTable from '@/views/machine/errorSystem/components/errorSystemDetailTable.vue';
|
||||||
import {getDictTreeList} from '@/api/system/dictionary/dictTree'
|
import {getDictTreeByCode} from '@/api/system/dictionary/dictTree'
|
||||||
import { type Dict } from '@/api/system/dictionary/interface';
|
import { type Dict } from '@/api/system/dictionary/interface';
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
@@ -156,31 +156,31 @@ const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) =>
|
|||||||
}
|
}
|
||||||
// 封装提取第二层节点的逻辑
|
// 封装提取第二层节点的逻辑
|
||||||
const loadSecondLevelOptions = async () => {
|
const loadSecondLevelOptions = async () => {
|
||||||
const dictCode = '误差体系指标项'; // 替换为实际需要的字典代码
|
const dictCode = 'Err_Sys_Items'; // 替换为实际需要的字典代码
|
||||||
const dictCode2 = '脚本-误差'; // 替换为实际需要的字典代码
|
const dictCode2 = 'Script_Error'; // 替换为实际需要的字典代码
|
||||||
|
|
||||||
const resDictTree: Dict.ResDictTree = {
|
const resDictTree: Dict.ResDictTree = {
|
||||||
name: dictCode,
|
name: '',
|
||||||
id: '',
|
id: '',
|
||||||
pid: '',
|
pid: '',
|
||||||
pids: '',
|
pids: '',
|
||||||
code: '',
|
code: dictCode,
|
||||||
sort: 0
|
sort: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
const resDictTree2: Dict.ResDictTree = {
|
const resDictTree2: Dict.ResDictTree = {
|
||||||
name: dictCode2,
|
name: '',
|
||||||
id: '',
|
id: '',
|
||||||
pid: '',
|
pid: '',
|
||||||
pids: '',
|
pids: '',
|
||||||
code: '',
|
code: dictCode2,
|
||||||
sort: 0
|
sort: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
// 并行请求两个字典树列表
|
// 并行请求两个字典树列表
|
||||||
const [result, result2] = await Promise.all([
|
const [result, result2] = await Promise.all([
|
||||||
getDictTreeList(resDictTree),
|
getDictTreeByCode(resDictTree),
|
||||||
getDictTreeList(resDictTree2)
|
getDictTreeByCode(resDictTree2)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const allOptions = convertToOptions(result.data as Dict.ResDictTree[]);
|
const allOptions = convertToOptions(result.data as Dict.ResDictTree[]);
|
||||||
|
|||||||
@@ -29,26 +29,21 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='useRole'>
|
<script setup lang='tsx' name='useRole'>
|
||||||
import TimeControl from '@/components/TimeControl/index.vue'
|
|
||||||
import { type ICD } from '@/api/device/interface/icd'
|
import { type ICD } from '@/api/device/interface/icd'
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||||
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
import {
|
import {
|
||||||
getICDList,
|
getICDList,
|
||||||
deleteICD,
|
deleteICD,
|
||||||
} from '@/api/device/icd/index.ts'
|
} from '@/api/device/icd/index.ts'
|
||||||
import { reactive, ref } from 'vue'
|
import { reactive, ref } from 'vue'
|
||||||
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'devType',
|
name: 'devType',
|
||||||
})
|
})
|
||||||
const modeStore = useModeStore()
|
|
||||||
const dictStore = useDictStore()
|
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
const icdPopup = ref()
|
const icdPopup = ref()
|
||||||
@@ -101,14 +96,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 批量删除设备
|
// 批量删除icd
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
await useHandleData(deleteICD, id, '删除所选icd')
|
await useHandleData(deleteICD, id, '删除所选icd')
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除设备
|
// 删除设备icd
|
||||||
const handleDelete = async (params: ICD.ResICD) => {
|
const handleDelete = async (params: ICD.ResICD) => {
|
||||||
await useHandleData(deleteICD, [params.id] , `删除【${params.name}】icd`)
|
await useHandleData(deleteICD, [params.id] , `删除【${params.name}】icd`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
|
|||||||
@@ -0,0 +1,182 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
:header-cell-style="{
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: '#003078',
|
||||||
|
color: '#fff'
|
||||||
|
}"
|
||||||
|
stripe
|
||||||
|
height="calc(100vh - 480px)"
|
||||||
|
:style="{ overflow: 'hidden' }"
|
||||||
|
row-key="id"
|
||||||
|
:expand-row-keys="[props.activeName]"
|
||||||
|
>
|
||||||
|
<el-table-column prop="name" label="指标" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" label="参与误差比较" width="110px">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-switch
|
||||||
|
v-model="row.errorFlag"
|
||||||
|
v-if="row.show"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
:disabled="row.disabled || disabled"
|
||||||
|
>
|
||||||
|
<template #active-action>
|
||||||
|
<span>√</span>
|
||||||
|
</template>
|
||||||
|
<template #inactive-action>
|
||||||
|
<span>×</span>
|
||||||
|
</template>
|
||||||
|
</el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="是否启用" width="85px">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-switch
|
||||||
|
v-model="row.enable"
|
||||||
|
v-if="row.show"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
:disabled="row.disabled || disabled"
|
||||||
|
>
|
||||||
|
<template #active-action>
|
||||||
|
<span>√</span>
|
||||||
|
</template>
|
||||||
|
<template #inactive-action>
|
||||||
|
<span>×</span>
|
||||||
|
</template>
|
||||||
|
</el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import type { Dict } from '@/api/system/dictionary/interface'
|
||||||
|
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||||
|
import { checkDataList } from '@/api/device/testScript'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
activeName: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
formContent: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const tableData = ref<any[]>([])
|
||||||
|
const info = async () => {
|
||||||
|
let checkData: any = []
|
||||||
|
let title = props.options.filter((i: any) => i.value == props.activeName)[0]
|
||||||
|
|
||||||
|
await checkDataList({
|
||||||
|
scriptId: props.formContent.id,
|
||||||
|
scriptType: props.activeName
|
||||||
|
}).then((res: any) => {
|
||||||
|
checkData = res.data
|
||||||
|
})
|
||||||
|
|
||||||
|
let { data } = await getDictTreeByCode({
|
||||||
|
name: '',
|
||||||
|
id: '',
|
||||||
|
pid: '',
|
||||||
|
pids: '',
|
||||||
|
code: 'Script_Error',
|
||||||
|
sort: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
data[0].children.forEach((item: any, i: number) => {
|
||||||
|
tableData.value.push({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
show: false,
|
||||||
|
children: []
|
||||||
|
})
|
||||||
|
item.children.forEach((k: any) => {
|
||||||
|
let childrenList: any = []
|
||||||
|
checkData.forEach((j: any) => {
|
||||||
|
if (j.valueType == k.id) {
|
||||||
|
childrenList.push(j)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (childrenList.length > 0) {
|
||||||
|
tableData.value[i].children.push({
|
||||||
|
id: k.id,
|
||||||
|
pid: item.id,
|
||||||
|
name: k.name,
|
||||||
|
pname: item.name,
|
||||||
|
dataType:
|
||||||
|
item.name == '谐波有功功率'
|
||||||
|
? 'avg'
|
||||||
|
: item.name == '闪变'
|
||||||
|
? 'avg'
|
||||||
|
: item.name == '暂态'
|
||||||
|
? 'avg'
|
||||||
|
: 'real',
|
||||||
|
show: true,
|
||||||
|
errorFlag: childrenList[0].errorFlag,
|
||||||
|
enable: childrenList[0].enable
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
tableData.value[i].children.push({
|
||||||
|
id: k.id,
|
||||||
|
pid: item.id,
|
||||||
|
name: k.name,
|
||||||
|
disabled: false,
|
||||||
|
pname: item.name,
|
||||||
|
dataType: '谐波有功功率'
|
||||||
|
? 'avg'
|
||||||
|
: item.name == '闪变'
|
||||||
|
? 'avg'
|
||||||
|
: item.name == '暂态'
|
||||||
|
? 'avg'
|
||||||
|
: 'real',
|
||||||
|
show: true,
|
||||||
|
errorFlag: 0,
|
||||||
|
enable: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 默认够选通讯脚本
|
||||||
|
if (item.name == title.label.replace(/准确度|检测/g, '')) {
|
||||||
|
if (item.name == '暂态') {
|
||||||
|
tableData.value[i].children.forEach((k: any) => {
|
||||||
|
k.disabled = true
|
||||||
|
k.enable = 1
|
||||||
|
k.errorFlag = 1
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
tableData.value[i].children[0].disabled = true
|
||||||
|
tableData.value[i].children[0].enable = 1
|
||||||
|
tableData.value[i].children[0].errorFlag = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
//console.log('🚀 ~ item.children.forEach ~ tableData.value:', tableData.value)
|
||||||
|
}
|
||||||
|
const getData = () => {
|
||||||
|
return tableData.value
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
info()
|
||||||
|
// tableData.value = data.data[0].children || []
|
||||||
|
})
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ getData })
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
198
frontend/src/views/machine/testScript/components/scriptForm.ts
Normal file
198
frontend/src/views/machine/testScript/components/scriptForm.ts
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
|
||||||
|
|
||||||
|
let scriptForm: any = {
|
||||||
|
subType: '', //tabcode
|
||||||
|
ffreq: 50, //频率
|
||||||
|
channelList: [
|
||||||
|
{
|
||||||
|
channelType: 'Ua',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase: 0, //相角
|
||||||
|
harmList: [
|
||||||
|
// {
|
||||||
|
// harm: 2, //谐波次数
|
||||||
|
// famp: 0, //谐波含有率
|
||||||
|
// fphase: 0 // 谐波相角
|
||||||
|
// },
|
||||||
|
], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
},
|
||||||
|
{
|
||||||
|
channelType: 'Ia',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase: 0, //相角
|
||||||
|
harmList: [], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
},
|
||||||
|
{
|
||||||
|
channelType: 'Ub',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase: -120, //相角
|
||||||
|
harmList: [], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
},
|
||||||
|
{
|
||||||
|
channelType: 'Ib',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase:-120, //相角
|
||||||
|
harmList: [], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
},
|
||||||
|
{
|
||||||
|
channelType: 'Uc',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase: 120, //相角
|
||||||
|
harmList: [], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
},
|
||||||
|
{
|
||||||
|
channelType: 'Ic',
|
||||||
|
channelFlag: false, //通道使能
|
||||||
|
harmFlag: false, //谐波使能
|
||||||
|
inHarmFlag: false, //间谐波使能
|
||||||
|
flickerFlag: false, //闪变使能
|
||||||
|
dipFlag: false, //暂态使能
|
||||||
|
famp: 100, //幅值
|
||||||
|
fphase: 120, //相角
|
||||||
|
harmList: [], //谐波
|
||||||
|
inharmList: [
|
||||||
|
// {
|
||||||
|
// inharm: '', //间谐波次数
|
||||||
|
// famp: 0, //间谐波含有率
|
||||||
|
// fphase: 0 // 间谐波相角
|
||||||
|
// }
|
||||||
|
], //间谐波
|
||||||
|
flickerData: {
|
||||||
|
flickerValue: '1', //标准值
|
||||||
|
fchagValue: '2.724', //变动量
|
||||||
|
fchagFre: '1', //波动频度
|
||||||
|
waveType: 'CPM', // 波动类型
|
||||||
|
waveFluType: 'SQU', //波类型
|
||||||
|
fdutyCycle: 50 //占空比
|
||||||
|
}, //闪变
|
||||||
|
dipData: {
|
||||||
|
ftransValue: '', // 暂态幅值
|
||||||
|
retainTime: '' // 暂态持续时间
|
||||||
|
} //暂态
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
// 追加谐波
|
||||||
|
|
||||||
|
|
||||||
|
export default scriptForm
|
||||||
@@ -1,95 +1,240 @@
|
|||||||
import { ref } from "vue"
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" >
|
<div class="table-container">
|
||||||
<div class='table-box'>
|
<div class="recalculation">
|
||||||
<ProTable
|
<el-button type="primary" :icon="Refresh" @click="recalculation">一键重算</el-button>
|
||||||
ref='proTable'
|
|
||||||
:columns='columns'
|
|
||||||
:request-api="getTableList"
|
|
||||||
:pagination="false"
|
|
||||||
:toolButton ='false'
|
|
||||||
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}"
|
|
||||||
>
|
|
||||||
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
|
||||||
<!-- 表格 header 按钮 -->
|
|
||||||
<template #tableHeader='scope'>
|
|
||||||
<el-button v-auth.testScript="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
|
||||||
<el-button v-auth.testScript="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
|
||||||
删除
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
<!-- 表格操作 -->
|
|
||||||
<template #operation='scope'>
|
|
||||||
<el-button v-auth.testScript="'upgrade'" type='primary' v-if="scope.row.type !== 1" link :icon='Share' @click='updateType(scope.row)'>复制</el-button>
|
|
||||||
<el-button v-auth.testScript="'edit'" type='primary' link :icon='EditPen' :model-value="false" @click="openDialog('edit', scope.row)">编辑</el-button>
|
|
||||||
<el-button v-auth.testScript="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</ProTable>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
:header-cell-style="{
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: '#003078',
|
||||||
|
color: '#fff'
|
||||||
|
}"
|
||||||
|
stripe
|
||||||
|
:cell-style="{ textAlign: 'center' }"
|
||||||
|
height="550px"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" label="序号" width="60" />
|
||||||
|
<el-table-column prop="pname" label="参考设定值类型" />
|
||||||
|
<el-table-column prop="name" label="参考设定值子类型" width="250">
|
||||||
|
<template #default="{ row }">{{ row.harmNum ? `(${row.harmNum}次)` : '' }} {{ row.name }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="dataType" label="值类型">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-select v-model="row.dataType" v-if="!row.show">
|
||||||
|
<el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
<span v-else>
|
||||||
|
{{ typeList.find(item => item.value == row.dataType)?.label || row.dataType }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="phase" label="相别" />
|
||||||
|
<el-table-column prop="value" label="参考设定值">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="row.show">{{ parseFloat((row.value - 0).toFixed(4)) || '' }}</span>
|
||||||
|
<el-input type="number" v-else v-model="row.value" placeholder="请输入值" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="value" label="参与误差比较">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.errorFlag == 0 ? '否' : '是' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" link :icon="EditPen" @click="row.show = !row.show" v-if="row.show">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" link :icon="Check" @click="row.show = !row.show" v-else>保存</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog :title="dialogTitle" v-model="showForm" @close="close" width="500">
|
||||||
|
<el-form ref="form" :model="form" label-width="auto">
|
||||||
|
<el-form-item label="参考设定值类型" prop="name">
|
||||||
|
<el-input v-model="form.name" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="参考设定值子类型" prop="standardName">
|
||||||
|
<el-input v-model="form.standardName" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="参考设定值" prop="standardTime">
|
||||||
|
<el-input v-model="form.standardTime" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div >
|
<div>
|
||||||
<el-button @click='close()'>取 消</el-button>
|
<el-button @click="close()">取 消</el-button>
|
||||||
<el-button type="primary" @click='save()'>保存</el-button>
|
<el-button type="primary" @click="save">保 存</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
</template>
|
||||||
<SetValuePopup ref='setValuePopup' />
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { TestScript } from '@/api/device/interface/testScript'
|
import { Refresh, EditPen, Check, Share } from '@element-plus/icons-vue'
|
||||||
import type { ColumnProps } from '@/components/ProTable/interface'
|
import { reactive, ref } from 'vue'
|
||||||
import {reactive, ref } from 'vue'
|
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
|
import { checkDataList, scriptDtlsCheckDataList } from '@/api/device/testScript/index'
|
||||||
|
const showForm = ref(false)
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const dialogTitle = ref('')
|
const dialogTitle = ref('')
|
||||||
|
const props = defineProps({
|
||||||
|
activeName: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
|
formContent: {
|
||||||
|
type: [Object, Array],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
type: [Object, Array],
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['recalculation'])
|
||||||
|
const tableData: any = ref([])
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
const typeList = [
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
|
||||||
{
|
{
|
||||||
prop: 'name',
|
label: '实时',
|
||||||
label: '参考设定值类型',
|
value: 'real'
|
||||||
minWidth: 350,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardName',
|
label: 'CP95值',
|
||||||
label: '参考设定值子类型',
|
value: 'cp95'
|
||||||
minWidth: 150,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardTime',
|
label: '平均值',
|
||||||
label: '参考设定值',
|
value: 'avg'
|
||||||
minWidth: 150,
|
|
||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
{
|
||||||
])
|
label: '最小值',
|
||||||
|
value: 'min'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '最大值',
|
||||||
|
value: 'max'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const form = ref({
|
||||||
|
name: 220,
|
||||||
|
standardName: 0,
|
||||||
|
standardTime: 0
|
||||||
|
})
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = (sign: string,row: any) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
dialogTitle.value = sign === 'add'? '新增检测项目信息' : '编辑检测项目信息'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const open = async (row: any, copyRowList: any) => {
|
||||||
|
let treeData: any = []
|
||||||
|
await getDictTreeByCode({
|
||||||
|
name: '',
|
||||||
|
id: '',
|
||||||
|
pid: '',
|
||||||
|
pids: '',
|
||||||
|
code: 'Script_Error',
|
||||||
|
sort: 0
|
||||||
|
}).then((res: any) => {
|
||||||
|
treeData = res.data[0].children
|
||||||
|
})
|
||||||
|
let checkDataList: any = []
|
||||||
|
await row.forEach((item: any) => {
|
||||||
|
item.children.forEach((k: any) => {
|
||||||
|
if (k.enable != 0 || k.errorFlag != 0) {
|
||||||
|
checkDataList.push({
|
||||||
|
pid: k.pid,
|
||||||
|
valueType: k.id,
|
||||||
|
dataType: k.dataType,
|
||||||
|
enable: k.enable,
|
||||||
|
errorFlag: k.errorFlag
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
let form = handleHarmData(JSON.parse(JSON.stringify(props.form)))
|
||||||
|
let retryCompute = isEqual(form, copyRowList)
|
||||||
|
await scriptDtlsCheckDataList({
|
||||||
|
...form,
|
||||||
|
scriptId: props.formContent?.id,
|
||||||
|
scriptType: props.activeName,
|
||||||
|
checkDataList: checkDataList,
|
||||||
|
retryCompute: retryCompute
|
||||||
|
}).then((res: any) => {
|
||||||
|
res.data.forEach((item: any) => {
|
||||||
|
let pList = treeData.filter((i: any) => i.id == item.pid)[0]
|
||||||
|
item.pname = pList.name
|
||||||
|
item.name = pList.children.filter((i: any) => i.id == item.valueType)[0].name
|
||||||
|
item.show = true
|
||||||
|
})
|
||||||
|
tableData.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 重算
|
||||||
|
const recalculation = () => {
|
||||||
|
emit('recalculation')
|
||||||
|
}
|
||||||
|
// 处理多余数据
|
||||||
|
const handleHarmData = (row: any) => {
|
||||||
|
row.channelList.forEach((channel: any) => {
|
||||||
|
// 筛选出 famp 和 fphase 不同时为 0 的对象
|
||||||
|
channel.harmList = channel.harmList.filter((item: any) => item.famp != 0 || item.fphase != 0)
|
||||||
|
channel.inharmList = channel.inharmList.filter(
|
||||||
|
(item: any) => item.inharm !== '' || item.famp !== 0 || item.fphase !== 0
|
||||||
|
)
|
||||||
|
})
|
||||||
|
return row
|
||||||
|
}
|
||||||
|
// 判断数据是否变化
|
||||||
|
const isEqual = (obj1: any, obj2: any) => {
|
||||||
|
// 如果两个对象是同一个引用,直接返回 true
|
||||||
|
if (obj1 == obj2) return true
|
||||||
|
// 如果其中一个是 null 或者不是对象,返回 false
|
||||||
|
if (obj1 === null || typeof obj1 !== 'object' || obj2 === null || typeof obj2 !== 'object') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 获取两个对象的键
|
||||||
|
const keys1 = Object.keys(obj1)
|
||||||
|
const keys2 = Object.keys(obj2)
|
||||||
|
// 如果键的数量不同,返回 false
|
||||||
|
if (keys1.length !== keys2.length) return false
|
||||||
|
// 遍历所有键,递归比较值
|
||||||
|
for (const key of keys1) {
|
||||||
|
if (!keys2.includes(key) || !isEqual(obj1[key], obj2[key])) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
const save = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
const getTableData = () => {
|
||||||
|
return tableData.value
|
||||||
|
}
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
onMounted(() => {})
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open, getTableData })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.recalculation {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: end;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,178 +1,618 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1400px">
|
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1450px">
|
||||||
<div class="dialog-content" >
|
<el-carousel height="600px" :autoplay="false" ref="carouselRef" indicator-position="none">
|
||||||
<el-tabs type="border-card" class="left-tabs" style="height: 100%;">
|
<el-carousel-item :name="0" style="height: 100%; overflow-y: auto">
|
||||||
|
<div class="dialog-content">
|
||||||
|
<el-tabs type="border-card" class="right-tabs">
|
||||||
|
<el-tab-pane label="检测">
|
||||||
|
<!-- 全局设置菜单内容 -->
|
||||||
|
<div style="height: 295px">
|
||||||
|
<el-radio-group v-model="form.subType">
|
||||||
|
<el-radio
|
||||||
|
v-for="item in tabChildren"
|
||||||
|
:key="item"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.code"
|
||||||
|
border
|
||||||
|
style="margin: 0 0 10px 10px"
|
||||||
|
/>
|
||||||
|
<!-- <el-radio v-for="item in tabChildren" :value="item.value" border>{{ item.label }}</el-radio> -->
|
||||||
|
</el-radio-group>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<el-tabs type="border-card" class="left-tabs" style="height: 100%">
|
||||||
<el-tab-pane label="输出菜单">
|
<el-tab-pane label="输出菜单">
|
||||||
<!-- 输出菜单内容 -->
|
<!-- 输出菜单内容 -->
|
||||||
<el-table :data="tableData"
|
<el-table
|
||||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
:data="tableData"
|
||||||
:cell-style="{ textAlign: 'center' }"
|
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:style="{ height: '295px',overflow:'hidden'}"
|
:style="{ height: '295px', overflow: 'hidden' }"
|
||||||
:show-header="false"
|
:show-header="false"
|
||||||
:span-method="arraySpanMethod">
|
:span-method="arraySpanMethod"
|
||||||
<el-table-column prop="sort" label="相别" width="60" />
|
:cell-style="tableStyle.cellStyle"
|
||||||
<el-table-column prop="frequency" label="电压/电流" width="90" />
|
:header-cell-style="{ textAlign: 'center', backgroundColor: '#003078', color: '#fff' }"
|
||||||
<el-table-column prop="L1" label="值" width="180"/>
|
@cell-click="handleRowClick"
|
||||||
<el-table-column label="操作" width="80">
|
:key="key"
|
||||||
<template #default="{ }">
|
>
|
||||||
<el-button type="info" :icon="Bottom"></el-button>
|
<el-table-column prop="name" label="相别" width="60" align="center" />
|
||||||
|
<el-table-column prop="frequency" label="电压/电流" align="center" width="60" />
|
||||||
|
<el-table-column prop="L1" label="值" width="180" align="center">
|
||||||
|
<template #default="{ row, $index }">
|
||||||
|
<span>
|
||||||
|
{{ row.type === 'V' ? '电压' : '电流' }}{{ form.channelList[$index].famp
|
||||||
|
}}{{
|
||||||
|
valueCode == 'Absolute' ? (row.type === 'V' ? 'V' : 'A') : '%'
|
||||||
|
}}
|
||||||
|
相角{{ form.channelList[$index].fphase }}°
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作">
|
<el-table-column label="操作" width="85">
|
||||||
<template #default="{ row, $index }">
|
<template #default="{ row, $index }">
|
||||||
<el-button :type="buttonTypes[$index].channel || 'info'" @click="toggleType(row, $index,'channel')">通道使能</el-button>
|
<!-- <el-button
|
||||||
<el-button :type="buttonTypes[$index]?.harmonic || 'info'" @click="toggleType(row, $index, 'harmonic')">谐波使能</el-button>
|
type="primary"
|
||||||
<el-button :type="buttonTypes[$index]?.interHarmonic || 'info'" @click="toggleType(row, $index, 'interHarmonic')">间谐波使能</el-button>
|
v-if="$index != 4"
|
||||||
<el-button :type="buttonTypes[$index]?.flicker || 'info'" @click="toggleType(row, $index, 'flicker')">闪变使能</el-button>
|
link
|
||||||
<el-button :type="buttonTypes[$index]?.transient || 'info'" @click="toggleType(row, $index, 'transient')">暂态使能</el-button>
|
:icon="CopyDocument"
|
||||||
|
@click="copyRow($index)"
|
||||||
|
>
|
||||||
|
复制
|
||||||
|
</el-button> -->
|
||||||
|
<el-dropdown placement="top-start">
|
||||||
|
<el-button type="primary" link :icon="CopyDocument">复制</el-button>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu>
|
||||||
|
<div v-if="$index == 0">
|
||||||
|
<el-dropdown-item @click="copyRow(0, 2)">L2</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click="copyRow(0, 4)">L3</el-dropdown-item>
|
||||||
|
</div>
|
||||||
|
<div v-if="$index == 2">
|
||||||
|
<el-dropdown-item @click="copyRow(2, 0)">L1</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click="copyRow(2, 4)">L3</el-dropdown-item>
|
||||||
|
</div>
|
||||||
|
<div v-if="$index == 4">
|
||||||
|
<el-dropdown-item @click="copyRow(4, 0)">L1</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click="copyRow(4, 2)">L2</el-dropdown-item>
|
||||||
|
</div>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center">
|
||||||
|
<template #default="{ row, $index }">
|
||||||
|
<el-checkbox-button
|
||||||
|
v-model="form.channelList[$index].channelFlag"
|
||||||
|
label="通道使能"
|
||||||
|
/>
|
||||||
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<el-tabs type="border-card" class="right-tabs" style="height: 100%;">
|
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
|
||||||
<el-tab-pane label="全局设置菜单">
|
<el-tab-pane label="全局设置菜单">
|
||||||
<!-- 全局设置菜单内容 -->
|
<!-- 全局设置菜单内容 -->
|
||||||
|
<div style="height: 295px; width: 170px">
|
||||||
<div class="form-item-container">
|
<div class="form-item-container">
|
||||||
<el-form-item label="频率:" prop='name'>
|
<el-form-item label="频率:" prop="name">
|
||||||
<div class="input-label-container">
|
<div class="input-label-container">
|
||||||
<el-input style="width: 100px;" />
|
<el-input type="number" style="width: 100px" v-model="form.ffreq" />
|
||||||
<label>Hz</label>
|
<label>Hz</label>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-label-container">
|
<!-- <div class="button-label-container">
|
||||||
<label>参考设定值列表:</label>
|
<label>参考设定值列表:</label>
|
||||||
<el-button type="primary" :icon='EditPen' @click="openDialog">编辑</el-button>
|
<el-button type="primary" :icon="EditPen" @click="openDialog">编辑</el-button>
|
||||||
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top: 20px;">
|
<div style="margin-top: 10px; height: 234px">
|
||||||
<el-tabs type="border-card" class="custom-tabs">
|
<el-tabs type="border-card" class="custom-tabs">
|
||||||
<el-tab-pane label="电压/电流编辑">
|
<el-tab-pane label="电压/电流编辑" v-if="childForm[0].channelFlag || childForm[1].channelFlag">
|
||||||
<TestScriptVolCurTab/>
|
<TestScriptVolCurTab :childForm="childForm" :valueCode="valueCode" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="谐波编辑">
|
<el-tab-pane label="谐波编辑" v-if="childForm[0].harmFlag || childForm[1].harmFlag">
|
||||||
<TestScriptHarmTab/>
|
<TestScriptHarmTab :childForm="childForm" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="间谐波编辑">
|
<el-tab-pane label="间谐波编辑" v-if="childForm[0].inHarmFlag || childForm[1].inHarmFlag">
|
||||||
<TestScriptInHarmTab/>
|
<TestScriptInHarmTab :childForm="childForm" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="闪变编辑">
|
<el-tab-pane label="闪变编辑" v-if="childForm[0].flickerFlag || childForm[1].flickerFlag">
|
||||||
<TestScriptFlickerTab/>
|
<TestScriptFlickerTab :childForm="childForm" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="暂态编辑">
|
<el-tab-pane label="暂态编辑" v-if="childForm[0].dipFlag || childForm[1].dipFlag">
|
||||||
<TestScriptDipTab/>
|
<TestScriptDipTab :childForm="childForm" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
</el-carousel-item>
|
||||||
<SetValueTable ref="setValueTable"/>
|
<el-carousel-item :name="1" style="height: 100%; overflow-y: auto" v-if="showSetValueTable">
|
||||||
|
<SetValueTable
|
||||||
|
ref="setValueTableRef"
|
||||||
|
:activeName="props.activeName"
|
||||||
|
:formContent="props.formContent"
|
||||||
|
:form="form"
|
||||||
|
:key="initial"
|
||||||
|
@recalculation="recalculation"
|
||||||
|
/>
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div >
|
<div>
|
||||||
<el-button @click='close()'>取 消</el-button>
|
<el-button @click="close">取 消</el-button>
|
||||||
<el-button type="primary" @click='save()'>保存</el-button>
|
<el-button type="primary" @click="next" v-if="!showSetValueTable">下一步</el-button>
|
||||||
|
<el-button type="primary" @click="previous" v-if="showSetValueTable">上一步</el-button>
|
||||||
|
<el-button type="primary" @click="save" v-if="showSetValueTable">保存</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { onMounted, reactive, ref } from 'vue'
|
||||||
import SetValueTable from '@/views/machine/testScript/components/setValueTable.vue';
|
import SetValueTable from '@/views/machine/testScript/components/setValueTable.vue'
|
||||||
import {EditPen,ArrowDown, Bottom} from '@element-plus/icons-vue'
|
import { EditPen, ArrowDown, Bottom, CopyDocument } from '@element-plus/icons-vue'
|
||||||
import { type TabsInstance } from 'element-plus';
|
import { type TabsInstance } from 'element-plus'
|
||||||
import TestScriptVolCurTab from '@/views/machine/testScript/components/testScriptVolCurTab.vue';
|
import TestScriptVolCurTab from '@/views/machine/testScript/components/testScriptVolCurTab.vue'
|
||||||
import TestScriptHarmTab from '@/views/machine/testScript/components/testScriptHarmTab.vue';
|
import TestScriptHarmTab from '@/views/machine/testScript/components/testScriptHarmTab.vue'
|
||||||
import TestScriptInHarmTab from '@/views/machine/testScript/components/testScriptInHarmTab.vue';
|
import TestScriptInHarmTab from '@/views/machine/testScript/components/testScriptInHarmTab.vue'
|
||||||
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue';
|
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue'
|
||||||
import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue';
|
import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { addScriptDtls } from '@/api/device/testScript'
|
||||||
|
import scriptForm from './scriptForm'
|
||||||
|
import { on } from 'events'
|
||||||
|
|
||||||
|
const emit = defineEmits(['addTab', 'close', 'getCommunication'])
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const props = defineProps({
|
||||||
|
options: {
|
||||||
|
type: [Array, Object],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
activeName: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
childActiveName: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
formContent: {
|
||||||
|
type: [Object, Array],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
communicationList: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const copyRowList = ref({})
|
||||||
|
const key = ref(0)
|
||||||
|
// let valueType
|
||||||
|
const showSetValueTable = ref(false)
|
||||||
|
const form: any = ref(JSON.parse(JSON.stringify(scriptForm)))
|
||||||
|
const childForm: any = ref([])
|
||||||
|
const ScriptValueType = ref('')
|
||||||
|
const initial = ref(0) //轮播图索引
|
||||||
|
const carouselRef = ref()
|
||||||
|
const setValueTableRef = ref()
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const dialogTitle = ref()
|
const dialogTitle = ref()
|
||||||
const setValueTable = ref()
|
const valueCode = ref('') //Absolute绝对值
|
||||||
const buttonTypeOptions = ['default', 'text', 'success', 'warning', 'info', 'primary', 'danger'] as const;
|
|
||||||
type ButtonType = typeof buttonTypeOptions[number];
|
|
||||||
// 初始化按钮类型
|
|
||||||
const buttonTypes = reactive<{ [key: number]: { channel: ButtonType, harmonic: ButtonType, interHarmonic: ButtonType, flicker: ButtonType, transient: ButtonType } }>({});
|
|
||||||
|
|
||||||
|
const tableData = [
|
||||||
|
{ name: 'L1', frequency: 'Ua', type: 'V', electricity: 0, fphase: 0, sort: 0 },
|
||||||
|
{ name: 'L1', frequency: 'Ia', type: 'I', electricity: 0, fphase: 0, sort: 0 },
|
||||||
|
{ name: 'L2', frequency: 'Ub', type: 'V', electricity: 0, fphase: 0, sort: 1 },
|
||||||
|
{ name: 'L2', frequency: 'Ib', type: 'I', electricity: 0, fphase: 0, sort: 1 },
|
||||||
|
{ name: 'L3', frequency: 'Uc', type: 'V', electricity: 0, fphase: 0, sort: 2 },
|
||||||
|
{ name: 'L3', frequency: 'Ic', type: 'I', electricity: 0, fphase: 0, sort: 2 }
|
||||||
|
]
|
||||||
|
|
||||||
const tableData= [
|
const tabChildren: any = ref([])
|
||||||
{ sort: 'L1', frequency: 'V', L1: '电压:57.75V 相角:0°'},
|
|
||||||
{ sort: 'L1', frequency: 'I', L1: '电压:57.75V 相角:0°'},
|
|
||||||
{ sort: 'L2', frequency: 'V', L1: '电压:57.75V 相角:0°'},
|
|
||||||
{ sort: 'L2', frequency: 'I', L1: '电压:57.75V 相角:0°'},
|
|
||||||
{ sort: 'L3', frequency: 'V', L1: '电压:57.75V 相角:0°'},
|
|
||||||
{ sort: 'L3', frequency: 'I', L1: '电压:57.75V 相角:0°'},
|
|
||||||
]
|
|
||||||
|
|
||||||
// 定义 span-method 逻辑
|
// 定义 span-method 逻辑
|
||||||
const arraySpanMethod = ({ rowIndex, columnIndex }: { rowIndex: number; columnIndex: number }) => {
|
const arraySpanMethod = ({ rowIndex, columnIndex }: { rowIndex: number; columnIndex: number }) => {
|
||||||
if (columnIndex === 0 || columnIndex === 3) { // 第一列
|
if (columnIndex === 0 || columnIndex === 3) {
|
||||||
|
// 第一列
|
||||||
if (rowIndex % 2 === 0) {
|
if (rowIndex % 2 === 0) {
|
||||||
return {
|
return {
|
||||||
rowspan: 2,
|
rowspan: 2,
|
||||||
colspan: 1
|
colspan: 1
|
||||||
};
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
rowspan: 0,
|
rowspan: 0,
|
||||||
colspan: 0
|
colspan: 0
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
const selectedRow = ref('')
|
||||||
|
const tableStyle = {
|
||||||
|
cellStyle: ({ row }: { row: any }) => {
|
||||||
|
return row.name === selectedRow.value
|
||||||
|
? { backgroundColor: '#dcdcdc' } // 设置选中行的背景颜色
|
||||||
|
: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const handleRowClick = async (row: any, column: any) => {
|
||||||
|
if (column.label == '相别' || column.label == '操作') {
|
||||||
|
childForm.value = []
|
||||||
|
selectedRow.value = row.name
|
||||||
|
childForm.value.push(form.value.channelList[row.sort * 2])
|
||||||
|
childForm.value.push(form.value.channelList[row.sort * 2 + 1])
|
||||||
|
console.log('🚀 ~ handleRowClick ~ childForm.value:', childForm.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// childForm.value = row
|
||||||
// 切换按钮类型
|
}
|
||||||
const toggleType = (row: any, $index: number, buttonType: 'channel' | 'harmonic' | 'interHarmonic' | 'flicker' | 'transient') => {
|
|
||||||
if ($index !== undefined) {
|
|
||||||
const currentType = buttonTypes[$index][buttonType];
|
|
||||||
buttonTypes[$index][buttonType] = currentType === 'info' ? 'primary' : 'info';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
|
emit('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
const save = () => {
|
const save = () => {
|
||||||
|
let copyForm = handleHarmData()
|
||||||
|
copyForm.checkDataList = setValueTableRef.value?.getTableData()
|
||||||
|
if (copyForm.checkDataList.some(item => item.value === null || item.value === '')) {
|
||||||
|
return ElMessage.warning({
|
||||||
|
message: '请填写所有参考设定值',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
addScriptDtls({ ...copyForm, scriptId: props.formContent.id, scriptType: props.activeName }).then(res => {
|
||||||
|
if (res.code === 'A0000') {
|
||||||
|
ElMessage.success({
|
||||||
|
message: dialogTitle.value == '新增检测项目信息' ? '添加检测脚本成功!' : '编辑检测脚本成功!',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
dialogVisible.value = false
|
||||||
|
emit('addTab', form.value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// emit('addTab', form.value)
|
||||||
|
}
|
||||||
|
// 上一步
|
||||||
|
const previous = () => {
|
||||||
|
carouselRef.value.setActiveItem(0)
|
||||||
|
showSetValueTable.value = false
|
||||||
|
}
|
||||||
|
// 下一步
|
||||||
|
const next = () => {
|
||||||
|
emit('getCommunication')
|
||||||
|
setTimeout(() => {
|
||||||
|
// 判断通讯脚本
|
||||||
|
if (form.value.ffreq == '') {
|
||||||
|
ElMessage.warning({
|
||||||
|
message: '请填写频率!',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let { flag, message } = checkFlags()
|
||||||
|
// // 判断够选通道
|
||||||
|
if (!flag) {
|
||||||
|
ElMessage.warning({
|
||||||
|
message: message,
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
showSetValueTable.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
setValueTableRef.value?.open(props.communicationList, copyRowList.value)
|
||||||
|
|
||||||
|
carouselRef.value.setActiveItem(1)
|
||||||
|
}, 100)
|
||||||
|
}, 100)
|
||||||
|
// 切换轮播图
|
||||||
|
}
|
||||||
|
// 重新计算
|
||||||
|
const recalculation = () => {
|
||||||
|
setValueTableRef.value?.open(props.communicationList, {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断够选通道
|
||||||
|
const checkFlags = () => {
|
||||||
|
let list: any = []
|
||||||
|
let flag = true
|
||||||
|
let message = ''
|
||||||
|
props.communicationList.forEach((item: any) => {
|
||||||
|
list.push(...item.children.filter((item: any) => item.enable != 0 || item.errorFlag != 0))
|
||||||
|
})
|
||||||
|
|
||||||
|
for (const item of list) {
|
||||||
|
switch (item.pname) {
|
||||||
|
case '频率':
|
||||||
|
flag = form.value.channelList.some(item => item.channelFlag == true)
|
||||||
|
message = '请选择通道使能'
|
||||||
|
break
|
||||||
|
case '电压':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].channelFlag == false &&
|
||||||
|
form.value.channelList[2].channelFlag == false &&
|
||||||
|
form.value.channelList[4].channelFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中够选了电压,请选择电压通道使能' }
|
||||||
|
|
||||||
|
break
|
||||||
|
case '谐波电压':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].harmFlag == false &&
|
||||||
|
form.value.channelList[2].harmFlag == false &&
|
||||||
|
form.value.channelList[4].harmFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中够选了谐波电压,请选择谐波电压通道使能' }
|
||||||
|
break
|
||||||
|
case '谐波电流':
|
||||||
|
if (
|
||||||
|
form.value.channelList[1].harmFlag == false &&
|
||||||
|
form.value.channelList[3].harmFlag == false &&
|
||||||
|
form.value.channelList[5].harmFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中够选了谐波电流,请选择谐波电流通道使能' }
|
||||||
|
break
|
||||||
|
case '谐波有功功率':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].harmFlag == false &&
|
||||||
|
form.value.channelList[1].harmFlag == false &&
|
||||||
|
form.value.channelList[2].harmFlag == false &&
|
||||||
|
form.value.channelList[3].harmFlag == false &&
|
||||||
|
form.value.channelList[4].harmFlag == false &&
|
||||||
|
form.value.channelList[5].harmFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中够选了谐波有功功率,请选择间电压、电流谐波通道使能' }
|
||||||
|
break
|
||||||
|
case '间谐波电压':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].inHarmFlag == false &&
|
||||||
|
form.value.channelList[2].inHarmFlag == false &&
|
||||||
|
form.value.channelList[4].inHarmFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中够选了间谐波电压,请选择间谐波电压通道使能' }
|
||||||
|
break
|
||||||
|
case '间谐波电流':
|
||||||
|
if (
|
||||||
|
form.value.channelList[1].inHarmFlag == false &&
|
||||||
|
form.value.channelList[3].inHarmFlag == false &&
|
||||||
|
form.value.channelList[5].inHarmFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中够选了间谐波电流,请选择间谐波电流通道使能' }
|
||||||
|
break
|
||||||
|
case '暂态':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].dipFlag == false &&
|
||||||
|
form.value.channelList[2].dipFlag == false &&
|
||||||
|
form.value.channelList[4].dipFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中够选了暂态,请选择电压暂态通道使能' }
|
||||||
|
break
|
||||||
|
case '电流':
|
||||||
|
if (
|
||||||
|
form.value.channelList[1].channelFlag == false &&
|
||||||
|
form.value.channelList[3].channelFlag == false &&
|
||||||
|
form.value.channelList[5].channelFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中够选了电压,请选择电压通道使能' }
|
||||||
|
break
|
||||||
|
case '三相电压不平衡度':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].channelFlag == false ||
|
||||||
|
form.value.channelList[2].channelFlag == false ||
|
||||||
|
form.value.channelList[4].channelFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中够选了三相电压不平衡度,请选择电压A、B、C通道使能' }
|
||||||
|
break
|
||||||
|
case '三相电流不平衡度':
|
||||||
|
if (
|
||||||
|
form.value.channelList[1].channelFlag == false ||
|
||||||
|
form.value.channelList[3].channelFlag == false ||
|
||||||
|
form.value.channelList[5].channelFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中够选了三相电流不平衡度,请选择电流A、B、C通道使能' }
|
||||||
|
break
|
||||||
|
case '闪变':
|
||||||
|
if (
|
||||||
|
form.value.channelList[0].flickerFlag == false &&
|
||||||
|
form.value.channelList[2].flickerFlag == false &&
|
||||||
|
form.value.channelList[4].flickerFlag == false
|
||||||
|
)
|
||||||
|
return { flag: false, message: '通讯脚本中够选了闪变,请选择电压闪变通道使能' }
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let index = 0; index < form.value.channelList.length; index++) {
|
||||||
|
const item = form.value.channelList[index]
|
||||||
|
const result = checkChannelValues(item, index)
|
||||||
|
|
||||||
|
if (!result.flag) {
|
||||||
|
flag = result.flag
|
||||||
|
message = result.message
|
||||||
|
break // 如果发现错误,直接退出循环
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { flag, message }
|
||||||
|
}
|
||||||
|
// 判断通道值
|
||||||
|
const checkChannelValues = (item: any, index: number) => {
|
||||||
|
const channelNames = ['L1/Ua', 'L1/Ia', 'L2/Ub', 'L2/Ib', 'L3/Uc', 'L3/Ic']
|
||||||
|
const channelName = channelNames[index] || ''
|
||||||
|
|
||||||
|
// 检查通道使能
|
||||||
|
if (item.channelFlag === false && (item.harmFlag || item.inHarmFlag || item.flickerFlag || item.dipFlag)) {
|
||||||
|
return { flag: false, message: `请选择${channelName}通道使能` }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查通道使能值
|
||||||
|
if (item.channelFlag === true && (item.famp === '' || item.fphase === '')) {
|
||||||
|
return { flag: false, message: '请填写通道使能值' }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查谐波使能值
|
||||||
|
if (item.harmFlag === true && item.harmList.filter(harm => harm.famp != 0 || harm.fphase != 0).length == 0) {
|
||||||
|
return { flag: false, message: '请填写谐波使能值' }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查间谐波使能值
|
||||||
|
if (
|
||||||
|
item.inHarmFlag === true &&
|
||||||
|
item.inharmList.filter(harm => harm.inharm !== '' || harm.famp !== 0 || harm.fphase !== 0).length === 0
|
||||||
|
) {
|
||||||
|
return { flag: false, message: '请填写间谐波使能值' }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查闪变使能值
|
||||||
|
if (
|
||||||
|
item.flickerFlag === true &&
|
||||||
|
(item.flickerData.fchagFre === '' || item.flickerData.fchagValue === '') &&
|
||||||
|
index != 1 &&
|
||||||
|
index != 3 &&
|
||||||
|
index != 5
|
||||||
|
) {
|
||||||
|
return { flag: false, message: '请填写闪变使能值' }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查暂态使能值
|
||||||
|
if (
|
||||||
|
item.dipFlag === true &&
|
||||||
|
(item.dipData.ftransValue === '' || item.dipData.retainTime === '') &&
|
||||||
|
index != 1 &&
|
||||||
|
index != 3 &&
|
||||||
|
index != 5
|
||||||
|
) {
|
||||||
|
return { flag: false, message: '请填写暂态使能值' }
|
||||||
|
}
|
||||||
|
|
||||||
|
return { flag: true, message: '' }
|
||||||
|
}
|
||||||
|
//处理谐波数据
|
||||||
|
const handleHarmData = () => {
|
||||||
|
let copyForm = JSON.parse(JSON.stringify(form.value))
|
||||||
|
|
||||||
|
copyForm.channelList.forEach((channel: any) => {
|
||||||
|
// 筛选出 famp 和 fphase 不同时为 0 的对象
|
||||||
|
channel.harmList = channel.harmList.filter((item: any) => item.famp != 0 || item.fphase != 0)
|
||||||
|
channel.inharmList = channel.inharmList.filter(
|
||||||
|
(item: any) => item.inharm !== '' || item.famp !== 0 || item.fphase !== 0
|
||||||
|
)
|
||||||
|
})
|
||||||
|
return copyForm
|
||||||
|
}
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = (sign: string,row: any) => {
|
const open = (sign: string, row: any) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = sign === 'add'? '新增检测项目信息' : '编辑检测项目信息'
|
valueCode.value = dictStore
|
||||||
|
.getDictData('Script_Value_Type')
|
||||||
|
.filter(item => item.id == props.formContent.valueType)[0].code
|
||||||
|
dialogTitle.value = sign === 'add' ? '新增检测项目信息' : '编辑检测项目信息'
|
||||||
|
// 添加选择检测项目
|
||||||
|
tabChildren.value = JSON.parse(
|
||||||
|
JSON.stringify(props.options.filter(item => item.value == props.activeName)[0].children || [])
|
||||||
|
)
|
||||||
|
|
||||||
// 初始化按钮类型
|
// 判断是否存在 code 在 targetCodes 中
|
||||||
tableData.forEach((_, index) => {
|
const hasTargetCode = tabChildren.value.some(item =>
|
||||||
buttonTypes[index] = {
|
['Base_0_10', 'Base_20_85', 'Base_110_200'].includes(item.code)
|
||||||
channel: 'info',
|
)
|
||||||
harmonic: 'info',
|
if (hasTargetCode) {
|
||||||
interHarmonic: 'info',
|
tabChildren.value.unshift({
|
||||||
flicker: 'info',
|
code: 'Base',
|
||||||
transient: 'info'
|
label: '额定工作条件下的检测',
|
||||||
};
|
value: '999999999999999999'
|
||||||
});
|
})
|
||||||
|
tabChildren.value = tabChildren.value.filter(
|
||||||
|
item => item.code !== 'Base_0_10' && item.code !== 'Base_20_85' && item.code !== 'Base_110_200'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// subType.value = tabChildren.value[0].code || ''
|
||||||
|
if (sign == 'add') {
|
||||||
|
form.value.subType =
|
||||||
|
props.childActiveName == ''
|
||||||
|
? JSON.parse(JSON.stringify(tabChildren.value[0].code)) || ''
|
||||||
|
: JSON.parse(JSON.stringify(props.childActiveName))
|
||||||
|
|
||||||
|
if (valueCode.value == 'Absolute') {
|
||||||
|
form.value.channelList.forEach((item: any) => {
|
||||||
|
item.famp = 0
|
||||||
|
item.fphase = 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
form.value = JSON.parse(JSON.stringify(row))
|
||||||
|
copyRowList.value = JSON.parse(JSON.stringify(row))
|
||||||
|
}
|
||||||
|
if (['Base_0_10', 'Base_20_85', 'Base_110_200'].includes(form.value.subType)) {
|
||||||
|
form.value.subType = 'Base'
|
||||||
|
}
|
||||||
|
|
||||||
|
handleRowClick({ name: 'L1', sort: 0 }, { label: '相别' })
|
||||||
|
dictStore.getDictData('Script_Value_Type')
|
||||||
|
//console.log('🚀 ~ open ~ tabChildren.value:', tabChildren.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断后台没有谐波,简谐波值 用于回显
|
||||||
|
|
||||||
|
const setharmList = (row: any) => {
|
||||||
|
row.channelList.forEach((item: any) => {
|
||||||
|
if (item.inharmList.length == 0) {
|
||||||
|
item.inharmList.push({ inharm: '', famp: 0, fphase: 0 })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return row
|
||||||
|
}
|
||||||
|
// 复制
|
||||||
|
const copyRow = (num: number, index: number) => {
|
||||||
|
form.value.channelList[index] = JSON.parse(JSON.stringify(form.value.channelList[num]))
|
||||||
|
form.value.channelList[index + 1] = JSON.parse(JSON.stringify(form.value.channelList[num + 1]))
|
||||||
|
form.value.channelList[0].channelType = 'Ua'
|
||||||
|
form.value.channelList[1].channelType = 'Ia'
|
||||||
|
form.value.channelList[2].channelType = 'Ub'
|
||||||
|
form.value.channelList[3].channelType = 'Ia'
|
||||||
|
form.value.channelList[4].channelType = 'Uc'
|
||||||
|
form.value.channelList[5].channelType = 'Ic'
|
||||||
|
key.value += 1
|
||||||
|
ElMessage.success({
|
||||||
|
message: '复制成功!',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = () => {
|
const openDialog = () => {}
|
||||||
setValueTable.value?.open()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
@@ -183,7 +623,6 @@ defineExpose({ open })
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
height: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs-container {
|
.tabs-container {
|
||||||
@@ -194,12 +633,12 @@ defineExpose({ open })
|
|||||||
}
|
}
|
||||||
|
|
||||||
.left-tabs {
|
.left-tabs {
|
||||||
flex: 3; /* 左侧 tab 占据 3/4 的宽度 */
|
width: 900px;
|
||||||
margin-right: 10px; /* 可选:添加间距 */
|
margin: 0 10px; /* 可选:添加间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-tabs {
|
.right-tabs {
|
||||||
flex: 1; /* 右侧 tab 占据 1/4 的宽度 */
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-item-container {
|
.form-item-container {
|
||||||
@@ -225,5 +664,16 @@ defineExpose({ open })
|
|||||||
.input-label-container label {
|
.input-label-container label {
|
||||||
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
||||||
}
|
}
|
||||||
|
:deep(.el-carousel__indicators) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
:deep(.el-carousel__arrow) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
:deep(.el-tabs--border-card > .el-tabs__content) {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
:deep(.el-table__body) {
|
||||||
|
border-top: var(--el-table-border);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,238 +1,491 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
<div class="divider-container">
|
<div class="divider-container">
|
||||||
<el-divider style="width: 400px">检测脚本信息</el-divider>
|
<el-divider style="width: 260px" content-position="left">检测脚本信息</el-divider>
|
||||||
<el-divider style="width: 1300px">检测项目概要信息</el-divider>
|
<!-- <el-divider style="width: 400px" content-position="left">通讯脚本</el-divider> -->
|
||||||
|
<el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider>
|
||||||
</div>
|
</div>
|
||||||
<div class="data-check-content">
|
<div class="data-check-content">
|
||||||
<div class="content-tree" >
|
<div class="content-tree">
|
||||||
<el-tree
|
<Tree :treeData="treeData" @setTab="setTab" />
|
||||||
:default-expanded-keys="['0', '0-1', '0-2', '0-3', '1']"
|
|
||||||
node-key="id"
|
|
||||||
:data="data"
|
|
||||||
:props="defaultProps"
|
|
||||||
@node-click="handleNodeClick" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content-right-Tabs" style="height: 470px;width: 100px;">
|
<div class="content-right-Tabs" style="height: calc(100vh - 315px); width: 100px">
|
||||||
<el-tabs type="border-card" style="height: 100%;">
|
<el-tabs type="border-card" style="height: 100%" v-model="activeName" @tab-change="tabChange">
|
||||||
<el-tab-pane
|
<el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
|
||||||
v-for="tab in props.options"
|
<div v-if="activeName == tab.value">
|
||||||
:key="tab.name"
|
<div class="dialog-footer">
|
||||||
:label="tab.label.replace(/准确度|检测/g, '')"
|
<el-button :icon="CirclePlus" type="primary" @click="openDialog('add')">新增</el-button>
|
||||||
:name="tab.name">
|
</div>
|
||||||
<!-- 频率tab -->
|
<div style="display: flex">
|
||||||
<el-tabs type="border-card" style="height: 400px;">
|
<!-- 通信脚本 -->
|
||||||
|
<el-tabs type="border-card" v-model="firstName" style="height: 100%">
|
||||||
|
<el-tab-pane label="通讯脚本" name="first">
|
||||||
|
<Commun
|
||||||
|
:activeName="activeName"
|
||||||
|
:formContent="props.formContent"
|
||||||
|
:options="props.options"
|
||||||
|
style="width: 360px"
|
||||||
|
:disabled="tab.children.length == 0 ? false : true"
|
||||||
|
ref="communRef"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<!-- 2级tab -->
|
||||||
|
<el-tabs
|
||||||
|
type="border-card"
|
||||||
|
style="flex: 1; margin-left: 10px"
|
||||||
|
v-model="childActiveName"
|
||||||
|
@tab-change="inquireTable"
|
||||||
|
>
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
v-for="subTab in tab.children || []"
|
v-for="subTab in tab.children || []"
|
||||||
:key="subTab.name"
|
:key="subTab.value"
|
||||||
:label="subTab.label"
|
:label="subTab.label"
|
||||||
:name="subTab.name">
|
:name="subTab.value"
|
||||||
<!-- 子标签页内容 -->
|
|
||||||
<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' }"
|
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:style="{ height: '240px',overflow:'hidden'}">
|
>
|
||||||
<el-table-column prop="sort" label="组次" width="60" />
|
<el-table
|
||||||
<el-table-column prop="frequency" label="频率(Hz)" width="100" />
|
:data="tableData"
|
||||||
<el-table-column prop="L1" label="L1"/>
|
:header-cell-style="{
|
||||||
<el-table-column prop="L2" label="L2"/>
|
textAlign: 'center',
|
||||||
<el-table-column prop="L3" label="L3"/>
|
backgroundColor: '#003078',
|
||||||
<el-table-column label="操作" min-width="100">
|
color: '#fff'
|
||||||
|
}"
|
||||||
|
stripe
|
||||||
|
:cell-style="{ textAlign: 'center' }"
|
||||||
|
highlight-current-row
|
||||||
|
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 }">
|
<template #default="{ row }">
|
||||||
<el-button type="primary" link :icon='CopyDocument' @click="copyRow(row)">复制</el-button>
|
<table class="tableL">
|
||||||
<el-button type="primary" link :icon='CopyDocument' @click="openAddDialog('edit',row)">编辑</el-button>
|
<tbody>
|
||||||
<el-button type='primary' link :icon='Delete' @click="deleteRow(row)">删除</el-button>
|
<tr>
|
||||||
|
<td class="theFirst">V</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num].famp == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num]?.famp +
|
||||||
|
(valueCode == 'Absolute' ? 'V' : '%')
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num].fphase == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num].fphase +
|
||||||
|
'°'
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="theFirst">I</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num + 1].famp == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num + 1].famp +
|
||||||
|
(valueCode == 'Absolute' ? 'V' : '%')
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{
|
||||||
|
row.channelList[item.num + 1].fphase == null
|
||||||
|
? '/'
|
||||||
|
: '' +
|
||||||
|
row.channelList[item.num + 1].fphase +
|
||||||
|
'°'
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="是否启用" width="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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</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-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type PropType, ref } from 'vue';
|
import { type PropType, ref, nextTick } from 'vue'
|
||||||
import { data } from "@/api/plan/autoTest.json";
|
import Tree from './tree.vue'
|
||||||
import type { CascaderOption } from 'element-plus';
|
import Commun from './communication.vue'
|
||||||
import {CirclePlus, Delete, EditPen,CopyDocument} from '@element-plus/icons-vue'
|
import {type CascaderOption, ElMessageBox} from 'element-plus'
|
||||||
import type { TestScript } from '@/api/device/interface/testScript';
|
import { getTreeData } from '@/api/check/test'
|
||||||
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue';
|
import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue'
|
||||||
|
import type { TestScript } from '@/api/device/interface/testScript'
|
||||||
const testProjectPopup = ref()
|
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
|
||||||
|
import { CheckData } from '@/api/check/interface'
|
||||||
|
import { dlsDetails, deleteDtls, updateDtls, addScriptDtls, checkDataList } from '@/api/device/testScript'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { scriptDtlsCheckDataList } from '@/api/device/testScript/index'
|
||||||
|
import ViewRow from '@/views/machine/testScript/components/viewRow.vue'
|
||||||
interface TabOption {
|
interface TabOption {
|
||||||
label: string;
|
label?: string
|
||||||
name: string;
|
name?: string
|
||||||
children?: TabOption[];
|
value?: string
|
||||||
|
code?: string
|
||||||
|
children?: TabOption[]
|
||||||
}
|
}
|
||||||
|
const communRef = ref()
|
||||||
|
const treeData = ref<CheckData.TreeItem[]>([])
|
||||||
|
const valueCode = ref('') //Absolute绝对值
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
options: {
|
options: {
|
||||||
type: Array as PropType<TabOption[]>,
|
type: Array as PropType<TabOption[]>,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
});
|
formContent: {
|
||||||
|
type: Object,
|
||||||
const tableData= [
|
required: true
|
||||||
{ 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' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '电压',
|
|
||||||
name: 'resultTab1',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab1' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab1' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab1' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '电流',
|
|
||||||
name: 'resultTab2',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab2' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab2' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab2' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '电压不平衡度',
|
|
||||||
name: 'resultTab3',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab3' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab3' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab3' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '电流不平衡度',
|
|
||||||
name: 'resultTab4',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab4' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab4' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab4' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '谐波电压',
|
|
||||||
name: 'resultTab5',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab5' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab5' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab5' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '谐波电流',
|
|
||||||
name: 'resultTab6',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab6' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab6' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab6' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '间谐波电压',
|
|
||||||
name: 'resultTab7',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab7' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab7' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab7' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '间谐波电流',
|
|
||||||
name: 'resultTab8',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab8' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab8' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab8' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '电压暂升暂降',
|
|
||||||
name: 'resultTab9',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab9' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab9' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab9' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '闪变',
|
|
||||||
name: 'resultTab10',
|
|
||||||
subTabs: [
|
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab10' },
|
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab10' },
|
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab10' }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]);
|
})
|
||||||
|
const 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 = {
|
if (
|
||||||
children: "children",
|
tabData.value
|
||||||
label: "name",
|
.filter((item: any) => item.value == activeName.value)[0]
|
||||||
pid: "pid",
|
?.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
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const handleNodeClick = (data: any) => {
|
tableData.value = res.data
|
||||||
console.log(data);
|
}
|
||||||
};
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
||||||
testProjectPopup.value?.open(titleType, row)
|
showDialog.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
testProjectPopupRef.value?.open(titleType, row)
|
||||||
|
}, 0)
|
||||||
}
|
}
|
||||||
|
// 复制
|
||||||
|
const copyRow = async (row: any) => {
|
||||||
|
ElMessageBox.confirm('是否复制当前检测项目?', '提示', {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: 'warning',
|
||||||
|
draggable: true
|
||||||
|
}).then(async () => {
|
||||||
|
let checkDataList: any = []
|
||||||
|
await communRef.value[0]?.getData().forEach((item: any) => {
|
||||||
|
item.children.forEach((k: any) => {
|
||||||
|
if (k.enable != 0 || k.errorFlag != 0) {
|
||||||
|
checkDataList.push({
|
||||||
|
pid: k.pid,
|
||||||
|
valueType: k.id,
|
||||||
|
dataType: k.dataType,
|
||||||
|
enable: k.enable,
|
||||||
|
errorFlag: k.errorFlag
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
let { data } = await scriptDtlsCheckDataList({ checkDataList: checkDataList, ...row, retryCompute: true })
|
||||||
|
let copyRow = JSON.parse(JSON.stringify(row))
|
||||||
|
delete copyRow.index
|
||||||
|
|
||||||
|
await addScriptDtls({ ...copyRow, scriptType: activeName.value, checkDataList: data }).then(res => {
|
||||||
|
if (res.code === 'A0000') {
|
||||||
|
ElMessage.success({
|
||||||
|
message: '复制成功!',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
getTree()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 查看
|
||||||
|
const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||||
|
|
||||||
|
getCommunication()
|
||||||
|
console.log('communicationList',communicationList.value)
|
||||||
|
//当前点击的一级tab
|
||||||
|
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称';
|
||||||
|
//当前点击的二级tab
|
||||||
|
const childrenTabName = ref('')
|
||||||
|
tabData.value.forEach((item: any) => {
|
||||||
|
if (item.value == activeName.value) {
|
||||||
|
item.children.forEach((k: any) => {
|
||||||
|
if (k.value == childActiveName.value) {
|
||||||
|
childrenTabName.value = k.label
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
viewDialog.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
}
|
||||||
|
// 删除
|
||||||
|
const deleteRow = async (row: any) => {
|
||||||
|
await useHandleData(deleteDtls, { enable: row.enable, index: row.index, scriptId: row.scriptId }, `删除`)
|
||||||
|
getTree()
|
||||||
|
}
|
||||||
|
// 启用
|
||||||
|
const enableRow = async (row: any) => {
|
||||||
|
ElMessageBox.confirm(`是否${row.enable == 0 ? `禁用` : `启用`}?`, '温馨提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
draggable: true
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
updateDtls({ enable: row.enable, index: row.index, scriptId: row.scriptId }).then(res => {
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: `${row.enable == 0 ? `禁用` : `启用`}成功!`
|
||||||
|
})
|
||||||
|
getTree()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
row.enable = row.enable == 0 ? 1 : 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 获取左边树数据
|
||||||
|
// 新增保存
|
||||||
|
const addTab = (row: any) => {
|
||||||
|
getTree()
|
||||||
|
}
|
||||||
|
// 保存通信脚本
|
||||||
|
const saveTheNewsletter = () => {}
|
||||||
|
onMounted(() => {
|
||||||
|
getTree()
|
||||||
|
console.log('testScriptDetail',props.options)
|
||||||
|
props.options.forEach((item: any) => {
|
||||||
|
tabData.value.push({
|
||||||
|
label: item.label.replace(/准确度|检测/g, ''),
|
||||||
|
value: item.value,
|
||||||
|
code: item.code,
|
||||||
|
children: []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
activeName.value = tabData.value[0].value
|
||||||
|
valueCode.value = dictStore
|
||||||
|
.getDictData('Script_Value_Type')
|
||||||
|
.filter(item => item.id == props.formContent.valueType)[0].code
|
||||||
|
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.data-check-content {
|
.data-check-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-tree {
|
.content-tree {
|
||||||
width: 300px;
|
width: 260px;
|
||||||
height: 470px;
|
height: calc(100vh - 315px);
|
||||||
border: 1px solid #dcdfe6;
|
border: 1px solid #dcdfe6;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
margin-right: 10px;
|
// margin-right: 10px;
|
||||||
overflow: auto; /* 同时启用垂直和水平滚动 */
|
overflow: auto; /* 同时启用垂直和水平滚动 */
|
||||||
overflow-x: auto; /* 确保水平滚动条生效 */
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
.scriptTree {
|
||||||
|
height: calc(100vh - 520px);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 确保 el-tree 内容可以超出容器宽度 */
|
/* 确保 el-tree 内容可以超出容器宽度 */
|
||||||
@@ -244,7 +497,7 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
|
|||||||
flex: 1; /* 根据需要调整宽度比例 */
|
flex: 1; /* 根据需要调整宽度比例 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-footer{
|
.dialog-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@@ -252,15 +505,51 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
|
|||||||
|
|
||||||
.divider-container {
|
.divider-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider-container .el-divider {
|
.divider-container .el-divider {
|
||||||
margin-right: 30px; /* 根据需要调整间距 */
|
margin-right: 30px; /* 根据需要调整间距 */
|
||||||
}
|
}
|
||||||
|
:deep(.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell) {
|
||||||
|
padding: 3px 11px;
|
||||||
|
}
|
||||||
|
:deep(.el-loading-mask) {
|
||||||
|
z-index: 3000;
|
||||||
|
}
|
||||||
|
.tableL {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
td {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 5px;
|
||||||
|
width: 45%;
|
||||||
|
}
|
||||||
|
.theFirst {
|
||||||
|
background-color: #003078;
|
||||||
|
color: #fff;
|
||||||
|
width: 20px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.actionButtons {
|
||||||
|
.el-button {
|
||||||
|
margin-left: 0px;
|
||||||
|
margin: 5px 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<style>
|
||||||
|
input::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
input::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none !important;
|
||||||
|
}
|
||||||
|
.el-divider--horizontal {
|
||||||
|
margin: 4px 0 24px 0;
|
||||||
|
}
|
||||||
|
.el-tabs--border-card > .el-tabs__content {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -3,24 +3,74 @@
|
|||||||
<div class="left-editor">
|
<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>
|
||||||
<div class="right-editor">
|
<div class="right-editor">
|
||||||
<!-- 右侧编辑区域内容 -->
|
<!-- 右侧编辑区域内容 -->
|
||||||
<el-form-item label="设定幅度(%)">
|
<el-form-item label-width="120px" label="设定幅度(%)">
|
||||||
<el-input v-model="input1" />
|
<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>
|
||||||
<el-form-item label="持续时间(周波)">
|
<el-form-item label-width="120px" label="持续时间(s)">
|
||||||
<el-input v-model="input2" />
|
<el-input
|
||||||
|
type="number"
|
||||||
|
v-model="form[0].dipData.retainTime"
|
||||||
|
style="width: 150px"
|
||||||
|
:disabled="!form[0].dipFlag"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref, watch } from 'vue'
|
||||||
|
const props = defineProps({
|
||||||
|
childForm: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const form: any = computed({
|
||||||
|
get() {
|
||||||
|
return props.childForm
|
||||||
|
},
|
||||||
|
set(value) {}
|
||||||
|
})
|
||||||
|
const handleInput = value => {
|
||||||
|
if (value < 0) {
|
||||||
|
props.childForm[0].dipData.ftransValue = 0
|
||||||
|
} else if (value > 200) {
|
||||||
|
props.childForm[0].dipData.ftransValue = 200
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
canvas {
|
canvas {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
}
|
}
|
||||||
@@ -28,16 +78,31 @@ canvas {
|
|||||||
.editor-container {
|
.editor-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.left-editor {
|
.left-editor {
|
||||||
flex: 3; /* 左侧区域占据 3/4 的宽度 */
|
flex: 1; /* 左侧区域占据 3/4 的宽度 */
|
||||||
margin-left: 150px; /* 可选:添加间距 */
|
position: relative;
|
||||||
|
img {
|
||||||
|
width: 90%;
|
||||||
|
height: 150px;
|
||||||
|
margin: 0 10px 20px;
|
||||||
|
}
|
||||||
|
.inputTop {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.inputBottom {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -5px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-editor {
|
.right-editor {
|
||||||
flex: 1; /* 右侧区域占据 1/4 的宽度 */
|
width: 400px;
|
||||||
margin-right: 250px; /* 向左侧移动一点 */
|
/* margin-right: 250px; 向左侧移动一点 */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,41 +1,77 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tabs-container">
|
<div class="tabs-container">
|
||||||
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%;">
|
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%">
|
||||||
<el-tab-pane label="Modulation">
|
<el-tab-pane label="短闪">
|
||||||
<!-- 全局设置菜单内容 -->
|
<!-- 全局设置菜单内容 Modulation-->
|
||||||
<div>
|
|
||||||
<el-form-item label="电压变动幅度(%)" prop='name'>
|
<div style="display: flex">
|
||||||
<el-input style="width: 200px;" />
|
<el-form-item abel-width="180px">
|
||||||
|
<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>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-container">
|
<div style="display: flex; justify-content: end">
|
||||||
<el-form-item label="波动频度(/min/Hz)" prop='name'>
|
<el-form-item label="变动量(%)" label-width="180px">
|
||||||
<el-input />
|
<el-input
|
||||||
</el-form-item>
|
placeholder="请输入变动量"
|
||||||
<el-form-item label="波动类型" prop='name'>
|
style="width: 180px"
|
||||||
<el-select placeholder="请选择波动类型" style="width: 150px;">
|
v-model="form[0].flickerData.fchagValue"
|
||||||
<el-option label="Hz" :value="1"></el-option>
|
/>
|
||||||
<el-option label="CPM" :value="0"></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%;">
|
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%">
|
||||||
<el-tab-pane label="WaveForm">
|
<el-tab-pane label="波形">
|
||||||
<!-- 全局设置菜单内容 -->
|
<!-- 全局设置菜单内容 WaveForm -->
|
||||||
<div >
|
<div>
|
||||||
<el-form-item label="波类型" prop='name'>
|
<el-form-item label="波类型" label-width="100px">
|
||||||
<el-select placeholder="请选择波类型">
|
<el-select
|
||||||
<el-option label="RECT" :value="2"></el-option>
|
placeholder="请选择波类型"
|
||||||
<el-option label="SIN" :value="1"></el-option>
|
style="width: 150px"
|
||||||
<el-option label="SQU" :value="0"></el-option>
|
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-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div>
|
||||||
<el-form-item label="占空比(%)" prop='name'>
|
<el-form-item label="占空比(%)" label-width="100px">
|
||||||
<el-input />
|
<el-input
|
||||||
|
style="width: 150px"
|
||||||
|
v-model="form[0].flickerData.fdutyCycle"
|
||||||
|
:disabled="!form[0].flickerFlag"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -44,7 +80,291 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref, computed } from 'vue'
|
||||||
|
const props = defineProps({
|
||||||
|
childForm: {
|
||||||
|
type: [Array, Object] as any,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const waveList = [
|
||||||
|
{
|
||||||
|
label: '变动频度(次/min)',
|
||||||
|
value: 'CPM',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
fchagFre: '0.1',
|
||||||
|
fchagValue: '7.4'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.2',
|
||||||
|
fchagValue: '4.58'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.4',
|
||||||
|
fchagValue: '3.54'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.6',
|
||||||
|
fchagValue: '3.2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1',
|
||||||
|
fchagValue: '2.724'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '2',
|
||||||
|
fchagValue: '2.211'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '3',
|
||||||
|
fchagValue: '1.95'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '5',
|
||||||
|
fchagValue: '1.64'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '7',
|
||||||
|
fchagValue: '1.459'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '10',
|
||||||
|
fchagValue: '1.29'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '22',
|
||||||
|
fchagValue: '1.02'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '39',
|
||||||
|
fchagValue: '0.906'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '48',
|
||||||
|
fchagValue: '0.87'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '68',
|
||||||
|
fchagValue: '0.81'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '110',
|
||||||
|
fchagValue: '0.725'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '176',
|
||||||
|
fchagValue: '0.64'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '273',
|
||||||
|
fchagValue: '0.56'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '375',
|
||||||
|
fchagValue: '0.5'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '480',
|
||||||
|
fchagValue: '0.48'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '585',
|
||||||
|
fchagValue: '0.42'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '682',
|
||||||
|
fchagValue: '0.37'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '796',
|
||||||
|
fchagValue: '0.32'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1020',
|
||||||
|
fchagValue: '0.28'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1055',
|
||||||
|
fchagValue: '0.28'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1200',
|
||||||
|
fchagValue: '0.29'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1390',
|
||||||
|
fchagValue: '0.34'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1620',
|
||||||
|
fchagValue: '0.402'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '2400',
|
||||||
|
fchagValue: '0.77'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '变动频率(HZ)',
|
||||||
|
value: 'HZ',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
fchagFre: '0.000833',
|
||||||
|
fchagValue: '7.4'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.001667',
|
||||||
|
fchagValue: '4.58'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.003333',
|
||||||
|
fchagValue: '3.54'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.005000',
|
||||||
|
fchagValue: '3.2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.008333',
|
||||||
|
fchagValue: '2.724'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.016667',
|
||||||
|
fchagValue: '2.211'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.025000',
|
||||||
|
fchagValue: '1.95'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.041667',
|
||||||
|
fchagValue: '1.64'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.058333',
|
||||||
|
fchagValue: '1.459'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.083333',
|
||||||
|
fchagValue: '1.29'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.183333',
|
||||||
|
fchagValue: '1.02'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.325000',
|
||||||
|
fchagValue: '0.906'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.400000',
|
||||||
|
fchagValue: '0.87'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.566667',
|
||||||
|
fchagValue: '0.81'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '0.916667',
|
||||||
|
fchagValue: '0.725'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '1.466667',
|
||||||
|
fchagValue: '0.64'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '2.275000',
|
||||||
|
fchagValue: '0.56'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '3.125000',
|
||||||
|
fchagValue: '0.5'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '4.000000',
|
||||||
|
fchagValue: '0.48'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '4.875000',
|
||||||
|
fchagValue: '0.42'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '5.683333',
|
||||||
|
fchagValue: '0.37'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '6.633333',
|
||||||
|
fchagValue: '0.32'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '8.500000',
|
||||||
|
fchagValue: '0.28'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '8.791667',
|
||||||
|
fchagValue: '0.28'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '10.000000',
|
||||||
|
fchagValue: '0.29'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '11.583333',
|
||||||
|
fchagValue: '0.34'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '13.500000',
|
||||||
|
fchagValue: '0.402'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fchagFre: '20.000000',
|
||||||
|
fchagValue: '0.77'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const waveChildrenList = computed(() => {
|
||||||
|
return waveList.filter((item: any) => item.value === form.value[0].flickerData.waveType)[0].children
|
||||||
|
})
|
||||||
|
const changeLable = e => {
|
||||||
|
setTimeout(() => {
|
||||||
|
let data = {
|
||||||
|
fchagFre: '',
|
||||||
|
fchagValue: ''
|
||||||
|
}
|
||||||
|
waveList.forEach((item: any, i: number) => {
|
||||||
|
item.children.forEach((item1: any, j: number) => {
|
||||||
|
if (item1.fchagFre == props.childForm[0].flickerData.fchagFre) {
|
||||||
|
data = waveList[i == 0 ? 1 : 0].children[j]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
props.childForm[0].flickerData.fchagFre = data.fchagFre
|
||||||
|
props.childForm[0].flickerData.fchagValue = data.fchagValue
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
// [频率变化]
|
||||||
|
const changeWaveType = e => {
|
||||||
|
props.childForm[0].flickerData.fchagValue = waveChildrenList.value.filter(
|
||||||
|
(item: any) => item.fchagFre == e
|
||||||
|
)[0].fchagValue
|
||||||
|
}
|
||||||
|
const form: any = computed({
|
||||||
|
get() {
|
||||||
|
if (props.childForm[0].flickerData.flickerValue == null) {
|
||||||
|
props.childForm[0].flickerData.fchagValue = ''
|
||||||
|
props.childForm[0].flickerData.fchagFre = ''
|
||||||
|
}
|
||||||
|
return props.childForm
|
||||||
|
},
|
||||||
|
set(value) {}
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -63,7 +383,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.fixed-width-tabs {
|
.fixed-width-tabs {
|
||||||
|
|
||||||
margin-right: 100px; /* 可选:添加右侧间距 */
|
margin-right: 100px; /* 可选:添加右侧间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,89 +1,157 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tabs-container">
|
<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-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">
|
<div class="table-container">
|
||||||
<el-table :data="tableData1" border class="half-width-table">
|
<el-table :data="form[0].harmList" border stripe size="small">
|
||||||
<el-table-column prop="date" label="次数" width="60"/>
|
<el-table-column prop="harm" align="center" label="次数" width="60" />
|
||||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
<el-table-column prop="famp" align="center" label="谐波含有率">
|
||||||
<template #default="scope">
|
<template #default="{ row }">
|
||||||
<div class="input-label-container">
|
<el-input type="number" v-if="row.show" v-model="row.famp" />
|
||||||
<el-input />
|
<span v-else>{{ row.famp }}%</span>
|
||||||
<label>%</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="name" label="谐波相角" width="120">
|
<el-table-column prop="fphase" label="谐波相角" align="center">
|
||||||
<template #default="scope">
|
<template #default="{ row }">
|
||||||
<div class="input-label-container">
|
<el-input type="number" v-if="row.show" v-model="row.fphase" />
|
||||||
<el-input />
|
<span v-else>{{ row.fphase }}°</span>
|
||||||
<label>°</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
<el-table-column label="操作" align="center">
|
||||||
<el-table :data="tableData2" border class="half-width-table">
|
<template #default="{ row, $index }">
|
||||||
<el-table-column prop="date" label="次数" width="60"/>
|
<el-button
|
||||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
type="primary"
|
||||||
<template #default="scope">
|
link
|
||||||
<div class="input-label-container">
|
:icon="EditPen"
|
||||||
<el-input />
|
v-if="!row.show"
|
||||||
<label>%</label>
|
@click="row.show = true"
|
||||||
</div>
|
>
|
||||||
</template>
|
编辑
|
||||||
</el-table-column>
|
</el-button>
|
||||||
<el-table-column prop="name" label="谐波相角" width="120">
|
<el-button type="primary" link :icon="Check" v-else @click="row.show = false">
|
||||||
<template #default="scope">
|
保存
|
||||||
<div class="input-label-container">
|
</el-button>
|
||||||
<el-input />
|
<el-button type="primary" link :icon="Delete" @click="HarmFlagDelete(0, $index)">
|
||||||
<label>°</label>
|
删除
|
||||||
</div>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<el-tabs type="border-card" style="height: 100%;">
|
<el-tabs type="border-card" style="height: 100%">
|
||||||
<el-tab-pane label="电流通道">
|
<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">
|
<div class="table-container">
|
||||||
<el-table :data="tableData1" border class="half-width-table">
|
<el-table :data="form[1].harmList" border stripe size="small">
|
||||||
<el-table-column prop="date" label="次数" width="60"/>
|
<el-table-column prop="harm" align="center" label="次数" width="60" />
|
||||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
<el-table-column prop="famp" align="center" label="谐波含有率">
|
||||||
<template #default="scope">
|
<template #default="{ row }">
|
||||||
<div class="input-label-container">
|
<el-input type="number" v-if="row.show" v-model="row.famp" />
|
||||||
<el-input />
|
<span v-else>{{ row.famp }}%</span>
|
||||||
<label>%</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="name" label="谐波相角" width="120">
|
<el-table-column prop="fphase" label="谐波相角" align="center">
|
||||||
<template #default="scope">
|
<template #default="{ row }">
|
||||||
<div class="input-label-container">
|
<el-input type="number" v-if="row.show" v-model="row.fphase" />
|
||||||
<el-input />
|
<span v-else>{{ row.fphase }}°</span>
|
||||||
<label>°</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
<el-table-column label="操作" align="center">
|
||||||
<el-table :data="tableData2" border class="half-width-table">
|
<template #default="{ row, $index }">
|
||||||
<el-table-column prop="date" label="次数" width="60"/>
|
<el-button
|
||||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
type="primary"
|
||||||
<template #default="scope">
|
link
|
||||||
<div class="input-label-container">
|
:icon="EditPen"
|
||||||
<el-input />
|
v-if="!row.show"
|
||||||
<label>%</label>
|
@click="row.show = true"
|
||||||
</div>
|
>
|
||||||
</template>
|
编辑
|
||||||
</el-table-column>
|
</el-button>
|
||||||
<el-table-column prop="name" label="谐波相角" width="120">
|
<el-button type="primary" link :icon="Check" v-else @click="row.show = false">
|
||||||
<template #default="scope">
|
保存
|
||||||
<div class="input-label-container">
|
</el-button>
|
||||||
<el-input />
|
<el-button type="primary" link :icon="Delete" @click="HarmFlagDelete(1, $index)">
|
||||||
<label>°</label>
|
删除
|
||||||
</div>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -91,40 +159,126 @@
|
|||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<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 {
|
interface TableItem {
|
||||||
date: string;
|
date: string
|
||||||
harmonicRate?: string;
|
harmonicRate?: string
|
||||||
harmonicPhase?: string;
|
harmonicPhase?: string
|
||||||
name?: string;
|
name?: string
|
||||||
}
|
}
|
||||||
|
const empty = (index: number) => {
|
||||||
// 定义并初始化 tableData
|
props.childForm[index].harmList = []
|
||||||
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}`
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
for (let i = 26; i <= 50; i++) {
|
const onSubmit = () => {
|
||||||
tableData2.value.push({
|
console.log('🚀 ~ onSubmit ~ props.childForm[0]:', props.childForm[0].harmList)
|
||||||
date: i.toString(),
|
if (formInline.value.harm.length == 0 || formInline.value.famp == '' || formInline.value.fphase == '') {
|
||||||
harmonicRate: `谐波含有率${i}`,
|
ElMessage.warning('请填写值!')
|
||||||
harmonicPhase: `谐波相角${i}`
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.tabs-container {
|
.tabs-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between; /* 使两个 el-tabs 之间有间距 */
|
justify-content: space-between; /* 使两个 el-tabs 之间有间距 */
|
||||||
@@ -163,4 +317,7 @@ for (let i = 26; i <= 50; i++) {
|
|||||||
.input-label-container label {
|
.input-label-container label {
|
||||||
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
||||||
}
|
}
|
||||||
|
// 全局css 加上以下代码,可以隐藏上下箭头
|
||||||
|
|
||||||
|
// 取消input的上下箭头
|
||||||
</style>
|
</style>
|
||||||
@@ -1,32 +1,160 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tabs-container">
|
<div class="tabs-container">
|
||||||
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%;">
|
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
|
||||||
<el-tab-pane label="间谐波A">
|
<el-tab-pane label="电压通道">
|
||||||
<!-- 全局设置菜单内容 -->
|
<el-form :inline="true" :model="formInline" :disabled="!props.childForm[0].inHarmFlag">
|
||||||
<div>
|
<el-form-item label="次数">
|
||||||
<el-form-item label="含有率(%)" prop='name'>
|
<el-select
|
||||||
<el-input />
|
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>
|
</el-form-item>
|
||||||
</div>
|
<el-form-item label="含有率">
|
||||||
<div>
|
<el-input
|
||||||
<el-form-item label="间谐波次数" prop='name'>
|
v-model="formInline.famp"
|
||||||
<el-input />
|
type="number"
|
||||||
|
placeholder="含有率"
|
||||||
|
style="width: 80px"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
</el-form-item>
|
</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>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%;">
|
<el-tabs type="border-card" style="height: 100%">
|
||||||
<el-tab-pane label="间谐波B">
|
<el-tab-pane label="电流通道">
|
||||||
<!-- 全局设置菜单内容 -->
|
<el-form :inline="true" :model="formInline1" :disabled="!props.childForm[1].inHarmFlag">
|
||||||
<div>
|
<el-form-item label="次数">
|
||||||
<el-form-item label="含有率(%)" prop='name'>
|
<el-select
|
||||||
<el-input />
|
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>
|
</el-form-item>
|
||||||
</div>
|
<el-form-item label="含有率">
|
||||||
<div>
|
<el-input
|
||||||
<el-form-item label="间谐波次数" prop='name'>
|
v-model="formInline1.famp"
|
||||||
<el-input />
|
type="number"
|
||||||
|
placeholder="含有率"
|
||||||
|
style="width: 80px"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
</el-form-item>
|
</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>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
@@ -34,33 +162,162 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<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>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.tabs-container {
|
.tabs-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center; /* 使两个 el-tabs 居中对齐 */
|
justify-content: space-between; /* 使两个 el-tabs 之间有间距 */
|
||||||
align-items: stretch; /* 使两个 el-tabs 高度拉伸 */
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 0 20px; /* 可选:添加左右间距 */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-width-tabs {
|
.right-tabs {
|
||||||
width: 400px; /* 设置固定的宽度 */
|
flex: 1; /* 使两个 el-tabs 占据相同的空间 */
|
||||||
margin-right: 100px; /* 可选:添加右侧间距 */
|
margin-right: 10px; /* 可选:添加右侧间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-width-tabs:last-child {
|
.el-tabs {
|
||||||
margin-right: 0; /* 最后一个 el-tabs 不需要右侧间距 */
|
flex: 1; /* 使两个 el-tabs 占据相同的空间 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-tab-pane {
|
.table-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column; /* 确保内容上下排列 */
|
justify-content: space-between; /* 使两个表格之间有间距 */
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-form-item {
|
.half-width-table {
|
||||||
margin-bottom: 20px; /* 可选:添加表单项之间的间距 */
|
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>
|
</style>
|
||||||
@@ -1,158 +1,255 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle"
|
<div>
|
||||||
v-model='dialogVisible'
|
<el-card style="margin-bottom: 10px" class="cardTop">
|
||||||
@close="close"
|
<el-form
|
||||||
v-bind="dialogBig"
|
:model="formContent"
|
||||||
width="1400px">
|
:inline="true"
|
||||||
<div class="dialog-content" >
|
label-width="auto"
|
||||||
<el-form :model='formContent' label-width="auto" class="form-three ">
|
ref="dialogFormRef"
|
||||||
<el-divider >基础信息</el-divider>
|
:rules="rules"
|
||||||
<el-form-item label="脚本名称" prop='name'>
|
class="form-five"
|
||||||
<el-input v-model='formContent.name' />
|
>
|
||||||
|
<el-form-item label="脚本名称" prop="name">
|
||||||
|
<el-input v-model.trim="formContent.name" placeholder="请输入脚本名称" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="参照标准名称" prop='standardName'>
|
<el-form-item label="参照标准名称" prop="standardName">
|
||||||
<el-input v-model='formContent.standardName' />
|
<el-input v-model.trim="formContent.standardName" placeholder="请输入参照标准名称" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="标准推行年份" prop='standardTime'>
|
<el-form-item label="标准推行年份" prop="standardTime">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="formContent.standardTime"
|
v-model="formContent.standardTime"
|
||||||
|
style="width: 100%"
|
||||||
type="year"
|
type="year"
|
||||||
|
format="YYYY"
|
||||||
|
value-format="YYYY"
|
||||||
placeholder="请选择标准推行年份"
|
placeholder="请选择标准推行年份"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</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 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>
|
||||||
|
<div class="formBut">
|
||||||
|
<el-button type="primary" :icon="Select" @click="save">保存</el-button>
|
||||||
|
<el-button :icon="Close" @click="close">返回</el-button>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
<el-card v-if="show">
|
||||||
|
<TestScriptDetail :options="secondLevelOptions" :formContent="formContent" />
|
||||||
|
</el-card>
|
||||||
</div>
|
</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>
|
</template>
|
||||||
<script setup lang='ts'>
|
<script setup lang="ts">
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
import { ref, nextTick } from 'vue'
|
||||||
import { computed, ref } from 'vue'
|
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import TestScriptDetail from '@/views/machine/testScript/components/testScriptDetail.vue';
|
import TestScriptDetail from '@/views/machine/testScript/components/testScriptDetail.vue'
|
||||||
import { type TestScript } from '@/api/device/interface/testScript';
|
import { type TestScript } from '@/api/device/interface/testScript'
|
||||||
import type { Dict } from '@/api/system/dictionary/interface';
|
import type { Dict } from '@/api/system/dictionary/interface'
|
||||||
import {getDictTreeList} from '@/api/system/dictionary/dictTree'
|
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||||
import type { CascaderOption } from 'element-plus';
|
import type { CascaderOption } from 'element-plus'
|
||||||
|
import { Select, Close } from '@element-plus/icons-vue'
|
||||||
|
import { pqScriptAdd, pqScriptUpdate } from '@/api/device/testScript'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
const modeId = ref()
|
const modeId = ref()
|
||||||
const secondLevelOptions: any[] = [];
|
const show = ref(false)
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const secondLevelOptions: any[] = []
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
function useMetaInfo() {
|
function useMetaInfo() {
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const titleType = ref('add')
|
const titleType = ref('add')
|
||||||
const formContent = ref<TestScript.ResTestScript>({
|
const formContent = ref<TestScript.ResTestScript>({
|
||||||
name: '',
|
name: '',
|
||||||
type: '',
|
type: '',
|
||||||
valueType:'',
|
valueType: '',
|
||||||
pattern: modeId.value,
|
pattern: modeId.value,
|
||||||
standardName: '',
|
standardName: '',
|
||||||
standardTime: '',
|
standardTime: '',
|
||||||
state:1,
|
state: 1
|
||||||
|
|
||||||
})
|
})
|
||||||
return { dialogVisible, titleType,formContent }
|
return { titleType, formContent }
|
||||||
}
|
}
|
||||||
|
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' }]
|
||||||
|
}
|
||||||
|
|
||||||
const { dialogVisible, titleType,formContent } = useMetaInfo()
|
const { titleType, formContent } = useMetaInfo()
|
||||||
|
|
||||||
let dialogTitle = computed(() => {
|
// 清空formContent
|
||||||
return titleType.value === 'add' ? '新增检测脚本' : '编辑检测脚本'
|
const resetFormContent = () => {
|
||||||
})
|
|
||||||
|
|
||||||
// 清空formContent
|
|
||||||
const resetFormContent = () => {
|
|
||||||
formContent.value = {
|
formContent.value = {
|
||||||
name: '',
|
name: '',
|
||||||
type: '',
|
type: '',
|
||||||
valueType:'',
|
valueType: '',
|
||||||
pattern: modeId.value,
|
pattern: '',
|
||||||
standardName: '',
|
standardName: '',
|
||||||
standardTime: '',
|
standardTime: '',
|
||||||
state:1,
|
state: 1
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
router.go(-1)
|
||||||
|
}
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
|
||||||
// 关闭弹窗
|
|
||||||
const close = () => {
|
|
||||||
dialogVisible.value = false
|
|
||||||
// 清空dialogForm中的值
|
// 清空dialogForm中的值
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
// 重置表单
|
// 重置表单
|
||||||
dialogFormRef.value?.resetFields()
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
// 关闭信息弹框
|
||||||
|
const closeInformation = () => {}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
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 {
|
||||||
const save = () => {
|
pqScriptUpdate(formContent.value).then(res => {
|
||||||
|
if (res.code === 'A0000') {
|
||||||
|
ElMessage.success({ message: res.message })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = async (sign: string,row: any,currentMode: string,id:string) => {
|
const open = async (title: string, row: any) => {
|
||||||
const dictCode = '测试脚本字典表'; // 替换为实际需要的字典代码
|
titleType.value = title
|
||||||
const resDictTree: Dict.ResDictTree = {
|
if (title == '新增检测脚本') {
|
||||||
name: dictCode,
|
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: '',
|
id: '',
|
||||||
pid: '',
|
pid: '',
|
||||||
pids: '',
|
pids: '',
|
||||||
code: '',
|
code: 'Script_Indicator_Items',
|
||||||
sort: 0
|
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);
|
|
||||||
}
|
}
|
||||||
});
|
const result = await getDictTreeByCode(data)
|
||||||
|
const result1 = (await getDictTreeByCode({ ...data, code: 'Script_Error' })).data[0].children
|
||||||
//console.log('secondLevelOptions',secondLevelOptions);
|
const allOptions = await convertToOptions(result.data as Dict.ResDictTree[])
|
||||||
|
//console.log('🚀 ~ treeInfo ~ result1:', allOptions[0]?.children)
|
||||||
if(id != ''){//新增的时候才会重新赋值值类型
|
const setallTree = await setTree(allOptions[0]?.children, result1)
|
||||||
formContent.value.valueType = id
|
secondLevelOptions.push(...(setallTree || []))
|
||||||
}
|
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id
|
||||||
titleType.value = sign
|
|
||||||
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id;
|
|
||||||
|
|
||||||
|
|
||||||
// 重置表单
|
|
||||||
dialogFormRef.value?.resetFields()
|
|
||||||
dialogVisible.value = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转换函数
|
onMounted(() => {
|
||||||
const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
|
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 => ({
|
return dictTree.map(item => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
|
code: item.code.split('-')[1] || item.code.split('-')[0],
|
||||||
label: item.name,
|
label: item.name,
|
||||||
children: item.children ? convertToOptions(item.children) : undefined
|
children: item.children ? convertToOptions(item.children) : undefined
|
||||||
}));
|
}))
|
||||||
};
|
}
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
/* .dialog-content {
|
/* .dialog-content {
|
||||||
padding: 10px;
|
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: 15.8%;
|
||||||
|
|
||||||
|
.el-form-item__content {
|
||||||
|
flex: 1;
|
||||||
|
.el-select,
|
||||||
|
.el-cascader,
|
||||||
|
.el-input__inner,
|
||||||
|
.el-date-editor {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -2,99 +2,112 @@
|
|||||||
<div class="editor-container">
|
<div class="editor-container">
|
||||||
<div class="left-editor">
|
<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>
|
||||||
<div class="right-editor">
|
<div class="right-editor">
|
||||||
<!-- 右侧编辑区域内容 -->
|
<!-- 右侧编辑区域内容 -->
|
||||||
<el-form-item label="电压有效值(V)">
|
<el-form :inline="true" label-width="auto" :model="form" class="form-two">
|
||||||
<el-input v-model="input1" />
|
<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>
|
||||||
<el-form-item label="电流有效值(A)">
|
<el-form-item label="电压相角(°)">
|
||||||
<el-input v-model="input1" />
|
<el-input type="number" v-model="form[0].fphase" :disabled="!form[0].channelFlag" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="相角(°)">
|
<el-form-item :label="`电流有效值(${valueCode == 'Absolute' ? 'A' : '%'})`">
|
||||||
<el-input v-model="input2" />
|
<el-input type="number" v-model="form[1].famp" :disabled="!form[1].channelFlag" />
|
||||||
</el-form-item>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<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(() => {
|
onMounted(() => {
|
||||||
if (canvas.value) {
|
drawSineWave()
|
||||||
const ctx = canvas.value.getContext('2d');
|
})
|
||||||
if (ctx) {
|
|
||||||
drawSineWave(ctx);
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
options: {
|
||||||
function drawSineWave(ctx: CanvasRenderingContext2D) {
|
dataZoom: null,
|
||||||
const width = canvas.value!.width;
|
series: [
|
||||||
const height = canvas.value!.height;
|
{
|
||||||
const amplitude = 50; // 振幅
|
name: '',
|
||||||
const frequency = 0.02; // 频率
|
type: 'line',
|
||||||
const offset = height / 2; // 偏移量
|
data: [10, -10, 10, -10, 10, -10, 10, -10, 10, -10, 10],
|
||||||
|
showSymbol: false,
|
||||||
// 绘制横轴
|
smooth: true
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
]
|
||||||
// 绘制纵轴刻度
|
|
||||||
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>
|
</script>
|
||||||
|
|
||||||
@@ -109,12 +122,13 @@ canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.left-editor {
|
.left-editor {
|
||||||
flex: 3; /* 左侧区域占据 3/4 的宽度 */
|
flex: 1;
|
||||||
margin-left: 150px; /* 可选:添加间距 */
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-editor {
|
.right-editor {
|
||||||
flex: 1; /* 右侧区域占据 1/4 的宽度 */
|
width: 600px;
|
||||||
margin-right: 250px; /* 向左侧移动一点 */
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
</style>
|
</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>
|
<template>
|
||||||
<el-dialog title="请确认检测脚本值类型"
|
<el-dialog title="请确认检测脚本值类型" v-model="dialogVisible" @close="close" v-bind="dialogSmall">
|
||||||
v-model='dialogVisible'
|
<div class="dialog-content">
|
||||||
@close="close"
|
|
||||||
v-bind="dialogSmall"
|
|
||||||
>
|
|
||||||
<div class="dialog-content" >
|
|
||||||
<el-form>
|
<el-form>
|
||||||
<el-form-item label='值类型'>
|
<el-form-item label="值类型">
|
||||||
<el-select v-model="selectedValue" filterable clearable placeholder="请选择值类型">
|
<el-select v-model="selectedValue" filterable clearable placeholder="请选择值类型">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Script_Value_Type')"
|
v-for="item in dictStore.getDictData('Script_Value_Type')"
|
||||||
@@ -19,60 +14,54 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<TestScriptPopup ref='testScriptPopup' />
|
<TestScriptPopup ref="testScriptPopup" />
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div>
|
<div>
|
||||||
<el-button @click='close()'>取 消</el-button>
|
<el-button @click="close()">取 消</el-button>
|
||||||
<el-button type="primary" @click='save()'>新增</el-button>
|
<el-button type="primary" @click="save()">新增</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<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'>
|
const close = () => {
|
||||||
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 = () => {
|
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
// 重置表单
|
// 重置表单
|
||||||
dialogFormRef.value?.resetFields()
|
dialogFormRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
const save = () => {
|
const save = () => {
|
||||||
testScriptPopup.value?.open('新增检测脚本', {}, mode.value,selectedValue.value)
|
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
|
mode.value = currentMode
|
||||||
// 重置表单
|
// 重置表单
|
||||||
dialogFormRef.value?.resetFields()
|
dialogFormRef.value?.resetFields()
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
/* .dialog-content {
|
||||||
</script>
|
|
||||||
<style scoped>
|
|
||||||
/* .dialog-content {
|
|
||||||
padding: 10px;
|
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: '#003078',
|
||||||
|
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: '#003078',
|
||||||
|
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: '#003078',
|
||||||
|
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: '#003078',
|
||||||
|
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: '#003078',
|
||||||
|
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>
|
||||||
@@ -1,63 +1,89 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class='table-box'>
|
<div class="table-box">
|
||||||
<ProTable
|
<ProTable ref="proTable" :columns="columns" :request-api="getTableList">
|
||||||
ref='proTable'
|
|
||||||
:columns='columns'
|
|
||||||
:request-api="getTableList"
|
|
||||||
>
|
|
||||||
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader="scope">
|
||||||
<el-button v-auth.testScript="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
<el-button v-auth.testScript="'add'" type="primary" :icon="CirclePlus" @click="openDialog('add')">
|
||||||
<el-button v-auth.testScript="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
新增
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
</el-button>
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
v-auth.testScript="'delete'"
|
||||||
|
type="danger"
|
||||||
|
:icon="Delete"
|
||||||
|
plain
|
||||||
|
:disabled="!scope.isSelected"
|
||||||
|
@click="batchDelete(scope.selectedListIds)"
|
||||||
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<template #operation="scope">
|
||||||
<el-button v-auth.testScript="'edit'" type='primary' link :icon='EditPen' :model-value="false" @click="openDialog('edit', scope.row)">编辑</el-button>
|
<el-button
|
||||||
<el-button v-auth.testScript="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
v-auth.testScript="'edit'"
|
||||||
<el-button v-auth.testScript="'upgrade'" type='primary' v-if="scope.row.type !== 1" link :icon='Share' @click='updateType(scope.row)'>升级</el-button>
|
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>
|
||||||
|
<el-button
|
||||||
|
v-auth.testScript="'upgrade'"
|
||||||
|
type="primary"
|
||||||
|
v-if="scope.row.type !== 1"
|
||||||
|
link
|
||||||
|
:icon="Share"
|
||||||
|
@click="updateType(scope.row)"
|
||||||
|
>
|
||||||
|
升级
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
<ComparisonPopup ref='comparisonPopup' />
|
<ComparisonPopup ref="comparisonPopup" />
|
||||||
<ValueTypePopup ref='valueTypePopup' />
|
<ValueTypePopup ref="valueTypePopup" />
|
||||||
<TestScriptPopup ref='testScriptPopup' />
|
<TestScriptPopup ref="testScriptPopup" />
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='useRole'>
|
<script setup lang="tsx" name="useRole">
|
||||||
import { type TestScript } from '@/api/device/interface/testScript'
|
import { type TestScript } from '@/api/device/interface/testScript'
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import type{ ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
import { CirclePlus, Delete, EditPen, Share } from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, EditPen, Share } from '@element-plus/icons-vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import ComparisonPopup from './components/comparisonPopup.vue'
|
import ComparisonPopup from './components/comparisonPopup.vue'
|
||||||
import TestScriptPopup from './components/testScriptPopup.vue'
|
import TestScriptPopup from './components/testScriptPopup.vue'
|
||||||
import ValueTypePopup from './components/valueTypePopup.vue'
|
import ValueTypePopup from './components/valueTypePopup.vue'
|
||||||
import {
|
import { useRouter } from 'vue-router'
|
||||||
getPqScriptList,updatePqScript,deletePqScript,
|
import { getPqScriptList, updatePqScript, deletePqScript } from '@/api/device/testScript/index'
|
||||||
} from '@/api/device/testScript/index'
|
|
||||||
import { computed, reactive, ref } from 'vue'
|
import { computed, reactive, ref } from 'vue'
|
||||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||||
defineOptions({
|
// defineOptions({
|
||||||
name: 'testScript'
|
// name: 'testScript'
|
||||||
})
|
// })
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
const comparisonPopup = ref()
|
const comparisonPopup = ref()
|
||||||
const testScriptPopup = ref()
|
const testScriptPopup = ref()
|
||||||
const valueTypePopup = ref()
|
const valueTypePopup = ref()
|
||||||
const modeStore = useModeStore();
|
const modeStore = useModeStore()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
const getTableList = (params: any) => {
|
const getTableList = (params: any) => {
|
||||||
let newParams = JSON.parse(JSON.stringify(params))
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id //获取数据字典中对应的id
|
||||||
newParams.pattern = patternId
|
newParams.pattern = patternId
|
||||||
return getPqScriptList(newParams)
|
return getPqScriptList(newParams)
|
||||||
}
|
}
|
||||||
@@ -66,13 +92,12 @@ const getTableList = (params: any) => {
|
|||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
const showValueSearch = computed(() => {
|
const showValueSearch = computed(() => {
|
||||||
if(modeStore.currentMode == '比对式'){
|
if (modeStore.currentMode == '比对式') {
|
||||||
return false;
|
return false
|
||||||
}else{
|
} else {
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
||||||
@@ -82,17 +107,17 @@ const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
|||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
minWidth: 350,
|
minWidth: 350,
|
||||||
search: {el:'input'}
|
search: { el: 'input' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardName',
|
prop: 'standardName',
|
||||||
label: '参照标准名称',
|
label: '参照标准名称',
|
||||||
minWidth: 150,
|
minWidth: 150
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardTime',
|
prop: 'standardTime',
|
||||||
label: '标准推行年份',
|
label: '标准推行年份',
|
||||||
minWidth: 150,
|
minWidth: 150
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'valueType',
|
prop: 'valueType',
|
||||||
@@ -100,41 +125,39 @@ const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
|||||||
enum: dictStore.getDictData('Script_Value_Type'),
|
enum: dictStore.getDictData('Script_Value_Type'),
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
search: showValueSearch.value ? { el: 'select' } : undefined,
|
search: showValueSearch.value ? { el: 'select' } : undefined,
|
||||||
minWidth: 150,
|
minWidth: 150
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'type',
|
prop: 'type',
|
||||||
label: '模板类型',
|
label: '模板类型',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return <el-tag type={scope.row.type ? 'success' : 'primary'}> {scope.row.type ? '模版' : '脚本'} </el-tag>
|
||||||
<el-tag type={scope.row.type ? 'success' : 'primary'} > {scope.row.type ? '模版' : '脚本'} </el-tag>
|
}
|
||||||
)
|
|
||||||
},
|
},
|
||||||
},
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 }
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
||||||
if(modeStore.currentMode == '比对式'){
|
if (modeStore.currentMode == '比对式') {
|
||||||
comparisonPopup.value?.open(titleType, row,modeStore.currentMode,)
|
comparisonPopup.value?.open(titleType, row, modeStore.currentMode)
|
||||||
}else{
|
} else {
|
||||||
if(titleType == 'add'){
|
|
||||||
valueTypePopup.value?.open(titleType, row,modeStore.currentMode)
|
if (titleType == 'add') {
|
||||||
}else{
|
router.push({
|
||||||
testScriptPopup.value?.open(titleType, row,modeStore.currentMode,'')
|
path: '/machine/testScriptAdd',
|
||||||
|
state: { title: '新增检测脚本', row: '', mode: modeStore.currentMode }
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/machine/testScriptAdd',
|
||||||
|
state: { title: '编辑检测脚本', row: JSON.stringify(row), mode: modeStore.currentMode }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 批量删除设备
|
// 批量删除设备
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
await useHandleData(deletePqScript, id, '删除所选脚本')
|
await useHandleData(deletePqScript, id, '删除所选脚本')
|
||||||
@@ -153,6 +176,4 @@ const updateType = async (params: TestScript.ResTestScript) => {
|
|||||||
await useHandleData(updatePqScript, params, `升级【${params.name}】为模版`)
|
await useHandleData(updatePqScript, params, `升级【${params.name}】为模版`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
:pagination="false"
|
:pagination="false"
|
||||||
:toolButton="false"
|
:toolButton="false"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
:row-key="id"
|
row-key="id"
|
||||||
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}"
|
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}"
|
||||||
|
:expand-row-keys="defaultExpandRowKeys"
|
||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
@@ -40,10 +41,11 @@ import ParameterPopup from '@/views/machine/testSource/components/parameterPopup
|
|||||||
import {reactive, ref, watch} from 'vue'
|
import {reactive, ref, watch} from 'vue'
|
||||||
import {generateUUID} from "@/styles";
|
import {generateUUID} from "@/styles";
|
||||||
import {defineEmits} from "vue/dist/vue";
|
import {defineEmits} from "vue/dist/vue";
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
|
||||||
const parameterPopup = ref()
|
const parameterPopup = ref()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
const btnDelete = ref(false)
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
const tableData = ref<any[]>([])
|
const tableData = ref<any[]>([])
|
||||||
@@ -68,6 +70,29 @@ watch(() => props.parameterStr, (newData) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const defaultExpandRowKeys =computed(() => {
|
||||||
|
return getDefaultKeyArray(tableData.value)
|
||||||
|
})
|
||||||
|
|
||||||
|
const getDefaultKeyArray = (data: any[]) => {
|
||||||
|
if (!data || data.length === 0) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
const firstElement = data[0]
|
||||||
|
let result: any[] = []
|
||||||
|
recursion(firstElement,result)
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
const recursion = (node: any, result: any[]) => {
|
||||||
|
if (node.children && node.children.length !== 0) {
|
||||||
|
result.push(node.id)
|
||||||
|
recursion(node.children[0], result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const getTableList = () => {
|
const getTableList = () => {
|
||||||
if (props.parameterStr) {
|
if (props.parameterStr) {
|
||||||
originalParameterArr = JSON.parse(props.parameterStr)
|
originalParameterArr = JSON.parse(props.parameterStr)
|
||||||
@@ -126,6 +151,9 @@ const columns = reactive<ColumnProps<any>[]>([
|
|||||||
prop: 'type',
|
prop: 'type',
|
||||||
label: '参数类型',
|
label: '参数类型',
|
||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
|
align: 'left',
|
||||||
|
headerAlign:'center'
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'desc',
|
prop: 'desc',
|
||||||
@@ -149,28 +177,49 @@ const openDialog = (titleType: string, row: Partial<TestSource.ParameterType> =
|
|||||||
|
|
||||||
// 批量删除源参数
|
// 批量删除源参数
|
||||||
const batchDelete = async (ids: string[]) => {
|
const batchDelete = async (ids: string[]) => {
|
||||||
let parentIds = originalParameterArr.map(item => item.pId)
|
ElMessageBox.confirm(`是否批量删除检测源?`, "温馨提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
draggable: true
|
||||||
|
}).then(async () => {
|
||||||
|
let parentIds = originalParameterArr.map(item => item.pId);
|
||||||
if (parentIds.some(item => ids.includes(item))) {
|
if (parentIds.some(item => ids.includes(item))) {
|
||||||
ElMessage.error('不能删除父节点');
|
ElMessage.error('不能删除父节点');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const id of ids) {
|
// 直接过滤掉需要删除的项
|
||||||
handleDelete(id)
|
originalParameterArr = originalParameterArr.filter(item => !ids.includes(item.id));
|
||||||
}
|
emit('change-parameter', originalParameterArr);
|
||||||
proTable.value?.clearSelection()
|
tableData.value = getTreeData(originalParameterArr);
|
||||||
|
ElMessage({
|
||||||
|
type: "success",
|
||||||
|
message: `批量删除检测源成功!`
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除源参数
|
// 删除源参数
|
||||||
const handleDelete = (id: string) => {
|
const handleDelete = (id: string) => {
|
||||||
let parentIds = originalParameterArr.map(item => item.pId)
|
ElMessageBox.confirm(`是否删除检测源?`, "温馨提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
draggable: true
|
||||||
|
}).then(async () => {
|
||||||
|
let parentIds = originalParameterArr.map(item => item.pId);
|
||||||
if (parentIds.includes(id)) {
|
if (parentIds.includes(id)) {
|
||||||
ElMessage.error('不能删除父节点');
|
ElMessage.error('不能删除父节点');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
originalParameterArr = originalParameterArr.filter(item => item.id !== id);
|
originalParameterArr = originalParameterArr.filter(item => item.id !== id);
|
||||||
emit('change-parameter', originalParameterArr)
|
emit('change-parameter', originalParameterArr);
|
||||||
tableData.value = getTreeData(originalParameterArr)
|
tableData.value = getTreeData(originalParameterArr);
|
||||||
|
ElMessage({
|
||||||
|
type: "success",
|
||||||
|
message: `删除检测源成功!`
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 复制源参数
|
// 复制源参数
|
||||||
const copyRow = (row) => {
|
const copyRow = (row) => {
|
||||||
delete row.children
|
delete row.children
|
||||||
@@ -225,3 +274,7 @@ defineExpose({
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@@ -157,6 +157,8 @@ const open = async (sign: string, data: TestSource.ResTestSource, currentMode: s
|
|||||||
dialogFormRef.value?.resetFields()
|
dialogFormRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const changeParameter = (parameterArr: any) => {
|
const changeParameter = (parameterArr: any) => {
|
||||||
formContent.value.parameter = JSON.stringify(parameterArr)
|
formContent.value.parameter = JSON.stringify(parameterArr)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ const filterMethod = (query: string, item: { label?: string }) => {
|
|||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
planData.value = data
|
planData.value = data
|
||||||
|
|
||||||
|
//console.log('123')
|
||||||
|
|
||||||
const pqDevList_Result1 = await getUnboundPqDevList(data);
|
const pqDevList_Result1 = await getUnboundPqDevList(data);
|
||||||
unboundPqDevList.value = pqDevList_Result1.data as Device.ReqPqDevParams[];
|
unboundPqDevList.value = pqDevList_Result1.data as Device.ReqPqDevParams[];
|
||||||
|
|
||||||
@@ -76,9 +78,11 @@ const filterMethod = (query: string, item: { label?: string }) => {
|
|||||||
boundPqDevList.value = pqDevList_Result2.data as Device.ReqPqDevParams[];
|
boundPqDevList.value = pqDevList_Result2.data as Device.ReqPqDevParams[];
|
||||||
|
|
||||||
value.value = boundPqDevList.value.map((i: { id: { toString: () => any } }) => i.id.toString());
|
value.value = boundPqDevList.value.map((i: { id: { toString: () => any } }) => i.id.toString());
|
||||||
|
//console.log('123',value.value)
|
||||||
}
|
}
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const save = async () => {
|
const save = async () => {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="检测脚本" prop="scriptId" :label-width="100">
|
<el-form-item label="检测脚本" prop="scriptId" :label-width="100">
|
||||||
<el-select v-model="formContent.scriptId" placeholder="请选择检测脚本" autocomplete="off">
|
<el-select v-model="formContent.scriptId" placeholder="请选择检测脚本" autocomplete="off" :disabled="isSelectDisabled ">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(option, index) in pqScriptArray"
|
v-for="(option, index) in pqScriptArray"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="误差体系" prop="errorSysId" :label-width="100">
|
<el-form-item label="误差体系" prop="errorSysId" :label-width="100">
|
||||||
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off">
|
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="isSelectDisabled">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(option, index) in pqErrorArray"
|
v-for="(option, index) in pqErrorArray"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -94,6 +94,7 @@
|
|||||||
import { type ErrorSystem } from '@/api/device/interface/error';
|
import { type ErrorSystem } from '@/api/device/interface/error';
|
||||||
import { type Device } from '@/api/device/interface/device';
|
import { type Device } from '@/api/device/interface/device';
|
||||||
import { Loading } from '@element-plus/icons-vue/dist/types';
|
import { Loading } from '@element-plus/icons-vue/dist/types';
|
||||||
|
import { truncate } from 'lodash';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -118,6 +119,7 @@ import { Loading } from '@element-plus/icons-vue/dist/types';
|
|||||||
const boundPqDevList=ref<Device.ResPqDev[]>([])//根据检测计划id查询出所有已绑定的设备
|
const boundPqDevList=ref<Device.ResPqDev[]>([])//根据检测计划id查询出所有已绑定的设备
|
||||||
const value = ref<string[]>([])
|
const value = ref<string[]>([])
|
||||||
const allData = computed(() => generateData())
|
const allData = computed(() => generateData())
|
||||||
|
const isSelectDisabled = ref(false)
|
||||||
const generateData = () => {
|
const generateData = () => {
|
||||||
const unboundData = unboundPqDevList.value.map((i: Device.ResPqDev) => ({
|
const unboundData = unboundPqDevList.value.map((i: Device.ResPqDev) => ({
|
||||||
key: i.id,
|
key: i.id,
|
||||||
@@ -214,6 +216,7 @@ const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
|||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
|
value.value = []
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
// 清空dialogForm中的值
|
// 清空dialogForm中的值
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
@@ -278,14 +281,21 @@ const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
|||||||
const open = async (sign: string,
|
const open = async (sign: string,
|
||||||
data: Plan.ReqPlan,
|
data: Plan.ReqPlan,
|
||||||
currentMode: string,) => {
|
currentMode: string,) => {
|
||||||
|
unboundPqDevList.value = []
|
||||||
|
boundPqDevList.value = []
|
||||||
//处理异步调用
|
//处理异步调用
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== currentMode)?.id ?? ''
|
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== currentMode)?.id ?? ''
|
||||||
data.pattern = patternId
|
data.pattern = patternId
|
||||||
mode.value = currentMode
|
mode.value = currentMode
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
|
isSelectDisabled.value = false
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
|
if(data.testState === 0){
|
||||||
|
isSelectDisabled.value = false
|
||||||
|
}else{
|
||||||
|
isSelectDisabled.value = true
|
||||||
|
}
|
||||||
|
|
||||||
Object.assign(formContent,{ ...data })
|
Object.assign(formContent,{ ...data })
|
||||||
} else {
|
} else {
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
@@ -295,6 +305,7 @@ const open = async (sign: string,
|
|||||||
|
|
||||||
if(sign == 'add')
|
if(sign == 'add')
|
||||||
{
|
{
|
||||||
|
console.log('add',data)
|
||||||
const [pqSource_Result, PqScript_Result, PqErrSys_Result,pqDevList_Result] = await Promise.all([
|
const [pqSource_Result, PqScript_Result, PqErrSys_Result,pqDevList_Result] = await Promise.all([
|
||||||
getTestSourceList(data),
|
getTestSourceList(data),
|
||||||
getPqScriptList(data),
|
getPqScriptList(data),
|
||||||
|
|||||||
@@ -7,21 +7,24 @@
|
|||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button type='primary' :icon='Download' @click='importClick'>导入</el-button>
|
<el-button type='primary' v-auth.plan="'import'" :icon='Download' @click='importClick'>导入</el-button>
|
||||||
<el-button type='primary' :icon='Upload' @click='exportClick'>导出</el-button>
|
<el-button type='primary' v-auth.plan="'export'" :icon='Upload' @click='exportClick'>导出</el-button>
|
||||||
<el-button type='primary' :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
|
<el-button type='primary' v-auth.plan="'combine'" :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
|
||||||
合并
|
合并
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
<el-button type='primary' v-auth.plan="'add'" :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
|
<el-button type='primary' v-auth.plan="'analysis'" :icon='List' :disabled='!scope.isSelected' @click='statisticalAnalysisMore(scope.selectedListIds,scope.selectedList)'>统计分析</el-button>
|
||||||
|
<el-button type='danger' v-auth.plan="'delete'" :icon='Delete' plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<template #operation='scope'>
|
||||||
<el-button type='primary' link :icon='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button>
|
<el-button type='primary' v-auth.plan="'edit'" link :icon='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button>
|
||||||
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
<el-button type='primary' v-auth.plan="'delete'" link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||||
<!-- <el-button type='primary' link :icon='List' @click='showDeviceOpen(scope.row)'>设备绑定</el-button> -->
|
<!-- <el-button type='primary' link :icon='List' @click='showDeviceOpen(scope.row)'>设备绑定</el-button> -->
|
||||||
|
<el-button type='primary' v-auth.plan="'analysis'" link :icon='List' v-if="scope.row.testState == '2'" @click='statisticalAnalysis(scope.row)'>统计分析</el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
@@ -34,14 +37,16 @@
|
|||||||
<TestSourcePopup :refresh-table='proTable?.getTableList' ref="testSourcePopup"/>
|
<TestSourcePopup :refresh-table='proTable?.getTableList' ref="testSourcePopup"/>
|
||||||
<!-- 查看设备绑定
|
<!-- 查看设备绑定
|
||||||
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/> -->
|
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/> -->
|
||||||
<ImportExcel ref='deviceImportExcel' />
|
<ImportExcel ref='planImportExcel' />
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='useProTable'>
|
<script setup lang='tsx' name='useProTable'>
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
import { ScaleToOriginal, CirclePlus, Delete, EditPen, View, Upload, Download, List, Tools } from '@element-plus/icons-vue'
|
import { ScaleToOriginal, CirclePlus, Delete, EditPen, View, Upload, Download, List, Tools } from '@element-plus/icons-vue'
|
||||||
import {getPlanList,deletePlan,exportPlan,downloadTemplate,importPlan } from '@/api/plan/plan.ts'
|
import {getPlanList,deletePlan,exportCNPlan,downloadCNPlanTemplate,importCNPlan } from '@/api/plan/plan.ts'
|
||||||
import { computed, onMounted, reactive, ref } from 'vue'
|
import { computed, onMounted, reactive, ref } from 'vue'
|
||||||
import type { Plan } from '@/api/plan/interface'
|
import type { Plan } from '@/api/plan/interface'
|
||||||
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
||||||
@@ -61,9 +66,11 @@ import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
|||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import { dictTestState,dictReportState,dictResult } from '@/api/plan/planData.ts'
|
import { dictTestState,dictReportState,dictResult } from '@/api/plan/planData.ts'
|
||||||
import {getTestSourceById} from '@/api/device/testSource/index'
|
import {getTestSourceById} from '@/api/device/testSource/index'
|
||||||
import ImportExcel from "@/components/ImportExcel/index.vue";
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
import {useDownload} from "@/hooks/useDownload";
|
import {useDownload} from "@/hooks/useDownload";
|
||||||
import {exportPqDev} from "@/api/device/device";
|
import {getTestConfig } from '@/api/system/base/index'
|
||||||
|
import {type Base } from '@/api/system/base/interface'
|
||||||
|
import { getBoundPqDevList ,staticsAnalyse} from '@/api/plan/plan.ts'
|
||||||
|
|
||||||
// defineOptions({
|
// defineOptions({
|
||||||
// name: 'planList'
|
// name: 'planList'
|
||||||
@@ -81,14 +88,20 @@ const planPopup = ref()
|
|||||||
const devTransferPopup = ref()
|
const devTransferPopup = ref()
|
||||||
const modeStore = useModeStore();
|
const modeStore = useModeStore();
|
||||||
|
|
||||||
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
const planImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
||||||
|
const planList = ref<Plan.ResPlan[]>([]);
|
||||||
const getTableList = async(params: any) => {
|
const getTableList = async(params: any) => {
|
||||||
let newParams = JSON.parse(JSON.stringify(params))
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||||
newParams.pattern = patternId
|
newParams.pattern = patternId
|
||||||
|
|
||||||
return getPlanList(newParams)
|
try {
|
||||||
|
const result = await getPlanList(newParams);
|
||||||
|
planList.value = result.data as Plan.ResPlan[];
|
||||||
|
return result;
|
||||||
|
} catch (error) {
|
||||||
|
return { data: [] }; // 返回空数据或处理错误
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -104,7 +117,6 @@ const dataSourceType = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
@@ -253,14 +265,9 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 300 },
|
||||||
])
|
])
|
||||||
|
|
||||||
const handleSourceClicked = (id: string) => {
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function isVisible(row: Plan.ReqPlan) {
|
function isVisible(row: Plan.ReqPlan) {
|
||||||
if(!row.hasOwnProperty('sourceName') || !Array.isArray(row.sourceName)){
|
if(!row.hasOwnProperty('sourceName') || !Array.isArray(row.sourceName)){
|
||||||
@@ -298,7 +305,6 @@ function showTestScript(row: string) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function handleFiles(event: Event) {
|
function handleFiles(event: Event) {
|
||||||
const target = event.target as HTMLInputElement
|
const target = event.target as HTMLInputElement
|
||||||
const files = target.files
|
const files = target.files
|
||||||
@@ -336,21 +342,21 @@ function handleFiles(event: Event) {
|
|||||||
// 点击导入按钮
|
// 点击导入按钮
|
||||||
const importClick = () => {
|
const importClick = () => {
|
||||||
const params = {
|
const params = {
|
||||||
title: '被检设备',
|
title: '检测计划',
|
||||||
showCover: false,
|
showCover: false,
|
||||||
patternId: dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? '',
|
patternId: dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? '',
|
||||||
tempApi: downloadTemplate,
|
tempApi: downloadCNPlanTemplate,
|
||||||
importApi: importPlan,
|
importApi: importCNPlan,
|
||||||
getTableList: proTable.value?.getTableList,
|
getTableList: proTable.value?.getTableList,
|
||||||
}
|
}
|
||||||
deviceImportExcel.value?.acceptParams(params)
|
planImportExcel.value?.acceptParams(params)
|
||||||
}
|
}
|
||||||
// 点击导出按钮
|
// 点击导出按钮
|
||||||
const exportClick = () => {
|
const exportClick = () => {
|
||||||
|
|
||||||
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', { type: 'warning' }).then(() =>{
|
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', { type: 'warning' }).then(() =>{
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||||
useDownload(exportPlan,'检测计划导出数据', {...proTable.value?.searchParam,pattern:patternId}, false,'.xlsx')
|
useDownload(exportCNPlan,'检测计划导出数据', {...proTable.value?.searchParam,pattern:patternId}, false,'.xlsx')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,9 +377,6 @@ const combineClick = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<Plan.ReqPlan> = {}) => {
|
const openDialog = (titleType: string, row: Partial<Plan.ReqPlan> = {}) => {
|
||||||
planPopup.value?.open(titleType, row,modeStore.currentMode)
|
planPopup.value?.open(titleType, row,modeStore.currentMode)
|
||||||
@@ -397,6 +400,56 @@ const showDeviceOpen = (row: Partial<Plan.ReqPlan> = {}) => {
|
|||||||
devTransferPopup.value.open(row)
|
devTransferPopup.value.open(row)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const myDict = new Map<string, any[]>();
|
||||||
|
|
||||||
|
const statisticalAnalysisMore = async (ids: string[], rows: Plan.ReqPlan[]) => {
|
||||||
|
const hasInvalidState = rows.some(row => row.testState != 2);
|
||||||
|
if (hasInvalidState) {
|
||||||
|
ElMessage({
|
||||||
|
type: 'error',
|
||||||
|
message: '存在检测状态不为检测完成的计划,无法进行统计分析。',
|
||||||
|
});
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
useDownload(staticsAnalyse,'分析结果', ids, false,'.xlsx')
|
||||||
|
}
|
||||||
|
|
||||||
|
const statisticalAnalysis = async (row: Partial<Plan.ReqPlan> = {}) => {
|
||||||
|
useDownload(staticsAnalyse,'分析结果', [row.id], false,'.xlsx')
|
||||||
|
|
||||||
|
// const response = await getTestConfig() as unknown as Base.ResTestConfig
|
||||||
|
// const maxTime= response.data.maxTime//检测最大次数
|
||||||
|
// const dev = await getBoundPqDevList({ 'planId': row.id })
|
||||||
|
// for (let i = 0; i <= maxTime; i++) {
|
||||||
|
// dev.data.forEach((item: any) => {
|
||||||
|
// if(item.reCheckNum === i){
|
||||||
|
// // 向已有的数组中添加元素
|
||||||
|
// if (myDict.has(i.toString())) {
|
||||||
|
// myDict.get(i.toString())?.push(item.name);
|
||||||
|
// }else{
|
||||||
|
// myDict.set(i.toString(), [item.name]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// for (let i = 0; i <= maxTime; i++) {
|
||||||
|
// if (myDict.has(i.toString())) {
|
||||||
|
// const array = myDict.get(i.toString());
|
||||||
|
// if (array) {
|
||||||
|
// for (const value of array) {
|
||||||
|
// console.log(i + '---'+value);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
:request-api='getDictTreeList'
|
:request-api='getDictTreeByName'
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
|
|
||||||
>
|
>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
import {useDictStore} from '@/stores/modules/dict'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
import {useHandleData} from '@/hooks/useHandleData'
|
import {useHandleData} from '@/hooks/useHandleData'
|
||||||
import {
|
import {
|
||||||
getDictTreeList,
|
getDictTreeByName,
|
||||||
deleteDictTree,
|
deleteDictTree,
|
||||||
} from '@/api/system/dictionary/dictTree'
|
} from '@/api/system/dictionary/dictTree'
|
||||||
import { reactive, ref } from 'vue'
|
import { reactive, ref } from 'vue'
|
||||||
|
|||||||
Reference in New Issue
Block a user