Compare commits
281 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddeb84fcfe | ||
|
|
b3aeebb7c7 | ||
|
|
b11f4839f4 | ||
|
|
4adc28a055 | ||
|
|
e46e9e1d3a | ||
|
|
4fcb26bbde | ||
|
|
6bd0e891fa | ||
|
|
15f1308557 | ||
|
|
9689197db9 | ||
|
|
4ad490657f | ||
|
|
9f8f8244e3 | ||
|
|
9206be2562 | ||
|
|
6065fd1f67 | ||
|
|
c16560a0ca | ||
|
|
440cfe1ac5 | ||
|
|
1ad1a0198e | ||
|
|
b603ac9bdb | ||
|
|
68aa4c409b | ||
|
|
f22b4e7fb8 | ||
|
|
400328d5fa | ||
|
|
cce3e6861a | ||
|
|
55368ce9b8 | ||
|
|
c6ef54f7d3 | ||
| 6f97c48226 | |||
| 5f45bc98fb | |||
|
|
5738594be2 | ||
|
|
ce47831992 | ||
| 634c2d84fc | |||
| 70855c5a21 | |||
|
|
b1e5e70411 | ||
|
|
bf2e3219fc | ||
|
|
2f5aeb9ffc | ||
| 9e8ed310fc | |||
| 07a5e32579 | |||
|
|
fe1bb04922 | ||
| a75e964adc | |||
|
|
87d22032e6 | ||
|
|
55ae64b3e1 | ||
|
|
891c6d8e93 | ||
|
|
ba7747dfe9 | ||
| b148c04059 | |||
|
|
4e179d61b5 | ||
|
|
b23ee84543 | ||
|
|
d02f85cea5 | ||
| ab02f8f1b3 | |||
| 8fc1d1ffc9 | |||
|
|
44b1da94c1 | ||
|
|
c2b63a7a3f | ||
|
|
56619c9140 | ||
|
|
99bbb5434d | ||
| 40c9c5fdad | |||
|
|
3ea2c93e43 | ||
|
|
6369c8ee63 | ||
|
|
da4bbf1e2c | ||
|
|
14e5535fd8 | ||
|
|
4e53bb3b27 | ||
| e793fdbe42 | |||
| 0e41a5b9f1 | |||
|
|
ac9dfd1669 | ||
|
|
72eb3e189b | ||
| 0cace11975 | |||
| b8e502b168 | |||
|
|
15502d0107 | ||
| cb4e4646bd | |||
| 93ce1b4994 | |||
|
|
1c452b5574 | ||
|
|
876c06ef54 | ||
|
|
37d65a944d | ||
|
|
7bc9321c86 | ||
|
|
ee564dccb6 | ||
| cdbb386c7c | |||
| 325ade7cdc | |||
|
|
fcd8c1a0dd | ||
|
|
fa1cb02a51 | ||
|
|
40fe12cd96 | ||
|
|
d83c04dc8b | ||
|
|
23b2974597 | ||
|
|
f5e78316ef | ||
|
|
cc2020f3d6 | ||
|
|
26cda335c5 | ||
|
|
171533cef0 | ||
|
|
69de6dd7a3 | ||
|
|
9039ed4bdc | ||
|
|
131d3b7018 | ||
|
|
454aabdc97 | ||
|
|
089c97d859 | ||
|
|
9ff5423368 | ||
|
|
f29d6e8d88 | ||
|
|
5199ee2db0 | ||
|
|
6de9e22b4c | ||
|
|
52968d9aaa | ||
|
|
b584142f5e | ||
|
|
edea30a406 | ||
|
|
1f3024eb91 | ||
| 8b9abba74b | |||
|
|
4dec1392f7 | ||
|
|
e54cbfbc0a | ||
|
|
505cd93446 | ||
|
|
f3ee11ebab | ||
|
|
45295ef898 | ||
|
|
0635dda6a0 | ||
|
|
f58f7b97e5 | ||
|
|
7556f0e5bc | ||
|
|
17fe29cb1b | ||
|
|
4bb4eb80d9 | ||
| ae1507e775 | |||
|
|
85d8a57bf7 | ||
|
|
42cf23a516 | ||
|
|
858cf75b46 | ||
|
|
de8a392d2c | ||
|
|
b614767b2d | ||
|
|
5ebb8549bf | ||
|
|
ead1feb379 | ||
|
|
1474c15bd9 | ||
|
|
f24f87dcc8 | ||
|
|
d416f46b3a | ||
| 352df35205 | |||
|
|
e5f201515e | ||
|
|
40520a7d30 | ||
|
|
cffbfe1380 | ||
|
|
839777ea4d | ||
|
|
5be1d22115 | ||
|
|
80d1912fd5 | ||
|
|
b94e0323d9 | ||
|
|
90f4e53e9f | ||
|
|
7ebad7d6b9 | ||
|
|
34534a1dbf | ||
| 645fac0681 | |||
| 0a23700403 | |||
|
|
c00f8843c0 | ||
|
|
8869974471 | ||
|
|
8125d60105 | ||
|
|
5a32d5b7a8 | ||
|
|
a1d113562b | ||
|
|
4a7535e4f5 | ||
|
|
de5548bbbd | ||
|
|
87c46e8477 | ||
|
|
edda224847 | ||
|
|
5ac6bbf04b | ||
|
|
b0a5329937 | ||
|
|
7a0626413d | ||
| fe04ad1573 | |||
|
|
689cc39bbc | ||
|
|
ba0c577514 | ||
|
|
a629907196 | ||
|
|
bf60bcfe12 | ||
|
|
27eb9a7d93 | ||
|
|
336ee843cc | ||
|
|
9eac101794 | ||
|
|
085fcc62aa | ||
|
|
99e6abbcfd | ||
| a4b96066e0 | |||
|
|
c4e2da8d67 | ||
|
|
1be15ee849 | ||
|
|
99bc54349b | ||
|
|
bf823ddff0 | ||
|
|
23e72f38a6 | ||
|
|
2d993b2f73 | ||
| 9703d35a3a | |||
|
|
d10a7a4884 | ||
|
|
938b9054d3 | ||
|
|
8a5bcca901 | ||
|
|
410cd53e51 | ||
|
|
4031724fa9 | ||
|
|
e95552e6b9 | ||
|
|
012f7e3346 | ||
|
|
cbe6c4a98d | ||
|
|
aa52778e99 | ||
|
|
5e8dda0b75 | ||
|
|
081aeacff7 | ||
|
|
65e54ee2b5 | ||
|
|
0fd6ebf810 | ||
|
|
fa4b5d26e5 | ||
|
|
23f45b38cb | ||
|
|
d76b055730 | ||
|
|
c334c07b39 | ||
|
|
45a5dcb068 | ||
|
|
3d9ba8b1cb | ||
|
|
c6836cad06 | ||
|
|
e70d1cb3f2 | ||
|
|
af454e1a56 | ||
|
|
6ce58e86ad | ||
| 2e17531c52 | |||
|
|
6b76d89507 | ||
|
|
e4025e39cb | ||
|
|
af12dc8d0a | ||
|
|
f0edeaee85 | ||
|
|
5cbdadecc4 | ||
|
|
30c1f90513 | ||
| c241d8b819 | |||
| 24f12a3590 | |||
|
|
f17f5c9925 | ||
|
|
99877b1c98 | ||
|
|
fdf91965d9 | ||
|
|
fd21d32f4a | ||
|
|
0a4385f29b | ||
|
|
63c6693d04 | ||
|
|
ff7084a332 | ||
|
|
b63e8897f5 | ||
|
|
dc3976f525 | ||
|
|
9b8765f001 | ||
| bbe23e1b14 | |||
|
|
5f0b36b3bb | ||
|
|
f0b75eae2f | ||
|
|
45e62b2750 | ||
|
|
d11e4822ed | ||
|
|
93b67fe845 | ||
|
|
ebc2ac1a41 | ||
|
|
4fd2f10ec6 | ||
|
|
2715871017 | ||
|
|
4cfca89895 | ||
| 53ead0e62f | |||
|
|
b00967159a | ||
|
|
1b37684e3c | ||
|
|
48f393be25 | ||
|
|
645fb83bce | ||
|
|
fe8bc407d3 | ||
|
|
d20cab57be | ||
|
|
68df3d5e23 | ||
|
|
8984bc577e | ||
|
|
07d02307e2 | ||
|
|
a027dc75c3 | ||
|
|
5da07d8631 | ||
|
|
d061fc9b32 | ||
|
|
ae47d429ba | ||
|
|
396d6a7336 | ||
|
|
fdf826d5f8 | ||
|
|
0db5fa650f | ||
|
|
53b4616a87 | ||
|
|
b923b7c35d | ||
|
|
8bd5351d29 | ||
|
|
726f7841e8 | ||
|
|
47883ce426 | ||
|
|
2459fc1848 | ||
|
|
cbc11f636a | ||
|
|
5dbd6eb8be | ||
|
|
167716e61b | ||
|
|
6d7f045bce | ||
|
|
a73417ea02 | ||
|
|
9c3850db98 | ||
| 393ad5fa0b | |||
|
|
9e8fe2c91f | ||
|
|
b57a7edf28 | ||
|
|
85cc5ebb27 | ||
| 0cd32fbb5f | |||
|
|
2833e65f57 | ||
|
|
5a29403636 | ||
|
|
9c0b9a7c93 | ||
|
|
69a4cbbbc2 | ||
|
|
e2b2382cc4 | ||
|
|
f8a4d05f57 | ||
|
|
d996c43f9f | ||
|
|
c195a58eb4 | ||
| b1c9375873 | |||
|
|
6010cbf20a | ||
|
|
11c32ed360 | ||
|
|
0494822ff4 | ||
|
|
2611f43d1f | ||
| ea4edfadd0 | |||
|
|
8e2a22cf61 | ||
|
|
3a1cfe0f31 | ||
|
|
5bdc44b301 | ||
|
|
92a1736667 | ||
|
|
57f9238033 | ||
|
|
1b171d4b8d | ||
|
|
c5acb84d97 | ||
|
|
63a1e9ec56 | ||
|
|
f06a8d6b15 | ||
| 92df927453 | |||
|
|
2878dce69d | ||
|
|
7d5d128b54 | ||
|
|
6e9e3db358 | ||
|
|
a415ffa12a | ||
|
|
9e8cdaead6 | ||
|
|
e5d4aae846 | ||
|
|
d6af35828d | ||
|
|
aa86c5e662 | ||
|
|
f99aa94b8f | ||
|
|
f5c226ba28 | ||
|
|
741020fe79 | ||
|
|
33004e081d |
11
.vscode/settings.json
vendored
11
.vscode/settings.json
vendored
@@ -1,18 +1,27 @@
|
|||||||
{
|
{
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
|
"CHNFACTOR",
|
||||||
|
"CHNPACTOR",
|
||||||
"Chns",
|
"Chns",
|
||||||
"Combox",
|
"Combox",
|
||||||
|
"Datasource",
|
||||||
"daterange",
|
"daterange",
|
||||||
"devicedata",
|
"devicedata",
|
||||||
"errordata",
|
"errordata",
|
||||||
"errordetail",
|
"errordetail",
|
||||||
|
"Interharmonic",
|
||||||
|
"IRMS",
|
||||||
"logdata",
|
"logdata",
|
||||||
|
"MSQI",
|
||||||
"Pids",
|
"Pids",
|
||||||
"plandata",
|
"plandata",
|
||||||
"PQDIF",
|
"PQDIF",
|
||||||
|
"Preinvestment",
|
||||||
"resourcedata",
|
"resourcedata",
|
||||||
"resourcename",
|
"resourcename",
|
||||||
"rmark",
|
"rmark",
|
||||||
"showtest"
|
"showtest",
|
||||||
|
"UNBAN",
|
||||||
|
"VRMS"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -25,10 +25,10 @@ module.exports = (appInfo) => {
|
|||||||
*/
|
*/
|
||||||
config.windowsOption = {
|
config.windowsOption = {
|
||||||
title: '自动检测平台',
|
title: '自动检测平台',
|
||||||
width: 1280,
|
width: 1600,
|
||||||
height: 850,
|
height: 950,
|
||||||
minWidth: 1280,
|
minWidth: 1600,
|
||||||
minHeight: 850,
|
minHeight: 950,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
//webSecurity: false,
|
//webSecurity: false,
|
||||||
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
||||||
|
|||||||
@@ -20,5 +20,5 @@ VITE_API_URL=/api
|
|||||||
# 开发环境跨域代理,支持配置多个
|
# 开发环境跨域代理,支持配置多个
|
||||||
|
|
||||||
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/"]]张文
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
:size='assemblySize'
|
:size='assemblySize'
|
||||||
:button='buttonConfig'
|
:button='buttonConfig'
|
||||||
>
|
>
|
||||||
<router-view :key='$route.fullPath' />
|
<router-view />
|
||||||
</el-config-provider>
|
</el-config-provider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
180
frontend/src/api/check/interface/index.ts
Normal file
180
frontend/src/api/check/interface/index.ts
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
export namespace CheckData {
|
||||||
|
export interface DataCheck {
|
||||||
|
scriptName: string,
|
||||||
|
errorSysName: string,
|
||||||
|
dataRule: string,
|
||||||
|
deviceName: string,
|
||||||
|
chnNum: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PhaseCheckResult {
|
||||||
|
// 检测源定值-标准值
|
||||||
|
resultData: number,
|
||||||
|
// 装置原始数据-被检值
|
||||||
|
data: number,
|
||||||
|
|
||||||
|
|
||||||
|
// 第几次谐波
|
||||||
|
num?: number,
|
||||||
|
//符合、不符合
|
||||||
|
isData?: number,
|
||||||
|
//最大误差值
|
||||||
|
radius?: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于定义 查看(设备)通道检测结果响应数据 类型
|
||||||
|
*/
|
||||||
|
export interface ResCheckResult {
|
||||||
|
dataA?: PhaseCheckResult | null,
|
||||||
|
dataB?: PhaseCheckResult | null,
|
||||||
|
dataC?: PhaseCheckResult | null,
|
||||||
|
dataT?: PhaseCheckResult | null,
|
||||||
|
|
||||||
|
// 第几次谐波
|
||||||
|
//num: number | null,
|
||||||
|
//符合、不符合
|
||||||
|
isData?: number,
|
||||||
|
//最大误差值
|
||||||
|
radius?: string,
|
||||||
|
//单位
|
||||||
|
unit?: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于定义 查看(设备)通道检测结果表格展示数据 类型
|
||||||
|
*/
|
||||||
|
export interface CheckResult {
|
||||||
|
stdA?: string,
|
||||||
|
dataA?: string,
|
||||||
|
errorA?: string,
|
||||||
|
maxErrorA?: string,
|
||||||
|
isDataA?: number,
|
||||||
|
stdB?: string,
|
||||||
|
dataB?: string,
|
||||||
|
errorB?: string,
|
||||||
|
maxErrorB?: string,
|
||||||
|
isDataB?: number,
|
||||||
|
stdC?: string,
|
||||||
|
dataC?: string,
|
||||||
|
errorC?: string,
|
||||||
|
maxErrorC?: string,
|
||||||
|
isDataC?: number,
|
||||||
|
stdT?: string,
|
||||||
|
dataT?: string,
|
||||||
|
errorT?: string,
|
||||||
|
maxErrorT?: string,
|
||||||
|
isDataT?: number,
|
||||||
|
|
||||||
|
//最大误差值
|
||||||
|
maxError?: string,
|
||||||
|
unit?: string,
|
||||||
|
//符合、不符合
|
||||||
|
result?: number,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于定义 具体通道的原始数据类型
|
||||||
|
*/
|
||||||
|
export interface RawDataItem {
|
||||||
|
time?: string,
|
||||||
|
harmNum?: number | null,
|
||||||
|
dataA?: string,
|
||||||
|
dataB?: string,
|
||||||
|
dataC?: string,
|
||||||
|
dataT?: string,
|
||||||
|
unit?: string | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Device {
|
||||||
|
deviceId: string; //装置序号Id
|
||||||
|
deviceName: string; //设备名称
|
||||||
|
chnNum: number; //设备通道数
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用来描述检测脚本类型
|
||||||
|
export interface ScriptItem {
|
||||||
|
id: string,
|
||||||
|
code: string,
|
||||||
|
scriptName: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用来描述 检测数据-左侧树结构
|
||||||
|
export interface TreeItem {
|
||||||
|
scriptTypeName: string | null,
|
||||||
|
sourceDesc: string | null,
|
||||||
|
harmNum: number | null,
|
||||||
|
index: number | null,
|
||||||
|
fly: number | null,
|
||||||
|
children: TreeItem[] | null,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用来描述 通道检测结果
|
||||||
|
export enum ChnCheckResultEnum {
|
||||||
|
UNKNOWN = -1,
|
||||||
|
LOADING = 0,
|
||||||
|
SUCCESS = 1,
|
||||||
|
FAIL = 2,
|
||||||
|
TIMEOUT = 3,
|
||||||
|
ERRORDATA = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeviceCheckResult {
|
||||||
|
deviceId: string,
|
||||||
|
deviceName: string,
|
||||||
|
chnResult: ChnCheckResultEnum[] //通道检测结果
|
||||||
|
}
|
||||||
|
|
||||||
|
//用来描述 某个脚本测试项对所有通道的检测结果
|
||||||
|
export interface ScriptChnItem {
|
||||||
|
scriptType: string
|
||||||
|
scriptName?: string //可以不要该属性,有点多余
|
||||||
|
|
||||||
|
// 设备
|
||||||
|
devices: Array<DeviceCheckResult>
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum ButtonColorEnum {
|
||||||
|
INFO = '#909399',
|
||||||
|
LOADING = '#003078',
|
||||||
|
SUCCESS = '#67c23a',
|
||||||
|
WARNING = '#e6a23c',
|
||||||
|
DANGER = '#f56c6c',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于描述 (设备)通道检测结果展示的按钮类型
|
||||||
|
*/
|
||||||
|
export interface ButtonResult {
|
||||||
|
color: ButtonColorEnum
|
||||||
|
icon: 'Minus' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于描述 脚本检测结果展示的按钮类型
|
||||||
|
*/
|
||||||
|
export interface ScriptChnViewItem {
|
||||||
|
scriptType: string,
|
||||||
|
scriptName?: string //脚本项名称,可以不要该属性,有点多余
|
||||||
|
|
||||||
|
// 设备
|
||||||
|
devices: Array<{
|
||||||
|
deviceId: string,
|
||||||
|
deviceName: string,
|
||||||
|
chnResult: ButtonResult[],
|
||||||
|
}>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义检测日志类型
|
||||||
|
*/
|
||||||
|
export interface LogItem {
|
||||||
|
type: 'info' | 'warning' | 'error'
|
||||||
|
log: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
59
frontend/src/api/check/test/index.ts
Normal file
59
frontend/src/api/check/test/index.ts
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import http from "@/api";
|
||||||
|
import {CheckData} from "@/api/check/interface";
|
||||||
|
|
||||||
|
export const getBigTestItem = (planId: string) => {
|
||||||
|
return http.get(`/adPlan/getBigTestItem?planId=${planId}`, {loading: false});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取弹出框表单数据
|
||||||
|
* @param params 当为scriptType为null时,表示查询所有脚本类型,否则只查询指定脚本类型。当为chnNum为-1时,表示查询所有通道,否则只查询指定通道。
|
||||||
|
*/
|
||||||
|
export const getFormData = (params: {
|
||||||
|
planId: string,
|
||||||
|
deviceId: string,
|
||||||
|
chnNum: string,
|
||||||
|
scriptType: string | null
|
||||||
|
}) => {
|
||||||
|
return http.post("/result/formContent/", params, {loading: false});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取树形结构数据
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const getTreeData = (params: {
|
||||||
|
scriptId: string,
|
||||||
|
devId: string,
|
||||||
|
devNum: string,
|
||||||
|
scriptType: string | null,
|
||||||
|
code: number,
|
||||||
|
}) => {
|
||||||
|
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取检查数据
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const getTableData = (params: {
|
||||||
|
scriptType: string | null,
|
||||||
|
scriptId: string,
|
||||||
|
devId: string,
|
||||||
|
devNum: string,
|
||||||
|
code: number,
|
||||||
|
index: number,
|
||||||
|
}) => {
|
||||||
|
return http.post("/result/resultData/", params, {loading: false});
|
||||||
|
}
|
||||||
|
|
||||||
|
export const exportRawData = (params: {
|
||||||
|
scriptType: string | null,
|
||||||
|
scriptId: string,
|
||||||
|
devId: string,
|
||||||
|
devNum: string,
|
||||||
|
code: number,
|
||||||
|
index: number,
|
||||||
|
}) => {
|
||||||
|
return http.download("/result/exportRawData", params, {loading: false});
|
||||||
|
}
|
||||||
29
frontend/src/api/device/devType/index.ts
Normal file
29
frontend/src/api/device/devType/index.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import type { DevType } from '@/api/device/interface/devType'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 设备类型管理模块
|
||||||
|
*/
|
||||||
|
|
||||||
|
//获取设备类型
|
||||||
|
export const getDevTypeList = (params: DevType.ReqPqDevTypeParams) => {
|
||||||
|
return http.post(`/devType/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加设备类型
|
||||||
|
export const addDevType = (params: DevType.ResPqDevType) => {
|
||||||
|
return http.post(`/devType/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑设备类型
|
||||||
|
export const updateDevType = (params: DevType.ResPqDevType) => {
|
||||||
|
return http.post(`/devType/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除设备类型
|
||||||
|
export const deleteDevType = (params: string[]) => {
|
||||||
|
return http.post(`/devType/delete`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -48,64 +48,64 @@ const data = [
|
|||||||
{
|
{
|
||||||
id: '1', //装置序号ID
|
id: '1', //装置序号ID
|
||||||
name: '240001', //设备名称
|
name: '240001', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882B4',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 4, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '2', //装置序号ID
|
id: '2', //装置序号ID
|
||||||
name: '240002', //设备名称
|
name: '240002', //设备名称
|
||||||
dev_Type: 'PQS882B4',//设备类型
|
dev_Type: 'PQS-882B4',//设备类型
|
||||||
dev_Chns: 4, //设备通道数
|
dev_Chns: 4, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '3', //装置序号ID
|
id: '3', //装置序号ID
|
||||||
name: '240003', //设备名称
|
name: '240003', //设备名称
|
||||||
dev_Type: 'PQS882B4',//设备类型
|
dev_Type: 'PQS-882B4',//设备类型
|
||||||
dev_Chns: 4, //设备通道数
|
dev_Chns: 4, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '4', //装置序号ID
|
id: '4', //装置序号ID
|
||||||
name: '240004', //设备名称
|
name: '240004', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882B4',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 4, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '5', //装置序号ID
|
id: '5', //装置序号ID
|
||||||
name: '240005', //设备名称
|
name: '240005', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '有不合格项', //检测结果
|
check_Result: '不符合', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'检测完成',//检测状态
|
check_State:'检测完成',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 1, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '6', //装置序号ID
|
id: '6', //装置序号ID
|
||||||
name: '240006', //设备名称
|
name: '240006', //设备名称
|
||||||
dev_Type: 'PQS882B4',//设备类型
|
dev_Type: 'PQS-882B4',//设备类型
|
||||||
dev_Chns: 4, //设备通道数
|
dev_Chns: 4, //设备通道数
|
||||||
check_Result: '有不合格项', //检测结果
|
check_Result: '不符合', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'检测完成',//检测状态
|
check_State:'检测完成',//检测状态
|
||||||
@@ -114,9 +114,9 @@ const data = [
|
|||||||
{
|
{
|
||||||
id: '7', //装置序号ID
|
id: '7', //装置序号ID
|
||||||
name: '240007', //设备名称
|
name: '240007', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '全部合格', //检测结果
|
check_Result: '符合', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'检测完成',//检测状态
|
check_State:'检测完成',//检测状态
|
||||||
@@ -125,20 +125,20 @@ const data = [
|
|||||||
{
|
{
|
||||||
id: '8', //装置序号ID
|
id: '8', //装置序号ID
|
||||||
name: '240008', //设备名称
|
name: '240008', //设备名称
|
||||||
dev_Type: 'PQS882B4',//设备类型
|
dev_Type: 'PQS-882B4',//设备类型
|
||||||
dev_Chns: 4, //设备通道数
|
dev_Chns: 4, //设备通道数
|
||||||
check_Result: '全部合格', //检测结果
|
check_Result: '符合', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'检测完成',//检测状态
|
check_State:'检测完成',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 1, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '9', //装置序号ID
|
id: '9', //装置序号ID
|
||||||
name: '240009', //设备名称
|
name: '240009', //设备名称
|
||||||
dev_Type: 'PQS882B4',//设备类型
|
dev_Type: 'PQS-882B4',//设备类型
|
||||||
dev_Chns: 4, //设备通道数
|
dev_Chns: 4, //设备通道数
|
||||||
check_Result: '有不合格项', //检测结果
|
check_Result: '不符合', //检测结果
|
||||||
report_State: '已生成', //报告状态
|
report_State: '已生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'检测完成',//检测状态
|
check_State:'检测完成',//检测状态
|
||||||
@@ -147,9 +147,9 @@ const data = [
|
|||||||
{
|
{
|
||||||
id: '10', //装置序号ID
|
id: '10', //装置序号ID
|
||||||
name: '240010', //设备名称
|
name: '240010', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '全部合格', //检测结果
|
check_Result: '符合', //检测结果
|
||||||
report_State: '已生成', //报告状态
|
report_State: '已生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'检测完成',//检测状态
|
check_State:'检测完成',//检测状态
|
||||||
@@ -158,9 +158,9 @@ const data = [
|
|||||||
{
|
{
|
||||||
id: '11', //装置序号ID
|
id: '11', //装置序号ID
|
||||||
name: '240011', //设备名称
|
name: '240011', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '全部合格', //检测结果
|
check_Result: '符合', //检测结果
|
||||||
report_State: '已生成', //报告状态
|
report_State: '已生成', //报告状态
|
||||||
document_State: '已归档', //归档状态
|
document_State: '已归档', //归档状态
|
||||||
check_State:'检测完成',//检测状态
|
check_State:'检测完成',//检测状态
|
||||||
@@ -169,9 +169,9 @@ const data = [
|
|||||||
{
|
{
|
||||||
id: '12', //装置序号ID
|
id: '12', //装置序号ID
|
||||||
name: '240012', //设备名称
|
name: '240012', //设备名称
|
||||||
dev_Type: 'PQS882B4',//设备类型
|
dev_Type: 'PQS-882B4',//设备类型
|
||||||
dev_Chns: 4, //设备通道数
|
dev_Chns: 4, //设备通道数
|
||||||
check_Result: '全部合格', //检测结果
|
check_Result: '符合', //检测结果
|
||||||
report_State: '已生成', //报告状态
|
report_State: '已生成', //报告状态
|
||||||
document_State: '已归档', //归档状态
|
document_State: '已归档', //归档状态
|
||||||
check_State:'检测完成',//检测状态
|
check_State:'检测完成',//检测状态
|
||||||
@@ -180,89 +180,89 @@ const data = [
|
|||||||
{
|
{
|
||||||
id: '13', //装置序号ID
|
id: '13', //装置序号ID
|
||||||
name: '240013', //设备名称
|
name: '240013', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '14', //装置序号ID
|
id: '14', //装置序号ID
|
||||||
name: '240014', //设备名称
|
name: '240014', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '15', //装置序号ID
|
id: '15', //装置序号ID
|
||||||
name: '240013', //设备名称
|
name: '240015', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '16', //装置序号ID
|
id: '16', //装置序号ID
|
||||||
name: '240014', //设备名称
|
name: '240016', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '17', //装置序号ID
|
id: '17', //装置序号ID
|
||||||
name: '240017', //设备名称
|
name: '240017', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '18', //装置序号ID
|
id: '18', //装置序号ID
|
||||||
name: '240018', //设备名称
|
name: '240018', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '19', //装置序号ID
|
id: '19', //装置序号ID
|
||||||
name: '240019', //设备名称
|
name: '240019', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '20', //装置序号ID
|
id: '20', //装置序号ID
|
||||||
name: '240020', //设备名称
|
name: '240020', //设备名称
|
||||||
dev_Type: 'PQS882A',//设备类型
|
dev_Type: 'PQS-882A',//设备类型
|
||||||
dev_Chns: 1, //设备通道数
|
dev_Chns: 1, //设备通道数
|
||||||
check_Result: '未检测', //检测结果
|
check_Result: '未检', //检测结果
|
||||||
report_State: '未生成', //报告状态
|
report_State: '未生成', //报告状态
|
||||||
document_State: '未归档', //归档状态
|
document_State: '未归档', //归档状态
|
||||||
check_State:'未检测',//检测状态
|
check_State:'未检',//检测状态
|
||||||
reCheck_Num: 0, //复检次数
|
reCheck_Num: 0, //复检次数
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -25,15 +25,39 @@ export const deletePqDev = (params: string[]) => {
|
|||||||
return http.post(`/pqDev/delete`, params)
|
return http.post(`/pqDev/delete`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
//导出被检设备
|
// export const downloadTemplate = () => {
|
||||||
export const exportPqDev=(params: Device.ReqPqDevParams)=>{
|
// return http.download(`/pqDev/downloadTemplate`)
|
||||||
return http.download(`/pqDev/export`, params)
|
// }
|
||||||
}
|
|
||||||
export const downloadTemplate = () => {
|
// //导入被检设备(比对)
|
||||||
return http.download(`/pqDev/downloadTemplate`)
|
// export const importPqDev=(params: Device.ReqPqDevParams)=>{
|
||||||
}
|
// return http.upload(`/pqDev/import`, params)
|
||||||
//导入被检设备
|
// }
|
||||||
export const importPqDev=(params: Device.ReqPqDevParams)=>{
|
// //导入比对式被检设备
|
||||||
return http.upload(`/pqDev/import`, params)
|
// export const importContrastPqDev=(params: Device.ReqPqDevParams)=>{
|
||||||
|
// return http.upload(`/pqDev/importContrast`, params)
|
||||||
|
// }
|
||||||
|
|
||||||
|
//导出灿能二楼设备
|
||||||
|
export const exportCNDev = (params: Device.ReqPqDevParams) => {
|
||||||
|
return http.download(`/pqDev/exportCNDev`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 下载灿能二楼设备导入文件模板
|
||||||
|
export const downloadCNDevTemplate = () => {
|
||||||
|
return http.download(`/pqDev/downloadCNDevTemplate`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//导入灿能二楼设备
|
||||||
|
export const importCNDev = (params: Device.ReqPqDevParams) => {
|
||||||
|
return http.uploadExcel(`/pqDev/importCNDev`, params)
|
||||||
|
}
|
||||||
|
//根据设备类型决定(电源、icd、模板、通道数、额定电压、额定电流);
|
||||||
|
export const getPqDev = () => {
|
||||||
|
return http.get(`/devType/listAll`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//被检设备归档
|
||||||
|
export const documentedPqDev = (ids: string[]) => {
|
||||||
|
return http.post(`/pqDev/documented`, ids)
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,183 +30,394 @@ const errordata = ref<ErrorSystem.ErrorSystemList[]>([
|
|||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
const errordetail = ref<ErrorSystem.Error_detail[]>([
|
const errorADetail = ref<ErrorSystem.Error_detail[]>([
|
||||||
{
|
{
|
||||||
measured: '电压偏差',
|
col1: '电压偏差',
|
||||||
|
col2: '',
|
||||||
deviceLevel: 'A',
|
deviceLevel: 'A',
|
||||||
measurementType:'电压',
|
measurementType:'电压',
|
||||||
condition: '10%~150%标称电压',
|
condition: '10%~150%标称电压',
|
||||||
maxErrorValue: '±0.1%Un'
|
maxErrorValue: '±0.1%Un'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '频率偏差',
|
col1:'频率偏差',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'频率',
|
measurementType:'频率',
|
||||||
condition: '42.5~57.5 Hz',
|
condition: '42.5~57.5 Hz',
|
||||||
maxErrorValue: '±0.01Hz'
|
maxErrorValue: '±0.01Hz'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '三相不平衡度',
|
col1:'三相不平衡度',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电压',
|
measurementType:'电压',
|
||||||
condition: '0.5%~5%',
|
condition: '0.5%~5%',
|
||||||
maxErrorValue: '±0.15%'
|
maxErrorValue: '±0.15%'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '三相不平衡度',
|
col1:'三相不平衡度',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电压',
|
measurementType:'电压',
|
||||||
condition: '5%(不包含)~ 40%',
|
condition: '5%(不包含)~ 40%',
|
||||||
maxErrorValue: '±0.3%'
|
maxErrorValue: '±0.3%'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '三相不平衡度',
|
col1:'三相不平衡度',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电流',
|
measurementType:'电流',
|
||||||
condition: '',
|
condition: '',
|
||||||
maxErrorValue: '±1%'
|
maxErrorValue: '±1%'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '电压波动幅值',
|
col1:'电压波动',
|
||||||
deviceLevel: 'A',
|
col2: '电压幅值',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电压',
|
measurementType:'电压',
|
||||||
condition: '',
|
condition: '',
|
||||||
maxErrorValue: '±0.2%Un'
|
maxErrorValue: '±0.2%Un'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '电压波动持续时间',
|
col1:'电压波动',
|
||||||
deviceLevel: 'A',
|
col2: '持续时间',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'时间',
|
measurementType:'时间',
|
||||||
condition: '',
|
condition: '',
|
||||||
maxErrorValue: '±1周波'
|
maxErrorValue: '±1周波'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '闪变',
|
col1:'闪变',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'短时间闪变',
|
measurementType:'短时间闪变',
|
||||||
condition: 'Pst:0.2~10',
|
condition: 'Pst:0.2~10',
|
||||||
maxErrorValue: '±5%'
|
maxErrorValue: '±5%'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '谐波和间谐波',
|
col1:'谐波和间谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电压',
|
measurementType:'电压',
|
||||||
condition: 'Uh≥1%Un',
|
condition: 'Uh≥1%Un',
|
||||||
maxErrorValue: '±5%Uh'
|
maxErrorValue: '±5%Uh'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '谐波和间谐波',
|
col1:'谐波和间谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电压',
|
measurementType:'电压',
|
||||||
condition: 'Uh<1%Un',
|
condition: 'Uh<1%Un',
|
||||||
maxErrorValue: '±0.05%Un'
|
maxErrorValue: '±0.05%Un'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '谐波和间谐波',
|
col1:'谐波和间谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电流',
|
measurementType:'电流',
|
||||||
condition: 'In≥3%In',
|
condition: 'In≥3%In',
|
||||||
maxErrorValue: '±5%Ih'
|
maxErrorValue: '±5%Ih'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '谐波和间谐波',
|
col1:'谐波和间谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电流',
|
measurementType:'电流',
|
||||||
condition: 'In<3%In',
|
condition: 'In<3%In',
|
||||||
maxErrorValue: '±0.15%In'
|
maxErrorValue: '±0.15%In'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '谐波和间谐波',
|
col1:'谐波和间谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'相角',
|
measurementType:'相角',
|
||||||
condition: '',
|
condition: '',
|
||||||
maxErrorValue: 'h≤5,±1°*h'
|
maxErrorValue: 'h≤5,±1°*h'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '谐波和间谐波',
|
col1:'谐波和间谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'相角',
|
measurementType:'相角',
|
||||||
condition: '',
|
condition: '',
|
||||||
maxErrorValue: 'h>5,±5°'
|
maxErrorValue: 'h>5,±5°'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '谐波和间谐波',
|
col1:'谐波和间谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'功率',
|
measurementType:'功率',
|
||||||
condition: 'Ph≥150W',
|
condition: 'Ph≥150W',
|
||||||
maxErrorValue: '±1%Ph'
|
maxErrorValue: '±1%Ph'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '谐波和间谐波',
|
col1:'谐波和间谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'功率',
|
measurementType:'功率',
|
||||||
condition: 'Ph<150W',
|
condition: 'Ph<150W',
|
||||||
maxErrorValue: '±1.5W'
|
maxErrorValue: '±1.5W'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '高频次谐波',
|
col1:'高频次谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电压',
|
measurementType:'电压',
|
||||||
condition: 'Uh≥1%Un',
|
condition: 'Uh≥1%Un',
|
||||||
maxErrorValue: '±5%Uh'
|
maxErrorValue: '±5%Uh'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '高频次谐波',
|
col1:'高频次谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电压',
|
measurementType:'电压',
|
||||||
condition: 'Uh<1%Un',
|
condition: 'Uh<1%Un',
|
||||||
maxErrorValue: '±0.05%Un'
|
maxErrorValue: '±0.05%Un'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '高频次谐波',
|
col1:'高频次谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电流',
|
measurementType:'电流',
|
||||||
condition: 'In≥3%In',
|
condition: 'In≥3%In',
|
||||||
maxErrorValue: '±5%Ih'
|
maxErrorValue: '±5%Ih'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '高频次谐波',
|
col1:'高频次谐波',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电流',
|
measurementType:'电流',
|
||||||
condition: 'In<3%In',
|
condition: 'In<3%In',
|
||||||
maxErrorValue: '±0.15%In'
|
maxErrorValue: '±0.15%In'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '功率',
|
col1:'功率',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'功率',
|
measurementType:'功率',
|
||||||
condition: '',
|
condition: '',
|
||||||
maxErrorValue: '±0.5%'
|
maxErrorValue: '±0.5%'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '电流',
|
col1:'电流',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电流',
|
measurementType:'电流',
|
||||||
condition: 'I≥0.05In',
|
condition: 'I≥0.05In',
|
||||||
maxErrorValue: '±0.5%'
|
maxErrorValue: '±0.5%'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '电流',
|
col1:'电流',
|
||||||
deviceLevel: 'A',
|
col2: '',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电流',
|
measurementType:'电流',
|
||||||
condition: '0.01In≤I<0.05In',
|
condition: '0.01In≤I<0.05In',
|
||||||
maxErrorValue: '±1%'
|
maxErrorValue: '±1%'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '暂态电压幅值',
|
col1: '电压暂降、电压暂升和短时中断',
|
||||||
deviceLevel: 'A',
|
col2: '电压幅值',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'电压',
|
measurementType:'电压',
|
||||||
condition: '',
|
condition: '',
|
||||||
maxErrorValue: '±0.2%Un'
|
maxErrorValue: '±0.2%Un'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
measured: '暂态持续时间',
|
col1: '电压暂降、电压暂升和短时中断',
|
||||||
deviceLevel: 'A',
|
col2: '持续时间',
|
||||||
|
deviceLevel: 'A',
|
||||||
measurementType:'时间',
|
measurementType:'时间',
|
||||||
condition: '',
|
condition: '',
|
||||||
maxErrorValue: '±1周波'
|
maxErrorValue: '±1周波'
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const errorSDetail = ref<ErrorSystem.Error_detail[]>([
|
||||||
|
{
|
||||||
|
col1: '电压偏差',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电压',
|
||||||
|
condition: '20%~120%标称电压',
|
||||||
|
maxErrorValue: '±0.5%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'频率偏差',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'频率',
|
||||||
|
condition: '42.5~57.5 Hz',
|
||||||
|
maxErrorValue: '±0.05Hz'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'三相不平衡度',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电压',
|
||||||
|
condition: '1%~5%',
|
||||||
|
maxErrorValue: '±0.2%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'三相不平衡度',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电压',
|
||||||
|
condition: '5%(不包含)~ 40%',
|
||||||
|
maxErrorValue: '±0.6%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'三相不平衡度',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电流',
|
||||||
|
condition: '',
|
||||||
|
maxErrorValue: '±1%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'电压波动',
|
||||||
|
col2: '电压幅值',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电压',
|
||||||
|
condition: '',
|
||||||
|
maxErrorValue: '±1.0%Un'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'电压波动',
|
||||||
|
col2: '持续时间',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'时间',
|
||||||
|
condition: '使用半波刷新方均根值',
|
||||||
|
maxErrorValue: '±1周波'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'电压波动',
|
||||||
|
col2: '持续时间',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'时间',
|
||||||
|
condition: '使用全波刷新方均根值',
|
||||||
|
maxErrorValue: '±2周波'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'闪变',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'短时间闪变',
|
||||||
|
condition: 'Pst:0.4~4',
|
||||||
|
maxErrorValue: '±10%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'谐波和间谐波',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电压',
|
||||||
|
condition: 'Uh≥3%Un',
|
||||||
|
maxErrorValue: '±5%Uh'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'谐波和间谐波',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电压',
|
||||||
|
condition: 'Uh<3%Un',
|
||||||
|
maxErrorValue: '±0.15%Un'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'谐波和间谐波',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电流',
|
||||||
|
condition: 'In≥10%In',
|
||||||
|
maxErrorValue: '±5%Ih'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'谐波和间谐波',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电流',
|
||||||
|
condition: 'In<10%In',
|
||||||
|
maxErrorValue: '±0.5%In'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'高频次谐波',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电压',
|
||||||
|
condition: 'Uh≥3%Un',
|
||||||
|
maxErrorValue: '±5%Uh'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'高频次谐波',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电压',
|
||||||
|
condition: 'Uh<3%Un',
|
||||||
|
maxErrorValue: '±0.15%Un'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'高频次谐波',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电流',
|
||||||
|
condition: 'In≥10%In',
|
||||||
|
maxErrorValue: '±5%Ih'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'高频次谐波',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电流',
|
||||||
|
condition: 'In<10%In',
|
||||||
|
maxErrorValue: '±0.5%In'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'功率',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'功率',
|
||||||
|
condition: '',
|
||||||
|
maxErrorValue: '±0.5%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'电流',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电流',
|
||||||
|
condition: 'I≥0.05In',
|
||||||
|
maxErrorValue: '±0.5%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1:'电流',
|
||||||
|
col2: '',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电流',
|
||||||
|
condition: '0.01In≤I<0.05In',
|
||||||
|
maxErrorValue: '±1%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1: '电压暂降、电压暂升和短时中断',
|
||||||
|
col2: '电压幅值',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'电压',
|
||||||
|
condition: '',
|
||||||
|
maxErrorValue: '±1.0%Un'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1: '电压暂降、电压暂升和短时中断',
|
||||||
|
col2: '持续时间',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'时间',
|
||||||
|
condition: '使用半波刷新方均根值',
|
||||||
|
maxErrorValue: '±1周波'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
col1: '电压暂降、电压暂升和短时中断',
|
||||||
|
col2: '持续时间',
|
||||||
|
deviceLevel: 'S',
|
||||||
|
measurementType:'时间',
|
||||||
|
condition: '使用全波刷新方均根值',
|
||||||
|
maxErrorValue: '±2周波'
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
export default {errordata,errordetail}
|
export default {errordata,errorADetail,errorSDetail}
|
||||||
38
frontend/src/api/device/icd/index.ts
Normal file
38
frontend/src/api/device/icd/index.ts
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import type { ICD } from '@/api/device/interface/icd'
|
||||||
|
import http from '@/api'
|
||||||
|
import { pa } from 'element-plus/es/locale/index.mjs'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name ICD管理模块
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//获取ICD分页
|
||||||
|
export const getICDList = (params: ICD.ReqICDParams) => {
|
||||||
|
return http.post(`/icd/list`,params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取ICD
|
||||||
|
export const getICDAllList = (params: ICD.ResICD) => {
|
||||||
|
return http.get(`/icd/listAll`,params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加ICD
|
||||||
|
export const addICD = (params: ICD.ResICD) => {
|
||||||
|
return http.post(`/icd/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑ICD
|
||||||
|
export const updateICD = (params: ICD.ResICD) => {
|
||||||
|
return http.post(`/icd/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除ICD
|
||||||
|
export const deleteICD = (params: string[]) => {
|
||||||
|
return http.post(`/icd/delete`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
40
frontend/src/api/device/interface/devType.ts
Normal file
40
frontend/src/api/device/interface/devType.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
|
// 设备类型模块
|
||||||
|
export namespace DevType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型数据表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqPqDevTypeParams extends ReqPage {
|
||||||
|
id: string; // 装置序号id 必填
|
||||||
|
devType?: string; // 设备名称
|
||||||
|
createTime?: string; //创建时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResPqDevType {
|
||||||
|
id: string; //设备类型ID
|
||||||
|
name: string;//设备类型名称
|
||||||
|
icd: string| null;//设备关联的ICD
|
||||||
|
power: string| null;//工作电源
|
||||||
|
devVolt: number; //额定电压(V)
|
||||||
|
devCurr: number; //额定电流(A)
|
||||||
|
devChns: number; //设备通道数
|
||||||
|
reportName: string| null;//报告模版名称
|
||||||
|
state: number;
|
||||||
|
createBy?: string| null; //创建用户
|
||||||
|
createTime?: string| null; //创建时间
|
||||||
|
updateBy?: string| null; //更新用户
|
||||||
|
updateTime?: string| null; //更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResPqDevTypePage extends ResPage<ResPqDevType> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,12 +4,22 @@ import type { ReqPage,ResPage } from '@/api/interface'
|
|||||||
export namespace Device {
|
export namespace Device {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电能质量指标字典数据表格分页查询参数
|
* 被检设备表格分页查询参数
|
||||||
*/
|
*/
|
||||||
export interface ReqPqDevParams extends ReqPage{
|
export interface ReqPqDevParams extends ReqPage{
|
||||||
id: string; // 装置序号id 必填
|
id: string; // 装置序号id 必填
|
||||||
|
name: string; //设备名称
|
||||||
devType?: string; // 设备名称
|
devType?: string; // 设备名称
|
||||||
createTime?:string; //创建时间
|
createTime?:string; //创建时间
|
||||||
|
pattern:string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被检设备表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqDevReportParams extends ReqPage{
|
||||||
|
planId?:string; // 计划id
|
||||||
|
devId?:string; // 装置id
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,7 +33,7 @@ export namespace Device {
|
|||||||
devChns: number; //设备通道数
|
devChns: number; //设备通道数
|
||||||
devVolt: number; //额定电压(V)
|
devVolt: number; //额定电压(V)
|
||||||
devCurr: number; //额定电流(A)
|
devCurr: number; //额定电流(A)
|
||||||
manufacturer: string;//生产厂家
|
manufacturer?: string | null;//生产厂家
|
||||||
createDate: string; //生产日期
|
createDate: string; //生产日期
|
||||||
createId: string; //出厂编号
|
createId: string; //出厂编号
|
||||||
hardwareVersion: string; //固件版本
|
hardwareVersion: string; //固件版本
|
||||||
@@ -42,18 +52,36 @@ export namespace Device {
|
|||||||
checkState?: number| null; //检测状态
|
checkState?: number| null; //检测状态
|
||||||
checkResult?: number| null; //检测结果
|
checkResult?: number| null; //检测结果
|
||||||
reportState?: number| null; //报告状态
|
reportState?: number| null; //报告状态
|
||||||
documentState?: number| null; //归档状态
|
|
||||||
reportPath?: string| null; //报告路径
|
reportPath?: string| null; //报告路径
|
||||||
qRCode?: string| null; //设备关键信息二维码
|
qRCode?: string| null; //设备关键信息二维码
|
||||||
reCheckNum: number; //复检次数
|
reCheckNum: number; //复检次数
|
||||||
|
planId?:string;//检测计划Id
|
||||||
|
timeCheckResult?:number;//守时检测结果(0:不符合1:符合)
|
||||||
|
factorFlag?:number;//是否支持系数校准(0:不支持,1:支持)
|
||||||
|
factorCheckResult?: number;//系数校准结果(0:不合格,1:合格,2:/表示没有做系数校准)
|
||||||
state: number; //状态
|
state: number; //状态
|
||||||
createBy?: string| null; //创建用户
|
createBy?: string| null; //创建用户
|
||||||
createTime?: string| null; //创建时间
|
createTime?: string| null; //创建时间
|
||||||
updateBy?: string| null; //更新用户
|
updateBy?: string| null; //更新用户
|
||||||
updateTime?: string| null; //更新时间
|
updateTime?: string| null; //更新时间
|
||||||
|
icdId: string| null;
|
||||||
|
power: string| null;//工作电源
|
||||||
|
preinvestmentPlan: string| null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface ResDev{
|
||||||
|
id: string;
|
||||||
|
name: string ,
|
||||||
|
icd:string ,
|
||||||
|
power:string,
|
||||||
|
devVolt:number,
|
||||||
|
devCurr:number,
|
||||||
|
devChns:number,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 被检设备表格查询分页返回的对象;
|
* 被检设备表格查询分页返回的对象;
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -22,25 +22,27 @@ export namespace ErrorSystem {
|
|||||||
|
|
||||||
// 查看详细误差体系
|
// 查看详细误差体系
|
||||||
export interface ErrorSystemDetail {
|
export interface ErrorSystemDetail {
|
||||||
nextId: number;
|
sort: number;
|
||||||
id:string;//误差体系子表ID
|
id:string;//误差体系子表ID
|
||||||
errorSysId:string;//所属误差体系ID
|
errorSysId:string;//所属误差体系ID
|
||||||
type: string;//检测脚本类型,树形字典表(没有树形表则需要拆分字段)
|
errorType: string;//误差类型,树形字典表(没有树形表则需要拆分字段)
|
||||||
startValue?:number;//误差判断起始值(误差范围)
|
scriptType: string;//脚本类型
|
||||||
|
startValue?:number | null;//误差判断起始值(误差范围)
|
||||||
startFlag?:number;//是否包含起始值
|
startFlag?:number;//是否包含起始值
|
||||||
endValue?:number;//;误差判断结束值(误差范围)
|
endValue?:number | null;//;误差判断结束值(误差范围)
|
||||||
endFlag?:number;//是否包含结束值
|
endFlag?:number;//是否包含结束值
|
||||||
conditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值)
|
conditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值)
|
||||||
maxErrorValue:number;//误差最大值
|
maxErrorValue:number;//误差最大值
|
||||||
errorValueType:string;//误差值类型(包括值类型,绝对值、相对值1、相对值2)
|
errorValueType:string;//误差值类型(包括值类型,绝对值、相对值1、相对值2)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查看详细误差体系
|
//查看详细误差体系
|
||||||
// export interface Error_detail {
|
export interface Error_detail {
|
||||||
// measured: string;
|
col1: string;
|
||||||
// deviceLevel: string;
|
col2: string;
|
||||||
// measurementType:string;
|
deviceLevel: string;
|
||||||
// condition: string;
|
measurementType:string;
|
||||||
// maxErrorValue: string;
|
condition: string;
|
||||||
// }
|
maxErrorValue: string;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
35
frontend/src/api/device/interface/icd.ts
Normal file
35
frontend/src/api/device/interface/icd.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
|
// ICD模块
|
||||||
|
export namespace ICD {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ICD表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqICDParams extends ReqPage {
|
||||||
|
id: string; // 装置序号id 必填
|
||||||
|
devType?: string; // 设备名称
|
||||||
|
createTime?: string; //创建时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ICD新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResICD {
|
||||||
|
id: string; //icdID
|
||||||
|
name: string;//icd名称
|
||||||
|
path: string;//icd存储地址
|
||||||
|
state: number;
|
||||||
|
createBy?: string| null; //创建用户
|
||||||
|
createTime?: string| null; //创建时间
|
||||||
|
updateBy?: string| null; //更新用户
|
||||||
|
updateTime?: string| null; //更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ICD表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResICDPage extends ResPage<ResICD> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,35 +1,35 @@
|
|||||||
import type { ReqPage,ResPage } from '@/api/interface'
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
// 被检设备模块
|
// 被检设备模块
|
||||||
export namespace Monitor {
|
export namespace Monitor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电能质量指标字典数据表格分页查询参数
|
* 电能质量指标字典数据表格分页查询参数
|
||||||
*/
|
*/
|
||||||
export interface ReqPqMonParams extends ReqPage{
|
export interface ReqPqMonParams extends ReqPage {
|
||||||
id: string; // 装置序号id 必填
|
id: string; // 装置序号id 必填
|
||||||
devType?: string; // 设备名称
|
devType?: string; // 设备名称
|
||||||
createTime?:string; //创建时间
|
createTime?: string; //创建时间
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 被检设备新增、修改、根据id查询返回的对象
|
* 被检设备新增、修改、根据id查询返回的对象
|
||||||
*/
|
*/
|
||||||
export interface ResPqMon {
|
export interface ResPqMon {
|
||||||
id: string; //监测点ID
|
id: string; //监测点ID
|
||||||
code: string; //默认与谐波系统监测点ID相同
|
code: string; //默认与谐波系统监测点ID相同
|
||||||
devId: string; //所属设备ID
|
devId: string; //所属设备ID
|
||||||
name: string; //所属母线
|
name: string; //所属母线
|
||||||
num: number; //监测点序号
|
num: number; //监测点序号
|
||||||
pt: number; //PT变比
|
pt: number; //PT变比
|
||||||
ct: number; //CT变比
|
ct: number; //CT变比
|
||||||
ptType:string; //接线方式,字典表
|
ptType: string; //接线方式,字典表
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 被检设备表格查询分页返回的对象;
|
* 被检设备表格查询分页返回的对象;
|
||||||
*/
|
*/
|
||||||
export interface ResPqMonPage extends ResPage<ResPqMon> {
|
export interface ResPqMonPage extends ResPage<ResPqMon> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,13 +11,14 @@ export namespace TestScript {
|
|||||||
id: string; // 装置序号id 必填
|
id: string; // 装置序号id 必填
|
||||||
name: string;
|
name: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
pattern:string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测脚本接口
|
// 检测脚本接口
|
||||||
export interface ResTestScript {
|
export interface ResTestScript {
|
||||||
id?: string; //检测脚本ID
|
id?: string; //检测脚本ID
|
||||||
name: string; //检测脚本名称
|
name: string; //检测脚本名称
|
||||||
type: string; //检测脚本类型(字典表Code字段,脚本还是模板)
|
type: string; //设定0为脚本,1为模板
|
||||||
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
||||||
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||||
standardName: string;//参照标准名称
|
standardName: string;//参照标准名称
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export namespace TestSource {
|
|||||||
// 检测源接口
|
// 检测源接口
|
||||||
export interface ResTestSource {
|
export interface ResTestSource {
|
||||||
id: string; //检测源ID
|
id: string; //检测源ID
|
||||||
name: string; //检测源名称(检测源类型 + 设备类型 + 数字自动生成)
|
name?: string; //检测源名称(检测源类型 + 设备类型 + 数字自动生成)
|
||||||
pattern: string;//检测源模式(字典表Code字段,数字、模拟、比对)
|
pattern: string;//检测源模式(字典表Code字段,数字、模拟、比对)
|
||||||
type: string; //检测源类型(字典表Code字段,标准源、高精度设备)
|
type: string; //检测源类型(字典表Code字段,标准源、高精度设备)
|
||||||
devType: string;//检测源设备类型(字典表Code字段)
|
devType: string;//检测源设备类型(字典表Code字段)
|
||||||
@@ -34,9 +34,9 @@ export namespace TestSource {
|
|||||||
}
|
}
|
||||||
export interface ParameterType{
|
export interface ParameterType{
|
||||||
id:string;
|
id:string;
|
||||||
sourceParamType:string;
|
type:string;
|
||||||
sourceParamDesc:string;
|
desc:string;
|
||||||
sourceParamValue:string;
|
value:string|null;
|
||||||
sort:number;
|
sort:number;
|
||||||
pId:string;
|
pId:string;
|
||||||
children?:ParameterType[];
|
children?:ParameterType[];
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ export const checkStatus = (status: number) => {
|
|||||||
case 400:
|
case 400:
|
||||||
ElMessage.error("请求失败!请您稍后重试");
|
ElMessage.error("请求失败!请您稍后重试");
|
||||||
break;
|
break;
|
||||||
case 401:
|
// case 401:
|
||||||
ElMessage.error("登录失效!请您重新登录");
|
// ElMessage.error("登录失效!请您重新登录");
|
||||||
break;
|
// break;
|
||||||
case 403:
|
case 403:
|
||||||
ElMessage.error("当前账号无权限访问!");
|
ElMessage.error("当前账号无权限访问!");
|
||||||
break;
|
break;
|
||||||
|
|||||||
6
frontend/src/api/home/channelsTest/index.ts
Normal file
6
frontend/src/api/home/channelsTest/index.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import http from "@/api";
|
||||||
|
|
||||||
|
//系数校准发送基本信息
|
||||||
|
export const getCoefficientCheck = (params: any) => {
|
||||||
|
return http.post(`/prepare/coefficientCheck`, params)
|
||||||
|
}
|
||||||
31
frontend/src/api/home/interface/channelsTest.ts
Normal file
31
frontend/src/api/home/interface/channelsTest.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// 系数校准模块
|
||||||
|
export namespace ChannelsTest {
|
||||||
|
|
||||||
|
// 系数校准列表
|
||||||
|
export interface CoefficientVO {
|
||||||
|
devName?: string;//设备名称
|
||||||
|
type?:string;//区分大小电压
|
||||||
|
monitorNum: string;//监测点序号
|
||||||
|
desc: string;//描述
|
||||||
|
aVuData:string;//电压通道A数据
|
||||||
|
aVuXi:string;//电压通道A系数
|
||||||
|
bVuData:string;//电压通道B数据
|
||||||
|
bVuXi:string;//电压通道B系数
|
||||||
|
cVuData:string;//电压通道C数据
|
||||||
|
cVuXi:string;//电压通道C系数
|
||||||
|
aIeData:string;//电流通道A数据
|
||||||
|
aIeXi:string;//电流通道A系数
|
||||||
|
bIeData:string;//电流通道B数据
|
||||||
|
bIeXi:string;//电流通道B系数
|
||||||
|
cIeData:string;//电流通道C数据
|
||||||
|
cIeXi:string;//电流通道C系数
|
||||||
|
loading: boolean;
|
||||||
|
aV:string;
|
||||||
|
bV:string;
|
||||||
|
cV:string;
|
||||||
|
aI:string;
|
||||||
|
bI:string;
|
||||||
|
cI:string;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { ElMessage, ElTreeSelect } from 'element-plus';
|
||||||
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from 'axios'
|
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from 'axios'
|
||||||
import { showFullScreenLoading, tryHideFullScreenLoading } from '@/components/Loading/fullScreen'
|
import { showFullScreenLoading, tryHideFullScreenLoading } from '@/components/Loading/fullScreen'
|
||||||
import { LOGIN_URL } from '@/config'
|
import { LOGIN_URL } from '@/config'
|
||||||
@@ -7,6 +8,7 @@ import { ResultEnum } from '@/enums/httpEnum'
|
|||||||
import { checkStatus } from './helper/checkStatus'
|
import { checkStatus } from './helper/checkStatus'
|
||||||
import { useUserStore } from '@/stores/modules/user'
|
import { useUserStore } from '@/stores/modules/user'
|
||||||
import router from '@/routers'
|
import router from '@/routers'
|
||||||
|
import {refreshToken} from '@/api/user/login'
|
||||||
|
|
||||||
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
|
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
@@ -42,7 +44,8 @@ class RequestHttp {
|
|||||||
config.loading ?? (config.loading = true)
|
config.loading ?? (config.loading = true)
|
||||||
config.loading && showFullScreenLoading()
|
config.loading && showFullScreenLoading()
|
||||||
if (config.headers && typeof config.headers.set === 'function') {
|
if (config.headers && typeof config.headers.set === 'function') {
|
||||||
config.headers.set('Authorization', 'Bearer '+userStore.token)
|
config.headers.set('Authorization', 'Bearer ' + userStore.accessToken)
|
||||||
|
config.headers.set('Refresh-Token', userStore.refreshToken)
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
@@ -51,25 +54,53 @@ class RequestHttp {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
let isFirst = true
|
||||||
/**
|
/**
|
||||||
* @description 响应拦截器
|
* @description 响应拦截器
|
||||||
* 服务器换返回信息 -> [拦截统一处理] -> 客户端JS获取到信息
|
* 服务器换返回信息 -> [拦截统一处理] -> 客户端JS获取到信息
|
||||||
*/
|
*/
|
||||||
this.service.interceptors.response.use(
|
this.service.interceptors.response.use(
|
||||||
(response: AxiosResponse) => {
|
async (response: AxiosResponse) => {
|
||||||
const { data } = response
|
const { data } = response
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
tryHideFullScreenLoading()
|
tryHideFullScreenLoading()
|
||||||
|
|
||||||
|
if(data.code === ResultEnum.ACCESSTOKEN_EXPIRED){
|
||||||
|
// 用长token去换短token
|
||||||
|
const result = await refreshToken()
|
||||||
|
if (result) { //获取新token成功的话
|
||||||
|
// 有新的token后,重新请求
|
||||||
|
userStore.setAccessToken(result.data.accessToken)
|
||||||
|
userStore.setRefreshToken(result.data.refreshToken)
|
||||||
|
response.config.headers.Authorization = `Bearer ${result.data.accessToken}`//重新请求前需要将更新后的新token更换掉之前无效的token,不然会死循环
|
||||||
|
const resp = await this.service.request(response.config)
|
||||||
|
return resp
|
||||||
|
} else {
|
||||||
|
// 刷新失效,跳转登录页
|
||||||
|
}
|
||||||
|
}
|
||||||
// 登陆失效
|
// 登陆失效
|
||||||
if (data.code == ResultEnum.OVERDUE) {
|
if (data.code == ResultEnum.OVERDUE) {
|
||||||
userStore.setToken('')
|
console.log("登陆失效")
|
||||||
userStore.setUserInfo({name: ''})
|
userStore.setAccessToken('')
|
||||||
|
userStore.setRefreshToken('')
|
||||||
|
userStore.setUserInfo({ name: '' })
|
||||||
router.replace(LOGIN_URL)
|
router.replace(LOGIN_URL)
|
||||||
ElMessage.error(data.message)
|
if(data.code != ResultEnum.OVERDUE){//临时处理token失效弹窗多次
|
||||||
|
ElMessage.error(data.message)
|
||||||
|
}else if(isFirst){
|
||||||
|
ElMessage.error(data.message)
|
||||||
|
isFirst = false
|
||||||
|
}
|
||||||
return Promise.reject(data)
|
return Promise.reject(data)
|
||||||
}
|
}
|
||||||
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
||||||
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
||||||
|
if(data.message.includes('&')){
|
||||||
|
const formattedMessage = data.message.split('&').join('<br>');
|
||||||
|
ElMessage.error({ message: formattedMessage, dangerouslyUseHTMLString: true });
|
||||||
|
return Promise.reject(data)
|
||||||
|
}
|
||||||
ElMessage.error(data.message)
|
ElMessage.error(data.message)
|
||||||
return Promise.reject(data)
|
return Promise.reject(data)
|
||||||
}
|
}
|
||||||
@@ -79,6 +110,7 @@ class RequestHttp {
|
|||||||
async (error: AxiosError) => {
|
async (error: AxiosError) => {
|
||||||
const { response } = error
|
const { response } = error
|
||||||
tryHideFullScreenLoading()
|
tryHideFullScreenLoading()
|
||||||
|
console.log('error', error.message)
|
||||||
// 请求超时 && 网络错误单独判断,没有 response
|
// 请求超时 && 网络错误单独判断,没有 response
|
||||||
if (error.message.indexOf('timeout') !== -1) ElMessage.error('请求超时!请您稍后重试')
|
if (error.message.indexOf('timeout') !== -1) ElMessage.error('请求超时!请您稍后重试')
|
||||||
if (error.message.indexOf('Network Error') !== -1) ElMessage.error('网络错误!请您稍后重试')
|
if (error.message.indexOf('Network Error') !== -1) ElMessage.error('网络错误!请您稍后重试')
|
||||||
@@ -115,9 +147,24 @@ class RequestHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
upload(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
upload(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||||
return this.service.post(url, params, { ..._object, headers: { 'Content-Type': 'multipart/form-data' } })
|
return this.service.post(url, params, {
|
||||||
|
..._object,
|
||||||
|
headers: { 'Content-Type': 'multipart/form-data' }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对excel的上传,默认返回的是blob类型,Excel没问题时返回json特殊处理
|
||||||
|
*/
|
||||||
|
uploadExcel(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||||
|
return this.service.post(url, params, {
|
||||||
|
..._object,
|
||||||
|
headers: { 'Content-Type': 'multipart/form-data' },
|
||||||
|
responseType: 'blob',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new RequestHttp(config)
|
export default new RequestHttp(config)
|
||||||
|
|||||||
@@ -1,227 +1,194 @@
|
|||||||
{
|
{
|
||||||
"code": "A0000",
|
"code": "A0000",
|
||||||
"data": [
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"pid": "0",
|
||||||
|
"name": "频率准确度检测",
|
||||||
|
"children": [
|
||||||
{
|
{
|
||||||
"id": "0",
|
"id": "1-1",
|
||||||
"name": "频率准确度检测",
|
"pid": "1",
|
||||||
"children": [
|
"name": "额定工作条件下的检测",
|
||||||
{
|
"children": [
|
||||||
"pid": 0,
|
{
|
||||||
"id": "0-1",
|
"id": "1-1-1",
|
||||||
"name": "额定工作条件下的检测",
|
"pid": "1-1",
|
||||||
"children": [
|
"name": "输入:频率 42.5Hz..."
|
||||||
{
|
},
|
||||||
"scriptIdx":1,
|
{
|
||||||
"isChildNode":true,
|
"id": "1-1-2",
|
||||||
"pid": "0-1",
|
"pid": "1-1",
|
||||||
"id": "0-1-1",
|
"name": "输入:频率 50.0Hz..."
|
||||||
"name": "输入:频率 42.5Hz..."
|
},
|
||||||
},
|
{
|
||||||
{
|
"id": "1-1-3",
|
||||||
"scriptIdx":2,
|
"pid": "1-1",
|
||||||
"isChildNode":true,
|
"name": "输入:频率 50.05Hz...."
|
||||||
"pid": "0-1",
|
}
|
||||||
"id": "0-1-2",
|
]
|
||||||
"name": "输入:频率 50.0Hz..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scriptIdx":3,
|
|
||||||
"isChildNode":true,
|
|
||||||
"pid": "0-1",
|
|
||||||
"id": "0-1-3",
|
|
||||||
"name": "输入:频率 50.05Hz..."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pid": 0,
|
|
||||||
"id": "0-2",
|
|
||||||
"name": "电压对频率测量的影响",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"scriptIdx":4,
|
|
||||||
"isChildNode":true,
|
|
||||||
"pid": "0-2",
|
|
||||||
"id": "0-2-1",
|
|
||||||
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scriptIdx":5,
|
|
||||||
"isChildNode":true,
|
|
||||||
"pid": "0-2",
|
|
||||||
"id": "0-2-1",
|
|
||||||
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scriptIdx":6,
|
|
||||||
"isChildNode":true,
|
|
||||||
"pid": "0-2",
|
|
||||||
"id": "0-2-2",
|
|
||||||
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pid": 0,
|
|
||||||
"id": "0-3",
|
|
||||||
"name": "谐波对频率测量的影响",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"scriptIdx":7,
|
|
||||||
"isChildNode":true,
|
|
||||||
"pid": "0-3",
|
|
||||||
"id": "0-3-1",
|
|
||||||
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "1",
|
"id": "1-2",
|
||||||
"name": "电压准确度检测",
|
"pid": "1",
|
||||||
"children": [
|
"name": "电压对频率测量的影响",
|
||||||
{
|
"children": [
|
||||||
"pid": 1,
|
{
|
||||||
"id": "1-1",
|
"id": "1-2-1",
|
||||||
"name": "额定工作条件下的检测",
|
"pid": "1-2",
|
||||||
"children": [
|
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
||||||
{
|
},
|
||||||
"scriptIdx":8,
|
{
|
||||||
"isChildNode":true,
|
"id": "1-2-1",
|
||||||
"pid": "1-1",
|
"pid": "1-2",
|
||||||
"id": "1-1-1",
|
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
||||||
"name": "输入:频率 42.5Hz..."
|
},
|
||||||
},
|
{
|
||||||
{
|
"id": "1-2-2",
|
||||||
"scriptIdx":9,
|
"pid": "1-2",
|
||||||
"isChildNode":true,
|
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
||||||
"pid": "1-1",
|
}
|
||||||
"id": "1-1-2",
|
]
|
||||||
"name": "输入:频率 50.0Hz..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scriptIdx":10,
|
|
||||||
"isChildNode":true,
|
|
||||||
"pid": "1-1",
|
|
||||||
"id": "1-1-3",
|
|
||||||
"name": "输入:频率 50.05Hz..."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pid": 0,
|
|
||||||
"id": "1-2",
|
|
||||||
"name": "电压对频率测量的影响",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"scriptIdx":11,
|
|
||||||
"isChildNode":true,
|
|
||||||
"pid": "1-2",
|
|
||||||
"id": "1-2-1",
|
|
||||||
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scriptIdx":12,
|
|
||||||
"isChildNode":true,
|
|
||||||
"pid": "1-2",
|
|
||||||
"id": "1-2-1",
|
|
||||||
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scriptIdx":13,
|
|
||||||
"isChildNode":true,
|
|
||||||
"pid": "1-2",
|
|
||||||
"id": "1-2-2",
|
|
||||||
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pid": 0,
|
|
||||||
"id": "0-3",
|
|
||||||
"name": "谐波对频率测量的影响",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"scriptIdx":14,
|
|
||||||
"isChildNode":true,
|
|
||||||
"pid": "0-3",
|
|
||||||
"id": "0-3-1",
|
|
||||||
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"id": "2",
|
"id": "1-3",
|
||||||
"name": "谐波准确度检测",
|
"pid": "1",
|
||||||
"children": [
|
"name": "谐波对频率测量的影响",
|
||||||
{
|
"children": [
|
||||||
"pid": 2,
|
{
|
||||||
"id": "2-1",
|
"id": "1-3-1",
|
||||||
"name": "额定工作条件下的检测",
|
"pid": "1-3",
|
||||||
"children": [
|
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
||||||
{
|
}
|
||||||
"scriptIdx":15,
|
]
|
||||||
"pid": "2-1",
|
|
||||||
"id": "2-1-1",
|
|
||||||
"name": "输入:频率 42.5Hz..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scriptIdx":16,
|
|
||||||
"pid": "2-1",
|
|
||||||
"id": "2-1-2",
|
|
||||||
"name": "输入:频率 50.0Hz..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scriptIdx":17,
|
|
||||||
"pid": "2-1",
|
|
||||||
"id": "2-1-3",
|
|
||||||
"name": "输入:频率 50.05Hz..."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pid": 2,
|
|
||||||
"id": "2-2",
|
|
||||||
"name": "电压对频率测量的影响",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"scriptIdx":18,
|
|
||||||
"pid": "2-2",
|
|
||||||
"id": "2-2-1",
|
|
||||||
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scriptIdx":19,
|
|
||||||
"pid": "2-2",
|
|
||||||
"id": "2-2-1",
|
|
||||||
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scriptIdx":20,
|
|
||||||
"pid": "2-2",
|
|
||||||
"id": "2-2-2",
|
|
||||||
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pid": 2,
|
|
||||||
"id": "2-3",
|
|
||||||
"name": "谐波对频率测量的影响",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"scriptIdx":21,
|
|
||||||
"pid": "2-3",
|
|
||||||
"id": "2-3-1",
|
|
||||||
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"id": "2",
|
||||||
|
"pid": "0",
|
||||||
|
"name": "电压准确度检测",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"pid": "2",
|
||||||
|
"id": "2-1",
|
||||||
|
"name": "额定工作条件下的检测",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "2-1-1",
|
||||||
|
"pid": "2-1",
|
||||||
|
"name": "输入:频率 42.5Hz..."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2-1-2",
|
||||||
|
"pid": "2-1",
|
||||||
|
"name": "输入:频率 50.0Hz..."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2-1-3",
|
||||||
|
"pid": "2-1",
|
||||||
|
"name": "输入:频率 50.05Hz..."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pid": "2",
|
||||||
|
"id": "2-2",
|
||||||
|
"name": "电压对频率测量的影响",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "2-2-1",
|
||||||
|
"pid": "2-2",
|
||||||
|
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2-2-1",
|
||||||
|
"pid": "2-2",
|
||||||
|
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2-2-2",
|
||||||
|
"pid": "2-2",
|
||||||
|
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pid": "2",
|
||||||
|
"id": "2-3",
|
||||||
|
"name": "谐波对频率测量的影响",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "2-3-1",
|
||||||
|
"pid": "2-3",
|
||||||
|
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "3",
|
||||||
|
"pid": "0",
|
||||||
|
"name": "谐波准确度检测",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "3-1",
|
||||||
|
"pid": "3",
|
||||||
|
"name": "额定工作条件下的检测",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "3-1-1",
|
||||||
|
"pid": "3-1",
|
||||||
|
"name": "输入:频率 42.5Hz..."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "3-1-2",
|
||||||
|
"pid": "3-1",
|
||||||
|
"name": "输入:频率 50.0Hz..."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "3-1-3",
|
||||||
|
"pid": "3-1",
|
||||||
|
"name": "输入:频率 50.05Hz..."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "3-2",
|
||||||
|
"pid": "3",
|
||||||
|
"name": "电压对频率测量的影响",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "3-2-1",
|
||||||
|
"pid": "3-2",
|
||||||
|
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "3-2-1",
|
||||||
|
"pid": "3-2",
|
||||||
|
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "3-2-2",
|
||||||
|
"pid": "3-2",
|
||||||
|
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "3-3",
|
||||||
|
"pid": "3",
|
||||||
|
"name": "谐波对频率测量的影响",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "3-3-1",
|
||||||
|
"pid": "3-3",
|
||||||
|
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,72 +1,44 @@
|
|||||||
import type { ReqPage } from '@/api/interface'
|
import type { ReqPage } from '@/api/interface'
|
||||||
import type { DatetimeFormatProps } from 'vue-i18n';
|
|
||||||
|
|
||||||
// 检测计划模块
|
// 检测计划模块
|
||||||
export namespace Plan {
|
export namespace Plan {
|
||||||
|
|
||||||
// 检测计划接口
|
// 检测计划接口
|
||||||
export interface PlanBO {
|
export interface ResPlan {
|
||||||
id?: string; //检测计划ID
|
id: string; //检测计划ID
|
||||||
name: string; //检测计划名称
|
name: string; //检测计划名称
|
||||||
pattern: string; //模式,字典表(数字、模拟、比对)
|
pattern: string; //模式,字典表(数字、模拟、比对)
|
||||||
father_Plan_Id?: string; //父计划ID
|
fatherPlanId?: string; //父计划ID
|
||||||
dataSource_Id: string[]; //数据源ID
|
dataSourceId: string; //数据源ID
|
||||||
script_Id: string; //检测脚本ID
|
scriptId: string; //检测脚本ID
|
||||||
error_Sys_Id: string;//误差体系ID
|
errorSysId: string;//误差体系ID
|
||||||
test_State: string; //检测状态
|
timeCheck:number;//守时检测:0否,1。是
|
||||||
report_State: string; //报告生成状态
|
testState: number; //检测状态:0:未检、1:检测中、2:检测完成,默认为 0
|
||||||
result: string;//检测结果
|
reportState: number; //报告生成状态:0:未生成、1:部分生成、2:全部生成,默认为 0
|
||||||
create_Time?: string;//创建时间
|
result: number;//检测结果:0:不符合、1:符合、2:/,默认为 2
|
||||||
|
code:number; //自动生成,用于生成数据表后缀
|
||||||
|
state: number;//;状态:0-删除 1-正常
|
||||||
|
createBy?:string; //创建用户
|
||||||
|
createTime?:string; //创建时间
|
||||||
|
updateBy?:string; //更新用户
|
||||||
|
updateTime?:string; //更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测计划 + 分页
|
// 检测计划 + 分页
|
||||||
export interface ReqPlanParams extends ReqPage,PlanBO {
|
export interface ReqPlanParams extends ReqPage,ResPlan {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测计划 + 检测源
|
|
||||||
export interface PlanAndSourceBO extends PlanBO {
|
export interface ReqPlan extends ResPlan {
|
||||||
testSourceName: string;//计划所属检测源
|
datasourceIds:string;
|
||||||
source_Id: string[];
|
sourceIds: string;
|
||||||
device_Id?: string[];
|
planId:string;
|
||||||
testSourceList?: string[];//临时测试
|
scriptName: string ;
|
||||||
dataSource_Ids:string;
|
errorSysName: string;
|
||||||
|
sourceName: string ;
|
||||||
|
devIds: string[];
|
||||||
}
|
}
|
||||||
// // 检测计划列表
|
|
||||||
// export interface PlanList {
|
|
||||||
// id: string; //检测计划ID
|
|
||||||
// name: string; //检测计划名称
|
|
||||||
// pattern: string; //模式,字典表(数字、模拟、比对)
|
|
||||||
// father_Plan_Id: string; //父计划ID
|
|
||||||
// dataSource_Id: string; //数据源ID
|
|
||||||
// script_Id: string; //检测脚本ID
|
|
||||||
// error_Sys_Id: string;//误差体系ID
|
|
||||||
// test_State: string; //检测状态
|
|
||||||
// report_State: string; //报告生成状态
|
|
||||||
// result: string;//检测结果
|
|
||||||
// state: number; //状态
|
|
||||||
// create_By?: string; //创建用户
|
|
||||||
// create_Time?: string;//创建时间
|
|
||||||
// update_By?: string; //更新用户
|
|
||||||
// update_Time?: string; //更新时间
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 被检设备参数
|
|
||||||
// export interface ReqPlanParams extends ReqPage {
|
|
||||||
// id: string; //检测计划ID
|
|
||||||
// name: string; //检测计划名称
|
|
||||||
// pattern: string; //模式,字典表(数字、模拟、比对)
|
|
||||||
// father_Plan_Id: string; //父计划ID
|
|
||||||
// dataSource_Id: string; //数据源ID
|
|
||||||
// script_Id: string; //检测脚本ID
|
|
||||||
// error_Sys_Id: string;//误差体系ID
|
|
||||||
// test_State: string; //检测状态
|
|
||||||
// report_State: string; //报告生成状态
|
|
||||||
// result: string;//检测结果
|
|
||||||
// state: number; //状态
|
|
||||||
// create_By?: string; //创建用户
|
|
||||||
// create_Time?: string;//创建时间
|
|
||||||
// update_By?: string; //更新用户
|
|
||||||
// update_Time?: string; //更新时间
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,87 @@
|
|||||||
import { ResPage } from '@/api/interface'
|
import type { Plan } from './interface'
|
||||||
import { Plan } from './interface'
|
|
||||||
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
|
import type { ErrorSystem } from '../device/interface/error'
|
||||||
|
import type { Device } from '../device/interface/device'
|
||||||
|
import { ReqDevReportParams } from '@/api/device/interface/device'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name 检测计划管理模块
|
* @name 检测计划管理模块
|
||||||
*/
|
*/
|
||||||
// 获取检测计划列表
|
// 获取检测计划列表
|
||||||
export const getPlanList = (params: Plan.ReqPlanParams) => {
|
export const getPlanList = (params: Plan.ReqPlanParams) => {
|
||||||
return http.post<ResPage<Plan.PlanBO>>(`/plan/list`, params)
|
return http.post(`/adPlan/list`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增检测计划
|
// 新增检测计划
|
||||||
export const addPlan = (params: Plan.PlanBO) => {
|
export const addPlan = (params: any) => {
|
||||||
return http.post(`/role/add`, params)
|
return http.post(`/adPlan/add`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑检测计划
|
// 编辑检测计划
|
||||||
export const editPlan = (params: Plan.PlanBO) => {
|
export const updatePlan = (params: any) => {
|
||||||
return http.post(`/role/edit`, params)
|
return http.post(`/adPlan/update`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除检测计划
|
// 删除检测计划
|
||||||
export const deletePlan = (params: { id: string[] }) => {
|
export const deletePlan = (params: { id: string[] }) => {
|
||||||
return http.post(`/role/del`, params)
|
return http.post(`/adPlan/delete`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取指定模式下所有检测源
|
||||||
|
export const getTestSourceList = (params: Plan.ReqPlan) => {
|
||||||
|
return http.get(`/pqSource/getAll?patternId=${params.pattern}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取指定模式下所有检测脚本
|
||||||
|
export const getPqScriptList = (params: Plan.ReqPlan) => {
|
||||||
|
return http.get(`/pqScript/getAll?patternId=${params.pattern}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取所有误差体系
|
||||||
|
export const getPqErrSysList = () => {
|
||||||
|
return http.get<ErrorSystem.ErrorSystemList>(`/pqErrSys/getAll`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取指定模式下所有未绑定的设备
|
||||||
|
export const getUnboundPqDevList = (params: Plan.ReqPlan) => {
|
||||||
|
return http.get(`/pqDev/listUnbound?pattern=${params.pattern}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据检测计划id查询出所有已绑定的设备
|
||||||
|
export const getBoundPqDevList = (params: any) => {
|
||||||
|
return http.post(`/pqDev/listByPlanId`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//检测计划绑定设备
|
||||||
|
// export const BindPqDevList = (params: any) => {
|
||||||
|
// return http.post(`/pqDev/bindDev`,params)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 按照模式查询检测计划(用于首页展示)
|
||||||
|
export const getPlanListByPattern = (params: Plan.ReqPlan) => {
|
||||||
|
return http.get(`/adPlan/listByPattern?pattern=${params.pattern}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出检测计划
|
||||||
|
export const exportPlan = (params: Device.ReqPqDevParams) => {
|
||||||
|
return http.download(`/adPlan/export`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下载模板
|
||||||
|
export const downloadTemplate = () => {
|
||||||
|
return http.download(`/adPlan/downloadTemplate`)
|
||||||
|
}
|
||||||
|
// 导入检测计划
|
||||||
|
export const importPlan = (params: Device.ReqPqDevParams) => {
|
||||||
|
return http.upload(`/adPlan/import`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 装置检测报告生成
|
||||||
|
export const generateDevReport = (params: Device.ReqDevReportParams) => {
|
||||||
|
return http.post(`/report/generateReport`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 装置检测报告下载
|
||||||
|
export const downloadDevData = (params: Device.ReqDevReportParams) => {
|
||||||
|
return http.download(`/report/downloadReport`, params)
|
||||||
|
}
|
||||||
@@ -58,11 +58,15 @@ const dictReportState: Dict[] = [
|
|||||||
const dictResult: Dict[] = [
|
const dictResult: Dict[] = [
|
||||||
{
|
{
|
||||||
id: "0",
|
id: "0",
|
||||||
label: '符合',
|
label: '不符合',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "1",
|
id: "1",
|
||||||
label: '不符合',
|
label: '符合',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '/',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -170,35 +174,35 @@ const testFatherPlanList: Dict[] = [
|
|||||||
const sourceDataList: Dict[] = [
|
const sourceDataList: Dict[] = [
|
||||||
{
|
{
|
||||||
id: "1",
|
id: "1",
|
||||||
label: '标准源-福禄克-6100A',
|
label: '标准源-FLUKE.6100A电能功率标准源-1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "2",
|
id: "2",
|
||||||
label: '标准源-昂立-PF2',
|
label: '标准源-ANGLI-FP2高性能数字信号源-1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "3",
|
id: "3",
|
||||||
label: '标准源-丹迪克-DKLN1',
|
label: '标准源-DKLN-1电能质量测试分析仪智能检定装置-1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "4",
|
id: "4",
|
||||||
label: '标准源-博电源-PQC600A',
|
label: '标准源-PQC600A高精度电能功率标准源-1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "5",
|
id: "5",
|
||||||
label: '高精度设备-PQV520-1',
|
label: '高精度设备-PQV-520便携式电能质量监测装置-1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "6",
|
id: "6",
|
||||||
label: '高精度设备-PQV520-2',
|
label: '高精度设备-PQV-520便携式电能质量监测装置-2',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "7",
|
id: "7",
|
||||||
label: '高精度设备-PQV520-3',
|
label: '高精度设备-PQV-520便携式电能质量监测装置-3',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "8",
|
id: "8",
|
||||||
label: '高精度设备-PQV520-4',
|
label: '高精度设备-PQV-520便携式电能质量监测装置-4',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -206,46 +210,80 @@ const sourceDataList: Dict[] = [
|
|||||||
const deviceDataList: Dict[] = [
|
const deviceDataList: Dict[] = [
|
||||||
{
|
{
|
||||||
id: "1",
|
id: "1",
|
||||||
label: '模拟装置1',
|
label: '240001',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "2",
|
id: "2",
|
||||||
label: '模拟装置2',
|
label: '240002',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "3",
|
id: "3",
|
||||||
label: '模拟装置3',
|
label: '240003',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "4",
|
id: "4",
|
||||||
label: '模拟装置4',
|
label: '240004',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "5",
|
id: "5",
|
||||||
label: '中电送检装置',
|
label: '240005',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "6",
|
id: "6",
|
||||||
label: '易司拓测试装置',
|
label: '240006',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "7",
|
id: "7",
|
||||||
label: '山大电力测试装置1',
|
label: '240007',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "8",
|
id: "8",
|
||||||
label: '山大电力测试装置2',
|
label: '240008',
|
||||||
},
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
// const deviceDataList: Dict[] = [
|
||||||
|
// {
|
||||||
|
// id: "1",
|
||||||
|
// label: '模拟装置1',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: "2",
|
||||||
|
// label: '模拟装置2',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: "3",
|
||||||
|
// label: '模拟装置3',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: "4",
|
||||||
|
// label: '模拟装置4',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: "5",
|
||||||
|
// label: '中电送检装置',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: "6",
|
||||||
|
// label: '易司拓测试装置',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: "7",
|
||||||
|
// label: '山大电力测试装置1',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: "8",
|
||||||
|
// label: '山大电力测试装置2',
|
||||||
|
// },
|
||||||
|
|
||||||
|
// ]
|
||||||
|
|
||||||
const planData = ref<Plan.PlanAndSourceBO[]>([
|
const planData = ref<Plan.PlanAndSourceBO[]>([
|
||||||
{
|
{
|
||||||
'id': '1',
|
'id': '1',
|
||||||
'name': '检测计划1',
|
'name': '沧州110kV东光站装置送检',
|
||||||
'pattern':'1',
|
'pattern':'1',
|
||||||
"source_Id" : ['1'],
|
"source_Id" : ['1'],
|
||||||
"testSourceName":'标准源-福禄克-6100A',
|
"testSourceName":'标准源-FLUKE.6100A电能功率标准源-1',
|
||||||
'dataSource_Id':['1'],
|
'dataSource_Id':['1'],
|
||||||
'dataSource_Ids':'实时数据',
|
'dataSource_Ids':'实时数据',
|
||||||
'script_Id':'1',
|
'script_Id':'1',
|
||||||
@@ -256,32 +294,32 @@ const planData = ref<Plan.PlanAndSourceBO[]>([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '2',
|
'id': '2',
|
||||||
'name': '检测计划2',
|
'name': '邯郸2台安徽振兴终端送检',
|
||||||
'pattern':'1',
|
'pattern':'1',
|
||||||
"source_Id" : ['5','6','7','8'],
|
"source_Id" : ['5','6','7','8'],
|
||||||
"testSourceName":'高精度设备-PQV520-1',
|
"testSourceName":'高精度设备-PQV-520便携式电能质量监测装置-1',
|
||||||
'father_Plan_Id':'1',
|
'father_Plan_Id':'1',
|
||||||
'dataSource_Id':['5'],
|
'dataSource_Id':['1'],
|
||||||
'dataSource_Ids':'分钟统计数据CP95值',
|
'dataSource_Ids':'实时数据',
|
||||||
'script_Id':'2',
|
'script_Id':'2',
|
||||||
'error_Sys_Id':'2',
|
'error_Sys_Id':'2',
|
||||||
'test_State':'2',
|
'test_State':'2',
|
||||||
'report_State':'2',
|
'report_State':'2',
|
||||||
'result':'0',
|
'result':'0',
|
||||||
"testSourceList":[
|
"testSourceList":[
|
||||||
'高精度设备-PQV520-2','高精度设备-PQV520-3','高精度设备-PQV520-4'
|
'高精度设备-PQV-520便携式电能质量监测装置-2','高精度设备-PQV-520便携式电能质量监测装置-3','高精度设备-PQV-520便携式电能质量监测装置-4'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '3',
|
'id': '3',
|
||||||
'name': '检测子计划3',
|
'name': '浙江分布式光伏电能质量试点',
|
||||||
'pattern':'1',
|
'pattern':'1',
|
||||||
"source_Id" : ['3'],
|
"source_Id" : ['3'],
|
||||||
"testSourceName":'标准源-丹迪克-DKLN1',
|
"testSourceName":'标准源-DKLN-1电能质量测试分析仪智能检定装置-1',
|
||||||
'father_Plan_Id':'1',
|
'father_Plan_Id':'1',
|
||||||
'dataSource_Id':['1'],
|
'dataSource_Id':['1'],
|
||||||
'dataSource_Ids':'实时数据',
|
'dataSource_Ids':'实时数据',
|
||||||
'script_Id':'3',
|
'script_Id':'4',
|
||||||
'error_Sys_Id':'3',
|
'error_Sys_Id':'3',
|
||||||
'test_State':'1',
|
'test_State':'1',
|
||||||
'report_State':'1',
|
'report_State':'1',
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
"code": "200",
|
"code": "200",
|
||||||
"data": [
|
"data": [
|
||||||
{
|
{
|
||||||
"name": "未检测",
|
"name": "未检",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"pid": 1,
|
"pid": 1,
|
||||||
"name": "邯郸220kV团城站等4座站电能质量检测"
|
"name": "邯郸220kV团城站电能质量检测"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 5,
|
"id": 5,
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
{
|
{
|
||||||
"id": 6,
|
"id": 6,
|
||||||
"pid": 1,
|
"pid": 1,
|
||||||
"name": "深圳市中电软件有限公司委托送检"
|
"name": "深圳市中电公司委托送检"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id": 1
|
"id": 1
|
||||||
@@ -28,17 +28,17 @@
|
|||||||
{
|
{
|
||||||
"id": 7,
|
"id": 7,
|
||||||
"pid": 2,
|
"pid": 2,
|
||||||
"name": "沧州220kV留古等4座变电站电能质量检测"
|
"name": "沧州220kV留古站电能质量检测"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 8,
|
"id": 8,
|
||||||
"pid": 2,
|
"pid": 2,
|
||||||
"name": "沧州供电公司110kV东光站等10台装置送检"
|
"name": "沧州110kV东光站装置送检"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 9,
|
"id": 9,
|
||||||
"pid": 2,
|
"pid": 2,
|
||||||
"name": "保定分布式光伏电能质量监测试点"
|
"name": "浙江分布式光伏电能质量试点"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id": 2
|
"id": 2
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
{
|
{
|
||||||
"id": 11,
|
"id": 11,
|
||||||
"pid": 3,
|
"pid": 3,
|
||||||
"name": "北京2024现场检测"
|
"name": "深圳2台中电终端委托送检"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id": 3
|
"id": 3
|
||||||
|
|||||||
34
frontend/src/api/socket/socket.ts
Normal file
34
frontend/src/api/socket/socket.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
|
||||||
|
export const startPreTest = (params) => {
|
||||||
|
return http.post(`/prepare/startPreTest`, params, {loading: false})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const closePreTest = (params) => {
|
||||||
|
return http.post(`/prepare/closePreTest`, params,{ loading: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始正式检测
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const startTest = (params) => {
|
||||||
|
return http.post(`/prepare/startTest`, params, {loading: false})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂停正式检测
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const pauseTest = () => {
|
||||||
|
return http.get(`/prepare/closePreTest`, {loading: false})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 继续正式检测
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const resumeTest = (params) => {
|
||||||
|
return http.post(`/prepare/restartTemTest/`, params, {loading: false})
|
||||||
|
}
|
||||||
@@ -216,7 +216,7 @@ const dictData: Dict[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
id: "0",
|
id: "0",
|
||||||
label: 'FLUKE6100A电能功率标准源',
|
label: 'FLUKE.6100A电能功率标准源',
|
||||||
code: 0,
|
code: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -236,7 +236,7 @@ const dictData: Dict[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "4",
|
id: "4",
|
||||||
label: 'PQV-520电能质量检测装置',
|
label: 'PQV-520便携式电能质量监测装置',
|
||||||
code: 4,
|
code: 4,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ export namespace Dict {
|
|||||||
name: string; // 名称
|
name: string; // 名称
|
||||||
code: string; // 编码
|
code: string; // 编码
|
||||||
sort: number; // 排序
|
sort: number; // 排序
|
||||||
|
openValue?: number | null;
|
||||||
level?: number | null; // 事件等级:0-普通;1-中等;2-严重 (默认为0)
|
level?: number | null; // 事件等级:0-普通;1-中等;2-严重 (默认为0)
|
||||||
algoDescribe?: number | null; // 与高级算法内部Id描述对应
|
algoDescribe?: number | null; // 与高级算法内部Id描述对应
|
||||||
value?: string | null; // 字典针对电压等级
|
value?: string | null; // 字典针对电压等级
|
||||||
@@ -116,10 +117,10 @@ export namespace Dict {
|
|||||||
storeFlag?:string ;//sts、di的是否存储 1:存储 0:不存 储;
|
storeFlag?:string ;//sts、di的是否存储 1:存储 0:不存 储;
|
||||||
curSts?:number | null;//sts、do的当前值;
|
curSts?:number | null;//sts、do的当前值;
|
||||||
ctlSts?:number;//do的是否可远程控制 1:是 0:否;
|
ctlSts?:number;//do的是否可远程控制 1:是 0:否;
|
||||||
maxNum?:number ;//设置最大值
|
maxNum?:number | null;//设置最大值
|
||||||
minNum?: number;//设置最小值
|
minNum?: number| null;//设置最小值
|
||||||
setValue?:string | null;//参数为enum可设置的所有值序列
|
setValue?:string | null;//参数为enum可设置的所有值序列
|
||||||
strlen?:number ;//参数string可设置字符串的长度上 限
|
strlen?:number | null;//参数string可设置字符串的长度上 限
|
||||||
defaultValue?:string | null; //参数缺省值、告警code值
|
defaultValue?:string | null; //参数缺省值、告警code值
|
||||||
resourcesId?:string ; //报表数据来源(统计表表名)
|
resourcesId?:string ; //报表数据来源(统计表表名)
|
||||||
limitName?:string | null; //限值字段名称
|
limitName?:string | null; //限值字段名称
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export namespace Login {
|
|||||||
}
|
}
|
||||||
export interface ResLogin {
|
export interface ResLogin {
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
|
refreshToken: string;
|
||||||
userInfo:{
|
userInfo:{
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,3 +30,11 @@ export const getDictList = () =>{
|
|||||||
return http.get<Dict>('/dictData/dictDataCache')
|
return http.get<Dict>('/dictData/dictDataCache')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//token刷新
|
||||||
|
export const refreshToken = () => {
|
||||||
|
return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`,
|
||||||
|
{},
|
||||||
|
{ loading: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,53 +1,53 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="dialogVisible" :title="`批量添加${parameter.title}`" :destroy-on-close="true" width="580px" draggable>
|
<el-dialog v-model='dialogVisible' :title='`批量添加${parameter.title}`' :destroy-on-close='true' width='580px'
|
||||||
<el-form class="drawer-multiColumn-form" label-width="100px">
|
draggable>
|
||||||
<el-form-item label="模板下载 :">
|
<el-form class='drawer-multiColumn-form' label-width='100px'>
|
||||||
<el-button type="primary" :icon="Download" @click="downloadTemp"> 点击下载 </el-button>
|
<el-form-item label='模板下载 :'>
|
||||||
|
<el-button type='primary' :icon='Download' @click='downloadTemp'> 点击下载</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="文件上传 :">
|
<el-form-item label='文件上传 :'>
|
||||||
<el-upload
|
<el-upload
|
||||||
action="#"
|
action='#'
|
||||||
class="upload"
|
class='upload'
|
||||||
:drag="true"
|
:drag='true'
|
||||||
:limit="excelLimit"
|
:limit='excelLimit'
|
||||||
:multiple="true"
|
:multiple='true'
|
||||||
:show-file-list="true"
|
:show-file-list='true'
|
||||||
:http-request="uploadExcel"
|
:http-request='uploadExcel'
|
||||||
:before-upload="beforeExcelUpload"
|
:before-upload='beforeExcelUpload'
|
||||||
:on-exceed="handleExceed"
|
:on-exceed='handleExceed'
|
||||||
:on-success="excelUploadSuccess"
|
|
||||||
:on-error="excelUploadError"
|
|
||||||
:accept="parameter.fileType!.join(',')"
|
:accept="parameter.fileType!.join(',')"
|
||||||
>
|
>
|
||||||
<slot name="empty">
|
<slot name='empty'>
|
||||||
<el-icon class="el-icon--upload">
|
<el-icon class='el-icon--upload'>
|
||||||
<upload-filled />
|
<upload-filled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
<div class='el-upload__text'>将文件拖到此处,或<em>点击上传</em></div>
|
||||||
</slot>
|
</slot>
|
||||||
<template #tip>
|
<template #tip>
|
||||||
<slot name="tip">
|
<slot name='tip'>
|
||||||
<div class="el-upload__tip">请上传 .xls , .xlsx 标准格式文件,文件最大为 {{ parameter.fileSize }}M</div>
|
<div class='el-upload__tip'>请上传 .xls , .xlsx 标准格式文件,文件最大为 {{ parameter.fileSize }}M</div>
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="parameter.showCover" label="数据覆盖 :">
|
<el-form-item v-if='parameter.showCover' label='数据覆盖 :'>
|
||||||
<el-switch v-model="isCover" />
|
<el-switch v-model='isCover' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="ImportExcel">
|
<script setup lang='ts' name='ImportExcel'>
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue'
|
||||||
import { useDownload } from "@/hooks/useDownload";
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
import { Download } from "@element-plus/icons-vue";
|
import { Download } from '@element-plus/icons-vue'
|
||||||
import { ElNotification, UploadRequestOptions, UploadRawFile } from "element-plus";
|
import { ElNotification, UploadRequestOptions, UploadRawFile, ElMessage } from 'element-plus'
|
||||||
|
|
||||||
export interface ExcelParameterProps {
|
export interface ExcelParameterProps {
|
||||||
title: string; // 标题
|
title: string; // 标题
|
||||||
showCover?: boolean; // 是否显示”数据覆盖“选项
|
showCover?: boolean; // 是否显示”数据覆盖“选项
|
||||||
|
patternId?: string; // 模式ID
|
||||||
fileSize?: number; // 上传文件的大小
|
fileSize?: number; // 上传文件的大小
|
||||||
fileType?: File.ExcelMimeType[]; // 上传文件的类型
|
fileType?: File.ExcelMimeType[]; // 上传文件的类型
|
||||||
tempApi?: (params: any) => Promise<any>; // 下载模板的Api
|
tempApi?: (params: any) => Promise<any>; // 下载模板的Api
|
||||||
@@ -56,96 +56,130 @@ export interface ExcelParameterProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 是否覆盖数据
|
// 是否覆盖数据
|
||||||
const isCover = ref(false);
|
const isCover = ref(false)
|
||||||
// 最大文件上传数
|
// 最大文件上传数
|
||||||
const excelLimit = ref(1);
|
const excelLimit = ref(1)
|
||||||
// dialog状态
|
// dialog状态
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false)
|
||||||
// 父组件传过来的参数
|
// 父组件传过来的参数
|
||||||
const parameter = ref<ExcelParameterProps>({
|
const parameter = ref<ExcelParameterProps>({
|
||||||
title: "",
|
title: '',
|
||||||
fileSize: 5,
|
fileSize: 5,
|
||||||
fileType: ["application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]
|
fileType: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
||||||
});
|
})
|
||||||
|
|
||||||
// 接收父组件参数
|
// 接收父组件参数
|
||||||
const acceptParams = (params: ExcelParameterProps) => {
|
const acceptParams = (params: ExcelParameterProps) => {
|
||||||
parameter.value = { ...parameter.value, ...params };
|
parameter.value = { ...parameter.value, ...params }
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true
|
||||||
};
|
}
|
||||||
|
|
||||||
// Excel 导入模板下载
|
// Excel 导入模板下载
|
||||||
const downloadTemp = () => {
|
const downloadTemp = () => {
|
||||||
if (!parameter.value.tempApi) return;
|
if (!parameter.value.tempApi) return
|
||||||
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`,{},true);
|
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, {}, false)
|
||||||
};
|
}
|
||||||
|
|
||||||
// 文件上传
|
// 文件上传
|
||||||
const uploadExcel = async (param: UploadRequestOptions) => {
|
const uploadExcel = async (param: UploadRequestOptions) => {
|
||||||
debugger
|
let excelFormData = new FormData()
|
||||||
let excelFormData = new FormData();
|
excelFormData.append('file', param.file)
|
||||||
excelFormData.append("file", param.file);
|
if (parameter.value.patternId) {
|
||||||
isCover.value && excelFormData.append("isCover", isCover.value as unknown as Blob);
|
excelFormData.append('patternId', parameter.value.patternId)
|
||||||
await parameter.value.importApi!(excelFormData);
|
}
|
||||||
parameter.value.getTableList && parameter.value.getTableList();
|
isCover.value && excelFormData.append('isCover', isCover.value as unknown as Blob)
|
||||||
dialogVisible.value = false;
|
//await parameter.value.importApi!(excelFormData);
|
||||||
};
|
await parameter.value.importApi!(excelFormData)
|
||||||
|
.then(res => handleImportResponse(res))
|
||||||
|
parameter.value.getTableList && parameter.value.getTableList()
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function handleImportResponse(res: any) {
|
||||||
|
if (res.type === 'application/json') {
|
||||||
|
const fileReader = new FileReader()
|
||||||
|
fileReader.onloadend = () => {
|
||||||
|
try {
|
||||||
|
const jsonData = JSON.parse(fileReader.result)
|
||||||
|
if (jsonData.code === 'A0000') {
|
||||||
|
ElMessage.success('导入成功')
|
||||||
|
} else {
|
||||||
|
ElMessage.error(jsonData.message)
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fileReader.readAsText(res)
|
||||||
|
} else {
|
||||||
|
ElMessage.error('导入失败,请查看下载附件!')
|
||||||
|
let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
|
||||||
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = '终端入网检测失败列表'
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
link.remove()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 文件上传之前判断
|
* @description 文件上传之前判断
|
||||||
* @param file 上传的文件
|
* @param file 上传的文件
|
||||||
* */
|
* */
|
||||||
const beforeExcelUpload = (file: UploadRawFile) => {
|
const beforeExcelUpload = (file: UploadRawFile) => {
|
||||||
const isExcel = parameter.value.fileType!.includes(file.type as File.ExcelMimeType);
|
const isExcel = parameter.value.fileType!.includes(file.type as File.ExcelMimeType)
|
||||||
const fileSize = file.size / 1024 / 1024 < parameter.value.fileSize!;
|
const fileSize = file.size / 1024 / 1024 < parameter.value.fileSize!
|
||||||
if (!isExcel)
|
if (!isExcel)
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: "温馨提示",
|
title: '温馨提示',
|
||||||
message: "上传文件只能是 xls / xlsx 格式!",
|
message: '上传文件只能是 xls / xlsx 格式!',
|
||||||
type: "warning"
|
type: 'warning',
|
||||||
});
|
})
|
||||||
if (!fileSize)
|
if (!fileSize)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: "温馨提示",
|
title: '温馨提示',
|
||||||
message: `上传文件大小不能超过 ${parameter.value.fileSize}MB!`,
|
message: `上传文件大小不能超过 ${parameter.value.fileSize}MB!`,
|
||||||
type: "warning"
|
type: 'warning',
|
||||||
});
|
})
|
||||||
}, 0);
|
}, 0)
|
||||||
return isExcel && fileSize;
|
return isExcel && fileSize
|
||||||
};
|
}
|
||||||
|
|
||||||
// 文件数超出提示
|
// 文件数超出提示
|
||||||
const handleExceed = () => {
|
const handleExceed = () => {
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: "温馨提示",
|
title: '温馨提示',
|
||||||
message: "最多只能上传一个文件!",
|
message: '最多只能上传一个文件!',
|
||||||
type: "warning"
|
type: 'warning',
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
// 上传错误提示
|
// 上传错误提示
|
||||||
const excelUploadError = () => {
|
// const excelUploadError = () => {
|
||||||
ElNotification({
|
// ElNotification({
|
||||||
title: "温馨提示",
|
// title: '温馨提示',
|
||||||
message: `批量添加${parameter.value.title}失败,请您重新上传!`,
|
// message: `批量添加${parameter.value.title}失败,请您重新上传!`,
|
||||||
type: "error"
|
// type: 'error',
|
||||||
});
|
// })
|
||||||
};
|
// }
|
||||||
|
|
||||||
// 上传成功提示
|
// 上传成功提示
|
||||||
const excelUploadSuccess = () => {
|
// const excelUploadSuccess = () => {
|
||||||
ElNotification({
|
// ElNotification({
|
||||||
title: "温馨提示",
|
// title: '温馨提示',
|
||||||
message: `批量添加${parameter.value.title}成功!`,
|
// message: `批量添加${parameter.value.title}成功!`,
|
||||||
type: "success"
|
// type: 'success',
|
||||||
});
|
// })
|
||||||
};
|
// }
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
acceptParams
|
acceptParams,
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang='scss' scoped>
|
||||||
@import "./index.scss";
|
@import "./index.scss";
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -8,9 +8,8 @@
|
|||||||
:search-param='searchParam'
|
:search-param='searchParam'
|
||||||
:search-col='searchCol'
|
:search-col='searchCol'
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 表格主体 -->
|
<!-- 表格主体 -->
|
||||||
<div class='card table-main'>
|
<div class='table-main' :class='{ card: showCard }' >
|
||||||
<!-- 表格头部 操作按钮 -->
|
<!-- 表格头部 操作按钮 -->
|
||||||
<div class='table-header'>
|
<div class='table-header'>
|
||||||
<div class='header-button-lf'>
|
<div class='header-button-lf'>
|
||||||
@@ -43,10 +42,11 @@
|
|||||||
>
|
>
|
||||||
<!-- 默认插槽 -->
|
<!-- 默认插槽 -->
|
||||||
<slot />
|
<slot />
|
||||||
|
|
||||||
<template v-for='item in tableColumns' :key='item'>
|
<template v-for='item in tableColumns' :key='item'>
|
||||||
<!-- selection || radio || index || expand || sort -->
|
<!-- selection || radio || index || expand || sort -->
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-if='item.type && columnTypes.includes(item.type)'
|
v-if='item.type && columnTypes.includes(item.type) && item.isShow'
|
||||||
v-bind='item'
|
v-bind='item'
|
||||||
:align="item.align ?? 'center'"
|
:align="item.align ?? 'center'"
|
||||||
:reserve-selection="item.type == 'selection'"
|
:reserve-selection="item.type == 'selection'"
|
||||||
@@ -126,6 +126,7 @@ export interface ProTableProps {
|
|||||||
requestError?: (params: any) => void; // 表格 api 请求错误监听 ==> 非必传
|
requestError?: (params: any) => void; // 表格 api 请求错误监听 ==> 非必传
|
||||||
dataCallback?: (data: any) => any; // 返回数据的回调函数,可以对数据进行处理 ==> 非必传
|
dataCallback?: (data: any) => any; // 返回数据的回调函数,可以对数据进行处理 ==> 非必传
|
||||||
title?: string; // 表格标题 ==> 非必传
|
title?: string; // 表格标题 ==> 非必传
|
||||||
|
showCard?: boolean; // 下个是否需要卡片
|
||||||
pagination?: boolean; // 是否需要分页组件 ==> 非必传(默认为true)
|
pagination?: boolean; // 是否需要分页组件 ==> 非必传(默认为true)
|
||||||
initParam?: any; // 初始化请求参数 ==> 非必传(默认为{})
|
initParam?: any; // 初始化请求参数 ==> 非必传(默认为{})
|
||||||
border?: boolean; // 是否带有纵向边框 ==> 非必传(默认为true)
|
border?: boolean; // 是否带有纵向边框 ==> 非必传(默认为true)
|
||||||
@@ -141,6 +142,7 @@ const props = withDefaults(defineProps<ProTableProps>(), {
|
|||||||
pagination: true,
|
pagination: true,
|
||||||
initParam: {},
|
initParam: {},
|
||||||
border: true,
|
border: true,
|
||||||
|
showCard: true,
|
||||||
toolButton: true,
|
toolButton: true,
|
||||||
rowKey: 'id',
|
rowKey: 'id',
|
||||||
searchCol: () => ({ xs: 1, sm: 2, md: 2, lg: 3, xl: 4 }),
|
searchCol: () => ({ xs: 1, sm: 2, md: 2, lg: 3, xl: 4 }),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class='icon-box'>
|
<div class='icon-box' >
|
||||||
<el-input
|
<el-input
|
||||||
ref='inputRef'
|
ref='inputRef'
|
||||||
v-model='valueIcon'
|
v-model='valueIcon'
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<el-button :icon='customIcons[iconValue]' />
|
<el-button :icon='customIcons[iconValue]' />
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-dialog v-model='dialogVisible' :title='placeholder' top='50px' width='66%'>
|
<el-dialog v-model='dialogVisible' :title='placeholder' top='5%' width='30%' >
|
||||||
<el-input v-model='inputValue' placeholder='搜索图标' size='large' :prefix-icon='Icons.Search' />
|
<el-input v-model='inputValue' placeholder='搜索图标' size='large' :prefix-icon='Icons.Search' />
|
||||||
<el-scrollbar v-if='Object.keys(iconsList).length'>
|
<el-scrollbar v-if='Object.keys(iconsList).length'>
|
||||||
<div class='icon-list'>
|
<div class='icon-list'>
|
||||||
|
|||||||
@@ -126,6 +126,15 @@ const handleChange = (unit: string) => {
|
|||||||
endDate.value = new Date()
|
endDate.value = new Date()
|
||||||
}
|
}
|
||||||
timeUnit.value = unit
|
timeUnit.value = unit
|
||||||
|
|
||||||
|
// 确保开始时间和结束时间不为空
|
||||||
|
if (!startDate.value) {
|
||||||
|
startDate.value = new Date()
|
||||||
|
}
|
||||||
|
if (!endDate.value) {
|
||||||
|
endDate.value = new Date()
|
||||||
|
}
|
||||||
|
|
||||||
emitDateChange() // 变化时也发出更新事件
|
emitDateChange() // 变化时也发出更新事件
|
||||||
updateNextButtonStatus()
|
updateNextButtonStatus()
|
||||||
}
|
}
|
||||||
@@ -172,7 +181,13 @@ const updateDateRange = () => {
|
|||||||
// endDate.value.setHours(23, 59, 59, 999); // 设置结束时间为今天的23:59:59.999
|
// endDate.value.setHours(23, 59, 59, 999); // 设置结束时间为今天的23:59:59.999
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
// 确保开始时间和结束时间不为空
|
||||||
|
if (!startDate.value) {
|
||||||
|
startDate.value = new Date()
|
||||||
|
}
|
||||||
|
if (!endDate.value) {
|
||||||
|
endDate.value = new Date()
|
||||||
|
}
|
||||||
|
|
||||||
updateNextButtonStatus()
|
updateNextButtonStatus()
|
||||||
}
|
}
|
||||||
@@ -285,7 +300,10 @@ const disableEndDate = (date: Date) => {
|
|||||||
|
|
||||||
|
|
||||||
// 格式化日期yyyy-mm-dd
|
// 格式化日期yyyy-mm-dd
|
||||||
function formatDate(date:Date) {
|
function formatDate(date: Date | null): string {
|
||||||
|
if (!date) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
const day = String(date.getDate()).padStart(2, '0');
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
|
import { ref } from "vue";
|
||||||
const chartsRef = ref();
|
const chartsRef = ref();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
//饼图数据
|
//饼图数据
|
||||||
@@ -21,11 +22,16 @@ const props = defineProps({
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
const customData: any = ref({}),
|
const customData: any = ref({}),
|
||||||
legendData: any = ref({}),
|
legendData: any = ref({}),
|
||||||
chart: any = ref();
|
chart: any = ref();
|
||||||
|
|
||||||
|
const labelIsShow = ref(true)//引导线台数和鼠标点击饼图是否弹出提示显示
|
||||||
const init = () => {
|
const init = () => {
|
||||||
|
|
||||||
|
|
||||||
customData.value = {
|
customData.value = {
|
||||||
title: "", //标题
|
title: "", //标题
|
||||||
textAlign: "left", //标题位置可选属性left 可选属性值 left,right,center
|
textAlign: "left", //标题位置可选属性left 可选属性值 left,right,center
|
||||||
@@ -34,13 +40,16 @@ const init = () => {
|
|||||||
isRadius: false, //是否圆角
|
isRadius: false, //是否圆角
|
||||||
isSpace: false, //是否显示间隔
|
isSpace: false, //是否显示间隔
|
||||||
isLabelLine: true, //是否显示引导线
|
isLabelLine: true, //是否显示引导线
|
||||||
|
titleFontSize: '14px', //标题字体大小
|
||||||
|
|
||||||
...props.customData,
|
...props.customData,
|
||||||
|
|
||||||
};
|
};
|
||||||
legendData.value = {
|
legendData.value = {
|
||||||
icon: "roundRect", // 图例项的icon,类型包括 circle(圆形),rect(正方形),//roundRect(圆角正方形),triangle(三角形),diamond(菱形),//pin(大头针行),arrow(箭头形),none(无图例项的icon)
|
icon: "roundRect", // 图例项的icon,类型包括 circle(圆形),rect(正方形),//roundRect(圆角正方形),triangle(三角形),diamond(菱形),//pin(大头针行),arrow(箭头形),none(无图例项的icon)
|
||||||
orient: "vertical", //图例排列方向
|
orient: "vertical", //图例排列方向
|
||||||
left: "right", //可选属性left,right,top,bottom,可选属性值 left,right,top,bottom,px,百分比,数值,
|
left: "right", //可选属性left,right,top,bottom,可选属性值 left,right,top,bottom,px,百分比,数值,
|
||||||
itemGap: 1, // 设置图例项之间的间隔为20
|
itemGap: 10, // 设置图例项之间的间隔为20
|
||||||
...props.legendData,
|
...props.legendData,
|
||||||
};
|
};
|
||||||
chart.value = chartsRef.value && echarts.init(chartsRef.value);
|
chart.value = chartsRef.value && echarts.init(chartsRef.value);
|
||||||
@@ -48,10 +57,27 @@ const init = () => {
|
|||||||
title: {
|
title: {
|
||||||
text: customData.value.title,
|
text: customData.value.title,
|
||||||
left: customData.value.textAlign,
|
left: customData.value.textAlign,
|
||||||
|
textStyle: {
|
||||||
|
fontSize: customData.value.titleFontSize, // 使用 titleFontSize 属性
|
||||||
|
},
|
||||||
},
|
},
|
||||||
legend: legendData.value,
|
legend:legendData.value,
|
||||||
|
// legend: {
|
||||||
|
// icon: legendData.value.icon, // 图例项的icon,类型包括 circle(圆形),rect(正方形),//roundRect(圆角正方形),triangle(三角形),diamond(菱形),//pin(大头针行),arrow(箭头形),none(无图例项的icon)
|
||||||
|
// orient: "vertical", //图例排列方向
|
||||||
|
// left: legendData.value.left, //可选属性left,right,top,bottom,可选属性值 left,right,top,bottom,px,百分比,数值,
|
||||||
|
// itemGap: 1, // 设置图例项之间的间隔为20
|
||||||
|
// formatter: function (name) {
|
||||||
|
|
||||||
|
// const item = props.chartsData.filter(item=>item.name==name)
|
||||||
|
// console.log(item)
|
||||||
|
// if(item)
|
||||||
|
// return item[0].value;
|
||||||
|
|
||||||
|
// },
|
||||||
|
// },
|
||||||
tooltip: {
|
tooltip: {
|
||||||
show: true,
|
show: labelIsShow.value,
|
||||||
trigger: "item",
|
trigger: "item",
|
||||||
formatter: customData.value.ratio ? `{b} : {c} ({d}%)` : "{b} :{c} ",
|
formatter: customData.value.ratio ? `{b} : {c} ({d}%)` : "{b} :{c} ",
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
@@ -61,7 +87,13 @@ const init = () => {
|
|||||||
type: "pie",
|
type: "pie",
|
||||||
radius: customData.value.isRing ? ["55", "75"] : "80%",
|
radius: customData.value.isRing ? ["55", "75"] : "80%",
|
||||||
data: props.chartsData,
|
data: props.chartsData,
|
||||||
center: ["55%", "50%"], // 设置饼图的中心位置
|
formatter: function (name: any) {
|
||||||
|
const item = props.chartsData.filter(item=>item.name==name)
|
||||||
|
//console.log(item)
|
||||||
|
if(item)
|
||||||
|
return item[0].value;
|
||||||
|
},
|
||||||
|
center: ["55%", "55%"], // 设置饼图的中心位置
|
||||||
// padAngle: 2,
|
// padAngle: 2,
|
||||||
minAngle: 15, //最小角度
|
minAngle: 15, //最小角度
|
||||||
startAngle: 270, //起始角度
|
startAngle: 270, //起始角度
|
||||||
@@ -74,12 +106,15 @@ const init = () => {
|
|||||||
},
|
},
|
||||||
label: {
|
label: {
|
||||||
normal: {
|
normal: {
|
||||||
show: true,
|
show: labelIsShow.value,
|
||||||
position: "inside",
|
position: "outside",
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: "#fff",
|
//color: "#fff",
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
},
|
},
|
||||||
|
formatter: function (data) {
|
||||||
|
return labelIsShow.value ? data.value + '台' : '';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
@@ -93,6 +128,7 @@ const init = () => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
option && chart.value && chart.value.setOption(option);
|
option && chart.value && chart.value.setOption(option);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
chart.value.resize();
|
chart.value.resize();
|
||||||
@@ -108,7 +144,7 @@ const reSize = (widthValue: number,heightValue: number,silentValue: boolean) =>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const resizeCharts = () => {
|
const resizeCharts = () => {
|
||||||
console.log(chart.value,111111);
|
//console.log(chart.value,111111);
|
||||||
|
|
||||||
if (chart.value) {
|
if (chart.value) {
|
||||||
chart.value.resize();
|
chart.value.resize();
|
||||||
@@ -128,6 +164,12 @@ watch(
|
|||||||
() => props.chartsData,
|
() => props.chartsData,
|
||||||
(val, oldVal) => {
|
(val, oldVal) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
|
const item = props.chartsData.find(item => item.value === 0);
|
||||||
|
if(item != undefined){
|
||||||
|
labelIsShow.value = false;
|
||||||
|
}else{
|
||||||
|
labelIsShow.value = true;
|
||||||
|
}
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ const auth: Directive = {
|
|||||||
const { value } = binding
|
const { value } = binding
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? []
|
const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? []
|
||||||
// console.log('1234',authStore.routeName)
|
// console.log('1234',authStore.routeName)
|
||||||
// console.log('123',currentPageRoles)
|
// console.log('123',currentPageRoles)
|
||||||
if (value instanceof Array && value.length) {
|
if (value instanceof Array && value.length) {
|
||||||
|
//console.log('123456',value)
|
||||||
const hasPermission = value.every(item => currentPageRoles.includes(item))
|
const hasPermission = value.every(item => currentPageRoles.includes(item))
|
||||||
if (!hasPermission) el.remove()
|
if (!hasPermission) el.remove()
|
||||||
} else {
|
} else {
|
||||||
|
//console.log('12345',value)
|
||||||
if (!currentPageRoles.includes(value)) el.remove()
|
if (!currentPageRoles.includes(value)) el.remove()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
export enum ResultEnum {
|
export enum ResultEnum {
|
||||||
SUCCESS = "A0000",
|
SUCCESS = "A0000",
|
||||||
ERROR = 500,
|
ERROR = 500,
|
||||||
OVERDUE = "401",
|
ACCESSTOKEN_EXPIRED = 401,
|
||||||
|
OVERDUE = 4001,
|
||||||
TIMEOUT = 30000,
|
TIMEOUT = 30000,
|
||||||
TYPE = "success"
|
TYPE = "success"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,13 @@
|
|||||||
<!-- </el-button> -->
|
<!-- </el-button> -->
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item @click="title = '模拟式模块'"
|
<el-dropdown-item @click="handelOpen('模拟式')"
|
||||||
>模拟式模块</el-dropdown-item
|
>模拟式模块</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item @click="title = '数字式模块'"
|
<el-dropdown-item @click="handelOpen('数字式')"
|
||||||
>数字式模块</el-dropdown-item
|
>数字式模块</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item @click="title = '比对式模块'"
|
<el-dropdown-item @click="handelOpen('比对式')"
|
||||||
>比对式模块</el-dropdown-item
|
>比对式模块</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
@@ -39,13 +39,16 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive, computed, onMounted, watch } from "vue";
|
import { ref, reactive, computed, onMounted, watch } from "vue";
|
||||||
const title = ref("模拟式模块");
|
import { useAuthStore } from "@/stores/modules/auth";
|
||||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
const title = ref("模拟式模块");
|
||||||
|
const router = useRouter();
|
||||||
|
const authStore = useAuthStore();
|
||||||
const modeStore = useModeStore();
|
const modeStore = useModeStore();
|
||||||
watch(() => modeStore.currentMode, (newVal) => {
|
|
||||||
//console.log('当前模式:', newVal);
|
onMounted(() => {
|
||||||
switch (newVal) {
|
switch (modeStore.currentMode) {
|
||||||
case '模拟式':
|
case '模拟式':
|
||||||
title.value = '模拟式模块';
|
title.value = '模拟式模块';
|
||||||
break;
|
break;
|
||||||
@@ -59,6 +62,20 @@ watch(() => modeStore.currentMode, (newVal) => {
|
|||||||
title.value = '模拟式模块';
|
title.value = '模拟式模块';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handelOpen = async (item: string) => {
|
||||||
|
await authStore.setShowMenu();
|
||||||
|
modeStore.setCurrentMode(item); // 将模式code存入 store
|
||||||
|
|
||||||
|
//if (router.currentRoute.value.path === '/home/index') {
|
||||||
|
// 强制刷新页面
|
||||||
|
window.location.reload();
|
||||||
|
//} else {
|
||||||
|
// router.push({ path: '/home/index' });
|
||||||
|
//}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "./index.scss";
|
@import "./index.scss";
|
||||||
|
|||||||
@@ -56,14 +56,14 @@ import Message from "./components/Message.vue";
|
|||||||
import Fullscreen from "./components/Fullscreen.vue";
|
import Fullscreen from "./components/Fullscreen.vue";
|
||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from "@/stores/modules/auth";
|
||||||
import {useDictStore} from "@/stores/modules/dict";
|
import {useDictStore} from "@/stores/modules/dict";
|
||||||
import { useModeStore } from "@/stores/modules/mode";
|
import { useModeStore,useAppSceneStore } from "@/stores/modules/mode";
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const dictStore = useDictStore();
|
const dictStore = useDictStore();
|
||||||
const username = computed(() => userStore.userInfo.name);
|
const username = computed(() => userStore.userInfo.name);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const modeStore = useModeStore();
|
const modeStore = useModeStore();
|
||||||
|
const AppSceneStore = useAppSceneStore();
|
||||||
// 退出登录
|
// 退出登录
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
|
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
|
||||||
@@ -74,10 +74,12 @@ const logout = () => {
|
|||||||
// 1.执行退出登录接口
|
// 1.执行退出登录接口
|
||||||
await logoutApi();
|
await logoutApi();
|
||||||
// 2.清除 Token
|
// 2.清除 Token
|
||||||
userStore.setToken("");
|
userStore.setAccessToken("");
|
||||||
|
userStore.setRefreshToken("");
|
||||||
userStore.setUserInfo({name: ""});
|
userStore.setUserInfo({name: ""});
|
||||||
dictStore.setDictData([]);
|
dictStore.setDictData([]);
|
||||||
modeStore.setCurrentMode('');
|
modeStore.setCurrentMode('');
|
||||||
|
AppSceneStore.setCurrentMode('');
|
||||||
// 3.重定向到登陆页
|
// 3.重定向到登陆页
|
||||||
router.replace(LOGIN_URL);
|
router.replace(LOGIN_URL);
|
||||||
ElMessage.success("退出登录成功!");
|
ElMessage.success("退出登录成功!");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.el-main {
|
.el-main {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 20px;//主体padding
|
padding: 15px;//主体padding
|
||||||
overflow-x: hidden;
|
overflow: hidden;
|
||||||
background-color: var(--el-bg-color-page);
|
background-color: var(--el-bg-color-page);
|
||||||
}
|
}
|
||||||
.el-footer {
|
.el-footer {
|
||||||
|
|||||||
@@ -2,21 +2,16 @@
|
|||||||
<Maximize v-show="maximize" />
|
<Maximize v-show="maximize" />
|
||||||
<Tabs v-if="tabs && showMenuFlag" />
|
<Tabs v-if="tabs && showMenuFlag" />
|
||||||
<el-main>
|
<el-main>
|
||||||
<!-- style="height: calc(100vh - 157px);overflow-y:auto; overflow-x:hidden;" :style='{height:showMenuFlag?"calc(100vh - 157px)":" calc(100vh - 120px)"}' -->
|
|
||||||
<router-view v-slot="{ Component, route }" style="height:100%;">
|
<router-view v-slot="{ Component, route }" style="height:100%;">
|
||||||
<transition appear name="fade-transform" mode="out-in">
|
<!-- {{ keepAliveName}} -->
|
||||||
<keep-alive :include="keepAliveName">
|
<!-- <transition name="slide-right" mode="out-in"> -->
|
||||||
<component
|
<keep-alive :include="tabsMenuList" >
|
||||||
:is="Component"
|
<component :is="Component" :key="route.fullPath" />
|
||||||
v-if="isRouterShow"
|
|
||||||
:key="route.fullPath"
|
|
||||||
/>
|
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</transition>
|
<!-- </transition> -->
|
||||||
</router-view>
|
</router-view>
|
||||||
</el-main>
|
</el-main>
|
||||||
<el-footer >
|
<el-footer>
|
||||||
<!-- v-show="footer" -->
|
|
||||||
<Footer />
|
<Footer />
|
||||||
</el-footer>
|
</el-footer>
|
||||||
</template>
|
</template>
|
||||||
@@ -31,12 +26,15 @@ import Maximize from "./components/Maximize.vue";
|
|||||||
import Tabs from "@/layouts/components/Tabs/index.vue";
|
import Tabs from "@/layouts/components/Tabs/index.vue";
|
||||||
import Footer from "@/layouts/components/Footer/index.vue";
|
import Footer from "@/layouts/components/Footer/index.vue";
|
||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from "@/stores/modules/auth";
|
||||||
|
import { useTabsStore } from '@/stores/modules/tabs'
|
||||||
|
const tabStore = useTabsStore()
|
||||||
const globalStore = useGlobalStore();
|
const globalStore = useGlobalStore();
|
||||||
|
const tabsMenuList = computed(() => tabStore.tabsMenuList.map(item => item.name))
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const { maximize, isCollapse, layout, tabs, footer } = storeToRefs(globalStore);
|
const { maximize, isCollapse, layout, tabs, footer } = storeToRefs(globalStore);
|
||||||
|
|
||||||
const keepAliveStore = useKeepAliveStore();
|
const keepAliveStore = useKeepAliveStore();
|
||||||
const { keepAliveName } = storeToRefs(keepAliveStore);
|
const { keepAliveName } = storeToRefs(keepAliveStore);
|
||||||
|
// console.log("🚀 ~ keepAliveName:", keepAliveName)
|
||||||
//是否显示导航栏
|
//是否显示导航栏
|
||||||
const showMenuFlag = computed(() => authStore.showMenuFlagGet);
|
const showMenuFlag = computed(() => authStore.showMenuFlagGet);
|
||||||
// 注入刷新页面方法
|
// 注入刷新页面方法
|
||||||
@@ -65,6 +63,7 @@ watch(
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// 监听窗口大小变化,折叠侧边栏
|
// 监听窗口大小变化,折叠侧边栏
|
||||||
const screenWidth = ref(0);
|
const screenWidth = ref(0);
|
||||||
const listeningWindow = useDebounceFn(() => {
|
const listeningWindow = useDebounceFn(() => {
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ const initTabs = () => {
|
|||||||
name: item.name,
|
name: item.name,
|
||||||
close: !item.meta.isAffix,
|
close: !item.meta.isAffix,
|
||||||
isKeepAlive: item.meta.isKeepAlive,
|
isKeepAlive: item.meta.isKeepAlive,
|
||||||
|
unshift:true
|
||||||
}
|
}
|
||||||
tabStore.addTabs(tabsParams)
|
tabStore.addTabs(tabsParams)
|
||||||
}
|
}
|
||||||
@@ -100,6 +101,7 @@ const tabsDrop = () => {
|
|||||||
// Tab Click
|
// Tab Click
|
||||||
const tabClick = (tabItem: TabsPaneContext) => {
|
const tabClick = (tabItem: TabsPaneContext) => {
|
||||||
const fullPath = tabItem.props.name as string
|
const fullPath = tabItem.props.name as string
|
||||||
|
// console.log("🚀 ~ tabClick ~ fullPath:", tabItem)
|
||||||
router.push(fullPath)
|
router.push(fullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,14 +46,13 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
// 1.NProgress 开始
|
// 1.NProgress 开始
|
||||||
NProgress.start()
|
NProgress.start()
|
||||||
|
|
||||||
// 2.动态设置标题
|
// 2.动态设置标题
|
||||||
const title = import.meta.env.VITE_GLOB_APP_TITLE
|
const title = import.meta.env.VITE_GLOB_APP_TITLE
|
||||||
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title
|
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title
|
||||||
|
|
||||||
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
|
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
|
||||||
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
|
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
|
||||||
if (userStore.token) return next(from.fullPath)
|
if (userStore.accessToken) return next(from.fullPath)
|
||||||
resetRouter()
|
resetRouter()
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
@@ -62,7 +61,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
if (ROUTER_WHITE_LIST.includes(to.path)) return next()
|
if (ROUTER_WHITE_LIST.includes(to.path)) return next()
|
||||||
|
|
||||||
// 5.判断是否有 Token,没有重定向到 login 页面
|
// 5.判断是否有 Token,没有重定向到 login 页面
|
||||||
if (!userStore.token) return next({ path: LOGIN_URL, replace: true })
|
if (!userStore.accessToken) return next({ path: LOGIN_URL, replace: true })
|
||||||
|
|
||||||
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
|
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
|
||||||
if (!authStore.authMenuListGet.length) {
|
if (!authStore.authMenuListGet.length) {
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ export const initDynamicRouter = async () => {
|
|||||||
type: "warning",
|
type: "warning",
|
||||||
duration: 3000
|
duration: 3000
|
||||||
});
|
});
|
||||||
userStore.setToken("");
|
userStore.setAccessToken("");
|
||||||
|
userStore.setRefreshToken("");
|
||||||
router.replace(LOGIN_URL);
|
router.replace(LOGIN_URL);
|
||||||
return Promise.reject("No permission");
|
return Promise.reject("No permission");
|
||||||
}
|
}
|
||||||
@@ -36,6 +37,7 @@ export const initDynamicRouter = async () => {
|
|||||||
// 3.添加动态路由
|
// 3.添加动态路由
|
||||||
authStore.flatMenuListGet.forEach(item => {
|
authStore.flatMenuListGet.forEach(item => {
|
||||||
item.children && delete item.children;
|
item.children && delete item.children;
|
||||||
|
|
||||||
if (item.component && typeof item.component == "string") {
|
if (item.component && typeof item.component == "string") {
|
||||||
item.component = modules["/src/views" + item.component + ".vue"];
|
item.component = modules["/src/views" + item.component + ".vue"];
|
||||||
}
|
}
|
||||||
@@ -47,7 +49,8 @@ export const initDynamicRouter = async () => {
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 当按钮 || 菜单请求出错时,重定向到登陆页
|
// 当按钮 || 菜单请求出错时,重定向到登陆页
|
||||||
userStore.setToken("");
|
userStore.setAccessToken("");
|
||||||
|
userStore.setRefreshToken("");
|
||||||
router.replace(LOGIN_URL);
|
router.replace(LOGIN_URL);
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export const staticRouter: RouteRecordRaw[] = [
|
|||||||
isHide: false,
|
isHide: false,
|
||||||
isFull: false,
|
isFull: false,
|
||||||
isAffix: false,
|
isAffix: false,
|
||||||
isKeepAlive: false,
|
isKeepAlive: true,//缓存改成true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ export const staticRouter: RouteRecordRaw[] = [
|
|||||||
isHide: false,
|
isHide: false,
|
||||||
isFull: false,
|
isFull: false,
|
||||||
isAffix: false,
|
isAffix: false,
|
||||||
isKeepAlive: false,
|
isKeepAlive: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -82,7 +82,7 @@ export const staticRouter: RouteRecordRaw[] = [
|
|||||||
isHide: false,
|
isHide: false,
|
||||||
isFull: false,
|
isFull: false,
|
||||||
isAffix: false,
|
isAffix: false,
|
||||||
isKeepAlive: false,
|
isKeepAlive: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// 错误页面路由
|
// 错误页面路由
|
||||||
|
|||||||
@@ -17,3 +17,5 @@ export const USER_STORE_KEY = "cn-user";
|
|||||||
// pinia中dict store的key
|
// pinia中dict store的key
|
||||||
export const DICT_STORE_KEY = "cn-dictData";
|
export const DICT_STORE_KEY = "cn-dictData";
|
||||||
|
|
||||||
|
export const CHECK_STORE_KEY = "cn-check";
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export interface TabsMenuProps {
|
|||||||
name: string;
|
name: string;
|
||||||
close: boolean;
|
close: boolean;
|
||||||
isKeepAlive: boolean;
|
isKeepAlive: boolean;
|
||||||
|
unshift?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TabsState */
|
/* TabsState */
|
||||||
|
|||||||
44
frontend/src/stores/modules/check.ts
Normal file
44
frontend/src/stores/modules/check.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import {defineStore} from "pinia";
|
||||||
|
import {CHECK_STORE_KEY} from "@/stores/constant";
|
||||||
|
import type {CheckData} from "@/api/check/interface";
|
||||||
|
|
||||||
|
|
||||||
|
export const useCheckStore = defineStore("check", {
|
||||||
|
id: CHECK_STORE_KEY,
|
||||||
|
|
||||||
|
state: () => ({
|
||||||
|
devices: Array<CheckData.Device>(),
|
||||||
|
planId: String(""),
|
||||||
|
planCode: String(""),
|
||||||
|
scriptId: String(""),
|
||||||
|
errorSysId: String(""),
|
||||||
|
}),
|
||||||
|
|
||||||
|
getters: {},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
addDevices(device: CheckData.Device[]) {
|
||||||
|
this.devices.push(...device);
|
||||||
|
},
|
||||||
|
|
||||||
|
clearDevices() {
|
||||||
|
this.devices = [];
|
||||||
|
},
|
||||||
|
|
||||||
|
setPlanId(planId: string) {
|
||||||
|
this.planId = planId
|
||||||
|
},
|
||||||
|
|
||||||
|
setPlanCode(planCode: string) {
|
||||||
|
this.planCode = planCode
|
||||||
|
},
|
||||||
|
|
||||||
|
setScriptId(scriptId: string) {
|
||||||
|
this.scriptId = scriptId
|
||||||
|
},
|
||||||
|
|
||||||
|
setErrorSysId(errorSysId: string) {
|
||||||
|
this.errorSysId = errorSysId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -23,4 +23,17 @@ export const useModeStore = defineStore('mode', {
|
|||||||
localStorage.setItem('currentMode', modeName); // 保存到 localStorage
|
localStorage.setItem('currentMode', modeName); // 保存到 localStorage
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const useAppSceneStore = defineStore('scene', {
|
||||||
|
state: () => ({
|
||||||
|
currentScene: localStorage.getItem('currentScene') || '' as string,
|
||||||
|
}),
|
||||||
|
actions: {
|
||||||
|
setCurrentMode(sceneName: string) {
|
||||||
|
this.currentScene = sceneName;
|
||||||
|
localStorage.setItem('currentScene', sceneName); // 保存到 localStorage
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,14 @@ export const useTabsStore = defineStore({
|
|||||||
actions: {
|
actions: {
|
||||||
// Add Tabs
|
// Add Tabs
|
||||||
async addTabs(tabItem: TabsMenuProps) {
|
async addTabs(tabItem: TabsMenuProps) {
|
||||||
|
|
||||||
if (this.tabsMenuList.every(item => item.path !== tabItem.path)) {
|
if (this.tabsMenuList.every(item => item.path !== tabItem.path)) {
|
||||||
this.tabsMenuList.push(tabItem);
|
if (tabItem?.unshift) {
|
||||||
|
this.tabsMenuList.unshift(tabItem);
|
||||||
|
}else{
|
||||||
|
this.tabsMenuList.push(tabItem);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!keepAliveStore.keepAliveName.includes(tabItem.name) && tabItem.isKeepAlive) {
|
if (!keepAliveStore.keepAliveName.includes(tabItem.name) && tabItem.isKeepAlive) {
|
||||||
keepAliveStore.addKeepAliveName(tabItem.name);
|
keepAliveStore.addKeepAliveName(tabItem.name);
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
import { defineStore } from "pinia";
|
import {defineStore} from "pinia";
|
||||||
import { UserState } from "@/stores/interface";
|
import {UserState} from "@/stores/interface";
|
||||||
import piniaPersistConfig from "@/stores/helper/persist";
|
import piniaPersistConfig from "@/stores/helper/persist";
|
||||||
import { USER_STORE_KEY } from "@/stores/constant";
|
import {USER_STORE_KEY} from "@/stores/constant";
|
||||||
|
|
||||||
export const useUserStore = defineStore({
|
export const useUserStore = defineStore({
|
||||||
id: USER_STORE_KEY,
|
id: USER_STORE_KEY,
|
||||||
state: (): UserState => ({
|
state: (): UserState => ({
|
||||||
token: "",
|
accessToken: "",
|
||||||
|
refreshToken: "",
|
||||||
userInfo: { name: "admin" },
|
userInfo: { name: "admin" },
|
||||||
}),
|
}),
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
// Set Token
|
// Set Token
|
||||||
setToken(token: string) {
|
setAccessToken(accessToken: string) {
|
||||||
this.token = token;
|
this.accessToken = accessToken;
|
||||||
|
},
|
||||||
|
setRefreshToken(refreshToken: string) {
|
||||||
|
this.refreshToken = refreshToken;
|
||||||
},
|
},
|
||||||
// Set setUserInfo
|
// Set setUserInfo
|
||||||
setUserInfo(userInfo: UserState["userInfo"]) {
|
setUserInfo(userInfo: UserState["userInfo"]) {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
/* flex */
|
/* flex */
|
||||||
.flx-center {
|
.flx-center {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -77,8 +79,8 @@
|
|||||||
|
|
||||||
/* scroll bar */
|
/* scroll bar */
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
width: 6px;
|
width: 8px;
|
||||||
height: 200px;
|
height: 8px;
|
||||||
// background-color: var(--el-color-primary);
|
// background-color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
/* 滚动条实际可拖动部分的颜色 */
|
/* 滚动条实际可拖动部分的颜色 */
|
||||||
|
|||||||
@@ -143,13 +143,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-table__body {
|
||||||
|
// border-left: 1px solid var(--el-table-border-color)
|
||||||
|
}
|
||||||
|
|
||||||
// el-table 表格样式
|
// el-table 表格样式
|
||||||
.el-table {
|
.el-table {
|
||||||
|
// border: 1px solid var(--el-table-border-color);
|
||||||
// flex: 1;
|
// flex: 1;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
border-left: 1px solid var(--el-table-border-color) // 修复 safari 浏览器表格错位 https://github.com/HalseySpicy/Geeker-Admin/issues/83
|
||||||
// 修复 safari 浏览器表格错位 https://github.com/HalseySpicy/Geeker-Admin/issues/83
|
|
||||||
table {
|
table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@@ -398,7 +402,7 @@
|
|||||||
|
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
width: 8px !important;
|
width: 8px !important;
|
||||||
height: 200px !important;
|
height: 8px !important;
|
||||||
// background-color: var(--el-color-primary);
|
// background-color: var(--el-color-primary);
|
||||||
z-index: 3001;
|
z-index: 3001;
|
||||||
}
|
}
|
||||||
@@ -441,7 +445,7 @@
|
|||||||
|
|
||||||
.dialog-small {
|
.dialog-small {
|
||||||
.el-dialog__body {
|
.el-dialog__body {
|
||||||
max-height: 260px;
|
max-height: 340px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,6 +461,81 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.cn-render-buttons {
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 13px;
|
||||||
|
line-height: 18px;
|
||||||
|
padding: 2px;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
font-size: 12px !important;
|
||||||
|
// color: var(--ba-bg-color-overlay) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-message-box {
|
||||||
|
padding: 0px !important;
|
||||||
|
|
||||||
|
.el-message-box__header {
|
||||||
|
background-color: var(--el-color-primary);
|
||||||
|
|
||||||
|
.el-message-box__title {
|
||||||
|
color: #fff;
|
||||||
|
padding: 10px 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-message-box__headerbtn {
|
||||||
|
top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-message-box__close {
|
||||||
|
svg {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
:hover {
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-message-box__content {
|
||||||
|
padding: 10px;
|
||||||
|
border-bottom: 1px solid #cccccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-message-box__btns {
|
||||||
|
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-one {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.el-form-item {
|
||||||
|
display: flex;
|
||||||
|
width: 98%;
|
||||||
|
margin-bottom: 15px !important;
|
||||||
|
|
||||||
|
.el-form-item__content {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.el-select,
|
||||||
|
.el-cascader,
|
||||||
|
.el-input__inner,
|
||||||
|
.el-date-editor {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.form-two {
|
.form-two {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -479,14 +558,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cn-render-buttons {
|
.form-three {
|
||||||
cursor: pointer;
|
display: flex;
|
||||||
display: inline-block;
|
flex-wrap: wrap;
|
||||||
margin-left: 13px;
|
// justify-content: space-between;
|
||||||
line-height: 18px;
|
.el-form-item {
|
||||||
padding: 2px;
|
display: flex;
|
||||||
.icon {
|
width: 32.3%;
|
||||||
font-size: 12px !important;
|
|
||||||
// color: var(--ba-bg-color-overlay) !important;
|
.el-form-item__content {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.el-select,
|
||||||
|
.el-cascader,
|
||||||
|
.el-input__inner,
|
||||||
|
.el-date-editor {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-table__cell {
|
||||||
|
border-right: 1px solid #ebeef5 !important;
|
||||||
|
border-left: 1px solid #ebeef5 !important;
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,24 +4,24 @@ import { ElNotification } from "element-plus";
|
|||||||
* @description 全局代码错误捕捉
|
* @description 全局代码错误捕捉
|
||||||
* */
|
* */
|
||||||
const errorHandler = (error: any) => {
|
const errorHandler = (error: any) => {
|
||||||
// 过滤 HTTP 请求错误
|
// // 过滤 HTTP 请求错误
|
||||||
if (error.status || error.status == 0) return false;
|
// if (error.status || error.status == 0) return false;
|
||||||
let errorMap: { [key: string]: string } = {
|
// let errorMap: { [key: string]: string } = {
|
||||||
InternalError: "Javascript引擎内部错误",
|
// InternalError: "Javascript引擎内部错误",
|
||||||
ReferenceError: "未找到对象",
|
// ReferenceError: "未找到对象",
|
||||||
TypeError: "使用了错误的类型或对象",
|
// TypeError: "使用了错误的类型或对象",
|
||||||
RangeError: "使用内置对象时,参数超范围",
|
// RangeError: "使用内置对象时,参数超范围",
|
||||||
SyntaxError: "语法错误",
|
// SyntaxError: "语法错误",
|
||||||
EvalError: "错误的使用了Eval",
|
// EvalError: "错误的使用了Eval",
|
||||||
URIError: "URI错误"
|
// URIError: "URI错误"
|
||||||
};
|
// };
|
||||||
let errorName = errorMap[error.name] || "未知错误";
|
// let errorName = errorMap[error.name] || "未知错误";
|
||||||
ElNotification({
|
// ElNotification({
|
||||||
title: errorName,
|
// title: errorName,
|
||||||
message: error,
|
// message: error,
|
||||||
type: "error",
|
// type: "error",
|
||||||
duration: 3000
|
// duration: 3000
|
||||||
});
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
export default errorHandler;
|
export default errorHandler;
|
||||||
|
|||||||
175
frontend/src/utils/webSocketClient.ts
Normal file
175
frontend/src/utils/webSocketClient.ts
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
import {ElMessage} from "element-plus";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default class SocketService {
|
||||||
|
static instance = null;
|
||||||
|
static get Instance() {
|
||||||
|
if (!this.instance) {
|
||||||
|
this.instance = new SocketService();
|
||||||
|
}
|
||||||
|
return this.instance;
|
||||||
|
}
|
||||||
|
// 和服务端连接的socket对象
|
||||||
|
ws = null;
|
||||||
|
// 存储回调函数
|
||||||
|
callBackMapping = {};
|
||||||
|
// 标识是否连接成功
|
||||||
|
connected = false;
|
||||||
|
// 记录重试的次数
|
||||||
|
sendRetryCount = 0;
|
||||||
|
// 重新连接尝试的次数
|
||||||
|
connectRetryCount = 0;
|
||||||
|
work:any;
|
||||||
|
heartbeatTimer;
|
||||||
|
heartbeatInterval = 6000; // 心跳间隔,单位毫秒
|
||||||
|
lastActivityTime= 0; // 上次活动时间戳
|
||||||
|
reconnectDelay= 5000; // 重新连接延迟,单位毫秒
|
||||||
|
|
||||||
|
// 定义连接服务器的方法
|
||||||
|
connect() {
|
||||||
|
|
||||||
|
// 连接服务器
|
||||||
|
if (!window.WebSocket) {
|
||||||
|
return console.log('您的浏览器不支持WebSocket');
|
||||||
|
}
|
||||||
|
|
||||||
|
// let token = $.cookie('123');
|
||||||
|
// let token = '4E6EF539AAF119D82AC4C2BC84FBA21F';
|
||||||
|
|
||||||
|
|
||||||
|
const url = 'ws://localhost:7777/hello?name=cdf'
|
||||||
|
this.ws = new WebSocket(url);
|
||||||
|
// 连接成功的事件
|
||||||
|
this.ws.onopen = () => {
|
||||||
|
ElMessage.success("webSocket连接服务端成功了");
|
||||||
|
console.log('连接服务端成功了');
|
||||||
|
this.connected = true;
|
||||||
|
// 重置重新连接的次数
|
||||||
|
this.connectRetryCount = 0;
|
||||||
|
this.updateLastActivityTime();
|
||||||
|
this.startHeartbeat();
|
||||||
|
};
|
||||||
|
// 1.连接服务端失败
|
||||||
|
// 2.当连接成功之后, 服务器关闭的情况
|
||||||
|
this.ws.onclose = () => {
|
||||||
|
console.log('连接服务端失败');
|
||||||
|
this.connected = false;
|
||||||
|
this.connectRetryCount++;
|
||||||
|
this.clearHeartbeat();
|
||||||
|
setTimeout(() => {
|
||||||
|
// this.connect();
|
||||||
|
}, 500 * this.connectRetryCount);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
this.ws.onerror = () => {
|
||||||
|
ElMessage.error("webSocket连接异常!");
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// 得到服务端发送过来的数据
|
||||||
|
this.ws.onmessage = (event) => {
|
||||||
|
let message: { [key: string]: any };
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log('Received message:',event.data)
|
||||||
|
message = JSON.parse(event.data);
|
||||||
|
} catch (e) {
|
||||||
|
return console.error("消息解析失败", event.data, e);
|
||||||
|
}
|
||||||
|
//console.log(message, "从服务端获取到了数据");
|
||||||
|
/* 通过接受服务端发送的type字段来回调函数 */
|
||||||
|
if (message?.type && this.callBackMapping[message.type]) {
|
||||||
|
this.callBackMapping[message.type](message);
|
||||||
|
} else {
|
||||||
|
console.log("抛弃====>")
|
||||||
|
console.log(event.data)
|
||||||
|
/* 丢弃或继续写你的逻辑 */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
startHeartbeat() {
|
||||||
|
let _this = this
|
||||||
|
var url = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},3000)})()']));
|
||||||
|
this.work = new Worker(url)
|
||||||
|
this.work.onmessage = function(e){
|
||||||
|
if ((Date.now() - _this.lastActivityTime) > _this.heartbeatInterval) {
|
||||||
|
// 如果超过心跳间隔没有活动,发送心跳消息
|
||||||
|
_this.sendHeartbeat();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// this.heartbeatTimer = setInterval(() => {
|
||||||
|
// if ((Date.now() - this.lastActivityTime) > this.heartbeatInterval) {
|
||||||
|
// // 如果超过心跳间隔没有活动,发送心跳消息
|
||||||
|
// this.sendHeartbeat();
|
||||||
|
// }
|
||||||
|
// }, this.heartbeatInterval/2); // 每半个心跳间隔检查一次
|
||||||
|
}
|
||||||
|
sendHeartbeat() {
|
||||||
|
console.log("进入心跳消息发送。。。。。。。。。。。。。")
|
||||||
|
this.ws.send('alive');
|
||||||
|
this.updateLastActivityTime(); // 发送心跳后更新活动时间
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updateLastActivityTime() {
|
||||||
|
this.lastActivityTime = Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
clearHeartbeat() {
|
||||||
|
this.work.terminate();
|
||||||
|
if (this.heartbeatTimer) {
|
||||||
|
|
||||||
|
clearInterval(this.heartbeatTimer);
|
||||||
|
this.heartbeatTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 回调函数的注册
|
||||||
|
registerCallBack(socketType, callBack) {
|
||||||
|
this.callBackMapping[socketType] = callBack;
|
||||||
|
}
|
||||||
|
// 取消某一个回调函数
|
||||||
|
unRegisterCallBack(socketType) {
|
||||||
|
this.callBackMapping[socketType] = null;
|
||||||
|
}
|
||||||
|
// 发送数据的方法
|
||||||
|
send(data) {
|
||||||
|
// 判断此时此刻有没有连接成功
|
||||||
|
if (this.connected) {
|
||||||
|
this.sendRetryCount = 0;
|
||||||
|
try {
|
||||||
|
this.ws.send(JSON.stringify(data));
|
||||||
|
} catch (e) {
|
||||||
|
this.ws.send(data);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.sendRetryCount++;
|
||||||
|
setTimeout(() => {
|
||||||
|
this.send(data);
|
||||||
|
}, this.sendRetryCount * 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 断开方法
|
||||||
|
closeWs() {
|
||||||
|
if (this.connected) {
|
||||||
|
this.ws.close()
|
||||||
|
}
|
||||||
|
console.log('WS关闭中..');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" :model-value="dialogVisible" @close="close" v-bind="dialogMiddle">
|
<el-dialog :title="dialogTitle" :model-value="dialogVisible" @close="close" v-bind="dialogMiddle">
|
||||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' >
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
||||||
<el-form-item label="上级菜单" prop="pid" :label-width="100">
|
<el-form-item label="上级菜单" prop="pid" :label-width="100">
|
||||||
<el-tree-select
|
<el-tree-select
|
||||||
v-model="displayPid"
|
v-model="displayPid"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<el-form-item label="编码" prop="code" :label-width="100">
|
<el-form-item label="编码" prop="code" :label-width="100">
|
||||||
<el-input v-model="formContent.code" />
|
<el-input v-model="formContent.code" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="图标" prop="icon" :label-width="100">
|
<el-form-item v-if="!formContent.type" label="图标" prop="icon" :label-width="100">
|
||||||
<IconSelect
|
<IconSelect
|
||||||
v-model="formContent.icon"
|
v-model="formContent.icon"
|
||||||
:iconValue="formContent.icon"
|
:iconValue="formContent.icon"
|
||||||
@@ -27,10 +27,10 @@
|
|||||||
placeholder="选择一个图标"
|
placeholder="选择一个图标"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="路由地址" prop="path" :label-width="100">
|
<el-form-item v-if="!formContent.type" label="路由地址" prop="path" :label-width="100">
|
||||||
<el-input v-model="formContent.path" />
|
<el-input v-model="formContent.path" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="组件地址" prop="component" :label-width="100">
|
<el-form-item v-if="!formContent.type" label="组件地址" prop="component" :label-width="100">
|
||||||
<el-input v-model="formContent.component" />
|
<el-input v-model="formContent.component" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序" prop="sort" :label-width="100">
|
<el-form-item label="排序" prop="sort" :label-width="100">
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
import ResourcePopup from './components/resourcePopup.vue'
|
import ResourcePopup from './components/resourcePopup.vue'
|
||||||
import {deleteFunction,getFunctionList} from '@/api/user/function/index'
|
import {deleteFunction,getFunctionList} from '@/api/user/function/index'
|
||||||
import * as Icons from '@element-plus/icons-vue'
|
import * as Icons from '@element-plus/icons-vue'
|
||||||
|
defineOptions({
|
||||||
|
name: 'resource'
|
||||||
|
})
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const resourcePopup = ref()
|
const resourcePopup = ref()
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
|
|||||||
@@ -146,7 +146,6 @@ const open = async (sign: string, data: Role.RoleBO, AllFunction: Function.ResFu
|
|||||||
const allIds = getAllIds(AllFunction);
|
const allIds = getAllIds(AllFunction);
|
||||||
// 匹配 roleFunctions 中的 id 并设置 checkedKeys
|
// 匹配 roleFunctions 中的 id 并设置 checkedKeys
|
||||||
const checkedKeys = allIds.filter(id => roleFunctions.some(roleFunc => roleFunc.id === id));
|
const checkedKeys = allIds.filter(id => roleFunctions.some(roleFunc => roleFunc.id === id));
|
||||||
|
|
||||||
// 过滤出叶子节点
|
// 过滤出叶子节点
|
||||||
const leafCheckedKeys = filterLeafNodes(AllFunction, checkedKeys);
|
const leafCheckedKeys = filterLeafNodes(AllFunction, checkedKeys);
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button v-auth.role="'add'" type='primary' :icon='CirclePlus' @click="openDrawer('新增角色')">新增</el-button>
|
<el-button v-auth.role="'add'" type='primary' :icon='CirclePlus' @click="openDrawer('新增角色')">新增</el-button>
|
||||||
<el-button v-auth.role="'batchDelete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
<el-button v-auth.role="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
批量删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
@@ -39,6 +39,9 @@ import RolePopup from './components/rolePopup.vue'
|
|||||||
import RoleResourcePopup from './components/roleResourcePopup.vue'
|
import RoleResourcePopup from './components/roleResourcePopup.vue'
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { onMounted, reactive, ref } from 'vue'
|
||||||
import {useDictStore} from '@/stores/modules/dict'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
|
defineOptions({
|
||||||
|
name: 'role'
|
||||||
|
})
|
||||||
const rolePopup = ref()
|
const rolePopup = ref()
|
||||||
const roleResourcePopup = ref()
|
const roleResourcePopup = ref()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
@@ -91,6 +94,22 @@ const columns = reactive<ColumnProps<Role.RoleBO>[]>([
|
|||||||
search: { el: 'input' },
|
search: { el: 'input' },
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'type',
|
||||||
|
label: '类型',
|
||||||
|
minWidth: 200,
|
||||||
|
render: (scope) => {
|
||||||
|
const typeMap: { [key: number]: { label: string; type: string } } = {
|
||||||
|
0: { label: '超级管理员', type: 'primary' },
|
||||||
|
1: { label: '管理员角色', type: 'success' },
|
||||||
|
2: { label: '普通角色', type: 'info' },
|
||||||
|
};
|
||||||
|
const typeInfo = typeMap[scope.row.type] || { label: '未知', type: 'danger' };
|
||||||
|
return (
|
||||||
|
<el-tag type={typeInfo.type}>{typeInfo.label}</el-tag>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'remark',
|
prop: 'remark',
|
||||||
label: '描述',
|
label: '描述',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close">
|
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close" >
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent"
|
<el-form :model="formContent"
|
||||||
ref='dialogFormRef'
|
ref='dialogFormRef'
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button v-auth.user="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
<el-button v-auth.user="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
<el-button v-auth.user="'batchDelete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
<el-button v-auth.user="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
批量删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
@@ -43,6 +43,9 @@
|
|||||||
import {getUserList, deleteUser,getRoleList} from '@/api/user/user'
|
import {getUserList, deleteUser,getRoleList} from '@/api/user/user'
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { onMounted, reactive, ref } from 'vue'
|
||||||
import { type Role } from '@/api/user/interface/role'
|
import { type Role } from '@/api/user/interface/role'
|
||||||
|
defineOptions({
|
||||||
|
name: 'user'
|
||||||
|
})
|
||||||
const roleList = ref<Role.RoleBO[]>([])
|
const roleList = ref<Role.RoleBO[]>([])
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const userPopup = ref()
|
const userPopup = ref()
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
<!--双列-->
|
|
||||||
<template>
|
|
||||||
<el-dialog v-model='dialogVisible' :title='title' v-bind='dialogMiddle' >
|
|
||||||
<el-scrollbar>
|
|
||||||
<el-form :inline="false" label-width="auto" ref="formRef" class='form-two'>
|
|
||||||
<el-form-item label="姓名" prop="username" >
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="性别" prop="gender">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="年龄" prop="age">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="身份证号" prop="id">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="邮箱" prop="email">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="居住地址" prop="address">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="手机" prop="phone">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="来源" prop="source">
|
|
||||||
<el-input
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
</el-scrollbar>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<div class='dialog-footer'>
|
|
||||||
<el-button @click='close()'>取消</el-button>
|
|
||||||
<el-button type='primary' @click='confirmForm()'>确定</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
<script setup lang='ts'>
|
|
||||||
import { dialogMiddle } from '@/utils/elementBind'
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const title = ref('单列弹出框')
|
|
||||||
const open = (textTitle: string) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
title.value = textTitle
|
|
||||||
}
|
|
||||||
|
|
||||||
const close = () => {
|
|
||||||
dialogVisible.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
const confirmForm = () => {
|
|
||||||
ElMessage.info('业务数据提交')
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({ open })
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,210 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class='table-box' ref='popupBaseView'>
|
|
||||||
<ProTable
|
|
||||||
ref='proTable'
|
|
||||||
:columns='columns'
|
|
||||||
:data='userData'
|
|
||||||
>
|
|
||||||
<!-- 表格 header 按钮 -->
|
|
||||||
<template #tableHeader='scope'>
|
|
||||||
<el-button type='primary' :icon='CirclePlus' @click="openDrawer('新增')">新增用户</el-button>
|
|
||||||
<el-button type='primary' :icon='Upload' plain @click='batchAdd'>批量添加用户</el-button>
|
|
||||||
<el-button type='primary' :icon='Download' plain @click='downloadFile'>导出用户数据</el-button>
|
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
|
||||||
批量删除用户
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
<!-- 表格操作 -->
|
|
||||||
<template #operation='scope'>
|
|
||||||
<el-button type='primary' link :icon='View'
|
|
||||||
@click="openDrawer('查看', scope.row)">查看
|
|
||||||
</el-button>
|
|
||||||
<el-button type='primary' link :icon='EditPen' @click="openDrawer('编辑', scope.row)">编辑</el-button>
|
|
||||||
<el-button type='primary' link :icon='Refresh' @click='resetPass(scope.row)'>重置密码</el-button>
|
|
||||||
<el-button type='primary' link :icon='CirclePlus' @click='deleteAccount()'>下钻</el-button>
|
|
||||||
</template>
|
|
||||||
</ProTable>
|
|
||||||
</div>
|
|
||||||
<single-column ref='singleColumn' />
|
|
||||||
<double-column ref='doubleColumn' />
|
|
||||||
<open :width='viewWidth' :height='viewHeight' ref='openView' />
|
|
||||||
</template>
|
|
||||||
<script setup lang='tsx' name='useProTable'>
|
|
||||||
import { ref, reactive } from 'vue'
|
|
||||||
import { User } from '@/api/user/interface'
|
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
|
||||||
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
|
||||||
import ImportExcel from '@/components/ImportExcel/index.vue'
|
|
||||||
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
|
||||||
import { CirclePlus, Delete, EditPen, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
|
|
||||||
import userDataList from '@/api/user/userData'
|
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
import SingleColumn from '@/views/demo/proTable/singleColumn.vue'
|
|
||||||
import Open from '@/views/demo/proTable/Open.vue'
|
|
||||||
import DoubleColumn from '@/views/demo/proTable/doubleColumn.vue'
|
|
||||||
import { useViewSize } from '@/hooks/useViewSize'
|
|
||||||
|
|
||||||
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
|
||||||
import {
|
|
||||||
getUserList,
|
|
||||||
deleteUser,
|
|
||||||
changeUserStatus,
|
|
||||||
exportUserInfo,
|
|
||||||
BatchAddUser,
|
|
||||||
} from '@/api/user/user'
|
|
||||||
import { ElMessageBox } from 'element-plus'
|
|
||||||
|
|
||||||
const userData = userDataList
|
|
||||||
const singleColumn = ref()
|
|
||||||
const doubleColumn = ref()
|
|
||||||
const openView = ref()
|
|
||||||
// ProTable 实例
|
|
||||||
const proTable = ref<ProTableInstance>()
|
|
||||||
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
|
||||||
const initParam = reactive({ type: 1 })
|
|
||||||
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
|
|
||||||
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
|
||||||
const dataCallback = (data: any) => {
|
|
||||||
return {
|
|
||||||
list: data.list,
|
|
||||||
total: data.total,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
|
|
||||||
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
|
|
||||||
const getTableList = (params: any) => {
|
|
||||||
let newParams = JSON.parse(JSON.stringify(params))
|
|
||||||
newParams.createTime && (newParams.startTime = newParams.createTime[0])
|
|
||||||
newParams.createTime && (newParams.endTime = newParams.createTime[1])
|
|
||||||
delete newParams.createTime
|
|
||||||
return getUserList(newParams)
|
|
||||||
}
|
|
||||||
// 页面按钮权限(按钮权限既可以使用 hooks,也可以直接使用 v-auth 指令,指令适合直接绑定在按钮上,hooks 适合根据按钮权限显示不同的内容)
|
|
||||||
const { BUTTONS } = useAuthButtons()
|
|
||||||
// 表格配置项
|
|
||||||
const columns = reactive<ColumnProps<User.ResUserList>[]>([
|
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
|
||||||
{
|
|
||||||
prop: 'username',
|
|
||||||
label: '姓名',
|
|
||||||
width: 120,
|
|
||||||
search: { el: 'input' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'gender',
|
|
||||||
label: '性别',
|
|
||||||
// 字典数据(本地数据)
|
|
||||||
enum: dictStore.getDictData('sex'),
|
|
||||||
search: { el: 'select', props: { filterable: true } },
|
|
||||||
fieldNames: { label: 'label', value: 'code' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'age',
|
|
||||||
label: '年龄',
|
|
||||||
search: {
|
|
||||||
// 自定义 search 显示内容
|
|
||||||
render: ({ searchParam }) => {
|
|
||||||
return (
|
|
||||||
<div class='flx-center'>
|
|
||||||
<el-input vModel_trim={searchParam.minAge} placeholder='最小年龄' />
|
|
||||||
<span class='mr10 ml10'>-</span>
|
|
||||||
<el-input vModel_trim={searchParam.maxAge} placeholder='最大年龄' />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ prop: 'idCard', label: '身份证号' },
|
|
||||||
{ prop: 'email', label: '邮箱' },
|
|
||||||
{ prop: 'address', label: '居住地址', width: 120 },
|
|
||||||
{
|
|
||||||
prop: 'status',
|
|
||||||
label: '状态',
|
|
||||||
enum: dictStore.getDictData('status'),
|
|
||||||
search: { el: 'tree-select', props: { filterable: true } },
|
|
||||||
fieldNames: { label: 'userLabel', value: 'userStatus' },
|
|
||||||
render: scope => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{BUTTONS.value.status ? (
|
|
||||||
<el-switch
|
|
||||||
model-value={scope.row.status}
|
|
||||||
active-text={scope.row.status ? '启用' : '禁用'}
|
|
||||||
active-value={1}
|
|
||||||
inactive-value={0}
|
|
||||||
onClick={() => changeStatus(scope.row)}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<el-tag type={scope.row.status ? 'success' : 'danger'}>{scope.row.status ? '启用' : '禁用'}</el-tag>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
width: 180,
|
|
||||||
search: {
|
|
||||||
el: 'date-picker',
|
|
||||||
span: 1,
|
|
||||||
props: { type: 'daterange', valueFormat: 'YYYY-MM-DD' },
|
|
||||||
defaultValue: ['2024-11-12', '2024-12-12'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
// 下钻
|
|
||||||
const deleteAccount = async () => {
|
|
||||||
openView.value.open('测试弹出框')
|
|
||||||
}
|
|
||||||
// 批量删除用户信息
|
|
||||||
const batchDelete = async (id: string[]) => {
|
|
||||||
await useHandleData(deleteUser, { id }, '删除所选用户信息')
|
|
||||||
proTable.value?.clearSelection()
|
|
||||||
proTable.value?.getTableList()
|
|
||||||
}
|
|
||||||
// 重置用户密码
|
|
||||||
const resetPass = async (params: User.ResUserList) => {
|
|
||||||
// await useHandleData(resetUserPassWord, { id: params.id }, `重置【${params.username}】用户密码`)
|
|
||||||
// proTable.value?.getTableList()
|
|
||||||
doubleColumn.value.open('双列弹出框')
|
|
||||||
}
|
|
||||||
// 切换用户状态
|
|
||||||
const changeStatus = async (row: User.ResUserList) => {
|
|
||||||
await useHandleData(changeUserStatus, {
|
|
||||||
id: row.id,
|
|
||||||
status: row.status == 1 ? 0 : 1,
|
|
||||||
}, `切换【${row.username}】用户状态`)
|
|
||||||
proTable.value?.getTableList()
|
|
||||||
}
|
|
||||||
// 导出用户列表
|
|
||||||
const downloadFile = async () => {
|
|
||||||
ElMessageBox.confirm('确认导出用户数据?', '温馨提示', { type: 'warning' }).then(() =>
|
|
||||||
useDownload(exportUserInfo, '用户列表', proTable.value?.searchParam),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// 批量添加用户
|
|
||||||
const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
|
|
||||||
const batchAdd = () => {
|
|
||||||
const params = {
|
|
||||||
title: '用户',
|
|
||||||
tempApi: exportUserInfo,
|
|
||||||
importApi: BatchAddUser,
|
|
||||||
getTableList: proTable.value?.getTableList,
|
|
||||||
}
|
|
||||||
dialogRef.value?.acceptParams(params)
|
|
||||||
}
|
|
||||||
// 打开 drawer(新增、查看、编辑)
|
|
||||||
const openDrawer = (title: string, row: Partial<User.ResUserList> = {}) => {
|
|
||||||
singleColumn.value.open('单列弹出框')
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
<!--单列-->
|
|
||||||
<template>
|
|
||||||
<el-dialog class='table-box'
|
|
||||||
v-model='dialogVisible'
|
|
||||||
top='114px'
|
|
||||||
:style="{height:height+'px',maxHeight:height+'px',overflow:'hidden'}"
|
|
||||||
:title='title'
|
|
||||||
:width='width'
|
|
||||||
:modal='false'>
|
|
||||||
<div class='table-box' :style="{height:(height-64)+'px',maxHeight:(height-64)+'px',overflow:'hidden'}">
|
|
||||||
<ProTable
|
|
||||||
ref='proTable'
|
|
||||||
:columns='columns'
|
|
||||||
:data='userData'
|
|
||||||
>
|
|
||||||
<!-- 表格 header 按钮 -->
|
|
||||||
<template #tableHeader='scope'>
|
|
||||||
<el-button type='primary' :icon='CirclePlus' @click="openDrawer('新增')">新增用户</el-button>
|
|
||||||
</template>
|
|
||||||
<!-- 表格操作 -->
|
|
||||||
<template #operation='scope'>
|
|
||||||
<el-button type='primary' link :icon='View'
|
|
||||||
@click="openDrawer('查看', scope.row)">查看
|
|
||||||
</el-button>
|
|
||||||
<el-button type='primary' link :icon='EditPen' @click="openDrawer('编辑', scope.row)">编辑</el-button>
|
|
||||||
<el-button type='primary' link :icon='Refresh' @click='resetPass(scope.row)'>重置密码</el-button>
|
|
||||||
<el-button type='primary' link :icon='Delete' @click='deleteAccount(scope.row)'>删除</el-button>
|
|
||||||
</template>
|
|
||||||
</ProTable>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
<script setup lang='tsx'>
|
|
||||||
import { CirclePlus, Delete, EditPen, Refresh, View } from '@element-plus/icons-vue'
|
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
|
||||||
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
|
||||||
import { reactive } from 'vue'
|
|
||||||
import { ColumnProps } from '@/components/ProTable/interface'
|
|
||||||
import { User } from '@/api/user/interface'
|
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
|
||||||
import {
|
|
||||||
changeUserStatus,
|
|
||||||
} from '@/api/user/user'
|
|
||||||
import userDataList from '@/api/user/userData'
|
|
||||||
|
|
||||||
const userData = userDataList
|
|
||||||
const proTable = ref()
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const title = ref('单列弹出框')
|
|
||||||
|
|
||||||
const { BUTTONS } = useAuthButtons()
|
|
||||||
// 表格配置项
|
|
||||||
const columns = reactive<ColumnProps<User.ResUserList>[]>([
|
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
|
||||||
{
|
|
||||||
prop: 'username',
|
|
||||||
label: '姓名',
|
|
||||||
width: 120,
|
|
||||||
search: { el: 'input' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'gender',
|
|
||||||
label: '性别',
|
|
||||||
// 字典数据(本地数据)
|
|
||||||
enum: dictStore.getDictData('sex'),
|
|
||||||
search: { el: 'select', props: { filterable: true } },
|
|
||||||
fieldNames: { label: 'label', value: 'code' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'age',
|
|
||||||
label: '年龄',
|
|
||||||
search: {
|
|
||||||
// 自定义 search 显示内容
|
|
||||||
render: ({ searchParam }) => {
|
|
||||||
return (
|
|
||||||
<div class='flx-center'>
|
|
||||||
<el-input vModel_trim={searchParam.minAge} placeholder='最小年龄' />
|
|
||||||
<span class='mr10 ml10'>-</span>
|
|
||||||
<el-input vModel_trim={searchParam.maxAge} placeholder='最大年龄' />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ prop: 'idCard', label: '身份证号', search: { el: 'input' } },
|
|
||||||
{ prop: 'email', label: '邮箱' },
|
|
||||||
{ prop: 'address', label: '居住地址', width: 120 },
|
|
||||||
{
|
|
||||||
prop: 'status',
|
|
||||||
label: '状态',
|
|
||||||
enum: dictStore.getDictData('status'),
|
|
||||||
search: { el: 'tree-select', props: { filterable: true } },
|
|
||||||
fieldNames: { label: 'userLabel', value: 'userStatus' },
|
|
||||||
render: scope => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{BUTTONS.value.status ? (
|
|
||||||
<el-switch
|
|
||||||
model-value={scope.row.status}
|
|
||||||
active-text={scope.row.status ? '启用' : '禁用'}
|
|
||||||
active-value={1}
|
|
||||||
inactive-value={0}
|
|
||||||
onClick={() => changeStatus(scope.row)}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<el-tag type={scope.row.status ? 'success' : 'danger'}>{scope.row.status ? '启用' : '禁用'}</el-tag>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
width: 180,
|
|
||||||
search: {
|
|
||||||
el: 'date-picker',
|
|
||||||
span: 1,
|
|
||||||
props: { type: 'daterange', valueFormat: 'YYYY-MM-DD' },
|
|
||||||
defaultValue: ['2024-11-12', '2024-12-12'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
const open = (textTitle: string) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
title.value = textTitle
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
defineExpose({ open })
|
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
width: {
|
|
||||||
type: Number,
|
|
||||||
default: 800,
|
|
||||||
},
|
|
||||||
height: {
|
|
||||||
type: Number,
|
|
||||||
default: 744,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// 切换用户状态
|
|
||||||
const changeStatus = async (row: User.ResUserList) => {
|
|
||||||
await useHandleData(changeUserStatus, {
|
|
||||||
id: row.id,
|
|
||||||
status: row.status == 1 ? 0 : 1,
|
|
||||||
}, `切换【${row.username}】用户状态`)
|
|
||||||
proTable.value?.getTableList()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除用户信息
|
|
||||||
const deleteAccount = async (params: User.ResUserList) => {
|
|
||||||
|
|
||||||
}
|
|
||||||
// 重置用户密码
|
|
||||||
const resetPass = async (params: User.ResUserList) => {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 打开 drawer(新增、查看、编辑)
|
|
||||||
const openDrawer = (title: string, row: Partial<User.ResUserList> = {}) => {
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
<!--单列-->
|
|
||||||
<template>
|
|
||||||
<el-dialog v-model='dialogVisible' :title='title' v-bind='dialogSmall'>
|
|
||||||
<el-scrollbar>
|
|
||||||
<el-form
|
|
||||||
:model='form'
|
|
||||||
:inline='false'
|
|
||||||
label-width='auto'
|
|
||||||
ref='formRuleRef'
|
|
||||||
:rules='rules'
|
|
||||||
>
|
|
||||||
<el-form-item label='姓名' prop='username'>
|
|
||||||
<el-input
|
|
||||||
v-model='form.username'
|
|
||||||
placeholder='请输入姓名'
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label='性别' prop='gender'>
|
|
||||||
<el-radio-group v-model='form.gender'>
|
|
||||||
<el-radio-button :label='0'>男</el-radio-button>
|
|
||||||
<el-radio-button :label='1'>女</el-radio-button>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label='年龄' prop='age'>
|
|
||||||
<el-input
|
|
||||||
v-model='form.age'
|
|
||||||
placeholder='年龄'
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label='身份证号' prop='idCard'>
|
|
||||||
<el-input
|
|
||||||
v-model='form.idCard'
|
|
||||||
placeholder='身份证号'
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label='邮箱' prop='email'>
|
|
||||||
<el-input
|
|
||||||
v-model='form.email'
|
|
||||||
placeholder='邮箱'
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label='居住地址' prop='address'>
|
|
||||||
<el-input
|
|
||||||
v-model='form.address'
|
|
||||||
placeholder='居住地址'
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
</el-scrollbar>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<div class='dialog-footer'>
|
|
||||||
<el-button @click='close()'>取消</el-button>
|
|
||||||
<el-button type='primary' @click='confirmForm()'>确定</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
<script setup lang='ts'>
|
|
||||||
import { dialogSmall } from '@/utils/elementBind'
|
|
||||||
import { FormInstance, FormItemRule } from 'element-plus'
|
|
||||||
|
|
||||||
interface userForm {
|
|
||||||
id?: string; //用户ID,作为唯一标识
|
|
||||||
username: string; //用户名
|
|
||||||
gender: number; // 性别
|
|
||||||
age: number; // 年龄
|
|
||||||
idCard: string; // 身份证
|
|
||||||
email: string; // 邮箱
|
|
||||||
address?: string; // 地址
|
|
||||||
}
|
|
||||||
|
|
||||||
const form: Ref<userForm> = ref({
|
|
||||||
username: '',
|
|
||||||
gender: 0,
|
|
||||||
age: 1,
|
|
||||||
idCard: '',
|
|
||||||
email: '',
|
|
||||||
})
|
|
||||||
|
|
||||||
const formRuleRef = ref<FormInstance>()
|
|
||||||
//定义校验规则
|
|
||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
|
||||||
username: [{ required: true, message: '用户名必填!', trigger: 'blur' }],
|
|
||||||
age: [
|
|
||||||
{ required: true, message: '年龄必填!', trigger: 'blur' },
|
|
||||||
// 指定正则,此处是数字正则
|
|
||||||
{ pattern: /^[1-9][0-9]?$|^100$/, message: '年龄必须在1到100之间', trigger: 'blur' },
|
|
||||||
],
|
|
||||||
idCard: [
|
|
||||||
{ required: true, message: '身份证必填!', trigger: 'blur' },
|
|
||||||
// 指定正则,此处是身份证正则
|
|
||||||
{ pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, message: '请输入正确的身份证号码', trigger: 'blur' },
|
|
||||||
],
|
|
||||||
email: [
|
|
||||||
{ required: true, message: '邮箱必填!', trigger: 'blur' },
|
|
||||||
// 指定校验类型
|
|
||||||
{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] },
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 重置表单
|
|
||||||
*/
|
|
||||||
const resetForm = () => {
|
|
||||||
form.value = {
|
|
||||||
username: '',
|
|
||||||
gender: 0,
|
|
||||||
age: 1,
|
|
||||||
idCard: '',
|
|
||||||
email: '',
|
|
||||||
address: '',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const title = ref('单列弹出框')
|
|
||||||
const open = (textTitle: string) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
title.value = textTitle
|
|
||||||
}
|
|
||||||
|
|
||||||
// 关闭弹出框
|
|
||||||
const close = () => {
|
|
||||||
//重置表单内容
|
|
||||||
//取消表单校验状态
|
|
||||||
formRuleRef.value && formRuleRef.value.resetFields()
|
|
||||||
dialogVisible.value = false
|
|
||||||
resetForm()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验表单数据
|
|
||||||
* 数据没问题,提交数据,并根据业务情况请求新增接口还是修改接口
|
|
||||||
*/
|
|
||||||
const confirmForm = () => {
|
|
||||||
ElMessage.info('业务数据提交')
|
|
||||||
try {
|
|
||||||
formRuleRef.value?.validate((valid: boolean) => {
|
|
||||||
if (valid) {
|
|
||||||
// 将表单数据转为json,发送到后端
|
|
||||||
let confirmFormData = JSON.parse(JSON.stringify(form.value))
|
|
||||||
|
|
||||||
if ('是否新增') {
|
|
||||||
// 执行新增接口
|
|
||||||
} else {
|
|
||||||
// 执行修改接口
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ElMessage.error('表单验证失败!')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
console.error('验证过程中发生错误', error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({ open })
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,127 +1,343 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div class="table-container table-main">
|
||||||
<div class="table-container">
|
<el-table :data="tableData"
|
||||||
<el-table :data="tableData" :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" >
|
:header-cell-style="{ textAlign: 'center' } "
|
||||||
|
:cell-style="{ textAlign: 'center' }"
|
||||||
<el-table-column prop="id" label="序号" width="70" />
|
style="width: 100%"
|
||||||
<el-table-column prop="updateTime" label="上送时刻" />
|
max-height="400px"
|
||||||
<el-table-column prop="deviceName" label="设备名称" />
|
:span-method="objectSpanMethod">
|
||||||
<el-table-column prop="MonitorIdx" label="监测点序号" />
|
<el-table-column prop="monitorNum" label="监测点序号" width="80"/>
|
||||||
|
<el-table-column prop="desc" label="描述" width="90"/>
|
||||||
<el-table-column label="电压通道" >
|
<el-table-column label="电压通道" >
|
||||||
<el-table-column prop="Ua" label="L1">
|
<el-table-column prop="Ua" label="A相">
|
||||||
|
<el-table-column prop="aVuData" label="被检值(V)" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-icon v-if="scope.row.aVuData === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
<span v-else>
|
||||||
|
{{ scope.row.aVuData }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="aVuXi" label="检测结果" width="90px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip
|
||||||
|
v-if="scope.row.aVuXi === '不合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.aV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.aVuXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.aVuXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.aV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.aVuXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<!-- <el-tag type="danger" v-if="scope.row.aVuXi === '不合格'">
|
||||||
|
{{ scope.row.aVuXi }}
|
||||||
|
</el-tag> -->
|
||||||
|
<el-icon v-else-if="scope.row.aVuXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
<!-- <span v-else>
|
||||||
|
{{ scope.row.aVuXi }}
|
||||||
|
</span> -->
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="Ub" label="L2">
|
<el-table-column prop="Ub" label="B相">
|
||||||
|
<el-table-column prop="bVuData" label="被检值(V)" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-icon v-if="scope.row.bVuData === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
<span v-else>
|
||||||
|
{{ scope.row.bVuData }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="bVuXi" label="检测结果" width="90px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip
|
||||||
|
v-if="scope.row.bVuXi === '不合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.bV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.bVuXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.bVuXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.bV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.bVuXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-icon v-else-if="scope.row.bVuXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="Uc" label="L3">
|
<el-table-column prop="Uc" label="C相">
|
||||||
|
<el-table-column prop="cVuData" label="被检值(V)" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-icon v-if="scope.row.cVuData === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
<span v-else>
|
||||||
|
{{ scope.row.cVuData }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="cVuXi" label="检测结果" width="90px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip
|
||||||
|
v-if="scope.row.cVuXi === '不合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.cV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.cVuXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.cVuXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4) + 'V'}}<br/>
|
||||||
|
误差值:{{ scope.row.cV + 'V'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.cVuXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-icon v-else-if="scope.row.cVuXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="电流通道" >
|
<el-table-column label="电流通道" >
|
||||||
<el-table-column prop="Ia" label="L1">
|
<el-table-column prop="Ia" label="A相">
|
||||||
|
<el-table-column prop="aIeData" label="被检值(A)" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-icon v-if="scope.row.aIeData === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
<span v-else>
|
||||||
|
{{ scope.row.aIeData }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="aIeXi" label="检测结果" width="90px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip
|
||||||
|
v-if="scope.row.aIeXi === '不合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{-0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.aI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.aIeXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.aIeXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ -0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.aI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.aIeXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-icon v-else-if="scope.row.aIeXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="Ib" label="L2">
|
<el-table-column prop="Ib" label="B相">
|
||||||
|
<el-table-column prop="bIeData" label="被检值(A)" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-icon v-if="scope.row.bIeData === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
<span v-else>
|
||||||
|
{{ scope.row.bIeData }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="bIeXi" label="检测结果" width="90px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip
|
||||||
|
v-if="scope.row.bIeXi === '不合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ -0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.bI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.bIeXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.bIeXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ -0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.bI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.bIeXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-icon v-else-if="scope.row.bIeXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="Ic" label="L3">
|
<el-table-column prop="Ic" label="C相">
|
||||||
|
<el-table-column prop="cIeData" label="被检值(A)" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-icon v-if="scope.row.cIeData === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
<span v-else>
|
||||||
|
{{ scope.row.cIeData }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="cIeXi" label="检测结果" width="90px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip
|
||||||
|
v-if="scope.row.cIeXi === '不合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ -0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.cI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="danger" class="tooltip-content">
|
||||||
|
{{ scope.row.cIeXi }}
|
||||||
|
</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-else-if="scope.row.cIeXi === '合格'"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
placement="bottom-start"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ -0.5 + "%~" +0.5 + "%" }}<br/>
|
||||||
|
误差值:{{ scope.row.cI + '%'}}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" class="tooltip-content">{{ scope.row.cIeXi }}</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-icon v-else-if="scope.row.cIeXi === '—'&& scope.row.loading" class="loading-box">
|
||||||
|
<el-icon-loading />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="校准结果">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag :type="scope.row.Result === '合格' ? 'success' : 'danger'">{{ scope.row.Result }}</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="ErrorSystemDialog">
|
<script lang="ts" setup name="ErrorSystemDialog">
|
||||||
import{ElMessage, FormInstance,FormItemRule}from'element-plus'
|
import { defineProps, type PropType } from 'vue';
|
||||||
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
|
import { ElIcon, ElLoading, ElTag } from 'element-plus';
|
||||||
import { dialogBig,dialogMiddle} from '@/utils/elementBind'
|
import type { ChannelsTest } from '@/api/home/interface/channelsTest';
|
||||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
import { number } from 'echarts';
|
||||||
import {CirclePlus, Delete, EditPen,FolderOpened,CopyDocument} from '@element-plus/icons-vue'
|
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
interface Props {
|
||||||
const dictStore = useDictStore()
|
tableData: ChannelsTest.CoefficientVO[];
|
||||||
const props = defineProps<{
|
big_V_loading: boolean;
|
||||||
tableData: {
|
curV: number;
|
||||||
id: string;
|
}
|
||||||
updateTime: string;
|
|
||||||
deviceName:string;
|
|
||||||
MonitorIdx:number;
|
|
||||||
Ua:number;
|
|
||||||
Ub:number;
|
|
||||||
Uc:number;
|
|
||||||
Ia:number;
|
|
||||||
Ib:number;
|
|
||||||
Ic:number;
|
|
||||||
Result: string;
|
|
||||||
};
|
|
||||||
}>();
|
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
tableData: () => [],
|
||||||
|
big_V_loading: false,
|
||||||
|
curV: 0,
|
||||||
|
});
|
||||||
|
|
||||||
// const tableData = ref([
|
function objectSpanMethod({ row, column, rowIndex, columnIndex }: { row: any, column: any, rowIndex: number, columnIndex: number }) {
|
||||||
// {
|
if (columnIndex === 0) {
|
||||||
// id: '1',
|
if (rowIndex % 4 === 0) {
|
||||||
// updateTime: '2024-10-10 10:30:00',
|
return {
|
||||||
// deviceName:'被检设备1',
|
rowspan: 4,
|
||||||
// MonitorIdx: 1,
|
colspan: 1,
|
||||||
// Ua:1.0003,
|
};
|
||||||
// Ub:1.0003,
|
} else {
|
||||||
// Uc:0.0096,
|
return {
|
||||||
// Ia:1.0003,
|
rowspan: 0,
|
||||||
// Ib:1.0003,
|
colspan: 0,
|
||||||
// Ic:1.0008,
|
};
|
||||||
// Result: '合格',
|
}
|
||||||
// },
|
}
|
||||||
// {
|
if (columnIndex === 1) {
|
||||||
// id: '2',
|
if (rowIndex % 2 === 0) {
|
||||||
// updateTime: '2024-10-10 10:30:00',
|
return {
|
||||||
// deviceName:'被检设备1',
|
rowspan: 2,
|
||||||
// MonitorIdx: 2,
|
colspan: 1,
|
||||||
// Ua:1.0003,
|
};
|
||||||
// Ub:1.0003,
|
} else {
|
||||||
// Uc:0.0096,
|
return {
|
||||||
// Ia:1.0003,
|
rowspan: 0,
|
||||||
// Ib:1.0003,
|
colspan: 0,
|
||||||
// Ic:1.0008,
|
};
|
||||||
// Result: '合格',
|
}
|
||||||
// },
|
}
|
||||||
// {
|
}
|
||||||
// id: '3',
|
|
||||||
// updateTime: '2024-10-10 10:30:00',
|
|
||||||
// deviceName:'被检设备1',
|
|
||||||
// MonitorIdx: 3,
|
|
||||||
// Ua:1.0003,
|
|
||||||
// Ub:1.0003,
|
|
||||||
// Uc:0.0096,
|
|
||||||
// Ia:1.0003,
|
|
||||||
// Ib:1.0003,
|
|
||||||
// Ic:1.0008,
|
|
||||||
// Result: '合格',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: '4',
|
|
||||||
// updateTime: '2024-10-10 10:30:00',
|
|
||||||
// deviceName:'被检设备1',
|
|
||||||
// MonitorIdx: 4,
|
|
||||||
// Ua:1.0003,
|
|
||||||
// Ub:1.0003,
|
|
||||||
// Uc:0.0096,
|
|
||||||
// Ia:1.0003,
|
|
||||||
// Ib:1.0003,
|
|
||||||
// Ic:1.0008,
|
|
||||||
// Result: '合格',
|
|
||||||
// },
|
|
||||||
// ])
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -157,4 +373,31 @@
|
|||||||
overflow-y: auto; /* 允许垂直滚动 */
|
overflow-y: auto; /* 允许垂直滚动 */
|
||||||
overflow-x: hidden; /* 隐藏水平滚动条 */
|
overflow-x: hidden; /* 隐藏水平滚动条 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 确保 el-icon-loading 的动画效果没有被覆盖 */
|
||||||
|
.loading-box {
|
||||||
|
animation: rotate 2s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-margin {
|
||||||
|
margin-left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-align {
|
||||||
|
vertical-align: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tooltip-content {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@keyframes rotate {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,32 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog title="数据查询" :model-value='visible' @close="handleCancel" width="1065px" draggable>
|
<el-dialog title="数据查询" :model-value='visible' @close="handleCancel" width="1065px" draggable>
|
||||||
<div class="data-check-dialog">
|
<div class="data-check-dialog">
|
||||||
<div class="data-check-title">
|
<div class="data-check-title">
|
||||||
<el-form :model='formContent'>
|
<el-form :model='formContent' label-width="auto" class="form-three ">
|
||||||
<el-row :gutter="24" >
|
<el-form-item label="检测脚本">
|
||||||
<el-col :span="8">
|
<el-input v-model='testScriptName' :disabled="true" />
|
||||||
<el-form-item label="检测脚本:" >
|
</el-form-item>
|
||||||
<el-input v-model='testScriptName' :disabled="true"/>
|
<el-form-item label="误差体系">
|
||||||
</el-form-item>
|
<el-input v-model='errorSysName' :disabled="true" />
|
||||||
</el-col>
|
</el-form-item>
|
||||||
<el-col :span="8">
|
<el-form-item label="数据原则">
|
||||||
<el-form-item label="误差体系:" >
|
<el-input v-model='dataRule' :disabled="true" />
|
||||||
<el-input v-model='errorSysName' :disabled="true"/>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="设备名称">
|
||||||
</el-col>
|
<el-input v-model='deviceName' :disabled="true" />
|
||||||
<el-col :span="8">
|
</el-form-item>
|
||||||
<el-form-item label="数据处理原则:" >
|
|
||||||
<el-input v-model='dataRule' :disabled="true"/>
|
<!-- <el-col :span="8">
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="24" >
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="设备名称:" >
|
|
||||||
<el-input v-model='deviceName' :disabled="true"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label='复检次数:'>
|
<el-form-item label='复检次数:'>
|
||||||
<el-select v-model="reCheckIdx">
|
<el-select v-model="reCheckIdx">
|
||||||
<el-option
|
<el-option
|
||||||
@@ -37,48 +27,44 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col> -->
|
||||||
<el-col :span="8">
|
<el-form-item label='通道号'>
|
||||||
<el-form-item label='通道号:'>
|
<el-select v-model="monitorIdx">
|
||||||
<el-select v-model="monitorIdx">
|
<el-option v-for="item in monitorIdxList" :key="item.value" :label="item.value"
|
||||||
<el-option
|
:value="item.value" />
|
||||||
v-for="item in monitorIdxList"
|
</el-select>
|
||||||
:key="item.value"
|
</el-form-item>
|
||||||
:label="item.value"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div class="data-check-content">
|
<div class="data-check-content">
|
||||||
<div class="content-left-tree">
|
<div class="content-left-tree">
|
||||||
<div class="content-left-tree-switch">
|
<div class="content-left-tree-switch">
|
||||||
<el-switch
|
<!-- <el-switch
|
||||||
v-model="scriptSwitch"
|
v-model="scriptSwitch"
|
||||||
class="ml-2"
|
class="ml-2"
|
||||||
inline-prompt
|
inline-prompt
|
||||||
style="--el-switch-on-color: #003078; --el-switch-off-color: #5a79a9"
|
style="--el-switch-on-color: #003078; --el-switch-off-color: #5a79a9"
|
||||||
active-text="不合格测试项"
|
active-text="不合格测试项"
|
||||||
inactive-text="全部测试项"
|
inactive-text="全部测试项"
|
||||||
/>
|
/> -->
|
||||||
|
<el-radio-group v-model="scriptSwitch">
|
||||||
|
<el-radio-button label="不合格测试项" value="0" />
|
||||||
|
<el-radio-button label="全部测试项" value="1" />
|
||||||
|
|
||||||
|
</el-radio-group>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="content-tree">
|
||||||
<el-tree
|
<el-tree :default-expanded-keys="['0', '0-1', '0-2', '0-3', '1']" node-key="id" :data="data"
|
||||||
:default-expanded-keys="['0','0-1','0-2','0-3','1']"
|
:props="defaultProps" @node-click="handleNodeClick" />
|
||||||
node-key="id"
|
|
||||||
:data="data"
|
|
||||||
:props="defaultProps"
|
|
||||||
@node-click="handleNodeClick"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-right">
|
<div class="content-right">
|
||||||
<div class="content-right-title">
|
<div class="content-right-title">
|
||||||
<el-divider >当前检测项目:</el-divider>
|
<!-- <el-divider>当前检测项目:</el-divider> -->
|
||||||
<span>{{currentScriptDsc}}</span>
|
<div>
|
||||||
|
当前检测项目
|
||||||
|
</div>
|
||||||
|
<span>{{ currentScriptDsc }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-right-Tabs">
|
<div class="content-right-Tabs">
|
||||||
<el-tabs type="border-card" v-model="activeName">
|
<el-tabs type="border-card" v-model="activeName">
|
||||||
@@ -114,52 +100,52 @@ import { type Monitor } from '@/api/device/interface/monitor'
|
|||||||
import { data } from "@/api/plan/autoTest.json";
|
import { data } from "@/api/plan/autoTest.json";
|
||||||
import DataCheckResultTable from './dataCheckResultTable.vue'
|
import DataCheckResultTable from './dataCheckResultTable.vue'
|
||||||
import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
||||||
|
const formContent = ref({})
|
||||||
const activeName = ref('rawDataTab')
|
const activeName = ref('rawDataTab')
|
||||||
const deviceName = ref('被检设备1');
|
const deviceName = ref('240001');
|
||||||
const monitorIdx = ref('1');
|
const monitorIdx = ref('1');
|
||||||
const reCheckIdx = ref('3');
|
const reCheckIdx = ref('3');
|
||||||
const testScriptName = ref('Q/GDW 10650.4-2021 模拟式');
|
const testScriptName = ref('Q/GDW 10650.4-2021 模拟式');
|
||||||
const errorSysName = ref('Q/GDW 10650.2-2021');
|
const errorSysName = ref('Q/GDW 10650.2-2021');
|
||||||
const dataRule = ref('所有值');
|
const dataRule = ref('所有值');
|
||||||
const scriptSwitch = ref(true);
|
const scriptSwitch = ref("0");
|
||||||
const currentScriptDsc = ref('频率准确度检测:频率:42.5Hz Ua=46.192V 0° Ub=46.192V -120° Uc=46.192V 120° Ia=1A 0° Ib=1A -120° Ic=1A 120°');
|
const currentScriptDsc = ref('电压准确度检测:频率:42.5Hz Ua=46.192V 0° Ub=46.192V -120° Uc=46.192V 120° Ia=1A 0° Ib=1A -120° Ic=1A 120°');
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: "children",
|
children: "children",
|
||||||
label: "name",
|
label: "name",
|
||||||
pid: "pid",
|
pid: "pid",
|
||||||
};
|
};
|
||||||
|
|
||||||
const reCheckList = [
|
const reCheckList = [
|
||||||
{
|
{
|
||||||
value: '0',
|
value: '0',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: '1',
|
value: '1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: '2',
|
value: '2',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: '3',
|
value: '3',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
const monitorIdxList = [
|
const monitorIdxList = [
|
||||||
{
|
{
|
||||||
value: '1',
|
value: '1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: '2 (不合格)',
|
value: '2 (不合格)',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: '3',
|
value: '3',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: '4 (不合格)',
|
value: '4 (不合格)',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
const handleNodeClick = (data) => {
|
const handleNodeClick = (data) => {
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
};
|
};
|
||||||
const MonIsShow = ref(false)
|
const MonIsShow = ref(false)
|
||||||
const DevIsShow = ref(false)
|
const DevIsShow = ref(false)
|
||||||
@@ -168,55 +154,76 @@ const dictStore = useDictStore()
|
|||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
const disabledDate = (time: Date) => {
|
const disabledDate = (time: Date) => {
|
||||||
return time.getTime() > Date.now()
|
return time.getTime() > Date.now()
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:visible', value: boolean): void;
|
(e: 'update:visible', value: boolean): void;
|
||||||
(e: 'submit', data: any): void;
|
(e: 'submit', data: any): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
emit('update:visible', false); // 关闭对话框
|
emit('update:visible', false); // 关闭对话框
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.data-check-dialog {
|
||||||
.data-check-dialog{
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
max-height: 580px;
|
max-height: 580px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-check-title{
|
.data-check-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-check-content{
|
.data-check-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
/* flex-direction: row; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-left-tree{
|
.content-left-tree {
|
||||||
width: 20%;
|
width: 240px;
|
||||||
max-height: 475px;
|
max-height: 445px;
|
||||||
overflow-y: auto;
|
/* overflow-y: auto; */
|
||||||
|
padding: 10px 0;
|
||||||
|
border: 1px solid #ccc;
|
||||||
/* background-color: gray; */
|
/* background-color: gray; */
|
||||||
}
|
}
|
||||||
.content-left-tree-switch{
|
|
||||||
|
.content-tree {
|
||||||
|
max-height: 405px;
|
||||||
|
margin-top: 10px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-left-tree-switch {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
.content-right{
|
|
||||||
margin-left: 20px;
|
.content-right {
|
||||||
|
margin-left: 10px;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
.content-right-Tabs{
|
|
||||||
|
.content-right-Tabs {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.el-divider--horizontal) {
|
||||||
|
margin: 15px 0;
|
||||||
|
}
|
||||||
|
.content-right-title{
|
||||||
|
div{
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,177 +1,63 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<el-button v-if="tableData.length > 0" type="primary" @click="exportData" style="margin-bottom: 10px">导出</el-button>
|
||||||
<div class="table-container">
|
<div class="table-main">
|
||||||
<el-table :data="tableData" stripe :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" height="310px" style="width: 100%" >
|
<el-table v-if="tableData.length > 0" :data="tableData" stripe border :header-cell-style="{ textAlign: 'center' } "
|
||||||
<el-table-column prop="id" label="序号" width="70" />
|
:cell-style="{ textAlign: 'center' }" height="315px"
|
||||||
<el-table-column prop="updateTime" label="数据时间" />
|
style="width: 100%;">
|
||||||
<el-table-column prop="L1" label="L1(V)" />
|
<el-table-column type="index" label="序号" width="70" fixed="left"/>
|
||||||
<el-table-column prop="L2" label="L2(V)" />
|
<el-table-column prop="time" label="数据时间"/>
|
||||||
<el-table-column prop="L3" label="L3(V)" />
|
<template v-if="!isThreePhase && phaseT === 0">
|
||||||
|
<el-table-column prop="dataA" :label="'A相'+(unit==''?'':'('+unit+')')"/>
|
||||||
</el-table>
|
<el-table-column prop="dataB" :label="'B相'+(unit==''?'':'('+unit+')')"/>
|
||||||
</div>
|
<el-table-column prop="dataC" :label="'C相'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
</template>
|
||||||
|
<template v-if="!isThreePhase && phaseT === 1">
|
||||||
|
<el-table-column prop="dataT" :label="tableHeader+(unit==''?'':'('+unit+')')"/>
|
||||||
|
</template>
|
||||||
|
<template v-if="isThreePhase">
|
||||||
|
<el-table-column prop="dataB" :label="'负序不平衡度'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
</template>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="tsx" setup>
|
<script lang="tsx" setup>
|
||||||
import{ElMessage, FormInstance,FormItemRule}from'element-plus'
|
import {CheckData} from "@/api/check/interface";
|
||||||
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
|
import {computed} from "vue";
|
||||||
import { dialogBig,dialogMiddle} from '@/utils/elementBind'
|
|
||||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
|
||||||
import {CirclePlus, Delete, EditPen,FolderOpened,CopyDocument} from '@element-plus/icons-vue'
|
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
const tableData = ref([
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
updateTime: "2024-10-10 09:30:00",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
updateTime: "2024-10-10 09:30:03",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
updateTime: "2024-10-10 09:30:06",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
updateTime: "2024-10-10 09:30:09",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 5,
|
|
||||||
updateTime: "2024-10-10 09:30:12",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 6,
|
|
||||||
updateTime: "2024-10-10 09:30:15",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 7,
|
|
||||||
updateTime: "2024-10-10 09:30:18",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 8,
|
|
||||||
updateTime: "2024-10-10 09:30:21",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 9,
|
|
||||||
updateTime: "2024-10-10 09:30:24",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 10,
|
|
||||||
updateTime: "2024-10-10 09:30:27",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 11,
|
|
||||||
updateTime: "2024-10-10 09:30:30",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 12,
|
|
||||||
updateTime: "2024-10-10 09:30:33",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 13,
|
|
||||||
updateTime: "2024-10-10 09:30:36",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 14,
|
|
||||||
updateTime: "2024-10-10 09:30:39",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 15,
|
|
||||||
updateTime: "2024-10-10 09:30:42",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 16,
|
|
||||||
updateTime: "2024-10-10 09:30:45",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 17,
|
|
||||||
updateTime: "2024-10-10 09:30:48",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 18,
|
|
||||||
updateTime: "2024-10-10 09:30:51",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 19,
|
|
||||||
updateTime: "2024-10-10 09:30:54",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 20,
|
|
||||||
updateTime: "2024-10-10 09:30:57",
|
|
||||||
L1:57.73,
|
|
||||||
L2:57.73,
|
|
||||||
L3:57.73,
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
|
const {tableData, currentScriptTypeName} = defineProps<{
|
||||||
|
tableData: CheckData.RawDataItem[]
|
||||||
|
currentScriptTypeName: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits(['exportRawDataHandler'])
|
||||||
|
|
||||||
|
const unit = computed(() => {
|
||||||
|
return tableData.length > 0 ? tableData[0].unit : '';
|
||||||
|
})
|
||||||
|
|
||||||
|
const phaseT = computed(() => {
|
||||||
|
return tableData[0].dataT == '/' ? 0 : 1
|
||||||
|
})
|
||||||
|
|
||||||
|
const tableHeader = computed(() => {
|
||||||
|
if (phaseT.value === 1) {
|
||||||
|
let index = currentScriptTypeName.indexOf('=');
|
||||||
|
return currentScriptTypeName.substring(0, index);
|
||||||
|
}
|
||||||
|
return currentScriptTypeName
|
||||||
|
})
|
||||||
|
|
||||||
|
const isThreePhase = computed(() => {
|
||||||
|
return currentScriptTypeName.includes('三相电压不平衡度') || currentScriptTypeName.includes('三相电流不平衡度')
|
||||||
|
})
|
||||||
|
|
||||||
|
const exportData = () => {
|
||||||
|
emit('exportRawDataHandler')
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.table-container {
|
|
||||||
max-height: 320px; /* 根据需要调整高度 */
|
|
||||||
overflow-y: auto; /* 允许垂直滚动 */
|
|
||||||
overflow-x: hidden; /* 隐藏水平滚动条 */
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -1,108 +1,166 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="table-container">
|
<div class="table-main">
|
||||||
<el-table :data="tableData" max-height="300" :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" >
|
<el-table v-if="tableData.length > 0" :data="tableData" height="357px" :header-cell-style="{ textAlign: 'center' } "
|
||||||
|
:cell-style="{ textAlign: 'center' }">
|
||||||
<el-table-column prop="id" label="序号" width="70" />
|
<!-- <el-table-column prop="chnNum" label="通道号" width="80">-->
|
||||||
<el-table-column prop="standardValue" label="标准值(V)" />
|
<!-- <template #default="{row}">-->
|
||||||
|
<!-- {{ '通道' + row.chnNum }}-->
|
||||||
<el-table-column label="L1(V)" >
|
<!-- </template>-->
|
||||||
<el-table-column prop="L1" label="被检值">
|
<!-- </el-table-column>-->
|
||||||
|
<template v-if="phaseT === 0">
|
||||||
</el-table-column>
|
<el-table-column label="A相">
|
||||||
<el-table-column prop="L1_errValue" label="误差值">
|
<el-table-column prop="stdA" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
<el-table-column prop="dataA" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||||
</el-table-column>
|
<el-table-column prop="isDataA" label="检测结果">
|
||||||
</el-table-column>
|
<template #default="scope">
|
||||||
<el-table-column label="L2(V)" >
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
<el-table-column prop="L2" label="被检值">
|
<template #content>
|
||||||
|
误差范围:{{ scope.row.maxErrorA }} <br/>
|
||||||
</el-table-column>
|
误差值:{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }}
|
||||||
<el-table-column prop="L2_errValue" label="误差值">
|
</template>
|
||||||
|
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
|
||||||
</el-table-column>
|
<el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag>
|
||||||
</el-table-column>
|
<el-tag type="warning" v-if="scope.row.isDataA === 4">/</el-tag>
|
||||||
<el-table-column label="L3(V)" >
|
</el-tooltip>
|
||||||
<el-table-column prop="L3" label="被检值">
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="L3_errValue" label="误差值">
|
<el-table-column label="B相">
|
||||||
|
<el-table-column prop="stdB" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||||
</el-table-column>
|
<el-table-column prop="dataB" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||||
</el-table-column>
|
<el-table-column prop="isDataB" label="检测结果">
|
||||||
|
<template #default="scope">
|
||||||
<el-table-column prop="maxErrVaule" label="最大误差(V)">
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
|
<template #content>
|
||||||
</el-table-column>
|
误差范围:{{ scope.row.maxErrorB }}<br/>
|
||||||
<el-table-column prop="Result" label="检测结果">
|
误差值:{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }}
|
||||||
<template #default="scope">
|
</template>
|
||||||
<el-tag :type="scope.row.Result === '合格' ? 'success' : 'danger'">{{ scope.row.Result }}</el-tag>
|
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
|
||||||
</template>
|
<el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag>
|
||||||
</el-table-column>
|
<el-tag type="warning" v-if="scope.row.isDataB === 4">/</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
</el-table>
|
</template>
|
||||||
</div>
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="C相">
|
||||||
|
<el-table-column prop="stdC" width="110" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
<el-table-column prop="dataC" width="110" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
<el-table-column prop="isDataC" label="检测结果">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ scope.row.maxErrorC }}<br/>
|
||||||
|
误差值:{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
|
||||||
|
<el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag>
|
||||||
|
<el-tag type="warning" v-if="scope.row.isDataC === 4">/</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="phaseT === 1">
|
||||||
|
<el-table-column :label="tableHeader">
|
||||||
|
<el-table-column prop="stdT" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
<el-table-column prop="dataT" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||||
|
<el-table-column prop="isDataT" label="检测结果">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip effect="dark" placement="bottom">
|
||||||
|
<template #content>
|
||||||
|
误差范围: {{ scope.row.maxErrorT }}<br/>
|
||||||
|
误差值:{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }}
|
||||||
|
</template>
|
||||||
|
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
|
||||||
|
<el-tag type="danger" v-if="scope.row.isDataT === 2">不符合</el-tag>
|
||||||
|
<el-tag type="warning" v-if="scope.row.isDataT === 4">/</el-tag>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column prop="maxError" label="误差范围"/>-->
|
||||||
|
<!-- <el-table-column prop="result" label="检测结果">-->
|
||||||
|
<!-- <template #default="scope">-->
|
||||||
|
<!-- <span v-if="scope.row.result === 1">符合</span>-->
|
||||||
|
<!-- <el-tag type="danger" v-if="scope.row.result === 2">不符合</el-tag>-->
|
||||||
|
<!-- <span v-if="scope.row.result === 4">/</span>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- </el-table-column>-->
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="tsx" setup>
|
<script lang="tsx" setup>
|
||||||
import{ElMessage, FormInstance,FormItemRule}from'element-plus'
|
import {defineProps} from 'vue';
|
||||||
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
|
import {CheckData} from "@/api/check/interface";
|
||||||
import { dialogBig,dialogMiddle} from '@/utils/elementBind'
|
|
||||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
|
||||||
import {CirclePlus, Delete, EditPen,FolderOpened,CopyDocument} from '@element-plus/icons-vue'
|
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
|
|
||||||
const tableData = ref([
|
const {tableData, currentScriptTypeName} = defineProps<{
|
||||||
{
|
tableData: CheckData.CheckResult[],
|
||||||
id: '1',
|
currentScriptTypeName: string
|
||||||
standardValue: 57.74,
|
}>();
|
||||||
L1:57.73,
|
|
||||||
L1_errValue: 0.01,
|
|
||||||
L2:57.73,
|
|
||||||
L2_errValue: 0.01,
|
|
||||||
L3:57.73,
|
|
||||||
L3_errValue: 0.01,
|
|
||||||
maxErrVaule: 0.05774,
|
|
||||||
Result: '合格',
|
|
||||||
},
|
|
||||||
|
|
||||||
])
|
|
||||||
|
const unit = computed(() => {
|
||||||
|
return tableData.length > 0 ? tableData[0].unit : '';
|
||||||
|
})
|
||||||
|
|
||||||
|
const phaseT = computed(() => {
|
||||||
|
return tableData[0].dataT == null || tableData[0].dataT == undefined ? 0 : 1
|
||||||
|
})
|
||||||
|
|
||||||
|
const tableHeader = computed(() => {
|
||||||
|
if (phaseT.value === 1){
|
||||||
|
let index = currentScriptTypeName.indexOf('=');
|
||||||
|
return currentScriptTypeName.substring(0, index);
|
||||||
|
}
|
||||||
|
return currentScriptTypeName
|
||||||
|
})
|
||||||
|
|
||||||
|
// const maxErrorStr = computed((data) => {
|
||||||
|
// let result = tableData[0].maxError ?? '/'
|
||||||
|
// let idx = result.indexOf('~');
|
||||||
|
// if (idx > 0) {
|
||||||
|
// result = result.substring(0, idx) + unit.value + result.substring(idx, result.length) + unit.value;
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// })
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.form-grid {
|
.form-grid {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row; /* 横向排列 */
|
flex-direction: row; /* 横向排列 */
|
||||||
flex-wrap: wrap; /* 允许换行 */
|
flex-wrap: wrap; /* 允许换行 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-grid .el-form-item {
|
.form-grid .el-form-item {
|
||||||
flex: 1 1 30%; /* 控件宽度 */
|
flex: 1 1 30%; /* 控件宽度 */
|
||||||
margin-right: 20px; /* 控件间距 */
|
margin-right: 20px; /* 控件间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-grid .el-form-item:last-child {
|
.form-grid .el-form-item:last-child {
|
||||||
margin-right: 0; /* 最后一个控件不需要右边距 */
|
margin-right: 0; /* 最后一个控件不需要右边距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-footer {
|
.dialog-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
margin-bottom: 10px; /* 调整这里的值以增加或减少间距 */
|
margin-bottom: 10px; /* 调整这里的值以增加或减少间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-tabs {
|
.el-tabs {
|
||||||
margin-bottom: 20px; /* 添加底部边距 */
|
margin-bottom: 20px; /* 添加底部边距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-table th, .el-table td {
|
.el-table th, .el-table td {
|
||||||
text-align: center; /* 所有单元格文字居中 */
|
text-align: center; /* 所有单元格文字居中 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-container {
|
|
||||||
max-height: 400px; /* 根据需要调整高度 */
|
|
||||||
overflow-y: auto; /* 允许垂直滚动 */
|
|
||||||
overflow-x: hidden; /* 隐藏水平滚动条 */
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -1,151 +1,748 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog title="数据查询" :model-value='visible' @close="handleCancel" v-bind="dialogBig" width="950px">
|
<el-dialog :append-to-body="appendToBody" class="dialog" title="数据查询" :model-value='visible' @close="close"
|
||||||
<div class="data-check-dialog">
|
v-bind="dialogBig" :draggable="false">
|
||||||
<div class="data-check-title">
|
<div class="data-check-dialog">
|
||||||
|
<div class="data-check-head">
|
||||||
|
<el-form :model='formContent' label-width="auto" class="form-three ">
|
||||||
|
<el-form-item label="检测脚本">
|
||||||
|
<el-input v-model='formContent.scriptName' :disabled="true"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="误差体系">
|
||||||
|
<el-input v-model='formContent.errorSysName' :disabled="true"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数据原则">
|
||||||
|
<el-input v-model='formContent.dataRule' :disabled="true"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备名称">
|
||||||
|
<el-input v-model='formContent.deviceName' :disabled="true"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='通道号'>
|
||||||
|
<el-select v-model="formContent.chnNum">
|
||||||
|
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="data-check-body">
|
||||||
|
<div class="content-left-tree">
|
||||||
|
<div style="width: 99%;">
|
||||||
|
<el-input
|
||||||
<!-- <el-form-item label='通道号:'>
|
placeholder='请输入测试项名称'
|
||||||
<el-select v-model="monitorIdx">
|
clearable
|
||||||
<el-option
|
v-model='searchValue'
|
||||||
v-for="item in monitorIdxList"
|
></el-input>
|
||||||
:key="item.value"
|
</div>
|
||||||
:label="item.value"
|
<div class="content-tree">
|
||||||
:value="item.value"
|
<el-tree :filter-node-method='filterNode' :highlight-current="true" :default-expanded-keys="defaultExpandedKeys"
|
||||||
/>
|
node-key="index"
|
||||||
</el-select>
|
:data="treeDataAll"
|
||||||
</el-form-item> -->
|
:props="defaultProps"
|
||||||
</div>
|
@node-click="handleNodeClick" class="custom-tree" ref="treeRef">
|
||||||
<div class="data-check-content">
|
<template #default="{ node, data }">
|
||||||
<div class="content-right">
|
<el-tooltip effect="dark" :content="data.scriptTypeName" placement="top">
|
||||||
<div class="content-right-title">
|
<span class="custom-tree-node" :style="data.fly===2? 'color: #F56C6C;':data.fly===4? 'color: #e6a23c;':''">{{
|
||||||
<el-divider >当前检测项目:</el-divider>
|
data.scriptTypeName
|
||||||
<span>{{currentScriptDsc}}</span>
|
}}</span>
|
||||||
</div>
|
</el-tooltip>
|
||||||
<div class="content-right-Tabs">
|
</template>
|
||||||
<el-tabs type="border-card" v-model="activeName">
|
</el-tree>
|
||||||
<el-tab-pane label="检测结果" name="resultTab">
|
</div>
|
||||||
<DataCheckResultTable></DataCheckResultTable>
|
|
||||||
</el-tab-pane>
|
|
||||||
<el-tab-pane label="原始数据" name="rawDataTab">
|
|
||||||
<DataCheckRawDataTable></DataCheckRawDataTable>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
|
||||||
|
<div class="content-right">
|
||||||
|
<div class="content-right-title">
|
||||||
|
<div style="width: 750px;">
|
||||||
|
<span class="content-right-title-text">当前检测项目:
|
||||||
|
<el-popover trigger="hover" :content="currentDesc" :width="popoverWidth" placement="right">
|
||||||
|
<template #reference>
|
||||||
|
<el-button type="text" style="font-size: 14px;">
|
||||||
|
{{ currentScriptTypeName }}
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-popover>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<!-- <el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 210px;" v-if="harmNumList.length" label='次数'>-->
|
||||||
|
<!-- <el-select v-model="currentHarmNum">-->
|
||||||
|
<!-- <el-option v-for="item in harmNumList" :key="item.value" :label="item.label" :value="item.value"/>-->
|
||||||
|
<!-- </el-select>-->
|
||||||
|
<!-- </el-form-item>-->
|
||||||
|
<el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 230px;" v-if="checkList.length" label='测试项'>
|
||||||
|
<el-select v-model="currentCheckItem">
|
||||||
|
<el-option v-for="item in checkList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="content-right-Tabs">
|
||||||
|
<el-tabs type="border-card" v-model="activeTab">
|
||||||
|
<el-tab-pane label="检测结果" name="resultTab">
|
||||||
|
<DataCheckResultTable :tableData="checkResultData" :currentScriptTypeName="currentScriptTypeName"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="原始数据" name="rawDataTab">
|
||||||
|
<DataCheckRawDataTable :tableData="rawTableData" :currentScriptTypeName="currentScriptTypeName" @exportRawDataHandler="exportRawDataHandler"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
|
import {dialogBig} from '@/utils/elementBind'
|
||||||
import IPAddress from '@/components/IpAddress/index.vue'
|
import {reactive, ref, watch} from 'vue'
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
|
||||||
import { type Device } from '@/api/device/interface/device'
|
|
||||||
import { ElMessage, type FormItemRule } from 'element-plus'
|
|
||||||
import { addPqDev, updatePqDev } from '@/api/device/device'
|
|
||||||
import { computed, reactive, type Ref, ref } from 'vue'
|
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
import { CirclePlus, Delete, EditPen } from '@element-plus/icons-vue'
|
|
||||||
// 使用 dayjs 库格式化
|
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import { getPqMonList } from '@/api/device/monitor'
|
|
||||||
import { type ColumnProps } from '@/components/ProTable/interface'
|
|
||||||
import { type Monitor } from '@/api/device/interface/monitor'
|
|
||||||
import { data } from "@/api/plan/autoTest.json";
|
|
||||||
import DataCheckResultTable from './dataCheckResultTable.vue'
|
import DataCheckResultTable from './dataCheckResultTable.vue'
|
||||||
import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
||||||
|
import {CheckData} from "@/api/check/interface";
|
||||||
const activeName = ref('rawDataTab')
|
import {useDictStore} from "@/stores/modules/dict";
|
||||||
const deviceName = ref('被检设备1');
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
const monitorIdx = ref('1');
|
import {getFormData, getTreeData, getTableData} from "@/api/check/test";
|
||||||
const testScriptName = ref('Q/GDW 10650.4-2021 模拟式');
|
import {useDownload} from "@/hooks/useDownload";
|
||||||
const errorSysName = ref('Q/GDW 10650.2-2021');
|
import {exportRawData} from "@/api/check/test"
|
||||||
const dataRule = ref('所有值');
|
|
||||||
const scriptSwitch = ref(true);
|
const {appendToBody} = withDefaults(defineProps<{
|
||||||
const currentScriptDsc = ref('频率准确度检测:频率:42.5Hz Ua=46.192V 0° Ub=46.192V -120° Uc=46.192V 120° Ia=1A 0° Ib=1A -120° Ic=1A 120°');
|
appendToBody: boolean
|
||||||
const defaultProps = {
|
}>(), {appendToBody: true})
|
||||||
|
|
||||||
|
const defaultProps = {
|
||||||
|
label: "scriptTypeName",
|
||||||
children: "children",
|
children: "children",
|
||||||
label: "name",
|
|
||||||
pid: "pid",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const monitorIdxList = [
|
|
||||||
{
|
|
||||||
value: '1',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '2',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '3',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '4',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
const handleNodeClick = (data) => {
|
|
||||||
console.log(data);
|
|
||||||
};
|
|
||||||
const MonIsShow = ref(false)
|
|
||||||
const DevIsShow = ref(false)
|
|
||||||
const IsPasswordShow = ref(false)
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
// 定义弹出组件元信息
|
const checkStore = useCheckStore()
|
||||||
const dialogFormRef = ref()
|
|
||||||
const disabledDate = (time: Date) => {
|
const visible = ref(false)
|
||||||
return time.getTime() > Date.now()
|
const treeRef = ref()
|
||||||
|
const searchValue = ref<string>('')
|
||||||
|
watch(searchValue, (val) => {
|
||||||
|
treeRef.value!.filter(val)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 格式化数字
|
||||||
|
const fixed = 4;
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const formContent = reactive<CheckData.DataCheck>({
|
||||||
|
scriptName: '',
|
||||||
|
errorSysName: '',
|
||||||
|
dataRule: '',
|
||||||
|
deviceName: '',
|
||||||
|
chnNum: '',
|
||||||
|
})
|
||||||
|
// 当前选中的谐波次数
|
||||||
|
// const currentHarmNum = ref<string>("-1")
|
||||||
|
// 谐波次数列表
|
||||||
|
// const harmNumList = reactive<{ value: string, label: string }[]>([])
|
||||||
|
// 当前选中的检测项
|
||||||
|
const currentCheckItem = ref<string>("")
|
||||||
|
// 检测项列表
|
||||||
|
const checkList = reactive<{ value: string, label: string }[]>([])
|
||||||
|
|
||||||
|
let deviceId: string = ''
|
||||||
|
let originScriptType: string | null = null
|
||||||
|
let scriptType: string | null = null
|
||||||
|
|
||||||
|
// 通道下拉列表
|
||||||
|
let chnList: any[] = []
|
||||||
|
|
||||||
|
|
||||||
|
// 左侧树数据
|
||||||
|
const treeDataAll = reactive<CheckData.TreeItem[]>([])
|
||||||
|
|
||||||
|
// 左侧树被选中的叶子节点id
|
||||||
|
const checkIndex = ref<string>('')
|
||||||
|
|
||||||
|
// 当前检测项目名称
|
||||||
|
const currentScriptTypeName = ref('')
|
||||||
|
// 当前检测项目描述
|
||||||
|
const currentDesc = ref('');
|
||||||
|
// 右侧Tab选中项
|
||||||
|
const activeTab = ref<string>('resultTab')
|
||||||
|
|
||||||
|
//存放相应的表格数据
|
||||||
|
let resTableData: { resultData: Map<string, any>, rawData: Map<string, any> } = {resultData: new Map(), rawData: new Map()}
|
||||||
|
|
||||||
|
// 检测结果表格数据
|
||||||
|
const checkResultData = reactive<CheckData.CheckResult[]>([])
|
||||||
|
|
||||||
|
const popoverWidth: ComputedRef<string> = computed(() => {
|
||||||
|
// return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (harmNumList.length || checkList.length ? 160 : 0)}px`
|
||||||
|
return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (checkList.length ? 220 : 0)}px`
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 原始数据表格数据
|
||||||
|
const rawTableData = reactive<CheckData.RawDataItem[]>([])
|
||||||
|
|
||||||
|
// 左侧树默认展开节点id
|
||||||
|
let defaultExpandedKeys: string[] = []
|
||||||
|
|
||||||
|
const filterNode = (value: string, data: any) => {
|
||||||
|
if (!value) return true
|
||||||
|
return data.scriptTypeName.includes(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<{
|
// 点击左侧树节点触发事件
|
||||||
visible: boolean;
|
const handleNodeClick = async (data: any) => {
|
||||||
}>();
|
if (!data.children) {
|
||||||
|
checkIndex.value = data.index
|
||||||
|
currentScriptTypeName.value = data.scriptTypeName
|
||||||
|
currentDesc.value = data.sourceDesc
|
||||||
|
scriptType = data.scriptType ?? scriptType
|
||||||
|
|
||||||
const emit = defineEmits<{
|
if (checkIndex.value) {
|
||||||
(e: 'update:visible', value: boolean): void;
|
await updateTableData()
|
||||||
(e: 'submit', data: any): void;
|
activeTab.value = 'resultTab'
|
||||||
}>();
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleCancel = () => {
|
watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||||
emit('update:visible', false); // 关闭对话框
|
// console.log("通道号", newVal);
|
||||||
};
|
|
||||||
|
if (newVal) {
|
||||||
|
// 发起请求,查询该测试项的检测结果
|
||||||
|
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
|
||||||
|
scriptId: checkStore.scriptId,
|
||||||
|
devId: deviceId,
|
||||||
|
devNum: formContent.chnNum + '',
|
||||||
|
scriptType: originScriptType,
|
||||||
|
code: parseInt(checkStore.planCode)
|
||||||
|
})
|
||||||
|
updateTreeFly(resTreeDataTemp, 4)
|
||||||
|
updateTreeFly(resTreeDataTemp, 2)
|
||||||
|
|
||||||
|
treeDataAll.length = 0
|
||||||
|
|
||||||
|
Object.assign(treeDataAll, resTreeDataTemp)
|
||||||
|
|
||||||
|
defaultOperate()
|
||||||
|
await updateTableData()
|
||||||
|
}
|
||||||
|
activeTab.value = 'resultTab'
|
||||||
|
})
|
||||||
|
|
||||||
|
// watch(currentHarmNum, (newVal, oldVal) => {
|
||||||
|
// console.log("谐波次数", newVal);
|
||||||
|
// if (newVal !== '-1') {
|
||||||
|
// let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal.toString())
|
||||||
|
// setCheckResultData(resCheckResult)
|
||||||
|
//
|
||||||
|
// let tempRawData = resTableData.rawData.get(newVal.toString())
|
||||||
|
// if (tempRawData) {
|
||||||
|
// setRawData(tempRawData)
|
||||||
|
// } else {
|
||||||
|
// setRawData([])
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// activeTab.value = 'resultTab'
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
||||||
|
watch(currentCheckItem, (newVal, oldVal) => {
|
||||||
|
console.log("当前检测项", newVal);
|
||||||
|
if (newVal) {
|
||||||
|
doCurrentCheckItemUpdate(newVal)
|
||||||
|
} else {
|
||||||
|
activeTab.value = 'resultTab'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 默认操作
|
||||||
|
const defaultOperate = () => {
|
||||||
|
let node = getDefaultNode(treeDataAll)
|
||||||
|
|
||||||
|
if (node) {
|
||||||
|
currentScriptTypeName.value = node.scriptTypeName
|
||||||
|
currentDesc.value = node.sourceDesc
|
||||||
|
checkIndex.value = node.index
|
||||||
|
defaultExpandedKeys = [node.index]
|
||||||
|
|
||||||
|
treeRef.value?.setCurrentKey(node.index);
|
||||||
|
scriptType = node.scriptType ?? scriptType
|
||||||
|
} else {
|
||||||
|
currentScriptTypeName.value = ''
|
||||||
|
currentDesc.value = ''
|
||||||
|
checkIndex.value = ''
|
||||||
|
defaultExpandedKeys = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateTableData = async () => {
|
||||||
|
// console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
||||||
|
if (checkIndex.value) {
|
||||||
|
// console.log("更新表格数据");
|
||||||
|
// 发起请求,查询该测试项的检测结果
|
||||||
|
const {data} = await getTableData({
|
||||||
|
scriptType,
|
||||||
|
scriptId: checkStore.scriptId,
|
||||||
|
devId: deviceId,
|
||||||
|
devNum: formContent.chnNum + '',
|
||||||
|
code: parseInt(checkStore.planCode),
|
||||||
|
index: parseInt(checkIndex.value),
|
||||||
|
})
|
||||||
|
|
||||||
|
let keys1 = Object.keys(data.resultData)
|
||||||
|
let resultData = new Map()
|
||||||
|
for (let key of keys1) {
|
||||||
|
resultData.set(key, data.resultData[key])
|
||||||
|
}
|
||||||
|
|
||||||
|
let keys2 = Object.keys(data.rawData)
|
||||||
|
let rawData = new Map()
|
||||||
|
for (let key of keys2) {
|
||||||
|
rawData.set(key, data.rawData[key])
|
||||||
|
}
|
||||||
|
|
||||||
|
resTableData = {
|
||||||
|
resultData,
|
||||||
|
rawData
|
||||||
|
}
|
||||||
|
|
||||||
|
let resCheckResult: CheckData.ResCheckResult = {}
|
||||||
|
let resRawData: CheckData.RawDataItem[] = []
|
||||||
|
|
||||||
|
if (keys1.length === 0) {
|
||||||
|
checkList.length = 0
|
||||||
|
checkResultData.length = 0
|
||||||
|
rawTableData.length = 0
|
||||||
|
currentCheckItem.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keys1.length === 1) {
|
||||||
|
resCheckResult = resTableData.resultData.get(keys1[0])
|
||||||
|
resRawData = resTableData.rawData.get(keys2[0])
|
||||||
|
|
||||||
|
resRawData = (resRawData == null || resRawData == undefined ? [] : resRawData)
|
||||||
|
resCheckResult = (resCheckResult == null || resCheckResult == undefined ? {} : resCheckResult)
|
||||||
|
setCheckResultData(resCheckResult)
|
||||||
|
setRawData(resRawData)
|
||||||
|
checkList.length = 0
|
||||||
|
currentCheckItem.value = ''
|
||||||
|
} else if (keys1.length != 0) {
|
||||||
|
let tempCheckList = []
|
||||||
|
for (let [key, value] of resTableData.resultData) {
|
||||||
|
let hum = formatHarmNum(key)
|
||||||
|
tempCheckList.push({
|
||||||
|
value: key,
|
||||||
|
label: value.isData === 1 ? hum : value.isData === 4 ? `${hum}(/)` : `${hum}(不符合)`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
toAngleLast(tempCheckList)
|
||||||
|
checkList.length = 0
|
||||||
|
Object.assign(checkList, tempCheckList)
|
||||||
|
|
||||||
|
if (currentCheckItem.value == tempCheckList[0].value) {
|
||||||
|
doCurrentCheckItemUpdate(tempCheckList[0].value)
|
||||||
|
} else {
|
||||||
|
currentCheckItem.value = tempCheckList[0].value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// setCheckResultData(resCheckResult)
|
||||||
|
else {
|
||||||
|
checkResultData.length = 0
|
||||||
|
rawTableData.length = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const doCurrentCheckItemUpdate = (newVal: string) => {
|
||||||
|
let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal)
|
||||||
|
setCheckResultData(resCheckResult)
|
||||||
|
|
||||||
|
let tempRawData = resTableData.rawData.get(newVal)
|
||||||
|
if (tempRawData) {
|
||||||
|
setRawData(tempRawData)
|
||||||
|
} else {
|
||||||
|
setRawData([])
|
||||||
|
}
|
||||||
|
|
||||||
|
activeTab.value = 'resultTab'
|
||||||
|
}
|
||||||
|
|
||||||
|
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
|
||||||
|
deviceId = _deviceId
|
||||||
|
originScriptType = _scriptType
|
||||||
|
scriptType = _scriptType
|
||||||
|
|
||||||
|
// 发起后端请求,查询详细信息 当chnNum为-1时,查询所有通道号
|
||||||
|
const {data: resFormContent}: { data: any } = await getFormData({
|
||||||
|
planId: checkStore.planId,
|
||||||
|
deviceId,
|
||||||
|
chnNum,
|
||||||
|
scriptType
|
||||||
|
})
|
||||||
|
|
||||||
|
chnList = resFormContent.chnList.map((item: { value: string, label: string }) => ({
|
||||||
|
value: item.value,
|
||||||
|
// label: item.value
|
||||||
|
label: item.label == '1' ? `${item.value}` : item.label == '2' ? `${item.value}(不符合)` : `${item.value}`
|
||||||
|
}))
|
||||||
|
|
||||||
|
let dataRuleName = dictStore.getDictData('Data_Rule').find(item => item.id == resFormContent.dataRule)?.name
|
||||||
|
|
||||||
|
Object.assign(formContent, {
|
||||||
|
...resFormContent,
|
||||||
|
dataRule: dataRuleName,
|
||||||
|
chnNum: chnList.length > 0 ? chnList[0].value : '',
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
visible.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const close = () => {
|
||||||
|
//数据清空
|
||||||
|
Object.assign(formContent, {
|
||||||
|
scriptName: '',
|
||||||
|
errorSysName: '',
|
||||||
|
dataRule: '',
|
||||||
|
deviceName: '',
|
||||||
|
chnNum: '',
|
||||||
|
})
|
||||||
|
treeDataAll.length = 0
|
||||||
|
// harmNumList.length = 0
|
||||||
|
// currentHarmNum.value = '-1'
|
||||||
|
currentCheckItem.value = ''
|
||||||
|
checkResultData.length = 0
|
||||||
|
rawTableData.length = 0
|
||||||
|
checkList.length = 0
|
||||||
|
defaultExpandedKeys = []
|
||||||
|
checkIndex.value = ''
|
||||||
|
activeTab.value = 'resultTab'
|
||||||
|
currentScriptTypeName.value = ''
|
||||||
|
currentDesc.value = ''
|
||||||
|
|
||||||
|
visible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||||
|
// console.log("检测结果", data);
|
||||||
|
let result: CheckData.CheckResult[] = []
|
||||||
|
if (data == null || data == undefined) {
|
||||||
|
Object.assign(checkResultData, [])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data.dataA != null && data.dataB != null && data.dataC != null) {
|
||||||
|
result.push({
|
||||||
|
stdA: numberToFixed(data.dataA.resultData),
|
||||||
|
dataA: numberToFixed(data.dataA.data),
|
||||||
|
errorA: getError(data.dataA.resultData, data.dataA.data),
|
||||||
|
maxErrorA: toMaxErrorStr(data.dataA.radius, data.unit),
|
||||||
|
isDataA: data.dataA.isData,
|
||||||
|
stdB: numberToFixed(data.dataB.resultData),
|
||||||
|
dataB: numberToFixed(data.dataB.data),
|
||||||
|
errorB: getError(data.dataB.resultData, data.dataB.data),
|
||||||
|
maxErrorB: toMaxErrorStr(data.dataB.radius, data.unit),
|
||||||
|
isDataB: data.dataB.isData,
|
||||||
|
stdC: numberToFixed(data.dataC.resultData),
|
||||||
|
dataC: numberToFixed(data.dataC.data),
|
||||||
|
errorC: getError(data.dataC.resultData, data.dataC.data),
|
||||||
|
maxErrorC: toMaxErrorStr(data.dataC.radius, data.unit),
|
||||||
|
isDataC: data.dataC.isData,
|
||||||
|
|
||||||
|
maxError: data.radius,
|
||||||
|
unit: data.unit,
|
||||||
|
result: data.isData,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.dataT != null) {
|
||||||
|
result.push({
|
||||||
|
stdT: numberToFixed(data.dataT.resultData),
|
||||||
|
dataT: numberToFixed(data.dataT.data),
|
||||||
|
errorT: getError(data.dataT.resultData, data.dataT.data),
|
||||||
|
maxErrorT: toMaxErrorStr(data.dataT.radius, data.unit),
|
||||||
|
isDataT: data.dataT?.isData,
|
||||||
|
|
||||||
|
maxError: data.radius,
|
||||||
|
unit: data.unit,
|
||||||
|
result: data.isData,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Object.assign(checkResultData, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
const exportRawDataHandler = () => {
|
||||||
|
useDownload(exportRawData, '原始数据.xlsx', {
|
||||||
|
scriptType,
|
||||||
|
scriptId: checkStore.scriptId,
|
||||||
|
devId: deviceId,
|
||||||
|
devNum: formContent.chnNum + '',
|
||||||
|
code: parseInt(checkStore.planCode),
|
||||||
|
index: parseInt(checkIndex.value),
|
||||||
|
}, false, '.xlsx')
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatHarmNum = (num: string) => {
|
||||||
|
// debugger
|
||||||
|
if (num.includes('.5')) {
|
||||||
|
return num
|
||||||
|
} else {
|
||||||
|
num = num.replace('.0', '')
|
||||||
|
return num
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const setRawData = (data: CheckData.RawDataItem[]) => {
|
||||||
|
data.forEach((item: CheckData.RawDataItem) => {
|
||||||
|
item.dataA = stringToFixed(item.dataA)
|
||||||
|
item.dataB = stringToFixed(item.dataB)
|
||||||
|
item.dataC = stringToFixed(item.dataC)
|
||||||
|
item.dataT = stringToFixed(item.dataT)
|
||||||
|
})
|
||||||
|
Object.assign(rawTableData, data)
|
||||||
|
console.log("原始数据", rawTableData)
|
||||||
|
}
|
||||||
|
|
||||||
|
const numberToFixed = (num: number): string => {
|
||||||
|
if (num == null || num == undefined) {
|
||||||
|
return '/'
|
||||||
|
} else {
|
||||||
|
let result = num.toFixed(fixed)
|
||||||
|
if (result === "-0.0000") {
|
||||||
|
return result.replace(/-/g, "")
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const stringToFixed = (str: string): string => {
|
||||||
|
if (str == null || str == undefined) {
|
||||||
|
return '/'
|
||||||
|
} else {
|
||||||
|
let num = Number(str)
|
||||||
|
if (isNaN(num)) {
|
||||||
|
return '/'
|
||||||
|
} else {
|
||||||
|
let result = num.toFixed(fixed)
|
||||||
|
if (result === "-0.0000") {
|
||||||
|
return result.replace(/-/g, "")
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getError = (num1: number, num2: number): string => {
|
||||||
|
if (num1 == null || num1 == undefined || num2 == null || num2 == undefined) {
|
||||||
|
return '/'
|
||||||
|
}
|
||||||
|
return Math.abs(Number(numberToFixed(num1)) - Number(numberToFixed(num2))).toFixed(fixed)
|
||||||
|
}
|
||||||
|
|
||||||
|
const toMaxErrorStr = (oldMaxErroe: any, unit: any) => {
|
||||||
|
let result = oldMaxErroe ?? '/'
|
||||||
|
let idx = result.indexOf('~');
|
||||||
|
if (idx > 0) {
|
||||||
|
let left = result.substring(0, idx)
|
||||||
|
let right = result.substring(idx, result.length)
|
||||||
|
result = left + unit + right + unit;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
const findFirstLeafNode = (node: any): any => {
|
||||||
|
if (!node.children || node.children.length === 0) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
return findFirstLeafNode(node.children[0]);
|
||||||
|
}
|
||||||
|
const getDefaultNode = (data: any[]) => {
|
||||||
|
if (!data || data.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const firstElement = data[0];
|
||||||
|
|
||||||
|
return findFirstLeafNode(firstElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
const toAngleLast = (data: any[]) => {
|
||||||
|
let angleIndex = -1
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
if (data[i].value.toString().includes('相角')) {
|
||||||
|
angleIndex = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (angleIndex != -1) {
|
||||||
|
let temp = data[angleIndex]
|
||||||
|
data.splice(angleIndex, 1)
|
||||||
|
data.push(temp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fly: 1合格 2不合格 4数据错误
|
||||||
|
const filterTree = (treeData: any[], fly: number): any[] => {
|
||||||
|
if (!treeData || treeData.length === 0) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
filter(treeData, fly)
|
||||||
|
return treeData
|
||||||
|
}
|
||||||
|
|
||||||
|
const filter = (treeData: any[], fly: number) => {
|
||||||
|
for (let i = treeData.length - 1; i >= 0; i--) {
|
||||||
|
let node = treeData[i]
|
||||||
|
if (node.fly !== fly) {
|
||||||
|
if (node.children && node.children.length > 0) {
|
||||||
|
filter(node.children, fly)
|
||||||
|
// 检查 children 是否被全部移除
|
||||||
|
if (node.children.length === 0) {
|
||||||
|
treeData.splice(i, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
treeData.splice(i, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateTreeFly = (treeData: any[], fly: number) => {
|
||||||
|
// 递归函数
|
||||||
|
function recursiveUpdate(node: any, targetFly: number) {
|
||||||
|
//if (!node) return false; // 如果节点不存在,返回 false
|
||||||
|
|
||||||
|
// 如果当前节点是叶子节点且 fly 字段等于 targetFly
|
||||||
|
if (!node.children || node.children.length === 0) {
|
||||||
|
if (node.fly === targetFly) {
|
||||||
|
node.fly = targetFly; // 确保叶子节点的 fly 字段被设置为 targetFly
|
||||||
|
return true; // 返回 true 表示找到并更新了
|
||||||
|
}
|
||||||
|
return false; // 否则返回 false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 递归更新子节点
|
||||||
|
let updated = false;
|
||||||
|
for (let child of node.children) {
|
||||||
|
if (recursiveUpdate(child, targetFly)) {
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果有子节点被更新了,则更新当前节点的 fly 字段
|
||||||
|
if (updated) {
|
||||||
|
node.fly = targetFly;
|
||||||
|
}
|
||||||
|
return updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < treeData.length; i++) {
|
||||||
|
// 调用递归函数从根节点开始更新
|
||||||
|
recursiveUpdate(treeData[i], fly);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
.data-check-dialog{
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
.dialog {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow-y: hidden;
|
||||||
|
overflow-x: hidden;
|
||||||
|
|
||||||
|
|
||||||
|
.data-check-dialog {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 100%;
|
overflow-y: hidden;
|
||||||
}
|
|
||||||
|
|
||||||
.data-check-title{
|
.data-check-head {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
margin-top: 5px;
|
width: 100%;
|
||||||
width: 100%;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.data-check-content{
|
.data-check-body {
|
||||||
display: flex;
|
height: 500px;
|
||||||
flex-direction: row;
|
width: 100%;
|
||||||
width: 100%;
|
display: flex;
|
||||||
}
|
flex-direction: row;
|
||||||
|
|
||||||
.content-right{
|
.content-left-tree {
|
||||||
width: 100%;
|
width: 18%;
|
||||||
}
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
max-height: 495px;
|
||||||
|
|
||||||
.content-right-title{
|
padding: 10px 0.5% 0px 0.5%;
|
||||||
margin-bottom: 10px;
|
border: 1px solid #ccc;
|
||||||
}
|
overflow-y: auto;
|
||||||
|
overflow-x: auto;
|
||||||
|
|
||||||
.content-right-Tabs{
|
.content-tree {
|
||||||
box-sizing: border-box;
|
width: 100%;
|
||||||
margin-top: 20px;
|
height: 100%;
|
||||||
margin-bottom: 10px;
|
margin-top: 10px;
|
||||||
max-height: 400px;
|
|
||||||
|
.custom-tree-node {
|
||||||
|
overflow-x: hidden !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
text-overflow: ellipsis !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-right {
|
||||||
|
width: 82%;
|
||||||
|
margin-left: 10px;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.content-right-title {
|
||||||
|
display: flex;
|
||||||
|
padding: 10px 0;
|
||||||
|
margin-top: 10px;
|
||||||
|
line-height: 1.5;
|
||||||
|
|
||||||
|
.content-right-title-text {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//.el-divider--horizontal {
|
||||||
|
// //margin-top: 0px;
|
||||||
|
// margin-bottom: 5px;
|
||||||
|
// height: 20px;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//.content-right-title-desc {
|
||||||
|
// font-size: 16px;
|
||||||
|
// height: 48px;
|
||||||
|
// max-height: 48px;
|
||||||
|
// overflow-y: auto;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-right-Tabs {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
max-height: 400px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<!--<style lang="scss">-->
|
||||||
|
<!--.el-popover.popover-class {-->
|
||||||
|
<!-- .el-popover__title {-->
|
||||||
|
<!-- color: #fff;-->
|
||||||
|
<!-- background-color: #003078 !important;-->
|
||||||
|
<!-- }-->
|
||||||
|
<!--}-->
|
||||||
|
<!--</style>-->
|
||||||
@@ -1,131 +1,139 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="预检测项目:">
|
<el-tab-pane label="预检测项目">
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<el-checkbox
|
<el-checkbox v-for="(item, index) in detectionOptions" v-model="item.selected" :key="index"
|
||||||
v-for="(item, index) in detectionOptions"
|
:label="item.name"></el-checkbox>
|
||||||
v-model="item.selected"
|
<!-- disabled="true" -->
|
||||||
:key="index"
|
</div>
|
||||||
:label="item.name"
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
></el-checkbox
|
|
||||||
>
|
|
||||||
<!-- disabled="true" -->
|
|
||||||
</div>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
|
|
||||||
<div class = "test-dialog">
|
<div class="test-dialog">
|
||||||
<div class="dialog-left">
|
<div class="dialog-left">
|
||||||
<el-steps direction="vertical" :active="activeIndex" :process-status="currentStepStatus" finish-status="success">
|
<el-steps direction="vertical" :active="activeIndex" :process-status="currentStepStatus"
|
||||||
<el-step title="源通讯校验" />
|
finish-status="success">
|
||||||
<el-step title="设备通讯校验" />
|
<el-step :status="step1" title="源通讯校验"/>
|
||||||
<el-step title="协议校验" />
|
<el-step :status="step2" title="设备通讯校验"/>
|
||||||
<el-step title="相序校验" />
|
<el-step :status="step3" title="协议校验"/>
|
||||||
<el-step title="检测完成" />
|
<el-step :status="step4" title="相序校验"/>
|
||||||
</el-steps>
|
<el-step :status="step5" title="检测完成"/>
|
||||||
</div>
|
</el-steps>
|
||||||
<div class="dialog-right">
|
</div>
|
||||||
|
<div class="dialog-right">
|
||||||
<el-collapse v-model="collapseActiveName" accordion>
|
<el-collapse v-model="collapseActiveName" accordion>
|
||||||
<el-collapse-item title="源通讯校验" name="1">
|
<el-collapse-item title="源通讯校验" name="1">
|
||||||
<div class = "div-log">
|
<div class="div-log">
|
||||||
<p v-for="(item, index) in step1InitLog" :key="index" :style="{color:item.type==='error'?'#F56C6C':'var(--el-text-color-regular)'}">
|
<p v-for="(item, index) in step1InitLog" :key="index"
|
||||||
{{ item.log }} <br />
|
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||||
</p>
|
{{ item.log }} <br/>
|
||||||
</div>
|
</p>
|
||||||
</el-collapse-item>
|
</div>
|
||||||
<el-collapse-item title="设备通讯校验" name="2">
|
</el-collapse-item>
|
||||||
<div class = "div-log">
|
<el-collapse-item title="设备通讯校验" name="2">
|
||||||
<p v-for="(item, index) in step2InitLog" :key="index" :style="{color:item.type==='error'?'#F56C6C':'var(--el-text-color-regular)'}">
|
<div class="div-log">
|
||||||
{{ item.log }} <br />
|
<p v-for="(item, index) in step2InitLog" :key="index"
|
||||||
</p>
|
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||||
</div>
|
{{ item.log }} <br/>
|
||||||
</el-collapse-item>
|
</p>
|
||||||
<el-collapse-item title="协议校验" name="3">
|
</div>
|
||||||
<div class = "div-log">
|
</el-collapse-item>
|
||||||
<p v-for="(item, index) in step3InitLog" :key="index" :style="{color:item.type==='error'?'#F56C6C':'var(--el-text-color-regular)'}">
|
<el-collapse-item title="协议校验" name="3">
|
||||||
{{ item.log }} <br />
|
<div class="div-log">
|
||||||
</p>
|
<p v-for="(item, index) in step3InitLog" :key="index"
|
||||||
</div>
|
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||||
</el-collapse-item>
|
{{ item.log }} <br/>
|
||||||
<el-collapse-item title="相序校验" name="4">
|
</p>
|
||||||
<div class = "div-log">
|
</div>
|
||||||
<p v-for="(item, index) in step4InitLog" :key="index" :style="{color:item.type==='error'?'#F56C6C':'var(--el-text-color-regular)'}">
|
</el-collapse-item>
|
||||||
{{ item.log }} <br />
|
<el-collapse-item title="相序校验" name="4">
|
||||||
</p>
|
<div class="div-log">
|
||||||
</div>
|
<p v-for="(item, index) in step4InitLog" :key="index"
|
||||||
</el-collapse-item>
|
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
|
||||||
|
{{ item.log.split('&&')[0] }}
|
||||||
|
<br v-if="item.log.includes('&&')"/>
|
||||||
|
{{ item.log.split('&&')[1] }}
|
||||||
|
|
||||||
|
<br v-if="item.log.includes('&&')"/>
|
||||||
|
{{ item.log.split('&&')[2] }}
|
||||||
|
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</el-collapse-item>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup name="preTest">
|
<script lang="tsx" setup name="preTest">
|
||||||
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
|
import {defineExpose} from 'vue';
|
||||||
|
|
||||||
const step1InitLog = ref([
|
const step1InitLog = ref([
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'暂无数据,等待检测开始',
|
log: '暂无数据,等待检测开始',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
const step1Log = ref([
|
const step1Log = ref([
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'源通讯校验成功',
|
log: '源通讯校验成功',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
const step2InitLog = ref([
|
const step2InitLog = ref([
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'暂无数据,等待检测开始',
|
log: '暂无数据,等待检测开始',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
const step2Log = ref([
|
const step2Log = ref([
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备1通讯校验成功',
|
log: '被检设备:240001通讯校验成功',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备2通讯校验成功',
|
log: '被检设备:240002通讯校验成功',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备3通讯校验成功',
|
log: '被检设备:240003通讯校验成功',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备4通讯校验成功',
|
log: '被检设备:240004通讯校验成功',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
const step3InitLog = ref([
|
const step3InitLog = ref([
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'暂无数据,等待检测开始',
|
log: '暂无数据,等待检测开始',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
const step3Log = ref([
|
const step3Log = ref([
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备1协议校验成功',
|
log: '被检设备:240001协议校验成功',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备2协议校验成功',
|
log: '被检设备:240002协议校验成功',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备3协议校验成功',
|
log: '被检设备:240003协议校验成功',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备4协议校验成功',
|
log: '被检设备:240004协议校验成功',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -133,32 +141,38 @@ const step3Log = ref([
|
|||||||
const step4InitLog = ref([
|
const step4InitLog = ref([
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'暂无数据,等待检测开始',
|
log: '暂无数据,等待检测开始',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
const step4Log = ref([
|
const step4Log = ref([
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备1相序校验成功',
|
log: '被检设备:240001相序校验成功',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备2相序校验成功',
|
log: '被检设备:240002相序校验成功',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备3相序校验成功',
|
log: '被检设备:240003相序校验成功',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log:'被检设备4相序校验成功',
|
log: '被检设备:240004相序校验成功',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
const collapseActiveName = ref('1')
|
const collapseActiveName = ref('1')
|
||||||
const activeIndex = ref(0)
|
const activeIndex = ref(0)
|
||||||
const activeTotalNum = ref(5)
|
const activeTotalNum = ref(5)
|
||||||
|
const step1 = ref('wait')
|
||||||
|
const step2 = ref('wait')
|
||||||
|
const step3 = ref('wait')
|
||||||
|
const step4 = ref('wait')
|
||||||
|
const step5 = ref('wait')
|
||||||
|
|
||||||
//定义与预检测配置数组
|
//定义与预检测配置数组
|
||||||
const detectionOptions = ref([
|
const detectionOptions = ref([
|
||||||
{
|
{
|
||||||
@@ -181,16 +195,16 @@ const detectionOptions = ref([
|
|||||||
name: "相序校验",//判断装置的接线是否正确
|
name: "相序校验",//判断装置的接线是否正确
|
||||||
selected: true,
|
selected: true,
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// id: 4,
|
// id: 4,
|
||||||
// name: "守时校验",//判断装置24小时内的守时误差是否小于1s
|
// name: "守时校验",//判断装置24小时内的守时误差是否小于1s
|
||||||
// selected: true,
|
// selected: true,
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// id: 5,
|
// id: 5,
|
||||||
// name: "通道系数校准",//通过私有协议与装置进行通讯,校准三相电压电流的通道系数
|
// name: "通道系数校准",//通过私有协议与装置进行通讯,校准三相电压电流的通道系数
|
||||||
// selected: true,
|
// selected: true,
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// id: 6,
|
// id: 6,
|
||||||
// name: "实时数据比对",
|
// name: "实时数据比对",
|
||||||
@@ -203,65 +217,362 @@ const detectionOptions = ref([
|
|||||||
|
|
||||||
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
testStatus: {
|
testStatus: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'wait'
|
default: 'wait'
|
||||||
|
},
|
||||||
|
webMsgSend: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
const testStatus = toRef(props, 'testStatus');
|
const testStatus = toRef(props, 'testStatus');
|
||||||
|
const webMsgSend = toRef(props, 'webMsgSend');
|
||||||
const ts = ref('');
|
const ts = ref('');
|
||||||
|
|
||||||
watch(activeIndex, function (newValue, oldValue) {
|
watch(webMsgSend, function (newValue, oldValue) {
|
||||||
|
// console.log(newValue)
|
||||||
|
|
||||||
if(activeIndex.value === 1)
|
switch (newValue.requestId) {
|
||||||
{
|
case 'yjc_ytxjy':
|
||||||
step1InitLog.value.length = 0;
|
switch (newValue.operateCode) {
|
||||||
step1InitLog.value = step1Log.value;
|
case 'INIT_GATHER':
|
||||||
|
if (newValue.code == 10200) {
|
||||||
|
step1InitLog.value.push({
|
||||||
|
type: 'info',
|
||||||
|
log: '源初始化成功!',
|
||||||
|
})
|
||||||
|
activeIndex.value = 1
|
||||||
|
step1.value = 'success'
|
||||||
|
step2.value = 'process'
|
||||||
|
} else if (newValue.code == 10201) {
|
||||||
|
step1.value = 'process'
|
||||||
|
step1InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '正在进行源初始化!',
|
||||||
|
}];
|
||||||
|
} else if (newValue.code == 10552) {
|
||||||
|
ElMessage.error(newValue.code)
|
||||||
|
step1.value = 'error'
|
||||||
|
ts.value = 'error'
|
||||||
|
} else if (newValue.code == 10523) {
|
||||||
|
step1.value = 'error'
|
||||||
|
ts.value = 'error'
|
||||||
|
step1InitLog.value = [{
|
||||||
|
type: 'error',
|
||||||
|
log: '源连接失败!',
|
||||||
|
}];
|
||||||
|
} else if (newValue.code == -1) {
|
||||||
|
step1.value = 'error'
|
||||||
|
ts.value = 'error'
|
||||||
|
step1InitLog.value = [{
|
||||||
|
type: 'error',
|
||||||
|
log: '源未知异常!',
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'yjc_sbtxjy':
|
||||||
|
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'INIT_GATHER$01':
|
||||||
|
if (newValue.code == 10200) {
|
||||||
|
step2InitLog.value.push({
|
||||||
|
type: 'info',
|
||||||
|
log: newValue.data + '设备通讯校验成功!',
|
||||||
|
})
|
||||||
|
|
||||||
|
} else if (newValue.code == 10201) {
|
||||||
|
step2.value = 'process'
|
||||||
|
step2InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '正在进行设备通讯校验.....',
|
||||||
|
}];
|
||||||
|
} else if (newValue.code == 10550) {
|
||||||
|
step2InitLog.value.push({
|
||||||
|
type: 'error',
|
||||||
|
log: newValue.data + '设备连接异常!',
|
||||||
|
})
|
||||||
|
step2.value = 'error'
|
||||||
|
// ts.value = 'error'
|
||||||
|
} else if (newValue.code == 10551) {
|
||||||
|
step2InitLog.value.push({
|
||||||
|
type: 'error',
|
||||||
|
log: newValue.data + '设备触发报告异常!',
|
||||||
|
})
|
||||||
|
step2.value = 'error'
|
||||||
|
ts.value = 'error'
|
||||||
|
} else if (newValue.code == 10552) {
|
||||||
|
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||||
|
step2InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||||
|
}];
|
||||||
|
step2.value = 'error'
|
||||||
|
ts.value = 'error'
|
||||||
|
} else if (newValue.code == 25001) {
|
||||||
|
activeIndex.value = 2
|
||||||
|
step2.value = 'success'
|
||||||
|
step3.value = 'process'
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'yjc_xyjy':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'INIT_GATHER$01':
|
||||||
|
if (newValue.code == 10200) {
|
||||||
|
step3InitLog.value.push({
|
||||||
|
type: 'info',
|
||||||
|
log: '统计数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||||
|
})
|
||||||
|
|
||||||
|
} else if (newValue.code == 10201) {
|
||||||
|
step3.value = 'process'
|
||||||
|
step3InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '正在进行通讯协议校验.....',
|
||||||
|
}];
|
||||||
|
} else if (newValue.code == 10550) {
|
||||||
|
step3InitLog.value.push({
|
||||||
|
type: 'error',
|
||||||
|
log: newValue.data + '设备连接异常!',
|
||||||
|
})
|
||||||
|
step3.value = 'error'
|
||||||
|
// ts.value = 'error'
|
||||||
|
} else if (newValue.code == 10551) {
|
||||||
|
step3InitLog.value.push({
|
||||||
|
type: 'error',
|
||||||
|
log: newValue.data + '设备触发报告异常!',
|
||||||
|
})
|
||||||
|
step3.value = 'error'
|
||||||
|
ts.value = 'error'
|
||||||
|
} else if (newValue.code == 10552) {
|
||||||
|
step3.value = 'error'
|
||||||
|
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||||
|
step3InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||||
|
}];
|
||||||
|
ts.value = 'error'
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'INIT_GATHER$02':
|
||||||
|
if (newValue.code == 10200) {
|
||||||
|
step3InitLog.value.push({
|
||||||
|
type: 'info',
|
||||||
|
log: '实时数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||||
|
})
|
||||||
|
|
||||||
|
} else if (newValue.code == 10201) {
|
||||||
|
step3.value = 'process'
|
||||||
|
step3InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '正在进行通讯协议校验.....',
|
||||||
|
}];
|
||||||
|
} else if (newValue.code == 10550) {
|
||||||
|
step3InitLog.value.push({
|
||||||
|
type: 'error',
|
||||||
|
log: newValue.data + '设备连接异常!',
|
||||||
|
})
|
||||||
|
step3.value = 'error'
|
||||||
|
// ts.value = 'error'
|
||||||
|
} else if (newValue.code == 10551) {
|
||||||
|
step3InitLog.value.push({
|
||||||
|
type: 'error',
|
||||||
|
log: newValue.data + '设备触发报告异常!',
|
||||||
|
})
|
||||||
|
step3.value = 'error'
|
||||||
|
ts.value = 'error'
|
||||||
|
} else if (newValue.code == 10552) {
|
||||||
|
step3.value = 'error'
|
||||||
|
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||||
|
step3InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||||
|
}];
|
||||||
|
ts.value = 'error'
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'INIT_GATHER$03':
|
||||||
|
if (newValue.code == 10200) {
|
||||||
|
step3InitLog.value.push({
|
||||||
|
type: 'info',
|
||||||
|
log: '暂态数据协议校验:' + newValue.data + '通讯协议校验成功!',
|
||||||
|
})
|
||||||
|
|
||||||
|
} else if (newValue.code == 10201) {
|
||||||
|
step3.value = 'process'
|
||||||
|
} else if (newValue.code == 10550) {
|
||||||
|
step3InitLog.value.push({
|
||||||
|
type: 'error',
|
||||||
|
log: newValue.data + '设备连接异常!',
|
||||||
|
})
|
||||||
|
step3.value = 'error'
|
||||||
|
// ts.value = 'error'
|
||||||
|
} else if (newValue.code == 10551) {
|
||||||
|
step3InitLog.value.push({
|
||||||
|
type: 'error',
|
||||||
|
log: newValue.data + '设备触发报告异常!',
|
||||||
|
})
|
||||||
|
step3.value = 'error'
|
||||||
|
ts.value = 'error'
|
||||||
|
} else if (newValue.code == 10552) {
|
||||||
|
//ElMessage.error("当前步骤已经初始化,执行自动关闭,请重新发起检测!")
|
||||||
|
step3.value = 'error'
|
||||||
|
step3InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||||
|
}];
|
||||||
|
ts.value = 'error'
|
||||||
|
} else if (newValue.code == 25001) {
|
||||||
|
activeIndex.value = 3
|
||||||
|
step3.value = 'success'
|
||||||
|
step4.value = 'process'
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'YJC_xujy':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'OPER_GATHER':
|
||||||
|
if (newValue.code == 10200) {
|
||||||
|
step4InitLog.value.push({
|
||||||
|
type: 'info',
|
||||||
|
log: '源参数下发成功,等待校验中.....',
|
||||||
|
})
|
||||||
|
|
||||||
|
} else if (newValue.code == 10201) {
|
||||||
|
step4.value = 'process'
|
||||||
|
step4InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '源参数下发中.....',
|
||||||
|
}];
|
||||||
|
} else if (newValue.code == 10552) {
|
||||||
|
ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||||
|
step4.value = 'error'
|
||||||
|
ts.value = 'error'
|
||||||
|
} else if (newValue.code == 10520) {
|
||||||
|
step4.value = 'error'
|
||||||
|
step4InitLog.value.push({
|
||||||
|
type: 'error',
|
||||||
|
log: '解析报文异常',
|
||||||
|
})
|
||||||
|
ts.value = 'error'
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'DATA_REQUEST$02':
|
||||||
|
if (newValue.code == 10200) {
|
||||||
|
let type = 'info'
|
||||||
|
if (newValue.data.includes('不合格')) {
|
||||||
|
type = 'error'
|
||||||
|
}
|
||||||
|
|
||||||
|
newValue.data.split('<br/>')
|
||||||
|
step4InitLog.value.push({
|
||||||
|
type: type,
|
||||||
|
log:newValue.data,
|
||||||
|
})
|
||||||
|
|
||||||
|
} else if (newValue.code == 10201) {
|
||||||
|
step4.value = 'process'
|
||||||
|
step4InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '获取数据相序校验数据!',
|
||||||
|
}];
|
||||||
|
} else if (newValue.code == 25003) {
|
||||||
|
step4.value = 'error'
|
||||||
|
step4InitLog.value.push({
|
||||||
|
type: 'error',
|
||||||
|
log: '相序校验未通过!',
|
||||||
|
})
|
||||||
|
ts.value = 'error'
|
||||||
|
} else if (newValue.code == 25001) {
|
||||||
|
step4.value = 'success'
|
||||||
|
step5.value = 'success'
|
||||||
|
step4InitLog.value.push({
|
||||||
|
type: 'wait',
|
||||||
|
log: '相序校验成功!',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
activeIndex.value = 5
|
||||||
|
ts.value = 'success'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'quit':
|
||||||
|
break;
|
||||||
|
case 'connect':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case "Source":
|
||||||
|
step1.value = 'error'
|
||||||
|
step1InitLog.value = [{
|
||||||
|
type: 'error',
|
||||||
|
log: '源服务端连接失败!',
|
||||||
|
}];
|
||||||
|
ts.value = 'error'
|
||||||
|
break;
|
||||||
|
case "Dev":
|
||||||
|
step2.value = 'error'
|
||||||
|
step2InitLog.value = [{
|
||||||
|
type: 'error',
|
||||||
|
log: '设备服务端连接失败!',
|
||||||
|
}];
|
||||||
|
ts.value = 'error'
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'unknown_operate':
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'error_flow_end':
|
||||||
|
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
ts.value = 'error'
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if(activeIndex.value === 2)
|
|
||||||
{
|
})
|
||||||
step2InitLog.value.length = 0;
|
|
||||||
step2InitLog.value = step2Log.value;
|
watch(activeIndex, function (newValue, oldValue) {
|
||||||
|
if (newValue <= activeTotalNum.value - 2) {
|
||||||
|
collapseActiveName.value = (newValue + 1).toString()
|
||||||
|
} else {
|
||||||
|
collapseActiveName.value = (newValue - 1).toString()
|
||||||
}
|
}
|
||||||
if(activeIndex.value === 3)
|
|
||||||
{
|
|
||||||
step3InitLog.value.length = 0;
|
|
||||||
step3InitLog.value = step3Log.value;
|
|
||||||
}
|
|
||||||
if(activeIndex.value > 3)
|
|
||||||
{
|
|
||||||
step4InitLog.value.length = 0;
|
|
||||||
step4InitLog.value = step4Log.value;
|
|
||||||
}
|
|
||||||
if(activeIndex.value < activeTotalNum.value - 2)
|
|
||||||
collapseActiveName.value = (newValue+1).toString()
|
|
||||||
else
|
|
||||||
collapseActiveName.value = (activeTotalNum.value - 1).toString()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
//监听goods_sn的变化
|
//监听goods_sn的变化
|
||||||
watch(testStatus, function (newValue, oldValue) {
|
watch(testStatus, function (newValue, oldValue) {
|
||||||
ts.value = props.testStatus;
|
|
||||||
if(ts.value==='start')
|
|
||||||
{
|
|
||||||
ts.value = 'process'
|
|
||||||
|
|
||||||
let timer = setInterval(() => {
|
ts.value = props.testStatus;
|
||||||
if(activeIndex.value < activeTotalNum.value - 2)
|
if (ts.value === 'start') {
|
||||||
activeIndex.value++
|
ts.value = 'process'
|
||||||
else if(activeIndex.value === activeTotalNum.value -2)
|
} else if (ts.value === 'waiting') {
|
||||||
{
|
activeIndex.value = 0
|
||||||
activeIndex.value++
|
step1InitLog.value = [
|
||||||
activeIndex.value++
|
{
|
||||||
}
|
type: 'info',
|
||||||
else
|
log: '暂无数据,等待检测开始',
|
||||||
{
|
},
|
||||||
clearInterval(timer)
|
]
|
||||||
ts.value = 'success'
|
step1.value = 'finish'
|
||||||
}
|
step2.value = 'wait'
|
||||||
|
step3.value = 'wait'
|
||||||
}, 1500);
|
step4.value = 'wait'
|
||||||
|
step5.value = 'wait'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -269,52 +580,102 @@ const emit = defineEmits(['update:testStatus']);
|
|||||||
//监听sn
|
//监听sn
|
||||||
watch(ts, function (newValue, oldValue) {
|
watch(ts, function (newValue, oldValue) {
|
||||||
//修改父组件
|
//修改父组件
|
||||||
emit('update:testStatus',ts.value)
|
emit('update:testStatus', ts.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 定义一个初始化参数的方法
|
||||||
|
function initializeParameters() {
|
||||||
|
activeIndex.value = 0
|
||||||
|
step1.value = 'process'
|
||||||
|
step2.value = 'wait'
|
||||||
|
step3.value = 'wait'
|
||||||
|
step4.value = 'wait'
|
||||||
|
step5.value = 'wait'
|
||||||
|
|
||||||
|
step1InitLog.value = [
|
||||||
|
{
|
||||||
|
type: 'info',
|
||||||
|
log: '暂无数据,等待检测开始',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
step2InitLog.value = [
|
||||||
|
{
|
||||||
|
type: 'info',
|
||||||
|
log: '暂无数据,等待检测开始',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
step3InitLog.value = [
|
||||||
|
{
|
||||||
|
type: 'info',
|
||||||
|
log: '暂无数据,等待检测开始',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
step4InitLog.value = [
|
||||||
|
{
|
||||||
|
type: 'info',
|
||||||
|
log: '暂无数据,等待检测开始',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
initializeParameters,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.test-dialog {
|
||||||
|
height: 350px;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
.test-dialog{
|
flex-direction: row;
|
||||||
height: 350px;
|
/* 横向排列 */
|
||||||
display: flex;
|
margin-top: 20px;
|
||||||
|
/* .dialog-left{
|
||||||
flex-direction: row; /* 横向排列 */
|
|
||||||
margin-top: 20px;
|
|
||||||
/* .dialog-left{
|
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
.dialog-left{
|
|
||||||
width: 15%;
|
|
||||||
margin-left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* .dialog-left :deep(.test-head-steps){
|
.dialog-left {
|
||||||
|
width: 15%;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .dialog-left :deep(.test-head-steps){
|
||||||
height: 80px;
|
height: 80px;
|
||||||
/* margin-bottom: 10px;
|
/* margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* .dialog-left :deep(.el-step__title) {
|
/* .dialog-left :deep(.el-step__title) {
|
||||||
font-size: 18px !important; /* 设置标题字体大小
|
font-size: 18px !important; /* 设置标题字体大小
|
||||||
} */
|
} */
|
||||||
|
|
||||||
/* .dialog-left :deep(.el-step__icon-inner) {
|
/* .dialog-left :deep(.el-step__icon-inner) {
|
||||||
font-size: 24px !important;
|
font-size: 24px !important;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
.dialog-right{
|
.dialog-right {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
.dialog-right :deep(.el-collapse-item__header) {
|
|
||||||
font-size: 16px;
|
.dialog-right :deep(.el-collapse-item__header) {
|
||||||
}
|
font-size: 16px;
|
||||||
|
}
|
||||||
.div-log{
|
|
||||||
height: 100px;
|
.div-log {
|
||||||
padding-left: 10px;
|
height: 145px;
|
||||||
}
|
overflow-y: auto;
|
||||||
|
padding-left: 10px;
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 5px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,56 +1,54 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog title="报告生成" :model-value='visible' @close="handleCancel" width="832px">
|
<el-dialog title="报告生成" :model-value='visible' @close="handleCancel" width="832px" draggable>
|
||||||
<div class="report-dialog">
|
<div class="report-dialog">
|
||||||
<div class="report-title">
|
<div class="report-title form-two">
|
||||||
<div>
|
|
||||||
<el-row :gutter="24" >
|
<el-form-item label="检测脚本" label-width="100px">
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="检测脚本:" >
|
|
||||||
<el-input v-model='testScriptName' :disabled="true"/>
|
<el-input v-model='testScriptName' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
<el-form-item label="误差体系" label-width="100px">
|
||||||
<el-form-item label="误差体系" >
|
|
||||||
<el-input v-model='errorSysName' :disabled="true"/>
|
<el-input v-model='errorSysName' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
|
||||||
</el-row>
|
<el-form-item label="数据原则" label-width="100px">
|
||||||
</div>
|
<el-input v-model='dataRule' :disabled="true"/>
|
||||||
<div>
|
</el-form-item>
|
||||||
<el-row :gutter="24" >
|
|
||||||
<el-col :span="12">
|
<el-form-item label="报告模板" label-width="100px">
|
||||||
<el-form-item label="数据处理原则" >
|
<el-input v-model='reportTemplate' :disabled="true"/>
|
||||||
<el-input v-model='dataRule' :disabled="true"/>
|
</el-form-item>
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="报告模板" >
|
|
||||||
<el-input v-model='reportTemplate' :disabled="true"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="report-content">
|
<div class="report-content">
|
||||||
<div>
|
<div>
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="报告生成状态表:">
|
<el-tab-pane label="报告生成进度">
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<div class="tabs-title"><el-button type="primary" loading >已生成2台/共4台</el-button> </div>
|
<div class="tabs-title ">
|
||||||
<el-table :data="reportData" stripe="" :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" border class="custom-table">
|
<el-button type="primary" :icon="Download" >报告下载</el-button>
|
||||||
|
<span style=" font-size: 18px;font-weight: 600;">
|
||||||
|
已生成 <span style="color: #67C23A">2</span> 台/共 <span style="color: green">3</span> 台
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="table-main">
|
||||||
|
<el-table :data="reportData" :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" border class="custom-table">
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column prop="id" width="70" label="序号" />
|
<el-table-column prop="id" width="70" label="序号" />
|
||||||
<el-table-column prop="deviceName" width="150" label="设备名称" />
|
<el-table-column prop="deviceName" width="150" label="设备名称" />
|
||||||
<el-table-column label="生成进度" width="450">
|
<el-table-column label="生成进度">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-progress :color="customColors" :percentage="scope.row.processValue" />
|
<el-progress :color="customColors" :percentage="scope.row.processValue" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="action" label="操作" width="100">
|
<el-table-column prop="action" label="操作" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type='primary' link :icon='View' :disabled="scope.row.processValue < 100">查看</el-button>
|
<el-button type='primary' link :icon='Download' :disabled="scope.row.processValue < 100">下载</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
@@ -69,7 +67,7 @@ import { ElMessage, type FormItemRule } from 'element-plus'
|
|||||||
import { addPqDev, updatePqDev } from '@/api/device/device'
|
import { addPqDev, updatePqDev } from '@/api/device/device'
|
||||||
import { computed, reactive, type Ref, ref } from 'vue'
|
import { computed, reactive, type Ref, ref } from 'vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { CirclePlus, Delete, EditPen,View } from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, Download,View } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -78,12 +76,12 @@ import { CirclePlus, Delete, EditPen,View } from '@element-plus/icons-vue'
|
|||||||
const errorSysName = ref('Q/GDW 10650.2-2021');
|
const errorSysName = ref('Q/GDW 10650.2-2021');
|
||||||
const dataRule = ref('所有值');
|
const dataRule = ref('所有值');
|
||||||
const scriptSwitch = ref(true);
|
const scriptSwitch = ref(true);
|
||||||
const currentScriptDsc = ref('频率准确度检测:频率:42.5Hz Ua=46.192V 0° Ub=46.192V -120° Uc=46.192V 120° Ia=1A 0° Ib=1A -120° Ic=1A 120°');
|
const currentScriptDsc = ref('电压准确度检测:频率:42.5Hz Ua=46.192V 0° Ub=46.192V -120° Uc=46.192V 120° Ia=1A 0° Ib=1A -120° Ic=1A 120°');
|
||||||
|
|
||||||
const reportData = ref([
|
const reportData = ref([
|
||||||
{ id: '1', deviceName: '被检设备1', processValue: '100' , action:'查看' },
|
{ id: '1', deviceName: '240001', processValue: '100' , action:'查看' },
|
||||||
{ id: '2', deviceName: '被检设备2', processValue: '100' , action:'查看' },
|
{ id: '2', deviceName: '240002', processValue: '100' , action:'查看' },
|
||||||
{ id: '3', deviceName: '被检设备3', processValue: '10', action:'查看' },
|
{ id: '3', deviceName: '240003', processValue: '10', action:'查看' },
|
||||||
])
|
])
|
||||||
const customColors = [
|
const customColors = [
|
||||||
{ color: "red", percentage: 0 },
|
{ color: "red", percentage: 0 },
|
||||||
@@ -146,7 +144,7 @@ const props = defineProps<{
|
|||||||
}
|
}
|
||||||
.tabs-title{
|
.tabs-title{
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: space-between;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
<div class="result-dialog">
|
<div class="result-dialog">
|
||||||
<div class="result-title">
|
<div class="result-title">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-form-item label="检测脚本:" >
|
<el-form-item label="检测脚本" >
|
||||||
<el-input v-model='testScriptName' :disabled="true"/>
|
<el-input v-model='testScriptName' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="误差体系" >
|
<el-form-item label="误差体系" >
|
||||||
<el-input v-model='errorSysName' :disabled="true"/>
|
<el-input v-model='errorSysName' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据处理原则" >
|
<el-form-item label="数据原则" >
|
||||||
<el-input v-model='dataRule' :disabled="true"/>
|
<el-input v-model='dataRule' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,51 +1,93 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" :model-value="visible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px" draggable>
|
<el-dialog :title="dialogTitle" :model-value="dialogVisible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px"
|
||||||
|
draggable>
|
||||||
<div class="steps-container">
|
|
||||||
<!-- simple -->
|
|
||||||
<!-- :style="{color:node.label=='未检测'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" -->
|
|
||||||
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success" >
|
|
||||||
<!-- style="height:100px" -->
|
|
||||||
<!-- <el-step title="预检测" :icon="getIcon(0)" /> -->
|
|
||||||
<el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit" />
|
|
||||||
<el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled"/>
|
|
||||||
<el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" />
|
|
||||||
<el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin" />
|
|
||||||
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key" />
|
|
||||||
</el-steps>
|
|
||||||
</div>
|
|
||||||
<preTest v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus"></preTest>
|
|
||||||
<timeTest v-if="stepsActiveIndex === 1" v-model:testStatus="timeTestStatus"></timeTest>
|
|
||||||
<channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest>
|
|
||||||
<test v-if="stepsActiveIndex >= 3" v-model:testStatus="TestStatus"></test>
|
|
||||||
|
|
||||||
<template #footer>
|
<div class="steps-container">
|
||||||
<div>
|
<!-- simple -->
|
||||||
<!-- <el-button @click="handleCancel">取 消</el-button> -->
|
<!-- :style="{color:node.label=='未检'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" -->
|
||||||
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled" @click="nextStep">跳过</el-button>
|
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
|
||||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
|
<!-- style="height:100px" -->
|
||||||
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'process'" @click="handleSubmit">停止检测</el-button>
|
<!-- <el-step title="预检测" :icon="getIcon(0)" /> -->
|
||||||
<el-button type="primary" :icon="Refresh" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button>
|
<el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit"/>
|
||||||
<el-button type="primary" :icon="Right" v-if="ActiveStatue === 'success'" @click="nextStep">{{nextStepText}}</el-button>
|
<el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled" v-if="isTimeCheck"/>
|
||||||
</div>
|
<!-- <el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" /> -->
|
||||||
</template>
|
<el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin"/>
|
||||||
</el-dialog>
|
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key"/>
|
||||||
|
</el-steps>
|
||||||
|
</div>
|
||||||
|
<preTest ref="preTestRef" v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest>
|
||||||
|
<timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
|
||||||
|
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
|
||||||
|
<test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"
|
||||||
|
@sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck"></test>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div>
|
||||||
|
<!-- <el-button @click="handleCancel">取 消</el-button> -->
|
||||||
|
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled"
|
||||||
|
@click="nextStep">跳过
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit" :disabled="btnState">开始检测</el-button>
|
||||||
|
<el-button type="primary" v-if="TestStatus === 'process'" @click="handleSubmit" disabled>
|
||||||
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||||
|
<component :is="Refresh"/>
|
||||||
|
</el-icon>
|
||||||
|
检测中
|
||||||
|
</el-button>
|
||||||
|
<el-button type="warning" :icon="VideoPlay" v-if="TestStatus === 'paused'" @click="handleSubmit">继续检测</el-button>
|
||||||
|
<el-button type="primary" :icon="RefreshLeft" v-if="TestStatus === 'test_recheck'" @click="handleSubmit">重新检测</el-button>
|
||||||
|
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
|
||||||
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||||
|
<component :is="Refresh"/>
|
||||||
|
</el-icon>
|
||||||
|
初始化中
|
||||||
|
</el-button>
|
||||||
|
<el-button type="warning" v-if="TestStatus === 'paused_ing'" disabled>
|
||||||
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||||
|
<component :is="Refresh"/>
|
||||||
|
</el-icon>
|
||||||
|
暂停中
|
||||||
|
</el-button>
|
||||||
|
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
||||||
|
v-if="ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout'"
|
||||||
|
@click="nextStep">
|
||||||
|
{{ nextStepText }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="tsx" setup name="testPopup">
|
<script lang="tsx" setup name="testPopup">
|
||||||
import { h } from 'vue';
|
import {h, reactive, ref, watch} from 'vue';
|
||||||
import{ElMessage, ElSelectV2, FormInstance,FormItemRule}from'element-plus'
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||||
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
|
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
||||||
import { dialogBig,dialogMiddle} from '@/utils/elementBind'
|
import {
|
||||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
Close,
|
||||||
import {CirclePlus, Delete, EditPen,FolderOpened,CopyDocument,Edit, Picture, UploadFilled, SuccessFilled,VideoPlay,Right,Refresh,Close, Odometer,Coin,Key, DArrowRight} from '@element-plus/icons-vue'
|
Coin,
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
DArrowRight,
|
||||||
import preTest from './preTest.vue'
|
Edit,
|
||||||
import timeTest from './timeTest.vue'
|
Key,
|
||||||
import channelsTest from './channelsTest.vue'
|
Odometer,
|
||||||
//import SvgIcon from '@/components/SvgIcon.vue';
|
Refresh,
|
||||||
|
Right,
|
||||||
|
SuccessFilled,
|
||||||
|
UploadFilled,
|
||||||
|
VideoPlay,
|
||||||
|
RefreshLeft, Loading
|
||||||
|
} from '@element-plus/icons-vue'
|
||||||
|
import preTest from './preTest.vue'
|
||||||
|
import timeTest from './timeTest.vue'
|
||||||
|
import {Device} from '@/api/device/interface/device';
|
||||||
|
import socketClient from '@/utils/webSocketClient';
|
||||||
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
|
import {startPreTest, pauseTest, resumeTest} from '@/api/socket/socket'
|
||||||
|
import {showFullScreenLoading} from "@/components/Loading/fullScreen";
|
||||||
|
|
||||||
|
|
||||||
|
//import SvgIcon from '@/components/SvgIcon.vue';
|
||||||
|
|
||||||
// import preTestIcon from '@/assets/icons/preTest.svg'
|
// import preTestIcon from '@/assets/icons/preTest.svg'
|
||||||
|
|
||||||
@@ -53,28 +95,30 @@
|
|||||||
// <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
|
// <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
|
||||||
// </svg>
|
// </svg>
|
||||||
// `;
|
// `;
|
||||||
const props = defineProps<{
|
// const props = defineProps<{
|
||||||
visible: boolean;
|
// visible: boolean;
|
||||||
dialogTitle: string;
|
// 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<{
|
// formData: {
|
||||||
(e: 'update:visible', value: boolean): void;
|
// id: string;//误差体系表Id
|
||||||
(e: 'submit', data: any): void;
|
// name: string;//误差体系名称
|
||||||
}>();
|
// standard_Name:string;//参照标准名称
|
||||||
|
// standard_Time:string;//标准推行时间
|
||||||
|
// dev_Level:string;//使用设备等级
|
||||||
|
// enable:number;//状态:0-不启用 1-启用
|
||||||
|
// state:number;//0-删除 1-正常
|
||||||
|
// };
|
||||||
|
// }>();
|
||||||
|
|
||||||
const skipDisabled = ref(false);
|
// const emit = defineEmits<{
|
||||||
const nextStepText = ref('下一步');
|
// (e: 'update:visible', value: boolean): void;
|
||||||
|
// (e: 'submit', data: any): void;
|
||||||
|
// }>();
|
||||||
|
const btnState = ref(false)
|
||||||
|
const checkStore = useCheckStore();
|
||||||
|
const skipDisabled = ref(false);
|
||||||
|
const nextStepText = ref('下一步');
|
||||||
|
const dialogVisible = ref(false)
|
||||||
//定义与预检测配置数组
|
//定义与预检测配置数组
|
||||||
const detectionOptions = ref([
|
const detectionOptions = ref([
|
||||||
{
|
{
|
||||||
@@ -117,106 +161,336 @@ const detectionOptions = ref([
|
|||||||
// },
|
// },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const stepsTotalNum = ref(5);//步骤总数
|
const stepsTotalNum = ref(4);//步骤总数
|
||||||
const stepsActiveIndex = ref(0); //当前正在执行的步骤索引
|
const stepsActiveIndex = ref(0); //当前正在执行的步骤索引
|
||||||
const ActiveStatue = ref('waiting');//当前步骤状态
|
const ActiveStatue = ref('waiting');//当前步骤状态
|
||||||
const preTestStatus = ref('waiting');//预检测执行状态
|
const preTestStatus = ref('waiting');//预检测执行状态
|
||||||
const timeTestStatus = ref('waiting');//守时校验执行状态
|
const timeTestStatus = ref('waiting');//守时校验执行状态
|
||||||
const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
||||||
const TestStatus = ref('waiting');//正式检测执行状态
|
const TestStatus = ref('waiting');//正式检测执行状态
|
||||||
|
const webMsgSend = ref();//webSocket推送的数据
|
||||||
|
|
||||||
watch(preTestStatus,function(newValue,oldValue){
|
const dialogTitle = ref('');
|
||||||
console.log(newValue,oldValue);
|
const isTimeCheck = ref(false)
|
||||||
|
const preTestRef = ref(null);
|
||||||
|
|
||||||
ActiveStatue.value = newValue
|
|
||||||
})
|
|
||||||
watch(timeTestStatus,function(newValue,oldValue){
|
|
||||||
console.log(newValue,oldValue);
|
|
||||||
|
|
||||||
ActiveStatue.value = newValue
|
// const devIdArr = ref([])
|
||||||
})
|
// const planId = ref('')
|
||||||
watch(channelsTestStatus,function(newValue,oldValue){
|
|
||||||
console.log(newValue,oldValue);
|
|
||||||
|
|
||||||
ActiveStatue.value = newValue
|
const dataSocket = reactive({
|
||||||
})
|
socketServe: socketClient.Instance,
|
||||||
watch(TestStatus,function(newValue,oldValue){
|
});
|
||||||
console.log(newValue,oldValue);
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = (selection: Device.ResPqDev[], title: string, time: boolean) => {
|
||||||
|
|
||||||
ActiveStatue.value = newValue
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(ActiveStatue,function(newValue,oldValue){
|
const checkStates = selection.map(item => item.checkState);
|
||||||
|
// devIdArr.value = selection.map(item => item.id);
|
||||||
|
// planId.value =selection[0].planId
|
||||||
|
// console.log('wwwwwwwwwwwwwwwww',selection)
|
||||||
|
|
||||||
if(newValue === 'success' || newValue === 'error')
|
const allCheckStatesEqual = new Set(checkStates).size <= 1;
|
||||||
|
|
||||||
|
if (!allCheckStatesEqual) {
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'所勾选设备检测状态不一致,请重新选择',
|
||||||
|
'提示',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogTitle.value = title;
|
||||||
|
dialogVisible.value = true;
|
||||||
|
isTimeCheck.value = time
|
||||||
|
|
||||||
|
if (preTestRef.value) {
|
||||||
|
preTestRef.value.initializeParameters();
|
||||||
|
}
|
||||||
|
|
||||||
|
preTestStatus.value = 'waiting';//预检测执行状态
|
||||||
|
//开始创建webSocket客户端
|
||||||
|
|
||||||
|
socketClient.Instance.connect();
|
||||||
|
dataSocket.socketServe = socketClient.Instance;
|
||||||
|
dataSocket.socketServe.registerCallBack('aaa', (res) => {
|
||||||
|
// 处理来自服务器的消息
|
||||||
|
// console.log('Received message:', res);
|
||||||
|
// 根据需要在这里添加更多的处理逻辑
|
||||||
|
|
||||||
|
if (res.code === 20000) {
|
||||||
|
ElMessage.error(message.message)
|
||||||
|
loading.close()
|
||||||
|
} else {
|
||||||
|
webMsgSend.value = res
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let loading;
|
||||||
|
const handleSubmit = () => {
|
||||||
|
skipDisabled.value = true
|
||||||
|
//btnState.value = true
|
||||||
|
console.log('=============', stepsActiveIndex.value)
|
||||||
|
|
||||||
|
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
||||||
|
let planId = checkStore.planId
|
||||||
|
|
||||||
|
|
||||||
|
if(!dataSocket.socketServe.connected){
|
||||||
|
ElMessage.error('webSocket连接中断!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (stepsActiveIndex.value) {
|
||||||
|
case 0:
|
||||||
|
// preTestStatus.value = 'start'
|
||||||
|
|
||||||
|
startPreTest({
|
||||||
|
userPageId: "cdf",
|
||||||
|
devIds: deviceIds,
|
||||||
|
planId: planId,
|
||||||
|
operateType: '1' // '1'为预检测、‘2‘为正式检测
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 'A001014') {
|
||||||
|
ElMessageBox.alert('装置配置异常', '检测失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TestStatus.value = 'error'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
preTestStatus.value = 'start'
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
timeTestStatus.value = 'start'
|
||||||
|
break;
|
||||||
|
// case 2:
|
||||||
|
// channelsTestStatus.value = 'start'
|
||||||
|
// break;
|
||||||
|
case 2:
|
||||||
|
if (TestStatus.value == "waiting") {
|
||||||
|
startPreTest({
|
||||||
|
userPageId: "cdf",
|
||||||
|
devIds: deviceIds,
|
||||||
|
planId: planId,
|
||||||
|
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.code === 'A001014') {
|
||||||
|
ElMessageBox.alert('装置配置异常', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TestStatus.value = 'test_init_fail'
|
||||||
|
}
|
||||||
|
/* if (res.code === 20000) {
|
||||||
|
TestStatus.value = 'start'
|
||||||
|
webMsgSend.value = ''
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.message)
|
||||||
|
}*/
|
||||||
|
})
|
||||||
|
TestStatus.value = 'start'
|
||||||
|
} else if (TestStatus.value == 'paused') {
|
||||||
|
// 发送继续指令
|
||||||
|
sendResume()
|
||||||
|
} else if (TestStatus.value == 'test_recheck') {
|
||||||
|
// 发送重新检测指令
|
||||||
|
sendReCheck()
|
||||||
|
|
||||||
|
|
||||||
|
}else if (TestStatus.value == 'success') {
|
||||||
|
emit('quitClicked'); // 触发事件
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'quitClicked'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
watch(preTestStatus, function (newValue, oldValue) {
|
||||||
|
console.log(newValue, oldValue);
|
||||||
|
|
||||||
|
ActiveStatue.value = newValue
|
||||||
|
})
|
||||||
|
watch(timeTestStatus, function (newValue, oldValue) {
|
||||||
|
console.log(newValue, oldValue);
|
||||||
|
|
||||||
|
ActiveStatue.value = newValue
|
||||||
|
})
|
||||||
|
watch(channelsTestStatus, function (newValue, oldValue) {
|
||||||
|
console.log(newValue, oldValue);
|
||||||
|
|
||||||
|
ActiveStatue.value = newValue
|
||||||
|
})
|
||||||
|
watch(TestStatus, function (newValue, oldValue) {
|
||||||
|
console.log(newValue, oldValue);
|
||||||
|
|
||||||
|
ActiveStatue.value = newValue
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(ActiveStatue, function (newValue, oldValue) {
|
||||||
|
|
||||||
|
if (newValue === 'success' || newValue === 'error') {
|
||||||
skipDisabled.value = false
|
skipDisabled.value = false
|
||||||
|
}
|
||||||
|
|
||||||
if(newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 2)
|
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||||
{
|
stepsActiveIndex.value++;
|
||||||
stepsActiveIndex.value++;
|
stepsActiveIndex.value++;
|
||||||
stepsActiveIndex.value++;
|
nextStepText.value = '检测完成'
|
||||||
nextStepText.value = '检测完成'
|
}
|
||||||
|
if (newValue === 'error' && stepsActiveIndex.value === stepsTotalNum.value - 3) {
|
||||||
|
stepsActiveIndex.value++;
|
||||||
|
stepsActiveIndex.value++;
|
||||||
|
nextStepText.value = '检测失败'
|
||||||
|
}
|
||||||
|
if (newValue === 'test_init_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||||
|
stepsActiveIndex.value++;
|
||||||
|
stepsActiveIndex.value++;
|
||||||
|
nextStepText.value = '初始化失败'
|
||||||
|
}
|
||||||
|
if (newValue === 'connect_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||||
|
stepsActiveIndex.value++;
|
||||||
|
stepsActiveIndex.value++;
|
||||||
|
nextStepText.value = '连接超时'
|
||||||
|
}
|
||||||
|
if (newValue === 'pause_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||||
|
stepsActiveIndex.value++;
|
||||||
|
stepsActiveIndex.value++;
|
||||||
|
nextStepText.value = '结束测试'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const sendPause = () => {
|
||||||
|
console.log('发起暂停请求')
|
||||||
|
|
||||||
|
TestStatus.value = 'paused_ing'
|
||||||
|
pauseTest()
|
||||||
|
}
|
||||||
|
const sendResume = () => {
|
||||||
|
console.log('发起继续检测请求')
|
||||||
|
|
||||||
|
resumeTest({
|
||||||
|
userPageId: "cdf",
|
||||||
|
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||||
|
planId: checkStore.planId,
|
||||||
|
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
||||||
|
}).then(res => {
|
||||||
|
Object.assign(webMsgSend.value, {
|
||||||
|
requestId: 'Resume_Success'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendReCheck = () => {
|
||||||
|
console.log('发送重新检测指令')
|
||||||
|
startPreTest({
|
||||||
|
userPageId: "cdf",
|
||||||
|
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||||
|
planId: checkStore.planId,
|
||||||
|
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.code === 'A001014') {
|
||||||
|
ElMessageBox.alert('装置配置异常', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
TestStatus.value = 'test_init_fail'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
TestStatus.value = 'start'
|
||||||
|
}
|
||||||
|
|
||||||
const getIcon = (index: number) => {
|
const getIcon = (index: number) => {
|
||||||
if (stepsActiveIndex.value > index) return SuccessFilled;
|
if (stepsActiveIndex.value > index) return SuccessFilled;
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: return h(<svg-icon name="preTest"></svg-icon>);
|
case 0:
|
||||||
case 1: return UploadFilled;
|
return h(<svg-icon name="preTest"></svg-icon>);
|
||||||
case 2: return Odometer;
|
case 1:
|
||||||
case 3: return Coin;
|
return UploadFilled;
|
||||||
case 4: return Key;
|
case 2:
|
||||||
default: return null;
|
return Odometer;
|
||||||
|
case 3:
|
||||||
|
return Coin;
|
||||||
|
case 4:
|
||||||
|
return Key;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const nextStep = () => {
|
const nextStep = () => {
|
||||||
if(stepsActiveIndex.value < stepsTotalNum.value )
|
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||||
{
|
stepsActiveIndex.value++
|
||||||
|
if (!isTimeCheck.value) {//不具备守时检测,预检测后直接跳正式检测
|
||||||
stepsActiveIndex.value++
|
stepsActiveIndex.value++
|
||||||
ActiveStatue.value = 'waiting'
|
|
||||||
}
|
}
|
||||||
else if(stepsActiveIndex.value === stepsTotalNum.value)
|
|
||||||
{
|
|
||||||
emit('update:visible', false); // 关闭对话框
|
|
||||||
clearData()
|
|
||||||
|
|
||||||
}
|
ActiveStatue.value = 'waiting'
|
||||||
};
|
} else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
||||||
|
//emit('update:visible', false); // 关闭对话框
|
||||||
function clearData(){
|
clearData()
|
||||||
stepsActiveIndex.value = 0;
|
dialogVisible.value = false;
|
||||||
preTestStatus.value = "waiting"
|
|
||||||
timeTestStatus.value = "waiting"
|
|
||||||
channelsTestStatus.value = "waiting"
|
|
||||||
TestStatus.value = "waiting"
|
|
||||||
nextStepText.value = "下一步"
|
|
||||||
}
|
}
|
||||||
const beforeClose = (done: () => void) => {
|
};
|
||||||
console.log(stepsActiveIndex.value,stepsTotalNum.value)
|
|
||||||
if(stepsActiveIndex.value < stepsTotalNum.value)
|
function clearData() {
|
||||||
{
|
stepsActiveIndex.value = 0;
|
||||||
ElMessageBox.confirm(
|
preTestStatus.value = "waiting"
|
||||||
'检测未完成,是否退出当前检测流程?',
|
timeTestStatus.value = "waiting"
|
||||||
'提示',
|
channelsTestStatus.value = "waiting"
|
||||||
{
|
TestStatus.value = "waiting"
|
||||||
confirmButtonText: '确定',
|
ActiveStatue.value = "waiting"
|
||||||
cancelButtonText: '取消',
|
skipDisabled.value = false
|
||||||
type: 'warning',
|
nextStepText.value = "下一步"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const beforeClose = (done: () => void) => {
|
||||||
|
console.log(stepsActiveIndex.value, stepsTotalNum.value)
|
||||||
|
if (stepsActiveIndex.value < stepsTotalNum.value) {
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'检测未完成,是否退出当前检测流程?',
|
||||||
|
'提示',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
clearData()
|
clearData()
|
||||||
emit('update:visible', false); // 关闭对话框
|
// todo 关闭弹窗,终止整个检测流程
|
||||||
|
//emit('update:visible', false); // 关闭对话框
|
||||||
})
|
dialogVisible.value = false;
|
||||||
}
|
})
|
||||||
else
|
} else {
|
||||||
{
|
clearData()
|
||||||
clearData()
|
//emit('update:visible', false); // 关闭对话框
|
||||||
emit('update:visible', false); // 关闭对话框
|
dialogVisible.value = false;
|
||||||
}
|
}
|
||||||
// ElMessageBox.confirm('Are you sure to close this dialog?')
|
// ElMessageBox.confirm('Are you sure to close this dialog?')
|
||||||
// .then(() => {
|
// .then(() => {
|
||||||
// done()
|
// done()
|
||||||
@@ -225,72 +499,33 @@ const getIcon = (index: number) => {
|
|||||||
// // catch error
|
// // catch error
|
||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
// clearData()
|
dataSocket.socketServe.closeWs()
|
||||||
// emit('update:visible', false); // 关闭对话框
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSubmit = () => {
|
|
||||||
skipDisabled.value = true
|
|
||||||
switch (stepsActiveIndex.value) {
|
|
||||||
case 0:
|
|
||||||
preTestStatus.value = 'start'
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
timeTestStatus.value = 'start'
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
channelsTestStatus.value = 'start'
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
TestStatus.value = 'start'
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
emit('quitClicked'); // 触发事件
|
||||||
};
|
// clearData()
|
||||||
|
// emit('update:visible', false); // 关闭对话框
|
||||||
// 当 props.visible 改变时,更新 formData
|
|
||||||
watch(() => props.visible, (newVal) => {
|
|
||||||
if (!newVal) {
|
|
||||||
// 这里可以重置表单数据,如果需要的话
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//选中
|
|
||||||
// 处理选择变化
|
|
||||||
const handleSelectionChange = (selection: any[]) => {
|
|
||||||
multipleSelection.value = selection.map(row => row.id); // 更新选中的行
|
|
||||||
|
|
||||||
};
|
|
||||||
const openAddDialog = () => {
|
|
||||||
tableData.value.push({
|
|
||||||
id: tableData.value.length + 1,
|
|
||||||
type: '',
|
|
||||||
startSelect: '',
|
|
||||||
startRange: '',
|
|
||||||
endSelect: '',
|
|
||||||
endRange: '',
|
|
||||||
unit:'',
|
|
||||||
maxErrorValue:'',
|
|
||||||
errorType:''
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// // 当 props.visible 改变时,更新 formData
|
||||||
|
// watch(() => props.visible, (newVal) => {
|
||||||
|
// if (!newVal) {
|
||||||
|
// // 这里可以重置表单数据,如果需要的话
|
||||||
|
|
||||||
</script>
|
// }
|
||||||
|
// });
|
||||||
<style scoped lang="scss">
|
|
||||||
|
|
||||||
:deep(.dialog-big .el-dialog__body){
|
// 对外映射
|
||||||
max-height: 840px !important;
|
defineExpose({open})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
:deep(.dialog-big .el-dialog__body) {
|
||||||
|
max-height: 840px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
// :deep(.dialog-big){
|
// :deep(.dialog-big){
|
||||||
// max-height: 840px !important;
|
// max-height: 840px !important;
|
||||||
// }
|
// }
|
||||||
@@ -298,32 +533,45 @@ const getIcon = (index: number) => {
|
|||||||
// max-height: 840px !important;
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
.steps-container :deep(.el-step__title) {
|
.steps-container :deep(.el-step__title) {
|
||||||
font-size: 20px !important; /* 设置标题字体大小 */
|
font-size: 20px !important; /* 设置标题字体大小 */
|
||||||
vertical-align:baseline !important;
|
vertical-align: baseline !important;
|
||||||
display: inline-block; /* 确保文字和图标在同一行 */
|
display: inline-block; /* 确保文字和图标在同一行 */
|
||||||
line-height: 1; /* 调整行高以确保底部对齐 */
|
line-height: 1; /* 调整行高以确保底部对齐 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.steps-container :deep(.el-step__icon-inner) {
|
|
||||||
font-size: 18px !important;
|
|
||||||
vertical-align:baseline !important;
|
|
||||||
display: inline-block; /* 确保文字和图标在同一行 */
|
|
||||||
line-height: 1; /* 调整行高以确保底部对齐 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.steps-container :deep(.el-step__icon) {
|
.steps-container :deep(.el-step__icon-inner) {
|
||||||
font-size: 18px !important;
|
font-size: 18px !important;
|
||||||
vertical-align:baseline !important;
|
vertical-align: baseline !important;
|
||||||
display: inline-block; /* 确保文字和图标在同一行 */
|
display: inline-block; /* 确保文字和图标在同一行 */
|
||||||
line-height: 1; /* 调整行高以确保底部对齐 */
|
line-height: 1; /* 调整行高以确保底部对齐 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.steps-container :deep(.el-step__icon) {
|
||||||
|
font-size: 18px !important;
|
||||||
|
vertical-align: baseline !important;
|
||||||
|
display: inline-block; /* 确保文字和图标在同一行 */
|
||||||
|
line-height: 1; /* 调整行高以确保底部对齐 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-box {
|
||||||
|
animation: loading 1.5s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes loading {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// :deep(.test-head-steps){
|
// :deep(.test-head-steps){
|
||||||
// height: 100px;
|
// height: 100px;
|
||||||
// margin-bottom: 20px;
|
// margin-bottom: 20px;
|
||||||
@@ -364,7 +612,7 @@ const getIcon = (index: number) => {
|
|||||||
// font-size: 24px !important; /* 设置标题字体大小 */
|
// font-size: 24px !important; /* 设置标题字体大小 */
|
||||||
// margin-top: 10px !important; /* 调整标题与图标的间距 */
|
// margin-top: 10px !important; /* 调整标题与图标的间距 */
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// :deep(.el-step__icon-inner) {
|
// :deep(.el-step__icon-inner) {
|
||||||
// font-size: 24px !important;
|
// font-size: 24px !important;
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -1,8 +1,37 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class = "test-dialog">
|
<el-tabs type="border-card">
|
||||||
<div class="dialog-left">
|
<el-tab-pane label="守时误差">
|
||||||
<el-timeline style="max-width: 600px">
|
<div class="right-title" >
|
||||||
|
<span v-if="activeIndex <= 1"> </span>
|
||||||
|
<span v-if="activeIndex > 1" class="time-text">
|
||||||
|
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
|
||||||
|
</span>
|
||||||
|
<div class="error-dsc">
|
||||||
|
<div class="green-div"></div>
|
||||||
|
<span class="description-text">
|
||||||
|
合格≤1000ms
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="red-div"></div>
|
||||||
|
<span class="description-text unqualified">
|
||||||
|
不合格>1000ms
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<div class="test-dialog">
|
||||||
|
<div class="dialog-left">
|
||||||
|
<el-steps direction="vertical" :active="stepsIndex" :process-status="currentStepStatus"
|
||||||
|
finish-status="success">
|
||||||
|
<el-step title="开始检测" />
|
||||||
|
<el-step title="触发设备检测GPS时刻的标准时间"/>
|
||||||
|
<el-step title="设备开始上送"/>
|
||||||
|
<el-step title="设备结束上送"/>
|
||||||
|
<el-step title="检测完成"/>
|
||||||
|
</el-steps>
|
||||||
|
<!-- <el-timeline style="max-width: 600px">
|
||||||
<el-timeline-item
|
<el-timeline-item
|
||||||
v-for="(activity, index) in activities"
|
v-for="(activity, index) in activities"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -15,38 +44,89 @@
|
|||||||
>
|
>
|
||||||
{{ activity.content }}
|
{{ activity.content }}
|
||||||
</el-timeline-item>
|
</el-timeline-item>
|
||||||
</el-timeline>
|
</el-timeline> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog-right">
|
<div class="dialog-right">
|
||||||
<div class="right-title">
|
<div class="right-title">
|
||||||
<!-- <div>设备上送时刻表</div> -->
|
<!-- <div>设备上送时刻表</div> -->
|
||||||
<div>
|
|
||||||
<el-button type="primary" loading v-if="activeIndex > 0 && activeIndex < activeTotalNum">设备已合格3台/共4台</el-button>
|
<!-- <span v-if="activeIndex <= 1"> </span>
|
||||||
<el-button type="primary" disabled="true" v-if="activeIndex === activeTotalNum">设备已合格3台/共4台</el-button>
|
<span v-if="activeIndex > 1" style=" font-size: 18px;font-weight: 600;">
|
||||||
</div>
|
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
|
||||||
|
</span>
|
||||||
|
<div class="error-dsc">
|
||||||
|
<div class="green-div"></div>
|
||||||
|
<span style=" color: #606266; font-size: 16px;font-weight: 600;">
|
||||||
|
守时误差≤1000ms
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="red-div"></div>
|
||||||
|
<span style=" color: #F56C6c; font-size: 16px;font-weight: 600;">
|
||||||
|
守时误差>1000ms
|
||||||
|
</span>
|
||||||
|
</div> -->
|
||||||
|
<!-- <span style=" font-size: 18px;font-weight: 600;">
|
||||||
|
设备已合格 <span style="color: #67C23A">{{ qualified }}</span> 台/共 <span style="color: green">4</span> 台
|
||||||
|
</span> -->
|
||||||
|
<!-- <el-button type="primary" loading v-if="activeIndex > 0 && activeIndex < activeTotalNum">设备已合格3台/共4台</el-button>
|
||||||
|
<el-button type="primary" disabled="true" v-if="activeIndex === activeTotalNum">设备已合格3台/共4台</el-button> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="right-content">
|
<div class="right-content table-main">
|
||||||
<el-table :data="deviceOperatorData" stripe :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" border>
|
<el-empty description="暂无数据,等待检测开始" v-if="activeIndex === 0" />
|
||||||
<el-table-column prop="deviceName" label="设备名" />
|
<!-- <ProTable v-if="activeIndex > 0" ref='proTable' :pagination='false' :toolButton='false' :showCard='false' :columns='columns'
|
||||||
|
:data='deviceOperatorData' stripe :header-cell-style="{ textAlign: 'center' }"
|
||||||
|
:cell-style="{ textAlign: 'center' }" style="width: 100%; height:435px" border>
|
||||||
|
</ProTable> -->
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-if="activeIndex > 0"
|
||||||
|
:data="deviceOperatorData"
|
||||||
|
stripe
|
||||||
|
:header-cell-class-name="'el-table-header'"
|
||||||
|
:cell-class-name="'el-table-cell'"
|
||||||
|
class="el-table"
|
||||||
|
border>
|
||||||
|
<el-table-column prop="deviceName" label="设备名称" />
|
||||||
<el-table-column prop="updataTime" label="上送时刻" />
|
<el-table-column prop="updataTime" label="上送时刻" />
|
||||||
<el-table-column prop="ErrorValue" label="守时误差(ms)" />
|
<el-table-column prop="ErrorValue" label="守时误差(ms)">
|
||||||
<el-table-column prop="Result" label="检测结果">
|
<!-- <template #header>
|
||||||
<template #default="scope">
|
<span>守时误差(ms)</span>
|
||||||
<el-tag :type="scope.row.Result === '合格' ? 'success' : 'danger'">{{ scope.row.Result }}</el-tag>
|
<el-tooltip content = "守时误差 = |设备上送时间 - 标准时间|,最大显示值为9999毫秒,超过该值的统一用ErrorMax来表示" placement="top" style="align-items: bottom;">
|
||||||
</template>
|
<el-icon><InfoFilled /></el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</template> -->
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
<el-table-column prop="Result" label="检测结果">
|
||||||
|
<!-- <template #header>
|
||||||
|
<span>检测结果</span>
|
||||||
|
<el-tooltip content = "守时误差小于等于1000毫秒为合格,否则不合格" placement="top" style="align-items: bottom;">
|
||||||
|
<el-icon><InfoFilled /></el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</template> -->
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag v-if="scope.row.Result === '不合格'" type="danger">{{ scope.row.Result }}</el-tag>
|
||||||
|
<span v-if="scope.row.Result != '不合格'">{{scope.row.Result}}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup name="timeTest">
|
<script lang="tsx" setup name="timeTest">
|
||||||
import { SuccessFilled } from '@element-plus/icons-vue'
|
import { SuccessFilled } from '@element-plus/icons-vue'
|
||||||
|
import { reactive, ref, toRef, watch } from 'vue'
|
||||||
|
|
||||||
|
const stepsIndex = ref(0)
|
||||||
const activeIndex = ref(0)
|
const activeIndex = ref(0)
|
||||||
const activeTotalNum = ref(5)
|
const activeTotalNum = ref(7)
|
||||||
|
const startTime = ref('')
|
||||||
|
const gpsTime = ref('')
|
||||||
|
const devStartTime = ref('')
|
||||||
|
const devEndTime = ref('')
|
||||||
|
const finishTime = ref('')
|
||||||
|
|
||||||
interface Activity {
|
interface Activity {
|
||||||
content: string;
|
content: string;
|
||||||
@@ -56,6 +136,7 @@ interface Activity {
|
|||||||
color?: string;
|
color?: string;
|
||||||
icon?: any;
|
icon?: any;
|
||||||
}
|
}
|
||||||
|
const qualified = ref(0)
|
||||||
const activities = ref<Activity[]>([
|
const activities = ref<Activity[]>([
|
||||||
{
|
{
|
||||||
content: '开始检测',
|
content: '开始检测',
|
||||||
@@ -63,182 +144,267 @@ const activities = ref<Activity[]>([
|
|||||||
},])
|
},])
|
||||||
|
|
||||||
|
|
||||||
const deviceOperatorData = ref([
|
const deviceOperatorData = ref([])
|
||||||
{
|
|
||||||
deviceName: '被检设备1',
|
|
||||||
updataTime: '—',
|
|
||||||
ErrorValue:'—',
|
|
||||||
Result: '—',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
deviceName: '被检设备2',
|
|
||||||
updataTime: '—',
|
|
||||||
ErrorValue:'—',
|
|
||||||
Result: '—',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
deviceName: '被检设备3',
|
|
||||||
updataTime: '—',
|
|
||||||
ErrorValue:'—',
|
|
||||||
Result: '—',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
deviceName: '被检设备4',
|
|
||||||
updataTime: '—',
|
|
||||||
ErrorValue:'—',
|
|
||||||
Result: '—',
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
const deviceData = ref([
|
const deviceData = ref([
|
||||||
{
|
{
|
||||||
deviceName: '被检设备1',
|
deviceName: '240001',
|
||||||
updataTime: '10:30:08.136',
|
updataTime: '2024-12-05 10:30:08.136',
|
||||||
ErrorValue:'148',
|
ErrorValue: '148',
|
||||||
Result: '合格',
|
Result: '合格',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
deviceName: '被检设备2',
|
deviceName: '240002',
|
||||||
updataTime: '10:30:08.136',
|
updataTime: '2024-12-05 10:30:08.136',
|
||||||
ErrorValue:'136',
|
ErrorValue: '136',
|
||||||
Result: '合格',
|
Result: '合格',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
deviceName: '被检设备3',
|
deviceName: '240003',
|
||||||
updataTime: '10:30:09.006',
|
updataTime: '2024-12-05 10:30:09.006',
|
||||||
ErrorValue:'1006',
|
ErrorValue: '1006',
|
||||||
Result: '不合格',
|
Result: '不合格',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
deviceName: '被检设备4',
|
deviceName: '240004',
|
||||||
updataTime: '10:30:08.736',
|
updataTime: '2024-12-05 10:30:08.736',
|
||||||
ErrorValue:'736',
|
ErrorValue: '736',
|
||||||
Result: '合格',
|
Result: '合格',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
testStatus: {
|
testStatus: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'wait'
|
default: 'wait'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const testStatus = toRef(props, 'testStatus');
|
const testStatus = toRef(props, 'testStatus');
|
||||||
const ts = ref('');
|
const ts = ref('');
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive([
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'deviceName',
|
||||||
|
label: '设备名称',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'updataTime',
|
||||||
|
label: '上送时刻',
|
||||||
|
// width: 230,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'ErrorValue',
|
||||||
|
label: '守时误差(ms)',
|
||||||
|
// width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'Result',
|
||||||
|
label: '检测结果',
|
||||||
|
// width: 100,
|
||||||
|
render: (scope: { row: { Result: string } }) => {
|
||||||
|
if (scope.row.Result === '不合格') {
|
||||||
|
return (
|
||||||
|
<el-tag type='danger'>{scope.row.Result}</el-tag>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return (
|
||||||
|
<span>{scope.row.Result}</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
//监听testStatus的变化
|
//监听testStatus的变化
|
||||||
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'
|
||||||
|
|
||||||
let timer = setInterval(() => {
|
let timer = setInterval(() => {
|
||||||
if(activeIndex.value < activeTotalNum.value - 2)
|
if (activeIndex.value < activeTotalNum.value)
|
||||||
activeIndex.value++
|
activeIndex.value++
|
||||||
else if(activeIndex.value === activeTotalNum.value -2)
|
// else if (activeIndex.value === activeTotalNum.value - 2) {
|
||||||
{
|
// activeIndex.value++
|
||||||
activeIndex.value++
|
// activeIndex.value++
|
||||||
activeIndex.value++
|
// }
|
||||||
}
|
else {
|
||||||
else
|
clearInterval(timer)
|
||||||
{
|
ts.value = 'success'
|
||||||
clearInterval(timer)
|
}
|
||||||
ts.value = 'success'
|
}, 1000);
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function formatDateTime(date: Date) {
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
const milliseconds = String(date.getMilliseconds()).padStart(3, '0');
|
||||||
|
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addMillisecondsToDate(dateString: string, millisecondsToAdd: number): Date {
|
||||||
|
// 解析字符串为 Date 对象
|
||||||
|
const [datePart, timePart] = dateString.split(' ');
|
||||||
|
const [year, month, day] = datePart.split('-').map(Number);
|
||||||
|
const [hours, minutes, seconds, milliseconds] = timePart.split(':').flatMap(part => part.split('.')).map(Number);
|
||||||
|
|
||||||
|
// 创建 Date 对象(注意:月份是从 0 开始的)
|
||||||
|
const date = new Date(year, month - 1, day, hours, minutes, seconds, milliseconds);
|
||||||
|
|
||||||
|
// 增加指定的毫秒数
|
||||||
|
date.setMilliseconds(date.getMilliseconds() + millisecondsToAdd);
|
||||||
|
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
watch(activeIndex, function (newValue, oldValue) {
|
watch(activeIndex, function (newValue, oldValue) {
|
||||||
|
|
||||||
if(activeIndex.value === 1)
|
console.log(activeIndex.value,111,stepsIndex.value,222)
|
||||||
{
|
|
||||||
activities.value.length = 0;
|
|
||||||
activities.value.push({
|
|
||||||
content: '开始检测',
|
|
||||||
timestamp: '2018-04-12 20:46',
|
|
||||||
size: 'large',
|
|
||||||
color: '#0bbd87',
|
|
||||||
icon: SuccessFilled,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if(activeIndex.value === 2)
|
|
||||||
{
|
|
||||||
activities.value.push({
|
|
||||||
content: 'GPS上送时刻',
|
|
||||||
timestamp: '2018-04-03 20:46',
|
|
||||||
color: '#0bbd87',
|
|
||||||
icon: SuccessFilled,
|
|
||||||
size: 'large',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if(activeIndex.value === 3)
|
|
||||||
{
|
|
||||||
activities.value.push({
|
|
||||||
content: '设备最早上送时刻',
|
|
||||||
timestamp: '2018-04-03 20:46',
|
|
||||||
color: '#0bbd87',
|
|
||||||
icon: SuccessFilled,
|
|
||||||
size: 'large',
|
|
||||||
});
|
|
||||||
|
|
||||||
deviceOperatorData.value.length = 0;
|
if (activeIndex.value === 1) {
|
||||||
deviceOperatorData.value = deviceData.value;
|
startTime.value = formatDateTime(new Date());
|
||||||
}
|
stepsIndex.value = 1;
|
||||||
if(activeIndex.value > 3)
|
// activities.value.length = 0;
|
||||||
{
|
// activities.value.push({
|
||||||
activities.value.push({
|
// content: '开始检测',
|
||||||
content: '设备最晚上送时刻',
|
// timestamp: '2018-04-12 20:46',
|
||||||
timestamp: '2018-04-03 20:46',
|
// size: 'large',
|
||||||
color: '#0bbd87',
|
// color: '#0bbd87',
|
||||||
icon: SuccessFilled,
|
// icon: SuccessFilled,
|
||||||
size: 'large',
|
// });
|
||||||
});
|
}
|
||||||
activities.value.push({
|
if (activeIndex.value === 2) {
|
||||||
content: '检测结束',
|
stepsIndex.value = 2;
|
||||||
timestamp: '2018-04-03 20:46',
|
gpsTime.value = formatDateTime(new Date());
|
||||||
color: '#0bbd87',
|
// activities.value.push({
|
||||||
icon: SuccessFilled,
|
// content: 'GPS上送时刻',
|
||||||
size: 'large',
|
// timestamp: '2018-04-03 20:46',
|
||||||
});
|
// color: '#0bbd87',
|
||||||
}
|
// icon: SuccessFilled,
|
||||||
|
// size: 'large',
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
if (activeIndex.value === 3) {
|
||||||
|
stepsIndex.value = 3;
|
||||||
|
deviceOperatorData.value.length = 0;
|
||||||
|
// deviceOperatorData.value = deviceData.value;
|
||||||
|
deviceOperatorData.value.push({
|
||||||
|
deviceName: '240002',
|
||||||
|
updataTime: formatDateTime(addMillisecondsToDate(gpsTime.value, 136)),
|
||||||
|
ErrorValue: '136',
|
||||||
|
Result: '合格',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (activeIndex.value === 4) {
|
||||||
|
deviceOperatorData.value.push({
|
||||||
|
deviceName: '240001',
|
||||||
|
updataTime: formatDateTime(addMillisecondsToDate(gpsTime.value, 148)),
|
||||||
|
ErrorValue: '148',
|
||||||
|
Result: '合格',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (activeIndex.value === 5) {
|
||||||
|
deviceOperatorData.value.push({
|
||||||
|
deviceName: '240004',
|
||||||
|
updataTime: formatDateTime(addMillisecondsToDate(gpsTime.value, 736)),
|
||||||
|
ErrorValue: '736',
|
||||||
|
Result: '合格',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (activeIndex.value === 6) {
|
||||||
|
stepsIndex.value = 5;
|
||||||
|
deviceOperatorData.value.push({
|
||||||
|
deviceName: '240003',
|
||||||
|
updataTime: formatDateTime(addMillisecondsToDate(gpsTime.value, 1006)),
|
||||||
|
ErrorValue: '1006',
|
||||||
|
Result: '不合格',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['update:testStatus']);
|
const emit = defineEmits(['update:testStatus']);
|
||||||
//监听sn
|
//监听sn
|
||||||
watch(ts, function (newValue, oldValue) {
|
watch(ts, function (newValue, oldValue) {
|
||||||
//修改父组件
|
//修改父组件
|
||||||
emit('update:testStatus',ts.value)
|
emit('update:testStatus', ts.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.test-dialog{
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
flex-direction: row; /* 横向排列 */
|
.test-dialog {
|
||||||
margin-top: 20px;
|
height: 350px;
|
||||||
min-height: 300px;
|
display: flex;
|
||||||
/* .dialog-left{
|
|
||||||
|
flex-direction: row;
|
||||||
|
/* 横向排列 */
|
||||||
|
margin-top: 20px;
|
||||||
|
/* .dialog-left{
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
.dialog-left{
|
|
||||||
margin-left: 20px;
|
.dialog-left {
|
||||||
width: 20%;
|
margin-left: 20px;
|
||||||
}
|
width: 20%;
|
||||||
.dialog-right{
|
}
|
||||||
margin-top: 25px;
|
|
||||||
margin-left: 20px;
|
.dialog-right {
|
||||||
width: 80%;
|
/* margin-top: 25px;
|
||||||
}
|
margin-left: 20px; */
|
||||||
.right-title{
|
width: 80%;
|
||||||
display: flex;
|
}
|
||||||
flex-direction: row; /* 横向排列 */
|
|
||||||
justify-content: flex-end;
|
.right-title {
|
||||||
margin-bottom: 10px;
|
height: 32px;
|
||||||
}
|
display: flex;
|
||||||
/* width: 100%;
|
flex-direction: row;
|
||||||
|
/* 横向排列 */
|
||||||
|
justify-content: space-between;
|
||||||
|
/* margin-bottom: 10px; */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.green-div{
|
||||||
|
width: 20px;
|
||||||
|
height: 14px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: #606266;
|
||||||
|
margin-left: 5px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red-div{
|
||||||
|
width: 20px;
|
||||||
|
height: 14px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: #F56C6C;
|
||||||
|
margin-left: 5px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-content{
|
||||||
|
height: 440px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
@@ -250,4 +416,70 @@ watch(ts, function (newValue, oldValue) {
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
padding: 10px 20px 10px 20px;
|
padding: 10px 20px 10px 20px;
|
||||||
box-sizing: border-box; */
|
box-sizing: border-box; */
|
||||||
|
|
||||||
|
.right-title .time-text {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-title .gps-time {
|
||||||
|
color: #003078;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 10px; /* 根据需要调整 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc .green-div,
|
||||||
|
.error-dsc .red-div {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc .green-div {
|
||||||
|
background-color: #67C23A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc .red-div {
|
||||||
|
background-color: #F56C6C;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc .description-text {
|
||||||
|
color: #606266;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-dsc .description-text.unqualified {
|
||||||
|
color: #F56C6C;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table-header {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table-cell {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table {
|
||||||
|
margin-top: -30px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tooltip-icon {
|
||||||
|
margin-left: 4px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-tag {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-text {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<div class='search_view'>
|
<div class='search_view'>
|
||||||
<el-input
|
<el-input
|
||||||
placeholder='请输入计划名称'
|
placeholder='请输入计划名称'
|
||||||
|
clearable
|
||||||
v-model='searchForm.planName'
|
v-model='searchForm.planName'
|
||||||
></el-input>
|
></el-input>
|
||||||
<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)'
|
||||||
@@ -15,6 +16,8 @@
|
|||||||
:filter-node-method='filterNode'
|
:filter-node-method='filterNode'
|
||||||
:props='defaultProps'
|
:props='defaultProps'
|
||||||
node-key='id'
|
node-key='id'
|
||||||
|
class="filter-tree"
|
||||||
|
:highlight-current="true"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
:default-checked-keys='defaultChecked'
|
:default-checked-keys='defaultChecked'
|
||||||
@node-click='handleNodeClick'
|
@node-click='handleNodeClick'
|
||||||
@@ -22,7 +25,7 @@
|
|||||||
<template #default='{ node, data }'>
|
<template #default='{ node, data }'>
|
||||||
<span class='custom-tree-node' style='display: flex;align-items: center;'>
|
<span class='custom-tree-node' style='display: flex;align-items: center;'>
|
||||||
<Platform v-if='!data.pid' style='width:18px;height: 18px;margin-right:8px;'
|
<Platform v-if='!data.pid' style='width:18px;height: 18px;margin-right:8px;'
|
||||||
:style="{color:node.label=='未检测'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" />
|
:style="{color:node.label=='未检'?'#fac858':node.label=='检测中'?'#ee6666':'#91cc75'}" />
|
||||||
<span>{{ node.label }}</span>
|
<span>{{ node.label }}</span>
|
||||||
<!-- <Menu v-if="data.pid" @click.stop="detail(data)" style="width: 12px;margin-left: 8px;"/> -->
|
<!-- <Menu v-if="data.pid" @click.stop="detail(data)" style="width: 12px;margin-left: 8px;"/> -->
|
||||||
</span>
|
</span>
|
||||||
@@ -32,10 +35,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
|
import { type Plan } from '@/api/plan/interface';
|
||||||
import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue'
|
import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue'
|
||||||
|
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
import {useCheckStore} from "@/stores/modules/check";
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const checkStore = useCheckStore()
|
||||||
|
const filterText = ref('')
|
||||||
|
const treeRef = ref()
|
||||||
const data: any = ref([])
|
const data: any = ref([])
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
@@ -45,14 +54,57 @@ const defaultProps = {
|
|||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
planName: '',
|
planName: '',
|
||||||
})
|
})
|
||||||
const defaultChecked = ref([])
|
const defaultChecked = ref<string[]>([]) // 明确类型为 number[]
|
||||||
|
const tree = ref(false)//确保左侧树高凉只执行一次
|
||||||
const getTreeData = (val: any) => {
|
const getTreeData = (val: any) => {
|
||||||
|
defaultChecked.value = [];
|
||||||
|
data.value = val;
|
||||||
|
|
||||||
|
for (let item of data.value) {
|
||||||
|
if (item.children.length > 0) {
|
||||||
|
let node = item.children[0];
|
||||||
|
defaultChecked.value.push(node.id);
|
||||||
|
checkStore.setPlanId(node.id);
|
||||||
|
checkStore.setPlanCode(node.code);
|
||||||
|
checkStore.setScriptId(node.scriptId);
|
||||||
|
checkStore.setErrorSysId(node.errorSysId);
|
||||||
|
// 高亮显示第一个节点
|
||||||
|
// 使用 nextTick 确保在 DOM 更新后调用 setCurrentKey
|
||||||
|
nextTick(() => {
|
||||||
|
treeRef.value?.setCurrentKey(node.id);
|
||||||
|
idd.value = node.id;
|
||||||
|
});
|
||||||
|
// 找到第一个符合条件的 children 后跳出循环
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//点击表格后左侧树刷新,高亮显示对应节点
|
||||||
|
const clickTableToTree = (val: any,id:any) => {
|
||||||
|
|
||||||
defaultChecked.value = []
|
defaultChecked.value = []
|
||||||
data.value = val
|
data.value = val
|
||||||
defaultChecked.value.push(data.value[0].children[0].id)
|
let node = ref('')
|
||||||
|
if (data.value.length > 0) {
|
||||||
|
for (let i = 0; i < data.value.length; i++){
|
||||||
|
for (let j = 0; j < data.value[i].children.length; j++) {
|
||||||
|
if (data.value[i].children[j].id == id) {
|
||||||
|
node.value = data.value[i].children[j].id
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用 nextTick 确保在 DOM 更新后调用 setCurrentKey
|
||||||
|
nextTick(() => {
|
||||||
|
treeRef.value?.setCurrentKey(node.value);
|
||||||
|
idd.value = node.value
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const filterText = ref('')
|
|
||||||
const treeRef = ref()
|
|
||||||
const {updateSelectedTreeNode} = defineProps<{
|
const {updateSelectedTreeNode} = defineProps<{
|
||||||
updateSelectedTreeNode:Function;
|
updateSelectedTreeNode:Function;
|
||||||
}>();
|
}>();
|
||||||
@@ -65,14 +117,34 @@ watch(
|
|||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
const handleNodeClick = (data) => {
|
|
||||||
// console.log(data)
|
const idd = ref('')
|
||||||
updateSelectedTreeNode()
|
const handleNodeClick = (data: Plan.ResPlan) => {
|
||||||
|
|
||||||
|
if (data.name === '未检' || data.name === '检测中' || data.name === '检测完成') {
|
||||||
|
// 如果是父节点,不执行任何操作
|
||||||
|
//console.log('父节点不执行任何操作');
|
||||||
|
// 设置当前高亮节点
|
||||||
|
nextTick(() => {
|
||||||
|
treeRef.value?.setCurrentKey(idd.value);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
idd.value = data.id
|
||||||
|
|
||||||
|
checkStore.setPlanId(data.id)
|
||||||
|
checkStore.setPlanCode(data.code)
|
||||||
|
checkStore.setScriptId(data.scriptId)
|
||||||
|
checkStore.setErrorSysId(data.errorSysId)
|
||||||
|
updateSelectedTreeNode(data.id)
|
||||||
}
|
}
|
||||||
const filterNode = (value: string, data) => {
|
const filterNode = (value: string, data: any) => {
|
||||||
if (!value) return true
|
if (!value) return true
|
||||||
return data.name.includes(value)
|
return data.name.includes(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 点击详情
|
// 点击详情
|
||||||
const detail = () => {
|
const detail = () => {
|
||||||
router.push('/plan')
|
router.push('/plan')
|
||||||
@@ -80,16 +152,15 @@ const detail = () => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// console.log()
|
// console.log()
|
||||||
})
|
})
|
||||||
defineExpose({ getTreeData })
|
defineExpose({ getTreeData ,clickTableToTree})
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
.plan_tree {
|
.plan_tree {
|
||||||
// width: 200px;
|
height: 100%;
|
||||||
// height: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 5px;
|
|
||||||
// height: calc(100% - 70px);
|
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
|
||||||
.search_view {
|
.search_view {
|
||||||
@@ -112,13 +183,52 @@ defineExpose({ getTreeData })
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tree_container {
|
.tree_container {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
overflow-x: auto;
|
||||||
|
|
||||||
.el-tree {
|
.el-tree {
|
||||||
height: 100%;
|
// height: 100%;
|
||||||
width: 100%;
|
width: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.filter-tree {
|
||||||
|
// border: 1px solid #dcdfe6;
|
||||||
|
min-width: 100%;
|
||||||
|
height: 97%;
|
||||||
|
display: inline-block;
|
||||||
|
overflow: auto;
|
||||||
|
margin-top: 12px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//.filter-tree span {
|
||||||
|
// font-size: 16px;
|
||||||
|
// display:block;
|
||||||
|
// overflow:hidden;
|
||||||
|
// word-break:keep-all;
|
||||||
|
// white-space:nowrap;
|
||||||
|
// text-overflow:ellipsis;
|
||||||
|
// padding-right: 12px;
|
||||||
|
//}
|
||||||
|
.leftBox {
|
||||||
|
// float: left;
|
||||||
|
// width: 20%;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.left {
|
||||||
|
height: calc(100% - 45px);
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
/* 设置滚动条宽度 */
|
||||||
|
:deep(.bodyTwo ::-webkit-scrollbar) {
|
||||||
|
width: 3px !important;
|
||||||
|
height: 6px !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ import { useAuthStore } from "@/stores/modules/auth";
|
|||||||
|
|
||||||
import model from "./tabs/model.vue";
|
import model from "./tabs/model.vue";
|
||||||
import dashboard from "./tabs/dashboard.vue";
|
import dashboard from "./tabs/dashboard.vue";
|
||||||
import { onMounted } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
|
// defineOptions({
|
||||||
|
// name: 'home'
|
||||||
|
// })
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
|
|
||||||
const activeIndex = ref("1-1");
|
const activeIndex = ref("1-1");
|
||||||
@@ -46,22 +49,21 @@ const modeList = [
|
|||||||
{
|
{
|
||||||
name: "模拟式模式",
|
name: "模拟式模式",
|
||||||
code:"模拟式",
|
code:"模拟式",
|
||||||
subName: "未启用模拟式检测计划",
|
img: new URL('/src/assets/images/dashboard/1.svg', import.meta.url).href,
|
||||||
img: "/src/assets/images/dashboard/1.svg",
|
|
||||||
isActive: true,
|
isActive: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "数字式模式",
|
name: "数字式模式",
|
||||||
code:"数字式",
|
code:"数字式",
|
||||||
subName: "启用数字检测计划",
|
subName: "启用数字检测计划",
|
||||||
img: "/src/assets/images/dashboard/2.svg",
|
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
|
||||||
isActive: false,
|
isActive: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "比对式模式",
|
name: "比对式模式",
|
||||||
code:"比对式",
|
code:"比对式",
|
||||||
subName: "启用比对式检测计划",
|
subName: "启用比对式检测计划",
|
||||||
img: "/src/assets/images/dashboard/3.svg",
|
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
|
||||||
isActive: false,
|
isActive: false,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -81,7 +83,8 @@ const handleSelect = (key: string, keyPath: string[]) => {
|
|||||||
//console.log(key, keyPath);
|
//console.log(key, keyPath);
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
//console.log();
|
//console.log(111);
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,34 @@
|
|||||||
<!-- 模式切换页面 -->
|
<!-- 模式切换页面 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="main_container">
|
<div class="main_container box">
|
||||||
<!-- :style="{
|
<!-- :style="{
|
||||||
height: authStore?.showMenuFlag
|
height: authStore?.showMenuFlag
|
||||||
? 'calc(100vh - 165px)'
|
? 'calc(100vh - 165px)'
|
||||||
: 'calc(100vh - 125px)',
|
: 'calc(100vh - 125px)',
|
||||||
}" -->
|
}" -->
|
||||||
<div class="mode" v-for="(item, index) in modeList" :key="index">
|
|
||||||
|
<el-carousel :interval="5000" type="card" style="width: 60%;margin-left: 20%;height: 70%;">
|
||||||
|
<el-carousel-item class="mode" :class="{ modeBG: index != 0 }" v-for="(item, index) in modeList" :key="index">
|
||||||
|
|
||||||
|
<div class="mode_top">
|
||||||
|
<div class="mode_name">
|
||||||
|
{{ item.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mode_img">
|
||||||
|
<img :src="item.img" />
|
||||||
|
</div>
|
||||||
|
<div class="test_button">
|
||||||
|
<el-button size="large" type="primary" @click="handelOpen(item)"
|
||||||
|
:disabled="item.isActive == false">进入检测</el-button>
|
||||||
|
</div>
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <div class="mode" :class="{ modeBG: index != 0 }" v-for="(item, index) in modeList" :key="index">
|
||||||
<div class="mode_top">
|
<div class="mode_top">
|
||||||
<div class="mode_name">
|
<div class="mode_name">
|
||||||
<p>
|
<p>
|
||||||
@@ -14,66 +36,63 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="test_button">
|
<div class="test_button">
|
||||||
<el-button
|
<el-button size="small" type="primary" @click="handelOpen(item)"
|
||||||
size="small"
|
:disabled="item.isActive == false">进入检测</el-button>
|
||||||
type="primary"
|
|
||||||
@click="handelOpen(item)"
|
|
||||||
:disabled="item.isActive == false"
|
|
||||||
>进入检测</el-button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mode_img">
|
<div class="mode_img">
|
||||||
<img :src="item.img" />
|
<img :src="item.img" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from "@/stores/modules/auth";
|
||||||
import { useModeStore } from "@/stores/modules/mode"; // 引入模式 store
|
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
|
||||||
|
import { ref } from "vue";
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const modeStore = useModeStore(); // 使用模式 store
|
const modeStore = useModeStore(); // 使用模式 store
|
||||||
|
const AppSceneStore = useAppSceneStore();
|
||||||
const activeIndex = ref("1-1");
|
const activeIndex = ref("1-1");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const modeList = [
|
const modeList = [
|
||||||
{
|
{
|
||||||
name: "模拟式模块",
|
name: "模拟式模块",
|
||||||
code:"模拟式",
|
code: "模拟式",
|
||||||
subName: "未启用模拟式检测计划",
|
subName: "未启用模拟式检测计划",
|
||||||
img: "/src/assets/images/dashboard/1.svg",
|
img: new URL('/src/assets/images/dashboard/1.svg', import.meta.url).href,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "数字式模块",
|
name: "数字式模块",
|
||||||
code:"数字式",
|
code: "数字式",
|
||||||
subName: "启用数字检测计划",
|
subName: "启用数字检测计划",
|
||||||
img: "/src/assets/images/dashboard/2.svg",
|
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
|
||||||
isActive: true,
|
isActive: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "比对式模块",
|
name: "比对式模块",
|
||||||
code:"比对式",
|
code: "比对式",
|
||||||
subName: "启用比对式检测计划",
|
subName: "启用比对式检测计划",
|
||||||
img: "/src/assets/images/dashboard/3.svg",
|
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
|
||||||
isActive: true,
|
isActive: false,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const handelOpen = async (item: any) => {
|
const handelOpen = async (item: any) => {
|
||||||
|
|
||||||
await authStore.setShowMenu();
|
|
||||||
modeStore.setCurrentMode(item.code); // 将模式code存入 store
|
modeStore.setCurrentMode(item.code); // 将模式code存入 store
|
||||||
|
AppSceneStore.setCurrentMode('1');//0:省级平台,1:设备出厂,2:研发自测
|
||||||
|
await authStore.setShowMenu();
|
||||||
return;
|
return;
|
||||||
if (isActive) {
|
// if (isActive) {
|
||||||
router.push({ path: "/static" });
|
// router.push({ path: "/static" });
|
||||||
} else {
|
// } else {
|
||||||
ElMessage({
|
// ElMessage({
|
||||||
message: "当前模式未配置",
|
// message: "当前模式未配置",
|
||||||
type: "warning",
|
// type: "warning",
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
const handleSelect = (key: string, keyPath: string[]) => {
|
const handleSelect = (key: string, keyPath: string[]) => {
|
||||||
console.log(key, keyPath);
|
console.log(key, keyPath);
|
||||||
@@ -83,7 +102,23 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.box {
|
||||||
|
background: #ededed;
|
||||||
|
// background-image: url("/src/assets/images/dashboard/DT.jpg");
|
||||||
|
// /* 背景图垂直、水平均居中 */
|
||||||
|
// // background-position: center center;
|
||||||
|
// /* 背景图不平铺 */
|
||||||
|
// background-repeat: no-repeat;
|
||||||
|
// /* 当内容高度大于图片高度时,背景图像的位置相对于viewport固定 */
|
||||||
|
// background-attachment: fixed;
|
||||||
|
// /* 让背景图基于容器大小伸缩 */
|
||||||
|
// background-size: cover;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.main_container {
|
.main_container {
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
// height: calc(100vh - 165px);
|
// height: calc(100vh - 165px);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -92,55 +127,45 @@ onMounted(() => {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
// padding: 20px 2%;
|
|
||||||
.mode {
|
.mode {
|
||||||
flex: none;
|
|
||||||
margin-top: 3px;
|
|
||||||
width: 32.5%;
|
|
||||||
height: 99.5% !important;
|
height: 99.5% !important;
|
||||||
border: 1px solid #eee;
|
border: 1px solid #eee;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: linear-gradient(
|
background: linear-gradient(180deg,
|
||||||
180deg,
|
rgba(0, 153, 255, 1) 0%,
|
||||||
rgba(0, 153, 255, 1) 0%,
|
rgba(0, 153, 255, 1) 0%,
|
||||||
rgba(0, 153, 255, 1) 0%,
|
rgba(0, 102, 255, 1) 65%,
|
||||||
rgba(0, 102, 255, 1) 65%,
|
rgba(0, 51, 255, 1) 100%,
|
||||||
rgba(0, 51, 255, 1) 100%,
|
rgba(0, 51, 255, 1) 100%);
|
||||||
rgba(0, 51, 255, 1) 100%
|
|
||||||
);
|
position: absolute;
|
||||||
|
|
||||||
|
|
||||||
// padding: 40px 0;
|
// padding: 40px 0;
|
||||||
.mode_top {
|
.mode_top {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: #008aff;
|
background: #008aff;
|
||||||
border-radius: 6px 6px 0 0;
|
border-radius: 6px 6px 0 0;
|
||||||
|
|
||||||
.mode_name {
|
.mode_name {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
flex: 1;
|
font-family: "微软雅黑 Bold", "微软雅黑", "微软雅黑", sans-serif;
|
||||||
display: flex;
|
font-weight: 700;
|
||||||
align-items: center;
|
font-style: normal;
|
||||||
justify-content: flex-start;
|
font-size: 20px;
|
||||||
p {
|
color: #ffffff;
|
||||||
font-family: "微软雅黑 Bold", "微软雅黑", "微软雅黑", sans-serif;
|
text-align: center;
|
||||||
font-weight: 700;
|
line-height: 40px;
|
||||||
font-style: normal;
|
padding-left: 10px;
|
||||||
font-size: 16px;
|
// margin-top: 20px;
|
||||||
color: #ffffff;
|
|
||||||
text-align: center;
|
|
||||||
// background: #fff;
|
|
||||||
line-height: 40px;
|
|
||||||
text-align: left;
|
|
||||||
padding-left: 10px;
|
|
||||||
// margin-top: 20px;
|
|
||||||
}
|
|
||||||
.mode_subName {
|
.mode_subName {
|
||||||
font-family: "微软雅黑", sans-serif;
|
font-family: "微软雅黑", sans-serif;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
@@ -155,14 +180,16 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.test_button {
|
.test_button {
|
||||||
width: 150px;
|
display: flex;
|
||||||
height: 100%;
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode_img {
|
.mode_img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
@@ -171,71 +198,107 @@ onMounted(() => {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
// padding: 30px 0 50px;
|
// padding: 30px 0 50px;
|
||||||
margin-top: 100px;
|
margin-top: 100px;
|
||||||
|
// margin-bottom: 100px;
|
||||||
|
|
||||||
img:nth-child(1) {
|
img:nth-child(1) {
|
||||||
width: 60%;
|
width: 60%;
|
||||||
height: auto;
|
height: auto;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
img:nth-child(2) {
|
img:nth-child(2) {
|
||||||
width: 70%;
|
width: 70%;
|
||||||
height: auto;
|
height: auto;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
img:nth-child(3) {
|
img:nth-child(3) {
|
||||||
width: 60%;
|
width: 60%;
|
||||||
height: auto;
|
height: auto;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode_test {
|
.mode_test {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
.test_button {
|
|
||||||
width: 120px;
|
|
||||||
height: 100%;
|
|
||||||
border: 1px solid rgba(121, 121, 121, 1);
|
|
||||||
border-radius: 5px;
|
|
||||||
font-family: "微软雅黑", sans-serif;
|
|
||||||
font-weight: 400;
|
|
||||||
font-style: normal;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 40px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.test_button:hover {
|
.test_button:hover {
|
||||||
background: rgba(0, 0, 0, 0.2);
|
background: rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode:nth-child(3n + 3) {
|
.test_button {
|
||||||
background: linear-gradient(
|
position: absolute;
|
||||||
180deg,
|
bottom: 30px;
|
||||||
rgba(0, 153, 255, 1) 0%,
|
left: 50%;
|
||||||
rgba(0, 153, 255, 1) 0%,
|
transform: translateX(-50%);
|
||||||
rgba(0, 102, 255, 1) 39%,
|
border-radius: 5px;
|
||||||
rgba(102, 51, 204, 1) 100%,
|
font-family: "微软雅黑", sans-serif;
|
||||||
rgba(102, 51, 204, 1) 100%
|
font-weight: 400;
|
||||||
);
|
font-style: normal;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 40px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.mode:nth-child(3n + 3) {
|
||||||
|
background: linear-gradient(180deg,
|
||||||
|
rgba(0, 153, 255, 1) 0%,
|
||||||
|
rgba(0, 153, 255, 1) 0%,
|
||||||
|
rgba(0, 102, 255, 1) 39%,
|
||||||
|
rgba(102, 51, 204, 1) 100%,
|
||||||
|
rgba(102, 51, 204, 1) 100%);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.mode_off {
|
.mode_off {
|
||||||
|
|
||||||
.mode_name,
|
.mode_name,
|
||||||
.mode_subName,
|
.mode_subName,
|
||||||
.test_button {
|
.test_button {
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.test_button:hover {
|
.test_button:hover {
|
||||||
// background: rgba(0, 0, 0, 0.2) !important;
|
// background: rgba(0, 0, 0, 0.2) !important;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-sub-menu__title) {
|
:deep(.el-sub-menu__title) {
|
||||||
border-bottom: 0 !important;
|
border-bottom: 0 !important;
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// .modeBG {
|
||||||
|
// &::before {
|
||||||
|
// content: "";
|
||||||
|
// position: absolute;
|
||||||
|
// top: 0;
|
||||||
|
// left: 0;
|
||||||
|
// width: 100%;
|
||||||
|
// height: 100%;
|
||||||
|
// background-color: #70707080;
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
:deep(.el-carousel__container) {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-carousel__item) {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ 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 { useDictStore } from '@/stores/modules/dict'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'log'
|
||||||
|
})
|
||||||
|
|
||||||
let multipleSelection = ref<string[]>([])
|
let multipleSelection = ref<string[]>([])
|
||||||
const logData = logDataList
|
const logData = logDataList
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
@@ -37,6 +42,10 @@ const excludedUnits = ['季度','年']; // 要排除的单位
|
|||||||
const defaultUnits = '日'; // 默认的单位
|
const defaultUnits = '日'; // 默认的单位
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ const login = (formEl: FormInstance | undefined) => {
|
|||||||
...loginForm,
|
...loginForm,
|
||||||
password: loginForm.password,
|
password: loginForm.password,
|
||||||
})
|
})
|
||||||
userStore.setToken(data.accessToken)
|
userStore.setAccessToken(data.accessToken)
|
||||||
|
userStore.setRefreshToken(data.refreshToken)
|
||||||
userStore.setUserInfo(data.userInfo)
|
userStore.setUserInfo(data.userInfo)
|
||||||
const response = await getDictList()
|
const response = await getDictList()
|
||||||
const dictData = response.data as unknown as Dict[]
|
const dictData = response.data as unknown as Dict[]
|
||||||
|
|||||||
217
frontend/src/views/machine/devType/components/devTypePopup.vue
Normal file
217
frontend/src/views/machine/devType/components/devTypePopup.vue
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 基础信息弹出框 -->
|
||||||
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" >
|
||||||
|
<div>
|
||||||
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
||||||
|
<el-form-item label="名称" prop="name" >
|
||||||
|
<el-input v-model='formContent.name' placeholder="请输入设备类型名称"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="工作电源" prop="power" >
|
||||||
|
<el-select v-model="formContent.power" clearable placeholder="请选择工作电源">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Dev_Power')"
|
||||||
|
:key="item.code"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="通道数" prop="devChns" >
|
||||||
|
<el-select v-model="formContent.devChns" clearable placeholder="请选择设备通道数">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Dev_Chns')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="额定电压(V)" prop="devVolt" >
|
||||||
|
<el-select v-model="formContent.devVolt" clearable placeholder="请选择额定电压">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Dev_Volt')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="额定电流(A)" prop="devCurr" >
|
||||||
|
<el-select v-model="formContent.devCurr" clearable placeholder="请选择额定电流">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Dev_Curr')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="报告模版名称" prop="reportName" >
|
||||||
|
<el-select v-model="formContent.reportName" clearable placeholder="请选择报告模版">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Report_Template')"
|
||||||
|
:key="item.code"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备关联ICD" prop="icd" >
|
||||||
|
<el-select v-model="formContent.icd" clearable placeholder="请选择ICD">
|
||||||
|
<el-option
|
||||||
|
v-for="item in icdOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="close()">取消</el-button>
|
||||||
|
<el-button type="primary" @click="save()" >
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import{ ElMessage, type FormInstance,type FormItemRule } from 'element-plus'
|
||||||
|
import type { ProTableInstance } from '@/components/ProTable/interface'
|
||||||
|
import { ref,computed, Ref } from 'vue'
|
||||||
|
import { type DevType } from '@/api/device/interface/devType'
|
||||||
|
import { type ICD } from '@/api/device/interface/icd'
|
||||||
|
import {dialogMiddle} from '@/utils/elementBind'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {addDevType,updateDevType} from '@/api/device/devType'
|
||||||
|
import {getICDAllList} from '@/api/device/icd'
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
// 定义弹出组件元信息
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
const icdOptions = ref<ICD.ResICD[]>([])
|
||||||
|
function useMetaInfo() {
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const titleType = ref('add')
|
||||||
|
const formContent = ref<DevType.ResPqDevType>({
|
||||||
|
id: '', //设备类型ID
|
||||||
|
name: '',//设备类型名称
|
||||||
|
icd: '',//设备关联的ICD
|
||||||
|
power: 'AC/DC 110V-220V',//工作电源
|
||||||
|
devVolt: 57.74, //额定电压(V)
|
||||||
|
devCurr: 5, //额定电流(A)
|
||||||
|
devChns: 1, //设备通道数
|
||||||
|
reportName: '',//报告模版名称
|
||||||
|
state: 1,
|
||||||
|
})
|
||||||
|
return { dialogVisible, titleType, formContent }
|
||||||
|
}
|
||||||
|
|
||||||
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
|
|
||||||
|
|
||||||
|
// 清空formContent
|
||||||
|
const resetFormContent = () => {
|
||||||
|
formContent.value = {
|
||||||
|
id: '', //设备类型ID
|
||||||
|
name: '',//设备类型名称
|
||||||
|
icd: '',//设备关联的ICD
|
||||||
|
power: 'AC/DC 110V-220V',//工作电源
|
||||||
|
devVolt: 57.74, //额定电压(V)
|
||||||
|
devCurr: 5, //额定电流(A)
|
||||||
|
devChns: 1, //设备通道数
|
||||||
|
reportName: '',//报告模版名称
|
||||||
|
state: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let dialogTitle = computed(() => {
|
||||||
|
return titleType.value === 'add' ? '新增设备类型' : '编辑设备类型'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//定义规则
|
||||||
|
const formRuleRef = ref<FormInstance>()
|
||||||
|
//定义校验规则
|
||||||
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
|
name: [{ required: true, message: '设备类型名称必填!', trigger: 'blur' }],
|
||||||
|
power: [
|
||||||
|
{ required: true, message: '工作电源必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
devChns: [
|
||||||
|
{ required: true, message: '设备通道数必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
devVolt: [
|
||||||
|
{ required: true, message: '额定电压必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
devCurr: [
|
||||||
|
{ required: true, message: '额定电流必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
reportName: [
|
||||||
|
{ required: true, message: '报告模版名称必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
icd: [
|
||||||
|
{ required: true, message: '设备关联ICD必选!', trigger: 'change' }
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 清空dialogForm中的值
|
||||||
|
resetFormContent()
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
|
try {
|
||||||
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
if (formContent.value.id) {
|
||||||
|
await updateDevType(formContent.value);
|
||||||
|
} else {
|
||||||
|
await addDevType(formContent.value);
|
||||||
|
}
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
close()
|
||||||
|
// 刷新表格
|
||||||
|
await props.refreshTable!()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
//error('验证过程中出现错误', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string, data: DevType.ResPqDevType,icd: ICD.ResICD[]) => {
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
titleType.value = sign
|
||||||
|
dialogVisible.value = true
|
||||||
|
|
||||||
|
icdOptions.value = icd
|
||||||
|
|
||||||
|
if (data.id) {
|
||||||
|
formContent.value = { ...data }
|
||||||
|
} else {
|
||||||
|
resetFormContent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
const props = defineProps<{
|
||||||
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
|
}>()
|
||||||
|
|
||||||
|
</script>
|
||||||
173
frontend/src/views/machine/devType/index.vue
Normal file
173
frontend/src/views/machine/devType/index.vue
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
<template>
|
||||||
|
<div class='table-box' ref='popupBaseView'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:request-api='getTableList'
|
||||||
|
>
|
||||||
|
<!-- :requestApi="getRoleList" -->
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader='scope'>
|
||||||
|
<el-button v-auth.devType="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
|
<el-button v-auth.devType="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 表格操作 -->
|
||||||
|
<template #operation='scope'>
|
||||||
|
<el-button v-auth.devType="'edit'" type='primary' link :icon='EditPen' :model-value='false'
|
||||||
|
@click="openDialog('edit', scope.row)">编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button v-auth.devType="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
<DevTypePopup :refresh-table='proTable?.getTableList' ref='devTypePopup' />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='useRole'>
|
||||||
|
import TimeControl from '@/components/TimeControl/index.vue'
|
||||||
|
import { type DevType } from '@/api/device/interface/devType'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {
|
||||||
|
getDevTypeList,
|
||||||
|
deleteDevType,
|
||||||
|
} from '@/api/device/devType/index.ts'
|
||||||
|
import { onBeforeMount, reactive, ref } from 'vue'
|
||||||
|
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
|
||||||
|
import { getICDAllList } from '@/api/device/icd'
|
||||||
|
import type { ICD } from '@/api/device/interface/icd'
|
||||||
|
|
||||||
|
// defineOptions({
|
||||||
|
// name: 'devType',
|
||||||
|
// })
|
||||||
|
const modeStore = useModeStore()
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
const devTypePopup = ref()
|
||||||
|
const icdOptions = ref<ICD.ResICD[]>([])
|
||||||
|
|
||||||
|
const getTableList = async (params: any) => {
|
||||||
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
|
return getDevTypeList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<DevType.ResPqDevType>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'name',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'power',
|
||||||
|
label: '工作电源',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'devChns',
|
||||||
|
label: '通道数',
|
||||||
|
minWidth: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'devVolt',
|
||||||
|
label: '额定电压(V)',
|
||||||
|
minWidth: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'devCurr',
|
||||||
|
label: '额定电流(A)',
|
||||||
|
minWidth: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'reportName',
|
||||||
|
label: '报告模版名称',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'icd',
|
||||||
|
label: '设备关联ICD',
|
||||||
|
minWidth: 200,
|
||||||
|
render: (scope) => {
|
||||||
|
// 查找ICD名称
|
||||||
|
const name = icdOptions.value.find(option => option.id === scope.row.icd)
|
||||||
|
return <span>{name?.name}</span>
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'createTime',
|
||||||
|
label: '创建时间',
|
||||||
|
width: 200,
|
||||||
|
render: scope => {
|
||||||
|
if (scope.row.createTime) {
|
||||||
|
const date = new Date(scope.row.createTime);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 打开 drawer(新增、编辑)
|
||||||
|
const openDialog = (titleType: string, row: Partial<DevType.ResPqDevType> = {}) => {
|
||||||
|
devTypePopup.value?.open(titleType, row,icdOptions.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 批量删除设备
|
||||||
|
const batchDelete = async (id: string[]) => {
|
||||||
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
||||||
|
await useHandleData(deleteDevType, id, '删除所选设备类型')
|
||||||
|
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除设备
|
||||||
|
const handleDelete = async (params: DevType.ResPqDevType) => {
|
||||||
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||||
|
await useHandleData(deleteDevType, [params.id] , `删除【${params.name}】设备类型`)
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
const response = await getICDAllList({
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
path: '',
|
||||||
|
state: 1
|
||||||
|
})
|
||||||
|
icdOptions.value = (response.data as ICD.ResICD[]).map(item => ({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
path: item.path,
|
||||||
|
state: item.state,
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -2,46 +2,47 @@
|
|||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="设备台账信息">
|
<el-tab-pane label="设备台账信息">
|
||||||
<div class="form-grid">
|
<div >
|
||||||
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' :disabled="false">
|
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' :disabled="false" label-width="auto" class="form-three">
|
||||||
<el-divider >设备信息</el-divider>
|
<el-divider >设备信息</el-divider>
|
||||||
<el-row :gutter="24" >
|
<el-form-item label="装置编号" prop="createId" >
|
||||||
<el-col :span="8">
|
<el-input v-model="formContent.createId" placeholder="请输入装置编号" @input="handleInput" />
|
||||||
<el-form-item label="设备名称" prop="name" :label-width="100">
|
</el-form-item>
|
||||||
<el-input v-model='formContent.name' placeholder="请输入设备名称"/>
|
<el-form-item label="设备名称" prop="name" >
|
||||||
|
<el-input v-model='formContent.name' placeholder="请输入设备名称" :disabled="scene === '1'"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label='设备类型' prop='devType' >
|
||||||
<el-col :span="8">
|
<el-select v-model="formContent.devType" filterable clearable placeholder="请选择设备类型" @change="handleDevTypeChange">
|
||||||
<el-form-item label='设备类型' prop='devType' :label-width="100">
|
|
||||||
<el-select v-model="formContent.devType" clearable placeholder="请选择设备类型">
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Dev_Type')"
|
v-for="item in devTypeOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label='预投计划' prop='preinvestmentPlan' v-if="scene ==='1'">
|
||||||
<el-col :span="8">
|
<el-select v-model="formContent.preinvestmentPlan" clearable placeholder="请选择预投计划">
|
||||||
<el-form-item label='设备模式' prop='pattern' :label-width="100">
|
<el-option
|
||||||
<el-select v-model="formContent.pattern" clearable placeholder="请选择设备模式" disabled>
|
v-for="item in dictStore.getDictData('Preinvestment_Plan')"
|
||||||
<el-option
|
|
||||||
v-for="item in dictStore.getDictData('Pattern')"
|
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<!-- <el-form-item label='设备模式' prop='pattern' >-->
|
||||||
|
<!-- <el-select v-model="formContent.pattern" clearable placeholder="请选择设备模式" disabled>-->
|
||||||
</el-row>
|
<!-- <el-option -->
|
||||||
|
<!-- v-for="item in dictStore.getDictData('Pattern')"-->
|
||||||
<el-row :gutter="24" >
|
<!-- :key="item.id"-->
|
||||||
<el-col :span="8">
|
<!-- :label="item.name"-->
|
||||||
<el-form-item label='生产厂商' prop='manufacturer' :label-width="100">
|
<!-- :value="item.id"-->
|
||||||
<el-select v-model="formContent.manufacturer" clearable placeholder="请选择生产厂商">
|
<!-- />-->
|
||||||
|
<!-- </el-select>-->
|
||||||
|
<!-- </el-form-item> -->
|
||||||
|
<el-form-item label='设备厂家' prop='manufacturer' v-if="scene != '1'">
|
||||||
|
<el-select v-model="formContent.manufacturer" clearable placeholder="请选择设备厂家">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Dev_Manufacturers')"
|
v-for="item in dictStore.getDictData('Dev_Manufacturers')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@@ -50,79 +51,32 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label="出厂日期" prop="createDate" v-if="scene === '0'">
|
||||||
<el-col :span="8">
|
<el-date-picker
|
||||||
<el-form-item label="生产日期" prop="createDate" :label-width="100">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="formContent.createDate"
|
v-model="formContent.createDate"
|
||||||
placeholder="请选择生产日期"
|
placeholder="请选择出厂日期"
|
||||||
:disabled-date="disabledDate"
|
:disabled-date="disabledDate"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
<el-form-item label="固件版本" prop="hardwareVersion" v-if="scene === '0'">
|
||||||
<el-form-item label="出厂编号" prop="createId" placeholder="请输入出厂编号" :label-width="100">
|
|
||||||
<el-input v-model="formContent.createId" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="24" >
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="固件版本" prop="hardwareVersion" :label-width="100">
|
|
||||||
<el-input v-model="formContent.hardwareVersion" placeholder="请输入固件版本"/>
|
<el-input v-model="formContent.hardwareVersion" placeholder="请输入固件版本"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label="软件版本" prop="softwareVersion" v-if="scene === '0'">
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="软件版本" prop="softwareVersion" :label-width="100">
|
|
||||||
<el-input v-model="formContent.softwareVersion" placeholder="请输入软件版本"/>
|
<el-input v-model="formContent.softwareVersion" placeholder="请输入软件版本"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
|
||||||
|
|
||||||
</el-row>
|
|
||||||
<el-divider >参数信息</el-divider>
|
<el-divider >参数信息</el-divider>
|
||||||
<el-row :gutter="24" >
|
<el-form-item label="通道数" prop="devChns" >
|
||||||
<el-col :span="8">
|
<el-input v-model='formContent.devChns' :disabled="true"/>
|
||||||
<el-form-item label="设备通道数" prop="devChns" :label-width="100">
|
|
||||||
<el-select v-model="formContent.devChns" clearable placeholder="请选择设备通道数">
|
|
||||||
<el-option
|
|
||||||
v-for="item in dictStore.getDictData('Dev_Chns')"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label="额定电压(V)" prop="devVolt" >
|
||||||
<el-col :span="8">
|
<el-input v-model='formContent.devVolt' :disabled="true"/>
|
||||||
<el-form-item label="额定电压(V)" prop="devVolt" :label-width="100">
|
|
||||||
<el-select v-model="formContent.devVolt" clearable placeholder="请选择额定电压">
|
|
||||||
<el-option
|
|
||||||
v-for="item in dictStore.getDictData('Dev_Volt')"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label="额定电流(A)" prop="devCurr" >
|
||||||
<el-col :span="8">
|
<el-input v-model='formContent.devCurr' :disabled="true"/>
|
||||||
<el-form-item label="额定电流(A)" prop="devCurr" :label-width="100">
|
|
||||||
<el-select v-model="formContent.devCurr" clearable placeholder="请选择额定电流">
|
|
||||||
<el-option
|
|
||||||
v-for="item in dictStore.getDictData('Dev_Curr')"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label='通讯协议' prop='protocol' >
|
||||||
</el-row>
|
<el-select v-model="formContent.protocol" clearable placeholder="请选择通讯协议" >
|
||||||
<el-row :gutter="24" >
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label='通讯协议' prop='protocol' :label-width="100">
|
|
||||||
<el-select v-model="formContent.protocol" clearable placeholder="请选择通讯协议" @change="handleEncryptionChange">
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Protocol')"
|
v-for="item in dictStore.getDictData('Protocol')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@@ -131,73 +85,49 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label="IP地址" prop="ip" >
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="IP地址" prop="ip" :label-width="100">
|
|
||||||
<IPAddress v-model:value="formContent.ip"/>
|
<IPAddress v-model:value="formContent.ip"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label="端口号" prop="port" placeholder="请输入端口号" >
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="端口号" prop="port" placeholder="请输入端口号" :label-width="100">
|
|
||||||
<el-input v-model="formContent.port" />
|
<el-input v-model="formContent.port" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label='是否加密' prop='encryptionFlag' >
|
||||||
|
<el-select v-model="formContent.encryptionFlag" clearable placeholder="请选择是否加密">
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-row :gutter="24" >
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label='是否加密' prop='encryptionFlag' :label-width="100">
|
|
||||||
<el-select v-model="formContent.encryptionFlag" clearable placeholder="请选择是否加密" @change="handleEncryptionChange">
|
|
||||||
<el-option label="是" :value="1"></el-option>
|
<el-option label="是" :value="1"></el-option>
|
||||||
<el-option label="否" :value="0"></el-option>
|
<el-option label="否" :value="0"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label='识别码' prop='series' clearable v-if="formContent.encryptionFlag">
|
||||||
<el-col :span="8" v-if="IsPasswordShow">
|
<el-input v-model='formContent.series' placeholder="请输入识别码" show-password/>
|
||||||
<el-form-item label='识别码' prop='series' clearable placeholder="请输入识别码" :label-width="100">
|
|
||||||
<el-input v-model='formContent.series' show-password/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label='密钥' prop='devKey' clearable v-if="formContent.encryptionFlag">
|
||||||
<el-col :span="8" v-if="IsPasswordShow">
|
<el-input v-model='formContent.devKey' placeholder="请输入密钥" show-password/>
|
||||||
<el-form-item label='密钥' prop='devKey' clearable placeholder="请输入密钥" :label-width="100">
|
|
||||||
<el-input v-model='formContent.devKey' show-password/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label='样品编号' prop='sampleID' clearable v-if="DevIsShow && scene === '0'">
|
||||||
</el-row>
|
<el-input v-model='formContent.sampleID' placeholder="请输入样品编号" />
|
||||||
<el-row :gutter="24" v-if="DevIsShow">
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label='样品编号' prop='sampleID' clearable placeholder="请输入样品编号" :label-width="100">
|
|
||||||
<el-input v-model='formContent.sampleID' />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label='送样日期' prop='arrivedDate' v-if="scene === '0'">
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label='送样日期' prop='arrivedDate' :label-width="100">
|
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="formContent.arrivedDate"
|
v-model="formContent.arrivedDate"
|
||||||
placeholder="请选择送样日期"
|
placeholder="请选择送样日期"
|
||||||
:disabled-date="disabledDate"
|
:disabled-date="disabledDate"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label='所属地市' prop='cityName' clearable placeholder="请输入所属地市" v-if="MonIsShow">
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="24" v-if="MonIsShow">
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label='所属地市' prop='cityName' clearable placeholder="请输入所属地市" :label-width="100">
|
|
||||||
<el-input v-model='formContent.cityName' />
|
<el-input v-model='formContent.cityName' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label='所属供电公司' prop='gDName' clearable placeholder="请输入所属供电公司" v-if="MonIsShow">
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label='所属供电公司' prop='gDName' clearable placeholder="请输入所属供电公司" :label-width="100">
|
|
||||||
<el-input v-model='formContent.gDName' />
|
<el-input v-model='formContent.gDName' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label='所属电站' prop='subName' clearable placeholder="请输入所属电站" v-if="MonIsShow">
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label='所属电站' prop='subName' clearable placeholder="请输入所属电站" :label-width="100">
|
|
||||||
<el-input v-model='formContent.subName' />
|
<el-input v-model='formContent.subName' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item v-auth.device="'factorFlag'" label="是否支持系数校准" prop='factorFlag'>
|
||||||
</el-row>
|
<el-radio-group v-model="formContent.factorFlag" >
|
||||||
|
<el-radio :value="1">是</el-radio>
|
||||||
|
<el-radio :value="0">否</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -230,9 +160,12 @@ import MonitorTable from '@/views/machine/device/components/monitorTab.vue';
|
|||||||
|
|
||||||
const MonIsShow = ref(false)
|
const MonIsShow = ref(false)
|
||||||
const DevIsShow = ref(false)
|
const DevIsShow = ref(false)
|
||||||
const IsPasswordShow = ref(false)
|
// 存储设备类型选项
|
||||||
|
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||||
|
// const IsPasswordShow = ref(false)
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const mode = ref()
|
const mode = ref()
|
||||||
|
const scene = ref('')
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
const disabledDate = (time: Date) => {
|
const disabledDate = (time: Date) => {
|
||||||
@@ -249,18 +182,22 @@ const disabledDate = (time: Date) => {
|
|||||||
devType:'',
|
devType:'',
|
||||||
devChns:1,
|
devChns:1,
|
||||||
devVolt:57.74,
|
devVolt:57.74,
|
||||||
devCurr:1,
|
devCurr:5,
|
||||||
manufacturer: '',
|
manufacturer:'',
|
||||||
createDate: '',
|
createDate: dayjs().format('YYYY-MM-DD'),
|
||||||
createId: '',
|
createId: '',
|
||||||
hardwareVersion: '',
|
hardwareVersion: '',
|
||||||
softwareVersion: '',
|
softwareVersion: '',
|
||||||
protocol: 'MMS',
|
protocol: 'MMS',
|
||||||
ip: '',
|
ip: '172.17.102.200',
|
||||||
port: 102,
|
port: 102,
|
||||||
encryptionFlag: 1,
|
encryptionFlag: 0,
|
||||||
reCheckNum:0,
|
reCheckNum:0,
|
||||||
state: 1,
|
state: 1,
|
||||||
|
factorFlag:0,
|
||||||
|
icdId:'',
|
||||||
|
power:'',
|
||||||
|
preinvestmentPlan:''
|
||||||
})
|
})
|
||||||
return { dialogVisible, titleType, formContent }
|
return { dialogVisible, titleType, formContent }
|
||||||
}
|
}
|
||||||
@@ -275,18 +212,22 @@ const disabledDate = (time: Date) => {
|
|||||||
devType:'',
|
devType:'',
|
||||||
devChns:1,
|
devChns:1,
|
||||||
devVolt:57.74,
|
devVolt:57.74,
|
||||||
devCurr:1,
|
devCurr:5,
|
||||||
manufacturer: '',
|
manufacturer: '',
|
||||||
createDate: '',
|
createDate: dayjs().format('YYYY-MM-DD'),
|
||||||
createId: '',
|
createId: '',
|
||||||
hardwareVersion: '',
|
hardwareVersion: '',
|
||||||
softwareVersion: '',
|
softwareVersion: '',
|
||||||
protocol: 'MMS',
|
protocol: 'MMS',
|
||||||
ip: '',
|
ip: '172.17.102.200',
|
||||||
port: 102,
|
port: 102,
|
||||||
encryptionFlag: 1,
|
encryptionFlag: 0,
|
||||||
reCheckNum:0,
|
reCheckNum:0,
|
||||||
state: 1,
|
state: 1,
|
||||||
|
factorFlag:0,
|
||||||
|
icdId:'',
|
||||||
|
power:'',
|
||||||
|
preinvestmentPlan:''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,38 +237,69 @@ const disabledDate = (time: Date) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 定义表单校验规则
|
// 定义表单校验规则
|
||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
const baseRules: Record<string, Array<FormItemRule>> = {
|
||||||
devType: [{ required: true, message: '设备类型必选!', trigger: 'change' }],
|
devType: [{ required: true, message: '设备类型必选!', trigger: 'change' }],
|
||||||
pattern: [{ required: true, message: '设备模式必填!', trigger: 'blur' }],
|
pattern: [{ required: true, message: '设备模式必填!', trigger: 'blur' }],
|
||||||
name: [{ required: true, message: '设备名称必填!', trigger: 'blur' }],
|
devChns: [
|
||||||
devChns: [{ required: true, message: '设备通道数必填!', trigger: 'blur' },
|
{ required: true, message: '设备通道数必填!', trigger: 'blur' },
|
||||||
// 指定正则,此处是数字正则
|
{ pattern: /^[1-9]\d*$/, message: '设备通道数为大于1的整数', trigger: 'blur' }
|
||||||
{ pattern: /^[1-9]\d*$/, message: '设备通道数为大于1的整数', trigger: 'blur' }],
|
],
|
||||||
devVolt: [{ required: true, message: '额定电压必填!', trigger: 'blur' },
|
devVolt: [
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: '额定电压格式错误', trigger: 'blur' }],
|
{ required: true, message: '额定电压必填!', trigger: 'blur' },
|
||||||
devCurr: [{ required: true, message: '额定电流必填!', trigger: 'blur' },
|
{ pattern: /^\d+(\.\d+)?$/, message: '额定电压格式错误', trigger: 'blur' }
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: '额定电流格式错误', trigger: 'blur' }],
|
],
|
||||||
createDate: [{ required: true, message: '生产日期必填!', trigger: 'blur' }],
|
devCurr: [
|
||||||
createId: [{ required: true, message: '出厂编号必填!', trigger: 'blur' }],
|
{ required: true, message: '额定电流必填!', trigger: 'blur' },
|
||||||
hardwareVersion: [{ required: true, message: '固件版本必填!', trigger: 'blur' }],
|
{ pattern: /^\d+(\.\d+)?$/, message: '额定电流格式错误', trigger: 'blur' }
|
||||||
softwareVersion: [{ required: true, message: '软件版本必填!', trigger: 'blur' }],
|
],
|
||||||
ip:[{ required: true, message: 'IP地址必填!', trigger: 'blur' } ,
|
createId: [{ required: true, message: '装置编号必填!', trigger: 'blur' }
|
||||||
{ pattern: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, message: 'IP地址格式错误', trigger: 'blur' }],
|
],
|
||||||
port:[{ required: true, message: '端口号必填!', trigger: 'blur' },
|
ip: [
|
||||||
{ pattern: /^(6553[0-5]|655[0-2][0-9]|64[0-9]{3}|[1-5]?[0-9]{1,4})$/, message: '端口号范围0到65535的整数', trigger: 'blur' }],
|
{ required: true, message: 'IP地址必填!', trigger: 'blur' },
|
||||||
manufacturer: [{ required: true, message: '生产厂家必选!', trigger: 'change' }],
|
{ pattern: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, message: 'IP地址格式错误', trigger: 'blur' }
|
||||||
encryptionFlag: [{ required: true, message: '是否加密必选!', trigger: 'change' }],
|
],
|
||||||
protocol: [{ required: true, message: '通讯协议必选!', trigger: 'change' }],
|
port: [
|
||||||
// series: [],
|
{ required: true, message: '端口号必填!', trigger: 'blur' },
|
||||||
// devKey: []
|
{ pattern: /^(6553[0-5]|655[0-2][0-9]|64[0-9]{3}|[1-5]?[0-9]{1,4})$/, message: '端口号范围0到65535的整数', trigger: 'blur' }
|
||||||
series : [
|
],
|
||||||
{ required: true, message: '请输入识别码', trigger: 'blur' }
|
encryptionFlag: [{ required: true, message: '是否加密必选!', trigger: 'change' }],
|
||||||
],
|
protocol: [{ required: true, message: '通讯协议必选!', trigger: 'change' }],
|
||||||
devKey : [
|
series: [{ required: true, message: '请输入识别码', trigger: 'blur' }],
|
||||||
{ required: true, message: '请输入密钥', trigger: 'blur' }
|
devKey: [{ required: true, message: '请输入密钥', trigger: 'blur' }]
|
||||||
],
|
};
|
||||||
})
|
|
||||||
|
// 使用计算属性根据 scene 动态生成规则
|
||||||
|
const rules = computed(() => {
|
||||||
|
const dynamicRules = { ...baseRules };
|
||||||
|
|
||||||
|
if (scene.value === '0'){//只有电科院需要展示
|
||||||
|
dynamicRules.createDate= [{ required: true, message: '出厂日期必填!', trigger: 'blur' }];
|
||||||
|
}
|
||||||
|
if (scene.value === '1'){//只有楼下出厂需要展示
|
||||||
|
dynamicRules.preinvestmentPlan= [{ required: true, message: '预投计划必选!', trigger: 'change' }];
|
||||||
|
dynamicRules.createId= [{ required: true, message: '装置编号必填!', trigger: 'blur' },
|
||||||
|
{ pattern: /^\d+$/, message: '装置编号为数字', trigger: 'blur' }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (scene.value !== '0') {
|
||||||
|
dynamicRules.name = [{ required: true, message: '设备名称必填!', trigger: 'blur' }];
|
||||||
|
dynamicRules.hardwareVersion = [{ required: true, message: '固件版本必填!', trigger: 'blur' }];
|
||||||
|
dynamicRules.softwareVersion = [{ required: true, message: '软件版本必填!', trigger: 'blur' }];
|
||||||
|
dynamicRules.manufacturer = [{ required: true, message: '生产厂家必选!', trigger: 'change' }];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scene.value !== '2') {
|
||||||
|
dynamicRules.name = [{ required: true, message: '设备名称必填!', trigger: 'blur' }];
|
||||||
|
dynamicRules.manufacturer = [{ required: true, message: '生产厂家必选!', trigger: 'change' }];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return dynamicRules;
|
||||||
|
});
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
@@ -343,19 +315,25 @@ const disabledDate = (time: Date) => {
|
|||||||
const save = () => {
|
const save = () => {
|
||||||
try {
|
try {
|
||||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
|
||||||
if (formContent.value.encryptionFlag === 1) {
|
if (formContent.value.encryptionFlag === 0) {
|
||||||
handleEncryptionChange(1)
|
formContent.value.series = ''
|
||||||
} else {
|
formContent.value.devKey = ''
|
||||||
handleEncryptionChange(0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
formContent.value.createDate = dayjs(formContent.value.createDate).format('YYYY-MM-DD');
|
formContent.value.createDate = dayjs(formContent.value.createDate).format('YYYY-MM-DD');
|
||||||
|
formContent.value.name = formContent.value.createId
|
||||||
if (formContent.value.arrivedDate)
|
if (formContent.value.arrivedDate)
|
||||||
{
|
{
|
||||||
formContent.value.arrivedDate = dayjs(formContent.value.arrivedDate).format('YYYY-MM-DD');
|
formContent.value.arrivedDate = dayjs(formContent.value.arrivedDate).format('YYYY-MM-DD');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//保存时判是否加密,把识别码密钥字段清空
|
||||||
|
if(formContent.value.encryptionFlag === 0){
|
||||||
|
formContent.value.series = null
|
||||||
|
formContent.value.devKey = null
|
||||||
|
}
|
||||||
|
|
||||||
if (formContent.value.id) {
|
if (formContent.value.id) {
|
||||||
await updatePqDev(formContent.value);
|
await updatePqDev(formContent.value);
|
||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
@@ -374,6 +352,7 @@ const disabledDate = (time: Date) => {
|
|||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close()
|
close()
|
||||||
// 刷新表格
|
// 刷新表格
|
||||||
await props.refreshTable!()
|
await props.refreshTable!()
|
||||||
@@ -387,8 +366,10 @@ const disabledDate = (time: Date) => {
|
|||||||
|
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = (sign: string, data: Device.ResPqDev,currentMode: string) => {
|
const open = async (sign: string, data: Device.ResPqDev,currentMode: string,currentScene: string,devType:Device.ResDev[] ) => {
|
||||||
|
devTypeOptions.value = devType
|
||||||
mode.value = currentMode
|
mode.value = currentMode
|
||||||
|
scene.value = currentScene
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
|
||||||
@@ -401,35 +382,72 @@ const open = (sign: string, data: Device.ResPqDev,currentMode: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.encryptionFlag === 1) {
|
if (data.encryptionFlag === 1) {
|
||||||
handleEncryptionChange(1)
|
//handleEncryptionChange(1)
|
||||||
} else {
|
} else {
|
||||||
handleEncryptionChange(0)
|
//handleEncryptionChange(0)
|
||||||
}
|
}
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
formContent.value = { ...data }
|
formContent.value = { ...data }
|
||||||
} else {
|
} else {
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
handleEncryptionChange(1)
|
if(scene.value === '2'){
|
||||||
|
const manufacturers = dictStore.getDictData('Dev_Manufacturers');
|
||||||
|
const nanjingCanxuan = manufacturers.find(item => item.name === '南京灿能');
|
||||||
|
if(nanjingCanxuan){
|
||||||
|
formContent.value.manufacturer = nanjingCanxuan.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//handleEncryptionChange(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置表单
|
// 重置表单
|
||||||
dialogFormRef.value?.resetFields()
|
dialogFormRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
const handleEncryptionChange = (value: number) => {
|
// const handleEncryptionChange = (value: number) => {
|
||||||
// 根据是否加密来显示或隐藏识别码和密钥
|
// // 根据是否加密来显示或隐藏识别码和密钥
|
||||||
if(value === 1){
|
// if(value === 1){
|
||||||
IsPasswordShow.value = true
|
// IsPasswordShow.value = true
|
||||||
|
//
|
||||||
}else
|
// }else
|
||||||
{
|
// {
|
||||||
IsPasswordShow.value = false
|
// IsPasswordShow.value = false
|
||||||
// formContent.value.series = ''
|
// // formContent.value.series = ''
|
||||||
// formContent.value.devKey = ''
|
// // formContent.value.devKey = ''
|
||||||
// rules.value.series = [];
|
// // rules.value.series = [];
|
||||||
// rules.value.devKey = [];
|
// // rules.value.devKey = [];
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
const handleDevTypeChange = (value: string) => {
|
||||||
|
// 在这里处理选中事件的逻辑
|
||||||
|
const dev = devTypeOptions.value.find(t =>t.id === value)
|
||||||
|
if (dev) {
|
||||||
|
formContent.value.devChns = dev.devChns; // 默认值为1
|
||||||
|
formContent.value.devCurr = dev.devCurr; // 默认值为1
|
||||||
|
formContent.value.devVolt = dev.devVolt; // 默认值为1
|
||||||
|
formContent.value.icdId = dev.icd
|
||||||
|
formContent.value.power = dev.power
|
||||||
|
} else {
|
||||||
|
formContent.value.devChns = 1; // 默认值为1
|
||||||
|
formContent.value.devCurr = 1; // 默认值为1
|
||||||
|
formContent.value.devVolt = 57.74; // 默认值为1
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleInput = (value: string) => {
|
||||||
|
// 在这里处理选中事件的逻辑
|
||||||
|
if(scene.value === '1'){
|
||||||
|
formContent.value.name = value
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|||||||
@@ -5,11 +5,12 @@
|
|||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
|
:style="{ height: '326px',maxHeight: '400px',overflow:'hidden'}"
|
||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button type='primary' :icon='CirclePlus'>新增</el-button>
|
<el-button type='primary' :icon='CirclePlus'>新增</el-button>
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>批量删除</el-button>
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation>
|
<template #operation>
|
||||||
@@ -30,7 +31,10 @@
|
|||||||
import { type ColumnProps } from '@/components/ProTable/interface'
|
import { type ColumnProps } from '@/components/ProTable/interface'
|
||||||
import { type Monitor } from '@/api/device/interface/monitor'
|
import { type Monitor } from '@/api/device/interface/monitor'
|
||||||
|
|
||||||
|
// 定义 props
|
||||||
|
const props = defineProps<{
|
||||||
|
MonIsShow: boolean;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
|
|||||||
@@ -10,16 +10,24 @@
|
|||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button v-auth.device="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
<el-button v-auth.device="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
<el-button v-auth.device="'export'" type='primary' :icon='Upload' plain @click='downloadFile()'>导出</el-button>
|
<el-button v-auth.device="'export'" type='primary' :icon='Upload' plain @click='downloadFile()'>导出</el-button>
|
||||||
<el-button v-auth.device="'import'" type='primary' :icon='Download' plain @click='importFile()'>导入</el-button>
|
<el-button v-auth.device="'import'" type='primary' :icon='Download' plain @click="importFile('')"
|
||||||
|
v-if='modeStore.currentMode != "比对式"'>导入
|
||||||
|
</el-button>
|
||||||
|
<el-button v-auth.device="'import'" type='primary' :icon='Download' plain @click="importFile('比对式')"
|
||||||
|
v-if='modeStore.currentMode === "比对式"'>导入
|
||||||
|
</el-button>
|
||||||
<el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
<el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
批量删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<template #operation='scope'>
|
||||||
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' :model-value="false" @click="openDialog('edit', scope.row)">编辑</el-button>
|
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' :model-value='false'
|
||||||
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
@click="openDialog('edit', scope.row)">编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</ProTable>
|
</ProTable>
|
||||||
@@ -39,23 +47,36 @@ import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/i
|
|||||||
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
||||||
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { getPqDevList, deletePqDev, exportPqDev, downloadTemplate, importPqDev } from '@/api/device/device/index.ts'
|
import {
|
||||||
import { ElMessageBox } from 'element-plus'
|
getPqDevList,
|
||||||
import { computed, reactive, ref } from 'vue'
|
deletePqDev,
|
||||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
getPqDev,
|
||||||
|
exportCNDev,
|
||||||
|
downloadCNDevTemplate,
|
||||||
|
importCNDev,
|
||||||
|
} from '@/api/device/device/index.ts'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { onBeforeMount, reactive, ref } from 'vue'
|
||||||
|
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
|
||||||
|
|
||||||
const modeStore = useModeStore();
|
// defineOptions({
|
||||||
|
// name: 'device',
|
||||||
|
// })
|
||||||
|
const modeStore = useModeStore()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
const appSceneStore = useAppSceneStore()
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
const devicePopup = ref()
|
const devicePopup = ref()
|
||||||
// 定义包含和排除的单位
|
const boundPqDevList = ref<Device.ReqPqDevParams[]>([])//根据检测计划id查询出所有已绑定的设备
|
||||||
|
// 存储设备类型选项
|
||||||
|
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||||
|
|
||||||
const getTableList = (params: any) => {
|
const getTableList = async (params: any) => {
|
||||||
let newParams = JSON.parse(JSON.stringify(params))
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
newParams.searchEndTime = endDate.value
|
newParams.searchEndTime = endDate.value
|
||||||
newParams.searchBeginTime = startDate.value
|
newParams.searchBeginTime = startDate.value
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||||
newParams.pattern = patternId
|
newParams.pattern = patternId
|
||||||
return getPqDevList(newParams)
|
return getPqDevList(newParams)
|
||||||
}
|
}
|
||||||
@@ -67,38 +88,60 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '设备名称',
|
label: '名称',
|
||||||
search: { el: 'input' },
|
search: { el: 'input' },
|
||||||
|
// isShow: appSceneStore.currentScene != '1',
|
||||||
|
// ...(appSceneStore.currentScene != '1' ? {
|
||||||
|
// search: { el: 'input' },
|
||||||
|
// } : {}),
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'devType',
|
prop: 'devType',
|
||||||
label: '设备类型',
|
label: '设备类型',
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
enum: dictStore.getDictData('Dev_Type'),
|
render: (scope) => {
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
// 查找设备类型名称
|
||||||
},
|
const name = devTypeOptions.value.find(option => option.id === scope.row.devType)
|
||||||
{
|
return <span>{name?.name}</span>
|
||||||
prop: 'createDate',
|
|
||||||
label: '生产日期',
|
|
||||||
minWidth: 200,
|
|
||||||
search: {
|
|
||||||
span: 2,
|
|
||||||
render: () => {
|
|
||||||
return (
|
|
||||||
<div class='flx-flex-start'>
|
|
||||||
<TimeControl
|
|
||||||
default={'月'}
|
|
||||||
onUpdate-dates={handleDateChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'createDate',
|
||||||
|
label: '出厂日期',
|
||||||
|
minWidth: 200,
|
||||||
|
isShow: appSceneStore.currentScene === '0',
|
||||||
|
...(appSceneStore.currentScene === '0' ? {
|
||||||
|
search: {
|
||||||
|
render: () => {
|
||||||
|
return (
|
||||||
|
<div class='flx-flex-start'>
|
||||||
|
<TimeControl
|
||||||
|
default={'月'}
|
||||||
|
onUpdate-dates={handleDateChange}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} : {}),
|
||||||
|
// search: {
|
||||||
|
// span: 2,
|
||||||
|
// render: () => {
|
||||||
|
// return (
|
||||||
|
// <div class='flx-flex-start'>
|
||||||
|
// <TimeControl
|
||||||
|
// default={'月'}
|
||||||
|
// onUpdate-dates={handleDateChange}
|
||||||
|
// />
|
||||||
|
// </div>
|
||||||
|
// )
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'devChns',
|
prop: 'devChns',
|
||||||
label: '设备通道数',
|
label: '通道数',
|
||||||
minWidth: 110,
|
minWidth: 110,
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -116,12 +159,33 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'manufacturer',
|
prop: 'manufacturer',
|
||||||
label: '生产厂商',
|
label: '设备厂家',
|
||||||
enum: dictStore.getDictData('Dev_Manufacturers'),
|
enum: dictStore.getDictData('Dev_Manufacturers'),
|
||||||
search: { el: 'select', props: { filterable: true }, order: 1 },
|
isShow: appSceneStore.currentScene != '1',
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
...(appSceneStore.currentScene != '1' ? {
|
||||||
|
search: { el: 'select', props: { filterable: true }, order: 1 },
|
||||||
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
|
} : {}),
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'createTime',
|
||||||
|
label: '创建时间',
|
||||||
|
width: 200,
|
||||||
|
render: scope => {
|
||||||
|
if (scope.row.createTime) {
|
||||||
|
const date = new Date(scope.row.createTime);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -135,53 +199,82 @@ const handleDateChange = (startDateTemp: string, endDateTemp: string) => {
|
|||||||
}
|
}
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
||||||
devicePopup.value?.open(titleType, row,modeStore.currentMode)
|
devicePopup.value?.open(titleType, row, modeStore.currentMode, appSceneStore.currentScene, devTypeOptions.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 批量删除设备
|
// 批量删除设备
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
await useHandleData(deletePqDev, id, '删除所选设备')
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
||||||
|
await useHandleData(deletePqDev, { 'ids': id, 'pattern': patternId }, '删除所选设备')
|
||||||
|
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除设备
|
// 删除设备
|
||||||
const handleDelete = async (params: Device.ResPqDev) => {
|
const handleDelete = async (params: Device.ResPqDev) => {
|
||||||
await useHandleData(deletePqDev, [params.id], `删除【${params.name}】设备`)
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||||
|
await useHandleData(deletePqDev, { 'ids': [params.id], 'pattern': patternId }, `删除【${params.name}】设备`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出设备
|
// 导出设备
|
||||||
const downloadFile = async () => {
|
const downloadFile = async () => {
|
||||||
// 获取当前的搜索参数
|
// 获取当前的搜索参数
|
||||||
const searchParam = proTable.value?.searchParam || {};
|
const searchParam = proTable.value?.searchParam || {}
|
||||||
|
|
||||||
// 将开始时间和结束时间添加到搜索参数中
|
// 将开始时间和结束时间添加到搜索参数中
|
||||||
searchParam.searchBeginTime = startDate.value;
|
searchParam.searchBeginTime = startDate.value
|
||||||
searchParam.searchEndTime = endDate.value;
|
searchParam.searchEndTime = endDate.value
|
||||||
|
|
||||||
ElMessageBox.confirm('确认导出被检设备?', '温馨提示', { type: 'warning' }).then(() =>
|
ElMessageBox.confirm('确认导出被检设备?', '温馨提示', { type: 'warning' }).then(() => {
|
||||||
useDownload(exportPqDev,'被检设备导出数据', proTable.value?.searchParam, false,'.xlsx'),
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||||
|
useDownload(exportCNDev, '被检设备导出数据', { ...proTable.value?.searchParam, pattern: patternId }, false, '.xlsx')
|
||||||
)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//导入设备
|
//导入设备
|
||||||
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
||||||
|
|
||||||
const importFile = async () => {
|
const importFile = async (pattern: string) => {
|
||||||
const params = {
|
|
||||||
title: '被检设备',
|
if (pattern === '比对式') {
|
||||||
showCover: false,
|
// const params = {
|
||||||
tempApi: downloadTemplate,
|
// title: '被检设备',
|
||||||
importApi: importPqDev,
|
// showCover: false,
|
||||||
getTableList: proTable.value?.getTableList,
|
// tempApi: downloadTemplate,
|
||||||
|
// importApi: importPqDev,
|
||||||
|
// getTableList: proTable.value?.getTableList,
|
||||||
|
// }
|
||||||
|
// deviceImportExcel.value?.acceptParams(params)
|
||||||
|
} else {
|
||||||
|
const params = {
|
||||||
|
title: '被检设备',
|
||||||
|
showCover: false,
|
||||||
|
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id,
|
||||||
|
tempApi: downloadCNDevTemplate,
|
||||||
|
importApi: importCNDev,
|
||||||
|
// importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev,
|
||||||
|
getTableList: proTable.value?.getTableList,
|
||||||
|
}
|
||||||
|
deviceImportExcel.value?.acceptParams(params)
|
||||||
}
|
}
|
||||||
deviceImportExcel.value?.acceptParams(params)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
const response = await getPqDev()
|
||||||
|
devTypeOptions.value = (response.data as Device.ResDev[]).map(item => ({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
icd: item.icd,
|
||||||
|
power: item.power,
|
||||||
|
devVolt: item.devVolt,
|
||||||
|
devCurr: item.devCurr,
|
||||||
|
devChns: item.devChns,
|
||||||
|
}))
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -2,40 +2,47 @@
|
|||||||
|
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<el-table :data="errorData"
|
<el-table :data="errorData.value"
|
||||||
height="500"
|
height="500"
|
||||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
:header-cell-style="rowClass"
|
||||||
:cell-style="{ textAlign: 'center' }"
|
:cell-style="{ textAlign: 'center' }"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:span-method="spanMethod"
|
:span-method="spanMethod"
|
||||||
border
|
:border="true"
|
||||||
class="custom-table">
|
class="custom-table"
|
||||||
<el-table-column prop="measured" label="被测量" />
|
>
|
||||||
<el-table-column prop="deviceLevel" label="检测装置级别" />
|
<el-table-column label="被测量">
|
||||||
<el-table-column prop="measurementType" label="测量类型" />
|
<el-table-column prop="col1" width="150"/>
|
||||||
<el-table-column prop="condition" label="测量条件" />
|
<el-table-column prop="col2" width="120" />
|
||||||
<el-table-column prop="maxErrorValue" label="最大误差" />
|
</el-table-column>
|
||||||
</el-table>
|
<el-table-column prop="deviceLevel" label="检测装置级别" width="120"/>
|
||||||
<div class="notes-container">
|
<el-table-column prop="measurementType" label="测量类型" />
|
||||||
<label>注1:UN:测量的标称电压;IN:测量仪器的标称电流;Uh和Ih:测量值,h表示谐波次数。</label>
|
<el-table-column prop="condition" label="测量条件" />
|
||||||
<label>注2:对于数字式接入监测终端,与电能质量信号采集单元联合准确度需满足本表要求。</label>
|
<el-table-column prop="maxErrorValue" label="最大误差" />
|
||||||
</div>
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="left-align-label">注1:UN:测量的标称电压;IN:测量仪器的标称电流;Uh和Ih:测量值,h表示谐波次数。</label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="left-align-label">注2:对于数字式接入监测终端,与电能质量信号采集单元联合准确度需满足本表要求。</label>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="IndicatorTypeDialog">
|
<script lang="ts" setup name="IndicatorTypeDialog">
|
||||||
import { defineProps, defineEmits, reactive,watch,ref,computed } from 'vue';
|
import { defineProps, defineEmits, reactive,watch,ref,computed, type CSSProperties } from 'vue';
|
||||||
import { dialogBig} from '@/utils/elementBind'
|
import { dialogBig} from '@/utils/elementBind'
|
||||||
import type { ColumnProps } from '@/components/ProTable/interface'
|
import type { ColumnProps } from '@/components/ProTable/interface'
|
||||||
import type { ErrorSystem } from '@/api/device/interface/error'
|
import type { ErrorSystem } from '@/api/device/interface/error'
|
||||||
import errorDataList from '@/api/device/error/errorData'
|
import errorDataList from '@/api/device/error/errorData'
|
||||||
import type { TableColumnCtx } from 'element-plus'
|
import type { TableColumnCtx } from 'element-plus'
|
||||||
import { da } from 'element-plus/es/locale';
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
|
||||||
const errorData = errorDataList.errordetail
|
const dictStore = useDictStore()
|
||||||
|
const errorData = ref<ErrorSystem.Error_detail[]>([]);
|
||||||
const dialogTitle = ref()
|
const dialogTitle = ref()
|
||||||
|
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref
|
||||||
function useMetaInfo() {
|
function useMetaInfo() {
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const formContent = ref<ErrorSystem.ErrorSystemList>({
|
const formContent = ref<ErrorSystem.ErrorSystemList>({
|
||||||
@@ -59,68 +66,209 @@ interface SpanMethodProps {
|
|||||||
columnIndex: number
|
columnIndex: number
|
||||||
}
|
}
|
||||||
|
|
||||||
const spanMethod = ({
|
const rowClass = ({ row, column, rowIndex, columnIndex }: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
|
||||||
|
let res: CSSProperties = {
|
||||||
|
textAlign: 'center' as CSSProperties['textAlign'],
|
||||||
|
backgroundColor: '#003078',
|
||||||
|
color: '#fff'
|
||||||
|
}
|
||||||
|
if (rowIndex === 1) {
|
||||||
|
res = { ...res, display: 'none' }
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const spanMethod = computed(() => {
|
||||||
|
return devLevelName.value === 'A级' ? spanAMethod : spanSMethod
|
||||||
|
})
|
||||||
|
|
||||||
|
const spanAMethod = ({
|
||||||
row,
|
row,
|
||||||
column,
|
column,
|
||||||
rowIndex,
|
rowIndex,
|
||||||
columnIndex,
|
columnIndex,
|
||||||
}: SpanMethodProps) => {
|
}: SpanMethodProps) => {
|
||||||
if (columnIndex === 0 ) { // 检查是否为第一列
|
if (columnIndex === 0) {
|
||||||
if (rowIndex === 2 || rowIndex === 21) { // 检查是否为第三行
|
if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
||||||
return {
|
return {
|
||||||
rowspan: 2, // 合并行数
|
rowspan: 1,
|
||||||
colspan: 1, // 单元格列数
|
colspan: 2,
|
||||||
};
|
}
|
||||||
}else if (rowIndex === 8) { //
|
}
|
||||||
|
if (rowIndex === 2) {//2三相不平衡跨三行两列
|
||||||
return {
|
return {
|
||||||
rowspan: 8,
|
rowspan: 3,
|
||||||
colspan: 1,
|
colspan: 2,
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
else if (rowIndex === 16) { //
|
if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 ||
|
||||||
|
rowIndex >= 9 && rowIndex <= 15 ||
|
||||||
|
rowIndex >= 17 && rowIndex <= 19 ||
|
||||||
|
rowIndex === 22 || rowIndex === 24) {//这些行不显示
|
||||||
return {
|
return {
|
||||||
rowspan: 4,
|
rowspan: 0,
|
||||||
colspan: 1,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else if (rowIndex === 3 || rowIndex === 9 || rowIndex === 10|| rowIndex === 11
|
|
||||||
|| rowIndex === 12|| rowIndex === 13|| rowIndex === 14|| rowIndex === 15
|
|
||||||
|| rowIndex === 17 || rowIndex === 18|| rowIndex === 19
|
|
||||||
|| rowIndex === 22) { // 检查是否为第四行
|
|
||||||
return {
|
|
||||||
rowspan: 0, // 不显示该单元格
|
|
||||||
colspan: 0,
|
colspan: 0,
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex === 5 || rowIndex === 23) {//5电压波动,23电压暂降暂升中断跨两列
|
||||||
|
return {
|
||||||
|
rowspan: 2,
|
||||||
|
colspan: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex === 8) {//谐波和间谐波跨八行两列
|
||||||
|
return {
|
||||||
|
rowspan: 8,
|
||||||
|
colspan: 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex === 16) {//高频次谐波跨八行两列
|
||||||
|
return {
|
||||||
|
rowspan: 4,
|
||||||
|
colspan: 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex === 21 || rowIndex === 22) {//电流跨两行两列
|
||||||
|
return {
|
||||||
|
rowspan: 2,
|
||||||
|
colspan: 2,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(columnIndex === 2) { // 检查是否为第三列
|
if (columnIndex === 1) {
|
||||||
if (rowIndex === 2
|
if (rowIndex <= 4 || rowIndex >= 7 && rowIndex <= 22) {
|
||||||
|| rowIndex === 8|| rowIndex === 10|| rowIndex === 12|| rowIndex === 14
|
|
||||||
|| rowIndex === 16|| rowIndex === 18
|
|
||||||
|| rowIndex === 21) {
|
|
||||||
return {
|
return {
|
||||||
rowspan: 2,
|
rowspan: 0,
|
||||||
colspan: 1,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else if (rowIndex === 3
|
|
||||||
|| rowIndex === 9|| rowIndex === 11|| rowIndex === 13|| rowIndex === 15
|
|
||||||
|| rowIndex === 17|| rowIndex === 19
|
|
||||||
|| rowIndex === 22) { // 检查是否为第四行
|
|
||||||
return {
|
|
||||||
rowspan: 0, // 不显示该单元格
|
|
||||||
colspan: 0,
|
colspan: 0,
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (columnIndex === 2 || columnIndex === 3) {
|
||||||
|
if (rowIndex === 2 || rowIndex === 8 || rowIndex === 10 ||
|
||||||
|
rowIndex === 12 || rowIndex === 14 || rowIndex === 16 ||
|
||||||
|
rowIndex === 18 || rowIndex === 21) {
|
||||||
|
return {
|
||||||
|
rowspan: 2,
|
||||||
|
colspan: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex === 3 || rowIndex === 9 || rowIndex === 11 ||
|
||||||
|
rowIndex === 13 || rowIndex === 15 || rowIndex === 17 ||
|
||||||
|
rowIndex === 19 || rowIndex === 22) {
|
||||||
|
return {
|
||||||
|
rowspan: 0,
|
||||||
|
colspan: 0,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 关闭弹窗
|
|
||||||
const close = () => {
|
const spanSMethod = ({
|
||||||
dialogVisible.value = false
|
row,
|
||||||
|
column,
|
||||||
|
rowIndex,
|
||||||
|
columnIndex,
|
||||||
|
}: SpanMethodProps) => {
|
||||||
|
if (columnIndex === 0) {
|
||||||
|
if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
||||||
|
return {
|
||||||
|
rowspan: 1,
|
||||||
|
colspan: 2,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (rowIndex === 2) {//2三相不平衡跨三行两列
|
||||||
|
return {
|
||||||
|
rowspan: 3,
|
||||||
|
colspan: 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 || rowIndex === 7 ||
|
||||||
|
rowIndex >= 10 && rowIndex <= 12 ||
|
||||||
|
rowIndex >= 14 && rowIndex <= 16 ||
|
||||||
|
rowIndex === 19 || rowIndex === 21 || rowIndex === 22) {//这些行不显示
|
||||||
|
return {
|
||||||
|
rowspan: 0,
|
||||||
|
colspan: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex === 5 || rowIndex === 20) {//5电压波动,23电压暂降暂升中断跨两行
|
||||||
|
return {
|
||||||
|
rowspan: 3,
|
||||||
|
colspan: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex === 9 || rowIndex === 13) {//谐波和间谐波跨八行两列
|
||||||
|
return {
|
||||||
|
rowspan: 4,
|
||||||
|
colspan: 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex === 18 ) {//电流跨两行两列
|
||||||
|
return {
|
||||||
|
rowspan: 2,
|
||||||
|
colspan: 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (columnIndex === 1) {
|
||||||
|
if (rowIndex === 6 || rowIndex === 21) {
|
||||||
|
return {
|
||||||
|
rowspan: 2,
|
||||||
|
colspan: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex <= 4 || rowIndex >= 7 && rowIndex <= 19 || rowIndex === 22) {
|
||||||
|
return {
|
||||||
|
rowspan: 0,
|
||||||
|
colspan: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (columnIndex === 2) {
|
||||||
|
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
|
||||||
|
rowIndex === 11 || rowIndex === 13 || rowIndex === 15 ||
|
||||||
|
rowIndex === 18 || rowIndex === 21) {
|
||||||
|
return {
|
||||||
|
rowspan: 2,
|
||||||
|
colspan: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex === 3 || rowIndex === 7 ||
|
||||||
|
rowIndex === 10 || rowIndex === 12 ||
|
||||||
|
rowIndex === 14 || rowIndex === 16 ||
|
||||||
|
rowIndex === 19 || rowIndex === 22) {
|
||||||
|
return {
|
||||||
|
rowspan: 0,
|
||||||
|
colspan: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(columnIndex === 3){
|
||||||
|
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
|
||||||
|
rowIndex === 11 || rowIndex === 13 ||rowIndex === 15 ||
|
||||||
|
rowIndex === 18 || rowIndex === 21){
|
||||||
|
return {
|
||||||
|
rowspan: 2,
|
||||||
|
colspan: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 ||
|
||||||
|
rowIndex === 12 || rowIndex === 14 ||rowIndex === 16 ||
|
||||||
|
rowIndex === 19 || rowIndex === 22){
|
||||||
|
return {
|
||||||
|
rowspan: 0,
|
||||||
|
colspan: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
||||||
@@ -128,6 +276,15 @@ const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
|||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
formContent.value = data as ErrorSystem.ErrorSystemList;
|
formContent.value = data as ErrorSystem.ErrorSystemList;
|
||||||
|
|
||||||
|
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';;
|
||||||
|
|
||||||
|
if(devLevelName.value === 'A级'){
|
||||||
|
errorData.value = errorDataList.errorADetail as unknown as ErrorSystem.Error_detail[];
|
||||||
|
}else{
|
||||||
|
errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,5 +307,13 @@ const props = defineProps<{
|
|||||||
|
|
||||||
.notes-container {
|
.notes-container {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
width: 100%; /* 确保注释容器宽度与表格一致 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notes-container label {
|
||||||
|
display: block; /* 使每个label标签上下排列 */
|
||||||
|
margin-bottom: 10px; /* 调整两个label之间的间距 */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,68 +1,79 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button :icon='CirclePlus' type="primary" @click="openAddDialog">新增</el-button>
|
<el-button :icon='CirclePlus' type="primary" @click="openAddDialog">新增</el-button>
|
||||||
<el-button :icon='Delete' type="danger" plain :disabled='!multipleSelection.length' @click="deleteSelectedRows">批量删除</el-button>
|
<el-button :icon='Delete' type="danger" plain :disabled='!multipleSelection.length' @click="deleteSelectedRows">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<el-table :data="tableData"
|
<el-table :data="tableData"
|
||||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
||||||
:cell-style="{ textAlign: 'center' }"
|
:cell-style="{ textAlign: 'center' }"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@selection-change="handleSelectionChange" >
|
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}"
|
||||||
|
@selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column prop="nextId" label="序号" width="60" />
|
<el-table-column prop="sort" label="序号" width="60" />
|
||||||
<el-table-column prop="type" label="电能质量检测指标类型" width="181">
|
<el-table-column prop="type" label="误差类型" min-width="180">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-select v-model="row.type" placeholder="选择指标类型" >
|
<el-cascader style="min-width: 180px;"
|
||||||
<el-option v-for="item in dictStore.getDictData('Pq_Test_Type')"
|
:options="errorOptions"
|
||||||
:key="item.id"
|
v-model="row.errorType"
|
||||||
:label="item.name"
|
:props="{ checkStrictly: false, emitPath: false }"
|
||||||
:value="item.id"/>
|
placeholder="请选择误差类型"
|
||||||
</el-select>
|
@change="handleErrorTypeChange($event, row)"/>
|
||||||
</template>
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="type" label="脚本类型" min-width="230">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-cascader style="min-width: 230px;"
|
||||||
|
:options="scriptOptions"
|
||||||
|
v-model="row.scriptType"
|
||||||
|
:props="{ checkStrictly: false, emitPath: false }"
|
||||||
|
placeholder="请选择脚本类型"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="起止范围" >
|
<el-table-column label="起止范围" >
|
||||||
<el-table-column label="起始">
|
<el-table-column label="起始" width="150">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-row type="flex">
|
<el-row type="flex" :gutter="24">
|
||||||
<el-col :span="14">
|
<el-col :span="12">
|
||||||
<el-select v-model="row.startFlag" placeholder="选择起始值" style="width: 70px;">
|
<el-select v-model="row.startFlag" placeholder="选择起始值" style="width: 70px;" @change="(value) => handleStartFlagChange(row, value)">
|
||||||
<el-option label="无" :value="2"></el-option>
|
<el-option label="无" :value="2"></el-option>
|
||||||
<el-option label=">=" :value="1"></el-option>
|
<el-option label=">=" :value="1"></el-option>
|
||||||
<el-option label=">" :value="0"></el-option>
|
<el-option label=">" :value="0"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="12">
|
||||||
<el-input v-model= "row.startValue" style="width: 70px;"
|
<el-input v-model= "row.startValue" style="width: 60px;" :disabled="isStartValueDisabled[row.sort]"
|
||||||
/>
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="结束">
|
<el-table-column label="结束" width="150">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-row type="flex" >
|
<el-row type="flex" :gutter="24" >
|
||||||
<el-col :span="14">
|
<el-col :span="12">
|
||||||
<el-select v-model="row.endFlag" placeholder="选择结束值" style="width: 70px;">
|
<el-select v-model="row.endFlag" placeholder="选择结束值" style="width: 70px;" @change="(value) => handleEndFlagChange(row, value)">
|
||||||
<el-option label="无" :value="2"></el-option>
|
<el-option label="无" :value="2"></el-option>
|
||||||
<el-option label="<=" :value="1"></el-option>
|
<el-option label="<=" :value="1"></el-option>
|
||||||
<el-option label="<" :value="0"></el-option>
|
<el-option label="<" :value="0"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="12">
|
||||||
<el-input v-model= "row.endValue" style="width: 70px;"/>
|
<el-input v-model= "row.endValue" style="width: 60px;" :disabled="isEndValueDisabled[row.sort]"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="单位" width="115">
|
<el-table-column label="单位" width="130">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-select v-model="row.conditionType" placeholder="选择单位">
|
<el-select v-model="row.conditionType" placeholder="选择单位">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Condition_Type')"
|
v-for="item in dictStore.getDictData('Condition_Type')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="Number(item.value)"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
@@ -74,20 +85,20 @@
|
|||||||
<el-input v-model= "row.maxErrorValue" style="width: 70px;"/>
|
<el-input v-model= "row.maxErrorValue" style="width: 70px;"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="误差类型">
|
<el-table-column label="误差类型" width="180">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-select v-model="row.errorValueType" placeholder="选择误差类型">
|
<el-select v-model="row.errorValueType" placeholder="选择误差类型">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Error_Value_Type')"
|
v-for="item in dictStore.getDictData('Error_Value_Type')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="Number(item.value)"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="150">
|
<el-table-column label="操作" min-width="150">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button type="primary" link :icon='CopyDocument' @click="copyRow(row)">复制</el-button>
|
<el-button type="primary" link :icon='CopyDocument' @click="copyRow(row)">复制</el-button>
|
||||||
<el-button type='primary' link :icon='Delete' @click="deleteRow(row)">删除</el-button>
|
<el-button type='primary' link :icon='Delete' @click="deleteRow(row)">删除</el-button>
|
||||||
@@ -101,55 +112,184 @@
|
|||||||
import { type ErrorSystem } from '@/api/device/interface/error';
|
import { type ErrorSystem } from '@/api/device/interface/error';
|
||||||
import { useDictStore, } from '@/stores/modules/dict'
|
import { useDictStore, } from '@/stores/modules/dict'
|
||||||
import {CirclePlus, Delete, EditPen,CopyDocument} from '@element-plus/icons-vue'
|
import {CirclePlus, Delete, EditPen,CopyDocument} from '@element-plus/icons-vue'
|
||||||
import { FormItemRule } from 'element-plus';
|
import { type CascaderOption, type FormItemRule } from 'element-plus';
|
||||||
import { onMounted, type PropType, Ref, ref, watch } from 'vue';
|
import { el } from 'element-plus/es/locale';
|
||||||
|
import { type PropType, type Ref, ref, watch } from 'vue';
|
||||||
import { defineEmits } from 'vue';
|
import { defineEmits } from 'vue';
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
|
||||||
const emit = defineEmits(['updateTableData']);
|
const emit = defineEmits(['updateTableData']);
|
||||||
const multipleSelection = ref<number[]>([])
|
const multipleSelection = ref<number[]>([])
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
const isStartValueDisabled = ref<{ [key: number]: boolean }>({});
|
||||||
|
const isEndValueDisabled = ref<{ [key: number]: boolean }>({});
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
errorOptions: {
|
||||||
|
type: Array as PropType<CascaderOption[]>,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
|
scriptOptions: {
|
||||||
|
type: Array as PropType<CascaderOption[]>,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
tableData: {
|
tableData: {
|
||||||
type: Array as PropType<ErrorSystem.ErrorSystemDetail[]>,
|
type: Array as PropType<ErrorSystem.ErrorSystemDetail[]>,
|
||||||
default: () => []
|
default: () => []
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 监听 props.tableData 的变化,确保每次数据变化时都重新设置 nextId
|
|
||||||
watch(() => props.tableData, (newTableData) => {
|
|
||||||
for (let i = 0; i < newTableData.length; i++) {
|
|
||||||
newTableData[i].nextId = i + 1;
|
|
||||||
}
|
|
||||||
}, { immediate: true });
|
|
||||||
|
|
||||||
// 定义规则
|
// 定义一个 Map 来存储误差和脚本系统信息
|
||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
const errSysAndScriptMap = new Map<string, string>([
|
||||||
type: [{ required: true, message: '误差体系名称必填!', trigger: 'blur' }],
|
['Freq_Deviation_Freq','FREQ'],//频率偏差/频率---频率
|
||||||
|
['Vol_Deviation_Vol','VRMS'],//电压偏差/电压---电压/相电压有效值
|
||||||
});
|
['MSQI_V','V_UNBAN'],//三相不平衡/电压---电压/三相电压负序不平衡度
|
||||||
|
['MSQI_CUR','I_UNBAN'],//三相不平衡/电流---电流/三相电流负序不平衡度
|
||||||
|
['Voltage Fluctuation_Voltage Amplitude',''],//电压波动/电压幅值---
|
||||||
|
['Voltage Fluctuation_Duration',''],//电压波动/持续时间---
|
||||||
|
['Short Time Flicker Item','PST'],//闪变/短时间闪变---闪变/短时间闪变
|
||||||
|
['Harmonic_Voltage','V2-50'],//谐波/电压---谐波/谐波电压含有率
|
||||||
|
['Harmonic_Current','I2-50'],//谐波/电流---谐波/谐波电流幅值
|
||||||
|
['Harmonic_Angle','VA2-50'],//谐波/相角---谐波/谐波电压相角
|
||||||
|
['Harmonic_Angle','IA2-50'],//谐波/相角---谐波/谐波电流相角
|
||||||
|
['Harmonic_Power','P2-50'],//谐波/功率---谐波/谐波有功功率
|
||||||
|
['Interharmonic_Voltage','SV_1-49'],//间谐波/电压---谐波/间谐波电压含有率
|
||||||
|
['Interharmonic_Current','SI_1-49'],//间谐波/电流---谐波/间谐波电流幅值
|
||||||
|
['High Frequency Harmonic_Voltage',''],//高频次谐波/电压
|
||||||
|
['High Frequency Harmonic_Current',''],//高频次谐波/电流
|
||||||
|
['Power Item','P'],//功率/功率---功率
|
||||||
|
['Current Item','IRMS'],//电流/电流---电流/电流有效值
|
||||||
|
['Dip & Swell & Short duration interruption_Voltage','MAG'],//暂态/电压幅值/电压---暂态/电压幅值
|
||||||
|
['Dip & Swell & Short duration interruption_Duration','DUR'],//暂态/持续时间/时间---暂态/持续时间
|
||||||
|
]);
|
||||||
|
|
||||||
|
const handleErrorTypeChange = (value: any, row: any) =>{
|
||||||
|
|
||||||
|
// const matchedRow = findRowById(row.errorType, props.errorOptions);//选中误差id找对应结构中的含chilren的code
|
||||||
|
// console.log('matchedRow.code',matchedRow.code)
|
||||||
|
// const code = errSysAndScriptMap.get(matchedRow?.code || '') || ''; // 确保 code 不为 undefined
|
||||||
|
// console.log('code',code)
|
||||||
|
// if (code) {
|
||||||
|
// const matchedRow2 = findRowByCode(code, props.scriptOptions);//误差code映射脚本code,找对应脚本结构中含children的id
|
||||||
|
// console.log('matchedRow2',matchedRow2)
|
||||||
|
// if (matchedRow2) {
|
||||||
|
// row.scriptType = matchedRow2.value;
|
||||||
|
// }else{
|
||||||
|
// row.scriptType = '';//如果没有找到匹配的脚本,置空
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// row.scriptType = '';//如果没有找到匹配的脚本,置空
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 假设 props.errorOptions 是一个数组,每个元素可能包含 children 属性
|
||||||
|
const findRowById = (id: string, options: any[]): any | null => {
|
||||||
|
for (const option of options) {
|
||||||
|
if (option.value === id) {
|
||||||
|
return option;
|
||||||
|
}
|
||||||
|
if (option.children && option.children.length > 0) {
|
||||||
|
const result = findRowById(id, option.children);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 假设 props.errorOptions 是一个数组,每个元素可能包含 children 属性
|
||||||
|
const findRowByCode = (code: string, options: any[]): any | null => {
|
||||||
|
for (const option of options) {
|
||||||
|
if (option.code === code) {
|
||||||
|
return option;
|
||||||
|
}
|
||||||
|
if (option.children && option.children.length > 0) {
|
||||||
|
const result = findRowByCode(code, option.children);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 监听 props.tableData 的变化,确保每次数据变化时都重新设置 sort
|
||||||
|
watch(() => props.tableData, async (newTableData) => {
|
||||||
|
for (let i = 0; i < newTableData.length; i++) {
|
||||||
|
newTableData[i].sort = i + 1;
|
||||||
|
if (newTableData[i].startFlag === 2) {
|
||||||
|
newTableData[i].startValue = null; // 设置 startValue 为 null
|
||||||
|
}
|
||||||
|
if (newTableData[i].endFlag === 2) {
|
||||||
|
newTableData[i].endValue = null; // 设置 endValue 为 null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 重新设置 isStartValueDisabled 和 isEndValueDisabled,并清空输入框
|
||||||
|
props.tableData.forEach(row => {
|
||||||
|
isStartValueDisabled.value[row.sort] = row.startFlag === 2;
|
||||||
|
|
||||||
|
});
|
||||||
|
props.tableData.forEach(row => {
|
||||||
|
isEndValueDisabled.value[row.sort] = row.endFlag === 2;
|
||||||
|
});
|
||||||
|
}, { immediate: true });
|
||||||
|
|
||||||
|
|
||||||
|
// 处理 startFlag 变化的方法
|
||||||
|
const handleStartFlagChange = (row: ErrorSystem.ErrorSystemDetail, value: number) => {
|
||||||
|
if (value === 2) {
|
||||||
|
row.startValue = null; // 清空输入框
|
||||||
|
isStartValueDisabled.value[row.sort] = true; // 禁用输入框
|
||||||
|
} else {
|
||||||
|
isStartValueDisabled.value[row.sort] = false; // 启用输入框
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理 endFlag 变化的方法
|
||||||
|
const handleEndFlagChange = (row: ErrorSystem.ErrorSystemDetail, value: number) => {
|
||||||
|
if (value === 2) {
|
||||||
|
row.endValue = null; // 清空输入框
|
||||||
|
isEndValueDisabled.value[row.sort] = true; // 禁用输入框
|
||||||
|
} else {
|
||||||
|
isEndValueDisabled.value[row.sort] = false; // 启用输入框
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//选中
|
//选中
|
||||||
const handleSelectionChange = (selection: ErrorSystem.ErrorSystemDetail[]) => {
|
const handleSelectionChange = (selection: ErrorSystem.ErrorSystemDetail[]) => {
|
||||||
multipleSelection.value = selection.map(row => row.nextId); // 更新选中的行
|
multipleSelection.value = selection.map(row => row.sort); // 更新选中的行
|
||||||
};
|
};
|
||||||
//新增
|
//新增
|
||||||
const openAddDialog = () => {
|
const openAddDialog = () => {
|
||||||
const newRow = {
|
// 获取字典数据
|
||||||
nextId: props.tableData.length + 1,
|
const conditionTypes = dictStore.getDictData('Condition_Type');
|
||||||
id: '',
|
const errorValueTypes = dictStore.getDictData('Error_Value_Type');
|
||||||
errorSysId: "",
|
const newRow = {
|
||||||
type: "",
|
sort: props.tableData.length + 1,
|
||||||
maxErrorValue: 0,
|
id: '',
|
||||||
errorValueType: ""
|
startFlag:2,
|
||||||
|
endFlag:2,
|
||||||
|
conditionType: conditionTypes.length > 0 ? Number(conditionTypes[3].value) : 0, // 设置默认值为第一个选项的值
|
||||||
|
errorValueType:errorValueTypes.length > 0 ? Number(errorValueTypes[0].value) : 0, // 设置默认值为第一个选项的值
|
||||||
|
errorSysId: "",
|
||||||
|
errorType: "",
|
||||||
|
scriptType: "",
|
||||||
|
maxErrorValue: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
emit('updateTableData', [...props.tableData, newRow]);
|
emit('updateTableData', [...props.tableData, newRow]);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const copyRow = (row: ErrorSystem.ErrorSystemDetail) => {
|
const copyRow = (row: ErrorSystem.ErrorSystemDetail) => {
|
||||||
// 深拷贝行数据
|
// 深拷贝行数据
|
||||||
const newRow = { ...row };
|
const newRow = { ...row };
|
||||||
const maxNextId = Math.max(...props.tableData.map(item => item.nextId), 0);
|
const maxNextId = Math.max(...props.tableData.map(item => item.sort), 0);
|
||||||
newRow.nextId = maxNextId + 1;
|
newRow.sort = maxNextId + 1;
|
||||||
emit('updateTableData', [...props.tableData, newRow]);
|
emit('updateTableData', [...props.tableData, newRow]);
|
||||||
};
|
};
|
||||||
//删除行
|
//删除行
|
||||||
@@ -163,7 +303,7 @@ const deleteRow = (row:ErrorSystem.ErrorSystemDetail) => {
|
|||||||
};
|
};
|
||||||
//批量删除选中行
|
//批量删除选中行
|
||||||
const deleteSelectedRows = () => {
|
const deleteSelectedRows = () => {
|
||||||
const newTableData = props.tableData.filter(row => !multipleSelection.value.includes(row.nextId));
|
const newTableData = props.tableData.filter(row => !multipleSelection.value.includes(row.sort));
|
||||||
multipleSelection.value = []; // 清空已选择的行
|
multipleSelection.value = []; // 清空已选择的行
|
||||||
emit('updateTableData', newTableData);
|
emit('updateTableData', newTableData);
|
||||||
};
|
};
|
||||||
@@ -176,6 +316,7 @@ const deleteSelectedRows = () => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
margin-bottom: 10px; /* 调整这里的值以增加或减少间距 */
|
margin-bottom: 10px; /* 调整这里的值以增加或减少间距 */
|
||||||
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-table th, .el-table td {
|
.el-table th, .el-table td {
|
||||||
|
|||||||
@@ -1,54 +1,42 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1500px">
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="基础信息">
|
<el-tab-pane label="基础信息">
|
||||||
<div class="form-grid">
|
<div >
|
||||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules'>
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' label-width="auto" class="form-three">
|
||||||
<el-row :gutter="24" >
|
<el-form-item label="标准号" prop="standardName" >
|
||||||
<el-col :span="8">
|
<el-input v-model='formContent.standardName' placeholder="请填写标准号"/>
|
||||||
<el-form-item label="误差体系名称" prop="name" :label-width="110">
|
</el-form-item>
|
||||||
<el-input v-model='formContent.name' placeholder="标准号+年份+设备等级"/>
|
<el-form-item label="标准推行年份" prop="standardTime" >
|
||||||
</el-form-item>
|
<el-date-picker
|
||||||
</el-col>
|
v-model="formContent.standardTime"
|
||||||
<el-col :span="8">
|
type="year"
|
||||||
<el-form-item label="参照标准名称" prop="standardName" :label-width="110">
|
placeholder="请选择标准推行年份"
|
||||||
<el-input v-model='formContent.standardName'/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
<el-form-item label="适用设备等级" prop="devLevel" >
|
||||||
<el-col :span="8">
|
<el-select v-model='formContent.devLevel' placeholder="请选择设备等级">
|
||||||
<el-form-item label="发布时间" prop="standardTime" :label-width="110">
|
<el-option
|
||||||
<el-input v-model="formContent.standardTime" />
|
v-for="item in dictStore.getDictData('Dev_Level')"
|
||||||
</el-form-item>
|
:key="item.id"
|
||||||
</el-col>
|
:label="item.name"
|
||||||
</el-row>
|
:value="item.id"/>
|
||||||
<el-row :gutter="24" >
|
</el-select>
|
||||||
<el-col :span="8">
|
</el-form-item>
|
||||||
<el-form-item label="适用设备等级" prop="devLevel" :label-width="110">
|
<el-form-item label="状态" prop="enable" >
|
||||||
<el-select v-model='formContent.devLevel' placeholder="请选择设备等级">
|
<el-select v-model='formContent.enable' placeholder="请选择状态">
|
||||||
<el-option
|
<el-option label="启用" :value="1"></el-option>
|
||||||
v-for="item in dictStore.getDictData('Dev_Level')"
|
<el-option label="不启用" :value="0"></el-option>
|
||||||
:key="item.id"
|
</el-select>
|
||||||
:label="item.name"
|
</el-form-item>
|
||||||
:value="item.id"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="状态" prop="enable" :label-width="110">
|
|
||||||
<el-select v-model='formContent.enable' placeholder="请选择状态">
|
|
||||||
<el-option label="启用" :value="1"></el-option>
|
|
||||||
<el-option label="不启用" :value="0"></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<ErrorSystemDetailTable :tableData="tableData" @updateTableData="handleTableDataUpdate"/>
|
|
||||||
|
|
||||||
|
<ErrorSystemDetailTable :tableData="tableData" :errorOptions="errorOptions" :scriptOptions="scriptOptions" @updateTableData="handleTableDataUpdate" />
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div >
|
<div >
|
||||||
<el-button @click='close()'>取 消</el-button>
|
<el-button @click='close()'>取 消</el-button>
|
||||||
@@ -61,22 +49,26 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="ErrorSystemDialog">
|
<script lang="ts" setup name="ErrorSystemDialog">
|
||||||
import{ElMessage, type FormInstance,type FormItemRule}from'element-plus'
|
import{type CascaderOption, ElMessage, type FormInstance,type FormItemRule}from'element-plus'
|
||||||
import { defineProps, defineEmits, reactive,watch,ref, Ref, computed } from 'vue';
|
import { defineProps, defineEmits, reactive,watch,ref, type Ref, computed } from 'vue';
|
||||||
import { dialogBig} from '@/utils/elementBind'
|
import { dialogBig} from '@/utils/elementBind'
|
||||||
import { addPqErrSys,updatePqErrSys,getPqErrSysListById} from '@/api/device/error/index'
|
import { addPqErrSys,updatePqErrSys,getPqErrSysListById} from '@/api/device/error/index'
|
||||||
import {CirclePlus, Delete, EditPen,FolderOpened,CopyDocument} from '@element-plus/icons-vue'
|
import {CirclePlus, Delete, EditPen,FolderOpened,CopyDocument} from '@element-plus/icons-vue'
|
||||||
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 { type Dict } from '@/api/system/dictionary/interface';
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const tableData = ref<ErrorSystem.ErrorSystemDetail[]>([]);
|
const tableData = ref<ErrorSystem.ErrorSystemDetail[]>([]);
|
||||||
|
const errorOptions: Ref<CascaderOption[]> = ref([]); // 修改这里
|
||||||
const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) => {
|
const scriptOptions: Ref<CascaderOption[]> = ref([]); // 修改这里
|
||||||
|
|
||||||
|
const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) => {
|
||||||
tableData.value = newTableData;
|
tableData.value = newTableData;
|
||||||
};
|
};
|
||||||
|
|
||||||
function useMetaInfo() {
|
function useMetaInfo() {
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
@@ -107,6 +99,7 @@
|
|||||||
state:1,
|
state:1,
|
||||||
pqErrSysDtlsList:[]
|
pqErrSysDtlsList:[]
|
||||||
}
|
}
|
||||||
|
tableData.value =[]
|
||||||
}
|
}
|
||||||
|
|
||||||
let dialogTitle = computed(() => {
|
let dialogTitle = computed(() => {
|
||||||
@@ -117,7 +110,7 @@
|
|||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
name: [{ required: true, message: '误差体系名称必填!', trigger: 'blur' }],
|
name: [{ required: true, message: '误差体系名称必填!', trigger: 'blur' }],
|
||||||
standardName: [{ required: true, message: '参照标准名称必填!', trigger: 'blur' }],
|
standardName: [{ required: true, message: '参照标准名称必填!', trigger: 'blur' }],
|
||||||
standardTime: [{ required: true, message: '标准推行时间必填!', trigger: 'blur' }],
|
standardTime: [{ required: true, message: '标准推行年份必选!', trigger: 'blur' }],
|
||||||
devLevel:[{ required: true, message: '请选择一项设备等级', trigger: 'change' },],
|
devLevel:[{ required: true, message: '请选择一项设备等级', trigger: 'change' },],
|
||||||
enable:[{ required: true, message: '请选择一项状态', trigger: 'change '},]
|
enable:[{ required: true, message: '请选择一项状态', trigger: 'change '},]
|
||||||
});
|
});
|
||||||
@@ -137,6 +130,12 @@
|
|||||||
try {
|
try {
|
||||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
// 确保 standardTime 是 Date 对象
|
||||||
|
if (formContent.value.standardTime) {
|
||||||
|
const date = new Date(formContent.value.standardTime);
|
||||||
|
formContent.value.standardTime = date.getFullYear().toString();
|
||||||
|
}
|
||||||
|
|
||||||
formContent.value.pqErrSysDtlsList = tableData.value
|
formContent.value.pqErrSysDtlsList = tableData.value
|
||||||
if (formContent.value.id) {
|
if (formContent.value.id) {
|
||||||
await updatePqErrSys(formContent.value);
|
await updatePqErrSys(formContent.value);
|
||||||
@@ -155,25 +154,90 @@
|
|||||||
console.error('验证过程中出现错误', err)
|
console.error('验证过程中出现错误', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 封装提取第二层节点的逻辑
|
||||||
|
const loadSecondLevelOptions = async () => {
|
||||||
|
const dictCode = '误差体系指标项'; // 替换为实际需要的字典代码
|
||||||
|
const dictCode2 = '脚本-误差'; // 替换为实际需要的字典代码
|
||||||
|
|
||||||
|
const resDictTree: Dict.ResDictTree = {
|
||||||
|
name: dictCode,
|
||||||
|
id: '',
|
||||||
|
pid: '',
|
||||||
|
pids: '',
|
||||||
|
code: '',
|
||||||
|
sort: 0
|
||||||
|
};
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
const resDictTree2: Dict.ResDictTree = {
|
||||||
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
name: dictCode2,
|
||||||
titleType.value = sign
|
id: '',
|
||||||
dialogVisible.value = true
|
pid: '',
|
||||||
if (data.id) {
|
pids: '',
|
||||||
const result = await getPqErrSysListById(data);
|
code: '',
|
||||||
if (result && result.data) {
|
sort: 0
|
||||||
formContent.value = result.data as ErrorSystem.ErrorSystemList;
|
};
|
||||||
|
|
||||||
tableData.value = formContent.value.pqErrSysDtlsList || []
|
// 并行请求两个字典树列表
|
||||||
|
const [result, result2] = await Promise.all([
|
||||||
|
getDictTreeList(resDictTree),
|
||||||
|
getDictTreeList(resDictTree2)
|
||||||
|
]);
|
||||||
|
|
||||||
|
const allOptions = convertToOptions(result.data as Dict.ResDictTree[]);
|
||||||
|
const allOptions2 = convertToOptions(result2.data as Dict.ResDictTree[]);
|
||||||
|
|
||||||
|
// 提取第二层节点
|
||||||
|
const secondLevelOptions: any[] = [];
|
||||||
|
allOptions.forEach(option => {
|
||||||
|
if (option.children && option.children.length > 0) {
|
||||||
|
secondLevelOptions.push(...option.children);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const secondLevelOptions2: any[] = [];
|
||||||
|
allOptions2.forEach(option => {
|
||||||
|
if (option.children && option.children.length > 0) {
|
||||||
|
secondLevelOptions2.push(...option.children);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 将第二层节点赋值给 options.value
|
||||||
|
errorOptions.value = secondLevelOptions;
|
||||||
|
scriptOptions.value = secondLevelOptions2;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 转换函数
|
||||||
|
const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
|
||||||
|
return dictTree.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name,
|
||||||
|
code: item.code,
|
||||||
|
children: item.children ? convertToOptions(item.children) : undefined
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
||||||
|
titleType.value = sign;
|
||||||
|
|
||||||
|
// 并行执行两个异步操作
|
||||||
|
const loadOptionsPromise = loadSecondLevelOptions();
|
||||||
|
const fetchDataPromise = data.id ? getPqErrSysListById(data) : Promise.resolve(null);
|
||||||
|
|
||||||
|
const [_, result] = await Promise.all([loadOptionsPromise, fetchDataPromise]);
|
||||||
|
|
||||||
|
if (result && result.data) {
|
||||||
|
formContent.value = result.data as ErrorSystem.ErrorSystemList;
|
||||||
|
tableData.value = formContent.value.pqErrSysDtlsList || [];
|
||||||
} else {
|
} else {
|
||||||
resetFormContent()
|
resetFormContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置表单
|
// 重置表单
|
||||||
dialogFormRef.value?.resetFields()
|
dialogFormRef.value?.resetFields();
|
||||||
}
|
dialogVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
@@ -183,22 +247,6 @@ const props = defineProps<{
|
|||||||
}>()
|
}>()
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.form-grid {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row; /* 横向排列 */
|
|
||||||
flex-wrap: wrap; /* 允许换行 */
|
|
||||||
}
|
|
||||||
.form-grid .el-form-item {
|
|
||||||
flex: 1 1 30%; /* 控件宽度 */
|
|
||||||
margin-right: 20px; /* 控件间距 */
|
|
||||||
}
|
|
||||||
.form-grid .el-form-item:last-child {
|
|
||||||
margin-right: 0; /* 最后一个控件不需要右边距 */
|
|
||||||
}
|
|
||||||
.el-tabs {
|
|
||||||
margin-bottom: 20px; /* 添加底部边距 */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
<el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
<el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
批量删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<template #operation='scope'>
|
||||||
<el-button type='primary' link :icon='View' @click="openDialog('view', scope.row)">查看</el-button>
|
<el-button v-auth.device="'view'" type='primary' link :icon='View' @click="openDialog('view', scope.row)">查看</el-button>
|
||||||
<el-button type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||||
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
@@ -37,6 +37,9 @@ import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStan
|
|||||||
import type { ErrorSystem } from '@/api/device/interface/error'
|
import type { ErrorSystem } from '@/api/device/interface/error'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { getPqErrSysList, deletePqErrSys} from '@/api/device/error/index'
|
import { getPqErrSysList, deletePqErrSys} from '@/api/device/error/index'
|
||||||
|
defineOptions({
|
||||||
|
name: 'errorSystem'
|
||||||
|
})
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
@@ -48,15 +51,15 @@ const columns = ref<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
|
|||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '误差体系名称',
|
label: '名称',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardName',
|
prop: 'standardName',
|
||||||
label: '参照标准名称',
|
label: '标准号',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardTime',
|
prop: 'standardTime',
|
||||||
label: '标准实施年份',
|
label: '标准推行年份',
|
||||||
width: 200,
|
width: 200,
|
||||||
search: { el: 'input' },
|
search: { el: 'input' },
|
||||||
},
|
},
|
||||||
|
|||||||
127
frontend/src/views/machine/icd/components/icdPopup.vue
Normal file
127
frontend/src/views/machine/icd/components/icdPopup.vue
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 基础信息弹出框 -->
|
||||||
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogSmall" @close="close" >
|
||||||
|
<div>
|
||||||
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules'>
|
||||||
|
<el-form-item label="名称" prop="name" >
|
||||||
|
<el-input v-model='formContent.name' placeholder="请输入icd名称"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="存储地址" prop="path" >
|
||||||
|
<el-input v-model='formContent.path' placeholder="请输入icd存储地址"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="close()">取消</el-button>
|
||||||
|
<el-button type="primary" @click="save()" >
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import{ ElMessage, type FormInstance,type FormItemRule } from 'element-plus'
|
||||||
|
import type { ProTableInstance } from '@/components/ProTable/interface'
|
||||||
|
import { ref,computed, Ref} from 'vue'
|
||||||
|
import { type ICD } from '@/api/device/interface/icd'
|
||||||
|
import {dialogSmall} from '@/utils/elementBind'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {addICD,updateICD} from '@/api/device/icd'
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
// 定义弹出组件元信息
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
function useMetaInfo() {
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const titleType = ref('add')
|
||||||
|
const formContent = ref<ICD.ResICD>({
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
path: '',
|
||||||
|
state: 1,
|
||||||
|
})
|
||||||
|
return { dialogVisible, titleType, formContent }
|
||||||
|
}
|
||||||
|
|
||||||
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
|
|
||||||
|
|
||||||
|
// 清空formContent
|
||||||
|
const resetFormContent = () => {
|
||||||
|
formContent.value = {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
path: '',
|
||||||
|
state: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let dialogTitle = computed(() => {
|
||||||
|
return titleType.value === 'add' ? '新增ICD' : '编辑ICD'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//定义规则
|
||||||
|
const formRuleRef = ref<FormInstance>()
|
||||||
|
//定义校验规则
|
||||||
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
|
name: [{ required: true, message: 'icd名称必填!', trigger: 'blur' }],
|
||||||
|
path: [{ required: true, message: 'icd存储地址必填!', trigger: 'blur' }],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 清空dialogForm中的值
|
||||||
|
resetFormContent()
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
|
try {
|
||||||
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
if (formContent.value.id) {
|
||||||
|
await updateICD(formContent.value);
|
||||||
|
} else {
|
||||||
|
await addICD(formContent.value);
|
||||||
|
}
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
close()
|
||||||
|
// 刷新表格
|
||||||
|
await props.refreshTable!()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
//error('验证过程中出现错误', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string, data: ICD.ResICD) => {
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
titleType.value = sign
|
||||||
|
dialogVisible.value = true
|
||||||
|
|
||||||
|
if (data.id) {
|
||||||
|
formContent.value = { ...data }
|
||||||
|
} else {
|
||||||
|
resetFormContent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
const props = defineProps<{
|
||||||
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
|
}>()
|
||||||
|
|
||||||
|
</script>
|
||||||
119
frontend/src/views/machine/icd/index.vue
Normal file
119
frontend/src/views/machine/icd/index.vue
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
<template>
|
||||||
|
<div class='table-box' ref='popupBaseView'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:request-api='getTableList'
|
||||||
|
>
|
||||||
|
<!-- :requestApi="getRoleList" -->
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader='scope'>
|
||||||
|
<el-button v-auth.devType="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
|
<el-button v-auth.devType="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 表格操作 -->
|
||||||
|
<template #operation='scope'>
|
||||||
|
<el-button v-auth.devType="'edit'" type='primary' link :icon='EditPen' :model-value='false'
|
||||||
|
@click="openDialog('edit', scope.row)">编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button v-auth.devType="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
<IcdPopup :refresh-table='proTable?.getTableList' ref='icdPopup' />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='useRole'>
|
||||||
|
import TimeControl from '@/components/TimeControl/index.vue'
|
||||||
|
import { type ICD } from '@/api/device/interface/icd'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {
|
||||||
|
getICDList,
|
||||||
|
deleteICD,
|
||||||
|
} from '@/api/device/icd/index.ts'
|
||||||
|
import { reactive, ref } from 'vue'
|
||||||
|
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'devType',
|
||||||
|
})
|
||||||
|
const modeStore = useModeStore()
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
const icdPopup = ref()
|
||||||
|
|
||||||
|
|
||||||
|
const getTableList = async (params: any) => {
|
||||||
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
|
return getICDList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<ICD.ResICD>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'name',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'path',
|
||||||
|
label: '存储地址',
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'createTime',
|
||||||
|
label: '创建时间',
|
||||||
|
render: scope => {
|
||||||
|
if (scope.row.createTime) {
|
||||||
|
const date = new Date(scope.row.createTime);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
// 打开 drawer(新增、编辑)
|
||||||
|
const openDialog = (titleType: string, row: Partial<ICD.ResICD> = {}) => {
|
||||||
|
icdPopup.value?.open(titleType, row)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 批量删除设备
|
||||||
|
const batchDelete = async (id: string[]) => {
|
||||||
|
await useHandleData(deleteICD, id, '删除所选icd')
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除设备
|
||||||
|
const handleDelete = async (params: ICD.ResICD) => {
|
||||||
|
await useHandleData(deleteICD, [params.id] , `删除【${params.name}】icd`)
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -123,8 +123,6 @@ const open = (currentMode: string) => {
|
|||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
const props = defineProps<{
|
|
||||||
refreshTable: (() => Promise<void>) | undefined;
|
|
||||||
}>()
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user