优化检测脚本页面

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

@@ -16,7 +16,13 @@
<el-table-column prop="name" label="指标" show-overflow-tooltip width="180px" /> <el-table-column prop="name" label="指标" show-overflow-tooltip width="180px" />
<el-table-column align="center" label="参与误差比较"> <el-table-column align="center" label="参与误差比较">
<template #default="{ row }"> <template #default="{ row }">
<el-switch v-model="row.errorFlag" v-if="row.show" :active-value="1" :inactive-value="0"> <el-switch
v-model="row.errorFlag"
v-if="row.show"
:active-value="1"
:inactive-value="0"
:disabled="disabled"
>
<template #active-action> <template #active-action>
<span></span> <span></span>
</template> </template>
@@ -28,7 +34,13 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="是否启用"> <el-table-column align="center" label="是否启用">
<template #default="{ row }"> <template #default="{ row }">
<el-switch v-model="row.enable" v-if="row.show" :active-value="1" :inactive-value="0"> <el-switch
v-model="row.enable"
v-if="row.show"
:active-value="1"
:inactive-value="0"
:disabled="disabled"
>
<template #active-action> <template #active-action>
<span></span> <span></span>
</template> </template>
@@ -51,10 +63,26 @@ const props = defineProps({
activeName: { activeName: {
type: String, type: String,
required: true required: true
},
formContent: {
type: Object,
required: true
},
disabled: {
type: Boolean,
default: true
} }
}) })
const tableData = ref<any[]>([]) const tableData = ref<any[]>([])
const info = async () => { const info = async () => {
let checkData: any = []
await checkDataList({
scriptId: props.formContent.id,
scriptType: props.activeName
}).then((res: any) => {
checkData = res.data
})
let { data } = await getDictTreeByCode({ let { data } = await getDictTreeByCode({
name: '', name: '',
id: '', id: '',
@@ -72,22 +100,46 @@ const info = async () => {
children: [] children: []
}) })
item.children.forEach((k: any) => { item.children.forEach((k: any) => {
tableData.value[i].children.push({ let childrenList: any = []
id: k.id, checkData.forEach((j: any) => {
pid: item.id, if (j.valueType == k.id) {
name: k.name, childrenList.push(j)
dataType: 'real', }
show: true,
errorFlag: 0,
enable: 0
}) })
if (childrenList.length > 0) {
tableData.value[i].children.push({
id: k.id,
pid: item.id,
name: k.name,
dataType: item.name == '闪变' ? 'avg' : item.name == '暂态' ? 'avg' : 'real',
show: true,
errorFlag: childrenList[0].errorFlag,
enable: childrenList[0].enable
})
} else {
tableData.value[i].children.push({
id: k.id,
pid: item.id,
name: k.name,
dataType: item.name == '闪变' ? 'avg' : item.name == '暂态' ? 'avg' : 'real',
show: true,
errorFlag: 0,
enable: 0
})
}
}) })
}) })
console.log('🚀 ~ item.children.forEach ~ tableData.value:', tableData.value)
}
const getData = () => {
return tableData.value
} }
onMounted(() => { onMounted(() => {
info() info()
// tableData.value = data.data[0].children || [] // tableData.value = data.data[0].children || []
}) })
// 对外映射
defineExpose({ getData })
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

View File

@@ -26,6 +26,7 @@ let scriptForm: any = {
} }
], //间谐波 ], //间谐波
flickerData: { flickerData: {
flickerValue: '1', //标准值
fchagValue: '', //变动量 fchagValue: '', //变动量
fchagFre: '', //波动频度 fchagFre: '', //波动频度
waveType: 'CPM', // 波动类型 waveType: 'CPM', // 波动类型
@@ -34,7 +35,7 @@ let scriptForm: any = {
}, //闪变 }, //闪变
dipData: { dipData: {
ftransValue: 0, // 暂态幅值 ftransValue: 0, // 暂态幅值
fretainTime: 0 // 暂态持续时间 retainTime: 0 // 暂态持续时间
} //暂态 } //暂态
}, },
{ {
@@ -55,6 +56,7 @@ let scriptForm: any = {
} }
], //间谐波 ], //间谐波
flickerData: { flickerData: {
flickerValue: '1', //标准值
fchagValue: '', //变动量 fchagValue: '', //变动量
fchagFre: '', //波动频度 fchagFre: '', //波动频度
waveType: 'CMP', // 波动类型 waveType: 'CMP', // 波动类型
@@ -63,7 +65,7 @@ let scriptForm: any = {
}, //闪变 }, //闪变
dipData: { dipData: {
ftransValue: 0, // 暂态幅值 ftransValue: 0, // 暂态幅值
fretainTime: 0 // 暂态持续时间 retainTime: 0 // 暂态持续时间
} //暂态 } //暂态
}, },
{ {
@@ -84,6 +86,7 @@ let scriptForm: any = {
} }
], //间谐波 ], //间谐波
flickerData: { flickerData: {
flickerValue: '1', //标准值
fchagValue: '', //变动量 fchagValue: '', //变动量
fchagFre: '', //波动频度 fchagFre: '', //波动频度
waveType: 'CMP', // 波动类型 waveType: 'CMP', // 波动类型
@@ -92,7 +95,7 @@ let scriptForm: any = {
}, //闪变 }, //闪变
dipData: { dipData: {
ftransValue: 0, // 暂态幅值 ftransValue: 0, // 暂态幅值
fretainTime: 0 // 暂态持续时间 retainTime: 0 // 暂态持续时间
} //暂态 } //暂态
}, },
{ {
@@ -113,6 +116,7 @@ let scriptForm: any = {
} }
], //间谐波 ], //间谐波
flickerData: { flickerData: {
flickerValue: '1', //标准值
fchagValue: '', //变动量 fchagValue: '', //变动量
fchagFre: '', //波动频度 fchagFre: '', //波动频度
waveType: 'CMP', // 波动类型 waveType: 'CMP', // 波动类型
@@ -121,7 +125,7 @@ let scriptForm: any = {
}, //闪变 }, //闪变
dipData: { dipData: {
ftransValue: 0, // 暂态幅值 ftransValue: 0, // 暂态幅值
fretainTime: 0 // 暂态持续时间 retainTime: 0 // 暂态持续时间
} //暂态 } //暂态
}, },
{ {
@@ -142,6 +146,7 @@ let scriptForm: any = {
} }
], //间谐波 ], //间谐波
flickerData: { flickerData: {
flickerValue: '1', //标准值
fchagValue: '', //变动量 fchagValue: '', //变动量
fchagFre: '', //波动频度 fchagFre: '', //波动频度
waveType: 'CMP', // 波动类型 waveType: 'CMP', // 波动类型
@@ -150,7 +155,7 @@ let scriptForm: any = {
}, //闪变 }, //闪变
dipData: { dipData: {
ftransValue: 0, // 暂态幅值 ftransValue: 0, // 暂态幅值
fretainTime: 0 // 暂态持续时间 retainTime: 0 // 暂态持续时间
} //暂态 } //暂态
}, },
{ {
@@ -171,6 +176,7 @@ let scriptForm: any = {
} }
], //间谐波 ], //间谐波
flickerData: { flickerData: {
flickerValue: '1', //标准值
fchagValue: '', //变动量 fchagValue: '', //变动量
fchagFre: '', //波动频度 fchagFre: '', //波动频度
waveType: 'CMP', // 波动类型 waveType: 'CMP', // 波动类型
@@ -179,7 +185,7 @@ let scriptForm: any = {
}, //闪变 }, //闪变
dipData: { dipData: {
ftransValue: 0, // 暂态幅值 ftransValue: 0, // 暂态幅值
fretainTime: 0 // 暂态持续时间 retainTime: 0 // 暂态持续时间
} //暂态 } //暂态
} }
] ]

View File

@@ -1,94 +1,35 @@
import { ref } from "vue"
<template> <template>
<el-dialog title="检测项目信息" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1400"> <div class="table-container">
<div class="table-container"> <el-table
<el-table :data="tableData"
:data="tableData" :header-cell-style="{
:header-cell-style="{ textAlign: 'center',
textAlign: 'center', backgroundColor: '#003078',
backgroundColor: '#003078', color: '#fff'
color: '#fff' }"
}" stripe
stripe :cell-style="{ textAlign: 'center' }"
:cell-style="{ textAlign: 'center' }" height="600px"
height="600px" >
> <el-table-column type="index" label="序号" width="60" />
<el-table-column type="index" label="序号" width="60" /> <el-table-column prop="pname" label="参考设定值类型" />
<el-table-column prop="pname" label="参考设定值类型" /> <el-table-column prop="name" label="参考设定值类型" />
<el-table-column prop="name" label="参考设定值子类型" /> <el-table-column prop="dataType" label="值类型" :formatter="formatter" />
<el-table-column prop="phase" label="相别" /> <el-table-column prop="phase" label="相别" />
<el-table-column prop="value" label="参考设定值" /> <el-table-column prop="value" label="参考设定值" />
<el-table-column label="操作"> <el-table-column prop="value" label="参与误差比较">
<template #default="{ row }"> <template #default="{ row }">
<el-button type="primary" link :icon="EditPen">编辑</el-button> {{ row.errorFlag == 0 ? '否' : '是' }}
</template>
</el-table-column>
</el-table>
</div>
<!-- <ProTable
ref="proTable"
:columns="columns"
:request-api="getTableList"
:pagination="false"
:toolButton="false"
:style="{ height: '530px', maxHeight: '530px', overflow: 'hidden' }"
>
<template #tableHeader="scope">
<el-button v-auth.testScript="'add'" type="primary" :icon="CirclePlus" @click="add">新增</el-button>
<el-button
v-auth.testScript="'delete'"
type="danger"
:icon="Delete"
plain
:disabled="!scope.isSelected"
@click="batchDelete(scope.selectedListIds)"
>
删除
</el-button>
</template> </template>
</el-table-column>
<template #operation="scope"> <el-table-column label="操作">
<el-button <template #default="{ row }">
v-auth.testScript="'upgrade'" <el-button type="primary" link :icon="EditPen">编辑</el-button>
type="primary"
v-if="scope.row.type !== 1"
link
:icon="Share"
@click="copy(scope.row)"
>
复制
</el-button>
<el-button
v-auth.testScript="'edit'"
type="primary"
link
:icon="EditPen"
:model-value="false"
@click="edit(scope.row)"
>
编辑
</el-button>
<el-button
v-auth.testScript="'delete'"
type="primary"
link
:icon="Delete"
@click="batchDelete(scope.row)"
>
删除
</el-button>
</template> </template>
</ProTable> --> </el-table-column>
</el-table>
</div>
<template #footer>
<div>
<el-button @click="close"> </el-button>
<el-button type="primary" @click="save">保存</el-button>
</div>
</template>
</el-dialog>
<el-dialog :title="dialogTitle" v-model="showForm" @close="close" width="500"> <el-dialog :title="dialogTitle" v-model="showForm" @close="close" width="500">
<el-form ref="form" :model="form" label-width="auto"> <el-form ref="form" :model="form" label-width="auto">
<el-form-item label="参考设定值类型" prop="name"> <el-form-item label="参考设定值类型" prop="name">
@@ -111,8 +52,6 @@ import { ref } from "vue"
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { TestScript } from '@/api/device/interface/testScript'
import type { ColumnProps } from '@/components/ProTable/interface'
import { CirclePlus, EditPen, Delete, Share } from '@element-plus/icons-vue' import { CirclePlus, EditPen, Delete, Share } from '@element-plus/icons-vue'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree' import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
@@ -144,13 +83,25 @@ const form = ref({
standardName: 0, standardName: 0,
standardTime: 0 standardTime: 0
}) })
const formatter = (row: any, column: any) => {
if (column.property == 'dataType') {
return row.dataType == 'real'
? '实时'
: row.dataType == 'cp95'
? 'CP95值'
: row.dataType == 'avg'
? '平均值'
: row.dataType == 'min'
? '最小值'
: row.dataType == 'max'
? '最大值'
: row.dataType
}
}
// 打开弹窗,可能是新增,也可能是编辑 // 打开弹窗,可能是新增,也可能是编辑
const open = async (row: any) => {
dialogVisible.value = true
// checkDataList({ scriptId: props.formContent.id, scriptType: props.activeName }).then((res: any) => {
// }) const open = async (row: any) => {
let treeData: any = [] let treeData: any = []
await getDictTreeByCode({ await getDictTreeByCode({
name: '', name: '',
@@ -162,16 +113,21 @@ const open = async (row: any) => {
}).then((res: any) => { }).then((res: any) => {
treeData = res.data[0].children treeData = res.data[0].children
}) })
let checkDataList: any = []
await row.forEach((item: any) => {
item.children.forEach((k: any) => {
if (k.enable != 0 || k.errorFlag != 0) {
checkDataList.push({
pid: k.pid,
valueType: k.id,
dataType: k.dataType,
enable: k.enable,
errorFlag: k.errorFlag
})
}
})
})
let checkDataList = [
{
pid: '004e06c7145e8454493dd69ad485c2a9',
valueType: '2da2a32c0cd19fb6368b9f4c249c2b3c',
dataType: 'real',
enable: 1,
errorFlag: 1
}
]
await scriptDtlsCheckDataList({ await scriptDtlsCheckDataList({
...props.form, ...props.form,
scriptId: props.formContent?.id, scriptId: props.formContent?.id,
@@ -189,14 +145,18 @@ const open = async (row: any) => {
const save = () => { const save = () => {
dialogVisible.value = false dialogVisible.value = false
} }
const getTableData = () => {
return tableData.value
}
// 关闭弹窗 // 关闭弹窗
const close = () => { const close = () => {
dialogVisible.value = false dialogVisible.value = false
} }
onMounted(() => {})
// 对外映射 // 对外映射
defineExpose({ open }) defineExpose({ open, getTableData })
</script> </script>
<style scoped></style> <style scoped></style>

View File

@@ -1,53 +1,56 @@
<template> <template>
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1400px"> <el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1400px">
<div class="dialog-content"> <el-carousel height="620px" :autoplay="false" ref="carouselRef" indicator-position="none">
<el-tabs type="border-card" class="right-tabs" style="height: 100%"> <el-carousel-item :name="0" style="height: 100%; overflow-y: auto">
<el-tab-pane label="检测"> <div class="dialog-content">
<!-- 全局设置菜单内容 --> <el-tabs type="border-card" class="right-tabs">
<div style="height: 295px"> <el-tab-pane label="检测">
<el-radio-group v-model="form.subType"> <!-- 全局设置菜单内容 -->
<el-radio <div style="height: 295px">
v-for="item in tabChildren" <el-radio-group v-model="form.subType">
:key="item" <el-radio
:label="item.label" v-for="item in tabChildren"
:value="item.code" :key="item"
border :label="item.label"
style="margin: 0 0 10px 10px" :value="item.code"
/> border
<!-- <el-radio v-for="item in tabChildren" :value="item.value" border>{{ item.label }}</el-radio> --> style="margin: 0 0 10px 10px"
</el-radio-group> />
</div> <!-- <el-radio v-for="item in tabChildren" :value="item.value" border>{{ item.label }}</el-radio> -->
</el-tab-pane> </el-radio-group>
</el-tabs> </div>
<el-tabs type="border-card" class="left-tabs" style="height: 100%"> </el-tab-pane>
<el-tab-pane label="输出菜单"> </el-tabs>
<!-- 输出菜单内容 --> <el-tabs type="border-card" class="left-tabs" style="height: 100%">
<el-table <el-tab-pane label="输出菜单">
:data="tableData" <!-- 输出菜单内容 -->
style="width: 100%" <el-table
:style="{ height: '295px', overflow: 'hidden' }" :data="tableData"
:show-header="false" style="width: 100%"
:span-method="arraySpanMethod" :style="{ height: '295px', overflow: 'hidden' }"
:cell-style="tableStyle.cellStyle" :show-header="false"
:header-cell-style="{ textAlign: 'center', backgroundColor: '#003078', color: '#fff' }" :span-method="arraySpanMethod"
@cell-click="handleRowClick" :cell-style="tableStyle.cellStyle"
:key="key" :header-cell-style="{ textAlign: 'center', backgroundColor: '#003078', color: '#fff' }"
> @cell-click="handleRowClick"
<el-table-column prop="name" label="相别" width="60" align="center" /> :key="key"
<el-table-column prop="frequency" label="电压/电流" align="center" width="60" /> >
<el-table-column prop="L1" label="" width="180" align="center"> <el-table-column prop="name" label="相别" width="60" align="center" />
<template #default="{ row, $index }"> <el-table-column prop="frequency" label="电压/电流" align="center" width="60" />
<span> <el-table-column prop="L1" label="值" width="180" align="center">
{{ row.type === 'V' ? '电压' : '电流' }}{{ form.channelList[$index].famp <template #default="{ row, $index }">
}}{{ valueCode == 'Absolute' ? (row.type === 'V' ? 'V' : 'A') : '%' }} 相角{{ <span>
form.channelList[$index].fphase {{ row.type === 'V' ? '电压' : '电流' }}{{ form.channelList[$index].famp
}}° }}{{
</span> valueCode == 'Absolute' ? (row.type === 'V' ? 'V' : 'A') : '%'
</template> }}
</el-table-column> 相角{{ form.channelList[$index].fphase }}°
<el-table-column label="操作" width="85"> </span>
<template #default="{ row, $index }"> </template>
<el-button </el-table-column>
<el-table-column label="操作" width="85">
<template #default="{ row, $index }">
<!-- <el-button
type="primary" type="primary"
v-if="$index != 4" v-if="$index != 4"
link link
@@ -55,102 +58,120 @@
@click="copyRow($index)" @click="copyRow($index)"
> >
复制 复制
</el-button> </el-button> -->
</template> <el-dropdown placement="top-start">
</el-table-column> <el-button type="primary" link :icon="CopyDocument">复制</el-button>
<el-table-column label="操作" align="center"> <template #dropdown>
<template #default="{ row, $index }"> <el-dropdown-menu>
<el-checkbox-button <div v-if="$index == 0">
v-model="form.channelList[$index].channelFlag" <el-dropdown-item @click="copyRow(0, 2)">L2</el-dropdown-item>
label="通道使能" <el-dropdown-item @click="copyRow(0, 4)">L3</el-dropdown-item>
size="small" </div>
/> <div v-if="$index == 2">
<el-checkbox-button <el-dropdown-item @click="copyRow(2, 0)">L1</el-dropdown-item>
v-model="form.channelList[$index].harmFlag" <el-dropdown-item @click="copyRow(2, 4)">L3</el-dropdown-item>
label="谐波使能" </div>
size="small" <div v-if="$index == 4">
/> <el-dropdown-item @click="copyRow(4, 0)">L1</el-dropdown-item>
<el-checkbox-button <el-dropdown-item @click="copyRow(4, 2)">L2</el-dropdown-item>
v-model="form.channelList[$index].inHarmFlag" </div>
label="间谐波使能" </el-dropdown-menu>
size="small" </template>
/> </el-dropdown>
<el-checkbox-button </template>
v-model="form.channelList[$index].flickerFlag" </el-table-column>
label="闪变使能" <el-table-column label="操作" align="center">
size="small" <template #default="{ row, $index }">
/> <el-checkbox-button
<el-checkbox-button v-model="form.channelList[$index].channelFlag"
v-model="form.channelList[$index].dipFlag" label="通道使能"
label="暂态使能" />
size="small" <el-checkbox-button
/> v-model="form.channelList[$index].harmFlag"
</template> label="谐波使能"
</el-table-column> />
</el-table> <el-checkbox-button
</el-tab-pane> v-model="form.channelList[$index].inHarmFlag"
</el-tabs> label="间谐波使能"
<el-tabs type="border-card" class="right-tabs" style="height: 100%"> />
<el-tab-pane label="全局设置菜单"> <el-checkbox-button
<!-- 全局设置菜单内容 --> v-model="form.channelList[$index].flickerFlag"
<div style="height: 295px"> label="闪变使能"
<div class="form-item-container"> />
<el-form-item label="频率:" prop="name"> <el-checkbox-button
<div class="input-label-container"> v-model="form.channelList[$index].dipFlag"
<el-input label="暂态使能"
type="number" />
@mousewheel.native.prevent </template>
style="width: 100px" </el-table-column>
v-model="form.ffreq" </el-table>
/> </el-tab-pane>
<label>Hz</label> </el-tabs>
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
<el-tab-pane label="全局设置菜单">
<!-- 全局设置菜单内容 -->
<div style="height: 295px">
<div class="form-item-container">
<el-form-item label="频率:" prop="name">
<div class="input-label-container">
<el-input
type="number"
@mousewheel.native.prevent
style="width: 100px"
v-model="form.ffreq"
/>
<label>Hz</label>
</div>
</el-form-item>
</div> </div>
</el-form-item> <!-- <div class="button-label-container">
</div> <label>参考设定值列表:</label>
<div class="button-label-container"> <el-button type="primary" :icon="EditPen" @click="openDialog">编辑</el-button>
<label>参考设定值列表:</label> </div> -->
<el-button type="primary" :icon="EditPen" @click="openDialog">编辑</el-button> </div>
</div> </el-tab-pane>
</div> </el-tabs>
</el-tab-pane> </div>
</el-tabs> <div style="margin-top: 10px; height: 245px">
</div> <el-tabs type="border-card" class="custom-tabs">
<div style="margin-top: 10px"> <el-tab-pane label="电压/电流编辑" v-if="childForm[0].channelFlag || childForm[1].channelFlag">
<el-tabs type="border-card" class="custom-tabs"> <TestScriptVolCurTab :childForm="childForm" :valueCode="valueCode" />
<el-tab-pane label="电压/电流编辑" v-if="childForm[0].channelFlag || childForm[1].channelFlag"> </el-tab-pane>
<TestScriptVolCurTab :childForm="childForm" /> <el-tab-pane label="谐波编辑" v-if="childForm[0].harmFlag || childForm[1].harmFlag">
</el-tab-pane> <TestScriptHarmTab :childForm="childForm" />
<el-tab-pane label="谐波编辑" v-if="childForm[0].harmFlag || childForm[1].harmFlag"> </el-tab-pane>
<TestScriptHarmTab :childForm="childForm" /> <el-tab-pane label="间谐波编辑" v-if="childForm[0].inHarmFlag || childForm[1].inHarmFlag">
</el-tab-pane> <TestScriptInHarmTab :childForm="childForm" />
<el-tab-pane label="间谐波编辑" v-if="childForm[0].inHarmFlag || childForm[1].inHarmFlag"> </el-tab-pane>
<TestScriptInHarmTab :childForm="childForm" /> <el-tab-pane label="闪变编辑" v-if="childForm[0].flickerFlag || childForm[1].flickerFlag">
</el-tab-pane> <TestScriptFlickerTab :childForm="childForm" />
<el-tab-pane label="闪变编辑" v-if="childForm[0].flickerFlag || childForm[1].flickerFlag"> </el-tab-pane>
<TestScriptFlickerTab :childForm="childForm" /> <el-tab-pane label="暂态编辑" v-if="childForm[0].dipFlag || childForm[1].dipFlag">
</el-tab-pane> <TestScriptDipTab :childForm="childForm" />
<el-tab-pane label="暂态编辑" v-if="childForm[0].dipFlag || childForm[1].dipFlag"> </el-tab-pane>
<TestScriptDipTab :childForm="childForm" /> </el-tabs>
</el-tab-pane> </div>
</el-tabs> </el-carousel-item>
</div> <el-carousel-item :name="1" style="height: 100%; overflow-y: auto" v-if="showSetValueTable">
<SetValueTable
<!-- <SetValueTable ref="setValueTableRef" v-if="showSetValueTable" /> --> ref="setValueTableRef"
:activeName="props.activeName"
:formContent="props.formContent"
:form="form"
:key="initial"
/>
</el-carousel-item>
</el-carousel>
<template #footer> <template #footer>
<div> <div>
<el-button @click="close"> </el-button> <el-button @click="close"> </el-button>
<el-button type="primary" @click="save">保存</el-button> <el-button type="primary" @click="next" v-if="!showSetValueTable">下一步</el-button>
<el-button type="primary" @click="previous" v-if="showSetValueTable">上一步</el-button>
<el-button type="primary" @click="save" v-if="showSetValueTable">保存</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
<SetValueTable
ref="setValueTableRef"
:activeName="props.activeName"
:formContent="props.formContent"
:form="form"
v-if="showSetValueTable"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -165,10 +186,10 @@ import TestScriptInHarmTab from '@/views/machine/testScript/components/testScrip
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue' import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue'
import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue' import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue'
import { useDictStore } from '@/stores/modules/dict' import { useDictStore } from '@/stores/modules/dict'
import { addScriptDtls, } from '@/api/device/testScript' import { addScriptDtls } from '@/api/device/testScript'
import scriptForm from './scriptForm' import scriptForm from './scriptForm'
const emit = defineEmits(['addTab', 'close']) const emit = defineEmits(['addTab', 'close', 'getCommunication'])
const dictStore = useDictStore() const dictStore = useDictStore()
const props = defineProps({ const props = defineProps({
options: { options: {
@@ -186,6 +207,10 @@ const props = defineProps({
formContent: { formContent: {
type: [Object, Array], type: [Object, Array],
required: true required: true
},
communicationList: {
type: Array,
required: true
} }
}) })
const key = ref(0) const key = ref(0)
@@ -194,6 +219,8 @@ const showSetValueTable = ref(false)
const form: any = ref(JSON.parse(JSON.stringify(scriptForm))) const form: any = ref(JSON.parse(JSON.stringify(scriptForm)))
const childForm: any = ref([]) const childForm: any = ref([])
const ScriptValueType = ref('') const ScriptValueType = ref('')
const initial = ref(0) //轮播图索引
const carouselRef = ref()
const setValueTableRef = ref() const setValueTableRef = ref()
const dialogVisible = ref(false) const dialogVisible = ref(false)
const dialogTitle = ref() const dialogTitle = ref()
@@ -255,6 +282,7 @@ const close = () => {
// 保存数据 // 保存数据
const save = () => { const save = () => {
let copyForm = handleHarmData() let copyForm = handleHarmData()
copyForm.checkDataList = setValueTableRef.value?.getTableData()
addScriptDtls({ ...copyForm, scriptId: props.formContent.id, scriptType: props.activeName }).then(res => { addScriptDtls({ ...copyForm, scriptId: props.formContent.id, scriptType: props.activeName }).then(res => {
if (res.code === 'A0000') { if (res.code === 'A0000') {
ElMessage.success({ ElMessage.success({
@@ -267,6 +295,59 @@ const save = () => {
}) })
// emit('addTab', form.value) // emit('addTab', form.value)
} }
// 上一步
const previous = () => {
carouselRef.value.setActiveItem(0)
showSetValueTable.value = false
}
// 下一步
const next = () => {
emit('getCommunication')
setTimeout(() => {
// 判断通讯脚本
if (!checkFlags(props.communicationList)) {
ElMessage.warning({
message: '请先完善通讯脚本',
type: 'warning'
})
return
}
// 判断够选通道
if (!checkChannel(form.value)) {
ElMessage.warning({
message: '请先选择使能通道',
type: 'warning'
})
return
}
}, 100)
showSetValueTable.value = true
setTimeout(() => {
setValueTableRef.value?.open(props.communicationList)
carouselRef.value.setActiveItem(1)
}, 100)
// 切换轮播图
}
// 判断通讯脚本是否有值
const checkFlags = (data: any) => {
for (let i = 0; i < data.length; i++) {
const item = data[i]
if (item.children) {
for (let j = 0; j < item.children.length; j++) {
const child = item.children[j]
if (child.errorFlag != 0 || child.enable != 0) {
return true
}
}
}
}
return false
}
// 判断够选通道
const checkChannel = (data: row) => {
return data.channelList.every(item => item.channelFlag === true)
}
//处理谐波数据 //处理谐波数据
const handleHarmData = () => { const handleHarmData = () => {
let copyForm = JSON.parse(JSON.stringify(form.value)) let copyForm = JSON.parse(JSON.stringify(form.value))
@@ -324,15 +405,15 @@ const setharmList = (row: any) => {
return row return row
} }
// 复制 // 复制
const copyRow = (index: number) => { const copyRow = (num: number, index: number) => {
form.value.channelList[index + 2] = JSON.parse(JSON.stringify(form.value.channelList[index])) form.value.channelList[index] = JSON.parse(JSON.stringify(form.value.channelList[num]))
form.value.channelList[index + 3] = JSON.parse(JSON.stringify(form.value.channelList[index + 1])) form.value.channelList[index + 1] = JSON.parse(JSON.stringify(form.value.channelList[num + 1]))
form.value.channelList[index].channelType == 'Ua' form.value.channelList[num].channelType == 'Ua'
? (form.value.channelList[index + 2].channelType = 'Ub') ? (form.value.channelList[index].channelType = 'Ub')
: (form.value.channelList[index + 2].channelType = 'Uc') : (form.value.channelList[index].channelType = 'Uc')
form.value.channelList[index + 1].channelType == 'Ia' form.value.channelList[num + 1].channelType == 'Ia'
? (form.value.channelList[index + 3].channelType = 'Ib') ? (form.value.channelList[index + 1].channelType = 'Ib')
: (form.value.channelList[index + 3].channelType = 'Ic') : (form.value.channelList[index + 1].channelType = 'Ic')
key.value += 1 key.value += 1
ElMessage.success({ ElMessage.success({
message: '复制成功!', message: '复制成功!',
@@ -341,15 +422,7 @@ const copyRow = (index: number) => {
} }
// 打开 drawer(新增、编辑) // 打开 drawer(新增、编辑)
const openDialog = () => { const openDialog = () => {}
let copyForm = JSON.parse(JSON.stringify(form.value))
showSetValueTable.value = true
// setValueTableRef.value?.open()
setTimeout(() => {
setValueTableRef.value?.open(props.formContent)
}, 100)
}
// 对外映射 // 对外映射
defineExpose({ open }) defineExpose({ open })
@@ -360,7 +433,6 @@ defineExpose({ open })
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
align-items: stretch; align-items: stretch;
height: 100%;
} }
.tabs-container { .tabs-container {
@@ -402,4 +474,10 @@ defineExpose({ open })
.input-label-container label { .input-label-container label {
margin-left: 5px; /* 添加标签与输入框之间的间距 */ margin-left: 5px; /* 添加标签与输入框之间的间距 */
} }
:deep(.el-carousel__indicators) {
display: none !important;
}
:deep(.el-carousel__arrow) {
display: none !important;
}
</style> </style>

View File

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

View File

@@ -4,7 +4,7 @@
<!-- 左侧编辑区域内容 --> <!-- 左侧编辑区域内容 -->
<img src="@/assets/images/transient.png" /> <img src="@/assets/images/transient.png" />
<div class="inputTop"> <!-- <div class="inputTop">
<el-input v-model="form[0].dipData.fValue" style="width: 150px; left: 4%" :disabled="!form[0].dipFlag"> <el-input v-model="form[0].dipData.fValue" style="width: 150px; left: 4%" :disabled="!form[0].dipFlag">
<template #append>S</template> <template #append>S</template>
</el-input> </el-input>
@@ -22,7 +22,7 @@
<el-input v-model="form[0].dipData.fValue" style="width: 150px; left: 40%" :disabled="!form[0].dipFlag"> <el-input v-model="form[0].dipData.fValue" style="width: 150px; left: 40%" :disabled="!form[0].dipFlag">
<template #append>S</template> <template #append>S</template>
</el-input> </el-input>
</div> </div> -->
</div> </div>
<div class="right-editor"> <div class="right-editor">
<!-- 右侧编辑区域内容 --> <!-- 右侧编辑区域内容 -->
@@ -30,7 +30,7 @@
<el-input v-model="form[0].dipData.ftransValue" style="width: 150px" :disabled="!form[0].dipFlag"/> <el-input v-model="form[0].dipData.ftransValue" style="width: 150px" :disabled="!form[0].dipFlag"/>
</el-form-item> </el-form-item>
<el-form-item label-width="120px" label="持续时间(周波)"> <el-form-item label-width="120px" label="持续时间(周波)">
<el-input v-model="form[0].dipData.fretainTime" style="width: 150px" :disabled="!form[0].dipFlag"/> <el-input v-model="form[0].dipData.retainTime" style="width: 150px" :disabled="!form[0].dipFlag"/>
</el-form-item> </el-form-item>
</div> </div>
</div> </div>

View File

@@ -1,11 +1,16 @@
<template> <template>
<div class="tabs-container"> <div class="tabs-container">
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%"> <el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%">
<el-tab-pane label="波动"> <el-tab-pane label="短闪">
<!-- 全局设置菜单内容 Modulation--> <!-- 全局设置菜单内容 Modulation-->
<div>
<el-form-item label="标准值" label-width="180px"> <div style="display: flex">
<el-select v-model="standardValue" style="width: 180px" placeholder="请选择标准值"> <el-form-item label="标准值">
<el-select
v-model="form[0].flickerData.flickerValue"
style="width: 180px"
placeholder="请选择标准值"
>
<el-option <el-option
v-for="item in standard" v-for="item in standard"
:key="item.label" :key="item.label"
@@ -14,7 +19,6 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item abel-width="180px"> <el-form-item abel-width="180px">
<template #label> <template #label>
<el-select <el-select
@@ -48,8 +52,11 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</div>
<div style="display: flex; justify-content: end">
<el-form-item label="变动量(%)" label-width="180px"> <el-form-item label="变动量(%)" label-width="180px">
<el-input <el-input
placeholder="请输入变动量"
style="width: 180px" style="width: 180px"
v-model="form[0].flickerData.fchagValue" v-model="form[0].flickerData.fchagValue"
:disabled="!form[0].flickerFlag" :disabled="!form[0].flickerFlag"
@@ -97,7 +104,7 @@ const props = defineProps({
required: true required: true
} }
}) })
const standardValue = ref('1')
const standard = [ const standard = [
{ {
label: '1', label: '1',
@@ -200,7 +207,7 @@ const waveList = [
] ]
const waveChildrenList = computed(() => { const waveChildrenList = computed(() => {
return waveList.filter((item: any) => item.value === form.value[0].flickerData.waveType)[0][ return waveList.filter((item: any) => item.value === form.value[0].flickerData.waveType)[0][
standardValue.value == '1' ? 'children1' : 'children3' props.childForm[0].flickerData.flickerValue == '1' ? 'children1' : 'children3'
] ]
}) })
const changeLable = e => { const changeLable = e => {

View File

@@ -8,7 +8,7 @@
<div class="right-editor"> <div class="right-editor">
<!-- 右侧编辑区域内容 --> <!-- 右侧编辑区域内容 -->
<el-form :inline="true" label-width="auto" :model="form" class="form-two"> <el-form :inline="true" label-width="auto" :model="form" class="form-two">
<el-form-item label="电压有效值(V)"> <el-form-item :label="`电压有效值(${valueCode == 'Absolute' ? 'V' : '%'})`">
<el-input <el-input
type="number" type="number"
@mousewheel.native.prevent @mousewheel.native.prevent
@@ -16,14 +16,6 @@
:disabled="!form[0].channelFlag" :disabled="!form[0].channelFlag"
/> />
</el-form-item> </el-form-item>
<el-form-item label="电流有效值(A)">
<el-input
type="number"
@mousewheel.native.prevent
v-model="form[1].famp"
:disabled="!form[1].channelFlag"
/>
</el-form-item>
<el-form-item label="电压相角(°)"> <el-form-item label="电压相角(°)">
<el-input <el-input
type="number" type="number"
@@ -32,6 +24,15 @@
:disabled="!form[0].channelFlag" :disabled="!form[0].channelFlag"
/> />
</el-form-item> </el-form-item>
<el-form-item :label="`电流有效值(${valueCode == 'Absolute' ? 'A' : '%'})`">
<el-input
type="number"
@mousewheel.native.prevent
v-model="form[1].famp"
:disabled="!form[1].channelFlag"
/>
</el-form-item>
<el-form-item label="电流相角(°)"> <el-form-item label="电流相角(°)">
<el-input <el-input
type="number" type="number"
@@ -53,6 +54,10 @@ const props = defineProps({
childForm: { childForm: {
type: Array, type: Array,
required: true required: true
},
valueCode: {
type: String,
required: true
} }
}) })