You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
448 lines
10 KiB
448 lines
10 KiB
<template>
|
|
<view class="page">
|
|
<u-navbar back-text="设备维护">
|
|
<view class="devicemaintenancetitle">
|
|
<u-radio-group v-model="devicevalue" @change="radioGroupChange">
|
|
<u-radio
|
|
@change="deviceradioChange"
|
|
v-for="(item, index) in devicelist" :key="index"
|
|
:name="item.name"
|
|
:disabled="item.disabled">
|
|
{{item.name}}
|
|
</u-radio>
|
|
</u-radio-group>
|
|
</view>
|
|
</u-navbar>
|
|
<view class="background">
|
|
<view class="list" v-for="(item, index) in subdeviceList" :key="item.comid">
|
|
<view class="list-content">
|
|
<view @tap="toOne(item)">
|
|
<view class="title">
|
|
<view>ID:{{ item.comid }}</view>
|
|
<view>
|
|
设备状态:
|
|
{{ maintain_devicestatus[item.statusindex] }}
|
|
</view>
|
|
</view>
|
|
<view class="content">
|
|
<view>设备类型:{{ maintain_devicetype[item.maintain_devicetype] }}</view>
|
|
<view>区域:{{ item.groupid }}</view>
|
|
</view>
|
|
</view>
|
|
<view @tap="select(index)">
|
|
<u-checkbox v-model="item.selected" shape="circle" disabled />
|
|
</view>
|
|
</view>
|
|
<view class="border" />
|
|
</view>
|
|
<u-empty v-if="subdeviceList.length === 0" margin-top="32" />
|
|
</view>
|
|
<u-loadmore
|
|
v-if="subdeviceList.length !== 0"
|
|
:status="loadmore"
|
|
margin-top="32"
|
|
@loadmore="getSubdevicePage"
|
|
/>
|
|
<view style="height: 32rpx" />
|
|
<u-popup v-model="showPopup" mode="top" class="top">
|
|
<view class="popup-content">
|
|
|
|
</view>
|
|
</u-popup>
|
|
<u-popup v-model="showImport" mode="bottom" height="400" class="importTip">
|
|
<view class="title">导入完成</view>
|
|
<view v-for="item in importTip" :key="item.create_time" class="tipList">
|
|
<view>设备ID:{{ item.maintain_subdeviceid }}</view>
|
|
<view>导入状态:{{ item.explain }}</view>
|
|
</view>
|
|
</u-popup>
|
|
<u-modal
|
|
v-model="showDelete"
|
|
:show-title="false"
|
|
:content="`是否删除这${selectedList.length}个设备`"
|
|
async-close
|
|
show-cancel-button
|
|
@confirm="deleteSubdevice"
|
|
/>
|
|
<u-toast ref="uToast" />
|
|
|
|
<view style="width: 40rpx;height: 40rpx;position: absolute;left: 50%;top: 50%;margin: -20rpx 0 0 -20rpx;">
|
|
<u-loading :show="devciewait" mode="flower" size="40"></u-loading>
|
|
</view>
|
|
|
|
<u-mask :show="devcieshow"></u-mask>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getSubdevicePage,
|
|
} from "@/common/network/equipment/subdevice";
|
|
|
|
export default {
|
|
components: {
|
|
|
|
},
|
|
data() {
|
|
return {
|
|
devcieshow: false,
|
|
devciewait: false,
|
|
devicelist: [
|
|
{
|
|
name: '灯杆',
|
|
disabled: false
|
|
},
|
|
{
|
|
name: '回路',
|
|
disabled: false
|
|
},
|
|
{
|
|
name: '传感器',
|
|
disabled: false
|
|
}
|
|
],
|
|
// u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
|
|
devicevalue: '灯杆',
|
|
maintain_devicetype: [
|
|
"",
|
|
"单色温调光灯控器",
|
|
"双色温调光灯控器",
|
|
"双灯头调光灯控器",
|
|
"单回路开关控制器",
|
|
"三相回路开关控制器",
|
|
"单回路调光控制器",
|
|
"单回路色温控制器",
|
|
"照度传感器",
|
|
"亮度传感器",
|
|
"车流量传感器",
|
|
],
|
|
maintain_devicestatus: ["已安装", "未安装"],
|
|
showPopup: false,
|
|
showImport: false,
|
|
showDelete: false,
|
|
page: 1,
|
|
subdeviceList: [],
|
|
loadmore: "loadmore",
|
|
importTip: [],
|
|
selectedList: [],
|
|
devicetype: 1,
|
|
deviceinfo:{
|
|
deviceurl: '/control/doPagedQuery.do',
|
|
devicetype: 1,
|
|
},
|
|
};
|
|
},
|
|
created() {},
|
|
mounted() {},
|
|
methods: {
|
|
refresh() {
|
|
this.page = 1;
|
|
this.getSubdevicePage();
|
|
},
|
|
getSubdevicePage(device) {
|
|
var that=this;
|
|
this.loadmore = "loading";
|
|
debugger
|
|
let data = {
|
|
currentPage: this.page,
|
|
perpage: 50,
|
|
url: device.deviceurl,
|
|
filtervalue: this.device.deviceid,
|
|
};
|
|
|
|
getSubdevicePage(data)
|
|
.then((res) => {
|
|
that.devciewait = false;
|
|
that.devcieshow = false;
|
|
if (res.data.totalCount > 0) {
|
|
|
|
if(that.devicetype == 1)//灯杆
|
|
{
|
|
for(var i = 0; i < res.data.list.length; i++){
|
|
|
|
if(res.data.list[i].iseffect == true){
|
|
res.data.list[i].statusindex = 0;
|
|
}
|
|
else{
|
|
res.data.list[i].statusindex = 1;
|
|
}
|
|
|
|
if(res.data.list[i].type == '0001'){
|
|
res.data.list[i].maintain_devicetype = 1;
|
|
}
|
|
else if(res.data.list[i].type == '0002'){
|
|
res.data.list[i].maintain_devicetype = 2;
|
|
}
|
|
else if(res.data.list[i].type == '0003'){
|
|
res.data.list[i].maintain_devicetype = 3;
|
|
}
|
|
|
|
}
|
|
}
|
|
else if(that.devicetype == 2)//回路
|
|
{
|
|
for(var i = 0; i < res.data.list.length; i++){
|
|
if(res.data.list[i].iseffect == true){
|
|
res.data.list[i].statusindex = 0;
|
|
}
|
|
else{
|
|
res.data.list[i].statusindex = 1;
|
|
}
|
|
|
|
if(res.data.list[i].type == '0001'){
|
|
res.data.list[i].maintain_devicetype = 4;
|
|
}
|
|
else if(res.data.list[i].type == '0002'){
|
|
res.data.list[i].maintain_devicetype = 5;
|
|
}
|
|
else if(res.data.list[i].type == '0003'){
|
|
res.data.list[i].maintain_devicetype = 6;
|
|
}
|
|
else if(res.data.list[i].type == '0004'){
|
|
res.data.list[i].maintain_devicetype = 7;
|
|
}
|
|
|
|
|
|
//res.data.list[i].groupid = res.data.list[i].groups;
|
|
}
|
|
}
|
|
else if(that.devicetype == 3)//传感器
|
|
{
|
|
for(var i = 0; i < res.data.list.length; i++){
|
|
if(res.data.list[i].iseffect == true){
|
|
res.data.list[i].statusindex = 0;
|
|
}
|
|
else{
|
|
res.data.list[i].statusindex = 1;
|
|
}
|
|
|
|
if(res.data.list[i].type == '0001'){
|
|
res.data.list[i].maintain_devicetype = 8;
|
|
}
|
|
else if(res.data.list[i].type == '0002'){
|
|
res.data.list[i].maintain_devicetype = 9;
|
|
}
|
|
else if(res.data.list[i].type == '0003'){
|
|
res.data.list[i].maintain_devicetype = 10;
|
|
}
|
|
|
|
|
|
res.data.list[i].groupid = '无';
|
|
}
|
|
}
|
|
|
|
if (that.page === 1) {
|
|
|
|
that.subdeviceList = res.data.list;
|
|
} else {
|
|
that.subdeviceList.push(...res.data.list);
|
|
}
|
|
that.total = res.data.totalCount;
|
|
if (that.page*50 < res.data.totalCount) {
|
|
that.page++;
|
|
data.currentPage = that.page;
|
|
|
|
that.loadmore = "loadmore";
|
|
} else {
|
|
that.loadmore = "nomore";
|
|
}
|
|
}
|
|
})
|
|
.catch((err) => {
|
|
console.log(err);
|
|
});
|
|
},
|
|
deviceradioChange(e){
|
|
this.devcieshow = true;
|
|
this.devciewait = true;
|
|
|
|
//var deviceurl = '/control/doPagedQuery.do';
|
|
this.subdeviceList = [];
|
|
if(e == '灯杆')
|
|
{
|
|
this.deviceinfo.devicetype = 1;
|
|
this.deviceinfo.deviceurl = '/control/doPagedQuery.do';
|
|
}
|
|
else if(e == '回路'){
|
|
this.deviceinfo.devicetype = 2;
|
|
this.deviceinfo.deviceurl = '/mcontrol/doPagedQuery.do';
|
|
}
|
|
else if(e == '传感器'){
|
|
this.deviceinfo.devicetype = 3;
|
|
this.deviceinfo.deviceurl = '/sensor/doPagedQuery.do';
|
|
}
|
|
this.devicetype = this.deviceinfo.devicetype;
|
|
this.getSubdevicePage(this.deviceinfo);
|
|
// console.log(e);
|
|
},
|
|
radioGroupChange(e) {
|
|
// console.log(e);
|
|
//this.devicevalue
|
|
},
|
|
toOne(subdevice) {
|
|
|
|
//if(this.devicetype != 3)
|
|
{
|
|
uni.navigateTo({
|
|
url: "/pages/commissioning/commissioning?subdeviceid=" + subdevice.comid +"&rtuid=" + subdevice.terminal+"&terminalId=" + subdevice.terminalId+"&subdeviceccid=" + subdevice.id+"&subdevicetype=" + this.devicetype+"&subdevicename=" + subdevice.name+"&subdevice=" + subdevice.type,
|
|
});
|
|
}
|
|
},
|
|
select(index) {
|
|
this.subdeviceList[index].selected = !this.subdeviceList[index].selected;
|
|
if (this.subdeviceList[index].selected) {
|
|
this.selectedList.push(this.subdeviceList[index].subdeviceid);
|
|
} else {
|
|
let i = this.selectedList.indexOf(
|
|
this.subdeviceList[index].subdeviceid
|
|
);
|
|
this.selectedList.splice(i, 1);
|
|
}
|
|
},
|
|
},
|
|
onLoad(option) {
|
|
this.device = option;
|
|
|
|
this.subdeviceid = this.device.subdeviceid;
|
|
this.lampid = this.device.id
|
|
this.rtuid = this.device.deviceid;
|
|
this.terminalid = this.device.terminalId;
|
|
|
|
|
|
this.getSubdevicePage(this.deviceinfo);
|
|
uni.$on("refresh", this.refresh);
|
|
},
|
|
onPullDownRefresh() {
|
|
this.refresh();
|
|
},
|
|
onReachBottom() {
|
|
if (this.loadmore === "loadmore") {
|
|
this.getSubdevicePage(this.deviceinfo);
|
|
}
|
|
},
|
|
onUnload() {
|
|
uni.$off("refresh", this.refresh);
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.page {
|
|
min-height: 100vh;
|
|
background: linear-gradient(
|
|
180deg,
|
|
rgba(235, 241, 255, 0.5) 0%,
|
|
#e4ebff 100%
|
|
);
|
|
}
|
|
|
|
.background {
|
|
margin: 32rpx 24rpx;
|
|
padding: 1px 0;
|
|
|
|
background: #ffffff;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.list-content {
|
|
display: flex;
|
|
}
|
|
.list-content > :first-child {
|
|
flex: 1;
|
|
}
|
|
.list-content > :last-child {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
|
|
margin-right: 1px;
|
|
width: 50rpx;
|
|
background: rgba(78, 115, 223, 0.4);
|
|
}
|
|
.list-content > :last-child .u-checkbox {
|
|
display: block;
|
|
}
|
|
.list:first-child .list-content > :last-child {
|
|
border-top-right-radius: 20rpx;
|
|
}
|
|
.list:last-child .list-content > :last-child {
|
|
border-bottom-right-radius: 20rpx;
|
|
}
|
|
.list >>> .u-checkbox__icon-wrap {
|
|
background-color: #ffffff;
|
|
}
|
|
.list >>> .u-checkbox__icon-wrap--checked {
|
|
background-color: #2979ff;
|
|
}
|
|
|
|
.list .title {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
margin-top: 24rpx;
|
|
padding: 0 24rpx;
|
|
|
|
font-size: 30rpx;
|
|
}
|
|
.list .title > :first-child {
|
|
max-width: 280rpx;
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
}
|
|
.list .content {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
margin: 20rpx 0;
|
|
padding: 0 24rpx;
|
|
|
|
font-size: 30rpx;
|
|
color: #8d92a6;
|
|
}
|
|
.list .content > :first-child {
|
|
max-width: 360rpx;
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
}
|
|
.list > .border {
|
|
height: 1px;
|
|
background-color: #e8e9ed;
|
|
}
|
|
.list:last-child > .border {
|
|
height: 0;
|
|
}
|
|
|
|
.u-drawer.top,
|
|
.u-drawer.top >>> .u-mask {
|
|
margin-top: calc(var(--status-bar-height) + 44px);
|
|
}
|
|
|
|
.popup-content {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
|
|
padding: 0 64rpx;
|
|
height: 230rpx;
|
|
|
|
color: #4e73df;
|
|
}
|
|
.popup-content .u-image {
|
|
margin: 0 auto 20rpx;
|
|
}
|
|
|
|
.importTip .title {
|
|
font-size: 36rpx;
|
|
line-height: 2em;
|
|
text-align: center;
|
|
}
|
|
.importTip .tipList {
|
|
padding: 20rpx;
|
|
line-height: 2em;
|
|
}
|
|
.devicemaintenancetitle{
|
|
padding-left: 50px;
|
|
}
|
|
</style>
|
|
|