修改和优化顶卷模块

This commit is contained in:
pangdundun 2023-12-09 16:01:44 +08:00
parent 1370fdd036
commit 8a07725056
39 changed files with 637 additions and 320 deletions

View File

@ -6,7 +6,8 @@
<view class="content" v-if="purviewList.indexOf('10')!=-1"> <view class="content" v-if="purviewList.indexOf('10')!=-1">
<div class="item"> <div class="item">
<u-collapse :accordion='false' :item-style="itemStyle" :head-style='headStyle'> <u-collapse :accordion='false' :item-style="itemStyle" :head-style='headStyle'>
<u-collapse-item :title="item.nickName" v-for="(item,index) in itemList" :key="index" align="center" v-show="isInclude(item)"> <u-collapse-item :title="item.nickName" v-for="(item,index) in itemList" :key="index" align="center"
v-show="isInclude(item)">
<view class="collapseItem"> <view class="collapseItem">
<view class="line"></view> <view class="line"></view>
<view class="control_model"> <view class="control_model">
@ -17,12 +18,12 @@
<text @click="change00(item.type,1)" <text @click="change00(item.type,1)"
:class="getTypeRoll(item.type)==1?'txt_act':'txt'">&nbsp;&nbsp;&nbsp;</text> :class="getTypeRoll(item.type)==1?'txt_act':'txt'">&nbsp;&nbsp;&nbsp;</text>
<text @click="change00(item.type,2)" <text @click="change00(item.type,2)"
:class="getTypeRoll(item.type)==2?'txt_act':'txt'">&nbsp;&nbsp;&nbsp;</text> :class="getTypeRoll(item.type)==2?'txt_act':'txt'">{{ item.type_2 ? '关&nbsp;&nbsp;&nbsp;闭' : '停&nbsp;&nbsp;&nbsp;止' }}</text>
<text @click="change00(item.type,3)" <text @click="change00(item.type,3)" v-if="!item.type_2"
:class="getTypeRoll(item.type)==3?'txt_act':'txt'">&nbsp;&nbsp;&nbsp;</text> :class="getTypeRoll(item.type)==3?'txt_act':'txt'">&nbsp;&nbsp;&nbsp;</text>
</view> </view>
<view class="line1"></view> <view class="line1"></view>
<view class="roll_input"> <view class="roll_input" v-if="!item.type_2">
<view class=""> <view class="">
<view class=""> <view class="">
<input v-model="item.open_value" <input v-model="item.open_value"
@ -40,6 +41,16 @@
<text>通道关闭</text> <text>通道关闭</text>
</view> </view>
</view> </view>
<view class="roll_input" v-else>
<view class="">
<view class="">
<input v-model="item.open_value"
@blur="blurChangeData00_1(item.type+1,$event)" type="number"
placeholder="0">
</view>
<text>通道;</text>
</view>
</view>
</view> </view>
</view> </view>
</u-collapse-item> </u-collapse-item>
@ -338,27 +349,122 @@
type: 21680, type: 21680,
open_value: 0, open_value: 0,
close_value: 0 close_value: 0
}, { },
{
head: "2#顶卷膜", head: "2#顶卷膜",
type: 21683, type: 21683,
open_value: 0, open_value: 0,
close_value: 0 close_value: 0
}, { },
{
head: "3#顶卷膜", head: "3#顶卷膜",
type: 21686, type: 21686,
open_value: 0, open_value: 0,
close_value: 0 close_value: 0
}, { },
{
head: "1#侧卷膜", head: "1#侧卷膜",
type: 21689, type: 21689,
open_value: 0, open_value: 0,
close_value: 0 close_value: 0
}, { },
{
head: "2#侧卷膜", head: "2#侧卷膜",
type: 21692, type: 21692,
open_value: 0, open_value: 0,
close_value: 0 close_value: 0
}, ], },
{
head: "外遮阳1",
type: 21695,
open_value: 0,
close_value: 0
},
{
head: "外遮阳2",
type: 21698,
open_value: 0,
close_value: 0
},
{
head: "外遮阳3",
type: 21701,
open_value: 0,
close_value: 0
},
{
head: "外遮阳4",
type: 21704,
open_value: 0,
close_value: 0
},
{
head: "外遮阳5",
type: 21707,
open_value: 0,
close_value: 0
},
{
head: "风机1",
type: 21710,
value: 0,
type_2: 2
},
{
head: "风机2",
type: 21712,
value: 0,
type_2: 2
},
{
head: "风机3",
type: 21714,
value: 0,
type_2: 2
},
{
head: "风机4",
type: 21716,
value: 0,
type_2: 2
},
{
head: "风机5",
type: 21718,
value: 0,
type_2: 2
},
{
head: "风机6",
type: 21720,
value: 0,
type_2: 2
},
{
head: "风机7",
type: 21722,
value: 0,
type_2: 2
},
{
head: "风机8",
type: 21724,
value: 0,
type_2: 2
},
{
head: "风机9",
type: 21726,
value: 0,
type_2: 2
},
{
head: "风机10",
type: 21728,
value: 0,
type_2: 2
},
],
itemStyle: { itemStyle: {
width: "690rpx", width: "690rpx",
background: " #FFFFFF", background: " #FFFFFF",
@ -374,11 +480,87 @@
color: "#333333", color: "#333333",
height: '91rpx' height: '91rpx'
}, },
txt_act_list: [{
txt_act21680: 0, txt_act21680: 0,
key: 21680
},
{
txt_act21683: 0, txt_act21683: 0,
key: 21683
},
{
txt_act21686: 0, txt_act21686: 0,
key: 21686
},
{
txt_act21689: 0, txt_act21689: 0,
key: 21689
},
{
txt_act21692: 0, txt_act21692: 0,
key: 21692
},
{
txt_act21695: 0,
key: 21695
},
{
txt_act21698: 0,
key: 21698
},
{
txt_act21701: 0,
key: 21701
},
{
txt_act21704: 0,
key: 21704
},
{
txt_act21707: 0,
key: 21707
},
{
txt_act21710: 0,
key: 21710
},
{
txt_act21712: 0,
key: 21712
},
{
txt_act21714: 0,
key: 21714
},
{
txt_act21716: 0,
key: 21716
},
{
txt_act21718: 0,
key: 21718
},
{
txt_act21720: 0,
key: 21720
},
{
txt_act21722: 0,
key: 21722
},
{
txt_act21724: 0,
key: 21724
},
{
txt_act21726: 0,
key: 21726
},
{
txt_act21728: 0,
key: 21728
},
],
inputData: [], inputData: [],
inputData1: [], inputData1: [],
timer: '', timer: '',
@ -484,13 +666,11 @@
} }
}) })
this.itemList.forEach(h => { this.itemList.forEach(h => {
// h.nickName = (this.wxgetpermission.filter(m=>m.name == h.head))[0].nickName
let s = this.wxgetpermission.filter(m => m.name == h.head) let s = this.wxgetpermission.filter(m => m.name == h.head)
if (s.length > 0) { if (s.length > 0) {
h.nickName = s[0].nickName h.nickName = s[0].nickName
} }
}) })
console.log(this.itemList);
} }
}) })
}, },
@ -605,17 +785,8 @@
}, },
// typetxt_act21680 // typetxt_act21680
getTypeRoll(i) { getTypeRoll(i) {
if (i == 21680) { let arr = this.txt_act_list.filter(el => el.key == i)
return this.txt_act21680 return arr[0][Object.keys(arr[0])[0]]
} else if (i == 21683) {
return this.txt_act21683
} else if (i == 21686) {
return this.txt_act21686
} else if (i == 21689) {
return this.txt_act21689
} else if (i == 21692) {
return this.txt_act21692
}
}, },
@ -643,18 +814,27 @@
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
this.inputData = res.data this.inputData = res.data
for (let i = 0; i < this.itemList.length; i++) { for (let i = 0; i < this.itemList.length; i++) {
this.itemList[i].open_value = this.inputData[Number('21681') + i * if (!this.itemList[i].type_2) {
this.itemList[i].open_value = this.inputData[Number('21681') +
i *
3] 3]
this.itemList[i].close_value = this.inputData[Number('21682') + i * this.itemList[i].close_value = this.inputData[Number('21682') +
i *
3] 3]
this.getType((21680 + i * 3), 1)
} else {
this.itemList[i].value = this.inputData[21711 + (i - 10) * 2]
this.getType((21710 + (i - 10) * 2), 2)
} }
// console.log(this.itemList);
this.getType('21680') }
this.getType('21683')
this.getType('21686') // this.getType('21680')
this.getType('21689') // this.getType('21683')
this.getType('21692') // this.getType('21686')
// this.getType('21689')
// this.getType('21692')
} }
}) })
} }
@ -791,66 +971,51 @@
return '' return ''
} }
}, },
padString(str, length) { padString(str, length) {
return str.padStart(length, '0'); return str.padStart(length, '0');
}, },
getType(type) { getType(type, flag) {
if (flag == 1) {
var number = this.padString(Number(this.inputData[type]).toString(2), 3) var number = this.padString(Number(this.inputData[type]).toString(2), 3)
// console.log(number); //001 // console.log(number); //001
// console.log(number[0]); //0 bit2 // console.log(number[0]); //0 bit2
// console.log(number[1]); //0 bit1 // console.log(number[1]); //0 bit1
// console.log(number[2]); //1 bit0 // console.log(number[2]); //1 bit0
if (type == '21680') { let arr = this.txt_act_list.filter(el => el.key == type)
let key1 = Object.keys(arr[0])[0];
this.txt_act_list.forEach(el => {
if (el.key == type) {
if (Number(number[0])) { if (Number(number[0])) {
this.txt_act21680 = 3 el[key1] = 3
} else if (Number(number[1])) { } else if (Number(number[1])) {
this.txt_act21680 = 2 el[key1] = 2
} else if (Number(number[2])) { } else if (Number(number[2])) {
this.txt_act21680 = 1 el[key1] = 1
} else { } else {
this.txt_act21680 = 0 el[key1] = 0
} }
} else if (type == '21683') { }
})
} else if (flag == 2) {
var number = this.padString(Number(this.inputData[type]).toString(2), 2)
// console.log(number); //01
// console.log(number[0]); //1 bit1
// console.log(number[1]); //1 bit0
let arr = this.txt_act_list.filter(el => el.key == type)
let key1 = Object.keys(arr[0])[0];
this.txt_act_list.forEach(el => {
if (el.key == type) {
if (Number(number[0])) { if (Number(number[0])) {
this.txt_act21683 = 3 el[key1] = 2
} else if (Number(number[1])) { } else if (Number(number[1])) {
this.txt_act21683 = 2 el[key1] = 1
} else if (Number(number[2])) {
this.txt_act21683 = 1
} else { } else {
this.txt_act21683 = 0 el[key1] = 0
} }
} else if (type == '21686') {
if (Number(number[0])) {
this.txt_act21686 = 3
} else if (Number(number[1])) {
this.txt_act21686 = 2
} else if (Number(number[2])) {
this.txt_act21686 = 1
} else {
this.txt_act21686 = 0
}
} else if (type == '21689') {
if (Number(number[0])) {
this.txt_act21689 = 3
} else if (Number(number[1])) {
this.txt_act21689 = 2
} else if (Number(number[2])) {
this.txt_act21689 = 1
} else {
this.txt_act21689 = 0
}
} else if (type == '21692') {
if (Number(number[0])) {
this.txt_act21692 = 3
} else if (Number(number[1])) {
this.txt_act21692 = 2
} else if (Number(number[2])) {
this.txt_act21692 = 1
} else {
this.txt_act21692 = 0
} }
})
} }
}, },
@ -858,17 +1023,15 @@
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}) })
if (type == 21680) { let arr = this.txt_act_list.filter(el => el.key == type)
this.txt_act21680 = index let key1 = Object.keys(arr[0])[0];
} else if (type == 21683) { this.txt_act_list.forEach(el=>{
this.txt_act21683 = index if(el.key == type){
} else if (type == 21686) { el[key1] = index
this.txt_act21686 = index
} else if (type == 21689) {
this.txt_act21689 = index
} else if (type == 21692) {
this.txt_act21692 = index
} }
})
if (type > 21679 && type < 21708) {
var list = ["0", "0", "0"]; var list = ["0", "0", "0"];
if (index == 1) { if (index == 1) {
list[2] = "1"; list[2] = "1";
@ -885,6 +1048,20 @@
} else { } else {
list[0] = "0"; list[0] = "0";
} }
} else if (type > 21709 && type < 21729) {
var list = ["0", "0"];
if (index == 1) {
list[1] = "1";
} else {
list[1] = "0";
};
if (index == 2) {
list[0] = "1";
} else {
list[0] = "0";
};
}
var num = list.join(""); var num = list.join("");
var dataNum = { var dataNum = {
target: { target: {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -142,7 +142,7 @@ var render = function () {
var m0 = _vm.isInclude(item) var m0 = _vm.isInclude(item)
var m1 = _vm.getTypeRoll(item.type) var m1 = _vm.getTypeRoll(item.type)
var m2 = _vm.getTypeRoll(item.type) var m2 = _vm.getTypeRoll(item.type)
var m3 = _vm.getTypeRoll(item.type) var m3 = !item.type_2 ? _vm.getTypeRoll(item.type) : null
return { return {
$orig: $orig, $orig: $orig,
m0: m0, m0: m0,
@ -572,6 +572,17 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
// //
// //
// //
//
//
//
//
//
//
//
//
//
//
//
var _default = { var _default = {
data: function data() { data: function data() {
return { return {
@ -607,6 +618,81 @@ var _default = {
type: 21692, type: 21692,
open_value: 0, open_value: 0,
close_value: 0 close_value: 0
}, {
head: "外遮阳1",
type: 21695,
open_value: 0,
close_value: 0
}, {
head: "外遮阳2",
type: 21698,
open_value: 0,
close_value: 0
}, {
head: "外遮阳3",
type: 21701,
open_value: 0,
close_value: 0
}, {
head: "外遮阳4",
type: 21704,
open_value: 0,
close_value: 0
}, {
head: "外遮阳5",
type: 21707,
open_value: 0,
close_value: 0
}, {
head: "风机1",
type: 21710,
value: 0,
type_2: 2
}, {
head: "风机2",
type: 21712,
value: 0,
type_2: 2
}, {
head: "风机3",
type: 21714,
value: 0,
type_2: 2
}, {
head: "风机4",
type: 21716,
value: 0,
type_2: 2
}, {
head: "风机5",
type: 21718,
value: 0,
type_2: 2
}, {
head: "风机6",
type: 21720,
value: 0,
type_2: 2
}, {
head: "风机7",
type: 21722,
value: 0,
type_2: 2
}, {
head: "风机8",
type: 21724,
value: 0,
type_2: 2
}, {
head: "风机9",
type: 21726,
value: 0,
type_2: 2
}, {
head: "风机10",
type: 21728,
value: 0,
type_2: 2
}], }],
itemStyle: { itemStyle: {
width: "690rpx", width: "690rpx",
@ -622,11 +708,67 @@ var _default = {
color: "#333333", color: "#333333",
height: '91rpx' height: '91rpx'
}, },
txt_act_list: [{
txt_act21680: 0, txt_act21680: 0,
key: 21680
}, {
txt_act21683: 0, txt_act21683: 0,
key: 21683
}, {
txt_act21686: 0, txt_act21686: 0,
key: 21686
}, {
txt_act21689: 0, txt_act21689: 0,
key: 21689
}, {
txt_act21692: 0, txt_act21692: 0,
key: 21692
}, {
txt_act21695: 0,
key: 21695
}, {
txt_act21698: 0,
key: 21698
}, {
txt_act21701: 0,
key: 21701
}, {
txt_act21704: 0,
key: 21704
}, {
txt_act21707: 0,
key: 21707
}, {
txt_act21710: 0,
key: 21710
}, {
txt_act21712: 0,
key: 21712
}, {
txt_act21714: 0,
key: 21714
}, {
txt_act21716: 0,
key: 21716
}, {
txt_act21718: 0,
key: 21718
}, {
txt_act21720: 0,
key: 21720
}, {
txt_act21722: 0,
key: 21722
}, {
txt_act21724: 0,
key: 21724
}, {
txt_act21726: 0,
key: 21726
}, {
txt_act21728: 0,
key: 21728
}],
inputData: [], inputData: [],
inputData1: [], inputData1: [],
timer: '', timer: '',
@ -733,7 +875,6 @@ var _default = {
}); });
}); });
_this.itemList.forEach(function (h) { _this.itemList.forEach(function (h) {
// h.nickName = (this.wxgetpermission.filter(m=>m.name == h.head))[0].nickName
var s = _this.wxgetpermission.filter(function (m) { var s = _this.wxgetpermission.filter(function (m) {
return m.name == h.head; return m.name == h.head;
}); });
@ -741,7 +882,6 @@ var _default = {
h.nickName = s[0].nickName; h.nickName = s[0].nickName;
} }
}); });
console.log(_this.itemList);
} }
}); });
}, },
@ -850,17 +990,10 @@ var _default = {
}, },
// 根据type参数返回对应的txt_act21680 // 根据type参数返回对应的txt_act21680
getTypeRoll: function getTypeRoll(i) { getTypeRoll: function getTypeRoll(i) {
if (i == 21680) { var arr = this.txt_act_list.filter(function (el) {
return this.txt_act21680; return el.key == i;
} else if (i == 21683) { });
return this.txt_act21683; return arr[0][Object.keys(arr[0])[0]];
} else if (i == 21686) {
return this.txt_act21686;
} else if (i == 21689) {
return this.txt_act21689;
} else if (i == 21692) {
return this.txt_act21692;
}
}, },
// 读取所有寄存器的状态值 // 读取所有寄存器的状态值
dataInit: function dataInit() { dataInit: function dataInit() {
@ -887,16 +1020,21 @@ var _default = {
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
_this3.inputData = res.data; _this3.inputData = res.data;
for (var i = 0; i < _this3.itemList.length; i++) { for (var i = 0; i < _this3.itemList.length; i++) {
if (!_this3.itemList[i].type_2) {
_this3.itemList[i].open_value = _this3.inputData[Number('21681') + i * 3]; _this3.itemList[i].open_value = _this3.inputData[Number('21681') + i * 3];
_this3.itemList[i].close_value = _this3.inputData[Number('21682') + i * 3]; _this3.itemList[i].close_value = _this3.inputData[Number('21682') + i * 3];
_this3.getType(21680 + i * 3, 1);
} else {
_this3.itemList[i].value = _this3.inputData[21711 + (i - 10) * 2];
_this3.getType(21710 + (i - 10) * 2, 2);
}
} }
// console.log(this.itemList);
_this3.getType('21680'); // this.getType('21680')
_this3.getType('21683'); // this.getType('21683')
_this3.getType('21686'); // this.getType('21686')
_this3.getType('21689'); // this.getType('21689')
_this3.getType('21692'); // this.getType('21692')
} }
}); });
} }
@ -1029,79 +1167,66 @@ var _default = {
padString: function padString(str, length) { padString: function padString(str, length) {
return str.padStart(length, '0'); return str.padStart(length, '0');
}, },
getType: function getType(type) { getType: function getType(type, flag) {
if (flag == 1) {
var number = this.padString(Number(this.inputData[type]).toString(2), 3); var number = this.padString(Number(this.inputData[type]).toString(2), 3);
// console.log(number); //001 // console.log(number); //001
// console.log(number[0]); //0 bit2 关闭 // console.log(number[0]); //0 bit2 关闭
// console.log(number[1]); //0 bit1 停止 // console.log(number[1]); //0 bit1 停止
// console.log(number[2]); //1 bit0 打开 // console.log(number[2]); //1 bit0 打开
if (type == '21680') { var arr = this.txt_act_list.filter(function (el) {
return el.key == type;
});
var key1 = Object.keys(arr[0])[0];
this.txt_act_list.forEach(function (el) {
if (el.key == type) {
if (Number(number[0])) { if (Number(number[0])) {
this.txt_act21680 = 3; el[key1] = 3;
} else if (Number(number[1])) { } else if (Number(number[1])) {
this.txt_act21680 = 2; el[key1] = 2;
} else if (Number(number[2])) { } else if (Number(number[2])) {
this.txt_act21680 = 1; el[key1] = 1;
} else { } else {
this.txt_act21680 = 0; el[key1] = 0;
} }
} else if (type == '21683') { }
});
} else if (flag == 2) {
var number = this.padString(Number(this.inputData[type]).toString(2), 2);
// console.log(number); //01
// console.log(number[0]); //1 bit1 关闭
// console.log(number[1]); //1 bit0 打开
var _arr = this.txt_act_list.filter(function (el) {
return el.key == type;
});
var _key = Object.keys(_arr[0])[0];
this.txt_act_list.forEach(function (el) {
if (el.key == type) {
if (Number(number[0])) { if (Number(number[0])) {
this.txt_act21683 = 3; el[_key] = 2;
} else if (Number(number[1])) { } else if (Number(number[1])) {
this.txt_act21683 = 2; el[_key] = 1;
} else if (Number(number[2])) {
this.txt_act21683 = 1;
} else { } else {
this.txt_act21683 = 0; el[_key] = 0;
} }
} else if (type == '21686') {
if (Number(number[0])) {
this.txt_act21686 = 3;
} else if (Number(number[1])) {
this.txt_act21686 = 2;
} else if (Number(number[2])) {
this.txt_act21686 = 1;
} else {
this.txt_act21686 = 0;
}
} else if (type == '21689') {
if (Number(number[0])) {
this.txt_act21689 = 3;
} else if (Number(number[1])) {
this.txt_act21689 = 2;
} else if (Number(number[2])) {
this.txt_act21689 = 1;
} else {
this.txt_act21689 = 0;
}
} else if (type == '21692') {
if (Number(number[0])) {
this.txt_act21692 = 3;
} else if (Number(number[1])) {
this.txt_act21692 = 2;
} else if (Number(number[2])) {
this.txt_act21692 = 1;
} else {
this.txt_act21692 = 0;
} }
});
} }
}, },
change00: function change00(type, index) { change00: function change00(type, index) {
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}); });
if (type == 21680) { var arr = this.txt_act_list.filter(function (el) {
this.txt_act21680 = index; return el.key == type;
} else if (type == 21683) { });
this.txt_act21683 = index; var key1 = Object.keys(arr[0])[0];
} else if (type == 21686) { this.txt_act_list.forEach(function (el) {
this.txt_act21686 = index; if (el.key == type) {
} else if (type == 21689) { el[key1] = index;
this.txt_act21689 = index;
} else if (type == 21692) {
this.txt_act21692 = index;
} }
});
if (type > 21679 && type < 21708) {
var list = ["0", "0", "0"]; var list = ["0", "0", "0"];
if (index == 1) { if (index == 1) {
list[2] = "1"; list[2] = "1";
@ -1118,6 +1243,21 @@ var _default = {
} else { } else {
list[0] = "0"; list[0] = "0";
} }
} else if (type > 21709 && type < 21729) {
var list = ["0", "0"];
if (index == 1) {
list[1] = "1";
} else {
list[1] = "0";
}
;
if (index == 2) {
list[0] = "1";
} else {
list[0] = "0";
}
;
}
var num = list.join(""); var num = list.join("");
var dataNum = { var dataNum = {
target: { target: {

File diff suppressed because one or more lines are too long