新页面补充

pull/60/head
孙萌 2023-12-01 14:34:56 +08:00
parent 277d8ebab6
commit ceefde9f94
20 changed files with 1875 additions and 42 deletions

View File

@ -200,5 +200,14 @@ export default {
getcontrol_rtDatastation(equipmentId, data) { getcontrol_rtDatastation(equipmentId, data) {
return sendGetRequest(`/getcontrol/rtDatastation?equipmentId=${equipmentId}`, data) return sendGetRequest(`/getcontrol/rtDatastation?equipmentId=${equipmentId}`, data)
} },
//控制器根据设备查看权限
getcontrol_cpermission(equipmentId, data) {
return sendPostRequest(`/getcontrol/cpermission?deviceId=${equipmentId}`, data)
},
//控制器五防接口
readControl_fiveControl(data) {
return sendGetRequest(`/readControl/fiveControl`, data);
},
}; };

View File

@ -333,6 +333,7 @@
font-family: Microsoft YaHei; font-family: Microsoft YaHei;
font-weight: 400; font-weight: 400;
color: #8BEAFF; color: #8BEAFF;
white-space: nowrap;
} }
.index .header .header-right { .index .header .header-right {
@ -488,6 +489,18 @@
height: 4px; height: 4px;
} }
.margin-none {
margin: 0 !important;
}
.padding-none {
padding: 0 !important;
}
.border-right {
border-right: 1px solid rgba(2, 148, 226, 0.5);
}
.input-main span { .input-main span {
padding: 0 10px; padding: 0 10px;
} }
@ -750,6 +763,14 @@
opacity: 0.5; opacity: 0.5;
} }
.title-tips {
font-size: 16px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #8BEAFF;
margin-top: 20px;
}
.flex-view { .flex-view {
display: flex; display: flex;
align-items: center; align-items: center;
@ -1917,6 +1938,31 @@
color: #fff; color: #fff;
} }
.wufang .flex-sel {
display: flex;
align-items: center;
padding-right: 10px;
}
.wufang .no-sel {
width: 35px;
height: 35px;
box-shadow: 0 0 15px rgba(53, 187, 247, 0.5) inset;
border: 1px solid rgba(0, 204, 255, 0.7);
border-radius: 50%;
cursor: pointer;
margin-right: 9px;
}
.wufang .sel {
width: 35px;
height: 35px;
margin-right: 9px;
background: url(../image/radio.png) no-repeat center;
background-size: 100% 100%;
cursor: pointer;
}
.dataAnalysis .page-content .search-flex { .dataAnalysis .page-content .search-flex {
display: flex; display: flex;
align-items: center; align-items: center;

File diff suppressed because one or more lines are too long

View File

@ -352,6 +352,7 @@
font-family: Microsoft YaHei; font-family: Microsoft YaHei;
font-weight: 400; font-weight: 400;
color: #8BEAFF; color: #8BEAFF;
white-space: nowrap;
} }
} }
@ -517,9 +518,16 @@
} }
} }
} }
.margin-none{
margin: 0!important;
}
.padding-none{
padding: 0!important;
}
.border-right{
border-right: 1px solid rgba(2, 148, 226, 0.5);
}
.input-main { .input-main {
span { span {
padding: 0 10px; padding: 0 10px;
} }
@ -787,7 +795,13 @@
} }
} }
} }
.title-tips{
font-size: 16px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #8BEAFF;
margin-top: 20px;
}
.flex-view { .flex-view {
display: flex; display: flex;
align-items: center; align-items: center;
@ -2036,7 +2050,31 @@
} }
} }
} }
.wufang{
.flex-sel{
display: flex;
align-items: center;
padding-right: 10px;
}
.no-sel {
width: 35px;
height: 35px;
box-shadow: 0 0 15px rgba(53, 187, 247, 0.50) inset;
border: 1px solid rgba(0, 204, 255, 0.70);
border-radius: 50%;
cursor: pointer;
margin-right: 9px;
}
.sel {
width: 35px;
height: 35px;
margin-right: 9px;
background: url(../image/radio.png) no-repeat center;
background-size: 100% 100%;
cursor: pointer;
}
}
.dataAnalysis { .dataAnalysis {
.page-content { .page-content {
.search-flex { .search-flex {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -37,7 +37,58 @@
export default { export default {
data() { data() {
return { return {
routerList: [ routerList: [],
routerNow: 'skylight',
routerIndex: 1,
purview: [],//
}
},
watch: {
"$route"(newName, oldName) {
this.gerRouter();
},
"$store.state.equipmentIndex"(newName, oldName) {
this.dataInit()
console.log(11);
},
},
mounted() {
this.gerRouter();
this.dataInit()
},
methods: {
dataInit() {
var store = this.$store.state
var data = store.equipmentList[store.equipmentIndex - 1].deviceId
this.api.getcontrol_cpermission(data).then(res => {
this.routerList = []
this.purview = res.data.data
var isParamInArray = this.purview.some(obj => obj['id'] === 8);//
var isParamInArray1 = this.purview.some(obj => obj['id'] === 9);//
if (isParamInArray) {
this.routerList.push({ name: '加热水泵', list: [], router: 'waterPump', isRouter: true, },
{ name: '地热风机', list: [], router: 'geothermalFan', isRouter: true, },
{ name: '上风口', list: [], router: 'uptake', isRouter: true, },
{ name: '下风口', list: [], router: 'downtake', isRouter: true, },
{ name: '卷被', list: [], router: 'rollByRoll', isRouter: true, },
{ name: '除雪', list: [], router: 'snowRemoval', isRouter: true, },
)
if (this.routerNow != '/waterPump'
&& this.routerNow != '/geothermalFan'
&& this.routerNow != '/uptake'
&& this.routerNow != '/downtake'
&& this.routerNow != '/rollByRoll'
&& this.routerNow != '/snowRemoval') {
this.$router.push({ path: `/waterPump` })
}
}
if (isParamInArray1) {
this.routerList.push(
{ {
name: '日光温室特殊参数(丽水项目)', router: 'skylight', list: [ name: '日光温室特殊参数(丽水项目)', router: 'skylight', list: [
{ name: '顶卷膜1', status: -1, router: 'skylight', index: 1 }, { name: '顶卷膜1', status: -1, router: 'skylight', index: 1 },
@ -57,23 +108,12 @@ export default {
}, },
{ name: '传感器输入合成', list: [], router: 'synthesis-con', isRouter: true, }, { name: '传感器输入合成', list: [], router: 'synthesis-con', isRouter: true, },
{ name: '传感器通道配置', list: [], router: 'sensorSet-con', isRouter: true, }, { name: '传感器通道配置', list: [], router: 'sensorSet-con', isRouter: true, },
{ name: '数据上传', list: [], router: 'upload-con', isRouter: true, },], { name: '数据上传', list: [], router: 'upload-con', isRouter: true, },)
routerNow: 'skylight',
routerIndex: 1,
} }
},
watch: {
"$route"(newName, oldName) {
this.gerRouter();
},
},
mounted() {
this.gerRouter();
},
methods: {
dataInit() {
})
}, },
// //

View File

@ -103,6 +103,30 @@ const routes = [
path: '/synthesis-con', path: '/synthesis-con',
name: 'synthesis-con', name: 'synthesis-con',
component: () => import('../views/page/synthesis-con.vue') component: () => import('../views/page/synthesis-con.vue')
},{
path: '/waterPump',
name: 'waterPump',
component: () => import('../views/wufang/waterPump.vue')
},{
path: '/geothermalFan',
name: 'geothermalFan',
component: () => import('../views/wufang/geothermalFan.vue')
},{
path: '/uptake',
name: 'uptake',
component: () => import('../views/wufang/uptake.vue')
},{
path: '/downtake',
name: 'downtake',
component: () => import('../views/wufang/downtake.vue')
},{
path: '/rollByRoll',
name: 'rollByRoll',
component: () => import('../views/wufang/rollByRoll.vue')
},{
path: '/snowRemoval',
name: 'snowRemoval',
component: () => import('../views/wufang/snowRemoval.vue')
},] },]
},] },]
}, },

View File

@ -50,9 +50,9 @@ export default new Vuex.Store({
{ label: '无线气象站电池电压', value: 29, countType: 2,unit:'V' }, { label: '无线气象站电池电压', value: 29, countType: 2,unit:'V' },
{ label: '无线气象站无线信号强度', value: 30, countType: 1,unit:'dBm' }, { label: '无线气象站无线信号强度', value: 30, countType: 1,unit:'dBm' },
{ label: '无线气象站信噪比SNR', value: 31, countType: 1,unit:'dB' }, { label: '无线气象站信噪比SNR', value: 31, countType: 1,unit:'dB' },
{ label: 'PM1.0', value: 32, countType: 0,unit:'μg/m2' }, { label: 'PM1.0', value: 32, countType: 0,unit:'μg/m³' },
{ label: 'PM2.5', value: 33, countType: 0,unit:'μg/m2' }, { label: 'PM2.5', value: 33, countType: 0,unit:'μg/m³' },
{ label: 'PM10', value: 34, countType: 0,unit:'μg/m2' }, { label: 'PM10', value: 34, countType: 0,unit:'μg/m³' },
{ label: '紫外辐射', value: 35, countType: 0,unit:'W/m2' }, { label: '紫外辐射', value: 35, countType: 0,unit:'W/m2' },
{ label: '蒸发量', value: 36, countType: 2,unit:'mm' }, { label: '蒸发量', value: 36, countType: 2,unit:'mm' },
{ label: '负氧离子', value: 37, countType: 0,unit:'个/cm3' }, { label: '负氧离子', value: 37, countType: 0,unit:'个/cm3' },

View File

@ -62,7 +62,7 @@ export default {
headerList: [ headerList: [
{ name: '实时数据', router: 'realTime', routerList: ['realTime'], img: require('../assets/image/header-img1.png') }, { name: '实时数据', router: 'realTime', routerList: ['realTime'], img: require('../assets/image/header-img1.png') },
// { name: '', router: 'status', index: 1, routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet'], img: require('../assets/image/header-img0.png') }, // { name: '', router: 'status', index: 1, routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet'], img: require('../assets/image/header-img0.png') },
{ name: '设定值参数', router: 'status', index: 1, routerList: ['status','skylight', 'fan','upload-con','sensorSet-con'], img: require('../assets/image/header-img0.png') }, { name: '设定值参数', router: 'status', index: 1, routerList: ['status','skylight', 'fan','upload-con','sensorSet-con','waterPump','geothermalFan','uptake','downtake','rollByRoll','snowRemoval'], img: require('../assets/image/header-img0.png') },
{ name: '设备菜单', router: '', routerList: [], img: require('../assets/image/header-img1.png') }, { name: '设备菜单', router: '', routerList: [], img: require('../assets/image/header-img1.png') },
{ name: '视频监控', router: '', routerList: [], img: require('../assets/image/header-img2.png') }, { name: '视频监控', router: '', routerList: [], img: require('../assets/image/header-img2.png') },
// history history // history history
@ -78,7 +78,7 @@ export default {
activeNames: [3], activeNames: [3],
leftList: [ leftList: [
{ name: '首页', img: require('../assets/image/index-icon.png'), list: [], router: 'realTime', isRouter: true, }, { name: '首页', img: require('../assets/image/index-icon.png'), list: [], router: 'realTime', isRouter: true, },
{ name: '温室', routerList: ['realTime', 'skylight', 'control','fan','upload-con','sensorSet-con','synthesis-con'], img: require('../assets/image/left-img0.png'), list: [] }, { name: '温室', routerList: ['realTime', 'skylight', 'control','fan','upload-con','sensorSet-con','synthesis-con','waterPump','geothermalFan','uptake','downtake','rollByRoll','snowRemoval'], img: require('../assets/image/left-img0.png'), list: [] },
// { name: '', img: require('../assets/image/left-img1.png'), list: [] }, // { name: '', img: require('../assets/image/left-img1.png'), list: [] },
{ name: '施肥机', routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet', 'realTime', 'history', 'dataAnalysis'], img: require('../assets/image/left-img2.png'), list: [] },], { name: '施肥机', routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet', 'realTime', 'history', 'dataAnalysis'], img: require('../assets/image/left-img2.png'), list: [] },],
routerNow: 'realTime', routerNow: 'realTime',

View File

@ -0,0 +1,273 @@
<template>
<div class="waterPump wufang">
<div class="table-title">
<img src="../../assets/img/downtake.png" alt=""> 下风口
</div>
<div class="title-tips">下风口有效性设置</div>
<div class="flex-view">
<div class="input-btn">
<div class="btn" @click="changeOpen(1)" :class="openIndex == 1 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet2.png" alt="" />自动运行
</div>
<div class="btn" @click="changeOpen(2)" :class="openIndex == 2 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet3.png" alt="" />手动打开
</div>
<div class="btn" @click="changeOpen(3)" :class="openIndex == 3 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />手动关闭
</div>
<div class="btn" @click="changeOpen(4)" :class="openIndex == 4 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />停止
</div>
</div>
</div>
<div class="flex-view">
<div class="flex-sel padding-none" @click="changeOpenTrue()">
<div v-if="!openTrue" class="no-sel margin-none"></div>
<div v-else class="sel margin-none"></div>
</div>
<div class="input-main">
<span>室外温度大于</span>
<input @blur="blurChangeCount('21544', $event)" v-model="inputData['21544']" @input="changeCountData('21544', $event)"
type="text" value="60" placeholder="60" />
<span>打开下风口</span>
</div>
</div>
<div class="flex-view">
<div class="input-main">
<div>上风口全部打开 (100%) </div>
<input @blur="blurChange('21543', $event)" v-model="inputData['21543']" @input="change('21543', $event)"
type="text" value="60" placeholder="60" />
<span>分钟温度降不下来打开下风口</span>
</div>
</div>
<div class="flex-view border-none">
<div class="input-main">
<div>下风口的行程时间</div>
<input @blur="blurChange('21545', $event)" v-model="inputData['21545']" @input="change('21545', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
<div class="input-main">
<div>展开的输出通道</div>
<input @blur="blurChange('21546', $event)" v-model="inputData['21546']" @input="change('21546', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
<div class="input-main">
<div>关闭的输出通道</div>
<input @blur="blurChange('21547', $event)" v-model="inputData['21547']" @input="change('21547', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
openIndex: 1,
inputData: {},
openTrue: false,
}
},
mounted() {
this.dataInit();
//input
let inputList = document.querySelectorAll('input');
for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue;//input
}
},
methods: {
changeOpenTrue() {
this.openTrue = !this.openTrue
var dataNum = {
target: {
value: this.openTrue ? 1 : 0,
},
};
this.changeBtn('21542', dataNum);
},
padString(str, length) {
return str.padStart(length, '0');
},
changeOpen(index) {
this.openIndex = index
var dataNum = {
target: {
value: this.openIndex,
},
};
this.changeBtn(21541, dataNum);
},
// x/10
blurChange10(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value * 10,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
// x/10
changeCount10(code, el) {
var data = el.target.value * 10
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
//
blurChangeCount(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: (el.target.value * 10) + 400,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeCountData(code, el) {
var data = (el.target.value * 10) + 400
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
countData(data) {
if (data) {
return (data - 400) / 10
} else {
return 0
}
},
// x/10
countData10(data) {
if (data) {
return data / 10
} else {
return 0
}
},
dataInit() {
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readControl_fiveControl(data).then(res => {
if(res.data.code==200){
this.inputData = res.data.data
this.openIndex = this.inputData['21541']
this.openTrue = this.inputData['21542'] == 0 ? false : true
this.inputData['21544'] = this.countData(this.inputData['21544'])
}
})
},
//
selectValue(e) {
e.currentTarget.select();
},
//
blurChange(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeBtn(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimerBtn(0, data);
},
//btn j*100
delayTimerBtn(i, data) {
const that = this;
//
let j = this.$store.state.lateSendBtn;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
change(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimer(0, data);
},
// j*100
delayTimer(i, data) {
const that = this;
//
let j = this.$store.state.lateSend;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
changeData(data) {
this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: "success",
});
this.dataInit();
} else {
this.$message.error("请求出错");
}
this.timer = null
});
},
},
}
</script>
<style lang="scss"></style>

View File

@ -0,0 +1,246 @@
<template>
<div class="waterPump">
<div class="table-title">
<img src="../../assets/img/geothermalFan.png" alt=""> 地热风机
</div>
<div class="title-tips">地热风机有效性设置</div>
<div class="flex-view">
<div class="input-btn">
<div class="btn" @click="changeOpen(1)" :class="openIndex == 1 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet2.png" alt="" />自动运行
</div>
<div class="btn" @click="changeOpen(2)" :class="openIndex == 2 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet3.png" alt="" />手动打开
</div>
<div class="btn" @click="changeOpen(3)" :class="openIndex == 3 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />手动关闭
</div>
<div class="btn" @click="changeOpen(4)" :class="openIndex == 4 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />停止
</div>
</div>
</div>
<div class="flex-view border-none">
<div class="input-main">
<span>室内1#平均温度高于</span>
<input @blur="blurChangeCount('21527', $event)" v-model="inputData['21527']"
@input="changeCountData('21527', $event)" type="text" value="60" placeholder="60" />
<span>启动</span>
</div>
</div>
<div class="flex-view border-none">
<div class="input-main">
<span style="width: 167px; display: inline-block;">滞回带</span>
<input @blur="blurChange10('21528', $event)" v-model="inputData['21528']"
@input="changeCount10('21528', $event)" type="text" value="60" placeholder="60" />
<span></span>
</div>
</div>
<div class="flex-view border-none">
<div class="input-main">
<span style="width: 167px; display: inline-block;">打开或关闭输出通道</span>
<input @blur="blurChange('21529', $event)" v-model="inputData['21529']"
@input="change('21529', $event)"
type="text" value="60" placeholder="60" />
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
openIndex: 1,
inputData: {},
}
},
mounted() {
this.dataInit();
//input
let inputList = document.querySelectorAll('input');
for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue;//input
}
},
methods: {
padString(str, length) {
return str.padStart(length, '0');
},
changeOpen(index) {
this.openIndex = index
var dataNum = {
target: {
value: this.openIndex,
},
};
this.changeBtn(21526, dataNum);
},
// x/10
blurChange10(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value * 10,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
// x/10
changeCount10(code, el) {
var data = el.target.value * 10
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
//
blurChangeCount(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: (el.target.value * 10) + 400,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeCountData(code, el) {
var data = (el.target.value * 10) + 400
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
countData(data) {
if (data) {
return (data - 400) / 10
} else {
return 0
}
},
// x/10
countData10(data) {
if (data) {
return data / 10
} else {
return 0
}
},
dataInit() {
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readControl_fiveControl(data).then(res => {
if(res.data.code==200){
this.inputData = res.data.data
this.openIndex = this.inputData['21526']
this.inputData['21527'] = this.countData(this.inputData['21527'])
this.inputData['21528'] = this.countData10(this.inputData['21528'])
}
})
},
//
selectValue(e) {
e.currentTarget.select();
},
//
blurChange(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeBtn(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimerBtn(0, data);
},
//btn j*100
delayTimerBtn(i, data) {
const that = this;
//
let j = this.$store.state.lateSendBtn;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
change(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimer(0, data);
},
// j*100
delayTimer(i, data) {
const that = this;
//
let j = this.$store.state.lateSend;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
changeData(data) {
this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: "success",
});
this.dataInit();
} else {
this.$message.error("请求出错");
}
this.timer = null
});
},
},
}
</script>
<style lang="scss"></style>

View File

@ -0,0 +1,344 @@
<template>
<div class="waterPump wufang">
<div class="table-title">
<img src="../../assets/img/rollByRoll.png" alt=""> 卷被
</div>
<div class="title-tips">卷被有效性设置</div>
<div class="flex-view">
<div class="input-btn">
<div class="btn" @click="changeOpen(1)" :class="openIndex == 1 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet2.png" alt="" />自动运行
</div>
<div class="btn" @click="changeOpen(2)" :class="openIndex == 2 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet3.png" alt="" />手动打开
</div>
<div class="btn" @click="changeOpen(3)" :class="openIndex == 3 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />手动关闭
</div>
<div class="btn" @click="changeOpen(4)" :class="openIndex == 4 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />停止
</div>
</div>
</div>
<div class="flex-view">
<div class="flex-sel padding-none" v-if="openTrue.length" @click="changeOpenTrue(0)">
<div v-if="openTrue[0]==0" class="no-sel margin-none"></div>
<div v-else class="sel margin-none"></div>
</div>
<div class="input-main">
<span>①室外光照大于</span>
<input @blur="blurChange10('21550', $event)"
v-model="inputData['21550']"
@input="changeCount10('21550', $event)"
type="text" value="60" placeholder="60" />
<span>klx收拢卷被</span>
</div>
</div>
<div class="flex-view">
<div class="flex-sel padding-none" v-if="openTrue.length" @click="changeOpenTrue(1)">
<div v-if="openTrue[1]==0" class="no-sel margin-none"></div>
<div v-else class="sel margin-none"></div>
</div>
<div class="input-main">
<span>②日出</span>
<input @blur="blurChange('21551', $event)"
v-model="inputData['21551']"
@input="change('21551', $event)"
type="text" value="60" placeholder="60" />
<span>分钟收拢卷被</span>
</div>
</div>
<div class="flex-view">
<div class="flex-sel padding-none" v-if="openTrue.length" @click="changeOpenTrue(2)">
<div v-if="openTrue[2]==0" class="no-sel margin-none"></div>
<div v-else class="sel margin-none"></div>
</div>
<div class="input-main">
<span>③室内1#平均温度低于</span>
<input @blur="blurChangeCount('21552', $event)"
v-model="inputData['21552']"
@input="changeCountData('21552', $event)"
type="text" value="60" placeholder="60" />
<span>展开卷被</span>
</div>
</div>
<div class="flex-view">
<div class="flex-sel padding-none" v-if="openTrue.length" @click="changeOpenTrue(3)">
<div v-if="openTrue[3]==0" class="no-sel margin-none"></div>
<div v-else class="sel margin-none"></div>
</div>
<div class="input-main">
<span>④日落前</span>
<input @blur="blurChange('21553', $event)"
v-model="inputData['21553']"
@input="change('21553', $event)"
type="text" value="60" placeholder="60" />
<span>分钟展开卷被</span>
</div>
</div>
<div class="flex-view border-none">
<div class="input-main">
<div>卷被的行程时间</div>
<input @blur="blurChange('21554', $event)"
v-model="inputData['21554']"
@input="change('21554', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
<div class="input-main">
<div>卷被开窗的行程时间</div>
<input @blur="blurChange('21555', $event)"
v-model="inputData['21555']"
@input="change('21555', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
<div class="input-main">
<div>展开的输出通道</div>
<input @blur="blurChange('21556', $event)"
v-model="inputData['21556']"
@input="change('21556', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
<div class="input-main">
<div>收拢的输出通道</div>
<input @blur="blurChange('21557', $event)" v-model="inputData['21557']" @input="change('21557', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
openIndex: 1,
inputData: {},
openTrue: [],
}
},
mounted() {
this.dataInit();
//input
let inputList = document.querySelectorAll('input');
for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue;//input
}
},
methods: {
//
myReverse(arr) {
return [...arr].reverse()
},
padString(str, length) {
return str.padStart(length, '0');
},
changeOpenTrue(index) {
if( this.openTrue[index]==0){
this.openTrue[index]=1
}else{
this.openTrue[index]=0
}
this.$forceUpdate();
var num=this.myReverse(this.openTrue).join("")
var dataNum = {
target: {
value: parseInt(num, 2),
},
};
this.changeBtn('21549', dataNum);
},
padString(str, length) {
return str.padStart(length, '0');
},
changeOpen(index) {
this.openIndex = index
var dataNum = {
target: {
value: this.openIndex,
},
};
this.changeBtn(21548, dataNum);
},
// x/10
blurChange10(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value * 10,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
// x/10
changeCount10(code, el) {
var data = el.target.value * 10
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
//
blurChangeCount(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: (el.target.value * 10) + 400,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeCountData(code, el) {
var data = (el.target.value * 10) + 400
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
countData(data) {
if (data) {
return (data - 400) / 10
} else {
return 0
}
},
// x/10
countData10(data) {
if (data) {
return data / 10
} else {
return 0
}
},
get21549(){
var num1 = this.inputData['21549']
var num11 = this.padString(num1.toString(2), 4)
var openList1New
openList1New = num11.split("")
this.openTrue= openList1New.reverse()
},
dataInit() {
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readControl_fiveControl(data).then(res => {
console.log(res, 111);
if(res.data.code==200){
this.inputData = res.data.data
this.openIndex = this.inputData['21548']
this.get21549()
this.inputData['21552'] = this.countData(this.inputData['21552'])
this.inputData['21550'] = this.countData10(this.inputData['21550'])
}
})
},
//
selectValue(e) {
e.currentTarget.select();
},
//
blurChange(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeBtn(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimerBtn(0, data);
},
//btn j*100
delayTimerBtn(i, data) {
const that = this;
//
let j = this.$store.state.lateSendBtn;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
change(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimer(0, data);
},
// j*100
delayTimer(i, data) {
const that = this;
//
let j = this.$store.state.lateSend;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
changeData(data) {
this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: "success",
});
this.dataInit();
} else {
this.$message.error("请求出错");
}
this.timer = null
});
},
},
}
</script>
<style lang="scss"></style>

View File

@ -0,0 +1,262 @@
<template>
<div class="waterPump wufang">
<div class="table-title">
<img src="../../assets/img/snowRemoval.png" alt=""> 除雪
</div>
<div class="title-tips">除雪有效性设置</div>
<div class="flex-view">
<div class="input-btn">
<div class="btn" @click="changeOpen(1)" :class="openIndex == 1 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet2.png" alt="" />自动除雪
</div>
<div class="btn" @click="changeOpen(2)" :class="openIndex == 2 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet3.png" alt="" />手动打开
</div>
<div class="btn" @click="changeOpen(3)" :class="openIndex == 3 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />手动关闭
</div>
</div>
</div>
<div class="flex-view">
<div class="input-main">
<span>一键除雪</span>
</div>
<div class="flex-sel">
<div v-if="!openTrue" class="no-sel" @click="changeOpenTrue(true)"></div>
<div v-else class="sel" ></div>
启动
</div>
<div class="flex-sel">
<div v-if="openTrue" class="no-sel" @click="changeOpenTrue(false)"></div>
<div v-else class="sel" ></div>
关闭
</div>
</div>
<div class="flex-view border-none">
<div class="input-main">
<div>除雪时间</div>
<input @blur="blurChange('21560', $event)"
v-model="inputData['21560']"
@input="change('21560', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
<div class="input-main">
<div>打开或关闭输出通道</div>
<input @blur="blurChange('21561', $event)"
v-model="inputData['21561']"
@input="change('21561', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
openIndex: 1,
inputData: {},
openTrue: false,
}
},
mounted() {
this.dataInit();
//input
let inputList = document.querySelectorAll('input');
for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue;//input
}
},
methods: {
changeOpenTrue(istrue) {
this.openTrue = istrue
var dataNum = {
target: {
value: this.openTrue ? 1 : 0,
},
};
this.changeBtn(21559, dataNum);
},
padString(str, length) {
return str.padStart(length, '0');
},
changeOpen(index) {
this.openIndex = index
var dataNum = {
target: {
value: this.openIndex,
},
};
this.changeBtn(21558, dataNum);
},
// x/10
blurChange10(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value * 10,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
// x/10
changeCount10(code, el) {
var data = el.target.value * 10
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
//
blurChangeCount(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: (el.target.value * 10) + 400,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeCountData(code, el) {
var data = (el.target.value * 10) + 400
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
countData(data) {
if (data) {
return (data - 400) / 10
} else {
return 0
}
},
// x/10
countData10(data) {
if (data) {
return data / 10
} else {
return 0
}
},
dataInit() {
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readControl_fiveControl(data).then(res => {
console.log(res, 111);
this.inputData = res.data.data
this.openIndex = this.inputData['21558']
this.openTrue = this.inputData['21559'] == 0 ? false : true
this.inputData['21544'] = this.countData(this.inputData['21544'])
})
},
//
selectValue(e) {
e.currentTarget.select();
},
//
blurChange(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeBtn(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimerBtn(0, data);
},
//btn j*100
delayTimerBtn(i, data) {
const that = this;
//
let j = this.$store.state.lateSendBtn;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
change(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimer(0, data);
},
// j*100
delayTimer(i, data) {
const that = this;
//
let j = this.$store.state.lateSend;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
changeData(data) {
this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: "success",
});
this.dataInit();
} else {
this.$message.error("请求出错");
}
this.timer = null
});
},
},
}
</script>
<style lang="scss"></style>

View File

@ -0,0 +1,294 @@
<template>
<div class="waterPump wufang">
<div class="table-title">
<img src="../../assets/img/uptake.png" alt=""> 上风口
</div>
<div class="title-tips">上风口有效性设置</div>
<div class="flex-view">
<div class="input-btn">
<div class="btn" @click="changeOpen(1)" :class="openIndex == 1 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet2.png" alt="" />自动运行
</div>
<div class="btn" @click="changeOpen(2)" :class="openIndex == 2 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet3.png" alt="" />手动打开
</div>
<div class="btn" @click="changeOpen(3)" :class="openIndex == 3 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />手动关闭
</div>
<div class="btn" @click="changeOpen(4)" :class="openIndex == 4 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />停止
</div>
</div>
</div>
<div class="flex-view">
<div class="input-main border-right">
<span>室内1#平均温度达到</span>
<input @blur="blurChangeCount('21532', $event)" v-model="inputData['21532']"
@input="changeCountData('21532', $event)" type="text" value="60" placeholder="60" />
<span>启动</span>
</div>
<div class="input-main border-right">
<span>滞回带</span>
<input @blur="blurChange10('21533', $event)" v-model="inputData['21533']"
@input="changeCount10('21533', $event)" type="text" value="60" placeholder="60" />
<span></span>
</div>
<div class="input-main border-right">
<span></span>
<input @blur="blurChange('21534', $event)" v-model="inputData['21534']" @input="change('21534', $event)"
type="text" value="60" placeholder="60" />
<span>步打开</span>
</div>
<div class="input-main">
<span>分步打开间隔时间</span>
<input @blur="blurChange('21537', $event)" v-model="inputData['21537']" @input="change('21537', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
</div>
<div class="flex-view">
<div class="flex-sel border-right" @click="changeOpenTrue()">
<div v-if="!openTrue" class="no-sel"></div>
<div v-else class="sel"></div>
计算的最大开度
</div>
<div class="input-main border-right">
<span>最大开度</span>
<span>{{ inputData['21535'] }}</span>
<span>%</span>
</div>
<div class="input-main">
<span>开度系数</span>
<input @blur="blurChange('21536', $event)" v-model="inputData['21536']" @input="change('21536', $event)"
type="text" value="60" placeholder="60" />
</div>
</div>
<div class="flex-view border-none">
<div class="input-main">
<div>上风口的行程时间</div>
<input @blur="blurChange('21538', $event)" v-model="inputData['21538']" @input="change('21538', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
<div class="input-main">
<div>展开的输出通道</div>
<input @blur="blurChange('21539', $event)" v-model="inputData['21539']" @input="change('21539', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
<div class="input-main">
<div>收拢的输出通道</div>
<input @blur="blurChange('21540', $event)" v-model="inputData['21540']" @input="change('21540', $event)"
type="text" value="60" placeholder="60" />
<span></span>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
openIndex: 1,
inputData: {},
openTrue: false,
}
},
mounted() {
this.dataInit();
//input
let inputList = document.querySelectorAll('input');
for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue;//input
}
},
methods: {
changeOpenTrue() {
this.openTrue = !this.openTrue
var dataNum = {
target: {
value: this.openTrue ? 1 : 0,
},
};
this.changeBtn('21531', dataNum);
},
padString(str, length) {
return str.padStart(length, '0');
},
changeOpen(index) {
this.openIndex = index
var dataNum = {
target: {
value: this.openIndex,
},
};
this.changeBtn(21530, dataNum);
},
// x/10
blurChange10(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value * 10,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
// x/10
changeCount10(code, el) {
var data = el.target.value * 10
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
//
blurChangeCount(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: (el.target.value * 10) + 400,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeCountData(code, el) {
var data = (el.target.value * 10) + 400
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
countData(data) {
if (data) {
return (data - 400) / 10
} else {
return 0
}
},
// x/10
countData10(data) {
if (data) {
return data / 10
} else {
return 0
}
},
dataInit() {
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readControl_fiveControl(data).then(res => {
if(res.data.code==200){
this.inputData = res.data.data
this.openIndex = this.inputData['21530']
this.openTrue = this.inputData['21531']==0?false:true
this.inputData['21532'] = this.countData(this.inputData['21532'])
this.inputData['21533'] = this.countData10(this.inputData['21533'])
}
})
},
//
selectValue(e) {
e.currentTarget.select();
},
//
blurChange(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeBtn(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimerBtn(0, data);
},
//btn j*100
delayTimerBtn(i, data) {
const that = this;
//
let j = this.$store.state.lateSendBtn;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
change(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimer(0, data);
},
// j*100
delayTimer(i, data) {
const that = this;
//
let j = this.$store.state.lateSend;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
changeData(data) {
this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: "success",
});
this.dataInit();
} else {
this.$message.error("请求出错");
}
this.timer = null
});
},
},
}
</script>
<style lang="scss"></style>

View File

@ -0,0 +1,257 @@
<template>
<div class="waterPump">
<div class="table-title">
<img src="../../assets/img/waterPump.png" alt=""> 加热水泵
</div>
<div class="flex-view">
<div class="input-btn">
<div class="btn" @click="changeOpen(1)" :class="openIndex == 1 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet2.png" alt="" />自动运行
</div>
<div class="btn" @click="changeOpen(2)" :class="openIndex == 2 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet3.png" alt="" />手动打开
</div>
<div class="btn" @click="changeOpen(3)" :class="openIndex == 3 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />手动关闭
</div>
</div>
</div>
<div class="flex-view border-none">
<div class="input-main border-right">
<span>室内1#平均温度白天时段高于</span>
<input @blur="blurChangeCount('21521', $event)" v-model="inputData['21521']"
@input="changeCountData('21521', $event)" type="text" value="60" placeholder="60" />
<span>启动</span>
</div>
<div class="input-main">
<span>滞回带</span>
<input @blur="blurChange10('21522', $event)" v-model="inputData['21522']"
@input="changeCount10('21522', $event)" type="text" value="60" placeholder="60" />
<span></span>
</div>
</div>
<div class="flex-view border-none">
<div class="input-main">
<span>室内1#平均温度夜间时段低于</span>
<input @blur="blurChangeCount('21523', $event)" v-model="inputData['21523']"
@input="changeCountData('21523', $event)" type="text" value="60" placeholder="60" />
<span>启动</span>
</div>
</div>
<div class="flex-view border-none">
<div class="input-main">
<span>室内1#平均温度夜间时段低于</span>
<input @blur="blurChangeCount('21524', $event)" v-model="inputData['21524']"
@input="changeCountData('21524', $event)" type="text" value="60" placeholder="60" />
<span>启动</span>
</div>
</div>
<div class="flex-view border-none">
<div class="input-main">
<span style="width: 231px; display: inline-block;">打开或关闭输出通道</span>
<input @blur="blurChange('21525', $event)" v-model="inputData['21525']"
@input="change('21525', $event)" type="text" value="60" placeholder="60" />
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
openIndex: 1,
inputData: {},
}
},
mounted() {
this.dataInit();
//input
let inputList = document.querySelectorAll('input');
for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue;//input
}
},
methods: {
padString(str, length) {
return str.padStart(length, '0');
},
changeOpen(index) {
this.openIndex = index
var dataNum = {
target: {
value: this.openIndex,
},
};
this.changeBtn(21520, dataNum);
},
// x/10
blurChange10(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value * 10,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
// x/10
changeCount10(code, el) {
var data = el.target.value * 10
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
//
blurChangeCount(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: (el.target.value * 10) + 400,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeCountData(code, el) {
var data = (el.target.value * 10) + 400
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
countData(data) {
if (data) {
return (data - 400) / 10
} else {
return 0
}
},
// x/10
countData10(data) {
if (data) {
return data / 10
} else {
return 0
}
},
dataInit() {
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readControl_fiveControl(data).then(res => {
if(res.data.code==200){
this.inputData = res.data.data
this.openIndex = this.inputData['21520']
this.inputData['21521'] = this.countData(this.inputData['21521'])
this.inputData['21522'] = this.countData10(this.inputData['21522'])
this.inputData['21523'] = this.countData(this.inputData['21523'])
this.inputData['21524'] = this.countData(this.inputData['21524'])
}
})
},
//
selectValue(e) {
e.currentTarget.select();
},
//
blurChange(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
}; //
if (this.timer) {
this.timer && clearInterval(this.timer);
this.changeData(data);
}
},
changeBtn(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimerBtn(0, data);
},
//btn j*100
delayTimerBtn(i, data) {
const that = this;
//
let j = this.$store.state.lateSendBtn;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
change(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimer(0, data);
},
// j*100
delayTimer(i, data) {
const that = this;
//
let j = this.$store.state.lateSend;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
},
changeData(data) {
this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: "success",
});
this.dataInit();
} else {
this.$message.error("请求出错");
}
this.timer = null
});
},
},
}
</script>
<style lang="scss"></style>