|
@@ -7,25 +7,21 @@
|
|
|
<div class="card-header">
|
|
<div class="card-header">
|
|
|
<span>设备区域</span>
|
|
<span>设备区域</span>
|
|
|
<div style="display: none">
|
|
<div style="display: none">
|
|
|
- <el-button type="primary" >
|
|
|
|
|
|
|
+ <el-button type="primary">
|
|
|
添加
|
|
添加
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<div class="tree">
|
|
<div class="tree">
|
|
|
- <LayTree
|
|
|
|
|
- :data="data"
|
|
|
|
|
- :tail-node-icon="false"
|
|
|
|
|
- :onlyIconControl="true"
|
|
|
|
|
- v-model:selectedKey="selectedKey"
|
|
|
|
|
- @node-click="handleClick"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <LayTree :data="data" :tail-node-icon="false" :onlyIconControl="true" v-model:selectedKey="selectedKey"
|
|
|
|
|
+ @node-click="handleClick">
|
|
|
<template #title="{ data }">
|
|
<template #title="{ data }">
|
|
|
- <div style="display: flex;align-items: center;"><el-icon v-if="(data.id+'').indexOf('device')!=-1" ><Cpu /></el-icon> {{ data.name }}</div>
|
|
|
|
|
|
|
+ <div style="display: flex;align-items: center;"><el-icon v-if="(data.id + '').indexOf('device') != -1">
|
|
|
|
|
+ <Cpu />
|
|
|
|
|
+ </el-icon> {{ data.name }}</div>
|
|
|
</template>
|
|
</template>
|
|
|
</LayTree>
|
|
</LayTree>
|
|
|
-
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
</el-col>
|
|
</el-col>
|
|
@@ -34,33 +30,23 @@
|
|
|
<el-card class="box-card">
|
|
<el-card class="box-card">
|
|
|
<div style="display: flex; flex-direction: row; justify-content: space-between">
|
|
<div style="display: flex; flex-direction: row; justify-content: space-between">
|
|
|
<div style="display: flex; flex-direction: row;">
|
|
<div style="display: flex; flex-direction: row;">
|
|
|
- <div
|
|
|
|
|
- style="
|
|
|
|
|
|
|
+ <div style="
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
flex-direction: row;
|
|
|
flex-wrap: nowrap;
|
|
flex-wrap: nowrap;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
- "
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ ">
|
|
|
<div style="font-size: 12px; width: 100px;">传感器编号:</div>
|
|
<div style="font-size: 12px; width: 100px;">传感器编号:</div>
|
|
|
- <el-input
|
|
|
|
|
- v-model="searchform.sn"
|
|
|
|
|
- placeholder="请输入"
|
|
|
|
|
- ></el-input>
|
|
|
|
|
|
|
+ <el-input v-model="searchform.sn" placeholder="请输入"></el-input>
|
|
|
</div>
|
|
</div>
|
|
|
- <div
|
|
|
|
|
- style="
|
|
|
|
|
|
|
+ <div style="
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
flex-direction: row;
|
|
|
flex-wrap: nowrap;
|
|
flex-wrap: nowrap;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
- "
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ ">
|
|
|
<div style="font-size: 12px; width: 80px;margin-right: 10px;text-align: right;">描述:</div>
|
|
<div style="font-size: 12px; width: 80px;margin-right: 10px;text-align: right;">描述:</div>
|
|
|
- <el-input
|
|
|
|
|
- v-model="searchform.desc"
|
|
|
|
|
- placeholder="请输入"
|
|
|
|
|
- ></el-input>
|
|
|
|
|
|
|
+ <el-input v-model="searchform.desc" placeholder="请输入"></el-input>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div>
|
|
<div>
|
|
@@ -75,24 +61,35 @@
|
|
|
<div class="card-header">
|
|
<div class="card-header">
|
|
|
<span>传感器台账</span>
|
|
<span>传感器台账</span>
|
|
|
<div>
|
|
<div>
|
|
|
|
|
+ <el-button type="primary" @click="inportSensor">导入</el-button>
|
|
|
<el-button type="primary" @click="goadd">添加</el-button>
|
|
<el-button type="primary" @click="goadd">添加</el-button>
|
|
|
<el-button type="danger" @click="deleteall">批量删除</el-button>
|
|
<el-button type="danger" @click="deleteall">批量删除</el-button>
|
|
|
- <el-button type="primary" plain @click="ziduanshow=true">显示字段</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" plain @click="ziduanshow = true">显示字段</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
- </div></template>
|
|
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<el-col :span="24" style="padding-left: 10px">
|
|
<el-col :span="24" style="padding-left: 10px">
|
|
|
<el-table :data="devicetabledata" ref="tableref" :border="true">
|
|
<el-table :data="devicetabledata" ref="tableref" :border="true">
|
|
|
<el-table-column type="selection" width="55" />
|
|
<el-table-column type="selection" width="55" />
|
|
|
- <el-table-column v-for="item in cloumdata.filter(i=>i.visible)" :prop="item.prop" :label="item.label" ></el-table-column>
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <el-table-column v-for="item in cloumdata.filter(i => i.visible)" :prop="item.prop"
|
|
|
|
|
+ :label="item.label"></el-table-column>
|
|
|
|
|
+ <el-table-column label="协议">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ {{ getProtocalTypeName(scope.row) }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作">
|
|
<el-table-column label="操作">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<div>
|
|
<div>
|
|
|
- <el-button link @click="lookdata(scope.row)" >
|
|
|
|
|
- <el-tooltip effect="dark" content="查看数据" >
|
|
|
|
|
- <el-icon><PieChart /></el-icon>
|
|
|
|
|
|
|
+ <el-button link @click="lookdata(scope.row)">
|
|
|
|
|
+ <el-tooltip effect="dark" content="查看数据">
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <PieChart />
|
|
|
|
|
+ </el-icon>
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
</el-button>
|
|
</el-button>
|
|
|
|
|
|
|
@@ -103,17 +100,18 @@
|
|
|
</el-icon>
|
|
</el-icon>
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- <el-button link @click="cdbd(scope.row)" >
|
|
|
|
|
- <el-tooltip effect="dark" content="测点绑定" >
|
|
|
|
|
- <el-icon><VideoPlay /></el-icon>
|
|
|
|
|
|
|
+ <el-button link @click="cdbd(scope.row)">
|
|
|
|
|
+ <el-tooltip effect="dark" content="测点绑定">
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <VideoPlay />
|
|
|
|
|
+ </el-icon>
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<el-popconfirm title="确定删除该传感器?" @confirm="deleterow(scope.row)">
|
|
<el-popconfirm title="确定删除该传感器?" @confirm="deleterow(scope.row)">
|
|
|
<template #reference>
|
|
<template #reference>
|
|
|
- <el-button link
|
|
|
|
|
- ><el-tooltip effect="dark" content="删除"
|
|
|
|
|
- ><el-icon><Delete /></el-icon></el-tooltip
|
|
|
|
|
- ></el-button>
|
|
|
|
|
|
|
+ <el-button link><el-tooltip effect="dark" content="删除"><el-icon>
|
|
|
|
|
+ <Delete />
|
|
|
|
|
+ </el-icon></el-tooltip></el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-popconfirm>
|
|
</el-popconfirm>
|
|
|
</div>
|
|
</div>
|
|
@@ -124,16 +122,9 @@
|
|
|
|
|
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="24" style="margin-top: 10px;">
|
|
<el-col :span="24" style="margin-top: 10px;">
|
|
|
- <el-pagination style="float: right;"
|
|
|
|
|
- small
|
|
|
|
|
- background
|
|
|
|
|
- layout="prev, pager, next"
|
|
|
|
|
- :total="pagedata.total"
|
|
|
|
|
- :page-size="pagedata.pageSize"
|
|
|
|
|
- :current-page="pagedata.pageNum"
|
|
|
|
|
- @current-change="onchangepage"
|
|
|
|
|
- class="mt-4"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <el-pagination style="float: right;" small background layout="prev, pager, next" :total="pagedata.total"
|
|
|
|
|
+ :page-size="pagedata.pageSize" :current-page="pagedata.pageNum" @current-change="onchangepage"
|
|
|
|
|
+ class="mt-4" />
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</el-card>
|
|
</el-card>
|
|
@@ -141,10 +132,7 @@
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
|
- <el-dialog
|
|
|
|
|
- title="测点配置"
|
|
|
|
|
- v-model="cdbdshow"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <el-dialog title="测点配置" v-model="cdbdshow">
|
|
|
|
|
|
|
|
<div style="display: flex; flex-direction: row; justify-content: space-between">
|
|
<div style="display: flex; flex-direction: row; justify-content: space-between">
|
|
|
<div style="display: flex; flex-direction: row;">
|
|
<div style="display: flex; flex-direction: row;">
|
|
@@ -165,7 +153,7 @@
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="名称" prop="label">
|
|
<el-table-column label="名称" prop="label">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <el-input v-model="scope.row.label"></el-input>
|
|
|
|
|
|
|
+ <el-input v-model="scope.row.label"></el-input>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="单位" prop="unitId">
|
|
<el-table-column label="单位" prop="unitId">
|
|
@@ -174,7 +162,8 @@
|
|
|
<template #reference>
|
|
<template #reference>
|
|
|
<el-button plain>{{ `${scope.row.unit}(${scope.row.unitType})` }}</el-button>
|
|
<el-button plain>{{ `${scope.row.unit}(${scope.row.unitType})` }}</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
- <el-table :data="allUnit" @cellClick="(row1)=>{scope.row.unit=row1.unitName;scope.row.unitType=row1.unitSymbol;}">
|
|
|
|
|
|
|
+ <el-table :data="allUnit"
|
|
|
|
|
+ @cellClick="(row1) => { scope.row.unit = row1.unitName; scope.row.unitType = row1.unitSymbol; }">
|
|
|
<el-table-column property="unitName" label="单位名称" />
|
|
<el-table-column property="unitName" label="单位名称" />
|
|
|
<el-table-column property="unitSymbol" label="单位符号" />
|
|
<el-table-column property="unitSymbol" label="单位符号" />
|
|
|
<el-table-column property="unitType" label="分类" />
|
|
<el-table-column property="unitType" label="分类" />
|
|
@@ -190,13 +179,14 @@
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="点表配置" prop="dataPointId">
|
|
<el-table-column label="点表配置" prop="dataPointId">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <span v-if="currentsensor.protocalType==3">无需配置</span>
|
|
|
|
|
- <div v-if="currentsensor.protocalType!=3">
|
|
|
|
|
|
|
+ <span v-if="currentsensor.protocalType == 3">无需配置</span>
|
|
|
|
|
+ <div v-if="currentsensor.protocalType != 3">
|
|
|
<el-popover placement="right" :width="400" trigger="click">
|
|
<el-popover placement="right" :width="400" trigger="click">
|
|
|
<template #reference>
|
|
<template #reference>
|
|
|
- <el-button plain>{{ `${ (currentdatapointlist.find(i=>(i.id+"")==scope.row.dataPointId) ?? {name:'失效'}).name}` }}</el-button>
|
|
|
|
|
|
|
+ <el-button plain>{{ `${(currentdatapointlist.find(i => (i.id + "") == scope.row.dataPointId) ??
|
|
|
|
|
+ { name: '失效' }).name}` }}</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
- <el-table :data="currentdatapointlist" @cellClick="(row1)=>{scope.row.dataPointId=row1.id;}">
|
|
|
|
|
|
|
+ <el-table :data="currentdatapointlist" @cellClick="(row1) => { scope.row.dataPointId = row1.id; }">
|
|
|
<el-table-column property="name" label="点位名称" />
|
|
<el-table-column property="name" label="点位名称" />
|
|
|
<el-table-column property="valueType" label="变量类型" />
|
|
<el-table-column property="valueType" label="变量类型" />
|
|
|
<el-table-column property="addr" label="地址" />
|
|
<el-table-column property="addr" label="地址" />
|
|
@@ -211,10 +201,9 @@
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<el-popconfirm title="确定删除该测点?" @confirm="deldatapoint(scope.$index)">
|
|
<el-popconfirm title="确定删除该测点?" @confirm="deldatapoint(scope.$index)">
|
|
|
<template #reference>
|
|
<template #reference>
|
|
|
- <el-button link
|
|
|
|
|
- ><el-tooltip effect="dark" content="删除"
|
|
|
|
|
- ><el-icon><Delete /></el-icon></el-tooltip
|
|
|
|
|
- ></el-button>
|
|
|
|
|
|
|
+ <el-button link><el-tooltip effect="dark" content="删除"><el-icon>
|
|
|
|
|
+ <Delete />
|
|
|
|
|
+ </el-icon></el-tooltip></el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-popconfirm>
|
|
</el-popconfirm>
|
|
|
</template>
|
|
</template>
|
|
@@ -224,65 +213,62 @@
|
|
|
|
|
|
|
|
<template #footer>
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
<div class="dialog-footer">
|
|
|
- <el-button @click="cdbdshow=false;"> 取消 </el-button>
|
|
|
|
|
|
|
+ <el-button @click="cdbdshow = false;"> 取消 </el-button>
|
|
|
<el-button type="primary" @click="dosave"> 保存 </el-button>
|
|
<el-button type="primary" @click="dosave"> 保存 </el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
- <el-dialog
|
|
|
|
|
- title="字段显示"
|
|
|
|
|
- v-model="ziduanshow"
|
|
|
|
|
- width="50%"
|
|
|
|
|
- @close="ziduanshow = false"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <el-dialog title="字段显示" v-model="ziduanshow" width="50%" @close="ziduanshow = false">
|
|
|
<div style="display: flex;flex-wrap: wrap;align-content: center;justify-content: center;align-items: center;">
|
|
<div style="display: flex;flex-wrap: wrap;align-content: center;justify-content: center;align-items: center;">
|
|
|
<el-checkbox v-for="item in cloumdata" v-model="item.visible" :label="item.label" size="large" />
|
|
<el-checkbox v-for="item in cloumdata" v-model="item.visible" :label="item.label" size="large" />
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
- <el-dialog
|
|
|
|
|
- title="测点数据查看"
|
|
|
|
|
- v-model="datashow"
|
|
|
|
|
- width="50%"
|
|
|
|
|
- @close="datashow = false"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <el-dialog title="测点数据查看" v-model="datashow" width="50%" @close="datashow = false">
|
|
|
<div>
|
|
<div>
|
|
|
-<!-- 显示测点实时数据-->
|
|
|
|
|
- <el-table @cellClick="doshowhistory" :data="JSON.parse(currentsensor.datapoints)" style="margin-top: 15px" height="250px">
|
|
|
|
|
|
|
+ <!-- 显示测点实时数据-->
|
|
|
|
|
+ <el-table @cellClick="doshowhistory" :data="JSON.parse(currentsensor.datapoints)" style="margin-top: 15px"
|
|
|
|
|
+ height="250px">
|
|
|
<el-table-column label="变量名" prop="name">
|
|
<el-table-column label="变量名" prop="name">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <span>{{scope.row.name}}</span>
|
|
|
|
|
|
|
+ <span>{{ scope.row.name }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="名称" prop="name">
|
|
<el-table-column label="名称" prop="name">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <span>{{scope.row.label}}</span>
|
|
|
|
|
|
|
+ <span>{{ scope.row.label }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="数值" prop="name">
|
|
<el-table-column label="数值" prop="name">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <span>{{ (useWSStore().getMessage()[currentsensor.id])?(useWSStore().getMessage()[currentsensor.id][scope.row.name]?.value):'-' }}</span>
|
|
|
|
|
|
|
+ <span>{{
|
|
|
|
|
+ (useWSStore().getMessage()[currentsensor.id]) ?
|
|
|
|
|
+ (useWSStore().getMessage()[currentsensor.id][scope.row.name]?.value) : '-'
|
|
|
|
|
+ }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="单位" prop="name">
|
|
<el-table-column label="单位" prop="name">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <span>{{scope.row.unitType}}</span>
|
|
|
|
|
|
|
+ <span>{{ scope.row.unitType }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="时间" prop="name">
|
|
<el-table-column label="时间" prop="name">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <span>{{ (useWSStore().getMessage()[currentsensor.id])?(useWSStore().getMessage()[currentsensor.id][scope.row.name]?.time):'-' }}</span>
|
|
|
|
|
|
|
+ <span>{{
|
|
|
|
|
+ (useWSStore().getMessage()[currentsensor.id]) ?
|
|
|
|
|
+ (useWSStore().getMessage()[currentsensor.id][scope.row.name]?.time) : '-'
|
|
|
|
|
+ }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
<div>
|
|
<div>
|
|
|
- <div style="margin-top: 10px" v-if="currentname!=''">变量 {{currentname}} 数值曲线</div>
|
|
|
|
|
-<!-- 显示历史数据 折线图-->
|
|
|
|
|
- <div ref="chartlinediv" style="height: 250px" v-loading="isloading" ></div>
|
|
|
|
|
|
|
+ <div style="margin-top: 10px" v-if="currentname != ''">变量 {{currentname}} 数值曲线</div>
|
|
|
|
|
+ <!-- 显示历史数据 折线图-->
|
|
|
|
|
+ <div ref="chartlinediv" style="height: 250px" v-loading="isloading"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
@@ -291,38 +277,38 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import {onMounted, ref, watch, watchEffect} from "vue";
|
|
|
|
|
-import {LayTree} from "@layui/layui-vue";
|
|
|
|
|
|
|
+import { onMounted, ref, watch, watchEffect } from "vue";
|
|
|
|
|
+import { LayTree } from "@layui/layui-vue";
|
|
|
import "@layui/layui-vue/lib/index.css";
|
|
import "@layui/layui-vue/lib/index.css";
|
|
|
-import {useRoute, useRouter} from "vue-router";
|
|
|
|
|
-import {listEquipmentOrganizational} from "@/api/data/equipmentOrganizational"
|
|
|
|
|
-import {listEquipmentSbook} from "@/api/data/equipmentSbook"
|
|
|
|
|
-import {listSensor,delSensor,addSensor,updateSensor,listSensorData,listSensorRecordData} from "@/api/data/sensor"
|
|
|
|
|
-import {listDatapoint} from "@/api/data/datapoint";
|
|
|
|
|
-import {listUnit} from "@/api/data/unit";
|
|
|
|
|
|
|
+import { useRoute, useRouter } from "vue-router";
|
|
|
|
|
+import { listEquipmentOrganizational } from "@/api/data/equipmentOrganizational"
|
|
|
|
|
+import { listEquipmentSbook } from "@/api/data/equipmentSbook"
|
|
|
|
|
+import { listSensor, delSensor, addSensor, updateSensor, listSensorData, listSensorRecordData } from "@/api/data/sensor"
|
|
|
|
|
+import { listDatapoint } from "@/api/data/datapoint";
|
|
|
|
|
+import { listUnit } from "@/api/data/unit";
|
|
|
import useWSStore from "@/store/modules/websocket"
|
|
import useWSStore from "@/store/modules/websocket"
|
|
|
import * as echarts from 'echarts';
|
|
import * as echarts from 'echarts';
|
|
|
|
|
|
|
|
|
|
|
|
|
-import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
|
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import moment from "moment";
|
|
import moment from "moment";
|
|
|
|
|
|
|
|
-const {proxy} = getCurrentInstance();
|
|
|
|
|
-const {protocal_type, sensor_type, sensor_status} = proxy.useDict("protocal_type", "sensor_type", "sensor_status");
|
|
|
|
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
|
|
+const { protocal_type, sensor_type, sensor_status } = proxy.useDict("protocal_type", "sensor_type", "sensor_status");
|
|
|
const pointdata = ref([]);
|
|
const pointdata = ref([]);
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
const ziduanshow = ref(false);
|
|
const ziduanshow = ref(false);
|
|
|
|
|
|
|
|
-const tableref = ref(null);
|
|
|
|
|
|
|
+const tableref = ref(null);
|
|
|
|
|
|
|
|
const cloumdata = ref([
|
|
const cloumdata = ref([
|
|
|
- {label: '传感器编号', prop: 'sn', visible: true},
|
|
|
|
|
- {label: '传感器名称', prop: 'name', visible: true},
|
|
|
|
|
- {label: '描述', prop: 'sensorDesc', visible: true},
|
|
|
|
|
- {label: '状态', prop: 'statusname', visible: true},
|
|
|
|
|
- {label: '类型', prop: 'sensorType', visible: true},
|
|
|
|
|
|
|
+ { label: '传感器编号', prop: 'sn', visible: true },
|
|
|
|
|
+ { label: '传感器名称', prop: 'name', visible: true },
|
|
|
|
|
+ { label: '描述', prop: 'sensorDesc', visible: true },
|
|
|
|
|
+ { label: '状态', prop: 'statusname', visible: true },
|
|
|
|
|
+ { label: '类型', prop: 'sensorType', visible: true },
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
@@ -331,23 +317,23 @@ const onchangepage = (page) => {
|
|
|
getalldata();
|
|
getalldata();
|
|
|
}
|
|
}
|
|
|
const pagedata = ref({
|
|
const pagedata = ref({
|
|
|
- total:0,
|
|
|
|
|
- pageSize:10,
|
|
|
|
|
- pageNum:1
|
|
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ pageSize: 10,
|
|
|
|
|
+ pageNum: 1
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const allUnit = ref([])
|
|
const allUnit = ref([])
|
|
|
|
|
|
|
|
-const deleterow =(item)=>{
|
|
|
|
|
- delSensor(item.id).then((res)=>{
|
|
|
|
|
|
|
+const deleterow = (item) => {
|
|
|
|
|
+ delSensor(item.id).then((res) => {
|
|
|
ElMessage.success("删除成功");
|
|
ElMessage.success("删除成功");
|
|
|
getalldata();
|
|
getalldata();
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const deleteall = ()=>{
|
|
|
|
|
- let selected = tableref.value.getSelectionRows();
|
|
|
|
|
- if(selected.length==0) {
|
|
|
|
|
|
|
+const deleteall = () => {
|
|
|
|
|
+ let selected = tableref.value.getSelectionRows();
|
|
|
|
|
+ if (selected.length == 0) {
|
|
|
ElMessage.warning("请选择要删除的行");
|
|
ElMessage.warning("请选择要删除的行");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -374,13 +360,13 @@ const deleteall = ()=>{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-const initdata = ()=>{
|
|
|
|
|
|
|
+const initdata = () => {
|
|
|
searchform.value.sn = '';
|
|
searchform.value.sn = '';
|
|
|
searchform.value.desc = '';
|
|
searchform.value.desc = '';
|
|
|
pagedata.value = {
|
|
pagedata.value = {
|
|
|
- total:0,
|
|
|
|
|
- pageSize:10,
|
|
|
|
|
- pageNum:1
|
|
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ pageSize: 10,
|
|
|
|
|
+ pageNum: 1
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -388,11 +374,19 @@ const goadd = () => {
|
|
|
router.push("/device/sensordash/add?type=0")
|
|
router.push("/device/sensordash/add?type=0")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const goedit = (item)=>{
|
|
|
|
|
- localStorage.setItem("currentsensor",JSON.stringify(item))
|
|
|
|
|
|
|
+const goedit = (item) => {
|
|
|
|
|
+ localStorage.setItem("currentsensor", JSON.stringify(item))
|
|
|
router.push("/device/sensordash/add?type=1")
|
|
router.push("/device/sensordash/add?type=1")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const getProtocalTypeName = (item) => {
|
|
|
|
|
+ for (var index in protocal_type.value) {
|
|
|
|
|
+ if (protocal_type.value[index].value == item.protocalType) {
|
|
|
|
|
+ return protocal_type.value[index].label
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
const currentnode = ref(null);
|
|
const currentnode = ref(null);
|
|
@@ -413,22 +407,23 @@ const getalldata = () => {
|
|
|
let deviceids = getdeviceid(currentnode.value).split(",").filter(i => i != "").join(",");
|
|
let deviceids = getdeviceid(currentnode.value).split(",").filter(i => i != "").join(",");
|
|
|
if (deviceids != "") {
|
|
if (deviceids != "") {
|
|
|
deviceids = deviceids.replaceAll("device_", "")
|
|
deviceids = deviceids.replaceAll("device_", "")
|
|
|
- listSensor({...pagedata.value, params: {deviceids: deviceids,...searchform.value}}).then(res => {
|
|
|
|
|
- const {rows,total,page,size} = res;
|
|
|
|
|
- pagedata.value = {total:total,pageNum:page, pageSize:10};
|
|
|
|
|
|
|
+ listSensor({ ...pagedata.value, params: { deviceids: deviceids, ...searchform.value } }).then(res => {
|
|
|
|
|
+ const { rows, total, page, size } = res;
|
|
|
|
|
+ pagedata.value = { total: total, pageNum: page, pageSize: 10 };
|
|
|
|
|
+ console.log(rows);
|
|
|
devicetabledata.value = rows.map(item => {
|
|
devicetabledata.value = rows.map(item => {
|
|
|
- try{
|
|
|
|
|
|
|
+ try {
|
|
|
var statusname = sensor_status.value.find(i => i.value == item.status).label;
|
|
var statusname = sensor_status.value.find(i => i.value == item.status).label;
|
|
|
item["statusname"] = statusname;
|
|
item["statusname"] = statusname;
|
|
|
- }catch (e) {
|
|
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
return item;
|
|
return item;
|
|
|
});
|
|
});
|
|
|
})
|
|
})
|
|
|
- }else{
|
|
|
|
|
- pagedata.value = {total:0,pageNum:1, pageSize:10};
|
|
|
|
|
- devicetabledata.value=[];
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ pagedata.value = { total: 0, pageNum: 1, pageSize: 10 };
|
|
|
|
|
+ devicetabledata.value = [];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -442,10 +437,10 @@ const data = ref([]);
|
|
|
|
|
|
|
|
|
|
|
|
|
const getTreedata = () => {
|
|
const getTreedata = () => {
|
|
|
- listEquipmentOrganizational({pageSize: 10000}).then(res => {
|
|
|
|
|
- const {rows, total, page, size} = res;
|
|
|
|
|
|
|
+ listEquipmentOrganizational({ pageSize: 10000 }).then(res => {
|
|
|
|
|
+ const { rows, total, page, size } = res;
|
|
|
//获取设备数据
|
|
//获取设备数据
|
|
|
- listEquipmentSbook({page: 1, pageSize: 100000}).then(res1 => {
|
|
|
|
|
|
|
+ listEquipmentSbook({ page: 1, pageSize: 100000 }).then(res1 => {
|
|
|
res1.rows.forEach(item => {
|
|
res1.rows.forEach(item => {
|
|
|
item["parentId"] = item.equipmentTreeId;
|
|
item["parentId"] = item.equipmentTreeId;
|
|
|
item["id"] = "device_" + item.id;
|
|
item["id"] = "device_" + item.id;
|
|
@@ -469,29 +464,29 @@ const cdbdshow = ref(false);
|
|
|
const currentsensor = ref(null);
|
|
const currentsensor = ref(null);
|
|
|
const cdbd = (item) => {
|
|
const cdbd = (item) => {
|
|
|
cdbdshow.value = true;
|
|
cdbdshow.value = true;
|
|
|
- listDatapoint({sensorId:item.id}).then(res=>{
|
|
|
|
|
- const {rows,total,page,size} = res;
|
|
|
|
|
|
|
+ listDatapoint({ sensorId: item.id }).then(res => {
|
|
|
|
|
+ const { rows, total, page, size } = res;
|
|
|
currentdatapointlist.value = rows;
|
|
currentdatapointlist.value = rows;
|
|
|
currentsensor.value = item;
|
|
currentsensor.value = item;
|
|
|
- try{
|
|
|
|
|
|
|
+ try {
|
|
|
pointdata.value = JSON.parse(item.datapoints);
|
|
pointdata.value = JSON.parse(item.datapoints);
|
|
|
- }catch (e){}
|
|
|
|
|
|
|
+ } catch (e) { }
|
|
|
|
|
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
const realtimedata = ref({})
|
|
const realtimedata = ref({})
|
|
|
const datashow = ref(false);
|
|
const datashow = ref(false);
|
|
|
-const lookdata = (item)=>{
|
|
|
|
|
|
|
+const lookdata = (item) => {
|
|
|
//弹窗
|
|
//弹窗
|
|
|
datashow.value = true;
|
|
datashow.value = true;
|
|
|
currentsensor.value = item;
|
|
currentsensor.value = item;
|
|
|
- listSensorData({page:1,pageSize:10000,id:item.id}).then(res=>{
|
|
|
|
|
- const {rows,total,page,size} = res;
|
|
|
|
|
- if(rows.length>0){
|
|
|
|
|
- if(rows[0].recordData){
|
|
|
|
|
|
|
+ listSensorData({ page: 1, pageSize: 10000, id: item.id }).then(res => {
|
|
|
|
|
+ const { rows, total, page, size } = res;
|
|
|
|
|
+ if (rows.length > 0) {
|
|
|
|
|
+ if (rows[0].recordData) {
|
|
|
let data = JSON.parse(rows[0].recordData);
|
|
let data = JSON.parse(rows[0].recordData);
|
|
|
- useWSStore().setMessagetype1(rows[0].tblSensor.id,data);
|
|
|
|
|
|
|
+ useWSStore().setMessagetype1(rows[0].tblSensor.id, data);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -501,31 +496,31 @@ const lookdata = (item)=>{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-const deldatapoint = (index)=>{
|
|
|
|
|
- pointdata.value.splice(index,1)
|
|
|
|
|
|
|
+const deldatapoint = (index) => {
|
|
|
|
|
+ pointdata.value.splice(index, 1)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const addrow = ()=>{
|
|
|
|
|
- if(!pointdata.value){pointdata.value = [];}
|
|
|
|
|
|
|
+const addrow = () => {
|
|
|
|
|
+ if (!pointdata.value) { pointdata.value = []; }
|
|
|
pointdata.value.push({
|
|
pointdata.value.push({
|
|
|
name: "",
|
|
name: "",
|
|
|
unit: "",
|
|
unit: "",
|
|
|
unitType: "0",
|
|
unitType: "0",
|
|
|
desc: "",
|
|
desc: "",
|
|
|
label: "",
|
|
label: "",
|
|
|
- dataPointId:null
|
|
|
|
|
|
|
+ dataPointId: null
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
-onMounted(()=>{
|
|
|
|
|
- listUnit({}).then(res=>{
|
|
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ listUnit({}).then(res => {
|
|
|
allUnit.value = res.data;
|
|
allUnit.value = res.data;
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const dosave = ()=>{
|
|
|
|
|
- let data = JSON.stringify(pointdata.value.filter(i=>i.name!==""));
|
|
|
|
|
|
|
+const dosave = () => {
|
|
|
|
|
+ let data = JSON.stringify(pointdata.value.filter(i => i.name !== ""));
|
|
|
currentsensor.value.datapoints = data;
|
|
currentsensor.value.datapoints = data;
|
|
|
- updateSensor(currentsensor.value).then(res=>{
|
|
|
|
|
|
|
+ updateSensor(currentsensor.value).then(res => {
|
|
|
ElMessage.success("保存成功");
|
|
ElMessage.success("保存成功");
|
|
|
cdbdshow.value = false;
|
|
cdbdshow.value = false;
|
|
|
getalldata();
|
|
getalldata();
|
|
@@ -536,23 +531,23 @@ const historytabledata = ref([]);
|
|
|
const chartlinediv = ref(null)
|
|
const chartlinediv = ref(null)
|
|
|
const currentname = ref("")
|
|
const currentname = ref("")
|
|
|
const isloading = ref(false);
|
|
const isloading = ref(false);
|
|
|
-watchEffect(()=>{
|
|
|
|
|
- if(currentsensor.value && useWSStore().getMessage()[currentsensor.value.id] && useWSStore().getMessage()[currentsensor.value.id][currentname.value] ){
|
|
|
|
|
|
|
+watchEffect(() => {
|
|
|
|
|
+ if (currentsensor.value && useWSStore().getMessage()[currentsensor.value.id] && useWSStore().getMessage()[currentsensor.value.id][currentname.value]) {
|
|
|
let data = useWSStore().getMessage()[currentsensor.value.id][currentname.value];
|
|
let data = useWSStore().getMessage()[currentsensor.value.id][currentname.value];
|
|
|
var isadd = false;
|
|
var isadd = false;
|
|
|
- historytabledata.value.forEach(i=>{
|
|
|
|
|
- if(moment(data.time).utc()-moment(i[0]).utc()>10){
|
|
|
|
|
|
|
+ historytabledata.value.forEach(i => {
|
|
|
|
|
+ if (moment(data.time).utc() - moment(i[0]).utc() > 10) {
|
|
|
isadd = true;
|
|
isadd = true;
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- if(isadd){
|
|
|
|
|
- historytabledata.value.push([moment(data.time).toDate(),data.value]);
|
|
|
|
|
|
|
+ if (isadd) {
|
|
|
|
|
+ historytabledata.value.push([moment(data.time).toDate(), data.value]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- if(historytabledata.value.length>0){
|
|
|
|
|
|
|
+ if (historytabledata.value.length > 0) {
|
|
|
const usedmemoryInstance = echarts.init(chartlinediv.value, "macarons");
|
|
const usedmemoryInstance = echarts.init(chartlinediv.value, "macarons");
|
|
|
- usedmemoryInstance.setOption( {
|
|
|
|
|
|
|
+ usedmemoryInstance.setOption({
|
|
|
tooltip: {
|
|
tooltip: {
|
|
|
trigger: 'axis',
|
|
trigger: 'axis',
|
|
|
position: function (pt) {
|
|
position: function (pt) {
|
|
@@ -579,18 +574,18 @@ watchEffect(()=>{
|
|
|
],
|
|
],
|
|
|
series: [
|
|
series: [
|
|
|
{
|
|
{
|
|
|
- name:currentname.value,
|
|
|
|
|
|
|
+ name: currentname.value,
|
|
|
data: historytabledata.value,
|
|
data: historytabledata.value,
|
|
|
type: 'line',
|
|
type: 'line',
|
|
|
smooth: true
|
|
smooth: true
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
- window.addEventListener("resize",()=>{
|
|
|
|
|
|
|
+ window.addEventListener("resize", () => {
|
|
|
usedmemoryInstance.resize()
|
|
usedmemoryInstance.resize()
|
|
|
});
|
|
});
|
|
|
- }else{
|
|
|
|
|
- if(chartlinediv.value){
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (chartlinediv.value) {
|
|
|
chartlinediv.value.innerHTML = "请选择监测点";
|
|
chartlinediv.value.innerHTML = "请选择监测点";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -598,19 +593,23 @@ watchEffect(()=>{
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
})
|
|
|
-const doshowhistory = (row)=>{
|
|
|
|
|
|
|
+const doshowhistory = (row) => {
|
|
|
isloading.value = true;
|
|
isloading.value = true;
|
|
|
currentname.value = row.name;
|
|
currentname.value = row.name;
|
|
|
//获取历史数据
|
|
//获取历史数据
|
|
|
- listSensorRecordData({sensorId:currentsensor.value.id,pointName:row.name,pageNum:1,pageSize:100,orderByColumn:"createTime",isAsc:"desc",params:{name:row.name}}).then(res=>{
|
|
|
|
|
- const {rows,total,page,size} = res;
|
|
|
|
|
|
|
+ listSensorRecordData({ sensorId: currentsensor.value.id, pointName: row.name, pageNum: 1, pageSize: 100, orderByColumn: "createTime", isAsc: "desc", params: { name: row.name } }).then(res => {
|
|
|
|
|
+ const { rows, total, page, size } = res;
|
|
|
isloading.value = false;
|
|
isloading.value = false;
|
|
|
- historytabledata.value = rows.map(i=>{
|
|
|
|
|
- return [moment(i.createTime).toDate(),i.pointValue]
|
|
|
|
|
|
|
+ historytabledata.value = rows.map(i => {
|
|
|
|
|
+ return [moment(i.createTime).toDate(), i.pointValue]
|
|
|
});
|
|
});
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const inportSensor = () =>{
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
@@ -629,6 +628,7 @@ const doshowhistory = (row)=>{
|
|
|
|
|
|
|
|
|
|
|
|
|
.tree {
|
|
.tree {
|
|
|
|
|
+
|
|
|
*,
|
|
*,
|
|
|
*:before,
|
|
*:before,
|
|
|
*:after {
|
|
*:after {
|