标准设备,比对模式被检设备
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@element-plus/icons-vue": "^2.3.1",
|
||||||
|
"@vue-flow/core": "^1.45.0",
|
||||||
"@vueuse/core": "^10.4.1",
|
"@vueuse/core": "^10.4.1",
|
||||||
"axios": "^1.7.3",
|
"axios": "^1.7.3",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
@@ -72,7 +73,7 @@
|
|||||||
"unplugin-auto-import": "^0.18.3",
|
"unplugin-auto-import": "^0.18.3",
|
||||||
"unplugin-vue-components": "^0.27.4",
|
"unplugin-vue-components": "^0.27.4",
|
||||||
"unplugin-vue-setup-extend-plus": "^1.0.0",
|
"unplugin-vue-setup-extend-plus": "^1.0.0",
|
||||||
"vite": "^5.3.1",
|
"vite": "^5.4.19",
|
||||||
"vite-plugin-compression": "^0.5.1",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-eslint": "^1.8.1",
|
"vite-plugin-eslint": "^1.8.1",
|
||||||
"vite-plugin-html": "^3.2.0",
|
"vite-plugin-html": "^3.2.0",
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { pa } from 'element-plus/es/locale/index.mjs';
|
||||||
import type {Device} from '@/api/device/interface/device'
|
import type {Device} from '@/api/device/interface/device'
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
|
|
||||||
@@ -30,8 +31,8 @@ export const exportPqDev = (params: Device.ReqPqDevParams) => {
|
|||||||
return http.download(`/pqDev/export`, params)
|
return http.download(`/pqDev/export`, params)
|
||||||
}
|
}
|
||||||
// 下载导入文件模板
|
// 下载导入文件模板
|
||||||
export const downloadTemplate = () => {
|
export const downloadTemplate = (params: { pattern: string }) => {
|
||||||
return http.download(`/pqDev/downloadTemplate`)
|
return http.download(`/pqDev/downloadTemplate`,params)
|
||||||
}
|
}
|
||||||
|
|
||||||
//导入被检设备
|
//导入被检设备
|
||||||
@@ -59,6 +60,9 @@ export const importContrastPqDev = (params: Device.ReqPqDevParams) => {
|
|||||||
// return http.uploadExcel(`/pqDev/importCNDev`, params)
|
// return http.uploadExcel(`/pqDev/importCNDev`, params)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
export const getPqDevById = (params: Device.ReqPqDevParams) => {
|
||||||
|
return http.get(`/pqDev/getById?id=${params.id}`)
|
||||||
|
}
|
||||||
|
|
||||||
//根据设备类型决定(电源、icd、模板、通道数、额定电压、额定电流);
|
//根据设备类型决定(电源、icd、模板、通道数、额定电压、额定电流);
|
||||||
export const getPqDev = () => {
|
export const getPqDev = () => {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
import { getPqDevById } from './../device/index';
|
||||||
import type {ReqPage, ResPage} from '@/api/interface'
|
import type {ReqPage, ResPage} from '@/api/interface'
|
||||||
|
import type { Monitor } from './monitor';
|
||||||
|
|
||||||
// 被检设备模块
|
// 被检设备模块
|
||||||
export namespace Device {
|
export namespace Device {
|
||||||
@@ -33,9 +35,6 @@ export namespace Device {
|
|||||||
name: string; //设备名称
|
name: string; //设备名称
|
||||||
pattern: string; //设备模式 模拟 数字 比对
|
pattern: string; //设备模式 模拟 数字 比对
|
||||||
devType: string;//设备类型
|
devType: string;//设备类型
|
||||||
devChns: number; //设备通道数
|
|
||||||
devVolt: number; //额定电压(V)
|
|
||||||
devCurr: number; //额定电流(A)
|
|
||||||
manufacturer?: string | null;//生产厂家
|
manufacturer?: string | null;//生产厂家
|
||||||
createDate: string; //生产日期
|
createDate: string; //生产日期
|
||||||
createId: string; //出厂编号
|
createId: string; //出厂编号
|
||||||
@@ -50,27 +49,46 @@ export namespace Device {
|
|||||||
sampleId?: string | null; //样品编号
|
sampleId?: string | null; //样品编号
|
||||||
arrivedDate?: string; //送样日期
|
arrivedDate?: string; //送样日期
|
||||||
cityName?: string | null; //所属地市名称
|
cityName?: string | null; //所属地市名称
|
||||||
gDName?: string | null; //所属供电公司名称
|
gdName?: string | null; //所属供电公司名称
|
||||||
subName?: string | null; //所属电站名称
|
subName?: string | null; //所属电站名称
|
||||||
checkState?: number | null; //检测状态
|
|
||||||
checkResult?: number | null; //检测结果
|
|
||||||
reportState?: number | null; //报告状态
|
|
||||||
reportPath?: string | null; //报告路径
|
reportPath?: string | null; //报告路径
|
||||||
qRCode?: string | null; //设备关键信息二维码
|
|
||||||
reCheckNum: number; //复检次数
|
|
||||||
planId?: string;//检测计划Id
|
planId?: string;//检测计划Id
|
||||||
timeCheckResult?: number;//守时检测结果(0:不符合1:符合)
|
|
||||||
factorFlag?: number;//是否支持系数校准(0:不支持,1:支持)
|
factorFlag?: number;//是否支持系数校准(0:不支持,1:支持)
|
||||||
factorCheckResult?: number;//系数校准结果(0:不合格,1:合格,2:/表示没有做系数校准)
|
preinvestmentPlan: string | null;//预投计划
|
||||||
|
delegate: string | null; //委托方
|
||||||
|
inspectChannel?: string[] | string;//被检通道
|
||||||
|
inspectDate?: string | null;//定检日期
|
||||||
|
harmSysId?: string | null;//谐波系统设备id
|
||||||
|
importFlag?: number;//是否为导入设备 0否 1是
|
||||||
state: number; //状态
|
state: number; //状态
|
||||||
createBy?: string | null; //创建用户
|
createBy?: string | null; //创建用户
|
||||||
createTime?: string | null; //创建时间
|
createTime?: string | null; //创建时间
|
||||||
updateBy?: string | null; //更新用户
|
updateBy?: string | null; //更新用户
|
||||||
updateTime?: string | null; //更新时间
|
updateTime?: string | null; //更新时间
|
||||||
|
|
||||||
|
devChns: number; //设备通道数
|
||||||
|
devVolt: number; //额定电压(V)
|
||||||
|
devCurr: number; //额定电流(A)
|
||||||
icdId: string | null;
|
icdId: string | null;
|
||||||
power: string | null;//工作电源
|
power: string | null;//工作电源
|
||||||
preinvestmentPlan: string | null;
|
|
||||||
delegate: string | null; //委托方
|
devId?: number;
|
||||||
|
checkState?: number | null; //检测状态(0:未检,1:检测中,2:检测完成 3:归档)
|
||||||
|
checkResult?: number | null; //检测结果(0:不符合,1:符合,2:未检)
|
||||||
|
reportState?: number | null; //报告状态(0:未生成,1:已生成,2:未检)
|
||||||
|
recheckNum: number; //复检次数
|
||||||
|
timeCheckResult?: number;//守时检测结果(0:不符合1:符合)
|
||||||
|
factorCheckResult?: number;//系数校准结果(0:不合格,1:合格,2:未检)
|
||||||
|
realtimeResult?: number;//实时数据结论(0:不符合,1:符合,2:未检)
|
||||||
|
statisticsResult?: number;//统计数据结论(0:不符合,1:符合,2:未检)
|
||||||
|
recordedResult?: number;//录波数据结论(0:不符合,1:符合,2:未检)
|
||||||
|
checkBy?: string | null;//检测人
|
||||||
|
checkTime?: string | null;//检测时间
|
||||||
|
preDetectTime?: number;//预检测耗时
|
||||||
|
coefficientTime?: number;//系数校准耗时
|
||||||
|
formalCheckTime?: number;//正式检测耗时
|
||||||
|
|
||||||
|
monitorList: Monitor.ResPqMon[] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +1,35 @@
|
|||||||
import type { ReqPage, ResPage } from '@/api/interface'
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
// 被检设备模块
|
// 监测点模块
|
||||||
export namespace Monitor {
|
export namespace Monitor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电能质量指标字典数据表格分页查询参数
|
* 监测点表格分页查询参数
|
||||||
*/
|
*/
|
||||||
export interface ReqPqMonParams extends ReqPage {
|
export interface ReqPqMonParams extends ReqPage {
|
||||||
id: string; // 装置序号id 必填
|
id: string; // 装置序号id 必填
|
||||||
devType?: string; // 设备名称
|
name?: string; // 设备名称
|
||||||
createTime?: string; //创建时间
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 被检设备新增、修改、根据id查询返回的对象
|
* 监测点新增、修改、根据id查询返回的对象
|
||||||
*/
|
*/
|
||||||
export interface ResPqMon {
|
export interface ResPqMon {
|
||||||
id: string; //监测点ID
|
id: string; //监测点ID
|
||||||
code: string; //默认与谐波系统监测点ID相同
|
|
||||||
devId: string; //所属设备ID
|
devId: string; //所属设备ID
|
||||||
name: string; //所属母线
|
busbar: string;//所属母线
|
||||||
num: number; //监测点序号
|
name: string; //监测点名称
|
||||||
pt: number; //PT变比
|
num: number; //线路号,监测点序号
|
||||||
ct: number; //CT变比
|
pt: string; //PT变比
|
||||||
ptType: string; //接线方式,字典表
|
ct: string; //CT变比
|
||||||
|
connection: string; //接线方式,字典表
|
||||||
|
statInterval: number; //统计间隔
|
||||||
|
harmSysId: string; //默认与谐波系统监测点ID相同
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 被检设备表格查询分页返回的对象;
|
* 监测点表格查询分页返回的对象;
|
||||||
*/
|
*/
|
||||||
export interface ResPqMonPage extends ResPage<ResPqMon> {
|
export interface ResPqMonPage extends ResPage<ResPqMon> {
|
||||||
|
|
||||||
|
|||||||
46
frontend/src/api/device/interface/standardDevice.ts
Normal file
46
frontend/src/api/device/interface/standardDevice.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import type {ReqPage, ResPage} from '@/api/interface'
|
||||||
|
|
||||||
|
// 标准设备模块
|
||||||
|
export namespace StandardDevice {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准设备表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqPqStandardDeviceParams extends ReqPage {
|
||||||
|
id: string; // 装置序号id 必填
|
||||||
|
name: string; //设备名称
|
||||||
|
devType?: string; // 设备名称
|
||||||
|
createTime?: string; //创建时间
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准设备新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResPqStandardDevice {
|
||||||
|
id: string; //装置序号ID
|
||||||
|
name: string; //设备名称
|
||||||
|
devType: string;//设备类型
|
||||||
|
manufacturer?: string | null;//生产厂家
|
||||||
|
protocol: string;//通讯协议
|
||||||
|
ip: string; //IP地址
|
||||||
|
port: number; //端口号
|
||||||
|
inspectChannel:string[] |string;//可检通道数
|
||||||
|
encryptionFlag: number; //装置是否为加密版本
|
||||||
|
series?: string | null; //装置识别码(3ds加密)
|
||||||
|
devKey?: string | null; //装置秘钥(3ds加密)
|
||||||
|
state: number; //状态
|
||||||
|
createBy?: string | null; //创建用户
|
||||||
|
createTime?: string | null; //创建时间
|
||||||
|
updateBy?: string | null; //更新用户
|
||||||
|
updateTime?: string | null; //更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准设备表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResPqStandardDevicePage extends ResPage<ResPqStandardDevice> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
46
frontend/src/api/device/standardDevice/index.ts
Normal file
46
frontend/src/api/device/standardDevice/index.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import type {StandardDevice} from '@/api/device/interface/standardDevice'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 标准设备管理模块
|
||||||
|
*/
|
||||||
|
|
||||||
|
//获取标准设备
|
||||||
|
export const getPqStandardDevList = (params: StandardDevice.ReqPqStandardDeviceParams) => {
|
||||||
|
return http.post(`/pqStandardDev/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据id查询标准设备
|
||||||
|
export const getPqStandardDevById = (params: StandardDevice.ReqPqStandardDeviceParams) => {
|
||||||
|
return http.get(`/pqStandardDev/getById?id=${params.id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加标准设备
|
||||||
|
export const addPqStandardDev = (params: StandardDevice.ResPqStandardDevice) => {
|
||||||
|
return http.post(`/pqStandardDev/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑标准设备
|
||||||
|
export const updatePqStandardDev = (params: StandardDevice.ResPqStandardDevice) => {
|
||||||
|
return http.post(`/pqStandardDev/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除标准设备
|
||||||
|
export const deletePqStandardDev = (params: string[]) => {
|
||||||
|
return http.post(`/pqStandardDev/delete`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//导出标准设备
|
||||||
|
export const exportPqStandardDev = (params: StandardDevice.ReqPqStandardDeviceParams) => {
|
||||||
|
return http.download(`/pqStandardDev/export`, params)
|
||||||
|
}
|
||||||
|
// 下载导入文件模板
|
||||||
|
export const downloadTemplate = () => {
|
||||||
|
return http.download(`/pqStandardDev/downloadTemplate`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//导入标准设备
|
||||||
|
export const importPqStandardDev = (params: StandardDevice.ReqPqStandardDeviceParams) => {
|
||||||
|
return http.uploadExcel(`/pqStandardDev/import`, params)
|
||||||
|
}
|
||||||
@@ -26,7 +26,10 @@ export namespace Plan {
|
|||||||
associateReport:number;//是否关联报告模板 0否 1是
|
associateReport:number;//是否关联报告模板 0否 1是
|
||||||
reportTemplateName:string;
|
reportTemplateName:string;
|
||||||
reportTemplateVersion:string;
|
reportTemplateVersion:string;
|
||||||
dataRule:string //数据处理原则
|
dataRule:string;//数据处理原则
|
||||||
|
|
||||||
|
progress?: number; // 进度百分比,例如 75
|
||||||
|
children?: ResPlan[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测计划 + 分页
|
// 检测计划 + 分页
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ const acceptParams = (params: ExcelParameterProps) => {
|
|||||||
// Excel 导入模板下载
|
// Excel 导入模板下载
|
||||||
const downloadTemp = () => {
|
const downloadTemp = () => {
|
||||||
if (!parameter.value.tempApi) return
|
if (!parameter.value.tempApi) return
|
||||||
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, {'patternId':parameter.value.patternId}, false)
|
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, {'pattern':parameter.value.patternId}, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文件上传
|
// 文件上传
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
active: item.value === appSceneStore.currentScene
|
active: item.value === appSceneStore.currentScene
|
||||||
}"
|
}"
|
||||||
@click="changeScene(item.value?? '')"
|
@click="changeScene(item.value?? '')"
|
||||||
|
:disabled = "item.value === appSceneStore.currentScene"
|
||||||
>
|
>
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
|||||||
@@ -140,3 +140,9 @@ body,
|
|||||||
:-webkit-any(article, aside, nav, section) h1 {
|
:-webkit-any(article, aside, nav, section) h1 {
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@import 'https://cdn.jsdelivr.net/npm/@vue-flow/core@1.45.0/dist/style.css';
|
||||||
|
@import 'https://cdn.jsdelivr.net/npm/@vue-flow/core@1.45.0/dist/theme-default.css';
|
||||||
|
@import 'https://cdn.jsdelivr.net/npm/@vue-flow/controls@latest/dist/style.css';
|
||||||
|
@import 'https://cdn.jsdelivr.net/npm/@vue-flow/minimap@latest/dist/style.css';
|
||||||
|
@import 'https://cdn.jsdelivr.net/npm/@vue-flow/node-resizer@latest/dist/style.css';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" :model-value="dialogVisible" @close="close" v-bind="dialogMiddle">
|
<el-dialog :title="dialogTitle" :model-value="dialogVisible" @close="close" v-bind="dialogMiddle" align-center>
|
||||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
||||||
<el-form-item label="上级菜单" prop="pid" :label-width="100">
|
<el-form-item label="上级菜单" prop="pid" :label-width="100">
|
||||||
<el-tree-select
|
<el-tree-select
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogSmall" @close="close" >
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogSmall" @close="close" align-center>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<el-form :model="formContent"
|
<el-form :model="formContent"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" >
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent" ref='dialogFormRef'>
|
<el-form :model="formContent" ref='dialogFormRef'>
|
||||||
<el-tree
|
<el-tree
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close">
|
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent"
|
<el-form :model="formContent"
|
||||||
ref='dialogFormRef'
|
ref='dialogFormRef'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close" >
|
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent"
|
<el-form :model="formContent"
|
||||||
ref='dialogFormRef'
|
ref='dialogFormRef'
|
||||||
|
|||||||
499
frontend/src/views/home/components/deviceConnectionPopup.vue
Normal file
499
frontend/src/views/home/components/deviceConnectionPopup.vue
Normal file
@@ -0,0 +1,499 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="设备通道配对" v-model='dialogVisible' v-bind="dialogBig">
|
||||||
|
<div class="flow-container" style="overflow: hidden; position: relative;">
|
||||||
|
<!-- <el-form ref='dialogFormRef' :disabled="false" label-width="auto" class="form-two">
|
||||||
|
<el-form-item label='被检设备' prop='type'>
|
||||||
|
<el-select v-model="value" clearable placeholder="被检设备" >
|
||||||
|
<el-option label="CN88888" :value="2"></el-option>
|
||||||
|
<el-option label="CN250985" :value="1"></el-option>
|
||||||
|
<el-option label="PQS240224008" :value="0"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='标准设备' prop='type' >
|
||||||
|
<el-select v-model="value" clearable placeholder="被检设备" >
|
||||||
|
<el-option label="CN88888" :value="2"></el-option>
|
||||||
|
<el-option label="CN250985" :value="1"></el-option>
|
||||||
|
<el-option label="PQS240224008" :value="0"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form> -->
|
||||||
|
<!-- <el-button @click="logConnections">打印当前配对</el-button> -->
|
||||||
|
<VueFlow
|
||||||
|
:nodes="nodes"
|
||||||
|
:edges="edges"
|
||||||
|
:connection-radius="30"
|
||||||
|
:nodes-draggable="false"
|
||||||
|
:dragging = "false"
|
||||||
|
:zoom-on-scroll="false"
|
||||||
|
:pan-on-drag="false"
|
||||||
|
:disable-zoom-pan-on-connect="true"
|
||||||
|
auto-connect
|
||||||
|
@connect="handleConnect"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { h, ref} from 'vue'
|
||||||
|
import { VueFlow, useVueFlow} from '@vue-flow/core'
|
||||||
|
import {dialogBig} from "@/utils/elementBind";
|
||||||
|
import {Platform,Promotion,Flag} from '@element-plus/icons-vue'
|
||||||
|
import { c } from 'vite/dist/node/types.d-aGj9QkWt';
|
||||||
|
import { de, el } from 'element-plus/es/locale';
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
// 初始化 VueFlow
|
||||||
|
const { edges} = useVueFlow()
|
||||||
|
|
||||||
|
|
||||||
|
// 提取公共的label渲染函数
|
||||||
|
const createLabel = ( text: string,type :string) => {
|
||||||
|
return h('div', {
|
||||||
|
style: {
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column', // 图标和文字上下排列
|
||||||
|
alignItems: 'center',
|
||||||
|
fontSize: '15px',
|
||||||
|
textAlign: 'center',
|
||||||
|
border: '1px solid #ccc', // 添加边框
|
||||||
|
borderRadius: '8px', // 圆角
|
||||||
|
padding: '8px', // 内边距
|
||||||
|
backgroundColor: '#f9f9f9' // 可选:背景色
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
h(Platform, {
|
||||||
|
style: {
|
||||||
|
width: '20px',
|
||||||
|
marginBottom: '4px', // 图标与文字间距
|
||||||
|
color: '#526ade'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
h('div', null, '设备名称:'+ text),
|
||||||
|
h('div', null, '设备类型:'+ type)
|
||||||
|
]) as any
|
||||||
|
}
|
||||||
|
|
||||||
|
const createLabel2 = (text: string) => {
|
||||||
|
return h('div', {
|
||||||
|
style: {
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
fontSize: '15px',
|
||||||
|
textAlign: 'center',
|
||||||
|
border: '1px solid #ccc', // 添加边框
|
||||||
|
borderRadius: '8px', // 圆角
|
||||||
|
padding: '8px', // 内边距
|
||||||
|
backgroundColor: '#f9f9f9' // 可选:背景色
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
h(Promotion, {
|
||||||
|
style: {
|
||||||
|
width: '20px',
|
||||||
|
marginRight: '4px',
|
||||||
|
color: '#526ade'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
text
|
||||||
|
]) as any
|
||||||
|
}
|
||||||
|
|
||||||
|
const createLabel3 = (text: string) => {
|
||||||
|
return h('div', {
|
||||||
|
style: {
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
fontSize: '15px',
|
||||||
|
textAlign: 'center',
|
||||||
|
border: '1px solid #ccc', // 添加边框
|
||||||
|
borderRadius: '8px', // 圆角
|
||||||
|
padding: '8px', // 内边距
|
||||||
|
backgroundColor: '#f9f9f9' // 可选:背景色
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
h(Flag, {
|
||||||
|
style: {
|
||||||
|
width: '20px',
|
||||||
|
marginRight: '4px',
|
||||||
|
color: '#526ade'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
text
|
||||||
|
]) as any
|
||||||
|
}
|
||||||
|
|
||||||
|
// 节点数据
|
||||||
|
const nodes2 = ref([
|
||||||
|
{
|
||||||
|
id: '1',
|
||||||
|
data: { label: createLabel('被检设备1') },
|
||||||
|
position: { x: 0, y: 50 },
|
||||||
|
class: 'no-handle-node', // 👈 添加自定义 class
|
||||||
|
style: { width: '200px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '2',
|
||||||
|
data: { label: createLabel('标准设备1') },
|
||||||
|
position: { x: 950, y: 0 },
|
||||||
|
class: 'no-handle-node', // 👈 添加自定义 class
|
||||||
|
style: { width: '200px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: '3',
|
||||||
|
data: { label: createLabel('被检设备2') },
|
||||||
|
position: { x: 0, y: 250 },
|
||||||
|
class: 'no-handle-node', // 👈 添加自定义 class
|
||||||
|
style: { width: '200px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '4',
|
||||||
|
data: { label: createLabel('标准设备2') },
|
||||||
|
position: { x: 950, y: 200 },
|
||||||
|
class: 'no-handle-node', // 👈 添加自定义 class
|
||||||
|
style: { width: '200px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
id: '5',
|
||||||
|
data: { label: createLabel('被检设备3') },
|
||||||
|
position: { x: 0, y: 425 },
|
||||||
|
class: 'no-handle-node', // 👈 添加自定义 class
|
||||||
|
style: { width: '200px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
id: '被检通道1',
|
||||||
|
type: 'input',
|
||||||
|
data: { label: createLabel3('被检通道1') },
|
||||||
|
position: { x: 200, y: 0 },
|
||||||
|
sourcePosition: 'right',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '被检通道2',
|
||||||
|
type: 'input',
|
||||||
|
data: { label: createLabel3('被检通道2') },
|
||||||
|
position: { x: 200, y:50 },
|
||||||
|
sourcePosition: 'right',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '被检通道3',
|
||||||
|
type: 'input',
|
||||||
|
data: { label: createLabel3('被检通道3') },
|
||||||
|
position: { x: 200, y: 100 },
|
||||||
|
sourcePosition: 'right',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '被检通道4',
|
||||||
|
type: 'input',
|
||||||
|
data: { label: createLabel3('被检通道4') },
|
||||||
|
position: { x: 200, y: 150 },
|
||||||
|
sourcePosition: 'right',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: '被检通道5',
|
||||||
|
type: 'input',
|
||||||
|
data: { label: createLabel3('被检通道1') },
|
||||||
|
position: { x: 200, y: 250 },
|
||||||
|
sourcePosition: 'right',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '被检通道6',
|
||||||
|
type: 'input',
|
||||||
|
data: { label: createLabel3('被检通道2') },
|
||||||
|
position: { x: 200, y:300 },
|
||||||
|
sourcePosition: 'right',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
id: '被检通道7',
|
||||||
|
type: 'input',
|
||||||
|
data: { label: createLabel3('被检通道1') },
|
||||||
|
position: { x: 200, y:400 },
|
||||||
|
sourcePosition: 'right',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '被检通道8',
|
||||||
|
type: 'input',
|
||||||
|
data: { label: createLabel3('被检通道2') },
|
||||||
|
position: { x: 200, y:450 },
|
||||||
|
sourcePosition: 'right',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '被检通道9',
|
||||||
|
type: 'input',
|
||||||
|
data: { label: createLabel3('被检通道3') },
|
||||||
|
position: { x: 200, y:500 },
|
||||||
|
sourcePosition: 'right',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
id: '标准通道1',
|
||||||
|
type: 'output',
|
||||||
|
data: { label: createLabel2('标准通道1') },
|
||||||
|
position: { x: 800, y: 0 },
|
||||||
|
targetPosition: 'left',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '标准通道2',
|
||||||
|
type: 'output',
|
||||||
|
data: { label: createLabel2('标准通道2') },
|
||||||
|
position: { x: 800, y: 50 },
|
||||||
|
targetPosition: 'left',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: '标准通道3',
|
||||||
|
type: 'output',
|
||||||
|
data: { label: createLabel2('标准通道1') },
|
||||||
|
position: { x: 800, y: 150 },
|
||||||
|
targetPosition: 'left',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '标准通道4',
|
||||||
|
type: 'output',
|
||||||
|
data: { label: createLabel2('标准通道2') },
|
||||||
|
position: { x: 800, y: 200 },
|
||||||
|
targetPosition: 'left',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '标准通道5',
|
||||||
|
type: 'output',
|
||||||
|
data: { label: createLabel2('标准通道3') },
|
||||||
|
position: { x: 800, y: 250 },
|
||||||
|
targetPosition: 'left',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '标准通道6',
|
||||||
|
type: 'output',
|
||||||
|
data: { label: createLabel2('标准通道4') },
|
||||||
|
position: { x: 800, y: 300 },
|
||||||
|
targetPosition: 'left',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const handleConnect = (params: any) => {
|
||||||
|
const sourceNode = nodes.value.find(node => node.id === params.source)
|
||||||
|
const targetNode = nodes.value.find(node => node.id === params.target)
|
||||||
|
// 连接规则验证
|
||||||
|
const isValidConnection =
|
||||||
|
sourceNode?.type === 'input' &&
|
||||||
|
targetNode?.type === 'output'
|
||||||
|
|
||||||
|
if (!isValidConnection) {
|
||||||
|
// 删除当前连接
|
||||||
|
removeEdge(params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 删除不合法连接的函数
|
||||||
|
const removeEdge = (params: any) => {
|
||||||
|
const edgeIndex = edges.value.findIndex(edge => edge.source === params.source && edge.target === params.target)
|
||||||
|
if (edgeIndex !== -1) {
|
||||||
|
edges.value.splice(edgeIndex, 1) // 删除该连接
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 打印当前节点和连线信息
|
||||||
|
function logConnections() {
|
||||||
|
console.log('当前节点:', nodes.value);
|
||||||
|
console.log('当前连线:', edges.value);
|
||||||
|
|
||||||
|
const connections = edges.value.map(edge => ({
|
||||||
|
source: edge.source,
|
||||||
|
target: edge.target,
|
||||||
|
label: `${edge.source} → ${edge.target}`
|
||||||
|
}));
|
||||||
|
|
||||||
|
console.table(connections);
|
||||||
|
}
|
||||||
|
|
||||||
|
const nodes = ref([])
|
||||||
|
const open = async () => {
|
||||||
|
nodes.value = createNodes()
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 每台设备的通道数量
|
||||||
|
const channelCounts = {
|
||||||
|
'1': 1, // 被检设备1 → 4个通道
|
||||||
|
'3': 3, // 被检设备2 → 2个通道
|
||||||
|
'5': 2, // 被检设备3 → 2个通道
|
||||||
|
'7': 4 // 被检设备4 → 4个通道
|
||||||
|
}
|
||||||
|
|
||||||
|
// 每台设备的通道数量
|
||||||
|
const channelCounts2 = {
|
||||||
|
'2': 2, // 标准设备1 → 2个通道
|
||||||
|
'4': 1, // 标准设备2 → 1个通道
|
||||||
|
}
|
||||||
|
|
||||||
|
const yPosition = ref(25)
|
||||||
|
const yPosition2 = ref(25)
|
||||||
|
const createNodes = () => {
|
||||||
|
const newNodes: any[] = []
|
||||||
|
|
||||||
|
|
||||||
|
// 存储每组被检/标准通道的垂直范围
|
||||||
|
const deviceChannelGroups: { deviceId: string; centerY: number; }[] = []
|
||||||
|
const standardChannelGroups: any[] = []
|
||||||
|
|
||||||
|
const deviceWidth = 0
|
||||||
|
const inputChannelX = 200
|
||||||
|
const outputChannelX = 800
|
||||||
|
const standardWidth = 950
|
||||||
|
|
||||||
|
// 添加被检通道
|
||||||
|
Object.entries(channelCounts).forEach(([deviceId, count]) => {
|
||||||
|
for (let i = 1; i <= count; i++) {
|
||||||
|
const channelId = `被检通道-${deviceId}-${i}`
|
||||||
|
newNodes.push({
|
||||||
|
id: channelId,
|
||||||
|
type: 'input',
|
||||||
|
data: { label: createLabel3(`被检通道${i}`) },
|
||||||
|
position: { x: inputChannelX, y: yPosition.value },
|
||||||
|
sourcePosition: 'right',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
})
|
||||||
|
if(i == 1 && count == 1){
|
||||||
|
deviceChannelGroups.push({
|
||||||
|
deviceId,
|
||||||
|
centerY: yPosition.value - 25
|
||||||
|
})
|
||||||
|
}else if(i == 2 && count == 2){
|
||||||
|
deviceChannelGroups.push({
|
||||||
|
deviceId,
|
||||||
|
centerY: yPosition.value - 50
|
||||||
|
})
|
||||||
|
}else if(i == 3 && count == 3){
|
||||||
|
deviceChannelGroups.push({
|
||||||
|
deviceId,
|
||||||
|
centerY: yPosition.value - 75
|
||||||
|
})
|
||||||
|
}else if(i == 4 && count == 4){
|
||||||
|
deviceChannelGroups.push({
|
||||||
|
deviceId,
|
||||||
|
centerY: yPosition.value - 100
|
||||||
|
})
|
||||||
|
}
|
||||||
|
yPosition.value += 50
|
||||||
|
}
|
||||||
|
yPosition.value += 50
|
||||||
|
})
|
||||||
|
// 添加标准通道
|
||||||
|
Object.entries(channelCounts2).forEach(([deviceId, count]) => {
|
||||||
|
for (let i = 1; i <= count; i++) {
|
||||||
|
const channelId = `标准通道-${deviceId}-${i}`
|
||||||
|
newNodes.push({
|
||||||
|
id: channelId,
|
||||||
|
type: 'output',
|
||||||
|
data: { label: createLabel3(`标准通道${i}`) },
|
||||||
|
position: { x: outputChannelX, y: yPosition2.value },
|
||||||
|
targetPosition: 'left',
|
||||||
|
style: { width: '150px', border: 'none', boxShadow: 'none' }
|
||||||
|
})
|
||||||
|
if(i == 1 && count == 1){
|
||||||
|
standardChannelGroups.push({
|
||||||
|
deviceId,
|
||||||
|
centerY: yPosition2.value - 25
|
||||||
|
})
|
||||||
|
}else if(i == 2 && count == 2){
|
||||||
|
standardChannelGroups.push({
|
||||||
|
deviceId,
|
||||||
|
centerY: yPosition2.value - 50
|
||||||
|
})
|
||||||
|
}else if(i == 3 && count == 3){
|
||||||
|
standardChannelGroups.push({
|
||||||
|
deviceId,
|
||||||
|
centerY: yPosition2.value - 100
|
||||||
|
})
|
||||||
|
}else if(i == 4 && count == 4){
|
||||||
|
standardChannelGroups.push({
|
||||||
|
deviceId,
|
||||||
|
centerY: yPosition2.value - 100
|
||||||
|
})
|
||||||
|
}
|
||||||
|
yPosition2.value += 50
|
||||||
|
}
|
||||||
|
yPosition2.value += 50
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 添加被检设备
|
||||||
|
deviceChannelGroups.forEach(({ deviceId, centerY }) => {
|
||||||
|
const device = inspectionDevices.find(d => d.id === deviceId)
|
||||||
|
if (!device) return
|
||||||
|
newNodes.push({
|
||||||
|
id: device.id,
|
||||||
|
data: { label: createLabel(device.name,device.deviceType) },
|
||||||
|
position: { x: deviceWidth, y: centerY },
|
||||||
|
class: 'no-handle-node',
|
||||||
|
style: { width: '200px', border: 'none', boxShadow: 'none' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// 添加标准设备
|
||||||
|
standardChannelGroups.forEach(({ deviceId, centerY }) => {
|
||||||
|
const device = standardDevices.find(d => d.id === deviceId)
|
||||||
|
if (!device) return
|
||||||
|
newNodes.push({
|
||||||
|
id: device.id,
|
||||||
|
data: { label: createLabel(device.name,device.deviceType) },
|
||||||
|
position: { x: standardWidth, y: centerY },
|
||||||
|
class: 'no-handle-node',
|
||||||
|
style: { width: '200px', border: 'none', boxShadow: 'none' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return newNodes
|
||||||
|
}
|
||||||
|
|
||||||
|
const inspectionDevices = [
|
||||||
|
{ id: '1', name: '被检设备1', type: 'normal', deviceType: 'PQS-882B4' },
|
||||||
|
{ id: '3', name: '被检设备2', type: 'normal', deviceType: 'PQS-883A2' },
|
||||||
|
{ id: '5', name: '被检设备3', type: 'normal', deviceType: 'PQS-882B2' },
|
||||||
|
{ id: '7', name: '被检设备4', type: 'normal', deviceType: 'PQS_883B' }
|
||||||
|
]
|
||||||
|
|
||||||
|
const standardDevices = [
|
||||||
|
{ id: '2', name: '标准设备1', type: 'normal', deviceType: 'PQS-882A' },
|
||||||
|
{ id: '4', name: '标准设备2', type: 'normal', deviceType: 'PQS-882B2' },
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
defineExpose({open})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.flow-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vue-flow__node.no-handle-node .vue-flow__handle {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -64,6 +64,10 @@
|
|||||||
>重置
|
>重置
|
||||||
</el-button
|
</el-button
|
||||||
>
|
>
|
||||||
|
<el-button
|
||||||
|
type='primary'
|
||||||
|
:icon='Clock' @click="handleTest2">通道配对
|
||||||
|
</el-button>
|
||||||
<!-- :disabled='!scope.isSelected' -->
|
<!-- :disabled='!scope.isSelected' -->
|
||||||
<el-button
|
<el-button
|
||||||
type='primary'
|
type='primary'
|
||||||
@@ -233,6 +237,8 @@
|
|||||||
<SelectTestItemPopup ref="selectTestItemPopupRef" @openTestDialog="openTestDialog"></SelectTestItemPopup>
|
<SelectTestItemPopup ref="selectTestItemPopupRef" @openTestDialog="openTestDialog"></SelectTestItemPopup>
|
||||||
<!-- 省平台-填写温度湿度弹窗 -->
|
<!-- 省平台-填写温度湿度弹窗 -->
|
||||||
<WriteTHPopup ref="writeTHPopupRef" @openTestDialog2="openTestDialog2"></WriteTHPopup>
|
<WriteTHPopup ref="writeTHPopupRef" @openTestDialog2="openTestDialog2"></WriteTHPopup>
|
||||||
|
<!-- 比对模式-通道配对弹窗 -->
|
||||||
|
<DeviceConnectionPopup ref="deviceConnectionPopupRef" ></DeviceConnectionPopup>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -272,7 +278,6 @@ import {onBeforeMount, onMounted, reactive, ref, watch} from 'vue'
|
|||||||
import {useDictStore} from '@/stores/modules/dict'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
import ChannelsTest from './channelsTest.vue'
|
import ChannelsTest from './channelsTest.vue'
|
||||||
import {useModeStore,useAppSceneStore} from '@/stores/modules/mode' // 引入模式 store
|
import {useModeStore,useAppSceneStore} from '@/stores/modules/mode' // 引入模式 store
|
||||||
|
|
||||||
import {useCheckStore} from '@/stores/modules/check'
|
import {useCheckStore} from '@/stores/modules/check'
|
||||||
import {CheckData} from '@/api/check/interface'
|
import {CheckData} from '@/api/check/interface'
|
||||||
import socketClient from '@/utils/webSocketClient'
|
import socketClient from '@/utils/webSocketClient'
|
||||||
@@ -285,7 +290,7 @@ import {getPqDev} from '@/api/device/device/index.ts'
|
|||||||
import {ResultEnum} from '@/enums/httpEnum'
|
import {ResultEnum} from '@/enums/httpEnum'
|
||||||
import SelectTestItemPopup from "@/views/home/components/selectTestItemPopup.vue";
|
import SelectTestItemPopup from "@/views/home/components/selectTestItemPopup.vue";
|
||||||
import WriteTHPopup from "@/views/home/components/writeTHPopup.vue";
|
import WriteTHPopup from "@/views/home/components/writeTHPopup.vue";
|
||||||
import { fa } from 'element-plus/es/locale'
|
import DeviceConnectionPopup from '@/views/home/components/deviceConnectionPopup.vue'
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const checkStore = useCheckStore()
|
const checkStore = useCheckStore()
|
||||||
@@ -303,7 +308,7 @@ const reportDialogVisible = ref(false)
|
|||||||
const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>()
|
const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>()
|
||||||
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
|
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
|
||||||
const writeTHPopupRef = ref<InstanceType<typeof WriteTHPopup>>()
|
const writeTHPopupRef = ref<InstanceType<typeof WriteTHPopup>>()
|
||||||
|
const deviceConnectionPopupRef = ref<InstanceType<typeof DeviceConnectionPopup>>()
|
||||||
const matchDialogVisible = ref(false)
|
const matchDialogVisible = ref(false)
|
||||||
const dialogTitle = ref('手动检测')
|
const dialogTitle = ref('手动检测')
|
||||||
const checkStateTable = ref<number[]>([0, 1, 2])
|
const checkStateTable = ref<number[]>([0, 1, 2])
|
||||||
@@ -531,7 +536,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'reCheckNum',
|
prop: 'recheckNum',
|
||||||
label: '检测次数',
|
label: '检测次数',
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
@@ -597,10 +602,10 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
return '不合格'
|
return '不合格'
|
||||||
} else if (scope.row.factorCheckResult === 1) {
|
} else if (scope.row.factorCheckResult === 1) {
|
||||||
return '合格'
|
return '合格'
|
||||||
} else if (scope.row.factorCheckResult === 2) {
|
} else {
|
||||||
return '/'
|
return '未检'
|
||||||
}
|
}
|
||||||
return ''
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow},
|
{prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow},
|
||||||
@@ -845,6 +850,11 @@ const addDevice = (val: string) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleTest2 = () => {
|
||||||
|
deviceConnectionPopupRef.value?.open()
|
||||||
|
}
|
||||||
|
|
||||||
const handleTest = async (val: string) => {
|
const handleTest = async (val: string) => {
|
||||||
|
|
||||||
if (devNum == 0) {
|
if (devNum == 0) {
|
||||||
|
|||||||
@@ -28,10 +28,22 @@
|
|||||||
>
|
>
|
||||||
<template #default='{ node, data }'>
|
<template #default='{ node, data }'>
|
||||||
<span class='custom-tree-node' style='display: flex;align-items: center;'>
|
<span class='custom-tree-node' style='display: flex;align-items: center;'>
|
||||||
|
<!-- 父节点图标 -->
|
||||||
<Platform v-if='!data.pid' style='width:18px;height: 18px;margin-right:8px;'
|
<Platform v-if='!data.pid' style='width:18px;height: 18px;margin-right:8px;'
|
||||||
:style="{color:node.label=='未检'?'#fac858':node.label=='检测中'?'#ee6666':'#91cc75'}" />
|
:style="{color:node.label=='未检'?'#fac858':node.label=='检测中'?'#ee6666':'#91cc75'}" />
|
||||||
|
<!-- 节点名称 -->
|
||||||
<span>{{ node.label }}</span>
|
<span>{{ node.label }}</span>
|
||||||
<!-- <Menu v-if="data.pid" @click.stop="detail(data)" style="width: 12px;margin-left: 8px;"/> -->
|
<!-- 子节点右侧图标 + tooltip -->
|
||||||
|
<el-tooltip
|
||||||
|
v-if="data.pid"
|
||||||
|
placement="top"
|
||||||
|
:manual="true"
|
||||||
|
:content="'子计划信息'">
|
||||||
|
<Menu
|
||||||
|
@click.stop="detail()"
|
||||||
|
style="width: 16px; height: 16px; margin-left: 8px; cursor: pointer; color: var(--el-color-primary)"
|
||||||
|
/>
|
||||||
|
</el-tooltip>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ const modeList = [
|
|||||||
code: "比对式",
|
code: "比对式",
|
||||||
subName: "启用比对式检测计划",
|
subName: "启用比对式检测计划",
|
||||||
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
|
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
|
||||||
isActive: false,
|
isActive: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const handelOpen = async (item: any) => {
|
const handelOpen = async (item: any) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" >
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
||||||
<el-form-item label="名称" prop="name" >
|
<el-form-item label="名称" prop="name" >
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" align-center>
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card" v-model="activeTab">
|
||||||
<el-tab-pane label="设备台账信息">
|
<el-tab-pane label="设备台账信息">
|
||||||
<div>
|
<div>
|
||||||
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' :disabled="false" label-width="auto" class="form-three">
|
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' :disabled="false" label-width="auto" class="form-three">
|
||||||
@@ -9,15 +9,16 @@
|
|||||||
<el-input v-model="formContent.createId" placeholder="请输入装置编号" @input="handleInput" maxlength="32" show-word-limit/>
|
<el-input v-model="formContent.createId" placeholder="请输入装置编号" @input="handleInput" maxlength="32" show-word-limit/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="设备名称" prop="name">
|
<el-form-item label="设备名称" prop="name">
|
||||||
<el-input v-model='formContent.name' placeholder="请输入设备名称" :disabled="scene === '1'" maxlength="32" show-word-limit/>
|
<el-input v-model='formContent.name' placeholder="请输入设备名称" :disabled="scene === '1' || formContent.importFlag == 1" maxlength="32" show-word-limit />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='设备类型' prop='devType'>
|
<el-form-item label='设备类型' prop='devType'>
|
||||||
<el-select v-model="formContent.devType" filterable clearable placeholder="请选择设备类型" @change="handleDevTypeChange">
|
<el-select v-model="formContent.devType" filterable clearable placeholder="请选择设备类型" @change="handleDevTypeChange" :disabled="formContent.importFlag == 1">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in devTypeOptions"
|
v-for="item in devTypeOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -31,31 +32,23 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label='设备模式' prop='pattern' >-->
|
|
||||||
<!-- <el-select v-model="formContent.pattern" clearable placeholder="请选择设备模式" disabled>-->
|
|
||||||
<!-- <el-option -->
|
|
||||||
<!-- v-for="item in dictStore.getDictData('Pattern')"-->
|
|
||||||
<!-- :key="item.id"-->
|
|
||||||
<!-- :label="item.name"-->
|
|
||||||
<!-- :value="item.id"-->
|
|
||||||
<!-- />-->
|
|
||||||
<!-- </el-select>-->
|
|
||||||
<!-- </el-form-item> -->
|
|
||||||
<el-form-item label='设备厂家' prop='manufacturer' v-if="scene != '1'">
|
<el-form-item label='设备厂家' prop='manufacturer' v-if="scene != '1'">
|
||||||
<el-select v-model="formContent.manufacturer" clearable placeholder="请选择设备厂家">
|
<el-select v-model="formContent.manufacturer" clearable placeholder="请选择设备厂家" :disabled="formContent.importFlag == 1">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Dev_Manufacturers')"
|
v-for="item in dictStore.getDictData('Dev_Manufacturers')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="出厂日期" prop="createDate" v-if="scene === '0'">
|
<el-form-item :label="createDateTitle" prop="createDate" v-if="scene === '0'" >
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="formContent.createDate"
|
v-model="formContent.createDate"
|
||||||
placeholder="请选择出厂日期"
|
:placeholder="`请选择${createDateTitle}`"
|
||||||
:disabled-date="disabledDate"
|
:disabled-date="disabledDate"
|
||||||
|
:disabled="formContent.importFlag == 1"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@@ -65,46 +58,62 @@
|
|||||||
<el-form-item label="软件版本" prop="softwareVersion" v-if="scene === '0'">
|
<el-form-item label="软件版本" prop="softwareVersion" v-if="scene === '0'">
|
||||||
<el-input v-model="formContent.softwareVersion" placeholder="请输入软件版本"/>
|
<el-input v-model="formContent.softwareVersion" placeholder="请输入软件版本"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label='定检日期' prop='inspectDate' v-if="MonIsShow">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="formContent.inspectDate"
|
||||||
|
placeholder="请选择定检日期"
|
||||||
|
:disabled-date="disabledDate"
|
||||||
|
:disabled="formContent.importFlag == 1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-divider>参数信息</el-divider>
|
<el-divider>参数信息</el-divider>
|
||||||
<el-form-item label="通道数" prop="devChns">
|
<el-form-item label="通道数" prop="devChns" v-if="DevIsShow">
|
||||||
<el-input v-model='formContent.devChns' :disabled="true"/>
|
<el-input v-model='formContent.devChns' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="额定电压(V)" prop="devVolt">
|
<el-form-item label="额定电压(V)" prop="devVolt" v-if="DevIsShow">
|
||||||
<el-input v-model='formContent.devVolt' :disabled="true"/>
|
<el-input v-model='formContent.devVolt' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="额定电流(A)" prop="devCurr">
|
<el-form-item label="额定电流(A)" prop="devCurr" v-if="DevIsShow">
|
||||||
<el-input v-model='formContent.devCurr' :disabled="true"/>
|
<el-input v-model='formContent.devCurr' :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label='被检通道' prop='inspectChannel' :label-width='100' v-if="MonIsShow">
|
||||||
|
<el-select v-model="formContent.inspectChannel" multiple collapse-tags :disabled="true" :max-collapse-tags="4" placeholder="请选择被检通道" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="(option, index) in pqChannelArray"
|
||||||
|
:key="index"
|
||||||
|
:label="option.label"
|
||||||
|
:value="option.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label='通讯协议' prop='protocol'>
|
<el-form-item label='通讯协议' prop='protocol'>
|
||||||
<el-select v-model="formContent.protocol" clearable placeholder="请选择通讯协议">
|
<el-select v-model="formContent.protocol" clearable placeholder="请选择通讯协议" :disabled="formContent.importFlag == 1">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Protocol')"
|
v-for="item in dictStore.getDictData('Protocol')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="IP地址" prop="ip">
|
|
||||||
<IPAddress v-model:value="formContent.ip"/>
|
|
||||||
</el-form-item> -->
|
|
||||||
<el-form-item label="IP地址" prop="ip" placeholder="请输入IP地址">
|
<el-form-item label="IP地址" prop="ip" placeholder="请输入IP地址">
|
||||||
<el-input v-model="formContent.ip"/>
|
<el-input v-model="formContent.ip" :disabled="formContent.importFlag == 1"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="端口号" prop="port" placeholder="请输入端口号">
|
<el-form-item label="端口号" prop="port" placeholder="请输入端口号">
|
||||||
<el-input v-model="formContent.port"/>
|
<el-input v-model="formContent.port" :disabled="formContent.importFlag == 1"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='是否加密' prop='encryptionFlag'>
|
<el-form-item label='是否加密' prop='encryptionFlag'>
|
||||||
<el-select v-model="formContent.encryptionFlag" clearable placeholder="请选择是否加密">
|
<el-select v-model="formContent.encryptionFlag" clearable placeholder="请选择是否加密" :disabled="formContent.importFlag == 1">
|
||||||
<el-option label="是" :value="1"></el-option>
|
<el-option label="是" :value="1"></el-option>
|
||||||
<el-option label="否" :value="0"></el-option>
|
<el-option label="否" :value="0"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='识别码' prop='series' clearable v-if="formContent.encryptionFlag">
|
<el-form-item label='识别码' prop='series' clearable v-if="formContent.encryptionFlag">
|
||||||
<el-input v-model='formContent.series' placeholder="请输入识别码" show-password/>
|
<el-input v-model='formContent.series' placeholder="请输入识别码" show-password :disabled="formContent.importFlag == 1"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='密钥' prop='devKey' clearable v-if="formContent.encryptionFlag">
|
<el-form-item label='密钥' prop='devKey' clearable v-if="formContent.encryptionFlag">
|
||||||
<el-input v-model='formContent.devKey' placeholder="请输入密钥" show-password/>
|
<el-input v-model='formContent.devKey' placeholder="请输入密钥" show-password :disabled="formContent.importFlag == 1"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='样品编号' prop='sampleId' clearable v-if="DevIsShow && scene === '0'">
|
<el-form-item label='样品编号' prop='sampleId' clearable v-if="DevIsShow && scene === '0'">
|
||||||
<el-input v-model='formContent.sampleId' placeholder="请输入样品编号"/>
|
<el-input v-model='formContent.sampleId' placeholder="请输入样品编号"/>
|
||||||
@@ -127,13 +136,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='所属地市' prop='cityName' clearable placeholder="请输入所属地市" v-if="MonIsShow">
|
<el-form-item label='所属地市' prop='cityName' clearable placeholder="请输入所属地市" v-if="MonIsShow">
|
||||||
<el-input v-model='formContent.cityName'/>
|
<el-input v-model='formContent.cityName' :disabled="formContent.importFlag == 1"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='所属供电公司' prop='gDName' clearable placeholder="请输入所属供电公司" v-if="MonIsShow">
|
<el-form-item label='所属供电公司' prop='gdName' clearable placeholder="请输入所属供电公司" v-if="MonIsShow">
|
||||||
<el-input v-model='formContent.gDName'/>
|
<el-input v-model='formContent.gdName' :disabled="formContent.importFlag == 1"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='所属电站' prop='subName' clearable placeholder="请输入所属电站" v-if="MonIsShow">
|
<el-form-item label='所属电站' prop='subName' clearable placeholder="请输入所属电站" v-if="MonIsShow">
|
||||||
<el-input v-model='formContent.subName'/>
|
<el-input v-model='formContent.subName' :disabled="formContent.importFlag == 1"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-auth.device="'factorFlag'" label="是否支持系数校准" prop='factorFlag' v-if="scene === '1'">
|
<el-form-item v-auth.device="'factorFlag'" label="是否支持系数校准" prop='factorFlag' v-if="scene === '1'">
|
||||||
<el-radio-group v-model="formContent.factorFlag">
|
<el-radio-group v-model="formContent.factorFlag">
|
||||||
@@ -146,7 +155,7 @@
|
|||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<!-- 监测点台账信息 tab pane -->
|
<!-- 监测点台账信息 tab pane -->
|
||||||
<MonitorTable :MonIsShow="MonIsShow"/>
|
<MonitorTable @getParameter="getParameter" :MonIsShow="MonIsShow" :DevFormContent = "formContent"/>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div >
|
<div >
|
||||||
@@ -158,8 +167,6 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
|
|
||||||
import IPAddress from '@/components/IpAddress/index.vue'
|
|
||||||
import {dialogBig} from '@/utils/elementBind'
|
import {dialogBig} from '@/utils/elementBind'
|
||||||
import {type Device} from '@/api/device/interface/device'
|
import {type Device} from '@/api/device/interface/device'
|
||||||
import {ElMessage, type FormItemRule} from 'element-plus'
|
import {ElMessage, type FormItemRule} from 'element-plus'
|
||||||
@@ -171,18 +178,31 @@ import {CirclePlus, Delete, EditPen} from '@element-plus/icons-vue'
|
|||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import MonitorTable from '@/views/machine/device/components/monitorTab.vue';
|
import MonitorTable from '@/views/machine/device/components/monitorTab.vue';
|
||||||
import {useAppSceneStore} from "@/stores/modules/mode";
|
import {useAppSceneStore} from "@/stores/modules/mode";
|
||||||
|
import { generateUUID } from '@/utils'
|
||||||
|
import { Monitor } from '@/api/device/interface/monitor'
|
||||||
|
|
||||||
|
|
||||||
const AppSceneStore = useAppSceneStore()
|
const AppSceneStore = useAppSceneStore()
|
||||||
const MonIsShow = ref(false)
|
const MonIsShow = ref(false)
|
||||||
const DevIsShow = ref(false)
|
const DevIsShow = ref(false)
|
||||||
// 存储设备类型选项
|
// 存储设备类型选项
|
||||||
const devTypeOptions = ref<Device.ResDev[]>([])
|
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||||
|
const monitor = ref<Monitor.ResPqMon[]>([])
|
||||||
// const IsPasswordShow = ref(false)
|
// const IsPasswordShow = ref(false)
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const mode = ref()
|
const mode = ref()
|
||||||
const scene = ref('')
|
const scene = ref('')
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
|
const createDateTitle = ref('')
|
||||||
|
const activeTab = ref('0') // '0' 对应第一个 tab
|
||||||
|
|
||||||
|
const pqChannelArray = ref([
|
||||||
|
{
|
||||||
|
value: '1',
|
||||||
|
label: '1',
|
||||||
|
}
|
||||||
|
])
|
||||||
const disabledDate = (time: Date) => {
|
const disabledDate = (time: Date) => {
|
||||||
return time.getTime() > Date.now()
|
return time.getTime() > Date.now()
|
||||||
}
|
}
|
||||||
@@ -190,7 +210,7 @@ const disabledDate = (time: Date) => {
|
|||||||
function useMetaInfo() {
|
function useMetaInfo() {
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const titleType = ref('add')
|
const titleType = ref('add')
|
||||||
const formContent = ref<Device.ResPqDev>({
|
const formContent = reactive<Device.ResPqDev>({
|
||||||
id: '',
|
id: '',
|
||||||
name: '',
|
name: '',
|
||||||
pattern: mode.value,
|
pattern: mode.value,
|
||||||
@@ -207,13 +227,20 @@ function useMetaInfo() {
|
|||||||
ip: '',
|
ip: '',
|
||||||
port: 102,
|
port: 102,
|
||||||
encryptionFlag: 0,
|
encryptionFlag: 0,
|
||||||
reCheckNum: 0,
|
recheckNum: 0,
|
||||||
state: 1,
|
state: 1,
|
||||||
factorFlag: 1,
|
factorFlag: 1,
|
||||||
icdId: '',
|
icdId: '',
|
||||||
power: '',
|
power: '',
|
||||||
preinvestmentPlan: '',
|
preinvestmentPlan: '',
|
||||||
delegate:''
|
delegate:'',
|
||||||
|
inspectDate:dayjs().format('YYYY-MM-DD'),
|
||||||
|
cityName: '',
|
||||||
|
gdName: '',
|
||||||
|
subName: '',
|
||||||
|
importFlag:0,
|
||||||
|
inspectChannel:[],
|
||||||
|
monitorList:[]
|
||||||
})
|
})
|
||||||
return {dialogVisible, titleType, formContent}
|
return {dialogVisible, titleType, formContent}
|
||||||
}
|
}
|
||||||
@@ -221,7 +248,8 @@ function useMetaInfo() {
|
|||||||
const {dialogVisible, titleType, formContent} = useMetaInfo()
|
const {dialogVisible, titleType, formContent} = useMetaInfo()
|
||||||
// 清空formContent
|
// 清空formContent
|
||||||
const resetFormContent = () => {
|
const resetFormContent = () => {
|
||||||
formContent.value = {
|
Object.assign(
|
||||||
|
formContent,{
|
||||||
id: '',
|
id: '',
|
||||||
name: '',
|
name: '',
|
||||||
pattern: mode.value,
|
pattern: mode.value,
|
||||||
@@ -238,14 +266,23 @@ const resetFormContent = () => {
|
|||||||
ip: '',
|
ip: '',
|
||||||
port: 102,
|
port: 102,
|
||||||
encryptionFlag: 0,
|
encryptionFlag: 0,
|
||||||
reCheckNum: 0,
|
recheckNum: 0,
|
||||||
state: 1,
|
state: 1,
|
||||||
factorFlag: 1,
|
factorFlag: 1,
|
||||||
icdId: '',
|
icdId: '',
|
||||||
power: '',
|
power: '',
|
||||||
preinvestmentPlan: '',
|
preinvestmentPlan: '',
|
||||||
delegate:''
|
delegate:'',
|
||||||
|
inspectDate:dayjs().format('YYYY-MM-DD'),
|
||||||
|
cityName: '',
|
||||||
|
gdName: '',
|
||||||
|
subName: '',
|
||||||
|
importFlag:0,
|
||||||
|
inspectChannel:[],
|
||||||
|
monitorList:[]
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -291,7 +328,7 @@ const rules = computed(() => {
|
|||||||
const dynamicRules = {...baseRules};
|
const dynamicRules = {...baseRules};
|
||||||
|
|
||||||
if (scene.value === '0') {//只有电科院需要展示
|
if (scene.value === '0') {//只有电科院需要展示
|
||||||
dynamicRules.createDate = [{required: true, message: '出厂日期必填!', trigger: 'blur'}];
|
dynamicRules.createDate = [{required: true, message: createDateTitle.value + '必填!', trigger: 'blur'}];
|
||||||
}
|
}
|
||||||
if (scene.value === '1') {//只有楼下出厂需要展示
|
if (scene.value === '1') {//只有楼下出厂需要展示
|
||||||
dynamicRules.preinvestmentPlan = [{required: true, message: '预投计划必选!', trigger: 'change'}];
|
dynamicRules.preinvestmentPlan = [{required: true, message: '预投计划必选!', trigger: 'change'}];
|
||||||
@@ -310,7 +347,13 @@ const rules = computed(() => {
|
|||||||
if (scene.value !== '2') {
|
if (scene.value !== '2') {
|
||||||
dynamicRules.name = [{required: true, message: '设备名称必填!', trigger: 'blur'}];
|
dynamicRules.name = [{required: true, message: '设备名称必填!', trigger: 'blur'}];
|
||||||
dynamicRules.manufacturer = [{required: true, message: '生产厂家必选!', trigger: 'change'}];
|
dynamicRules.manufacturer = [{required: true, message: '生产厂家必选!', trigger: 'change'}];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mode.value === '比对式'){
|
||||||
|
dynamicRules.inspectDate = [{required: true, message: '定检日期必填!', trigger: 'blur'}];
|
||||||
|
dynamicRules.cityName = [{required: true, message: '所属地市必填!', trigger: 'blur'}];
|
||||||
|
dynamicRules.gdName = [{required: true, message: '所属供电公司必填!', trigger: 'blur'}];
|
||||||
|
dynamicRules.subName = [{required: true, message: '所属电站必填!', trigger: 'blur'}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -324,7 +367,15 @@ const close = () => {
|
|||||||
resetFormContent()
|
resetFormContent()
|
||||||
// 重置表单
|
// 重置表单
|
||||||
dialogFormRef.value?.resetFields()
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
//子组件监测点变化通知父组件设备台账
|
||||||
|
const getParameter = (data: Monitor.ResPqMon[]) => {
|
||||||
|
monitor.value = data
|
||||||
|
//保存监测点信息自动更新设备台账的被检通道
|
||||||
|
formContent.inspectChannel = monitor.value
|
||||||
|
.map(item => item.num.toString())
|
||||||
|
.sort((a, b) => parseFloat(a) - parseFloat(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
@@ -332,41 +383,59 @@ const save = () => {
|
|||||||
try {
|
try {
|
||||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
|
||||||
if (formContent.value.encryptionFlag === 0) {
|
if (formContent.encryptionFlag === 0) {
|
||||||
formContent.value.series = ''
|
formContent.series = ''
|
||||||
formContent.value.devKey = ''
|
formContent.devKey = ''
|
||||||
}
|
}
|
||||||
if (valid) {
|
if (valid) {
|
||||||
formContent.value.createDate = dayjs(formContent.value.createDate).format('YYYY-MM-DD');
|
formContent.createDate = dayjs(formContent.createDate).format('YYYY-MM-DD');
|
||||||
if (AppSceneStore.currentScene === '1') {
|
if (AppSceneStore.currentScene === '1') {
|
||||||
formContent.value.name = formContent.value.createId
|
formContent.name = formContent.createId
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formContent.value.arrivedDate) {
|
if (formContent.arrivedDate) {
|
||||||
formContent.value.arrivedDate = dayjs(formContent.value.arrivedDate).format('YYYY-MM-DD');
|
formContent.arrivedDate = dayjs(formContent.arrivedDate).format('YYYY-MM-DD');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mode.value == '比对式'){
|
||||||
|
if (formContent.inspectDate) {
|
||||||
|
formContent.inspectDate = dayjs(formContent.inspectDate).format('YYYY-MM-DD');
|
||||||
|
}
|
||||||
|
|
||||||
|
//可检通道转为字符串逗号分隔
|
||||||
|
// 确保 inspectChannel 是数组再执行 join
|
||||||
|
if (Array.isArray(formContent.inspectChannel)) {
|
||||||
|
formContent.inspectChannel = formContent.inspectChannel
|
||||||
|
.map(Number) // 将值转为数字以保证正确排序
|
||||||
|
.sort((a, b) => a - b) // 数字升序排序
|
||||||
|
.map(String) // 恢复为字符串用于保存
|
||||||
|
.join(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//保存时判是否加密,把识别码密钥字段清空
|
//保存时判是否加密,把识别码密钥字段清空
|
||||||
if (formContent.value.encryptionFlag === 0) {
|
if (formContent.encryptionFlag === 0) {
|
||||||
formContent.value.series = null
|
formContent.series = null
|
||||||
formContent.value.devKey = null
|
formContent.devKey = null
|
||||||
}
|
}
|
||||||
|
formContent.monitorList = monitor.value
|
||||||
|
|
||||||
if (formContent.value.id) {
|
if (titleType.value != 'add') {
|
||||||
await updatePqDev(formContent.value);
|
await updatePqDev(formContent);
|
||||||
ElMessage.success({message: `${dialogTitle.value}成功!`})
|
ElMessage.success({message: `${dialogTitle.value}成功!`})
|
||||||
} else {
|
} else {
|
||||||
// 新增需要把设备模式转成字典ID
|
// 新增需要把设备模式转成字典ID
|
||||||
const patternItem = dictStore.getDictData('Pattern').find(item => item.name === formContent.value.pattern);
|
const patternItem = dictStore.getDictData('Pattern').find(item => item.name === formContent.pattern);
|
||||||
if (patternItem) {
|
if (patternItem) {
|
||||||
formContent.value.pattern = patternItem.id;
|
formContent.pattern = patternItem.id;
|
||||||
}
|
}
|
||||||
// 新增需要把通讯协议转成字典ID
|
// 新增需要把通讯协议转成字典ID
|
||||||
const protocolItem = dictStore.getDictData('Protocol').find(item => item.name === formContent.value.protocol);
|
const protocolItem = dictStore.getDictData('Protocol').find(item => item.name === formContent.protocol);
|
||||||
if (protocolItem) {
|
if (protocolItem) {
|
||||||
formContent.value.protocol = protocolItem.id;
|
formContent.protocol = protocolItem.id;
|
||||||
}
|
}
|
||||||
await addPqDev(formContent.value);
|
await addPqDev(formContent);
|
||||||
ElMessage.success({message: `${dialogTitle.value}成功!`})
|
ElMessage.success({message: `${dialogTitle.value}成功!`})
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -385,92 +454,100 @@ const save = () => {
|
|||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = async (sign: string, data: Device.ResPqDev, currentMode: string, currentScene: string, devType: Device.ResDev[]) => {
|
const open = async (sign: string, data: Device.ResPqDev, currentMode: string, currentScene: string, devType: Device.ResDev[]) => {
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
devTypeOptions.value = devType
|
devTypeOptions.value = devType
|
||||||
mode.value = currentMode
|
mode.value = currentMode
|
||||||
scene.value = currentScene
|
scene.value = currentScene
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
activeTab.value = '0' // 强制回到第一个 tab
|
||||||
|
|
||||||
if (currentMode === '比对式') {
|
if (currentMode === '比对式') {
|
||||||
|
createDateTitle.value = '投运日期'
|
||||||
DevIsShow.value = false
|
DevIsShow.value = false
|
||||||
MonIsShow.value = true
|
MonIsShow.value = true
|
||||||
} else {
|
} else {
|
||||||
|
createDateTitle.value = '出厂日期'
|
||||||
DevIsShow.value = true
|
DevIsShow.value = true
|
||||||
MonIsShow.value = false
|
MonIsShow.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.encryptionFlag === 1) {
|
|
||||||
//handleEncryptionChange(1)
|
|
||||||
} else {
|
|
||||||
//handleEncryptionChange(0)
|
|
||||||
}
|
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
formContent.value = {...data}
|
updateDeviceByType(data.devType)
|
||||||
|
Object.assign(formContent,{ ...data })
|
||||||
|
if (typeof formContent.inspectChannel === 'string') {
|
||||||
|
formContent.inspectChannel = formContent.inspectChannel.split(',').filter(Boolean)
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
|
//只有比对式设备ID由前端传
|
||||||
|
if(currentMode === '比对式')
|
||||||
|
formContent.id = generateUUID().replaceAll("-","")
|
||||||
|
|
||||||
if(scene.value === '2'){
|
if(scene.value === '2'){
|
||||||
const manufacturers = dictStore.getDictData('Dev_Manufacturers');
|
const manufacturers = dictStore.getDictData('Dev_Manufacturers');
|
||||||
const nanjingCanxuan = manufacturers.find(item => item.name === '南京灿能');
|
const nanjingCanxuan = manufacturers.find(item => item.name === '南京灿能');
|
||||||
if (nanjingCanxuan) {
|
if (nanjingCanxuan) {
|
||||||
formContent.value.manufacturer = nanjingCanxuan.id;
|
formContent.manufacturer = nanjingCanxuan.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 设置默认设备参数
|
||||||
|
updateDeviceByType('') // 可传空或默认类型
|
||||||
|
}
|
||||||
|
|
||||||
//handleEncryptionChange(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置表单
|
|
||||||
dialogFormRef.value?.resetFields()
|
|
||||||
|
const updateDeviceByType = (devTypeId: string) => {
|
||||||
|
const dev = devTypeOptions.value.find(t => t.id === devTypeId)
|
||||||
|
if (dev) {
|
||||||
|
formContent.devChns = dev.devChns
|
||||||
|
formContent.devCurr = dev.devCurr
|
||||||
|
formContent.devVolt = dev.devVolt
|
||||||
|
formContent.icdId = dev.icd
|
||||||
|
formContent.power = dev.power
|
||||||
|
|
||||||
|
// 动态设置 pqChannelArray 从 1 到 dev.devChns.length
|
||||||
|
pqChannelArray.value = Array.from({ length: dev.devChns }, (_, i) => ({
|
||||||
|
value: String(i + 1),
|
||||||
|
label: String(i + 1),
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
// 默认值处理
|
||||||
|
formContent.devChns = 1
|
||||||
|
formContent.devCurr = 1
|
||||||
|
formContent.devVolt = 57.74
|
||||||
|
pqChannelArray.value = [{ value: '1', label: '1' }]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// const handleEncryptionChange = (value: number) => {
|
|
||||||
// // 根据是否加密来显示或隐藏识别码和密钥
|
|
||||||
// if(value === 1){
|
|
||||||
// IsPasswordShow.value = true
|
|
||||||
//
|
|
||||||
// }else
|
|
||||||
// {
|
|
||||||
// IsPasswordShow.value = false
|
|
||||||
// // formContent.value.series = ''
|
|
||||||
// // formContent.value.devKey = ''
|
|
||||||
// // rules.value.series = [];
|
|
||||||
// // rules.value.devKey = [];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
const handleDevTypeChange = (value: string) => {
|
const handleDevTypeChange = (value: string) => {
|
||||||
// 在这里处理选中事件的逻辑
|
updateDeviceByType(value)
|
||||||
const dev = devTypeOptions.value.find(t => t.id === value)
|
const maxChannel = formContent.devChns
|
||||||
if (dev) {
|
|
||||||
formContent.value.devChns = dev.devChns; // 默认值为1
|
|
||||||
formContent.value.devCurr = dev.devCurr; // 默认值为1
|
|
||||||
formContent.value.devVolt = dev.devVolt; // 默认值为1
|
|
||||||
formContent.value.icdId = dev.icd
|
|
||||||
formContent.value.power = dev.power
|
|
||||||
// if (dev.name.includes('882B')) {
|
|
||||||
// formContent.value.ip = '172.17.102.220'
|
|
||||||
// } else if (dev.name.includes('882A')) {
|
|
||||||
// formContent.value.ip = '172.17.102.221'
|
|
||||||
// } else {
|
|
||||||
// formContent.value.ip = '172.17.102.200'
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
// 过滤掉超出新通道数范围的选项
|
||||||
} else {
|
if (Array.isArray(formContent.inspectChannel)) {
|
||||||
formContent.value.devChns = 1; // 默认值为1
|
formContent.inspectChannel = formContent.inspectChannel.filter(
|
||||||
formContent.value.devCurr = 1; // 默认值为1
|
(channel) => parseInt(channel, 10) <= maxChannel
|
||||||
formContent.value.devVolt = 57.74; // 默认值为1
|
)
|
||||||
//formContent.value.ip = '172.17.102.200'
|
}
|
||||||
|
//切换设备类型时,删除超出最大通道数的监测点台账
|
||||||
|
monitor.value = monitor.value.filter(
|
||||||
|
(monitor) => parseInt(monitor.num.toString(), 10) <= maxChannel
|
||||||
|
)
|
||||||
|
formContent.monitorList = monitor.value
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const handleInput = (value: string) => {
|
const handleInput = (value: string) => {
|
||||||
// 在这里处理选中事件的逻辑
|
// 在这里处理选中事件的逻辑
|
||||||
if (scene.value === '1') {
|
if (scene.value === '1') {
|
||||||
formContent.value.name = value
|
formContent.name = value
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
239
frontend/src/views/machine/device/components/monitorPopup.vue
Normal file
239
frontend/src/views/machine/device/components/monitorPopup.vue
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 基础信息弹出框 -->
|
||||||
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" align-center>
|
||||||
|
<div>
|
||||||
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
||||||
|
<el-form-item label="名称" prop="name" >
|
||||||
|
<el-input v-model='formContent.name' placeholder="请输入监测点名称"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="线路号" prop="num" >
|
||||||
|
<el-select v-model="formContent.num" clearable placeholder="请选择线路号" @change="handleMonNumChange">
|
||||||
|
<el-option
|
||||||
|
v-for="item in lineNum"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="所属母线" prop="busbar" placeholder="请输入所属母线" >
|
||||||
|
<el-input v-model="formContent.busbar" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="PT变比" prop="pt" placeholder="请输入PT变比" >
|
||||||
|
<el-input v-model="formContent.pt" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="CT变比" prop="ct" placeholder="请输入CT变比" >
|
||||||
|
<el-input v-model="formContent.ct" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='接线方式' prop='connection' >
|
||||||
|
<el-select v-model="formContent.connection" clearable placeholder="请选择接线方式">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Dev_Connect')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='统计间隔' prop='statInterval' >
|
||||||
|
<el-select v-model="formContent.statInterval" clearable placeholder="请选择统计间隔">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Dev_Chns')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="谐波系统检测点id" prop="harmSysId" placeholder="请输入谐波系统检测点id" >
|
||||||
|
<el-input v-model="formContent.harmSysId" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="close()">取消</el-button>
|
||||||
|
<el-button type="primary" @click="save()" >
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import{ ElMessage, type FormInstance,type FormItemRule } from 'element-plus'
|
||||||
|
import type { ProTableInstance } from '@/components/ProTable/interface'
|
||||||
|
import { ref,computed, Ref, toRaw } from 'vue'
|
||||||
|
import { type Monitor } from '@/api/device/interface/monitor'
|
||||||
|
import {dialogMiddle} from '@/utils/elementBind'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { generateUUID } from '@/utils'
|
||||||
|
import { Device } from '@/api/device/interface/device'
|
||||||
|
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const lineNum = ref<{ id: number; name: string }[]>([])
|
||||||
|
const originalNum = ref<number | null>(null) // 存储编辑前的 num 值
|
||||||
|
const monitorTable = ref<any[]>()
|
||||||
|
// 定义弹出组件元信息
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
function useMetaInfo() {
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const titleType = ref('add')
|
||||||
|
const formContent = ref<Monitor.ResPqMon>({
|
||||||
|
id: '',
|
||||||
|
devId: '',
|
||||||
|
busbar: '',
|
||||||
|
name: '',
|
||||||
|
num: 1,
|
||||||
|
pt: '',
|
||||||
|
ct: '',
|
||||||
|
connection: '',
|
||||||
|
statInterval: 1,
|
||||||
|
harmSysId: '',
|
||||||
|
})
|
||||||
|
return { dialogVisible, titleType, formContent }
|
||||||
|
}
|
||||||
|
|
||||||
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
|
|
||||||
|
|
||||||
|
const emit = defineEmits(['get-parameter'])
|
||||||
|
// 清空formContent
|
||||||
|
const resetFormContent = () => {
|
||||||
|
formContent.value = {
|
||||||
|
id: '',
|
||||||
|
devId: '',
|
||||||
|
busbar: '',
|
||||||
|
name: '',
|
||||||
|
num: 1,
|
||||||
|
pt: '',
|
||||||
|
ct: '',
|
||||||
|
connection: '',
|
||||||
|
statInterval: 1,
|
||||||
|
harmSysId: '',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let dialogTitle = computed(() => {
|
||||||
|
return titleType.value === 'add' ? '新增监测点台账' : '编辑监测点台账'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//定义校验规则
|
||||||
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
|
name : [{ required: true, message: '监测点名称必填!', trigger: 'blur' }],
|
||||||
|
num:[ { required: true, message: '线路号必选', trigger: 'change' }],
|
||||||
|
pt: [
|
||||||
|
{ required: true, message: 'PT变比必填!', trigger: 'blur' },
|
||||||
|
{ pattern: /^[1-9]\d*:[1-9]\d*$/, message: 'PT变比格式应为 n:n 形式,例如 1:1', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
ct: [
|
||||||
|
{ required: true, message: 'CT变比必填!', trigger: 'blur' },
|
||||||
|
{ pattern: /^[1-9]\d*:[1-9]\d*$/, message: 'CT变比格式应为 n:n 形式,例如 1:1', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
connection: [{ required: true, message: '接线方式必选!', trigger: 'change' }],
|
||||||
|
busbar : [{ required: true, message: '所属母线必填!', trigger: 'blur' }],
|
||||||
|
harmSysId : [{ required: true, message: '谐波系统检测点id必填!', trigger: 'blur' }],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
|
try {
|
||||||
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
// 校验名称是否重复
|
||||||
|
const isNameDuplicate = monitorTable.value.some(
|
||||||
|
item => item.name === formContent.value.name && item.id !== formContent.value.id
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isNameDuplicate) {
|
||||||
|
ElMessage.error({ message: '监测点名称已存在,请重新输入!' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (titleType.value != 'edit')
|
||||||
|
{
|
||||||
|
formContent.value.id = generateUUID().replaceAll("-","")
|
||||||
|
}
|
||||||
|
emit('get-parameter', formContent.value)
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
console.error('验证过程中出现错误', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string, data: Monitor.ResPqMon,device: Device.ResPqDev,table: any[]) => {
|
||||||
|
// 重置表单
|
||||||
|
//dialogFormRef.value?.resetFields()
|
||||||
|
titleType.value = sign
|
||||||
|
dialogVisible.value = true
|
||||||
|
monitorTable.value = table|| []
|
||||||
|
// 提取 table 中已使用的 num(安全处理)
|
||||||
|
const usedNums = new Set<number>()
|
||||||
|
if (table && table.length > 0) {
|
||||||
|
table.forEach(item => {
|
||||||
|
if (item.num != null) {
|
||||||
|
usedNums.add(Number(item.num))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
lineNum.value = Array.from({ length: device.devChns }, (_, i) => {
|
||||||
|
const id = i + 1;
|
||||||
|
return {
|
||||||
|
id,
|
||||||
|
name: id.toString()
|
||||||
|
};
|
||||||
|
}).filter(item => !usedNums.has(item.id)); // 过滤掉已被使用的线路号
|
||||||
|
|
||||||
|
|
||||||
|
if (sign == 'edit') {
|
||||||
|
formContent.value = { ...data }
|
||||||
|
originalNum.value = data.num // 记录原始线路号
|
||||||
|
} else {
|
||||||
|
resetFormContent()
|
||||||
|
originalNum.value = null
|
||||||
|
// 设置默认选中第一个线路号
|
||||||
|
if (lineNum.value.length > 0) {
|
||||||
|
formContent.value.num = lineNum.value[0].id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formContent.value.devId = device.id
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const handleMonNumChange = (value: string) => {
|
||||||
|
const newValue = parseInt(value)
|
||||||
|
if (originalNum.value && originalNum.value !== newValue) {
|
||||||
|
// 将原来的 num 添加回 lineNum(表示释放)
|
||||||
|
lineNum.value.push({
|
||||||
|
id: originalNum.value,
|
||||||
|
name: originalNum.value.toString()
|
||||||
|
})
|
||||||
|
//移除新选择的 num(因为已被占用)
|
||||||
|
lineNum.value = lineNum.value.filter(item => item.id !== newValue).sort((a, b) => a.id - b.id)
|
||||||
|
|
||||||
|
// 更新 originalNum 为最新值,以便下次修改
|
||||||
|
originalNum.value = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -4,75 +4,189 @@
|
|||||||
<div class='table-box' ref='popupBaseView'>
|
<div class='table-box' ref='popupBaseView'>
|
||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
|
:pagination="false"
|
||||||
|
:toolButton="false"
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
:style="{ height: '326px',maxHeight: '400px',overflow:'hidden'}"
|
:data="tableData"
|
||||||
|
:style="{ height: '375px',maxHeight: '400px',overflow:'hidden'}"
|
||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button type='primary' :icon='CirclePlus'>新增</el-button>
|
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')" :disabled="props.DevFormContent.importFlag == 1">新增</el-button>
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>删除</el-button>
|
<el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation>
|
<template #operation="scope">
|
||||||
<el-button type='primary' link :icon='EditPen'>复制</el-button>
|
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' :model-value='false' :disabled="props.DevFormContent.importFlag == 1"
|
||||||
<el-button type='primary' link :icon='EditPen'>编辑</el-button>
|
@click="openDialog('edit', scope.row)">编辑
|
||||||
<el-button type='primary' link :icon='Delete'>删除</el-button>
|
</el-button>
|
||||||
|
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row.id)' >删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
|
<MonitorPopup @getParameter="getParameter" ref='monitorPopup'/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, defineProps, reactive } from 'vue';
|
import { ref, defineProps, reactive, watch } from 'vue';
|
||||||
import ProTable from '@/components/ProTable/index.vue'; // 假设 ProTable 是自定义组件
|
import ProTable from '@/components/ProTable/index.vue'; // 假设 ProTable 是自定义组件
|
||||||
import { CirclePlus, Delete, EditPen } from '@element-plus/icons-vue';
|
import { CirclePlus, Delete, EditPen, MessageBox } from '@element-plus/icons-vue';
|
||||||
import { getPqMonList } from '@/api/device/monitor'
|
|
||||||
import { type ColumnProps } from '@/components/ProTable/interface'
|
import MonitorPopup from '@/views/machine/device/components/monitorPopup.vue'
|
||||||
|
import { ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||||
import { type Monitor } from '@/api/device/interface/monitor'
|
import { type Monitor } from '@/api/device/interface/monitor'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict';
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData';
|
||||||
|
import { Device } from '@/api/device/interface/device';
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
|
|
||||||
// 定义 props
|
// 定义 props
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
MonIsShow: boolean;
|
MonIsShow: boolean;
|
||||||
|
DevFormContent:Device.ResPqDev
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const monitorPopup = ref()
|
||||||
|
const tableData = ref<any[]>([])
|
||||||
|
const title_Type = ref('add')
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Monitor.ResPqMon>[]>([
|
const columns = reactive<ColumnProps<Monitor.ResPqMon>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: '',
|
prop: 'name',
|
||||||
|
label: '名称',
|
||||||
|
width: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'busbar',
|
||||||
label: '所属母线',
|
label: '所属母线',
|
||||||
width: 200,
|
width: 200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: '',
|
prop: 'num',
|
||||||
label: '被检通道',
|
label: '线路号',
|
||||||
width: 200,
|
width: 200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: '',
|
prop: 'pt',
|
||||||
label: 'PT变比',
|
label: 'PT变比',
|
||||||
width: 110,
|
width: 110,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: '',
|
prop: 'ct',
|
||||||
label: 'CT变比',
|
label: 'CT变比',
|
||||||
width: 130,
|
width: 130,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: '',
|
prop: 'connection',
|
||||||
label: '接线方式',
|
label: '接线方式',
|
||||||
|
enum: dictStore.getDictData('Dev_Connect'),
|
||||||
|
fieldNames: {label: 'name', value: 'id'},
|
||||||
width: 130,
|
width: 130,
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: '',
|
prop: 'statInterval',
|
||||||
label: '谐波系统监测点ID',
|
label: '统计间隔',
|
||||||
minWidth: 250,
|
width: 130,
|
||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
const emit = defineEmits(['get-parameter'])
|
||||||
|
|
||||||
|
const getParameter = (data: Monitor.ResPqMon) => {
|
||||||
|
if (title_Type.value === 'edit') {
|
||||||
|
// 编辑:替换已有的数据
|
||||||
|
const index = tableData.value.findIndex(item => item.id === data.id)
|
||||||
|
if (index > -1) {
|
||||||
|
tableData.value = [
|
||||||
|
...tableData.value.slice(0, index),
|
||||||
|
data,
|
||||||
|
...tableData.value.slice(index + 1)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 新增:追加数据
|
||||||
|
tableData.value = [...tableData.value, data]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
emit('get-parameter', tableData.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 打开 drawer(新增、编辑)
|
||||||
|
const openDialog = (titleType: string, row: Partial<Monitor.ResPqMon> = {}) => {
|
||||||
|
if(props.DevFormContent.devType == '' || props.DevFormContent.devType == undefined){
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'请先选择被检设备类型',
|
||||||
|
'提示',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
title_Type.value = titleType
|
||||||
|
monitorPopup.value?.open(titleType, row,props.DevFormContent,tableData.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 批量删除监测点台账
|
||||||
|
const batchDelete = (ids: string[]) => {
|
||||||
|
ElMessageBox.confirm(`是否批量删除监测点?`, "温馨提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
draggable: true
|
||||||
|
}).then(async () => {
|
||||||
|
tableData.value = tableData.value.filter(item => !ids.includes(item.id));
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
|
||||||
|
ElMessage({
|
||||||
|
type: "success",
|
||||||
|
message: `批量删除监测点成功!`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除监测点台账
|
||||||
|
const handleDelete = (id: string) => {
|
||||||
|
ElMessageBox.confirm(`是否删除监测点?`, "温馨提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
draggable: true
|
||||||
|
}).then(async () => {
|
||||||
|
tableData.value = tableData.value.filter(item => item.id !== id)
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
ElMessage({
|
||||||
|
type: "success",
|
||||||
|
message: `删除监测点成功!`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.DevFormContent.monitorList,
|
||||||
|
(newVal) => {
|
||||||
|
tableData.value = newVal|| []
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ import {type ColumnProps, type ProTableInstance} from '@/components/ProTable/int
|
|||||||
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
||||||
import {CirclePlus, Delete, Download, EditPen, Upload} from '@element-plus/icons-vue'
|
import {CirclePlus, Delete, Download, EditPen, Upload} from '@element-plus/icons-vue'
|
||||||
import {useDictStore} from '@/stores/modules/dict'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
import {deletePqDev, downloadTemplate, exportPqDev, getPqDev, getPqDevList, importPqDev} from '@/api/device/device/index.ts'
|
import {deletePqDev, downloadTemplate, exportPqDev, getPqDev, getPqDevList, importPqDev,getPqDevById} from '@/api/device/device/index.ts'
|
||||||
import {ElMessageBox} from 'element-plus'
|
import {ElMessageBox} from 'element-plus'
|
||||||
import {onBeforeMount, reactive, ref} from 'vue'
|
import {onBeforeMount, reactive, ref} from 'vue'
|
||||||
import {useAppSceneStore, useModeStore} from '@/stores/modules/mode'
|
import {useAppSceneStore, useModeStore} from '@/stores/modules/mode'
|
||||||
@@ -65,11 +65,10 @@ const boundPqDevList = ref<Device.ReqPqDevParams[]>([])//根据检测计划id查
|
|||||||
// 存储设备类型选项
|
// 存储设备类型选项
|
||||||
const devTypeOptions = ref<Device.ResDev[]>([])
|
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||||
|
|
||||||
|
|
||||||
const getTableList = async (params: any) => {
|
const getTableList = async (params: any) => {
|
||||||
let newParams = JSON.parse(JSON.stringify(params))
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
newParams.searchEndTime = endDate.value
|
// newParams.searchEndTime = endDate.value
|
||||||
newParams.searchBeginTime = startDate.value
|
// newParams.searchBeginTime = startDate.value
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||||
newParams.pattern = patternId
|
newParams.pattern = patternId
|
||||||
return getPqDevList(newParams)
|
return getPqDevList(newParams)
|
||||||
@@ -102,25 +101,11 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'createDate',
|
prop: 'createDate',
|
||||||
label: '出厂日期',
|
label: modeStore.currentMode === '比对式' ? '投运日期' : '出厂日期',
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
isShow: appSceneStore.currentScene === '0',
|
isShow: appSceneStore.currentScene === '0',
|
||||||
...(appSceneStore.currentScene === '0' ? {
|
// ...(appSceneStore.currentScene === '0' ? {
|
||||||
search: {
|
|
||||||
render: () => {
|
|
||||||
return (
|
|
||||||
<div class='flx-flex-start'>
|
|
||||||
<TimeControl
|
|
||||||
default={'月'}
|
|
||||||
onUpdate-dates={handleDateChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} : {}),
|
|
||||||
// search: {
|
// search: {
|
||||||
// span: 2,
|
|
||||||
// render: () => {
|
// render: () => {
|
||||||
// return (
|
// return (
|
||||||
// <div class='flx-flex-start'>
|
// <div class='flx-flex-start'>
|
||||||
@@ -132,24 +117,25 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
// )
|
// )
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
|
// } : {}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'devChns',
|
prop: 'devChns',
|
||||||
label: '通道数',
|
label: '通道数',
|
||||||
minWidth: 110,
|
minWidth: 110,
|
||||||
|
isShow: modeStore.currentMode != '比对式',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'devVolt',
|
prop: 'devVolt',
|
||||||
label: '额定电压(V)',
|
label: '额定电压(V)',
|
||||||
minWidth: 130,
|
minWidth: 130,
|
||||||
|
isShow: modeStore.currentMode != '比对式',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'devCurr',
|
prop: 'devCurr',
|
||||||
label: '额定电流(A)',
|
label: '额定电流(A)',
|
||||||
minWidth: 130,
|
minWidth: 130,
|
||||||
|
isShow: modeStore.currentMode != '比对式',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'ip',
|
prop: 'ip',
|
||||||
@@ -167,6 +153,20 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
} : {}),
|
} : {}),
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'gdName',
|
||||||
|
label: '供电公司',
|
||||||
|
isShow: modeStore.currentMode === '比对式',
|
||||||
|
search: {el: 'input'},
|
||||||
|
minWidth: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'subName',
|
||||||
|
label: '变电站',
|
||||||
|
isShow: modeStore.currentMode === '比对式',
|
||||||
|
search: {el: 'input'},
|
||||||
|
minWidth: 200,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'createTime',
|
prop: 'createTime',
|
||||||
label: '创建时间',
|
label: '创建时间',
|
||||||
@@ -197,8 +197,14 @@ const handleDateChange = (startDateTemp: string, endDateTemp: string) => {
|
|||||||
endDate.value = endDateTemp
|
endDate.value = endDateTemp
|
||||||
}
|
}
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
const openDialog = async (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
||||||
|
if(titleType === 'add'){
|
||||||
devicePopup.value?.open(titleType, row, modeStore.currentMode, appSceneStore.currentScene, devTypeOptions.value)
|
devicePopup.value?.open(titleType, row, modeStore.currentMode, appSceneStore.currentScene, devTypeOptions.value)
|
||||||
|
}else{
|
||||||
|
row = await getPqDevById(row)
|
||||||
|
devicePopup.value?.open(titleType, row.data, modeStore.currentMode, appSceneStore.currentScene, devTypeOptions.value)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -238,17 +244,6 @@ const downloadFile = async () => {
|
|||||||
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
||||||
|
|
||||||
const importFile = async (pattern: string) => {
|
const importFile = async (pattern: string) => {
|
||||||
|
|
||||||
if (pattern === '比对式') {
|
|
||||||
// const params = {
|
|
||||||
// title: '被检设备',
|
|
||||||
// showCover: false,
|
|
||||||
// tempApi: downloadTemplate,
|
|
||||||
// importApi: importPqDev,
|
|
||||||
// getTableList: proTable.value?.getTableList,
|
|
||||||
// }
|
|
||||||
// deviceImportExcel.value?.acceptParams(params)
|
|
||||||
} else {
|
|
||||||
const params = {
|
const params = {
|
||||||
title: '被检设备',
|
title: '被检设备',
|
||||||
showCover: false,
|
showCover: false,
|
||||||
@@ -259,7 +254,7 @@ const importFile = async (pattern: string) => {
|
|||||||
getTableList: proTable.value?.getTableList,
|
getTableList: proTable.value?.getTableList,
|
||||||
}
|
}
|
||||||
deviceImportExcel.value?.acceptParams(params)
|
deviceImportExcel.value?.acceptParams(params)
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" align-center>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<el-table :data="errorData.value"
|
<el-table :data="errorData.value"
|
||||||
height="500"
|
height="500"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1660px">
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1660px" align-center>
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="基础信息">
|
<el-tab-pane label="基础信息">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogSmall" @close="close" >
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogSmall" @close="close" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules'>
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules'>
|
||||||
<el-form-item label="名称" prop="name" >
|
<el-form-item label="名称" prop="name" >
|
||||||
|
|||||||
@@ -0,0 +1,306 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" align-center>
|
||||||
|
<el-tabs type="border-card">
|
||||||
|
<el-tab-pane label="设备台账信息">
|
||||||
|
<div >
|
||||||
|
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' :disabled="false" label-width="auto" class="form-three">
|
||||||
|
<el-divider >设备信息</el-divider>
|
||||||
|
|
||||||
|
<el-form-item label="设备名称" prop="name" >
|
||||||
|
<el-input v-model='formContent.name' placeholder="请输入设备名称" maxlength="32" show-word-limit/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='设备类型' prop='devType' >
|
||||||
|
<el-select v-model="formContent.devType" filterable clearable placeholder="请选择设备类型" @change="handleDevTypeChange">
|
||||||
|
<el-option
|
||||||
|
v-for="item in devTypeOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='设备厂家' prop='manufacturer'>
|
||||||
|
<el-select v-model="formContent.manufacturer" clearable placeholder="请选择设备厂家">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Dev_Manufacturers')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-divider >参数信息</el-divider>
|
||||||
|
|
||||||
|
<el-form-item label='可检通道数' prop='inspectChannel' :label-width='100'>
|
||||||
|
<el-select v-model="formContent.inspectChannel" multiple collapse-tags :max-collapse-tags="4" placeholder="请选择可检通道数" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="(option, index) in pqChannelArray"
|
||||||
|
:key="index"
|
||||||
|
:label="option.label"
|
||||||
|
:value="option.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='通讯协议' prop='protocol'>
|
||||||
|
<el-select v-model="formContent.protocol" clearable placeholder="请选择通讯协议">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('Protocol')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="IP地址" prop="ip" placeholder="请输入IP地址">
|
||||||
|
<el-input v-model="formContent.ip"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="端口号" prop="port" placeholder="请输入端口号" >
|
||||||
|
<el-input v-model="formContent.port" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='是否加密' prop='encryptionFlag' >
|
||||||
|
<el-select v-model="formContent.encryptionFlag" clearable placeholder="请选择是否加密">
|
||||||
|
<el-option label="是" :value="1"></el-option>
|
||||||
|
<el-option label="否" :value="0"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='识别码' prop='series' clearable v-if="formContent.encryptionFlag">
|
||||||
|
<el-input v-model='formContent.series' placeholder="请输入识别码" show-password/>
|
||||||
|
</el-form-item>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<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 IPAddress from '@/components/IpAddress/index.vue'
|
||||||
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
|
import {type StandardDevice} from '@/api/device/interface/standardDevice.ts'
|
||||||
|
import { ElMessage, type FormItemRule } from 'element-plus'
|
||||||
|
import { addPqStandardDev, updatePqStandardDev} from '@/api/device/standardDevice/index.ts'
|
||||||
|
import { computed, reactive, type Ref, ref } from 'vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { CirclePlus, Delete, EditPen } from '@element-plus/icons-vue'
|
||||||
|
import {type Device} from '@/api/device/interface/device.ts'
|
||||||
|
// 使用 dayjs 库格式化
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
|
// 存储设备类型选项
|
||||||
|
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
// 定义弹出组件元信息
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
|
||||||
|
const pqChannelArray = ref([
|
||||||
|
{
|
||||||
|
value: '1',
|
||||||
|
label: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '2',
|
||||||
|
label: '2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '3',
|
||||||
|
label: '3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '4',
|
||||||
|
label: '4',
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
function useMetaInfo() {
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const titleType = ref('add')
|
||||||
|
const formContent = reactive<StandardDevice.ResPqStandardDevice>({
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
devType:'',
|
||||||
|
manufacturer:'',
|
||||||
|
protocol: 'MMS',
|
||||||
|
ip: '',
|
||||||
|
port: 102,
|
||||||
|
inspectChannel:'',
|
||||||
|
encryptionFlag: 0,
|
||||||
|
state: 1,
|
||||||
|
})
|
||||||
|
return { dialogVisible, titleType, formContent }
|
||||||
|
}
|
||||||
|
|
||||||
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
|
// 清空formContent
|
||||||
|
const resetFormContent = () => {
|
||||||
|
Object.assign(
|
||||||
|
formContent,{
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
devType:'',
|
||||||
|
manufacturer:'',
|
||||||
|
protocol: 'MMS',
|
||||||
|
ip: '',
|
||||||
|
port: 102,
|
||||||
|
inspectChannel:'',
|
||||||
|
encryptionFlag: 0,
|
||||||
|
state: 1,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let dialogTitle = computed(() => {
|
||||||
|
return titleType.value === 'add' ? '新增标准设备' : '编辑标准设备'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
//定义校验规则
|
||||||
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
|
name : [{ required: true, message: '设备名称必填!', trigger: 'blur' }],
|
||||||
|
devType: [{ required: true, message: '设备类型必选!', trigger: 'change' }],
|
||||||
|
manufacturer:[{ required: true, message: '生产厂家必选!', trigger: 'change' }],
|
||||||
|
ip: [
|
||||||
|
{ required: true, message: 'IP地址必填!', trigger: 'blur' },
|
||||||
|
{ pattern: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, message: 'IP地址格式错误', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
port: [
|
||||||
|
{ required: true, message: '端口号必填!', trigger: 'blur' },
|
||||||
|
{ pattern: /^(6553[0-5]|655[0-2][0-9]|64[0-9]{3}|[1-5]?[0-9]{1,4})$/, message: '端口号范围0到65535的整数', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
inspectChannel:[ { required: true, message: '可检通道数必选', trigger: 'change' }],
|
||||||
|
encryptionFlag: [{ required: true, message: '是否加密必选!', trigger: 'change' }],
|
||||||
|
series: [{ required: true, message: '请输入识别码', trigger: 'blur' }],
|
||||||
|
devKey: [{ required: true, message: '请输入密钥', trigger: 'blur' }],
|
||||||
|
protocol: [{required: true, message: '通讯协议必选!', trigger: 'change'}],
|
||||||
|
})
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 清空dialogForm中的值
|
||||||
|
resetFormContent()
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
|
try {
|
||||||
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (formContent.encryptionFlag === 0) {
|
||||||
|
formContent.series = ''
|
||||||
|
formContent.devKey = ''
|
||||||
|
}
|
||||||
|
if (valid) {
|
||||||
|
//保存时判是否加密,把识别码密钥字段清空
|
||||||
|
if(formContent.encryptionFlag === 0){
|
||||||
|
formContent.series = null
|
||||||
|
formContent.devKey = null
|
||||||
|
}
|
||||||
|
|
||||||
|
//可检通道转为字符串逗号分隔
|
||||||
|
// 确保 inspectChannel 是数组再执行 join
|
||||||
|
if (Array.isArray(formContent.inspectChannel)) {
|
||||||
|
formContent.inspectChannel = formContent.inspectChannel
|
||||||
|
.map(Number) // 将值转为数字以保证正确排序
|
||||||
|
.sort((a, b) => a - b) // 数字升序排序
|
||||||
|
.map(String) // 恢复为字符串用于保存
|
||||||
|
.join(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (formContent.id) {
|
||||||
|
await updatePqStandardDev(formContent);
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// 新增需要把通讯协议转成字典ID
|
||||||
|
const protocolItem = dictStore.getDictData('Protocol').find(item => item.name === formContent.protocol);
|
||||||
|
if (protocolItem) {
|
||||||
|
formContent.protocol = protocolItem.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
await addPqStandardDev(formContent);
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
}
|
||||||
|
close()
|
||||||
|
// 刷新表格
|
||||||
|
await props.refreshTable!()
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
console.error('验证过程中出现错误', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string, data: StandardDevice.ResPqStandardDevice,devType:Device.ResDev[]) => {
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
devTypeOptions.value = devType
|
||||||
|
titleType.value = sign
|
||||||
|
if (data.id) {
|
||||||
|
Object.assign(formContent,{ ...data })
|
||||||
|
if (typeof formContent.inspectChannel === 'string') {
|
||||||
|
formContent.inspectChannel = formContent.inspectChannel.split(',').filter(Boolean)
|
||||||
|
}
|
||||||
|
handleDevTypeChange(data.devType)
|
||||||
|
} else {
|
||||||
|
resetFormContent()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleDevTypeChange = (value: string) => {
|
||||||
|
// 在这里处理选中事件的逻辑
|
||||||
|
const dev = devTypeOptions.value.find(t =>t.id === value)
|
||||||
|
if (dev) {
|
||||||
|
const maxChannel = dev.devChns
|
||||||
|
// 动态设置 pqChannelArray 从 1 到 dev.devChns.length
|
||||||
|
pqChannelArray.value = Array.from({ length: dev.devChns }, (_, i) => ({
|
||||||
|
value: String(i + 1),
|
||||||
|
label: String(i + 1),
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 过滤掉超出新通道数范围的选项
|
||||||
|
if (Array.isArray(formContent.inspectChannel)) {
|
||||||
|
formContent.inspectChannel = formContent.inspectChannel.filter(
|
||||||
|
(channel) => parseInt(channel, 10) <= maxChannel
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 可选:恢复默认值
|
||||||
|
pqChannelArray.value = [
|
||||||
|
{ value: '1', label: '1' },
|
||||||
|
{ value: '2', label: '2' },
|
||||||
|
{ value: '3', label: '3' },
|
||||||
|
{ value: '4', label: '4' },
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
const props = defineProps<{
|
||||||
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
229
frontend/src/views/machine/standardDevice/index.vue
Normal file
229
frontend/src/views/machine/standardDevice/index.vue
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
<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>
|
||||||
|
<el-button v-auth.device="'export'" type='primary' :icon='Upload' plain @click='downloadFile()'>导出</el-button>
|
||||||
|
<el-button v-auth.device="'import'" type='primary' :icon='Download' plain @click="importFile()">导入
|
||||||
|
</el-button>
|
||||||
|
</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>
|
||||||
|
<StandardDevicePopup :refresh-table='proTable?.getTableList' ref='standardDevicePopup'/>
|
||||||
|
<ImportExcel ref='deviceImportExcel'/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='useRole'>
|
||||||
|
import {type StandardDevice} from '@/api/device/interface/standardDevice.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 StandardDevicePopup from '@/views/machine/standardDevice/components/standardDevicePopup.vue'
|
||||||
|
import {CirclePlus, Delete, Download, EditPen, Upload} from '@element-plus/icons-vue'
|
||||||
|
import {deletePqStandardDev, getPqStandardDevList,getPqStandardDevById,exportPqStandardDev,downloadTemplate,importPqStandardDev} from '@/api/device/standardDevice/index.ts'
|
||||||
|
import {computed, onBeforeMount, reactive, ref} from 'vue'
|
||||||
|
import { getPqDev} from '@/api/device/device/index.ts'
|
||||||
|
import {type Device} from '@/api/device/interface/device.ts'
|
||||||
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
|
import { ElMessageBox } from 'element-plus'
|
||||||
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
const standardDevicePopup = ref()
|
||||||
|
// 存储设备类型选项
|
||||||
|
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
|
|
||||||
|
const getTableList = async (params: any) => {
|
||||||
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
|
|
||||||
|
return getPqStandardDevList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<StandardDevice.ResPqStandardDevice>[]>([
|
||||||
|
{type: 'selection', fixed: 'left', width: 70},
|
||||||
|
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||||
|
{
|
||||||
|
prop: 'name',
|
||||||
|
label: '名称',
|
||||||
|
search: {el: 'input'},
|
||||||
|
minWidth: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'devType',
|
||||||
|
label: '设备类型',
|
||||||
|
enum:computed(() => {
|
||||||
|
return devTypeOptions.value.map(item => ({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
icd: item.icd,
|
||||||
|
power: item.power,
|
||||||
|
devVolt: item.devVolt,
|
||||||
|
devCurr: item.devCurr,
|
||||||
|
devChns: item.devChns,
|
||||||
|
}))
|
||||||
|
}),
|
||||||
|
search: {el: 'select', props: {filterable: true}, order: 1},
|
||||||
|
fieldNames: {label: 'name', value: 'id'},
|
||||||
|
render: (scope) => {
|
||||||
|
// 查找设备类型名称
|
||||||
|
const name = devTypeOptions.value.find(option => option.id === scope.row.devType)
|
||||||
|
return <span>{name?.name}</span>
|
||||||
|
},
|
||||||
|
minWidth: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'inspectChannel',
|
||||||
|
label: '可检通道',
|
||||||
|
minWidth: 150,
|
||||||
|
render: (scope) => {
|
||||||
|
const codes = scope.row.inspectChannel // 获取当前行的 datasourceIds 字段
|
||||||
|
if (!codes) {
|
||||||
|
return '/'
|
||||||
|
}
|
||||||
|
// 确保 codes 是一个字符串
|
||||||
|
const codeString = Array.isArray(codes) ? codes.join(',') : codes
|
||||||
|
const codeArray = codeString.split(',')
|
||||||
|
return codeArray.length > 1 ? codeArray.join(', ') : codeArray[0]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'ip',
|
||||||
|
label: 'IP地址',
|
||||||
|
minWidth: 110,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'manufacturer',
|
||||||
|
label: '设备厂家',
|
||||||
|
enum: dictStore.getDictData('Dev_Manufacturers'),
|
||||||
|
search: {el: 'select', props: {filterable: true}, order: 1},
|
||||||
|
fieldNames: {label: 'name', value: 'id'},
|
||||||
|
minWidth: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'createTime',
|
||||||
|
label: '创建时间',
|
||||||
|
minWidth: 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},
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const formContent = reactive<StandardDevice.ResPqStandardDevice>({
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
devType:'',
|
||||||
|
manufacturer:'',
|
||||||
|
hardwareVersion: '',
|
||||||
|
softwareVersion: '',
|
||||||
|
ip: '172.17.102.200',
|
||||||
|
port: 102,
|
||||||
|
inspectChannel:'',
|
||||||
|
encryptionFlag: 0,
|
||||||
|
state: 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 打开 drawer(新增、编辑)
|
||||||
|
const openDialog = async (titleType: string, row: Partial<StandardDevice.ResPqStandardDevice> = {}) => {
|
||||||
|
if(titleType === 'add'){
|
||||||
|
row = formContent
|
||||||
|
standardDevicePopup.value?.open(titleType, row,devTypeOptions.value)
|
||||||
|
}else{
|
||||||
|
row = await getPqStandardDevById(row)
|
||||||
|
standardDevicePopup.value?.open(titleType, row.data,devTypeOptions.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 批量删除设备
|
||||||
|
const batchDelete = async (id: string[]) => {
|
||||||
|
await useHandleData(deletePqStandardDev, id, '删除所选设备')
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除设备
|
||||||
|
const handleDelete = async (params: StandardDevice.ResPqStandardDevice) => {
|
||||||
|
await useHandleData(deletePqStandardDev, [params.id] , `删除【${params.name}】设备`)
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 导出设备
|
||||||
|
const downloadFile = async () => {
|
||||||
|
ElMessageBox.confirm('确认导出标准设备?', '温馨提示', {type: 'warning'}).then(() => {
|
||||||
|
useDownload(exportPqStandardDev, '标准设备导出数据', {...proTable.value?.searchParam}, false, '.xlsx')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//导入设备
|
||||||
|
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
||||||
|
|
||||||
|
const importFile = async () => {
|
||||||
|
const params = {
|
||||||
|
title: '标准设备',
|
||||||
|
showCover: false,
|
||||||
|
tempApi: downloadTemplate,
|
||||||
|
importApi: importPqStandardDev,
|
||||||
|
getTableList: proTable.value?.getTableList,
|
||||||
|
}
|
||||||
|
console.log(params)
|
||||||
|
deviceImportExcel.value?.acceptParams(params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
const response = await getPqDev()
|
||||||
|
devTypeOptions.value = (response.data as Device.ResDev[]).map(item => ({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
icd: item.icd,
|
||||||
|
power: item.power,
|
||||||
|
devVolt: item.devVolt,
|
||||||
|
devCurr: item.devCurr,
|
||||||
|
devChns: item.devChns,
|
||||||
|
}))
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="dialogVisible" :title="dialogTitle"
|
<el-dialog v-model="dialogVisible" :title="dialogTitle"
|
||||||
v-bind="dialogSmall" @close="close">
|
v-bind="dialogSmall" @close="close" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent" ref="dialogFormRef" :rules="rules">
|
<el-form :model="formContent" ref="dialogFormRef" :rules="rules">
|
||||||
<el-form-item label="参数所属" prop="pId" :label-width="100">
|
<el-form-item label="参数所属" prop="pId" :label-width="100">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" align-center>
|
||||||
<div >
|
<div >
|
||||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' :disabled="tableIsDisable" label-width="auto" class="form-three">
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' :disabled="tableIsDisable" label-width="auto" class="form-three">
|
||||||
<el-form-item label="设备类型" prop="devType" >
|
<el-form-item label="设备类型" prop="devType" >
|
||||||
|
|||||||
330
frontend/src/views/plan/planList/components/chidrenPlan.vue
Normal file
330
frontend/src/views/plan/planList/components/chidrenPlan.vue
Normal file
@@ -0,0 +1,330 @@
|
|||||||
|
<!--单列-->
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
class="table-box"
|
||||||
|
v-model="dialogVisible"
|
||||||
|
top="114px"
|
||||||
|
:style="{ height: height + 'px', maxHeight: height + 'px', overflow: 'hidden' }"
|
||||||
|
:title="title"
|
||||||
|
:width="width"
|
||||||
|
:modal="false"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="table-box"
|
||||||
|
:style="{ height: height - 64 + 'px', maxHeight: height - 64 + 'px', overflow: 'hidden' }"
|
||||||
|
>
|
||||||
|
<div style="margin-bottom: 20px">
|
||||||
|
<el-button type="primary" :icon="CirclePlus" @click="addTab(editableTabsValue)">新增计划</el-button>
|
||||||
|
</div>
|
||||||
|
<el-tabs
|
||||||
|
v-model="editableTabsValue"
|
||||||
|
type="card"
|
||||||
|
class="demo-tabs"
|
||||||
|
closable
|
||||||
|
@tab-remove="removeTab"
|
||||||
|
>
|
||||||
|
<el-tab-pane
|
||||||
|
v-for="item in editableTabs"
|
||||||
|
:key="item.name"
|
||||||
|
:label="item.title"
|
||||||
|
:name="item.name"
|
||||||
|
>
|
||||||
|
<ProTable
|
||||||
|
ref="proTable"
|
||||||
|
:columns="item.columns"
|
||||||
|
:data="item.tableData"
|
||||||
|
type="selection"
|
||||||
|
style="height: 750px;"
|
||||||
|
>
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader="scope">
|
||||||
|
<el-button type="primary" :icon="Delete" v-if="item.name == '1'">
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" :icon="Delete" v-if="item.name != '1'">
|
||||||
|
导出检测方案
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" :icon="Delete" >
|
||||||
|
导入检测结果
|
||||||
|
</el-button>
|
||||||
|
<el-button type="danger" :icon="Delete" plain :disabled="!scope.isSelected">
|
||||||
|
批量移除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 表格操作 -->
|
||||||
|
<template #operation="scope">
|
||||||
|
<el-button type="primary" link :icon="Delete" v-if="item.name == '1'">删除</el-button>
|
||||||
|
<el-button type="primary" link :icon="Delete" v-if="item.name != '1'">移除</el-button>
|
||||||
|
</template>
|
||||||
|
</ProTable>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="tsx">
|
||||||
|
import { TabPaneName } from 'element-plus'
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import { CirclePlus, Delete } from '@element-plus/icons-vue'
|
||||||
|
const sourceDataList = [
|
||||||
|
{
|
||||||
|
id: 'device1',
|
||||||
|
name:"电能质量监测仪A001",
|
||||||
|
type:"PQS-882A",
|
||||||
|
date:"2022-05-05",
|
||||||
|
channel: "2",
|
||||||
|
vol: "57.74",
|
||||||
|
cur: "5",
|
||||||
|
company: "南京灿能",
|
||||||
|
state: 0,
|
||||||
|
check:1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'device2',
|
||||||
|
name:"电能质量监测仪A002",
|
||||||
|
type:"PQS-882B4",
|
||||||
|
date:"2022-05-05",
|
||||||
|
channel: "4",
|
||||||
|
vol: "57.74",
|
||||||
|
cur: "5",
|
||||||
|
company: "南京灿能",
|
||||||
|
state: 1,
|
||||||
|
check:2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'device3',
|
||||||
|
name:"电能质量监测仪A003",
|
||||||
|
type:"PQS-882B4",
|
||||||
|
date:"2022-05-05",
|
||||||
|
channel: "4",
|
||||||
|
vol: "57.74",
|
||||||
|
cur: "5",
|
||||||
|
company: "南京灿能",
|
||||||
|
state: 1,
|
||||||
|
check:2,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
const sourceDataList2 = [
|
||||||
|
{
|
||||||
|
id: 'device1',
|
||||||
|
name:"电能质量监测仪A003",
|
||||||
|
type:"PQS-882A",
|
||||||
|
date:"2022-05-05",
|
||||||
|
channel: "2",
|
||||||
|
vol: "57.74",
|
||||||
|
cur: "5",
|
||||||
|
company: "南京灿能",
|
||||||
|
state: 0,
|
||||||
|
check:1,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
// 初始数据源
|
||||||
|
const SourceData = sourceDataList
|
||||||
|
const SourceData2 = sourceDataList2
|
||||||
|
// 控制弹窗显示与标题
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const title = ref('')
|
||||||
|
const planTitle = ref('')
|
||||||
|
// tab 相关
|
||||||
|
let tabIndex = 2
|
||||||
|
const editableTabsValue = ref('2')
|
||||||
|
const editableTabs = ref([
|
||||||
|
{
|
||||||
|
title: planTitle,
|
||||||
|
name: '1',
|
||||||
|
content: 'Tab 1 content',
|
||||||
|
tableData: [...SourceData],
|
||||||
|
columns: [
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'name',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 180,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'type',
|
||||||
|
label: '设备类型',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'date',
|
||||||
|
label: '出厂日期',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'channel',
|
||||||
|
label: '通道数',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'vol',
|
||||||
|
label: '额定电压V',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'cur',
|
||||||
|
label: '额定电流A',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'company',
|
||||||
|
label: '设备厂家',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'state',
|
||||||
|
label: '分配状态',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
render: () => {
|
||||||
|
return (
|
||||||
|
<el-tag type='success' effect="dark">已分配</el-tag>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'check',
|
||||||
|
label: '检测状态',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
render: (scope: { row: { check: number } }) => {
|
||||||
|
return (
|
||||||
|
scope.row.check === 0 ? <el-tag type='warning' effect="dark">未检</el-tag> :
|
||||||
|
scope.row.check === 1 ? <el-tag type='danger' effect="dark">检测中</el-tag> :
|
||||||
|
<el-tag type='success' effect="dark">检测完成</el-tag>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 100 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '子计划',
|
||||||
|
name: '2',
|
||||||
|
content: 'Tab 2 content',
|
||||||
|
tableData: [...SourceData2],
|
||||||
|
columns: [
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'name',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 180,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'type',
|
||||||
|
label: '设备类型',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'date',
|
||||||
|
label: '出厂日期',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'channel',
|
||||||
|
label: '通道数',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'vol',
|
||||||
|
label: '额定电压V',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'cur',
|
||||||
|
label: '额定电流A',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'company',
|
||||||
|
label: '设备厂家',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'check',
|
||||||
|
label: '检测状态',
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
render: (scope: { row: { check: number } }) => {
|
||||||
|
return (
|
||||||
|
scope.row.check === 0 ? <el-tag type='warning' effect="dark">未检</el-tag> :
|
||||||
|
scope.row.check === 1 ? <el-tag type='danger' effect="dark">检测中</el-tag> :
|
||||||
|
<el-tag type='success' effect="dark">检测完成</el-tag>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 100 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
// 新增 tab 方法
|
||||||
|
const addTab = (targetName: string) => {
|
||||||
|
const newTabName = `${++tabIndex}`
|
||||||
|
editableTabs.value.push({
|
||||||
|
title: '子计划',
|
||||||
|
name: newTabName,
|
||||||
|
content: 'New Tab content',
|
||||||
|
tableData: [], // 每个 tab 独立的数据副本
|
||||||
|
columns: [...editableTabs.value[0].columns], // 复用已有列配置
|
||||||
|
})
|
||||||
|
editableTabsValue.value = newTabName
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除 tab 方法
|
||||||
|
const removeTab = (targetName: TabPaneName) => {
|
||||||
|
const tabs = editableTabs.value
|
||||||
|
let activeName = editableTabsValue.value
|
||||||
|
if (activeName === targetName) {
|
||||||
|
tabs.forEach((tab, index) => {
|
||||||
|
if (tab.name === targetName) {
|
||||||
|
const nextTab = tabs[index + 1] || tabs[index - 1]
|
||||||
|
if (nextTab) {
|
||||||
|
activeName = nextTab.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
editableTabsValue.value = activeName
|
||||||
|
editableTabs.value = tabs.filter((tab) => tab.name !== targetName)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 弹窗打开方法
|
||||||
|
const open = (textTitle: string,planName: string) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
title.value = textTitle
|
||||||
|
planTitle.value = planName
|
||||||
|
}
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
// props
|
||||||
|
const props = defineProps({
|
||||||
|
width: {
|
||||||
|
type: Number,
|
||||||
|
default: 800,
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: Number,
|
||||||
|
default: 744,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-row :gutter="24">
|
<el-row :gutter="24">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button type='primary' v-auth.plan="'import'" :icon='Download' @click='importClick'>导入</el-button>
|
<el-button type='primary' v-auth.plan="'import'" :icon='Download' @click='importClick' v-if="modeStore.currentMode != '比对式'">导入</el-button>
|
||||||
<el-button type='primary' v-auth.plan="'export'" :icon='Upload' @click='exportClick'>导出</el-button>
|
<el-button type='primary' v-auth.plan="'export'" :icon='Upload' @click='exportClick' v-if="modeStore.currentMode != '比对式'">导出</el-button>
|
||||||
<el-button type='primary' v-auth.plan="'combine'" :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
|
<el-button type='primary' v-auth.plan="'combine'" :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
|
||||||
合并
|
合并
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
<template #operation='scope'>
|
<template #operation='scope'>
|
||||||
<el-button type='primary' v-auth.plan="'edit'" link :icon='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button>
|
<el-button type='primary' v-auth.plan="'edit'" link :icon='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button>
|
||||||
<el-button type='primary' v-auth.plan="'delete'" link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
<el-button type='primary' v-auth.plan="'delete'" link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||||
|
<el-button type='primary' link :icon='List' @click="openTestSource(scope.row)">子计划</el-button>
|
||||||
<!-- <el-button type='primary' link :icon='List' @click='showDeviceOpen(scope.row)'>设备绑定</el-button> -->
|
<!-- <el-button type='primary' link :icon='List' @click='showDeviceOpen(scope.row)'>设备绑定</el-button> -->
|
||||||
<el-button type='primary' v-auth.plan="'analysis'" link :icon='List' v-if="scope.row.testState == '2'" @click='statisticalAnalysis(scope.row)'>统计分析</el-button>
|
<el-button type='primary' v-auth.plan="'analysis'" link :icon='List' v-if="scope.row.testState == '2'" @click='statisticalAnalysis(scope.row)'>统计分析</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -38,7 +39,7 @@
|
|||||||
<!-- 查看设备绑定
|
<!-- 查看设备绑定
|
||||||
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/> -->
|
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/> -->
|
||||||
<ImportExcel ref='planImportExcel' />
|
<ImportExcel ref='planImportExcel' />
|
||||||
|
<SourceOpen :refresh-table='proTable?.getTableList' ref='openSourceView' :width='viewWidth' :height='viewHeight'></SourceOpen>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
|
|||||||
import type { Plan } from '@/api/plan/interface'
|
import type { Plan } from '@/api/plan/interface'
|
||||||
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
||||||
import DeviceOpen from '@/views/plan/planList/components/devPopup.vue'
|
import DeviceOpen from '@/views/plan/planList/components/devPopup.vue'
|
||||||
import SourceOpen from '@/views/plan/planList/components/sourcePopup.vue'
|
import SourceOpen from '@/views/plan/planList/components/chidrenPlan.vue'
|
||||||
import DevTransfer from './components/devTransfer.vue'
|
import DevTransfer from './components/devTransfer.vue'
|
||||||
import { useViewSize } from '@/hooks/useViewSize'
|
import { useViewSize } from '@/hooks/useViewSize'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
@@ -62,7 +63,7 @@ import type { ErrorSystem } from '@/api/error/interface'
|
|||||||
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue' // 导入子组件
|
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue' // 导入子组件
|
||||||
import TestSourcePopup from '@/views/machine/testSource/components/testSourcePopup.vue' // 导入子组件
|
import TestSourcePopup from '@/views/machine/testSource/components/testSourcePopup.vue' // 导入子组件
|
||||||
import { type TestSource } from '@/api/device/interface/testSource'
|
import { type TestSource } from '@/api/device/interface/testSource'
|
||||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import { dictTestState,dictReportState,dictResult } from '@/api/plan/planData.ts'
|
import { dictTestState,dictReportState,dictResult } from '@/api/plan/planData.ts'
|
||||||
import {getTestSourceById} from '@/api/device/testSource/index'
|
import {getTestSourceById} from '@/api/device/testSource/index'
|
||||||
@@ -105,6 +106,7 @@ const getTableList = async(params: any) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
||||||
|
|
||||||
const dataSourceType = computed(() => {
|
const dataSourceType = computed(() => {
|
||||||
// switch (modeStore.currentMode) {
|
// switch (modeStore.currentMode) {
|
||||||
@@ -138,10 +140,28 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
|||||||
fieldNames: { label: 'label', value: 'id' },
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return (
|
||||||
scope.row.testState === 0 ? '未检' : scope.row.testState === 1 ? '检测中' : '检测完成'
|
scope.row.testState === 0 ? <el-tag type='warning' effect="dark">未检</el-tag> :
|
||||||
|
scope.row.testState === 1 ? <el-tag type='danger' effect="dark">检测中</el-tag> :
|
||||||
|
<el-tag type='success' effect="dark">检测完成</el-tag>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'progress',
|
||||||
|
label: '检测进度',
|
||||||
|
minWidth: 180,
|
||||||
|
render: (scope) => {
|
||||||
|
const randomPercentage = Math.floor(Math.random() * 101); // 生成 0 到 100 的随机整数
|
||||||
|
return (
|
||||||
|
<el-progress
|
||||||
|
text-inside={true}
|
||||||
|
stroke-width={20}
|
||||||
|
percentage={randomPercentage}
|
||||||
|
status='success'
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'reportState',
|
prop: 'reportState',
|
||||||
label: '检测报告状态',
|
label: '检测报告状态',
|
||||||
@@ -407,6 +427,10 @@ const handleDelete = async (params: Plan.ReqPlanParams) => {
|
|||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const openTestSource = (row: Partial<Plan.ReqPlan> = {}) => {
|
||||||
|
openSourceView.value.open("检测计划详情",row.name)
|
||||||
|
}
|
||||||
|
|
||||||
const showDeviceOpen = (row: Partial<Plan.ReqPlan> = {}) => {
|
const showDeviceOpen = (row: Partial<Plan.ReqPlan> = {}) => {
|
||||||
devTransferPopup.value.open(row)
|
devTransferPopup.value.open(row)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="dialogVisible" :title="dialogTitle"
|
<el-dialog v-model="dialogVisible" :title="dialogTitle"
|
||||||
v-bind="dialogSmall" @close="close">
|
v-bind="dialogSmall" @close="close" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent" ref="dialogFormRef" :rules="rules">
|
<el-form :model="formContent" ref="dialogFormRef" :rules="rules">
|
||||||
<el-form-item label="字典类型" :label-width="100">
|
<el-form-item label="字典类型" :label-width="100">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind="dialogBig" @close="close">
|
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind="dialogBig" @close="close" align-center>
|
||||||
<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-three">
|
||||||
<el-divider>基础数据</el-divider>
|
<el-divider>基础数据</el-divider>
|
||||||
<el-form-item label='数据模型' prop='dataType'>
|
<el-form-item label='数据模型' prop='dataType'>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind='dialogSmall' @close="close">
|
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind='dialogSmall' @close="close" align-center>
|
||||||
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' >
|
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' >
|
||||||
<el-form-item label='字典名称' :label-width='100' prop='name'>
|
<el-form-item label='字典名称' :label-width='100' prop='name'>
|
||||||
<el-input v-model='formContent.name' placeholder='请输入字典名称' autocomplete='off' maxlength="32" show-word-limit/>
|
<el-input v-model='formContent.name' placeholder='请输入字典名称' autocomplete='off' maxlength="32" show-word-limit/>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind='dialogSmall' @close="close">
|
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind='dialogSmall' @close="close" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model='formContent' ref='dialogFormRef' :rules='rules'>
|
<el-form :model='formContent' ref='dialogFormRef' :rules='rules'>
|
||||||
<el-form-item label='类型名称' :label-width='100' prop='name'>
|
<el-form-item label='类型名称' :label-width='100' prop='name'>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogSmall">
|
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogSmall" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-form ref="dialogFormRef" :model="formContent" :rules="rules">
|
<el-form ref="dialogFormRef" :model="formContent" :rules="rules">
|
||||||
<el-form-item label="名称" prop="name">
|
<el-form-item label="名称" prop="name">
|
||||||
|
|||||||
Reference in New Issue
Block a user