|
|
@@ -6,7 +6,7 @@
|
|
|
</view>
|
|
|
<view class="utabs_box">
|
|
|
<view class="utabs">
|
|
|
- <u-tabs :list="list" :is-scroll="true" :current="current" @change="change" item-width="140" font-size="24" gutter="20"
|
|
|
+ <u-tabs :list="list" :is-scroll="true" :current="currents" @change="change" item-width="140" font-size="24" gutter="20"
|
|
|
bar-width="60" active-color="#42b983"></u-tabs>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -14,15 +14,17 @@
|
|
|
<view class="list_item" v-for="(item,index) in eqlistdata" :key="index" @click="historys(item)">
|
|
|
<view class="list_item_top">
|
|
|
<p class="p1">
|
|
|
- <image :src="'http://static.yfpyx.com/bigdata_app'+images[current].path" mode=""></image>
|
|
|
+ <image :src="'http://static.yfpyx.com/bigdata_app'+imgpath[0].path" mode=""></image>
|
|
|
{{item.device_name==''?"--":item.device_name}}
|
|
|
</p>
|
|
|
<p :class="[item.is_online?'p2':'p_out']">{{item.is_online?"在线":"离线"}}</p>
|
|
|
</view>
|
|
|
<view class="list_item_text">
|
|
|
- <p>设备ID:{{item.imei}}</p>
|
|
|
+ <p>设备ID:{{item.imei || item.device_id}}</p>
|
|
|
<p>适配用户:{{item.real_name==''?"无":item.real_name}}</p>
|
|
|
- <p>添加设备时间:{{item.addtime|timeFormat()}}</p>
|
|
|
+ <p>最新上报时间:{{item.addtime|timeFormat()}}</p>
|
|
|
+ <p>添加设备时间:{{item.uptime|timeFormat()}}</p>
|
|
|
+ <p>设备已运行:{{item.days}}天</p>
|
|
|
</view>
|
|
|
<view class="list_item_btn" v-if="infoalter" @click.stop="modification(item)">
|
|
|
信息修改
|
|
|
@@ -39,70 +41,91 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- list: [{
|
|
|
- name: "杀虫灯"
|
|
|
- }, {
|
|
|
- name: "测报灯"
|
|
|
- }, {
|
|
|
- name: "智能性诱"
|
|
|
- }, {
|
|
|
- name: "环境检测"
|
|
|
- }, {
|
|
|
- name: "监控设备"
|
|
|
- }, {
|
|
|
- name: "孢子仪"
|
|
|
- }, {
|
|
|
- name: "性诱2.0"
|
|
|
- }],
|
|
|
+ list: [],
|
|
|
current: 0,
|
|
|
+ currents:0,
|
|
|
page: 1,
|
|
|
size: 10,
|
|
|
images: [{
|
|
|
+ name: "杀虫灯",
|
|
|
path: "/image/fourMoodBase/3.png", //
|
|
|
id: 2
|
|
|
},
|
|
|
{
|
|
|
+ name: "测报灯",
|
|
|
path: "/image/fourMoodBase/1.png",
|
|
|
id: 3
|
|
|
}, {
|
|
|
+ name: "性诱测报",
|
|
|
path: "/image/fourMoodBase/6.png",
|
|
|
id: 4
|
|
|
}, {
|
|
|
+ name: "环境监测",
|
|
|
path: "/image/fourMoodBase/5.png",
|
|
|
id: 5
|
|
|
}, {
|
|
|
+ name: "监控设备",
|
|
|
path: "/image/fourMoodBase/2.png",
|
|
|
id: 6
|
|
|
}, {
|
|
|
+ name: "孢子仪",
|
|
|
path: "/image/fourMoodBase/4.png",
|
|
|
id: 7
|
|
|
},
|
|
|
{
|
|
|
+ name: "性诱2.0",
|
|
|
path: "/image/fourMoodBase/10.png",
|
|
|
id: 10
|
|
|
}
|
|
|
],
|
|
|
eqlistdata: [],
|
|
|
isTop: false,
|
|
|
- infoalter:false // 权限设置
|
|
|
+ infoalter: false, // 权限设置,
|
|
|
+ type_id: 0, //设备类型,
|
|
|
+ imgpath:[]
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- async eqlist() { //设备列表
|
|
|
- if (this.current == 6) {
|
|
|
- var index = this.current + 4
|
|
|
- } else {
|
|
|
- var index = this.current + 2
|
|
|
- }
|
|
|
+ async eqlist(tf) { //设备列表
|
|
|
const res = await this.$myRequest({
|
|
|
url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
|
|
|
data: {
|
|
|
- device_type_id: index,
|
|
|
+ device_type_id: this.type_id,
|
|
|
page: this.page,
|
|
|
page_size: this.size,
|
|
|
}
|
|
|
})
|
|
|
- this.eqlistdata = this.eqlistdata.concat(res.data)
|
|
|
+ var newtime = +new Date() / 1000
|
|
|
+ if(tf){
|
|
|
+ this.eqlistdata = this.eqlistdata.concat(res.data)
|
|
|
+ }else{
|
|
|
+ this.eqlistdata = res.data
|
|
|
+ }
|
|
|
+ for (var i = 0; i < this.eqlistdata.length; i++) {
|
|
|
+ var days = (newtime - this.eqlistdata[i].uptime) / 60 / 60 / 24
|
|
|
+ this.eqlistdata[i].days = Math.round(days)
|
|
|
+ }
|
|
|
+ console.log(res)
|
|
|
+ },
|
|
|
+ async xyeqlist(tf) { //设备列表
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: '/api/api_gateway?method=sex_lure_nl.sex_lure.nl_device_list',
|
|
|
+ data: {
|
|
|
+ device_type_id: this.type_id,
|
|
|
+ page: this.page,
|
|
|
+ page_size: this.size,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ var newtime = +new Date() / 1000
|
|
|
+ if(tf){
|
|
|
+ this.eqlistdata = this.eqlistdata.concat(res.data)
|
|
|
+ }else{
|
|
|
+ this.eqlistdata = res.data
|
|
|
+ }
|
|
|
+ for (var i = 0; i < this.eqlistdata.length; i++) {
|
|
|
+ var days = (newtime - this.eqlistdata[i].uptime) / 60 / 60 / 24
|
|
|
+ this.eqlistdata[i].days = Math.round(days)
|
|
|
+ }
|
|
|
console.log(res)
|
|
|
},
|
|
|
//camera.camera_manage.list_camera
|
|
|
@@ -116,26 +139,34 @@
|
|
|
this.accessToken = res.accessToken
|
|
|
},
|
|
|
change(index) { //头部导航栏的点击
|
|
|
+ this.current = index
|
|
|
+ this.currents = index
|
|
|
this.page = 1
|
|
|
this.eqlistdata = []
|
|
|
- this.current = index
|
|
|
- this.eqlist()
|
|
|
+ console.log(index)
|
|
|
+ for (var i = 0; i < this.images.length; i++) {
|
|
|
+ if (this.list[index].name == this.images[i].name) {
|
|
|
+ this.type_id = this.images[i].id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.imgpath = this.images.filter((item)=>{
|
|
|
+ return item.id == this.type_id
|
|
|
+ })
|
|
|
+ if (this.type_id == 10) {
|
|
|
+ this.xyeqlist()
|
|
|
+ } else {
|
|
|
+ this.eqlist()
|
|
|
+ }
|
|
|
},
|
|
|
clickRight() { //搜索
|
|
|
uni.navigateTo({
|
|
|
- url: "./search?id=" + (this.current + 2)
|
|
|
+ url: "./search?id=" + this.type_id
|
|
|
})
|
|
|
},
|
|
|
modification(item) {
|
|
|
- if(this.current==6){
|
|
|
- uni.navigateTo({
|
|
|
- url: "./modification?data=" + JSON.stringify(item) + "&id=" + (this.current + 4)
|
|
|
- })
|
|
|
- }else{
|
|
|
- uni.navigateTo({
|
|
|
- url: "./modification?data=" + JSON.stringify(item) + "&id=" + (this.current + 2)
|
|
|
- })
|
|
|
- }
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "./modification?data=" + JSON.stringify(item) + "&id=" + this.type_id,
|
|
|
+ })
|
|
|
},
|
|
|
top() {
|
|
|
uni.pageScrollTo({
|
|
|
@@ -144,7 +175,7 @@
|
|
|
})
|
|
|
},
|
|
|
historys(item) {
|
|
|
- switch (this.current + 2) {
|
|
|
+ switch (this.type_id) {
|
|
|
case 2:
|
|
|
uni.navigateTo({
|
|
|
url: "../prevention/equipmentdetails?shebei=" + JSON.stringify(item)
|
|
|
@@ -170,19 +201,19 @@
|
|
|
})
|
|
|
break;
|
|
|
case 3:
|
|
|
- item.type = this.current + 2
|
|
|
+ item.type = this.type_id
|
|
|
uni.navigateTo({
|
|
|
url: "../cb/equip-detail/equip-detail?info=" + JSON.stringify(item)
|
|
|
})
|
|
|
break;
|
|
|
case 4:
|
|
|
- item.type = this.current + 2
|
|
|
+ item.type = this.type_id
|
|
|
uni.navigateTo({
|
|
|
url: "../cb/equip-detail/equip-detail?info=" + JSON.stringify(item)
|
|
|
})
|
|
|
break;
|
|
|
default:
|
|
|
- item.type = this.current + 4
|
|
|
+ item.type = this.type_id
|
|
|
uni.navigateTo({
|
|
|
url: "../cb/xy2.0/particulars?info=" + JSON.stringify(item)
|
|
|
})
|
|
|
@@ -191,29 +222,83 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
- this.eqlist()
|
|
|
+ this.list=[]
|
|
|
this.camera()
|
|
|
uni.getStorage({
|
|
|
- key:"jurisdiction",
|
|
|
- success:(res)=>{
|
|
|
+ key: "jurisdiction",
|
|
|
+ success: (res) => {
|
|
|
console.log(JSON.parse(res.data))
|
|
|
- let items = JSON.parse(res.data).filter((item)=>{
|
|
|
+ let items = JSON.parse(res.data).filter((item) => {
|
|
|
return item.purview_name == "设备管理"
|
|
|
})
|
|
|
- let items2 = items[0].children.filter((item)=>{
|
|
|
- return item.purview_name == "分配设备"
|
|
|
+ let items2 = items[0].children.filter((item) => {
|
|
|
+ return item.purview_name == "设备列表"
|
|
|
})
|
|
|
console.log(items2[0].children)
|
|
|
- this.infoalter = items2[0].children.some((item)=>{
|
|
|
+ this.infoalter = items2[0].children.some((item) => {
|
|
|
return item.purview_name == "修改名称" || item.purview_name == "添加位置"
|
|
|
})
|
|
|
console.log(this.infoalter)
|
|
|
+ var res = JSON.parse(res.data)
|
|
|
+ for (var i = 0; i < res.length; i++) {
|
|
|
+ switch (res[i].purview_name) {
|
|
|
+ case "测报系统":
|
|
|
+ for (var j = 0; j < res[i].children.length; j++) {
|
|
|
+ var obj = {
|
|
|
+ name: res[i].children[j].purview_name=="虫情测报灯"?"测报灯":res[i].children[j].purview_name
|
|
|
+ }
|
|
|
+ this.list.push(obj)
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "监控系统":
|
|
|
+ for (var j = 0; j < res[i].children.length; j++) {
|
|
|
+ var obj = {
|
|
|
+ name: res[i].children[j].purview_name
|
|
|
+ }
|
|
|
+ this.list.push(obj)
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "环境监测系统":
|
|
|
+ for (var j = 0; j < res[i].children.length; j++) {
|
|
|
+ var obj = {
|
|
|
+ name: res[i].children[j].purview_name
|
|
|
+ }
|
|
|
+ this.list.push(obj)
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "防治系统":
|
|
|
+ for (var j = 0; j < res[i].children.length; j++) {
|
|
|
+ var obj = {
|
|
|
+ name: res[i].children[j].purview_name
|
|
|
+ }
|
|
|
+ this.list.push(obj)
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (var i = 0; i < this.images.length; i++) {
|
|
|
+ if (this.list[this.current].name == this.images[i].name) {
|
|
|
+ this.type_id = this.images[i].id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.imgpath = this.images.filter((item)=>{
|
|
|
+ return item.id == this.type_id
|
|
|
+ })
|
|
|
+ if (this.type_id == 10) {
|
|
|
+ this.xyeqlist(false)
|
|
|
+ } else {
|
|
|
+ this.eqlist(false)
|
|
|
+ }
|
|
|
},
|
|
|
})
|
|
|
},
|
|
|
onReachBottom() {
|
|
|
this.page++
|
|
|
- this.eqlist()
|
|
|
+ if (this.type_id == 10) {
|
|
|
+ this.xyeqlist(true)
|
|
|
+ } else {
|
|
|
+ this.eqlist(true)
|
|
|
+ }
|
|
|
},
|
|
|
onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
|
|
|
if (e.scrollTop > 200) { //距离大于200时显示
|