表单验证

This commit is contained in:
sjl
2024-10-30 15:19:47 +08:00
parent f9bb15ad24
commit 0c2f59a0a7
21 changed files with 736 additions and 603 deletions

View File

@@ -6,9 +6,11 @@
"errordata", "errordata",
"errordetail", "errordetail",
"logdata", "logdata",
"Pids",
"plandata", "plandata",
"resourcedata", "resourcedata",
"resourcename", "resourcename",
"rmark" "rmark",
"showtest"
] ]
} }

View File

@@ -1,10 +1,10 @@
const data = [ const data = [
{ {
id: 'device1', id: 'device1',
deviceName:"模拟装置1", devicename:"模拟装置1",
deviceType:"PQS882B4电能质量监测装置", deviceType:"PQS882B4电能质量监测装置",
deviceChannels:"4", deviceChannels:"4",
PlanName: "沧州220kV留古等4座变电站电能质量检测", Planname: "沧州220kV留古等4座变电站电能质量检测",
deviceUn: "57.74", deviceUn: "57.74",
deviceIn: "5", deviceIn: "5",
deviceCompany: "南京灿能电力自动化股份有限公司", deviceCompany: "南京灿能电力自动化股份有限公司",
@@ -12,10 +12,10 @@ const data = [
}, },
{ {
id: 'device2', id: 'device2',
deviceName:"模拟装置2", devicename:"模拟装置2",
deviceType:"PQS882A电能质量监测装置", deviceType:"PQS882A电能质量监测装置",
deviceChannels:"1", deviceChannels:"1",
PlanName: "邯郸220kV团城站等4座站电能质量检测", Planname: "邯郸220kV团城站等4座站电能质量检测",
deviceUn: "57.74", deviceUn: "57.74",
deviceIn: "5", deviceIn: "5",
deviceCompany: "南京灿能电力自动化股份有限公司", deviceCompany: "南京灿能电力自动化股份有限公司",
@@ -23,10 +23,10 @@ const data = [
}, },
{ {
id: 'device3', id: 'device3',
deviceName:"模拟装置3", devicename:"模拟装置3",
deviceType:"PQS882A电能质量监测装置", deviceType:"PQS882A电能质量监测装置",
deviceChannels:"1", deviceChannels:"1",
PlanName: "衡水冀州光伏电站配套出口工程", Planname: "衡水冀州光伏电站配套出口工程",
deviceUn: "57.74", deviceUn: "57.74",
deviceIn: "1", deviceIn: "1",
deviceCompany: "南京灿能电力自动化股份有限公司", deviceCompany: "南京灿能电力自动化股份有限公司",
@@ -34,10 +34,10 @@ const data = [
}, },
{ {
id: 'device4', id: 'device4',
deviceName:"模拟装置4", devicename:"模拟装置4",
deviceType:"PMC-680M-22-22-00-115ANBC电能质量监测装置", deviceType:"PMC-680M-22-22-00-115ANBC电能质量监测装置",
deviceChannels:"4", deviceChannels:"4",
PlanName: "深圳市中电软件有限公司委托送检", Planname: "深圳市中电软件有限公司委托送检",
deviceUn: "57.74", deviceUn: "57.74",
deviceIn: "5", deviceIn: "5",
deviceCompany: "深圳中电电力技术股份有限公司", deviceCompany: "深圳中电电力技术股份有限公司",
@@ -48,47 +48,47 @@ const data = [
const plan_devicedata = [ const plan_devicedata = [
{ {
id: '1', //装置序号ID id: '1', //装置序号ID
Name: '设备1', //设备名称 name: '设备1', //设备名称
Dev_Type: 'PQS882A',//设备类型 dev_Type: 'PQS882A',//设备类型
Dev_Chns: 1, //设备通道数 dev_Chns: 1, //设备通道数
Check_Result: '合格', //检测结果 check_Result: '合格', //检测结果
Report_State: '已生成', //报告状态 report_State: '已生成', //报告状态
Document_State: '归档', //归档状态 document_State: '归档', //归档状态
Check_State:'检测完成',//检测状态 check_State:'检测完成',//检测状态
ReCheck_Num: 0, //复检次数 reCheck_Num: 0, //复检次数
}, },
{ {
id: '2', //装置序号ID id: '2', //装置序号ID
Name: '设备2', //设备名称 name: '设备2', //设备名称
Dev_Type: 'PQS882B4',//设备类型 dev_Type: 'PQS882B4',//设备类型
Dev_Chns: 4, //设备通道数 dev_Chns: 4, //设备通道数
Check_Result: '/', //检测结果 check_Result: '/', //检测结果
Report_State: '未生成', //报告状态 report_State: '未生成', //报告状态
Document_State: '未归档', //归档状态 document_State: '未归档', //归档状态
Check_State:'未检',//检测状态 check_State:'未检',//检测状态
ReCheck_Num: 0, //复检次数 reCheck_Num: 0, //复检次数
}, },
{ {
id: '3', //装置序号ID id: '3', //装置序号ID
Name: '设备3', //设备名称 name: '设备3', //设备名称
Dev_Type: 'PQS882B4',//设备类型 dev_Type: 'PQS882B4',//设备类型
Dev_Chns: 4, //设备通道数 dev_Chns: 4, //设备通道数
Check_Result: '/', //检测结果 check_Result: '/', //检测结果
Report_State: '未生成', //报告状态 report_State: '未生成', //报告状态
Document_State: '未归档', //归档状态 document_State: '未归档', //归档状态
Check_State:'检测中',//检测状态 check_State:'检测中',//检测状态
ReCheck_Num: 0, //复检次数 reCheck_Num: 0, //复检次数
}, },
{ {
id: '4', //装置序号ID id: '4', //装置序号ID
Name: '设备4', //设备名称 name: '设备4', //设备名称
Dev_Type: 'PQS882B4',//设备类型 dev_Type: 'PQS882B4',//设备类型
Dev_Chns: 4, //设备通道数 dev_Chns: 4, //设备通道数
Check_Result: '不合格', //检测结果 check_Result: '不合格', //检测结果
Report_State: '未生成', //报告状态 report_State: '未生成', //报告状态
Document_State: '未归档', //归档状态 document_State: '未归档', //归档状态
Check_State:'检测完成',//检测状态 check_State:'检测完成',//检测状态
ReCheck_Num: 1, //复检次数 reCheck_Num: 1, //复检次数
}, },
] ]

View File

@@ -32,37 +32,37 @@ export namespace Device {
// 被检设备列表 // 被检设备列表
export interface DeviceList { export interface DeviceList {
id: string; //装置序号ID id: string; //装置序号ID
Name: string; //设备名称 name: string; //设备名称
Pattern?: string; //设备模式 模拟 数字 比对 pattern?: string; //设备模式 模拟 数字 比对
Dev_Type: string;//设备类型 dev_Type: string;//设备类型
Dev_Chns: number; //设备通道数 dev_Chns: number; //设备通道数
Dev_Volt?: number; //额定电压V dev_Volt?: number; //额定电压V
Dev_Curr?: number; //额定电流A dev_Curr?: number; //额定电流A
Manufacturer?: string;//生产厂家 manufacturer?: string;//生产厂家
CreateDate?: string; //生产日期 createDate?: string; //生产日期
CreateId?: string; //出厂编号 createId?: string; //出厂编号
Hardware_Version?: string; //固件版本 hardware_Version?: string; //固件版本
Software_Version?: string; //软件版本 software_Version?: string; //软件版本
IP?: string; //IP地址 iP?: string; //IP地址
Port?: number; //端口号 port?: number; //端口号
IsEncryption?: string; //装置是否为加密版本 isEncryption?: string; //装置是否为加密版本
Series?: string; //装置识别码3ds加密 series?: string; //装置识别码3ds加密
Dev_Key?: string; //装置秘钥3ds加密 dev_Key?: string; //装置秘钥3ds加密
SampleID?: string; //样品编号 sampleID?: string; //样品编号
Arrived_Date?: string; //送样日期 arrived_Date?: string; //送样日期
City_Name?: string; //所属地市名称 city_Name?: string; //所属地市名称
GD_Name?: string; //所属供电公司名称 gD_Name?: string; //所属供电公司名称
Sub_Name?: string; //所属电站名称 sub_Name?: string; //所属电站名称
Check_State: string; //检测状态 check_State: string; //检测状态
Check_Result: string; //检测结果 check_Result: string; //检测结果
Report_State: string; //报告状态 report_State: string; //报告状态
Document_State: string; //归档状态 document_State: string; //归档状态
ReCheck_Num: number; //复检次数 reCheck_Num: number; //复检次数
State?: number; //状态 state?: number; //状态
Create_By?: string; //创建用户 create_By?: string; //创建用户
Create_Time?: string; //创建时间 create_Time?: string; //创建时间
Update_By?: string; //更新用户 update_By?: string; //更新用户
Update_Time?: string; //更新时间 update_Time?: string; //更新时间
} }
} }

View File

@@ -2,33 +2,35 @@ import type {ErrorSystem} from "./interface"
const errordata = ref<ErrorSystem.ErrorSystemList[]>([ const errordata = ref<ErrorSystem.ErrorSystemList[]>([
{ {
'id': '1', id: '1',
'name': 'Q/GDW 1650.2- 2016', name: 'Q/GDW 1650.2- 2016',
'publishTime':'', standard_Name:'',
'year':'2016', standard_Time:'2016',
'level':'A级', dev_Level:'A级',
'state':'', enable:1,
state:1,
}, },
{ {
'id': '2', id: '2',
'name': 'Q/GDW 10650.2 - 2021', name: 'Q/GDW 1650.2- 2021',
'publishTime':'', standard_Name:'',
'year':'2021', standard_Time:'2021',
'level':'A级', dev_Level:'A级',
'state':'', enable:1,
state:1,
}, },
{ {
'id': '3', id: '3',
'name': 'GBT 19862 - 2016', name: 'GBT 19862 - 2016',
'publishTime':'', standard_Name:'',
'year':'2016', standard_Time:'2016',
'level':'A级', dev_Level:'A级',
'state':'', enable:1,
state:1,
}, },
]) ])
const errordetail = ref<ErrorSystem.ErrorSystemDetail[]>([ const errordetail = ref<ErrorSystem.Error_detail[]>([
{ {
measured: '电压偏差', measured: '电压偏差',
deviceLevel: 'A', deviceLevel: 'A',

View File

@@ -4,19 +4,38 @@ export namespace ErrorSystem {
export interface ErrorSystemList { export interface ErrorSystemList {
id: string;//误差体系表Id id: string;//误差体系表Id
name: string;//误差体系名称 name: string;//误差体系名称
publishTime:string;//发布时间 standard_Name:string;//参照标准名称
year:string;//标准实施年份 standard_Time:string;//标准推行时间
level:string;//使用设备等级 dev_Level:string;//使用设备等级
state:string;//状态 enable:number;//状态0-不启用 1-启用
state:number;//0-删除 1-正常
create_By?:string;//创建用户
create_Time?:string;//创建时间
update_By?:string;//修改用户
update_Time?:string;//修改时间
} }
// 查看详细误差体系 // 查看详细误差体系
export interface ErrorSystemDetail { export interface ErrorSystemDetail {
measured: string;//被测量 id:string;//误差体系子表ID
deviceLevel: string;//检测装置级别 error_Sys_Id:string;//所属误差体系ID
measurementType: string;//测量类型 type: string;//检测脚本类型,树形字典表(没有树形表则需要拆分字段)
condition: string;//测量条件 JudgeConditionStart?:number;//误差判断起始值(误差范围)
maxErrorValue: string;//最大误差 IsContainStart?:number;//是否包含起始值
JudgeConditionEnd?:number;//误差判断结束值(误差范围)
IsContainEnd?:number;//是否包含结束值
JudgeConditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值)
MaxErrorValue:number;//误差最大值
ErrorValueType:string;//误差值类型包括值类型绝对值、相对值1、相对值2
}
// 查看详细误差体系
export interface Error_detail {
measured: string;
deviceLevel: string;
measurementType:string;
condition: string;
maxErrorValue: string;
} }
} }

View File

@@ -1,13 +1,15 @@
// 日志管理模块 // 审计日志管理模块
export namespace Log { export namespace Sys_Log_Audit {
// 日志列表 // 日志列表
export interface LogList { export interface Audit_LogList {
id: string;//日志表Id id: string;//日志表Id
content: string;//日志内容 operate_Type:string;//日志类型
user:string;//操作用户 ip:string;//操作IP
record_Time:string;//记录时间 result: string;//事件结果
type:string;//日志类型 remark: string;//事件描述
level:string;//日志等级 warn:number;//告警标志
create_By:string;//创建用户
create_Time:string;//创建时间
} }
} }

View File

@@ -1,61 +1,75 @@
import type {Log} from "./interface" import type {Sys_Log_Audit} from "./interface"
const logdata = ref<Log.LogList[]>([ const logdata = ref<Sys_Log_Audit.Audit_LogList[]>([
{ {
'id': '1', id: '1',
'content': 'Admin用户09:35:47,790 登录系统', operate_Type:'操作日志',
'user':'Admin', ip:'192.168.1.139',
'record_Time':'2024-10-16 12:13:14', result: '登陆成功',
'type':'操作日志', remark: 'Admin用户09:35:47,790 登录系统',
'level':'/', warn:0,
create_By:'Admin',
create_Time:'2024-10-16 12:13:14',
}, },
{ {
'id': '2', id: '2',
'content': 'Admin用户09:35:47,891 新建设备 “模拟式装置1”', operate_Type:'操作日志',
'user':'Admin', ip:'192.168.1.139',
'record_Time':'2024-10-16 12:13:14', result: '新建成功',
'type':'操作日志', remark: 'Admin用户09:35:47,891 新建设备 “模拟式装置1”',
'level':'/', warn:0,
create_By:'Admin',
create_Time:'2024-10-16 12:13:14',
}, },
{ {
'id': '3', id: '3',
'content': 'User用户 09:35:56,391 新建设备 “模拟式装置2”', operate_Type:'操作日志',
'user':'User', ip:'192.168.1.139',
'record_Time':'2024-10-16 12:13:14', result: '新建成功',
'type':'操作日志', remark: 'User用户 09:35:56,391 新建设备 “模拟式装置2”',
'level':'/', warn:0,
create_By:'User',
create_Time:'2024-10-16 12:13:14',
}, },
{ {
'id': '4', id: '4',
'content': 'Admin用户09:35:59,977 对 “模拟式装置1”开始进行自动检测', operate_Type:'操作日志',
'user':'Admin', ip:'192.168.1.139',
'record_Time':'2024-10-16 12:13:14', result: '操作成功',
'type':'操作日志', remark: 'Admin用户09:35:59,977 对 “模拟式装置1”开始进行自动检测',
'level':'/', warn:0,
create_By:'Admin',
create_Time:'2024-10-16 12:13:14',
}, },
{ {
'id': '5', id: '5',
'content': 'User用户09:36:02,229 对 “模拟式装置2”开始进行自动检测', operate_Type:'操作日志',
'user':'User', ip:'192.168.1.139',
'record_Time':'2024-10-16 12:13:14', result: '操作成功',
'type':'操作日志', remark: 'User用户09:36:02,229 对 “模拟式装置2”开始进行自动检测',
'level':'/', warn:0,
create_By:'User',
create_Time:'2024-10-16 12:13:14',
}, },
{ {
'id': '6', id: '6',
'content': 'DKLN源回复报文异常已丢弃。报文长度为XX内容为“XXXXXXX”', operate_Type:'告警日志',
'user':'Admin', ip:'192.168.1.139',
'record_Time':'2024-10-16 12:13:14', result: 'warn警告',
'type':'告警日志', remark: 'DKLN源回复报文异常已丢弃。报文长度为XX内容为“XXXXXXX”',
'level':'WARN警告', warn:1,
create_By:'Admin',
create_Time:'2024-10-16 12:13:14',
}, },
{ {
'id': '7', id: '7',
'content': 'IP192.168.1.205 的装置第1通道触发QVVR01报告失败', operate_Type:'告警日志',
'user':'AA', ip:'192.168.1.205',
'record_Time':'2024-10-16 12:13:14', result: '报告触发失败',
'type':'告警日志', remark: 'ip192.168.1.205 的装置第1通道触发QVVR01报告失败',
'level':'ERROR一般错误', warn:1,
create_By:'AA',
create_Time:'2024-10-16 12:13:14',
}, },
]) ])

View File

@@ -6,19 +6,22 @@ export namespace Resource {
// 菜单列表 // 菜单列表
export interface ResResourceList { export interface ResResourceList {
id: string;//资源表Id id: string;//资源表Id
pid:string;//节点0为根节点
pids?:string;//节点上层所有节点
name: string;//名称 name: string;//名称
code:string;//资源标识
path:string;//路径 path:string;//路径
icon?:string;//图标
sort:number;//排序 sort:number;//排序
type:string;//资源类型 type:number;//资源类型0-菜单、1-按钮、2-公共资源、3-服务间调用资源
remark:string;//资源描述 remark?: string;//权限资源描述
route_Name:string;//路由名称 state:number;//权限资源状态
create_Time:string;//创建时间 create_By?:string;//创建
update_Time:string;//更新时间 create_Time?:string;//创建时间
update_By?:string;//更新人
update_Time?:string;//更新时间
children?: ResResourceList[]; children?: ResResourceList[];
} }
export interface ResType {
userLabel: string;
userValue: number;
}
} }

View File

@@ -4,247 +4,264 @@ import type { Resource } from "./interface"
const resourcedata = ref<Resource.ResResourceList[]>([ const resourcedata = ref<Resource.ResResourceList[]>([
{ {
'id': '1', 'id': '1',
'pid':'0',
'pids':'',
'name': '检测计划', 'name': '检测计划',
'code':'',
'path':'/plan/planList/index', 'path':'/plan/planList/index',
'icon':'',
'sort':100, 'sort':100,
'type':'菜单', 'type':0,
'remark': '检测计划描述', 'remark': '检测计划描述',
'route_Name':'route', 'state':1,
'create_Time': '2024-10-16 12:13:14',
'update_Time':'2024-10-16 12:13:14',
}, },
{ {
'id': '2', id: '2',
'name': '台账管理', pid:'0',
'path':'/plan/planList/index', pids:'',
'sort':100, name: '台账管理',
'type':'菜单', code:'',
'remark':'检测计划描述', path:'/machine',
'route_Name':'route', icon:'',
'create_Time': '2024-10-16 12:13:14', sort:100,
'update_Time':'2024-10-16 12:13:14', type:0,
remark: '台账管理描述',
state:1,
children:[{ children:[{
'id': '21', id: '21',
'name': '检测脚本', pid:'11',
pids:'',
'path':'/plan/planList/index', name: '检测脚本',
'sort':100, code:'',
'type':'菜单', path:'/machine/testScript/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '检测脚本描述',
state:1,
}, },
{ {
'id': '22', id: '22',
'name': '被检设备', pid:'22',
pids:'',
'path':'/plan/planList/index', name: '被检设备',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '被检设备描述',
state:1,
}, },
{ {
'id': '23', id: '23',
'name': '误差体系', pid:'23',
pids:'',
'path':'/plan/planList/index', name: '误差体系',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '误差体系描述',
},{ state:1,
'id': '24',
'name': '检测源',
'path':'/plan/planList/index',
'sort':100,
'type':'菜单',
'remark':'检测计划描述',
'route_Name':'route',
'create_Time': '2024-10-16 12:13:14',
'update_Time':'2024-10-16 12:13:14',
}
]
}, },
{ {
'id': '3', id: '24',
'name': '权限管理', pid:'24',
pids:'',
'path':'/plan/planList/index', name: '检测源',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '检测源描述',
state:1,
}]
},
{
id: '3',
pid:'0',
pids:'',
name: '权限管理',
code:'',
path:'/plan/planList/index',
icon:'',
sort:100,
type:0,
remark: '权限管理描述',
state:1,
children:[{ children:[{
'id': '31', id: '31',
'name': '用户管理', pid:'1',
pids:'',
'path':'/plan/planList/index', name: '用户管理',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '用户管理描述',
state:1,
}, },
{ {
'id': '32', id: '32',
'name': '角色管理', pid:'2',
pids:'',
'path':'/plan/planList/index', name: '角色管理',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '角色管理描述',
state:1,
}, },
{ {
'id': '33', id: '33',
'name': '菜单管理', pid:'3',
pids:'',
'path':'/plan/planList/index', name: '菜单管理',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '菜单管理描述',
} state:1,
] }]
}, },
{ {
'id': '4', id: '4',
'name': '系统配置', pid:'0',
pids:'',
'path':'/plan/planList/index', name: '系统配置',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '系统配置描述',
state:1,
children:[{ children:[{
'id': '41', id: '41',
'name': '通用配置', pid:'1',
pids:'',
'path':'/plan/planList/index', name: '通用配置',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '通用配置描述',
state:1,
}, },
{ {
'id': '42', id: '42',
'name': '数据字典', pid:'2',
pids:'',
'path':'/plan/planList/index', name: '数据字典',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '数据字典描述',
state:1,
}, },
{ {
'id': '43', id: '43',
'name': '报告模版', pid:'3',
pids:'',
'path':'/plan/planList/index', name: '报告模版',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '报告模版描述',
},{ state:1,
'id': '44',
'name': '版本注册',
'path':'/plan/planList/index',
'sort':100,
'type':'菜单',
'remark':'检测计划描述',
'route_Name':'route',
'create_Time': '2024-10-16 12:13:14',
'update_Time':'2024-10-16 12:13:14',
}
]
}, },
{ {
'id': '5', id: '44',
'name': '日志管理', pid:'4',
pids:'',
'path':'/plan/planList/index', name: '版本注册',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '版本注册描述',
state:1,
},]
}, },
{ {
'id': '6', id: '5',
'name': '统计分析', pid:'0',
pids:'',
'path':'/plan/planList/index', name: '日志管理',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '日志管理描述',
state:1,
}, },
{ {
'id': '7', id: '6',
'name': '示例', pid:'0',
pids:'',
'path':'/plan/planList/index', name: '统计分析',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '统计分析描述',
state:1,
},
{
id: '7',
pid:'0',
pids:'',
name: '示例',
code:'',
path:'/plan/planList/index',
icon:'',
sort:100,
type:0,
remark: '示例描述',
state:0,
children:[{ children:[{
'id': '71', id: '71',
'name': '普通表格', pid:'1',
pids:'',
'path':'/plan/planList/index', name: '普通表格',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '普通表格描述',
state:0,
}, },
{ {
'id': '72', id: '71',
'name': '表格树', pid:'1',
pids:'',
'path':'/plan/planList/index', name: '表格树',
'sort':100, code:'',
'type':'菜单', path:'/plan/planList/index',
'remark':'检测计划描述', icon:'',
'route_Name':'route', sort:100,
'create_Time': '2024-10-16 12:13:14', type:0,
'update_Time':'2024-10-16 12:13:14', remark: '表格树描述',
} state:0,
] }]
}, },
]) ])
export default resourcedata export default resourcedata

View File

@@ -43,28 +43,6 @@ const dictData: Dict[] = [
}, },
], ],
}, },
{
id: "3",
code: 'type',
label: '资源类型',
children: [
{
id: "1",
label: '菜单',
code: 1,
},
{
id: "2",
label: '按钮',
code: 2,
},
{
id: "3",
label: '公共资源',
code: 3,
},
],
},
]
export default dictData export default dictData

View File

@@ -17,7 +17,8 @@ export const userStatus = [
]; ];
export const resourceType = [ export const resourceType = [
{ label: "菜单", value: 1 }, { label: "菜单", value: 0 },
{ label: "按钮", value: 2 }, { label: "按钮", value: 1 },
{ label: "公共资源", value: 3 } { label: "公共资源", value: 2 }
{ label: "服务间调用资源", value: 3 }
]; ];

View File

@@ -1,6 +1,6 @@
<template> <template>
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogSmall"> <el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogSmall">
<el-form :model="formData" :rules="rules"> <el-form :model="formData" ref='formRuleRef' :rules='rules'>
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
<el-input v-model="formData.name" /> <el-input v-model="formData.name" />
</el-form-item> </el-form-item>
@@ -12,17 +12,15 @@
</el-form-item> </el-form-item>
<el-form-item label="类型" prop="type"> <el-form-item label="类型" prop="type">
<el-select v-model="formData.type" placeholder="请选择资源类型"> <el-select v-model="formData.type" placeholder="请选择资源类型">
<el-option label="菜单" value="菜单" /> <el-option label="菜单" :value="0"></el-option>
<el-option label="按钮" value="按钮" /> <el-option label="按钮" :value="1"></el-option>
<el-option label="公共资源" value="公共资源" /> <el-option label="公共资源" :value="2"></el-option>
<el-option label="服务间调用资源" :value="3"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="描述" prop="remark"> <el-form-item label="描述" prop="remark">
<el-input v-model="formData.remark" :rows="2" type="textarea"/> <el-input v-model="formData.remark" :rows="2" type="textarea"/>
</el-form-item> </el-form-item>
<el-form-item label="路由" prop="route_Name">
<el-input v-model="formData.route_Name" />
</el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
@@ -34,42 +32,69 @@
</template> </template>
<script lang="ts" setup name="ResourceDialog"> <script lang="ts" setup name="ResourceDialog">
import { defineProps, defineEmits, reactive,watch } from 'vue'; import { defineProps, defineEmits,watch,ref, type Ref } from 'vue';
import { dialogSmall } from '@/utils/elementBind' import { dialogSmall } from '@/utils/elementBind'
import { ElMessage, FormInstance, FormItemRule } from 'element-plus'
const props = defineProps<{ const props = defineProps<{
visible: boolean; visible: boolean;
dialogTitle: string; dialogTitle: string;
formData: { formData: {
id: string;//资源表Id
id:string; pid:string;//节点0为根节点
name: string; pids?:string;//节点上层所有节点
path: string; name: string;//名称
sort: number; code:string;//资源标识
type: string; path:string;//路径
remark: string; icon?:string;//图标
route_Name: string; sort:number;//排序
type:number;//资源类型0-菜单、1-按钮、2-公共资源、3-服务间调用资源
remark?: string;//权限资源描述
state:number;//权限资源状态
create_By?:string;//创建人
create_Time?:string;//创建时间
update_By?:string;//更新人
update_Time?:string;//更新时间
}; };
}>(); }>();
const rules = {
name :[ // 定义规则
{require:true,trigger:"blur",message:"请填写菜单名称"} const formRuleRef = ref<FormInstance>()
] const rules : Ref<Record<string, Array<FormItemRule>>> = ref({
} name :[{required:true,trigger:'blur',message:'菜单名称必填!'}],
path :[{required:true,trigger:'blur',message:'菜单路径必填!'}],
type :[{required:true,trigger:'change',message:'菜单类型必选!'}]
})
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'update:visible', value: boolean): void; (e: 'update:visible', value: boolean): void;
(e: 'submit', data: any): void; (e: 'submit', data: any): void;
}>(); }>();
const handleCancel = () => { const handleCancel = () => {
//重置表单内容
//取消表单校验状态
formRuleRef.value && formRuleRef.value.resetFields()
emit('update:visible', false); // 关闭对话框 emit('update:visible', false); // 关闭对话框
}; };
const handleSubmit = () => { const handleSubmit = () => {
try {
formRuleRef.value?.validate((valid: boolean) => {
if (valid) {
// 将表单数据转为json,发送到后端
let confirmFormData = JSON.parse(JSON.stringify(props.formData))
emit('submit', props.formData); // 提交表单数据 emit('submit', props.formData); // 提交表单数据
emit('update:visible', false); // 提交后关闭对话框 emit('update:visible', false); // 提交后关闭对话框
}; } else {
ElMessage.error('表单验证失败!')
}
})
}catch (error) {
console.error('验证过程中发生错误', error)
}
}
// 当 props.visible 改变时,更新 formData // 当 props.visible 改变时,更新 formData
watch(() => props.visible, (newVal) => { watch(() => props.visible, (newVal) => {

View File

@@ -40,122 +40,103 @@
import { type Resource } from '@/api/resource/interface' import { type Resource } from '@/api/resource/interface'
import ProTable from '@/components/ProTable/index.vue' import ProTable from '@/components/ProTable/index.vue'
import ResourceDialog from "@/views/authority/resource/components/ResourceDialog.vue"; // 导入子组件 import ResourceDialog from "@/views/authority/resource/components/ResourceDialog.vue"; // 导入子组件
import {CirclePlus, Delete, EditPen} from '@element-plus/icons-vue' import {CirclePlus, Delete, EditPen,HomeFilled} from '@element-plus/icons-vue'
import resourceDataList from '@/api/resource/resourceData' import resourceDataList from '@/api/resource/resourceData'
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface' import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
import { ElMessage, ElMessageBox, inputEmits } from 'element-plus'; import { ElMessage, ElMessageBox, inputEmits } from 'element-plus';
import { useDictStore } from '@/stores/modules/dict'
const dictStore = useDictStore()
let multipleSelection = ref<string[]>([]); let multipleSelection = ref<string[]>([]);
const resourceData = resourceDataList const resourceData = resourceDataList
const dialogFormVisible = ref(false) const dialogFormVisible = ref(false)
const isEditMode = ref(false); const isEditMode = ref(false);
const dialogTitle = ref('新增菜单') const dialogTitle = ref('新增菜单')
const dialogForm = ref<Resource.ResResourceList>({ const dialogForm = ref<Resource.ResResourceList>({
id: '', id: '',
pid:'',
pids:'',
name: '', name: '',
code:'',
path:'', path:'',
sort: 0, icon:'',
type: '', sort:100,
type:0,
remark: '', remark: '',
route_Name: '', state:1,
create_Time: '' ,
update_Time: '' ,
children:[], children:[],
}); });
// ProTable 实例 // ProTable 实例
const proTable = ref<ProTableInstance>() const proTable = ref<ProTableInstance>()
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<Resource.ResResourceList>[]>([ const columns = reactive<ColumnProps<Resource.ResResourceList>[]>([
{ type: 'selection', fixed: 'left', width: 70 }, { type: 'selection', fixed: 'left', width: 70 },
{ {
prop: 'name', prop: 'name',
label: '名称', label: '名称',
width: 150, minWidth: 200,
search: { el: 'input', tooltip: '我是搜索提示' }, search: { el: 'input', tooltip: '我是搜索提示' },
}, },
{
prop: 'code',
label: '资源标识',
minWidth: 100,
},
{ {
prop: 'path', prop: 'path',
label: '路径', label: '路径',
width: 300, minWidth: 200,
},
{
prop: 'sort',
label: '排序',
width: 100,
search: {
// 自定义 search 显示内容
render: ({ searchParam }) => {
return (
<div class='flx-center'>
<el-input vModel_trim={searchParam.minAge} placeholder='最小排序' />
<span class='mr10 ml10'>-</span>
<el-input vModel_trim={searchParam.maxAge} placeholder='最大排序' />
</div>
)
},
},
}, },
{ {
prop: 'type', prop: 'type',
label: '类型', label: '类型',
width: 150, width: 150,
// 字典数据(本地数据)
//enum: dictStore.getDictData('type'),
//search: { el: 'select', props: { filterable: true } },
//fieldNames: { label: 'label', value: 'resourceType' },
search: { search: {
// 自定义 search 显示内容
render: ({searchParam}) => { render: ({searchParam}) => {
return ( return (
<div class='flx-center'> <div class='flx-center'>
<el-select placeholder="请选择"> <el-select placeholder="请选择" v-model={searchParam.type}>
<el-option label="菜单"></el-option> <el-option label="菜单" value="0"></el-option>
<el-option label="按钮"></el-option> <el-option label="按钮" value="1"></el-option>
<el-option label="公共资源"></el-option> <el-option label="公共资源" value="2"></el-option>
<el-option label="服务间调用资源" value="3"></el-option>
</el-select> </el-select>
</div> </div>
);
},
},
},
{
prop: 'state',
label: '权限资源状态',
minWidth: 120,
enum: dictStore.getDictData('status'),
fieldNames: { label: 'label', value: 'code' },
render: scope => {
return (
<el-tag type={scope.row.state ? 'success' : 'danger'} > {scope.row.state ? '正常' : '禁用'} </el-tag>
) )
}, },
}, },
}, { prop: 'operation', label: '操作', fixed: 'right',minWidth: 200 },
{
prop: 'route_Name',
width: 200,
label: '路由',
search: { el: 'input' },
},
{
prop: 'create_Time',
label: '创建时间',
width: 180,
search: {
el: 'date-picker',
span: 1,
props: { type: 'daterange', valueFormat: 'YYYY-MM-DD'},
defaultValue: ['2024-11-12', '2024-12-12'],}
},
{
prop: 'update_Time',
label: '更新时间',
width: 180,
},
{ prop: 'operation', label: '操作', fixed: 'right' },
]) ])
// 打开 drawer(新增、查看、编辑) // 打开 drawer(新增、查看、编辑)
// 打开新增对话框 // 打开新增对话框
const openAddDialog = () => { const openAddDialog = () => {
dialogForm.value = { dialogForm.value = {
id: '', id: '',
pid:'',
pids:'',
name: '', name: '',
code:'',
path:'', path:'',
icon:'',
sort:100, sort:100,
type: '', type:0,
remark: '', remark: '',
route_Name: '', state:1,
create_Time: '' ,
update_Time: '' ,
children: [], children: [],
}; };
isEditMode.value = true; isEditMode.value = true;

View File

@@ -21,14 +21,16 @@
<script setup lang='tsx' name='useProTable'> <script setup lang='tsx' name='useProTable'>
// 根据实际路径调整 // 根据实际路径调整
import TimeControl from '@/components/TimeControl/index.vue' import TimeControl from '@/components/TimeControl/index.vue'
import { type Log } from '@/api/log/interface' import { type Sys_Log_Audit } from '@/api/log/interface'
import ProTable from '@/components/ProTable/index.vue' import ProTable from '@/components/ProTable/index.vue'
import { Upload ,DataAnalysis} from '@element-plus/icons-vue' import { Upload ,DataAnalysis} from '@element-plus/icons-vue'
import logDataList from '@/api/log/logData' import logDataList from '@/api/log/logData'
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface' import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
import { reactive,ref,watch } from 'vue' import { reactive,ref,watch } from 'vue'
import { useDictStore } from '@/stores/modules/dict'
let multipleSelection = ref<string[]>([]) let multipleSelection = ref<string[]>([])
const logData = logDataList const logData = logDataList
const dictStore = useDictStore()
// 定义包含和排除的单位 // 定义包含和排除的单位
const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位 const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
const excludedUnits = ['季度','年']; // 要排除的单位 const excludedUnits = ['季度','年']; // 要排除的单位
@@ -36,7 +38,7 @@ const defaultUnits = '日'; // 默认的单位
// ProTable 实例 // ProTable 实例
const proTable = ref<ProTableInstance>() const proTable = ref<ProTableInstance>()
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<Log.LogList>[]>([ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
{ type: 'selection', fixed: 'left', width: 70 }, { type: 'selection', fixed: 'left', width: 70 },
{ {
prop: 'id', prop: 'id',
@@ -44,15 +46,20 @@ const columns = reactive<ColumnProps<Log.LogList>[]>([
width: 70, width: 70,
}, },
{ {
prop: 'user', prop: 'create_By',
label: '操作用户', label: '操作用户',
search: { el: 'select', props: { filterable: true } }, search: { el: 'input' },
width: 150, minWidth: 100,
}, },
{ {
prop: 'record_Time', prop: 'ip',
label: 'IP',
minWidth: 120,
},
{
prop: 'create_Time',
label: '记录时间', label: '记录时间',
width: 200, minWidth: 180,
search: { search: {
span: 2, span: 2,
render: () => { render: () => {
@@ -69,28 +76,38 @@ const columns = reactive<ColumnProps<Log.LogList>[]>([
}, },
}, },
{ {
prop: 'content', prop: 'remark',
label: '内容', label: '事件描述',
minWidth: 400,
}, },
{ {
prop: 'type', prop: 'result',
label: '事件结果',
minWidth: 120,
},
{
prop: 'warn',
label: '告警标志',
enum: dictStore.getDictData('status'),
minWidth: 100,
fieldNames: { label: 'label', value: 'code' },
render: scope => {
return (
<el-tag type={scope.row.warn ? 'danger' : 'success'}>{scope.row.warn ? '告警' : '未告警'}</el-tag>
)
},
},
{
prop: 'operate_Type',
label: '日志类型', label: '日志类型',
width: 200, width: 100,
search: { el: 'select', props: { filterable: true } }, search: { el: 'select', props: { filterable: true } },
}, },
{
prop: 'level',
label: '日志等级',
width: 200,
search: { el: 'select', props: { filterable: true } },
},
]) ])
//选中 //选中
// 处理选择变化 // 处理选择变化
const handleSelectionChange = (selection: Log.LogList[]) => { const handleSelectionChange = (selection: Sys_Log_Audit.Audit_LogList[]) => {
multipleSelection.value = selection.map(row => row.id) // 更新选中的行 multipleSelection.value = selection.map(row => row.id) // 更新选中的行
} }

View File

@@ -44,7 +44,7 @@
const dictStore = useDictStore() const dictStore = useDictStore()
const deviceData = deviceDataList const deviceData = deviceDataList.data
// ProTable 实例 // ProTable 实例
const proTable = ref<ProTableInstance>() const proTable = ref<ProTableInstance>()

View File

@@ -21,7 +21,7 @@
const errorData = errorDataList.errordetail const errorData = errorDataList.errordetail
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemDetail>[]>([ const columns = reactive<ColumnProps<ErrorSystem.Error_detail>[]>([
{ {
prop: 'measured', prop: 'measured',
label: '被测量', label: '被测量',
@@ -46,8 +46,8 @@ const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemDetail>[]>([
interface SpanMethodProps { interface SpanMethodProps {
row: ErrorSystem.ErrorSystemDetail row: ErrorSystem.Error_detail
column: TableColumnCtx<ErrorSystem.ErrorSystemDetail> column: TableColumnCtx<ErrorSystem.Error_detail>
rowIndex: number rowIndex: number
columnIndex: number columnIndex: number
} }

View File

@@ -3,41 +3,37 @@
<el-tabs type="border-card"> <el-tabs type="border-card">
<el-tab-pane label="基础信息"> <el-tab-pane label="基础信息">
<div class="form-grid"> <div class="form-grid">
<el-form :model="formData" > <el-form :model="formData" ref='formRuleRef' :rules='rules'>
<el-row :gutter="160" > <el-row :gutter="120" >
<el-col :span="9"> <el-col :span="9">
<el-form-item label="误差体系名称" prop="name"> <el-form-item label="误差体系名称" prop="name">
<el-input v-model='formData.name' placeholder="标准号+年份+设备等级"/> <el-input v-model='formData.name' placeholder="标准号+年份+设备等级"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="发布时间" prop="publishTime"> <el-form-item label="参照标准名称" prop="standard_Name">
<el-input v-model="formData.publishTime" /> <el-input v-model='formData.standard_Name'/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="7">
<el-form-item label="上传误差体系截图" prop="screenshot"> <el-form-item label="发布时间" prop="standard_Time">
<el-button :icon="FolderOpened" type="primary"></el-button> <el-input v-model="formData.standard_Time" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="160" > <el-row :gutter="120" >
<el-col :span="9"> <el-col :span="9">
<el-form-item label="适用设备等级" prop="level"> <el-form-item label="适用设备等级" prop="dev_Level">
<el-select v-model='formData.level' placeholder="请选择设备等级"> <el-select v-model='formData.dev_Level' placeholder="请选择设备等级">
<el-option label="A级" value="A级" /> <el-option label="A级" value="A级" />
<el-option label="S级" value="S级" /> <el-option label="S级" value="S级" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="实施时间" prop="year"> <el-form-item label="状态" prop="enable">
<el-input v-model='formData.year'/> <el-select v-model='formData.enable' placeholder="请选择状态">
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="状态" prop="state">
<el-select v-model='formData.state' placeholder="请选择状态">
<el-option label="启用" value="启用" /> <el-option label="启用" value="启用" />
<el-option label="停用" value="停用" /> <el-option label="停用" value="停用" />
</el-select> </el-select>
@@ -148,7 +144,8 @@
</template> </template>
<script lang="ts" setup name="ErrorSystemDialog"> <script lang="ts" setup name="ErrorSystemDialog">
import { defineProps, defineEmits, reactive,watch,ref } from 'vue'; import{ElMessage, FormInstance,FormItemRule}from'element-plus'
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
import { dialogBig,dialogMiddle} from '@/utils/elementBind' import { dialogBig,dialogMiddle} from '@/utils/elementBind'
import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件 import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
import {CirclePlus, Delete, EditPen,FolderOpened,CopyDocument} from '@element-plus/icons-vue' import {CirclePlus, Delete, EditPen,FolderOpened,CopyDocument} from '@element-plus/icons-vue'
@@ -157,15 +154,28 @@
dialogTitle: string; dialogTitle: string;
formData: { formData: {
id:string; id: string;//误差体系表Id
name: string; name: string;//误差体系名称
publishTime:string; standard_Name:string;//参照标准名称
year: string; standard_Time:string;//标准推行时间
level: string; dev_Level:string;//使用设备等级
state: string; enable:number;//状态0-不启用 1-启用
state:number;//0-删除 1-正常
}; };
}>(); }>();
// 定义规则
const formRuleRef = ref<FormInstance>()
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
name: [{ required: true, message: '误差体系名称必填!', trigger: 'blur' }],
standard_Name: [{ required: true, message: '参照标准名称必填!', trigger: 'blur' }],
standard_Time: [{ required: true, message: '标准推行时间必填!', trigger: 'blur' }],
dev_Level:[{ required: true, message: '请选择一项设备等级', trigger: 'change' },],
enable:[{ required: true, message: '请选择一项状态', trigger: 'change '},]
});
let multipleSelection = ref<number[]>([]) let multipleSelection = ref<number[]>([])
const errorTypeOptions = [ const errorTypeOptions = [
{ label: '绝对值-标称值', value: 'type1' }, { label: '绝对值-标称值', value: 'type1' },
@@ -254,12 +264,32 @@ const typeList = [
}>(); }>();
const handleCancel = () => { const handleCancel = () => {
//重置表单内容
//取消表单校验状态
formRuleRef.value && formRuleRef.value.resetFields()
emit('update:visible', false); // 关闭对话框 emit('update:visible', false); // 关闭对话框
}; };
const handleSubmit = () => { const handleSubmit = () => {
//ElMessage.info('业务数据提交')
try {
formRuleRef.value?.validate((valid: boolean) => {
if (valid)
{
// 将表单数据转为json,发送到后端
let confirmFormData = JSON.parse(JSON.stringify(props.formData));
console.log(confirmFormData)
emit('submit', props.formData); // 提交表单数据 emit('submit', props.formData); // 提交表单数据
emit('update:visible', false); // 提交后关闭对话框 emit('update:visible', false); // 提交后关闭对话框
}
else
{
ElMessage.error('表单验证失败!')
}
})
} catch (error) {
console.error('验证过程中发生错误', error)
}
}; };
// 当 props.visible 改变时,更新 formData // 当 props.visible 改变时,更新 formData

View File

@@ -50,6 +50,8 @@ import { reactive,ref } from 'vue'
import type { ErrorSystem } from '@/api/error/interface' import type { ErrorSystem } from '@/api/error/interface'
import ErrorSystemDialog from "@/views/machine/errorSystem/components/ErrorSystemDialog.vue"; // 导入子组件 import ErrorSystemDialog from "@/views/machine/errorSystem/components/ErrorSystemDialog.vue"; // 导入子组件
import ErrorStandardDialog from "@/views/machine/errorSystem/components/ErrorStandardDialog.vue"; // 导入子组件 import ErrorStandardDialog from "@/views/machine/errorSystem/components/ErrorStandardDialog.vue"; // 导入子组件
import { useDictStore } from '@/stores/modules/dict'
const dictStore = useDictStore()
let multipleSelection = ref<string[]>([]) let multipleSelection = ref<string[]>([])
const errorData = errorDataList.errordata const errorData = errorDataList.errordata
const dialogFormVisible = ref(false) const dialogFormVisible = ref(false)
@@ -57,25 +59,27 @@ const dialogTitle = ref('新增误差体系')
const dialogForm = ref<ErrorSystem.ErrorSystemList>({ const dialogForm = ref<ErrorSystem.ErrorSystemList>({
id: '', id: '',
name: '', name: '',
publishTime: '', standard_Name:'',
year:'', standard_Time:'',
level:'', dev_Level:'',
state: '', enable:1,
state:1,
}); });
const detail_dialogFormVisible = ref(false) const detail_dialogFormVisible = ref(false)
const detail_dialogTitle = ref('Q/GDW 10650.2-2021 误差体系') const detail_dialogTitle = ref('Q/GDW 10650.2-2021 误差体系')
const detail_dialogForm = ref<ErrorSystem.ErrorSystemDetail>({ const detail_dialogForm = ref<ErrorSystem.Error_detail>({
measured: '',//被测量 measured: '',//被测量
deviceLevel: '',//检测装置级别 deviceLevel: '',//检测装置级别
measurementType:'',
condition: '',//测量条件 condition: '',//测量条件
maxErrorValue: '',//最大误差 maxErrorValue: '',//最大误差
}); });
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemList>[]>([ const columns = ref<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
{ type: 'selection', fixed: 'left', width: 70 }, { type: 'selection', fixed: 'left', width: 70 },
{ {
prop: 'id', prop: 'id',
@@ -85,28 +89,29 @@ const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
{ {
prop: 'name', prop: 'name',
label: '误差体系名称', label: '误差体系名称',
}, },
{ {
prop: 'year', prop: 'Standard_Name',
label: '参照标准名称',
},
{
prop: 'standard_Time',
label: '标准实施年份', label: '标准实施年份',
width: 200, width: 200,
search: { el: 'input' }, search: { el: 'input' },
}, },
{ {
prop: 'level', prop: 'dev_Level',
label: '适用设备等级', label: '适用设备等级',
width: 200, width: 120,
search: { el: 'select', props: { filterable: true } }, search: { el: 'select', props: { filterable: true } },
}, },
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 400, }, { prop: 'operation', label: '操作', fixed: 'right' ,width: 300,},
]) ])
// 打开编辑对话框 // 打开编辑对话框
const openEditDialog = (errorSystem: ErrorSystem.ErrorSystemList) => { const openEditDialog = (errorSystem: ErrorSystem.ErrorSystemList) => {
errorSystem.publishTime ='2024' errorSystem.standard_Time ='2024'
errorSystem.state = '启用';
dialogForm.value = {...errorSystem}; dialogForm.value = {...errorSystem};
dialogTitle.value = '编辑误差体系'; dialogTitle.value = '编辑误差体系';
dialogFormVisible.value = true; // 打开对话框 dialogFormVisible.value = true; // 打开对话框
@@ -116,10 +121,11 @@ const openAddDialog = () => {
dialogForm.value = { dialogForm.value = {
id: '', id: '',
name: '', name: '',
publishTime: '', standard_Name:'',
year: '', standard_Time:'',
level: '', dev_Level:'',
state: '', enable:1,
state:1,
}; };
dialogTitle.value = '新增误差体系'; dialogTitle.value = '新增误差体系';
dialogFormVisible.value = true; // 打开对话框 dialogFormVisible.value = true; // 打开对话框

View File

@@ -1,6 +1,6 @@
<template> <template>
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogSmall"> <el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogSmall">
<el-form :model="formData" > <el-form :model="formData" ref='formRuleRef' :rules='rules'>
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
<el-input v-model="formData.name" :disabled="isReadOnly"/> <el-input v-model="formData.name" :disabled="isReadOnly"/>
</el-form-item> </el-form-item>
@@ -54,7 +54,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { defineProps, defineEmits, reactive,watch,ref } from 'vue'; import{ElMessage, FormInstance,FormItemRule}from'element-plus'
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
import { dialogSmall} from '@/utils/elementBind' import { dialogSmall} from '@/utils/elementBind'
const props = defineProps<{ const props = defineProps<{
visible: boolean; visible: boolean;
@@ -107,13 +108,41 @@ const emit = defineEmits<{
(e: 'submit', data: any): void; (e: 'submit', data: any): void;
}>(); }>();
// 定义规则
const formRuleRef = ref<FormInstance>()
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
name: [{ required: true, message: '检测计划名称必填!', trigger: 'blur' }],
father_Plan_Id: [{ required: true, message: '参照标准名称必填!', trigger: 'change' }],
});
const handleCancel = () => { const handleCancel = () => {
//重置表单内容
//取消表单校验状态
formRuleRef.value && formRuleRef.value.resetFields()
emit('update:visible', false); // 关闭对话框 emit('update:visible', false); // 关闭对话框
}; };
const handleSubmit = () => { const handleSubmit = () => {
try {
formRuleRef.value?.validate((valid: boolean) => {
if (valid)
{
// 将表单数据转为json,发送到后端
let confirmFormData = JSON.parse(JSON.stringify(props.formData));
console.log(confirmFormData)
emit('submit', props.formData); // 提交表单数据 emit('submit', props.formData); // 提交表单数据
emit('update:visible', false); // 提交后关闭对话框 emit('update:visible', false); // 提交后关闭对话框
}
else
{
ElMessage.error('表单验证失败!')
}
})
} catch (error) {
console.error('验证过程中发生错误', error)
}
}; };
// 当 props.visible 改变时,更新 formData // 当 props.visible 改变时,更新 formData

View File

@@ -48,42 +48,42 @@
const columns = reactive<ColumnProps<Device.DeviceList>[]>([ const columns = reactive<ColumnProps<Device.DeviceList>[]>([
{ type: 'selection', fixed: 'left', width: 70 }, { type: 'selection', fixed: 'left', width: 70 },
{ {
prop: 'Name', prop: 'name',
label: '名称', label: '名称',
minWidth: 120, minWidth: 120,
}, },
{ {
prop: 'Dev_Type', prop: 'dev_Type',
label: '类型', label: '类型',
minWidth: 100, minWidth: 100,
}, },
{ {
prop: 'Dev_Chns', prop: 'dev_Chns',
label: '通道数', label: '通道数',
minWidth: 70, minWidth: 100,
}, },
{ {
prop: 'ReCheck_Num', prop: 'reCheck_Num',
label: '复检次数', label: '复检次数',
minWidth: 70, minWidth: 70,
}, },
{ {
prop: 'Report_State', prop: 'report_State',
label: '报告状态', label: '报告状态',
minWidth: 130, minWidth: 130,
}, },
{ {
prop: 'Check_Result', prop: 'check_Result',
label: '检测结果', label: '检测结果',
minWidth: 130, minWidth: 130,
}, },
{ {
prop: 'Check_State', prop: 'check_State',
label: '检测状态', label: '检测状态',
minWidth: 130, minWidth: 130,
}, },
{ {
prop: 'Document_State', prop: 'document_State',
label: '归档状态', label: '归档状态',
minWidth: 130, minWidth: 130,
}, },
@@ -94,8 +94,6 @@
dialogVisible.value = true dialogVisible.value = true
title.value = textTitle title.value = textTitle
} }
defineExpose({ open }) defineExpose({ open })

View File

@@ -21,6 +21,7 @@
<el-button type='primary' link :icon='EditPen' @click="openEditDialog(scope.row)">编辑</el-button> <el-button type='primary' link :icon='EditPen' @click="openEditDialog(scope.row)">编辑</el-button>
<el-button type='primary' link :icon='Delete' >删除</el-button> <el-button type='primary' link :icon='Delete' >删除</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' link :icon='List' @click="showtestSourceOpen(scope.row)">检测源</el-button>
</template> </template>
</ProTable> </ProTable>
@@ -47,13 +48,14 @@ import type { Plan } from '@/api/plan/interface'
import PlanDialog from "@/views/plan/planList/components/PlanDialog.vue"; // 导入子组件 import PlanDialog from "@/views/plan/planList/components/PlanDialog.vue"; // 导入子组件
import Open from '@/views/plan/planList/components/PlanOpen.vue' import Open from '@/views/plan/planList/components/PlanOpen.vue'
import { useViewSize } from '@/hooks/useViewSize' import { useViewSize } from '@/hooks/useViewSize'
import { useRouter } from "vue-router";
const { popupBaseView, viewWidth, viewHeight } = useViewSize() const { popupBaseView, viewWidth, viewHeight } = useViewSize()
const openView = ref() const openView = ref()
const planData = planDataList const planData = planDataList
const dialogFormVisible = ref(false) const dialogFormVisible = ref(false)
const dialogTitle = ref('') const dialogTitle = ref('')
const isReadOnly = ref(false) const isReadOnly = ref(false)
const router = useRouter();
const dialogForm = ref<Plan.PlanList>({ const dialogForm = ref<Plan.PlanList>({
id: '', id: '',
name: '', name: '',
@@ -117,7 +119,7 @@ const columns = reactive<ColumnProps<Plan.PlanList>[]>([
label: '父节点', label: '父节点',
width: 200, width: 200,
}, },
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 350, }, { prop: 'operation', label: '操作', fixed: 'right' ,width: 500, },
]) ])
// 打开编辑对话框 // 打开编辑对话框
@@ -129,6 +131,7 @@ const openEditDialog = (planSystem: Plan.PlanList) => {
}; };
const openAddDialog = () => { const openAddDialog = () => {
dialogForm.value = { dialogForm.value = {
id: '', id: '',
name: '', name: '',
@@ -157,6 +160,12 @@ const handleRowClick = (planSystem: Plan.PlanList) =>{
const showDeviceOpen = (planSystem: Plan.PlanList) => { const showDeviceOpen = (planSystem: Plan.PlanList) => {
openView.value.open('设备列表') openView.value.open('设备列表')
} }
const showtestSourceOpen=(planSystem: Plan.PlanList)=>{
router.push({
path: "/machine/testSource",
});
}
</script> </script>
<style scoped> <style scoped>