检测脚本添加额定电压、额定电流 修改bug

This commit is contained in:
GGJ
2025-03-14 15:03:36 +08:00
parent 7caa4a5303
commit 410cfb0f7a
8 changed files with 171 additions and 108 deletions

View File

@@ -2,39 +2,37 @@ import type { ReqPage, ResPage } from '@/api/interface'
// 检测脚本模块 // 检测脚本模块
export namespace TestScript { export namespace TestScript {
/** /**
* 检测脚本表格分页查询参数 * 检测脚本表格分页查询参数
*/ */
export interface ReqTestScriptParams extends ReqPage{ export interface ReqTestScriptParams extends ReqPage {
id: string; // 装置序号id 必填 id: string // 装置序号id 必填
name: string; name: string
type: string; type: string
pattern:string; pattern: string
} }
// 检测脚本接口 // 检测脚本接口
export interface ResTestScript { export interface ResTestScript {
id?: string; //检测脚本ID id?: string //检测脚本ID
name: string; //检测脚本名称 name: string //检测脚本名称
type: string; //设定0为脚本1为模板 type: string //设定0为脚本1为模板
pattern: string;//检测脚本模式(字典表Code字段数字、模拟、比对) pattern: string //检测脚本模式(字典表Code字段数字、模拟、比对)
valueType?: string;//脚本值类型(字典表Code字段相对值脚本、绝对值脚本、无) valueType?: string //脚本值类型(字典表Code字段相对值脚本、绝对值脚本、无)
standardName: string;//参照标准名称 standardName: string //参照标准名称
standardTime: string;//标准推行时间 standardTime: string //标准推行时间
state?:number;// state?: number //
createBy?: string; createBy?: string
createTime?: string; createTime?: string
updateBy?: string; updateBy?: string
updateTime?: string; updateTime?: string
selectedValue?: string; selectedValue?: string
ratedCurr?: number
ratedVolt?: number
} }
/** /**
* 检测脚本查询分页返回的对象; * 检测脚本查询分页返回的对象;
*/ */
export interface ResTestScriptPage extends ResPage<ResTestScript> { export interface ResTestScriptPage extends ResPage<ResTestScript> {}
}
}
}

View File

@@ -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 { .el-table__cell {
border-right: 1px solid #ebeef5 !important; border-right: 1px solid #ebeef5 !important;

View File

@@ -8,7 +8,7 @@
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } " :header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
:cell-style="{ textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"
style="width: 100%" style="width: 100%"
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}" :style="{ height: '400px',maxHeight: '400px',overflow:'hidden'}"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column prop="sort" label="序号" width="60" /> <el-table-column prop="sort" label="序号" width="60" />

View File

@@ -3,7 +3,7 @@
<el-tabs type="border-card"> <el-tabs type="border-card">
<el-tab-pane label="基础信息"> <el-tab-pane label="基础信息">
<div > <div >
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' label-width="auto" class="form-three"> <el-form :model="formContent" ref='dialogFormRef' :rules='rules' label-width="auto" class="form-four">
<el-form-item label="标准号" prop="standardName" > <el-form-item label="标准号" prop="standardName" >
<el-input v-model='formContent.standardName' placeholder="请填写标准号"/> <el-input v-model='formContent.standardName' placeholder="请填写标准号"/>
</el-form-item> </el-form-item>

View File

@@ -8,7 +8,7 @@
color: '#fff' color: '#fff'
}" }"
stripe stripe
height="calc(100vh - 480px)" :height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`"
:style="{ overflow: 'hidden' }" :style="{ overflow: 'hidden' }"
row-key="id" row-key="id"
:expand-row-keys="[props.activeName]" :expand-row-keys="[props.activeName]"
@@ -75,6 +75,9 @@ const props = defineProps({
options: { options: {
type: Array, type: Array,
required: true required: true
},
shrink: {
type: Boolean
} }
}) })
const tableData = ref<any[]>([]) const tableData = ref<any[]>([])

View File

@@ -6,11 +6,15 @@
<el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider> <el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider>
</div> </div>
<div class="data-check-content"> <div class="data-check-content">
<div class="content-tree"> <div class="content-tree" :style="{ height: `calc(100vh - ${props.shrink ? '370px' : '315px'})` }">
<Tree :treeData="treeData" @setTab="setTab" /> <Tree :treeData="treeData" @setTab="setTab" />
</div> </div>
<div class="content-right-Tabs" style="height: calc(100vh - 315px); width: 100px"> <div
class="content-right-Tabs"
style="width: 100px"
:style="{ height: `calc(100vh - ${props.shrink ? '370px' : '315px'})` }"
>
<el-tabs type="border-card" style="height: 100%" v-model="activeName" @tab-change="tabChange"> <el-tabs type="border-card" style="height: 100%" v-model="activeName" @tab-change="tabChange">
<el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value"> <el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
<div v-if="activeName == tab.value"> <div v-if="activeName == tab.value">
@@ -26,6 +30,7 @@
:formContent="props.formContent" :formContent="props.formContent"
:options="props.options" :options="props.options"
style="width: 360px" style="width: 360px"
:shrink="props.shrink"
:disabled="tab.children.length == 0 ? false : true" :disabled="tab.children.length == 0 ? false : true"
ref="communRef" ref="communRef"
/> />
@@ -55,7 +60,7 @@
stripe stripe
:cell-style="{ textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"
highlight-current-row highlight-current-row
height="calc(100vh - 480px)" :height="`calc(100vh - ${props.shrink ? '535px' : '480px'})`"
style="width: 100%" style="width: 100%"
> >
<el-table-column type="index" label="组次" width="60" /> <el-table-column type="index" label="组次" width="60" />
@@ -188,7 +193,8 @@
v-if="showDialog" v-if="showDialog"
/> />
<!-- 查看 --> <!-- 查看 -->
<ViewRow ref="viewRowRef" <ViewRow
ref="viewRowRef"
:activeName="activeName" :activeName="activeName"
:formContent="props.formContent" :formContent="props.formContent"
@close="viewDialog = false" @close="viewDialog = false"
@@ -201,7 +207,7 @@
import { type PropType, ref, nextTick } from 'vue' import { type PropType, ref, nextTick } from 'vue'
import Tree from './tree.vue' import Tree from './tree.vue'
import Commun from './communication.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 { getTreeData } from '@/api/check/test'
import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue' import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue'
import type { TestScript } from '@/api/device/interface/testScript' import type { TestScript } from '@/api/device/interface/testScript'
@@ -230,6 +236,9 @@ const props = defineProps({
formContent: { formContent: {
type: Object, type: Object,
required: true required: true
},
shrink: {
type: Boolean
} }
}) })
const showDialog = ref(false) const showDialog = ref(false)
@@ -265,7 +274,7 @@ const getTree = () => {
}).then(res => { }).then(res => {
if (res.code === 'A0000') { if (res.code === 'A0000') {
treeData.value = res.data treeData.value = res.data
console.log('tree',treeData.value) console.log('tree', treeData.value)
// 添加tab子项 // 添加tab子项
props.options.forEach((k: any, i: number) => { props.options.forEach((k: any, i: number) => {
tabData.value[i].children = [] tabData.value[i].children = []
@@ -308,7 +317,7 @@ const setTab = row => {
const copyActiveName = ref('') const copyActiveName = ref('')
// 获取通讯脚本点击 // 获取通讯脚本点击
const getCommunication = () => { const getCommunication = () => {
console.log('123123',communRef.value[0]?.getData()) console.log('123123', communRef.value[0]?.getData())
communicationList.value = communRef.value[0]?.getData() communicationList.value = communRef.value[0]?.getData()
} }
// 切换大tab控制小tab // 切换大tab控制小tab
@@ -347,8 +356,6 @@ const inquireTable = () => {
tableData.value = res.data tableData.value = res.data
} }
}) })
} }
// 打开 drawer(新增、编辑) // 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => { const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
@@ -360,8 +367,8 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
// 复制 // 复制
const copyRow = async (row: any) => { const copyRow = async (row: any) => {
ElMessageBox.confirm('是否复制当前检测项目?', '提示', { ElMessageBox.confirm('是否复制当前检测项目?', '提示', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: 'warning', type: 'warning',
draggable: true draggable: true
}).then(async () => { }).then(async () => {
@@ -396,11 +403,10 @@ const copyRow = async (row: any) => {
} }
// 查看 // 查看
const view = (row: Partial<TestScript.ResTestScript> = {}) => { const view = (row: Partial<TestScript.ResTestScript> = {}) => {
getCommunication() getCommunication()
console.log('communicationList',communicationList.value) console.log('communicationList', communicationList.value)
//当前点击的一级tab //当前点击的一级tab
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'; const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'
//当前点击的二级tab //当前点击的二级tab
const childrenTabName = ref('') const childrenTabName = ref('')
tabData.value.forEach((item: any) => { tabData.value.forEach((item: any) => {
@@ -416,7 +422,6 @@ const view = (row: Partial<TestScript.ResTestScript> = {}) => {
setTimeout(() => { setTimeout(() => {
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value) viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
}, 0) }, 0)
} }
// 删除 // 删除
const deleteRow = async (row: any) => { const deleteRow = async (row: any) => {
@@ -453,7 +458,7 @@ const addTab = (row: any) => {
const saveTheNewsletter = () => {} const saveTheNewsletter = () => {}
onMounted(() => { onMounted(() => {
getTree() getTree()
console.log('testScriptDetail',props.options) console.log('testScriptDetail', props.options)
props.options.forEach((item: any) => { props.options.forEach((item: any) => {
tabData.value.push({ tabData.value.push({
label: item.label.replace(/准确度|检测/g, ''), label: item.label.replace(/准确度|检测/g, ''),
@@ -466,7 +471,6 @@ onMounted(() => {
valueCode.value = dictStore valueCode.value = dictStore
.getDictData('Script_Value_Type') .getDictData('Script_Value_Type')
.filter(item => item.id == props.formContent.valueType)[0].code .filter(item => item.id == props.formContent.valueType)[0].code
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -477,16 +481,14 @@ onMounted(() => {
.content-tree { .content-tree {
width: 260px; width: 260px;
height: calc(100vh - 315px);
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
border-radius: 4px; border-radius: 4px;
// margin-right: 10px; // margin-right: 10px;
overflow: auto; /* 同时启用垂直和水平滚动 */ overflow: auto; /* 同时启用垂直和水平滚动 */
overflow-x: hidden; overflow-x: hidden;
} }
.scriptTree {
height: calc(100vh - 520px);
}
/* 确保 el-tree 内容可以超出容器宽度 */ /* 确保 el-tree 内容可以超出容器宽度 */
.el-tree { .el-tree {

View File

@@ -35,7 +35,7 @@
:disabled="!form[0].dipFlag" :disabled="!form[0].dipFlag"
/> />
</el-form-item> </el-form-item>
<el-form-item label-width="120px" label="持续时间(s)"> <el-form-item label-width="120px" label="持续时间(周波)">
<el-input <el-input
type="number" type="number"
v-model="form[0].dipData.retainTime" v-model="form[0].dipData.retainTime"

View File

@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<el-card style="margin-bottom: 10px" class="cardTop"> <el-card style="margin-bottom: 10px" class="cardTop" :style="{ height: height }">
<el-form <el-form
:model="formContent" :model="formContent"
:inline="true" :inline="true"
@@ -30,6 +30,18 @@
<el-option v-for="item in stencil" :key="item.value" :label="item.name" :value="item.value" /> <el-option v-for="item in stencil" :key="item.value" :label="item.name" :value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item>
<div class="formBut">
<el-button
type="primary"
:icon="shrink ? ArrowUpBold : ArrowDownBold"
@click="shrinkChange"
></el-button>
<el-button type="primary" :icon="Select" @click="save">保存</el-button>
<el-button :icon="Close" @click="close">返回</el-button>
</div>
</el-form-item>
<el-form-item label="检测脚本值类型" prop="valueType"> <el-form-item label="检测脚本值类型" prop="valueType">
<el-select <el-select
v-model="formContent.valueType" v-model="formContent.valueType"
@@ -46,16 +58,30 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item label="额定电流" prop="ratedCurr">
<div class="formBut"> <el-input-number
<el-button type="primary" :icon="Select" @click="save">保存</el-button> v-model.trim="formContent.ratedCurr"
<el-button :icon="Close" @click="close">返回</el-button> min="0"
</div> max="20"
style="width: 100%"
placeholder="请输入额定电流"
clearable
/>
</el-form-item>
<el-form-item label="额定电压" prop="ratedVolt">
<el-input-number
v-model.trim="formContent.ratedVolt"
min="0"
max="380"
style="width: 100%"
placeholder="请输入额定电压"
clearable
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<el-card v-if="show"> <el-card v-if="show">
<TestScriptDetail :options="secondLevelOptions" :formContent="formContent" /> <TestScriptDetail :options="secondLevelOptions" :formContent="formContent" :shrink="shrink" />
</el-card> </el-card>
</div> </div>
</template> </template>
@@ -67,11 +93,12 @@ import { type TestScript } from '@/api/device/interface/testScript'
import type { Dict } from '@/api/system/dictionary/interface' import type { Dict } from '@/api/system/dictionary/interface'
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree' import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
import type { CascaderOption } from 'element-plus' import type { CascaderOption } from 'element-plus'
import { Select, Close } from '@element-plus/icons-vue' import { Select, Close, ArrowDownBold, ArrowUpBold } from '@element-plus/icons-vue'
import { pqScriptAdd, pqScriptUpdate } from '@/api/device/testScript' import { pqScriptAdd, pqScriptUpdate } from '@/api/device/testScript'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
const modeId = ref() const modeId = ref()
const show = ref(false) const show = ref(false)
const height = ref('125px')
const router = useRouter() const router = useRouter()
const secondLevelOptions: any[] = [] const secondLevelOptions: any[] = []
@@ -87,10 +114,13 @@ function useMetaInfo() {
pattern: modeId.value, pattern: modeId.value,
standardName: '', standardName: '',
standardTime: '', standardTime: '',
state: 1 state: 1,
ratedCurr: 0,
ratedVolt: 0
}) })
return { titleType, formContent } return { titleType, formContent }
} }
const shrink = ref(true)
const stencil = [ const stencil = [
{ name: '脚本', value: 0 }, { name: '脚本', value: 0 },
{ name: '模版', value: 1 } { name: '模版', value: 1 }
@@ -100,11 +130,17 @@ const rules = {
standardName: [{ required: true, message: '请输入参照标准名称', trigger: 'blur' }], standardName: [{ required: true, message: '请输入参照标准名称', trigger: 'blur' }],
standardTime: [{ required: true, message: '请选择标准推行年份', trigger: 'change' }], standardTime: [{ required: true, message: '请选择标准推行年份', trigger: 'change' }],
type: [{ required: true, message: '请选择模版类型', trigger: 'change' }], type: [{ required: true, message: '请选择模版类型', trigger: 'change' }],
valueType: [{ required: true, message: '请选择检测脚本值类型', trigger: 'change' }] valueType: [{ required: true, message: '请选择检测脚本值类型', trigger: 'change' }],
ratedCurr: [{ required: true, message: '请填写额定电流', trigger: 'change' }],
ratedVolt: [{ required: true, message: '请填写额定电压', trigger: 'change' }]
} }
const { titleType, formContent } = useMetaInfo() const { titleType, formContent } = useMetaInfo()
// 收缩
const shrinkChange = () => {
shrink.value = !shrink.value
shrink.value ? (height.value = '125px') : (height.value = '70px')
}
// 清空formContent // 清空formContent
const resetFormContent = () => { const resetFormContent = () => {
formContent.value = { formContent.value = {
@@ -114,13 +150,14 @@ const resetFormContent = () => {
pattern: '', pattern: '',
standardName: '', standardName: '',
standardTime: '', standardTime: '',
state: 1 state: 1,
ratedCurr: 0,
ratedVolt: 0
} }
router.go(-1) router.go(-1)
} }
// 关闭弹窗 // 关闭弹窗
const close = () => { const close = () => {
// 清空dialogForm中的值 // 清空dialogForm中的值
resetFormContent() resetFormContent()
// 重置表单 // 重置表单
@@ -151,6 +188,9 @@ const save = () => {
} }
}) })
} }
} else {
shrink.value = true
height.value = '125px'
} }
}) })
} }
@@ -163,7 +203,7 @@ const open = async (title: string, row: any) => {
} else { } else {
let list = JSON.parse(row) let list = JSON.parse(row)
formContent.value = list formContent.value = list
console.log('🚀 ~ open ~ list:', formContent.value ) console.log('🚀 ~ open ~ list:', formContent.value)
show.value = true show.value = true
} }
// 重置表单 // 重置表单
@@ -239,7 +279,7 @@ defineExpose({ open })
// justify-content: space-between; // justify-content: space-between;
.el-form-item { .el-form-item {
display: flex; display: flex;
width: 15.8%; width: 18.8%;
.el-form-item__content { .el-form-item__content {
flex: 1; flex: 1;