修改浙江无线测试用例bug

This commit is contained in:
GGJ
2024-12-17 20:57:07 +08:00
parent e10ca83ec5
commit 21831dda90
32 changed files with 873 additions and 254 deletions

View File

@@ -102,8 +102,8 @@
<div v-if="JSON.stringify(echartsData) != '{}' && deviceData?.records?.length != 0">
<!-- <h3 class="mt10 mb10">历史趋势</h3> -->
<el-tabs type="border-card" class="mt10">
<el-tab-pane label="历史趋势">
<el-tabs v-model="childTab" type="border-card" class="mt10">
<el-tab-pane label="历史趋势" name="0">
<div class="history_trend" v-if="titleList != '(未绑定数据)'">
<div class="history_header" ref="headerRef">
<!-- <el-form :model="searchForm" class="history_select" id="history_select"> -->
@@ -117,6 +117,17 @@
:label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<!-- <el-select style="width: 12px !important" v-model="searchForm.dataLevel">
<el-option value="Primary" label="一次值"></el-option>
<el-option value="Secondary" label="二次值"></el-option>
</el-select> -->
<el-radio-group v-model="searchForm.dataLevel" @change="init(true)">
<el-radio-button label="一次值" value="Primary" />
<el-radio-button label="二次值" value="Secondary" />
</el-radio-group>
</el-form-item>
<el-form-item for="-" label="统计类型" label-width="80px">
<el-select style="width: 120px" v-model="searchForm.type"
placeholder="请选择值类型">
@@ -124,12 +135,8 @@
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item for="-" label="值类型">
<el-select style="width: 12px !important" v-model="searchForm.dataLevel">
<el-option value="Primary" label="一次值"></el-option>
<el-option value="Secondary" label="二次值"></el-option>
</el-select>
</el-form-item>
<el-form-item for="-" v-for="(item, index) in countData" :key="index"
:label="item.name.includes('次数') ? item.name : item.name.includes('幅值') ? item.name.slice(0, -2) + '次数' : item.name + '谐波次数'"
v-show="item.countOptions.length != 0">
@@ -162,8 +169,8 @@
</div>
<el-empty :style="EcharHeight" v-else description="未绑定数据" />
</el-tab-pane>
<el-tab-pane label="暂态数据">
暂态数据
<el-tab-pane label="暂态数据" name="1">
<transient :activeName='activeName' ref="transientRef" />
</el-tab-pane>
</el-tabs>
@@ -192,12 +199,15 @@ import { color, gradeColor3 } from '@/components/echarts/color'
import TableHeader from '@/components/table/header/index.vue'
import { useConfig } from '@/stores/config'
import { getDeviceList } from '@/api/cs-device-boot/planData'
import transient from './components/transient.vue'
const dictData = useDictData()
defineOptions({
// name: 'govern/device/planData/index'
})
const childTab = ref('0')
const num = ref(0)
const config = useConfig()
const transientRef = ref()
color[0] = config.layout.elementUiPrimary[0]
//电压等级
const voltageLevelList = dictData.getBasicData('Dev_Voltage_Stand')
@@ -249,6 +259,41 @@ queryByCode('portable-harmonic').then(res => {
})
queryStatistical(res.data.id).then(vv => {
legendDictList.value = vv.data
indexOptions.value.map((item: any, index: any) => {
if (!countDataCopy.value[index]) {
countDataCopy.value[index] = {
index: item.id,
countOptions: [],
count: [],
name: indexOptions.value.find((vv: any) => {
return vv.id == item.id
})?.name
}
}
legendDictList.value?.selectedList?.map((vv: any, vvs: any) => {
//查找相等的指标
if (item.id == vv.dataType) {
vv.eleEpdPqdVOS.map((kk: any, kks: any) => {
if (kk.harmStart && kk.harmEnd) {
range(0, 0, 0)
if (kk.showName == '间谐波电压含有率') {
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map(
(item: any) => {
return item - 0.5
}
)
} else {
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
}
if (!countDataCopy.value[index].count || countDataCopy.value[index].count.length == 0) {
countDataCopy.value[index].count = countDataCopy.value[index].countOptions[0]
}
}
})
}
})
})
})
})
const activeName: any = ref()
@@ -284,21 +329,23 @@ const nodeClick = async (e: anyObj) => {
if (res.data.records.length == 1) {
activeName.value = res.data.records[0].id
} else {
res.data.records.map((item: any, index: any) => {
//多层
for (const item of res.data.records) {
if (item.id == e.id) {
activeName.value = item.id
return
} else {
activeName.value = res.data.records[0].id
return
activeName.value = item.id;
break; // 找到匹配项后停止遍历
}
})
}
// 如果没有找到匹配项默认设置为第一个元素的id
if (activeName.value !== e.id) { // 假设e.id是一个用于比较的初始值表示未找到匹配项
activeName.value = res.data.records[0].id;
}
}
// if (searchForm.value.index.length == 0) {
// searchForm.value.index = [indexOptions.value[0].id]
// }
schemeTreeRef.value.getPlanData(deviceData.value)
await setTimeout(() => {
loading.value = true
@@ -307,6 +354,7 @@ const nodeClick = async (e: anyObj) => {
} else {
init(false)
}
transientRef.value && transientRef.value.init()
}, 100)
loading.value = false
@@ -326,6 +374,8 @@ const onIndexChange = (val: any) => {
}
})
searchForm.value.index = pp
formatCountOptions()
// if (val.length == 0) {
// searchForm.value.index = [indexOptions.value[0].id]
// }
@@ -402,7 +452,7 @@ const init = (flag: boolean) => {
//选择的指标使用方法处理
formatCountOptions(searchForm.value.index)
formatCountOptions()
//查询历史趋势
historyDataList.value = []
let middleTitle = ''
@@ -822,46 +872,61 @@ const handleExport = async () => {
return
}
const countData: any = ref([])
const countDataCopy: any = ref([])
const tableHeaderRef = ref()
//根据选择的指标处理谐波次数
const formatCountOptions = (list: any) => {
countData.value = []
if (list.length != 0) {
list.map((item: any, index: any) => {
if (!countData.value[index]) {
countData.value[index] = {
index: item,
countOptions: [],
count: [],
name: indexOptions.value.find((vv: any) => {
return vv.id == item
})?.name
}
}
legendDictList.value?.selectedList?.map((vv: any, vvs: any) => {
//查找相等的指标
if (item == vv.dataType) {
vv.eleEpdPqdVOS.map((kk: any, kks: any) => {
if (kk.harmStart && kk.harmEnd) {
range(0, 0, 0)
if (kk.showName == '间谐波电压含有率') {
countData.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map(
(item: any) => {
return item - 0.5
}
)
} else {
countData.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
}
if (!countData.value[index].count || countData.value[index].count.length == 0) {
countData.value[index].count = countData.value[index].countOptions[0]
}
}
})
//根据选择的指标处理谐波次数
const formatCountOptions = () => {
countData.value = []
console.log(123, indexOptions.value);
if (searchForm.value.index.length != 0) {
searchForm.value.index.forEach((item: any, index: any) => {
countDataCopy.value.forEach((vv: any, vvs: any) => {
if (vv.index == item) {
countData.value.push(vv)
}
})
})
// indexOptions.value.map((item: any, index: any) => {
// if (!countDataCopy.value[index]) {
// countDataCopy.value[index] = {
// index: item.id,
// countOptions: [],
// count: [],
// name: indexOptions.value.find((vv: any) => {
// return vv.id == item.id
// })?.name
// }
// }
// legendDictList.value?.selectedList?.map((vv: any, vvs: any) => {
// //查找相等的指标
// if (item.id == vv.dataType) {
// vv.eleEpdPqdVOS.map((kk: any, kks: any) => {
// if (kk.harmStart && kk.harmEnd) {
// range(0, 0, 0)
// if (kk.showName == '间谐波电压含有率') {
// countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map(
// (item: any) => {
// return item - 0.5
// }
// )
// } else {
// countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
// }
// if (!countDataCopy.value[index].count || countDataCopy.value[index].count.length == 0) {
// countDataCopy.value[index].count = countDataCopy.value[index].countOptions[0]
// }
// }
// })
// }
// })
// })
console.log("🚀 ~ vv.eleEpdPqdVOS.map ~ countData.value:", countDataCopy.value)
countData.value.map((item: any, key: any) => {
if (item.name.includes('谐波电流有效值')) {
item.name = '谐波电流次数'
@@ -922,26 +987,24 @@ watch(
() => searchForm.value.index,
(val: any, oldval: any) => {
if (val) {
// if (val) {
// let list = val
// setTimeout(() => {
// formatCountOptions(list)
// }, 100)
// countData.value.map((item: any, key: any) => {
// if (
// list.findIndex((vv: any) => {
// return vv == item.index
// }) == -1
// ) {
// countData.value.splice(key, 1)
// }
// })
let list = val
setTimeout(() => {
formatCountOptions(list)
}, 100)
countData.value.map((item: any, key: any) => {
if (
list.findIndex((vv: any) => {
return vv == item.index
}) == -1
) {
countData.value.splice(key, 1)
}
})
init(false)
}
// init(false)
// }
},
{
deep: true,
@@ -949,6 +1012,7 @@ watch(
}
)
onMounted(() => {
setTimeout(() => {
init(true)
}, 1500)