From 3c56eb2ba09bf8bf27775dd4424f040d0e0eade9 Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Tue, 26 Nov 2024 15:41:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=AF=E5=B7=AE=E4=BD=93=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/device/error/index.ts | 69 ++-- frontend/src/api/device/interface/error.ts | 79 ++-- .../machine/device/components/devicePopup.vue | 51 ++- .../machine/device/components/monitorTab.vue | 5 +- .../components/ErrorSystemDialog.vue | 386 ------------------ ...ndardDialog.vue => errorStandardPopup.vue} | 0 .../components/errorSystemDetailTable.vue | 189 +++++++++ .../components/errorSystemPopup.vue | 204 +++++++++ .../src/views/machine/errorSystem/index.vue | 147 +++---- .../src/views/machine/testSource/index.vue | 35 +- .../plan/planList/components/moreButtons.vue | 2 +- frontend/src/views/plan/planList/index.vue | 2 +- 12 files changed, 548 insertions(+), 621 deletions(-) delete mode 100644 frontend/src/views/machine/errorSystem/components/ErrorSystemDialog.vue rename frontend/src/views/machine/errorSystem/components/{ErrorStandardDialog.vue => errorStandardPopup.vue} (100%) create mode 100644 frontend/src/views/machine/errorSystem/components/errorSystemDetailTable.vue create mode 100644 frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue diff --git a/frontend/src/api/device/error/index.ts b/frontend/src/api/device/error/index.ts index b68b6a6..5b7f13f 100644 --- a/frontend/src/api/device/error/index.ts +++ b/frontend/src/api/device/error/index.ts @@ -1,41 +1,34 @@ -// 误差体系模块 -export namespace ErrorSystem { - // 误差体系列表 - export interface ErrorSystemList { - id: string;//误差体系表Id - name: string;//误差体系名称 - standard_Name:string;//参照标准名称 - standard_Time:string;//标准推行时间 - dev_Level:string;//使用设备等级 - enable?:number;//状态:0-不启用 1-启用 - state:number;//0-删除 1-正常 - create_By?:string;//创建用户 - create_Time?:string;//创建时间 - update_By?:string;//修改用户 - update_Time?:string;//修改时间 - } +import type { ErrorSystem } from '@/api/device/interface/error' +import http from '@/api' + +/** + * @name 误差体系管理模块 + */ + +//获取误差体系 +export const getPqErrSysList = (params: ErrorSystem.ErrorSystemList) => { + return http.post(`/pqErrSys/list`, params) +} + +//根据id查询误差体系 +export const getPqErrSysListById = (params: ErrorSystem.ErrorSystemList) => { + return http.get(`/pqErrSys/getById?id=${params.id}`) +} + +//添加误差体系 +export const addPqErrSys = (params: ErrorSystem.ErrorSystemList) => { + return http.post(`/pqErrSys/add`, params) +} + +//编辑误差体系 +export const updatePqErrSys = (params: ErrorSystem.ErrorSystemList) => { + return http.post(`/pqErrSys/update`, params) +} + +//删除误差体系 +export const deletePqErrSys = (params: string[]) => { + return http.post(`/pqErrSys/delete`, params) +} - // 查看详细误差体系 - export interface ErrorSystemDetail { - id:string;//误差体系子表ID - error_Sys_Id:string;//所属误差体系ID - type: string;//检测脚本类型,树形字典表(没有树形表则需要拆分字段) - JudgeConditionStart?:number;//误差判断起始值(误差范围) - 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; - } - } \ No newline at end of file diff --git a/frontend/src/api/device/interface/error.ts b/frontend/src/api/device/interface/error.ts index b68b6a6..15bfd1e 100644 --- a/frontend/src/api/device/interface/error.ts +++ b/frontend/src/api/device/interface/error.ts @@ -1,41 +1,46 @@ +import type { ReqPage } from "@/api/interface"; + // 误差体系模块 export namespace ErrorSystem { - // 误差体系列表 - export interface ErrorSystemList { - id: string;//误差体系表Id - name: string;//误差体系名称 - standard_Name:string;//参照标准名称 - standard_Time:string;//标准推行时间 - dev_Level:string;//使用设备等级 - enable?:number;//状态:0-不启用 1-启用 - state:number;//0-删除 1-正常 - create_By?:string;//创建用户 - create_Time?:string;//创建时间 - update_By?:string;//修改用户 - update_Time?:string;//修改时间 + + // 误差体系列表 + export interface ErrorSystemList { + id: string;//误差体系表Id + name: string;//误差体系名称 + standardName:string;//参照标准名称 + standardTime:string;//标准推行时间 + devLevel:string;//使用设备等级 + enable:number;//状态:0-不启用 1-启用 + state:number;//0-删除 1-正常 + createBy?:string;//创建用户 + createTime?:string;//创建时间 + updateBy?:string;//修改用户 + updateTime?:string;//修改时间 + pqErrSysDtlsList?: ErrorSystemDetail[];//误差体系子表列表 + } + + + // 查看详细误差体系 + export interface ErrorSystemDetail { + nextId: number; + id:string;//误差体系子表ID + errorSysId:string;//所属误差体系ID + type: string;//检测脚本类型,树形字典表(没有树形表则需要拆分字段) + startValue?:number;//误差判断起始值(误差范围) + startFlag?:number;//是否包含起始值 + endValue?:number;//;误差判断结束值(误差范围) + endFlag?:number;//是否包含结束值 + conditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值) + maxErrorValue:number;//误差最大值 + errorValueType:string;//误差值类型(包括值类型,绝对值、相对值1、相对值2) } - - // 查看详细误差体系 - export interface ErrorSystemDetail { - id:string;//误差体系子表ID - error_Sys_Id:string;//所属误差体系ID - type: string;//检测脚本类型,树形字典表(没有树形表则需要拆分字段) - JudgeConditionStart?:number;//误差判断起始值(误差范围) - 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; - } - } \ No newline at end of file + // 查看详细误差体系 + // export interface Error_detail { + // measured: string; + // deviceLevel: string; + // measurementType:string; + // condition: string; + // maxErrorValue: string; + // } +} \ No newline at end of file diff --git a/frontend/src/views/machine/device/components/devicePopup.vue b/frontend/src/views/machine/device/components/devicePopup.vue index adad227..f833eda 100644 --- a/frontend/src/views/machine/device/components/devicePopup.vue +++ b/frontend/src/views/machine/device/components/devicePopup.vue @@ -319,8 +319,14 @@ const disabledDate = (time: Date) => { manufacturer: [{ required: true, message: '生产厂家必选!', trigger: 'change' }], encryptionFlag: [{ required: true, message: '是否加密必选!', trigger: 'change' }], protocol: [{ required: true, message: '通讯协议必选!', trigger: 'change' }], - series: [], - devKey: [] + // series: [], + // devKey: [] + series : [ + { required: true, message: '请输入识别码', trigger: 'blur' } + ], + devKey : [ + { required: true, message: '请输入密钥', trigger: 'blur' } + ], }) // 关闭弹窗 @@ -335,7 +341,7 @@ const disabledDate = (time: Date) => { // 保存数据 const save = () => { - try { + try { dialogFormRef.value?.validate(async (valid: boolean) => { if (formContent.value.encryptionFlag === 1) { @@ -353,7 +359,17 @@ const disabledDate = (time: Date) => { if (formContent.value.id) { await updatePqDev(formContent.value); ElMessage.success({ message: `${dialogTitle.value}成功!` }) - } else { + } else { + // 新增需要把设备模式转成字典ID + const patternItem = dictStore.getDictData('Pattern').find(item => item.name === formContent.value.pattern); + if (patternItem) { + formContent.value.pattern = patternItem.id; + } + // 新增需要把通讯协议转成字典ID + const protocolItem = dictStore.getDictData('Protocol').find(item => item.name === formContent.value.protocol); + if (protocolItem) { + formContent.value.protocol = protocolItem.id; + } await addPqDev(formContent.value); ElMessage.success({ message: `${dialogTitle.value}成功!` }) @@ -373,8 +389,6 @@ const disabledDate = (time: Date) => { // 打开弹窗,可能是新增,也可能是编辑 const open = (sign: string, data: Device.ResPqDev,currentMode: string) => { mode.value = currentMode - // 重置表单 - dialogFormRef.value?.resetFields() titleType.value = sign dialogVisible.value = true @@ -397,30 +411,23 @@ const open = (sign: string, data: Device.ResPqDev,currentMode: string) => { resetFormContent() handleEncryptionChange(1) } + + // 重置表单 + dialogFormRef.value?.resetFields() } const handleEncryptionChange = (value: number) => { // 根据是否加密来显示或隐藏识别码和密钥 - if(value === 1){ IsPasswordShow.value = true - rules.value.series = [ - { required: true, message: '请输入识别码', trigger: 'blur' } - ]; - rules.value.devKey = [ - { required: true, message: '请输入密钥', trigger: 'blur' } - ]; + }else { - IsPasswordShow.value = false - formContent.value.series = '' - formContent.value.devKey = '' - rules.value.series = []; - rules.value.devKey = []; + IsPasswordShow.value = false + // formContent.value.series = '' + // formContent.value.devKey = '' + // rules.value.series = []; + // rules.value.devKey = []; } - - // 如果选择"是",则显示;否则隐藏 - dialogFormRef.value?.clearValidate(); // 清除验证状态 - } // 对外映射 diff --git a/frontend/src/views/machine/device/components/monitorTab.vue b/frontend/src/views/machine/device/components/monitorTab.vue index a4e1a44..209b289 100644 --- a/frontend/src/views/machine/device/components/monitorTab.vue +++ b/frontend/src/views/machine/device/components/monitorTab.vue @@ -29,9 +29,8 @@ import { getPqMonList } from '@/api/device/monitor' import { type ColumnProps } from '@/components/ProTable/interface' import { type Monitor } from '@/api/device/interface/monitor' - const props = defineProps({ - MonIsShow: Boolean, - }); + + // 表格配置项 diff --git a/frontend/src/views/machine/errorSystem/components/ErrorSystemDialog.vue b/frontend/src/views/machine/errorSystem/components/ErrorSystemDialog.vue deleted file mode 100644 index b0e0e23..0000000 --- a/frontend/src/views/machine/errorSystem/components/ErrorSystemDialog.vue +++ /dev/null @@ -1,386 +0,0 @@ - - - - - \ No newline at end of file diff --git a/frontend/src/views/machine/errorSystem/components/ErrorStandardDialog.vue b/frontend/src/views/machine/errorSystem/components/errorStandardPopup.vue similarity index 100% rename from frontend/src/views/machine/errorSystem/components/ErrorStandardDialog.vue rename to frontend/src/views/machine/errorSystem/components/errorStandardPopup.vue diff --git a/frontend/src/views/machine/errorSystem/components/errorSystemDetailTable.vue b/frontend/src/views/machine/errorSystem/components/errorSystemDetailTable.vue new file mode 100644 index 0000000..24639c8 --- /dev/null +++ b/frontend/src/views/machine/errorSystem/components/errorSystemDetailTable.vue @@ -0,0 +1,189 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue b/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue new file mode 100644 index 0000000..4f96f71 --- /dev/null +++ b/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue @@ -0,0 +1,204 @@ + + + + + diff --git a/frontend/src/views/machine/errorSystem/index.vue b/frontend/src/views/machine/errorSystem/index.vue index 2c09f78..c8ff00a 100644 --- a/frontend/src/views/machine/errorSystem/index.vue +++ b/frontend/src/views/machine/errorSystem/index.vue @@ -3,148 +3,93 @@ -