提交更改
This commit is contained in:
@@ -9,25 +9,26 @@
|
||||
<div class="device-control-right" v-if="deviceData">
|
||||
<el-descriptions title="设备基本信息" class="mb10" :column="3" border>
|
||||
<el-descriptions-item label="名称">
|
||||
{{ deviceData.name }}
|
||||
{{ deviceData.name ? deviceData.name : '/' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="类型">
|
||||
{{ echoName(deviceData.devType, devTypeOptions) }}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="接入方式">
|
||||
{{ deviceData.devAccessMethod }}
|
||||
{{ deviceData.devAccessMethod ? deviceData.devAccessMethod : '/' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="识别码">
|
||||
{{ deviceData.ndid }}
|
||||
{{ deviceData.ndid ? deviceData.ndid : '/' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="型号">
|
||||
{{ echoName(deviceData.devModel, devModelOptions) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="接入时间">
|
||||
{{ deviceData.time }}
|
||||
{{ deviceData.time ? deviceData.time : '/' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
{{ dataSet }}
|
||||
<el-tabs v-model="dataSet" type="border-card" class="device-control-box-card" @tab-click="handleClick">
|
||||
<el-tab-pane
|
||||
lazy
|
||||
@@ -52,8 +53,21 @@
|
||||
<el-button type="primary" icon="el-icon-Search" @click="handleClick">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="overflow: auto" :style="{ height: tableHeight }" v-loading="tableLoading">
|
||||
<div class="content">
|
||||
<div
|
||||
style="overflow: auto"
|
||||
:style="{ height: tableHeight }"
|
||||
v-loading="tableLoading"
|
||||
v-if="dataSet.length > 1"
|
||||
>
|
||||
<!-- 卡片 -->
|
||||
<div
|
||||
class="content"
|
||||
v-if="
|
||||
dataSet.indexOf('_trenddata') == -1 &&
|
||||
dataSet.indexOf('_realtimedata') == -1 &&
|
||||
dataSet.indexOf('_event') == -1
|
||||
"
|
||||
>
|
||||
<el-card class="box-card" v-for="(item, index) in tableData" :key="index">
|
||||
<template #header>
|
||||
<div class="clearfix">
|
||||
@@ -66,6 +80,7 @@
|
||||
></Icon>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 模块数据 -->
|
||||
<div class="box-card-content" v-if="dataSet.indexOf('_history') == -1">
|
||||
<div v-for="(child, childIndex) in item.children" :key="childIndex">
|
||||
{{ child.anotherName }}:
|
||||
@@ -121,7 +136,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<el-pagination
|
||||
v-if="tableData.length"
|
||||
v-if="
|
||||
tableData.length &&
|
||||
dataSet.indexOf('_trenddata') == -1 &&
|
||||
dataSet.indexOf('_realtimedata') == -1 &&
|
||||
dataSet.indexOf('_event') == -1
|
||||
"
|
||||
background
|
||||
class="mr2 mt10"
|
||||
style="float: right"
|
||||
@@ -133,7 +153,16 @@
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="formInline.total"
|
||||
></el-pagination>
|
||||
<div v-else style="height: 42px"></div>
|
||||
<div v-if="!tableData" style="height: 42px"></div>
|
||||
<!-- <el-tab-pane lazy label="趋势数据" name="0">
|
||||
<div style="height:calc(100vh - 330px);overflow: auto;border:1px solid red;"></div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane lazy label="实时数据" name="1">
|
||||
<div style="height:calc(100vh - 330px);overflow: auto;border:1px solid red;"></div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane lazy label="暂态事件" name="2">
|
||||
<div style="height:calc(100vh - 330px);overflow: auto;border:1px solid red;"></div>
|
||||
</el-tab-pane> -->
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-empty v-else description="请选择设备" class="device-control-right" />
|
||||
@@ -194,58 +223,86 @@ const handleSizeChange = (val: number) => {
|
||||
formInline.pageSize = val
|
||||
handleClick()
|
||||
}
|
||||
const nodeClick = (e: anyObj) => {
|
||||
const nodeClick = async (e: anyObj) => {
|
||||
if (!e) {
|
||||
loading.value = false
|
||||
return
|
||||
}
|
||||
console.log(e, '监测点请求的判断')
|
||||
if (e.level == 3) {
|
||||
loading.value = true
|
||||
getDeviceData(e.pid, 'history', e.id).then((res: any) => {
|
||||
res.data.dataSetList.forEach((item: any) => {
|
||||
if (item.type === 'history') {
|
||||
item.id = item.id + '_history'
|
||||
}
|
||||
})
|
||||
formInline.lineId = e.id
|
||||
await getDeviceData(e.pid, 'history', e.id).then((res: any) => {
|
||||
console.log(res.data, '-------------')
|
||||
deviceData.value = res.data
|
||||
if (res.data.dataSetList.length === 0) {
|
||||
if (!res.data.dataSetList) {
|
||||
dataSet.value = ''
|
||||
tableData.value = []
|
||||
} else {
|
||||
res.data.dataSetList.forEach((item: any) => {
|
||||
console.log(item.type, '777777777')
|
||||
if (item.type === 'history') {
|
||||
item.id = item.id + '_history'
|
||||
}
|
||||
if (item.type === 'trenddata') {
|
||||
item.id = item.id + '_trenddata'
|
||||
}
|
||||
if (item.type === 'realtimedata') {
|
||||
item.id = item.id + '_realtimedata'
|
||||
}
|
||||
if (item.type === 'event') {
|
||||
item.id = item.id + '_event'
|
||||
}
|
||||
})
|
||||
dataSet.value = res.data.dataSetList[0].id
|
||||
handleClick()
|
||||
}
|
||||
loading.value = false
|
||||
})
|
||||
formInline.lineId = e.id
|
||||
} else {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
const handleClick = (tab?: any) => {
|
||||
const handleClick = async (tab?: any) => {
|
||||
tableLoading.value = true
|
||||
if (tab) {
|
||||
tableData.value = []
|
||||
formInline.pageNum = 1
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (dataSet.value.indexOf('_history') > -1) {
|
||||
formInline.startTime = datePickerRef.value.timeValue[0]
|
||||
formInline.endTime = datePickerRef.value.timeValue[1]
|
||||
formInline.id = dataSet.value.replace('_history', '')
|
||||
deviceHisData(formInline).then((res: any) => {
|
||||
console.log(res)
|
||||
tableData.value = res.data.records
|
||||
formInline.total = res.data.total
|
||||
tableLoading.value = false
|
||||
})
|
||||
} else {
|
||||
formInline.id = dataSet.value
|
||||
deviceRtData(formInline).then((res: any) => {
|
||||
tableData.value = res.data.records
|
||||
formInline.total = res.data.total
|
||||
tableLoading.value = false
|
||||
})
|
||||
}
|
||||
}, 100)
|
||||
// setTimeout(() => {
|
||||
//查询历史模块数据
|
||||
if (dataSet.value.indexOf('_history') > -1) {
|
||||
console.log('_history')
|
||||
formInline.startTime = datePickerRef.value.timeValue[0]
|
||||
formInline.endTime = datePickerRef.value.timeValue[1]
|
||||
formInline.id = dataSet.value.replace('_history', '')
|
||||
await deviceHisData(formInline).then((res: any) => {
|
||||
console.log(res)
|
||||
tableData.value = res.data.records
|
||||
formInline.total = res.data.total
|
||||
tableLoading.value = false
|
||||
})
|
||||
}
|
||||
//查询数据趋势数据
|
||||
if (dataSet.value.indexOf('_trenddata') > -1) {
|
||||
console.log('_trenddata')
|
||||
}
|
||||
//查询实时数据
|
||||
if (dataSet.value.indexOf('_realtimedata') > -1) {
|
||||
console.log('_realtimedata')
|
||||
}
|
||||
//查询暂事件
|
||||
if (dataSet.value.indexOf('_event') > -1) {
|
||||
console.log('_event')
|
||||
} else {
|
||||
formInline.id = dataSet.value
|
||||
await deviceRtData(formInline).then((res: any) => {
|
||||
tableData.value = res.data.records
|
||||
formInline.total = res.data.total
|
||||
tableLoading.value = false
|
||||
})
|
||||
}
|
||||
// }, 100)
|
||||
}
|
||||
queryByCode('Device_Type').then(res => {
|
||||
queryCsDictTree(res.data.id).then(res => {
|
||||
@@ -268,7 +325,7 @@ queryByCode('Device_Type').then(res => {
|
||||
})
|
||||
})
|
||||
const echoName = (value: any, arr: any[]) => {
|
||||
return arr.find(item => item.value == value).label
|
||||
return value ? arr.find(item => item.value == value).label : '/'
|
||||
}
|
||||
const openGroup = () => {
|
||||
if (!dataSet.value) {
|
||||
|
||||
Reference in New Issue
Block a user