添加一键重算功能
This commit is contained in:
@@ -118,7 +118,14 @@ const info = async () => {
|
||||
pid: item.id,
|
||||
name: k.name,
|
||||
pname: item.name,
|
||||
dataType: item.name == '闪变' ? 'avg' : item.name == '暂态' ? 'avg' : 'real',
|
||||
dataType:
|
||||
item.name == '谐波有功功率'
|
||||
? 'avg'
|
||||
: item.name == '闪变'
|
||||
? 'avg'
|
||||
: item.name == '暂态'
|
||||
? 'avg'
|
||||
: 'real',
|
||||
show: true,
|
||||
errorFlag: childrenList[0].errorFlag,
|
||||
enable: childrenList[0].enable
|
||||
@@ -130,7 +137,13 @@ const info = async () => {
|
||||
name: k.name,
|
||||
disabled: false,
|
||||
pname: item.name,
|
||||
dataType: item.name == '闪变' ? 'avg' : item.name == '暂态' ? 'avg' : 'real',
|
||||
dataType: '谐波有功功率'
|
||||
? 'avg'
|
||||
: item.name == '闪变'
|
||||
? 'avg'
|
||||
: item.name == '暂态'
|
||||
? 'avg'
|
||||
: 'real',
|
||||
show: true,
|
||||
errorFlag: 0,
|
||||
enable: 0
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { log } from 'console'
|
||||
|
||||
let scriptForm: any = {
|
||||
subType: '', //tabcode
|
||||
ffreq: 50, //频率
|
||||
@@ -191,16 +193,6 @@ let scriptForm: any = {
|
||||
]
|
||||
}
|
||||
// 追加谐波
|
||||
function getScriptForm() {
|
||||
for (let i = 2; i < 51; i++) {
|
||||
scriptForm.channelList.forEach(item => {
|
||||
item.harmList.push({
|
||||
harm: i, //谐波次数
|
||||
famp: 0, //谐波含有率
|
||||
fphase: 0 // 谐波相角
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
// getScriptForm()
|
||||
|
||||
|
||||
export default scriptForm
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<template>
|
||||
<div class="table-container">
|
||||
<div class="recalculation">
|
||||
<el-button type="primary" :icon="Refresh" @click="recalculation">一键重算</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:header-cell-style="{
|
||||
@@ -9,25 +13,28 @@
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
height="600px"
|
||||
height="550px"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="60" />
|
||||
<el-table-column prop="pname" label="参考设定值类型" />
|
||||
<el-table-column prop="name" label="参考设定值子类型" width="250">
|
||||
<template #default="{ row }">{{ row.harmNum ? `(${row.harmNum}次)` : '' }} {{ row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dataType" label="值类型" :formatter="formatter" />
|
||||
<el-table-column prop="dataType" label="值类型">
|
||||
<template #default="{ row }">
|
||||
<el-select v-model="row.dataType" v-if="!row.show">
|
||||
<el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<span v-else>
|
||||
{{ typeList.find(item => item.value == row.dataType)?.label || row.dataType }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="phase" label="相别" />
|
||||
<el-table-column prop="value" label="参考设定值">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.show">{{ row.value }}</span>
|
||||
<el-input
|
||||
type="number"
|
||||
v-else
|
||||
v-model="row.value"
|
||||
placeholder="请输入值"
|
||||
@blur="row.show = !row.show"
|
||||
/>
|
||||
<el-input type="number" v-else v-model="row.value" placeholder="请输入值" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="value" label="参与误差比较">
|
||||
@@ -68,7 +75,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { CirclePlus, EditPen, Check, Share } from '@element-plus/icons-vue'
|
||||
import { Refresh, EditPen, Check, Share } from '@element-plus/icons-vue'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||
import { dialogBig } from '@/utils/elementBind'
|
||||
@@ -91,29 +98,36 @@ const props = defineProps({
|
||||
required: true
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['recalculation'])
|
||||
const tableData: any = ref([])
|
||||
// 表格配置项
|
||||
|
||||
const typeList = [
|
||||
{
|
||||
label: '实时',
|
||||
value: 'real'
|
||||
},
|
||||
{
|
||||
label: 'CP95值',
|
||||
value: 'cp95'
|
||||
},
|
||||
{
|
||||
label: '平均值',
|
||||
value: 'avg'
|
||||
},
|
||||
{
|
||||
label: '最小值',
|
||||
value: 'min'
|
||||
},
|
||||
{
|
||||
label: '最大值',
|
||||
value: 'max'
|
||||
}
|
||||
]
|
||||
const form = ref({
|
||||
name: 220,
|
||||
standardName: 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
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
|
||||
@@ -161,8 +175,12 @@ const open = async (row: any, copyRowList: any) => {
|
||||
tableData.value = res.data
|
||||
})
|
||||
}
|
||||
// 重算
|
||||
const recalculation = () => {
|
||||
emit('recalculation')
|
||||
}
|
||||
// 处理多余数据
|
||||
const handleHarmData = row => {
|
||||
const handleHarmData = (row: any) => {
|
||||
row.channelList.forEach((channel: any) => {
|
||||
// 筛选出 famp 和 fphase 不同时为 0 的对象
|
||||
channel.harmList = channel.harmList.filter((item: any) => item.famp != 0 || item.fphase != 0)
|
||||
@@ -173,7 +191,7 @@ const handleHarmData = row => {
|
||||
return row
|
||||
}
|
||||
// 判断数据是否变化
|
||||
const isEqual = (obj1:any, obj2:any) => {
|
||||
const isEqual = (obj1: any, obj2: any) => {
|
||||
// 如果两个对象是同一个引用,直接返回 true
|
||||
if (obj1 == obj2) return true
|
||||
// 如果其中一个是 null 或者不是对象,返回 false
|
||||
@@ -211,4 +229,10 @@ onMounted(() => {})
|
||||
defineExpose({ open, getTableData })
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
<style scoped>
|
||||
.recalculation {
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -154,6 +154,7 @@
|
||||
:formContent="props.formContent"
|
||||
:form="form"
|
||||
:key="initial"
|
||||
@recalculation="recalculation"
|
||||
/>
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
@@ -333,6 +334,10 @@ const next = () => {
|
||||
}, 100)
|
||||
// 切换轮播图
|
||||
}
|
||||
// 重新计算
|
||||
const recalculation = () => {
|
||||
setValueTableRef.value?.open(props.communicationList, {})
|
||||
}
|
||||
|
||||
// 判断够选通道
|
||||
const checkFlags = () => {
|
||||
|
||||
Reference in New Issue
Block a user