var deviceData;
|
//阀门控制
|
var data = {
|
"interfaceId": "5402",
|
"outId": "10402",
|
"reqDateTime": new Date(),
|
"tokenAuth": "",
|
"data": {
|
"deptId": "",
|
"depotId": "",
|
"type": "09",
|
"passCode": "",
|
"serId": "",
|
"targetStatus":""
|
}
|
};
|
//设备列表 - 电磁阀
|
var data1 = {
|
"interfaceId": "5401",
|
"outId": "10401",
|
"reqDateTime": new Date(),
|
"tokenAuth": "",
|
"data": {
|
"deptId": "",
|
"depotId": "",
|
"type": "09",
|
}
|
};
|
|
function init() {
|
|
var user = JSON.parse(localStorage.getItem('user'));
|
var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
|
url = user.url + "/api-phone/v35/gateway";
|
data.tokenAuth = user.tokenAuth;
|
data.data.deptId = user.deptId;
|
data1.tokenAuth = user.tokenAuth;
|
data1.data.deptId = user.deptId;
|
//获取从上一个页面传递的数据
|
var self = plus.webview.currentWebview();
|
data.data.depotId = self.depotId
|
data1.data.depotId = self.depotId
|
// depotType = self.depotType
|
// depotName = self.depotName
|
}
|
|
|
//获取设备列表(电磁阀)
|
function getDeviceList() {
|
mui.ajax(url, {
|
type: "POST",
|
dataType: "json",
|
crossDomain: true,
|
contentType: "application/json;charset=utf-8",
|
data: JSON.stringify(data1),
|
success: function(result) {
|
if (result.code == "0000") {
|
deviceData = result.data;
|
} else {
|
mui.toast(result.msg);
|
}
|
},
|
error: function() {
|
mui.alert("系统繁忙,请重试!", "提示", ["确定"], function() {}, "div")
|
}
|
})
|
|
}
|
|
|
//阀门管理
|
function setTemp() {
|
console.log(JSON.stringify(data.data))
|
mui.ajax(url, {
|
type: "POST",
|
dataType: "json",
|
crossDomain: true,
|
contentType: "application/json;charset=utf-8",
|
data: JSON.stringify(data),
|
success: function(result) {
|
if (result.code == "0000") {
|
mui.toast(result.msg);
|
} else {
|
mui.toast(result.msg);
|
}
|
},
|
error: function() {
|
mui.alert("系统繁忙,请重试!", "提示", ["确定"], function() {}, "div")
|
}
|
})
|
}
|
|
//渲染页面
|
function renderDevice() {
|
var html = '';
|
if (deviceData) {
|
var deviceList = deviceData.listDevice
|
if (deviceList && deviceList.length > 0) {
|
var frontList = [];
|
var backList = [];
|
var leftList = [];
|
var rightList = [];
|
$.each(deviceList, function(index, item) {
|
if (item.location == '01') {
|
frontList.push(item)
|
} else if (item.location == '02') {
|
backList.push(item)
|
} else if (item.location == '03') {
|
leftList.push(item)
|
} else if (item.location == '04') {
|
rightList.push(item)
|
}
|
})
|
if (frontList && frontList.length > 0) {
|
html += '<div class="m-tf"><div class="g-tittf1">仓库正面</div><ul class="ul-listmana1 ullisttf1">';
|
$.each(frontList, function(index, item) {
|
if (item.location == '01') {
|
html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
|
item.serId +
|
'" data-win="#win_kt"><div class="pic pic2"><img src="images/e2.png"></div>';
|
if (targetStatus == 'OPEN') {
|
html += '<div class="info out" style="background-image: url(images/e5.png);">' +
|
item.name + '</div>'
|
} else {
|
html += '<div class="info out" style="background-image: url(images/e9.png);">' +
|
item.name + '</div>'
|
}
|
html += '</div></div></li>'
|
}
|
})
|
html += '</ul></div>'
|
}
|
if (backList && backList.length > 0) {
|
html += '<div class="m-tf"><div class="g-tittf1">仓库反面</div><ul class="ul-listmana1 ullisttf1">';
|
$.each(backList, function(index, item) {
|
if (item.location == '02') {
|
html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
|
item.serId +
|
'" data-win="#win_fm"><div class="pic pic2"><img src="images/e2.png"></div>';
|
if (targetStatus == 'OPEN') {
|
html += '<div class="info full" style="background-image: url(images/e5.png);">' +
|
item.name + '</div>'
|
} else {
|
html += '<div class="info full" style="background-image: url(images/e9.png);">' +
|
item.name + '</div>'
|
}
|
html += '</div></div></li>'
|
}
|
})
|
html += '</ul></div>'
|
}
|
if (leftList && leftList.length > 0) {
|
html += '<div class="m-tf"><div class="g-tittf1">仓库左侧面</div><ul class="ul-listmana1 ullisttf1">';
|
$.each(leftList, function(index, item) {
|
if (item.location == '03') {
|
html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
|
item.serId +
|
'" data-win="#win_fm"><div class="pic pic2"><img src="images/e2.png"></div>';
|
if (targetStatus == 'OPEN') {
|
html += '<div class="info full" style="background-image: url(images/e5.png);">' +
|
item.name + '</div>'
|
} else {
|
html += '<div class="info full" style="background-image: url(images/e9.png);">' +
|
item.name + '</div>'
|
}
|
html += '</div></div></li>'
|
}
|
})
|
html += '</ul></div>'
|
}
|
if (rightList && rightList.length > 0) {
|
html += '<div class="m-tf"><div class="g-tittf1">仓库右侧面</div><ul class="ul-listmana1 ullisttf1">';
|
$.each(rightList, function(index, item) {
|
if (item.location == '04') {
|
html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
|
item.serId +
|
'" data-win="#win_fm"><div class="pic pic2"><img src="images/e2.png"></div>';
|
if (targetStatus == 'OPEN') {
|
html += '<div class="info full" style="background-image: url(images/e5.png);">' +
|
item.name + '</div>'
|
} else {
|
html += '<div class="info full" style="background-image: url(images/e9.png);">' +
|
item.name + '</div>'
|
}
|
html += '</div></div></li>'
|
}
|
})
|
html += '</ul></div>'
|
}
|
} else {
|
html += '<div class="m-tf"><div class="g-tittf1" style="text-align: center;font-size: 20px;color:#dd524d>暂无数据</div>';
|
}
|
} else {
|
html += '<div class="m-tf"><div class="g-tittf1" style="text-align: center;font-size: 20px;color:#dd524d>暂无数据</div>';
|
}
|
// $("#recordList").html(html);
|
}
|
|
//电磁阀操作
|
mui(".mui-scroll-wrapper").on("tap", ".m-tf ul li .con", function() {
|
var passCode = this.getAttribute("passCode");
|
var serId = this.getAttribute("serId");
|
data.data.passCode = passCode;
|
data.data.serId = serId;
|
$('.m-pop').css('display', 'flex');
|
});
|
mui(".m-pop").on("tap", ".inner a", function() {
|
var id = this.getAttribute("id");
|
mui.toast(id);
|
closePop();
|
});
|
//关闭弹窗
|
function closePop() {
|
$(".m-pop").css('display', 'none');
|
}
|
$('.pop-bg,.m-pop .close').click(function(e) {
|
e.stopPropagation();
|
$('.m-pop').fadeOut();
|
});
|
|
|
var slider = mui(".mui-slider");
|
slider.slider({
|
interval: 3000
|
});
|
|
mui('.mui-scroll-wrapper').scroll({
|
indicators: false, //是否显示滚动条
|
deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏
|
bounce: false, //是否启用回弹
|
deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
|
});
|