修改测试bug
This commit is contained in:
@@ -79,27 +79,34 @@
|
||||
realTimeFlag
|
||||
">
|
||||
<template #select>
|
||||
<el-form-item label="日期" v-show="dataSet.indexOf('_history') != -1">
|
||||
<el-form-item label="日期"
|
||||
v-show="dataSet.includes('_items') || dataSet.indexOf('_history') != -1">
|
||||
<DatePicker ref="datePickerRef"></DatePicker>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据类型" v-if="dataSet.indexOf('_history') == -1">
|
||||
|
||||
<el-select v-model="formInline.targetType">
|
||||
<el-form-item label="数据类型" v-if="!dataSet.includes('_')">
|
||||
<el-select v-model="formInline.targetType" @change="handleTargetTypeChange">
|
||||
<el-option v-for="item in queryList" :key="item.id" :label="item.name"
|
||||
:value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="指标" v-show="!realTimeFlag">
|
||||
<el-input style="width: 160px" v-model="formInline.searchValue" autocomplete="off" clearable
|
||||
placeholder="请输入关键词"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="值类型">
|
||||
|
||||
<el-form-item label="值类型" v-if="!dataSet.includes('_items')">
|
||||
<el-select style="min-width: 120px !important" v-model="formInline.dataLevel"
|
||||
:disabled="dataLevel == 'Primary' && deviceType == '0'">
|
||||
<el-option value="Primary" label="一次值"></el-option>
|
||||
<el-option value="Secondary" label="二次值"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="筛选" v-if="!dataSet.includes('_')">
|
||||
<el-input style="width: 160px" v-model="searchValue" autocomplete="off" clearable
|
||||
placeholder="请输入关键词"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="偶数/奇数" v-if="oddAndEvenFlag && !dataSet.includes('_')">
|
||||
<el-select v-model="oddAndEven" style="min-width: 120px !important">
|
||||
<el-option v-for="item in oddAndEvenList" :key="item.value" :label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button type="primary" icon="el-icon-Search" @click="handleClick">查询</el-button>
|
||||
@@ -138,87 +145,87 @@
|
||||
"
|
||||
></div> -->
|
||||
<!-- v-loading="tableLoading" -->
|
||||
<div :style="{ height: tableHeight }" v-loading="tableLoading" v-if="!dataSet.includes('_')">
|
||||
<div style="overflow: auto" :style="{ height: tableHeight }" v-loading="tableLoading" v-if="
|
||||
dataSet.indexOf('_trenddata') == -1 &&
|
||||
dataSet.indexOf('_realtimedata') == -1 &&
|
||||
dataSet.indexOf('_event') == -1 &&
|
||||
tableData.length != 0
|
||||
">
|
||||
<div class="mb5 mt5" v-if="dataSet.indexOf('_history') == -1">
|
||||
统计时间:{{ tableData[0]?.time || '' }}
|
||||
</div>
|
||||
|
||||
<div style="overflow: auto" :style="{ height: tableHeight }" v-loading="tableLoading" v-if="
|
||||
dataSet.indexOf('_trenddata') == -1 &&
|
||||
dataSet.indexOf('_realtimedata') == -1 &&
|
||||
dataSet.indexOf('_event') == -1 &&
|
||||
tableData.length != 0
|
||||
">
|
||||
<div class="mb5 mt5" v-if="dataSet.indexOf('_history') == -1">
|
||||
统计时间:{{ tableData[0]?.time || '' }}
|
||||
</div>
|
||||
|
||||
<nearRealTimeData ref="nearRealTimeDataRef" v-if="dataSet.indexOf('_history') == -1" />
|
||||
<nearRealTimeData ref="nearRealTimeDataRef" v-if="dataSet.indexOf('_history') == -1" />
|
||||
|
||||
|
||||
<!-- 循环渲染的card 最新数据/历史数据显示 -->
|
||||
<div class="content"
|
||||
v-if="tableData.length != 0 && !tableLoading && dataSet.indexOf('_history') != -1"
|
||||
:style="{ height: tableHeightBox }">
|
||||
<!-- 循环渲染的card 最新数据/历史数据显示 -->
|
||||
<div class="content"
|
||||
v-if="tableData.length != 0 && !tableLoading && dataSet.indexOf('_history') != -1"
|
||||
:style="{ height: tableHeightBox }">
|
||||
|
||||
<el-card class="box-card" :class="dataSet.indexOf('_history') == -1 ? 'box-card-new' : ''"
|
||||
v-for="(item, index) in tableData" :key="index">
|
||||
<template #header>
|
||||
<div class="clearfix">
|
||||
<span style="flex: 1">{{ item.name }}</span>
|
||||
<Icon name="el-icon-TrendCharts" class="ml10" @click="getDeviceDataTrend(item)"
|
||||
style="font-size: 26px; cursor: pointer; color: #fff"></Icon>
|
||||
</div>
|
||||
</template>
|
||||
<el-card class="box-card" :class="dataSet.indexOf('_history') == -1 ? 'box-card-new' : ''"
|
||||
v-for="(item, index) in tableData" :key="index">
|
||||
<template #header>
|
||||
<div class="clearfix">
|
||||
<span style="flex: 1">{{ item.name }}</span>
|
||||
<Icon name="el-icon-TrendCharts" class="ml10" @click="getDeviceDataTrend(item)"
|
||||
style="font-size: 26px; cursor: pointer; color: #fff"></Icon>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="box-card-content" v-if="dataSet.indexOf('_history') == -1">
|
||||
<div class="box-card-div">
|
||||
<div v-for="(child, childIndex) in item.children" :key="childIndex">
|
||||
{{ child.anotherName }}:
|
||||
{{ child.dataValue === 3.1415926 ? '暂无数据' : child.dataValue }}
|
||||
</div>
|
||||
|
||||
<div class="box-card-content" v-if="dataSet.indexOf('_history') == -1">
|
||||
<div class="box-card-div">
|
||||
<div v-for="(child, childIndex) in item.children" :key="childIndex">
|
||||
{{ child.anotherName }}:
|
||||
{{ child.dataValue === 3.1415926 ? '暂无数据' : child.dataValue }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-else-if="item.children.length" class="box-card-div">
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-tag effect="dark" type="danger" style="width: 40px; text-align: center"
|
||||
class="mr10">
|
||||
MAX
|
||||
</el-tag>
|
||||
{{
|
||||
item.children[0].maxValue === 3.1415956 ||
|
||||
typeof item.children[0].maxValue != 'number'
|
||||
? '暂无数据'
|
||||
: item.children[0].maxValue
|
||||
}}
|
||||
<div v-else-if="item.children.length" class="box-card-div">
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-tag effect="dark" type="danger" style="width: 40px; text-align: center"
|
||||
class="mr10">
|
||||
MAX
|
||||
</el-tag>
|
||||
{{
|
||||
item.children[0].maxValue === 3.1415956 ||
|
||||
typeof item.children[0].maxValue != 'number'
|
||||
? '暂无数据'
|
||||
: item.children[0].maxValue
|
||||
}}
|
||||
</div>
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-tag effect="dark" type="success" style="width: 40px; text-align: center"
|
||||
class="mr10">
|
||||
AVG
|
||||
</el-tag>
|
||||
{{
|
||||
item.children[0].avgValue === 3.1415956 ||
|
||||
typeof item.children[0].avgValue != 'number'
|
||||
? '暂无数据'
|
||||
: item.children[0].avgValue
|
||||
}}
|
||||
</div>
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-tag effect="dark" type="warning" style="width: 40px; text-align: center"
|
||||
class="mr10">
|
||||
MIN
|
||||
</el-tag>
|
||||
{{
|
||||
item.children[0].minValue === 3.1415956 ||
|
||||
typeof item.children[0].minValue != 'number'
|
||||
? '暂无数据'
|
||||
: item.children[0].minValue
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-tag effect="dark" type="success" style="width: 40px; text-align: center"
|
||||
class="mr10">
|
||||
AVG
|
||||
</el-tag>
|
||||
{{
|
||||
item.children[0].avgValue === 3.1415956 ||
|
||||
typeof item.children[0].avgValue != 'number'
|
||||
? '暂无数据'
|
||||
: item.children[0].avgValue
|
||||
}}
|
||||
</div>
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-tag effect="dark" type="warning" style="width: 40px; text-align: center"
|
||||
class="mr10">
|
||||
MIN
|
||||
</el-tag>
|
||||
{{
|
||||
item.children[0].minValue === 3.1415956 ||
|
||||
typeof item.children[0].minValue != 'number'
|
||||
? '暂无数据'
|
||||
: item.children[0].minValue
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-empty description="暂无数据" v-if="tableData.length === 0"></el-empty>
|
||||
</div>
|
||||
<!-- <div class="content" v-if="tableData.length != 0 && !tableLoading"
|
||||
</el-card>
|
||||
<el-empty description="暂无数据" v-if="tableData.length === 0"></el-empty>
|
||||
</div>
|
||||
<!-- <div class="content" v-if="tableData.length != 0 && !tableLoading"
|
||||
:style="{ height: tableHeightBox }">
|
||||
|
||||
<el-card class="box-card" :class="dataSet.indexOf('_history') == -1 ? 'box-card-new' : ''"
|
||||
@@ -283,6 +290,7 @@
|
||||
</el-card>
|
||||
<el-empty description="暂无数据" v-if="tableData.length === 0"></el-empty>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- <el-pagination v-if="
|
||||
tableData.length &&
|
||||
@@ -296,7 +304,7 @@
|
||||
|
||||
<!-- 趋势数据 -->
|
||||
<div style="height: calc(100vh - 340px)" v-if="dataSet.indexOf('_trenddata') != -1">
|
||||
<Trend ref="trendRef"></Trend>
|
||||
<Trend ref="trendRef" :TrendList="TrendList"></Trend>
|
||||
</div>
|
||||
<!-- 实时数据 -->
|
||||
<div :style="`height: calc(100vh - (${sonTab == 1 ? '378px' : sonTab == 2 ? '340px' : '425px'}))`"
|
||||
@@ -328,9 +336,9 @@
|
||||
<Event ref="eventRef"></Event>
|
||||
</div>
|
||||
<!-- 测试项记录 -->
|
||||
<div style="height: calc(100vh - 340px)" v-if="dataSet.indexOf('_items') != -1"
|
||||
<div style="height: calc(100vh - 395px)" v-if="dataSet.indexOf('_items') != -1"
|
||||
v-loading="tableLoading">
|
||||
<!-- <Event ref="eventRef"></Event> -->
|
||||
<testItemRecords ref="testItemRecordsRef" @onSubmit="handleClick" />
|
||||
</div>
|
||||
<div v-if="!tableData" style="height: 42px"></div>
|
||||
</el-tabs>
|
||||
@@ -356,7 +364,7 @@ import {
|
||||
queryDictType,
|
||||
|
||||
} from '@/api/cs-device-boot/EquipmentDelivery'
|
||||
import { deviceHisData, deviceRtData, realTimeData } from '@/api/cs-device-boot/csGroup'
|
||||
import { deviceHisData, deviceRtData, realTimeData, getTestData } from '@/api/cs-device-boot/csGroup'
|
||||
import { ref, reactive, onMounted, onUnmounted, inject, nextTick, onBeforeUnmount } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import DatePicker from '@/components/form/datePicker/index.vue'
|
||||
@@ -368,6 +376,7 @@ import recordWoves from './tabs/components/recordwoves.vue' //实时数据-实
|
||||
import offLineDataImport from './offLineDataImport/index.vue'
|
||||
import Event from './tabs/event.vue'
|
||||
import nearRealTimeData from './nearRealTimeData.vue'
|
||||
import testItemRecords from './testItemRecords.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
@@ -384,14 +393,18 @@ const tableLoading = ref(false)
|
||||
const getGroupLoading = ref(false)
|
||||
const deviceData = ref<any>(null)
|
||||
const dataSet = ref('')
|
||||
const testItemRecordsRef = ref()
|
||||
const nearRealTimeDataRef = ref()
|
||||
const devTypeOptions = ref([])
|
||||
const devModelOptions = ref([])
|
||||
const tableData = ref<any[]>([])
|
||||
const tableHeight = mainHeight(290).height
|
||||
const tableHeightBox = mainHeight(310).height
|
||||
const mangePopup = ref()
|
||||
const datePickerRef = ref()
|
||||
const searchValue = ref('')
|
||||
const TrendList=ref({})
|
||||
const oddAndEven = ref('1')
|
||||
const datePickerRef = ref('1')
|
||||
const oddAndEvenFlag = ref(false)
|
||||
const formInline = reactive({
|
||||
searchValue: '',
|
||||
pageNum: 1,
|
||||
@@ -404,7 +417,21 @@ const formInline = reactive({
|
||||
targetType: '',
|
||||
dataLevel: 'Secondary'
|
||||
})
|
||||
const oddAndEvenList = [
|
||||
{
|
||||
value: '1',
|
||||
label: '奇次',
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: '偶次',
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: '全部',
|
||||
},
|
||||
|
||||
]
|
||||
const detail = ref<any>(null)
|
||||
//是否显示实时数据默认内容
|
||||
const realTimeFlag = ref(true)
|
||||
@@ -567,20 +594,24 @@ const deviceId: any = ref('')
|
||||
const lineId: any = ref('')
|
||||
const dataLevel: any = ref('')
|
||||
const nodeClick = async (e: anyObj) => {
|
||||
searchValue.value = ''
|
||||
await queryDictType({
|
||||
lineId: e?.id
|
||||
}).then(res => {
|
||||
oddAndEvenFlag.value = false
|
||||
queryList.value = res.data
|
||||
formInline.targetType = res.data[0].id
|
||||
})
|
||||
// console.log("🚀 ~ nodeClick ~ e:", e)
|
||||
|
||||
if (e.level == 2) return
|
||||
deviceId.value = e?.pid
|
||||
lineId.value = e?.id
|
||||
TrendList.value=e
|
||||
if (!e) {
|
||||
loading.value = false
|
||||
return
|
||||
}
|
||||
|
||||
//选中设备名称后,点击标签页也能查询数据,要求点击设备名称后,点击标签页默认查询第一个监测点数据
|
||||
if (e.level == 3 || e.level == 2) {
|
||||
loading.value = true
|
||||
@@ -948,15 +979,16 @@ const handleClick = async (tab?: any) => {
|
||||
}
|
||||
//测试项记录
|
||||
if (dataSet.value.includes('_items')) {
|
||||
formInline.startTime = datePickerRef.value && datePickerRef.value.timeValue[0]
|
||||
formInline.endTime = datePickerRef.value && datePickerRef.value.timeValue[1]
|
||||
formInline.id = dataSet.value
|
||||
// await deviceRtData(formInline)
|
||||
await realTimeData(formInline)
|
||||
await getTestData(formInline)
|
||||
.then((res: any) => {
|
||||
tableData.value = res.data
|
||||
formInline.total = res.data.total
|
||||
tableLoading.value = false
|
||||
setTimeout(() => { //targetType
|
||||
nearRealTimeDataRef.value?.setData(res.data, queryList.value.filter((item: any) => item.id == formInline.targetType))
|
||||
testItemRecordsRef.value?.setData(res.data,)
|
||||
}, 500)
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -979,12 +1011,41 @@ const handleClick = async (tab?: any) => {
|
||||
.then((res: any) => {
|
||||
tableData.value = res.data
|
||||
formInline.total = res.data.total
|
||||
tableLoading.value = false
|
||||
let queryListName = queryList.value.filter((item: any) => item.id == formInline.targetType)
|
||||
let list = res.data.filter((item: any) => {
|
||||
if (item.otherName.includes(searchValue.value)) {
|
||||
return item
|
||||
}
|
||||
})
|
||||
if (oddAndEvenFlag.value) {
|
||||
list = list.filter((item: any) => {
|
||||
let str = item.otherName.split("次")[0]
|
||||
queryListName[0].name == '间谐波电压含有率' ? str = str - 0.5 : ''
|
||||
|
||||
if (oddAndEven.value == '1') {
|
||||
// 奇次
|
||||
if (str % 2 != 0) {
|
||||
return item
|
||||
}
|
||||
|
||||
} else if (oddAndEven.value == '2') {
|
||||
// 偶次
|
||||
if (str % 2 == 0) {
|
||||
return item
|
||||
}
|
||||
} else {
|
||||
return item
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
setTimeout(() => { //targetType
|
||||
nearRealTimeDataRef.value?.setData(res.data, queryList.value.filter((item: any) => item.id == formInline.targetType))
|
||||
nearRealTimeDataRef.value?.setData(list, queryListName)
|
||||
tableLoading.value = false
|
||||
}, 500)
|
||||
setTimeout(() => {
|
||||
|
||||
loading.value = false
|
||||
}, 1500)
|
||||
})
|
||||
@@ -1045,6 +1106,14 @@ queryByCode('Device_Type').then(res => {
|
||||
})
|
||||
})
|
||||
})
|
||||
const handleTargetTypeChange = () => {
|
||||
|
||||
if (queryList.value.filter((item: any) => item.id == formInline.targetType)[0].name != '基本数据') {
|
||||
oddAndEvenFlag.value = true
|
||||
} else {
|
||||
oddAndEvenFlag.value = false
|
||||
}
|
||||
}
|
||||
const queryList: any = ref([])
|
||||
|
||||
const echoName = (value: any, arr: any[]) => {
|
||||
|
||||
Reference in New Issue
Block a user