检测脚本添加额定电压、额定电流 修改bug
This commit is contained in:
@@ -6,11 +6,15 @@
|
||||
<el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider>
|
||||
</div>
|
||||
<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" />
|
||||
</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-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
|
||||
<div v-if="activeName == tab.value">
|
||||
@@ -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%"
|
||||
>
|
||||
<el-table-column type="index" label="组次" width="60" />
|
||||
@@ -188,12 +193,13 @@
|
||||
v-if="showDialog"
|
||||
/>
|
||||
<!-- 查看 -->
|
||||
<ViewRow ref="viewRowRef"
|
||||
:activeName="activeName"
|
||||
:formContent="props.formContent"
|
||||
@close="viewDialog = false"
|
||||
v-if="viewDialog"
|
||||
/>
|
||||
<ViewRow
|
||||
ref="viewRowRef"
|
||||
:activeName="activeName"
|
||||
:formContent="props.formContent"
|
||||
@close="viewDialog = false"
|
||||
v-if="viewDialog"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -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<TestScript.ResTestScript> = {}) => {
|
||||
@@ -359,48 +366,47 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
|
||||
}
|
||||
// 复制
|
||||
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<TestScript.ResTestScript> = {}) => {
|
||||
|
||||
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<TestScript.ResTestScript> = {}) => {
|
||||
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
|
||||
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@@ -477,16 +481,14 @@ onMounted(() => {
|
||||
|
||||
.content-tree {
|
||||
width: 260px;
|
||||
height: calc(100vh - 315px);
|
||||
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
// margin-right: 10px;
|
||||
overflow: auto; /* 同时启用垂直和水平滚动 */
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.scriptTree {
|
||||
height: calc(100vh - 520px);
|
||||
}
|
||||
|
||||
|
||||
/* 确保 el-tree 内容可以超出容器宽度 */
|
||||
.el-tree {
|
||||
|
||||
Reference in New Issue
Block a user