优化检测脚本页面

This commit is contained in:
GGJ
2025-02-24 16:45:39 +08:00
parent 1a23bcb510
commit bd1eecc106
8 changed files with 544 additions and 411 deletions

View File

@@ -13,120 +13,140 @@
<div class="content-right-Tabs" style="height: calc(100vh - 335px); width: 100px">
<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 class="dialog-footer">
<el-button :icon="CirclePlus" type="primary" @click="openDialog('add')">新增</el-button>
<el-button :icon="Check" type="primary" @click="saveTheNewsletter">保存通讯脚本</el-button>
</div>
<div style="display: flex">
<!-- 通信脚本 -->
<el-tabs type="border-card" v-model="firstName" style="height: 100%">
<el-tab-pane label="通讯脚本" name="first">
<Commun :activeName="activeName" style="width: 400px" />
</el-tab-pane>
</el-tabs>
<!-- 2级tab -->
<el-tabs
type="border-card"
style="flex: 1; margin-left: 10px"
v-model="childActiveName"
@tab-change="inquireTable"
>
<el-tab-pane
v-for="subTab in tab.children || []"
:key="subTab.value"
:label="subTab.label"
:name="subTab.value"
style="width: 100%"
<div v-if="activeName == tab.value">
<div class="dialog-footer">
<el-button :icon="CirclePlus" type="primary" @click="openDialog('add')">新增</el-button>
</div>
<div style="display: flex">
<!-- 通信脚本 -->
<el-tabs type="border-card" v-model="firstName" style="height: 100%">
<el-tab-pane label="通讯脚本" name="first">
<Commun
:activeName="activeName"
:formContent="props.formContent"
style="width: 400px"
:disabled="tab.children.length == 0 ? false : true"
ref="communRef"
/>
</el-tab-pane>
</el-tabs>
<!-- 2级tab -->
<el-tabs
type="border-card"
style="flex: 1; margin-left: 10px"
v-model="childActiveName"
@tab-change="inquireTable"
>
<el-table
:data="tableData"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
color: '#fff'
}"
stripe
:cell-style="{ textAlign: 'center' }"
height="calc(100vh - 515px)"
<el-tab-pane
v-for="subTab in tab.children || []"
:key="subTab.value"
:label="subTab.label"
:name="subTab.value"
style="width: 100%"
>
<el-table-column type="index" label="组次" width="60" />
<el-table-column prop="ffreq" label="频率(Hz)" width="100" />
<el-table-column :label="item.label" v-for="item in column" :key="item.label">
<template #default="{ row }">
<table class="tableL">
<tr>
<td class="theFirst">V</td>
<td>
{{
'电压=' +
row.channelList[item.num]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
}}
</td>
<td>
{{ '相角=' + row.channelList[item.num]?.fphase + '°' }}
</td>
</tr>
<tr>
<td class="theFirst">I</td>
<td>
{{
'电流=' +
row.channelList[item.num + 1]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
}}
</td>
<td>
{{ '相角=' + row.channelList[item.num + 1]?.fphase + '°' }}
</td>
</tr>
</table>
</template>
</el-table-column>
<el-table-column label="是否启用" width="90">
<template #default="{ row }">
<el-switch
v-model="row.enable"
:active-value="1"
:inactive-value="0"
@change="enableRow(row)"
>
<template #active-action>
<span></span>
</template>
<template #inactive-action>
<span>×</span>
</template>
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="220">
<template #default="{ row }">
<el-button
type="primary"
link
:icon="CopyDocument"
@click="copyRow(row)"
>
复制
</el-button>
<el-button
type="primary"
link
:icon="CopyDocument"
@click="openDialog('edit', row)"
>
编辑
</el-button>
<el-button type="primary" link :icon="Delete" @click="deleteRow(row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<el-table
:data="tableData"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
color: '#fff'
}"
stripe
:cell-style="{ textAlign: 'center' }"
height="calc(100vh - 515px)"
style="width: 100%"
>
<el-table-column type="index" label="组次" width="60" />
<el-table-column prop="ffreq" label="频率(Hz)" width="100" />
<el-table-column
:label="item.label"
v-for="item in column"
:key="item.label"
>
<template #default="{ row }">
<table class="tableL">
<tr>
<td class="theFirst">V</td>
<td>
{{
'电压=' +
row.channelList[item.num]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
}}
</td>
<td>
{{ '相角=' + row.channelList[item.num]?.fphase + '°' }}
</td>
</tr>
<tr>
<td class="theFirst">I</td>
<td>
{{
'电流=' +
row.channelList[item.num + 1]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
}}
</td>
<td>
{{
'相角=' +
row.channelList[item.num + 1]?.fphase +
'°'
}}
</td>
</tr>
</table>
</template>
</el-table-column>
<el-table-column label="是否启用" width="90">
<template #default="{ row }">
<el-switch
v-model="row.enable"
:active-value="1"
:inactive-value="0"
@change="enableRow(row)"
>
<template #active-action>
<span></span>
</template>
<template #inactive-action>
<span>×</span>
</template>
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="220">
<template #default="{ row }">
<el-button
type="primary"
link
:icon="CopyDocument"
@click="copyRow(row)"
>
复制
</el-button>
<el-button
type="primary"
link
:icon="CopyDocument"
@click="openDialog('edit', row)"
>
编辑
</el-button>
<el-button
type="primary"
link
:icon="Delete"
@click="deleteRow(row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</div>
</div>
</el-tab-pane>
</el-tabs>
@@ -139,7 +159,9 @@
:activeName="activeName"
:childActiveName="childActiveName"
:formContent="props.formContent"
:communicationList="communicationList"
@addTab="addTab"
@getCommunication="getCommunication"
@close="showDialog = false"
v-if="showDialog"
/>
@@ -166,6 +188,7 @@ interface TabOption {
code?: string
children?: TabOption[]
}
const communRef = ref()
const treeData = ref<CheckData.TreeItem[]>([])
const valueCode = ref('') //Absolute绝对值
const props = defineProps({
@@ -183,6 +206,7 @@ const dictStore = useDictStore()
const activeName = ref('')
const childActiveName = ref('')
const firstName = 'first'
const communicationList = ref([])
const testProjectPopupRef = ref()
const tableData: any = ref([])
const tabData: any = ref([])
@@ -241,7 +265,10 @@ const getTree = () => {
})
}
const copyActiveName = ref('')
// 获取通讯脚本点击
const getCommunication = () => {
communicationList.value = communRef.value[0]?.getData()
}
// 切换大tab控制小tab
const tabChange = () => {
if (copyActiveName.value != activeName.value) {
@@ -326,9 +353,7 @@ const addTab = (row: any) => {
getTree()
}
// 保存通信脚本
const saveTheNewsletter=()=>{
}
const saveTheNewsletter = () => {}
onMounted(() => {
getTree()
props.options.forEach((item: any) => {