修改点击使能默认够选通道使能,修改暂态使能持续时间保持一致

This commit is contained in:
GGJ
2025-04-10 11:11:23 +08:00
parent 5b736bc475
commit 5619413f37
2 changed files with 45 additions and 11 deletions

View File

@@ -31,7 +31,11 @@
:show-header="false" :show-header="false"
:span-method="arraySpanMethod" :span-method="arraySpanMethod"
:cell-style="tableStyle.cellStyle" :cell-style="tableStyle.cellStyle"
:header-cell-style="{ textAlign: 'center', backgroundColor: 'var(--el-color-primary)', color: '#fff' }" :header-cell-style="{
textAlign: 'center',
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}"
@cell-click="handleRowClick" @cell-click="handleRowClick"
:key="key" :key="key"
> >
@@ -89,18 +93,22 @@
<el-checkbox-button <el-checkbox-button
v-model="form.channelList[$index].harmFlag" v-model="form.channelList[$index].harmFlag"
label="谐波使能" label="谐波使能"
@change="handleHarmFlag($event, $index)"
/> />
<el-checkbox-button <el-checkbox-button
v-model="form.channelList[$index].inHarmFlag" v-model="form.channelList[$index].inHarmFlag"
label="间谐波使能" label="间谐波使能"
@change="handleHarmFlag($event, $index)"
/> />
<el-checkbox-button <el-checkbox-button
v-model="form.channelList[$index].flickerFlag" v-model="form.channelList[$index].flickerFlag"
label="闪变使能" label="闪变使能"
@change="handleHarmFlag($event, $index)"
/> />
<el-checkbox-button <el-checkbox-button
v-model="form.channelList[$index].dipFlag" v-model="form.channelList[$index].dipFlag"
label="暂态使能" label="暂态使能"
@change="handleHarmFlag($event, $index)"
/> />
</template> </template>
</el-table-column> </el-table-column>
@@ -114,7 +122,13 @@
<div class="form-item-container"> <div class="form-item-container">
<el-form-item label="频率:" prop="name"> <el-form-item label="频率:" prop="name">
<div class="input-label-container"> <div class="input-label-container">
<el-input type="number" style="width: 100px" v-model="form.ffreq" onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))" @change="validateFreq" /> <el-input
type="number"
style="width: 100px"
v-model="form.ffreq"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
@change="validateFreq"
/>
<label>Hz</label> <label>Hz</label>
</div> </div>
</el-form-item> </el-form-item>
@@ -142,7 +156,7 @@
<TestScriptFlickerTab :childForm="childForm" /> <TestScriptFlickerTab :childForm="childForm" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="暂态编辑" v-if="childForm[0].dipFlag || childForm[1].dipFlag"> <el-tab-pane label="暂态编辑" v-if="childForm[0].dipFlag || childForm[1].dipFlag">
<TestScriptDipTab :childForm="childForm" /> <TestScriptDipTab :childForm="childForm" @setRetainTime="setRetainTime" />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
@@ -154,7 +168,7 @@
:formContent="props.formContent" :formContent="props.formContent"
:form="form" :form="form"
:key="initial" :key="initial"
:valueCode=valueCode :valueCode="valueCode"
@recalculation="recalculation" @recalculation="recalculation"
/> />
</el-carousel-item> </el-carousel-item>
@@ -277,6 +291,12 @@ const close = () => {
dialogVisible.value = false dialogVisible.value = false
emit('close') emit('close')
} }
// 设置持续时间
const setRetainTime = (val: any) => {
form.value.channelList.forEach((item: any) => {
item.dipData.retainTime = val
})
}
// 保存数据 // 保存数据
const save = () => { const save = () => {
@@ -612,13 +632,19 @@ const copyRow = (num: number, index: number) => {
} }
const validateFreq = () => { const validateFreq = () => {
if (form.value.ffreq < 40) { if (form.value.ffreq < 40) {
ElMessage.warning("频率不能低于40Hz") ElMessage.warning('频率不能低于40Hz')
form.value.ffreq = 40 form.value.ffreq = 40
} else if (form.value.ffreq > 60) { } else if (form.value.ffreq > 60) {
ElMessage.warning("频率不能高于60Hz") ElMessage.warning('频率不能高于60Hz')
form.value.ffreq = 60 form.value.ffreq = 60
} }
}
// 点击使能按钮
const handleHarmFlag = (e: boolean, i: number) => {
if (e) {
form.value.channelList[i].channelFlag = true
}
} }
// 打开 drawer(新增、编辑) // 打开 drawer(新增、编辑)

View File

@@ -64,6 +64,7 @@ const form: any = computed({
}, },
set(value) {} set(value) {}
}) })
const emit = defineEmits(['setRetainTime'])
const handleInput = value => { const handleInput = value => {
if (value < 0) { if (value < 0) {
ElMessage.warning("设定幅度不能小于0%") ElMessage.warning("设定幅度不能小于0%")
@@ -78,11 +79,18 @@ const handleInputRetainTime = value => {
if (value < 0) { if (value < 0) {
ElMessage.warning("持续时间不能小于0周波") ElMessage.warning("持续时间不能小于0周波")
props.childForm[0].dipData.retainTime = 0 props.childForm[0].dipData.retainTime = 0
emit('setRetainTime', 0 )
}else if (value > 300) { }else if (value > 300) {
ElMessage.warning("持续时间不能大于300周波") ElMessage.warning("持续时间不能大于300周波")
props.childForm[0].dipData.retainTime = 300 props.childForm[0].dipData.retainTime = 300
emit('setRetainTime', 300 )
}else{
console.log(props);
emit('setRetainTime', value )
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>