42 Commits

Author SHA1 Message Date
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
75 changed files with 2182 additions and 999 deletions

View File

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

View File

@@ -13,13 +13,15 @@ export namespace CheckData {
// 装置原始数据-被检值 // 装置原始数据-被检值
data: number, data: number,
// 误差值
errorData: number,
// 第几次谐波 // 第几次谐波
num?: number, num?: number,
//符合、不符合 //符合、不符合
isData?: number, isData?: number,
//最大误差值 //最大误差值
radius?: string, radius?: string,
unit?: string,
} }
/** /**
@@ -50,21 +52,25 @@ export namespace CheckData {
errorA?: string, errorA?: string,
maxErrorA?: string, maxErrorA?: string,
isDataA?: number, isDataA?: number,
unitA?: string,
stdB?: string, stdB?: string,
dataB?: string, dataB?: string,
errorB?: string, errorB?: string,
maxErrorB?: string, maxErrorB?: string,
isDataB?: number, isDataB?: number,
unitB?: string,
stdC?: string, stdC?: string,
dataC?: string, dataC?: string,
errorC?: string, errorC?: string,
maxErrorC?: string, maxErrorC?: string,
isDataC?: number, isDataC?: number,
unitC?: string,
stdT?: string, stdT?: string,
dataT?: string, dataT?: string,
errorT?: string, errorT?: string,
maxErrorT?: string, maxErrorT?: string,
isDataT?: number, isDataT?: number,
unitT?: string,
//最大误差值 //最大误差值
maxError?: string, maxError?: string,
@@ -93,9 +99,9 @@ export namespace CheckData {
planId: string; //计划Id planId: string; //计划Id
devType: string; //设备类型 devType: string; //设备类型
devVolt:number; //设备电压 devVolt: number; //设备电压
devCurr:number; //设备电流 devCurr: number; //设备电流
factorFlag:number; //是否支持系数校准 factorFlag: number; //是否支持系数校准
} }
// 用来描述检测脚本类型 // 用来描述检测脚本类型
@@ -107,7 +113,7 @@ export namespace CheckData {
// 用来描述 检测数据-左侧树结构 // 用来描述 检测数据-左侧树结构
export interface TreeItem { export interface TreeItem {
id:string | null, id: string | null,
scriptTypeName: string | null, scriptTypeName: string | null,
sourceDesc: string | null, sourceDesc: string | null,
harmNum: number | null, harmNum: number | null,
@@ -123,7 +129,8 @@ export namespace CheckData {
SUCCESS = 1, SUCCESS = 1,
FAIL = 2, FAIL = 2,
TIMEOUT = 3, TIMEOUT = 3,
ERRORDATA = 4 ERRORDATA = 4,
NOT_PART_IN_ERROR = 5
} }
export interface DeviceCheckResult { export interface DeviceCheckResult {
@@ -143,8 +150,8 @@ export namespace CheckData {
export enum ButtonColorEnum { export enum ButtonColorEnum {
INFO = '#909399', INFO = '#909399',
LOADING = '#003078', LOADING = 'var(--el-color-primary)',
SUCCESS = '#67c23a', SUCCESS = '#91cc75',
WARNING = '#e6a23c', WARNING = '#e6a23c',
DANGER = '#f56c6c', DANGER = '#f56c6c',
} }
@@ -154,7 +161,7 @@ export namespace CheckData {
*/ */
export interface ButtonResult { export interface ButtonResult {
color: ButtonColorEnum color: ButtonColorEnum
icon: 'Minus' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled' icon: 'More' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled' | 'Minus'
} }
/** /**

View File

@@ -2,7 +2,7 @@ import http from "@/api";
import {CheckData} from "@/api/check/interface"; import {CheckData} from "@/api/check/interface";
export const getBigTestItem = (params: { export const getBigTestItem = (params: {
reCheckType:number, reCheckType: number,
planId: string, planId: string,
devId: string, devId: string,
}) => { }) => {
@@ -31,9 +31,9 @@ export const getTreeData = (params: {
devId?: string, devId?: string,
devNum?: string, devNum?: string,
scriptType?: string | null, 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, scriptId: string,
devId: string, devId: string,
devNum: string, devNum: string,
code: number, code: string,
index: number, index: number,
}) => { }) => {
return http.post("/result/resultData/", params, {loading: false}); return http.post("/result/resultData/", params, {loading: false});
@@ -56,8 +56,44 @@ export const exportRawData = (params: {
scriptId: string, scriptId: string,
devId: string, devId: string,
devNum: string, devNum: string,
code: number, code: string,
index: number, index: number,
}) => { }) => {
return http.download("/result/exportRawData", params, {loading: false}); 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

@@ -1,4 +1,4 @@
import type { Device } from '@/api/device/interface/device' import type {Device} from '@/api/device/interface/device'
import http from '@/api' import http from '@/api'
/** /**
@@ -7,57 +7,65 @@ import http from '@/api'
//获取被检设备 //获取被检设备
export const getPqDevList = (params: Device.ReqPqDevParams) => { export const getPqDevList = (params: Device.ReqPqDevParams) => {
return http.post(`/pqDev/list`, params) return http.post(`/pqDev/list`, params)
} }
//添加被检设备 //添加被检设备
export const addPqDev = (params: Device.ResPqDev) => { export const addPqDev = (params: Device.ResPqDev) => {
return http.post(`/pqDev/add`, params) return http.post(`/pqDev/add`, params)
} }
//编辑被检设备 //编辑被检设备
export const updatePqDev = (params: Device.ResPqDev) => { export const updatePqDev = (params: Device.ResPqDev) => {
return http.post(`/pqDev/update`, params) return http.post(`/pqDev/update`, params)
} }
//删除被检设备 //删除被检设备
export const deletePqDev = (params: string[]) => { export const deletePqDev = (params: string[]) => {
return http.post(`/pqDev/delete`, params) return http.post(`/pqDev/delete`, params)
} }
// export const downloadTemplate = () => { //导出被检设备
// return http.download(`/pqDev/downloadTemplate`) export const exportPqDev = (params: Device.ReqPqDevParams) => {
return http.download(`/pqDev/export`, params)
}
// 下载导入文件模板
export const downloadTemplate = () => {
return http.download(`/pqDev/downloadTemplate`)
}
//导入被检设备
export const importPqDev = (params: Device.ReqPqDevParams) => {
return http.uploadExcel(`/pqDev/import`, params)
}
//导入比对式被检设备
export const importContrastPqDev = (params: Device.ReqPqDevParams) => {
return http.upload(`/pqDev/importContrast`, params)
}
// //导出灿能二楼设备
// export const exportCNDev = (params: Device.ReqPqDevParams) => {
// return http.download(`/pqDev/exportCNDev`, params)
// }
//
// // 下载灿能二楼设备导入文件模板
// export const downloadCNDevTemplate = () => {
// return http.download(`/pqDev/downloadCNDevTemplate`)
// }
//
// //导入灿能二楼设备
// export const importCNDev = (params: Device.ReqPqDevParams) => {
// return http.uploadExcel(`/pqDev/importCNDev`, params)
// } // }
// //导入被检设备(比对)
// export const importPqDev=(params: Device.ReqPqDevParams)=>{
// return http.upload(`/pqDev/import`, params)
// }
// //导入比对式被检设备
// export const importContrastPqDev=(params: Device.ReqPqDevParams)=>{
// return http.upload(`/pqDev/importContrast`, params)
// }
//导出灿能二楼设备
export const exportCNDev = (params: Device.ReqPqDevParams) => {
return http.download(`/pqDev/exportCNDev`, params)
}
// 下载灿能二楼设备导入文件模板
export const downloadCNDevTemplate = () => {
return http.download(`/pqDev/downloadCNDevTemplate`)
}
//导入灿能二楼设备
export const importCNDev = (params: Device.ReqPqDevParams) => {
return http.uploadExcel(`/pqDev/importCNDev`, params)
}
//根据设备类型决定电源、icd、模板、通道数、额定电压、额定电流 //根据设备类型决定电源、icd、模板、通道数、额定电压、额定电流
export const getPqDev = () => { export const getPqDev = () => {
return http.get(`/devType/listAll`) return http.get(`/devType/listAll`)
} }
//被检设备归档 //被检设备归档
export const documentedPqDev = (ids: string[]) => { export const documentedPqDev = (ids: string[]) => {
return http.post(`/pqDev/documented`, ids) return http.post(`/pqDev/documented`, ids)
} }

View File

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

View File

@@ -1,30 +1,32 @@
import type { ReqPage,ResPage } from '@/api/interface' import type {ReqPage, ResPage} from '@/api/interface'
// 被检设备模块 // 被检设备模块
export namespace Device { export namespace Device {
/** /**
* 被检设备表格分页查询参数 * 被检设备表格分页查询参数
*/ */
export interface ReqPqDevParams extends ReqPage{ export interface ReqPqDevParams extends ReqPage {
id: string; // 装置序号id 必填 id: string; // 装置序号id 必填
name: string; //设备名称 name: string; //设备名称
devType?: string; // 设备名称 devType?: string; // 设备名称
createTime?:string; //创建时间 createTime?: string; //创建时间
pattern:string; pattern: string;
} }
/**
* 被检设备表格分页查询参数
*/
export interface ReqDevReportParams extends ReqPage{
planId?:string; // 计划id
devId?:string; // 装置id
}
/** /**
* 被检设备新增、修改、根据id查询返回的对象 * 被检设备表格分页查询参数
*/ */
export interface ReqDevReportParams extends ReqPage {
planId?: string; // 计划id
devId?: string; // 装置id
scriptId?: string; // 脚本id
planCode?: string;
}
/**
* 被检设备新增、修改、根据id查询返回的对象
*/
export interface ResPqDev { export interface ResPqDev {
id: string; //装置序号ID id: string; //装置序号ID
name: string; //设备名称 name: string; //设备名称
@@ -38,54 +40,53 @@ export namespace Device {
createId: string; //出厂编号 createId: string; //出厂编号
hardwareVersion: string; //固件版本 hardwareVersion: string; //固件版本
softwareVersion: string; //软件版本 softwareVersion: string; //软件版本
protocol:string; //通讯协议 protocol: string; //通讯协议
ip: string; //IP地址 ip: string; //IP地址
port: number; //端口号 port: number; //端口号
encryptionFlag: number; //装置是否为加密版本 encryptionFlag: number; //装置是否为加密版本
series?: string| null; //装置识别码3ds加密 series?: string | null; //装置识别码3ds加密
devKey?: string| null; //装置秘钥3ds加密 devKey?: string | null; //装置秘钥3ds加密
sampleID?: string| null; //样品编号 sampleId?: string | null; //样品编号
arrivedDate?: string; //送样日期 arrivedDate?: string; //送样日期
cityName?: string| null; //所属地市名称 cityName?: string | null; //所属地市名称
gDName?: string| null; //所属供电公司名称 gDName?: string | null; //所属供电公司名称
subName?: string| null; //所属电站名称 subName?: string | null; //所属电站名称
checkState?: number| null; //检测状态 checkState?: number | null; //检测状态
checkResult?: number| null; //检测结果 checkResult?: number | null; //检测结果
reportState?: number| null; //报告状态 reportState?: number | null; //报告状态
reportPath?: string| null; //报告路径 reportPath?: string | null; //报告路径
qRCode?: string| null; //设备关键信息二维码 qRCode?: string | null; //设备关键信息二维码
reCheckNum: number; //复检次数 reCheckNum: number; //复检次数
planId?:string;//检测计划Id planId?: string;//检测计划Id
timeCheckResult?:number;//守时检测结果(0:不符合1:符合) timeCheckResult?: number;//守时检测结果(0:不符合1:符合)
factorFlag?:number;//是否支持系数校准(0:不支持,1:支持) factorFlag?: number;//是否支持系数校准(0:不支持,1:支持)
factorCheckResult?: number;//系数校准结果(0:不合格1:合格2/表示没有做系数校准) factorCheckResult?: number;//系数校准结果(0:不合格1:合格2/表示没有做系数校准)
state: number; //状态 state: number; //状态
createBy?: string| null; //创建用户 createBy?: string | null; //创建用户
createTime?: string| null; //创建时间 createTime?: string | null; //创建时间
updateBy?: string| null; //更新用户 updateBy?: string | null; //更新用户
updateTime?: string| null; //更新时间 updateTime?: string | null; //更新时间
icdId: string| null; icdId: string | null;
power: string| null;//工作电源 power: string | null;//工作电源
preinvestmentPlan: string| null; preinvestmentPlan: string | null;
} }
export interface ResDev{ export interface ResDev {
id: string; id: string;
name: string , name: string,
icd:string , icd: string,
power:string, power: string,
devVolt:number, devVolt: number,
devCurr:number, devCurr: number,
devChns:number, devChns: number,
} }
/**
* 被检设备表格查询分页返回的对象;
*/
export interface ResPqDevPage extends ResPage<ResPqDev> {
/** }
* 被检设备表格查询分页返回的对象; }
*/
export interface ResPqDevPage extends ResPage<ResPqDev> {
}
}

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 namespace TestScript {
/**
* 检测脚本表格分页查询参数
/** */
* 检测脚本表格分页查询参数 export interface ReqTestScriptParams extends ReqPage {
*/ id: string // 装置序号id 必填
export interface ReqTestScriptParams extends ReqPage{ name: string
id: string; // 装置序号id 必填 type: string
name: string; pattern: string
type: string; }
pattern:string;
}
// 检测脚本接口 // 检测脚本接口
export interface ResTestScript { export interface ResTestScript {
id?: string; //检测脚本ID id?: string //检测脚本ID
name: string; //检测脚本名称 name: string //检测脚本名称
type: string; //设定0为脚本1为模板 type: string //设定0为脚本1为模板
pattern: string;//检测脚本模式(字典表Code字段数字、模拟、比对) pattern: string //检测脚本模式(字典表Code字段数字、模拟、比对)
valueType?: string;//脚本值类型(字典表Code字段相对值脚本、绝对值脚本、无) valueType?: string //脚本值类型(字典表Code字段相对值脚本、绝对值脚本、无)
standardName: string;//参照标准名称 standardName: string //参照标准名称
standardTime: string;//标准推行时间 standardTime: string //标准推行时间
state?:number;// state?: number //
createBy?: string; createBy?: string
createTime?: string; createTime?: string
updateBy?: string; updateBy?: string
updateTime?: string; updateTime?: string
selectedValue?: string; 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

@@ -84,12 +84,12 @@ class RequestHttp {
} }
} }
// 登陆失效 // 登陆失效
if (data.code == ResultEnum.OVERDUE) { if (data.code === ResultEnum.OVERDUE) {
console.log("登陆失效") console.log("登陆失效")
userStore.setAccessToken('') userStore.setAccessToken('')
userStore.setRefreshToken('') userStore.setRefreshToken('')
userStore.setIsRefreshToken(false) userStore.setIsRefreshToken(false)
userStore.setUserInfo({ name: '' }) userStore.setUserInfo({ id:'',name: '' })
await router.replace(LOGIN_URL) await router.replace(LOGIN_URL)
if(isFirst){//临时处理token失效弹窗多次 if(isFirst){//临时处理token失效弹窗多次
ElMessage.error(data.message) ElMessage.error(data.message)

View File

@@ -22,6 +22,10 @@ export namespace Plan {
createTime?:string; //创建时间 createTime?:string; //创建时间
updateBy?:string; //更新用户 updateBy?:string; //更新用户
updateTime?: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) => { export const exportPlan = (params: Device.ReqPqDevParams) => {
return http.download(`/adPlan/exportCNPlan`, params) return http.download(`/adPlan/export`, params)
} }
// 下载模板 // 下载模板
export const downloadCNPlanTemplate = () => { export const downloadTemplate = () => {
return http.download(`/adPlan/downloadCNPlanTemplate`) return http.download(`/adPlan/downloadTemplate`)
} }
// 导入检测计划 // 导入检测计划
export const importCNPlan = (params: Device.ReqPqDevParams) => { export const importPlan = (params: Device.ReqPqDevParams) => {
return http.uploadExcel(`/adPlan/importCNPlan`, params) return http.uploadExcel(`/adPlan/import`, params)
} }
// 装置检测报告生成 // 装置检测报告生成

View File

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

View File

@@ -5,6 +5,7 @@ export namespace Login {
export interface ReqLoginForm { export interface ReqLoginForm {
username: string; username: string;
password: string; password: string;
checked: boolean;
} }
export interface ResLogin { export interface ResLogin {
accessToken: string; accessToken: string;

View File

@@ -1,40 +1,59 @@
import type { Login } from '@/api/user/interface/user' import type {Login} from '@/api/user/interface/user'
import { ADMIN as rePrefix } from '@/api/system/config/serviceName' import {ADMIN as rePrefix} from '@/api/system/config/serviceName'
import http from '@/api' import http from '@/api'
import type { Dict } from '@/api/interface' import type {Dict} from '@/api/interface'
/** /**
* @name 登录模块 * @name 登录模块
*/ */
// 用户登录 // 用户登录
export const loginApi = (params: Login.ReqLoginForm) => { export const loginApi = (params: { username: string; password: string,checked: boolean }) => {
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false }) return http.post<Login.ResLogin>(`${rePrefix}/login`, params, {loading: false})
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false }) // return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
} }
// 获取菜单列表 // 获取菜单列表
export const getAuthMenuListApi = () => { export const getAuthMenuListApi = () => {
return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, { loading: false }) return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, {loading: false})
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false }) // return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
} }
// 获取按钮权限 // 获取按钮权限
export const getAuthButtonListApi = () => { export const getAuthButtonListApi = () => {
return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, { loading: false }) return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, {loading: false})
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false }) // return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
} }
// 用户退出登录 // 用户退出登录
export const logoutApi = () => { export const logoutApi = () => {
return http.post(`${rePrefix}/logout`) return http.post(`${rePrefix}/logout`)
} }
//获取下拉框列表 //获取下拉框列表
export const getDictList = () =>{ export const getDictList = () => {
return http.get<Dict>('/dictData/dictDataCache') return http.get<Dict>('/dictData/dictDataCache')
} }
//token刷新 //token刷新
export const refreshToken = () => { export const refreshToken = () => {
return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`, return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`,
{}, {},
{ loading: false } {loading: false}
) )
} }
//获取场景
export const getCurrentScene = () => {
return http.get('/sysTestConfig/getCurrentScene', {}, {loading: false})
}
/**
* 获取RSA公钥
*/
export const getPublicKey = (username: string, checked: boolean) => {
return http.get(`/admin/getPublicKey?username=${username}&checked=${checked}`, {}, {loading: false})
}
/**
* 获取是否在检测中自动生成报告
*/
export const getAutoGenerate = () => {
return http.get('/sysTestConfig/getAutoGenerate', {}, {loading: false})
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -30,7 +30,7 @@
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
<p style="margin: 0;"> <p style="margin: 0;" >
<a href="http://www.shining-electric.com/" target="_blank"> <a href="http://www.shining-electric.com/" target="_blank">
2024 © 南京灿能电力自动化股份有限公司 2024 © 南京灿能电力自动化股份有限公司
</a> </a>
@@ -117,10 +117,11 @@ const handelOpen = async (item: string) => {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
text-align: center; text-align: right;
line-height: 40px; line-height: 40px;
a { a {
color: #fff; color: #fff;
margin-right: 25px; // 增加右边距
} }
} }
} }

View File

@@ -18,17 +18,20 @@
</div> </div>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <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-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>
<el-dropdown-item @click="openDialog('passwordRef')"> <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>
<el-dropdown-item @click="changeMode"> <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>
<el-dropdown-item @click="openDialog('versionRegisterRef')"> <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-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
@@ -42,6 +45,9 @@
<PasswordDialog ref="passwordRef"></PasswordDialog> <PasswordDialog ref="passwordRef"></PasswordDialog>
<!-- versionRegisterDialog --> <!-- versionRegisterDialog -->
<VersionDialog ref="versionRegisterRef"></VersionDialog> <VersionDialog ref="versionRegisterRef"></VersionDialog>
<!-- ThemeDialog -->
<ThemeDialog ref="themeRef"></ThemeDialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -50,12 +56,13 @@ import { LOGIN_URL } from "@/config";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { logoutApi } from "@/api/user/login"; import { logoutApi } from "@/api/user/login";
import { useUserStore } from "@/stores/modules/user"; 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 InfoDialog from "./InfoDialog.vue";
import PasswordDialog from "./PasswordDialog.vue"; import PasswordDialog from "./PasswordDialog.vue";
import ThemeDialog from "./ThemeDialog.vue";
import VersionDialog from "@/views/system/versionRegister/index.vue"; import VersionDialog from "@/views/system/versionRegister/index.vue";
import { computed } from "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 AssemblySize from "./components/AssemblySize.vue";
import Language from "./components/Language.vue"; import Language from "./components/Language.vue";
import SearchMenu from "./components/SearchMenu.vue"; import SearchMenu from "./components/SearchMenu.vue";
@@ -72,6 +79,14 @@ const router = useRouter();
const authStore = useAuthStore(); const authStore = useAuthStore();
const modeStore = useModeStore(); const modeStore = useModeStore();
const AppSceneStore = useAppSceneStore(); const AppSceneStore = useAppSceneStore();
import { useTheme } from "@/hooks/useTheme";
import { useI18n } from "vue-i18n";
import {getPublicKey} from "@/api/user/login"; // 引入 vue-i18n 钩子
const { changePrimary} = useTheme();
// 初始化 i18n
const { t } = useI18n(); // 使用 t 方法替代 $t
// 退出登录 // 退出登录
const logout = () => { const logout = () => {
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", { ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
@@ -84,7 +99,7 @@ const logout = () => {
// 2.清除 Token // 2.清除 Token
userStore.setAccessToken(""); userStore.setAccessToken("");
userStore.setRefreshToken(""); userStore.setRefreshToken("");
userStore.setUserInfo({name: ""}); userStore.setUserInfo({id: "", name: ""});
userStore.setIsRefreshToken(false) userStore.setIsRefreshToken(false)
dictStore.setDictData([]); dictStore.setDictData([]);
modeStore.setCurrentMode(''); modeStore.setCurrentMode('');
@@ -101,12 +116,19 @@ const logout = () => {
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null); const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null); const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null); const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null);
const themeRef = ref<InstanceType<typeof ThemeDialog> | null>(null);
const openDialog = (ref: string) => { const openDialog = (ref: string) => {
if (ref == "infoRef") infoRef.value?.openDialog(); if (ref == "infoRef") infoRef.value?.openDialog();
if (ref == "passwordRef") passwordRef.value?.openDialog(); if (ref == "passwordRef") passwordRef.value?.openDialog();
if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog(); if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog();
if (ref == "themeRef") themeRef.value?.openDialog();
}; };
//模式切换 //模式切换
const changeMode = () => { const changeMode = () => {
authStore.changeModel(); 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; // color: var(--el-menu-hover-text-color) !important;
// background-color: transparent !important; // background-color: transparent !important;
color: #fff !important;//一级导航文字选中颜色 color: #fff !important;//一级导航文字选中颜色
background-color: #5274a5 !important; //一级导航选中背景色 //background-color: #5274a5 !important; //一级导航选中背景色
background-color: var(--el-color-primary-light-3) !important;
} }
.el-menu--collapse { .el-menu--collapse {
.is-active { .is-active {
.el-sub-menu__title { .el-sub-menu__title {
color: #ffffff !important; color: #ffffff !important;
// background-color: var(--el-color-primary) !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; border-bottom: 0 !important;
} }
} }
@@ -53,7 +58,9 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
// color: var(--el-menu-active-color) !important; // color: var(--el-menu-active-color) !important;
// background-color: var(--el-menu-active-bg-color) !important; // background-color: var(--el-menu-active-bg-color) !important;
color: #fff !important;//一级导航文字选中颜色 color: #fff !important;//一级导航文字选中颜色
background-color: #5274a5 !important; //一级导航选中背景色 //background-color: #5274a5 !important; //一级导航选中背景色
background-color: var(--el-color-primary-light-3) !important;
&::before { &::before {
position: absolute; position: absolute;
top: 0; top: 0;

View File

@@ -1,23 +1,28 @@
<template> <template>
<div class='tabs-box'> <div class="tabs-box">
<div class='tabs-menu'> <div class="tabs-menu">
<el-tabs v-model='tabsMenuValue' type='card' @tab-click='tabClick' @tab-remove='tabRemove'> <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' <el-tab-pane
:closable='item.close'> v-for="item in tabsMenuList"
<template #label> :key="item.path"
<el-icon v-show='item.icon && tabsIcon' class='tabs-icon'> :label="item.title"
<component :is='item.icon'></component> :name="item.path"
</el-icon> :closable="item.close"
{{ item.title }} >
</template> <template #label>
</el-tab-pane> <el-icon v-show="item.icon && tabsIcon" class="tabs-icon">
</el-tabs> <component :is="item.icon"></component>
<MoreButton /> </el-icon>
{{ item.title }}
</template>
</el-tab-pane>
</el-tabs>
<MoreButton />
</div>
</div> </div>
</div>
</template> </template>
<script setup lang='ts'> <script setup lang="ts">
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
import { ref, computed, watch, onMounted } from 'vue' import { ref, computed, watch, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
@@ -38,79 +43,80 @@ const tabsMenuList = computed(() => tabStore.tabsMenuList)
const tabsIcon = computed(() => globalStore.tabsIcon) const tabsIcon = computed(() => globalStore.tabsIcon)
onMounted(() => { onMounted(() => {
tabsDrop() tabsDrop()
initTabs() initTabs()
}) })
// 监听路由的变化(防止浏览器后退/前进不变化 tabsMenuValue // 监听路由的变化(防止浏览器后退/前进不变化 tabsMenuValue
watch( watch(
() => route.fullPath, () => route.fullPath,
() => { () => {
if (route.meta.isFull) return if (route.meta.isFull) return
if (route.meta.hideTab){ if (route.meta.hideTab) {
tabsMenuValue.value = route.meta.parentPath as string tabsMenuValue.value = route.meta.parentPath as string
}else{ } else {
tabsMenuValue.value = route.fullPath tabsMenuValue.value = route.fullPath
const tabsParams = { const tabsParams = {
icon: route.meta.icon as string, icon: route.meta.icon as string,
title: route.meta.title as string, title: route.meta.title as string,
path: route.fullPath, path: route.fullPath,
name: route.name as string, name: route.name as string,
close: !route.meta.isAffix, close: !route.meta.isAffix,
isKeepAlive: route.meta.isKeepAlive as boolean, isKeepAlive: route.meta.isKeepAlive as boolean
} }
tabStore.addTabs(tabsParams) tabStore.addTabs(tabsParams)
} }
}, },
{ immediate: true }, { immediate: true }
) )
// 初始化需要固定的 tabs // 初始化需要固定的 tabs
const initTabs = () => { const initTabs = () => {
authStore.flatMenuListGet.forEach(item => { authStore.flatMenuListGet.forEach(item => {
if (item.meta.isAffix && !item.meta.isHide && !item.meta.isFull) { if (item.meta.isAffix && !item.meta.isHide && !item.meta.isFull) {
const tabsParams = { const tabsParams = {
icon: item.meta.icon, icon: item.meta.icon,
title: item.meta.title, title: item.meta.title,
path: item.path, path: item.path,
name: item.name, name: item.name,
close: !item.meta.isAffix, close: !item.meta.isAffix,
isKeepAlive: item.meta.isKeepAlive, isKeepAlive: item.meta.isKeepAlive,
unshift:true unshift: true
} }
tabStore.addTabs(tabsParams) tabStore.addTabs(tabsParams)
} }
}) })
} }
// tabs 拖拽排序 // tabs 拖拽排序
const tabsDrop = () => { const tabsDrop = () => {
Sortable.create(document.querySelector('.el-tabs__nav') as HTMLElement, { Sortable.create(document.querySelector('.el-tabs__nav') as HTMLElement, {
draggable: '.el-tabs__item', draggable: '.el-tabs__item',
animation: 300, animation: 300,
onEnd({ newIndex, oldIndex }) { onEnd({ newIndex, oldIndex }) {
const tabsList = [...tabStore.tabsMenuList] const tabsList = [...tabStore.tabsMenuList]
const currRow = tabsList.splice(oldIndex as number, 1)[0] const currRow = tabsList.splice(oldIndex as number, 1)[0]
tabsList.splice(newIndex as number, 0, currRow) tabsList.splice(newIndex as number, 0, currRow)
tabStore.setTabs(tabsList) tabStore.setTabs(tabsList)
}, }
}) })
} }
// Tab Click // Tab Click
const tabClick = (tabItem: TabsPaneContext) => { const tabClick = (tabItem: TabsPaneContext) => {
const fullPath = tabItem.props.name as string const fullPath = tabItem.props.name as string
// console.log("🚀 ~ tabClick ~ fullPath:", tabItem) // console.log("🚀 ~ tabClick ~ fullPath:", tabItem)
router.push(fullPath) router.push(fullPath)
} }
// Remove Tab // Remove Tab
const tabRemove = (fullPath: TabPaneName) => { 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> </script>
<style scoped lang='scss'> <style scoped lang="scss">
@import "./index.scss"; @import './index.scss';
</style> </style>

View File

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

View File

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

View File

@@ -6,60 +6,60 @@ export type LanguageType = 'zh' | 'en' | null;
/* GlobalState */ /* GlobalState */
export interface GlobalState { export interface GlobalState {
layout: LayoutType; layout: LayoutType;
assemblySize: AssemblySizeType; assemblySize: AssemblySizeType;
language: LanguageType; language: LanguageType;
maximize: boolean; maximize: boolean;
primary: string; primary: string;
isDark: boolean; isDark: boolean;
isGrey: boolean; isGrey: boolean;
isWeak: boolean; isWeak: boolean;
asideInverted: boolean; asideInverted: boolean;
headerInverted: boolean; headerInverted: boolean;
isCollapse: boolean; isCollapse: boolean;
accordion: boolean; accordion: boolean;
breadcrumb: boolean; breadcrumb: boolean;
breadcrumbIcon: boolean; breadcrumbIcon: boolean;
tabs: boolean; tabs: boolean;
tabsIcon: boolean; tabsIcon: boolean;
footer: boolean; footer: boolean;
} }
/* UserState */ /* UserState */
export interface UserState { export interface UserState {
accessToken: string; accessToken: string;
refreshToken: string; refreshToken: string;
isRefreshToken: boolean; isRefreshToken: boolean;
userInfo: { name: string }; userInfo: { id: string, name: string };
} }
/* tabsMenuProps */ /* tabsMenuProps */
export interface TabsMenuProps { export interface TabsMenuProps {
icon: string; icon: string;
title: string; title: string;
path: string; path: string;
name: string; name: string;
close: boolean; close: boolean;
isKeepAlive: boolean; isKeepAlive: boolean;
unshift?: boolean; unshift?: boolean;
} }
/* TabsState */ /* TabsState */
export interface TabsState { export interface TabsState {
tabsMenuList: TabsMenuProps[]; tabsMenuList: TabsMenuProps[];
} }
/* AuthState */ /* AuthState */
export interface AuthState { export interface AuthState {
routeName: string; routeName: string;
authButtonList: { authButtonList: {
[key: string]: string[]; [key: string]: string[];
}; };
authMenuList: Menu.MenuOptions[]; authMenuList: Menu.MenuOptions[];
showMenuFlag: boolean; showMenuFlag: boolean;
} }
/* KeepAliveState */ /* KeepAliveState */
export interface KeepAliveState { export interface KeepAliveState {
keepAliveName: string[]; keepAliveName: string[];
} }

View File

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

View File

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

View File

@@ -9,7 +9,7 @@ export const useUserStore = defineStore({
accessToken: "", accessToken: "",
refreshToken: "", refreshToken: "",
isRefreshToken:false, isRefreshToken:false,
userInfo: { name: "admin" }, userInfo: {id:"", name: "admin" },
}), }),
getters: {}, getters: {},
actions: { actions: {
@@ -26,7 +26,7 @@ export const useUserStore = defineStore({
// Set setUserInfo // Set setUserInfo
setUserInfo(userInfo: UserState["userInfo"]) { setUserInfo(userInfo: UserState["userInfo"]) {
this.userInfo = userInfo; this.userInfo = userInfo;
}, }
}, },
persist: piniaPersistConfig(USER_STORE_KEY), persist: piniaPersistConfig(USER_STORE_KEY),
}); });

View File

@@ -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 { .el-table__cell {
border-right: 1px solid #ebeef5 !important; border-right: 1px solid #ebeef5 !important;

View File

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

View File

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

View File

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

View File

@@ -7,7 +7,7 @@
<div>{{ outputDsc }}</div> <div>{{ outputDsc }}</div>
<div> <div>
<span style=" font-size: 18px;font-weight: 600;"> <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> </span>
<!-- <el-button type="primary" loading <!-- <el-button type="primary" loading
@@ -98,6 +98,9 @@ import { getCoefficientCheck } from '@/api/home/channelsTest/index'
import type { ChannelsTest } from '@/api/home/interface/channelsTest'; import type { ChannelsTest } from '@/api/home/interface/channelsTest';
import type { Plan } from '@/api/plan/interface'; import type { Plan } from '@/api/plan/interface';
import { fa } from 'element-plus/es/locale'; import { fa } from 'element-plus/es/locale';
import {useUserStore} from "@/stores/modules/user";
const activeIndex = ref(0) const activeIndex = ref(0)
const activeTotalNum = ref(4) const activeTotalNum = ref(4)
const qualified = ref(0) const qualified = ref(0)
@@ -136,7 +139,7 @@ const props = defineProps({
default: () => ({}) default: () => ({})
} }
}) })
const userStore = useUserStore()
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]); const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish'); const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
const webMsgSend = toRef(props, 'webMsgSend'); const webMsgSend = toRef(props, 'webMsgSend');
@@ -726,7 +729,10 @@ const updateErrorState = (index: number, hasError: boolean) => {
(e: 'submitClicked', callback: (resolve: (value: boolean) => void) => void): void; (e: 'submitClicked', callback: (resolve: (value: boolean) => void) => void): void;
}>(); }>();
const handleCancel=() => { const handleCancel=() => {
//dataSocket.socketServe.closeWs()
// 清空 name, channel, total // 清空 name, channel, total
name.value = []; name.value = [];
channel.value = []; channel.value = [];
@@ -782,9 +788,10 @@ const handleSubmit = async () => {
userPageId: "cdf", userPageId: "cdf",
devIds:devIdArray.value, devIds:devIdArray.value,
planId:planId.value, planId:planId.value,
errorSysId: select_Plan.value?.errorSysId, errorSysId:select_Plan.value?.errorSysId,
     scriptId: select_Plan.value?.scriptId, scriptId:select_Plan.value?.scriptId,
operateType:'0' // '0'为预检测、1为正式检测 operateType:'0', // '0'为预检测、1为正式检测
userId:userStore.userInfo.id
}) })
active.value++; active.value++;

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" loading v-if="activeIndex > 0 && activeIndex < activeTotalNum">合格92项/共103项</el-button>
<el-button type="primary" v-if="activeIndex >= activeTotalNum" disabled>合格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=" 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> </span>
</div> </div>
<div class="dialog-content"> <div class="dialog-content">
<el-table :data="tableData" :cell-class-name="tableCell" row-key="id" height="450px" <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> border>
<el-table-column fixed prop="scriptItemName" label="检测项目" width="210px" /> <el-table-column fixed prop="scriptItemName" label="检测项目" width="210px" />
<el-table-column label="被检通道1" :min-width="minwidth" align="center"> <el-table-column label="被检通道1" :min-width="minwidth" align="center">

View File

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

View File

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

View File

@@ -8,7 +8,8 @@
<el-input v-model='formContent.scriptName' :disabled="true"/> <el-input v-model='formContent.scriptName' :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="误差体系"> <el-form-item label="误差体系">
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="checkStore.showDetailType===0"> <el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="checkStore.showDetailType===0"
@change="handleErrorSysChange">
<el-option <el-option
v-for="(option) in pqErrorList" v-for="(option) in pqErrorList"
:key="option.id" :key="option.id"
@@ -27,8 +28,11 @@
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/> <el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label=" "> <el-form-item v-if="checkStore.showDetailType===1">
<el-button type="primary" :icon="Postcard" v-if="checkStore.showDetailType===1" @click="handleGenerateReport">报告生成</el-button> <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-item>
</el-form> </el-form>
</div> </div>
@@ -107,10 +111,12 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
import {CheckData} from "@/api/check/interface"; import {CheckData} from "@/api/check/interface";
import {useDictStore} from "@/stores/modules/dict"; import {useDictStore} from "@/stores/modules/dict";
import {useCheckStore} from "@/stores/modules/check"; import {useCheckStore} from "@/stores/modules/check";
import {exportRawData, getFormData, getTableData, getTreeData} from "@/api/check/test"; import {changeErrorSystem, deleteTempTable, exportRawData, getFormData, getTableData, getTreeData, reCalculate} from "@/api/check/test";
import {getPqErrSysList} from '@/api/plan/plan' import {getPqErrSysList} from '@/api/plan/plan'
import {useDownload} from "@/hooks/useDownload"; 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<{ const {appendToBody} = withDefaults(defineProps<{
appendToBody: boolean appendToBody: boolean
@@ -143,8 +149,9 @@ const formContent = reactive<CheckData.DataCheck>({
deviceName: '', deviceName: '',
chnNum: '', chnNum: '',
}) })
// 当前选中的谐波次数 // 原始误差体系id
// const currentHarmNum = ref<string>("-1") let originErrorSysId: string = ''
let planCode: string = ''
// 谐波次数列表 // 谐波次数列表
// const harmNumList = reactive<{ value: string, label: string }[]>([]) // const harmNumList = reactive<{ value: string, label: string }[]>([])
// 当前选中的检测项 // 当前选中的检测项
@@ -212,38 +219,61 @@ const handleNodeClick = async (data: any) => {
} }
}; };
watch(() => formContent.errorSysId, async (newVal, oldVal) => { const handleErrorSysChange = async () => {
if (newVal != '') { console.log("切换误差体系", formContent.errorSysId);
console.log("切换误差体系"); changeErrorSystem({
formContent.chnNum = chnList[0].value 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) => { watch(() => formContent.chnNum, async (newVal, oldVal) => {
// console.log("通道号", newVal); // console.log("通道号", newVal);
if (newVal != '') { if (newVal != '') {
// 发起请求,查询该测试项的检测结果 handleChnNumChange()
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
scriptId: checkStore.plan.scriptId,
devId: deviceId,
devNum: formContent.chnNum + '',
scriptType: originScriptType,
code: parseInt(checkStore.plan.code)
})
updateTreeFly(resTreeDataTemp, 4)
updateTreeFly(resTreeDataTemp, 2)
treeDataAll.length = 0
Object.assign(treeDataAll, resTreeDataTemp)
defaultOperate()
await updateTableData()
} }
activeTab.value = 'resultTab'
}) })
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: planCode
})
updateTreeFly(resTreeDataTemp, 4)
updateTreeFly(resTreeDataTemp, 2)
treeDataAll.length = 0
Object.assign(treeDataAll, resTreeDataTemp)
defaultOperate()
await updateTableData()
activeTab.value = 'resultTab'
}
// watch(currentHarmNum, (newVal, oldVal) => { // watch(currentHarmNum, (newVal, oldVal) => {
// console.log("谐波次数", newVal); // console.log("谐波次数", newVal);
@@ -301,7 +331,7 @@ const updateTableData = async () => {
scriptId: checkStore.plan.scriptId, scriptId: checkStore.plan.scriptId,
devId: deviceId, devId: deviceId,
devNum: formContent.chnNum + '', devNum: formContent.chnNum + '',
code: parseInt(checkStore.plan.code), code: planCode,
index: parseInt(checkIndex.value), index: parseInt(checkIndex.value),
}) })
@@ -341,7 +371,8 @@ const updateTableData = async () => {
setCheckResultData(resCheckResult) setCheckResultData(resCheckResult)
setRawData(resRawData) setRawData(resRawData)
checkList.length = 0 checkList.length = 0
checkList.push({value: keys1[0], label: resCheckResult.isData === 1? `${keys1[0]}`:resCheckResult.isData === 4? `${keys1[0]}/` :`${keys1[0]}(不符合)`}) let key = formatHarmNum(keys1[0])
checkList.push({value: keys1[0], label: resCheckResult.isData === 1 ? `${key}` : resCheckResult.isData === 4 ? `${key}/` : resCheckResult.isData === 5? `${key}-`:`${key}(不符合)`})
if (currentCheckItem.value == checkList[0].value) { if (currentCheckItem.value == checkList[0].value) {
doCurrentCheckItemUpdate(checkList[0].value) doCurrentCheckItemUpdate(checkList[0].value)
} else { } else {
@@ -353,7 +384,7 @@ const updateTableData = async () => {
let hum = formatHarmNum(key) let hum = formatHarmNum(key)
tempCheckList.push({ tempCheckList.push({
value: key, value: key,
label: value.isData === 1 ? hum : value.isData === 4 ? `${hum}/` : `${hum}(不符合)` label: value.isData === 1 ? `${hum}`: value.isData === 4 ? `${hum}/` : value.isData === 5? `${hum}-`:`${hum}(不符合)`
}) })
} }
@@ -391,6 +422,7 @@ const doCurrentCheckItemUpdate = (newVal: string) => {
} }
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => { const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
planCode = checkStore.plan.code + ''
deviceId = _deviceId deviceId = _deviceId
originScriptType = _scriptType originScriptType = _scriptType
scriptType = _scriptType scriptType = _scriptType
@@ -416,6 +448,7 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
dataRule: dataRuleName, dataRule: dataRuleName,
chnNum: chnList.length > 0 ? chnList[0].value : '', chnNum: chnList.length > 0 ? chnList[0].value : '',
}) })
originErrorSysId = formContent.errorSysId
pqErrorList.length = 0 pqErrorList.length = 0
let {data: resPqErrorList} = await getPqErrSysList() let {data: resPqErrorList} = await getPqErrSysList()
@@ -428,7 +461,29 @@ const handleGenerateReport = () => {
console.log("生成报告", checkStore.plan.id, deviceId) console.log("生成报告", checkStore.plan.id, deviceId)
} }
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, { Object.assign(formContent, {
scriptName: '', scriptName: '',
@@ -450,8 +505,13 @@ const close = () => {
currentScriptTypeName.value = '' currentScriptTypeName.value = ''
currentDesc.value = '' currentDesc.value = ''
pqErrorList.length = 0 pqErrorList.length = 0
planCode = ''
visible.value = false; visible.value = false;
if (checkStore.showDetailType === 1) {
await deleteTempTable(checkStore.plan.code + '')
}
}; };
const setCheckResultData = (data: CheckData.ResCheckResult | null) => { const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
@@ -465,19 +525,22 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
result.push({ result.push({
stdA: numberToFixed(data.dataA.resultData), stdA: numberToFixed(data.dataA.resultData),
dataA: numberToFixed(data.dataA.data), dataA: numberToFixed(data.dataA.data),
errorA: getError(data.dataA.resultData, data.dataA.data), errorA: numberToFixed(data.dataA.errorData),
maxErrorA: toMaxErrorStr(data.dataA.radius, data.unit), maxErrorA: toMaxErrorStr(data.dataA.radius, data.dataA.unit),
unitA: data.dataA.unit,
isDataA: data.dataA.isData, isDataA: data.dataA.isData,
stdB: numberToFixed(data.dataB.resultData), stdB: numberToFixed(data.dataB.resultData),
dataB: numberToFixed(data.dataB.data), dataB: numberToFixed(data.dataB.data),
errorB: getError(data.dataB.resultData, data.dataB.data), errorB: numberToFixed(data.dataB.errorData),
maxErrorB: toMaxErrorStr(data.dataB.radius, data.unit), maxErrorB: toMaxErrorStr(data.dataB.radius, data.dataB.unit),
isDataB: data.dataB.isData, isDataB: data.dataB.isData,
unitB: data.dataB.unit,
stdC: numberToFixed(data.dataC.resultData), stdC: numberToFixed(data.dataC.resultData),
dataC: numberToFixed(data.dataC.data), dataC: numberToFixed(data.dataC.data),
errorC: getError(data.dataC.resultData, data.dataC.data), errorC: numberToFixed(data.dataC.errorData),
maxErrorC: toMaxErrorStr(data.dataC.radius, data.unit), maxErrorC: toMaxErrorStr(data.dataC.radius, data.dataC.unit),
isDataC: data.dataC.isData, isDataC: data.dataC.isData,
unitC: data.dataC.unit,
maxError: data.radius, maxError: data.radius,
unit: data.unit, unit: data.unit,
@@ -489,9 +552,10 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
result.push({ result.push({
stdT: numberToFixed(data.dataT.resultData), stdT: numberToFixed(data.dataT.resultData),
dataT: numberToFixed(data.dataT.data), dataT: numberToFixed(data.dataT.data),
errorT: getError(data.dataT.resultData, data.dataT.data), errorT: numberToFixed(data.dataT.errorData),
maxErrorT: toMaxErrorStr(data.dataT.radius, data.unit), maxErrorT: toMaxErrorStr(data.dataT.radius, data.dataT.unit),
isDataT: data.dataT?.isData, isDataT: data.dataT?.isData,
unitT: data.dataT.unit,
maxError: data.radius, maxError: data.radius,
unit: data.unit, unit: data.unit,
@@ -507,7 +571,7 @@ const exportRawDataHandler = () => {
scriptId: checkStore.plan.scriptId, scriptId: checkStore.plan.scriptId,
devId: deviceId, devId: deviceId,
devNum: formContent.chnNum + '', devNum: formContent.chnNum + '',
code: parseInt(checkStore.plan.code), code: checkStore.plan.code + '',
index: parseInt(checkIndex.value), index: parseInt(checkIndex.value),
}, false, '.xlsx') }, false, '.xlsx')
} }
@@ -776,7 +840,7 @@ defineExpose({
<!--.el-popover.popover-class {--> <!--.el-popover.popover-class {-->
<!-- .el-popover__title {--> <!-- .el-popover__title {-->
<!-- color: #fff;--> <!-- color: #fff;-->
<!-- background-color: #003078 !important;--> <!-- background-color: var(--el-color-primary) !important;-->
<!-- }--> <!-- }-->
<!--}--> <!--}-->
<!--</style>--> <!--</style>-->

View File

@@ -6,7 +6,7 @@
<div>{{ outputDsc }}</div> <div>{{ outputDsc }}</div>
<div> <div>
<span style=" font-size: 18px;font-weight: 600;"> <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> </span>
<!-- <el-button type="primary" loading <!-- <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 {ChannelsTest} from '@/api/home/interface/channelsTest';
import type {Plan} from '@/api/plan/interface'; import type {Plan} from '@/api/plan/interface';
import {useCheckStore} from "@/stores/modules/check"; import {useCheckStore} from "@/stores/modules/check";
import {useUserStore} from "@/stores/modules/user";
const checkStore = useCheckStore() const checkStore = useCheckStore()
const activeIndex = ref(0) const activeIndex = ref(0)
@@ -143,7 +144,7 @@ const props = defineProps({
default: () => ({}) default: () => ({})
}, },
}) })
const userStore = useUserStore()
const testStatus = toRef(props, 'testStatus'); const testStatus = toRef(props, 'testStatus');
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]); const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish'); const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
@@ -720,7 +721,8 @@ const handleSubmit = async () => {
planId: planId.value, planId: planId.value,
errorSysId: select_Plan.value?.errorSysId, errorSysId: select_Plan.value?.errorSysId,
scriptId: select_Plan.value?.scriptId, scriptId: select_Plan.value?.scriptId,
operateType: '0' // '0'为预检测、1为正式检测 operateType: '0', // '0'为预检测、1为正式检测
userId:userStore.userInfo.id
}) })
active.value++; active.value++;

View File

@@ -27,7 +27,7 @@
<div class="tabs-title "> <div class="tabs-title ">
<el-button type="primary" :icon="Download" >报告下载</el-button> <el-button type="primary" :icon="Download" >报告下载</el-button>
<span style=" font-size: 18px;font-weight: 600;"> <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> </span>
</div> </div>

View File

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

View File

@@ -938,6 +938,7 @@ const handleTest = async (val: string) => {
dialogTitle.value = val dialogTitle.value = val
if (val === '手动检测') { if (val === '手动检测') {
checkStore.setShowDetailType(2)
if (testType === 'reTest') { if (testType === 'reTest') {
ElMessageBox.confirm('请选择复检检测方式', '设备复检', ElMessageBox.confirm('请选择复检检测方式', '设备复检',
@@ -988,6 +989,7 @@ const handleTest = async (val: string) => {
channelsTest.value?.open(channelsSelection.value, props.plan) channelsTest.value?.open(channelsSelection.value, props.plan)
return return
} else { } else {
checkStore.setShowDetailType(2)
checkStore.setCheckType(1) checkStore.setCheckType(1)
checkStore.initSelectTestItems() checkStore.initSelectTestItems()
// 一键检测 // 一键检测
@@ -1062,7 +1064,7 @@ const openDrawer = async (title: string, row: any) => {
if (title === '报告生成') { if (title === '报告生成') {
await generateDevReport({'planId': checkStore.plan.id, 'devId': row.id}) await generateDevReport({'planId': checkStore.plan.id, 'devId': row.id,'scriptId':checkStore.plan.scriptId,'planCode':checkStore.plan.code+''})
emit('batchGenerateClicked') // 触发事件 emit('batchGenerateClicked') // 触发事件
ElMessage.success({message: `报告生成成功!`}) ElMessage.success({message: `报告生成成功!`})
} }
@@ -1140,7 +1142,7 @@ onBeforeMount(async () => {
const handleQuitClicked = () => { const handleQuitClicked = () => {
//console.log('handleQuitClicked') //console.log('handleQuitClicked')
//dataSocket.socketServe.closeWs() dataSocket.socketServe.closeWs()
emit('batchGenerateClicked') // 触发事件 emit('batchGenerateClicked') // 触发事件
} }

View File

@@ -1,7 +1,7 @@
<template> <template>
<el-table <el-table
:data="tableData" :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="date" label="Date" width="180" />
<el-table-column prop="name" label="Name" width="180" /> <el-table-column prop="name" label="Name" width="180" />

View File

@@ -9,73 +9,73 @@
<span>检测用时{{ timeView }}</span> <span>检测用时{{ timeView }}</span>
</div> </div>
<el-progress <el-progress
style="width: 60%; margin-right: 4%;" style="width: 82%; margin-right: 3%;"
:percentage="percentage" :percentage="percentage"
:color="customColors"/> :color="customColors"/>
<div style="width: 15%"> <!-- <div style="width: 15%">-->
<el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()"> <!-- <el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">-->
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;"> <!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
<component :is="Refresh"/> <!-- <component :is="Refresh"/>-->
</el-icon> <!-- </el-icon>-->
初始化中 <!-- 初始化中-->
</el-button> <!-- </el-button>-->
<el-button <!-- <el-button-->
type="primary" <!-- type="primary"-->
v-if="testStatus=='process' && percentage < 100" <!-- v-if="testStatus=='process' && percentage < 100"-->
:icon="VideoPause" <!-- :icon="VideoPause"-->
@click="handlePause()">停止检测 <!-- @click="handlePause()">停止检测-->
</el-button> <!-- </el-button>-->
<el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled> <!-- <el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>-->
<el-icon class="loading-box" style="margin-right: 8px;"> <!-- <el-icon class="loading-box" style="margin-right: 8px;">-->
<component :is="Refresh"/> <!-- <component :is="Refresh"/>-->
</el-icon> <!-- </el-icon>-->
暂停中 <!-- 暂停中-->
</el-button> <!-- </el-button>-->
<!-- <el-button--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- type="primary"--> <!-- &lt;!&ndash; type="primary"&ndash;&gt;-->
<!-- v-if="testStatus=='test_init'"--> <!-- &lt;!&ndash; v-if="testStatus=='test_init'"&ndash;&gt;-->
<!-- :icon="VideoPause"--> <!-- &lt;!&ndash; :icon="VideoPause"&ndash;&gt;-->
<!-- disabled>初始化中--> <!-- &lt;!&ndash; disabled>初始化中&ndash;&gt;-->
<!-- </el-button>--> <!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- <el-button--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- type="danger"--> <!-- &lt;!&ndash; type="danger"&ndash;&gt;-->
<!-- v-if="testStatus=='test_init_fail'"--> <!-- &lt;!&ndash; v-if="testStatus=='test_init_fail'"&ndash;&gt;-->
<!-- :icon="Failed"--> <!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;-->
<!-- disabled>初始化失败--> <!-- &lt;!&ndash; disabled>初始化失败&ndash;&gt;-->
<!-- </el-button>--> <!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- <el-button--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- type="danger"--> <!-- &lt;!&ndash; type="danger"&ndash;&gt;-->
<!-- v-if="testStatus=='connect_timeout'"--> <!-- &lt;!&ndash; v-if="testStatus=='connect_timeout'"&ndash;&gt;-->
<!-- :icon="Failed"--> <!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;-->
<!-- disabled>连接超时--> <!-- &lt;!&ndash; disabled>连接超时&ndash;&gt;-->
<!-- </el-button>--> <!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- <el-button--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- type="primary"--> <!-- &lt;!&ndash; type="primary"&ndash;&gt;-->
<!-- :icon="RefreshLeft"--> <!-- &lt;!&ndash; :icon="RefreshLeft"&ndash;&gt;-->
<!-- v-if="testStatus === 'recheck'"--> <!-- &lt;!&ndash; v-if="testStatus === 'recheck'"&ndash;&gt;-->
<!-- @click="emit('sendReCheck')">重新检测--> <!-- &lt;!&ndash; @click="emit('sendReCheck')">重新检测&ndash;&gt;-->
<!-- </el-button>--> <!-- &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 <!-- <el-button-->
type="warning" <!-- type="warning"-->
v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100" <!-- v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"-->
:icon="VideoPlay" <!-- :icon="VideoPlay"-->
:disabled="testStatus === 'pause_timeout'" <!-- :disabled="testStatus === 'pause_timeout'"-->
@click="emit('sendResume')" <!-- @click="emit('sendResume')"-->
>继续检测 <!-- >继续检测-->
</el-button> <!-- </el-button>-->
</div> <!-- </div>-->
<el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button> <el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
</div> </div>
<div class="dialog-content"> <div class="dialog-content">
<el-table :data="checkResultView" row-key="scriptType" height="450px" <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> border>
<el-table-column fixed prop="scriptName" label="检测项目" width="150px" align="center"> <el-table-column fixed prop="scriptName" label="检测项目" width="150px" align="center">
</el-table-column> </el-table-column>
@@ -168,6 +168,9 @@ import {CheckData} from "@/api/check/interface"
import {useCheckStore} from "@/stores/modules/check"; import {useCheckStore} from "@/stores/modules/check";
import {ElMessage, ElMessageBox} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus";
import {getBigTestItem} from "@/api/check/test"; import {getBigTestItem} from "@/api/check/test";
import {getAutoGenerate} from "@/api/user/login";
import {generateDevReport} from "@/api/plan/plan";
const checkStore = useCheckStore() const checkStore = useCheckStore()
@@ -196,7 +199,7 @@ const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause',
// 用来保存测试项进度抽屉是否打开 // 用来保存测试项进度抽屉是否打开
const drawer = ref(false) const drawer = ref(false)
// 进度条颜色 // 进度条颜色
const customColors = [{color: "#67c23a", percentage: 100}] const customColors = [{color: "#91cc75", percentage: 100}]
// 检测脚本数据 // 检测脚本数据
let scriptData: CheckData.ScriptItem[] = [] let scriptData: CheckData.ScriptItem[] = []
// 用来保存被检设备 // 用来保存被检设备
@@ -254,7 +257,7 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
for (let j = 0; j < device.chnResult.length; j++) { for (let j = 0; j < device.chnResult.length; j++) {
switch (device.chnResult[j]) { switch (device.chnResult[j]) {
case CheckData.ChnCheckResultEnum.UNKNOWN: case CheckData.ChnCheckResultEnum.UNKNOWN:
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'}) tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'More'})
break; break;
case CheckData.ChnCheckResultEnum.LOADING: case CheckData.ChnCheckResultEnum.LOADING:
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'}) tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
@@ -271,6 +274,9 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
case CheckData.ChnCheckResultEnum.ERRORDATA: case CheckData.ChnCheckResultEnum.ERRORDATA:
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'}) tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
break; break;
case CheckData.ChnCheckResultEnum.NOT_PART_IN_ERROR:
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
break;
default: default:
break; break;
} }
@@ -684,12 +690,19 @@ const handleEndItem = (code: string, desc: string | undefined, devices: CheckDat
} }
// 更新进度条 // 更新进度条
const updatePercentage = () => { const updatePercentage = async () => {
if (activeIndex < checkTotal) { if (activeIndex < checkTotal) {
percentage.value = Math.trunc(activeIndex / checkTotal * 100); percentage.value = Math.trunc(activeIndex / checkTotal * 100);
} else { } else {
percentage.value = 100; percentage.value = 100;
emit('update:testStatus', 'success') 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('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', { ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
confirmButtonText: '确定', confirmButtonText: '确定',
}) })
@@ -1117,7 +1130,7 @@ const handleClick = (item: any, chnNum: number, scriptType: string) => {
}) })
} }
if (flag === -1 || flag === 1) { if (flag === -1 || flag === 1) {
checkStore.setShowDetailType(0) checkStore.setShowDetailType(2)
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType); dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType);
} }
}; };
@@ -1243,7 +1256,7 @@ const startTimer = () => {
} }
}; };
const handlePause = () => { const handlePause = () => {
emit('sendPause') //emit('sendPause')
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`}) testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`})
} }
@@ -1424,10 +1437,15 @@ const secondToTime = (second: number) => {
} }
onBeforeUnmount(() => { onBeforeUnmount(() => {
if (timer) { if (timer) {
clearInterval(timer) clearInterval(timer)
} }
}) })
defineExpose({
handlePause
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -1479,8 +1497,7 @@ onBeforeUnmount(() => {
.timeView { .timeView {
display: flex; display: flex;
align-items: center; align-items: center;
color: #91cc75;
color: #67c23a;;
width: 28%; width: 28%;
margin-right: 0px; margin-right: 0px;
text-align: left; text-align: left;
@@ -1514,8 +1531,7 @@ onBeforeUnmount(() => {
.drawer-container { .drawer-container {
:deep(header.el-drawer__header) { :deep(header.el-drawer__header) {
color: #fff !important; color: #fff !important;
background-color: #003078 !important; background-color: var(--el-color-primary) !important;
.el-drawer__close-btn svg:hover { .el-drawer__close-btn svg:hover {
color: #ccc !important; color: #ccc !important;
} }
@@ -1541,7 +1557,7 @@ onBeforeUnmount(() => {
//:deep(.el-drawer .el-drawer__title){ //:deep(.el-drawer .el-drawer__title){
// background-color: #003078 !important; // background-color: var(--el-color-primary) !important;
//} //}
</style> </style>

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,7 +9,7 @@
<el-input v-model='loginForm.username' placeholder='用户名'> <el-input v-model='loginForm.username' placeholder='用户名'>
<template #prefix> <template #prefix>
<el-icon class='el-input__icon'> <el-icon class='el-input__icon'>
<user /> <user/>
</el-icon> </el-icon>
</template> </template>
</el-input> </el-input>
@@ -24,11 +24,14 @@
> >
<template #prefix> <template #prefix>
<el-icon class='el-input__icon'> <el-icon class='el-input__icon'>
<lock /> <lock/>
</el-icon> </el-icon>
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop='checked'>
<el-checkbox v-model="loginForm.checked">记住我</el-checkbox>
</el-form-item>
</el-form> </el-form>
<div class='login-btn'> <div class='login-btn'>
<el-button <el-button
@@ -53,21 +56,22 @@
</template> </template>
<script setup lang='ts'> <script setup lang='ts'>
import { useRouter } from 'vue-router' import {useRouter} from 'vue-router'
import { HOME_URL } from '@/config' import {HOME_URL} from '@/config'
import { getTimeState } from '@/utils' import {getTimeState} from '@/utils'
import { type Dict } from '@/api/interface' import {type Dict} from '@/api/interface'
import { type Login } from '@/api/user/interface/user' import {type Login} from '@/api/user/interface/user'
import { ElNotification } from 'element-plus' import type {ElForm} from 'element-plus'
import { getDictList, loginApi } from '@/api/user/login' import {ElNotification} from 'element-plus'
import { useUserStore } from '@/stores/modules/user' import {getDictList, getPublicKey, loginApi} from '@/api/user/login'
import { useTabsStore } from '@/stores/modules/tabs' import {useUserStore} from '@/stores/modules/user'
import { useKeepAliveStore } from '@/stores/modules/keepAlive' import {useTabsStore} from '@/stores/modules/tabs'
import { initDynamicRouter } from '@/routers/modules/dynamicRouter' import {useKeepAliveStore} from '@/stores/modules/keepAlive'
import { CircleClose, UserFilled } from '@element-plus/icons-vue' import {initDynamicRouter} from '@/routers/modules/dynamicRouter'
import { useAuthStore } from '@/stores/modules/auth' import {CircleClose, UserFilled} from '@element-plus/icons-vue'
import type { ElForm } from 'element-plus' import {useAuthStore} from '@/stores/modules/auth'
import {useDictStore} from "@/stores/modules/dict"; import {useDictStore} from "@/stores/modules/dict";
import forge from 'node-forge'
const authStore = useAuthStore() const authStore = useAuthStore()
const router = useRouter() const router = useRouter()
@@ -76,19 +80,22 @@ const tabsStore = useTabsStore()
const keepAliveStore = useKeepAliveStore() const keepAliveStore = useKeepAliveStore()
const dictStore = useDictStore() const dictStore = useDictStore()
const isAutoLogin = ref(false)
let publicKey: any = null;
type FormInstance = InstanceType<typeof ElForm>; type FormInstance = InstanceType<typeof ElForm>;
const loginFormRef = ref<FormInstance>() const loginFormRef = ref<FormInstance>()
const loginRules = reactive({ const loginRules = reactive({
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }], username: [{required: true, message: '请输入用户名', trigger: 'blur'}],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }], password: [{required: true, message: '请输入密码', trigger: 'blur'}],
}) })
const loading = ref(false) const loading = ref(false)
const loginForm = reactive<Login.ReqLoginForm>({ const loginForm = reactive<Login.ReqLoginForm>({
username: '', username: '',
password: '', password: '',
checked: false,
}) })
// login // login
@@ -98,11 +105,28 @@ const login = (formEl: FormInstance | undefined) => {
if (!valid) return if (!valid) return
loading.value = true loading.value = true
try { try {
if (!isAutoLogin.value) {
let {data: publicKeyBase64}: { data: string } = await getPublicKey(loginForm.username, loginForm.checked)
//将base64格式的公钥转换为Forge可以使用的格式
const publicKeyDer = forge.util.decode64(publicKeyBase64);
publicKey = forge.pki.publicKeyFromPem(forge.pki.publicKeyToPem(forge.pki.publicKeyFromAsn1(forge.asn1.fromDer(publicKeyDer))));
}
// 1.执行登录接口 // 1.执行登录接口
const { data } = await loginApi({ const {data} = await loginApi({
...loginForm, username: forge.util.encode64(loginForm.username),
password: loginForm.password, password: isAutoLogin.value ? loginForm.password : encryptPassword(loginForm.password),
checked: loginForm.checked
}) })
if (loginForm.checked) {
localStorage.setItem("loginInfo", JSON.stringify({
username: forge.util.encode64(loginForm.username),
password: isAutoLogin.value ? loginForm.password : encryptPassword(loginForm.password),
exp: Date.now() + 1000 * 60 * 60 * 24 * 30
}))
} else {
localStorage.removeItem("loginInfo")
}
userStore.setAccessToken(data.accessToken) userStore.setAccessToken(data.accessToken)
userStore.setRefreshToken(data.refreshToken) userStore.setRefreshToken(data.refreshToken)
userStore.setUserInfo(data.userInfo) userStore.setUserInfo(data.userInfo)
@@ -148,6 +172,27 @@ onMounted(() => {
} }
} }
}) })
const encryptPassword = (password: string) => {
const encrypted = publicKey.encrypt(password, 'RSAES-PKCS1-V1_5');
// 将加密后的数据转换为base64格式以便传输
return forge.util.encode64(encrypted);
}
onBeforeMount(async () => {
let loginInfoJSON = localStorage.getItem("loginInfo")
if (loginInfoJSON) {
const loginInfo = JSON.parse(loginInfoJSON)
if (loginInfo.exp < Date.now()) {
localStorage.removeItem("loginInfo")
} else {
isAutoLogin.value = true
loginForm.username = forge.util.decode64(loginInfo.username)
loginForm.password = loginInfo.password
loginForm.checked = true
}
}
})
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>

View File

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

View File

@@ -6,7 +6,7 @@
</div> </div>
<div class="data-check-content"> <div class="data-check-content">
<div class="content-tree"> <div class="content-tree">
<Tree ref="treeRef" :treeData="treeData" @setTab="setTab"/> <Tree ref="treeRef" :treeData="treeData" @setTab="setTab" />
</div> </div>
<div class="content-right-Tabs" style="height: calc(100vh - 315px); width: 100px"> <div class="content-right-Tabs" style="height: calc(100vh - 315px); width: 100px">
@@ -14,11 +14,11 @@
<el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value"> <el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
<div v-if="activeName == tab.value"> <div v-if="activeName == tab.value">
<div class="dialog-footer"> <div class="dialog-footer">
<!-- <el-button :icon="CirclePlus" type="primary" @click="openDialog('add')">新增</el-button>--> <!-- <el-button :icon="CirclePlus" type="primary" @click="openDialog('add')">新增</el-button>-->
</div> </div>
<div style="display: flex"> <div style="display: flex">
<!-- 通信脚本 --> <!-- 通信脚本 -->
<el-tabs type="border-card" v-model="firstName" style="height: 100%" class="hidden-tab"> <el-tabs type="border-card" v-model="firstName" style="height: 100%" class="hidden-tab">
<el-tab-pane label="通讯脚本" name="first"> <el-tab-pane label="通讯脚本" name="first">
<Commun <Commun
:activeName="activeName" :activeName="activeName"
@@ -48,7 +48,7 @@
:data="tableData" :data="tableData"
:header-cell-style="{ :header-cell-style="{
textAlign: 'center', textAlign: 'center',
backgroundColor: '#003078', backgroundColor: 'var(--el-color-primary)',
color: '#fff' color: '#fff'
}" }"
stripe stripe
@@ -95,7 +95,7 @@
? '/' ? '/'
: '' + : '' +
row.channelList[item.num + 1].famp + row.channelList[item.num + 1].famp +
(valueCode == 'Absolute' ? 'V' : '%') (valueCode == 'Absolute' ? 'A' : '%')
}} }}
</td> </td>
<td> <td>
@@ -126,46 +126,52 @@
</el-tabs> </el-tabs>
<div class="page"> <div class="page">
<div class="black-container"> <div class="black-container">
<!-- <el-progress--> <!-- <el-progress-->
<!-- v-if="loading"--> <!-- v-if="loading"-->
<!-- type="circle"--> <!-- type="circle"-->
<!-- >--> <!-- >-->
<!-- <template #default="{}">--> <!-- <template #default="{}">-->
<!-- <span class="Loading">Loading</span>--> <!-- <span class="Loading">Loading</span>-->
<!-- </template>--> <!-- </template>-->
<!-- </el-progress>--> <!-- </el-progress>-->
<div class="loading-container" v-if="showLoading"> <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-circle"></div>
<div class="loading-text">Loading...</div> <div class="loading-text">Loading...</div>
</div>
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
</div> </div>
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>--> <div class="loading-container" v-else>
</div> <div style="width: 80%; height: 80%" class="loading-box">
<div class="loading-container" v-else> <div class="loading-circle static"></div>
<div style="width: 80%; height: 80%; " class="loading-box"> <div class="loading-text">Loading</div>
<div class="loading-circle static"></div> </div>
<div class="loading-text">Loading</div> <!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
</div> </div>
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
</div>
</div> </div>
<div style="margin-top: 10px;"> <div style="margin-top: 10px">
<span>标准源加量输出:{{hour}}{{minute}}{{second}}</span> <span>标准源加量输出:{{ hour }}{{ minute }}{{ second }}</span>
</div> </div>
<div style="margin-top: 10px;"> <div style="margin-top: 10px">
<el-button :icon="VideoPlay" <el-button
type="primary" :icon="VideoPlay"
size="large" type="primary"
@click="startLoading" size="large"
:disabled="pauseDisabled" @click="startLoading"
>启动</el-button> :disabled="pauseDisabled"
<el-button :icon="VideoPause" >
type="primary" 启动
size="large" </el-button>
@click="stopLoading" <el-button
:disabled="pauseDisabled" :icon="VideoPause"
>停止</el-button> type="primary"
</div> size="large"
@click="stopLoading"
:disabled="pauseDisabled"
>
停止
</el-button>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -187,12 +193,13 @@
v-if="showDialog" v-if="showDialog"
/> />
<!-- 查看 --> <!-- 查看 -->
<ViewRow ref="viewRowRef" <ViewRow
:activeName="activeName" ref="viewRowRef"
:formContent="props.formContent" :activeName="activeName"
@close="viewDialog = false" :formContent="props.formContent"
v-if="viewDialog" @close="viewDialog = false"
/> v-if="viewDialog"
/>
</div> </div>
</template> </template>
@@ -200,9 +207,19 @@
import { type PropType, ref, nextTick, onMounted, watch } from 'vue' import { type PropType, ref, nextTick, onMounted, watch } from 'vue'
import Tree from './tree.vue' import Tree from './tree.vue'
import Commun from '@/views/machine/testScript/components//communication.vue' import Commun from '@/views/machine/testScript/components//communication.vue'
import {type CascaderOption, ElMessage} from 'element-plus' import { type CascaderOption, ElMessage } from 'element-plus'
import { getTreeData } from '@/api/check/test' 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 type { TestScript } from '@/api/device/interface/testScript'
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue' import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
import { CheckData } from '@/api/check/interface' import { CheckData } from '@/api/check/interface'
@@ -211,7 +228,7 @@ import { useDictStore } from '@/stores/modules/dict'
import { useHandleData } from '@/hooks/useHandleData' import { useHandleData } from '@/hooks/useHandleData'
import { scriptDtlsCheckDataList } from '@/api/device/testScript/index' import { scriptDtlsCheckDataList } from '@/api/device/testScript/index'
import ViewRow from '@/views/machine/testScript/components/viewRow.vue' import ViewRow from '@/views/machine/testScript/components/viewRow.vue'
import { startSimulateTest,closeSimulateTest } from '@/api/device/controlSource/index.ts' import { startSimulateTest, closeSimulateTest } from '@/api/device/controlSource/index.ts'
import { controlSource } from '@/api/device/interface/controlSource' import { controlSource } from '@/api/device/interface/controlSource'
interface TabOption { interface TabOption {
label?: string label?: string
@@ -238,17 +255,16 @@ const props = defineProps({
type: Object, type: Object,
required: true required: true
}, },
startDisabeld: { startDisabeld: {
type:Boolean, type: Boolean,
required:true required: true
}, },
pauseDisabled: { pauseDisabled: {
type: Boolean, type: Boolean,
required: true required: true
} }
}) })
const showDialog = ref(false) const showDialog = ref(false)
const viewDialog = ref(false) const viewDialog = ref(false)
const dictStore = useDictStore() const dictStore = useDictStore()
@@ -285,47 +301,47 @@ const hour = ref(0)
const minute = ref(0) const minute = ref(0)
const second = ref(0) const second = ref(0)
const emit = defineEmits(['update:activeName','update:activeIndex','update:startDisabeld','update:pauseDisabled']) const emit = defineEmits(['update:activeName', 'update:activeIndex', 'update:startDisabeld', 'update:pauseDisabled'])
watch(()=>props.formControl.scriptId,async ()=>{ watch(
if(props.formControl.scriptId!=''){ () => props.formControl.scriptId,
async () => {
nextTick(async () => { if (props.formControl.scriptId != '') {
await getTree() nextTick(async () => {
console.log('props.formControl.scriptId') await getTree()
treeRef.value.checkTree() console.log('props.formControl.scriptId')
}) treeRef.value.checkTree()
})
}
} }
}) )
const controlContent = ref<controlSource.ResControl>({ const controlContent = ref<controlSource.ResControl>({
userPageId: '', userPageId: '',
scriptId: '', scriptId: '',
scriptIndex: 0, scriptIndex: 0,
sourceId: '', sourceId: ''
}) })
// 获取树 // 获取树
const getTree = () => { const getTree = () => {
getTreeData({ getTreeData({
scriptId: props.formControl.scriptId, scriptId: props.formControl.scriptId
}).then(res => { }).then(res => {
if (res.code === 'A0000') { if (res.code === 'A0000') {
treeData.value = res.data treeData.value = res.data
//console.log('tree',res.data) //console.log('tree',res.data)
// 为 treeData 及其子节点添加 id // 为 treeData 及其子节点添加 id
let idCounter = 0; let idCounter = 0
const addIdToTree = (nodes: any[]) => { const addIdToTree = (nodes: any[]) => {
nodes.forEach(node => { nodes.forEach(node => {
node.id = idCounter++; // 为每个节点添加唯一的 id node.id = idCounter++ // 为每个节点添加唯一的 id
if (node.children && node.children.length > 0) { if (node.children && node.children.length > 0) {
node.disabled = true node.disabled = true
addIdToTree(node.children); // 递归为子节点添加 id addIdToTree(node.children) // 递归为子节点添加 id
} }
}); })
}; }
addIdToTree(treeData.value); addIdToTree(treeData.value)
// 添加tab子项 // 添加tab子项
props.options.forEach((k: any, i: number) => { props.options.forEach((k: any, i: number) => {
@@ -335,7 +351,6 @@ const getTree = () => {
item.children.forEach((s: any) => { item.children.forEach((s: any) => {
k.children.forEach((P: any) => { k.children.forEach((P: any) => {
if (P.code == s.scriptTypeCode) { if (P.code == s.scriptTypeCode) {
tabData.value[i].children.push({ tabData.value[i].children.push({
label: P.label, label: P.label,
value: P.code, value: P.code,
@@ -364,10 +379,8 @@ const getTree = () => {
} }
}) })
//console.log('获取树') //console.log('获取树')
} }
// 设置树点击tab // 设置树点击tab
const setTab = row => { const setTab = row => {
activeName.value = row.activeName activeName.value = row.activeName
@@ -396,8 +409,6 @@ const tabChange = () => {
childActiveName.value = childActiveName.value =
tabData.value.filter((item: any) => item.value == activeName.value)[0]?.children[0]?.value || '' tabData.value.filter((item: any) => item.value == activeName.value)[0]?.children[0]?.value || ''
} }
} }
inquireTable() inquireTable()
} }
@@ -425,13 +436,11 @@ const inquireTable = () => {
//console.log('treeData',treeData.value) //console.log('treeData',treeData.value)
} }
// 查看 // 查看
const view = (row: Partial<TestScript.ResTestScript> = {}) => { const view = (row: Partial<TestScript.ResTestScript> = {}) => {
getCommunication() getCommunication()
//当前点击的一级tab //当前点击的一级tab
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'; const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'
//当前点击的二级tab //当前点击的二级tab
const childrenTabName = ref('') const childrenTabName = ref('')
tabData.value.forEach((item: any) => { tabData.value.forEach((item: any) => {
@@ -445,25 +454,23 @@ const view = (row: Partial<TestScript.ResTestScript> = {}) => {
}) })
viewDialog.value = true viewDialog.value = true
setTimeout(() => { setTimeout(() => {
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value) viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
}, 0) }, 0)
} }
// 定义 startLoading 方法 // 定义 startLoading 方法
const startLoading = async () => { const startLoading = async () => {
emit('update:startDisabeld', true) emit('update:startDisabeld', true)
emit('update:pauseDisabled', true) emit('update:pauseDisabled', true)
ElMessage.success({message:'启动中...',duration:6000}) ElMessage.success({ message: '启动中...', duration: 6000 })
// 启动加载逻辑 // 启动加载逻辑
controlContent.value.userPageId = 'cdf' controlContent.value.userPageId = 'cdf'
controlContent.value.scriptId = props.formControl.scriptId controlContent.value.scriptId = props.formControl.scriptId
controlContent.value.scriptIndex = childActiveIndex.value controlContent.value.scriptIndex = childActiveIndex.value
controlContent.value.sourceId = props.formControl.sourceId controlContent.value.sourceId = props.formControl.sourceId
setTimeout(async () => { setTimeout(async () => {
await startSimulateTest(controlContent.value) await startSimulateTest(controlContent.value)
},3000) }, 3000)
} }
// 定义 startLoading 方法 // 定义 startLoading 方法
@@ -472,44 +479,43 @@ const stopLoading = async () => {
controlContent.value.userPageId = 'cdf' controlContent.value.userPageId = 'cdf'
controlContent.value.scriptId = props.formControl.scriptId controlContent.value.scriptId = props.formControl.scriptId
controlContent.value.scriptIndex = childActiveIndex.value controlContent.value.scriptIndex = childActiveIndex.value
controlContent.value.sourceId = props.formControl.sourceId controlContent.value.sourceId = props.formControl.sourceId
await closeSimulateTest(controlContent.value) await closeSimulateTest(controlContent.value)
emit('update:pauseDisabled', true) emit('update:pauseDisabled', true)
emit('update:startDisabeld', true) emit('update:startDisabeld', true)
ElMessage.success({message:'停止中...',duration:5000}) ElMessage.success({ message: '停止中...', duration: 5000 })
} }
const startTimeCount = () => { const startTimeCount = () => {
// Loading效果展示 // Loading效果展示
showLoading.value = true showLoading.value = true
if (!timer) { if (!timer) {
hour.value = 0 hour.value = 0
minute.value = 0 minute.value = 0
second.value = 0 second.value = 0
timeCount.value = 0 timeCount.value = 0
timer = setInterval(() => { timer = setInterval(() => {
timeCount.value = timeCount.value + 1 timeCount.value = timeCount.value + 1
secondToTime(timeCount.value) secondToTime(timeCount.value)
}, 1000) }, 1000)
} }
} }
const secondToTime = (secd: number) => { const secondToTime = (secd: number) => {
//将秒数转换成时分秒 //将秒数转换成时分秒
hour.value = Math.floor(secd / 3600) hour.value = Math.floor(secd / 3600)
minute.value = Math.floor((secd - hour.value * 3600) / 60) minute.value = Math.floor((secd - hour.value * 3600) / 60)
second.value = Math.floor(secd % 60); second.value = Math.floor(secd % 60)
} }
const stopTimeCount = () => { const stopTimeCount = () => {
if (timer) { if (timer) {
clearInterval(timer) clearInterval(timer)
timer = null timer = null
} }
//Loading效果关闭 //Loading效果关闭
showLoading.value = false showLoading.value = false
} }
// 获取左边树数据 // 获取左边树数据
@@ -519,7 +525,6 @@ const addTab = (row: any) => {
} }
onMounted(() => { onMounted(() => {
getTree() getTree()
props.options.forEach((item: any) => { props.options.forEach((item: any) => {
tabData.value.push({ tabData.value.push({
@@ -537,8 +542,8 @@ onMounted(() => {
}) })
defineExpose({ defineExpose({
startTimeCount, startTimeCount,
stopTimeCount stopTimeCount
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -598,7 +603,7 @@ defineExpose({
width: 45%; width: 45%;
} }
.theFirst { .theFirst {
background-color: #003078; background-color: var(--el-color-primary);
color: #fff; color: #fff;
width: 20px !important; width: 20px !important;
} }
@@ -611,50 +616,50 @@ defineExpose({
} }
.page { .page {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.black-container { .black-container {
background-color: #000; background-color: #000;
width: 300px; width: 300px;
height: 300px; height: 300px;
position: relative; /* 设置为相对定位 */ position: relative; /* 设置为相对定位 */
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-left: 20px; margin-left: 20px;
} }
.loading-container { .loading-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.loading-box { .loading-box {
position: relative; /* 设置为相对定位 */ position: relative; /* 设置为相对定位 */
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.loading-circle { .loading-circle {
border: 8px solid rgba(255, 255, 255, 0.932); border: 8px solid rgba(255, 255, 255, 0.932);
border-top: 8px solid var(--el-color-primary); /* 蓝色 */ border-top: 8px solid var(--el-color-primary); /* 蓝色 */
border-bottom: 8px solid var(--el-color-primary); /* 蓝色 */ border-bottom: 8px solid var(--el-color-primary); /* 蓝色 */
border-radius: 50%; border-radius: 50%;
width: 200px; width: 200px;
height: 200px; height: 200px;
position: absolute; /* 设置为绝对定位 */ position: absolute; /* 设置为绝对定位 */
animation: spin 2s linear infinite; animation: spin 2s linear infinite;
} }
.loading-circle.static { .loading-circle.static {
@@ -662,35 +667,36 @@ defineExpose({
} }
.loading-text { .loading-text {
position: absolute; /* 设置为绝对定位 */ position: absolute; /* 设置为绝对定位 */
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
color: #fff; color: #fff;
font-size: 20px; /* 根据需要调整字体大小 */ font-size: 20px; /* 根据需要调整字体大小 */
text-align: center; text-align: center;
} }
@keyframes spin { @keyframes spin {
0% { transform: rotate(0deg); } 0% {
100% { transform: rotate(360deg); } transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
} }
.hidden-tab { .hidden-tab {
display: none; display: none;
} }
@keyframes rotate { @keyframes rotate {
from { from {
transform: rotate(0deg); transform: rotate(0deg);
} }
to { to {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
</style> </style>
<style> <style>
input::-webkit-inner-spin-button { input::-webkit-inner-spin-button {

View File

@@ -31,7 +31,7 @@
<!-- <div class="formBut">--> <!-- <div class="formBut">-->
<el-button type="primary" :icon="Select" @click="start()" :disabled="connectDisabeld">通讯校验</el-button> <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-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>--> <!-- </div>-->
</el-form-item> </el-form-item>
</el-form> </el-form>

View File

@@ -103,8 +103,8 @@
<el-form-item label='密钥' prop='devKey' clearable v-if="formContent.encryptionFlag"> <el-form-item label='密钥' prop='devKey' clearable v-if="formContent.encryptionFlag">
<el-input v-model='formContent.devKey' placeholder="请输入密钥" show-password/> <el-input v-model='formContent.devKey' placeholder="请输入密钥" show-password/>
</el-form-item> </el-form-item>
<el-form-item label='样品编号' prop='sampleID' clearable v-if="DevIsShow && scene === '0'"> <el-form-item label='样品编号' prop='sampleId' clearable v-if="DevIsShow && scene === '0'">
<el-input v-model='formContent.sampleID' placeholder="请输入样品编号" /> <el-input v-model='formContent.sampleId' placeholder="请输入样品编号" />
</el-form-item> </el-form-item>
<el-form-item label='送样日期' prop='arrivedDate' v-if="scene === '0'"> <el-form-item label='送样日期' prop='arrivedDate' v-if="scene === '0'">
<el-date-picker <el-date-picker

View File

@@ -1,9 +1,9 @@
<template> <template>
<div class='table-box' ref='popupBaseView'> <div class='table-box' ref='popupBaseView'>
<ProTable <ProTable
ref='proTable' ref='proTable'
:columns='columns' :columns='columns'
:request-api='getTableList' :request-api='getTableList'
> >
<!-- :requestApi="getRoleList" --> <!-- :requestApi="getRoleList" -->
<!-- 表格 header 按钮 --> <!-- 表格 header 按钮 -->
@@ -32,32 +32,25 @@
</ProTable> </ProTable>
</div> </div>
<DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup' /> <DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup'/>
<ImportExcel ref='deviceImportExcel' /> <ImportExcel ref='deviceImportExcel'/>
</template> </template>
<script setup lang='tsx' name='useRole'> <script setup lang='tsx' name='useRole'>
import TimeControl from '@/components/TimeControl/index.vue' import TimeControl from '@/components/TimeControl/index.vue'
import { type Device } from '@/api/device/interface/device.ts' import {type Device} from '@/api/device/interface/device.ts'
import { useHandleData } from '@/hooks/useHandleData' import {useHandleData} from '@/hooks/useHandleData'
import { useDownload } from '@/hooks/useDownload' import {useDownload} from '@/hooks/useDownload'
import ProTable from '@/components/ProTable/index.vue' import ProTable from '@/components/ProTable/index.vue'
import ImportExcel from '@/components/ImportExcel/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 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 {useDictStore} from '@/stores/modules/dict'
import { import {deletePqDev, downloadTemplate, exportPqDev, getPqDev, getPqDevList, importPqDev} from '@/api/device/device/index.ts'
getPqDevList, import {ElMessageBox} from 'element-plus'
deletePqDev, import {onBeforeMount, reactive, ref} from 'vue'
getPqDev, import {useAppSceneStore, useModeStore} from '@/stores/modules/mode'
exportCNDev,
downloadCNDevTemplate,
importCNDev,
} from '@/api/device/device/index.ts'
import { ElMessage, ElMessageBox } from 'element-plus'
import { onBeforeMount, reactive, ref } from 'vue'
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
// defineOptions({ // defineOptions({
// name: 'device', // name: 'device',
@@ -72,6 +65,7 @@ const boundPqDevList = ref<Device.ReqPqDevParams[]>([])//根据检测计划id查
// 存储设备类型选项 // 存储设备类型选项
const devTypeOptions = ref<Device.ResDev[]>([]) const devTypeOptions = ref<Device.ResDev[]>([])
const getTableList = async (params: any) => { const getTableList = async (params: any) => {
let newParams = JSON.parse(JSON.stringify(params)) let newParams = JSON.parse(JSON.stringify(params))
newParams.searchEndTime = endDate.value newParams.searchEndTime = endDate.value
@@ -84,12 +78,12 @@ const getTableList = async (params: any) => {
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
{ type: 'selection', fixed: 'left', width: 70 }, {type: 'selection', fixed: 'left', width: 70},
{ type: 'index', fixed: 'left', width: 70, label: '序号' }, {type: 'index', fixed: 'left', width: 70, label: '序号'},
{ {
prop: 'name', prop: 'name',
label: '名称', label: '名称',
search: { el: 'input' }, search: {el: 'input'},
// isShow: appSceneStore.currentScene != '1', // isShow: appSceneStore.currentScene != '1',
// ...(appSceneStore.currentScene != '1' ? { // ...(appSceneStore.currentScene != '1' ? {
// search: { el: 'input' }, // search: { el: 'input' },
@@ -115,12 +109,12 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
search: { search: {
render: () => { render: () => {
return ( return (
<div class='flx-flex-start'> <div class='flx-flex-start'>
<TimeControl <TimeControl
default={'月'} default={'月'}
onUpdate-dates={handleDateChange} onUpdate-dates={handleDateChange}
/> />
</div> </div>
) )
}, },
}, },
@@ -163,8 +157,8 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
enum: dictStore.getDictData('Dev_Manufacturers'), enum: dictStore.getDictData('Dev_Manufacturers'),
isShow: appSceneStore.currentScene != '1', isShow: appSceneStore.currentScene != '1',
...(appSceneStore.currentScene != '1' ? { ...(appSceneStore.currentScene != '1' ? {
search: { el: 'select', props: { filterable: true }, order: 1 }, search: {el: 'select', props: {filterable: true}, order: 1},
fieldNames: { label: 'name', value: 'id' }, fieldNames: {label: 'name', value: 'id'},
} : {}), } : {}),
minWidth: 200, minWidth: 200,
}, },
@@ -174,19 +168,19 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
width: 200, width: 200,
render: scope => { render: scope => {
if (scope.row.createTime) { if (scope.row.createTime) {
const date = new Date(scope.row.createTime); const date = new Date(scope.row.createTime);
const year = date.getFullYear(); const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0'); const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0'); const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0'); const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
} }
return ''; return '';
} }
}, },
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 }, {prop: 'operation', label: '操作', fixed: 'right', width: 200},
]) ])
@@ -206,7 +200,7 @@ const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
// 批量删除设备 // 批量删除设备
const batchDelete = async (id: string[]) => { const batchDelete = async (id: string[]) => {
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
await useHandleData(deletePqDev, { 'ids': id, 'pattern': patternId }, '删除所选设备') await useHandleData(deletePqDev, {'ids': id, 'pattern': patternId}, '删除所选设备')
proTable.value?.clearSelection() proTable.value?.clearSelection()
proTable.value?.getTableList() proTable.value?.getTableList()
@@ -215,7 +209,7 @@ const batchDelete = async (id: string[]) => {
// 删除设备 // 删除设备
const handleDelete = async (params: Device.ResPqDev) => { const handleDelete = async (params: Device.ResPqDev) => {
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
await useHandleData(deletePqDev, { 'ids': [params.id], 'pattern': patternId }, `删除【${params.name}】设备`) await useHandleData(deletePqDev, {'ids': [params.id], 'pattern': patternId}, `删除【${params.name}】设备`)
proTable.value?.getTableList() proTable.value?.getTableList()
} }
@@ -229,9 +223,9 @@ const downloadFile = async () => {
searchParam.searchBeginTime = startDate.value searchParam.searchBeginTime = startDate.value
searchParam.searchEndTime = endDate.value searchParam.searchEndTime = endDate.value
ElMessageBox.confirm('确认导出被检设备?', '温馨提示', { type: 'warning' }).then(() => { ElMessageBox.confirm('确认导出被检设备?', '温馨提示', {type: 'warning'}).then(() => {
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
useDownload(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: '被检设备', title: '被检设备',
showCover: false, showCover: false,
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id, patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id,
tempApi: downloadCNDevTemplate, tempApi: downloadTemplate,
importApi: importCNDev, importApi: importPqDev,
// importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev, // importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev,
getTableList: proTable.value?.getTableList, getTableList: proTable.value?.getTableList,
} }

View File

@@ -1,63 +1,62 @@
<template> <template>
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig"> <el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
<div class="table-container"> <div class="table-container">
<el-table :data="errorData.value" <el-table :data="errorData.value"
height="500" height="500"
:header-cell-style="rowClass" :header-cell-style="rowClass"
:cell-style="{ textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"
style="width: 100%" style="width: 100%"
:span-method="spanMethod" :span-method="spanMethod"
:border="true" :border="true"
class="custom-table" class="custom-table"
> >
<el-table-column label="被测量"> <el-table-column label="被测量">
<el-table-column prop="col1" width="150"/> <el-table-column prop="col1" width="150"/>
<el-table-column prop="col2" width="120" /> <el-table-column prop="col2" width="120"/>
</el-table-column> </el-table-column>
<el-table-column prop="deviceLevel" label="检测装置级别" width="120"/> <el-table-column prop="deviceLevel" label="检测装置级别" width="120"/>
<el-table-column prop="measurementType" label="测量类型" /> <el-table-column prop="measurementType" label="测量类型"/>
<el-table-column prop="condition" label="测量条件" /> <el-table-column prop="condition" label="测量条件"/>
<el-table-column prop="maxErrorValue" label="最大误差" /> <el-table-column prop="maxErrorValue" label="最大误差"/>
</el-table> </el-table>
</div> </div>
<div> <div>
<label class="left-align-label">注1UN测量的标称电压IN测量仪器的标称电流Uh和Ih测量值h表示谐波次数</label> <label class="left-align-label">注1UN测量的标称电压IN测量仪器的标称电流Uh和Ih测量值h表示谐波次数</label>
</div> </div>
<div> <div>
<label class="left-align-label">注2对于数字式接入监测终端与电能质量信号采集单元联合准确度需满足本表要求</label> <label class="left-align-label">注2对于数字式接入监测终端与电能质量信号采集单元联合准确度需满足本表要求</label>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script lang="ts" setup name="IndicatorTypeDialog"> <script lang="ts" setup name="IndicatorTypeDialog">
import { defineProps, defineEmits, reactive,watch,ref,computed, type CSSProperties } from 'vue'; import {computed, type CSSProperties, defineProps, ref} from 'vue';
import { dialogBig} from '@/utils/elementBind' import {dialogBig} from '@/utils/elementBind'
import type { ColumnProps } from '@/components/ProTable/interface' import type {ErrorSystem} from '@/api/device/interface/error'
import type { ErrorSystem } from '@/api/device/interface/error' import errorDataList from '@/api/device/error/errorData'
import errorDataList from '@/api/device/error/errorData' import type {TableColumnCtx} from 'element-plus'
import type { TableColumnCtx } from 'element-plus' import {useDictStore} from '@/stores/modules/dict'
import { useDictStore } from '@/stores/modules/dict'
const dictStore = useDictStore() const dictStore = useDictStore()
const errorData = ref<ErrorSystem.Error_detail[]>([]); const errorData = ref<ErrorSystem.Error_detail[]>([]);
const dialogTitle = ref() const dialogTitle = ref()
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref
function useMetaInfo() { function useMetaInfo() {
const dialogVisible = ref(false) const dialogVisible = ref(false)
const formContent = ref<ErrorSystem.ErrorSystemList>({ const formContent = ref<ErrorSystem.ErrorSystemList>({
id: '', id: '',
name: '', name: '',
standardName:'', standardName: '',
standardTime:'', standardTime: '',
devLevel:'', devLevel: '',
enable:1, enable: 1,
state:1, state: 1,
}) })
return { dialogVisible, formContent } return {dialogVisible, formContent}
} }
const { dialogVisible, formContent } = useMetaInfo() const {dialogVisible, formContent} = useMetaInfo()
interface SpanMethodProps { interface SpanMethodProps {
row: ErrorSystem.ErrorSystemDetail row: ErrorSystem.ErrorSystemDetail
@@ -66,14 +65,14 @@ interface SpanMethodProps {
columnIndex: number columnIndex: number
} }
const rowClass = ({ row, column, rowIndex, columnIndex }: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => { const rowClass = ({row, column, rowIndex, columnIndex}: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
let res: CSSProperties = { let res: CSSProperties = {
textAlign: 'center' as CSSProperties['textAlign'], textAlign: 'center' as CSSProperties['textAlign'],
backgroundColor: '#003078', backgroundColor: 'var(--el-color-primary)',
color: '#fff' color: '#fff'
} }
if (rowIndex === 1) { if (rowIndex === 1) {
res = { ...res, display: 'none' } res = {...res, display: 'none'}
} }
return res return res
} }
@@ -84,11 +83,11 @@ const spanMethod = computed(() => {
}) })
const spanAMethod = ({ const spanAMethod = ({
row, row,
column, column,
rowIndex, rowIndex,
columnIndex, columnIndex,
}: SpanMethodProps) => { }: SpanMethodProps) => {
if (columnIndex === 0) { if (columnIndex === 0) {
if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差1频率偏差7闪变20功率简单的跨两列 if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差1频率偏差7闪变20功率简单的跨两列
return { return {
@@ -166,11 +165,11 @@ const spanAMethod = ({
const spanSMethod = ({ const spanSMethod = ({
row, row,
column, column,
rowIndex, rowIndex,
columnIndex, columnIndex,
}: SpanMethodProps) => { }: SpanMethodProps) => {
if (columnIndex === 0) { if (columnIndex === 0) {
if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差1频率偏差7闪变20功率简单的跨两列 if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差1频率偏差7闪变20功率简单的跨两列
return { return {
@@ -205,7 +204,7 @@ const spanSMethod = ({
colspan: 2, colspan: 2,
} }
} }
if (rowIndex === 18 ) {//电流跨两行两列 if (rowIndex === 18) {//电流跨两行两列
return { return {
rowspan: 2, rowspan: 2,
colspan: 2, colspan: 2,
@@ -235,9 +234,9 @@ const spanSMethod = ({
colspan: 1, colspan: 1,
} }
} }
if (rowIndex === 3 || rowIndex === 7 || if (rowIndex === 3 || rowIndex === 7 ||
rowIndex === 10 || rowIndex === 12 || rowIndex === 10 || rowIndex === 12 ||
rowIndex === 14 || rowIndex === 16 || rowIndex === 14 || rowIndex === 16 ||
rowIndex === 19 || rowIndex === 22) { rowIndex === 19 || rowIndex === 22) {
return { return {
rowspan: 0, rowspan: 0,
@@ -245,18 +244,18 @@ const spanSMethod = ({
} }
} }
} }
if(columnIndex === 3){ if (columnIndex === 3) {
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 || if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
rowIndex === 11 || rowIndex === 13 ||rowIndex === 15 || rowIndex === 11 || rowIndex === 13 || rowIndex === 15 ||
rowIndex === 18 || rowIndex === 21){ rowIndex === 18 || rowIndex === 21) {
return { return {
rowspan: 2, rowspan: 2,
colspan: 1, colspan: 1,
} }
} }
if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 || if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 ||
rowIndex === 12 || rowIndex === 14 ||rowIndex === 16 || rowIndex === 12 || rowIndex === 14 || rowIndex === 16 ||
rowIndex === 19 || rowIndex === 22){ rowIndex === 19 || rowIndex === 22) {
return { return {
rowspan: 0, rowspan: 0,
colspan: 0, colspan: 0,
@@ -267,34 +266,34 @@ const spanSMethod = ({
// 关闭弹窗 // 关闭弹窗
const close = () => { const close = () => {
dialogVisible.value = false dialogVisible.value = false
} }
// 打开弹窗,可能是新增,也可能是编辑 // 打开弹窗,可能是新增,也可能是编辑
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => { const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
dialogTitle.value = sign + ' 误差体系' dialogTitle.value = sign + ' 误差体系'
dialogVisible.value = true dialogVisible.value = true
if (data.id) { if (data.id) {
formContent.value = data as ErrorSystem.ErrorSystemList; formContent.value = data as ErrorSystem.ErrorSystemList;
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';; if (devLevelName.value === 'A级' || data.devLevel === 'A级') {
errorData.value = errorDataList.errorADetail as unknown as ErrorSystem.Error_detail[];
if(devLevelName.value === 'A级'){ } else {
errorData.value = errorDataList.errorADetail as unknown as ErrorSystem.Error_detail[]; errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];
}else{ }
errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];
}
} }
} }
// 对外映射 // 对外映射
defineExpose({ open }) defineExpose({open})
const props = defineProps<{ const props = defineProps<{
refreshTable: (() => Promise<void>) | undefined; refreshTable: (() => Promise<void>) | undefined;
}>() }>()
</script> </script>
<style> <style>
.table-container { .table-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -316,4 +315,4 @@ const props = defineProps<{
} }
</style> </style>

View File

@@ -5,10 +5,10 @@
</div> </div>
<div class="table-container"> <div class="table-container">
<el-table :data="tableData" <el-table :data="tableData"
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } " :header-cell-style="{ textAlign: 'center',backgroundColor: 'var(--el-color-primary)',color: '#fff' } "
:cell-style="{ textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"
style="width: 100%" style="width: 100%"
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}" :style="{ height: '400px',maxHeight: '400px',overflow:'hidden'}"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column prop="sort" label="序号" width="60" /> <el-table-column prop="sort" label="序号" width="60" />

View File

@@ -3,7 +3,7 @@
<el-tabs type="border-card"> <el-tabs type="border-card">
<el-tab-pane label="基础信息"> <el-tab-pane label="基础信息">
<div > <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-form-item label="标准号" prop="standardName" >
<el-input v-model='formContent.standardName' placeholder="请填写标准号"/> <el-input v-model='formContent.standardName' placeholder="请填写标准号"/>
</el-form-item> </el-form-item>
@@ -26,7 +26,7 @@
<el-form-item label="状态" prop="enable" > <el-form-item label="状态" prop="enable" >
<el-select v-model='formContent.enable' placeholder="请选择状态"> <el-select v-model='formContent.enable' placeholder="请选择状态">
<el-option label="启用" :value="1"></el-option> <el-option label="启用" :value="1"></el-option>
<el-option label="不启用" :value="0"></el-option> <el-option label="用" :value="0"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>

View File

@@ -16,6 +16,7 @@
<!-- 表格操作 --> <!-- 表格操作 -->
<template #operation='scope'> <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="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="'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> <el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
</template> </template>
@@ -26,7 +27,7 @@
<ErrorStandardPopup :refresh-table='proTable?.getTableList' ref='errorStandardPopup' /> <ErrorStandardPopup :refresh-table='proTable?.getTableList' ref='errorStandardPopup' />
</template> </template>
<script setup lang="ts" name='useProTable'> <script setup lang="tsx" name='useProTable'>
import ProTable from '@/components/ProTable/index.vue' import ProTable from '@/components/ProTable/index.vue'
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface' import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
import { CirclePlus, Delete,EditPen,View} from '@element-plus/icons-vue' 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 ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue'
import type { ErrorSystem } from '@/api/device/interface/error' import type { ErrorSystem } from '@/api/device/interface/error'
import { useDictStore } from '@/stores/modules/dict' import { useDictStore } from '@/stores/modules/dict'
import { getPqErrSysList, deletePqErrSys} from '@/api/device/error/index' import { getPqErrSysList, deletePqErrSys,copyPqErrSys} from '@/api/device/error/index'
import { ElMessageBox } from 'element-plus'
defineOptions({ defineOptions({
name: 'errorSystem' name: 'errorSystem'
}) })
@@ -71,7 +73,15 @@ const columns = ref<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
search: { el: 'select', props: { filterable: true } }, search: { el: 'select', props: { filterable: true } },
fieldNames: { label: 'name', value: 'id' }, 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(新增、编辑) // 打开 drawer(新增、编辑)
@@ -86,19 +96,33 @@ const openDialog = (titleType: string, row: Partial<ErrorSystem.ErrorSystemList>
} }
// 批量删除设备 // 批量误差体系
const batchDelete = async (id: string[]) => { const batchDelete = async (id: string[]) => {
await useHandleData(deletePqErrSys, id, '删除所选误差体系') await useHandleData(deletePqErrSys, id, '删除所选误差体系')
proTable.value?.clearSelection() proTable.value?.clearSelection()
proTable.value?.getTableList() proTable.value?.getTableList()
} }
// 删除设备 // 删除误差体系
const handleDelete = async (params: ErrorSystem.ErrorSystemList) => { const handleDelete = async (params: ErrorSystem.ErrorSystemList) => {
await useHandleData(deletePqErrSys, [params.id], `删除【${params.name}】误差体系`) await useHandleData(deletePqErrSys, [params.id], `删除【${params.name}】误差体系`)
proTable.value?.getTableList() 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> </script>
<style scoped> <style scoped>

View File

@@ -4,11 +4,11 @@
:data="tableData" :data="tableData"
:header-cell-style="{ :header-cell-style="{
textAlign: 'center', textAlign: 'center',
backgroundColor: '#003078', backgroundColor: 'var(--el-color-primary)',
color: '#fff' color: '#fff'
}" }"
stripe stripe
height="calc(100vh - 480px)" :height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`"
:style="{ overflow: 'hidden' }" :style="{ overflow: 'hidden' }"
row-key="id" row-key="id"
:expand-row-keys="[props.activeName]" :expand-row-keys="[props.activeName]"
@@ -75,6 +75,9 @@ const props = defineProps({
options: { options: {
type: Array, type: Array,
required: true required: true
},
shrink: {
type: Boolean
} }
}) })
const tableData = ref<any[]>([]) const tableData = ref<any[]>([])

View File

@@ -8,7 +8,7 @@
:data="tableData" :data="tableData"
:header-cell-style="{ :header-cell-style="{
textAlign: 'center', textAlign: 'center',
backgroundColor: '#003078', backgroundColor: 'var(--el-color-primary)',
color: '#fff' color: '#fff'
}" }"
stripe stripe
@@ -33,7 +33,7 @@
<el-table-column prop="phase" label="相别" /> <el-table-column prop="phase" label="相别" />
<el-table-column prop="value" label="参考设定值"> <el-table-column prop="value" label="参考设定值">
<template #default="{ row }"> <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="请输入值" /> <el-input type="number" v-else v-model="row.value" placeholder="请输入值" />
</template> </template>
</el-table-column> </el-table-column>
@@ -96,6 +96,10 @@ const props = defineProps({
form: { form: {
type: [Object, Array], type: [Object, Array],
required: true required: true
},
valueCode: {
type: String,
required: true
} }
}) })
const emit = defineEmits(['recalculation']) const emit = defineEmits(['recalculation'])
@@ -213,6 +217,112 @@ const isEqual = (obj1: any, obj2: any) => {
return true 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 = () => { const save = () => {
dialogVisible.value = false dialogVisible.value = false
} }
@@ -224,6 +334,7 @@ const getTableData = () => {
const close = () => { const close = () => {
dialogVisible.value = false dialogVisible.value = false
} }
onMounted(() => {}) onMounted(() => {})
// 对外映射 // 对外映射

View File

@@ -31,7 +31,7 @@
:show-header="false" :show-header="false"
:span-method="arraySpanMethod" :span-method="arraySpanMethod"
:cell-style="tableStyle.cellStyle" :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" @cell-click="handleRowClick"
:key="key" :key="key"
> >
@@ -154,6 +154,7 @@
:formContent="props.formContent" :formContent="props.formContent"
:form="form" :form="form"
:key="initial" :key="initial"
:valueCode=valueCode
@recalculation="recalculation" @recalculation="recalculation"
/> />
</el-carousel-item> </el-carousel-item>

View File

@@ -6,11 +6,15 @@
<el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider> <el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider>
</div> </div>
<div class="data-check-content"> <div class="data-check-content">
<div class="content-tree"> <div class="content-tree" :style="{ height: `calc(100vh - ${props.shrink ? '370px' : '315px'})` }">
<Tree :treeData="treeData" @setTab="setTab" /> <Tree :treeData="treeData" @setTab="setTab" />
</div> </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-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"> <el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
<div v-if="activeName == tab.value"> <div v-if="activeName == tab.value">
@@ -26,6 +30,7 @@
:formContent="props.formContent" :formContent="props.formContent"
:options="props.options" :options="props.options"
style="width: 360px" style="width: 360px"
:shrink="props.shrink"
:disabled="tab.children.length == 0 ? false : true" :disabled="tab.children.length == 0 ? false : true"
ref="communRef" ref="communRef"
/> />
@@ -49,13 +54,13 @@
:data="tableData" :data="tableData"
:header-cell-style="{ :header-cell-style="{
textAlign: 'center', textAlign: 'center',
backgroundColor: '#003078', backgroundColor: 'var(--el-color-primary)',
color: '#fff' color: '#fff'
}" }"
stripe stripe
:cell-style="{ textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"
highlight-current-row highlight-current-row
height="calc(100vh - 480px)" :height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`"
style="width: 100%" style="width: 100%"
> >
<el-table-column type="index" label="组次" width="60" /> <el-table-column type="index" label="组次" width="60" />
@@ -97,7 +102,7 @@
? '/' ? '/'
: '' + : '' +
row.channelList[item.num + 1].famp + row.channelList[item.num + 1].famp +
(valueCode == 'Absolute' ? 'V' : '%') (valueCode == 'Absolute' ? 'A' : '%')
}} }}
</td> </td>
<td> <td>
@@ -188,12 +193,13 @@
v-if="showDialog" v-if="showDialog"
/> />
<!-- 查看 --> <!-- 查看 -->
<ViewRow ref="viewRowRef" <ViewRow
:activeName="activeName" ref="viewRowRef"
:formContent="props.formContent" :activeName="activeName"
@close="viewDialog = false" :formContent="props.formContent"
v-if="viewDialog" @close="viewDialog = false"
/> v-if="viewDialog"
/>
</div> </div>
</template> </template>
@@ -201,7 +207,7 @@
import { type PropType, ref, nextTick } from 'vue' import { type PropType, ref, nextTick } from 'vue'
import Tree from './tree.vue' import Tree from './tree.vue'
import Commun from './communication.vue' import Commun from './communication.vue'
import {type CascaderOption, ElMessageBox} from 'element-plus' import { type CascaderOption, ElMessageBox } from 'element-plus'
import { getTreeData } from '@/api/check/test' import { getTreeData } from '@/api/check/test'
import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue' import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue'
import type { TestScript } from '@/api/device/interface/testScript' import type { TestScript } from '@/api/device/interface/testScript'
@@ -230,6 +236,9 @@ const props = defineProps({
formContent: { formContent: {
type: Object, type: Object,
required: true required: true
},
shrink: {
type: Boolean
} }
}) })
const showDialog = ref(false) const showDialog = ref(false)
@@ -265,7 +274,7 @@ const getTree = () => {
}).then(res => { }).then(res => {
if (res.code === 'A0000') { if (res.code === 'A0000') {
treeData.value = res.data treeData.value = res.data
console.log('tree',treeData.value) console.log('tree', treeData.value)
// 添加tab子项 // 添加tab子项
props.options.forEach((k: any, i: number) => { props.options.forEach((k: any, i: number) => {
tabData.value[i].children = [] tabData.value[i].children = []
@@ -308,7 +317,7 @@ const setTab = row => {
const copyActiveName = ref('') const copyActiveName = ref('')
// 获取通讯脚本点击 // 获取通讯脚本点击
const getCommunication = () => { const getCommunication = () => {
console.log('123123',communRef.value[0]?.getData()) console.log('123123', communRef.value[0]?.getData())
communicationList.value = communRef.value[0]?.getData() communicationList.value = communRef.value[0]?.getData()
} }
// 切换大tab控制小tab // 切换大tab控制小tab
@@ -347,8 +356,6 @@ const inquireTable = () => {
tableData.value = res.data tableData.value = res.data
} }
}) })
} }
// 打开 drawer(新增、编辑) // 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => { const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
@@ -359,48 +366,47 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
} }
// 复制 // 复制
const copyRow = async (row: any) => { const copyRow = async (row: any) => {
ElMessageBox.confirm('是否复制当前检测项目?', '提示', { ElMessageBox.confirm('是否复制当前检测项目?', '提示', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: 'warning', type: 'warning',
draggable: true draggable: true
}).then(async () => { }).then(async () => {
let checkDataList: any = [] let checkDataList: any = []
await communRef.value[0]?.getData().forEach((item: any) => { await communRef.value[0]?.getData().forEach((item: any) => {
item.children.forEach((k: any) => { item.children.forEach((k: any) => {
if (k.enable != 0 || k.errorFlag != 0) { if (k.enable != 0 || k.errorFlag != 0) {
checkDataList.push({ checkDataList.push({
pid: k.pid, pid: k.pid,
valueType: k.id, valueType: k.id,
dataType: k.dataType, dataType: k.dataType,
enable: k.enable, enable: k.enable,
errorFlag: k.errorFlag errorFlag: k.errorFlag
}) })
} }
}) })
}) })
let { data } = await scriptDtlsCheckDataList({ checkDataList: checkDataList, ...row, retryCompute: true }) let { data } = await scriptDtlsCheckDataList({ checkDataList: checkDataList, ...row, retryCompute: true })
let copyRow = JSON.parse(JSON.stringify(row)) let copyRow = JSON.parse(JSON.stringify(row))
delete copyRow.index delete copyRow.index
await addScriptDtls({ ...copyRow, scriptType: activeName.value, checkDataList: data }).then(res => { await addScriptDtls({ ...copyRow, scriptType: activeName.value, checkDataList: data }).then(res => {
if (res.code === 'A0000') { if (res.code === 'A0000') {
ElMessage.success({ ElMessage.success({
message: '复制成功!', message: '复制成功!',
type: 'success' type: 'success'
})
getTree()
}
}) })
getTree()
}
}) })
})
} }
// 查看 // 查看
const view = (row: Partial<TestScript.ResTestScript> = {}) => { const view = (row: Partial<TestScript.ResTestScript> = {}) => {
getCommunication() getCommunication()
console.log('communicationList',communicationList.value) console.log('communicationList', communicationList.value)
//当前点击的一级tab //当前点击的一级tab
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'; const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'
//当前点击的二级tab //当前点击的二级tab
const childrenTabName = ref('') const childrenTabName = ref('')
tabData.value.forEach((item: any) => { tabData.value.forEach((item: any) => {
@@ -416,12 +422,11 @@ const view = (row: Partial<TestScript.ResTestScript> = {}) => {
setTimeout(() => { setTimeout(() => {
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value) viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
}, 0) }, 0)
} }
// 删除 // 删除
const deleteRow = async (row: any) => { const deleteRow = async (row: any) => {
await useHandleData(deleteDtls, { enable: row.enable, index: row.index, scriptId: row.scriptId }, `删除`) await useHandleData(deleteDtls, { enable: row.enable, index: row.index, scriptId: row.scriptId }, `删除`)
getTree() getTree()
} }
// 启用 // 启用
const enableRow = async (row: any) => { const enableRow = async (row: any) => {
@@ -453,7 +458,7 @@ const addTab = (row: any) => {
const saveTheNewsletter = () => {} const saveTheNewsletter = () => {}
onMounted(() => { onMounted(() => {
getTree() getTree()
console.log('testScriptDetail',props.options) console.log('testScriptDetail', props.options)
props.options.forEach((item: any) => { props.options.forEach((item: any) => {
tabData.value.push({ tabData.value.push({
label: item.label.replace(/准确度|检测/g, ''), label: item.label.replace(/准确度|检测/g, ''),
@@ -466,7 +471,6 @@ onMounted(() => {
valueCode.value = dictStore valueCode.value = dictStore
.getDictData('Script_Value_Type') .getDictData('Script_Value_Type')
.filter(item => item.id == props.formContent.valueType)[0].code .filter(item => item.id == props.formContent.valueType)[0].code
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -477,16 +481,14 @@ onMounted(() => {
.content-tree { .content-tree {
width: 260px; width: 260px;
height: calc(100vh - 315px);
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
border-radius: 4px; border-radius: 4px;
// margin-right: 10px; // margin-right: 10px;
overflow: auto; /* 同时启用垂直和水平滚动 */ overflow: auto; /* 同时启用垂直和水平滚动 */
overflow-x: hidden; overflow-x: hidden;
} }
.scriptTree {
height: calc(100vh - 520px);
}
/* 确保 el-tree 内容可以超出容器宽度 */ /* 确保 el-tree 内容可以超出容器宽度 */
.el-tree { .el-tree {
@@ -526,7 +528,7 @@ onMounted(() => {
width: 45%; width: 45%;
} }
.theFirst { .theFirst {
background-color: #003078; background-color: var(--el-color-primary);
color: #fff; color: #fff;
width: 20px !important; width: 20px !important;
} }

View File

@@ -35,7 +35,7 @@
:disabled="!form[0].dipFlag" :disabled="!form[0].dipFlag"
/> />
</el-form-item> </el-form-item>
<el-form-item label-width="120px" label="持续时间(s)"> <el-form-item label-width="120px" label="持续时间(周波)">
<el-input <el-input
type="number" type="number"
v-model="form[0].dipData.retainTime" v-model="form[0].dipData.retainTime"
@@ -86,7 +86,7 @@ canvas {
position: relative; position: relative;
img { img {
width: 90%; width: 90%;
height: 150px; height: 140px;
margin: 0 10px 20px; margin: 0 10px 20px;
} }
.inputTop { .inputTop {

View File

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

View File

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

View File

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

View File

@@ -24,7 +24,7 @@
class="custom-tree-node" class="custom-tree-node"
style="display: flex; align-items: center" 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> <svg-icon v-if="data.isChildNode && data.scriptIdx === currentIndex" name="loading" spin ></svg-icon>
<span>{{ node.label }}</span> <span>{{ node.label }}</span>

View File

@@ -54,6 +54,23 @@
<el-radio :value="0"></el-radio> <el-radio :value="0"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </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-form>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@@ -93,11 +110,7 @@
import { type TestScript } from '@/api/device/interface/testScript'; import { type TestScript } from '@/api/device/interface/testScript';
import { type ErrorSystem } from '@/api/device/interface/error'; import { type ErrorSystem } from '@/api/device/interface/error';
import { type Device } from '@/api/device/interface/device'; import { type Device } from '@/api/device/interface/device';
import { Loading } from '@element-plus/icons-vue/dist/types'; import {getPqReportAllName,getPqReportAllVersion} from '@/api/device/report/index.ts'
import { truncate } from 'lodash';
const dictStore = useDictStore() const dictStore = useDictStore()
// 定义弹出组件元信息 // 定义弹出组件元信息
const dialogFormRef = ref() const dialogFormRef = ref()
@@ -108,6 +121,9 @@ import { truncate } from 'lodash';
const pqErrSysList=ref<ErrorSystem.ErrorSystemList[]>([])//获取指定模式下所有检测源 const pqErrSysList=ref<ErrorSystem.ErrorSystemList[]>([])//获取指定模式下所有检测源
const pqDevList=ref<Device.ResPqDev[]>([])//获取指定模式下所有检测源 const pqDevList=ref<Device.ResPqDev[]>([])//获取指定模式下所有检测源
const pqReportName = ref<{ name: string }[]>([])
const pqSourceArray = ref<{ label: string; value: string; }[]>() const pqSourceArray = ref<{ label: string; value: string; }[]>()
const pqScriptArray = ref<{ label: string; value: string; }[]>() const pqScriptArray = ref<{ label: string; value: string; }[]>()
const pqErrorArray = ref<{ label: string; value: string; }[]>() const pqErrorArray = ref<{ label: string; value: string; }[]>()
@@ -164,6 +180,9 @@ const filterMethod = (query: string, item: { label?: string }) => {
devIds:[], devIds:[],
sourceIds:'', sourceIds:'',
datasourceIds:'', datasourceIds:'',
associateReport:0,
reportTemplateName:'',
reportTemplateVersion:'',
}) })
return { dialogVisible, titleType, formContent } return { dialogVisible, titleType, formContent }
} }
@@ -194,6 +213,9 @@ const filterMethod = (query: string, item: { label?: string }) => {
devIds:[], devIds:[],
sourceIds:'', sourceIds:'',
datasourceIds:'', datasourceIds:'',
associateReport:0,
reportTemplateName:'',
reportTemplateVersion:'',
} }
) )
@@ -204,14 +226,27 @@ const filterMethod = (query: string, item: { label?: string }) => {
}) })
// 定义规则
const formRuleRef = ref<FormInstance>()
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({ // 定义表单校验规则
name: [{ required: true, message: '检测计划名称必填!', trigger: 'blur' }], const baseRules: Record<string, Array<FormItemRule>> = {
sourceIds: [{ required: true, message: '检测源必选', trigger: 'blur' }], name: [{ required: true, message: '检测计划名称必填', trigger: 'blur' }],
datasourceIds: [{ required: true, message: '数据源必选!', trigger: 'blur' }], sourceIds: [{ required: true, message: '检测源必选!', trigger: 'change' }],
scriptId: [{ required: true, message: '检测脚本必选!', trigger: 'blur' }], datasourceIds: [{ required: true, message: '数据源必选!', trigger: 'change' }],
errorSysId: [{ required: true, message: '误差体系必选!', trigger: 'blur' }], 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 +283,7 @@ const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
if( mode.value === '比对式'){ if( mode.value === '比对式'){
await updatePlan(formContent) await updatePlan(formContent)
}else{ }else{
await updatePlan({...formContent,'sourceIds':[formContent.sourceIds],'datasourceIds':[formContent.datasourceIds]}); await updatePlan({...formContent,'sourceIds':[formContent.sourceIds],'datasourceIds':[formContent.datasourceIds]});
} }
ElMessage.success({ message: `${dialogTitle.value}成功!` }) ElMessage.success({ message: `${dialogTitle.value}成功!` })
@@ -305,14 +341,23 @@ const open = async (sign: string,
if(sign == 'add') if(sign == 'add')
{ {
console.log('add',data) const [pqSource_Result, PqScript_Result, PqErrSys_Result,pqDevList_Result,pqReportName_Result] = await Promise.all([
const [pqSource_Result, PqScript_Result, PqErrSys_Result,pqDevList_Result] = await Promise.all([
getTestSourceList(data), getTestSourceList(data),
getPqScriptList(data), getPqScriptList(data),
getPqErrSysList(), 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[]; pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[];
pqScriptList.value = PqScript_Result.data as TestScript.ResTestScript[]; pqScriptList.value = PqScript_Result.data as TestScript.ResTestScript[];
pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[]; pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[];
@@ -321,14 +366,23 @@ const open = async (sign: string,
unboundPqDevList.value = pqDevList.value unboundPqDevList.value = pqDevList.value
boundPqDevList.value = []; boundPqDevList.value = [];
}else{//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值 }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), getTestSourceList(data),
getPqScriptList(data), getPqScriptList(data),
getPqErrSysList(), getPqErrSysList(),
getBoundPqDevList({ 'planId': data.id }), 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[]; pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[];
pqScriptList.value = PqScript_Result.data as TestScript.ResTestScript[]; pqScriptList.value = PqScript_Result.data as TestScript.ResTestScript[];
pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[]; pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[];
@@ -392,16 +446,16 @@ function pqToArray() {
} }
const dataSourceType = computed(() => { const dataSourceType = computed(() => {
switch (mode.value) { // switch (mode.value) {
case '模拟式': // case '模拟式':
return 'Datasource_Simulate' // return 'Datasource_Simulate'
case '数字式': // case '数字式':
return 'Datasource_Digital' // return 'Datasource_Digital'
default: // default:
return 'Datasource_Contrast' // return 'Datasource_Contrast'
} // }
}) return 'Datasource'
})
// 对外映射 // 对外映射

View File

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

View File

@@ -0,0 +1,285 @@
<template>
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogSmall">
<el-form ref="dialogFormRef" :model="formContent" :rules="rules" style="height: 330px; overflow: hidden;" >
<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;"
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;"
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>
<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 { updatePqReport, addPqReport, getPqReportById } 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)
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;
};
// 对外映射
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,132 @@
<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: '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 AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite"; import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers"; import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import { nodePolyfills } from 'vite-plugin-node-polyfills';
export default defineConfig(({ mode }: ConfigEnv): UserConfig => { export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
const root = process.cwd(); const root = process.cwd();
@@ -59,6 +60,12 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
dts: false, dts: false,
// dts: "src/types/components.d.ts", // dts: "src/types/components.d.ts",
}), }),
nodePolyfills({
include: ['crypto'],
globals: {
crypto: true,
},
}),
], ],
// 基础配置 // 基础配置
base: viteEnv.VITE_PUBLIC_PATH, base: viteEnv.VITE_PUBLIC_PATH,