联调检测脚本修改功能

This commit is contained in:
GGJ
2025-02-20 16:39:15 +08:00
parent 629fd174e4
commit 14583d919d
9 changed files with 498 additions and 296 deletions

View File

@@ -34,3 +34,15 @@ export const addScriptDtls = (params: any) => {
export const dlsDetails = (params: any) => {
return http.post(`/pqScript/dlsDetails`, params)
}
// 删除脚本
export const deleteDtls = (params: any) => {
return http.post(`/pqScript/deleteDtls`, params)
}
// 启用关闭脚本
export const updateDtls = (params: any) => {
return http.post(`/pqScript/updateDtls`, params)
}
// 根据通讯参数生成装置下发原始数据公式
export const scriptDtlsCheckDataList = (params: any) => {
return http.post(`/pqScript/scriptDtlsCheckDataList`, params)
}

View File

@@ -8,7 +8,7 @@
color: '#fff'
}"
stripe
height="calc(100vh - 335px)"
height="calc(100vh - 515px)"
:style="{ overflow: 'hidden' }"
row-key="id"
default-expand-all

View File

@@ -1,6 +1,4 @@
let scriptForm: any = {
// value: '',
label: '',
subType: '', //tabcode
ffreq: 50, //频率
channelList: [
@@ -20,9 +18,9 @@ let scriptForm: any = {
// fphase: 0 // 谐波相角
// },
], //谐波
inHarmList: [
inharmList: [
{
inharm: 0, //间谐波次数
inharm: '', //间谐波次数
famp: 0, //间谐波含有率
fphase: 0 // 间谐波相角
}
@@ -32,7 +30,7 @@ let scriptForm: any = {
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fdutyCycle: 0 //占空比
fdutyCycle: 50 //占空比
}, //闪变
dipData: {
ftransValue: 0, // 暂态幅值
@@ -49,9 +47,9 @@ let scriptForm: any = {
famp: 0, //幅值
fphase: 0, //相角
harmList: [], //谐波
inHarmList: [
inharmList: [
{
inharm: 1, //间谐波次数
inharm: '', //间谐波次数
famp: 0, //间谐波含有率
fphase: 0 // 间谐波相角
}
@@ -61,7 +59,7 @@ let scriptForm: any = {
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fdutyCycle: 0 //占空比
fdutyCycle: 50 //占空比
}, //闪变
dipData: {
ftransValue: 0, // 暂态幅值
@@ -78,9 +76,9 @@ let scriptForm: any = {
famp: 0, //幅值
fphase: 0, //相角
harmList: [], //谐波
inHarmList: [
inharmList: [
{
inharm: 1, //间谐波次数
inharm: '', //间谐波次数
famp: 0, //间谐波含有率
fphase: 0 // 间谐波相角
}
@@ -90,7 +88,7 @@ let scriptForm: any = {
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fdutyCycle: 0 //占空比
fdutyCycle: 50 //占空比
}, //闪变
dipData: {
ftransValue: 0, // 暂态幅值
@@ -107,9 +105,9 @@ let scriptForm: any = {
famp: 0, //幅值
fphase: 0, //相角
harmList: [], //谐波
inHarmList: [
inharmList: [
{
inharm: 1, //间谐波次数
inharm: '', //间谐波次数
famp: 0, //间谐波含有率
fphase: 0 // 间谐波相角
}
@@ -119,7 +117,7 @@ let scriptForm: any = {
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fdutyCycle: 0 //占空比
fdutyCycle: 50 //占空比
}, //闪变
dipData: {
ftransValue: 0, // 暂态幅值
@@ -136,9 +134,9 @@ let scriptForm: any = {
famp: 0, //幅值
fphase: 0, //相角
harmList: [], //谐波
inHarmList: [
inharmList: [
{
inharm: 1, //间谐波次数
inharm: '', //间谐波次数
famp: 0, //间谐波含有率
fphase: 0 // 间谐波相角
}
@@ -148,7 +146,7 @@ let scriptForm: any = {
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fdutyCycle: 0 //占空比
fdutyCycle: 50 //占空比
}, //闪变
dipData: {
ftransValue: 0, // 暂态幅值
@@ -165,9 +163,9 @@ let scriptForm: any = {
famp: 0, //幅值
fphase: 0, //相角
harmList: [], //谐波
inHarmList: [
inharmList: [
{
inharm: 1, //间谐波次数
inharm: '', //间谐波次数
famp: 0, //间谐波含有率
fphase: 0 // 间谐波相角
}
@@ -177,7 +175,7 @@ let scriptForm: any = {
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fdutyCycle: 0 //占空比
fdutyCycle: 50 //占空比
}, //闪变
dipData: {
ftransValue: 0, // 暂态幅值

View File

@@ -5,7 +5,7 @@
<el-tab-pane label="检测">
<!-- 全局设置菜单内容 -->
<div style="height: 295px">
<el-radio-group v-model="subType">
<el-radio-group v-model="form.subType">
<el-radio
v-for="item in tabChildren"
:key="item"
@@ -97,7 +97,12 @@
<div class="form-item-container">
<el-form-item label="频率:" prop="name">
<div class="input-label-container">
<el-input type="number" style="width: 100px" v-model="form.ffreq" />
<el-input
type="number"
@mousewheel.native.prevent
style="width: 100px"
v-model="form.ffreq"
/>
<label>Hz</label>
</div>
</el-form-item>
@@ -134,7 +139,7 @@
<template #footer>
<div>
<el-button @click="close()"> </el-button>
<el-button @click="close"> </el-button>
<el-button type="primary" @click="save">保存</el-button>
</div>
</template>
@@ -153,10 +158,10 @@ import TestScriptInHarmTab from '@/views/machine/testScript/components/testScrip
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue'
import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue'
import { useDictStore } from '@/stores/modules/dict'
import { addScriptDtls } from '@/api/device/testScript'
import { addScriptDtls, scriptDtlsCheckDataList } from '@/api/device/testScript'
import scriptForm from './scriptForm'
const emit = defineEmits(['addTab'])
const emit = defineEmits(['addTab', 'close'])
const dictStore = useDictStore()
const props = defineProps({
options: {
@@ -167,6 +172,10 @@ const props = defineProps({
type: String,
required: true
},
childActiveName: {
type: String,
required: true
},
formContent: {
type: [Object, Array],
required: true
@@ -174,7 +183,7 @@ const props = defineProps({
})
const key = ref(0)
// let valueType
const form: any = ref(scriptForm)
const form: any = ref(JSON.parse(JSON.stringify(scriptForm)))
const childForm: any = ref([])
const ScriptValueType = ref('')
const setValueTableRef = ref()
@@ -190,7 +199,7 @@ const tableData = [
{ name: 'L3', frequency: 'Uc', type: 'V', electricity: 0, fphase: 0, sort: 2 },
{ name: 'L3', frequency: 'Ic', type: 'I', electricity: 0, fphase: 0, sort: 2 }
]
const subType = ref('')
const tabChildren: any = ref([])
// 定义 span-method 逻辑
const arraySpanMethod = ({ rowIndex, columnIndex }: { rowIndex: number; columnIndex: number }) => {
@@ -232,62 +241,104 @@ const handleRowClick = async (row: any, column: any) => {
// 关闭弹窗
const close = () => {
dialogVisible.value = false
emit('close')
}
// 保存数据
const save = () => {
// dialogVisible.value = false
form.value.subType = subType.value
form.value.label = tabChildren.value.filter((item: any) => item.code == subType.value)[0].label
let copyForm = JSON.parse(JSON.stringify(form.value))
copyForm.channelList.forEach((channel: any) => {
// 筛选出 famp 和 fphase 不同时为 0 的对象
channel.harmList = channel.harmList.filter((item: any) => item.famp !== 0 || item.fphase !== 0)
channel.inHarmList = channel.inHarmList.filter(
(item: any) => item.inharm !== 0 || item.famp !== 0 || item.fphase !== 0
)
})
console.log('🚀 ~ save ~ form.value:', copyForm)
let copyForm = handleHarmData()
addScriptDtls({ ...copyForm, scriptId: props.formContent.id, scriptType: props.activeName }).then(res => {
if (res.code === 'A0000') {
ElMessage.success({ message: res.message })
ElMessage.success({
message: dialogTitle.value == '新增检测项目信息' ? '添加检测脚本成功!' : '编辑检测脚本成功!',
type: 'success'
})
dialogVisible.value = false
emit('addTab', form.value)
}
})
// emit('addTab', form.value)
}
//处理谐波数据
const handleHarmData = () => {
let copyForm = JSON.parse(JSON.stringify(form.value))
copyForm.channelList.forEach((channel: any) => {
// 筛选出 famp 和 fphase 不同时为 0 的对象
channel.harmList = channel.harmList.filter((item: any) => item.famp !== 0 || item.fphase !== 0)
channel.inharmList = channel.inharmList.filter(
(item: any) => item.inharm !== '' || item.famp !== 0 || item.fphase !== 0
)
})
return copyForm
}
// 打开弹窗,可能是新增,也可能是编辑
const open = (sign: string, row: any) => {
dialogVisible.value = true
dialogTitle.value = sign === 'add' ? '新增检测项目信息' : '编辑检测项目信息'
// 添加选择检测项目
tabChildren.value = props.options.filter(item => item.value == props.activeName)[0].children || []
subType.value = tabChildren.value[0].code || ''
// subType.value = tabChildren.value[0].code || ''
if (sign == 'add') {
form.value.subType = props.childActiveName == '' ? tabChildren.value[0].code || '' : props.childActiveName
} else {
form.value = setharmList(JSON.parse(JSON.stringify(row)))
}
handleRowClick({ name: 'L1', sort: 0 }, { label: '相别' })
dictStore.getDictData('Script_Value_Type')
valueCode.value = dictStore
.getDictData('Script_Value_Type')
.filter(item => item.id == props.formContent.valueType)[0].code
}
// 判断后台没有谐波,简谐波值 用于回显
const setharmList = (row: any) => {
row.channelList.forEach((item: any) => {
let harmList = []
for (let i = 2; i < 51; i++) {
let data = item.harmList.filter((harm: any) => harm.harm == i)
if (data.length > 0) {
harmList.push({ harm: i, famp: data[0].famp, fphase: data[0].fphase })
} else {
harmList.push({ harm: i, famp: 0, fphase: 0 })
}
}
item.harmList = harmList
if (item.inharmList.length == 0) {
item.inharmList.push({ inharm: 0, famp: 0, fphase: 0 })
}
})
return row
}
// 复制
const copyRow = (index: number) => {
scriptForm.channelList[index + 2] = JSON.parse(JSON.stringify(scriptForm.channelList[index]))
scriptForm.channelList[index + 3] = JSON.parse(JSON.stringify(scriptForm.channelList[index + 1]))
scriptForm.channelList[index].channelType == 'Ua'
? (scriptForm.channelList[index + 2].channelType = 'Ub')
: (scriptForm.channelList[index + 2].channelType = 'Uc')
scriptForm.channelList[index + 1].channelType == 'Ia'
? (scriptForm.channelList[index + 3].channelType = 'Ib')
: (scriptForm.channelList[index + 3].channelType = 'Ic')
form.value.channelList[index + 2] = JSON.parse(JSON.stringify(form.value.channelList[index]))
form.value.channelList[index + 3] = JSON.parse(JSON.stringify(form.value.channelList[index + 1]))
form.value.channelList[index].channelType == 'Ua'
? (form.value.channelList[index + 2].channelType = 'Ub')
: (form.value.channelList[index + 2].channelType = 'Uc')
form.value.channelList[index + 1].channelType == 'Ia'
? (form.value.channelList[index + 3].channelType = 'Ib')
: (form.value.channelList[index + 3].channelType = 'Ic')
key.value += 1
ElMessage.success({
message: '复制成功!',
type: 'success'
})
}
// 打开 drawer(新增、编辑)
const openDialog = () => {
setValueTableRef.value?.open()
let copyForm = JSON.parse(JSON.stringify(form.value))
scriptDtlsCheckDataList({ ...copyForm, scriptId: props.formContent?.id, scriptType: props.activeName }).then(
res => {}
)
// setValueTableRef.value?.open()
}
// 对外映射

View File

@@ -2,34 +2,42 @@
<div>
<div class="divider-container">
<el-divider style="width: 300px" content-position="left">检测脚本信息</el-divider>
<el-divider style="width: 400px" content-position="left">通讯脚本</el-divider>
<!-- <el-divider style="width: 400px" content-position="left">通讯脚本</el-divider> -->
<el-divider style="flex: 1" content-position="left">检测项目概要信息</el-divider>
</div>
<div class="data-check-content">
<div class="content-tree">
<Tree :treeData="treeData" />
</div>
<div class="content-tree" style="width: 400px">
<Commun :options="props.options" />
</div>
<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="CirclePlus" type="primary" @click="openAddDialog()">保存测试项</el-button> -->
<el-button :icon="Check" type="primary">保存通讯脚本</el-button>
</div>
<!-- 频率tab -->
<!-- {{ tab.children }} -->
<el-tabs type="border-card" v-model="childActiveName" @tab-change="inquireTable">
<div style="display: flex">
<!-- 通信脚本 -->
<el-tabs type="border-card" v-model="firstName" style="height: 100%">
<el-tab-pane label="通讯脚本" name="first">
<Commun :options="props.options" 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 class="table-container">
<el-table
:data="tableData"
:header-cell-style="{
@@ -40,6 +48,7 @@
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" />
@@ -50,178 +59,49 @@
<td class="theFirst">V</td>
<td>
{{
row.channelList[item.num]?.famp
? '电压=' +
'电压=' +
row.channelList[item.num]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
: '/'
}}
</td>
<td>
{{
row.channelList[item.num]?.fphase
? '电流=' + row.channelList[item.num]?.fphase + '°'
: '/'
}}
{{ '相角=' + row.channelList[item.num]?.fphase + '°' }}
</td>
</tr>
<tr>
<td class="theFirst">I</td>
<td>
{{
row.channelList[item.num + 1]?.famp
? '电压=' +
'电流=' +
row.channelList[item.num + 1]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
: '/'
}}
</td>
<td>
{{
row.channelList[item.num + 1]?.fphase
? '电流=' +
row.channelList[item.num + 1]?.fphase +
'°'
: '/'
}}
{{ '相角=' + row.channelList[item.num + 1]?.fphase + '°' }}
</td>
</tr>
</table>
</template>
</el-table-column>
<!-- <el-table-column label="L1">
<el-table-column label="是否启用" width="90">
<template #default="{ row }">
<table class="tableL">
<tr>
<td class="theFirst">V</td>
<td>
{{
row.channelList[0]?.famp
? '电压=' +
row.channelList[0]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
: '/'
}}
</td>
<td>
{{
row.channelList[0]?.fphase
? '电流=' + row.channelList[0]?.fphase + '°'
: '/'
}}
</td>
</tr>
<tr>
<td class="theFirst">I</td>
<td>
{{
row.channelList[1]?.famp
? '电压=' +
row.channelList[1]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
: '/'
}}
</td>
<td>
{{
row.channelList[1]?.fphase
? '电流=' + row.channelList[1]?.fphase + '°'
: '/'
}}
</td>
</tr>
</table>
<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="L2">
<template #default="{ row }">
<table class="tableL">
<tr>
<td class="theFirst">V</td>
<td>
{{
row.channelList[2]?.famp
? '电压=' +
row.channelList[2]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
: '/'
}}
</td>
<td>
{{
row.channelList[2]?.fphase
? '电流=' + row.channelList[2]?.fphase + '°'
: '/'
}}
</td>
</tr>
<tr>
<td class="theFirst">I</td>
<td>
{{
row.channelList[3]?.famp
? '电压=' +
row.channelList[3]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
: '/'
}}
</td>
<td>
{{
row.channelList[3]?.fphase
? '电流=' + row.channelList[3]?.fphase + '°'
: '/'
}}
</td>
</tr>
</table>
</template>
</el-table-column>
<el-table-column prop="L3" label="L3">
<template #default="{ row }">
<table class="tableL">
<tr>
<td class="theFirst">V</td>
<td>
{{
row.channelList[4]?.famp
? '电压=' +
row.channelList[4]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
: '/'
}}
</td>
<td>
{{
row.channelList[4]?.fphase
? '电流=' + row.channelList[4]?.fphase + '°'
: '/'
}}
</td>
</tr>
<tr>
<td class="theFirst">I</td>
<td>
{{
row.channelList[5]?.famp
? '电压=' +
row.channelList[5]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
: '/'
}}
</td>
<td>
{{
row.channelList[5]?.fphase
? '电流=' + row.channelList[5]?.fphase + '°'
: '/'
}}
</td>
</tr>
</table>
</template>
</el-table-column> -->
<el-table-column label="操作" width="210">
<el-table-column label="操作" width="220">
<template #default="{ row }">
<el-button
type="primary"
@@ -235,7 +115,7 @@
type="primary"
link
:icon="CopyDocument"
@click="openAddDialog('edit', row)"
@click="openDialog('edit', row)"
>
编辑
</el-button>
@@ -245,9 +125,9 @@
</template>
</el-table-column>
</el-table>
</div>
</el-tab-pane>
</el-tabs>
</div>
</el-tab-pane>
</el-tabs>
</div>
@@ -257,8 +137,11 @@
ref="testProjectPopupRef"
:options="props.options"
:activeName="activeName"
@addTab="addTab"
:childActiveName="childActiveName"
:formContent="props.formContent"
@addTab="addTab"
@close="showDialog = false"
v-if="showDialog"
/>
</div>
</template>
@@ -269,12 +152,13 @@ import Tree from './tree.vue'
import Commun from './communication.vue'
import type { CascaderOption } from 'element-plus'
import { getTreeData } from '@/api/check/test'
import { CirclePlus, Delete, EditPen, CopyDocument } from '@element-plus/icons-vue'
import { CirclePlus, Delete, Check, CopyDocument } from '@element-plus/icons-vue'
import type { TestScript } from '@/api/device/interface/testScript'
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
import { CheckData } from '@/api/check/interface'
import { dlsDetails } from '@/api/device/testScript'
import { dlsDetails, deleteDtls, updateDtls, addScriptDtls } from '@/api/device/testScript'
import { useDictStore } from '@/stores/modules/dict'
import { useHandleData } from '@/hooks/useHandleData'
interface TabOption {
label?: string
name?: string
@@ -294,9 +178,11 @@ const props = defineProps({
required: true
}
})
const showDialog = ref(false)
const dictStore = useDictStore()
const activeName = ref('')
const childActiveName = ref('')
const firstName = 'first'
const testProjectPopupRef = ref()
const tableData: any = ref([])
const tabData: any = ref([])
@@ -362,7 +248,7 @@ const tabChange = () => {
copyActiveName.value == activeName.value
childActiveName.value = ''
childActiveName.value =
tabData.value.filter(item => item.value == activeName.value)[0]?.children[0]?.value || ''
tabData.value.filter((item: any) => item.value == activeName.value)[0]?.children[0]?.value || ''
}
inquireTable()
}
@@ -376,7 +262,7 @@ const inquireTable = () => {
}).then((res: any) => {
if (res.code === 'A0000') {
res.data.forEach((item: any) => {
item.channelList = item.channelList.sort((a, b) => {
item.channelList = item.channelList.sort((a: any, b: any) => {
const indexA = sortOrder.indexOf(a.channelType)
const indexB = sortOrder.indexOf(b.channelType)
return indexA - indexB
@@ -389,9 +275,50 @@ const inquireTable = () => {
}
// 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
if (titleType == 'add') {
}
showDialog.value = true
setTimeout(() => {
testProjectPopupRef.value?.open(titleType, row)
}, 0)
}
// 复制
const copyRow = (row: any) => {
let copyRow = JSON.parse(JSON.stringify(row))
delete copyRow.index
addScriptDtls({ ...copyRow, scriptType: activeName.value }).then(res => {
if (res.code === 'A0000') {
ElMessage.success({
message: '复制成功!',
type: 'success'
})
getTree()
}
})
}
// 删除
const deleteRow = async (row: any) => {
await useHandleData(deleteDtls, { enable: row.enable, index: row.index, scriptId: row.scriptId }, `删除`)
getTree()
}
// 启用
const enableRow = async (row: any) => {
ElMessageBox.confirm(`是否${row.enable == 0 ? `禁用` : `启用`}?`, '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
draggable: true
})
.then(async () => {
updateDtls({ enable: row.enable, index: row.index, scriptId: row.scriptId }).then(res => {
ElMessage({
type: 'success',
message: `${row.enable == 0 ? `禁用` : `启用`}成功!`
})
getTree()
})
})
.catch(() => {
row.enable = row.enable == 0 ? 1 : 0
})
}
// 获取左边树数据
// 新增保存
@@ -420,7 +347,6 @@ const addTab = (row: any) => {
// }
}
onMounted(() => {
console.log('🚀 ~ onMounted ~ props.options:', props.options)
getTree()
props.options.forEach((item: any) => {
tabData.value.push({
@@ -451,6 +377,9 @@ onMounted(() => {
overflow: auto; /* 同时启用垂直和水平滚动 */
overflow-x: hidden;
}
.scriptTree {
height: calc(100vh - 520px);
}
/* 确保 el-tree 内容可以超出容器宽度 */
.el-tree {
@@ -496,3 +425,12 @@ onMounted(() => {
}
}
</style>
<style>
input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
input::-webkit-outer-spin-button {
-webkit-appearance: none !important;
}
</style>

View File

@@ -3,15 +3,17 @@
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%">
<el-tab-pane label="Modulation">
<!-- 全局设置菜单内容 -->
<div>
<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-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="波动频度(/min/Hz)" label-width="140px" prop="name">
<el-input style="width: 150px" v-model="form[0].flickerData.fchagFre" :disabled="!form[0].flickerFlag"/>
</el-form-item>
<el-form-item label="波动类型" prop="name">
<el-select
placeholder="请选择波动类型"
@@ -23,6 +25,17 @@
<el-option label="CPM" :value="0"></el-option>
</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"
v-model="form[0].flickerData.fchagFre"
:disabled="!form[0].flickerFlag"
/>
</el-form-item>
</div>
</el-tab-pane>
</el-tabs>
@@ -45,7 +58,11 @@
</div>
<div>
<el-form-item label="占空比(%)" label-width="100px" prop="name">
<el-input style="width: 150px" v-model="form[0].flickerData.fdutyCycle" :disabled="!form[0].flickerFlag"/>
<el-input
style="width: 150px"
v-model="form[0].flickerData.fdutyCycle"
:disabled="!form[0].flickerFlag"
/>
</el-form-item>
</div>
</el-tab-pane>

View File

@@ -9,7 +9,13 @@
<el-table-column prop="date" align="center" label="谐波含有率" width="120">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input type="number" size="small" v-model="form[0].harmList[$index].famp" :disabled="!form[0].harmFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[0].harmList[$index].famp"
:disabled="!form[0].harmFlag"
/>
<label>%</label>
</div>
</template>
@@ -17,7 +23,13 @@
<el-table-column prop="name" label="谐波相角" align="center" width="120">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input type="number" size="small" v-model="form[0].harmList[$index].fphase" :disabled="!form[0].harmFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[0].harmList[$index].fphase"
:disabled="!form[0].harmFlag"
/>
<label>°</label>
</div>
</template>
@@ -28,7 +40,13 @@
<el-table-column prop="date" label="谐波含有率" align="center" width="120">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input type="number" size="small" v-model="form[0].harmList[$index + 24].famp" :disabled="!form[0].harmFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[0].harmList[$index + 24].famp"
:disabled="!form[0].harmFlag"
/>
<label>%</label>
</div>
</template>
@@ -36,7 +54,13 @@
<el-table-column prop="name" label="谐波相角" align="center" width="120">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input type="number" size="small" v-model="form[0].harmList[$index+24].fphase" :disabled="!form[0].harmFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[0].harmList[$index + 24].fphase"
:disabled="!form[0].harmFlag"
/>
<label>°</label>
</div>
</template>
@@ -54,7 +78,13 @@
<el-table-column prop="date" label="谐波含有率" align="center" width="120">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input type="number" size="small" v-model="form[1].harmList[$index].famp" :disabled="!form[1].harmFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[1].harmList[$index].famp"
:disabled="!form[1].harmFlag"
/>
<label>%</label>
</div>
</template>
@@ -62,7 +92,13 @@
<el-table-column prop="name" align="center" label="谐波相角" width="120">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input type="number" size="small" v-model="form[1].harmList[$index].fphase" :disabled="!form[1].harmFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[1].harmList[$index].fphase"
:disabled="!form[1].harmFlag"
/>
<label>°</label>
</div>
</template>
@@ -73,7 +109,13 @@
<el-table-column prop="date" label="谐波含有率" align="center" width="120">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input type="number" size="small" v-model="form[1].harmList[$index + 24].famp" :disabled="!form[1].harmFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[1].harmList[$index + 24].famp"
:disabled="!form[1].harmFlag"
/>
<label>%</label>
</div>
</template>
@@ -81,7 +123,13 @@
<el-table-column prop="name" label="谐波相角" align="center" width="120">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input type="number" size="small" v-model="form[1].harmList[$index+24].fphase" :disabled="!form[1].harmFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[1].harmList[$index + 24].fphase"
:disabled="!form[1].harmFlag"
/>
<label>°</label>
</div>
</template>
@@ -102,7 +150,7 @@ const props = defineProps({
}
})
const form:any = computed({
const form: any = computed({
get() {
return props.childForm
},
@@ -137,7 +185,7 @@ for (let i = 26; i <= 50; i++) {
}
</script>
<style scoped>
<style lang="scss" scoped>
.tabs-container {
display: flex;
justify-content: space-between; /* 使两个 el-tabs 之间有间距 */
@@ -176,4 +224,7 @@ for (let i = 26; i <= 50; i++) {
.input-label-container label {
margin-left: 5px; /* 添加标签与输入框之间的间距 */
}
// 全局css 加上以下代码,可以隐藏上下箭头
// 取消input的上下箭头
</style>

View File

@@ -1,42 +1,143 @@
<template>
<div>
<div class="container">
<el-form-item label="频率" label-width="80px">
<el-input v-model="form[0].inHarmList[0].inharm" :disabled="!form[0].inHarmFlag" />
</el-form-item>
<el-form-item label="含有率(%)" label-width="80px">
<el-input v-model="form[0].inHarmList[0].fAmp" :disabled="!form[0].inHarmFlag" />
</el-form-item>
<el-form-item label="相角(°)" label-width="80px">
<el-input v-model="form[0].inHarmList[0].fphase" :disabled="!form[0].inHarmFlag" />
</el-form-item>
<el-form-item label-width="80px">
<el-button type="primary" @click="inHarmFlagAdd">添加</el-button>
</el-form-item>
<div class="tabs-container">
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
<el-tab-pane label="电压通道">
<el-table :data="form[0].inharmList" border size="small" class="half-width-table">
<el-table-column prop="date" align="center" label="次数">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-select
v-model="form[0].inharmList[$index].inharm"
:disabled="!form[0].inHarmFlag"
filterable
placeholder="选择次数"
size="small"
>
<el-option v-for="item in 49" :key="item" :label="item + 0.5" :value="item + 0.5" />
</el-select>
</div>
<div class="container" v-for="item in num" :key="item">
<el-form-item label="频率" label-width="80px">
<el-input v-model="form[0].inHarmList[item].inharm" :disabled="!form[0].inHarmFlag" />
</el-form-item>
<el-form-item label="含有率(%)" label-width="80px">
<el-input v-model="form[0].inHarmList[item].fAmp" :disabled="!form[0].inHarmFlag" />
</el-form-item>
<el-form-item label="相角(°)" label-width="80px">
<el-input v-model="form[0].inHarmList[item].fphase" :disabled="!form[0].inHarmFlag" />
</el-form-item>
<el-form-item label-width="80px">
<el-button type="primary" @click="inHarmFlagDelete(item)">删除</el-button>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="date" align="center" label="间谐波含有率">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[0].inharmList[$index].famp"
:disabled="!form[0].inHarmFlag"
/>
<label>%</label>
</div>
</template>
</el-table-column>
<el-table-column prop="name" label="间谐波相角" align="center">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[0].inharmList[$index].fphase"
:disabled="!form[0].inHarmFlag"
/>
<label>°</label>
</div>
</template>
</el-table-column>
<el-table-column prop="date" align="center" label="操作" width="100">
<template #default="{ row, $index }">
<el-button
v-if="$index == 0"
type="primary"
size="small"
link
:icon="CirclePlus"
@click="inHarmFlagAdd(0, row)"
>
新增
</el-button>
<el-button v-else type="primary" link :icon="Delete" @click="inHarmFlagDelete(0, $index)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
<el-tab-pane label="电流通道">
<el-table :data="form[1].inharmList" border size="small" class="half-width-table">
<el-table-column prop="date" align="center" label="次数">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-select
v-model="form[1].inharmList[$index].inharm"
:disabled="!form[1].inHarmFlag"
filterable
placeholder="选择次数"
size="small"
>
<el-option v-for="item in 49" :key="item" :label="item + 0.5" :value="item + 0.5" />
</el-select>
</div>
</template>
</el-table-column>
<el-table-column prop="date" align="center" label="间谐波含有率">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[1].inharmList[$index].famp"
:disabled="!form[1].inHarmFlag"
/>
<label>%</label>
</div>
</template>
</el-table-column>
<el-table-column prop="name" label="间谐波相角" align="center">
<template #default="{ row, $index }">
<div class="input-label-container">
<el-input
type="number"
@mousewheel.native.prevent
size="small"
v-model="form[1].inharmList[$index].fphase"
:disabled="!form[1].inHarmFlag"
/>
<label>°</label>
</div>
</template>
</el-table-column>
<el-table-column prop="date" align="center" label="操作" width="100">
<template #default="{ row, $index }">
<el-button
v-if="$index == 0"
type="primary"
size="small"
link
:icon="CirclePlus"
@click="inHarmFlagAdd(1, row)"
>
新增
</el-button>
<el-button v-else type="primary" link :icon="Delete" @click="inHarmFlagDelete(1, $index)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { CirclePlus, Delete, EditPen, CopyDocument } from '@element-plus/icons-vue'
const props = defineProps({
childForm: {
type: Array,
@@ -52,14 +153,14 @@ const form: any = computed({
})
const num = ref(0)
// 添加间谐波
const inHarmFlagAdd = () => {
props.childForm[0].inHarmList.push({ inharm: '0', fAmp: '0', fphase: '0' })
// 添加间谐波
const inHarmFlagAdd = (index: number, row: any) => {
props.childForm[index].inharmList.push({ inharm: '', famp: 0, fphase: 0 })
num.value += 1
}
// 删除
const inHarmFlagDelete = (number: number) => {
props.childForm[0].inHarmList.splice(number, 1)
const inHarmFlagDelete = (index: number, number: number) => {
props.childForm[index].inharmList.splice(number, 1)
num.value -= 1
}
</script>
@@ -89,4 +190,21 @@ const inHarmFlagDelete = (number: number) => {
:deep(.el-form-item) {
margin-bottom: 10px !important;
}
.input-label-container {
display: flex;
align-items: center; /* 垂直居中对齐 */
}
.input-label-container label {
margin-left: 5px; /* 添加标签与输入框之间的间距 */
}
.tabs-container {
display: flex;
justify-content: space-between; /* 使两个 el-tabs 之间有间距 */
height: 100%;
.right-tabs {
flex: 1; /* 使两个 el-tabs 占据相同的空间 */
margin-right: 10px; /* 可选:添加右侧间距 */
}
}
</style>

View File

@@ -9,16 +9,36 @@
<!-- 右侧编辑区域内容 -->
<el-form :inline="true" label-width="auto" :model="form" class="form-two">
<el-form-item label="电压有效值(V)">
<el-input type="number" v-model="form[0].famp" :disabled="!form[0].channelFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
v-model="form[0].famp"
:disabled="!form[0].channelFlag"
/>
</el-form-item>
<el-form-item label="电流有效值(A)">
<el-input type="number"v-model="form[0].fphase" :disabled="!form[1].channelFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
v-model="form[1].famp"
:disabled="!form[1].channelFlag"
/>
</el-form-item>
<el-form-item label="电压相角(°)">
<el-input type="number"v-model="form[1].famp" :disabled="!form[0].channelFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
v-model="form[0].fphase"
:disabled="!form[0].channelFlag"
/>
</el-form-item>
<el-form-item label="电流相角(°)">
<el-input type="number"v-model="form[1].fphase" :disabled="!form[1].channelFlag"/>
<el-input
type="number"
@mousewheel.native.prevent
v-model="form[1].fphase"
:disabled="!form[1].channelFlag"
/>
</el-form-item>
</el-form>
</div>
@@ -26,7 +46,7 @@
</template>
<script setup lang="ts">
import { onMounted, ref ,watch} from 'vue'
import { onMounted, ref, watch } from 'vue'
import Line from '@/components/echarts/line/index.vue'
// const emit = defineEmits(['update'])
const props = defineProps({
@@ -39,20 +59,17 @@ const props = defineProps({
const lineRef: any = ref()
const chartsData = ref({})
// 解构并创建响应式变量
const form:any = computed({
const form: any = computed({
get() {
return props.childForm
},
set(value) {
}
set(value) {}
})
onMounted(() => {
drawSineWave()
})
function drawSineWave() {
chartsData.value = {
tooltip: {