|
|
@@ -1,62 +1,121 @@
|
|
|
<!-- 设备状态 -->
|
|
|
<template>
|
|
|
- <div class="equipInfo">
|
|
|
- <div class="equipImg">
|
|
|
- <img v-if="equipType==2" src="../../../../../static/images/equipImg2.png" alt="">
|
|
|
- <img v-if="equipType==3" src="../../../../../static/images/equipImg3.png" alt="">
|
|
|
- <img v-if="equipType==4" src="../../../../../static/images/equipImg4.jpg" alt="">
|
|
|
- <img v-if="equipType==5" src="../../../../../static/images/equipImg5.png" alt="">
|
|
|
- <img v-if="equipType==7" src="../../../../../static/images/equipImg7.png" alt="">
|
|
|
- <img v-if="equipType==8" src="../../../../../static/images/equipImg8.jpg" alt="">
|
|
|
- <p>设备类型:{{equipType|equipType}}</p>
|
|
|
- </div>
|
|
|
- <div class="equipMsg">
|
|
|
- <div class="title">
|
|
|
- <span></span>
|
|
|
- <span>基础信息</span>
|
|
|
+ <div class="">
|
|
|
+ <div class="equipInfo">
|
|
|
+ <div class="equipImg">
|
|
|
+ <img v-if="equipType==2" src="../../../../../static/images/equipImg2.png" alt="">
|
|
|
+ <img v-if="equipType==3" src="../../../../../static/images/equipImg3.png" alt="">
|
|
|
+ <img v-if="equipType==4" src="../../../../../static/images/equipImg4.jpg" alt="">
|
|
|
+ <img v-if="equipType==5" src="../../../../../static/images/equipImg5.png" alt="">
|
|
|
+ <img v-if="equipType==7" src="../../../../../static/images/equipImg7.png" alt="">
|
|
|
+ <img v-if="equipType==8" src="../../../../../static/images/equipImg8.jpg" alt="">
|
|
|
+ <p>设备类型:{{equipType|equipType}}</p>
|
|
|
</div>
|
|
|
- <div>设备ID:{{equipId}}</div>
|
|
|
- <div>设备名称:{{info.device_name || '--'}}</div>
|
|
|
- <div>在线状态:<span :class="[info.is_online?'online':'offline']">{{info.is_online?'在线':'离线'}}</span></div>
|
|
|
- <template v-if="equipType==2">
|
|
|
- <div>设备版本:{{info.dtype || '--'}}</div>
|
|
|
- </template>
|
|
|
- <template v-if="equipType==3">
|
|
|
- <div>设备版本:{{info.dtype || '--'}}</div>
|
|
|
- </template>
|
|
|
- <template v-if="equipType==4">
|
|
|
- <div>添加诱芯:
|
|
|
- <span v-if="!lureShow">{{lure}}</span>
|
|
|
- <span ref="upDateLure" v-if="lureShow">
|
|
|
- <input type="text" v-model="editlure" placeholder="请输入监测害虫名称">
|
|
|
- <i class="el-icon-check controlIcon" @click="submitYx()"></i>
|
|
|
- <i class="el-icon-close controlIcon" @click="lureShow=false;editlure=lure"></i>
|
|
|
- </span>
|
|
|
- <i v-else class="el-icon-edit controlIcon" @click="changeLure()"></i>
|
|
|
+ <div class="equipMsg">
|
|
|
+ <div class="title">
|
|
|
+ <span></span>
|
|
|
+ <span>基础信息</span>
|
|
|
</div>
|
|
|
- </template>
|
|
|
- <template v-if="equipType==5">
|
|
|
- <div>电压:{{info.device_status || '--'}}</div>
|
|
|
- <div>信号强度:{{info.device_status || '--'}}</div>
|
|
|
- </template>
|
|
|
- <template v-if="equipType==7">
|
|
|
- <div>载玻片、培养液更换:
|
|
|
- <span v-if="!lureShow">{{lure}}</span>
|
|
|
- <span ref="upDateLure" v-if="lureShow">
|
|
|
- <input type="text" v-model="editlure" placeholder="请输入监测害虫名称">
|
|
|
- <i class="el-icon-edit controlIcon" @click="submitYx()"></i>
|
|
|
- <i class="el-icon-edit controlIcon" @click="lureShow=false;editlure=lure"></i>
|
|
|
- </span>
|
|
|
- <i v-else class="el-icon-edit controlIcon" @click="setTime()"></i>
|
|
|
+ <div>设备ID:{{equipId}}</div>
|
|
|
+ <div>设备名称:{{info.device_name || '--'}}</div>
|
|
|
+ <div>在线状态:<span :class="[info.is_online?'online':'offline']">{{info.is_online?'在线':'离线'}}</span></div>
|
|
|
+ <template v-if="equipType==2">
|
|
|
+ <div>设备版本:{{info.dtype || '--'}}</div>
|
|
|
+ </template>
|
|
|
+ <template v-if="equipType==3">
|
|
|
+ <div>设备版本:{{info.dtype || '--'}}</div>
|
|
|
+ </template>
|
|
|
+ <template v-if="equipType==4">
|
|
|
+ <div>添加诱芯:
|
|
|
+ <span v-if="!lureShow">{{lure}}</span>
|
|
|
+ <span ref="upDateLure" v-if="lureShow">
|
|
|
+ <input type="text" v-model="editlure" placeholder="请输入监测害虫名称">
|
|
|
+ <i class="el-icon-check controlIcon" @click="submitYx()"></i>
|
|
|
+ <i class="el-icon-close controlIcon" @click="lureShow=false;editlure=lure"></i>
|
|
|
+ </span>
|
|
|
+ <i v-else class="el-icon-edit controlIcon" @click="changeLure()"></i>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-if="equipType==5">
|
|
|
+ <div>电压:{{info.device_status || '--'}}</div>
|
|
|
+ <div>信号强度:{{info.device_status || '--'}}</div>
|
|
|
+ </template>
|
|
|
+ <template v-if="equipType==7">
|
|
|
+ <div>载玻片、培养液更换:
|
|
|
+ <span v-if="!lureShow">{{lure}}</span>
|
|
|
+ <span ref="upDateLure" v-if="lureShow">
|
|
|
+ <input type="text" v-model="editlure" placeholder="请输入监测害虫名称">
|
|
|
+ <i class="el-icon-edit controlIcon" @click="submitYx()"></i>
|
|
|
+ <i class="el-icon-edit controlIcon" @click="lureShow=false;editlure=lure"></i>
|
|
|
+ </span>
|
|
|
+ <i v-else class="el-icon-edit controlIcon" @click="setTime()"></i>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <div>最新上报时间:{{info.addtime*1000|formatTime}}
|
|
|
+ <span><i class="el-icon-refresh controlIcon" @click="refreshDate()" v-if="info.d_id"></i></span>
|
|
|
</div>
|
|
|
- </template>
|
|
|
- <div>最新上报时间:{{info.addtime*1000|formatTime}}
|
|
|
- <span><i class="el-icon-refresh controlIcon" @click="refreshDate()" v-if="info.d_id"></i></span>
|
|
|
+ <div v-if="equipType!=5">设备定位:{{info.address || '--'}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="equipState">
|
|
|
+ <slot name="equipStateInner"></slot>
|
|
|
</div>
|
|
|
- <div v-if="equipType!=5">设备定位:{{info.address || '--'}}</div>
|
|
|
</div>
|
|
|
- <div class="equipState">
|
|
|
- <slot name="equipStateInner"></slot>
|
|
|
+ <div class="tab-pane" v-if="equipType !== 5">
|
|
|
+ <!-- {{equipId}}-
|
|
|
+ {{equipType}} -->
|
|
|
+ <div class="list" v-if="equipDataState">
|
|
|
+ <div class="elementItem" v-for="(item,index) in showState[equipType]" :key="index">
|
|
|
+ <!-- {{equipState_dict[item]}} -->
|
|
|
+ <div>{{equipState_dict[item].name}}</div>
|
|
|
+ <template v-if="item=='tt'">
|
|
|
+ <template v-if="equipData.ts == 1">
|
|
|
+ <div class="elementValue" >{{equipData['st']}}-{{equipData['et']}}{{equipState_dict['et'].unit}}</div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="elementValue" v-if="equipState_dict[item].value">{{equipState_dict[item].value[equipData[item]]}}</div>
|
|
|
+ <div class="elementValue" v-else >{{equipData[item]}}{{equipState_dict[item].unit}}</div>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <template v-if="item=='addtime'">
|
|
|
+ <div class="elementValue" >{{equipData[item]*1000|formatTime}}</div>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item=='at'">
|
|
|
+ <template v-if="equipData.new_tem">
|
|
|
+ <div class="elementValue" >{{equipData.new_tem}}{{equipState_dict[item].unit}}</div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="elementValue" >{{equipData[item]}}{{equipState_dict[item].unit}}</div>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item=='ah'">
|
|
|
+ <template v-if="equipData.new_hum">
|
|
|
+ <div class="elementValue" >{{equipData.new_hum}}{{equipState_dict[item].unit}}</div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="elementValue" >{{equipData[item]}}{{equipState_dict[item].unit}}</div>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="elementValue" v-if="equipState_dict[item].value">{{equipState_dict[item].value[equipData[item]]}}</div>
|
|
|
+ <div class="elementValue" v-else >{{equipData[item]}}{{equipState_dict[item].unit}}</div>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else class="empty">
|
|
|
+ <div>暂无数据</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="qxztab-pane" v-if="equipType == 5">
|
|
|
+ <div class="list">
|
|
|
+ <div class="elementItem" v-for="(item,index) in reaTimeStatusList" :key="index">
|
|
|
+ <div>{{item.e}}{{item.name}}</div>
|
|
|
+ <!-- <div>{{item.e}}{{item.name}}<i class="el-icon-refresh edit" @click="editName(item,index)"></i></div> -->
|
|
|
+ <div class="elementValue">{{item.num}}{{item.unit}}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -64,6 +123,7 @@
|
|
|
<script>
|
|
|
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
|
//例如:import 《组件名称》 from '《组件路径》';
|
|
|
+import equipState_dict from './equipState_dict.json'
|
|
|
export default {
|
|
|
//import引入的组件需要注入到对象中才能使用
|
|
|
components: {},
|
|
|
@@ -76,7 +136,19 @@ export default {
|
|
|
lure:"",
|
|
|
lureShow:false,
|
|
|
cultivate:"",
|
|
|
- glass:""
|
|
|
+ glass:"",
|
|
|
+ // 实施状态
|
|
|
+ equipState_dict,
|
|
|
+ showState: {
|
|
|
+ "2": ["ds","ws","rps","tps","dps","tt","ct","at","ah","cv","bv","csq","dver"],
|
|
|
+ "3": ["ds","ws","tt","hs","at","ah","upds","dnds","vbat","rps","tps","lps","csq","dver"],
|
|
|
+ "4": ["proj","ds","ws","at","ah","cv","bv","cs","bs","infr_ct","csq","dver"],
|
|
|
+ "7": ["at","ah","set_temp","pre_temp","bs","usb_sta","vbat","csq","dver"],
|
|
|
+ },
|
|
|
+ equipData:{},
|
|
|
+ equipDataState:true,
|
|
|
+ infos:'',
|
|
|
+ reaTimeStatusList:[],
|
|
|
};
|
|
|
},
|
|
|
//监听属性 类似于data概念
|
|
|
@@ -217,14 +289,80 @@ export default {
|
|
|
}).then((res) => {
|
|
|
if (res.data.message == "") {
|
|
|
setTimeout(()=>{
|
|
|
- this.getEquipInfo(this.equipId,this.equipType);
|
|
|
- var val = new Date().getTime();
|
|
|
- this.$emit('getNowState');
|
|
|
+ this.equipStateSet(this.equipId, this.equipType);
|
|
|
},3000)
|
|
|
} else {
|
|
|
this.$message.err("刷新失败");
|
|
|
}
|
|
|
});
|
|
|
+ },
|
|
|
+ // 设备状态弹框
|
|
|
+ equipStateSet(id, device_status) {
|
|
|
+ if(device_status == 5){
|
|
|
+ this.$axios({
|
|
|
+ method: "POST",
|
|
|
+ url: "/api/api_gateway?method=weather.weather.qxz_status",
|
|
|
+ data: this.qs.stringify({
|
|
|
+ device_type_id: this.equipType,
|
|
|
+ page_size: 1,
|
|
|
+ device_id: id,
|
|
|
+ page: 1
|
|
|
+ })
|
|
|
+ }).then(res => {
|
|
|
+ if (res.data.message == "") {
|
|
|
+ console.log(res.data.data.counts)
|
|
|
+ let arr = new Array();
|
|
|
+ let conf = res.data.data.conf;
|
|
|
+ let dat = res.data.data.dat;
|
|
|
+ for (let i1 in conf) {
|
|
|
+ if (conf[i1]) {
|
|
|
+ let arr2 = conf[i1].split("#");
|
|
|
+ let obj = {};
|
|
|
+ obj.e = "e" + i1.slice(1);
|
|
|
+ obj.name = arr2[0];
|
|
|
+ obj.unit = arr2[1];
|
|
|
+ for (let i2 in dat) {
|
|
|
+ if (i1 == i2) {
|
|
|
+ let arr3 = dat[i2].split("#");
|
|
|
+ obj.num = arr3[0] == "-99.99" ? "N/A" : arr3[0];
|
|
|
+ obj.icon = arr3[1];
|
|
|
+ arr.push(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ arr = arr.sort((a, b) => {
|
|
|
+ return a.e.slice(-1) - b.e.slice(-1);
|
|
|
+ });
|
|
|
+ this.reaTimeStatusList = arr;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.$axios({
|
|
|
+ method: "POST",
|
|
|
+ url: "/api/api_gateway?method=forecast.worm_lamp.device_history_data",
|
|
|
+ data: this.qs.stringify({
|
|
|
+ device_type_id: this.equipType,
|
|
|
+ page_size: 1,
|
|
|
+ device_id: id,
|
|
|
+ page: 1
|
|
|
+ })
|
|
|
+ }).then(res => {
|
|
|
+ if (res.data.message == "") {
|
|
|
+ if(res.data.data.counts == 0){
|
|
|
+ this.equipDataState=false;
|
|
|
+ this.equipData = {}
|
|
|
+ }else{
|
|
|
+ this.equipDataState = true;
|
|
|
+ this.equipData = res.data.data.data[0].d_h_t
|
|
|
+ console.log(this.equipData);
|
|
|
+ console.log('this.equipData');
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
@@ -232,6 +370,7 @@ export default {
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {
|
|
|
this.getEquipInfo(this.equipId,this.equipType)
|
|
|
+ this.equipStateSet(this.equipId, this.equipType);
|
|
|
},
|
|
|
beforeCreate() {}, //生命周期 - 创建之前
|
|
|
beforeMount() {}, //生命周期 - 挂载之前
|
|
|
@@ -248,6 +387,7 @@ export default {
|
|
|
display: flex;
|
|
|
justify-content: space-around;
|
|
|
align-content: center;
|
|
|
+ margin-bottom: 20px;
|
|
|
.equipImg{
|
|
|
position: relative;
|
|
|
flex: 1;
|
|
|
@@ -305,4 +445,95 @@ export default {
|
|
|
color: #04d5e8;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
+// 实时状态
|
|
|
+.tab-pane{
|
|
|
+ background: rgba(56,67,86,.7);
|
|
|
+ .list {
|
|
|
+ display: flex;
|
|
|
+ justify-content: left;
|
|
|
+ flex-direction: row;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ padding: 10px 7px 5px 7px;
|
|
|
+ .elementItem{
|
|
|
+ width: 33.3333%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ line-height: 36px;
|
|
|
+ border-left: 5px solid rgba(56,67,86,.7);
|
|
|
+ border-right: 5px solid rgba(56,67,86,.7);
|
|
|
+ margin-bottom: 10px;
|
|
|
+ padding: 0 9px;
|
|
|
+ font-size: .1625rem;
|
|
|
+ .elementValue{
|
|
|
+ color: #04d5e8;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .elementItem:nth-child(6n+1),
|
|
|
+ .elementItem:nth-child(6n+2),
|
|
|
+ .elementItem:nth-child(6n+3){
|
|
|
+ background: #0c142c;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elementItem:nth-child(6n+4),
|
|
|
+ .elementItem:nth-child(6n+5),
|
|
|
+ .elementItem:nth-child(6n+6){
|
|
|
+ background: #0c142c;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .empty{
|
|
|
+ line-height: 100px;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #0195ff;
|
|
|
+ }
|
|
|
+}
|
|
|
+// qxz实时状态
|
|
|
+.qxztab-pane{
|
|
|
+ background: rgba(56,67,86,.7);
|
|
|
+ .list {
|
|
|
+ display: flex;
|
|
|
+ justify-content: left;
|
|
|
+ flex-direction: row;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ padding: 10px 7px 5px 7px;
|
|
|
+ .elementItem{
|
|
|
+ width: 33.3333%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ line-height: 36px;
|
|
|
+ border-left: 5px solid rgba(56,67,86,.7);
|
|
|
+ border-right: 5px solid rgba(56,67,86,.7);
|
|
|
+ margin-bottom: 10px;
|
|
|
+ padding: 0 9px;
|
|
|
+ font-size: 13px;
|
|
|
+ .elementValue{
|
|
|
+ color: #04d5e8;
|
|
|
+ }
|
|
|
+ .edit{
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .elementItem:nth-child(6n+1),
|
|
|
+ .elementItem:nth-child(6n+2),
|
|
|
+ .elementItem:nth-child(6n+3){
|
|
|
+ background: #0c142c;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elementItem:nth-child(6n+4),
|
|
|
+ .elementItem:nth-child(6n+5),
|
|
|
+ .elementItem:nth-child(6n+6){
|
|
|
+ background: #0c142c;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .empty{
|
|
|
+ line-height: 100px;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #0195ff;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|