联调检测脚本

This commit is contained in:
GGJ
2025-02-24 08:38:54 +08:00
parent 7a76c2da8a
commit 034b31ba47
8 changed files with 344 additions and 150 deletions

View File

@@ -1,63 +1,82 @@
<template>
<div class="tabs-container">
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%">
<el-tab-pane label="Modulation">
<!-- 全局设置菜单内容 -->
<div class="form-container">
<el-form-item label=""></el-form-item>
<el-form-item label="电压变动幅度(%)" label-width="140px" prop="name">
<el-input
style="width: 150px"
v-model="form[0].flickerData.fchagValue"
:disabled="!form[0].flickerFlag"
/>
</el-form-item>
</div>
<div class="form-container">
<el-form-item label="波动类型" prop="name">
<el-select
placeholder="请选择波动类型"
style="width: 150px"
v-model="form[0].flickerData.waveFluType"
:disabled="!form[0].flickerFlag"
>
<el-option label="Hz" :value="1"></el-option>
<el-option label="CPM" :value="0"></el-option>
<el-tab-pane label="波动">
<!-- 全局设置菜单内容 Modulation-->
<div>
<el-form-item label="标准值" label-width="180px">
<el-select v-model="standardValue" style="width: 180px" placeholder="请选择标准值">
<el-option
v-for="item in standard"
:key="item.label"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item
:label="`波动频度( ${form[0].flickerData.waveFluType == 1 ? 'Hz/min' : '次/min'})`"
label-width="140px"
prop="name"
>
<el-input
style="width: 150px"
<el-form-item abel-width="180px">
<template #label>
<el-select
v-model="form[0].flickerData.waveType"
@change="changeLable"
style="width: 170px"
>
<el-option
v-for="item in waveList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<el-select
placeholder="请选择波动类型"
style="width: 180px"
filterable
allow-create
v-model="form[0].flickerData.fchagFre"
:disabled="!form[0].flickerFlag"
@change="changeWaveType"
>
<el-option
v-for="(item, i) in waveChildrenList"
:key="item.fchagFre"
:value="item.fchagFre"
:label="item.fchagFre"
/>
</el-select>
</el-form-item>
<el-form-item label="变动量(%)" label-width="180px">
<el-input
style="width: 180px"
v-model="form[0].flickerData.fchagValue"
:disabled="!form[0].flickerFlag"
/>
</el-form-item>
</div>
</el-tab-pane>
</el-tabs>
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%">
<el-tab-pane label="WaveForm">
<!-- 全局设置菜单内容 -->
<el-tab-pane label="波形">
<!-- 全局设置菜单内容 WaveForm -->
<div>
<el-form-item label="波类型" label-width="100px" prop="name">
<el-form-item label="波类型" label-width="100px">
<el-select
placeholder="请选择波类型"
style="width: 150px"
v-model="form[0].flickerData.waveType"
v-model="form[0].flickerData.waveFluType"
:disabled="!form[0].flickerFlag"
>
<el-option label="RECT" :value="2"></el-option>
<el-option label="SIN" :value="1"></el-option>
<el-option label="SQU" :value="0"></el-option>
<el-option label="RECT" value="RECT"></el-option>
<el-option label="SIN" value="SIN"></el-option>
<el-option label="SQU" value="SQU"></el-option>
</el-select>
</el-form-item>
</div>
<div>
<el-form-item label="占空比(%)" label-width="100px" prop="name">
<el-form-item label="占空比(%)" label-width="100px">
<el-input
style="width: 150px"
v-model="form[0].flickerData.fdutyCycle"
@@ -71,13 +90,145 @@
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
import { onMounted, ref, computed } from 'vue'
const props = defineProps({
childForm: {
type: Array,
type: [Array, Object] as any,
required: true
}
})
const standardValue = ref('1')
const standard = [
{
label: '1',
value: '1'
},
{
label: '3',
value: '3'
}
]
const waveList = [
{
label: '变动频度(次/min)',
value: 'CPM',
children1: [
{
fchagFre: '1',
fchagValue: '2.724'
},
{
fchagFre: '2',
fchagValue: '2.211'
},
{
fchagFre: '7',
fchagValue: '1.459'
},
{
fchagFre: '39',
fchagValue: '0.906'
},
{
fchagFre: '110',
fchagValue: '0.725'
},
{
fchagFre: '1620',
fchagValue: '0.402'
}
],
children3: [
{
fchagFre: '7',
fchagValue: '4.377'
},
{
fchagFre: '110',
fchagValue: '2.175'
},
{
fchagFre: '1620',
fchagValue: '1.206'
}
]
},
{
label: '变动频率(HZ)',
value: 'HZ',
children1: [
{
fchagFre: '0.008333',
fchagValue: '2.724'
},
{
fchagFre: '0.016667',
fchagValue: '2.211'
},
{
fchagFre: '0.058333',
fchagValue: '1.459'
},
{
fchagFre: '0.325',
fchagValue: '0.906'
},
{
fchagFre: '0.916',
fchagValue: '0.725'
},
{
fchagFre: '13.5',
fchagValue: '0.402'
}
],
children3: [
{
fchagFre: '0.058333',
fchagValue: '4.377'
},
{
fchagFre: '0.916',
fchagValue: '2.175'
},
{
fchagFre: '13.5',
fchagValue: '1.206'
}
]
}
]
const waveChildrenList = computed(() => {
return waveList.filter((item: any) => item.value === form.value[0].flickerData.waveType)[0][
standardValue.value == '1' ? 'children1' : 'children3'
]
})
const changeLable = e => {
setTimeout(() => {
if (props.childForm[0].flickerData.fchagFre != '') {
let data = waveChildrenList.value.filter((item: any) =>
props.childForm[0].flickerData.waveType == 'CPM'
? item.fchagFre == Math.round(props.childForm[0].flickerData.fchagFre * 120)
: (item.fchagFre - 0).toFixed(3) == (props.childForm[0].flickerData.fchagFre / 120).toFixed(3)
)
if (data.length > 0) {
props.childForm[0].flickerData.fchagValue = data[0].fchagValue
props.childForm[0].flickerData.fchagFre = data[0].fchagFre
} else {
props.childForm[0].flickerData.fchagFre =
props.childForm[0].flickerData.waveType == 'CPM'
? Math.round(props.childForm[0].flickerData.fchagFre * 120)
: (props.childForm[0].flickerData.fchagFre / 120).toFixed(3)
}
}
}, 100)
}
// [频率变化]
const changeWaveType = e => {
props.childForm[0].flickerData.fchagValue = waveChildrenList.value?.filter(
(item: any) => item.fchagFre == e
)[0].fchagValue
}
const form: any = computed({
get() {
return props.childForm