From 410cfb0f7a7619829f9dc57e52c59b1ea8c9a8ef Mon Sep 17 00:00:00 2001 From: GGJ <357021191@qq.com> Date: Fri, 14 Mar 2025 15:03:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E8=84=9A=E6=9C=AC=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=A2=9D=E5=AE=9A=E7=94=B5=E5=8E=8B=E3=80=81=E9=A2=9D?= =?UTF-8?q?=E5=AE=9A=E7=94=B5=E6=B5=81=20=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/device/interface/testScript.ts | 60 +++++---- frontend/src/styles/element.scss | 20 +++ .../components/errorSystemDetailTable.vue | 2 +- .../components/errorSystemPopup.vue | 2 +- .../testScript/components/communication.vue | 5 +- .../components/testScriptDetail.vue | 118 +++++++++--------- .../components/testScriptDipTab.vue | 2 +- .../testScript/components/testScriptPopup.vue | 70 ++++++++--- 8 files changed, 171 insertions(+), 108 deletions(-) diff --git a/frontend/src/api/device/interface/testScript.ts b/frontend/src/api/device/interface/testScript.ts index dd3db64..a5a8fcc 100644 --- a/frontend/src/api/device/interface/testScript.ts +++ b/frontend/src/api/device/interface/testScript.ts @@ -2,39 +2,37 @@ import type { ReqPage, ResPage } from '@/api/interface' // 检测脚本模块 export namespace TestScript { - - - /** - * 检测脚本表格分页查询参数 - */ - export interface ReqTestScriptParams extends ReqPage{ - id: string; // 装置序号id 必填 - name: string; - type: string; - pattern:string; - } + /** + * 检测脚本表格分页查询参数 + */ + export interface ReqTestScriptParams extends ReqPage { + id: string // 装置序号id 必填 + name: string + type: string + pattern: string + } // 检测脚本接口 export interface ResTestScript { - id?: string; //检测脚本ID - name: string; //检测脚本名称 - type: string; //设定0为脚本,1为模板 - pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对) - valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无) - standardName: string;//参照标准名称 - standardTime: string;//标准推行时间 - state?:number;// - createBy?: string; - createTime?: string; - updateBy?: string; - updateTime?: string; - selectedValue?: string; + id?: string //检测脚本ID + name: string //检测脚本名称 + type: string //设定0为脚本,1为模板 + pattern: string //检测脚本模式(字典表Code字段,数字、模拟、比对) + valueType?: string //脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无) + standardName: string //参照标准名称 + standardTime: string //标准推行时间 + state?: number // + createBy?: string + createTime?: string + updateBy?: string + updateTime?: string + selectedValue?: string + ratedCurr?: number + ratedVolt?: number } - /** - * 检测脚本查询分页返回的对象; - */ - export interface ResTestScriptPage extends ResPage { - - } - } \ No newline at end of file + /** + * 检测脚本查询分页返回的对象; + */ + export interface ResTestScriptPage extends ResPage {} +} diff --git a/frontend/src/styles/element.scss b/frontend/src/styles/element.scss index 04f934d..22874db 100644 --- a/frontend/src/styles/element.scss +++ b/frontend/src/styles/element.scss @@ -578,6 +578,26 @@ } } } +.form-four { + display: flex; + flex-wrap: wrap; + // justify-content: space-between; + .el-form-item { + display: flex; + width: 24%; + + .el-form-item__content { + flex: 1; + + .el-select, + .el-cascader, + .el-input__inner, + .el-date-editor { + width: 100%; + } + } + } +} .el-table__cell { border-right: 1px solid #ebeef5 !important; diff --git a/frontend/src/views/machine/errorSystem/components/errorSystemDetailTable.vue b/frontend/src/views/machine/errorSystem/components/errorSystemDetailTable.vue index 2c3a0e5..f18aed7 100644 --- a/frontend/src/views/machine/errorSystem/components/errorSystemDetailTable.vue +++ b/frontend/src/views/machine/errorSystem/components/errorSystemDetailTable.vue @@ -8,7 +8,7 @@ :header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" - :style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}" + :style="{ height: '400px',maxHeight: '400px',overflow:'hidden'}" @selection-change="handleSelectionChange"> diff --git a/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue b/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue index 435bdde..559a05c 100644 --- a/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue +++ b/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue @@ -3,7 +3,7 @@
- + diff --git a/frontend/src/views/machine/testScript/components/communication.vue b/frontend/src/views/machine/testScript/components/communication.vue index 502733f..0ce0894 100644 --- a/frontend/src/views/machine/testScript/components/communication.vue +++ b/frontend/src/views/machine/testScript/components/communication.vue @@ -8,7 +8,7 @@ color: '#fff' }" stripe - height="calc(100vh - 480px)" + :height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`" :style="{ overflow: 'hidden' }" row-key="id" :expand-row-keys="[props.activeName]" @@ -75,6 +75,9 @@ const props = defineProps({ options: { type: Array, required: true + }, + shrink: { + type: Boolean } }) const tableData = ref([]) diff --git a/frontend/src/views/machine/testScript/components/testScriptDetail.vue b/frontend/src/views/machine/testScript/components/testScriptDetail.vue index 4d47e03..0dd9e04 100644 --- a/frontend/src/views/machine/testScript/components/testScriptDetail.vue +++ b/frontend/src/views/machine/testScript/components/testScriptDetail.vue @@ -6,11 +6,15 @@ 检测项目概要信息
-
+
-
+
@@ -26,6 +30,7 @@ :formContent="props.formContent" :options="props.options" style="width: 360px" + :shrink="props.shrink" :disabled="tab.children.length == 0 ? false : true" ref="communRef" /> @@ -55,7 +60,7 @@ stripe :cell-style="{ textAlign: 'center' }" highlight-current-row - height="calc(100vh - 480px)" + :height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`" style="width: 100%" > @@ -188,12 +193,13 @@ v-if="showDialog" /> - +
@@ -201,7 +207,7 @@ import { type PropType, ref, nextTick } from 'vue' import Tree from './tree.vue' import Commun from './communication.vue' -import {type CascaderOption, ElMessageBox} from 'element-plus' +import { type CascaderOption, ElMessageBox } from 'element-plus' import { getTreeData } from '@/api/check/test' import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue' import type { TestScript } from '@/api/device/interface/testScript' @@ -230,6 +236,9 @@ const props = defineProps({ formContent: { type: Object, required: true + }, + shrink: { + type: Boolean } }) const showDialog = ref(false) @@ -265,7 +274,7 @@ const getTree = () => { }).then(res => { if (res.code === 'A0000') { treeData.value = res.data - console.log('tree',treeData.value) + console.log('tree', treeData.value) // 添加tab子项 props.options.forEach((k: any, i: number) => { tabData.value[i].children = [] @@ -308,7 +317,7 @@ const setTab = row => { const copyActiveName = ref('') // 获取通讯脚本点击 const getCommunication = () => { - console.log('123123',communRef.value[0]?.getData()) + console.log('123123', communRef.value[0]?.getData()) communicationList.value = communRef.value[0]?.getData() } // 切换大tab控制小tab @@ -347,8 +356,6 @@ const inquireTable = () => { tableData.value = res.data } }) - - } // 打开 drawer(新增、编辑) const openDialog = (titleType: string, row: Partial = {}) => { @@ -359,48 +366,47 @@ const openDialog = (titleType: string, row: Partial = } // 复制 const copyRow = async (row: any) => { - ElMessageBox.confirm('是否复制当前检测项目?', '提示', { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: 'warning', - draggable: true - }).then(async () => { - let checkDataList: any = [] - await communRef.value[0]?.getData().forEach((item: any) => { - item.children.forEach((k: any) => { - if (k.enable != 0 || k.errorFlag != 0) { - checkDataList.push({ - pid: k.pid, - valueType: k.id, - dataType: k.dataType, - enable: k.enable, - errorFlag: k.errorFlag - }) - } - }) - }) - let { data } = await scriptDtlsCheckDataList({ checkDataList: checkDataList, ...row, retryCompute: true }) - let copyRow = JSON.parse(JSON.stringify(row)) - delete copyRow.index - - await addScriptDtls({ ...copyRow, scriptType: activeName.value, checkDataList: data }).then(res => { - if (res.code === 'A0000') { - ElMessage.success({ - message: '复制成功!', - type: 'success' + ElMessageBox.confirm('是否复制当前检测项目?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + draggable: true + }).then(async () => { + let checkDataList: any = [] + await communRef.value[0]?.getData().forEach((item: any) => { + item.children.forEach((k: any) => { + if (k.enable != 0 || k.errorFlag != 0) { + checkDataList.push({ + pid: k.pid, + valueType: k.id, + dataType: k.dataType, + enable: k.enable, + errorFlag: k.errorFlag + }) + } + }) + }) + let { data } = await scriptDtlsCheckDataList({ checkDataList: checkDataList, ...row, retryCompute: true }) + let copyRow = JSON.parse(JSON.stringify(row)) + delete copyRow.index + + await addScriptDtls({ ...copyRow, scriptType: activeName.value, checkDataList: data }).then(res => { + if (res.code === 'A0000') { + ElMessage.success({ + message: '复制成功!', + type: 'success' + }) + getTree() + } }) - getTree() - } }) - }) } // 查看 const view = (row: Partial = {}) => { - getCommunication() - console.log('communicationList',communicationList.value) + console.log('communicationList', communicationList.value) //当前点击的一级tab - const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'; + const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称' //当前点击的二级tab const childrenTabName = ref('') tabData.value.forEach((item: any) => { @@ -416,12 +422,11 @@ const view = (row: Partial = {}) => { setTimeout(() => { viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value) }, 0) - } // 删除 const deleteRow = async (row: any) => { - await useHandleData(deleteDtls, { enable: row.enable, index: row.index, scriptId: row.scriptId }, `删除`) - getTree() + await useHandleData(deleteDtls, { enable: row.enable, index: row.index, scriptId: row.scriptId }, `删除`) + getTree() } // 启用 const enableRow = async (row: any) => { @@ -453,7 +458,7 @@ const addTab = (row: any) => { const saveTheNewsletter = () => {} onMounted(() => { getTree() - console.log('testScriptDetail',props.options) + console.log('testScriptDetail', props.options) props.options.forEach((item: any) => { tabData.value.push({ label: item.label.replace(/准确度|检测/g, ''), @@ -466,7 +471,6 @@ onMounted(() => { valueCode.value = dictStore .getDictData('Script_Value_Type') .filter(item => item.id == props.formContent.valueType)[0].code - })