Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1a740f8bf | ||
|
|
56d035253b | ||
|
|
e7348107d0 | ||
|
|
ea38b4eb21 | ||
| 67ef976739 | |||
| 60145ec4f7 | |||
|
|
81600ddc69 | ||
|
|
e0941d628b | ||
|
|
760dcbf723 | ||
|
|
b75ecb8c66 | ||
|
|
39f4cfa670 | ||
|
|
862251b83c | ||
|
|
312490ce59 | ||
|
|
d7df999cf2 | ||
|
|
e0b1b5907b | ||
|
|
f06ca03881 | ||
|
|
a9b80ed33c | ||
|
|
834230b26a | ||
|
|
403ddbfb6e | ||
|
|
ffb44ea909 | ||
|
|
b729e4efa1 | ||
|
|
962c286fd5 | ||
|
|
c215f51554 | ||
| 859c85b427 | |||
|
|
5fe637e84f | ||
|
|
5f68071c77 | ||
|
|
1675a5af31 | ||
|
|
ec1d09dbd0 | ||
|
|
eda7b516f6 | ||
|
|
630eb48d28 | ||
|
|
0d2f8a7788 | ||
| 230c68f454 | |||
| 68934060e6 | |||
| 846e7514b7 | |||
| 410cfb0f7a | |||
|
|
c892410b07 | ||
|
|
7caa4a5303 | ||
|
|
c17efbf9f6 | ||
| c46abeecf5 | |||
|
|
0947097932 | ||
|
|
50fc02d4eb | ||
|
|
a122e9e1b3 |
@@ -26,6 +26,7 @@
|
||||
"md5": "^2.3.0",
|
||||
"mitt": "^3.0.1",
|
||||
"mkdirp": "^3.0.1",
|
||||
"node-forge": "^1.3.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^2.2.1",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
@@ -45,6 +46,7 @@
|
||||
"@types/html2canvas": "^1.0.0",
|
||||
"@types/md5": "^2.3.2",
|
||||
"@types/node": "^20.14.14",
|
||||
"@types/node-forge": "^1.3.11",
|
||||
"@types/nprogress": "^0.2.0",
|
||||
"@types/qs": "^6.9.8",
|
||||
"@types/sortablejs": "^1.15.2",
|
||||
@@ -74,7 +76,7 @@
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-eslint": "^1.8.1",
|
||||
"vite-plugin-html": "^3.2.0",
|
||||
"vite-plugin-node-polyfills": "^0.22.0",
|
||||
"vite-plugin-node-polyfills": "^0.23.0",
|
||||
"vite-plugin-pwa": "^0.16.5",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vue-tsc": "^2.0.21"
|
||||
|
||||
@@ -13,13 +13,15 @@ export namespace CheckData {
|
||||
// 装置原始数据-被检值
|
||||
data: number,
|
||||
|
||||
|
||||
// 误差值
|
||||
errorData: number,
|
||||
// 第几次谐波
|
||||
num?: number,
|
||||
//符合、不符合
|
||||
isData?: number,
|
||||
//最大误差值
|
||||
radius?: string,
|
||||
unit?: string,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,21 +52,25 @@ export namespace CheckData {
|
||||
errorA?: string,
|
||||
maxErrorA?: string,
|
||||
isDataA?: number,
|
||||
unitA?: string,
|
||||
stdB?: string,
|
||||
dataB?: string,
|
||||
errorB?: string,
|
||||
maxErrorB?: string,
|
||||
isDataB?: number,
|
||||
unitB?: string,
|
||||
stdC?: string,
|
||||
dataC?: string,
|
||||
errorC?: string,
|
||||
maxErrorC?: string,
|
||||
isDataC?: number,
|
||||
unitC?: string,
|
||||
stdT?: string,
|
||||
dataT?: string,
|
||||
errorT?: string,
|
||||
maxErrorT?: string,
|
||||
isDataT?: number,
|
||||
unitT?: string,
|
||||
|
||||
//最大误差值
|
||||
maxError?: string,
|
||||
@@ -93,9 +99,9 @@ export namespace CheckData {
|
||||
|
||||
planId: string; //计划Id
|
||||
devType: string; //设备类型
|
||||
devVolt:number; //设备电压
|
||||
devCurr:number; //设备电流
|
||||
factorFlag:number; //是否支持系数校准
|
||||
devVolt: number; //设备电压
|
||||
devCurr: number; //设备电流
|
||||
factorFlag: number; //是否支持系数校准
|
||||
}
|
||||
|
||||
// 用来描述检测脚本类型
|
||||
@@ -107,7 +113,7 @@ export namespace CheckData {
|
||||
|
||||
// 用来描述 检测数据-左侧树结构
|
||||
export interface TreeItem {
|
||||
id:string | null,
|
||||
id: string | null,
|
||||
scriptTypeName: string | null,
|
||||
sourceDesc: string | null,
|
||||
harmNum: number | null,
|
||||
@@ -123,7 +129,8 @@ export namespace CheckData {
|
||||
SUCCESS = 1,
|
||||
FAIL = 2,
|
||||
TIMEOUT = 3,
|
||||
ERRORDATA = 4
|
||||
ERRORDATA = 4,
|
||||
NOT_PART_IN_ERROR = 5
|
||||
}
|
||||
|
||||
export interface DeviceCheckResult {
|
||||
@@ -143,8 +150,8 @@ export namespace CheckData {
|
||||
|
||||
export enum ButtonColorEnum {
|
||||
INFO = '#909399',
|
||||
LOADING = '#003078',
|
||||
SUCCESS = '#67c23a',
|
||||
LOADING = 'var(--el-color-primary)',
|
||||
SUCCESS = '#91cc75',
|
||||
WARNING = '#e6a23c',
|
||||
DANGER = '#f56c6c',
|
||||
}
|
||||
@@ -154,7 +161,7 @@ export namespace CheckData {
|
||||
*/
|
||||
export interface ButtonResult {
|
||||
color: ButtonColorEnum
|
||||
icon: 'Minus' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled'
|
||||
icon: 'More' | 'Loading' | 'Close' | 'CircleCheckFilled' | 'Link' | 'WarnTriangleFilled' | 'Minus'
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@ import http from "@/api";
|
||||
import {CheckData} from "@/api/check/interface";
|
||||
|
||||
export const getBigTestItem = (params: {
|
||||
reCheckType:number,
|
||||
reCheckType: number,
|
||||
planId: string,
|
||||
devId: string,
|
||||
}) => {
|
||||
@@ -31,9 +31,9 @@ export const getTreeData = (params: {
|
||||
devId?: string,
|
||||
devNum?: string,
|
||||
scriptType?: string | null,
|
||||
code?: number,
|
||||
code?: string,
|
||||
}) => {
|
||||
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true});
|
||||
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: false});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ export const getTableData = (params: {
|
||||
scriptId: string,
|
||||
devId: string,
|
||||
devNum: string,
|
||||
code: number,
|
||||
code: string,
|
||||
index: number,
|
||||
}) => {
|
||||
return http.post("/result/resultData/", params, {loading: false});
|
||||
@@ -56,8 +56,44 @@ export const exportRawData = (params: {
|
||||
scriptId: string,
|
||||
devId: string,
|
||||
devNum: string,
|
||||
code: number,
|
||||
code: string,
|
||||
index: number,
|
||||
}) => {
|
||||
return http.download("/result/exportRawData", params, {loading: false});
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新计算
|
||||
* @param params
|
||||
*/
|
||||
export const reCalculate = (params: {
|
||||
planId: string,
|
||||
scriptId: string,
|
||||
errorSysId: string,
|
||||
deviceId: string,
|
||||
code: string
|
||||
}) => {
|
||||
return http.post("/result/reCalculate", params, {loading: true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更换误差体系
|
||||
* @param params
|
||||
*/
|
||||
export const changeErrorSystem = (params: {
|
||||
planId: string,
|
||||
scriptId: string,
|
||||
errorSysId: string,
|
||||
deviceId: string,
|
||||
code: string
|
||||
}) => {
|
||||
return http.post("/result/changeErrorSystem", params, {loading: true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除(误差体系切换时产生的)临时表
|
||||
* @param code
|
||||
*/
|
||||
export const deleteTempTable = (code: string) => {
|
||||
return http.get(`/result/deleteTempTable?code=${code}`, null, {loading: false})
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Device } from '@/api/device/interface/device'
|
||||
import type {Device} from '@/api/device/interface/device'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
@@ -7,57 +7,65 @@ import http from '@/api'
|
||||
|
||||
//获取被检设备
|
||||
export const getPqDevList = (params: Device.ReqPqDevParams) => {
|
||||
return http.post(`/pqDev/list`, params)
|
||||
return http.post(`/pqDev/list`, params)
|
||||
}
|
||||
|
||||
//添加被检设备
|
||||
export const addPqDev = (params: Device.ResPqDev) => {
|
||||
return http.post(`/pqDev/add`, params)
|
||||
return http.post(`/pqDev/add`, params)
|
||||
}
|
||||
|
||||
//编辑被检设备
|
||||
export const updatePqDev = (params: Device.ResPqDev) => {
|
||||
return http.post(`/pqDev/update`, params)
|
||||
return http.post(`/pqDev/update`, params)
|
||||
}
|
||||
|
||||
//删除被检设备
|
||||
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、模板、通道数、额定电压、额定电流);
|
||||
export const getPqDev = () => {
|
||||
return http.get(`/devType/listAll`)
|
||||
return http.get(`/devType/listAll`)
|
||||
}
|
||||
|
||||
//被检设备归档
|
||||
export const documentedPqDev = (ids: string[]) => {
|
||||
return http.post(`/pqDev/documented`, ids)
|
||||
return http.post(`/pqDev/documented`, ids)
|
||||
}
|
||||
|
||||
@@ -30,5 +30,7 @@ export const deletePqErrSys = (params: string[]) => {
|
||||
return http.post(`/pqErrSys/delete`, params)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//复制误差体系
|
||||
export const copyPqErrSys = (params: ErrorSystem.ErrorSystemList) => {
|
||||
return http.get(`/pqErrSys/copy?id=${params.id}`)
|
||||
}
|
||||
@@ -1,30 +1,32 @@
|
||||
import type { ReqPage,ResPage } from '@/api/interface'
|
||||
import type {ReqPage, ResPage} from '@/api/interface'
|
||||
|
||||
// 被检设备模块
|
||||
export namespace Device {
|
||||
|
||||
/**
|
||||
* 被检设备表格分页查询参数
|
||||
*/
|
||||
export interface ReqPqDevParams extends ReqPage{
|
||||
id: string; // 装置序号id 必填
|
||||
name: string; //设备名称
|
||||
devType?: string; // 设备名称
|
||||
createTime?:string; //创建时间
|
||||
pattern:string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备表格分页查询参数
|
||||
*/
|
||||
export interface ReqDevReportParams extends ReqPage{
|
||||
planId?:string; // 计划id
|
||||
devId?:string; // 装置id
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
* 被检设备表格分页查询参数
|
||||
*/
|
||||
export interface ReqPqDevParams extends ReqPage {
|
||||
id: string; // 装置序号id 必填
|
||||
name: string; //设备名称
|
||||
devType?: string; // 设备名称
|
||||
createTime?: string; //创建时间
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备表格分页查询参数
|
||||
*/
|
||||
export interface ReqDevReportParams extends ReqPage {
|
||||
planId?: string; // 计划id
|
||||
devId?: string; // 装置id
|
||||
scriptId?: string; // 脚本id
|
||||
planCode?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResPqDev {
|
||||
id: string; //装置序号ID
|
||||
name: string; //设备名称
|
||||
@@ -38,54 +40,53 @@ export namespace Device {
|
||||
createId: string; //出厂编号
|
||||
hardwareVersion: string; //固件版本
|
||||
softwareVersion: string; //软件版本
|
||||
protocol:string; //通讯协议
|
||||
protocol: string; //通讯协议
|
||||
ip: string; //IP地址
|
||||
port: number; //端口号
|
||||
encryptionFlag: number; //装置是否为加密版本
|
||||
series?: string| null; //装置识别码(3ds加密)
|
||||
devKey?: string| null; //装置秘钥(3ds加密)
|
||||
sampleID?: string| null; //样品编号
|
||||
series?: string | null; //装置识别码(3ds加密)
|
||||
devKey?: string | null; //装置秘钥(3ds加密)
|
||||
sampleId?: string | null; //样品编号
|
||||
arrivedDate?: string; //送样日期
|
||||
cityName?: string| null; //所属地市名称
|
||||
gDName?: string| null; //所属供电公司名称
|
||||
subName?: string| null; //所属电站名称
|
||||
checkState?: number| null; //检测状态
|
||||
checkResult?: number| null; //检测结果
|
||||
reportState?: number| null; //报告状态
|
||||
reportPath?: string| null; //报告路径
|
||||
qRCode?: string| null; //设备关键信息二维码
|
||||
cityName?: string | null; //所属地市名称
|
||||
gDName?: string | null; //所属供电公司名称
|
||||
subName?: string | null; //所属电站名称
|
||||
checkState?: number | null; //检测状态
|
||||
checkResult?: number | null; //检测结果
|
||||
reportState?: number | null; //报告状态
|
||||
reportPath?: string | null; //报告路径
|
||||
qRCode?: string | null; //设备关键信息二维码
|
||||
reCheckNum: number; //复检次数
|
||||
planId?:string;//检测计划Id
|
||||
timeCheckResult?:number;//守时检测结果(0:不符合1:符合)
|
||||
factorFlag?:number;//是否支持系数校准(0:不支持,1:支持)
|
||||
planId?: string;//检测计划Id
|
||||
timeCheckResult?: number;//守时检测结果(0:不符合1:符合)
|
||||
factorFlag?: number;//是否支持系数校准(0:不支持,1:支持)
|
||||
factorCheckResult?: number;//系数校准结果(0:不合格,1:合格,2:/表示没有做系数校准)
|
||||
state: number; //状态
|
||||
createBy?: string| null; //创建用户
|
||||
createTime?: string| null; //创建时间
|
||||
updateBy?: string| null; //更新用户
|
||||
updateTime?: string| null; //更新时间
|
||||
icdId: string| null;
|
||||
power: string| null;//工作电源
|
||||
preinvestmentPlan: string| null;
|
||||
createBy?: string | null; //创建用户
|
||||
createTime?: string | null; //创建时间
|
||||
updateBy?: string | null; //更新用户
|
||||
updateTime?: string | null; //更新时间
|
||||
icdId: string | null;
|
||||
power: string | null;//工作电源
|
||||
preinvestmentPlan: string | null;
|
||||
}
|
||||
|
||||
|
||||
export interface ResDev{
|
||||
id: string;
|
||||
name: string ,
|
||||
icd:string ,
|
||||
power:string,
|
||||
devVolt:number,
|
||||
devCurr:number,
|
||||
devChns:number,
|
||||
export interface ResDev {
|
||||
id: string;
|
||||
name: string,
|
||||
icd: string,
|
||||
power: string,
|
||||
devVolt: number,
|
||||
devCurr: number,
|
||||
devChns: number,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 被检设备表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResPqDevPage extends ResPage<ResPqDev> {
|
||||
|
||||
/**
|
||||
* 被检设备表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResPqDevPage extends ResPage<ResPqDev> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
frontend/src/api/device/interface/report.ts
Normal file
39
frontend/src/api/device/interface/report.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { ReqPage, ResPage } from '@/api/interface'
|
||||
import type { UploadFile } from 'element-plus';
|
||||
|
||||
// 报告模版接口
|
||||
export namespace PqReport {
|
||||
|
||||
/**
|
||||
* 报告模版表格分页查询参数
|
||||
*/
|
||||
export interface ReqReportParams extends ReqPage {
|
||||
id: string; // 装置序号id 必填
|
||||
name?: string; // 设备名称
|
||||
createTime?: string; //创建时间
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告模版新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResReport {
|
||||
id: string; //报告模板id
|
||||
name: string;//报告模板名称
|
||||
version:string;//版本号
|
||||
baseFile?:string;//基础模板文件路径
|
||||
detailFile?:string;//检测项模版文件路径
|
||||
description:string;//描述信息
|
||||
state:number;//状态:8-删除 1-正常
|
||||
createBy?: string| null; //创建用户
|
||||
createTime?: string| null; //创建时间
|
||||
updateBy?: string| null; //更新用户
|
||||
updateTime?: string| null; //更新时间
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告模版表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResReportPage extends ResPage<ResReport> {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,39 +2,37 @@ import type { ReqPage, ResPage } from '@/api/interface'
|
||||
|
||||
// 检测脚本模块
|
||||
export namespace TestScript {
|
||||
|
||||
|
||||
/**
|
||||
* 检测脚本表格分页查询参数
|
||||
*/
|
||||
export interface ReqTestScriptParams extends ReqPage{
|
||||
id: string; // 装置序号id 必填
|
||||
name: string;
|
||||
type: string;
|
||||
pattern:string;
|
||||
}
|
||||
/**
|
||||
* 检测脚本表格分页查询参数
|
||||
*/
|
||||
export interface ReqTestScriptParams extends ReqPage {
|
||||
id: string // 装置序号id 必填
|
||||
name: string
|
||||
type: string
|
||||
pattern: string
|
||||
}
|
||||
|
||||
// 检测脚本接口
|
||||
export interface ResTestScript {
|
||||
id?: string; //检测脚本ID
|
||||
name: string; //检测脚本名称
|
||||
type: string; //设定0为脚本,1为模板
|
||||
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
||||
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||
standardName: string;//参照标准名称
|
||||
standardTime: string;//标准推行时间
|
||||
state?:number;//
|
||||
createBy?: string;
|
||||
createTime?: string;
|
||||
updateBy?: string;
|
||||
updateTime?: string;
|
||||
selectedValue?: string;
|
||||
id?: string //检测脚本ID
|
||||
name: string //检测脚本名称
|
||||
type: string //设定0为脚本,1为模板
|
||||
pattern: string //检测脚本模式(字典表Code字段,数字、模拟、比对)
|
||||
valueType?: string //脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||
standardName: string //参照标准名称
|
||||
standardTime: string //标准推行时间
|
||||
state?: number //
|
||||
createBy?: string
|
||||
createTime?: string
|
||||
updateBy?: string
|
||||
updateTime?: string
|
||||
selectedValue?: string
|
||||
ratedCurr?: number
|
||||
ratedVolt?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测脚本查询分页返回的对象;
|
||||
*/
|
||||
export interface ResTestScriptPage extends ResPage<ResTestScript> {
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 检测脚本查询分页返回的对象;
|
||||
*/
|
||||
export interface ResTestScriptPage extends ResPage<ResTestScript> {}
|
||||
}
|
||||
|
||||
42
frontend/src/api/device/report/index.ts
Normal file
42
frontend/src/api/device/report/index.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import type {PqReport} from '@/api/device/interface/report'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
* @name 报告模版模块
|
||||
*/
|
||||
|
||||
//获取报告模版
|
||||
export const getPqReportList = (params: PqReport.ReqReportParams) => {
|
||||
return http.post(`/report/list`, params)
|
||||
}
|
||||
|
||||
//新增报告模版
|
||||
export const addPqReport = (params: PqReport.ResReport) => {
|
||||
return http.upload(`/report/add`, params)
|
||||
}
|
||||
|
||||
//删除报告模版
|
||||
export const deletePqReport = (params: string[]) => {
|
||||
return http.post(`/report/delete`, params)
|
||||
}
|
||||
|
||||
//查询报告模板详情
|
||||
export const getPqReportById = (params: PqReport.ResReport) => {
|
||||
return http.get(`/report/getById?id=${params.id}`)
|
||||
}
|
||||
|
||||
//修改报告模板
|
||||
export const updatePqReport = (params: PqReport.ResReport) => {
|
||||
return http.upload(`/report/update`, params)
|
||||
}
|
||||
|
||||
//查询所有报告模板名称
|
||||
export const getPqReportAllName = () => {
|
||||
return http.get(`/report/listAllName`)
|
||||
}
|
||||
|
||||
//根据名称查询指定报告模板的所有版本
|
||||
export const getPqReportAllVersion = (params:any) => {
|
||||
return http.get(`/report/listAllVersion?name=${params.name}`)
|
||||
}
|
||||
|
||||
@@ -84,12 +84,12 @@ class RequestHttp {
|
||||
}
|
||||
}
|
||||
// 登陆失效
|
||||
if (data.code == ResultEnum.OVERDUE) {
|
||||
if (data.code === ResultEnum.OVERDUE) {
|
||||
console.log("登陆失效")
|
||||
userStore.setAccessToken('')
|
||||
userStore.setRefreshToken('')
|
||||
userStore.setIsRefreshToken(false)
|
||||
userStore.setUserInfo({ name: '' })
|
||||
userStore.setUserInfo({ id:'',name: '' })
|
||||
await router.replace(LOGIN_URL)
|
||||
if(isFirst){//临时处理token失效弹窗多次
|
||||
ElMessage.error(data.message)
|
||||
|
||||
@@ -22,6 +22,10 @@ export namespace Plan {
|
||||
createTime?:string; //创建时间
|
||||
updateBy?:string; //更新用户
|
||||
updateTime?:string; //更新时间
|
||||
|
||||
associateReport:number;//是否关联报告模板 0否 1是
|
||||
reportTemplateName:string;
|
||||
reportTemplateVersion:string
|
||||
}
|
||||
|
||||
// 检测计划 + 分页
|
||||
|
||||
@@ -63,17 +63,17 @@ export const getPlanListByPattern = (params: Plan.ReqPlan) => {
|
||||
}
|
||||
|
||||
// 导出检测计划
|
||||
export const exportCNPlan = (params: Device.ReqPqDevParams) => {
|
||||
return http.download(`/adPlan/exportCNPlan`, params)
|
||||
export const exportPlan = (params: Device.ReqPqDevParams) => {
|
||||
return http.download(`/adPlan/export`, params)
|
||||
}
|
||||
|
||||
// 下载模板
|
||||
export const downloadCNPlanTemplate = () => {
|
||||
return http.download(`/adPlan/downloadCNPlanTemplate`)
|
||||
export const downloadTemplate = () => {
|
||||
return http.download(`/adPlan/downloadTemplate`)
|
||||
}
|
||||
// 导入检测计划
|
||||
export const importCNPlan = (params: Device.ReqPqDevParams) => {
|
||||
return http.uploadExcel(`/adPlan/importCNPlan`, params)
|
||||
export const importPlan = (params: Device.ReqPqDevParams) => {
|
||||
return http.uploadExcel(`/adPlan/import`, params)
|
||||
}
|
||||
|
||||
// 装置检测报告生成
|
||||
|
||||
@@ -13,9 +13,9 @@ export const closePreTest = (params) => {
|
||||
* 开始正式检测
|
||||
* @param params
|
||||
*/
|
||||
export const startTest = (params) => {
|
||||
return http.post(`/prepare/startTest`, params, {loading: false})
|
||||
}
|
||||
// export const startTest = (params) => {
|
||||
// return http.post(`/prepare/startTest`, params, {loading: false})
|
||||
// }
|
||||
|
||||
/**
|
||||
* 暂停正式检测
|
||||
|
||||
@@ -5,6 +5,7 @@ export namespace Login {
|
||||
export interface ReqLoginForm {
|
||||
username: string;
|
||||
password: string;
|
||||
checked: boolean;
|
||||
}
|
||||
export interface ResLogin {
|
||||
accessToken: string;
|
||||
|
||||
@@ -1,40 +1,59 @@
|
||||
import type { Login } from '@/api/user/interface/user'
|
||||
import { ADMIN as rePrefix } from '@/api/system/config/serviceName'
|
||||
import type {Login} from '@/api/user/interface/user'
|
||||
import {ADMIN as rePrefix} from '@/api/system/config/serviceName'
|
||||
import http from '@/api'
|
||||
import type { Dict } from '@/api/interface'
|
||||
import type {Dict} from '@/api/interface'
|
||||
|
||||
/**
|
||||
* @name 登录模块
|
||||
*/
|
||||
// 用户登录
|
||||
export const loginApi = (params: Login.ReqLoginForm) => {
|
||||
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false })
|
||||
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
||||
export const loginApi = (params: { username: string; password: string,checked: boolean }) => {
|
||||
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, {loading: false})
|
||||
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
||||
}
|
||||
// 获取菜单列表
|
||||
export const getAuthMenuListApi = () => {
|
||||
return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, { loading: false })
|
||||
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
||||
return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, {loading: false})
|
||||
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
||||
}
|
||||
// 获取按钮权限
|
||||
export const getAuthButtonListApi = () => {
|
||||
return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, { loading: false })
|
||||
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
||||
return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, {loading: false})
|
||||
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
||||
}
|
||||
// 用户退出登录
|
||||
export const logoutApi = () => {
|
||||
return http.post(`${rePrefix}/logout`)
|
||||
return http.post(`${rePrefix}/logout`)
|
||||
}
|
||||
|
||||
//获取下拉框列表
|
||||
export const getDictList = () =>{
|
||||
return http.get<Dict>('/dictData/dictDataCache')
|
||||
export const getDictList = () => {
|
||||
return http.get<Dict>('/dictData/dictDataCache')
|
||||
}
|
||||
|
||||
//token刷新
|
||||
export const refreshToken = () => {
|
||||
return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`,
|
||||
{},
|
||||
{ loading: false }
|
||||
return http.get<Login.ResLogin>(`${rePrefix}/refreshToken`,
|
||||
{},
|
||||
{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})
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ export const HOME_URL: string = "/home/index";
|
||||
export const LOGIN_URL: string = "/login";
|
||||
|
||||
// 默认主题颜色
|
||||
export const DEFAULT_PRIMARY: string = "#003078";
|
||||
export const DEFAULT_PRIMARY: string = "#526ADE";
|
||||
|
||||
// 路由白名单地址(本地存在的路由 staticRouter.ts 中)
|
||||
export const ROUTER_WHITE_LIST: string[] = ["/500"];
|
||||
@@ -19,3 +19,5 @@ export const AMAP_MAP_KEY: string = "";
|
||||
|
||||
// 百度地图 key
|
||||
export const BAIDU_MAP_KEY: string = "";
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
export enum ResultEnum {
|
||||
SUCCESS = "A0000",
|
||||
ERROR = 500,
|
||||
ACCESSTOKEN_EXPIRED = 401,
|
||||
OVERDUE = 4001,
|
||||
ACCESSTOKEN_EXPIRED = "A0024",
|
||||
OVERDUE = "A0025",
|
||||
TIMEOUT = 30000,
|
||||
TYPE = "success"
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ export const useTheme = () => {
|
||||
|
||||
// 修改主题颜色
|
||||
const changePrimary = (val: string | null) => {
|
||||
|
||||
if (!val) {
|
||||
val = DEFAULT_PRIMARY;
|
||||
ElMessage({ type: "success", message: `主题颜色已重置为 ${DEFAULT_PRIMARY}` });
|
||||
@@ -40,10 +41,13 @@ export const useTheme = () => {
|
||||
for (let i = 1; i <= 9; i++) {
|
||||
const primaryColor = isDark.value ? `${getDarkColor(val, i / 10)}` : `${getLightColor(val, i / 10)}`;
|
||||
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, primaryColor);
|
||||
|
||||
// const colorValue = document.documentElement.style.getPropertyValue(`--el-color-primary-light-${i}`).trim();
|
||||
// console.log(`--el-color-primary-light-${i}: ${colorValue}`);
|
||||
}
|
||||
globalStore.setGlobalState("primary", val);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
// 灰色和弱色切换
|
||||
const changeGreyOrWeak = (type: Theme.GreyOrWeakType, value: boolean) => {
|
||||
const body = document.body as HTMLElement;
|
||||
|
||||
@@ -26,6 +26,7 @@ export default {
|
||||
changePassword: "Change Password",
|
||||
changeMode:"Change Mode",
|
||||
versionRegister:"Version Register",
|
||||
changeTheme: "Change Theme",
|
||||
logout: "Logout"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@ export default {
|
||||
changePassword: "修改密码",
|
||||
changeMode:"模式切换",
|
||||
versionRegister:"版本注册",
|
||||
changeTheme:"主题切换",
|
||||
logout: "退出登录"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
}
|
||||
.el-menu-item:hover {
|
||||
color: #fff; //一级导航划过颜色
|
||||
background-color: #5274a5 !important; //一级导航划过背景色
|
||||
//background-color: #5274a5 !important; //一级导航划过背景色
|
||||
background-color:var(--el-color-primary-light-3) !important;
|
||||
|
||||
}
|
||||
.el-sub-menu__hide-arrow {
|
||||
width: 65px;
|
||||
@@ -47,7 +49,9 @@
|
||||
}
|
||||
.el-menu-item.is-active {
|
||||
color: #fff !important; //一级导航文字选中颜色
|
||||
background-color: #5274a5 !important; //一级导航选中背景色
|
||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
border-bottom: 0 !important;
|
||||
}
|
||||
.el-sub-menu__title {
|
||||
@@ -67,7 +71,9 @@
|
||||
color: #fff !important; //二级导航文字选中颜色
|
||||
// background-color: var(--el-color-primary) !important;
|
||||
// background-color: #5274a5 !important;//二级导航选中背景色
|
||||
background-color: #5274a5 !important;
|
||||
|
||||
//background-color: #7588e5 !important;
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
border-bottom-color: var(--el-color-primary) !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<p style="margin: 0;">
|
||||
<p style="margin: 0;" >
|
||||
<a href="http://www.shining-electric.com/" target="_blank">
|
||||
2024 © 南京灿能电力自动化股份有限公司
|
||||
</a>
|
||||
@@ -117,10 +117,11 @@ const handelOpen = async (item: string) => {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
text-align: right;
|
||||
line-height: 40px;
|
||||
a {
|
||||
color: #fff;
|
||||
margin-right: 25px; // 增加右边距
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,17 +18,20 @@
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="openDialog('themeRef')">
|
||||
<el-icon><Sunny /></el-icon>{{ t("header.changeTheme") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDialog('infoRef')">
|
||||
<el-icon><User /></el-icon>{{ $t("header.personalData") }}
|
||||
<el-icon><User /></el-icon>{{ t("header.personalData") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDialog('passwordRef')">
|
||||
<el-icon><Edit /></el-icon>{{ $t("header.changePassword") }}
|
||||
<el-icon><Edit /></el-icon>{{ t("header.changePassword") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="changeMode">
|
||||
<el-icon><Edit /></el-icon>{{ $t("header.changeMode") }}
|
||||
<el-icon><Switch /></el-icon>{{ t("header.changeMode") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDialog('versionRegisterRef')">
|
||||
<el-icon><SetUp /></el-icon>{{ $t("header.versionRegister") }}
|
||||
<el-icon><SetUp /></el-icon>{{ t("header.versionRegister") }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
@@ -42,6 +45,9 @@
|
||||
<PasswordDialog ref="passwordRef"></PasswordDialog>
|
||||
<!-- versionRegisterDialog -->
|
||||
<VersionDialog ref="versionRegisterRef"></VersionDialog>
|
||||
<!-- ThemeDialog -->
|
||||
<ThemeDialog ref="themeRef"></ThemeDialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -50,12 +56,13 @@ import { LOGIN_URL } from "@/config";
|
||||
import { useRouter } from "vue-router";
|
||||
import { logoutApi } from "@/api/user/login";
|
||||
import { useUserStore } from "@/stores/modules/user";
|
||||
import { ElMessageBox, ElMessage } from "element-plus";
|
||||
import { ElMessageBox, ElMessage, CHANGE_EVENT } from "element-plus";
|
||||
import InfoDialog from "./InfoDialog.vue";
|
||||
import PasswordDialog from "./PasswordDialog.vue";
|
||||
import ThemeDialog from "./ThemeDialog.vue";
|
||||
import VersionDialog from "@/views/system/versionRegister/index.vue";
|
||||
import { computed } from "vue";
|
||||
import { Avatar } from "@element-plus/icons-vue";
|
||||
import { Avatar, Delete, Document, Sunny, Switch } from "@element-plus/icons-vue";
|
||||
import AssemblySize from "./components/AssemblySize.vue";
|
||||
import Language from "./components/Language.vue";
|
||||
import SearchMenu from "./components/SearchMenu.vue";
|
||||
@@ -72,6 +79,14 @@ const router = useRouter();
|
||||
const authStore = useAuthStore();
|
||||
const modeStore = useModeStore();
|
||||
const AppSceneStore = useAppSceneStore();
|
||||
import { useTheme } from "@/hooks/useTheme";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import {getPublicKey} from "@/api/user/login"; // 引入 vue-i18n 钩子
|
||||
const { changePrimary} = useTheme();
|
||||
|
||||
// 初始化 i18n
|
||||
const { t } = useI18n(); // 使用 t 方法替代 $t
|
||||
|
||||
// 退出登录
|
||||
const logout = () => {
|
||||
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
|
||||
@@ -84,7 +99,7 @@ const logout = () => {
|
||||
// 2.清除 Token
|
||||
userStore.setAccessToken("");
|
||||
userStore.setRefreshToken("");
|
||||
userStore.setUserInfo({name: ""});
|
||||
userStore.setUserInfo({id: "", name: ""});
|
||||
userStore.setIsRefreshToken(false)
|
||||
dictStore.setDictData([]);
|
||||
modeStore.setCurrentMode('');
|
||||
@@ -101,12 +116,19 @@ const logout = () => {
|
||||
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
|
||||
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
|
||||
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null);
|
||||
|
||||
const themeRef = ref<InstanceType<typeof ThemeDialog> | null>(null);
|
||||
const openDialog = (ref: string) => {
|
||||
if (ref == "infoRef") infoRef.value?.openDialog();
|
||||
if (ref == "passwordRef") passwordRef.value?.openDialog();
|
||||
if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog();
|
||||
if (ref == "themeRef") themeRef.value?.openDialog();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//模式切换
|
||||
const changeMode = () => {
|
||||
authStore.changeModel();
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" title="主题切换" width="500px" draggable>
|
||||
<el-divider content-position="center">主题颜色</el-divider>
|
||||
<div style="display: flex; justify-content: center;">
|
||||
<el-color-picker v-model="color" />
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="sure">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useTheme } from "@/hooks/useTheme";
|
||||
import { on } from "events";
|
||||
const color = ref('')
|
||||
const { changePrimary} = useTheme();
|
||||
|
||||
const dialogVisible = ref(false);
|
||||
const openDialog = () => {
|
||||
// 修复:使用可选链和空值合并运算符确保不会出现 null 或 undefined
|
||||
const storedColor = JSON.parse(localStorage.getItem('cn-global') ?? '{}').primary;
|
||||
color.value = storedColor ?? '#526ADE'; // 默认值为 '#526ADE'
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
|
||||
const sure = () => {
|
||||
changePrimary(color.value); // 切换主题
|
||||
dialogVisible.value = false;
|
||||
};
|
||||
|
||||
// onMounted(() => {
|
||||
// // 修复:使用可选链和空值合并运算符确保不会出现 null 或 undefined
|
||||
// const storedColor = JSON.parse(localStorage.getItem('cn-global') ?? '{}').primary;
|
||||
// console.log('123',storedColor)
|
||||
// color.value = storedColor ?? '#526ADE'; // 默认值为 '#526ADE'
|
||||
// })
|
||||
|
||||
defineExpose({ openDialog });
|
||||
</script>
|
||||
|
||||
@@ -33,14 +33,19 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
||||
// color: var(--el-menu-hover-text-color) !important;
|
||||
// background-color: transparent !important;
|
||||
color: #fff !important;//一级导航文字选中颜色
|
||||
background-color: #5274a5 !important; //一级导航选中背景色
|
||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
}
|
||||
.el-menu--collapse {
|
||||
.is-active {
|
||||
.el-sub-menu__title {
|
||||
color: #ffffff !important;
|
||||
// background-color: var(--el-color-primary) !important;
|
||||
background-color: #5274a5 !important;
|
||||
//background-color: #5274a5 !important;
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
border-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
@@ -53,7 +58,9 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
||||
// color: var(--el-menu-active-color) !important;
|
||||
// background-color: var(--el-menu-active-bg-color) !important;
|
||||
color: #fff !important;//一级导航文字选中颜色
|
||||
background-color: #5274a5 !important; //一级导航选中背景色
|
||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
<template>
|
||||
<div class='tabs-box'>
|
||||
<div class='tabs-menu'>
|
||||
<el-tabs v-model='tabsMenuValue' type='card' @tab-click='tabClick' @tab-remove='tabRemove'>
|
||||
<el-tab-pane v-for='item in tabsMenuList' :key='item.path' :label='item.title' :name='item.path'
|
||||
:closable='item.close'>
|
||||
<template #label>
|
||||
<el-icon v-show='item.icon && tabsIcon' class='tabs-icon'>
|
||||
<component :is='item.icon'></component>
|
||||
</el-icon>
|
||||
{{ item.title }}
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<MoreButton />
|
||||
<div class="tabs-box">
|
||||
<div class="tabs-menu">
|
||||
<el-tabs v-model="tabsMenuValue" type="card" @tab-click="tabClick" @tab-remove="tabRemove">
|
||||
<el-tab-pane
|
||||
v-for="item in tabsMenuList"
|
||||
:key="item.path"
|
||||
:label="item.title"
|
||||
:name="item.path"
|
||||
:closable="item.close"
|
||||
>
|
||||
<template #label>
|
||||
<el-icon v-show="item.icon && tabsIcon" class="tabs-icon">
|
||||
<component :is="item.icon"></component>
|
||||
</el-icon>
|
||||
{{ item.title }}
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<MoreButton />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
<script setup lang="ts">
|
||||
import Sortable from 'sortablejs'
|
||||
import { ref, computed, watch, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
@@ -38,79 +43,80 @@ const tabsMenuList = computed(() => tabStore.tabsMenuList)
|
||||
const tabsIcon = computed(() => globalStore.tabsIcon)
|
||||
|
||||
onMounted(() => {
|
||||
tabsDrop()
|
||||
initTabs()
|
||||
tabsDrop()
|
||||
initTabs()
|
||||
})
|
||||
|
||||
|
||||
// 监听路由的变化(防止浏览器后退/前进不变化 tabsMenuValue)
|
||||
watch(
|
||||
() => route.fullPath,
|
||||
() => {
|
||||
if (route.meta.isFull) return
|
||||
if (route.meta.hideTab){
|
||||
tabsMenuValue.value = route.meta.parentPath as string
|
||||
}else{
|
||||
tabsMenuValue.value = route.fullPath
|
||||
const tabsParams = {
|
||||
icon: route.meta.icon as string,
|
||||
title: route.meta.title as string,
|
||||
path: route.fullPath,
|
||||
name: route.name as string,
|
||||
close: !route.meta.isAffix,
|
||||
isKeepAlive: route.meta.isKeepAlive as boolean,
|
||||
}
|
||||
tabStore.addTabs(tabsParams)
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
() => route.fullPath,
|
||||
() => {
|
||||
if (route.meta.isFull) return
|
||||
if (route.meta.hideTab) {
|
||||
tabsMenuValue.value = route.meta.parentPath as string
|
||||
} else {
|
||||
tabsMenuValue.value = route.fullPath
|
||||
const tabsParams = {
|
||||
icon: route.meta.icon as string,
|
||||
title: route.meta.title as string,
|
||||
path: route.fullPath,
|
||||
name: route.name as string,
|
||||
close: !route.meta.isAffix,
|
||||
isKeepAlive: route.meta.isKeepAlive as boolean
|
||||
}
|
||||
tabStore.addTabs(tabsParams)
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
// 初始化需要固定的 tabs
|
||||
const initTabs = () => {
|
||||
authStore.flatMenuListGet.forEach(item => {
|
||||
if (item.meta.isAffix && !item.meta.isHide && !item.meta.isFull) {
|
||||
const tabsParams = {
|
||||
icon: item.meta.icon,
|
||||
title: item.meta.title,
|
||||
path: item.path,
|
||||
name: item.name,
|
||||
close: !item.meta.isAffix,
|
||||
isKeepAlive: item.meta.isKeepAlive,
|
||||
unshift:true
|
||||
}
|
||||
tabStore.addTabs(tabsParams)
|
||||
}
|
||||
})
|
||||
authStore.flatMenuListGet.forEach(item => {
|
||||
if (item.meta.isAffix && !item.meta.isHide && !item.meta.isFull) {
|
||||
const tabsParams = {
|
||||
icon: item.meta.icon,
|
||||
title: item.meta.title,
|
||||
path: item.path,
|
||||
name: item.name,
|
||||
close: !item.meta.isAffix,
|
||||
isKeepAlive: item.meta.isKeepAlive,
|
||||
unshift: true
|
||||
}
|
||||
tabStore.addTabs(tabsParams)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// tabs 拖拽排序
|
||||
const tabsDrop = () => {
|
||||
Sortable.create(document.querySelector('.el-tabs__nav') as HTMLElement, {
|
||||
draggable: '.el-tabs__item',
|
||||
animation: 300,
|
||||
onEnd({ newIndex, oldIndex }) {
|
||||
const tabsList = [...tabStore.tabsMenuList]
|
||||
const currRow = tabsList.splice(oldIndex as number, 1)[0]
|
||||
tabsList.splice(newIndex as number, 0, currRow)
|
||||
tabStore.setTabs(tabsList)
|
||||
},
|
||||
})
|
||||
Sortable.create(document.querySelector('.el-tabs__nav') as HTMLElement, {
|
||||
draggable: '.el-tabs__item',
|
||||
animation: 300,
|
||||
onEnd({ newIndex, oldIndex }) {
|
||||
const tabsList = [...tabStore.tabsMenuList]
|
||||
const currRow = tabsList.splice(oldIndex as number, 1)[0]
|
||||
tabsList.splice(newIndex as number, 0, currRow)
|
||||
tabStore.setTabs(tabsList)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Tab Click
|
||||
const tabClick = (tabItem: TabsPaneContext) => {
|
||||
const fullPath = tabItem.props.name as string
|
||||
// console.log("🚀 ~ tabClick ~ fullPath:", tabItem)
|
||||
router.push(fullPath)
|
||||
const fullPath = tabItem.props.name as string
|
||||
// console.log("🚀 ~ tabClick ~ fullPath:", tabItem)
|
||||
router.push(fullPath)
|
||||
}
|
||||
|
||||
// Remove Tab
|
||||
const tabRemove = (fullPath: TabPaneName) => {
|
||||
tabStore.removeTabs(fullPath as string, fullPath == route.fullPath)
|
||||
|
||||
|
||||
tabStore.removeTabs(fullPath as string, fullPath == route.fullPath || '/machine/testScriptAdd' == route.fullPath)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
@import "./index.scss";
|
||||
<style scoped lang="scss">
|
||||
@import './index.scss';
|
||||
</style>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
border-radius: 3px;
|
||||
}
|
||||
.layout-light {
|
||||
background-color: var(--el-color-primary-light-5);
|
||||
background-color: var(--el-color-primary-light-3);
|
||||
border-radius: 3px;
|
||||
}
|
||||
.layout-content {
|
||||
|
||||
@@ -65,5 +65,6 @@ const setupAll = async () => {
|
||||
|
||||
//挂载app
|
||||
setupAll().then(() => {
|
||||
|
||||
app.mount('#app')
|
||||
})
|
||||
|
||||
@@ -6,60 +6,60 @@ export type LanguageType = 'zh' | 'en' | null;
|
||||
|
||||
/* GlobalState */
|
||||
export interface GlobalState {
|
||||
layout: LayoutType;
|
||||
assemblySize: AssemblySizeType;
|
||||
language: LanguageType;
|
||||
maximize: boolean;
|
||||
primary: string;
|
||||
isDark: boolean;
|
||||
isGrey: boolean;
|
||||
isWeak: boolean;
|
||||
asideInverted: boolean;
|
||||
headerInverted: boolean;
|
||||
isCollapse: boolean;
|
||||
accordion: boolean;
|
||||
breadcrumb: boolean;
|
||||
breadcrumbIcon: boolean;
|
||||
tabs: boolean;
|
||||
tabsIcon: boolean;
|
||||
footer: boolean;
|
||||
layout: LayoutType;
|
||||
assemblySize: AssemblySizeType;
|
||||
language: LanguageType;
|
||||
maximize: boolean;
|
||||
primary: string;
|
||||
isDark: boolean;
|
||||
isGrey: boolean;
|
||||
isWeak: boolean;
|
||||
asideInverted: boolean;
|
||||
headerInverted: boolean;
|
||||
isCollapse: boolean;
|
||||
accordion: boolean;
|
||||
breadcrumb: boolean;
|
||||
breadcrumbIcon: boolean;
|
||||
tabs: boolean;
|
||||
tabsIcon: boolean;
|
||||
footer: boolean;
|
||||
}
|
||||
|
||||
/* UserState */
|
||||
export interface UserState {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
isRefreshToken: boolean;
|
||||
userInfo: { name: string };
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
isRefreshToken: boolean;
|
||||
userInfo: { id: string, name: string };
|
||||
}
|
||||
|
||||
/* tabsMenuProps */
|
||||
export interface TabsMenuProps {
|
||||
icon: string;
|
||||
title: string;
|
||||
path: string;
|
||||
name: string;
|
||||
close: boolean;
|
||||
isKeepAlive: boolean;
|
||||
unshift?: boolean;
|
||||
icon: string;
|
||||
title: string;
|
||||
path: string;
|
||||
name: string;
|
||||
close: boolean;
|
||||
isKeepAlive: boolean;
|
||||
unshift?: boolean;
|
||||
}
|
||||
|
||||
/* TabsState */
|
||||
export interface TabsState {
|
||||
tabsMenuList: TabsMenuProps[];
|
||||
tabsMenuList: TabsMenuProps[];
|
||||
}
|
||||
|
||||
/* AuthState */
|
||||
export interface AuthState {
|
||||
routeName: string;
|
||||
authButtonList: {
|
||||
[key: string]: string[];
|
||||
};
|
||||
authMenuList: Menu.MenuOptions[];
|
||||
showMenuFlag: boolean;
|
||||
routeName: string;
|
||||
authButtonList: {
|
||||
[key: string]: string[];
|
||||
};
|
||||
authMenuList: Menu.MenuOptions[];
|
||||
showMenuFlag: boolean;
|
||||
}
|
||||
|
||||
/* KeepAliveState */
|
||||
export interface KeepAliveState {
|
||||
keepAliveName: string[];
|
||||
keepAliveName: string[];
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@ import {defineStore} from "pinia";
|
||||
import {CHECK_STORE_KEY} from "@/stores/constant";
|
||||
import type {CheckData} from "@/api/check/interface";
|
||||
import type {Plan} from '@/api/plan/interface'
|
||||
import {useAppSceneStore} from "@/stores/modules/mode";
|
||||
|
||||
|
||||
const AppSceneStore = useAppSceneStore()
|
||||
export const useCheckStore = defineStore("check", {
|
||||
id: CHECK_STORE_KEY,
|
||||
|
||||
@@ -13,7 +14,7 @@ export const useCheckStore = defineStore("check", {
|
||||
selectTestItems: Object<CheckData.SelectTestItem>({preTest: true, timeTest: true, channelsTest: false, test: true}),
|
||||
checkType:1, // 0:手动检测 1:自动检测
|
||||
reCheckType: 1, // 0:不合格项复检 1:全部复检
|
||||
showDetailType: 0 // 0:数据查询 1:误差体系跟换
|
||||
showDetailType: 0 // 0:数据查询 1:误差体系跟换 2:正式检测
|
||||
}),
|
||||
|
||||
getters: {},
|
||||
@@ -30,7 +31,11 @@ export const useCheckStore = defineStore("check", {
|
||||
},
|
||||
initSelectTestItems() {
|
||||
this.selectTestItems.preTest = true
|
||||
this.selectTestItems.channelsTest = false
|
||||
if (AppSceneStore.currentScene === '1') {
|
||||
this.selectTestItems.channelsTest = true
|
||||
} else {
|
||||
this.selectTestItems.timeTest = true
|
||||
}
|
||||
this.selectTestItems.test = true
|
||||
},
|
||||
setSelectTestItems(selectTestItems: CheckData.SelectTestItem) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { GlobalState } from "@/stores/interface";
|
||||
import { DEFAULT_PRIMARY } from "@/config";
|
||||
import { DEFAULT_PRIMARY} from "@/config";
|
||||
import piniaPersistConfig from "@/stores/helper/persist";
|
||||
import {GLOBAL_STORE_KEY} from "@/stores/constant";
|
||||
|
||||
@@ -31,7 +31,7 @@ export const useGlobalStore = defineStore({
|
||||
// 折叠菜单
|
||||
isCollapse: false,
|
||||
// 菜单手风琴
|
||||
accordion: true,
|
||||
accordion: false,
|
||||
// 面包屑导航
|
||||
breadcrumb: true,
|
||||
// 面包屑导航图标
|
||||
@@ -42,12 +42,14 @@ export const useGlobalStore = defineStore({
|
||||
tabsIcon: true,
|
||||
// 页脚
|
||||
footer: false
|
||||
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
// Set GlobalState
|
||||
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
|
||||
this.$patch({ [args[0]]: args[1] });
|
||||
console.log(DEFAULT_PRIMARY);
|
||||
}
|
||||
},
|
||||
persist: piniaPersistConfig(GLOBAL_STORE_KEY)
|
||||
|
||||
@@ -9,7 +9,7 @@ export const useUserStore = defineStore({
|
||||
accessToken: "",
|
||||
refreshToken: "",
|
||||
isRefreshToken:false,
|
||||
userInfo: { name: "admin" },
|
||||
userInfo: {id:"", name: "admin" },
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
@@ -26,7 +26,7 @@ export const useUserStore = defineStore({
|
||||
// Set setUserInfo
|
||||
setUserInfo(userInfo: UserState["userInfo"]) {
|
||||
this.userInfo = userInfo;
|
||||
},
|
||||
}
|
||||
},
|
||||
persist: piniaPersistConfig(USER_STORE_KEY),
|
||||
});
|
||||
|
||||
@@ -578,6 +578,26 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.form-four {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
// justify-content: space-between;
|
||||
.el-form-item {
|
||||
display: flex;
|
||||
width: 24%;
|
||||
|
||||
.el-form-item__content {
|
||||
flex: 1;
|
||||
|
||||
.el-select,
|
||||
.el-cascader,
|
||||
.el-input__inner,
|
||||
.el-date-editor {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.el-table__cell {
|
||||
border-right: 1px solid #ebeef5 !important;
|
||||
|
||||
@@ -37,6 +37,7 @@ export function rgbToHex(r: any, g: any, b: any) {
|
||||
* @returns {String} 返回处理后的颜色值
|
||||
*/
|
||||
export function getDarkColor(color: string, level: number) {
|
||||
|
||||
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
||||
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
||||
let rgb = hexToRgb(color);
|
||||
@@ -51,6 +52,7 @@ export function getDarkColor(color: string, level: number) {
|
||||
* @returns {String} 返回处理后的颜色值
|
||||
*/
|
||||
export function getLightColor(color: string, level: number) {
|
||||
|
||||
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
||||
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
||||
let rgb = hexToRgb(color);
|
||||
|
||||
@@ -20,6 +20,7 @@ export default class SocketService {
|
||||
// 重新连接尝试的次数
|
||||
connectRetryCount = 0;
|
||||
work:any;
|
||||
workerBlobUrl:any;
|
||||
lastActivityTime= 0; // 上次活动时间戳
|
||||
lastResponseHeartTime = Date.now();//最后一次收到心跳回复时间
|
||||
|
||||
@@ -107,9 +108,9 @@ export default class SocketService {
|
||||
startHeartbeat() {
|
||||
this.lastResponseHeartTime = Date.now();
|
||||
const _this = this
|
||||
const url = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},9000)})()']));
|
||||
this.workerBlobUrl = url; // 存储临时的Blob URL
|
||||
this.work = new Worker(url);
|
||||
_this.workerBlobUrl = window.URL.createObjectURL(new Blob(['(function(e){setInterval(function(){this.postMessage(null)},9000)})()']));
|
||||
|
||||
this.work = new Worker(_this.workerBlobUrl);
|
||||
this.work.onmessage = function(e){
|
||||
//判断多久没收到心跳响应
|
||||
|
||||
@@ -135,13 +136,14 @@ export default class SocketService {
|
||||
}
|
||||
|
||||
clearHeartbeat() {
|
||||
if (this.work) {
|
||||
this.work.terminate();
|
||||
this.work = null;
|
||||
const _this = this
|
||||
if (_this.work) {
|
||||
_this.work.terminate();
|
||||
_this.work = null;
|
||||
}
|
||||
if (this.workerBlobUrl) {
|
||||
window.URL.revokeObjectURL(this.workerBlobUrl); // 释放临时的Blob URL
|
||||
this.workerBlobUrl = null;
|
||||
if (_this.workerBlobUrl) {
|
||||
window.URL.revokeObjectURL(_this.workerBlobUrl); // 释放临时的Blob URL
|
||||
_this.workerBlobUrl = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<!-- :requestApi="getRoleList" -->
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader='scope'>
|
||||
<el-button v-auth.role="'add'" type='primary' :icon='CirclePlus' @click="openDrawer('新增角色')">新增</el-button>
|
||||
<el-button v-auth.role="'add'" type='primary' :icon='CirclePlus' @click="openDrawer('add')">新增</el-button>
|
||||
<el-button v-auth.role="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||
@click='batchDelete(scope.selectedListIds)'>
|
||||
删除
|
||||
@@ -16,7 +16,7 @@
|
||||
</template>
|
||||
<!-- 表格操作 -->
|
||||
<template #operation='scope'>
|
||||
<el-button v-auth.role="'edit'" type='primary' link :icon='EditPen' @click="openDrawer('编辑角色', scope.row)">编辑</el-button>
|
||||
<el-button v-auth.role="'edit'" type='primary' link :icon='EditPen' @click="openDrawer('edit', scope.row)">编辑</el-button>
|
||||
<el-button v-auth.role="'delete'" v-if="scope.row.type !== 0 && scope.row.type !== 1" type='primary' link :icon='Delete' @click='deleteAccount(scope.row)'>删除</el-button>
|
||||
<el-button v-auth.role="'SetPermissions'" type='primary' link :icon='Share' @click="openDrawer('设置权限', scope.row)">设置权限</el-button>
|
||||
</template>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div>{{ outputDsc }}</div>
|
||||
<div>
|
||||
<span style=" font-size: 18px;font-weight: 600;">
|
||||
设备已合格 <span style="color: #67C23A">{{ qualified }}</span> 台/共 <span style="color: green">{{ total }}</span>
|
||||
设备已合格 <span style="color: #91cc75">{{ qualified }}</span> 台/共 <span style="color: green">{{ total }}</span>
|
||||
台
|
||||
</span>
|
||||
<!-- <el-button type="primary" loading
|
||||
@@ -98,6 +98,9 @@ import { getCoefficientCheck } from '@/api/home/channelsTest/index'
|
||||
import type { ChannelsTest } from '@/api/home/interface/channelsTest';
|
||||
import type { Plan } from '@/api/plan/interface';
|
||||
import { fa } from 'element-plus/es/locale';
|
||||
import {useUserStore} from "@/stores/modules/user";
|
||||
|
||||
|
||||
const activeIndex = ref(0)
|
||||
const activeTotalNum = ref(4)
|
||||
const qualified = ref(0)
|
||||
@@ -136,7 +139,7 @@ const props = defineProps({
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
|
||||
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||
const webMsgSend = toRef(props, 'webMsgSend');
|
||||
@@ -726,7 +729,10 @@ const updateErrorState = (index: number, hasError: boolean) => {
|
||||
(e: 'submitClicked', callback: (resolve: (value: boolean) => void) => void): void;
|
||||
}>();
|
||||
|
||||
|
||||
const handleCancel=() => {
|
||||
|
||||
//dataSocket.socketServe.closeWs()
|
||||
// 清空 name, channel, total
|
||||
name.value = [];
|
||||
channel.value = [];
|
||||
@@ -782,9 +788,10 @@ const handleSubmit = async () => {
|
||||
userPageId: "cdf",
|
||||
devIds:devIdArray.value,
|
||||
planId:planId.value,
|
||||
errorSysId: select_Plan.value?.errorSysId,
|
||||
scriptId: select_Plan.value?.scriptId,
|
||||
operateType:'0' // '0'为预检测、‘1‘为正式检测
|
||||
errorSysId:select_Plan.value?.errorSysId,
|
||||
scriptId:select_Plan.value?.scriptId,
|
||||
operateType:'0', // '0'为预检测、‘1‘为正式检测
|
||||
userId:userStore.userInfo.id
|
||||
})
|
||||
active.value++;
|
||||
|
||||
|
||||
@@ -38,13 +38,13 @@
|
||||
<!-- <el-button type="primary" loading v-if="activeIndex > 0 && activeIndex < activeTotalNum">合格92项/共103项</el-button>
|
||||
<el-button type="primary" v-if="activeIndex >= activeTotalNum" disabled>合格92项/共103项</el-button> -->
|
||||
<span style=" font-size: 18px;font-weight: 600;">
|
||||
数据已合格 <span style="color: #67C23A">{{ qualified }}</span> 项/共 <span style="color: green">{{ 103 }}</span>
|
||||
数据已合格 <span style="color: #91cc75">{{ qualified }}</span> 项/共 <span style="color: green">{{ 103 }}</span>
|
||||
项
|
||||
</span>
|
||||
</div>
|
||||
<div class="dialog-content">
|
||||
<el-table :data="tableData" :cell-class-name="tableCell" row-key="id" height="450px"
|
||||
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' }" style="width: 100%"
|
||||
:header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' }" style="width: 100%"
|
||||
border>
|
||||
<el-table-column fixed prop="scriptItemName" label="检测项目" width="210px" />
|
||||
<el-table-column label="被检通道1" :min-width="minwidth" align="center">
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
v-model="scriptSwitch"
|
||||
class="ml-2"
|
||||
inline-prompt
|
||||
style="--el-switch-on-color: #003078; --el-switch-off-color: #5a79a9"
|
||||
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #5a79a9"
|
||||
active-text="不合格测试项"
|
||||
inactive-text="全部测试项"
|
||||
/> -->
|
||||
|
||||
@@ -10,52 +10,55 @@
|
||||
<!-- </el-table-column>-->
|
||||
<template v-if="phaseT === 0">
|
||||
<el-table-column label="A相">
|
||||
<el-table-column prop="stdA" width="105" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataA" width="105" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="stdA" width="105" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataA" width="105" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataA" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围:{{ scope.row.maxErrorA }} <br/>
|
||||
误差值:{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }}
|
||||
误差值:{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? innerUnitA : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataA === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="B相">
|
||||
<el-table-column prop="stdB" width="105" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataB" width="105" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="stdB" width="105" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataB" width="105" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataB" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围:{{ scope.row.maxErrorB }}<br/>
|
||||
误差值:{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }}
|
||||
误差值:{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? innerUnitB : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataB === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="C相">
|
||||
<el-table-column prop="stdC" width="105" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataC" width="105" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="stdC" width="105" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataC" width="105" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataC" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围: {{ scope.row.maxErrorC }}<br/>
|
||||
误差值:{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }}
|
||||
误差值:{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? innerUnitC : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataC === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -64,18 +67,19 @@
|
||||
|
||||
<template v-if="phaseT === 1">
|
||||
<el-table-column :label="tableHeader">
|
||||
<el-table-column prop="stdT" :label="'标准值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="dataT" :label="'被检值'+(unit==''?'':'('+unit+')')"/>
|
||||
<el-table-column prop="stdT" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="dataT" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')"/>
|
||||
<el-table-column prop="isDataT" label="检测结果">
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
误差范围: {{ scope.row.maxErrorT }}<br/>
|
||||
误差值:{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }}
|
||||
误差值:{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? innerUnitT : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.isDataT === 2">不符合</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.isDataT === 4">/</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -105,10 +109,23 @@ const {tableData, currentScriptTypeName} = defineProps<{
|
||||
}>();
|
||||
|
||||
|
||||
const unit = computed(() => {
|
||||
const outerUnit = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unit : '';
|
||||
})
|
||||
|
||||
const innerUnitA = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitA : '';
|
||||
})
|
||||
const innerUnitB = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitB : '';
|
||||
})
|
||||
const innerUnitC = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitC : '';
|
||||
})
|
||||
const innerUnitT = computed(() => {
|
||||
return tableData.length > 0 ? tableData[0].unitT : '';
|
||||
})
|
||||
|
||||
const phaseT = computed(() => {
|
||||
return tableData[0].dataT == null || tableData[0].dataT == undefined ? 0 : 1
|
||||
})
|
||||
@@ -125,7 +142,7 @@ const tableHeader = computed(() => {
|
||||
// let result = tableData[0].maxError ?? '/'
|
||||
// let idx = result.indexOf('~');
|
||||
// if (idx > 0) {
|
||||
// result = result.substring(0, idx) + unit.value + result.substring(idx, result.length) + unit.value;
|
||||
// result = result.substring(0, idx) + outerUnit.value + result.substring(idx, result.length) + outerUnit.value;
|
||||
// }
|
||||
// return result;
|
||||
// })
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
<el-input v-model='formContent.scriptName' :disabled="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="误差体系">
|
||||
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="checkStore.showDetailType===0">
|
||||
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="checkStore.showDetailType===0"
|
||||
@change="handleErrorSysChange">
|
||||
<el-option
|
||||
v-for="(option) in pqErrorList"
|
||||
:key="option.id"
|
||||
@@ -27,8 +28,11 @@
|
||||
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label=" ">
|
||||
<el-button type="primary" :icon="Postcard" v-if="checkStore.showDetailType===1" @click="handleGenerateReport">报告生成</el-button>
|
||||
<el-form-item v-if="checkStore.showDetailType===1">
|
||||
<el-button type="primary" :icon="Postcard" @click="handleGenerateReport">报告生成</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="checkStore.showDetailType===0">
|
||||
<el-button type="primary" :icon="Histogram" @click="handleReCalculate">重新计算</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -107,10 +111,12 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
||||
import {CheckData} from "@/api/check/interface";
|
||||
import {useDictStore} from "@/stores/modules/dict";
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {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 {useDownload} from "@/hooks/useDownload";
|
||||
import {Postcard} from "@element-plus/icons-vue";
|
||||
import {Histogram, Postcard} from "@element-plus/icons-vue";
|
||||
import {ResultEnum} from "@/enums/httpEnum";
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
const {appendToBody} = withDefaults(defineProps<{
|
||||
appendToBody: boolean
|
||||
@@ -143,8 +149,9 @@ const formContent = reactive<CheckData.DataCheck>({
|
||||
deviceName: '',
|
||||
chnNum: '',
|
||||
})
|
||||
// 当前选中的谐波次数
|
||||
// const currentHarmNum = ref<string>("-1")
|
||||
// 原始误差体系id
|
||||
let originErrorSysId: string = ''
|
||||
let planCode: string = ''
|
||||
// 谐波次数列表
|
||||
// const harmNumList = reactive<{ value: string, label: string }[]>([])
|
||||
// 当前选中的检测项
|
||||
@@ -212,38 +219,61 @@ const handleNodeClick = async (data: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
watch(() => formContent.errorSysId, async (newVal, oldVal) => {
|
||||
if (newVal != '') {
|
||||
console.log("切换误差体系");
|
||||
formContent.chnNum = chnList[0].value
|
||||
}
|
||||
})
|
||||
const handleErrorSysChange = async () => {
|
||||
console.log("切换误差体系", formContent.errorSysId);
|
||||
changeErrorSystem({
|
||||
planId: checkStore.plan.id,
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
errorSysId: formContent.errorSysId,
|
||||
deviceId: deviceId,
|
||||
code: checkStore.plan.code + '',
|
||||
}).then((res) => {
|
||||
if (res.code === ResultEnum.SUCCESS) {
|
||||
ElMessage.success('切换误差体系成功')
|
||||
if (originErrorSysId != formContent.errorSysId) {
|
||||
planCode = checkStore.plan.code + "_temp"
|
||||
} else {
|
||||
planCode = checkStore.plan.code + ''
|
||||
}
|
||||
if (formContent.chnNum != chnList[0].value) {
|
||||
formContent.chnNum = chnList[0].value
|
||||
} else {
|
||||
handleChnNumChange()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||
// console.log("通道号", newVal);
|
||||
|
||||
if (newVal != '') {
|
||||
// 发起请求,查询该测试项的检测结果
|
||||
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()
|
||||
handleChnNumChange()
|
||||
}
|
||||
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) => {
|
||||
// console.log("谐波次数", newVal);
|
||||
@@ -301,7 +331,7 @@ const updateTableData = async () => {
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
devId: deviceId,
|
||||
devNum: formContent.chnNum + '',
|
||||
code: parseInt(checkStore.plan.code),
|
||||
code: planCode,
|
||||
index: parseInt(checkIndex.value),
|
||||
})
|
||||
|
||||
@@ -341,7 +371,8 @@ const updateTableData = async () => {
|
||||
setCheckResultData(resCheckResult)
|
||||
setRawData(resRawData)
|
||||
checkList.length = 0
|
||||
checkList.push({value: keys1[0], label: resCheckResult.isData === 1? `${keys1[0]}`:resCheckResult.isData === 4? `${keys1[0]}(/)` :`${keys1[0]}(不符合)`})
|
||||
let key = formatHarmNum(keys1[0])
|
||||
checkList.push({value: keys1[0], label: resCheckResult.isData === 1 ? `${key}` : resCheckResult.isData === 4 ? `${key}(/)` : resCheckResult.isData === 5? `${key}(-)`:`${key}(不符合)`})
|
||||
if (currentCheckItem.value == checkList[0].value) {
|
||||
doCurrentCheckItemUpdate(checkList[0].value)
|
||||
} else {
|
||||
@@ -353,7 +384,7 @@ const updateTableData = async () => {
|
||||
let hum = formatHarmNum(key)
|
||||
tempCheckList.push({
|
||||
value: key,
|
||||
label: value.isData === 1 ? hum : value.isData === 4 ? `${hum}(/)` : `${hum}(不符合)`
|
||||
label: value.isData === 1 ? `${hum}`: value.isData === 4 ? `${hum}(/)` : value.isData === 5? `${hum}(-)`:`${hum}(不符合)`
|
||||
})
|
||||
}
|
||||
|
||||
@@ -391,6 +422,7 @@ const doCurrentCheckItemUpdate = (newVal: string) => {
|
||||
}
|
||||
|
||||
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
|
||||
planCode = checkStore.plan.code + ''
|
||||
deviceId = _deviceId
|
||||
originScriptType = _scriptType
|
||||
scriptType = _scriptType
|
||||
@@ -416,6 +448,7 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
|
||||
dataRule: dataRuleName,
|
||||
chnNum: chnList.length > 0 ? chnList[0].value : '',
|
||||
})
|
||||
originErrorSysId = formContent.errorSysId
|
||||
|
||||
pqErrorList.length = 0
|
||||
let {data: resPqErrorList} = await getPqErrSysList()
|
||||
@@ -428,7 +461,29 @@ const handleGenerateReport = () => {
|
||||
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, {
|
||||
scriptName: '',
|
||||
@@ -450,8 +505,13 @@ const close = () => {
|
||||
currentScriptTypeName.value = ''
|
||||
currentDesc.value = ''
|
||||
pqErrorList.length = 0
|
||||
planCode = ''
|
||||
|
||||
visible.value = false;
|
||||
|
||||
if (checkStore.showDetailType === 1) {
|
||||
await deleteTempTable(checkStore.plan.code + '')
|
||||
}
|
||||
};
|
||||
|
||||
const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||
@@ -465,19 +525,22 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||
result.push({
|
||||
stdA: numberToFixed(data.dataA.resultData),
|
||||
dataA: numberToFixed(data.dataA.data),
|
||||
errorA: getError(data.dataA.resultData, data.dataA.data),
|
||||
maxErrorA: toMaxErrorStr(data.dataA.radius, data.unit),
|
||||
errorA: numberToFixed(data.dataA.errorData),
|
||||
maxErrorA: toMaxErrorStr(data.dataA.radius, data.dataA.unit),
|
||||
unitA: data.dataA.unit,
|
||||
isDataA: data.dataA.isData,
|
||||
stdB: numberToFixed(data.dataB.resultData),
|
||||
dataB: numberToFixed(data.dataB.data),
|
||||
errorB: getError(data.dataB.resultData, data.dataB.data),
|
||||
maxErrorB: toMaxErrorStr(data.dataB.radius, data.unit),
|
||||
errorB: numberToFixed(data.dataB.errorData),
|
||||
maxErrorB: toMaxErrorStr(data.dataB.radius, data.dataB.unit),
|
||||
isDataB: data.dataB.isData,
|
||||
unitB: data.dataB.unit,
|
||||
stdC: numberToFixed(data.dataC.resultData),
|
||||
dataC: numberToFixed(data.dataC.data),
|
||||
errorC: getError(data.dataC.resultData, data.dataC.data),
|
||||
maxErrorC: toMaxErrorStr(data.dataC.radius, data.unit),
|
||||
errorC: numberToFixed(data.dataC.errorData),
|
||||
maxErrorC: toMaxErrorStr(data.dataC.radius, data.dataC.unit),
|
||||
isDataC: data.dataC.isData,
|
||||
unitC: data.dataC.unit,
|
||||
|
||||
maxError: data.radius,
|
||||
unit: data.unit,
|
||||
@@ -489,9 +552,10 @@ const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
||||
result.push({
|
||||
stdT: numberToFixed(data.dataT.resultData),
|
||||
dataT: numberToFixed(data.dataT.data),
|
||||
errorT: getError(data.dataT.resultData, data.dataT.data),
|
||||
maxErrorT: toMaxErrorStr(data.dataT.radius, data.unit),
|
||||
errorT: numberToFixed(data.dataT.errorData),
|
||||
maxErrorT: toMaxErrorStr(data.dataT.radius, data.dataT.unit),
|
||||
isDataT: data.dataT?.isData,
|
||||
unitT: data.dataT.unit,
|
||||
|
||||
maxError: data.radius,
|
||||
unit: data.unit,
|
||||
@@ -507,7 +571,7 @@ const exportRawDataHandler = () => {
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
devId: deviceId,
|
||||
devNum: formContent.chnNum + '',
|
||||
code: parseInt(checkStore.plan.code),
|
||||
code: checkStore.plan.code + '',
|
||||
index: parseInt(checkIndex.value),
|
||||
}, false, '.xlsx')
|
||||
}
|
||||
@@ -776,7 +840,7 @@ defineExpose({
|
||||
<!--.el-popover.popover-class {-->
|
||||
<!-- .el-popover__title {-->
|
||||
<!-- color: #fff;-->
|
||||
<!-- background-color: #003078 !important;-->
|
||||
<!-- background-color: var(--el-color-primary) !important;-->
|
||||
<!-- }-->
|
||||
<!--}-->
|
||||
<!--</style>-->
|
||||
@@ -6,7 +6,7 @@
|
||||
<div>{{ outputDsc }}</div>
|
||||
<div>
|
||||
<span style=" font-size: 18px;font-weight: 600;">
|
||||
设备已合格 <span style="color: #67C23A">{{ qualified }}</span> 台/共 <span style="color: green">{{ total }}</span>
|
||||
设备已合格 <span style="color: #91cc75">{{ qualified }}</span> 台/共 <span style="color: green">{{ total }}</span>
|
||||
台
|
||||
</span>
|
||||
<!-- <el-button type="primary" loading
|
||||
@@ -99,6 +99,7 @@ import {getCoefficientCheck} from '@/api/home/channelsTest/index'
|
||||
import type {ChannelsTest} from '@/api/home/interface/channelsTest';
|
||||
import type {Plan} from '@/api/plan/interface';
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {useUserStore} from "@/stores/modules/user";
|
||||
|
||||
const checkStore = useCheckStore()
|
||||
const activeIndex = ref(0)
|
||||
@@ -143,7 +144,7 @@ const props = defineProps({
|
||||
default: () => ({})
|
||||
},
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
const testStatus = toRef(props, 'testStatus');
|
||||
const tableDataMap = new Map<number, Ref<ChannelsTest.CoefficientVO[]>>([]);
|
||||
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||
@@ -720,7 +721,8 @@ const handleSubmit = async () => {
|
||||
planId: planId.value,
|
||||
errorSysId: select_Plan.value?.errorSysId,
|
||||
scriptId: select_Plan.value?.scriptId,
|
||||
operateType: '0' // '0'为预检测、‘1‘为正式检测
|
||||
operateType: '0', // '0'为预检测、‘1‘为正式检测
|
||||
userId:userStore.userInfo.id
|
||||
})
|
||||
active.value++;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="tabs-title ">
|
||||
<el-button type="primary" :icon="Download" >报告下载</el-button>
|
||||
<span style=" font-size: 18px;font-weight: 600;">
|
||||
已生成 <span style="color: #67C23A">2</span> 台/共 <span style="color: green">3</span> 台
|
||||
已生成 <span style="color: #91cc75">2</span> 台/共 <span style="color: green">3</span> 台
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<el-form-item v-if="checkStore.plan.timeCheck===1" prop="timeTest" :label-width="100">
|
||||
<el-checkbox v-model="formContent.timeTest" label="守时检测"/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="channelsTest" :label-width="100">
|
||||
<el-form-item v-if="AppSceneStore.currentScene === '1'" prop="channelsTest" :label-width="100">
|
||||
<el-checkbox v-model="formContent.channelsTest" label="系数校准"/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="test" :label-width="100">
|
||||
@@ -32,7 +32,8 @@ import {ref} from "vue";
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import type {CheckData} from "@/api/check/interface";
|
||||
import {ElMessageBox} from "element-plus";
|
||||
|
||||
import {useAppSceneStore} from "@/stores/modules/mode";
|
||||
const AppSceneStore = useAppSceneStore()
|
||||
const emit = defineEmits(['openTestDialog'])
|
||||
const checkStore = useCheckStore();
|
||||
|
||||
|
||||
@@ -938,6 +938,7 @@ const handleTest = async (val: string) => {
|
||||
|
||||
dialogTitle.value = val
|
||||
if (val === '手动检测') {
|
||||
checkStore.setShowDetailType(2)
|
||||
|
||||
if (testType === 'reTest') {
|
||||
ElMessageBox.confirm('请选择复检检测方式', '设备复检',
|
||||
@@ -988,6 +989,7 @@ const handleTest = async (val: string) => {
|
||||
channelsTest.value?.open(channelsSelection.value, props.plan)
|
||||
return
|
||||
} else {
|
||||
checkStore.setShowDetailType(2)
|
||||
checkStore.setCheckType(1)
|
||||
checkStore.initSelectTestItems()
|
||||
// 一键检测
|
||||
@@ -1062,7 +1064,7 @@ const openDrawer = async (title: string, row: any) => {
|
||||
|
||||
|
||||
if (title === '报告生成') {
|
||||
await generateDevReport({'planId': checkStore.plan.id, 'devId': row.id})
|
||||
await generateDevReport({'planId': checkStore.plan.id, 'devId': row.id,'scriptId':checkStore.plan.scriptId,'planCode':checkStore.plan.code+''})
|
||||
emit('batchGenerateClicked') // 触发事件
|
||||
ElMessage.success({message: `报告生成成功!`})
|
||||
}
|
||||
@@ -1140,7 +1142,7 @@ onBeforeMount(async () => {
|
||||
|
||||
const handleQuitClicked = () => {
|
||||
//console.log('handleQuitClicked')
|
||||
//dataSocket.socketServe.closeWs()
|
||||
dataSocket.socketServe.closeWs()
|
||||
emit('batchGenerateClicked') // 触发事件
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:row-class-name="tableRowClassName" row-key="id" height="300px" :header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%" border v-on:cell-click="handleClick"
|
||||
:row-class-name="tableRowClassName" row-key="id" height="300px" :header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' } " style="width: 100%" border v-on:cell-click="handleClick"
|
||||
>
|
||||
<el-table-column prop="date" label="Date" width="180" />
|
||||
<el-table-column prop="name" label="Name" width="180" />
|
||||
|
||||
@@ -9,73 +9,73 @@
|
||||
<span>检测用时:{{ timeView }}</span>
|
||||
</div>
|
||||
<el-progress
|
||||
style="width: 60%; margin-right: 4%;"
|
||||
style="width: 82%; margin-right: 3%;"
|
||||
:percentage="percentage"
|
||||
:color="customColors"/>
|
||||
|
||||
<div style="width: 15%">
|
||||
<el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
初始化中
|
||||
</el-button>
|
||||
<!-- <div style="width: 15%">-->
|
||||
<!-- <el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">-->
|
||||
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
|
||||
<!-- <component :is="Refresh"/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- 初始化中-->
|
||||
<!-- </el-button>-->
|
||||
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="testStatus=='process' && percentage < 100"
|
||||
:icon="VideoPause"
|
||||
@click="handlePause()">停止检测
|
||||
</el-button>
|
||||
<el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>
|
||||
<el-icon class="loading-box" style="margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
暂停中
|
||||
</el-button>
|
||||
<!-- <el-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-if="testStatus=='test_init'"-->
|
||||
<!-- :icon="VideoPause"-->
|
||||
<!-- disabled>初始化中-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="danger"-->
|
||||
<!-- v-if="testStatus=='test_init_fail'"-->
|
||||
<!-- :icon="Failed"-->
|
||||
<!-- disabled>初始化失败-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="danger"-->
|
||||
<!-- v-if="testStatus=='connect_timeout'"-->
|
||||
<!-- :icon="Failed"-->
|
||||
<!-- disabled>连接超时-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- :icon="RefreshLeft"-->
|
||||
<!-- v-if="testStatus === 'recheck'"-->
|
||||
<!-- @click="emit('sendReCheck')">重新检测-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-if="testStatus=='process' && percentage < 100"-->
|
||||
<!-- :icon="VideoPause"-->
|
||||
<!-- @click="handlePause()">停止检测-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>-->
|
||||
<!-- <el-icon class="loading-box" style="margin-right: 8px;">-->
|
||||
<!-- <component :is="Refresh"/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- 暂停中-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <!– <el-button–>-->
|
||||
<!-- <!– type="primary"–>-->
|
||||
<!-- <!– v-if="testStatus=='test_init'"–>-->
|
||||
<!-- <!– :icon="VideoPause"–>-->
|
||||
<!-- <!– disabled>初始化中–>-->
|
||||
<!-- <!– </el-button>–>-->
|
||||
<!-- <!– <el-button–>-->
|
||||
<!-- <!– type="danger"–>-->
|
||||
<!-- <!– v-if="testStatus=='test_init_fail'"–>-->
|
||||
<!-- <!– :icon="Failed"–>-->
|
||||
<!-- <!– disabled>初始化失败–>-->
|
||||
<!-- <!– </el-button>–>-->
|
||||
<!-- <!– <el-button–>-->
|
||||
<!-- <!– type="danger"–>-->
|
||||
<!-- <!– v-if="testStatus=='connect_timeout'"–>-->
|
||||
<!-- <!– :icon="Failed"–>-->
|
||||
<!-- <!– disabled>连接超时–>-->
|
||||
<!-- <!– </el-button>–>-->
|
||||
<!-- <!– <el-button–>-->
|
||||
<!-- <!– type="primary"–>-->
|
||||
<!-- <!– :icon="RefreshLeft"–>-->
|
||||
<!-- <!– v-if="testStatus === 'recheck'"–>-->
|
||||
<!-- <!– @click="emit('sendReCheck')">重新检测–>-->
|
||||
<!-- <!– </el-button>–>-->
|
||||
|
||||
|
||||
<el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>
|
||||
<!-- <el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>-->
|
||||
|
||||
<el-button
|
||||
type="warning"
|
||||
v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"
|
||||
:icon="VideoPlay"
|
||||
:disabled="testStatus === 'pause_timeout'"
|
||||
@click="emit('sendResume')"
|
||||
>继续检测
|
||||
</el-button>
|
||||
</div>
|
||||
<!-- <el-button-->
|
||||
<!-- type="warning"-->
|
||||
<!-- v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"-->
|
||||
<!-- :icon="VideoPlay"-->
|
||||
<!-- :disabled="testStatus === 'pause_timeout'"-->
|
||||
<!-- @click="emit('sendResume')"-->
|
||||
<!-- >继续检测-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </div>-->
|
||||
<el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
|
||||
</div>
|
||||
|
||||
<div class="dialog-content">
|
||||
<el-table :data="checkResultView" row-key="scriptType" height="450px"
|
||||
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%"
|
||||
:header-cell-style="{ background: 'var(--el-color-primary)', color: '#eee', textAlign: 'center' } " style="width: 100%"
|
||||
border>
|
||||
<el-table-column fixed prop="scriptName" label="检测项目" width="150px" align="center">
|
||||
</el-table-column>
|
||||
@@ -168,6 +168,9 @@ import {CheckData} from "@/api/check/interface"
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import {getBigTestItem} from "@/api/check/test";
|
||||
import {getAutoGenerate} from "@/api/user/login";
|
||||
import {generateDevReport} from "@/api/plan/plan";
|
||||
|
||||
|
||||
const checkStore = useCheckStore()
|
||||
|
||||
@@ -196,7 +199,7 @@ const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause',
|
||||
// 用来保存测试项进度抽屉是否打开
|
||||
const drawer = ref(false)
|
||||
// 进度条颜色
|
||||
const customColors = [{color: "#67c23a", percentage: 100}]
|
||||
const customColors = [{color: "#91cc75", percentage: 100}]
|
||||
// 检测脚本数据
|
||||
let scriptData: CheckData.ScriptItem[] = []
|
||||
// 用来保存被检设备
|
||||
@@ -254,7 +257,7 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
|
||||
for (let j = 0; j < device.chnResult.length; j++) {
|
||||
switch (device.chnResult[j]) {
|
||||
case CheckData.ChnCheckResultEnum.UNKNOWN:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'More'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.LOADING:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.LOADING, icon: 'Loading'})
|
||||
@@ -271,6 +274,9 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
|
||||
case CheckData.ChnCheckResultEnum.ERRORDATA:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'WarnTriangleFilled'})
|
||||
break;
|
||||
case CheckData.ChnCheckResultEnum.NOT_PART_IN_ERROR:
|
||||
tempChnBtnResult.push({color: CheckData.ButtonColorEnum.INFO, icon: 'Minus'})
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -684,12 +690,19 @@ const handleEndItem = (code: string, desc: string | undefined, devices: CheckDat
|
||||
}
|
||||
|
||||
// 更新进度条
|
||||
const updatePercentage = () => {
|
||||
const updatePercentage = async () => {
|
||||
if (activeIndex < checkTotal) {
|
||||
percentage.value = Math.trunc(activeIndex / checkTotal * 100);
|
||||
} else {
|
||||
percentage.value = 100;
|
||||
emit('update:testStatus', 'success')
|
||||
|
||||
let {data: autoGenerate} = await getAutoGenerate()
|
||||
if (autoGenerate == 1) {
|
||||
//调用自动生成报告接口
|
||||
let deviceIds = checkStore.devices.map(item => item.deviceId)
|
||||
// await generateDevReport({'planId': checkStore.plan.id, 'devId':deviceIds[0] ,'scriptId':checkStore.plan.scriptId,'planCode':checkStore.plan.code+''})
|
||||
}
|
||||
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
|
||||
confirmButtonText: '确定',
|
||||
})
|
||||
@@ -1117,7 +1130,7 @@ const handleClick = (item: any, chnNum: number, scriptType: string) => {
|
||||
})
|
||||
}
|
||||
if (flag === -1 || flag === 1) {
|
||||
checkStore.setShowDetailType(0)
|
||||
checkStore.setShowDetailType(2)
|
||||
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType);
|
||||
}
|
||||
};
|
||||
@@ -1243,7 +1256,7 @@ const startTimer = () => {
|
||||
}
|
||||
};
|
||||
const handlePause = () => {
|
||||
emit('sendPause')
|
||||
//emit('sendPause')
|
||||
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`})
|
||||
}
|
||||
|
||||
@@ -1424,10 +1437,15 @@ const secondToTime = (second: number) => {
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
}
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
handlePause
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -1479,8 +1497,7 @@ onBeforeUnmount(() => {
|
||||
.timeView {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
color: #67c23a;;
|
||||
color: #91cc75;
|
||||
width: 28%;
|
||||
margin-right: 0px;
|
||||
text-align: left;
|
||||
@@ -1514,8 +1531,7 @@ onBeforeUnmount(() => {
|
||||
.drawer-container {
|
||||
:deep(header.el-drawer__header) {
|
||||
color: #fff !important;
|
||||
background-color: #003078 !important;
|
||||
|
||||
background-color: var(--el-color-primary) !important;
|
||||
.el-drawer__close-btn svg:hover {
|
||||
color: #ccc !important;
|
||||
}
|
||||
@@ -1541,7 +1557,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
|
||||
//:deep(.el-drawer .el-drawer__title){
|
||||
// background-color: #003078 !important;
|
||||
// background-color: var(--el-color-primary) !important;
|
||||
//}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -16,28 +16,30 @@
|
||||
<timeTest v-if="showComponent&&timeTestSelected" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/>
|
||||
<!-- <channelsTest v-if="stepsActiveIndex === 3" v-model:testStatus="channelsTestStatus"></channelsTest>-->
|
||||
<factorTest v-if="showComponent&&channelsTestSelected" v-show="channelsTestSelected && stepsActiveView==3" v-model:testStatus="channelsTestStatus" :webMsgSend="webMsgSend"/>
|
||||
<test v-if="showComponent&&testSelected" v-show="testSelected && stepsActiveView==4" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend"
|
||||
<test v-if="showComponent&&testSelected" ref="testRef" v-show="testSelected && stepsActiveView==4" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend"
|
||||
@update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck" :stepsActive="stepsActive"/>
|
||||
|
||||
<template #footer>
|
||||
<div>
|
||||
<!-- <el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < stepsTotalNum && ActiveStatue != 'success'" @click="nextStep">跳过</el-button>-->
|
||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
|
||||
<el-button type="primary"
|
||||
v-if="(stepsActiveIndex <= stepsTotalNum - 1) && (ActiveStatue !== 'success' &&ActiveStatue !== 'test_init' && ActiveStatue !=='paused_ing' && ActiveStatue !=='paused' && ActiveStatue !== 'waiting' && ActiveStatue !== 'error' && ActiveStatue !== 'test_init_fail' && ActiveStatue !== 'connect_timeout' && ActiveStatue!=='pause_timeout')"
|
||||
disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
检测中
|
||||
</el-button>
|
||||
<!-- <el-button type="primary"-->
|
||||
<!-- v-if="(stepsActiveIndex <= stepsTotalNum - 1) && (ActiveStatue !== 'success' &&ActiveStatue !== 'test_init' && ActiveStatue !=='paused_ing' && ActiveStatue !=='paused' && ActiveStatue !== 'waiting' && ActiveStatue !== 'error' && ActiveStatue !== 'test_init_fail' && ActiveStatue !== 'connect_timeout' && ActiveStatue!=='pause_timeout')"-->
|
||||
<!-- disabled>-->
|
||||
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
|
||||
<!-- <component :is="Refresh"/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- 检测中-->
|
||||
<!-- </el-button>-->
|
||||
|
||||
|
||||
<!-- <el-button type="primary" v-if="ActiveStatue === 'process'" disabled>-->
|
||||
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
|
||||
<!-- <component :is="Refresh"/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- 检测中-->
|
||||
<!-- </el-button>-->
|
||||
<el-button type="warning" :icon="VideoPlay" v-if="TestStatus === 'paused'" @click="handleSubmit">继续检测</el-button>
|
||||
<!-- <el-button type="warning" :icon="VideoPlay" v-if="TestStatus === 'paused'" @click="handleSubmit">继续检测</el-button>-->
|
||||
<!-- <el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'recheck' || ActiveStatue ==='error' || ActiveStatue ==='test_init_fail' || ActiveStatue === 'pause_timeout' || ActiveStatue === 'connect_timeout'" @click="handleSubmit">重新检测</el-button>-->
|
||||
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
@@ -45,17 +47,34 @@
|
||||
</el-icon>
|
||||
初始化中
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="TestStatus=='process'"
|
||||
:icon="VideoPause"
|
||||
@click="handlePause()">停止检测
|
||||
</el-button>
|
||||
<el-button type="warning" v-if="TestStatus === 'paused_ing'" disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
暂停中
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
v-if="(TestStatus =='paused')"
|
||||
:icon="VideoPlay"
|
||||
@click="sendResume"
|
||||
>继续检测
|
||||
</el-button>
|
||||
|
||||
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
||||
v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
|
||||
@click="nextStep">
|
||||
{{ nextStepText }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="handleQuit" v-else>
|
||||
退出检测
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -66,7 +85,7 @@
|
||||
<script lang="tsx" setup name="testPopup">
|
||||
import {reactive, ref, watch} from 'vue';
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
import {Coin, DArrowRight, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPlay} from '@element-plus/icons-vue'
|
||||
import {Coin, DArrowRight, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPlay,VideoPause} from '@element-plus/icons-vue'
|
||||
import preTest from './preTest.vue'
|
||||
import timeTest from './timeTest.vue'
|
||||
import factorTest from './factorTest.vue'
|
||||
@@ -74,7 +93,9 @@ import test from './test.vue'
|
||||
import socketClient from '@/utils/webSocketClient';
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {pauseTest, resumeTest, startPreTest} from '@/api/socket/socket'
|
||||
import {useUserStore} from "@/stores/modules/user";
|
||||
|
||||
const userStore = useUserStore()
|
||||
const checkStore = useCheckStore();
|
||||
const nextStepText = ref('下一步');
|
||||
const dialogVisible = ref(false)
|
||||
@@ -93,6 +114,7 @@ const webMsgSend = ref();//webSocket推送的数据
|
||||
const dialogTitle = ref('')
|
||||
const showComponent = ref(true)
|
||||
const preTestRef = ref(null)
|
||||
const testRef = ref(null)
|
||||
|
||||
const dataSocket = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
@@ -190,7 +212,8 @@ const handleSubmit = () => {
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: '1' // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
operateType: '1', // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
}).then(res => {
|
||||
if (res.code === 'A001014') {
|
||||
ElMessageBox.alert('装置配置异常', '检测失败', {
|
||||
@@ -218,7 +241,8 @@ const handleSubmit = () => {
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: checkStore.reCheckType ==1 ?'2':'8' // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
operateType: checkStore.reCheckType ==1 ?'2':'8', // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 'A001014') {
|
||||
@@ -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 = () => {
|
||||
console.log('发起暂停请求')
|
||||
|
||||
@@ -326,7 +364,8 @@ const sendResume = () => {
|
||||
userPageId: "cdf",
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.plan.id,
|
||||
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
})
|
||||
Object.assign(webMsgSend.value, {
|
||||
requestId: 'Resume_Success'
|
||||
@@ -339,7 +378,8 @@ const sendReCheck = () => {
|
||||
userPageId: "cdf",
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.plan.id,
|
||||
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 'A001014') {
|
||||
@@ -440,6 +480,17 @@ defineExpose({open})
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
.test-head-steps {
|
||||
::v-deep .el-step {
|
||||
.el-step__head.is-success {
|
||||
color: #91cc75;
|
||||
}
|
||||
.el-step__title.is-success{
|
||||
color: #91cc75;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.dialog-big .el-dialog__body) {
|
||||
max-height: 840px !important;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="right-title" >
|
||||
<span v-if="activeIndex <= 1"> </span>
|
||||
<span v-if="activeIndex > 1" class="time-text">
|
||||
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
|
||||
标准时间: <span style="color: var(--el-color-primary)">{{ gpsTime }}</span>
|
||||
</span>
|
||||
<div class="error-dsc">
|
||||
<div class="green-div"></div>
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
<!-- <span v-if="activeIndex <= 1"> </span>
|
||||
<span v-if="activeIndex > 1" style=" font-size: 18px;font-weight: 600;">
|
||||
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
|
||||
标准时间: <span style="color: var(--el-color-primary)">{{ gpsTime }}</span>
|
||||
</span>
|
||||
<div class="error-dsc">
|
||||
<div class="green-div"></div>
|
||||
@@ -423,7 +423,7 @@ watch(ts, function (newValue, oldValue) {
|
||||
}
|
||||
|
||||
.right-title .gps-time {
|
||||
color: #003078;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.error-dsc {
|
||||
@@ -440,7 +440,7 @@ watch(ts, function (newValue, oldValue) {
|
||||
}
|
||||
|
||||
.error-dsc .green-div {
|
||||
background-color: #67C23A;
|
||||
background-color: #91cc75;
|
||||
}
|
||||
|
||||
.error-dsc .red-div {
|
||||
|
||||
@@ -168,7 +168,7 @@ const handleTabsChange = (val: any) => {
|
||||
form.value.activeChildTabs = Number(val)
|
||||
|
||||
}
|
||||
localStorage.setItem('color', 'red')
|
||||
localStorage.setItem('color', '#91cc75')
|
||||
//功能选择数据
|
||||
const tabsList = ref([
|
||||
{
|
||||
|
||||
@@ -52,6 +52,7 @@ import { ElMessage } from "element-plus";
|
||||
import { useAuthStore } from "@/stores/modules/auth";
|
||||
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
|
||||
import { ref } from "vue";
|
||||
import {getCurrentScene} from "@/api/user/login";
|
||||
const authStore = useAuthStore();
|
||||
const modeStore = useModeStore(); // 使用模式 store
|
||||
const AppSceneStore = useAppSceneStore();
|
||||
@@ -82,7 +83,9 @@ const modeList = [
|
||||
];
|
||||
const handelOpen = async (item: any) => {
|
||||
modeStore.setCurrentMode(item.code); // 将模式code存入 store
|
||||
AppSceneStore.setCurrentMode('1');//0:省级平台,1:设备出厂,2:研发自测
|
||||
const {data:scene} = await getCurrentScene(); // 获取当前场景
|
||||
// AppSceneStore.setCurrentMode(scene+'');//0:省级平台,1:设备出厂,2:研发自测
|
||||
AppSceneStore.setCurrentMode(scene+'');//0:省级平台,1:设备出厂,2:研发自测
|
||||
await authStore.setShowMenu();
|
||||
return;
|
||||
// if (isActive) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<el-input v-model='loginForm.username' placeholder='用户名'>
|
||||
<template #prefix>
|
||||
<el-icon class='el-input__icon'>
|
||||
<user />
|
||||
<user/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
@@ -24,11 +24,14 @@
|
||||
>
|
||||
<template #prefix>
|
||||
<el-icon class='el-input__icon'>
|
||||
<lock />
|
||||
<lock/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop='checked'>
|
||||
<el-checkbox v-model="loginForm.checked">记住我</el-checkbox>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class='login-btn'>
|
||||
<el-button
|
||||
@@ -53,21 +56,22 @@
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
import { useRouter } from 'vue-router'
|
||||
import { HOME_URL } from '@/config'
|
||||
import { getTimeState } from '@/utils'
|
||||
import { type Dict } from '@/api/interface'
|
||||
import { type Login } from '@/api/user/interface/user'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import { getDictList, loginApi } from '@/api/user/login'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { useTabsStore } from '@/stores/modules/tabs'
|
||||
import { useKeepAliveStore } from '@/stores/modules/keepAlive'
|
||||
import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
||||
import { CircleClose, UserFilled } from '@element-plus/icons-vue'
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
import type { ElForm } from 'element-plus'
|
||||
import {useRouter} from 'vue-router'
|
||||
import {HOME_URL} from '@/config'
|
||||
import {getTimeState} from '@/utils'
|
||||
import {type Dict} from '@/api/interface'
|
||||
import {type Login} from '@/api/user/interface/user'
|
||||
import type {ElForm} from 'element-plus'
|
||||
import {ElNotification} from 'element-plus'
|
||||
import {getDictList, getPublicKey, loginApi} from '@/api/user/login'
|
||||
import {useUserStore} from '@/stores/modules/user'
|
||||
import {useTabsStore} from '@/stores/modules/tabs'
|
||||
import {useKeepAliveStore} from '@/stores/modules/keepAlive'
|
||||
import {initDynamicRouter} from '@/routers/modules/dynamicRouter'
|
||||
import {CircleClose, UserFilled} from '@element-plus/icons-vue'
|
||||
import {useAuthStore} from '@/stores/modules/auth'
|
||||
import {useDictStore} from "@/stores/modules/dict";
|
||||
import forge from 'node-forge'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const router = useRouter()
|
||||
@@ -76,19 +80,22 @@ const tabsStore = useTabsStore()
|
||||
const keepAliveStore = useKeepAliveStore()
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const isAutoLogin = ref(false)
|
||||
let publicKey: any = null;
|
||||
|
||||
|
||||
type FormInstance = InstanceType<typeof ElForm>;
|
||||
const loginFormRef = ref<FormInstance>()
|
||||
const loginRules = reactive({
|
||||
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
||||
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
|
||||
username: [{required: true, message: '请输入用户名', trigger: 'blur'}],
|
||||
password: [{required: true, message: '请输入密码', trigger: 'blur'}],
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const loginForm = reactive<Login.ReqLoginForm>({
|
||||
username: '',
|
||||
password: '',
|
||||
checked: false,
|
||||
})
|
||||
|
||||
// login
|
||||
@@ -98,11 +105,28 @@ const login = (formEl: FormInstance | undefined) => {
|
||||
if (!valid) return
|
||||
loading.value = true
|
||||
try {
|
||||
if (!isAutoLogin.value) {
|
||||
let {data: publicKeyBase64}: { data: string } = await getPublicKey(loginForm.username, loginForm.checked)
|
||||
//将base64格式的公钥转换为Forge可以使用的格式
|
||||
const publicKeyDer = forge.util.decode64(publicKeyBase64);
|
||||
publicKey = forge.pki.publicKeyFromPem(forge.pki.publicKeyToPem(forge.pki.publicKeyFromAsn1(forge.asn1.fromDer(publicKeyDer))));
|
||||
}
|
||||
|
||||
// 1.执行登录接口
|
||||
const { data } = await loginApi({
|
||||
...loginForm,
|
||||
password: loginForm.password,
|
||||
const {data} = await loginApi({
|
||||
username: forge.util.encode64(loginForm.username),
|
||||
password: isAutoLogin.value ? loginForm.password : encryptPassword(loginForm.password),
|
||||
checked: loginForm.checked
|
||||
})
|
||||
if (loginForm.checked) {
|
||||
localStorage.setItem("loginInfo", JSON.stringify({
|
||||
username: forge.util.encode64(loginForm.username),
|
||||
password: isAutoLogin.value ? loginForm.password : encryptPassword(loginForm.password),
|
||||
exp: Date.now() + 1000 * 60 * 60 * 24 * 30
|
||||
}))
|
||||
} else {
|
||||
localStorage.removeItem("loginInfo")
|
||||
}
|
||||
userStore.setAccessToken(data.accessToken)
|
||||
userStore.setRefreshToken(data.refreshToken)
|
||||
userStore.setUserInfo(data.userInfo)
|
||||
@@ -148,6 +172,27 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const encryptPassword = (password: string) => {
|
||||
const encrypted = publicKey.encrypt(password, 'RSAES-PKCS1-V1_5');
|
||||
// 将加密后的数据转换为base64格式以便传输
|
||||
return forge.util.encode64(encrypted);
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
let loginInfoJSON = localStorage.getItem("loginInfo")
|
||||
if (loginInfoJSON) {
|
||||
const loginInfo = JSON.parse(loginInfoJSON)
|
||||
if (loginInfo.exp < Date.now()) {
|
||||
localStorage.removeItem("loginInfo")
|
||||
} else {
|
||||
isAutoLogin.value = true
|
||||
loginForm.username = forge.util.decode64(loginInfo.username)
|
||||
loginForm.password = loginInfo.password
|
||||
loginForm.checked = true
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
height: 100%;
|
||||
min-height: 550px;
|
||||
// background-color: #eeeeee;
|
||||
background-color: #003078;
|
||||
background-color: var(--el-color-primary);
|
||||
background-image: url("@/assets/images/login_bg.svg");
|
||||
background-size: 100% 100%;
|
||||
background-size: cover;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
<div class="data-check-content">
|
||||
<div class="content-tree">
|
||||
<Tree ref="treeRef" :treeData="treeData" @setTab="setTab"/>
|
||||
<Tree ref="treeRef" :treeData="treeData" @setTab="setTab" />
|
||||
</div>
|
||||
|
||||
<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">
|
||||
<div v-if="activeName == tab.value">
|
||||
<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 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">
|
||||
<Commun
|
||||
:activeName="activeName"
|
||||
@@ -48,7 +48,7 @@
|
||||
:data="tableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#003078',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
@@ -95,7 +95,7 @@
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num + 1].famp +
|
||||
(valueCode == 'Absolute' ? 'V' : '%')
|
||||
(valueCode == 'Absolute' ? 'A' : '%')
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
@@ -126,46 +126,52 @@
|
||||
</el-tabs>
|
||||
<div class="page">
|
||||
<div class="black-container">
|
||||
<!-- <el-progress-->
|
||||
<!-- v-if="loading"-->
|
||||
<!-- type="circle"-->
|
||||
<!-- >-->
|
||||
<!-- <template #default="{}">-->
|
||||
<!-- <span class="Loading">Loading</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-progress>-->
|
||||
<div class="loading-container" v-if="showLoading">
|
||||
<div style="width: 80%; height: 80%;" class="loading-box">
|
||||
<div class="loading-circle"></div>
|
||||
<div class="loading-text">Loading...</div>
|
||||
<!-- <el-progress-->
|
||||
<!-- v-if="loading"-->
|
||||
<!-- type="circle"-->
|
||||
<!-- >-->
|
||||
<!-- <template #default="{}">-->
|
||||
<!-- <span class="Loading">Loading</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-progress>-->
|
||||
<div class="loading-container" v-if="showLoading">
|
||||
<div style="width: 80%; height: 80%" class="loading-box">
|
||||
<div class="loading-circle"></div>
|
||||
<div class="loading-text">Loading...</div>
|
||||
</div>
|
||||
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||
</div>
|
||||
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||
</div>
|
||||
<div class="loading-container" v-else>
|
||||
<div style="width: 80%; height: 80%; " class="loading-box">
|
||||
<div class="loading-circle static"></div>
|
||||
<div class="loading-text">Loading</div>
|
||||
<div class="loading-container" v-else>
|
||||
<div style="width: 80%; height: 80%" class="loading-box">
|
||||
<div class="loading-circle static"></div>
|
||||
<div class="loading-text">Loading</div>
|
||||
</div>
|
||||
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||
</div>
|
||||
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 10px;">
|
||||
<span>标准源加量输出:{{hour}}时{{minute}}分{{second}}秒</span>
|
||||
</div>
|
||||
<div style="margin-top: 10px;">
|
||||
<el-button :icon="VideoPlay"
|
||||
type="primary"
|
||||
size="large"
|
||||
@click="startLoading"
|
||||
:disabled="pauseDisabled"
|
||||
>启动</el-button>
|
||||
<el-button :icon="VideoPause"
|
||||
type="primary"
|
||||
size="large"
|
||||
@click="stopLoading"
|
||||
:disabled="pauseDisabled"
|
||||
>停止</el-button>
|
||||
</div>
|
||||
<div style="margin-top: 10px">
|
||||
<span>标准源加量输出:{{ hour }}时{{ minute }}分{{ second }}秒</span>
|
||||
</div>
|
||||
<div style="margin-top: 10px">
|
||||
<el-button
|
||||
:icon="VideoPlay"
|
||||
type="primary"
|
||||
size="large"
|
||||
@click="startLoading"
|
||||
:disabled="pauseDisabled"
|
||||
>
|
||||
启动
|
||||
</el-button>
|
||||
<el-button
|
||||
:icon="VideoPause"
|
||||
type="primary"
|
||||
size="large"
|
||||
@click="stopLoading"
|
||||
:disabled="pauseDisabled"
|
||||
>
|
||||
停止
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -187,12 +193,13 @@
|
||||
v-if="showDialog"
|
||||
/>
|
||||
<!-- 查看 -->
|
||||
<ViewRow ref="viewRowRef"
|
||||
:activeName="activeName"
|
||||
:formContent="props.formContent"
|
||||
@close="viewDialog = false"
|
||||
v-if="viewDialog"
|
||||
/>
|
||||
<ViewRow
|
||||
ref="viewRowRef"
|
||||
:activeName="activeName"
|
||||
:formContent="props.formContent"
|
||||
@close="viewDialog = false"
|
||||
v-if="viewDialog"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -200,9 +207,19 @@
|
||||
import { type PropType, ref, nextTick, onMounted, watch } from 'vue'
|
||||
import Tree from './tree.vue'
|
||||
import Commun from '@/views/machine/testScript/components//communication.vue'
|
||||
import {type CascaderOption, ElMessage} from 'element-plus'
|
||||
import { type CascaderOption, ElMessage } from 'element-plus'
|
||||
import { getTreeData } from '@/api/check/test'
|
||||
import {CirclePlus, Delete, Check, CopyDocument, View, EditPen, VideoPlay, VideoPause, Loading} from '@element-plus/icons-vue'
|
||||
import {
|
||||
CirclePlus,
|
||||
Delete,
|
||||
Check,
|
||||
CopyDocument,
|
||||
View,
|
||||
EditPen,
|
||||
VideoPlay,
|
||||
VideoPause,
|
||||
Loading
|
||||
} from '@element-plus/icons-vue'
|
||||
import type { TestScript } from '@/api/device/interface/testScript'
|
||||
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
|
||||
import { CheckData } from '@/api/check/interface'
|
||||
@@ -211,7 +228,7 @@ import { useDictStore } from '@/stores/modules/dict'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { scriptDtlsCheckDataList } from '@/api/device/testScript/index'
|
||||
import ViewRow from '@/views/machine/testScript/components/viewRow.vue'
|
||||
import { startSimulateTest,closeSimulateTest } from '@/api/device/controlSource/index.ts'
|
||||
import { startSimulateTest, closeSimulateTest } from '@/api/device/controlSource/index.ts'
|
||||
import { controlSource } from '@/api/device/interface/controlSource'
|
||||
interface TabOption {
|
||||
label?: string
|
||||
@@ -238,17 +255,16 @@ const props = defineProps({
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
startDisabeld: {
|
||||
type:Boolean,
|
||||
required:true
|
||||
},
|
||||
pauseDisabled: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}
|
||||
startDisabeld: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
pauseDisabled: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const showDialog = ref(false)
|
||||
const viewDialog = ref(false)
|
||||
const dictStore = useDictStore()
|
||||
@@ -285,47 +301,47 @@ const hour = ref(0)
|
||||
const minute = 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 ()=>{
|
||||
if(props.formControl.scriptId!=''){
|
||||
|
||||
nextTick(async () => {
|
||||
await getTree()
|
||||
console.log('props.formControl.scriptId')
|
||||
treeRef.value.checkTree()
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
watch(
|
||||
() => props.formControl.scriptId,
|
||||
async () => {
|
||||
if (props.formControl.scriptId != '') {
|
||||
nextTick(async () => {
|
||||
await getTree()
|
||||
console.log('props.formControl.scriptId')
|
||||
treeRef.value.checkTree()
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
const controlContent = ref<controlSource.ResControl>({
|
||||
userPageId: '',
|
||||
scriptId: '',
|
||||
scriptIndex: 0,
|
||||
sourceId: '',
|
||||
userPageId: '',
|
||||
scriptId: '',
|
||||
scriptIndex: 0,
|
||||
sourceId: ''
|
||||
})
|
||||
// 获取树
|
||||
const getTree = () => {
|
||||
getTreeData({
|
||||
scriptId: props.formControl.scriptId,
|
||||
scriptId: props.formControl.scriptId
|
||||
}).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
treeData.value = res.data
|
||||
//console.log('tree',res.data)
|
||||
// 为 treeData 及其子节点添加 id
|
||||
let idCounter = 0;
|
||||
let idCounter = 0
|
||||
const addIdToTree = (nodes: any[]) => {
|
||||
nodes.forEach(node => {
|
||||
node.id = idCounter++; // 为每个节点添加唯一的 id
|
||||
node.id = idCounter++ // 为每个节点添加唯一的 id
|
||||
if (node.children && node.children.length > 0) {
|
||||
node.disabled = true
|
||||
addIdToTree(node.children); // 递归为子节点添加 id
|
||||
addIdToTree(node.children) // 递归为子节点添加 id
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
addIdToTree(treeData.value);
|
||||
addIdToTree(treeData.value)
|
||||
|
||||
// 添加tab子项
|
||||
props.options.forEach((k: any, i: number) => {
|
||||
@@ -335,7 +351,6 @@ const getTree = () => {
|
||||
item.children.forEach((s: any) => {
|
||||
k.children.forEach((P: any) => {
|
||||
if (P.code == s.scriptTypeCode) {
|
||||
|
||||
tabData.value[i].children.push({
|
||||
label: P.label,
|
||||
value: P.code,
|
||||
@@ -357,17 +372,15 @@ const getTree = () => {
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
//console.log('2222',treeData.value)
|
||||
|
||||
tabChange()
|
||||
}
|
||||
})
|
||||
//console.log('获取树')
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 设置树点击tab
|
||||
const setTab = row => {
|
||||
activeName.value = row.activeName
|
||||
@@ -396,8 +409,6 @@ const tabChange = () => {
|
||||
childActiveName.value =
|
||||
tabData.value.filter((item: any) => item.value == activeName.value)[0]?.children[0]?.value || ''
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
inquireTable()
|
||||
}
|
||||
@@ -425,13 +436,11 @@ const inquireTable = () => {
|
||||
//console.log('treeData',treeData.value)
|
||||
}
|
||||
|
||||
|
||||
// 查看
|
||||
const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||
|
||||
getCommunication()
|
||||
//当前点击的一级tab
|
||||
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称';
|
||||
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'
|
||||
//当前点击的二级tab
|
||||
const childrenTabName = ref('')
|
||||
tabData.value.forEach((item: any) => {
|
||||
@@ -445,25 +454,23 @@ const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||
})
|
||||
viewDialog.value = true
|
||||
setTimeout(() => {
|
||||
|
||||
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
|
||||
}, 0)
|
||||
|
||||
}
|
||||
|
||||
// 定义 startLoading 方法
|
||||
const startLoading = async () => {
|
||||
emit('update:startDisabeld', true)
|
||||
emit('update:pauseDisabled', true)
|
||||
ElMessage.success({message:'启动中...',duration:6000})
|
||||
emit('update:startDisabeld', true)
|
||||
emit('update:pauseDisabled', true)
|
||||
ElMessage.success({ message: '启动中...', duration: 6000 })
|
||||
// 启动加载逻辑
|
||||
controlContent.value.userPageId = 'cdf'
|
||||
controlContent.value.scriptId = props.formControl.scriptId
|
||||
controlContent.value.scriptIndex = childActiveIndex.value
|
||||
controlContent.value.sourceId = props.formControl.sourceId
|
||||
setTimeout(async () => {
|
||||
await startSimulateTest(controlContent.value)
|
||||
},3000)
|
||||
controlContent.value.sourceId = props.formControl.sourceId
|
||||
setTimeout(async () => {
|
||||
await startSimulateTest(controlContent.value)
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
// 定义 startLoading 方法
|
||||
@@ -472,44 +479,43 @@ const stopLoading = async () => {
|
||||
controlContent.value.userPageId = 'cdf'
|
||||
controlContent.value.scriptId = props.formControl.scriptId
|
||||
controlContent.value.scriptIndex = childActiveIndex.value
|
||||
controlContent.value.sourceId = props.formControl.sourceId
|
||||
controlContent.value.sourceId = props.formControl.sourceId
|
||||
await closeSimulateTest(controlContent.value)
|
||||
emit('update:pauseDisabled', true)
|
||||
emit('update:startDisabeld', true)
|
||||
ElMessage.success({message:'停止中...',duration:5000})
|
||||
ElMessage.success({ message: '停止中...', duration: 5000 })
|
||||
}
|
||||
|
||||
|
||||
const startTimeCount = () => {
|
||||
// Loading效果展示
|
||||
showLoading.value = true
|
||||
// Loading效果展示
|
||||
showLoading.value = true
|
||||
|
||||
if (!timer) {
|
||||
hour.value = 0
|
||||
minute.value = 0
|
||||
second.value = 0
|
||||
timeCount.value = 0
|
||||
timer = setInterval(() => {
|
||||
timeCount.value = timeCount.value + 1
|
||||
secondToTime(timeCount.value)
|
||||
}, 1000)
|
||||
}
|
||||
if (!timer) {
|
||||
hour.value = 0
|
||||
minute.value = 0
|
||||
second.value = 0
|
||||
timeCount.value = 0
|
||||
timer = setInterval(() => {
|
||||
timeCount.value = timeCount.value + 1
|
||||
secondToTime(timeCount.value)
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
const secondToTime = (secd: number) => {
|
||||
//将秒数转换成时分秒
|
||||
hour.value = Math.floor(secd / 3600)
|
||||
minute.value = Math.floor((secd - hour.value * 3600) / 60)
|
||||
second.value = Math.floor(secd % 60);
|
||||
//将秒数转换成时分秒
|
||||
hour.value = Math.floor(secd / 3600)
|
||||
minute.value = Math.floor((secd - hour.value * 3600) / 60)
|
||||
second.value = Math.floor(secd % 60)
|
||||
}
|
||||
|
||||
const stopTimeCount = () => {
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
//Loading效果关闭
|
||||
showLoading.value = false
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
//Loading效果关闭
|
||||
showLoading.value = false
|
||||
}
|
||||
|
||||
// 获取左边树数据
|
||||
@@ -519,7 +525,6 @@ const addTab = (row: any) => {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
getTree()
|
||||
props.options.forEach((item: any) => {
|
||||
tabData.value.push({
|
||||
@@ -537,8 +542,8 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
startTimeCount,
|
||||
stopTimeCount
|
||||
startTimeCount,
|
||||
stopTimeCount
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@@ -598,7 +603,7 @@ defineExpose({
|
||||
width: 45%;
|
||||
}
|
||||
.theFirst {
|
||||
background-color: #003078;
|
||||
background-color: var(--el-color-primary);
|
||||
color: #fff;
|
||||
width: 20px !important;
|
||||
}
|
||||
@@ -611,50 +616,50 @@ defineExpose({
|
||||
}
|
||||
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.black-container {
|
||||
background-color: #000;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
position: relative; /* 设置为相对定位 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 20px;
|
||||
background-color: #000;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
position: relative; /* 设置为相对定位 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.loading-box {
|
||||
position: relative; /* 设置为相对定位 */
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative; /* 设置为相对定位 */
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.loading-circle {
|
||||
border: 8px solid rgba(255, 255, 255, 0.932);
|
||||
border-top: 8px solid var(--el-color-primary); /* 蓝色 */
|
||||
border-bottom: 8px solid var(--el-color-primary); /* 蓝色 */
|
||||
border-radius: 50%;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
position: absolute; /* 设置为绝对定位 */
|
||||
animation: spin 2s linear infinite;
|
||||
border: 8px solid rgba(255, 255, 255, 0.932);
|
||||
border-top: 8px solid var(--el-color-primary); /* 蓝色 */
|
||||
border-bottom: 8px solid var(--el-color-primary); /* 蓝色 */
|
||||
border-radius: 50%;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
position: absolute; /* 设置为绝对定位 */
|
||||
animation: spin 2s linear infinite;
|
||||
}
|
||||
|
||||
.loading-circle.static {
|
||||
@@ -662,35 +667,36 @@ defineExpose({
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
position: absolute; /* 设置为绝对定位 */
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
color: #fff;
|
||||
font-size: 20px; /* 根据需要调整字体大小 */
|
||||
text-align: center;
|
||||
position: absolute; /* 设置为绝对定位 */
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
color: #fff;
|
||||
font-size: 20px; /* 根据需要调整字体大小 */
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.hidden-tab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
<style>
|
||||
input::-webkit-inner-spin-button {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<!-- <div class="formBut">-->
|
||||
<el-button type="primary" :icon="Select" @click="start()" :disabled="connectDisabeld">通讯校验</el-button>
|
||||
<el-button v-if="!connectDisabeld" type="text" style="color: #303133" disabled>源未连接</el-button>
|
||||
<el-button v-else type="text" style="color: #67c23a" disabled>源连接成功</el-button>
|
||||
<el-button v-else type="text" style="color: #91cc75" disabled>源连接成功</el-button>
|
||||
<!-- </div>-->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -103,8 +103,8 @@
|
||||
<el-form-item label='密钥' prop='devKey' clearable v-if="formContent.encryptionFlag">
|
||||
<el-input v-model='formContent.devKey' placeholder="请输入密钥" show-password/>
|
||||
</el-form-item>
|
||||
<el-form-item label='样品编号' prop='sampleID' clearable v-if="DevIsShow && scene === '0'">
|
||||
<el-input v-model='formContent.sampleID' placeholder="请输入样品编号" />
|
||||
<el-form-item label='样品编号' prop='sampleId' clearable v-if="DevIsShow && scene === '0'">
|
||||
<el-input v-model='formContent.sampleId' placeholder="请输入样品编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label='送样日期' prop='arrivedDate' v-if="scene === '0'">
|
||||
<el-date-picker
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class='table-box' ref='popupBaseView'>
|
||||
<ProTable
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:request-api='getTableList'
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:request-api='getTableList'
|
||||
>
|
||||
<!-- :requestApi="getRoleList" -->
|
||||
<!-- 表格 header 按钮 -->
|
||||
@@ -32,32 +32,25 @@
|
||||
|
||||
</ProTable>
|
||||
</div>
|
||||
<DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup' />
|
||||
<ImportExcel ref='deviceImportExcel' />
|
||||
<DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup'/>
|
||||
<ImportExcel ref='deviceImportExcel'/>
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='useRole'>
|
||||
import TimeControl from '@/components/TimeControl/index.vue'
|
||||
import { type Device } from '@/api/device/interface/device.ts'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
import {type Device} from '@/api/device/interface/device.ts'
|
||||
import {useHandleData} from '@/hooks/useHandleData'
|
||||
import {useDownload} from '@/hooks/useDownload'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||
import {type ColumnProps, type ProTableInstance} from '@/components/ProTable/interface'
|
||||
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
||||
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import {
|
||||
getPqDevList,
|
||||
deletePqDev,
|
||||
getPqDev,
|
||||
exportCNDev,
|
||||
downloadCNDevTemplate,
|
||||
importCNDev,
|
||||
} from '@/api/device/device/index.ts'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { onBeforeMount, reactive, ref } from 'vue'
|
||||
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
|
||||
import {CirclePlus, Delete, Download, EditPen, Upload} from '@element-plus/icons-vue'
|
||||
import {useDictStore} from '@/stores/modules/dict'
|
||||
import {deletePqDev, downloadTemplate, exportPqDev, getPqDev, getPqDevList, importPqDev} from '@/api/device/device/index.ts'
|
||||
import {ElMessageBox} from 'element-plus'
|
||||
import {onBeforeMount, reactive, ref} from 'vue'
|
||||
import {useAppSceneStore, useModeStore} from '@/stores/modules/mode'
|
||||
|
||||
// defineOptions({
|
||||
// name: 'device',
|
||||
@@ -72,6 +65,7 @@ const boundPqDevList = ref<Device.ReqPqDevParams[]>([])//根据检测计划id查
|
||||
// 存储设备类型选项
|
||||
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||
|
||||
|
||||
const getTableList = async (params: any) => {
|
||||
let newParams = JSON.parse(JSON.stringify(params))
|
||||
newParams.searchEndTime = endDate.value
|
||||
@@ -84,12 +78,12 @@ const getTableList = async (params: any) => {
|
||||
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||
{type: 'selection', fixed: 'left', width: 70},
|
||||
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '名称',
|
||||
search: { el: 'input' },
|
||||
search: {el: 'input'},
|
||||
// isShow: appSceneStore.currentScene != '1',
|
||||
// ...(appSceneStore.currentScene != '1' ? {
|
||||
// search: { el: 'input' },
|
||||
@@ -115,12 +109,12 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
search: {
|
||||
render: () => {
|
||||
return (
|
||||
<div class='flx-flex-start'>
|
||||
<TimeControl
|
||||
default={'月'}
|
||||
onUpdate-dates={handleDateChange}
|
||||
/>
|
||||
</div>
|
||||
<div class='flx-flex-start'>
|
||||
<TimeControl
|
||||
default={'月'}
|
||||
onUpdate-dates={handleDateChange}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
@@ -163,8 +157,8 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
enum: dictStore.getDictData('Dev_Manufacturers'),
|
||||
isShow: appSceneStore.currentScene != '1',
|
||||
...(appSceneStore.currentScene != '1' ? {
|
||||
search: { el: 'select', props: { filterable: true }, order: 1 },
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
search: {el: 'select', props: {filterable: true}, order: 1},
|
||||
fieldNames: {label: 'name', value: 'id'},
|
||||
} : {}),
|
||||
minWidth: 200,
|
||||
},
|
||||
@@ -174,19 +168,19 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
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 '';
|
||||
const date = new Date(scope.row.createTime);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
||||
{prop: 'operation', label: '操作', fixed: 'right', width: 200},
|
||||
])
|
||||
|
||||
|
||||
@@ -206,8 +200,8 @@ const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
||||
// 批量删除设备
|
||||
const batchDelete = async (id: string[]) => {
|
||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
||||
await useHandleData(deletePqDev, { 'ids': id, 'pattern': patternId }, '删除所选设备')
|
||||
|
||||
await useHandleData(deletePqDev, {'ids': id, 'pattern': patternId}, '删除所选设备')
|
||||
|
||||
proTable.value?.clearSelection()
|
||||
proTable.value?.getTableList()
|
||||
}
|
||||
@@ -215,9 +209,9 @@ const batchDelete = async (id: string[]) => {
|
||||
// 删除设备
|
||||
const handleDelete = async (params: Device.ResPqDev) => {
|
||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||
await useHandleData(deletePqDev, { 'ids': [params.id], 'pattern': patternId }, `删除【${params.name}】设备`)
|
||||
await useHandleData(deletePqDev, {'ids': [params.id], 'pattern': patternId}, `删除【${params.name}】设备`)
|
||||
proTable.value?.getTableList()
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 导出设备
|
||||
@@ -229,9 +223,9 @@ const downloadFile = async () => {
|
||||
searchParam.searchBeginTime = startDate.value
|
||||
searchParam.searchEndTime = endDate.value
|
||||
|
||||
ElMessageBox.confirm('确认导出被检设备?', '温馨提示', { type: 'warning' }).then(() => {
|
||||
ElMessageBox.confirm('确认导出被检设备?', '温馨提示', {type: 'warning'}).then(() => {
|
||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||
useDownload(exportCNDev, '被检设备导出数据', { ...proTable.value?.searchParam, pattern: patternId }, false, '.xlsx')
|
||||
useDownload(exportPqDev, '被检设备导出数据', {...proTable.value?.searchParam, pattern: patternId}, false, '.xlsx')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -254,8 +248,8 @@ const importFile = async (pattern: string) => {
|
||||
title: '被检设备',
|
||||
showCover: false,
|
||||
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id,
|
||||
tempApi: downloadCNDevTemplate,
|
||||
importApi: importCNDev,
|
||||
tempApi: downloadTemplate,
|
||||
importApi: importPqDev,
|
||||
// importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev,
|
||||
getTableList: proTable.value?.getTableList,
|
||||
}
|
||||
|
||||
@@ -1,63 +1,62 @@
|
||||
<template>
|
||||
|
||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
||||
<div class="table-container">
|
||||
<el-table :data="errorData.value"
|
||||
height="500"
|
||||
:header-cell-style="rowClass"
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
style="width: 100%"
|
||||
:span-method="spanMethod"
|
||||
:border="true"
|
||||
class="custom-table"
|
||||
>
|
||||
<el-table-column label="被测量">
|
||||
<el-table-column prop="col1" width="150"/>
|
||||
<el-table-column prop="col2" width="120" />
|
||||
</el-table-column>
|
||||
<el-table-column prop="deviceLevel" label="检测装置级别" width="120"/>
|
||||
<el-table-column prop="measurementType" label="测量类型" />
|
||||
<el-table-column prop="condition" label="测量条件" />
|
||||
<el-table-column prop="maxErrorValue" label="最大误差" />
|
||||
</el-table>
|
||||
</div>
|
||||
<div>
|
||||
<label class="left-align-label">注1:UN:测量的标称电压;IN:测量仪器的标称电流;Uh和Ih:测量值,h表示谐波次数。</label>
|
||||
</div>
|
||||
<div>
|
||||
<label class="left-align-label">注2:对于数字式接入监测终端,与电能质量信号采集单元联合准确度需满足本表要求。</label>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="IndicatorTypeDialog">
|
||||
import { defineProps, defineEmits, reactive,watch,ref,computed, type CSSProperties } from 'vue';
|
||||
import { dialogBig} from '@/utils/elementBind'
|
||||
import type { ColumnProps } from '@/components/ProTable/interface'
|
||||
import type { ErrorSystem } from '@/api/device/interface/error'
|
||||
import errorDataList from '@/api/device/error/errorData'
|
||||
import type { TableColumnCtx } from 'element-plus'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const errorData = ref<ErrorSystem.Error_detail[]>([]);
|
||||
const dialogTitle = ref()
|
||||
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref
|
||||
function useMetaInfo() {
|
||||
const dialogVisible = ref(false)
|
||||
const formContent = ref<ErrorSystem.ErrorSystemList>({
|
||||
id: '',
|
||||
name: '',
|
||||
standardName:'',
|
||||
standardTime:'',
|
||||
devLevel:'',
|
||||
enable:1,
|
||||
state:1,
|
||||
})
|
||||
return { dialogVisible, formContent }
|
||||
}
|
||||
|
||||
const { dialogVisible, formContent } = useMetaInfo()
|
||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
||||
<div class="table-container">
|
||||
<el-table :data="errorData.value"
|
||||
height="500"
|
||||
:header-cell-style="rowClass"
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
style="width: 100%"
|
||||
:span-method="spanMethod"
|
||||
:border="true"
|
||||
class="custom-table"
|
||||
>
|
||||
<el-table-column label="被测量">
|
||||
<el-table-column prop="col1" width="150"/>
|
||||
<el-table-column prop="col2" width="120"/>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deviceLevel" label="检测装置级别" width="120"/>
|
||||
<el-table-column prop="measurementType" label="测量类型"/>
|
||||
<el-table-column prop="condition" label="测量条件"/>
|
||||
<el-table-column prop="maxErrorValue" label="最大误差"/>
|
||||
</el-table>
|
||||
</div>
|
||||
<div>
|
||||
<label class="left-align-label">注1:UN:测量的标称电压;IN:测量仪器的标称电流;Uh和Ih:测量值,h表示谐波次数。</label>
|
||||
</div>
|
||||
<div>
|
||||
<label class="left-align-label">注2:对于数字式接入监测终端,与电能质量信号采集单元联合准确度需满足本表要求。</label>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="IndicatorTypeDialog">
|
||||
import {computed, type CSSProperties, defineProps, ref} from 'vue';
|
||||
import {dialogBig} from '@/utils/elementBind'
|
||||
import type {ErrorSystem} from '@/api/device/interface/error'
|
||||
import errorDataList from '@/api/device/error/errorData'
|
||||
import type {TableColumnCtx} from 'element-plus'
|
||||
import {useDictStore} from '@/stores/modules/dict'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const errorData = ref<ErrorSystem.Error_detail[]>([]);
|
||||
const dialogTitle = ref()
|
||||
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref
|
||||
function useMetaInfo() {
|
||||
const dialogVisible = ref(false)
|
||||
const formContent = ref<ErrorSystem.ErrorSystemList>({
|
||||
id: '',
|
||||
name: '',
|
||||
standardName: '',
|
||||
standardTime: '',
|
||||
devLevel: '',
|
||||
enable: 1,
|
||||
state: 1,
|
||||
})
|
||||
return {dialogVisible, formContent}
|
||||
}
|
||||
|
||||
const {dialogVisible, formContent} = useMetaInfo()
|
||||
|
||||
interface SpanMethodProps {
|
||||
row: ErrorSystem.ErrorSystemDetail
|
||||
@@ -66,14 +65,14 @@ interface SpanMethodProps {
|
||||
columnIndex: number
|
||||
}
|
||||
|
||||
const rowClass = ({ row, column, rowIndex, columnIndex }: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
|
||||
const rowClass = ({row, column, rowIndex, columnIndex}: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
|
||||
let res: CSSProperties = {
|
||||
textAlign: 'center' as CSSProperties['textAlign'],
|
||||
backgroundColor: '#003078',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}
|
||||
if (rowIndex === 1) {
|
||||
res = { ...res, display: 'none' }
|
||||
res = {...res, display: 'none'}
|
||||
}
|
||||
return res
|
||||
}
|
||||
@@ -84,11 +83,11 @@ const spanMethod = computed(() => {
|
||||
})
|
||||
|
||||
const spanAMethod = ({
|
||||
row,
|
||||
column,
|
||||
rowIndex,
|
||||
columnIndex,
|
||||
}: SpanMethodProps) => {
|
||||
row,
|
||||
column,
|
||||
rowIndex,
|
||||
columnIndex,
|
||||
}: SpanMethodProps) => {
|
||||
if (columnIndex === 0) {
|
||||
if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
||||
return {
|
||||
@@ -98,16 +97,16 @@ const spanAMethod = ({
|
||||
}
|
||||
if (rowIndex === 2) {//2三相不平衡跨三行两列
|
||||
return {
|
||||
rowspan: 3,
|
||||
rowspan: 3,
|
||||
colspan: 2,
|
||||
}
|
||||
}
|
||||
if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 ||
|
||||
rowIndex >= 9 && rowIndex <= 15 ||
|
||||
rowIndex >= 17 && rowIndex <= 19 ||
|
||||
if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 ||
|
||||
rowIndex >= 9 && rowIndex <= 15 ||
|
||||
rowIndex >= 17 && rowIndex <= 19 ||
|
||||
rowIndex === 22 || rowIndex === 24) {//这些行不显示
|
||||
return {
|
||||
rowspan: 0,
|
||||
rowspan: 0,
|
||||
colspan: 0,
|
||||
}
|
||||
}
|
||||
@@ -145,16 +144,16 @@ const spanAMethod = ({
|
||||
}
|
||||
}
|
||||
if (columnIndex === 2 || columnIndex === 3) {
|
||||
if (rowIndex === 2 || rowIndex === 8 || rowIndex === 10 ||
|
||||
rowIndex === 12 || rowIndex === 14 || rowIndex === 16 ||
|
||||
if (rowIndex === 2 || rowIndex === 8 || rowIndex === 10 ||
|
||||
rowIndex === 12 || rowIndex === 14 || rowIndex === 16 ||
|
||||
rowIndex === 18 || rowIndex === 21) {
|
||||
return {
|
||||
rowspan: 2,
|
||||
colspan: 1,
|
||||
}
|
||||
}
|
||||
if (rowIndex === 3 || rowIndex === 9 || rowIndex === 11 ||
|
||||
rowIndex === 13 || rowIndex === 15 || rowIndex === 17 ||
|
||||
if (rowIndex === 3 || rowIndex === 9 || rowIndex === 11 ||
|
||||
rowIndex === 13 || rowIndex === 15 || rowIndex === 17 ||
|
||||
rowIndex === 19 || rowIndex === 22) {
|
||||
return {
|
||||
rowspan: 0,
|
||||
@@ -166,11 +165,11 @@ const spanAMethod = ({
|
||||
|
||||
|
||||
const spanSMethod = ({
|
||||
row,
|
||||
column,
|
||||
rowIndex,
|
||||
columnIndex,
|
||||
}: SpanMethodProps) => {
|
||||
row,
|
||||
column,
|
||||
rowIndex,
|
||||
columnIndex,
|
||||
}: SpanMethodProps) => {
|
||||
if (columnIndex === 0) {
|
||||
if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
||||
return {
|
||||
@@ -180,16 +179,16 @@ const spanSMethod = ({
|
||||
}
|
||||
if (rowIndex === 2) {//2三相不平衡跨三行两列
|
||||
return {
|
||||
rowspan: 3,
|
||||
rowspan: 3,
|
||||
colspan: 2,
|
||||
}
|
||||
}
|
||||
if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 || rowIndex === 7 ||
|
||||
rowIndex >= 10 && rowIndex <= 12 ||
|
||||
rowIndex >= 14 && rowIndex <= 16 ||
|
||||
rowIndex >= 10 && rowIndex <= 12 ||
|
||||
rowIndex >= 14 && rowIndex <= 16 ||
|
||||
rowIndex === 19 || rowIndex === 21 || rowIndex === 22) {//这些行不显示
|
||||
return {
|
||||
rowspan: 0,
|
||||
rowspan: 0,
|
||||
colspan: 0,
|
||||
}
|
||||
}
|
||||
@@ -205,7 +204,7 @@ const spanSMethod = ({
|
||||
colspan: 2,
|
||||
}
|
||||
}
|
||||
if (rowIndex === 18 ) {//电流跨两行两列
|
||||
if (rowIndex === 18) {//电流跨两行两列
|
||||
return {
|
||||
rowspan: 2,
|
||||
colspan: 2,
|
||||
@@ -227,17 +226,17 @@ const spanSMethod = ({
|
||||
}
|
||||
}
|
||||
if (columnIndex === 2) {
|
||||
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
|
||||
rowIndex === 11 || rowIndex === 13 || rowIndex === 15 ||
|
||||
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
|
||||
rowIndex === 11 || rowIndex === 13 || rowIndex === 15 ||
|
||||
rowIndex === 18 || rowIndex === 21) {
|
||||
return {
|
||||
rowspan: 2,
|
||||
colspan: 1,
|
||||
}
|
||||
}
|
||||
if (rowIndex === 3 || rowIndex === 7 ||
|
||||
rowIndex === 10 || rowIndex === 12 ||
|
||||
rowIndex === 14 || rowIndex === 16 ||
|
||||
if (rowIndex === 3 || rowIndex === 7 ||
|
||||
rowIndex === 10 || rowIndex === 12 ||
|
||||
rowIndex === 14 || rowIndex === 16 ||
|
||||
rowIndex === 19 || rowIndex === 22) {
|
||||
return {
|
||||
rowspan: 0,
|
||||
@@ -245,18 +244,18 @@ const spanSMethod = ({
|
||||
}
|
||||
}
|
||||
}
|
||||
if(columnIndex === 3){
|
||||
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
|
||||
rowIndex === 11 || rowIndex === 13 ||rowIndex === 15 ||
|
||||
rowIndex === 18 || rowIndex === 21){
|
||||
if (columnIndex === 3) {
|
||||
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
|
||||
rowIndex === 11 || rowIndex === 13 || rowIndex === 15 ||
|
||||
rowIndex === 18 || rowIndex === 21) {
|
||||
return {
|
||||
rowspan: 2,
|
||||
colspan: 1,
|
||||
}
|
||||
}
|
||||
if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 ||
|
||||
rowIndex === 12 || rowIndex === 14 ||rowIndex === 16 ||
|
||||
rowIndex === 19 || rowIndex === 22){
|
||||
if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 ||
|
||||
rowIndex === 12 || rowIndex === 14 || rowIndex === 16 ||
|
||||
rowIndex === 19 || rowIndex === 22) {
|
||||
return {
|
||||
rowspan: 0,
|
||||
colspan: 0,
|
||||
@@ -267,34 +266,34 @@ const spanSMethod = ({
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
||||
dialogTitle.value = sign + ' 误差体系'
|
||||
dialogVisible.value = true
|
||||
|
||||
if (data.id) {
|
||||
formContent.value = data as ErrorSystem.ErrorSystemList;
|
||||
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[];
|
||||
} else {
|
||||
errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];
|
||||
}
|
||||
|
||||
if(devLevelName.value === 'A级'){
|
||||
errorData.value = errorDataList.errorADetail as unknown as ErrorSystem.Error_detail[];
|
||||
}else{
|
||||
errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
// 对外映射
|
||||
defineExpose({open})
|
||||
const props = defineProps<{
|
||||
refreshTable: (() => Promise<void>) | undefined;
|
||||
}>()
|
||||
</script>
|
||||
<style>
|
||||
</script>
|
||||
<style>
|
||||
.table-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -316,4 +315,4 @@ const props = defineProps<{
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
</div>
|
||||
<div class="table-container">
|
||||
<el-table :data="tableData"
|
||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
||||
:header-cell-style="{ textAlign: 'center',backgroundColor: 'var(--el-color-primary)',color: '#fff' } "
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
style="width: 100%"
|
||||
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}"
|
||||
:style="{ height: '400px',maxHeight: '400px',overflow:'hidden'}"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="sort" label="序号" width="60" />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane label="基础信息">
|
||||
<div >
|
||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' label-width="auto" class="form-three">
|
||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' label-width="auto" class="form-four">
|
||||
<el-form-item label="标准号" prop="standardName" >
|
||||
<el-input v-model='formContent.standardName' placeholder="请填写标准号"/>
|
||||
</el-form-item>
|
||||
@@ -26,7 +26,7 @@
|
||||
<el-form-item label="状态" prop="enable" >
|
||||
<el-select v-model='formContent.enable' placeholder="请选择状态">
|
||||
<el-option label="启用" :value="1"></el-option>
|
||||
<el-option label="不启用" :value="0"></el-option>
|
||||
<el-option label="停用" :value="0"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<!-- 表格操作 -->
|
||||
<template #operation='scope'>
|
||||
<el-button v-auth.device="'view'" type='primary' link :icon='View' @click="openDialog('view', scope.row)">查看</el-button>
|
||||
<el-button v-auth.device="'view'" type='primary' link :icon='View' @click="copy(scope.row)">复制</el-button>
|
||||
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||
</template>
|
||||
@@ -26,7 +27,7 @@
|
||||
<ErrorStandardPopup :refresh-table='proTable?.getTableList' ref='errorStandardPopup' />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name='useProTable'>
|
||||
<script setup lang="tsx" name='useProTable'>
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||
import { CirclePlus, Delete,EditPen,View} from '@element-plus/icons-vue'
|
||||
@@ -36,7 +37,8 @@ import ErrorSystemPopup from '@/views/machine/errorSystem/components/errorSystem
|
||||
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue'
|
||||
import type { ErrorSystem } from '@/api/device/interface/error'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { getPqErrSysList, deletePqErrSys} from '@/api/device/error/index'
|
||||
import { getPqErrSysList, deletePqErrSys,copyPqErrSys} from '@/api/device/error/index'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
defineOptions({
|
||||
name: 'errorSystem'
|
||||
})
|
||||
@@ -71,7 +73,15 @@ const columns = ref<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
|
||||
search: { el: 'select', props: { filterable: true } },
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
},
|
||||
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 250,},
|
||||
{
|
||||
prop: 'enable',
|
||||
label: '启用状态',
|
||||
width: 120,
|
||||
render: scope => {
|
||||
return (scope.row.enable ? <el-tag type='success'>启用</el-tag> : <el-tag type='danger'>停用</el-tag>)
|
||||
},
|
||||
},
|
||||
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 300,},
|
||||
])
|
||||
|
||||
// 打开 drawer(新增、编辑)
|
||||
@@ -86,19 +96,33 @@ const openDialog = (titleType: string, row: Partial<ErrorSystem.ErrorSystemList>
|
||||
}
|
||||
|
||||
|
||||
// 批量删除设备
|
||||
// 批量误差体系
|
||||
const batchDelete = async (id: string[]) => {
|
||||
await useHandleData(deletePqErrSys, id, '删除所选误差体系')
|
||||
proTable.value?.clearSelection()
|
||||
proTable.value?.getTableList()
|
||||
}
|
||||
|
||||
// 删除设备
|
||||
// 删除误差体系
|
||||
const handleDelete = async (params: ErrorSystem.ErrorSystemList) => {
|
||||
await useHandleData(deletePqErrSys, [params.id], `删除【${params.name}】误差体系`)
|
||||
proTable.value?.getTableList()
|
||||
}
|
||||
|
||||
|
||||
// 复制误差体系
|
||||
const copy = async (params: ErrorSystem.ErrorSystemList) => {
|
||||
ElMessageBox.confirm('是否复制当前误差体系?', '提示', {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: 'warning',
|
||||
draggable: true
|
||||
}).then(async () => {
|
||||
copyPqErrSys(params).then(() => {
|
||||
proTable.value?.getTableList()
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
:data="tableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#003078',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
height="calc(100vh - 480px)"
|
||||
:height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`"
|
||||
:style="{ overflow: 'hidden' }"
|
||||
row-key="id"
|
||||
:expand-row-keys="[props.activeName]"
|
||||
@@ -75,6 +75,9 @@ const props = defineProps({
|
||||
options: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
shrink: {
|
||||
type: Boolean
|
||||
}
|
||||
})
|
||||
const tableData = ref<any[]>([])
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
:data="tableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#003078',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
@@ -33,7 +33,7 @@
|
||||
<el-table-column prop="phase" label="相别" />
|
||||
<el-table-column prop="value" label="参考设定值">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.show">{{ parseFloat((row.value - 0).toFixed(4)) || '' }}</span>
|
||||
<span v-if="row.show">{{ parseFloat((row.value - 0).toFixed(4)) }}{{ setUnit(row) || '' }}</span>
|
||||
<el-input type="number" v-else v-model="row.value" placeholder="请输入值" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -96,6 +96,10 @@ const props = defineProps({
|
||||
form: {
|
||||
type: [Object, Array],
|
||||
required: true
|
||||
},
|
||||
valueCode: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['recalculation'])
|
||||
@@ -213,6 +217,112 @@ const isEqual = (obj1: any, obj2: any) => {
|
||||
|
||||
return true
|
||||
}
|
||||
const unit = [
|
||||
{
|
||||
label: '频率',
|
||||
unit: 'Hz'
|
||||
},
|
||||
{
|
||||
label: '相电压有效值',
|
||||
unit: 'V'
|
||||
},
|
||||
{
|
||||
label: '电压偏差',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '电压相角',
|
||||
unit: '°'
|
||||
},
|
||||
{
|
||||
label: '基波电压有效值',
|
||||
unit: ''
|
||||
},
|
||||
{
|
||||
label: '电流有效值',
|
||||
unit: 'A'
|
||||
},
|
||||
{
|
||||
label: '电流相角',
|
||||
unit: '°'
|
||||
},
|
||||
{
|
||||
label: '基波电流有效值',
|
||||
unit: ''
|
||||
},
|
||||
{
|
||||
label: '谐波电压',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '谐波电流',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '谐波电流幅值',
|
||||
unit: 'A'
|
||||
},
|
||||
{
|
||||
label: '谐波有功功率',
|
||||
unit: 'W'
|
||||
},
|
||||
{
|
||||
label: '间谐波电压',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '间谐波电流',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '电压幅值',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '持续时间',
|
||||
unit: '周波'
|
||||
},
|
||||
{
|
||||
label: '三相电压不平衡度',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '三相电流不平衡度',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '闪变',
|
||||
unit: ''
|
||||
},
|
||||
|
||||
{
|
||||
label: '电流',
|
||||
unit: props.valueCode == 'Absolute' ? 'A' : '%'
|
||||
},
|
||||
|
||||
]
|
||||
// 参考设定值添加单位
|
||||
const setUnit = (row: any) => {
|
||||
console.log('🚀 ~ setUnit ~ row:', row)
|
||||
let text = ''
|
||||
if (row.pname == '暂态') {
|
||||
row.name == '电压幅值' ? (text = '%') : ''
|
||||
row.name == '持续时间' ? (text = '周波') : ''
|
||||
} else if (row.pname == '电压') {
|
||||
let o = props.valueCode == 'Absolute' ? 'V' : '%'
|
||||
row.name == '相电压有效值' ? (text = o) : ''
|
||||
row.name == '电压偏差' ? (text = '%') : ''
|
||||
row.name == '电压相角' ? (text = '°') : ''
|
||||
}else if (row.pname == '电流') {
|
||||
let o = props.valueCode == 'Absolute' ? 'A' : '%'
|
||||
row.name == '电流有效值' ? (text = o) : ''
|
||||
row.name == '电流相角' ? (text = '°') : ''
|
||||
} else {
|
||||
text = unit.filter(item => item.label == row.pname)[0]?.unit
|
||||
}
|
||||
|
||||
return text || ''
|
||||
}
|
||||
const save = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
@@ -224,6 +334,7 @@ const getTableData = () => {
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
|
||||
// 对外映射
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
:show-header="false"
|
||||
:span-method="arraySpanMethod"
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="{ textAlign: 'center', backgroundColor: '#003078', color: '#fff' }"
|
||||
:header-cell-style="{ textAlign: 'center', backgroundColor: 'var(--el-color-primary)', color: '#fff' }"
|
||||
@cell-click="handleRowClick"
|
||||
:key="key"
|
||||
>
|
||||
@@ -154,6 +154,7 @@
|
||||
:formContent="props.formContent"
|
||||
:form="form"
|
||||
:key="initial"
|
||||
:valueCode=valueCode
|
||||
@recalculation="recalculation"
|
||||
/>
|
||||
</el-carousel-item>
|
||||
|
||||
@@ -6,11 +6,15 @@
|
||||
<el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider>
|
||||
</div>
|
||||
<div class="data-check-content">
|
||||
<div class="content-tree">
|
||||
<div class="content-tree" :style="{ height: `calc(100vh - ${props.shrink ? '370px' : '315px'})` }">
|
||||
<Tree :treeData="treeData" @setTab="setTab" />
|
||||
</div>
|
||||
|
||||
<div class="content-right-Tabs" style="height: calc(100vh - 315px); width: 100px">
|
||||
<div
|
||||
class="content-right-Tabs"
|
||||
style="width: 100px"
|
||||
:style="{ height: `calc(100vh - ${props.shrink ? '370px' : '315px'})` }"
|
||||
>
|
||||
<el-tabs type="border-card" style="height: 100%" v-model="activeName" @tab-change="tabChange">
|
||||
<el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
|
||||
<div v-if="activeName == tab.value">
|
||||
@@ -26,6 +30,7 @@
|
||||
:formContent="props.formContent"
|
||||
:options="props.options"
|
||||
style="width: 360px"
|
||||
:shrink="props.shrink"
|
||||
:disabled="tab.children.length == 0 ? false : true"
|
||||
ref="communRef"
|
||||
/>
|
||||
@@ -49,13 +54,13 @@
|
||||
:data="tableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#003078',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
highlight-current-row
|
||||
height="calc(100vh - 480px)"
|
||||
:height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column type="index" label="组次" width="60" />
|
||||
@@ -97,7 +102,7 @@
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num + 1].famp +
|
||||
(valueCode == 'Absolute' ? 'V' : '%')
|
||||
(valueCode == 'Absolute' ? 'A' : '%')
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
@@ -188,12 +193,13 @@
|
||||
v-if="showDialog"
|
||||
/>
|
||||
<!-- 查看 -->
|
||||
<ViewRow ref="viewRowRef"
|
||||
:activeName="activeName"
|
||||
:formContent="props.formContent"
|
||||
@close="viewDialog = false"
|
||||
v-if="viewDialog"
|
||||
/>
|
||||
<ViewRow
|
||||
ref="viewRowRef"
|
||||
:activeName="activeName"
|
||||
:formContent="props.formContent"
|
||||
@close="viewDialog = false"
|
||||
v-if="viewDialog"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -201,7 +207,7 @@
|
||||
import { type PropType, ref, nextTick } from 'vue'
|
||||
import Tree from './tree.vue'
|
||||
import Commun from './communication.vue'
|
||||
import {type CascaderOption, ElMessageBox} from 'element-plus'
|
||||
import { type CascaderOption, ElMessageBox } from 'element-plus'
|
||||
import { getTreeData } from '@/api/check/test'
|
||||
import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue'
|
||||
import type { TestScript } from '@/api/device/interface/testScript'
|
||||
@@ -230,6 +236,9 @@ const props = defineProps({
|
||||
formContent: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
shrink: {
|
||||
type: Boolean
|
||||
}
|
||||
})
|
||||
const showDialog = ref(false)
|
||||
@@ -265,7 +274,7 @@ const getTree = () => {
|
||||
}).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
treeData.value = res.data
|
||||
console.log('tree',treeData.value)
|
||||
console.log('tree', treeData.value)
|
||||
// 添加tab子项
|
||||
props.options.forEach((k: any, i: number) => {
|
||||
tabData.value[i].children = []
|
||||
@@ -308,7 +317,7 @@ const setTab = row => {
|
||||
const copyActiveName = ref('')
|
||||
// 获取通讯脚本点击
|
||||
const getCommunication = () => {
|
||||
console.log('123123',communRef.value[0]?.getData())
|
||||
console.log('123123', communRef.value[0]?.getData())
|
||||
communicationList.value = communRef.value[0]?.getData()
|
||||
}
|
||||
// 切换大tab控制小tab
|
||||
@@ -347,8 +356,6 @@ const inquireTable = () => {
|
||||
tableData.value = res.data
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
// 打开 drawer(新增、编辑)
|
||||
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) => {
|
||||
ElMessageBox.confirm('是否复制当前检测项目?', '提示', {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: 'warning',
|
||||
draggable: true
|
||||
}).then(async () => {
|
||||
let checkDataList: any = []
|
||||
await communRef.value[0]?.getData().forEach((item: any) => {
|
||||
item.children.forEach((k: any) => {
|
||||
if (k.enable != 0 || k.errorFlag != 0) {
|
||||
checkDataList.push({
|
||||
pid: k.pid,
|
||||
valueType: k.id,
|
||||
dataType: k.dataType,
|
||||
enable: k.enable,
|
||||
errorFlag: k.errorFlag
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
let { data } = await scriptDtlsCheckDataList({ checkDataList: checkDataList, ...row, retryCompute: true })
|
||||
let copyRow = JSON.parse(JSON.stringify(row))
|
||||
delete copyRow.index
|
||||
|
||||
await addScriptDtls({ ...copyRow, scriptType: activeName.value, checkDataList: data }).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
ElMessage.success({
|
||||
message: '复制成功!',
|
||||
type: 'success'
|
||||
ElMessageBox.confirm('是否复制当前检测项目?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
draggable: true
|
||||
}).then(async () => {
|
||||
let checkDataList: any = []
|
||||
await communRef.value[0]?.getData().forEach((item: any) => {
|
||||
item.children.forEach((k: any) => {
|
||||
if (k.enable != 0 || k.errorFlag != 0) {
|
||||
checkDataList.push({
|
||||
pid: k.pid,
|
||||
valueType: k.id,
|
||||
dataType: k.dataType,
|
||||
enable: k.enable,
|
||||
errorFlag: k.errorFlag
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
let { data } = await scriptDtlsCheckDataList({ checkDataList: checkDataList, ...row, retryCompute: true })
|
||||
let copyRow = JSON.parse(JSON.stringify(row))
|
||||
delete copyRow.index
|
||||
|
||||
await addScriptDtls({ ...copyRow, scriptType: activeName.value, checkDataList: data }).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
ElMessage.success({
|
||||
message: '复制成功!',
|
||||
type: 'success'
|
||||
})
|
||||
getTree()
|
||||
}
|
||||
})
|
||||
getTree()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// 查看
|
||||
const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||
|
||||
getCommunication()
|
||||
console.log('communicationList',communicationList.value)
|
||||
console.log('communicationList', communicationList.value)
|
||||
//当前点击的一级tab
|
||||
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称';
|
||||
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'
|
||||
//当前点击的二级tab
|
||||
const childrenTabName = ref('')
|
||||
tabData.value.forEach((item: any) => {
|
||||
@@ -416,12 +422,11 @@ const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||
setTimeout(() => {
|
||||
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
|
||||
}, 0)
|
||||
|
||||
}
|
||||
// 删除
|
||||
const deleteRow = async (row: any) => {
|
||||
await useHandleData(deleteDtls, { enable: row.enable, index: row.index, scriptId: row.scriptId }, `删除`)
|
||||
getTree()
|
||||
await useHandleData(deleteDtls, { enable: row.enable, index: row.index, scriptId: row.scriptId }, `删除`)
|
||||
getTree()
|
||||
}
|
||||
// 启用
|
||||
const enableRow = async (row: any) => {
|
||||
@@ -453,7 +458,7 @@ const addTab = (row: any) => {
|
||||
const saveTheNewsletter = () => {}
|
||||
onMounted(() => {
|
||||
getTree()
|
||||
console.log('testScriptDetail',props.options)
|
||||
console.log('testScriptDetail', props.options)
|
||||
props.options.forEach((item: any) => {
|
||||
tabData.value.push({
|
||||
label: item.label.replace(/准确度|检测/g, ''),
|
||||
@@ -466,7 +471,6 @@ onMounted(() => {
|
||||
valueCode.value = dictStore
|
||||
.getDictData('Script_Value_Type')
|
||||
.filter(item => item.id == props.formContent.valueType)[0].code
|
||||
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@@ -477,16 +481,14 @@ onMounted(() => {
|
||||
|
||||
.content-tree {
|
||||
width: 260px;
|
||||
height: calc(100vh - 315px);
|
||||
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
// margin-right: 10px;
|
||||
overflow: auto; /* 同时启用垂直和水平滚动 */
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.scriptTree {
|
||||
height: calc(100vh - 520px);
|
||||
}
|
||||
|
||||
|
||||
/* 确保 el-tree 内容可以超出容器宽度 */
|
||||
.el-tree {
|
||||
@@ -526,7 +528,7 @@ onMounted(() => {
|
||||
width: 45%;
|
||||
}
|
||||
.theFirst {
|
||||
background-color: #003078;
|
||||
background-color: var(--el-color-primary);
|
||||
color: #fff;
|
||||
width: 20px !important;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
:disabled="!form[0].dipFlag"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="120px" label="持续时间(s)">
|
||||
<el-form-item label-width="120px" label="持续时间(周波)">
|
||||
<el-input
|
||||
type="number"
|
||||
v-model="form[0].dipData.retainTime"
|
||||
@@ -86,7 +86,7 @@ canvas {
|
||||
position: relative;
|
||||
img {
|
||||
width: 90%;
|
||||
height: 150px;
|
||||
height: 140px;
|
||||
margin: 0 10px 20px;
|
||||
}
|
||||
.inputTop {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card style="margin-bottom: 10px" class="cardTop">
|
||||
<el-card style="margin-bottom: 10px" class="cardTop" :style="{ height: height }">
|
||||
<el-form
|
||||
:model="formContent"
|
||||
:inline="true"
|
||||
@@ -13,23 +13,41 @@
|
||||
<el-input v-model.trim="formContent.name" placeholder="请输入脚本名称" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="参照标准名称" prop="standardName">
|
||||
<el-input v-model.trim="formContent.standardName" placeholder="请输入参照标准名称" clearable />
|
||||
<!-- <el-input v-model.trim="formContent.standardName" placeholder="请输入参照标准名称" clearable />-->
|
||||
<el-select v-model="formContent.standardName" filterable placeholder="请选择参照标准名称" @change="setStandardTimeList">
|
||||
<el-option v-for="item in standardNameList" :key="item.label" :label="item.label" :value="item.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="标准推行年份" prop="standardTime">
|
||||
<el-date-picker
|
||||
v-model="formContent.standardTime"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
format="YYYY"
|
||||
value-format="YYYY"
|
||||
placeholder="请选择标准推行年份"
|
||||
/>
|
||||
<!-- <el-date-picker-->
|
||||
<!-- v-model="formContent.standardTime"-->
|
||||
<!-- style="width: 100%"-->
|
||||
<!-- type="year"-->
|
||||
<!-- format="YYYY"-->
|
||||
<!-- value-format="YYYY"-->
|
||||
<!-- placeholder="请选择标准推行年份"-->
|
||||
<!-- />-->
|
||||
<el-select v-model="formContent.standardTime" filterable placeholder="请选择标准推行年份">
|
||||
<el-option v-for="item in standardTimeList" :key="item" :value="item" :label="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="模版类型" prop="type">
|
||||
<el-select v-model="formContent.type" filterable clearable placeholder="请选择模版类型">
|
||||
<el-option v-for="item in stencil" :key="item.value" :label="item.name" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<div class="formBut">
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="shrink ? ArrowUpBold : ArrowDownBold"
|
||||
@click="shrinkChange"
|
||||
></el-button>
|
||||
<el-button type="primary" :icon="Select" @click="save">保存</el-button>
|
||||
<el-button :icon="Close" @click="close">返回</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测脚本值类型" prop="valueType">
|
||||
<el-select
|
||||
v-model="formContent.valueType"
|
||||
@@ -46,16 +64,30 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="formBut">
|
||||
<el-button type="primary" :icon="Select" @click="save">保存</el-button>
|
||||
<el-button :icon="Close" @click="close">返回</el-button>
|
||||
</div>
|
||||
<el-form-item label="额定电流" prop="ratedCurr">
|
||||
<el-input-number
|
||||
v-model.trim="formContent.ratedCurr"
|
||||
min="0"
|
||||
max="20"
|
||||
style="width: 100%"
|
||||
placeholder="请输入额定电流"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="额定电压" prop="ratedVolt">
|
||||
<el-input-number
|
||||
v-model.trim="formContent.ratedVolt"
|
||||
min="0"
|
||||
max="380"
|
||||
style="width: 100%"
|
||||
placeholder="请输入额定电压"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card v-if="show">
|
||||
<TestScriptDetail :options="secondLevelOptions" :formContent="formContent" />
|
||||
<TestScriptDetail :options="secondLevelOptions" :formContent="formContent" :shrink="shrink" />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -67,12 +99,15 @@ import { type TestScript } from '@/api/device/interface/testScript'
|
||||
import type { Dict } from '@/api/system/dictionary/interface'
|
||||
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||
import type { CascaderOption } from 'element-plus'
|
||||
import { Select, Close } from '@element-plus/icons-vue'
|
||||
import { Select, Close, ArrowDownBold, ArrowUpBold } from '@element-plus/icons-vue'
|
||||
import { pqScriptAdd, pqScriptUpdate } from '@/api/device/testScript'
|
||||
import { useRouter } from 'vue-router'
|
||||
const modeId = ref()
|
||||
const show = ref(false)
|
||||
const height = ref('125px')
|
||||
const router = useRouter()
|
||||
const standardNameList = reactive<{id:string,label: string, value: string}[]>([])
|
||||
const standardTimeList = reactive<Array<string>>([])
|
||||
|
||||
const secondLevelOptions: any[] = []
|
||||
// 定义弹出组件元信息
|
||||
@@ -87,10 +122,13 @@ function useMetaInfo() {
|
||||
pattern: modeId.value,
|
||||
standardName: '',
|
||||
standardTime: '',
|
||||
state: 1
|
||||
state: 1,
|
||||
ratedCurr: 0,
|
||||
ratedVolt: 0
|
||||
})
|
||||
return { titleType, formContent }
|
||||
}
|
||||
const shrink = ref(true)
|
||||
const stencil = [
|
||||
{ name: '脚本', value: 0 },
|
||||
{ name: '模版', value: 1 }
|
||||
@@ -100,11 +138,17 @@ const rules = {
|
||||
standardName: [{ required: true, message: '请输入参照标准名称', trigger: 'blur' }],
|
||||
standardTime: [{ required: true, message: '请选择标准推行年份', trigger: 'change' }],
|
||||
type: [{ required: true, message: '请选择模版类型', trigger: 'change' }],
|
||||
valueType: [{ required: true, message: '请选择检测脚本值类型', trigger: 'change' }]
|
||||
valueType: [{ required: true, message: '请选择检测脚本值类型', trigger: 'change' }],
|
||||
ratedCurr: [{ required: true, message: '请填写额定电流', trigger: 'change' }],
|
||||
ratedVolt: [{ required: true, message: '请填写额定电压', trigger: 'change' }]
|
||||
}
|
||||
|
||||
const { titleType, formContent } = useMetaInfo()
|
||||
|
||||
// 收缩
|
||||
const shrinkChange = () => {
|
||||
shrink.value = !shrink.value
|
||||
shrink.value ? (height.value = '125px') : (height.value = '70px')
|
||||
}
|
||||
// 清空formContent
|
||||
const resetFormContent = () => {
|
||||
formContent.value = {
|
||||
@@ -114,13 +158,14 @@ const resetFormContent = () => {
|
||||
pattern: '',
|
||||
standardName: '',
|
||||
standardTime: '',
|
||||
state: 1
|
||||
state: 1,
|
||||
ratedCurr: 0,
|
||||
ratedVolt: 0
|
||||
}
|
||||
router.go(-1)
|
||||
}
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
|
||||
// 清空dialogForm中的值
|
||||
resetFormContent()
|
||||
// 重置表单
|
||||
@@ -129,6 +174,15 @@ const close = () => {
|
||||
// 关闭信息弹框
|
||||
const closeInformation = () => {}
|
||||
|
||||
const setStandardTimeList = ()=>{
|
||||
let checkStandard = standardNameList.find(item => item.label === formContent.value.standardName)
|
||||
if (checkStandard) {
|
||||
standardTimeList.push(...checkStandard.value.split(','))
|
||||
} else {
|
||||
standardTimeList.push('2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024', '2025')
|
||||
}
|
||||
}
|
||||
|
||||
// 保存数据
|
||||
const save = () => {
|
||||
// dialogFormRef
|
||||
@@ -151,19 +205,26 @@ const save = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
shrink.value = true
|
||||
height.value = '125px'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = async (title: string, row: any) => {
|
||||
dictStore.getDictData("Script_Standard_Name").forEach(item => {
|
||||
standardNameList.push({id: item.id, label: item.name, value: item.value})
|
||||
})
|
||||
|
||||
titleType.value = title
|
||||
if (title == '新增检测脚本') {
|
||||
show.value = false
|
||||
} else {
|
||||
let list = JSON.parse(row)
|
||||
formContent.value = list
|
||||
console.log('🚀 ~ open ~ list:', formContent.value )
|
||||
console.log('🚀 ~ open ~ list:', formContent.value)
|
||||
show.value = true
|
||||
}
|
||||
// 重置表单
|
||||
@@ -239,7 +300,7 @@ defineExpose({ open })
|
||||
// justify-content: space-between;
|
||||
.el-form-item {
|
||||
display: flex;
|
||||
width: 15.8%;
|
||||
width: 18.8%;
|
||||
|
||||
.el-form-item__content {
|
||||
flex: 1;
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
size="small"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#003078',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
@@ -111,7 +111,7 @@
|
||||
size="small"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#003078',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
@@ -134,7 +134,7 @@
|
||||
size="small"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#003078',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
@@ -155,7 +155,7 @@
|
||||
size="small"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#003078',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
@@ -178,7 +178,7 @@
|
||||
:data="setValue_TableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#003078',
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
|
||||
@@ -127,6 +127,16 @@ const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
||||
search: showValueSearch.value ? { el: 'select' } : undefined,
|
||||
minWidth: 150
|
||||
},
|
||||
{
|
||||
prop: 'ratedCurr',
|
||||
label: '额定电流',
|
||||
minWidth: 100
|
||||
},
|
||||
{
|
||||
prop: 'ratedVolt',
|
||||
label: '额定电压',
|
||||
minWidth: 100
|
||||
},
|
||||
{
|
||||
prop: 'type',
|
||||
label: '模板类型',
|
||||
@@ -135,6 +145,7 @@ const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
||||
return <el-tag type={scope.row.type ? 'success' : 'primary'}> {scope.row.type ? '模版' : '脚本'} </el-tag>
|
||||
}
|
||||
},
|
||||
|
||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 }
|
||||
])
|
||||
|
||||
@@ -143,7 +154,6 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
|
||||
if (modeStore.currentMode == '比对式') {
|
||||
comparisonPopup.value?.open(titleType, row, modeStore.currentMode)
|
||||
} else {
|
||||
|
||||
if (titleType == 'add') {
|
||||
router.push({
|
||||
path: '/machine/testScriptAdd',
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
class="custom-tree-node"
|
||||
style="display: flex; align-items: center"
|
||||
>
|
||||
<CircleCheck v-if="data.isChildNode && data.scriptIdx < currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#67C23A;"/>
|
||||
<CircleCheck v-if="data.isChildNode && data.scriptIdx < currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#91cc75;"/>
|
||||
|
||||
<svg-icon v-if="data.isChildNode && data.scriptIdx === currentIndex" name="loading" spin ></svg-icon>
|
||||
<span>{{ node.label }}</span>
|
||||
|
||||
@@ -54,6 +54,23 @@
|
||||
<el-radio :value="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联报告模版" :label-width="100" prop='associateReport'>
|
||||
<el-radio-group v-model="formContent.associateReport">
|
||||
<el-radio :value="1">是</el-radio>
|
||||
<el-radio :value="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="模版名称" prop="reportTemplateName" :label-width="100" v-if="formContent.associateReport === 1">
|
||||
<el-select v-model="formContent.reportTemplateName" placeholder="请选择报告模版" autocomplete="off" >
|
||||
<el-option
|
||||
v-for="(option, index) in pqReportName"
|
||||
:key="index"
|
||||
:label="option.name"
|
||||
:value="option.name"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -93,11 +110,7 @@
|
||||
import { type TestScript } from '@/api/device/interface/testScript';
|
||||
import { type ErrorSystem } from '@/api/device/interface/error';
|
||||
import { type Device } from '@/api/device/interface/device';
|
||||
import { Loading } from '@element-plus/icons-vue/dist/types';
|
||||
import { truncate } from 'lodash';
|
||||
|
||||
|
||||
|
||||
import {getPqReportAllName,getPqReportAllVersion} from '@/api/device/report/index.ts'
|
||||
const dictStore = useDictStore()
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
@@ -108,6 +121,9 @@ import { truncate } from 'lodash';
|
||||
const pqErrSysList=ref<ErrorSystem.ErrorSystemList[]>([])//获取指定模式下所有检测源
|
||||
const pqDevList=ref<Device.ResPqDev[]>([])//获取指定模式下所有检测源
|
||||
|
||||
const pqReportName = ref<{ name: string }[]>([])
|
||||
|
||||
|
||||
const pqSourceArray = ref<{ label: string; value: string; }[]>()
|
||||
const pqScriptArray = ref<{ label: string; value: string; }[]>()
|
||||
const pqErrorArray = ref<{ label: string; value: string; }[]>()
|
||||
@@ -164,6 +180,9 @@ const filterMethod = (query: string, item: { label?: string }) => {
|
||||
devIds:[],
|
||||
sourceIds:'',
|
||||
datasourceIds:'',
|
||||
associateReport:0,
|
||||
reportTemplateName:'',
|
||||
reportTemplateVersion:'',
|
||||
})
|
||||
return { dialogVisible, titleType, formContent }
|
||||
}
|
||||
@@ -194,6 +213,9 @@ const filterMethod = (query: string, item: { label?: string }) => {
|
||||
devIds:[],
|
||||
sourceIds:'',
|
||||
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' }],
|
||||
sourceIds: [{ required: true, message: '检测源必选!', trigger: 'blur' }],
|
||||
datasourceIds: [{ required: true, message: '数据源必选!', trigger: 'blur' }],
|
||||
scriptId: [{ required: true, message: '检测脚本必选!', trigger: 'blur' }],
|
||||
errorSysId: [{ required: true, message: '误差体系必选!', trigger: 'blur' }],
|
||||
|
||||
|
||||
// 定义表单校验规则
|
||||
const baseRules: Record<string, Array<FormItemRule>> = {
|
||||
name: [{ required: true, message: '检测计划名称必填!', trigger: 'blur' }],
|
||||
sourceIds: [{ required: true, message: '检测源必选!', trigger: 'change' }],
|
||||
datasourceIds: [{ required: true, message: '数据源必选!', trigger: 'change' }],
|
||||
scriptId: [{ required: true, message: '检测脚本必选!', trigger: 'change' }],
|
||||
errorSysId: [{ required: true, message: '误差体系必选!', trigger: 'change' }],
|
||||
};
|
||||
|
||||
// 使用计算属性根据 scene 动态生成规则
|
||||
const rules = computed(() => {
|
||||
const dynamicRules = { ...baseRules };
|
||||
|
||||
if (formContent.associateReport === 1){//只有关联报告模版时需要展示
|
||||
dynamicRules.reportTemplateName= [{ required: true, message: '报告模版名称必选!', trigger: 'change' }];
|
||||
//dynamicRules.reportTemplateVersion= [{ required: true, message: '报告模版版本号必选!', trigger: 'change' }];
|
||||
}
|
||||
|
||||
return dynamicRules;
|
||||
});
|
||||
|
||||
// 关闭弹窗
|
||||
@@ -248,6 +283,7 @@ const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
if( mode.value === '比对式'){
|
||||
await updatePlan(formContent)
|
||||
}else{
|
||||
|
||||
await updatePlan({...formContent,'sourceIds':[formContent.sourceIds],'datasourceIds':[formContent.datasourceIds]});
|
||||
}
|
||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||
@@ -305,14 +341,23 @@ const open = async (sign: string,
|
||||
|
||||
if(sign == 'add')
|
||||
{
|
||||
console.log('add',data)
|
||||
const [pqSource_Result, PqScript_Result, PqErrSys_Result,pqDevList_Result] = await Promise.all([
|
||||
const [pqSource_Result, PqScript_Result, PqErrSys_Result,pqDevList_Result,pqReportName_Result] = await Promise.all([
|
||||
getTestSourceList(data),
|
||||
getPqScriptList(data),
|
||||
getPqErrSysList(),
|
||||
getUnboundPqDevList(data)
|
||||
getUnboundPqDevList(data),
|
||||
getPqReportAllName(),
|
||||
|
||||
]);
|
||||
|
||||
|
||||
|
||||
if (Array.isArray(pqReportName_Result.data)) {
|
||||
pqReportName.value = pqReportName_Result.data.map(item => ({ name: item }));
|
||||
} else {
|
||||
pqReportName.value = [];
|
||||
console.error('pqReportName_Result.data is not an array:', pqReportName_Result.data);
|
||||
}
|
||||
pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[];
|
||||
pqScriptList.value = PqScript_Result.data as TestScript.ResTestScript[];
|
||||
pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[];
|
||||
@@ -321,14 +366,23 @@ const open = async (sign: string,
|
||||
unboundPqDevList.value = pqDevList.value
|
||||
boundPqDevList.value = [];
|
||||
}else{//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
|
||||
const [pqSource_Result, PqScript_Result, PqErrSys_Result,boundPqDevList_Result, unboundPqDevList_Result] = await Promise.all([
|
||||
|
||||
const [pqSource_Result, PqScript_Result, PqErrSys_Result,boundPqDevList_Result, unboundPqDevList_Result,pqReportName_Result] = await Promise.all([
|
||||
getTestSourceList(data),
|
||||
getPqScriptList(data),
|
||||
getPqErrSysList(),
|
||||
getBoundPqDevList({ 'planId': data.id }),
|
||||
getUnboundPqDevList(data)
|
||||
getUnboundPqDevList(data),
|
||||
getPqReportAllName(),
|
||||
]);
|
||||
|
||||
if (Array.isArray(pqReportName_Result.data)) {
|
||||
pqReportName.value = pqReportName_Result.data.map(item => ({ name: item }));
|
||||
} else {
|
||||
pqReportName.value = [];
|
||||
console.error('pqReportName_Result.data is not an array:', pqReportName_Result.data);
|
||||
}
|
||||
|
||||
pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[];
|
||||
pqScriptList.value = PqScript_Result.data as TestScript.ResTestScript[];
|
||||
pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[];
|
||||
@@ -337,7 +391,7 @@ const open = async (sign: string,
|
||||
|
||||
pqDevList.value = [...boundData,...unboundData] as Device.ResPqDev[];
|
||||
formContent.devIds = boundData.map(i => i.id );// 已绑定设备id集合
|
||||
|
||||
|
||||
Object.assign(formContent,{ ...data })
|
||||
//设备绑定显示
|
||||
unboundPqDevList.value = unboundPqDevList_Result.data as Device.ResPqDev[];
|
||||
@@ -392,16 +446,16 @@ function pqToArray() {
|
||||
}
|
||||
|
||||
const dataSourceType = computed(() => {
|
||||
switch (mode.value) {
|
||||
case '模拟式':
|
||||
return 'Datasource_Simulate'
|
||||
case '数字式':
|
||||
return 'Datasource_Digital'
|
||||
default:
|
||||
return 'Datasource_Contrast'
|
||||
}
|
||||
})
|
||||
|
||||
// switch (mode.value) {
|
||||
// case '模拟式':
|
||||
// return 'Datasource_Simulate'
|
||||
// case '数字式':
|
||||
// return 'Datasource_Digital'
|
||||
// default:
|
||||
// return 'Datasource_Contrast'
|
||||
// }
|
||||
return 'Datasource'
|
||||
})
|
||||
|
||||
|
||||
// 对外映射
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||
import { ScaleToOriginal, CirclePlus, Delete, EditPen, View, Upload, Download, List, Tools } from '@element-plus/icons-vue'
|
||||
import {getPlanList,deletePlan,exportCNPlan,downloadCNPlanTemplate,importCNPlan } from '@/api/plan/plan.ts'
|
||||
import {getPlanList,deletePlan,exportPlan,downloadTemplate,importPlan } from '@/api/plan/plan.ts'
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import type { Plan } from '@/api/plan/interface'
|
||||
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
||||
@@ -106,14 +106,15 @@ const getTableList = async(params: any) => {
|
||||
|
||||
|
||||
const dataSourceType = computed(() => {
|
||||
switch (modeStore.currentMode) {
|
||||
case '模拟式':
|
||||
return 'Datasource_Simulate'
|
||||
case '数字式':
|
||||
return 'Datasource_Digital'
|
||||
default:
|
||||
return 'Datasource_Contrast'
|
||||
}
|
||||
// switch (modeStore.currentMode) {
|
||||
// case '模拟式':
|
||||
// return 'Datasource_Simulate'
|
||||
// case '数字式':
|
||||
// return 'Datasource_Digital'
|
||||
// default:
|
||||
// return 'Datasource_Contrast'
|
||||
// }
|
||||
return 'Datasource'
|
||||
})
|
||||
|
||||
|
||||
@@ -219,19 +220,17 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||
width: 360,
|
||||
render: scope => {
|
||||
return (
|
||||
<el-link type='primary' link onClick={() => showTestScript(scope.row.scriptId)}>
|
||||
{scope.row.scriptName}
|
||||
</el-link>
|
||||
<span>{scope.row.scriptName}</span>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'errorSysId',
|
||||
label: '误差体系',
|
||||
width: 200,
|
||||
width: 240,
|
||||
render: scope => {
|
||||
return (
|
||||
<el-link type='primary' link onClick={() => showData(scope.row.errorSysName || '')}>
|
||||
<el-link type='primary' link onClick={() => showData(scope.row)}>
|
||||
{scope.row.errorSysName}
|
||||
</el-link>
|
||||
)
|
||||
@@ -282,8 +281,9 @@ function isVisible(row: Plan.ReqPlan) {
|
||||
}
|
||||
|
||||
|
||||
function showData(row: string) {
|
||||
errorStandardPopup.value?.open(row, row)
|
||||
function showData(row: any) {
|
||||
let split = row.errorSysName.split('-')
|
||||
errorStandardPopup.value?.open(row.errorSysName, {id:row.errorSysId,devLevel:split[split.length-1]})
|
||||
}
|
||||
|
||||
async function showTestSource(row:string) {
|
||||
@@ -345,8 +345,8 @@ const importClick = () => {
|
||||
title: '检测计划',
|
||||
showCover: false,
|
||||
patternId: dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? '',
|
||||
tempApi: downloadCNPlanTemplate,
|
||||
importApi: importCNPlan,
|
||||
tempApi: downloadTemplate,
|
||||
importApi: importPlan,
|
||||
getTableList: proTable.value?.getTableList,
|
||||
}
|
||||
planImportExcel.value?.acceptParams(params)
|
||||
@@ -356,7 +356,7 @@ const exportClick = () => {
|
||||
|
||||
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', { type: 'warning' }).then(() =>{
|
||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||
useDownload(exportCNPlan,'检测计划导出数据', {...proTable.value?.searchParam,pattern:patternId}, false,'.xlsx')
|
||||
useDownload(exportPlan,'检测计划导出数据', {...proTable.value?.searchParam,pattern:patternId}, false,'.xlsx')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
285
frontend/src/views/system/template/components/reportPopup.vue
Normal file
285
frontend/src/views/system/template/components/reportPopup.vue
Normal 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>
|
||||
132
frontend/src/views/system/template/index.vue
Normal file
132
frontend/src/views/system/template/index.vue
Normal 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>
|
||||
|
||||
@@ -10,6 +10,7 @@ import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||
import AutoImport from "unplugin-auto-import/vite";
|
||||
import Components from "unplugin-vue-components/vite";
|
||||
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
||||
import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
||||
|
||||
export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
||||
const root = process.cwd();
|
||||
@@ -59,6 +60,12 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
||||
dts: false,
|
||||
// dts: "src/types/components.d.ts",
|
||||
}),
|
||||
nodePolyfills({
|
||||
include: ['crypto'],
|
||||
globals: {
|
||||
crypto: true,
|
||||
},
|
||||
}),
|
||||
],
|
||||
// 基础配置
|
||||
base: viteEnv.VITE_PUBLIC_PATH,
|
||||
|
||||
Reference in New Issue
Block a user