|
|
@@ -43,6 +43,19 @@
|
|
|
<i class="iconfont icon-shijian"></i>
|
|
|
最新上报时间 : {{item.upl_time}}
|
|
|
</p>
|
|
|
+ <p>
|
|
|
+ <i class="iconfont icon-chouchongbug"></i>
|
|
|
+ 监测害虫名称 : {{item.pest_name||'未填写'}}
|
|
|
+ <span @click="setName(item.imei,item.pest_name)" class="el-icon-edit"></span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ <i class="iconfont icon-shijian"></i>
|
|
|
+ 诱芯更换时间 : {{item.core||'未填写'}}
|
|
|
+ <span @click="setTime(item.imei,item.core)" class="el-icon-edit"></span>
|
|
|
+ <span style="color:red" v-if="timeCalc(item.core) == 'null'">请及时设置</span>
|
|
|
+ <span style="color:red" v-if="timeCalc(item.core) < 10 && timeCalc(item.core) > 0">剩余{{timeCalc(item.core)}}天,请更换</span>
|
|
|
+ <span style="color:red" v-if="timeCalc(item.core) < 1">已过期请更换</span>
|
|
|
+ </p>
|
|
|
<p class="btns">
|
|
|
<i class="iconfont icon-yemiancaozuo"></i>
|
|
|
<el-button
|
|
|
@@ -87,6 +100,16 @@
|
|
|
</p>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column prop="upl_time" label="监测害虫名称">
|
|
|
+ <template slot-scope="scope">{{
|
|
|
+ scope.row.pest_name || '未填写'
|
|
|
+ }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="upl_time" label="诱芯更换时间">
|
|
|
+ <template slot-scope="scope">{{
|
|
|
+ scope.row.core || '未填写'
|
|
|
+ }}</template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="upl_time" label="最新上报时间">
|
|
|
<template slot-scope="scope">{{
|
|
|
scope.row.upl_time
|
|
|
@@ -184,6 +207,30 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <!-- 设置诱芯更换时间配置弹框 -->
|
|
|
+ <el-dialog title="设置监测害虫名称" :visible.sync="setNameDialogVisible" width="420px">
|
|
|
+ <el-form ref="form" :model="xyform" label-width="130px">
|
|
|
+ <el-form-item label="监测害虫名称:">
|
|
|
+ <el-input v-model="xyform.name"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="setNameDialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="setNameSubm()">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- 设置诱芯更换时间配置弹框 -->
|
|
|
+ <el-dialog title="设置诱芯" :visible.sync="setTimeDialogVisible" width="420px">
|
|
|
+ <el-form ref="form" :model="xyform" label-width="130px">
|
|
|
+ <el-form-item label="监测害虫名称:">
|
|
|
+ <el-date-picker v-model="xyform.core" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="setTimeDialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="setTimeSubm()">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
<!-- 设备控制对话框II型 -->
|
|
|
<el-dialog
|
|
|
title="设备控制"
|
|
|
@@ -381,10 +428,17 @@ import EquipItem from '@/components/EquipItem'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ newtime:'',
|
|
|
//图表和表格切换
|
|
|
displayType: '1',
|
|
|
// 设备加载loading
|
|
|
tableLoading : false,
|
|
|
+ setNameDialogVisible:false,
|
|
|
+ setTimeDialogVisible: false, //设置诱虫名称配置弹框
|
|
|
+ xyform:{
|
|
|
+ name:'',
|
|
|
+ core:'',
|
|
|
+ },
|
|
|
//设备列表
|
|
|
equipList: [],
|
|
|
role: 'admin',
|
|
|
@@ -439,8 +493,25 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getEquipList()
|
|
|
+ this.newtime = new Date().getTime();
|
|
|
},
|
|
|
computed: {
|
|
|
+ timeCalc(){
|
|
|
+ // if(time){
|
|
|
+ // let num = time
|
|
|
+ // }
|
|
|
+ return function(time){
|
|
|
+ if(time){
|
|
|
+ var time = new Date(time).getTime();
|
|
|
+ var currenttime = new Date().getTime();
|
|
|
+ var num = Math.round((parseInt(time)-parseInt(currenttime))/(24*3600000))
|
|
|
+ return num
|
|
|
+ }else{
|
|
|
+ return 'null'
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
userType: function () {
|
|
|
//获取用户类型
|
|
|
return window.sessionStorage.getItem('myuser_type')
|
|
|
@@ -470,6 +541,56 @@ export default {
|
|
|
getDisplayType(data) {
|
|
|
this.displayType = data
|
|
|
},
|
|
|
+ //诱芯更换诱虫名称
|
|
|
+ setName(id,name) {
|
|
|
+ this.d_id = id;
|
|
|
+ this.xyform.name = name
|
|
|
+ this.setNameDialogVisible = true
|
|
|
+ },
|
|
|
+ //诱芯更换时间
|
|
|
+ setTime(id,core) {
|
|
|
+ this.d_id = id;
|
|
|
+ this.xyform.core = core
|
|
|
+ this.setTimeDialogVisible = true
|
|
|
+ },
|
|
|
+ //诱芯更换诱虫名称
|
|
|
+ setNameSubm() {
|
|
|
+ this.$axios({
|
|
|
+ method: 'POST',
|
|
|
+ url: '/ybq_pest_set',
|
|
|
+ data: this.qs.stringify({
|
|
|
+ e_id: this.d_id,
|
|
|
+ pest: this.xyform.name,
|
|
|
+ })
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.data == 0) {
|
|
|
+ this.$message.success('修改成功!')
|
|
|
+ this.getEquipList()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.message)
|
|
|
+ }
|
|
|
+ this.setNameDialogVisible = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //诱芯更换时间
|
|
|
+ setTimeSubm() {
|
|
|
+ this.$axios({
|
|
|
+ method: 'POST',
|
|
|
+ url: '/sex_core',
|
|
|
+ data: this.qs.stringify({
|
|
|
+ id: this.d_id,
|
|
|
+ core: this.xyform.core,
|
|
|
+ })
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.data == 0) {
|
|
|
+ this.$message.success('修改成功!')
|
|
|
+ this.getEquipList()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.message)
|
|
|
+ }
|
|
|
+ this.setTimeDialogVisible = false
|
|
|
+ })
|
|
|
+ },
|
|
|
//获取设备列表
|
|
|
getEquipList() {
|
|
|
this.tableLoading = true;
|
|
|
@@ -490,6 +611,8 @@ export default {
|
|
|
let obj= eval('(' + item.sex_trap + ')')
|
|
|
obj.equip_name=item.equip_name
|
|
|
obj.upl_time=item.upl_time
|
|
|
+ obj.pest_name=item.pest_name
|
|
|
+ obj.core = item.core.substring(item.core.lastIndexOf("#")+1)
|
|
|
obj.is_online=Number(item.is_online)
|
|
|
return obj
|
|
|
})
|
|
|
@@ -680,6 +803,10 @@ export default {
|
|
|
case 7:
|
|
|
return '销号'
|
|
|
}
|
|
|
+ },
|
|
|
+ msec(val){
|
|
|
+ var time = new Date(val).getTime();
|
|
|
+ return time
|
|
|
}
|
|
|
}
|
|
|
}
|