75 Commits

Author SHA1 Message Date
sjl
cf77572f41 设备类型报告模版只在楼下厂家展示 2025-05-06 10:08:57 +08:00
GGJ
fe6524404c 微调 2025-04-29 10:47:25 +08:00
caozehui
ccda7218f4 检测计划数据源字段调整、绑定设备样式调整 2025-04-28 09:18:52 +08:00
caozehui
ddd0e6a22b (间)谐波含有率可以为小数 2025-04-27 16:11:48 +08:00
caozehui
ed85453de1 误差体系切换时-生成报告 2025-04-25 14:32:17 +08:00
caozehui
04939606fc 间谐波电流、间谐波电流复制bug,tooltip位置调整 2025-04-24 16:16:04 +08:00
caozehui
2df455b667 暂态设定幅值最大为180% 2025-04-24 10:18:27 +08:00
caozehui
8fb214d7a7 微调 2025-04-23 15:28:35 +08:00
caozehui
4f2c8a8016 微调 2025-04-23 10:45:46 +08:00
caozehui
c2974dbe0d 微调 2025-04-22 15:52:03 +08:00
caozehui
3891e5459a 误差体系修改 2025-04-22 14:21:24 +08:00
caozehui
9ed47ac5bc 检测结果数据显示问题 2025-04-22 14:12:07 +08:00
caozehui
114fcd140d 微调 2025-04-22 13:49:59 +08:00
caozehui
19a30894f8 微调 2025-04-21 09:11:31 +08:00
caozehui
2134fea518 微调 2025-04-21 09:10:24 +08:00
caozehui
82f495ce3b 调整窗口大小 2025-04-18 13:42:48 +08:00
caozehui
f2ecff54a3 微调 2025-04-18 11:07:04 +08:00
caozehui
f56004ac15 微调 2025-04-17 14:47:32 +08:00
caozehui
5303c47248 微调 2025-04-17 10:21:38 +08:00
GGJ
37731592f7 微调 2025-04-16 10:17:37 +08:00
caozehui
c9e41e0c82 日志导出csv、报告模板编辑框样式调整 2025-04-15 09:45:00 +08:00
caozehui
4a80a88e6e 微调 2025-04-14 19:51:06 +08:00
caozehui
30b219e14d 微调 2025-04-14 14:43:29 +08:00
caozehui
ecec9adeea icd校验 2025-04-14 13:22:46 +08:00
caozehui
1853152138 日志分页查询及展示 2025-04-11 14:34:56 +08:00
GGJ
5619413f37 修改点击使能默认够选通道使能,修改暂态使能持续时间保持一致 2025-04-10 11:11:23 +08:00
caozehui
5b736bc475 微调 2025-04-10 10:50:53 +08:00
caozehui
2aa37c3fe3 微调 2025-04-09 20:42:17 +08:00
caozehui
4e0cb72f32 微调 2025-04-09 20:06:08 +08:00
caozehui
ce74ec4db7 bug修复 2025-04-09 19:30:00 +08:00
caozehui
9938306884 微调 2025-04-09 14:30:00 +08:00
caozehui
ef63fcf807 bug修复 2025-04-08 09:51:35 +08:00
caozehui
08cffa4256 bug修复 2025-04-08 09:43:12 +08:00
caozehui
e1a740f8bf 文件大小提示 2025-03-31 18:54:13 +08:00
caozehui
56d035253b 微调 2025-03-31 13:22:57 +08:00
caozehui
e7348107d0 解决forge库在桌面端无法使用的问题 2025-03-28 09:38:59 +08:00
caozehui
ea38b4eb21 微调 2025-03-28 09:31:46 +08:00
GGJ
67ef976739 Merge branch 'master' of http://192.168.1.22:3000/frontend/pqs-9100_client 2025-03-27 18:34:51 +08:00
GGJ
60145ec4f7 修改参考设定值添加单位 2025-03-27 18:34:40 +08:00
caozehui
81600ddc69 引入获取是否自动生成报告接口 2025-03-27 16:20:16 +08:00
caozehui
e0941d628b 引入获取是否自动生成报告接口 2025-03-27 15:54:27 +08:00
caozehui
760dcbf723 微调 2025-03-27 14:59:01 +08:00
caozehui
b75ecb8c66 微调 2025-03-26 15:42:40 +08:00
caozehui
39f4cfa670 微调 2025-03-25 15:49:32 +08:00
caozehui
862251b83c 微调 2025-03-25 15:08:25 +08:00
caozehui
312490ce59 微调 2025-03-24 19:56:11 +08:00
caozehui
d7df999cf2 登录接口加密传输登录信息 2025-03-24 19:22:56 +08:00
caozehui
e0b1b5907b 微调 2025-03-24 15:41:53 +08:00
sjl
f06ca03881 微调 2025-03-24 14:59:45 +08:00
caozehui
a9b80ed33c 微调 2025-03-24 10:46:16 +08:00
sjl
834230b26a 报告模版 2025-03-24 08:56:08 +08:00
caozehui
403ddbfb6e 微调 2025-03-20 19:42:46 +08:00
caozehui
ffb44ea909 微调 2025-03-20 16:31:15 +08:00
sjl
b729e4efa1 微调 2025-03-19 13:30:11 +08:00
sjl
962c286fd5 主题切换 2025-03-19 10:26:41 +08:00
caozehui
c215f51554 微调 2025-03-18 19:38:27 +08:00
GGJ
859c85b427 检测脚本添加 额定电压 额定电流字段 2025-03-18 16:28:22 +08:00
sjl
5fe637e84f 微调 2025-03-17 16:03:53 +08:00
sjl
5f68071c77 微调颜色 2025-03-17 15:55:30 +08:00
caozehui
1675a5af31 微调 2025-03-17 14:33:19 +08:00
caozehui
ec1d09dbd0 微调 2025-03-17 13:30:00 +08:00
caozehui
eda7b516f6 微调 2025-03-17 13:24:35 +08:00
sjl
630eb48d28 微调 2025-03-17 13:17:12 +08:00
caozehui
0d2f8a7788 微调 2025-03-14 16:30:45 +08:00
GGJ
230c68f454 修改他不删除后编辑检测监本还存在问题 2025-03-14 16:23:27 +08:00
GGJ
68934060e6 修改参考设定值0不显示 2025-03-14 16:10:00 +08:00
GGJ
846e7514b7 Merge branch 'master' of http://192.168.1.22:3000/frontend/pqs-9100_client 2025-03-14 15:03:45 +08:00
GGJ
410cfb0f7a 检测脚本添加额定电压、额定电流 修改bug 2025-03-14 15:03:36 +08:00
caozehui
c892410b07 微调 2025-03-14 14:45:39 +08:00
sjl
7caa4a5303 微调 2025-03-14 12:27:04 +08:00
sjl
c17efbf9f6 微调 2025-03-14 12:13:34 +08:00
c46abeecf5 websocket代码提交 2025-03-14 11:35:55 +08:00
caozehui
0947097932 微调 2025-03-14 11:23:49 +08:00
caozehui
50fc02d4eb 微调 2025-03-13 14:40:33 +08:00
caozehui
a122e9e1b3 微调 2025-03-12 15:01:58 +08:00
91 changed files with 4735 additions and 3156 deletions

View File

@@ -26,6 +26,7 @@
"md5": "^2.3.0",
"mitt": "^3.0.1",
"mkdirp": "^3.0.1",
"node-forge": "^1.3.1",
"nprogress": "^0.2.0",
"pinia": "^2.2.1",
"pinia-plugin-persistedstate": "^3.2.1",
@@ -45,6 +46,7 @@
"@types/html2canvas": "^1.0.0",
"@types/md5": "^2.3.2",
"@types/node": "^20.14.14",
"@types/node-forge": "^1.3.11",
"@types/nprogress": "^0.2.0",
"@types/qs": "^6.9.8",
"@types/sortablejs": "^1.15.2",
@@ -74,7 +76,7 @@
"vite-plugin-compression": "^0.5.1",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-node-polyfills": "^0.22.0",
"vite-plugin-node-polyfills": "^0.23.0",
"vite-plugin-pwa": "^0.16.5",
"vite-plugin-svg-icons": "^2.0.1",
"vue-tsc": "^2.0.21"

View File

@@ -13,13 +13,15 @@ export namespace CheckData {
// 装置原始数据-被检值
data: number,
// 误差值
errorData: number,
// 第几次谐波
num?: number,
//符合、不符合
isData?: number,
//最大误差值
radius?: string,
unit?: string,
}
/**
@@ -50,21 +52,25 @@ export namespace CheckData {
errorA?: string,
maxErrorA?: string,
isDataA?: number,
unitA?: string,
stdB?: string,
dataB?: string,
errorB?: string,
maxErrorB?: string,
isDataB?: number,
unitB?: string,
stdC?: string,
dataC?: string,
errorC?: string,
maxErrorC?: string,
isDataC?: number,
unitC?: string,
stdT?: string,
dataT?: string,
errorT?: string,
maxErrorT?: string,
isDataT?: number,
unitT?: string,
//最大误差值
maxError?: string,
@@ -123,7 +129,8 @@ export namespace CheckData {
SUCCESS = 1,
FAIL = 2,
TIMEOUT = 3,
ERRORDATA = 4
ERRORDATA = 4,
NOT_PART_IN_ERROR = 5
}
export interface DeviceCheckResult {
@@ -143,8 +150,8 @@ export namespace CheckData {
export enum ButtonColorEnum {
INFO = '#909399',
LOADING = '#003078',
SUCCESS = '#67c23a',
LOADING = 'var(--el-color-primary)',
SUCCESS = '#91cc75',
WARNING = '#e6a23c',
DANGER = '#f56c6c',
}
@@ -154,7 +161,7 @@ export namespace CheckData {
*/
export interface ButtonResult {
color: ButtonColorEnum
icon: 'Minus' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled'
icon: 'More' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled' | 'Minus'
}
/**

View File

@@ -31,9 +31,9 @@ export const getTreeData = (params: {
devId?: string,
devNum?: string,
scriptType?: string | null,
code?: number,
code?: string,
}) => {
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true});
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: false});
}
/**
@@ -45,7 +45,7 @@ export const getTableData = (params: {
scriptId: string,
devId: string,
devNum: string,
code: number,
code: string,
index: number,
}) => {
return http.post("/result/resultData/", params, {loading: false});
@@ -56,8 +56,44 @@ export const exportRawData = (params: {
scriptId: string,
devId: string,
devNum: string,
code: number,
code: string,
index: number,
}) => {
return http.download("/result/exportRawData", params, {loading: false});
}
/**
* 重新计算
* @param params
*/
export const reCalculate = (params: {
planId: string,
scriptId: string,
errorSysId: string,
deviceId: string,
code: string
}) => {
return http.post("/result/reCalculate", params, {loading: true});
}
/**
* 更换误差体系
* @param params
*/
export const changeErrorSystem = (params: {
planId: string,
scriptId: string,
errorSysId: string,
deviceId: string,
code: string
}) => {
return http.post("/result/changeErrorSystem", params, {loading: true});
}
/**
* 删除(误差体系切换时产生的)临时表
* @param code
*/
export const deleteTempTable = (code: string) => {
return http.get(`/result/deleteTempTable?code=${code}`, null, {loading: false})
}

View File

@@ -25,33 +25,41 @@ export const deletePqDev = (params: string[]) => {
return http.post(`/pqDev/delete`, params)
}
// export const downloadTemplate = () => {
// return http.download(`/pqDev/downloadTemplate`)
// }
// //导入被检设备(比对)
// export const importPqDev=(params: Device.ReqPqDevParams)=>{
// return http.upload(`/pqDev/import`, params)
// }
// //导入比对式被检设备
// export const importContrastPqDev=(params: Device.ReqPqDevParams)=>{
// return http.upload(`/pqDev/importContrast`, params)
// }
//导出灿能二楼设备
export const exportCNDev = (params: Device.ReqPqDevParams) => {
return http.download(`/pqDev/exportCNDev`, params)
//导出被检设备
export const exportPqDev = (params: Device.ReqPqDevParams) => {
return http.download(`/pqDev/export`, params)
}
// 下载导入文件模板
export const downloadTemplate = () => {
return http.download(`/pqDev/downloadTemplate`)
}
// 下载灿能二楼设备导入文件模板
export const downloadCNDevTemplate = () => {
return http.download(`/pqDev/downloadCNDevTemplate`)
//导入被检设备
export const importPqDev = (params: Device.ReqPqDevParams) => {
return http.uploadExcel(`/pqDev/import`, params)
}
//导入灿能二楼设备
export const importCNDev = (params: Device.ReqPqDevParams) => {
return http.uploadExcel(`/pqDev/importCNDev`, params)
//导入比对式被检设备
export const importContrastPqDev = (params: Device.ReqPqDevParams) => {
return http.upload(`/pqDev/importContrast`, params)
}
// //导出灿能二楼设备
// export const exportCNDev = (params: Device.ReqPqDevParams) => {
// return http.download(`/pqDev/exportCNDev`, params)
// }
//
// // 下载灿能二楼设备导入文件模板
// export const downloadCNDevTemplate = () => {
// return http.download(`/pqDev/downloadCNDevTemplate`)
// }
//
// //导入灿能二楼设备
// export const importCNDev = (params: Device.ReqPqDevParams) => {
// return http.uploadExcel(`/pqDev/importCNDev`, params)
// }
//根据设备类型决定电源、icd、模板、通道数、额定电压、额定电流
export const getPqDev = () => {
return http.get(`/devType/listAll`)

View File

@@ -30,5 +30,7 @@ export const deletePqErrSys = (params: string[]) => {
return http.post(`/pqErrSys/delete`, params)
}
//复制误差体系
export const copyPqErrSys = (params: ErrorSystem.ErrorSystemList) => {
return http.get(`/pqErrSys/copy?id=${params.id}`)
}

View File

@@ -20,6 +20,9 @@ export namespace Device {
export interface ReqDevReportParams extends ReqPage {
planId?: string; // 计划id
devId?: string; // 装置id
scriptId?: string; // 脚本id
planCode?: string;
devIdList?: string[]; // 装置id列表
}
/**
@@ -44,7 +47,7 @@ export namespace Device {
encryptionFlag: number; //装置是否为加密版本
series?: string | null; //装置识别码3ds加密
devKey?: string | null; //装置秘钥3ds加密
sampleID?: string| null; //样品编号
sampleId?: string | null; //样品编号
arrivedDate?: string; //送样日期
cityName?: string | null; //所属地市名称
gDName?: string | null; //所属供电公司名称
@@ -81,7 +84,6 @@ export namespace Device {
}
/**
* 被检设备表格查询分页返回的对象;
*/

View File

@@ -33,7 +33,9 @@ export namespace ErrorSystem {
endFlag?:number;//是否包含结束值
conditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值)
maxErrorValue:number;//误差最大值
errorValueType:string;//误差值类型(包括值类型绝对值、相对值1、相对值2
errorValueType:any;//误差值类型(0标称值、1标准值、2值类型
valueType:number;//值类型1绝对值、2相对值
errorUnit:string;//误差单位
}
//查看详细误差体系

View File

@@ -0,0 +1,39 @@
import type { ReqPage, ResPage } from '@/api/interface'
import type { UploadFile } from 'element-plus';
// 报告模版接口
export namespace PqReport {
/**
* 报告模版表格分页查询参数
*/
export interface ReqReportParams extends ReqPage {
id: string; // 装置序号id 必填
name?: string; // 设备名称
createTime?: string; //创建时间
}
/**
* 报告模版新增、修改、根据id查询返回的对象
*/
export interface ResReport {
id: string; //报告模板id
name: string;//报告模板名称
version:string;//版本号
baseFile?:string;//基础模板文件路径
detailFile?:string;//检测项模版文件路径
description:string;//描述信息
state:number;//状态:8-删除 1-正常
createBy?: string| null; //创建用户
createTime?: string| null; //创建时间
updateBy?: string| null; //更新用户
updateTime?: string| null; //更新时间
}
/**
* 报告模版表格查询分页返回的对象;
*/
export interface ResReportPage extends ResPage<ResReport> {
}
}

View File

@@ -2,39 +2,37 @@ import type { ReqPage, ResPage } from '@/api/interface'
// 检测脚本模块
export namespace TestScript {
/**
* 检测脚本表格分页查询参数
*/
export interface ReqTestScriptParams extends ReqPage {
id: string; // 装置序号id 必填
name: string;
type: string;
pattern:string;
id: string // 装置序号id 必填
name: string
type: string
pattern: string
}
// 检测脚本接口
export interface ResTestScript {
id?: string; //检测脚本ID
name: string; //检测脚本名称
type: string; //设定0为脚本1为模板
pattern: string;//检测脚本模式(字典表Code字段数字、模拟、比对)
valueType?: string;//脚本值类型(字典表Code字段相对值脚本、绝对值脚本、无)
standardName: string;//参照标准名称
standardTime: string;//标准推行时间
state?:number;//
createBy?: string;
createTime?: string;
updateBy?: string;
updateTime?: string;
selectedValue?: string;
id?: string //检测脚本ID
name: string //检测脚本名称
type: string //设定0为脚本1为模板
pattern: string //检测脚本模式(字典表Code字段数字、模拟、比对)
valueType?: string //脚本值类型(字典表Code字段相对值脚本、绝对值脚本、无)
standardName: string //参照标准名称
standardTime: string //标准推行时间
state?: number //
createBy?: string
createTime?: string
updateBy?: string
updateTime?: string
selectedValue?: string
ratedCurr?: number
ratedVolt?: number
}
/**
* 检测脚本查询分页返回的对象;
*/
export interface ResTestScriptPage extends ResPage<ResTestScript> {
}
export interface ResTestScriptPage extends ResPage<ResTestScript> {}
}

View File

@@ -0,0 +1,42 @@
import type {PqReport} from '@/api/device/interface/report'
import http from '@/api'
/**
* @name 报告模版模块
*/
//获取报告模版
export const getPqReportList = (params: PqReport.ReqReportParams) => {
return http.post(`/report/list`, params)
}
//新增报告模版
export const addPqReport = (params: PqReport.ResReport) => {
return http.upload(`/report/add`, params)
}
//删除报告模版
export const deletePqReport = (params: string[]) => {
return http.post(`/report/delete`, params)
}
//查询报告模板详情
export const getPqReportById = (params: PqReport.ResReport) => {
return http.get(`/report/getById?id=${params.id}`)
}
//修改报告模板
export const updatePqReport = (params: PqReport.ResReport) => {
return http.upload(`/report/update`, params)
}
//查询所有报告模板名称
export const getPqReportAllName = () => {
return http.get(`/report/listAllName`)
}
//根据名称查询指定报告模板的所有版本
export const getPqReportAllVersion = (params:any) => {
return http.get(`/report/listAllVersion?name=${params.name}`)
}

View File

@@ -76,6 +76,7 @@ class RequestHttp {
userStore.setAccessToken(result.data.accessToken)
userStore.setRefreshToken(result.data.refreshToken)
userStore.setIsRefreshToken(false)
userStore.setExp(1000 * 60 * 60 * 24 * 30)
response.config.headers.Authorization = `Bearer ${result.data.accessToken}`//重新请求前需要将更新后的新token更换掉之前无效的token,不然会死循环
const resp = await this.service.request(response.config)
return resp
@@ -84,12 +85,13 @@ class RequestHttp {
}
}
// 登陆失效
if (data.code == ResultEnum.OVERDUE) {
if (data.code === ResultEnum.OVERDUE) {
console.log("登陆失效")
userStore.setAccessToken('')
userStore.setRefreshToken('')
userStore.setIsRefreshToken(false)
userStore.setUserInfo({ name: '' })
userStore.setUserInfo({ id:'',name: '' })
userStore.setExp(0)
await router.replace(LOGIN_URL)
if(isFirst){//临时处理token失效弹窗多次
ElMessage.error(data.message)
@@ -100,14 +102,29 @@ class RequestHttp {
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
if (data.code && data.code !== ResultEnum.SUCCESS) {
if(data.message.includes('&')){
const formattedMessage = data.message.split('&').join('<br>');
let formattedMessage = data.message.split('&').join('<br>');
if (data.message.includes(':')) {
formattedMessage = formattedMessage.replace(':', '')
}
ElMessage.error({ message: formattedMessage, dangerouslyUseHTMLString: true });
return Promise.reject(data)
}
ElMessage.error(data.message)
return Promise.reject(data)
}
// 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑)
if (userStore.exp <= Date.now() && userStore.exp !== 0) {
userStore.setAccessToken('')
userStore.setRefreshToken('')
userStore.setIsRefreshToken(false)
userStore.setUserInfo({ id:'',name: '' })
userStore.setExp(0)
ElMessage.error('登录已过期,请重新登录!')
await router.replace(LOGIN_URL)
return Promise.reject(data)
}
return data
},
async (error: AxiosError) => {

View File

@@ -22,6 +22,10 @@ export namespace Plan {
createTime?:string; //创建时间
updateBy?:string; //更新用户
updateTime?:string; //更新时间
associateReport:number;//是否关联报告模板 0否 1是
reportTemplateName:string;
reportTemplateVersion:string
}
// 检测计划 + 分页

View File

@@ -63,17 +63,17 @@ export const getPlanListByPattern = (params: Plan.ReqPlan) => {
}
// 导出检测计划
export const exportCNPlan = (params: Device.ReqPqDevParams) => {
return http.download(`/adPlan/exportCNPlan`, params)
export const exportPlan = (params: Device.ReqPqDevParams) => {
return http.download(`/adPlan/export`, params)
}
// 下载模板
export const downloadCNPlanTemplate = () => {
return http.download(`/adPlan/downloadCNPlanTemplate`)
export const downloadTemplate = (params: { patternId: string }) => {
return http.download(`/adPlan/downloadTemplate`, params)
}
// 导入检测计划
export const importCNPlan = (params: Device.ReqPqDevParams) => {
return http.uploadExcel(`/adPlan/importCNPlan`, params)
export const importPlan = (params: Device.ReqPqDevParams) => {
return http.uploadExcel(`/adPlan/import`, params)
}
// 装置检测报告生成

View File

@@ -13,9 +13,9 @@ export const closePreTest = (params) => {
* 开始正式检测
* @param params
*/
export const startTest = (params) => {
return http.post(`/prepare/startTest`, params, {loading: false})
}
// export const startTest = (params) => {
// return http.post(`/prepare/startTest`, params, {loading: false})
// }
/**
* 暂停正式检测

View File

@@ -9,3 +9,8 @@ import http from '@/api'
export const getAuditLog = (params: AuditLog.ReqAuditLogParams) => {
return http.post(`/sysLog/list`, params)
}
export const exportCsv = (params: AuditLog.ReqAuditLogParams) => {
return http.download(`/sysLog/exportCSV`, params)
}

View File

@@ -5,11 +5,13 @@ export namespace Login {
export interface ReqLoginForm {
username: string;
password: string;
checked: boolean;
}
export interface ResLogin {
accessToken: string;
refreshToken: string;
userInfo:{
id: string;
name: string;
}
}

View File

@@ -2,11 +2,12 @@ import type { Login } from '@/api/user/interface/user'
import {ADMIN as rePrefix} from '@/api/system/config/serviceName'
import http from '@/api'
import type {Dict} from '@/api/interface'
/**
* @name 登录模块
*/
// 用户登录
export const loginApi = (params: Login.ReqLoginForm) => {
export const loginApi = (params: { username: string; password: string}) => {
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, {loading: false})
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
}
@@ -38,3 +39,21 @@ export const refreshToken = () => {
)
}
//获取场景
export const getCurrentScene = () => {
return http.get('/sysTestConfig/getCurrentScene', {}, {loading: false})
}
/**
* 获取RSA公钥
*/
export const getPublicKey = (username: string) => {
return http.get(`/admin/getPublicKey?username=${username}`, {}, {loading: false})
}
/**
* 获取是否在检测中自动生成报告
*/
export const getAutoGenerate = () => {
return http.get('/sysTestConfig/getAutoGenerate', {}, {loading: false})
}

View File

@@ -77,7 +77,7 @@ const acceptParams = (params: ExcelParameterProps) => {
// Excel 导入模板下载
const downloadTemp = () => {
if (!parameter.value.tempApi) return
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, {}, false)
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, {'patternId':parameter.value.patternId}, false)
}
// 文件上传

View File

@@ -9,7 +9,7 @@ export const HOME_URL: string = "/home/index";
export const LOGIN_URL: string = "/login";
// 默认主题颜色
export const DEFAULT_PRIMARY: string = "#003078";
export const DEFAULT_PRIMARY: string = "#526ADE";
// 路由白名单地址(本地存在的路由 staticRouter.ts 中)
export const ROUTER_WHITE_LIST: string[] = ["/500"];
@@ -19,3 +19,5 @@ export const AMAP_MAP_KEY: string = "";
// 百度地图 key
export const BAIDU_MAP_KEY: string = "";

View File

@@ -4,8 +4,8 @@
export enum ResultEnum {
SUCCESS = "A0000",
ERROR = 500,
ACCESSTOKEN_EXPIRED = 401,
OVERDUE = 4001,
ACCESSTOKEN_EXPIRED = "A0024",
OVERDUE = "A0025",
TIMEOUT = 30000,
TYPE = "success"
}

View File

@@ -27,6 +27,7 @@ export const useTheme = () => {
// 修改主题颜色
const changePrimary = (val: string | null) => {
if (!val) {
val = DEFAULT_PRIMARY;
ElMessage({ type: "success", message: `主题颜色已重置为 ${DEFAULT_PRIMARY}` });
@@ -40,10 +41,13 @@ export const useTheme = () => {
for (let i = 1; i <= 9; i++) {
const primaryColor = isDark.value ? `${getDarkColor(val, i / 10)}` : `${getLightColor(val, i / 10)}`;
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, primaryColor);
// const colorValue = document.documentElement.style.getPropertyValue(`--el-color-primary-light-${i}`).trim();
// console.log(`--el-color-primary-light-${i}: ${colorValue}`);
}
globalStore.setGlobalState("primary", val);
};
}
// 灰色和弱色切换
const changeGreyOrWeak = (type: Theme.GreyOrWeakType, value: boolean) => {
const body = document.body as HTMLElement;

View File

@@ -26,6 +26,7 @@ export default {
changePassword: "Change Password",
changeMode:"Change Mode",
versionRegister:"Version Register",
changeTheme: "Change Theme",
logout: "Logout"
}
};

View File

@@ -26,6 +26,7 @@ export default {
changePassword: "修改密码",
changeMode:"模式切换",
versionRegister:"版本注册",
changeTheme:"主题切换",
logout: "退出登录"
}
};

View File

@@ -39,7 +39,9 @@
}
.el-menu-item:hover {
color: #fff; //一级导航划过颜色
background-color: #5274a5 !important; //一级导航划过背景色
//background-color: #5274a5 !important; //一级导航划过背景色
background-color:var(--el-color-primary-light-3) !important;
}
.el-sub-menu__hide-arrow {
width: 65px;
@@ -47,7 +49,9 @@
}
.el-menu-item.is-active {
color: #fff !important; //一级导航文字选中颜色
background-color: #5274a5 !important; //一级导航选中背景色
//background-color: #5274a5 !important; //一级导航选中背景色
background-color: var(--el-color-primary-light-3) !important;
border-bottom: 0 !important;
}
.el-sub-menu__title {
@@ -67,7 +71,9 @@
color: #fff !important; //二级导航文字选中颜色
// background-color: var(--el-color-primary) !important;
// background-color: #5274a5 !important;//二级导航选中背景色
background-color: #5274a5 !important;
//background-color: #7588e5 !important;
background-color: var(--el-color-primary-light-3) !important;
border-bottom-color: var(--el-color-primary) !important;
}
}

View File

@@ -117,10 +117,11 @@ const handelOpen = async (item: string) => {
position: absolute;
width: 100%;
height: 100%;
text-align: center;
text-align: right;
line-height: 40px;
a {
color: #fff;
margin-right: 25px; // 增加右边距
}
}
}

View File

@@ -18,17 +18,20 @@
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="openDialog('themeRef')">
<el-icon><Sunny /></el-icon>{{ t("header.changeTheme") }}
</el-dropdown-item>
<el-dropdown-item @click="openDialog('infoRef')">
<el-icon><User /></el-icon>{{ $t("header.personalData") }}
<el-icon><User /></el-icon>{{ t("header.personalData") }}
</el-dropdown-item>
<el-dropdown-item @click="openDialog('passwordRef')">
<el-icon><Edit /></el-icon>{{ $t("header.changePassword") }}
<el-icon><Edit /></el-icon>{{ t("header.changePassword") }}
</el-dropdown-item>
<el-dropdown-item @click="changeMode">
<el-icon><Edit /></el-icon>{{ $t("header.changeMode") }}
<el-icon><Switch /></el-icon>{{ t("header.changeMode") }}
</el-dropdown-item>
<el-dropdown-item @click="openDialog('versionRegisterRef')">
<el-icon><SetUp /></el-icon>{{ $t("header.versionRegister") }}
<el-icon><SetUp /></el-icon>{{ t("header.versionRegister") }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
@@ -42,6 +45,9 @@
<PasswordDialog ref="passwordRef"></PasswordDialog>
<!-- versionRegisterDialog -->
<VersionDialog ref="versionRegisterRef"></VersionDialog>
<!-- ThemeDialog -->
<ThemeDialog ref="themeRef"></ThemeDialog>
</template>
<script setup lang="ts">
@@ -50,12 +56,13 @@ import { LOGIN_URL } from "@/config";
import { useRouter } from "vue-router";
import { logoutApi } from "@/api/user/login";
import { useUserStore } from "@/stores/modules/user";
import { ElMessageBox, ElMessage } from "element-plus";
import { ElMessageBox, ElMessage, CHANGE_EVENT } from "element-plus";
import InfoDialog from "./InfoDialog.vue";
import PasswordDialog from "./PasswordDialog.vue";
import ThemeDialog from "./ThemeDialog.vue";
import VersionDialog from "@/views/system/versionRegister/index.vue";
import { computed } from "vue";
import { Avatar } from "@element-plus/icons-vue";
import { Avatar, Delete, Document, Sunny, Switch } from "@element-plus/icons-vue";
import AssemblySize from "./components/AssemblySize.vue";
import Language from "./components/Language.vue";
import SearchMenu from "./components/SearchMenu.vue";
@@ -72,6 +79,13 @@ const router = useRouter();
const authStore = useAuthStore();
const modeStore = useModeStore();
const AppSceneStore = useAppSceneStore();
import { useTheme } from "@/hooks/useTheme";
import { useI18n } from "vue-i18n";
const { changePrimary} = useTheme();
// 初始化 i18n
const { t } = useI18n(); // 使用 t 方法替代 $t
// 退出登录
const logout = () => {
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
@@ -84,7 +98,8 @@ const logout = () => {
// 2.清除 Token
userStore.setAccessToken("");
userStore.setRefreshToken("");
userStore.setUserInfo({name: ""});
userStore.setExp(0)
userStore.setUserInfo({id: "", name: ""});
userStore.setIsRefreshToken(false)
dictStore.setDictData([]);
modeStore.setCurrentMode('');
@@ -101,12 +116,19 @@ const logout = () => {
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null);
const themeRef = ref<InstanceType<typeof ThemeDialog> | null>(null);
const openDialog = (ref: string) => {
if (ref == "infoRef") infoRef.value?.openDialog();
if (ref == "passwordRef") passwordRef.value?.openDialog();
if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog();
if (ref == "themeRef") themeRef.value?.openDialog();
};
//模式切换
const changeMode = () => {
authStore.changeModel();

View File

@@ -0,0 +1,45 @@
<template>
<el-dialog v-model="dialogVisible" title="主题切换" width="500px" draggable>
<el-divider content-position="center">主题颜色</el-divider>
<div style="display: flex; justify-content: center;">
<el-color-picker v-model="color" />
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="sure">确认</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useTheme } from "@/hooks/useTheme";
import { on } from "events";
const color = ref('')
const { changePrimary} = useTheme();
const dialogVisible = ref(false);
const openDialog = () => {
// 修复:使用可选链和空值合并运算符确保不会出现 null 或 undefined
const storedColor = JSON.parse(localStorage.getItem('cn-global') ?? '{}').primary;
color.value = storedColor ?? '#526ADE'; // 默认值为 '#526ADE'
dialogVisible.value = true;
};
const sure = () => {
changePrimary(color.value); // 切换主题
dialogVisible.value = false;
};
// onMounted(() => {
// // 修复:使用可选链和空值合并运算符确保不会出现 null 或 undefined
// const storedColor = JSON.parse(localStorage.getItem('cn-global') ?? '{}').primary;
// console.log('123',storedColor)
// color.value = storedColor ?? '#526ADE'; // 默认值为 '#526ADE'
// })
defineExpose({ openDialog });
</script>

View File

@@ -33,14 +33,19 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
// color: var(--el-menu-hover-text-color) !important;
// background-color: transparent !important;
color: #fff !important;//一级导航文字选中颜色
background-color: #5274a5 !important; //一级导航选中背景色
//background-color: #5274a5 !important; //一级导航选中背景色
background-color: var(--el-color-primary-light-3) !important;
}
.el-menu--collapse {
.is-active {
.el-sub-menu__title {
color: #ffffff !important;
// background-color: var(--el-color-primary) !important;
background-color: #5274a5 !important;
//background-color: #5274a5 !important;
background-color: var(--el-color-primary-light-3) !important;
border-bottom: 0 !important;
}
}
@@ -53,7 +58,9 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
// color: var(--el-menu-active-color) !important;
// background-color: var(--el-menu-active-bg-color) !important;
color: #fff !important;//一级导航文字选中颜色
background-color: #5274a5 !important; //一级导航选中背景色
//background-color: #5274a5 !important; //一级导航选中背景色
background-color: var(--el-color-primary-light-3) !important;
&::before {
position: absolute;
top: 0;

View File

@@ -1,12 +1,17 @@
<template>
<div class='tabs-box'>
<div class='tabs-menu'>
<el-tabs v-model='tabsMenuValue' type='card' @tab-click='tabClick' @tab-remove='tabRemove'>
<el-tab-pane v-for='item in tabsMenuList' :key='item.path' :label='item.title' :name='item.path'
:closable='item.close'>
<div class="tabs-box">
<div class="tabs-menu">
<el-tabs v-model="tabsMenuValue" type="card" @tab-click="tabClick" @tab-remove="tabRemove">
<el-tab-pane
v-for="item in tabsMenuList"
:key="item.path"
:label="item.title"
:name="item.path"
:closable="item.close"
>
<template #label>
<el-icon v-show='item.icon && tabsIcon' class='tabs-icon'>
<component :is='item.icon'></component>
<el-icon v-show="item.icon && tabsIcon" class="tabs-icon">
<component :is="item.icon"></component>
</el-icon>
{{ item.title }}
</template>
@@ -17,7 +22,7 @@
</div>
</template>
<script setup lang='ts'>
<script setup lang="ts">
import Sortable from 'sortablejs'
import { ref, computed, watch, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
@@ -42,7 +47,6 @@ onMounted(() => {
initTabs()
})
// 监听路由的变化(防止浏览器后退/前进不变化 tabsMenuValue
watch(
() => route.fullPath,
@@ -58,12 +62,12 @@ watch(
path: route.fullPath,
name: route.name as string,
close: !route.meta.isAffix,
isKeepAlive: route.meta.isKeepAlive as boolean,
isKeepAlive: route.meta.isKeepAlive as boolean
}
tabStore.addTabs(tabsParams)
}
},
{ immediate: true },
{ immediate: true }
)
// 初始化需要固定的 tabs
@@ -94,7 +98,7 @@ const tabsDrop = () => {
const currRow = tabsList.splice(oldIndex as number, 1)[0]
tabsList.splice(newIndex as number, 0, currRow)
tabStore.setTabs(tabsList)
},
}
})
}
@@ -107,10 +111,12 @@ const tabClick = (tabItem: TabsPaneContext) => {
// Remove Tab
const tabRemove = (fullPath: TabPaneName) => {
tabStore.removeTabs(fullPath as string, fullPath == route.fullPath)
tabStore.removeTabs(fullPath as string, fullPath == route.fullPath || '/machine/testScriptAdd' == route.fullPath)
}
</script>
<style scoped lang='scss'>
@import "./index.scss";
<style scoped lang="scss">
@import './index.scss';
</style>

View File

@@ -46,7 +46,7 @@
border-radius: 3px;
}
.layout-light {
background-color: var(--el-color-primary-light-5);
background-color: var(--el-color-primary-light-3);
border-radius: 3px;
}
.layout-content {

View File

@@ -65,5 +65,6 @@ const setupAll = async () => {
//挂载app
setupAll().then(() => {
app.mount('#app')
})

View File

@@ -30,6 +30,7 @@ export const initDynamicRouter = async () => {
});
userStore.setAccessToken("");
userStore.setRefreshToken("");
userStore.setExp(0)
router.replace(LOGIN_URL);
return Promise.reject("No permission");
}
@@ -52,6 +53,7 @@ export const initDynamicRouter = async () => {
// 当按钮 || 菜单请求出错时,重定向到登陆页
userStore.setAccessToken("");
userStore.setRefreshToken("");
userStore.setExp(0)
router.replace(LOGIN_URL);
return Promise.reject(error);
}

View File

@@ -30,7 +30,7 @@ export interface UserState {
accessToken: string;
refreshToken: string;
isRefreshToken: boolean;
userInfo: { name: string };
userInfo: { id: string, name: string };
}
/* tabsMenuProps */

View File

@@ -2,8 +2,9 @@ import {defineStore} from "pinia";
import {CHECK_STORE_KEY} from "@/stores/constant";
import type {CheckData} from "@/api/check/interface";
import type {Plan} from '@/api/plan/interface'
import {useAppSceneStore} from "@/stores/modules/mode";
const AppSceneStore = useAppSceneStore()
export const useCheckStore = defineStore("check", {
id: CHECK_STORE_KEY,
@@ -13,7 +14,7 @@ export const useCheckStore = defineStore("check", {
selectTestItems: Object<CheckData.SelectTestItem>({preTest: true, timeTest: true, channelsTest: false, test: true}),
checkType:1, // 0:手动检测 1:自动检测
reCheckType: 1, // 0:不合格项复检 1:全部复检
showDetailType: 0 // 0:数据查询 1:误差体系跟换
showDetailType: 0 // 0:数据查询 1:误差体系跟换 2正式检测
}),
getters: {},
@@ -30,7 +31,11 @@ export const useCheckStore = defineStore("check", {
},
initSelectTestItems() {
this.selectTestItems.preTest = true
this.selectTestItems.channelsTest = false
if (AppSceneStore.currentScene === '1') {
this.selectTestItems.channelsTest = true
} else {
this.selectTestItems.timeTest = true
}
this.selectTestItems.test = true
},
setSelectTestItems(selectTestItems: CheckData.SelectTestItem) {

View File

@@ -31,7 +31,7 @@ export const useGlobalStore = defineStore({
// 折叠菜单
isCollapse: false,
// 菜单手风琴
accordion: true,
accordion: false,
// 面包屑导航
breadcrumb: true,
// 面包屑导航图标
@@ -42,12 +42,14 @@ export const useGlobalStore = defineStore({
tabsIcon: true,
// 页脚
footer: false
}),
getters: {},
actions: {
// Set GlobalState
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
this.$patch({ [args[0]]: args[1] });
console.log(DEFAULT_PRIMARY);
}
},
persist: piniaPersistConfig(GLOBAL_STORE_KEY)

View File

@@ -9,7 +9,8 @@ export const useUserStore = defineStore({
accessToken: "",
refreshToken: "",
isRefreshToken:false,
userInfo: { name: "admin" },
exp: Number(0),
userInfo: {id:"", name: "admin" },
}),
getters: {},
actions: {
@@ -27,6 +28,9 @@ export const useUserStore = defineStore({
setUserInfo(userInfo: UserState["userInfo"]) {
this.userInfo = userInfo;
},
setExp(exp: number) {
this.exp = exp;
}
},
persist: piniaPersistConfig(USER_STORE_KEY),
});

View File

@@ -445,7 +445,7 @@
.dialog-small {
.el-dialog__body {
max-height: 340px;
max-height: 350px;
}
}
@@ -578,6 +578,26 @@
}
}
}
.form-four {
display: flex;
flex-wrap: wrap;
// justify-content: space-between;
.el-form-item {
display: flex;
width: 24%;
.el-form-item__content {
flex: 1;
.el-select,
.el-cascader,
.el-input__inner,
.el-date-editor {
width: 100%;
}
}
}
}
.el-table__cell {
border-right: 1px solid #ebeef5 !important;

View File

@@ -37,6 +37,7 @@ export function rgbToHex(r: any, g: any, b: any) {
* @returns {String} 返回处理后的颜色值
*/
export function getDarkColor(color: string, level: number) {
let reg = /^\#?[0-9A-Fa-f]{6}$/;
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
let rgb = hexToRgb(color);
@@ -51,6 +52,7 @@ export function getDarkColor(color: string, level: number) {
* @returns {String} 返回处理后的颜色值
*/
export function getLightColor(color: string, level: number) {
let reg = /^\#?[0-9A-Fa-f]{6}$/;
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
let rgb = hexToRgb(color);

View File

@@ -20,6 +20,7 @@ export default class SocketService {
// 重新连接尝试的次数
connectRetryCount = 0;
work:any;
workerBlobUrl:any;
lastActivityTime= 0; // 上次活动时间戳
lastResponseHeartTime = Date.now();//最后一次收到心跳回复时间
@@ -107,9 +108,9 @@ export default class SocketService {
startHeartbeat() {
this.lastResponseHeartTime = Date.now();
const _this = this
const url = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},9000)})()']));
this.workerBlobUrl = url; // 存储临时的Blob URL
this.work = new Worker(url);
_this.workerBlobUrl = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},9000)})()']));
this.work = new Worker(_this.workerBlobUrl);
this.work.onmessage = function(e){
//判断多久没收到心跳响应
@@ -135,13 +136,14 @@ export default class SocketService {
}
clearHeartbeat() {
if (this.work) {
this.work.terminate();
this.work = null;
const _this = this
if (_this.work) {
_this.work.terminate();
_this.work = null;
}
if (this.workerBlobUrl) {
window.URL.revokeObjectURL(this.workerBlobUrl); // 释放临时的Blob URL
this.workerBlobUrl = null;
if (_this.workerBlobUrl) {
window.URL.revokeObjectURL(_this.workerBlobUrl); // 释放临时的Blob URL
_this.workerBlobUrl = null;
}
}

View File

@@ -199,6 +199,8 @@ const displayPid = computed({
functionList.value = response.data as unknown as Function.ResFunction[]
titleType.value = sign
dialogVisible.value = true
rules.value.path = [{ required: true, trigger: 'blur', message: '路由地址必填!' }];
rules.value.component = [{ required: true, trigger: 'blur', message: '组件地址必填!' }];
if (formContent.value.pid ==='0') {
formContent.value.pid = '';

View File

@@ -8,7 +8,7 @@
<!-- :requestApi="getRoleList" -->
<!-- 表格 header 按钮 -->
<template #tableHeader='scope'>
<el-button v-auth.role="'add'" type='primary' :icon='CirclePlus' @click="openDrawer('新增角色')">新增</el-button>
<el-button v-auth.role="'add'" type='primary' :icon='CirclePlus' @click="openDrawer('add')">新增</el-button>
<el-button v-auth.role="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
@click='batchDelete(scope.selectedListIds)'>
删除
@@ -16,7 +16,7 @@
</template>
<!-- 表格操作 -->
<template #operation='scope'>
<el-button v-auth.role="'edit'" type='primary' link :icon='EditPen' @click="openDrawer('编辑角色', scope.row)">编辑</el-button>
<el-button v-auth.role="'edit'" type='primary' link :icon='EditPen' @click="openDrawer('edit', scope.row)">编辑</el-button>
<el-button v-auth.role="'delete'" v-if="scope.row.type !== 0 && scope.row.type !== 1" type='primary' link :icon='Delete' @click='deleteAccount(scope.row)'>删除</el-button>
<el-button v-auth.role="'SetPermissions'" type='primary' link :icon='Share' @click="openDrawer('设置权限', scope.row)">设置权限</el-button>
</template>

View File

@@ -7,7 +7,7 @@
<div>{{ outputDsc }}</div>
<div>
<span style=" font-size: 18px;font-weight: 600;">
设备已合格 <span style="color: #67C23A">{{ qualified }}</span> / <span style="color: green">{{ total }}</span>
设备已合格 <span style="color: #91cc75">{{ qualified }}</span> / <span style="color: green">{{ total }}</span>
</span>
<!-- <el-button type="primary" loading
@@ -25,7 +25,9 @@
<span class="spanStyle">源输出为</span><br/>
<span class="spanStyle" v-if="active > 0">{{ big_V_Download }}</span><br/>
<span class="spanStyle" v-if="active > 0">{{ big_I_Download }}</span>
<el-icon v-if="active === 1 " class="loading-box"><el-icon-loading /></el-icon>
<el-icon v-if="active === 1 " class="loading-box">
<el-icon-loading/>
</el-icon>
</template>
</el-step>
<el-step>
@@ -34,7 +36,9 @@
<span class="spanStyle">源输出为</span><br/>
<span class="spanStyle" v-if="active > 1">{{ small_V_Download }}</span><br/>
<span class="spanStyle" v-if="active > 1">{{ small_I_Download }}</span>
<el-icon v-if="active === 2" class="loading-box"><el-icon-loading /></el-icon>
<el-icon v-if="active === 2" class="loading-box">
<el-icon-loading/>
</el-icon>
</template>
</el-step>
<el-step>
@@ -43,7 +47,9 @@
<span class="spanStyle">源输出为</span><br/>
<span class="spanStyle" v-if="active > 2">{{ big_V_Adjust }}</span><br/>
<span class="spanStyle" v-if="active > 2">{{ big_I_Adjust }}</span>
<el-icon v-if="active === 3" class="loading-box"><el-icon-loading /></el-icon>
<el-icon v-if="active === 3" class="loading-box">
<el-icon-loading/>
</el-icon>
</template>
</el-step>
<el-step>
@@ -52,7 +58,9 @@
<span class="spanStyle">源输出为</span><br/>
<span class="spanStyle" v-if="active > 3">{{ small_V_Adjust }}</span><br/>
<span class="spanStyle" v-if="active > 3">{{ small_I_Adjust }}</span>
<el-icon v-if="active === 4" class="loading-box"><el-icon-loading /></el-icon>
<el-icon v-if="active === 4" class="loading-box">
<el-icon-loading/>
</el-icon>
</template>
</el-step>
<el-step title="结束"/>
@@ -90,14 +98,16 @@
</template>
<script lang="tsx" setup name="channelsTest">
import {type Device} from '@/api/device/interface/device';
import { SuccessFilled, Failed, Message, MessageBox } from '@element-plus/icons-vue'
import {Failed} from '@element-plus/icons-vue'
import {type Ref, ref, toRef, watch} from 'vue'
import {dialogBig} from '@/utils/elementBind'
import { ElMessage, ElMessageBox, TabsPaneContext } from 'element-plus';
import {ElMessageBox} from 'element-plus';
import {getCoefficientCheck} from '@/api/home/channelsTest/index'
import type {ChannelsTest} from '@/api/home/interface/channelsTest';
import type {Plan} from '@/api/plan/interface';
import { fa } from 'element-plus/es/locale';
import {useUserStore} from "@/stores/modules/user";
const activeIndex = ref(0)
const activeTotalNum = ref(4)
const qualified = ref(0)
@@ -136,7 +146,7 @@ const props = defineProps({
default: () => ({})
}
})
const userStore = useUserStore()
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
const webMsgSend = toRef(props, 'webMsgSend');
@@ -294,40 +304,59 @@ watch(webMsgSend,function (newValue,oldValue){
break;
}
break;
case 'yjc_xyjy':
switch (newValue.operateCode) {
case 'VERIFY_MAPPING$01':
if (newValue.code == 10200) {
let data = JSON.parse(newValue.data)
ElMessageBox.alert(`脚本与icd检验失败! icd名称${data['icdType']} -> 校验项:${data['dataType']}`, '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
TableInit();
}
break;
}
break;
case 'Coefficient_Check':
console.log("Coefficient_Checkactive", active.value);
switch (newValue.operateCode) {
case 'big_end'://大电压,电流下装
active.value++;
case 'big_start'://大电压,电流下装
big_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
big_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
break;
case 'big_end'://大电压,电流下装
active.value++;
tableLoading('small', '系数下装')
break;
}
switch (newValue.operateCode) {
case 'small_end'://小电压,电流下装
active.value++;
case 'small_start'://小电压,电流下装
small_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
small_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
break;
case 'small_end'://小电压,电流下装
active.value++;
tableLoading('big', '系数校准')
break;
}
switch (newValue.operateCode) {
case 'big_comp_end'://大电压,电流校准
active.value++;
case 'big_comp_start'://大电压,电流校准
big_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
big_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
break;
case 'big_comp_end'://大电压,电流校准
active.value++;
tableLoading('small', '系数校准')
break;
}
switch (newValue.operateCode) {
case 'small_comp_end'://小电压,电流校准
active.value++;
case 'small_comp_start'://小电压,电流校准
small_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
small_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
break;
case 'small_comp_end'://小电压,电流校准
active.value++;
active.value++;
for (let i = 0; i < name.value.length; i++) {
@@ -726,7 +755,10 @@ const updateErrorState = (index: number, hasError: boolean) => {
(e: 'submitClicked', callback: (resolve: (value: boolean) => void) => void): void;
}>();
const handleCancel = () => {
//dataSocket.socketServe.closeWs()
// 清空 name, channel, total
name.value = [];
channel.value = [];
@@ -746,8 +778,7 @@ const getTableDataForChannel = (index: number): any[] => {
watch(activeIndex, function (newValue, oldValue) {
if(activeIndex.value === 1)
{
if (activeIndex.value === 1) {
outputDsc.value = "电压误差为±0.1Un% 电流误差为±0.5%";
// 当前源输出为Ua=Ub=Uc=57.74V Ia=Ib=Ic=1A"
}
@@ -782,9 +813,10 @@ const handleSubmit = async () => {
userPageId: "cdf",
devIds: devIdArray.value,
planId: planId.value,
errorSysId: select_Plan.value?.errorSysId,
     scriptId: select_Plan.value?.scriptId,
operateType:'0' // '0'为预检测、1为正式检测
errorSysId: select_Plan.value?.errorSysId,
scriptId: select_Plan.value?.scriptId,
operateType: '0', // '0'为预检测、1为正式检测
userId: userStore.userInfo.id
})
active.value++;
@@ -899,6 +931,7 @@ const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: num
justify-content: space-between;
margin-bottom: 10px;
}
.custom-tabs-label .el-icon {
vertical-align: middle;
}
@@ -915,6 +948,7 @@ const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: num
.el-tabs--border-card {
height: 470px;
}
/* .el-icon svg {
color: #ff7171;
} */
@@ -922,6 +956,7 @@ const initializeTableData = (templates: ChannelsTest.CoefficientVO[], index: num
.icon-style {
color: #ff7171;
}
.container {
display: flex;
}

View File

@@ -38,13 +38,13 @@
<!-- <el-button type="primary" loading v-if="activeIndex > 0 && activeIndex < activeTotalNum">合格92项/共103项</el-button>
<el-button type="primary" v-if="activeIndex >= activeTotalNum" disabled>合格92项/共103项</el-button> -->
<span style=" font-size: 18px;font-weight: 600;">
数据已合格 <span style="color: #67C23A">{{ qualified }}</span> / <span style="color: green">{{ 103 }}</span>
数据已合格 <span style="color: #91cc75">{{ qualified }}</span> / <span style="color: green">{{ 103 }}</span>
</span>
</div>
<div class="dialog-content">
<el-table :data="tableData" :cell-class-name="tableCell" row-key="id" height="450px"
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' }" style="width: 100%"
:header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' }" style="width: 100%"
border>
<el-table-column fixed prop="scriptItemName" label="检测项目" width="210px" />
<el-table-column label="被检通道1" :min-width="minwidth" align="center">

View File

@@ -43,7 +43,7 @@
v-model="scriptSwitch"
class="ml-2"
inline-prompt
style="--el-switch-on-color: #003078; --el-switch-off-color: #5a79a9"
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #5a79a9"
active-text="不合格测试项"
inactive-text="全部测试项"
/> -->

View File

@@ -1,8 +1,8 @@
<template>
<el-button v-if="tableData.length > 0" type="primary" @click="exportData" style="margin-bottom: 10px">导出</el-button>
<div class="table-main">
<div class="table-main" max-height="282px">
<el-table v-if="tableData.length > 0" :data="tableData" stripe border :header-cell-style="{ textAlign: 'center' } "
:cell-style="{ textAlign: 'center' }" height="315px"
:cell-style="{ textAlign: 'center' }" max-height="282px"
style="width: 100%;">
<el-table-column type="index" label="序号" width="70" fixed="left"/>
<el-table-column prop="time" label="数据时间"/>

View File

@@ -10,52 +10,55 @@
<!-- </el-table-column>-->
<template v-if="phaseT === 0">
<el-table-column label="A相">
<el-table-column prop="stdA" width="105" :label="'标准值'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="dataA" width="105" :label="'被检值'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="stdA" width="130" :label="'标准值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="dataA" width="130" :label="'被检值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="isDataA" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
误差范围{{ scope.row.maxErrorA }} <br/>
误差值{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }}
误差值{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? innerUnitA : '' }}
</template>
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag>
<el-tag type="warning" v-if="scope.row.isDataA === 4">/</el-tag>
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="B相">
<el-table-column prop="stdB" width="105" :label="'标准值'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="dataB" width="105" :label="'被检值'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="stdB" width="130" :label="'标准值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="dataB" width="130" :label="'被检值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="isDataB" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
误差范围{{ scope.row.maxErrorB }}<br/>
误差值{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }}
误差值{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? innerUnitB : '' }}
</template>
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag>
<el-tag type="warning" v-if="scope.row.isDataB === 4">/</el-tag>
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="C相">
<el-table-column prop="stdC" width="105" :label="'标准值'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="dataC" width="105" :label="'被检值'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="stdC" width="130" :label="'标准值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="dataC" width="130" :label="'被检值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="isDataC" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
误差范围 {{ scope.row.maxErrorC }}<br/>
误差值{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }}
误差值{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? innerUnitC : '' }}
</template>
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag>
<el-tag type="warning" v-if="scope.row.isDataC === 4">/</el-tag>
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
</el-tooltip>
</template>
</el-table-column>
@@ -64,18 +67,19 @@
<template v-if="phaseT === 1">
<el-table-column :label="tableHeader">
<el-table-column prop="stdT" :label="'标准值'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="dataT" :label="'被检值'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="stdT" :label="'标准值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="dataT" :label="'被检值'+(outerUnit==''?'':''+outerUnit+'')"/>
<el-table-column prop="isDataT" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
误差范围 {{ scope.row.maxErrorT }}<br/>
误差值{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }}
误差值{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? innerUnitT : '' }}
</template>
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataT === 2">不符合</el-tag>
<el-tag type="warning" v-if="scope.row.isDataT === 4">/</el-tag>
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
</el-tooltip>
</template>
</el-table-column>
@@ -105,10 +109,23 @@ const {tableData, currentScriptTypeName} = defineProps<{
}>();
const unit = computed(() => {
const outerUnit = computed(() => {
return tableData.length > 0 ? tableData[0].unit : '';
})
const innerUnitA = computed(() => {
return tableData.length > 0 ? tableData[0].unitA : '';
})
const innerUnitB = computed(() => {
return tableData.length > 0 ? tableData[0].unitB : '';
})
const innerUnitC = computed(() => {
return tableData.length > 0 ? tableData[0].unitC : '';
})
const innerUnitT = computed(() => {
return tableData.length > 0 ? tableData[0].unitT : '';
})
const phaseT = computed(() => {
return tableData[0].dataT == null || tableData[0].dataT == undefined ? 0 : 1
})
@@ -125,7 +142,7 @@ const tableHeader = computed(() => {
// let result = tableData[0].maxError ?? '/'
// let idx = result.indexOf('~');
// if (idx > 0) {
// result = result.substring(0, idx) + unit.value + result.substring(idx, result.length) + unit.value;
// result = result.substring(0, idx) + outerUnit.value + result.substring(idx, result.length) + outerUnit.value;
// }
// return result;
// })

View File

@@ -1,6 +1,6 @@
<template>
<el-dialog :append-to-body="appendToBody" class="dialog" title="数据查询" :model-value='visible' @close="close"
v-bind="dialogBig" :draggable="false">
v-bind="dialogBig" :draggable="false" width="1400px">
<div class="data-check-dialog">
<div class="data-check-head">
<el-form :model='formContent' label-width="auto" class="form-three ">
@@ -8,7 +8,8 @@
<el-input v-model='formContent.scriptName' :disabled="true"/>
</el-form-item>
<el-form-item label="误差体系">
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="checkStore.showDetailType===0">
<el-select :disabled="checkStore.showDetailType===2 || checkStore.showDetailType===0" v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off"
@change="handleErrorSysChange">
<el-option
v-for="(option) in pqErrorList"
:key="option.id"
@@ -27,8 +28,11 @@
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" :icon="Postcard" v-if="checkStore.showDetailType===1" @click="handleGenerateReport">报告生成</el-button>
<el-form-item v-if="checkStore.showDetailType===1">
<el-button type="primary" :icon="Postcard" @click="handleGenerateReport">报告生成</el-button>
</el-form-item>
<el-form-item v-if="checkStore.showDetailType===0">
<el-button type="primary" :icon="Histogram" @click="handleReCalculate">重新计算</el-button>
</el-form-item>
</el-form>
</div>
@@ -49,7 +53,7 @@
:props="defaultProps"
@node-click="handleNodeClick" class="custom-tree" ref="treeRef">
<template #default="{ node, data }">
<el-tooltip effect="dark" :content="data.scriptTypeName" placement="top">
<el-tooltip effect="dark" :content="data.scriptTypeName" placement="right">
<span class="custom-tree-node" :style="data.fly===2? 'color: #F56C6C;':data.fly===4? 'color: #e6a23c;':''">{{
data.scriptTypeName
}}</span>
@@ -61,7 +65,7 @@
<div class="content-right">
<div class="content-right-title">
<div style="width: 750px;">
<div style="width: 840px;">
<span class="content-right-title-text">当前检测项目
<el-popover trigger="hover" :content="currentDesc" :width="popoverWidth" placement="right">
<template #reference>
@@ -72,15 +76,13 @@
</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 style="margin-left: 0px;margin-bottom:0px !important;width: 280px;" v-if="checkListLevel.length" label='测试项'>
<el-cascader
v-model="currentCheckItem"
:options="checkListLevel"
:props="{expandTrigger: 'click' as const}"
placement="bottom-end"
/>
</el-form-item>
</div>
<div class="content-right-Tabs">
@@ -107,10 +109,12 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
import {CheckData} from "@/api/check/interface";
import {useDictStore} from "@/stores/modules/dict";
import {useCheckStore} from "@/stores/modules/check";
import {exportRawData, getFormData, getTableData, getTreeData} from "@/api/check/test";
import {getPqErrSysList} from '@/api/plan/plan'
import {changeErrorSystem, deleteTempTable, exportRawData, getFormData, getTableData, getTreeData, reCalculate} from "@/api/check/test";
import {generateDevReport, getPqErrSysList} from '@/api/plan/plan'
import {useDownload} from "@/hooks/useDownload";
import {Postcard} from "@element-plus/icons-vue";
import {Histogram, Postcard} from "@element-plus/icons-vue";
import {ResultEnum} from "@/enums/httpEnum";
import {ElMessage} from "element-plus";
const {appendToBody} = withDefaults(defineProps<{
appendToBody: boolean
@@ -143,14 +147,17 @@ const formContent = reactive<CheckData.DataCheck>({
deviceName: '',
chnNum: '',
})
// 当前选中的谐波次数
// const currentHarmNum = ref<string>("-1")
// 原始误差体系id
let originErrorSysId: string = ''
let planCode: string = ''
// 谐波次数列表
// const harmNumList = reactive<{ value: string, label: string }[]>([])
// 当前选中的检测项
const currentCheckItem = ref<string>("")
const currentCheckItem = ref<any>()
// 检测项列表
const checkList = reactive<{ value: string, label: string }[]>([])
// const checkList = reactive<{ value: string, label: string }[]>([])
// 带有层级的检测项列表
const checkListLevel = reactive<{ value: string, label: string, children: { value: string, label: string }[] }[]>([])
let deviceId: string = ''
let originScriptType: string | null = null
@@ -174,14 +181,13 @@ const currentDesc = ref('');
const activeTab = ref<string>('resultTab')
//存放相应的表格数据
let resTableData: { resultData: Map<string, any>, rawData: Map<string, any> } = {resultData: new Map(), rawData: new Map()}
const resTableData = reactive<{ resultData: Map<string, any>, rawData: Map<string, any> }>({resultData: new Map(), rawData: new Map()})
// 检测结果表格数据
const checkResultData = reactive<CheckData.CheckResult[]>([])
const 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`
return `${1140 - (currentScriptTypeName.value.length + 7 + 3) * 14 - (checkListLevel.length ? 280 : 0)}px`
})
@@ -212,24 +218,48 @@ const handleNodeClick = async (data: any) => {
}
};
watch(() => formContent.errorSysId, async (newVal, oldVal) => {
if (newVal != '') {
console.log("切换误差体系");
const handleErrorSysChange = async () => {
console.log("切换误差体系", formContent.errorSysId);
changeErrorSystem({
planId: checkStore.plan.id,
scriptId: checkStore.plan.scriptId,
errorSysId: formContent.errorSysId,
deviceId: deviceId,
code: checkStore.plan.code + '',
}).then((res) => {
if (res.code === ResultEnum.SUCCESS) {
ElMessage.success('切换误差体系成功')
if (originErrorSysId != formContent.errorSysId) {
planCode = checkStore.plan.code + "_temp"
} else {
planCode = checkStore.plan.code + ''
}
if (formContent.chnNum != chnList[0].value) {
formContent.chnNum = chnList[0].value
} else {
handleChnNumChange()
}
}
})
}
watch(() => formContent.chnNum, async (newVal, oldVal) => {
// console.log("通道号", newVal);
if (newVal != '') {
handleChnNumChange()
}
})
const handleChnNumChange = async () => {
console.log("通道号", formContent.chnNum);
// 发起请求,查询该测试项的检测结果
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
scriptId: checkStore.plan.scriptId,
devId: deviceId,
devNum: formContent.chnNum + '',
scriptType: originScriptType,
code: parseInt(checkStore.plan.code)
code: planCode
})
updateTreeFly(resTreeDataTemp, 4)
updateTreeFly(resTreeDataTemp, 2)
@@ -240,32 +270,18 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
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)
let key = newVal[0]
if (newVal.length == 2) {
key += "_" + newVal[1]
}
console.log("当前检测项", key);
doCurrentCheckItemUpdate(key)
} else {
activeTab.value = 'resultTab'
}
@@ -294,6 +310,12 @@ const defaultOperate = () => {
const updateTableData = async () => {
console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
if (checkIndex.value !== '') {
checkListLevel.length = 0
checkResultData.length = 0
rawTableData.length = 0
currentCheckItem.value = ''
// console.log("更新表格数据");
// 发起请求,查询该测试项的检测结果
const {data} = await getTableData({
@@ -301,76 +323,65 @@ const updateTableData = async () => {
scriptId: checkStore.plan.scriptId,
devId: deviceId,
devNum: formContent.chnNum + '',
code: parseInt(checkStore.plan.code),
code: 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 children = []
let label = key
if ((key.includes('谐波') || key.includes('简谐波')) && key !== '谐波有功功率') {
for (let item of data.resultData[key]) {
let num = formatHarmNum(item.harmNum + '')
label = item.isData === 1 ? `${num}` : item.isData === 4 ? `${num}/` : item.isData === 5 ? `${num}-` : `${num}(不符合)`
children.push({label: label, value: num})
resultData.set(key + "_" + num, item)
}
checkListLevel.push({label: key, value: key, children: children})
} else {
label = data.resultData[key][0].isData === 1 ? `${key}` : data.resultData[key][0].isData === 4 ? `${key}/` : data.resultData[key][0].isData === 5 ? `${key}-` : `${key}(不符合)`
resultData.set(key, data.resultData[key][0])
checkListLevel.push({label: label, value: key, children: []})
}
}
let keys2 = Object.keys(data.rawData)
let rawData = new Map()
for (let key of keys2) {
if ((key.includes('谐波') || key.includes('简谐波')) && key !== '谐波有功功率') {
for (let item of data.rawData[key]) {
let num = formatHarmNum(item.harmNum + '')
let value = rawData.get(key + "_" + num)
if (!value) {
rawData.set(key + "_" + num, [item])
} else {
value.push(item)
}
}
} else {
rawData.set(key, data.rawData[key])
}
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 = ''
}
resTableData.resultData = resultData
resTableData.rawData = rawData
if (keys1.length === 1) {
resCheckResult = resTableData.resultData.get(keys1[0])
resRawData = resTableData.rawData.get(keys2[0])
toAngleLast()
resRawData = (resRawData == null || resRawData == undefined ? [] : resRawData)
resCheckResult = (resCheckResult == null || resCheckResult == undefined ? {} : resCheckResult)
setCheckResultData(resCheckResult)
setRawData(resRawData)
checkList.length = 0
checkList.push({value: keys1[0], label: resCheckResult.isData === 1? `${keys1[0]}`:resCheckResult.isData === 4? `${keys1[0]}/` :`${keys1[0]}(不符合)`})
if (currentCheckItem.value == checkList[0].value) {
doCurrentCheckItemUpdate(checkList[0].value)
if (checkListLevel.length !== 0) {
if (checkListLevel[0].children.length !== 0) {
currentCheckItem.value = [checkListLevel[0].value + '', checkListLevel[0].children[0].value + '']
} else {
currentCheckItem.value = checkList[0].value
currentCheckItem.value = [checkListLevel[0].value + '']
}
} else if (keys1.length != 0) {
let tempCheckList = []
for (let [key, value] of resTableData.resultData) {
let hum = formatHarmNum(key)
tempCheckList.push({
value: key,
label: value.isData === 1 ? hum : value.isData === 4 ? `${hum}/` : `${hum}(不符合)`
})
}
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
}
@@ -391,6 +402,7 @@ const doCurrentCheckItemUpdate = (newVal: string) => {
}
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
planCode = checkStore.plan.code + ''
deviceId = _deviceId
originScriptType = _scriptType
scriptType = _scriptType
@@ -416,6 +428,7 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
dataRule: dataRuleName,
chnNum: chnList.length > 0 ? chnList[0].value : '',
})
originErrorSysId = formContent.errorSysId
pqErrorList.length = 0
let {data: resPqErrorList} = await getPqErrSysList()
@@ -424,11 +437,34 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
visible.value = true;
}
const handleGenerateReport = () => {
console.log("生成报告", checkStore.plan.id, deviceId)
const handleGenerateReport = async () => {
await generateDevReport({'planId': checkStore.plan.id, 'devIdList': [deviceId],'scriptId':checkStore.plan.scriptId,'planCode':planCode})
ElMessage.success({message: `报告生成成功!`})
}
const close = () => {
const handleReCalculate = async () => {
reCalculate({
planId: checkStore.plan.id,
scriptId: checkStore.plan.scriptId,
errorSysId: formContent.errorSysId,
deviceId: deviceId,
code: checkStore.plan.code + ''
}).then((res) => {
ElMessage.success('重新计算成功!')
// if (originErrorSysId != formContent.errorSysId) {
// planCode = checkStore.plan.code + "_temp"
// } else {
// planCode = checkStore.plan.code + ''
// }
if (formContent.chnNum != chnList[0].value) {
formContent.chnNum = chnList[0].value
} else {
handleChnNumChange()
}
})
}
const close = async () => {
//数据清空
Object.assign(formContent, {
scriptName: '',
@@ -443,19 +479,23 @@ const close = () => {
currentCheckItem.value = ''
checkResultData.length = 0
rawTableData.length = 0
checkList.length = 0
//checkList.length = 0
defaultExpandedKeys = []
checkIndex.value = ''
activeTab.value = 'resultTab'
currentScriptTypeName.value = ''
currentDesc.value = ''
pqErrorList.length = 0
planCode = ''
visible.value = false;
if (checkStore.showDetailType === 1) {
await deleteTempTable(checkStore.plan.code + '')
}
};
const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
// console.log("检测结果", data);
let result: CheckData.CheckResult[] = []
if (data == null || data == undefined) {
Object.assign(checkResultData, [])
@@ -463,21 +503,30 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
}
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),
// stdA: numberToFixed(data.dataA.resultData),
// dataA: numberToFixed(data.dataA.data),
stdA: dataToShow(data.dataA.resultData),
dataA: dataToShow(data.dataA.data),
errorA: data.dataA.errorData == null ? '/' : data.dataA.errorData + '',
maxErrorA: toMaxErrorStr(data.dataA.radius, data.dataA.unit),
unitA: data.dataA.unit,
isDataA: data.dataA.isData,
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),
// stdB: numberToFixed(data.dataB.resultData),
// dataB: numberToFixed(data.dataB.data),
stdB: dataToShow(data.dataB.resultData),
dataB: dataToShow(data.dataB.data),
errorB: data.dataB.errorData == null ? '/' : data.dataB.errorData + '',
maxErrorB: toMaxErrorStr(data.dataB.radius, data.dataB.unit),
isDataB: data.dataB.isData,
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),
unitB: data.dataB.unit,
// stdC: numberToFixed(data.dataC.resultData),
// dataC: numberToFixed(data.dataC.data),
stdC: dataToShow(data.dataC.resultData),
dataC: dataToShow(data.dataC.data),
errorC: data.dataC.errorData == null ? '/' : data.dataC.errorData + '',
maxErrorC: toMaxErrorStr(data.dataC.radius, data.dataC.unit),
isDataC: data.dataC.isData,
unitC: data.dataC.unit,
maxError: data.radius,
unit: data.unit,
@@ -485,13 +534,16 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
})
}
if (data.dataT != null) {
if (data.dataT != null && data.dataA == null && data.dataB == null && data.dataC == null) {
result.push({
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),
// stdT: numberToFixed(data.dataT.resultData),
// dataT: numberToFixed(data.dataT.data),
stdT: dataToShow(data.dataT.resultData),
dataT: dataToShow(data.dataT.data),
errorT: data.dataT.errorData == null ? '/' : data.dataT.errorData + '',
maxErrorT: toMaxErrorStr(data.dataT.radius, data.dataT.unit),
isDataT: data.dataT?.isData,
unitT: data.dataT.unit,
maxError: data.radius,
unit: data.unit,
@@ -499,15 +551,16 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
})
}
Object.assign(checkResultData, result)
console.log("检测结果", checkResultData);
}
const exportRawDataHandler = () => {
useDownload(exportRawData, '原始数据.xlsx', {
useDownload(exportRawData, '原始数据', {
scriptType,
scriptId: checkStore.plan.scriptId,
devId: deviceId,
devNum: formContent.chnNum + '',
code: parseInt(checkStore.plan.code),
code: checkStore.plan.code + '',
index: parseInt(checkIndex.value),
}, false, '.xlsx')
}
@@ -524,15 +577,26 @@ const formatHarmNum = (num: string) => {
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)
// item.dataA = stringToFixed(item.dataA)
// item.dataB = stringToFixed(item.dataB)
// item.dataC = stringToFixed(item.dataC)
// item.dataT = stringToFixed(item.dataT)
item.dataA = dataToShow(item.dataA)
item.dataB = dataToShow(item.dataB)
item.dataC = dataToShow(item.dataC)
item.dataT = dataToShow(item.dataT)
})
rawTableData.length = 0
Object.assign(rawTableData, data)
console.log("原始数据", rawTableData)
}
const dataToShow = (num: number): string => {
if (num == null || num == undefined) {
return '/'
}
return num+''
}
const numberToFixed = (num: number): string => {
if (num == null || num == undefined) {
@@ -598,18 +662,18 @@ const getDefaultNode = (data: any[]) => {
return findFirstLeafNode(firstElement);
}
const toAngleLast = (data: any[]) => {
const toAngleLast = () => {
let angleIndex = -1
for (let i = 0; i < data.length; i++) {
if (data[i].value.toString().includes('相角')) {
for (let i = 0; i < checkListLevel.length; i++) {
if (checkListLevel[i].value.toString().includes('相角')) {
angleIndex = i
break
}
}
if (angleIndex != -1) {
let temp = data[angleIndex]
data.splice(angleIndex, 1)
data.push(temp)
let temp = checkListLevel[angleIndex]
checkListLevel.splice(angleIndex, 1)
checkListLevel.push(temp)
}
}
@@ -681,7 +745,6 @@ defineExpose({
</script>
<style lang="scss" scoped>
.dialog {
display: flex;
flex-direction: column;
@@ -776,7 +839,7 @@ defineExpose({
<!--.el-popover.popover-class {-->
<!-- .el-popover__title {-->
<!-- color: #fff;-->
<!-- background-color: #003078 !important;-->
<!-- background-color: var(--el-color-primary) !important;-->
<!-- }-->
<!--}-->
<!--</style>-->

View File

@@ -6,7 +6,7 @@
<div>{{ outputDsc }}</div>
<div>
<span style=" font-size: 18px;font-weight: 600;">
设备已合格 <span style="color: #67C23A">{{ qualified }}</span> / <span style="color: green">{{ total }}</span>
设备已合格 <span style="color: #91cc75">{{ qualified }}</span> / <span style="color: green">{{ total }}</span>
</span>
<!-- <el-button type="primary" loading
@@ -99,6 +99,7 @@ import {getCoefficientCheck} from '@/api/home/channelsTest/index'
import type {ChannelsTest} from '@/api/home/interface/channelsTest';
import type {Plan} from '@/api/plan/interface';
import {useCheckStore} from "@/stores/modules/check";
import {useUserStore} from "@/stores/modules/user";
const checkStore = useCheckStore()
const activeIndex = ref(0)
@@ -143,7 +144,7 @@ const props = defineProps({
default: () => ({})
},
})
const userStore = useUserStore()
const testStatus = toRef(props, 'testStatus');
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
@@ -188,6 +189,7 @@ watch(testStatus, function (newValue, oldValue) {
watch(webMsgSend, function (newValue, oldValue) {
console.log('webMsgSend---code', newValue.code)
console.log('webMsgSend---requestId', newValue.requestId)
if (testStatus.value !== 'waiting') {
if (newValue.code == 10520) {
ElMessageBox.alert('报文解析异常!', '初始化失败', {
confirmButtonText: '确定',
@@ -343,44 +345,59 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
}
break;
case 'yjc_xyjy':
switch (newValue.operateCode) {
case 'VERIFY_MAPPING$01':
if (newValue.code == 10200) {
let data = JSON.parse(newValue.data)
ElMessageBox.alert(`脚本与icd校验失败icd名称${data['icdType']} -> 校验项:${data['dataType']}`, '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
TableInit();
}
break;
}
break;
case 'Coefficient_Check':
console.log("Coefficient_Checkactive", active.value);
switch (newValue.operateCode) {
case 'big_end'://大电压,电流下装
console.log('大电压,电流下装')
active.value++;
case 'big_start'://大电压,电流下装
big_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
big_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
break;
case 'big_end'://大电压,电流下装
active.value++;
tableLoading('small', '系数下装')
break;
}
switch (newValue.operateCode) {
case 'small_end'://小电压,电流下装
console.log('小电压,电流下装')
active.value++;
case 'small_start'://小电压,电流下装
small_V_Download.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
small_I_Download.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
break;
case 'small_end'://小电压,电流下装
active.value++;
tableLoading('big', '系数校准')
break;
}
switch (newValue.operateCode) {
case 'big_comp_end'://大电压,电流校准
console.log('大电压,电流校准')
active.value++;
case 'big_comp_start'://大电压,电流校准
big_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
big_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
break;
case 'big_comp_end'://大电压,电流校准
active.value++;
tableLoading('small', '系数校准')
break;
}
switch (newValue.operateCode) {
case 'small_comp_end'://小电压,电流校准
console.log('小电压,电流校准')
active.value++;
case 'small_comp_start'://小电压,电流校准
small_V_Adjust.value = 'Ua=Ub=Uc=' + newValue.data.devVolt + 'V';
small_I_Adjust.value = 'Ia=Ib=Ic=' + newValue.data.devCurr + 'A';
break;
case 'small_comp_end'://小电压,电流校准
active.value++;
active.value++;
for (let i = 0; i < name.value.length; i++) {
@@ -517,6 +534,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
}
}
}
})
//出错系数检测初始化
@@ -720,7 +738,8 @@ const handleSubmit = async () => {
planId: planId.value,
errorSysId: select_Plan.value?.errorSysId,
scriptId: select_Plan.value?.scriptId,
operateType: '0' // '0'为预检测、1为正式检测
operateType: '0', // '0'为预检测、1为正式检测
userId:userStore.userInfo.id
})
active.value++;

View File

@@ -4,8 +4,7 @@
<el-tab-pane label="预检测项目">
<div class="form-grid">
<el-checkbox v-for="(item, index) in detectionOptions" v-model="item.selected" :key="index"
:label="item.name"></el-checkbox>
<!-- disabled="true" -->
:label="item.name" disabled></el-checkbox>
</div>
</el-tab-pane>
</el-tabs>
@@ -18,7 +17,7 @@
<el-step :status="step2" title="设备通讯校验"/>
<el-step :status="step3" title="协议校验"/>
<el-step :status="step4" title="相序校验"/>
<el-step :status="step5" title="检测完成"/>
<el-step :status="step5" :title="ts === 'error'? '检测失败':ts === 'process'? '检测中':ts === 'success'? '检测成功':'待检测'"/>
</el-steps>
</div>
<div class="dialog-right">
@@ -234,8 +233,7 @@ const webMsgSend = toRef(props, 'webMsgSend');
const ts = ref('');
watch(webMsgSend, function (newValue, oldValue) {
// console.log(newValue)
if (testStatus.value !== 'waiting') {
switch (newValue.requestId) {
case 'yjc_ytxjy':
switch (newValue.operateCode) {
@@ -258,9 +256,11 @@ watch(webMsgSend, function (newValue, oldValue) {
ElMessage.error(newValue.code)
step1.value = 'error'
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 10523) {
step1.value = 'error'
ts.value = 'error'
step5.value = 'error'
step1InitLog.value = [{
type: 'error',
log: '源连接失败!',
@@ -268,6 +268,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} else if (newValue.code == -1) {
step1.value = 'error'
ts.value = 'error'
step5.value = 'error'
step1InitLog.value = [{
type: 'error',
log: '源未知异常!',
@@ -301,6 +302,7 @@ watch(webMsgSend, function (newValue, oldValue) {
})
step2.value = 'error'
// ts.value = 'error'
// step5.value = 'error'
} else if (newValue.code == 10551) {
step2InitLog.value.push({
type: 'error',
@@ -308,6 +310,7 @@ watch(webMsgSend, function (newValue, oldValue) {
})
step2.value = 'error'
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 10552) {
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
step2InitLog.value = [{
@@ -316,6 +319,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}];
step2.value = 'error'
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 25001) {
activeIndex.value = 2
step2.value = 'success'
@@ -347,6 +351,7 @@ watch(webMsgSend, function (newValue, oldValue) {
})
step3.value = 'error'
// ts.value = 'error'
// step5.value = 'error'
} else if (newValue.code == 10551) {
step3InitLog.value.push({
type: 'error',
@@ -354,6 +359,7 @@ watch(webMsgSend, function (newValue, oldValue) {
})
step3.value = 'error'
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 10552) {
step3.value = 'error'
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
@@ -362,6 +368,7 @@ watch(webMsgSend, function (newValue, oldValue) {
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
}];
ts.value = 'error'
step5.value = 'error'
}
break;
case 'INIT_GATHER$02':
@@ -384,6 +391,7 @@ watch(webMsgSend, function (newValue, oldValue) {
})
step3.value = 'error'
// ts.value = 'error'
// step5.value = 'error'
} else if (newValue.code == 10551) {
step3InitLog.value.push({
type: 'error',
@@ -391,6 +399,7 @@ watch(webMsgSend, function (newValue, oldValue) {
})
step3.value = 'error'
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 10552) {
step3.value = 'error'
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
@@ -399,6 +408,7 @@ watch(webMsgSend, function (newValue, oldValue) {
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
}];
ts.value = 'error'
step5.value = 'error'
}
break;
case 'INIT_GATHER$03':
@@ -417,6 +427,7 @@ watch(webMsgSend, function (newValue, oldValue) {
})
step3.value = 'error'
// ts.value = 'error'
// step5.value = 'error'
} else if (newValue.code == 10551) {
step3InitLog.value.push({
type: 'error',
@@ -424,6 +435,7 @@ watch(webMsgSend, function (newValue, oldValue) {
})
step3.value = 'error'
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 10552) {
//ElMessage.error("当前步骤已经初始化,执行自动关闭,请重新发起检测!")
step3.value = 'error'
@@ -432,14 +444,26 @@ watch(webMsgSend, function (newValue, oldValue) {
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
}];
ts.value = 'error'
} else if (newValue.code == 25001) {
step5.value = 'error'
}
break;
case 'VERIFY_MAPPING$01':
if (newValue.code == 25001) {
activeIndex.value = 3
step3.value = 'success'
step4.value = 'process'
} else if (newValue.code == 10200) {
let data = JSON.parse(newValue.data)
step3InitLog.value.push({
type: 'error',
log: `脚本与icd检验失败! icd名称${data['icdType']} -> 校验项:${data['dataType']}`,
})
step3.value = 'error'
ts.value = 'error'
step5.value = 'error'
}
break;
}
break;
case 'YJC_xujy':
switch (newValue.operateCode) {
@@ -460,6 +484,7 @@ watch(webMsgSend, function (newValue, oldValue) {
ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
step4.value = 'error'
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 10520) {
step4.value = 'error'
step4InitLog.value.push({
@@ -467,6 +492,7 @@ watch(webMsgSend, function (newValue, oldValue) {
log: '解析报文异常',
})
ts.value = 'error'
step5.value = 'error'
}
break;
@@ -496,6 +522,7 @@ watch(webMsgSend, function (newValue, oldValue) {
log: '相序校验未通过!',
})
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 25001) {
step4.value = 'success'
step5.value = 'success'
@@ -503,9 +530,9 @@ watch(webMsgSend, function (newValue, oldValue) {
type: 'wait',
log: '相序校验成功!',
})
ts.value = 'success'
}
activeIndex.value = 5
ts.value = 'success'
console.log("@@@@", ts.value)
break
}
@@ -522,6 +549,7 @@ watch(webMsgSend, function (newValue, oldValue) {
log: '源服务端连接失败!',
}];
ts.value = 'error'
step5.value = 'error'
break;
case "Dev":
step2.value = 'error'
@@ -530,6 +558,7 @@ watch(webMsgSend, function (newValue, oldValue) {
log: '设备服务端连接失败!',
}];
ts.value = 'error'
step5.value = 'error'
break;
}
break;
@@ -542,9 +571,10 @@ watch(webMsgSend, function (newValue, oldValue) {
type: 'error',
})
ts.value = 'error'
step5.value = 'error'
break;
}
}
})
watch(activeIndex, function (newValue, oldValue) {

View File

@@ -27,7 +27,7 @@
<div class="tabs-title ">
<el-button type="primary" :icon="Download" >报告下载</el-button>
<span style=" font-size: 18px;font-weight: 600;">
已生成 <span style="color: #67C23A">2</span> / <span style="color: green">3</span>
已生成 <span style="color: #91cc75">2</span> / <span style="color: green">3</span>
</span>
</div>

View File

@@ -8,7 +8,7 @@
<el-form-item v-if="checkStore.plan.timeCheck===1" prop="timeTest" :label-width="100">
<el-checkbox v-model="formContent.timeTest" label="守时检测"/>
</el-form-item>
<el-form-item prop="channelsTest" :label-width="100">
<el-form-item v-if="AppSceneStore.currentScene === '1'" prop="channelsTest" :label-width="100">
<el-checkbox v-model="formContent.channelsTest" label="系数校准"/>
</el-form-item>
<el-form-item prop="test" :label-width="100">
@@ -32,7 +32,8 @@ import {ref} from "vue";
import {useCheckStore} from "@/stores/modules/check";
import type {CheckData} from "@/api/check/interface";
import {ElMessageBox} from "element-plus";
import {useAppSceneStore} from "@/stores/modules/mode";
const AppSceneStore = useAppSceneStore()
const emit = defineEmits(['openTestDialog'])
const checkStore = useCheckStore();

View File

@@ -18,7 +18,7 @@
<template #tableHeader=''>
<el-form :model='form' :inline='true'>
<el-form-item label='关键字'>
<el-input v-model='form.search' placeholder='请输入设备名称' clearable style='width: 140px;'></el-input>
<el-input v-model='form.search' placeholder='请输入设备名称' clearable style='width: 170px;' show-word-limit maxlength="32"></el-input>
</el-form-item>
<el-form-item label='检测状态' v-if='form.activeTabs != 3 && form.activeTabs != 4 && form.activeTabs != 5'>
<el-select v-model='form.checkStatus' clearable>
@@ -938,6 +938,7 @@ const handleTest = async (val: string) => {
dialogTitle.value = val
if (val === '手动检测') {
checkStore.setShowDetailType(2)
if (testType === 'reTest') {
ElMessageBox.confirm('请选择复检检测方式', '设备复检',
@@ -957,11 +958,14 @@ const handleTest = async (val: string) => {
selectTestItemPopupRef.value?.open()
})
.catch((action: Action) => {
if(action === 'cancel'){
ElMessage.success('全部复检')
checkStore.setReCheckType(1)
selectTestItemPopupRef.value?.open()
}
})
} else {
checkStore.setReCheckType(1)
selectTestItemPopupRef.value?.open()
}
} else if (val === '系数校准') {
@@ -988,6 +992,7 @@ const handleTest = async (val: string) => {
channelsTest.value?.open(channelsSelection.value, props.plan)
return
} else {
checkStore.setShowDetailType(2)
checkStore.setCheckType(1)
checkStore.initSelectTestItems()
// 一键检测
@@ -1062,7 +1067,7 @@ const openDrawer = async (title: string, row: any) => {
if (title === '报告生成') {
await generateDevReport({'planId': checkStore.plan.id, 'devId': row.id})
await generateDevReport({'planId': checkStore.plan.id, 'devIdList': [row.id],'scriptId':checkStore.plan.scriptId,'planCode':checkStore.plan.code+''})
emit('batchGenerateClicked') // 触发事件
ElMessage.success({message: `报告生成成功!`})
}
@@ -1140,7 +1145,7 @@ onBeforeMount(async () => {
const handleQuitClicked = () => {
//console.log('handleQuitClicked')
//dataSocket.socketServe.closeWs()
dataSocket.socketServe.closeWs()
emit('batchGenerateClicked') // 触发事件
}

View File

@@ -1,7 +1,7 @@
<template>
<el-table
:data="tableData"
:row-class-name="tableRowClassName" row-key="id" height="300px" :header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%" border v-on:cell-click="handleClick"
:row-class-name="tableRowClassName" row-key="id" height="300px" :header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' } " style="width: 100%" border v-on:cell-click="handleClick"
>
<el-table-column prop="date" label="Date" width="180" />
<el-table-column prop="name" label="Name" width="180" />

View File

@@ -9,73 +9,73 @@
<span>检测用时{{ timeView }}</span>
</div>
<el-progress
style="width: 60%; margin-right: 4%;"
style="width: 82%; margin-right: 3%;"
:percentage="percentage"
:color="customColors"/>
<div style="width: 15%">
<el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
<component :is="Refresh"/>
</el-icon>
初始化中
</el-button>
<!-- <div style="width: 15%">-->
<!-- <el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">-->
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
<!-- <component :is="Refresh"/>-->
<!-- </el-icon>-->
<!-- 初始化中-->
<!-- </el-button>-->
<el-button
type="primary"
v-if="testStatus=='process' && percentage < 100"
:icon="VideoPause"
@click="handlePause()">停止检测
</el-button>
<el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>
<el-icon class="loading-box" style="margin-right: 8px;">
<component :is="Refresh"/>
</el-icon>
暂停中
</el-button>
<!-- <el-button-->
<!-- type="primary"-->
<!-- v-if="testStatus=='test_init'"-->
<!-- v-if="testStatus=='process' && percentage < 100"-->
<!-- :icon="VideoPause"-->
<!-- disabled>初始化中-->
<!-- @click="handlePause()">停止检测-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- v-if="testStatus=='test_init_fail'"-->
<!-- :icon="Failed"-->
<!-- disabled>初始化失败-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- v-if="testStatus=='connect_timeout'"-->
<!-- :icon="Failed"-->
<!-- disabled>连接超时-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- :icon="RefreshLeft"-->
<!-- v-if="testStatus === 'recheck'"-->
<!-- @click="emit('sendReCheck')">重新检测-->
<!-- <el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>-->
<!-- <el-icon class="loading-box" style="margin-right: 8px;">-->
<!-- <component :is="Refresh"/>-->
<!-- </el-icon>-->
<!-- 暂停中-->
<!-- </el-button>-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="primary"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus=='test_init'"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="VideoPause"&ndash;&gt;-->
<!-- &lt;!&ndash; disabled>初始化中&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="danger"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus=='test_init_fail'"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;-->
<!-- &lt;!&ndash; disabled>初始化失败&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="danger"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus=='connect_timeout'"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;-->
<!-- &lt;!&ndash; disabled>连接超时&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="primary"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="RefreshLeft"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus === 'recheck'"&ndash;&gt;-->
<!-- &lt;!&ndash; @click="emit('sendReCheck')">重新检测&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>
<!-- <el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>-->
<el-button
type="warning"
v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"
:icon="VideoPlay"
:disabled="testStatus === 'pause_timeout'"
@click="emit('sendResume')"
>继续检测
</el-button>
</div>
<!-- <el-button-->
<!-- type="warning"-->
<!-- v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"-->
<!-- :icon="VideoPlay"-->
<!-- :disabled="testStatus === 'pause_timeout'"-->
<!-- @click="emit('sendResume')"-->
<!-- >继续检测-->
<!-- </el-button>-->
<!-- </div>-->
<el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
</div>
<div class="dialog-content">
<el-table :data="checkResultView" row-key="scriptType" height="450px"
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%"
:header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' } " style="width: 100%"
border>
<el-table-column fixed prop="scriptName" label="检测项目" width="150px" align="center">
</el-table-column>
@@ -86,9 +86,9 @@
<el-table-column v-for="(chnItem,index2) in item.chnNum" :key="`${item.deviceId}${chnItem}`"
:label="'通道'+chnItem" align="center">
<template #default="{row}">
<el-tooltip
:content="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
placement="top">
<!-- <el-tooltip-->
<!-- :content="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"-->
<!-- placement="top">-->
<el-button
:disabled="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.LOADING"
:color="row.devices[index1].chnResult[index2].color"
@@ -105,7 +105,7 @@
</el-icon>
</el-button>
</el-tooltip>
<!-- </el-tooltip>-->
</template>
</el-table-column>
</el-table-column>
@@ -168,6 +168,9 @@ import {CheckData} from "@/api/check/interface"
import {useCheckStore} from "@/stores/modules/check";
import {ElMessage, ElMessageBox} from "element-plus";
import {getBigTestItem} from "@/api/check/test";
import {getAutoGenerate} from "@/api/user/login";
import {generateDevReport} from "@/api/plan/plan";
const checkStore = useCheckStore()
@@ -196,7 +199,7 @@ const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause',
// 用来保存测试项进度抽屉是否打开
const drawer = ref(false)
// 进度条颜色
const customColors = [{color: "#67c23a", percentage: 100}]
const customColors = [{color: "#91cc75", percentage: 100}]
// 检测脚本数据
let scriptData: CheckData.ScriptItem[] = []
// 用来保存被检设备
@@ -254,7 +257,7 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
for (let j = 0; j < device.chnResult.length; j++) {
switch (device.chnResult[j]) {
case CheckData.ChnCheckResultEnum.UNKNOWN:
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'More'})
break;
case CheckData.ChnCheckResultEnum.LOADING:
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
@@ -271,6 +274,9 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
case CheckData.ChnCheckResultEnum.ERRORDATA:
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
break;
case CheckData.ChnCheckResultEnum.NOT_PART_IN_ERROR:
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
break;
default:
break;
}
@@ -349,6 +355,7 @@ watch(testStatus, function (newValue, oldValue) {
let count = 0
watch(webMsgSend, function (newValue, oldValue) {
if (testStatus.value !== 'waiting') {
if (props.stepsActive === 4) {
if (newValue.code == 10520) {
ElMessageBox.alert('报文解析异常!', '初始化失败', {
@@ -529,7 +536,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'yjc_xyjy':
switch (newValue.operateCode) {
case 'INIT_GATHER$03':
case 'VERIFY_MAPPING$01':
if (newValue.code == 25001) {
ElMessage.success('初始化成功!')
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:协议校验成功!`})
@@ -537,11 +544,21 @@ watch(webMsgSend, function (newValue, oldValue) {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`})
percentage.value = 3
activeIndex = getNextActiveIndex() + 2
//startTimer()
emit('update:testStatus', 'process')
} else if (newValue.code == 10200) {
let data = JSON.parse(newValue.data)
ElMessageBox.alert(`脚本与icd校验失败icd名称${data['icdType']} -> 校验项:${data['dataType']}`, '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({
type: 'error',
log: `${new Date().toLocaleString()}脚本与icd校验失败icd名称${newValue.data.icdType} -> 校验项:${newValue.data.dataType}`
})
emit('update:testStatus', 'test_init_fail')
}
break;
}
@@ -642,6 +659,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
}
}
}
}, {deep: true})
const handleStartItem = (code: string, desc: string | undefined) => {
@@ -684,12 +702,19 @@ const handleEndItem = (code: string, desc: string | undefined, devices: CheckDat
}
// 更新进度条
const updatePercentage = () => {
const updatePercentage = async () => {
if (activeIndex < checkTotal) {
percentage.value = Math.trunc(activeIndex / checkTotal * 100);
} else {
percentage.value = 100;
emit('update:testStatus', 'success')
let {data: autoGenerate} = await getAutoGenerate()
if (autoGenerate == 1) {
//调用自动生成报告接口
let deviceIds = checkStore.devices.map(item => item.deviceId)
// await generateDevReport({'planId': checkStore.plan.id, 'devId':deviceIds[0] ,'scriptId':checkStore.plan.scriptId,'planCode':checkStore.plan.code+''})
}
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
confirmButtonText: '确定',
})
@@ -1117,7 +1142,7 @@ const handleClick = (item: any, chnNum: number, scriptType: string) => {
})
}
if (flag === -1 || flag === 1) {
checkStore.setShowDetailType(0)
checkStore.setShowDetailType(2)
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType);
}
};
@@ -1243,7 +1268,7 @@ const startTimer = () => {
}
};
const handlePause = () => {
emit('sendPause')
//emit('sendPause')
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`})
}
@@ -1424,10 +1449,15 @@ const secondToTime = (second: number) => {
}
onBeforeUnmount(() => {
if (timer) {
clearInterval(timer)
}
})
defineExpose({
handlePause
})
</script>
<style scoped lang="scss">
@@ -1479,8 +1509,7 @@ onBeforeUnmount(() => {
.timeView {
display: flex;
align-items: center;
color: #67c23a;;
color: #91cc75;
width: 28%;
margin-right: 0px;
text-align: left;
@@ -1514,8 +1543,7 @@ onBeforeUnmount(() => {
.drawer-container {
:deep(header.el-drawer__header) {
color: #fff !important;
background-color: #003078 !important;
background-color: var(--el-color-primary) !important;
.el-drawer__close-btn svg:hover {
color: #ccc !important;
}
@@ -1541,7 +1569,7 @@ onBeforeUnmount(() => {
//:deep(.el-drawer .el-drawer__title){
// background-color: #003078 !important;
// background-color: var(--el-color-primary) !important;
//}
</style>

View File

@@ -16,28 +16,30 @@
<timeTest v-if="showComponent&&timeTestSelected" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/>
<!-- <channelsTest v-if="stepsActiveIndex === 3" v-model:testStatus="channelsTestStatus"></channelsTest>-->
<factorTest v-if="showComponent&&channelsTestSelected" v-show="channelsTestSelected && stepsActiveView==3" v-model:testStatus="channelsTestStatus" :webMsgSend="webMsgSend"/>
<test v-if="showComponent&&testSelected" v-show="testSelected && stepsActiveView==4" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend"
<test v-if="showComponent&&testSelected" ref="testRef" v-show="testSelected && stepsActiveView==4" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend"
@update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck" :stepsActive="stepsActive"/>
<template #footer>
<div>
<!-- <el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < stepsTotalNum && ActiveStatue != 'success'" @click="nextStep">跳过</el-button>-->
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
<el-button type="primary"
v-if="(stepsActiveIndex <= stepsTotalNum - 1) && (ActiveStatue !== 'success' &&ActiveStatue !== 'test_init' && ActiveStatue !=='paused_ing' && ActiveStatue !=='paused' && ActiveStatue !== 'waiting' && ActiveStatue !== 'error' && ActiveStatue !== 'test_init_fail' && ActiveStatue !== 'connect_timeout' && ActiveStatue!=='pause_timeout')"
disabled>
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
<component :is="Refresh"/>
</el-icon>
检测中
</el-button>
<!-- <el-button type="primary"-->
<!-- v-if="(stepsActiveIndex <= stepsTotalNum - 1) && (ActiveStatue !== 'success' &&ActiveStatue !== 'test_init' && ActiveStatue !=='paused_ing' && ActiveStatue !=='paused' && ActiveStatue !== 'waiting' && ActiveStatue !== 'error' && ActiveStatue !== 'test_init_fail' && ActiveStatue !== 'connect_timeout' && ActiveStatue!=='pause_timeout')"-->
<!-- disabled>-->
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
<!-- <component :is="Refresh"/>-->
<!-- </el-icon>-->
<!-- 检测中-->
<!-- </el-button>-->
<!-- <el-button type="primary" v-if="ActiveStatue === 'process'" disabled>-->
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
<!-- <component :is="Refresh"/>-->
<!-- </el-icon>-->
<!-- 检测中-->
<!-- </el-button>-->
<el-button type="warning" :icon="VideoPlay" v-if="TestStatus === 'paused'" @click="handleSubmit">继续检测</el-button>
<!-- <el-button type="warning" :icon="VideoPlay" v-if="TestStatus === 'paused'" @click="handleSubmit">继续检测</el-button>-->
<!-- <el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'recheck' || ActiveStatue ==='error' || ActiveStatue ==='test_init_fail' || ActiveStatue === 'pause_timeout' || ActiveStatue === 'connect_timeout'" @click="handleSubmit">重新检测</el-button>-->
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
@@ -45,17 +47,34 @@
</el-icon>
初始化中
</el-button>
<el-button
type="primary"
v-if="TestStatus=='process'"
:icon="VideoPause"
@click="handlePause()">停止检测
</el-button>
<el-button type="warning" v-if="TestStatus === 'paused_ing'" disabled>
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
<component :is="Refresh"/>
</el-icon>
暂停中
</el-button>
<el-button
type="warning"
v-if="(TestStatus =='paused')"
:icon="VideoPlay"
@click="sendResume"
>继续检测
</el-button>
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
@click="nextStep">
{{ nextStepText }}
</el-button>
<el-button type="primary" @click="handleQuit" v-else>
退出检测
</el-button>
</div>
</template>
</el-dialog>
@@ -66,7 +85,7 @@
<script lang="tsx" setup name="testPopup">
import {reactive, ref, watch} from 'vue';
import {ElMessage, ElMessageBox} from 'element-plus'
import {Coin, DArrowRight, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPlay} from '@element-plus/icons-vue'
import {Coin, DArrowRight, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPlay,VideoPause} from '@element-plus/icons-vue'
import preTest from './preTest.vue'
import timeTest from './timeTest.vue'
import factorTest from './factorTest.vue'
@@ -74,7 +93,9 @@ import test from './test.vue'
import socketClient from '@/utils/webSocketClient';
import {useCheckStore} from "@/stores/modules/check";
import {pauseTest, resumeTest, startPreTest} from '@/api/socket/socket'
import {useUserStore} from "@/stores/modules/user";
const userStore = useUserStore()
const checkStore = useCheckStore();
const nextStepText = ref('下一步');
const dialogVisible = ref(false)
@@ -93,6 +114,7 @@ const webMsgSend = ref();//webSocket推送的数据
const dialogTitle = ref('')
const showComponent = ref(true)
const preTestRef = ref(null)
const testRef = ref(null)
const dataSocket = reactive({
socketServe: socketClient.Instance,
@@ -190,7 +212,8 @@ const handleSubmit = () => {
userPageId: "cdf",
devIds: deviceIds,
planId: planId,
operateType: '1' // '1'为预检测、2为正式检测、'8'为不合格项复检
operateType: '1', // '1'为预检测、2为正式检测、'8'为不合格项复检
userId:userStore.userInfo.id
}).then(res => {
if (res.code === 'A001014') {
ElMessageBox.alert('装置配置异常', '检测失败', {
@@ -218,7 +241,8 @@ const handleSubmit = () => {
userPageId: "cdf",
devIds: deviceIds,
planId: planId,
operateType: checkStore.reCheckType ==1 ?'2':'8' // '1'为预检测、2为正式检测、'8'为不合格项复检
operateType: checkStore.reCheckType ==1 ?'2':'8', // '1'为预检测、2为正式检测、'8'为不合格项复检
userId:userStore.userInfo.id
}).then(res => {
console.log(res)
if (res.code === 'A001014') {
@@ -275,7 +299,7 @@ watch(TestStatus, function (newValue, oldValue) {
watch(ActiveStatue, function (newValue, oldValue) {
if (newValue === 'error') {
// stepsActiveIndex.value = stepsTotalNum.value + 2
stepsActiveIndex.value = stepsTotalNum.value + 1
nextStepText.value = '检测失败'
}
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 1) {
@@ -302,16 +326,25 @@ watch(ActiveStatue, function (newValue, oldValue) {
})
const handleQuit = () => {
console.log('handleQuit',ActiveStatue.value)
if (ActiveStatue.value !== 'success' && ActiveStatue.value !== 'waiting' && ActiveStatue.value !== 'paused' && ActiveStatue.value !== 'test_init_fail' && ActiveStatue.value !== 'connect_timeout' && ActiveStatue.value !== 'pause_timeout') {
beforeClose(() => {})
} else {
handleClose()
}
}
const handlePause=()=>{
sendPause()
testRef.value?.handlePause()
}
const sendPause = () => {
console.log('发起暂停请求')
TestStatus.value = 'paused_ing'
pauseTest().then(res => {
Object.assign(webMsgSend.value, {
requestId: 'preStopTest',
operateCode: 'stop'
})
})
pauseTest()
// setTimeout(() => {
// Object.assign(webMsgSend.value, {
// requestId: 'preStopTest',
@@ -326,7 +359,8 @@ const sendResume = () => {
userPageId: "cdf",
devIds: checkStore.devices.map((item) => item.deviceId),
planId: checkStore.plan.id,
operateType: '2' // 0:'系数校验''1'为预检测、2为正式检测、'8'为不合格项复检
operateType: '2', // 0:'系数校验''1'为预检测、2为正式检测、'8'为不合格项复检
userId:userStore.userInfo.id
})
Object.assign(webMsgSend.value, {
requestId: 'Resume_Success'
@@ -339,7 +373,8 @@ const sendReCheck = () => {
userPageId: "cdf",
devIds: checkStore.devices.map((item) => item.deviceId),
planId: checkStore.plan.id,
operateType: '2' // 0:'系数校验''1'为预检测、2为正式检测、'8'为不合格项复检
operateType: '2', // 0:'系数校验''1'为预检测、2为正式检测、'8'为不合格项复检
userId:userStore.userInfo.id
}).then(res => {
console.log(res)
if (res.code === 'A001014') {
@@ -440,6 +475,17 @@ defineExpose({open})
<style scoped lang="scss">
.test-head-steps {
::v-deep .el-step {
.el-step__head.is-success {
color: #91cc75;
}
.el-step__title.is-success{
color: #91cc75;
}
}
}
:deep(.dialog-big .el-dialog__body) {
max-height: 840px !important;
}

View File

@@ -5,7 +5,7 @@
<div class="right-title" >
<span v-if="activeIndex <= 1"> </span>
<span v-if="activeIndex > 1" class="time-text">
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
标准时间: <span style="color: var(--el-color-primary)">{{ gpsTime }}</span>
</span>
<div class="error-dsc">
<div class="green-div"></div>
@@ -52,7 +52,7 @@
<!-- <span v-if="activeIndex <= 1"> </span>
<span v-if="activeIndex > 1" style=" font-size: 18px;font-weight: 600;">
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
标准时间: <span style="color: var(--el-color-primary)">{{ gpsTime }}</span>
</span>
<div class="error-dsc">
<div class="green-div"></div>
@@ -423,7 +423,7 @@ watch(ts, function (newValue, oldValue) {
}
.right-title .gps-time {
color: #003078;
color: var(--el-color-primary);
}
.error-dsc {
@@ -440,7 +440,7 @@ watch(ts, function (newValue, oldValue) {
}
.error-dsc .green-div {
background-color: #67C23A;
background-color: #91cc75;
}
.error-dsc .red-div {

View File

@@ -5,6 +5,8 @@
placeholder='请输入计划名称'
clearable
v-model='searchForm.planName'
show-word-limit
maxlength="32"
></el-input>
<el-tooltip content="检测计划列表" placement="top">
<Menu style='width: 26px;height: 26px; margin-left: 8px;cursor: pointer;color:var(--el-color-primary)'

View File

@@ -168,7 +168,7 @@ const handleTabsChange = (val: any) => {
form.value.activeChildTabs = Number(val)
}
localStorage.setItem('color', 'red')
localStorage.setItem('color', '#91cc75')
//功能选择数据
const tabsList = ref([
{

View File

@@ -52,6 +52,7 @@ import { ElMessage } from "element-plus";
import { useAuthStore } from "@/stores/modules/auth";
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
import { ref } from "vue";
import {getCurrentScene} from "@/api/user/login";
const authStore = useAuthStore();
const modeStore = useModeStore(); // 使用模式 store
const AppSceneStore = useAppSceneStore();
@@ -82,7 +83,10 @@ const modeList = [
];
const handelOpen = async (item: any) => {
modeStore.setCurrentMode(item.code); // 将模式code存入 store
AppSceneStore.setCurrentMode('1');//0省级平台1设备出厂2研发自测
const {data:scene} = await getCurrentScene(); // 获取当前场景
// AppSceneStore.setCurrentMode(scene+'');//0省级平台1设备出厂2研发自测
AppSceneStore.setCurrentMode(scene+'');//0省级平台1设备出厂2研发自测
await authStore.setShowMenu();
return;
// if (isActive) {

View File

@@ -4,13 +4,11 @@
ref='proTable'
:columns='columns'
:request-api='getTableList'
@selection-change='handleSelectionChange'
type='selection'
>
<!-- 表格 header 按钮 -->
<template #tableHeader>
<el-button type='primary' :icon='DataAnalysis'>分析</el-button>
<el-button type='primary' :icon='Upload'>导出csv</el-button>
<el-button type='primary' :icon='Upload' @click='handleExport'>导出csv</el-button>
</template>
</ProTable>
@@ -23,12 +21,12 @@
import TimeControl from '@/components/TimeControl/index.vue'
import {type AuditLog} from '@/api/system/log/interface/log.ts'
import ProTable from '@/components/ProTable/index.vue'
import { Upload ,DataAnalysis} from '@element-plus/icons-vue'
import {DataAnalysis, Upload} from '@element-plus/icons-vue'
import type {ColumnProps, ProTableInstance} from '@/components/ProTable/interface'
import { reactive,ref,watch } from 'vue'
import {
getAuditLog,
} from '@/api/system/log/index.ts'
import {reactive, ref} from 'vue'
import {getAuditLog, exportCsv} from '@/api/system/log/index.ts'
import {useDownload} from "@/hooks/useDownload";
import {exportPqDev} from "@/api/device/device";
// defineOptions({
@@ -53,7 +51,7 @@ const columns = reactive<ColumnProps<AuditLog.ReqAuditLogParams>[]>([
{type: 'selection', fixed: 'left', width: 70},
{type: 'index', fixed: 'left', width: 70, label: '序号'},
{
prop: 'createBy',
prop: 'userName',
label: '操作用户',
search: {el: 'input'},
minWidth: 100,
@@ -64,7 +62,7 @@ const columns = reactive<ColumnProps<AuditLog.ReqAuditLogParams>[]>([
minWidth: 120,
},
{
prop: 'createTime',
prop: 'logTime',
label: '记录时间',
minWidth: 180,
search: {
@@ -82,9 +80,11 @@ const columns = reactive<ColumnProps<AuditLog.ReqAuditLogParams>[]>([
},
},
{
prop: 'remark',
label: '事件描述',
minWidth: 400,
minWidth: 450,
render: (scope) => {
return (scope.row.userName + '在' + scope.row.logTime + '执行了' + scope.row.operateType + scope.row.operate + '操作,结果为' + scope.row.result + '。')
}
},
{
prop: 'result',
@@ -97,7 +97,7 @@ const columns = reactive<ColumnProps<AuditLog.ReqAuditLogParams>[]>([
minWidth: 100,
render: scope => {
return (
<el-tag type={scope.row.warn ? 'danger' : 'success'}>{scope.row.warn ? '告警' : '未告警'}</el-tag>
<el-tag type={scope.row.warn == 1 ? 'danger' : 'success'}>{scope.row.warn == 1 ? '告警' : '未告警'}</el-tag>
)
},
},
@@ -114,7 +114,16 @@ const handleDateChange = (startDateTemp: string, endDateTemp: string) => {
endDate.value = endDateTemp
}
const handleExport = () => {
// 获取当前的搜索参数
let searchParam = proTable.value?.searchParam || {}
// 将开始时间和结束时间添加到搜索参数中
searchParam.searchBeginTime = startDate.value
searchParam.searchEndTime = endDate.value
useDownload(exportCsv, '日志列表', searchParam, false, '.csv')
}
</script>

View File

@@ -29,6 +29,9 @@
</template>
</el-input>
</el-form-item>
<el-form-item prop='checked'>
<el-checkbox v-model="loginForm.checked">记住我</el-checkbox>
</el-form-item>
</el-form>
<div class='login-btn'>
<el-button
@@ -58,16 +61,17 @@ import { HOME_URL } from '@/config'
import {getTimeState} from '@/utils'
import {type Dict} from '@/api/interface'
import {type Login} from '@/api/user/interface/user'
import type {ElForm} from 'element-plus'
import {ElNotification} from 'element-plus'
import { getDictList, loginApi } from '@/api/user/login'
import {getDictList, getPublicKey, loginApi} from '@/api/user/login'
import {useUserStore} from '@/stores/modules/user'
import {useTabsStore} from '@/stores/modules/tabs'
import {useKeepAliveStore} from '@/stores/modules/keepAlive'
import {initDynamicRouter} from '@/routers/modules/dynamicRouter'
import {CircleClose, UserFilled} from '@element-plus/icons-vue'
import {useAuthStore} from '@/stores/modules/auth'
import type { ElForm } from 'element-plus'
import {useDictStore} from "@/stores/modules/dict";
import forge from 'node-forge'
const authStore = useAuthStore()
const router = useRouter()
@@ -76,6 +80,7 @@ const tabsStore = useTabsStore()
const keepAliveStore = useKeepAliveStore()
const dictStore = useDictStore()
let publicKey: any = null;
type FormInstance = InstanceType<typeof ElForm>;
@@ -89,6 +94,7 @@ const loading = ref(false)
const loginForm = reactive<Login.ReqLoginForm>({
username: '',
password: '',
checked: false,
})
// login
@@ -98,14 +104,22 @@ const login = (formEl: FormInstance | undefined) => {
if (!valid) return
loading.value = true
try {
let {data: publicKeyBase64}: { data: string } = await getPublicKey(loginForm.username)
//将base64格式的公钥转换为Forge可以使用的格式
const publicKeyDer = forge.util.decode64(publicKeyBase64);
publicKey = forge.pki.publicKeyFromPem(forge.pki.publicKeyToPem(forge.pki.publicKeyFromAsn1(forge.asn1.fromDer(publicKeyDer))));
// 1.执行登录接口
const {data} = await loginApi({
...loginForm,
password: loginForm.password,
username: forge.util.encode64(loginForm.username),
password: encryptPassword(loginForm.password),
})
userStore.setAccessToken(data.accessToken)
userStore.setRefreshToken(data.refreshToken)
userStore.setUserInfo(data.userInfo)
if(loginForm.checked){
userStore.setExp(Date.now() + 1000 * 60 * 60 * 24 * 30)
}
const response = await getDictList()
const dictData = response.data as unknown as Dict[]
await dictStore.initDictData(dictData)
@@ -148,6 +162,13 @@ onMounted(() => {
}
}
})
const encryptPassword = (password: string) => {
const encrypted = publicKey.encrypt(password, 'RSAES-PKCS1-V1_5');
// 将加密后的数据转换为base64格式以便传输
return forge.util.encode64(encrypted);
}
</script>
<style scoped lang='scss'>

View File

@@ -2,7 +2,7 @@
height: 100%;
min-height: 550px;
// background-color: #eeeeee;
background-color: #003078;
background-color: var(--el-color-primary);
background-image: url("@/assets/images/login_bg.svg");
background-size: 100% 100%;
background-size: cover;

View File

@@ -48,7 +48,7 @@
:data="tableData"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}"
stripe
@@ -95,7 +95,7 @@
? '/'
: '' +
row.channelList[item.num + 1].famp +
(valueCode == 'Absolute' ? 'V' : '%')
(valueCode == 'Absolute' ? 'A' : '%')
}}
</td>
<td>
@@ -135,36 +135,42 @@
<!-- </template>-->
<!-- </el-progress>-->
<div class="loading-container" v-if="showLoading">
<div style="width: 80%; height: 80%;" class="loading-box">
<div style="width: 80%; height: 80%" class="loading-box">
<div class="loading-circle"></div>
<div class="loading-text">Loading...</div>
</div>
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
</div>
<div class="loading-container" v-else>
<div style="width: 80%; height: 80%; " class="loading-box">
<div style="width: 80%; height: 80%" class="loading-box">
<div class="loading-circle static"></div>
<div class="loading-text">Loading</div>
</div>
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
</div>
</div>
<div style="margin-top: 10px;">
<div style="margin-top: 10px">
<span>标准源加量输出:{{ hour }}{{ minute }}{{ second }}</span>
</div>
<div style="margin-top: 10px;">
<el-button :icon="VideoPlay"
<div style="margin-top: 10px">
<el-button
:icon="VideoPlay"
type="primary"
size="large"
@click="startLoading"
:disabled="pauseDisabled"
>启动</el-button>
<el-button :icon="VideoPause"
>
启动
</el-button>
<el-button
:icon="VideoPause"
type="primary"
size="large"
@click="stopLoading"
:disabled="pauseDisabled"
>停止</el-button>
>
停止
</el-button>
</div>
</div>
</div>
@@ -187,7 +193,8 @@
v-if="showDialog"
/>
<!-- 查看 -->
<ViewRow ref="viewRowRef"
<ViewRow
ref="viewRowRef"
:activeName="activeName"
:formContent="props.formContent"
@close="viewDialog = false"
@@ -202,7 +209,17 @@ import Tree from './tree.vue'
import Commun from '@/views/machine/testScript/components//communication.vue'
import { type CascaderOption, ElMessage } from 'element-plus'
import { getTreeData } from '@/api/check/test'
import {CirclePlus, Delete, Check, CopyDocument, View, EditPen, VideoPlay, VideoPause, Loading} from '@element-plus/icons-vue'
import {
CirclePlus,
Delete,
Check,
CopyDocument,
View,
EditPen,
VideoPlay,
VideoPause,
Loading
} from '@element-plus/icons-vue'
import type { TestScript } from '@/api/device/interface/testScript'
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
import { CheckData } from '@/api/check/interface'
@@ -248,7 +265,6 @@ const props = defineProps({
}
})
const showDialog = ref(false)
const viewDialog = ref(false)
const dictStore = useDictStore()
@@ -287,45 +303,45 @@ const second = ref(0)
const emit = defineEmits(['update:activeName', 'update:activeIndex', 'update:startDisabeld', 'update:pauseDisabled'])
watch(()=>props.formControl.scriptId,async ()=>{
watch(
() => props.formControl.scriptId,
async () => {
if (props.formControl.scriptId != '') {
nextTick(async () => {
await getTree()
console.log('props.formControl.scriptId')
treeRef.value.checkTree()
})
}
})
}
)
const controlContent = ref<controlSource.ResControl>({
userPageId: '',
scriptId: '',
scriptIndex: 0,
sourceId: '',
sourceId: ''
})
// 获取树
const getTree = () => {
getTreeData({
scriptId: props.formControl.scriptId,
scriptId: props.formControl.scriptId
}).then(res => {
if (res.code === 'A0000') {
treeData.value = res.data
//console.log('tree',res.data)
// 为 treeData 及其子节点添加 id
let idCounter = 0;
let idCounter = 0
const addIdToTree = (nodes: any[]) => {
nodes.forEach(node => {
node.id = idCounter++; // 为每个节点添加唯一的 id
node.id = idCounter++ // 为每个节点添加唯一的 id
if (node.children && node.children.length > 0) {
node.disabled = true
addIdToTree(node.children); // 递归为子节点添加 id
addIdToTree(node.children) // 递归为子节点添加 id
}
})
}
});
};
addIdToTree(treeData.value);
addIdToTree(treeData.value)
// 添加tab子项
props.options.forEach((k: any, i: number) => {
@@ -335,7 +351,6 @@ const getTree = () => {
item.children.forEach((s: any) => {
k.children.forEach((P: any) => {
if (P.code == s.scriptTypeCode) {
tabData.value[i].children.push({
label: P.label,
value: P.code,
@@ -364,10 +379,8 @@ const getTree = () => {
}
})
//console.log('获取树')
}
// 设置树点击tab
const setTab = row => {
activeName.value = row.activeName
@@ -396,8 +409,6 @@ const tabChange = () => {
childActiveName.value =
tabData.value.filter((item: any) => item.value == activeName.value)[0]?.children[0]?.value || ''
}
}
inquireTable()
}
@@ -425,13 +436,11 @@ const inquireTable = () => {
//console.log('treeData',treeData.value)
}
// 查看
const view = (row: Partial<TestScript.ResTestScript> = {}) => {
getCommunication()
//当前点击的一级tab
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称';
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'
//当前点击的二级tab
const childrenTabName = ref('')
tabData.value.forEach((item: any) => {
@@ -445,10 +454,8 @@ const view = (row: Partial<TestScript.ResTestScript> = {}) => {
})
viewDialog.value = true
setTimeout(() => {
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
}, 0)
}
// 定义 startLoading 方法
@@ -479,7 +486,6 @@ const stopLoading = async () => {
ElMessage.success({ message: '停止中...', duration: 5000 })
}
const startTimeCount = () => {
// Loading效果展示
showLoading.value = true
@@ -500,7 +506,7 @@ const secondToTime = (secd: number) => {
//将秒数转换成时分秒
hour.value = Math.floor(secd / 3600)
minute.value = Math.floor((secd - hour.value * 3600) / 60)
second.value = Math.floor(secd % 60);
second.value = Math.floor(secd % 60)
}
const stopTimeCount = () => {
@@ -519,7 +525,6 @@ const addTab = (row: any) => {
}
onMounted(() => {
getTree()
props.options.forEach((item: any) => {
tabData.value.push({
@@ -598,7 +603,7 @@ defineExpose({
width: 45%;
}
.theFirst {
background-color: #003078;
background-color: var(--el-color-primary);
color: #fff;
width: 20px !important;
}
@@ -672,11 +677,13 @@ defineExpose({
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.hidden-tab {
display: none;
@@ -690,7 +697,6 @@ defineExpose({
transform: rotate(360deg);
}
}
</style>
<style>
input::-webkit-inner-spin-button {

View File

@@ -31,7 +31,7 @@
<!-- <div class="formBut">-->
<el-button type="primary" :icon="Select" @click="start()" :disabled="connectDisabeld">通讯校验</el-button>
<el-button v-if="!connectDisabeld" type="text" style="color: #303133" disabled>源未连接</el-button>
<el-button v-else type="text" style="color: #67c23a" disabled>源连接成功</el-button>
<el-button v-else type="text" style="color: #91cc75" disabled>源连接成功</el-button>
<!-- </div>-->
</el-form-item>
</el-form>

View File

@@ -46,7 +46,7 @@
/>
</el-select>
</el-form-item>
<el-form-item label="报告模版名称" prop="reportName" >
<el-form-item label="报告模版名称" prop="reportName" v-if="scene == '1'">
<el-select v-model="formContent.reportName" clearable placeholder="请选择报告模版">
<el-option
v-for="item in dictStore.getDictData('Report_Template')"
@@ -93,6 +93,7 @@
const dictStore = useDictStore()
// 定义弹出组件元信息
const dialogFormRef = ref()
const scene = ref('')
const icdOptions = ref<ICD.ResICD[]>([])
function useMetaInfo() {
const dialogVisible = ref(false)
@@ -138,8 +139,19 @@ const resetFormContent = () => {
//定义规则
const formRuleRef = ref<FormInstance>()
// 使用计算属性根据 scene 动态生成规则
const rules = computed(() => {
const dynamicRules = { ...baseRules };
if (scene.value === '1'){//只有楼下出厂需要展示
dynamicRules.reportName = [{ required: true, message: '报告模版名称必选!', trigger: 'change' }];
}
return dynamicRules;
});
//定义校验规则
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
const baseRules: Record<string, Array<FormItemRule>> = {
name: [{ required: true, message: '设备类型名称必填!', trigger: 'blur' }],
power: [
{ required: true, message: '工作电源必选!', trigger: 'change' }
@@ -153,13 +165,10 @@ const resetFormContent = () => {
devCurr: [
{ required: true, message: '额定电流必选!', trigger: 'change' }
],
reportName: [
{ required: true, message: '报告模版名称必选!', trigger: 'change' }
],
icd: [
{ required: true, message: '设备关联ICD必选', trigger: 'change' }
],
})
]
};
// 关闭弹窗
@@ -193,12 +202,12 @@ const close = () => {
}
// 打开弹窗,可能是新增,也可能是编辑
const open = async (sign: string, data: DevType.ResPqDevType,icd: ICD.ResICD[]) => {
const open = async (sign: string, data: DevType.ResPqDevType,icd: ICD.ResICD[],currentScene: string) => {
// 重置表单
dialogFormRef.value?.resetFields()
titleType.value = sign
dialogVisible.value = true
scene.value = currentScene
icdOptions.value = icd
if (data.id) {

View File

@@ -51,6 +51,7 @@ import type { ICD } from '@/api/device/interface/icd'
// })
const modeStore = useModeStore()
const dictStore = useDictStore()
const appSceneStore = useAppSceneStore()
// ProTable 实例
const proTable = ref<ProTableInstance>()
const devTypePopup = ref()
@@ -96,6 +97,7 @@ import type { ICD } from '@/api/device/interface/icd'
prop: 'reportName',
label: '报告模版名称',
minWidth: 150,
isShow: appSceneStore.currentScene == '1',
enum: dictStore.getDictData('Report_Template'),
fieldNames: { label: 'name', value: 'id' },
},
@@ -134,7 +136,7 @@ import type { ICD } from '@/api/device/interface/icd'
// 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial<DevType.ResPqDevType> = {}) => {
devTypePopup.value?.open(titleType, row,icdOptions.value)
devTypePopup.value?.open(titleType, row,icdOptions.value,appSceneStore.currentScene)
}

View File

@@ -103,8 +103,8 @@
<el-form-item label='密钥' prop='devKey' clearable v-if="formContent.encryptionFlag">
<el-input v-model='formContent.devKey' placeholder="请输入密钥" show-password/>
</el-form-item>
<el-form-item label='样品编号' prop='sampleID' clearable v-if="DevIsShow && scene === '0'">
<el-input v-model='formContent.sampleID' placeholder="请输入样品编号" />
<el-form-item label='样品编号' prop='sampleId' clearable v-if="DevIsShow && scene === '0'">
<el-input v-model='formContent.sampleId' placeholder="请输入样品编号" />
</el-form-item>
<el-form-item label='送样日期' prop='arrivedDate' v-if="scene === '0'">
<el-date-picker
@@ -157,7 +157,9 @@ import { CirclePlus, Delete, EditPen } from '@element-plus/icons-vue'
// 使用 dayjs 库格式化
import dayjs from 'dayjs'
import MonitorTable from '@/views/machine/device/components/monitorTab.vue';
import {useAppSceneStore} from "@/stores/modules/mode";
const AppSceneStore = useAppSceneStore()
const MonIsShow = ref(false)
const DevIsShow = ref(false)
// 存储设备类型选项
@@ -322,7 +324,10 @@ const rules = computed(() => {
}
if (valid) {
formContent.value.createDate = dayjs(formContent.value.createDate).format('YYYY-MM-DD');
if (AppSceneStore.currentScene === '1') {
formContent.value.name = formContent.value.createId
}
if (formContent.value.arrivedDate)
{
formContent.value.arrivedDate = dayjs(formContent.value.arrivedDate).format('YYYY-MM-DD');

View File

@@ -43,21 +43,14 @@ import { useHandleData } from '@/hooks/useHandleData'
import {useDownload} from '@/hooks/useDownload'
import ProTable from '@/components/ProTable/index.vue'
import ImportExcel from '@/components/ImportExcel/index.vue'
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
import {type ColumnProps, type ProTableInstance} from '@/components/ProTable/interface'
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
import {CirclePlus, Delete, Download, EditPen, Upload} from '@element-plus/icons-vue'
import {useDictStore} from '@/stores/modules/dict'
import {
getPqDevList,
deletePqDev,
getPqDev,
exportCNDev,
downloadCNDevTemplate,
importCNDev,
} from '@/api/device/device/index.ts'
import { ElMessage, ElMessageBox } from 'element-plus'
import {deletePqDev, downloadTemplate, exportPqDev, getPqDev, getPqDevList, importPqDev} from '@/api/device/device/index.ts'
import {ElMessageBox} from 'element-plus'
import {onBeforeMount, reactive, ref} from 'vue'
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
import {useAppSceneStore, useModeStore} from '@/stores/modules/mode'
// defineOptions({
// name: 'device',
@@ -72,6 +65,7 @@ const boundPqDevList = ref<Device.ReqPqDevParams[]>([])//根据检测计划id查
// 存储设备类型选项
const devTypeOptions = ref<Device.ResDev[]>([])
const getTableList = async (params: any) => {
let newParams = JSON.parse(JSON.stringify(params))
newParams.searchEndTime = endDate.value
@@ -231,7 +225,7 @@ const downloadFile = async () => {
ElMessageBox.confirm('确认导出被检设备?', '温馨提示', {type: 'warning'}).then(() => {
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
useDownload(exportCNDev, '被检设备导出数据', { ...proTable.value?.searchParam, pattern: patternId }, false, '.xlsx')
useDownload(exportPqDev, '被检设备导出数据', {...proTable.value?.searchParam, pattern: patternId}, false, '.xlsx')
})
}
@@ -254,8 +248,8 @@ const importFile = async (pattern: string) => {
title: '被检设备',
showCover: false,
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id,
tempApi: downloadCNDevTemplate,
importApi: importCNDev,
tempApi: downloadTemplate,
importApi: importPqDev,
// importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev,
getTableList: proTable.value?.getTableList,
}

View File

@@ -31,9 +31,8 @@
</template>
<script lang="ts" setup name="IndicatorTypeDialog">
import { defineProps, defineEmits, reactive,watch,ref,computed, type CSSProperties } from 'vue';
import {computed, type CSSProperties, defineProps, ref} from 'vue';
import {dialogBig} from '@/utils/elementBind'
import type { ColumnProps } from '@/components/ProTable/interface'
import type {ErrorSystem} from '@/api/device/interface/error'
import errorDataList from '@/api/device/error/errorData'
import type {TableColumnCtx} from 'element-plus'
@@ -69,7 +68,7 @@ interface SpanMethodProps {
const rowClass = ({row, column, rowIndex, columnIndex}: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
let res: CSSProperties = {
textAlign: 'center' as CSSProperties['textAlign'],
backgroundColor: '#003078',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}
if (rowIndex === 1) {
@@ -274,12 +273,12 @@ const close = () => {
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
dialogTitle.value = sign + ' 误差体系'
dialogVisible.value = true
if (data.id) {
formContent.value = data as ErrorSystem.ErrorSystemList;
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';;
if(devLevelName.value === 'A级'){
if (devLevelName.value === 'A级' || data.devLevel === 'A级') {
errorData.value = errorDataList.errorADetail as unknown as ErrorSystem.Error_detail[];
} else {
errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];

View File

@@ -5,10 +5,10 @@
</div>
<div class="table-container">
<el-table :data="tableData"
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
:header-cell-style="{ textAlign: 'center',backgroundColor: 'var(--el-color-primary)',color: '#fff' } "
:cell-style="{ textAlign: 'center' }"
style="width: 100%"
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}"
:style="{ height: '400px',maxHeight: '400px',overflow:'hidden'}"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"/>
<el-table-column prop="sort" label="序号" width="60"/>
@@ -29,7 +29,7 @@
v-model="row.scriptType"
:props="{ checkStrictly: false, emitPath: false }"
placeholder="请选择脚本类型"
/>
@change="handleScriptTypeChange(row)"/>
</template>
</el-table-column>
<el-table-column label="起止范围">
@@ -70,7 +70,7 @@
<template #default="{ row }">
<el-select v-model="row.conditionType" placeholder="选择单位">
<el-option
v-for="item in dictStore.getDictData('Condition_Type')"
v-for="item in conditionTypes"
:key="item.id"
:label="item.name"
:value="Number(item.value)"
@@ -85,16 +85,16 @@
<el-input v-model="row.maxErrorValue" style="width: 70px;"/>
</template>
</el-table-column>
<el-table-column label="误差类型" width="180">
<el-table-column label="误差类型" width="170">
<template #default="{ row }">
<el-select v-model="row.errorValueType" placeholder="选择误差类型">
<el-option
v-for="item in dictStore.getDictData('Error_Value_Type')"
:key="item.id"
:label="item.name"
:value="Number(item.value)"
/>
</el-select>
<el-cascader :options="errorValueTypeOptions"
v-model="row.errorValueType"
@change="handleErrorValueTypeChange(row)"/>
</template>
</el-table-column>
<el-table-column label="误差单位" width="100" prop="errorUnit">
<template #default="{ row }">
<span>{{ row.errorUnit }}</span>
</template>
</el-table-column>
</el-table-column>
@@ -111,11 +111,10 @@
<script setup lang="ts">
import {type ErrorSystem} from '@/api/device/interface/error';
import {useDictStore,} from '@/stores/modules/dict'
import {CirclePlus, Delete, EditPen,CopyDocument} from '@element-plus/icons-vue'
import { type CascaderOption, type FormItemRule } from 'element-plus';
import { el } from 'element-plus/es/locale';
import { type PropType, type Ref, ref, watch } from 'vue';
import { defineEmits } from 'vue';
import {CirclePlus, CopyDocument, Delete} from '@element-plus/icons-vue'
import {type CascaderOption} from 'element-plus';
import {defineEmits, type PropType, reactive, ref, watch} from 'vue';
const emit = defineEmits(['updateTableData']);
const multipleSelection = ref<number[]>([])
const dictStore = useDictStore()
@@ -138,31 +137,24 @@ import { el } from 'element-plus/es/locale';
}
});
const errorValueTypeOptions = reactive<{ value: number, label: string, children: { value: number, label: string }[] }[]>([])
const conditionTypes = dictStore.getDictData('Condition_Type')
const errorValueTypes = dictStore.getDictData('Error_Value_Type')
const valueTypes = dictStore.getDictData('Script_Value_Type')
// 定义一个 Map 来存储误差和脚本系统信息
const errSysAndScriptMap = new Map<string, string>([
['Freq_Deviation_Freq','FREQ'],//频率偏差/频率---频率
['Vol_Deviation_Vol','VRMS'],//电压偏差/电压---电压/相电压有效值
['MSQI_V','V_UNBAN'],//三相不平衡/电压---电压/三相电压负序不平衡度
['MSQI_CUR','I_UNBAN'],//三相不平衡/电流---电流/三相电流负序不平衡度
['Voltage Fluctuation_Voltage Amplitude',''],//电压波动/电压幅值---
['Voltage Fluctuation_Duration',''],//电压波动/持续时间---
['Short Time Flicker Item','PST'],//闪变/短时间闪变---闪变/短时间闪变
['Harmonic_Voltage','V2-50'],//谐波/电压---谐波/谐波电压含有率
['Harmonic_Current','I2-50'],//谐波/电流---谐波/谐波电流幅值
['Harmonic_Angle','VA2-50'],//谐波/相角---谐波/谐波电压相角
['Harmonic_Angle','IA2-50'],//谐波/相角---谐波/谐波电流相角
['Harmonic_Power','P2-50'],//谐波/功率---谐波/谐波有功功率
['Interharmonic_Voltage','SV_1-49'],//间谐波/电压---谐波/间谐波电压含有率
['Interharmonic_Current','SI_1-49'],//间谐波/电流---谐波/间谐波电流幅值
['High Frequency Harmonic_Voltage',''],//高频次谐波/电压
['High Frequency Harmonic_Current',''],//高频次谐波/电流
['Power Item','P'],//功率/功率---功率
['Current Item','IRMS'],//电流/电流---电流/电流有效值
['Dip & Swell & Short duration interruption_Voltage','MAG'],//暂态/电压幅值/电压---暂态/电压幅值
['Dip & Swell & Short duration interruption_Duration','DUR'],//暂态/持续时间/时间---暂态/持续时间
]);
onBeforeMount(() => {
valueTypes.forEach(item1 => {
let children = []
for (let i = 0; i < errorValueTypes.length; i++) {
if (item1.value === '2' && errorValueTypes[i].value === '2') {
continue
}
children.push({label: errorValueTypes[i].name, value: Number(errorValueTypes[i].value)})
}
errorValueTypeOptions.push({label: item1.name, value: Number(item1.value), children: children})
})
})
const handleErrorTypeChange = (value: any, row: any) => {
// const matchedRow = findRowById(row.errorType, props.errorOptions);//选中误差id找对应结构中的含chilren的code
@@ -182,6 +174,31 @@ const handleErrorTypeChange = (value: any, row: any) =>{
// }
}
const handleScriptTypeChange = (row: any) => {
handleErrorValueTypeChange(row)
}
const handleErrorValueTypeChange = (row: any) => {
let scriptType = findRowById(row.scriptType, props.scriptOptions)
if (scriptType) {
const errorValueType = row.errorValueType
let level1 = errorValueType[0]
switch (level1) {
case 1: // 绝对值
row.valueType = 1
row.errorUnit = scriptType.remark
break;
case 2: // 相对值
row.valueType = 2
row.errorUnit = "%"
break;
default:
break;
}
}
}
// 假设 props.errorOptions 是一个数组,每个元素可能包含 children 属性
const findRowById = (id: string, options: any[]): any | null => {
@@ -266,21 +283,23 @@ const handleEndFlagChange = (row: ErrorSystem.ErrorSystemDetail, value: number)
//新增
const openAddDialog = () => {
// 获取字典数据
const conditionTypes = dictStore.getDictData('Condition_Type');
const errorValueTypes = dictStore.getDictData('Error_Value_Type');
const newRow = {
sort: props.tableData.length + 1,
id: '',
startFlag: 2,
endFlag: 2,
conditionType: conditionTypes.length > 0 ? Number(conditionTypes[3].value) : 0, // 设置默认值为第一个选项的值
errorValueType:errorValueTypes.length > 0 ? Number(errorValueTypes[0].value) : 0, // 设置默认值为第一个选项的值
conditionType: conditionTypes.length > 0 ? Number(conditionTypes[0].value) : 0, // 设置默认值为第一个选项的值
valueType: valueTypes.length > 0 ? Number(valueTypes[0].value) : 1,
errorValueType: [errorValueTypeOptions[0].value, errorValueTypeOptions[0].children[0].value],
errorSysId: "",
errorType: "",
scriptType: "",
maxErrorValue: 0
};
emit('updateTableData', [...props.tableData, newRow]);
};
@@ -322,6 +341,7 @@ const deleteSelectedRows = () => {
.el-table th, .el-table td {
text-align: center; /* 所有单元格文字居中 */
}
.table-container {
max-height: 400px; /* 根据需要调整高度 */
overflow-y: auto; /* 允许垂直滚动 */

View File

@@ -1,9 +1,9 @@
<template>
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1500px">
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1660px">
<el-tabs type="border-card">
<el-tab-pane label="基础信息">
<div>
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' label-width="auto" class="form-three">
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' label-width="auto" class="form-four">
<el-form-item label="标准号" prop="standardName" >
<el-input v-model='formContent.standardName' placeholder="请填写标准号"/>
</el-form-item>
@@ -26,7 +26,7 @@
<el-form-item label="状态" prop="enable" >
<el-select v-model='formContent.enable' placeholder="请选择状态">
<el-option label="启用" :value="1"></el-option>
<el-option label="不启用" :value="0"></el-option>
<el-option label="用" :value="0"></el-option>
</el-select>
</el-form-item>
</el-form>
@@ -137,6 +137,9 @@ const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) =>
}
formContent.value.pqErrSysDtlsList = tableData.value
formContent.value.pqErrSysDtlsList.forEach((item) => {
item.errorValueType=item.errorValueType[1]
})
if (formContent.value.id) {
await updatePqErrSys(formContent.value);
ElMessage.success({ message: `${dialogTitle.value}成功!` })
@@ -212,7 +215,8 @@ const loadSecondLevelOptions = async () => {
value: item.id,
label: item.name,
code: item.code,
children: item.children ? convertToOptions(item.children) : undefined
children: item.children ? convertToOptions(item.children) : undefined,
remark: item.remark
}));
};
@@ -230,6 +234,9 @@ const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
if (result && result.data) {
formContent.value = result.data as ErrorSystem.ErrorSystemList;
tableData.value = formContent.value.pqErrSysDtlsList || [];
tableData.value.forEach((item) => {
item.errorValueType=[item.valueType,item.errorValueType]
})
} else {
resetFormContent();
}

View File

@@ -16,6 +16,7 @@
<!-- 表格操作 -->
<template #operation='scope'>
<el-button v-auth.device="'view'" type='primary' link :icon='View' @click="openDialog('view', scope.row)">查看</el-button>
<el-button v-auth.device="'view'" type='primary' link :icon='View' @click="copy(scope.row)">复制</el-button>
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
</template>
@@ -26,7 +27,7 @@
<ErrorStandardPopup :refresh-table='proTable?.getTableList' ref='errorStandardPopup' />
</template>
<script setup lang="ts" name='useProTable'>
<script setup lang="tsx" name='useProTable'>
import ProTable from '@/components/ProTable/index.vue'
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
import { CirclePlus, Delete,EditPen,View} from '@element-plus/icons-vue'
@@ -36,7 +37,8 @@ import ErrorSystemPopup from '@/views/machine/errorSystem/components/errorSystem
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue'
import type { ErrorSystem } from '@/api/device/interface/error'
import { useDictStore } from '@/stores/modules/dict'
import { getPqErrSysList, deletePqErrSys} from '@/api/device/error/index'
import { getPqErrSysList, deletePqErrSys,copyPqErrSys} from '@/api/device/error/index'
import { ElMessageBox } from 'element-plus'
defineOptions({
name: 'errorSystem'
})
@@ -71,7 +73,15 @@ const columns = ref<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
search: { el: 'select', props: { filterable: true } },
fieldNames: { label: 'name', value: 'id' },
},
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 250,},
{
prop: 'enable',
label: '启用状态',
width: 120,
render: scope => {
return (scope.row.enable ? <el-tag type='success'>启用</el-tag> : <el-tag type='danger'>停用</el-tag>)
},
},
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 300,},
])
// 打开 drawer(新增、编辑)
@@ -86,19 +96,33 @@ const openDialog = (titleType: string, row: Partial<ErrorSystem.ErrorSystemList>
}
// 批量删除设备
// 批量误差体系
const batchDelete = async (id: string[]) => {
await useHandleData(deletePqErrSys, id, '删除所选误差体系')
proTable.value?.clearSelection()
proTable.value?.getTableList()
}
// 删除设备
// 删除误差体系
const handleDelete = async (params: ErrorSystem.ErrorSystemList) => {
await useHandleData(deletePqErrSys, [params.id], `删除【${params.name}】误差体系`)
proTable.value?.getTableList()
}
// 复制误差体系
const copy = async (params: ErrorSystem.ErrorSystemList) => {
ElMessageBox.confirm('是否复制当前误差体系?', '提示', {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: 'warning',
draggable: true
}).then(async () => {
copyPqErrSys(params).then(() => {
proTable.value?.getTableList()
})
})
}
</script>
<style scoped>

View File

@@ -4,11 +4,11 @@
:data="tableData"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}"
stripe
height="calc(100vh - 480px)"
:height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`"
:style="{ overflow: 'hidden' }"
row-key="id"
:expand-row-keys="[props.activeName]"
@@ -75,6 +75,9 @@ const props = defineProps({
options: {
type: Array,
required: true
},
shrink: {
type: Boolean
}
})
const tableData = ref<any[]>([])
@@ -137,7 +140,7 @@ const info = async () => {
name: k.name,
disabled: false,
pname: item.name,
dataType: '谐波有功功率'
dataType: item.name =='谐波有功功率'
? 'avg'
: item.name == '闪变'
? 'avg'

View File

@@ -8,7 +8,7 @@
:data="tableData"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}"
stripe
@@ -20,7 +20,7 @@
<el-table-column prop="name" label="参考设定值子类型" width="250">
<template #default="{ row }">{{ row.harmNum ? `(${row.harmNum}次)` : '' }} {{ row.name }}</template>
</el-table-column>
<el-table-column prop="dataType" label="值类型">
<!-- <el-table-column prop="dataType" label="值类型">
<template #default="{ row }">
<el-select v-model="row.dataType" v-if="!row.show">
<el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value" />
@@ -29,11 +29,11 @@
{{ typeList.find(item => item.value == row.dataType)?.label || row.dataType }}
</span>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column prop="phase" label="相别" />
<el-table-column prop="value" label="参考设定值">
<template #default="{ row }">
<span v-if="row.show">{{ parseFloat((row.value - 0).toFixed(4)) || '' }}</span>
<span v-if="row.show">{{ parseFloat((row.value - 0).toFixed(4)) }}{{ setUnit(row) || '' }}</span>
<el-input type="number" v-else v-model="row.value" placeholder="请输入值" />
</template>
</el-table-column>
@@ -96,6 +96,10 @@ const props = defineProps({
form: {
type: [Object, Array],
required: true
},
valueCode: {
type: String,
required: true
}
})
const emit = defineEmits(['recalculation'])
@@ -213,6 +217,112 @@ const isEqual = (obj1: any, obj2: any) => {
return true
}
const unit = [
{
label: '频率',
unit: 'Hz'
},
{
label: '相电压有效值',
unit: 'V'
},
{
label: '电压偏差',
unit: '%'
},
{
label: '电压相角',
unit: '°'
},
{
label: '基波电压有效值',
unit: ''
},
{
label: '电流有效值',
unit: 'A'
},
{
label: '电流相角',
unit: '°'
},
{
label: '基波电流有效值',
unit: ''
},
{
label: '谐波电压',
unit: '%'
},
{
label: '谐波电流',
unit: '%'
},
{
label: '谐波电流幅值',
unit: 'A'
},
{
label: '谐波有功功率',
unit: 'W'
},
{
label: '间谐波电压',
unit: '%'
},
{
label: '间谐波电流',
unit: '%'
},
{
label: '电压幅值',
unit: '%'
},
{
label: '持续时间',
unit: '周波'
},
{
label: '三相电压不平衡度',
unit: '%'
},
{
label: '三相电流不平衡度',
unit: '%'
},
{
label: '闪变',
unit: ''
},
{
label: '电流',
unit: props.valueCode == 'Absolute' ? 'A' : '%'
},
]
// 参考设定值添加单位
const setUnit = (row: any) => {
console.log('🚀 ~ setUnit ~ row:', row)
let text = ''
if (row.pname == '暂态') {
row.name == '电压幅值' ? (text = '%') : ''
row.name == '持续时间' ? (text = '周波') : ''
} else if (row.pname == '电压') {
let o = props.valueCode == 'Absolute' ? 'V' : '%'
row.name == '相电压有效值' ? (text = o) : ''
row.name == '电压偏差' ? (text = '%') : ''
row.name == '电压相角' ? (text = '°') : ''
}else if (row.pname == '电流') {
let o = props.valueCode == 'Absolute' ? 'A' : '%'
row.name == '电流有效值' ? (text = o) : ''
row.name == '电流相角' ? (text = '°') : ''
} else {
text = unit.filter(item => item.label == row.pname)[0]?.unit
}
return text || ''
}
const save = () => {
dialogVisible.value = false
}
@@ -224,6 +334,7 @@ const getTableData = () => {
const close = () => {
dialogVisible.value = false
}
onMounted(() => {})
// 对外映射

View File

@@ -31,7 +31,11 @@
:show-header="false"
:span-method="arraySpanMethod"
:cell-style="tableStyle.cellStyle"
:header-cell-style="{ textAlign: 'center', backgroundColor: '#003078', color: '#fff' }"
:header-cell-style="{
textAlign: 'center',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}"
@cell-click="handleRowClick"
:key="key"
>
@@ -85,22 +89,32 @@
<el-checkbox-button
v-model="form.channelList[$index].channelFlag"
label="通道使能"
:disabled="
form.channelList[$index].harmFlag ||
form.channelList[$index].inHarmFlag ||
form.channelList[$index].flickerFlag ||
form.channelList[$index].dipFlag
"
/>
<el-checkbox-button
v-model="form.channelList[$index].harmFlag"
label="谐波使能"
@change="handleHarmFlag($event, $index)"
/>
<el-checkbox-button
v-model="form.channelList[$index].inHarmFlag"
label="间谐波使能"
@change="handleHarmFlag($event, $index)"
/>
<el-checkbox-button
v-model="form.channelList[$index].flickerFlag"
label="闪变使能"
@change="handleHarmFlag($event, $index)"
/>
<el-checkbox-button
v-model="form.channelList[$index].dipFlag"
label="暂态使能"
@change="handleHarmFlag($event, $index)"
/>
</template>
</el-table-column>
@@ -114,7 +128,13 @@
<div class="form-item-container">
<el-form-item label="频率:" prop="name">
<div class="input-label-container">
<el-input type="number" style="width: 100px" v-model="form.ffreq" />
<el-input
type="number"
style="width: 100px"
v-model="form.ffreq"
onkeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"
@change="validateFreq"
/>
<label>Hz</label>
</div>
</el-form-item>
@@ -142,7 +162,7 @@
<TestScriptFlickerTab :childForm="childForm" />
</el-tab-pane>
<el-tab-pane label="暂态编辑" v-if="childForm[0].dipFlag || childForm[1].dipFlag">
<TestScriptDipTab :childForm="childForm" />
<TestScriptDipTab :childForm="childForm" @setRetainTime="setRetainTime" />
</el-tab-pane>
</el-tabs>
</div>
@@ -154,6 +174,7 @@
:formContent="props.formContent"
:form="form"
:key="initial"
:valueCode="valueCode"
@recalculation="recalculation"
/>
</el-carousel-item>
@@ -276,6 +297,12 @@ const close = () => {
dialogVisible.value = false
emit('close')
}
// 设置持续时间
const setRetainTime = (val: any) => {
form.value.channelList.forEach((item: any) => {
item.dipData.retainTime = val
})
}
// 保存数据
const save = () => {
@@ -317,7 +344,7 @@ const next = () => {
return
}
let { flag, message } = checkFlags()
// // 判断选通道
// // 判断选通道
if (!flag) {
ElMessage.warning({
message: message,
@@ -340,7 +367,7 @@ const recalculation = () => {
setValueTableRef.value?.open(props.communicationList, {})
}
// 判断选通道
// 判断选通道
const checkFlags = () => {
let list: any = []
let flag = true
@@ -361,7 +388,7 @@ const checkFlags = () => {
form.value.channelList[2].channelFlag == false &&
form.value.channelList[4].channelFlag == false
)
return { flag: false, message: '通讯脚本中选了电压,请选择电压通道使能' }
return { flag: false, message: '通讯脚本中选了电压,请选择电压通道使能' }
break
case '谐波电压':
@@ -370,7 +397,7 @@ const checkFlags = () => {
form.value.channelList[2].harmFlag == false &&
form.value.channelList[4].harmFlag == false
)
return { flag: false, message: '通讯脚本中选了谐波电压,请选择谐波电压通道使能' }
return { flag: false, message: '通讯脚本中选了谐波电压,请选择谐波电压通道使能' }
break
case '谐波电流':
if (
@@ -378,7 +405,7 @@ const checkFlags = () => {
form.value.channelList[3].harmFlag == false &&
form.value.channelList[5].harmFlag == false
)
return { flag: false, message: '通讯脚本中选了谐波电流,请选择谐波电流通道使能' }
return { flag: false, message: '通讯脚本中选了谐波电流,请选择谐波电流通道使能' }
break
case '谐波有功功率':
if (
@@ -389,7 +416,7 @@ const checkFlags = () => {
form.value.channelList[4].harmFlag == false &&
form.value.channelList[5].harmFlag == false
)
return { flag: false, message: '通讯脚本中选了谐波有功功率,请选择间电压、电流谐波通道使能' }
return { flag: false, message: '通讯脚本中选了谐波有功功率,请选择间电压、电流谐波通道使能' }
break
case '间谐波电压':
if (
@@ -397,7 +424,7 @@ const checkFlags = () => {
form.value.channelList[2].inHarmFlag == false &&
form.value.channelList[4].inHarmFlag == false
)
return { flag: false, message: '通讯脚本中选了间谐波电压,请选择间谐波电压通道使能' }
return { flag: false, message: '通讯脚本中选了间谐波电压,请选择间谐波电压通道使能' }
break
case '间谐波电流':
if (
@@ -405,7 +432,7 @@ const checkFlags = () => {
form.value.channelList[3].inHarmFlag == false &&
form.value.channelList[5].inHarmFlag == false
)
return { flag: false, message: '通讯脚本中选了间谐波电流,请选择间谐波电流通道使能' }
return { flag: false, message: '通讯脚本中选了间谐波电流,请选择间谐波电流通道使能' }
break
case '暂态':
if (
@@ -413,7 +440,7 @@ const checkFlags = () => {
form.value.channelList[2].dipFlag == false &&
form.value.channelList[4].dipFlag == false
)
return { flag: false, message: '通讯脚本中选了暂态,请选择电压暂态通道使能' }
return { flag: false, message: '通讯脚本中选了暂态,请选择电压暂态通道使能' }
break
case '电流':
if (
@@ -421,7 +448,7 @@ const checkFlags = () => {
form.value.channelList[3].channelFlag == false &&
form.value.channelList[5].channelFlag == false
)
return { flag: false, message: '通讯脚本中选了电,请选择电通道使能' }
return { flag: false, message: '通讯脚本中选了电,请选择电通道使能' }
break
case '三相电压不平衡度':
if (
@@ -429,7 +456,7 @@ const checkFlags = () => {
form.value.channelList[2].channelFlag == false ||
form.value.channelList[4].channelFlag == false
)
return { flag: false, message: '通讯脚本中选了三相电压不平衡度,请选择电压A、B、C通道使能' }
return { flag: false, message: '通讯脚本中选了三相电压不平衡度,请选择电压A、B、C通道使能' }
break
case '三相电流不平衡度':
if (
@@ -437,7 +464,7 @@ const checkFlags = () => {
form.value.channelList[3].channelFlag == false ||
form.value.channelList[5].channelFlag == false
)
return { flag: false, message: '通讯脚本中选了三相电流不平衡度,请选择电流A、B、C通道使能' }
return { flag: false, message: '通讯脚本中选了三相电流不平衡度,请选择电流A、B、C通道使能' }
break
case '闪变':
if (
@@ -445,7 +472,7 @@ const checkFlags = () => {
form.value.channelList[2].flickerFlag == false &&
form.value.channelList[4].flickerFlag == false
)
return { flag: false, message: '通讯脚本中选了闪变,请选择电压闪变通道使能' }
return { flag: false, message: '通讯脚本中选了闪变,请选择电压闪变通道使能' }
break
}
}
@@ -600,7 +627,7 @@ const copyRow = (num: number, index: number) => {
form.value.channelList[0].channelType = 'Ua'
form.value.channelList[1].channelType = 'Ia'
form.value.channelList[2].channelType = 'Ub'
form.value.channelList[3].channelType = 'Ia'
form.value.channelList[3].channelType = 'Ib'
form.value.channelList[4].channelType = 'Uc'
form.value.channelList[5].channelType = 'Ic'
key.value += 1
@@ -610,6 +637,21 @@ const copyRow = (num: number, index: number) => {
})
}
const validateFreq = () => {
if (form.value.ffreq < 40) {
ElMessage.warning('频率不能低于40Hz')
form.value.ffreq = 40
} else if (form.value.ffreq > 60) {
ElMessage.warning('频率不能高于60Hz')
form.value.ffreq = 60
}
}
// 点击使能按钮
const handleHarmFlag = (e: boolean, i: number) => {
if (e) {
form.value.channelList[i].channelFlag = true
}
}
// 打开 drawer(新增、编辑)
const openDialog = () => {}
@@ -676,4 +718,8 @@ defineExpose({ open })
:deep(.el-table__body) {
border-top: var(--el-table-border);
}
:deep(.el-checkbox-button.is-disabled .el-checkbox-button__inner) {
background-color: var(--el-color-primary);
color: var(--el-color-white);
}
</style>

View File

@@ -6,11 +6,15 @@
<el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider>
</div>
<div class="data-check-content">
<div class="content-tree">
<div class="content-tree" :style="{ height: `calc(100vh - ${props.shrink ? '370px' : '315px'})` }">
<Tree :treeData="treeData" @setTab="setTab" />
</div>
<div class="content-right-Tabs" style="height: calc(100vh - 315px); width: 100px">
<div
class="content-right-Tabs"
style="width: 100px"
:style="{ height: `calc(100vh - ${props.shrink ? '370px' : '315px'})` }"
>
<el-tabs type="border-card" style="height: 100%" v-model="activeName" @tab-change="tabChange">
<el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
<div v-if="activeName == tab.value">
@@ -26,6 +30,7 @@
:formContent="props.formContent"
:options="props.options"
style="width: 360px"
:shrink="props.shrink"
:disabled="tab.children.length == 0 ? false : true"
ref="communRef"
/>
@@ -49,13 +54,13 @@
:data="tableData"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}"
stripe
:cell-style="{ textAlign: 'center' }"
highlight-current-row
height="calc(100vh - 480px)"
:height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`"
style="width: 100%"
>
<el-table-column type="index" label="组次" width="60" />
@@ -97,7 +102,7 @@
? '/'
: '' +
row.channelList[item.num + 1].famp +
(valueCode == 'Absolute' ? 'V' : '%')
(valueCode == 'Absolute' ? 'A' : '%')
}}
</td>
<td>
@@ -188,7 +193,8 @@
v-if="showDialog"
/>
<!-- 查看 -->
<ViewRow ref="viewRowRef"
<ViewRow
ref="viewRowRef"
:activeName="activeName"
:formContent="props.formContent"
@close="viewDialog = false"
@@ -230,6 +236,9 @@ const props = defineProps({
formContent: {
type: Object,
required: true
},
shrink: {
type: Boolean
}
})
const showDialog = ref(false)
@@ -347,8 +356,6 @@ const inquireTable = () => {
tableData.value = res.data
}
})
}
// 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
@@ -360,8 +367,8 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
// 复制
const copyRow = async (row: any) => {
ElMessageBox.confirm('是否复制当前检测项目?', '提示', {
confirmButtonText: "确定",
cancelButtonText: "取消",
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
draggable: true
}).then(async () => {
@@ -396,11 +403,10 @@ const copyRow = async (row: any) => {
}
// 查看
const view = (row: Partial<TestScript.ResTestScript> = {}) => {
getCommunication()
console.log('communicationList', communicationList.value)
//当前点击的一级tab
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称';
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'
//当前点击的二级tab
const childrenTabName = ref('')
tabData.value.forEach((item: any) => {
@@ -416,7 +422,6 @@ const view = (row: Partial<TestScript.ResTestScript> = {}) => {
setTimeout(() => {
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
}, 0)
}
// 删除
const deleteRow = async (row: any) => {
@@ -466,7 +471,6 @@ onMounted(() => {
valueCode.value = dictStore
.getDictData('Script_Value_Type')
.filter(item => item.id == props.formContent.valueType)[0].code
})
</script>
<style lang="scss" scoped>
@@ -477,16 +481,14 @@ onMounted(() => {
.content-tree {
width: 260px;
height: calc(100vh - 315px);
border: 1px solid #dcdfe6;
border-radius: 4px;
// margin-right: 10px;
overflow: auto; /* 同时启用垂直和水平滚动 */
overflow-x: hidden;
}
.scriptTree {
height: calc(100vh - 520px);
}
/* 确保 el-tree 内容可以超出容器宽度 */
.el-tree {
@@ -526,7 +528,7 @@ onMounted(() => {
width: 45%;
}
.theFirst {
background-color: #003078;
background-color: var(--el-color-primary);
color: #fff;
width: 20px !important;
}

View File

@@ -33,14 +33,17 @@
v-model="form[0].dipData.ftransValue"
style="width: 150px"
:disabled="!form[0].dipFlag"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
</el-form-item>
<el-form-item label-width="120px" label="持续时间(s)">
<el-form-item label-width="120px" label="持续时间(周波)">
<el-input
type="number"
v-model="form[0].dipData.retainTime"
@input="handleInputRetainTime"
style="width: 150px"
:disabled="!form[0].dipFlag"
onkeypress="return (/[\d.]/.test(String.fromCharCode(event.keyCode)))"
/>
</el-form-item>
</div>
@@ -61,13 +64,33 @@ const form: any = computed({
},
set(value) {}
})
const emit = defineEmits(['setRetainTime'])
const handleInput = value => {
if (value < 0) {
ElMessage.warning("设定幅度不能小于0%")
props.childForm[0].dipData.ftransValue = 0
} else if (value > 200) {
props.childForm[0].dipData.ftransValue = 200
} else if (value > 180) {
ElMessage.warning("设定幅度不能大于180%")
props.childForm[0].dipData.ftransValue = 180
}
}
const handleInputRetainTime = value => {
if (value < 0) {
ElMessage.warning("持续时间不能小于0周波")
props.childForm[0].dipData.retainTime = 0
emit('setRetainTime', 0 )
}else if (value > 300) {
ElMessage.warning("持续时间不能大于300周波")
props.childForm[0].dipData.retainTime = 300
emit('setRetainTime', 300 )
}else{
console.log(props);
emit('setRetainTime', value )
}
}
</script>
<style lang="scss" scoped>
@@ -86,7 +109,7 @@ canvas {
position: relative;
img {
width: 90%;
height: 150px;
height: 140px;
margin: 0 10px 20px;
}
.inputTop {

View File

@@ -23,6 +23,8 @@
type="number"
placeholder="含有率"
style="width: 80px"
onkeypress="return (/[\d.]/.test(String.fromCharCode(event.keyCode)))"
@input="validateInput('famp',0)"
clearable
/>
</el-form-item>
@@ -32,6 +34,8 @@
type="number"
placeholder="相角"
style="width: 80px"
onkeypress="return (/[\d-]/.test(String.fromCharCode(event.keyCode)))"
@input="validateInput('fphase',0)"
clearable
/>
</el-form-item>
@@ -102,6 +106,8 @@
type="number"
placeholder="含有率"
style="width: 80px"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
@input="validateInput('famp',1)"
clearable
/>
</el-form-item>
@@ -111,6 +117,8 @@
type="number"
placeholder="相角"
style="width: 80px"
onkeypress="return (/[\d-]/.test(String.fromCharCode(event.keyCode)))"
@input="validateInput('fphase',1)"
clearable
/>
</el-form-item>
@@ -162,8 +170,9 @@
</template>
<script setup lang="ts">
import { Check, Delete, EditPen, CopyDocument } from '@element-plus/icons-vue'
import {Check, Delete, EditPen} from '@element-plus/icons-vue'
import {ref} from 'vue'
const props = defineProps({
childForm: {
type: Array as any,
@@ -175,7 +184,8 @@ const form: any = computed({
get() {
return props.childForm
},
set(value) {}
set(value) {
}
})
const formInline = ref({
harm: [],
@@ -187,6 +197,7 @@ const formInline1 = ref({
famp: '',
fphase: ''
})
// 定义表格数据项的类型
interface TableItem {
date: string
@@ -194,6 +205,7 @@ interface TableItem {
harmonicPhase?: string
name?: string
}
const empty = (index: number) => {
props.childForm[index].harmList = []
}
@@ -276,6 +288,48 @@ const onSubmit1 = () => {
const HarmFlagDelete = (index: number, number: number) => {
props.childForm[index].harmList.splice(number, 1)
}
const validateInput = (type: string, index: number) => {
if (type == 'famp') {
if (Number(formInline.value.famp) < 0 || Number(formInline1.value.famp) < 0) {
ElMessage.warning("含有率不能低于0")
if (index == 0) {
formInline.value.famp = '0'
}
if (index == 1) {
formInline1.value.famp = '0'
}
}
if (Number(formInline.value.famp) > 200 || Number(formInline1.value.famp) > 200) {
ElMessage.warning("含有率不能高于200")
if (index == 0) {
formInline.value.famp = '200'
}
if (index == 1) {
formInline1.value.famp = '200'
}
}
}
if (type == 'fphase') {
if (Number(formInline.value.fphase) < -360 || Number(formInline1.value.fphase) < -360) {
ElMessage.warning("相角不能低于-360°")
if (index == 0) {
formInline.value.fphase = '-360';
}
if (index == 1) {
formInline1.value.fphase = '-360';
}
} else if (Number(formInline.value.fphase) > 360 || Number(formInline1.value.fphase) > 360) {
ElMessage.warning("相角不能高于360°")
if (index == 0) {
formInline.value.fphase = '360';
}
if (index == 1) {
formInline1.value.fphase = '360';
}
}
}
}
</script>
<style lang="scss" scoped>
@@ -317,6 +371,7 @@ const HarmFlagDelete = (index: number, number: number) => {
.input-label-container label {
margin-left: 5px; /* 添加标签与输入框之间的间距 */
}
// 全局css 加上以下代码,可以隐藏上下箭头
// 取消input的上下箭头

View File

@@ -23,6 +23,8 @@
type="number"
placeholder="含有率"
style="width: 80px"
onkeypress="return (/[\d.]/.test(String.fromCharCode(event.keyCode)))"
@input="validateInput('famp',0)"
clearable
/>
</el-form-item>
@@ -32,6 +34,8 @@
type="number"
placeholder="相角"
style="width: 80px"
onkeypress="return (/[\d-]/.test(String.fromCharCode(event.keyCode)))"
@input="validateInput('fphase',0)"
clearable
/>
</el-form-item>
@@ -102,6 +106,8 @@
type="number"
placeholder="含有率"
style="width: 80px"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
@input="validateInput('famp',1)"
clearable
/>
</el-form-item>
@@ -111,6 +117,8 @@
type="number"
placeholder="相角"
style="width: 80px"
onkeypress="return (/[\d-]/.test(String.fromCharCode(event.keyCode)))"
@input="validateInput('fphase',1)"
clearable
/>
</el-form-item>
@@ -276,6 +284,48 @@ const onSubmit1 = () => {
const inHarmFlagDelete = (index: number, number: number) => {
props.childForm[index].inharmList.splice(number, 1)
}
const validateInput = (type: string, index: number) => {
if (type == 'famp') {
if (Number(formInline.value.famp) < 0 || Number(formInline1.value.famp) < 0) {
ElMessage.warning("含有率不能低于0")
if (index == 0) {
formInline.value.famp = '0'
}
if (index == 1) {
formInline1.value.famp = '0'
}
}
if (Number(formInline.value.famp) > 200 || Number(formInline1.value.famp) > 200) {
ElMessage.warning("含有率不能高于200")
if (index == 0) {
formInline.value.famp = '200'
}
if (index == 1) {
formInline1.value.famp = '200'
}
}
}
if (type == 'fphase') {
if (Number(formInline.value.fphase) < -360 || Number(formInline1.value.fphase) < -360) {
ElMessage.warning("相角不能低于-360°")
if (index == 0) {
formInline.value.fphase = '-360';
}
if (index == 1) {
formInline1.value.fphase = '-360';
}
} else if (Number(formInline.value.fphase) > 360 || Number(formInline1.value.fphase) > 360) {
ElMessage.warning("相角不能高于360°")
if (index == 0) {
formInline.value.fphase = '360';
}
if (index == 1) {
formInline1.value.fphase = '360';
}
}
}
}
</script>
<style lang="scss" scoped>

View File

@@ -1,6 +1,6 @@
<template>
<div>
<el-card style="margin-bottom: 10px" class="cardTop">
<el-card style="margin-bottom: 10px" class="cardTop" :style="{ height: height }">
<el-form
:model="formContent"
:inline="true"
@@ -13,23 +13,41 @@
<el-input v-model.trim="formContent.name" placeholder="请输入脚本名称" clearable />
</el-form-item>
<el-form-item label="参照标准名称" prop="standardName">
<el-input v-model.trim="formContent.standardName" placeholder="请输入参照标准名称" clearable />
<!-- <el-input v-model.trim="formContent.standardName" placeholder="请输入参照标准名称" clearable />-->
<el-select v-model="formContent.standardName" filterable placeholder="请选择参照标准名称" @change="setStandardTimeList">
<el-option v-for="item in standardNameList" :key="item.label" :label="item.label" :value="item.label" />
</el-select>
</el-form-item>
<el-form-item label="标准推行年份" prop="standardTime">
<el-date-picker
v-model="formContent.standardTime"
style="width: 100%"
type="year"
format="YYYY"
value-format="YYYY"
placeholder="请选择标准推行年份"
/>
<!-- <el-date-picker-->
<!-- v-model="formContent.standardTime"-->
<!-- style="width: 100%"-->
<!-- type="year"-->
<!-- format="YYYY"-->
<!-- value-format="YYYY"-->
<!-- placeholder="请选择标准推行年份"-->
<!-- />-->
<el-select v-model="formContent.standardTime" filterable placeholder="请选择标准推行年份">
<el-option v-for="item in standardTimeList" :key="item" :value="item" :label="item" />
</el-select>
</el-form-item>
<el-form-item label="模版类型" prop="type">
<el-select v-model="formContent.type" filterable clearable placeholder="请选择模版类型">
<el-option v-for="item in stencil" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<div class="formBut">
<el-button
type="primary"
:icon="shrink ? ArrowUpBold : ArrowDownBold"
@click="shrinkChange"
></el-button>
<el-button type="primary" :icon="Select" @click="save">保存</el-button>
<el-button :icon="Close" @click="close">返回</el-button>
</div>
</el-form-item>
<el-form-item label="检测脚本值类型" prop="valueType">
<el-select
v-model="formContent.valueType"
@@ -46,16 +64,30 @@
/>
</el-select>
</el-form-item>
<el-form-item>
<div class="formBut">
<el-button type="primary" :icon="Select" @click="save">保存</el-button>
<el-button :icon="Close" @click="close">返回</el-button>
</div>
<el-form-item label="额定电流" prop="ratedCurr">
<el-input-number
v-model.trim="formContent.ratedCurr"
min="0"
max="20"
style="width: 100%"
placeholder="请输入额定电流"
clearable
/>
</el-form-item>
<el-form-item label="额定电压" prop="ratedVolt">
<el-input-number
v-model.trim="formContent.ratedVolt"
min="0"
max="380"
style="width: 100%"
placeholder="请输入额定电压"
clearable
/>
</el-form-item>
</el-form>
</el-card>
<el-card v-if="show">
<TestScriptDetail :options="secondLevelOptions" :formContent="formContent" />
<TestScriptDetail :options="secondLevelOptions" :formContent="formContent" :shrink="shrink" />
</el-card>
</div>
</template>
@@ -67,12 +99,15 @@ import { type TestScript } from '@/api/device/interface/testScript'
import type { Dict } from '@/api/system/dictionary/interface'
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
import type { CascaderOption } from 'element-plus'
import { Select, Close } from '@element-plus/icons-vue'
import { Select, Close, ArrowDownBold, ArrowUpBold } from '@element-plus/icons-vue'
import { pqScriptAdd, pqScriptUpdate } from '@/api/device/testScript'
import { useRouter } from 'vue-router'
const modeId = ref()
const show = ref(false)
const height = ref('125px')
const router = useRouter()
const standardNameList = reactive<{id:string,label: string, value: string}[]>([])
const standardTimeList = reactive<Array<string>>([])
const secondLevelOptions: any[] = []
// 定义弹出组件元信息
@@ -87,10 +122,13 @@ function useMetaInfo() {
pattern: modeId.value,
standardName: '',
standardTime: '',
state: 1
state: 1,
ratedCurr: 0,
ratedVolt: 0
})
return { titleType, formContent }
}
const shrink = ref(true)
const stencil = [
{ name: '脚本', value: 0 },
{ name: '模版', value: 1 }
@@ -100,11 +138,17 @@ const rules = {
standardName: [{ required: true, message: '请输入参照标准名称', trigger: 'blur' }],
standardTime: [{ required: true, message: '请选择标准推行年份', trigger: 'change' }],
type: [{ required: true, message: '请选择模版类型', trigger: 'change' }],
valueType: [{ required: true, message: '请选择检测脚本值类型', trigger: 'change' }]
valueType: [{ required: true, message: '请选择检测脚本值类型', trigger: 'change' }],
ratedCurr: [{ required: true, message: '请填写额定电流', trigger: 'change' }],
ratedVolt: [{ required: true, message: '请填写额定电压', trigger: 'change' }]
}
const { titleType, formContent } = useMetaInfo()
// 收缩
const shrinkChange = () => {
shrink.value = !shrink.value
shrink.value ? (height.value = '125px') : (height.value = '70px')
}
// 清空formContent
const resetFormContent = () => {
formContent.value = {
@@ -114,13 +158,14 @@ const resetFormContent = () => {
pattern: '',
standardName: '',
standardTime: '',
state: 1
state: 1,
ratedCurr: 0,
ratedVolt: 0
}
router.go(-1)
}
// 关闭弹窗
const close = () => {
// 清空dialogForm中的值
resetFormContent()
// 重置表单
@@ -129,6 +174,15 @@ const close = () => {
// 关闭信息弹框
const closeInformation = () => {}
const setStandardTimeList = ()=>{
let checkStandard = standardNameList.find(item => item.label === formContent.value.standardName)
if (checkStandard) {
standardTimeList.push(...checkStandard.value.split(','))
} else {
standardTimeList.push('2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024', '2025')
}
}
// 保存数据
const save = () => {
// dialogFormRef
@@ -151,12 +205,19 @@ const save = () => {
}
})
}
} else {
shrink.value = true
height.value = '125px'
}
})
}
// 打开弹窗,可能是新增,也可能是编辑
const open = async (title: string, row: any) => {
dictStore.getDictData("Script_Standard_Name").forEach(item => {
standardNameList.push({id: item.id, label: item.name, value: item.value})
})
titleType.value = title
if (title == '新增检测脚本') {
show.value = false
@@ -239,7 +300,7 @@ defineExpose({ open })
// justify-content: space-between;
.el-form-item {
display: flex;
width: 15.8%;
width: 18.8%;
.el-form-item__content {
flex: 1;

View File

@@ -9,17 +9,17 @@
<!-- 右侧编辑区域内容 -->
<el-form :inline="true" label-width="auto" :model="form" class="form-two">
<el-form-item :label="`电压有效值(${valueCode == 'Absolute' ? 'V' : '%'})`">
<el-input type="number" v-model="form[0].famp" :disabled="!form[0].channelFlag" />
<el-input type="number" v-model="form[0].famp" :disabled="!form[0].channelFlag" onkeypress="return (/[\d.]/.test(String.fromCharCode(event.keyCode)))" @input="validateInput(0, 'famp')"/>
</el-form-item>
<el-form-item label="电压相角(°)">
<el-input type="number" v-model="form[0].fphase" :disabled="!form[0].channelFlag" />
<el-input type="number" v-model="form[0].fphase" :disabled="!form[0].channelFlag" onkeypress="return (/[\d-]/.test(String.fromCharCode(event.keyCode)))" @input="validateInput(0, 'fphase')"/>
</el-form-item>
<el-form-item :label="`电流有效值(${valueCode == 'Absolute' ? 'A' : '%'})`">
<el-input type="number" v-model="form[1].famp" :disabled="!form[1].channelFlag" />
<el-input type="number" v-model="form[1].famp" :disabled="!form[1].channelFlag" onkeypress="return (/[\d.]/.test(String.fromCharCode(event.keyCode)))" @input="validateInput(1, 'famp')"/>
</el-form-item>
<el-form-item label="电流相角(°)">
<el-input type="number" v-model="form[1].fphase" :disabled="!form[1].channelFlag" />
<el-input type="number" v-model="form[1].fphase" :disabled="!form[1].channelFlag" onkeypress="return (/[\d-]/.test(String.fromCharCode(event.keyCode)))" @input="validateInput(1, 'fphase')"/>
</el-form-item>
</el-form>
</div>
@@ -109,6 +109,50 @@ function drawSineWave() {
}
}
}
const validateInput = (index: number, field: string) => {
const value = form.value[index][field];
if (index === 0) {
if (field === 'famp') {
if (value < 0) {
ElMessage.warning("电压不能低于0V")
form.value[index][field] = 0;
} else if (value > 380) {
ElMessage.warning("电压不能高于380V")
form.value[index][field] = 380;
}
}
}
if (index === 1) {
if (field === 'famp') {
if (value < 0) {
if(valueCode=== 'Absolute') {
ElMessage.warning("电流不能低于0A")
}else{
ElMessage.warning("电流不能低于0%")
}
form.value[index][field] = 0;
} else if (value > 20) {
if(valueCode=== 'Absolute') {
ElMessage.warning("电流不能高于20A")
form.value[index][field] = 20;
}else if(value > 200){
ElMessage.warning("电流不能高于200%")
form.value[index][field] = 200;
}
}
}
}
if (field === 'fphase') {
if (value < -360) {
ElMessage.warning("相角不能低于-360°")
form.value[index][field] = -360;
} else if (value > 360) {
ElMessage.warning("相角不能高于360°")
form.value[index][field] = 360;
}
}
}
</script>
<style scoped>

View File

@@ -90,7 +90,7 @@
size="small"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}"
stripe
@@ -111,7 +111,7 @@
size="small"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}"
stripe
@@ -134,7 +134,7 @@
size="small"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}"
stripe
@@ -155,7 +155,7 @@
size="small"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}"
stripe
@@ -178,7 +178,7 @@
:data="setValue_TableData"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}"
stripe

View File

@@ -127,6 +127,16 @@ const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
search: showValueSearch.value ? { el: 'select' } : undefined,
minWidth: 150
},
{
prop: 'ratedCurr',
label: '额定电流',
minWidth: 100
},
{
prop: 'ratedVolt',
label: '额定电压',
minWidth: 100
},
{
prop: 'type',
label: '模板类型',
@@ -135,6 +145,7 @@ const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
return <el-tag type={scope.row.type ? 'success' : 'primary'}> {scope.row.type ? '模版' : '脚本'} </el-tag>
}
},
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 }
])
@@ -143,7 +154,6 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
if (modeStore.currentMode == '比对式') {
comparisonPopup.value?.open(titleType, row, modeStore.currentMode)
} else {
if (titleType == 'add') {
router.push({
path: '/machine/testScriptAdd',

View File

@@ -93,8 +93,8 @@ function useMetaInfo() {
}
const rules: reactive<Record<string, Array<FormItemRule>>> = reactive({
desc: [{required: true, message: '源参数描述必填!', trigger: 'blur'}],
type: [{required: true, message: '源参数类型必填!', trigger: 'blur'}],
desc: [{required: true, message: '源参数描述必填!', trigger: 'blur'},{min: 1, max: 32, message: '长度为1~32个字符', trigger: 'blur'}],
type: [{required: true, message: '源参数类型必填!', trigger: 'blur'},{min: 1, max: 32, message: '长度为1~32个字符', trigger: 'blur'}],
sort: [{required: true, message: '排序必填!', trigger: 'blur'}]
})

View File

@@ -24,7 +24,7 @@
class="custom-tree-node"
style="display: flex; align-items: center"
>
<CircleCheck v-if="data.isChildNode && data.scriptIdx < currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#67C23A;"/>
<CircleCheck v-if="data.isChildNode && data.scriptIdx < currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#91cc75;"/>
<svg-icon v-if="data.isChildNode && data.scriptIdx === currentIndex" name="loading" spin ></svg-icon>
<span>{{ node.label }}</span>

View File

@@ -9,7 +9,7 @@
<el-input v-model="formContent.name" placeholder="请输入名称" autocomplete="off"/>
</el-form-item>
<el-form-item label='检测源' prop='sourceIds' :label-width='100'>
<el-select v-model="formContent.sourceIds" :multiple="selectByMode" collapse-tags placeholder="请选择检测源">
<el-select v-model="formContent.sourceIds" :multiple="selectByMode" collapse-tags placeholder="请选择检测源" clearable>
<el-option
v-for="(option, index) in pqSourceArray"
:key="index"
@@ -19,17 +19,17 @@
</el-select>
</el-form-item>
<el-form-item label="数据源" prop="datasourceIds" :label-width="100">
<el-select v-model="formContent.datasourceIds" :multiple="selectByMode" collapse-tags placeholder="请选择数据源" autocomplete="off">
<el-select v-model="formContent.datasourceIds" :multiple="selectByMode" collapse-tags placeholder="请选择数据源" autocomplete="off" clearable>
<el-option
v-for="item in dictStore.getDictData(dataSourceType)"
:key="item.id"
:label="item.name"
:value="item.value || ''"
:value="item.code || ''"
/>
</el-select>
</el-form-item>
<el-form-item label="检测脚本" prop="scriptId" :label-width="100">
<el-select v-model="formContent.scriptId" placeholder="请选择检测脚本" autocomplete="off" :disabled="isSelectDisabled ">
<el-select v-model="formContent.scriptId" placeholder="请选择检测脚本" autocomplete="off" :disabled="isSelectDisabled" clearable>
<el-option
v-for="(option, index) in pqScriptArray"
:key="index"
@@ -39,7 +39,7 @@
</el-select>
</el-form-item>
<el-form-item label="误差体系" prop="errorSysId" :label-width="100">
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="isSelectDisabled">
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="isSelectDisabled" clearable>
<el-option
v-for="(option, index) in pqErrorArray"
:key="index"
@@ -54,6 +54,23 @@
<el-radio :value="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="关联报告模版" :label-width="100" prop='associateReport'>
<el-radio-group v-model="formContent.associateReport">
<el-radio :value="1"></el-radio>
<el-radio :value="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="模版名称" prop="reportTemplateName" :label-width="100" v-if="formContent.associateReport === 1">
<el-select v-model="formContent.reportTemplateName" placeholder="请选择报告模版" autocomplete="off" >
<el-option
v-for="(option, index) in pqReportName"
:key="index"
:label="option.name"
:value="option.name"
/>
</el-select>
</el-form-item>
</el-form>
</el-col>
<el-col :span="12">
@@ -65,9 +82,7 @@
:data="allData"
:titles="['未绑定设备', '已绑定设备']">
<template #default="{ option }">
<el-tooltip :content="option.tips" placement="top" :show-after=1000>
<span>{{ option.label }}</span>
</el-tooltip>
</template>
</el-transfer>
</el-col>
@@ -93,11 +108,7 @@
import { type TestScript } from '@/api/device/interface/testScript';
import { type ErrorSystem } from '@/api/device/interface/error';
import { type Device } from '@/api/device/interface/device';
import { Loading } from '@element-plus/icons-vue/dist/types';
import { truncate } from 'lodash';
import {getPqReportAllName,getPqReportAllVersion} from '@/api/device/report/index.ts'
const dictStore = useDictStore()
// 定义弹出组件元信息
const dialogFormRef = ref()
@@ -108,6 +119,9 @@ import { truncate } from 'lodash';
const pqErrSysList=ref<ErrorSystem.ErrorSystemList[]>([])//获取指定模式下所有检测源
const pqDevList=ref<Device.ResPqDev[]>([])//获取指定模式下所有检测源
const pqReportName = ref<{ name: string }[]>([])
const pqSourceArray = ref<{ label: string; value: string; }[]>()
const pqScriptArray = ref<{ label: string; value: string; }[]>()
const pqErrorArray = ref<{ label: string; value: string; }[]>()
@@ -164,6 +178,9 @@ const filterMethod = (query: string, item: { label?: string }) => {
devIds:[],
sourceIds:'',
datasourceIds:'',
associateReport:0,
reportTemplateName:'',
reportTemplateVersion:'',
})
return { dialogVisible, titleType, formContent }
}
@@ -194,6 +211,9 @@ const filterMethod = (query: string, item: { label?: string }) => {
devIds:[],
sourceIds:'',
datasourceIds:'',
associateReport:0,
reportTemplateName:'',
reportTemplateVersion:'',
}
)
@@ -204,14 +224,27 @@ const filterMethod = (query: string, item: { label?: string }) => {
})
// 定义规则
const formRuleRef = ref<FormInstance>()
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
// 定义表单校验规则
const baseRules: Record<string, Array<FormItemRule>> = {
name: [{ required: true, message: '检测计划名称必填!', trigger: 'blur' }],
sourceIds: [{ required: true, message: '检测源必选!', trigger: 'blur' }],
datasourceIds: [{ required: true, message: '数据源必选!', trigger: 'blur' }],
scriptId: [{ required: true, message: '检测脚本必选!', trigger: 'blur' }],
errorSysId: [{ required: true, message: '误差体系必选!', trigger: 'blur' }],
sourceIds: [{ required: true, message: '检测源必选!', trigger: 'change' }],
datasourceIds: [{ required: true, message: '数据源必选!', trigger: 'change' }],
scriptId: [{ required: true, message: '检测脚本必选!', trigger: 'change' }],
errorSysId: [{ required: true, message: '误差体系必选!', trigger: 'change' }],
};
// 使用计算属性根据 scene 动态生成规则
const rules = computed(() => {
const dynamicRules = { ...baseRules };
if (formContent.associateReport === 1){//只有关联报告模版时需要展示
dynamicRules.reportTemplateName= [{ required: true, message: '报告模版名称必选!', trigger: 'change' }];
//dynamicRules.reportTemplateVersion= [{ required: true, message: '报告模版版本号必选!', trigger: 'change' }];
}
return dynamicRules;
});
// 关闭弹窗
@@ -248,6 +281,7 @@ const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
if( mode.value === '比对式'){
await updatePlan(formContent)
}else{
await updatePlan({...formContent,'sourceIds':[formContent.sourceIds],'datasourceIds':[formContent.datasourceIds]});
}
ElMessage.success({ message: `${dialogTitle.value}成功!` })
@@ -305,14 +339,23 @@ const open = async (sign: string,
if(sign == 'add')
{
console.log('add',data)
const [pqSource_Result, PqScript_Result, PqErrSys_Result,pqDevList_Result] = await Promise.all([
const [pqSource_Result, PqScript_Result, PqErrSys_Result,pqDevList_Result,pqReportName_Result] = await Promise.all([
getTestSourceList(data),
getPqScriptList(data),
getPqErrSysList(),
getUnboundPqDevList(data)
getUnboundPqDevList(data),
getPqReportAllName(),
]);
if (Array.isArray(pqReportName_Result.data)) {
pqReportName.value = pqReportName_Result.data.map(item => ({ name: item }));
} else {
pqReportName.value = [];
console.error('pqReportName_Result.data is not an array:', pqReportName_Result.data);
}
pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[];
pqScriptList.value = PqScript_Result.data as TestScript.ResTestScript[];
pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[];
@@ -321,14 +364,23 @@ const open = async (sign: string,
unboundPqDevList.value = pqDevList.value
boundPqDevList.value = [];
}else{//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
const [pqSource_Result, PqScript_Result, PqErrSys_Result,boundPqDevList_Result, unboundPqDevList_Result] = await Promise.all([
const [pqSource_Result, PqScript_Result, PqErrSys_Result,boundPqDevList_Result, unboundPqDevList_Result,pqReportName_Result] = await Promise.all([
getTestSourceList(data),
getPqScriptList(data),
getPqErrSysList(),
getBoundPqDevList({ 'planId': data.id }),
getUnboundPqDevList(data)
getUnboundPqDevList(data),
getPqReportAllName(),
]);
if (Array.isArray(pqReportName_Result.data)) {
pqReportName.value = pqReportName_Result.data.map(item => ({ name: item }));
} else {
pqReportName.value = [];
console.error('pqReportName_Result.data is not an array:', pqReportName_Result.data);
}
pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[];
pqScriptList.value = PqScript_Result.data as TestScript.ResTestScript[];
pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[];
@@ -392,18 +444,18 @@ function pqToArray() {
}
const dataSourceType = computed(() => {
switch (mode.value) {
case '模拟式':
return 'Datasource_Simulate'
case '数字式':
return 'Datasource_Digital'
default:
return 'Datasource_Contrast'
}
// switch (mode.value) {
// case '模拟式':
// return 'Datasource_Simulate'
// case '数字式':
// return 'Datasource_Digital'
// default:
// return 'Datasource_Contrast'
// }
return 'Datasource'
})
// 对外映射
defineExpose({ open })
const props = defineProps<{

View File

@@ -46,7 +46,7 @@
import ProTable from '@/components/ProTable/index.vue'
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
import { ScaleToOriginal, CirclePlus, Delete, EditPen, View, Upload, Download, List, Tools } from '@element-plus/icons-vue'
import {getPlanList,deletePlan,exportCNPlan,downloadCNPlanTemplate,importCNPlan } from '@/api/plan/plan.ts'
import {getPlanList,deletePlan,exportPlan,downloadTemplate,importPlan } from '@/api/plan/plan.ts'
import { computed, onMounted, reactive, ref } from 'vue'
import type { Plan } from '@/api/plan/interface'
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
@@ -93,7 +93,7 @@ const planList = ref<Plan.ResPlan[]>([]);
const getTableList = async(params: any) => {
let newParams = JSON.parse(JSON.stringify(params))
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
newParams.pattern = patternId
newParams.patternId = patternId
try {
const result = await getPlanList(newParams);
@@ -106,14 +106,15 @@ const getTableList = async(params: any) => {
const dataSourceType = computed(() => {
switch (modeStore.currentMode) {
case '模拟式':
return 'Datasource_Simulate'
case '数字式':
return 'Datasource_Digital'
default:
return 'Datasource_Contrast'
}
// switch (modeStore.currentMode) {
// case '模拟式':
// return 'Datasource_Simulate'
// case '数字式':
// return 'Datasource_Digital'
// default:
// return 'Datasource_Contrast'
// }
return 'Datasource'
})
@@ -219,19 +220,17 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
width: 360,
render: scope => {
return (
<el-link type='primary' link onClick={() => showTestScript(scope.row.scriptId)}>
{scope.row.scriptName}
</el-link>
<span>{scope.row.scriptName}</span>
)
},
},
{
prop: 'errorSysId',
label: '误差体系',
width: 200,
width: 240,
render: scope => {
return (
<el-link type='primary' link onClick={() => showData(scope.row.errorSysName || '')}>
<el-link type='primary' link onClick={() => showData(scope.row)}>
{scope.row.errorSysName}
</el-link>
)
@@ -282,8 +281,9 @@ function isVisible(row: Plan.ReqPlan) {
}
function showData(row: string) {
errorStandardPopup.value?.open(row, row)
function showData(row: any) {
let split = row.errorSysName.split('-')
errorStandardPopup.value?.open(row.errorSysName, {id:row.errorSysId,devLevel:split[split.length-1]})
}
async function showTestSource(row:string) {
@@ -345,8 +345,8 @@ const importClick = () => {
title: '检测计划',
showCover: false,
patternId: dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? '',
tempApi: downloadCNPlanTemplate,
importApi: importCNPlan,
tempApi: downloadTemplate,
importApi: importPlan,
getTableList: proTable.value?.getTableList,
}
planImportExcel.value?.acceptParams(params)
@@ -356,7 +356,7 @@ const exportClick = () => {
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', { type: 'warning' }).then(() =>{
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
useDownload(exportCNPlan,'检测计划导出数据', {...proTable.value?.searchParam,pattern:patternId}, false,'.xlsx')
useDownload(exportPlan,'检测计划导出数据', {...proTable.value?.searchParam,patternId:patternId}, false,'.xlsx')
})
}

View File

@@ -3,6 +3,7 @@
<el-tabs type="border-card">
<el-tab-pane label="检测相关配置">
<div>
<el-form :model="TestConfigForm" ref='testConfigFormRef' :rules='rules'>
<el-divider>检测配置</el-divider>
<el-row :gutter="24">
<el-col :span="8">
@@ -15,7 +16,8 @@
</el-col>
<el-col :span="8">
<el-form-item label='检测最大次数' prop='maxTime' :label-width="110">
<el-input-number v-model='TestConfigForm.maxTime' :min='1' :max='999' />
<!-- <el-input-number v-model='TestConfigForm.maxTime' :min='1' :max='999' onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"/>-->
<el-input number v-model.number='TestConfigForm.maxTime' placeholder="请输入检测最大次数" onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"/>
</el-form-item>
</el-col>
<el-col :span="8">
@@ -30,8 +32,8 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-form :model="RegResForm" ref='dialogFormRef' :rules='rules'>
<el-divider>有效数据配置</el-divider>
<el-row :gutter="24">
@@ -42,17 +44,17 @@
</el-col>
<el-col :span="8">
<el-form-item label="实时数据有效组数" prop="realTime" :label-width="140">
<el-input number v-model.number='RegResForm.realTime' placeholder="请输入实时数据有效组数"/>
<el-input number v-model.number='RegResForm.realTime' placeholder="请输入实时数据有效组数" onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="统计数据有效组数" prop="statistics" :label-width="140">
<el-input number v-model.number='RegResForm.statistics' placeholder="请输入统计数据有效组数"/>
<el-input number v-model.number='RegResForm.statistics' placeholder="请输入统计数据有效组数" onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="闪变数据有效组数" prop="flicker" :label-width="140">
<el-input number v-model.number='RegResForm.flicker' placeholder="请输入闪变数据有效组数"/>
<el-input number v-model.number='RegResForm.flicker' placeholder="请输入闪变数据有效组数" onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"/>
</el-form-item>
</el-col>
</el-row>
@@ -179,13 +181,9 @@
</div>
</template>
<script setup lang='tsx''>
import { type Dict } from '@/api/system/dictionary/interface'
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
import PqPopup from '@/views/system/dictionary/dictPq/components/pqPopup.vue'
<script setup lang='tsx'>
import {useDictStore} from '@/stores/modules/dict'
import { useHandleData } from '@/hooks/useHandleData'
import { computed, onMounted, reactive, Ref, ref, watch } from 'vue'
import {computed, onMounted, Ref, ref} from 'vue'
import {type Base} from '@/api/system/base/interface'
import {type VersionRegister} from '@/api/system/versionRegister/interface'
import {getTestConfig, updateTestConfig} from '@/api/system/base/index'
@@ -198,6 +196,7 @@
const modeStore = useModeStore();
const dictStore = useDictStore()
const testConfigFormRef = ref()
const dialogFormRef = ref()
const mode = ref()
const IsMode = ref(false)
@@ -257,17 +256,21 @@ onMounted(async () => {
// 定义弹出组件元信息
const rules = computed(() => {
const baseRules: Ref<Record<string, Array<FormItemRule>>> = ref({
maxTime: [
{required: true, trigger: 'blur', message: '检测最大次数必填!'},
{pattern: /^(?:[1-9]|[1-9][0-9]|[1-9][0-9]{2})$/, message: '检测最大次数为1~999的正整数', trigger: 'blur'}
],
realTime: [
{required: true, trigger: 'blur', message: '实时数据有效组数必填!'},
{ pattern: /^[0-9]\d*$/, message: '实时数据有效组数为含0的正整数', trigger: 'blur' }
{pattern: /^(?:[1-9]|[1-9][0-9]|[1-9][0-9]{2})$/, message: '实时数据有效组数为1~999的正整数', trigger: 'blur'}
],
statistics: [
{required: true, trigger: 'blur', message: '统计数据有效组数必填!'},
{ pattern: /^[0-9]\d*$/, message: '统计数据有效组数为含0的正整数', trigger: 'blur' }
{pattern: /^(?:[1-9]|[1-9][0-9]|[1-9][0-9]{2})$/, message: '统计数据有效组数为1~999的正整数', trigger: 'blur'}
],
flicker: [
{required: true, trigger: 'blur', message: '闪变数据有效组数必填!'},
{ pattern: /^[0-9]\d*$/, message: '闪变数据有效组数为含0的正整数', trigger: 'blur' }
{pattern: /^(?:[1-9]|[1-9][0-9]|[1-9][0-9]{2})$/, message: '闪变数据有效组数为1~999的正整数', trigger: 'blur'}
],
});
@@ -275,7 +278,7 @@ onMounted(async () => {
if (mode.value == '比对式') {
baseRules.value.waveRecord = [
{required: true, trigger: 'blur', message: '录波数据有效组数必填!'},
{ pattern: /^[0-9]\d*$/, message: '录波数据有效组数为含0的正整数', trigger: 'blur' }
{pattern: /^(?:[1-9]|[1-9][0-9]|[1-9][0-9]{2})$/, message: '录波数据有效组数为1~999的正整数', trigger: 'blur'}
];
}
@@ -283,15 +286,16 @@ onMounted(async () => {
})
const submitForm = async () => {
try {
dialogFormRef.value?.validate(async (valid: boolean) => {
testConfigFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
await updateTestConfig(TestConfigForm.value);
dialogFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
//await updateTestConfig(TestConfigForm.value);
// 提取并传递 4 个参数
const {id, waveRecord, realTime, statistics, flicker} = RegResForm.value
RegResForm2.value = {id, waveRecord, realTime, statistics, flicker}
@@ -304,6 +308,10 @@ onMounted(async () => {
ElMessage.success({message: `保存配置成功!`})
}
})
}
})
} catch (err) {
console.error('验证过程中出现错误', err)
}

View File

@@ -0,0 +1,304 @@
<template>
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogSmall">
<div>
<el-form ref="dialogFormRef" :model="formContent" :rules="rules">
<el-form-item label="名称" prop="name">
<el-input v-model="formContent.name" placeholder="请输入报告名称"/>
</el-form-item>
<el-form-item label="版本号" prop="version">
<el-input v-model="formContent.version" placeholder="请输入版本号"/>
</el-form-item>
<el-form-item label="基础模板文件" prop="baseFile">
<el-upload
action="#"
:limit="1"
:on-change='BaseHandleChange'
:auto-upload="false"
:file-list="baseFileList"
:on-exceed="BaseHandleExceed"
:on-remove="BaseHandleRemove"
style="width: 100% !important;"
accept=".docx"
class="upload-container"
>
<el-button type="primary">选择文件</el-button>
</el-upload>
仅支持上传大小不超过5MB的.docx文件
</el-form-item>
<el-form-item label="检测项模版文件" prop="detailFile">
<el-upload
action="#"
:limit="1"
:on-change='DataHandleChange'
:auto-upload="false"
:file-list="detailFileList"
:on-exceed="DataHandleExceed"
:on-remove="DataHandleRemove"
style="width: 100% !important;"
accept=".docx"
class="upload-container"
>
<el-button type="primary">选择文件</el-button>
</el-upload>
仅支持上传大小不超过5MB的.docx文件
</el-form-item>
<el-form-item label="描述信息" prop="description">
<el-input v-model="formContent.description" type="textarea" placeholder="请输入描述信息"/>
</el-form-item>
</el-form>
</div>
<template #footer>
<div>
<el-button @click="close()"> </el-button>
<el-button type="primary" @click="save()">保存</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import {dialogSmall} from '@/utils/elementBind'
import {type PqReport} from '@/api/device/interface/report'
import {ElMessage, UploadFile} from 'element-plus'
import {addPqReport, getPqReportById, updatePqReport} from '@/api/device/report'
import {computed, reactive, ref} from 'vue'
// 定义弹出组件元信息
const dialogFormRef = ref()
let excelFormData = new FormData()
const baseFileName = ref('')
const baseFileUrl = ref('')
const detailFileName = ref('')
const detailFileUrl = ref('')
const baseFileList = computed(() => {
if (baseFileName.value && baseFileUrl.value) {
return [{name: baseFileName.value, url: baseFileUrl.value}];
}
return [];
});
const detailFileList = computed(() => {
if (detailFileName.value && detailFileUrl.value) {
return [{name: detailFileName.value, url: detailFileUrl.value}];
}
return [];
});
function useMetaInfo() {
const dialogVisible = ref(false)
const titleType = ref('add')
const formContent = ref<PqReport.ResReport>({
id: '',
name: '',
version: '', // 版本号
description: '', // 描述信息
detailFile: '',//检测项模版文件路径
baseFile: '',
state: 1,
})
return {dialogVisible, titleType, formContent}
}
const {dialogVisible, titleType, formContent} = useMetaInfo()
// 清空formContent
const resetFormContent = () => {
formContent.value = {
id: '',
name: '',
version: '', // 版本号
description: '', // 描述信息
detailFile: '',//检测项模版文件路径
baseFile: '',
state: 1,
}
}
let dialogTitle = computed(() => {
return titleType.value === 'add' ? '新增报告模版' : '编辑报告模版'
})
// 关闭弹窗
const close = () => {
excelFormData = new FormData()
dialogVisible.value = false
resetFormContent()
dialogFormRef.value?.resetFields()
}
// 表单验证规则
const rules = reactive({
name: [{required: true, message: '请输入报告名称', trigger: 'blur'}],
version: [{required: true, message: '请输入版本号', trigger: 'blur'}],
baseFile: [{required: true, message: '请上传基础模板文件', trigger: 'change'}],
detailFile: [{required: true, message: '请上传检测项模版文件', trigger: 'change'}],
})
// 保存数据
const save = () => {
try {
dialogFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
// 清空 excelFormData
excelFormData.delete('id')
excelFormData.delete('name')
excelFormData.delete('version')
excelFormData.delete('description')
excelFormData.append('name', formContent.value.name)
excelFormData.append('version', formContent.value.version)
excelFormData.append('description', formContent.value.description)
let baseFileFlag = handleFileLimit(excelFormData.get('baseFile') as File)
let detailFileFlag = handleFileLimit(excelFormData.get('detailFile') as File)
if (!baseFileFlag || !detailFileFlag) {
return
}
if (formContent.value.id) {
excelFormData.append('id', formContent.value.id)
await updatePqReport(excelFormData);
ElMessage.success({message: `${dialogTitle.value}成功!`})
} else {
await addPqReport(excelFormData);
ElMessage.success({message: `${dialogTitle.value}成功!`})
}
close()
// 刷新表格
await props.refreshTable!()
}
})
} catch (err) {
console.error('验证过程中出现错误', err)
}
}
// 打开弹窗,可能是新增,也可能是编辑
const open = async (sign: string, data?: PqReport.ResReport) => {
titleType.value = sign
dialogVisible.value = true
if (data?.id) {
await getPqReportById(data).then((res) => {
formContent.value.id = res.data.id
formContent.value.name = res.data.name
formContent.value.version = res.data.version
formContent.value.description = res.data.description
// 处理文件信息
if (res.data.baseFileVO) {
baseFileName.value = res.data.baseFileVO.name;
baseFileUrl.value = res.data.baseFileVO.url;
formContent.value.baseFile = res.data.baseFileVO.name
}
if (res.data.detailFileVO) {
detailFileName.value = res.data.detailFileVO.name;
detailFileUrl.value = res.data.detailFileVO.url;
formContent.value.detailFile = res.data.detailFileVO.name
}
})
} else {
baseFileName.value = ''
baseFileUrl.value = ''
detailFileName.value = ''
detailFileUrl.value = ''
resetFormContent();
dialogFormRef.value?.resetFields()
// 清空 excelFormData
excelFormData = new FormData();
}
}
const DataHandleRemove = () => {
excelFormData.delete('detailFile');
formContent.value.detailFile = ''
};
const BaseHandleRemove = () => {
excelFormData.delete('baseFile');
formContent.value.baseFile = ''
};
const BaseHandleExceed = (files: File[]) => {
// 移除旧文件
excelFormData.delete('baseFile');
// 添加新文件
if (files.length > 0) {
const newFile = files[0] as unknown as UploadFile;
baseFileName.value = newFile.name;
excelFormData.append('baseFile', newFile as Blob, newFile.name);
formContent.value.detailFile = newFile.name
}
};
const DataHandleExceed = (files: File[]) => {
// 移除旧文件
excelFormData.delete('detailFile');
// 添加新文件
if (files.length > 0) {
const newFile = files[0] as UploadFile;
detailFileName.value = newFile.name;
excelFormData.append('detailFile', newFile as Blob, newFile.name);
formContent.value.detailFile = newFile.name
}
};
const BaseHandleChange = async (param: UploadFile) => {
baseFileName.value = param.name;
baseFileUrl.value = URL.createObjectURL(param.raw as Blob);
excelFormData.append('baseFile', param.raw as Blob, param.name);
formContent.value.baseFile = param.name;
};
const DataHandleChange = async (param: UploadFile) => {
detailFileName.value = param.name;
detailFileUrl.value = URL.createObjectURL(param.raw as Blob);
excelFormData.append('detailFile', param.raw as Blob, param.name);
formContent.value.detailFile = param.name;
};
const fileSizeLimit = 5 * 1024 * 1024; // 5MB
const handleFileLimit = (file: File) => {
if (file) {
if (file.size > fileSizeLimit) {
ElMessage.error({message: `文件大小不能超过${fileSizeLimit / 1024 / 1024}MB`});
return false;
} else {
return true;
}
}
return true;
}
// 对外映射
defineExpose({open})
const props = defineProps<{
refreshTable: (() => Promise<void>) | undefined
}>()
</script>
<style scoped>
.upload-container {
display: flex;
align-items: center;
}
</style>

View File

@@ -0,0 +1,137 @@
<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.device="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
<el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
@click='batchDelete(scope.selectedListIds)'>
删除
</el-button>
</template>
<!-- 表格操作 -->
<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="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除
</el-button>
</template>
</ProTable>
</div>
<ReportPopup :refresh-table='proTable?.getTableList' ref='reportPopup'/>
</template>
<script setup lang='tsx' name='useRole'>
import {type PqReport} from '@/api/device/interface/report.ts'
import {useHandleData} from '@/hooks/useHandleData'
import {useDownload} from '@/hooks/useDownload'
import ProTable from '@/components/ProTable/index.vue'
import {type ColumnProps, type ProTableInstance} from '@/components/ProTable/interface'
import ReportPopup from '@/views/system/template/components/reportPopup.vue'
import {CirclePlus, Delete, Download, EditPen, Upload} from '@element-plus/icons-vue'
import {useDictStore} from '@/stores/modules/dict'
import {getPqReportList,deletePqReport} from '@/api/device/report/index.ts'
import {reactive, ref} from 'vue'
// ProTable 实例
const proTable = ref<ProTableInstance>()
const reportPopup = ref()
const getTableList = async (params: any) => {
let newParams = JSON.parse(JSON.stringify(params))
return getPqReportList(newParams)
}
// 表格配置项
const columns = reactive<ColumnProps<PqReport.ResReport>[]>([
{type: 'selection', fixed: 'left', width: 70},
{type: 'index', fixed: 'left', width: 70, label: '序号'},
{
prop: 'name',
label: '名称',
search: {el: 'input'},
minWidth: 100,
},
{
prop: 'version',
label: '版本号',
minWidth: 80,
},
{
prop: 'baseFile',
label: '基础模板文件路径',
minWidth: 150,
render: scope => {
return scope.row.baseFileVO.url
}
},
{
prop: 'detailFile',
label: '检测项模版文件路径',
minWidth: 150,
render: scope => {
return scope.row.detailFileVO.url
}
},
{
prop:'description',
label: '描述',
minWidth: 150
},
{
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<PqReport.ResReport> = {}) => {
reportPopup.value.open(titleType, row)
}
// 批量删除报告模版
const batchDelete = async (id: string[]) => {
await useHandleData(deletePqReport, id, '删除所选报告模版')
proTable.value?.clearSelection()
proTable.value?.getTableList()
}
// 删除报告模版
const handleDelete = async (params:PqReport.ResReport) => {
await useHandleData(deletePqReport, [params.id], `删除【${params.name}】报告模版`)
proTable.value?.getTableList()
}
</script>

View File

@@ -10,6 +10,7 @@ import vueJsx from "@vitejs/plugin-vue-jsx";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import { nodePolyfills } from 'vite-plugin-node-polyfills';
export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
const root = process.cwd();
@@ -59,6 +60,12 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
dts: false,
// dts: "src/types/components.d.ts",
}),
nodePolyfills({
include: ['crypto'],
globals: {
crypto: true,
},
}),
],
// 基础配置
base: viteEnv.VITE_PUBLIC_PATH,