2024-12-26 09:28:19 +08:00
|
|
|
<template>
|
2025-02-17 16:44:02 +08:00
|
|
|
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1400px">
|
2025-02-13 16:15:26 +08:00
|
|
|
<div class="dialog-content">
|
2025-02-17 08:39:18 +08:00
|
|
|
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
|
2025-02-17 16:44:02 +08:00
|
|
|
<el-tab-pane label="检测">
|
2025-02-17 08:39:18 +08:00
|
|
|
<!-- 全局设置菜单内容 -->
|
|
|
|
|
<div style="height: 295px">
|
|
|
|
|
<el-radio-group v-model="radio">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="item in tabChildren"
|
|
|
|
|
:key="item"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
border
|
|
|
|
|
style="margin: 0 0 10px 10px"
|
|
|
|
|
/>
|
|
|
|
|
<!-- <el-radio v-for="item in tabChildren" :value="item.value" border>{{ item.label }}</el-radio> -->
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</div>
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
</el-tabs>
|
2025-02-13 16:15:26 +08:00
|
|
|
<el-tabs type="border-card" class="left-tabs" style="height: 100%">
|
2024-12-30 14:43:13 +08:00
|
|
|
<el-tab-pane label="输出菜单">
|
|
|
|
|
<!-- 输出菜单内容 -->
|
2025-02-13 16:15:26 +08:00
|
|
|
<el-table
|
|
|
|
|
:data="tableData"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
:style="{ height: '295px', overflow: 'hidden' }"
|
|
|
|
|
:show-header="false"
|
|
|
|
|
:span-method="arraySpanMethod"
|
2025-02-17 08:39:18 +08:00
|
|
|
:cell-style="tableStyle.cellStyle"
|
|
|
|
|
:header-cell-style="{ textAlign: 'center', backgroundColor: '#003078', color: '#fff' }"
|
2025-02-17 16:44:02 +08:00
|
|
|
@cell-click="handleRowClick"
|
2025-02-13 16:15:26 +08:00
|
|
|
>
|
2025-02-17 16:44:02 +08:00
|
|
|
<el-table-column prop="name" label="相别" width="60" align="center" />
|
|
|
|
|
<el-table-column prop="frequency" label="电压/电流" align="center" width="60" />
|
|
|
|
|
<el-table-column prop="L1" label="值" width="180" align="center">
|
|
|
|
|
<template #default="{ row, $index }">
|
|
|
|
|
<span>
|
|
|
|
|
{{ row.frequency === 'V' ? '电压' : '电流' }}{{ form.children[$index].fAmp
|
|
|
|
|
}}{{ row.frequency === 'V' ? 'V' : 'A' }} 相角{{ form.children[$index].fPhase }}°
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" width="85">
|
2025-02-13 16:15:26 +08:00
|
|
|
<template #default="{}">
|
2025-02-17 16:44:02 +08:00
|
|
|
<el-button type="primary" link :icon="Bottom">复制</el-button>
|
2025-02-13 16:15:26 +08:00
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2025-02-17 08:39:18 +08:00
|
|
|
<el-table-column label="操作" align="center">
|
2025-02-13 16:15:26 +08:00
|
|
|
<template #default="{ row, $index }">
|
2025-02-17 16:44:02 +08:00
|
|
|
<el-checkbox-group v-model="form.children[$index].checkboxGroup">
|
|
|
|
|
<el-checkbox-button v-for="item in GroupList" :key="item.value" :value="item.value">
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</el-checkbox-button>
|
|
|
|
|
</el-checkbox-group>
|
2025-02-13 16:15:26 +08:00
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
2024-12-30 14:43:13 +08:00
|
|
|
</el-tab-pane>
|
|
|
|
|
</el-tabs>
|
2025-02-13 16:15:26 +08:00
|
|
|
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
|
2024-12-30 14:43:13 +08:00
|
|
|
<el-tab-pane label="全局设置菜单">
|
2025-02-13 16:15:26 +08:00
|
|
|
<!-- 全局设置菜单内容 -->
|
2025-02-17 08:39:18 +08:00
|
|
|
<div style="height: 295px">
|
2025-02-13 16:15:26 +08:00
|
|
|
<div class="form-item-container">
|
|
|
|
|
<el-form-item label="频率:" prop="name">
|
|
|
|
|
<div class="input-label-container">
|
2025-02-17 16:44:02 +08:00
|
|
|
<el-input style="width: 100px" v-model="form.fFreq" />
|
2025-02-13 16:15:26 +08:00
|
|
|
<label>Hz</label>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="button-label-container">
|
|
|
|
|
<label>参考设定值列表:</label>
|
|
|
|
|
<el-button type="primary" :icon="EditPen" @click="openDialog">编辑</el-button>
|
|
|
|
|
</div>
|
2025-01-06 09:21:24 +08:00
|
|
|
</div>
|
2024-12-30 14:43:13 +08:00
|
|
|
</el-tab-pane>
|
|
|
|
|
</el-tabs>
|
2025-02-13 16:15:26 +08:00
|
|
|
</div>
|
|
|
|
|
<div style="margin-top: 10px">
|
|
|
|
|
<el-tabs type="border-card" class="custom-tabs">
|
|
|
|
|
<el-tab-pane label="电压/电流编辑">
|
2025-02-17 16:44:02 +08:00
|
|
|
<TestScriptVolCurTab :childForm="childForm" />
|
2025-02-13 16:15:26 +08:00
|
|
|
</el-tab-pane>
|
|
|
|
|
<el-tab-pane label="谐波编辑">
|
2025-02-17 16:44:02 +08:00
|
|
|
<TestScriptHarmTab :childForm="childForm" />
|
2025-02-13 16:15:26 +08:00
|
|
|
</el-tab-pane>
|
|
|
|
|
<el-tab-pane label="间谐波编辑">
|
2025-02-17 16:44:02 +08:00
|
|
|
<TestScriptInHarmTab :childForm="childForm" />
|
2025-02-13 16:15:26 +08:00
|
|
|
</el-tab-pane>
|
|
|
|
|
<el-tab-pane label="闪变编辑">
|
2025-02-17 16:44:02 +08:00
|
|
|
<TestScriptFlickerTab :childForm="childForm" />
|
2025-02-13 16:15:26 +08:00
|
|
|
</el-tab-pane>
|
|
|
|
|
<el-tab-pane label="暂态编辑">
|
2025-02-17 16:44:02 +08:00
|
|
|
<TestScriptDipTab :childForm="childForm" />
|
2025-02-13 16:15:26 +08:00
|
|
|
</el-tab-pane>
|
|
|
|
|
</el-tabs>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<SetValueTable ref="setValueTable" />
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div>
|
|
|
|
|
<el-button @click="close()">取 消</el-button>
|
|
|
|
|
<el-button type="primary" @click="save()">保存</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2024-12-26 09:28:19 +08:00
|
|
|
</el-dialog>
|
2024-12-30 14:43:13 +08:00
|
|
|
</template>
|
2024-12-26 09:28:19 +08:00
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { dialogBig } from '@/utils/elementBind'
|
2024-12-30 14:43:13 +08:00
|
|
|
import { onMounted, reactive, ref } from 'vue'
|
2025-02-13 16:15:26 +08:00
|
|
|
import SetValueTable from '@/views/machine/testScript/components/setValueTable.vue'
|
2025-02-17 16:44:02 +08:00
|
|
|
import { EditPen, ArrowDown, Bottom, CopyDocument } from '@element-plus/icons-vue'
|
2025-02-13 16:15:26 +08:00
|
|
|
import { type TabsInstance } from 'element-plus'
|
|
|
|
|
import TestScriptVolCurTab from '@/views/machine/testScript/components/testScriptVolCurTab.vue'
|
|
|
|
|
import TestScriptHarmTab from '@/views/machine/testScript/components/testScriptHarmTab.vue'
|
|
|
|
|
import TestScriptInHarmTab from '@/views/machine/testScript/components/testScriptInHarmTab.vue'
|
|
|
|
|
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue'
|
|
|
|
|
import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue'
|
2025-02-17 16:44:02 +08:00
|
|
|
|
2025-02-17 08:39:18 +08:00
|
|
|
const emit = defineEmits(['addTab'])
|
|
|
|
|
interface TabOption {
|
|
|
|
|
label: string
|
|
|
|
|
name: string
|
|
|
|
|
value: string
|
|
|
|
|
children?: TabOption[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
options: {
|
|
|
|
|
type: Array as PropType<TabOption[]>,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
activeName: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true
|
|
|
|
|
}
|
|
|
|
|
})
|
2025-02-17 16:44:02 +08:00
|
|
|
const GroupList = [
|
|
|
|
|
{
|
|
|
|
|
label: '通道使能',
|
|
|
|
|
value: 'channelFlag'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '谐波使能',
|
|
|
|
|
value: 'harmFlag'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '间谐波使能',
|
|
|
|
|
value: 'inHarmFlag'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '闪变使能',
|
|
|
|
|
value: 'flickerFlag'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '暂态使能',
|
|
|
|
|
value: 'dipFlag'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
const form: any = ref({
|
2025-02-17 08:39:18 +08:00
|
|
|
value: '',
|
2025-02-17 16:44:02 +08:00
|
|
|
label: '',
|
|
|
|
|
fFreq: 50,
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
checkboxGroup: ['channelFlag','harmFlag'],//通道选择
|
|
|
|
|
fAmp: 0, //幅值
|
|
|
|
|
fPhase: 0, //相角
|
|
|
|
|
harmList: [
|
|
|
|
|
{
|
|
|
|
|
harm: 1, //谐波次数
|
|
|
|
|
fAmp: 0, //谐波含有率
|
|
|
|
|
fPhase: 0 // 谐波相角
|
|
|
|
|
}
|
|
|
|
|
], //谐波
|
|
|
|
|
inHarmList: [
|
|
|
|
|
{
|
|
|
|
|
inharm: 1, //间谐波次数
|
|
|
|
|
fAmp: 0, //间谐波含有率
|
|
|
|
|
fPhase: 0 // 间谐波相角
|
|
|
|
|
}
|
|
|
|
|
], //间谐波
|
|
|
|
|
flickerData: {
|
|
|
|
|
fChagValue: 0,//电压变动幅度
|
|
|
|
|
fChagFre: 0, //波动频度
|
|
|
|
|
waveFluType: 0, //波动类型
|
|
|
|
|
waveType: 0, //波类型
|
|
|
|
|
fDutyCycle: 0, //占空比
|
|
|
|
|
|
|
|
|
|
}, //闪变
|
|
|
|
|
dipData: {
|
|
|
|
|
fTransValue: 0, // 暂态幅值
|
|
|
|
|
fRetainTime: 0 // 暂态持续时间
|
|
|
|
|
} //暂态
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
checkboxGroup: [],
|
|
|
|
|
fAmp: 0,
|
|
|
|
|
fPhase: 0
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
checkboxGroup: [],
|
|
|
|
|
fAmp: 0,
|
|
|
|
|
fPhase: 0
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
checkboxGroup: [],
|
|
|
|
|
fAmp: 0,
|
|
|
|
|
fPhase: 0
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
checkboxGroup: [],
|
|
|
|
|
fAmp: 0,
|
|
|
|
|
fPhase: 0
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
checkboxGroup: [],
|
|
|
|
|
fAmp: 0,
|
|
|
|
|
fPhase: 0
|
|
|
|
|
}
|
|
|
|
|
]
|
2025-02-17 08:39:18 +08:00
|
|
|
})
|
2025-02-17 16:44:02 +08:00
|
|
|
const childForm: any = ref([])
|
2024-12-26 09:28:19 +08:00
|
|
|
|
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
|
const dialogTitle = ref()
|
|
|
|
|
const setValueTable = ref()
|
2025-02-13 16:15:26 +08:00
|
|
|
const buttonTypeOptions = ['default', 'text', 'success', 'warning', 'info', 'primary', 'danger'] as const
|
|
|
|
|
|
|
|
|
|
const tableData = [
|
2025-02-17 16:44:02 +08:00
|
|
|
{ name: 'L1', frequency: 'V', electricity: 0, fPhase: 0, sort: 0 },
|
|
|
|
|
{ name: 'L1', frequency: 'I', electricity: 0, fPhase: 0, sort: 0 },
|
|
|
|
|
{ name: 'L2', frequency: 'V', electricity: 0, fPhase: 0, sort: 1 },
|
|
|
|
|
{ name: 'L2', frequency: 'I', electricity: 0, fPhase: 0, sort: 1 },
|
|
|
|
|
{ name: 'L3', frequency: 'V', electricity: 0, fPhase: 0, sort: 2 },
|
|
|
|
|
{ name: 'L3', frequency: 'I', electricity: 0, fPhase: 0, sort: 2 }
|
2025-02-13 16:15:26 +08:00
|
|
|
]
|
2025-02-17 08:39:18 +08:00
|
|
|
const radio = ref('')
|
|
|
|
|
const tabChildren: any = ref([])
|
2024-12-30 14:43:13 +08:00
|
|
|
// 定义 span-method 逻辑
|
|
|
|
|
const arraySpanMethod = ({ rowIndex, columnIndex }: { rowIndex: number; columnIndex: number }) => {
|
2025-02-13 16:15:26 +08:00
|
|
|
if (columnIndex === 0 || columnIndex === 3) {
|
|
|
|
|
// 第一列
|
|
|
|
|
if (rowIndex % 2 === 0) {
|
|
|
|
|
return {
|
|
|
|
|
rowspan: 2,
|
|
|
|
|
colspan: 1
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return {
|
|
|
|
|
rowspan: 0,
|
|
|
|
|
colspan: 0
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-30 14:43:13 +08:00
|
|
|
}
|
2025-02-13 16:15:26 +08:00
|
|
|
}
|
2025-02-17 16:44:02 +08:00
|
|
|
const selectedRow = ref('')
|
2025-02-17 08:39:18 +08:00
|
|
|
const tableStyle = {
|
|
|
|
|
cellStyle: ({ row }: { row: any }) => {
|
2025-02-17 16:44:02 +08:00
|
|
|
return row.name === selectedRow.value
|
2025-02-17 08:39:18 +08:00
|
|
|
? { backgroundColor: '#dcdcdc' } // 设置选中行的背景颜色
|
|
|
|
|
: {}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-02-17 16:44:02 +08:00
|
|
|
const handleRowClick = async (row: any, column: any) => {
|
|
|
|
|
if (column.label == '相别') {
|
|
|
|
|
childForm.value = []
|
|
|
|
|
selectedRow.value = row.name
|
|
|
|
|
childForm.value.push(form.value.children[row.sort * 2])
|
|
|
|
|
childForm.value.push(form.value.children[row.sort * 2 + 1])
|
|
|
|
|
console.log('🚀 ~ handleRowClick ~ childForm.value:', childForm.value)
|
2025-02-13 16:15:26 +08:00
|
|
|
}
|
2025-02-17 16:44:02 +08:00
|
|
|
|
|
|
|
|
// childForm.value = row
|
2025-02-13 16:15:26 +08:00
|
|
|
}
|
2024-12-30 14:43:13 +08:00
|
|
|
|
2024-12-26 09:28:19 +08:00
|
|
|
// 关闭弹窗
|
|
|
|
|
const close = () => {
|
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
}
|
2024-12-30 14:43:13 +08:00
|
|
|
|
2025-02-13 16:15:26 +08:00
|
|
|
// 保存数据
|
2025-02-17 08:39:18 +08:00
|
|
|
const save = () => {
|
2025-02-17 16:44:02 +08:00
|
|
|
dialogVisible.value = false
|
2025-02-17 08:39:18 +08:00
|
|
|
form.value.value = radio.value
|
|
|
|
|
form.value.label = tabChildren.value.filter(item => item.value == radio.value)[0].label
|
|
|
|
|
emit('addTab', form.value)
|
|
|
|
|
}
|
2024-12-30 14:43:13 +08:00
|
|
|
|
2024-12-26 09:28:19 +08:00
|
|
|
// 打开弹窗,可能是新增,也可能是编辑
|
2025-02-13 16:15:26 +08:00
|
|
|
const open = (sign: string, row: any) => {
|
2024-12-26 09:28:19 +08:00
|
|
|
dialogVisible.value = true
|
2025-02-13 16:15:26 +08:00
|
|
|
dialogTitle.value = sign === 'add' ? '新增检测项目信息' : '编辑检测项目信息'
|
2025-02-17 16:44:02 +08:00
|
|
|
// 添加选择检测项目
|
2025-02-17 08:39:18 +08:00
|
|
|
tabChildren.value = props.options.filter(item => item.value == props.activeName)[0].children || []
|
|
|
|
|
radio.value = tabChildren.value[0].value || ''
|
2025-02-17 16:44:02 +08:00
|
|
|
handleRowClick({ name: 'L1', sort: 0 }, { label: '相别' })
|
2024-12-30 14:43:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 打开 drawer(新增、编辑)
|
|
|
|
|
const openDialog = () => {
|
2025-02-13 16:15:26 +08:00
|
|
|
setValueTable.value?.open()
|
2024-12-26 09:28:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 对外映射
|
|
|
|
|
defineExpose({ open })
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2024-12-30 14:43:13 +08:00
|
|
|
.dialog-content {
|
2025-02-13 16:15:26 +08:00
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
align-items: stretch;
|
|
|
|
|
height: 100%;
|
2024-12-30 14:43:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tabs-container {
|
2025-02-13 16:15:26 +08:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
2024-12-30 14:43:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.left-tabs {
|
2025-02-17 16:44:02 +08:00
|
|
|
width: 900px;
|
2025-02-17 08:39:18 +08:00
|
|
|
margin: 0 10px; /* 可选:添加间距 */
|
2024-12-30 14:43:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.right-tabs {
|
2025-02-17 08:39:18 +08:00
|
|
|
flex: 1;
|
2024-12-30 14:43:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.form-item-container {
|
2025-02-13 16:15:26 +08:00
|
|
|
display: flex;
|
|
|
|
|
justify-content: center; /* 水平居中 */
|
|
|
|
|
margin-bottom: 10px; /* 可选:添加间距 */
|
2024-12-30 14:43:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.button-label-container {
|
2025-02-13 16:15:26 +08:00
|
|
|
display: flex;
|
|
|
|
|
justify-content: center; /* 水平居中 */
|
|
|
|
|
align-items: center; /* 垂直居中 */
|
2024-12-30 14:43:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.button-label-container label {
|
2025-02-13 16:15:26 +08:00
|
|
|
margin-right: 10px; /* 按钮和文字之间的距离 */
|
2024-12-30 14:43:13 +08:00
|
|
|
}
|
2025-01-06 09:21:24 +08:00
|
|
|
.input-label-container {
|
2025-02-13 16:15:26 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center; /* 垂直居中对齐 */
|
2025-01-06 09:21:24 +08:00
|
|
|
}
|
2024-12-30 14:43:13 +08:00
|
|
|
|
2025-01-06 09:21:24 +08:00
|
|
|
.input-label-container label {
|
2025-02-13 16:15:26 +08:00
|
|
|
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
2025-01-06 09:21:24 +08:00
|
|
|
}
|
2025-02-13 16:15:26 +08:00
|
|
|
</style>
|