历史趋势图参数修改:指标多选改为单选

This commit is contained in:
zhujiyan
2024-09-19 10:12:01 +08:00
parent dda516b376
commit 747ba32792

View File

@@ -26,7 +26,7 @@
:name="item.id"
:key="index"
>
<el-descriptions value="small" class="mb10" :column="4" border>
<el-descriptions value="small" class="mb10" :column="6" border>
<el-descriptions-item label="测试项名称" width="160">
{{ item.itemName }}
</el-descriptions-item>
@@ -69,13 +69,11 @@
<span style="width: 140px; overflow: hidden; display: block">
{{ item.startTime }}
</span>
<!-- {{ item.startTime }} -->
</el-descriptions-item>
<el-descriptions-item label="结束时间" width="160">
<span style="width: 140px; overflow: hidden; display: block">
{{ item.endTime }}
</span>
<!-- {{ item.endTime }} -->
</el-descriptions-item>
<el-descriptions-item label="监测位置" width="160">
{{ item.location }}
@@ -98,9 +96,9 @@
<div class="history_header">
<el-form :model="searchForm" class="history_select" id="history_select">
<el-form-item label="统计指标" label-width="80px">
<!-- multiple
:multiple-limit="3" -->
<el-select
multiple
:multiple-limit="3"
collapse-tags
collapse-tags-tooltip
v-model="searchForm.index"
@@ -205,7 +203,7 @@ const typeOptions = [
}
]
searchForm.value = {
index: [],
index: '',
type: typeOptions[0].id,
count: []
}
@@ -219,7 +217,8 @@ const legendDictList: any = ref([])
queryByCode('portable-harmonic').then(res => {
queryCsDictTree(res.data.id).then(item => {
indexOptions.value = item.data
searchForm.value.index[0] = indexOptions.value[0].id
// searchForm.value.index[0] = indexOptions.value[0].id
searchForm.value.index = indexOptions.value[0].id
})
queryStatistical(res.data.id).then(vv => {
legendDictList.value = vv.data
@@ -278,11 +277,14 @@ const init = async () => {
// 选择指标的时候切换legend内容和data数据
let list: any = []
legendDictList.value?.selectedList?.map((item: any) => {
searchForm.value.index.map((vv: any) => {
if (item.dataType == vv) {
list.push(item.eleEpdPqdVOS)
}
})
// searchForm.value.index.map((vv: any) => {
// if (item.dataType == vv) {
// list.push(item.eleEpdPqdVOS)
// }
// })
if (item.dataType == searchForm.value.index) {
list.push(item.eleEpdPqdVOS)
}
})
//颜色数组
@@ -302,7 +304,7 @@ const init = async () => {
]
if (historyDevId.value) {
//选择的指标使用方法处理
initSearchFormIndexAndCount(searchForm.value.index)
initSearchFormIndexAndCount([searchForm.value.index])
//查询历史趋势
historyDataList.value = []
loading.value = true
@@ -320,11 +322,13 @@ const init = async () => {
} else {
middleTitle = ''
}
let indexList=[]
indexList=[searchForm.value.index]
chartTitle.value = deviceData.value.itemName + '_' + middleTitle + '_'
searchForm.value.index.map((item: any, indexs: any) => {
indexList.map((item: any, indexs: any) => {
indexOptions.value.map((vv: any) => {
if (vv.id == item) {
chartTitle.value += indexs == searchForm.value.index.length - 1 ? vv.name : vv.name + '/'
chartTitle.value += indexs == indexList.length - 1 ? vv.name : vv.name + '/'
}
})
})
@@ -333,7 +337,7 @@ const init = async () => {
console.log(item.count, '878888888')
lists[index] = {
statisticalId: item.index,
frequencys: item.count&& item.count.length != 0 ?[ item.count] : []
frequencys: item.count && item.count.length != 0 ? [item.count] : []
}
})
let obj = {
@@ -362,6 +366,7 @@ const init = async () => {
unitList.push(item.unit)
}
})
console.log(timeList, '+++++++++++')
xAxis = timeList.sort((a: any, b: any) => {
return (
a.replace('-', '').replace('-', '').replace(' ', '').replace(':', '').replace(':', '') -
@@ -761,7 +766,7 @@ const initSearchFormIndexAndCount = (list: any) => {
}
}
watch(
() => searchForm.value.index,
() => [searchForm.value.index],
(val: any, oldval: any) => {
if (val) {
initSearchFormIndexAndCount(val)
@@ -784,7 +789,8 @@ watch(
immediate: true
}
)
onMounted(() => {})
onMounted(() => {
})
</script>
<style lang="scss" scoped>