pc-master #163

Merged
xiaomeng merged 4 commits from pc-master into portal 2024-08-23 07:24:58 +00:00
21 changed files with 3200 additions and 22 deletions

View File

@ -14,7 +14,7 @@ function sendGetRequest(url, data) {
params: data
})
.then(function (res) { //请求成功response接收返回参数
if (res.data.code == 401) {
if (res.data.code == 403) {
localStorage.removeItem('token')
router.push({
name: 'login'
@ -41,7 +41,7 @@ function sendUploadRequest(url, data) {
}
}).then(
(res) => {
if (res.data.code == 401) {
if (res.data.code == 403) {
localStorage.removeItem('token')
router.push({
name: 'login'
@ -631,4 +631,53 @@ getIccid(data){
controlReadValuedownload(data) {
return sendPostRequest(`/control/read/value?devicecode=${data}`,'')
},
// 智能灌注
//主页查看智能灌溉控制器
getFi_rtdata(data) {
return sendGetRequest(`/getFi/rtdata`, data)
},
//当天折线图
chart_fidata(data) {
return sendPostRequest(`/chart/fidata?equipmentId=${data}`,'')
},
//智能灌溉1
readFi_irrigate(url,data) {
return sendGetRequest(url, data)
},
//智能灌溉写入
postwriteFi_write(data) {
return sendPostRequest("/writeFi/write", data);
},
//智能灌溉状态值
getFI_getState(data) {
return sendGetRequest("/getFI/getState", data);
},
//智能灌溉系统参数
readControl_getFIIccid(data) {
return sendGetRequest("/readControl/getFIIccid", data);
},
//智能灌溉系统导入txt的
upLoadFIwritevalue(data) {
return sendUploadRequest(`/FI/write/value`, data)
},
//智能灌溉系统导出下载txt
FIreadvaluedownload(data) {
return sendPostRequest(`/FI/read/value?devicecode=${data}`,'')
},
//智能灌溉系统数据上传
readFi_datauploadfi(data) {
return sendGetRequest("/readFi/datauploadfi", data);
},
//智能灌溉固有参数
readFi_intrinsicparameterfi(data) {
return sendGetRequest("/readFi/intrinsicparameterfi", data);
},
//智能灌溉传感器通道
readFi_sensorchannelfi(data) {
return sendGetRequest("/readFi/sensorchannelfi", data);
},
};

View File

@ -1221,6 +1221,10 @@
cursor: pointer;
}
.irrigateSet .open-btn.w-250 {
width: 250px;
}
.irrigateSet .open-btn > img {
margin-right: 10px;
}

File diff suppressed because one or more lines are too long

View File

@ -1284,7 +1284,9 @@
color: #00C8FF;
margin: 7.5px 10px;
cursor: pointer;
&.w-250{
width: 250px;
}
>img {
margin-right: 10px;
}

View File

@ -0,0 +1,225 @@
<template>
<div class="set-params collapse scroll">
<div class="set-top">
<img src="../assets/image/set-icon.png" alt="">设定值参数
</div>
<!-- -->
<div class="set-tips" @click="toHome($store.state.equipmentIndex)">
<div >
{{ $store.state.equipmentList[$store.state.equipmentIndex - 1].deviceTypeName }}</div>
</div>
<el-collapse v-model="$store.state.activeNames">
<template v-for="item, index in routerList">
<el-collapse-item :class="routerNow == item.router ? 'active' : ''" :name="index + 1" :key="index"
v-if="!item.isRouter">
<template slot="title" class="collapse-title">
<span class="name">{{ item.name }}</span>
</template>
<!-- -->
<ul class="table-ul">
<li @click="toRouter(item1)"
:class="routerNow == item1.router && routerIndex == index1 + 1 ? 'active' : ''" class="table-li"
v-for="item1, index1 in item.list" :key="index1">{{
item1.name }} <div class="status" :class="item1.status == 0 ? 'outline' : 'online'"
v-if="item1.status >= 0">{{ item1.status
== 0
? '离线' : '在线' }}</div>
</li>
</ul>
</el-collapse-item>
<div @click="toRouter(item)" :class="routerNow == item.router ? 'active' : ''" class="no-list" v-else>{{
item.name
}}</div>
</template>
</el-collapse>
</div>
</template>
<script>
export default {
data() {
return {
routerList: [
// { name: '', list: [], router: 'formula' },
{ name: `${ this.$store.state.equipmentList[this.$store.state.equipmentIndex - 1].deviceTypeName }状态显示`, list: [], router: 'status-soil', isRouter: true, },
{
name: '灌溉组配置', router: 'irrigateSet-soil', list: [
{ name: '1#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 1 },
{ name: '2#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 2 },
{ name: '3#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 3 },
{ name: '4#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 4 },
{ name: '5#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 5 },
{ name: '6#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 6 },
{ name: '7#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 7 },
{ name: '8#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 8 },
{ name: '9#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 9 },
{ name: '10#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 10 },
{ name: '11#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 11 },
{ name: '12#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 12 },
{ name: '13#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 13 },
{ name: '14#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 14 },
{ name: '15#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 15 },
{ name: '16#灌溉组配置', status: -1, router: 'irrigateSet-soil', index: 16 }]
},
{ name: '固有参数', list: [], router: 'intrinsicParameter-soil', isRouter: true, },
{ name: '系统参数配置', list: [], router: 'systemSet-soil', isRouter: true, },
{ name: '传感器通道配置', list: [], router: 'sensorSet-soil', isRouter: true, },
{ name: '数据上传', list: [], router: 'upload-soil', isRouter: true, },],
routerNow: 'irrigateSet-soil',
routerIndex: 1,
}
},
watch: {
"$route"(newName, oldName) {
this.gerRouter();
},
},
mounted() {
this.gerRouter();
this.dataInit()
},
methods: {
///
getByid() {
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.getByid(data).then((res) => {
if (res.data.code == 200) {
store.equipmentName = res.data.data
this.getList()
} else {
this.$message.error(res.data.msg);
}
this.loading = false
});
},
dataInit() {
// var store = this.$store.state
// if(!store.equipmentName){
// this.getByid()
// }else{
// this.getList()
// }
},
getList(){
var store = this.$store.state
// store.nameList.forEach((el, index) => {
// if (index < 8) {
// if (store.equipmentName['fertilization' + store.nameList[index]]) {
// // store.equipmentName['fertilization'+store.nameList[index]]
// this.routerList[0].list.push({
// name: '' + (index + 1),
// status: -1,
// index: index + 1,
// router: 'formula'
// })
// }
// }
// // if (store.equipmentName['solenoid' + store.nameList[index]]) {
// // // store.equipmentName['fertilization'+store.nameList[index]]
// // this.routerList[1].list.push({
// // name: store.equipmentName['solenoid' + store.nameList[index]],
// // status: -1,
// // index: index + 1,
// // router: 'irrigateSet'
// // })
// // }
// })
},
//
toHome(index) {
this.$router.push({ path: `/status-soil` })
},
gerRouter() {
this.routerNow = this.$route.name;
this.routerIndex = this.$route.query.id ? this.$route.query.id : 1
},
toRouter(item) {
if (item.router) {
if (item.http) {
window.location.href = item.http;
} else if (item.router == 'irrigateSet-soil' && this.$route.query.id != item.index) {
this.$router.push({ path: `/irrigateSet-soil?id=${item.index}` })
}
// else if (item.router == 'formula' && this.$route.query.id != item.index) {
// this.$router.push({ path: `/formula?id=${item.index}` })
// }
else if (item.router != this.routerNow && !item.http) {
this.$router.push({ name: item.router })
}
}
},
},
}
</script>
<style lang="scss" scoped>
.set-params {
width: 280px;
height: 100%;
background: rgba(0, 92, 178, 0.15);
border: 2px solid rgba(0, 186, 255, 0.20);
.set-top {
font-size: 20px;
font-family: Microsoft YaHei;
font-weight: bold;
color: #FFFFFF;
width: 100%;
padding-left: 20px;
display: flex;
align-items: center;
padding-top: 20px;
img {
width: 40px;
height: 40px;
margin-right: 10px;
}
}
.el-collapse-item {
&.active {}
}
.no-list {
color: #A8B6C8;
&.active {
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.3);
color: #fff;
}
}
.set-tips {
width: 100%;
border-bottom: 1px solid rgba(168, 182, 200, 0.2);
margin-top: 17px;
padding-bottom: 17px;
padding-left: 10px;
cursor: pointer;
>div {
width: 220px;
height: 40px;
// background: rgba(255, 255, 255, 0.1);
// border: 1px solid rgba(255, 255, 255, 0.3);
display: flex;
align-items: center;
padding-left: 10px;
}
}
}
</style>

View File

@ -4,6 +4,7 @@ import HomeView from '../views/HomeView.vue'
import index from '../views/index.vue'
import login from '../views/login.vue'
import control from '../views/control.vue'
import soil from '../views/soil.vue'
Vue.use(VueRouter)
const routes = [
@ -132,7 +133,8 @@ const routes = [
name: 'videoManage',
component: () => import('../views/manage/videoManage.vue')
},]
}, {
},
{
path: '/control',
name: 'control',
component: control,
@ -257,6 +259,37 @@ const routes = [
name: 'facadeInsulation',
component: () => import('../views/page/facadeInsulation.vue')
},]
},
{
path: '/soil',
name: 'soil',
component: soil,
redirect: '/irrigateSet-soil',
children: [{
path: '/irrigateSet-soil',
name: 'irrigateSet-soil',
component: () => import('../views/page/irrigateSet-soil.vue')
},{
path: '/intrinsicParameter-soil',
name: 'intrinsicParameter-soil',
component: () => import('../views/page/intrinsicParameter-soil.vue')
},{
path: '/systemSet-soil',
name: 'systemSet-soil',
component: () => import('../views/page/systemSet-soil.vue')
},{
path: '/upload-soil',
name: 'upload-soil',
component: () => import('../views/page/upload-soil.vue')
},{
path: '/sensorSet-soil',
name: 'sensorSet-soil',
component: () => import('../views/page/sensorSet-soil.vue')
},{
path: '/status-soil',
name: 'status-soil',
component: () => import('../views/page/status-soil.vue')
},]
},]
},

View File

@ -26,9 +26,3 @@ export default {
</script>
<style lang="scss">
</style>

View File

@ -30,7 +30,7 @@
<template v-for="item, index in leftList">
<el-collapse-item :name="index + 1" :key="index" v-if="!item.isRouter">
<template slot="title" class="collapse-title">
<div class="img"><img :src="item.img" alt=""></div> {{ item.name }}
<div class="img"><img style="width: 16px;":src="item.img" alt=""></div> {{ item.name }}
</template>
<ul class="table-ul">
<li class="table-li" @click="toRouter1(item1)"
@ -111,6 +111,7 @@ export default {
{ name: '温室', routerList: ['realTime', 'dataAnalysis', 'historyData', 'exitSettings', 'videoMonitoring','imageData', 'skylight', 'control', 'systemSet-con', 'fan', 'upload-con', 'sensorSet-con', 'synthesis-con', 'alarmSettings', 'waterPump', 'geothermalFan', 'uptake', 'downtake', 'rollByRoll', 'snowRemoval', "targetTemperature", "targetHumidity", "targetCo2", "sunroofControl", "outsizeSunshade", "insizeSunshade", "wetFan", "LED", 'electromagneticControl', "coercionMist", "circulationCan", "internalInsulation", "forceOutput", "intrinsicParameter", "parameterSet"], img: require('../assets/image/left-img0.png'), list: [] },
// { name: '', img: require('../assets/image/left-img1.png'), list: [] },
{ name: '施肥机', routerList: ['formula', 'dataAnalysis', 'historyData', 'irrigateSet', 'videoMonitoring','imageData', 'PIDSet', 'systemSet', 'upload', 'sensorSet', 'realTime', 'history', 'dataAnalysis'], img: require('../assets/image/left-img2.png'), list: [] },
{ name: '智能灌溉', routerList: ['realTime', 'dataAnalysis', 'historyData','irrigateSet-soil', 'videoMonitoring','imageData','PIDSet-soil', 'systemSet-soil', 'upload-soil', 'sensorSet-soil', 'realTime', 'history', 'dataAnalysis'], img: require('../assets/image/irrigateSet-icon1-act.png'), list: [] },
{ name: '生态气象站', routerList: ['realTime', 'historyData', 'exitSettings', 'skylight', 'control', 'systemSet-con','imageData', 'fan', 'upload-con', 'sensorSet-con', 'synthesis-con', 'alarmSettings', 'waterPump', 'geothermalFan', 'uptake', 'downtake', 'rollByRoll', 'snowRemoval', "targetTemperature", "targetHumidity", "targetCo2", "sunroofControl", "outsizeSunshade", "insizeSunshade", "wetFan", "LED", 'electromagneticControl', "coercionMist", "circulationCan", "internalInsulation", "forceOutput", "intrinsicParameter", "parameterSet"], img: require('../assets/image/left-img3.png'), list: [] },
],
leftList1: [
@ -300,6 +301,7 @@ export default {
this.leftList[1].list = []
this.leftList[2].list = []
this.leftList[3].list = []
this.leftList[4].list = []
this.$store.state.equipmentList.forEach((el, index) => {
//deviceId
if (this.deviceId && this.deviceId == el.deviceId) {
@ -317,6 +319,12 @@ export default {
this.leftList[index1].list.push(el)
}
})
} else if (el.deviceName == 20) {
this.leftList.forEach((el1, index1) => {
if (el1.name == '智能灌溉') {
this.leftList[index1].list.push(el)
}
})
}
// else if (el.deviceName == 30) {
// this.leftList.forEach((el1, index1) => {
@ -356,10 +364,14 @@ export default {
if (el1.name == '施肥机') {
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
}
if (el1.name == '智能灌溉') {
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
}
if (el1.name == '生态气象站') {
this.leftList[index1].list.sort(this.compare('equipmentStatu'))
}
})
this.gerRouter()
this.getByid()
var data = {
@ -431,6 +443,8 @@ export default {
}
if (this.deviceName == '10') {
this.$router.push({ path: `/control` })
} else if(this.deviceName == '20'){
this.$router.push({ path: `/soil` })
} else {
this.$router.push({ path: `/formula` })
}
@ -497,6 +511,7 @@ export default {
} else {
if (item.deviceName == 10) {
//
//
this.$store.state.equipmentIndex = item.index
this.routerIndex = item.index
@ -505,6 +520,7 @@ export default {
}
this.$router.push({ path: `/control?change=${item.index}` })
} else if (item.deviceName == 1 ) {
//
if(this.routerNow == 'irrigateSet'){
this.$store.state.equipmentIndex = item.index
this.routerIndex = item.index
@ -513,10 +529,19 @@ export default {
this.routerIndex = item.index
this.$router.push({ path: `/irrigateSet?change=${item.index}` })
}
} else if (item.deviceName == 20 ) {
//
} else if (item.deviceName == 30) {
if(this.routerNow == 'irrigateSet-soil'){
this.$store.state.equipmentIndex = item.index
this.routerIndex = item.index
}else{
this.$store.state.equipmentIndex = item.index
this.routerIndex = item.index
this.$router.push({ path: `/irrigateSet-soil?change=${item.index}` })
}
}
else if (item.deviceName == 30) {
this.$message('气象站无该页面');
}
}

View File

@ -12,6 +12,10 @@
<img src="../../assets/manageImg/manage-btn-icon1.png" alt="">
控制器
</div>
<div class="manage-btn" @click="active = 2" :class="active == 2 ? 'active' : ''">
<img src="../../assets/manageImg/manage-btn-icon1.png" alt="">
智能控制器
</div>
</div>
<div class="table-view" v-if="active == 0">
<el-table :data="tableData" :row-class-name="tableRowClassName" height="620" style="width: 100%">
@ -40,7 +44,8 @@
</el-table-column>
</el-table>
</div>
<div class="table-view" v-else>
<div class="table-view" v-else-if="active==1">
<el-table :data="tableData1" :row-class-name="tableRowClassName" height="620" style="width: 100%">
<!-- <el-table-column label="序号">
<template slot-scope="scope">
@ -64,7 +69,30 @@
</el-table-column>
</el-table>
</div>
<div class="table-view" v-else-if="active==2">
<el-table :data="tableData2" :row-class-name="tableRowClassName" height="620" style="width: 100%">
<!-- <el-table-column label="序号">
<template slot-scope="scope">
<div>{{scope.$index+1 }}
</div>
</template>
</el-table-column> -->
<el-table-column prop="deviceId" label="设备code码">
</el-table-column>
<el-table-column prop="deviceTypeName" label="设备名称">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<div class="table-flex">
<div class="table-operate blue" @click="openModel1(scope.row, scope.$index)">
<img src="../../assets/manageImg/table-edit.png" alt="">编辑
</div>
</div>
</template>
</el-table-column>
</el-table>
</div>
<el-dialog title="提示" top="10vh" :visible.sync="addModel" width="700px" class="vrcode-model manage-model"
:append-to-body="true">
<div class="vrcode-model-title">
@ -283,6 +311,7 @@ export default {
active: 0,
tableData: [],
tableData1: [],
tableData2: [],
addModel: false,
addModel1: false,
changeName: false,
@ -298,12 +327,15 @@ export default {
this.api.selUserbyid(user.userid).then(res => {
this.tableData = []
this.tableData1 = []
this.tableData2 = []
if (res.data.code == 200) {
res.data.data.devices.forEach((el, index) => {
if (el.deviceName == 10) {
this.tableData1.push(el)
} else if (el.deviceName == 1) {
this.tableData.push(el)
} else if (el.deviceName == 20) {
this.tableData2.push(el)
}
})
}

View File

@ -154,7 +154,10 @@ export default {
},
deviceType:'',
deviceSel: [{ label: '控制器', value: 10, }, { label: '施肥机', value: 1, }, { label: '气象站', value:30, }],
deviceSel: [{ label: '控制器', value: 10, },
{ label: '施肥机', value: 1, },
{ label: '气象站', value:30, },
{ label: '智能灌溉控制器', value:20, }],
}
},
mounted() { this.dataInit() },

View File

@ -225,7 +225,10 @@ export default {
typeSelList: [{ label: '管理员', value: 1, }, { label: '用户', value: 2, }],
deviceType:'',
deviceSel: [{ label: '控制器', value: 10, }, { label: '施肥机', value: 1, }, { label: '气象站', value:30, }],
deviceSel: [{ label: '控制器', value: 10, },
{ label: '施肥机', value: 1, },
{ label: '气象站', value:30, },
{ label: '智能灌溉控制器', value:20, }],
}
},
mounted() { this.dataInit() },

View File

@ -99,7 +99,7 @@ export default {
this.tableData = res.data.data.equipments
this.typeSelList=[]
res.data.data.devices.forEach((el,index)=>{
if(el.deviceName==10){
if(el.deviceName!=30){
this.typeSelList.push(el)
}
})

View File

@ -40,7 +40,7 @@
</div>
</template>
</el-table-column>
<el-table-column label="清水与肥料的比例">
<el-table-column label="1000L水与肥料的倍数">
<template slot-scope="scope">
<div class="input-main-80">
<input @blur="blurChange(store.formulaNum[indexs - 1] + 5 + scope.$index, $event)"

View File

@ -0,0 +1,387 @@
<template>
<div class="intrinsicParameter">
<div class="table-title">
<img src="../../assets/img/intrinsicParameter.png" alt="">设备固有参数
</div>
<div class="flex-view border-none shrink-none padding-none">
<div class="input-main-80">
<span>出水脉冲:</span>
<input @blur="blurChange(10030, $event)" v-model="inputData[10030]" @input="change(10030, $event)"
type="text" placeholder="0">
</div>
<div class="input-main-80">
<span>土壤参数:</span>
<input @blur="blurChange(10031, $event)" v-model="inputData[10031]" @input="change(10031, $event)"
type="text" placeholder="0">
</div>
</div>
<div class="flex-view border-none shrink-none padding-none" v-for="item,index in 40" :key="index">
<div class="input-sel input-sel-w180">
<span>{{index+1}}#灌溉组土壤温度传感器选择</span>
<el-dropdown @command="handleCommand($event,10080+index)">
<div class="el-dropdown-link">
<input v-model="inputDataNew[10080+index]" type="text" class="input-input" placeholder="无">
<div class="arrow"><img src="../../assets/image/arrow.png" alt=""></div>
</div>
<el-dropdown-menu class="input-menu-180" slot="dropdown">
<el-dropdown-item v-for="item, index in typeList1" :key="index" :command="item.value">{{
item.label }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="input-sel input-sel-w180">
<span>{{index+1}}#灌溉组土壤湿度传感器选择</span>
<el-dropdown @command="handleCommand($event,10040+index)">
<div class="el-dropdown-link">
<input v-model="inputDataNew[10040+index]" type="text" class="input-input" placeholder="无">
<div class="arrow"><img src="../../assets/image/arrow.png" alt=""></div>
</div>
<el-dropdown-menu class="input-menu-180" slot="dropdown">
<el-dropdown-item v-for="item, index in typeList1" :key="index" :command="item.value">{{
item.label }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
<el-dialog title="请输入密码" class="vrcode-model confirm-psw" top="30vh" :close-on-click-modal="false" :append-to-body="true" :visible.sync="warnModel"
width="700px">
<div class="vrcode-model-title vrcode-model-title-282">请输入密码</div>
<div class="warning-model" style="padding: 0 30px;">
<div class="flex-view border-none">
<div class="input-main">
<div>密码:</div>
<input type="text" v-model="modelPassword">
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="modelClose"> </el-button>
<el-button type="success" @click="modelConfirm"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
warnModel: true,
modelPassword:'',
sensorType: '',
typeList1: [
// { label: '1#湿', value: 0 },
{ label: '1#土壤湿度', value: 1 },
{ label: '2#土壤湿度', value: 2 },
{ label: '3#土壤湿度', value: 3 },
{ label: '4#土壤湿度', value: 4 },
{ label: '5#土壤湿度', value: 5 },
{ label: '6#土壤湿度', value: 6 },
{ label: '7#土壤湿度', value: 7 },
{ label: '8#土壤湿度', value: 8 },
{ label: '9#土壤湿度', value: 9 },
{ label: '10#土壤湿度', value: 10 },
{ label: '11#土壤湿度', value: 11 },
{ label: '12#土壤湿度', value: 12 },
{ label: '13#土壤湿度', value: 13 },
{ label: '14#土壤湿度', value: 14 },],
list1:40,
typeList2: [
// { label: '1#湿', value: 0 },
{ label: '1#土壤温度', value: 1 },
{ label: '2#土壤温度', value: 2 },
{ label: '3#土壤温度', value: 3 },
{ label: '4#土壤温度', value: 4 },
{ label: '5#土壤温度', value: 5 },
{ label: '6#土壤温度', value: 6 },
{ label: '7#土壤温度', value: 7 },
{ label: '8#土壤温度', value: 8 },
{ label: '9#土壤温度', value: 9 },
{ label: '10#土壤温度', value: 10 },
{ label: '11#土壤温度', value: 11 },
{ label: '12#土壤温度', value: 12 },
{ label: '13#土壤温度', value: 13 },
{ label: '14#土壤温度', value: 14 },],
list2:40,
typeList3: [
{ label: '加热模式', value: 1 },
{ label: '制冷模式', value: 2 },],
inputData:[],
inputDataNew:[],
loading:null,
}
},
watch: {
'$store.state.equipmentIndex'(newVal, oldVal) {
this.dataInit();
},
},
mounted() {
this.dataInit()
//input
let inputList = document.querySelectorAll('input');
for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue;//input
}
},
methods: {
modelClose(){
this.$router.go(-1); //
},
modelConfirm(){
if(this.modelPassword=='230509'){
this.warnModel=false
}else{
this.$message('密码错误');
}
},
// 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 (store.nowInput != el.target.value) {
this.changeData(data);
}
// 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)
},
// x/10
countData10(data) {
if (data) {
return data / 10
} else {
return 0
}
},
getData1(data) {
var name=''
this.typeList1.forEach((el, index) => {
if (el.value == data) {
name=el.label
}
})
return name
},
getData2(data) {
var name=''
this.typeList2.forEach((el, index) => {
if (el.value == data) {
name=el.label
}
})
return name
},
getData3(data) {
var name=''
this.typeList3.forEach((el, index) => {
if (el.value == data) {
name=el.label
}
})
return name
},
dataInit() {
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readFi_intrinsicparameterfi(data).then(res => {
this.loading.close()
if (res.data.code == 200) {
this.inputData =JSON.parse(JSON.stringify(res.data.data));
this.inputDataNew=JSON.parse(JSON.stringify(res.data.data))
for (let i = 0; i < 40; i++) {
this.inputDataNew[10080+i]=this.getData1(this.inputData[10080+i])
this.inputDataNew[10040+i]=this.getData2(this.inputData[10040+i])
}
// this.list1.forEach((el,index)=>{
// this.inputDataNew[el]=this.getData1(this.inputData[el])
// })
// this.list2.forEach((el,index)=>{
// this.inputDataNew[el]=this.getData2(this.inputData[el])
// })
// this.inputDataNew[20726]=this.getData3(this.inputData[20726])
console.log(this.inputData, this.inputDataNew);
}
})
},
//
padString(str, length) {
return str.padStart(length, '0');
},
//
myReverse(arr) {
return [...arr].reverse()
},
//
selectValue(e) {
var store = this.$store.state
store.nowInput = e.target.value
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 (store.nowInput != el.target.value) {
this.changeData(data);
}
// 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);
},
//
handleCommand(command,code) {
this.typeList1.forEach((el, index) => {
if (el.value == command) {
this.inputDataNew[code] = el.label
}
})
var dataNum = {
target: {
value: command,
},
};
this.changeBtn(code, dataNum);
},
//
handleCommand1(command,code) {
this.typeList3.forEach((el, index) => {
if (el.value == command) {
this.inputDataNew[code] = el.label
}
})
var dataNum = {
target: {
value: command,
},
};
this.changeBtn(code, dataNum);
},
//
handleCommand2(command,code) {
this.typeList2.forEach((el, index) => {
if (el.value == command) {
this.inputDataNew[code] = el.label
}
})
var dataNum = {
target: {
value: command,
},
};
this.changeBtn(code, dataNum);
},
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) {
var store = this.$store.state
this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: "success",
});
store.nowInput = ''
// this.dataInit();
} else {
this.inputData[data.regAddress] = store.nowInput
this.$message.error(res.data.msg);
}
this.timer = null
});
},
},
}
</script>
<style lang="scss"></style>

View File

@ -0,0 +1,985 @@
<template>
<div class="irrigateSet">
<div class="table-title">
<img src="../../assets/image/irrigateSet.png" alt="" />
{{ this.indexs }}#智能灌溉组
<!-- <div class="tips"></div> -->
</div>
<div class="flex-view">
<div class="input-btn">
<span>控制模式选择</span>
<div class="btn" @click="change00(3)"
:class="inputData['1' + (10 + (indexs - 1)) + '00'] == 3 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet1.png" alt="" />停止
</div>
<div class="btn" @click="change00(2)"
:class="inputData['1' + (10 + (indexs - 1)) + '00'] == 2 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet3.png" alt="" />手动启动
</div>
<div class="btn" @click="change00(1)"
:class="inputData['1' + (10 + (indexs - 1)) + '00'] == 1 ? 'blue' : 'green'">
<img src="../../assets/image/irrigateSet2.png" alt="" />自动
</div>
</div>
<div class="input-main">
<span>手动启动时间</span>
<input @blur="blurChange10('1' + (10 + (indexs - 1)) + '01', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '01']"
@input="changeData10('1' + (10 + (indexs - 1)) + '01', $event)" type="text" value="60" placeholder="60" />
</div>
</div>
<div class="flex-view">
<div class="input-main-80">
<span>自动运行起始日期</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '02', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '02']"
@input="change('1' + (10 + (indexs - 1)) + '02', $event)" type="number" placeholder="0" />
<span></span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '03', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '03']"
@input="change('1' + (10 + (indexs - 1)) + '03', $event)" type="number" placeholder="0" />
<span></span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '04', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '04']"
@input="change('1' + (10 + (indexs - 1)) + '04', $event)" type="number" placeholder="0" />
<span></span>
</div>
<div class="input-main-80">
<span>间隔灌溉天数</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '05', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '05']"
@input="change('1' + (10 + (indexs - 1)) + '05', $event)" type="number" placeholder="0" />
</div>
</div>
<!-- <div class="flex-view">
<div class="input-main-80">
<span>灌溉</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '51', $event)" v-model="inputData['1' + (10 + (indexs - 1)) + '51']"
@input="change('1' + (10 + (indexs - 1)) + '51', $event)" type="number" placeholder="0" />
<span>次清水间隔灌溉</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '52', $event)" v-model="inputData['1' + (10 + (indexs - 1)) + '52']"
@input="change('1' + (10 + (indexs - 1)) + '52', $event)" type="number" placeholder="0" />
<span>次施肥</span>
</div>
</div>
<div class="flex-view">
<div class="input-main-80">
<span>施肥时采用</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '58', $event)" v-model="inputData['1' + (10 + (indexs - 1)) + '58']"
@input="change('1' + (10 + (indexs - 1)) + '58', $event)" type="number" placeholder="0" />
<span>号配方</span>
<span>达到中液位混合</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '66', $event)" v-model="inputData['1' + (10 + (indexs - 1)) + '66']"
@input="change('1' + (10 + (indexs - 1)) + '66', $event)" type="number" placeholder="0" />
<span>()电磁阀开始输出</span>
</div>
</div> -->
<div class="flex-view">
<div class="input-main-80">
<span>电磁阀控制通道</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '52', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '52']"
@input="change('1' + (10 + (indexs - 1)) + '52', $event)" type="text" placeholder="0" />
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '53', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '53']"
@input="change('1' + (10 + (indexs - 1)) + '53', $event)" type="text" placeholder="0" />
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '54', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '54']"
@input="change('1' + (10 + (indexs - 1)) + '54', $event)" type="text" placeholder="0" />
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '55', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '55']"
@input="change('1' + (10 + (indexs - 1)) + '55', $event)" type="text" placeholder="0" />
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '56', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '56']"
@input="change('1' + (10 + (indexs - 1)) + '56', $event)" type="text" placeholder="0" />
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '57', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '57']"
@input="change('1' + (10 + (indexs - 1)) + '57', $event)" type="text" placeholder="0" />
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '58', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '58']"
@input="change('1' + (10 + (indexs - 1)) + '58', $event)" type="text" placeholder="0" />
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '59', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '59']"
@input="change('1' + (10 + (indexs - 1)) + '59', $event)" type="text" placeholder="0" />
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '60', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '60']"
@input="change('1' + (10 + (indexs - 1)) + '60', $event)" type="text" placeholder="0" />
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '61', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '61']"
@input="change('1' + (10 + (indexs - 1)) + '61', $event)" type="text" placeholder="0" />
</div>
<!-- <div class="btn green">
<img src="../../assets/image/rotate.png" alt="" />轮模式启用
</div> -->
</div>
<div class="flex-view">
<!-- <div @click="(open1 = !open1), change59()" class="open-btn" :class="open1 ? 'active' : ''">
<img v-if="!open1" src="../../assets/image/irrigateSet-icon1.png" alt="" />
<img v-else src="../../assets/image/irrigateSet-icon1-act.png" alt="" />
灌溉清水时不启动施肥机
</div>
<div @click="(open2 = !open2), change59()" class="open-btn" :class="open2 ? 'active' : ''">
<img v-if="!open2" src="../../assets/image/irrigateSet-icon2.png" alt="" />
<img v-else src="../../assets/image/irrigateSet-icon2-act.png" alt="" />
灌溉结束时清空混液罐
</div> -->
<div @click="change59()" class="open-btn" :class="inputData['1' + (10 + (indexs - 1)) + '62'] ? 'active' : ''">
<img v-if="inputData['1' + (10 + (indexs - 1)) + '62'] == 0" src="../../assets/image/irrigateSet-icon2.png"
alt="" />
<img v-else src="../../assets/image/irrigateSet-icon2-act.png" alt="" />
轮灌模式
</div>
<!-- <div @click="(open4 = !open4), change59()" class="open-btn" :class="open4 ? 'active' : ''">
<img v-if="!open4" src="../../assets/image/irrigateSet-icon0.png" alt="" />
<img v-else src="../../assets/image/irrigateSet-icon0-act.png" alt="" />
灌溉清水时不启动进水泵
</div> -->
</div>
<div class="input-view">
<div class="input-sel">
<span>施肥机自动运行模式选择</span>
<el-dropdown trigger="click" @command="handleCommand">
<div class="el-dropdown-link">
<input type="text" value="选择设定弹窗" v-model="data53" class="input-input" placeholder="无" />
<div class="arrow">
<img src="../../assets/image/arrow.png" alt="" />
</div>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="1">预定时间点启动</el-dropdown-item>
<el-dropdown-item command="2">预定时间段启动</el-dropdown-item>
<el-dropdown-item command="3">依据土壤传感器</el-dropdown-item>
<el-dropdown-item command="4">依据光照传感器</el-dropdown-item>
<el-dropdown-item command="5">依据外控信号</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
<el-dialog :modal-append-to-body="false" :show-close="false" :close-on-click-modal="true" :visible.sync="model1"
width="440px" :before-close="handleClose1">
<div class="page-title title-302">{{ indexs }}#灌溉组控制参数配置</div>
<div class="model1-top">
<div class="btn blue">
<img src="../../assets/image/play.png" alt="" />时间点启动
</div>
<div class="input-main-80">
<span>每次灌溉时长</span>
<input @blur="blurChange10('1' + (10 + (indexs - 1)) + '06', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '06']"
@input="changeData10('1' + (10 + (indexs - 1)) + '06', $event)" type="number" placeholder="0" />
<span></span>
</div>
</div>
<div class="model1-bottom">
<div class="title">启动时间点</div>
<div class="model1-content">
<div>
<div class="number">1</div>
<div class="input-main-80">
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '07', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '07']"
@input="change('1' + (10 + (indexs - 1)) + '07', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '08', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '08']"
@input="change('1' + (10 + (indexs - 1)) + '08', $event)" type="number" placeholder="0" />
</div>
</div>
<div>
<div class="number">2</div>
<div class="input-main-80">
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '09', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '09']"
@input="change('1' + (10 + (indexs - 1)) + '09', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '10', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '10']"
@input="change('1' + (10 + (indexs - 1)) + '10', $event)" type="number" placeholder="0" />
</div>
</div>
<div>
<div class="number">3</div>
<div class="input-main-80">
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '11', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '11']"
@input="change('1' + (10 + (indexs - 1)) + '11', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '12', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '12']"
@input="change('1' + (10 + (indexs - 1)) + '12', $event)" type="number" placeholder="0" />
</div>
</div>
<div>
<div class="number">4</div>
<div class="input-main-80">
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '13', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '13']"
@input="change('1' + (10 + (indexs - 1)) + '13', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '14', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '14']"
@input="change('1' + (10 + (indexs - 1)) + '14', $event)" type="number" placeholder="0" />
</div>
</div>
<div>
<div class="number">5</div>
<div class="input-main-80">
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '15', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '15']"
@input="change('1' + (10 + (indexs - 1)) + '15', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '16', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '16']"
@input="change('1' + (10 + (indexs - 1)) + '16', $event)" type="number" placeholder="0" />
</div>
</div>
</div>
</div>
<div class="model-return">
<div @click="model1 = false" class="btn green">
<img src="../../assets/image/return.png" alt="" />返回
</div>
</div>
</el-dialog>
<el-dialog :modal-append-to-body="false" :show-close="false" :close-on-click-modal="true" :visible.sync="model2"
width="760px" :before-close="handleClose2">
<div class="page-title title-302">{{ indexs }}#灌溉组控制参数配置</div>
<div class="model1-top model2-top">
<div class="btn blue">
<img src="../../assets/image/play.png" alt="" />间隔启动
</div>
<div class="input-main-80">
<span>每次灌溉时长</span>
<input @blur="blurChange10('1' + (10 + (indexs - 1)) + '17', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '17']"
@input="changeData10('1' + (10 + (indexs - 1)) + '17', $event)" type="number" placeholder="0" />
<span></span>
</div>
</div>
<div class="model1-bottom">
<div class="title">启动时间点</div>
<div class="model1-content">
<div>
<div class="number">1</div>
<div class="input-main-80">
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '19', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '19']"
@input="change('1' + (10 + (indexs - 1)) + '19', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '20', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '20']"
@input="change('1' + (10 + (indexs - 1)) + '20', $event)" type="number" placeholder="0" />
<span>-</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '21', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '21']"
@input="change('1' + (10 + (indexs - 1)) + '21', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '22', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '22']"
@input="change('1' + (10 + (indexs - 1)) + '22', $event)" type="number" placeholder="0" />
<span style="font-size: 16px">时间段里启动次数</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '18', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '18']"
@input="change('1' + (10 + (indexs - 1)) + '18', $event)" type="number" placeholder="0" />
</div>
</div>
<div>
<div class="number">2</div>
<div class="input-main-80">
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '24', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '24']"
@input="change('1' + (10 + (indexs - 1)) + '24', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '25', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '25']"
@input="change('1' + (10 + (indexs - 1)) + '25', $event)" type="number" placeholder="0" />
<span>-</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '26', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '26']"
@input="change('1' + (10 + (indexs - 1)) + '26', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '27', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '27']"
@input="change('1' + (10 + (indexs - 1)) + '27', $event)" type="number" placeholder="0" />
<span style="font-size: 16px">时间段里启动次数</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '23', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '23']"
@input="change('1' + (10 + (indexs - 1)) + '23', $event)" type="number" placeholder="0" />
</div>
</div>
<div>
<div class="number">3</div>
<div class="input-main-80">
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '29', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '29']"
@input="change('1' + (10 + (indexs - 1)) + '29', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '30', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '30']"
@input="change('1' + (10 + (indexs - 1)) + '30', $event)" type="number" placeholder="0" />
<span>-</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '31', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '31']"
@input="change('1' + (10 + (indexs - 1)) + '31', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '32', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '32']"
@input="change('1' + (10 + (indexs - 1)) + '32', $event)" type="number" placeholder="0" />
<span style="font-size: 16px">时间段里启动次数</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '28', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '28']"
@input="change('1' + (10 + (indexs - 1)) + '28', $event)" type="number" placeholder="0" />
</div>
</div>
</div>
</div>
<div class="model-return">
<div @click="model2 = false" class="btn green">
<img src="../../assets/image/return.png" alt="" />返回
</div>
</div>
</el-dialog>
<el-dialog :modal-append-to-body="false" :show-close="false" :close-on-click-modal="true" :visible.sync="model3"
width="760px" :before-close="handleClose3">
<div class="page-title title-302">{{ indexs }}#灌溉组控制参数配置</div>
<div class="model1-top model3-top">
<div class="btn blue">
<img src="../../assets/image/model3-icon.png" alt="" />光积累启动
</div>
<div class="input-main-80">
<span>有效检测时间段</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '45', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '45']"
@input="change('1' + (10 + (indexs - 1)) + '45', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '46', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '46']"
@input="change('1' + (10 + (indexs - 1)) + '46', $event)" type="number" placeholder="0" />
<span>-</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '47', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '47']"
@input="change('1' + (10 + (indexs - 1)) + '47', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '48', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '48']"
@input="change('1' + (10 + (indexs - 1)) + '48', $event)" type="number" placeholder="0" />
</div>
</div>
<div class="model1-bottom model3-bottom">
<div class="model1-content model3-content">
<div class="input-main-80">
<span class="text">启动时灌湛时长</span>
<input @blur="blurChange10('1' + (10 + (indexs - 1)) + '40', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '40']"
@input="changeData10('1' + (10 + (indexs - 1)) + '40', $event)" type="number" placeholder="0" />
<span class="text"></span>
</div>
<div class="input-main-80">
<span class="text">光积累启动值</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '41', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '41']"
@input="change('1' + (10 + (indexs - 1)) + '41', $event)" type="number" placeholder="0" />
</div>
<div class="input-main-80">
<span class="text">最小光照值</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '42', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '42']"
@input="change('1' + (10 + (indexs - 1)) + '42', $event)" type="number" placeholder="0" />
<span class="text">Klux</span>
</div>
<div class="input-main-80">
<span class="text" style="padding-left: 20px">最短灌溉间隔</span>
<input @blur="blurChange10('1' + (10 + (indexs - 1)) + '43', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '43']"
@input="changeData10('1' + (10 + (indexs - 1)) + '43', $event)" type="number" placeholder="0" />
</div>
<div class="input-main-80">
<span class="text">最长灌溉间隔</span>
<input @blur="blurChange10('1' + (10 + (indexs - 1)) + '44', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '44']"
@input="changeData10('1' + (10 + (indexs - 1)) + '44', $event)" type="number" placeholder="0" />
</div>
</div>
</div>
<div class="model-return">
<div @click="model3 = false" class="btn green">
<img src="../../assets/image/return.png" alt="" />返回
</div>
</div>
</el-dialog>
<el-dialog :modal-append-to-body="false" :show-close="false" :close-on-click-modal="true" :visible.sync="model5"
width="760px" :before-close="handleClose5">
<div class="page-title title-302">{{ indexs }}#灌溉组控制参数配置</div>
<div class="model1-top model3-top">
<div class="btn blue">
<img src="../../assets/image/model3-icon.png" alt="" />土壤传感器
</div>
<div class="input-main-80">
<span>有效检测时间段</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '33', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '33']"
@input="change('1' + (10 + (indexs - 1)) + '33', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '34', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '34']"
@input="change('1' + (10 + (indexs - 1)) + '34', $event)" type="number" placeholder="0" />
<span>-</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '35', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '35']"
@input="change('1' + (10 + (indexs - 1)) + '35', $event)" type="number" placeholder="0" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '36', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '36']"
@input="change('1' + (10 + (indexs - 1)) + '36', $event)" type="number" placeholder="0" />
</div>
</div>
<div class="model1-bottom model3-bottom">
<div class="model1-content model3-content">
<div class="input-main-80">
<span class="text">最低土壤湿度</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '37', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '37']"
@input="change('1' + (10 + (indexs - 1)) + '37', $event)" type="number" placeholder="0" />
<span class="text">%</span>
</div>
<div class="input-main-80">
<span class="text">最高土壤湿度</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '38', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '38']"
@input="change('1' + (10 + (indexs - 1)) + '38', $event)" type="number" placeholder="0" />
<span class="text">%</span>
</div>
<div class="input-main-80">
<span class="text">灌溉时长上限</span>
<input @blur="blurChange10('1' + (10 + (indexs - 1)) + '39', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '39']"
@input="changeData10('1' + (10 + (indexs - 1)) + '39', $event)" type="number" placeholder="0" />
<span class="text"></span>
</div>
</div>
</div>
<div class="model-return">
<div @click="model5 = false" class="btn green">
<img src="../../assets/image/return.png" alt="" />返回
</div>
</div>
</el-dialog>
<el-dialog :modal-append-to-body="false" :show-close="false" :close-on-click-modal="true" :visible.sync="model4"
width="700px" :before-close="handleClose4">
<div class="page-title title-302">{{ indexs }}#灌溉组控制参数配置</div>
<div style="display: flex;align-items: center;">
<div class="btn blue">
<img src="../../assets/image/model4-icon.png" alt="" />外控模式
</div>
<div>
<div class="input-main-80">
<span>有效时间</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '67', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '67']"
@input="change('1' + (10 + (indexs - 1)) + '67', $event)" type="number" placeholder="0" min="0"
max="23" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '68', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '68']"
@input="change('1' + (10 + (indexs - 1)) + '68', $event)" type="number" placeholder="0" min="0"
max="59" />
<span>--</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '69', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '69']"
@input="change('1' + (10 + (indexs - 1)) + '69', $event)" type="number" placeholder="0" min="0"
max="23" />
<span>:</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '70', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '70']"
@input="change('1' + (10 + (indexs - 1)) + '70', $event)" type="number" placeholder="0" min="0"
max="59" />
</div>
</div>
</div>
<div class="model1-top model4-top">
<div class="model-left">
<div class="btn btn-w80" @click="blurChange('1' + (10 + (indexs - 1)) + '71', { target: { value: 1 } }), model4Sel = 1"
:class="model4Sel == 1 ? 'blue' : 'off'">
{{ model4Sel == 1 ? '有效' : '无效' }}
</div>
<span>外部数字量控制方式:</span>
</div>
<div class="model-right">
<div>
<div class="number">1</div>
<div class="input-main-80">
<span>外部输入通道</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '49', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '49']"
@input="change('1' + (10 + (indexs - 1)) + '49', $event)" type="number" placeholder="0" />
</div>
</div>
<div>
<div class="number">2</div>
<div class="input-main-80">
<span>外部输入通道</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '50', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '50']"
@input="change('1' + (10 + (indexs - 1)) + '50', $event)" type="number" placeholder="0" />
</div>
</div>
</div>
</div>
<div class="model1-top model4-top">
<div class="model-left">
<div class="btn btn-w80 "
@click="blurChange('1' + (10 + (indexs - 1)) + '71', { target: { value: 2 } }), model4Sel = 2"
:class="model4Sel == 2 ? 'blue' : 'off'">
{{ model4Sel == 2 ? '有效' : '无效' }}
</div>
<span>液位传感器控制方式:</span>
</div>
<div class="model-right">
<div>
<div class="input-main-80">
<span>液位信号通道</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '72', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '72']"
@input="change('1' + (10 + (indexs - 1)) + '72', $event)" type="number" placeholder="0" />
</div>
</div>
<div>
<div class="input-main-80">
<span>启动低液位值</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '73', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '73']"
@input="change('1' + (10 + (indexs - 1)) + '73', $event)" type="number" placeholder="0" />
<span>cm</span>
</div>
</div>
<div>
<div class="input-main-80">
<span>停止高液位值</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '74', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '74']"
@input="change('1' + (10 + (indexs - 1)) + '74', $event)" type="number" placeholder="0" />
<span>cm</span>
</div>
</div>
</div>
</div>
<div class="model-return">
<div @click="model4 = false" class="btn green">
<img src="../../assets/image/return.png" alt="" />返回
</div>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
topActive: 1,
open1: false,
open2: false,
open3: false,
open4: false,
model1: false,
model2: false,
model3: false,
model4: false,
model4Sel: 0,
model5: false,
timer: null,
indexs: 2,
data53: "",
inputData: {},
loading: null,
};
},
watch: {
'$store.state.equipmentIndex': function (newValue, oldValue) {
const that = this;
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
setTimeout(() => {
that.dataInit();
}, 0);
},
$route(newVal, oldVal) {
const that = this;
this.indexs = this.$route.query.id ? this.$route.query.id : 1;
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
setTimeout(() => {
that.dataInit();
}, 0);
},
},
mounted() {
const that = this;
this.indexs = this.$route.query.id ? this.$route.query.id : 1;
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
setTimeout(() => {
that.dataInit();
}, 0);
//input
let inputList = document.querySelectorAll('input');
for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue;//input
}
},
methods: {
countData10(data) {
if (data) {
return data / 10
} else {
return 0
}
},
changeData10(code, el) {
var data = el.target.value * 10
var sendData = {
target: {
value: data
}
}
this.change(code, sendData)
},
handleCommand(command) {
if (command == "1") {
this.model1 = true;
} else if (command == "2") {
this.model2 = true;
} else if (command == "3") {
this.model5 = true;
} else if (command == "4") {
this.model3 = true;
} else if (command == "5") {
this.model4 = true;
}
this.inputData['1' + (10 + (this.indexs - 1)) + "51"] = command;
this.get53data(command)
var data53 = {
target: {
value: this.inputData['1' + (10 + (this.indexs - 1)) + "51"],
},
}
this.changeBtn('1' + (10 + (this.indexs - 1)) + "51", data53);
},
get53data(index) {
var data = index;
var text53 = "";
if (data == "1") {
text53 = "预定时间点启动";
} else if (data == "2") {
text53 = "预定时间段启动";
} else if (data == "3") {
text53 = "依据土壤传感器";
} else if (data == "4") {
text53 = "依据光照传感器";
} else if (data == "5") {
text53 = "依据外控信号";
}
this.data53 = text53;
},
change00(index) {
this.topActive = index
// var list = ["0", "0", "0"];
// if (index == 1) {
// list[0] = "1";
// } else {
// list[0] = "0";
// }
// if (index == 2) {
// list[1] = "1";
// } else {
// list[1] = "0";
// }
// if (index == 3) {
// list[2] = "1";
// } else {
// list[2] = "0";
// }
this.inputData['1' + (10 + (this.indexs - 1)) + '00'] = index
// var num = list.join("");
var dataNum = {
target: {
value: index,
},
};
this.changeBtn('1' + (10 + (this.indexs - 1)) + "00", dataNum);
},
padString(str, length) {
return str.padStart(length, '0');
},
getType00() {
var number = this.padString(this.inputData['1' + (10 + (this.indexs - 1)) + "00"].toString(2), 3)
if (Number(number[0])) {
this.topActive = 1
} else if (Number(number[1])) {
this.topActive = 2
} else if (Number(number[2])) {
this.topActive = 3
} else {
this.topActive = 0
}
console.log(this.topActive, 11);
},
change59() {
// var list = ["0", "0", "0", "0"];
// if (this.open1) {
// list[3] = "1";
// } else {
// list[3] = "0";
// }
// if (this.open2) {
// list[2] = "1";
// } else {
// list[2] = "0";
// }
// if (this.open3) {
// list[1] = "1";
// } else {
// list[1] = "0";
// }
// if (this.open4) {
// list[0] = "1";
// } else {
// list[0] = "0";
// }
var num = 0
if (this.inputData['1' + (10 + (this.indexs - 1)) + '62'] == 1) {
this.inputData['1' + (10 + (this.indexs - 1)) + '62'] = 0
num = 0
} else {
this.inputData['1' + (10 + (this.indexs - 1)) + '62'] = 1
num = 1
}
var dataNum = {
target: {
value: num,
},
};
this.changeBtn('1' + (10 + (this.indexs - 1)) + "62", dataNum);
},
getType() {
var number = this.padString(this.inputData['1' + (10 + (this.indexs - 1)) + "59"].toString(2), 4)
console.log(number);
if (Number(number[3])) {
this.open1 = true;
} else {
this.open1 = false;
}
if (Number(number[2])) {
this.open2 = true;
} else {
this.open2 = false;
}
if (Number(number[1])) {
this.open3 = true;
} else {
this.open3 = false;
}
if (Number(number[0])) {
this.open4 = true;
} else {
this.open4 = false;
}
},
dataInit() {
var indexs = this.indexs
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
// this.api.readFi_irrigate()
this.api.readFi_irrigate(`/readFi/irrigate${indexs}`, data).then((res) => {
this.loading.close()
if (res.data.code == 200) {
this.inputData = res.data.data;
// this.getType();
// this.getType00();
this.get53data(this.inputData['1' + (10 + (this.indexs - 1)) + "53"]);
this.inputData['1' + (10 + (indexs - 1)) + '01'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '01'])
this.inputData['1' + (10 + (indexs - 1)) + '06'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '06'])
this.inputData['1' + (10 + (indexs - 1)) + '17'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '17'])
this.inputData['1' + (10 + (indexs - 1)) + '39'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '39'])
this.inputData['1' + (10 + (indexs - 1)) + '40'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '40'])
this.inputData['1' + (10 + (indexs - 1)) + '43'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '43'])
this.inputData['1' + (10 + (indexs - 1)) + '44'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '44'])
this.model4Sel = this.inputData['1' + (10 + (indexs - 1)) + '71']
} else {
this.$message.error(res.data.msg);
}
});
},
//
selectValue(e) {
var store = this.$store.state
store.nowInput = e.target.value
e.currentTarget.select();
},
//
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 (store.nowInput != el.target.value) {
this.changeData(data);
}
// if (this.timer) {
// this.timer && clearInterval(this.timer);
// this.changeData(data);
// }
},
//
blurChange(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
}; //
if (store.nowInput != el.target.value) {
this.changeData(data);
}
// 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);
},
changeModel4() {
},
//
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) {
var store = this.$store.state
this.api.postwriteFi_write(data).then((res) => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: "success",
});
store.nowInput = ''
// this.dataInit();
} else {
this.inputData[data.regAddress] = store.nowInput
this.$message.error(res.data.msg);
}
this.timer = null
});
},
handleClose1(done) {
// this.$confirm('')
// .then(_ => {
// done();
// })
// .catch(_ => {});
},
handleClose2(done) {
// this.$confirm('')
// .then(_ => {
// done();
// })
// .catch(_ => {});
},
handleClose3(done) {
// this.$confirm('')
// .then(_ => {
// done();
// })
// .catch(_ => {});
},
handleClose4(done) {
// this.$confirm('')
// .then(_ => {
// done();
// })
// .catch(_ => {});
},
handleClose5(done) { },
},
};
</script>
<style lang="scss"></style>

View File

@ -1211,6 +1211,72 @@ export default {
}
})
}else if(this.deviceName==20){
this.api.getFi_rtdata(formData).then(res=>{
if (res.data.code == 200) {
this.inputData = res.data.data;
this.list = []
this.updateTime=res.data.data[0].updateTime
this.inputData.forEach((el, index) => {
list.forEach((el1, index1) => {
if (el.formula == el1.value) {
var num = 0
var name = ''
if (el.equipmentStart == 0) {
num = '故障'
} else {
num = el.environmentData + el1.unit
}
if (el.targetValue == 1) {
if (el.equipmentNumber == 0) {
name = '目标' + el.environmentDataId
} else {
name = '目标' + el.equipmentNumber + '#' + el.environmentDataId
}
} else {
if (el.equipmentNumber == 0) {
name = '1#平均' + el.environmentDataId
} else if (el.equipmentNumber == 15) {
name = '2#平均' + el.environmentDataId
} else {
name = el.equipmentNumber + '#' + el.environmentDataId
}
}
this.list.push({
...el,
name: name,
num: num,
img: require(`../../assets/image/real-time-${el.formula}.png`)
})
}
})
})
} else {
// this.$message.error(res.data.msg);
}
})
var nowDevice = store.equipmentList[this.indexs - 1]
// var data2 = {
// cameraid: nowDevice.cameraSerialNumber,
// channelid: nowDevice.cameraChannelNumber
// }
this.imgUrl = nowDevice.hls
this.api.chart_fidata(equipmentId).then(res=>{
if (res.data.code == 200) {
var chartsData = res.data.data
realTimeLine('realTime-line', chartsData, data1)
} else {
// this.$message.error(res.data.msg);
}
})
}
},

View File

@ -0,0 +1,498 @@
<template>
<div class="irrigateSet sensorSet">
<div class="table-title">
<img src="../../assets/image/sensor.png" alt=""> 传感器配置界面
</div>
<div class="sensor-view">
<div class="left scroll">
<div @click="toIndex(index)" :class="active == index ? 'active' : ''" v-for="item, index in 96"
:key="index">
<div>
{{ index + 1 }}#传感器通道
</div>
</div>
</div>
<div class="right">
<div class="right-top">
<div class="right-sel">
<div @click="changeOpen()">
<div v-if="openList.indexOf(active) == -1" class="no-sel"></div>
<div v-else class="sel"></div>
有效性
</div>
</div>
<div class="input-sel">
<div class="title">传感器类型</div>
<el-dropdown @command="handleCommand">
<div class="el-dropdown-link">
<input v-model="sensorType" type="text" class="input-input" placeholder="选择传感器类型">
<div class="arrow"><img src="../../assets/image/arrow.png" alt=""></div>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="item, index in typeList" :key="index" :command="item.value">{{
item.label }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<!-- <div class="right-sel">
<div @click="sel2 = !sel2">
<div v-if="!sel2" class="no-sel"></div>
<div v-else class="sel"></div>
通讯类传感器
</div>
<div @click="sel3 = !sel3">
<div v-if="!sel3" class="no-sel"></div>
<div v-else class="sel"></div>
模拟量传感器
</div>
</div> -->
</div>
<div class="right-bottom">
<div>
<div class="input-main">
<div>标定低点AD值</div>
<input @blur="blurChange(numberList[active] + 1, $event)"
v-model="inputDataNew[numberList[active] + 1]"
@input="change(numberList[active] + 1, $event)" type="number" placeholder="0.0">
</div>
<div class="input-main">
<div>标定低点数据</div>
<input @blur="blurChange1(numberList[active] + 2, $event)"
v-model="inputDataNew[numberList[active] + 2]"
@input="change1(numberList[active] + 2, $event)" type="number" placeholder="0.0">
</div>
</div>
<div>
<div class="input-main">
<div>标定高点AD值</div>
<input @blur="blurChange(numberList[active] + 3, $event)"
v-model="inputDataNew[numberList[active] + 3]"
@input="change(numberList[active] + 3, $event)" type="number" placeholder="0.0">
</div>
<div class="input-main">
<div>标定高点数据</div>
<input @blur="blurChange1(numberList[active] + 4, $event)"
v-model="inputDataNew[numberList[active] + 4]"
@input="change1(numberList[active] + 4, $event)" type="number" placeholder="0.0">
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
active: 0,
sel1: true,
sel2: false,
sel3: false,
numberList: [],
inputData: [],
inputDataNew: [],
sensorType: '',//
openList: [],//
typeList: this.$store.state.typeList,
loading: null,
list1:'',
list2:'',
list3:'',
list4:'',
list5:'',
list6:'',
}
},
watch: {
'active'(newVal, oldVal) {
this.getSensorType()
// this.getCountData()
},
},
created(){
for (let i = 0; i < 96; i++) {
this.numberList.push(10206+(i*5))
}
},
mounted() {
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.dataInit()
//input
let inputList = document.querySelectorAll('input');
for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue;//input
}
},
methods: {
//countType
//0
//1-400
//2/10
//3(-400) / 10
countType1(data) {
var num = data - 400
return num
},
countType2(data) {
var num = data / 10
return num
},
countType3(data) {
var num = (data - 400) / 10
return num
},
countType4(data) {
var num = (data - 1000) / 10
return num
},
//
sendCountType1(data) {
var num = data + 400
return num
},
sendCountType2(data) {
var num = data * 10
return num
},
sendCountType3(data) {
var num = (data * 10) + 400
return num
},
sendCountType4(data) {
var num = (data * 10) + 1000
return num
},
//
handleCommand(command) {
this.typeList.forEach((el, index) => {
if (el.value == command) {
this.sensorType = el.label
}
})
var dataNum = {
target: {
value: command,
},
};
this.changeBtn(this.numberList[this.active], dataNum);
},
//inputData
getSaveCountData() {
for (var i = 0; i < 48; i++) {
this.typeList.forEach((el, index) => {
if (el.value == this.inputData[this.numberList[i]]) {
if (el.countType == 0) {
this.inputData[this.numberList[i] + 2] = this.inputDataNew[this.numberList[i] + 2]
this.inputData[this.numberList[i] + 4] = this.inputDataNew[this.numberList[i] + 4]
} else if (el.countType == 1) {
this.inputData[this.numberList[i] + 2] = this.sendCountType1(this.inputDataNew[this.numberList[i] + 2])
this.inputData[this.numberList[i] + 4] = this.sendCountType1(this.inputDataNew[this.numberList[i] + 4])
} else if (el.countType == 2) {
this.inputData[this.numberList[i] + 2] = this.sendCountType2(this.inputDataNew[this.numberList[i] + 2])
this.inputData[this.numberList[i] + 4] = this.sendCountType2(this.inputDataNew[this.numberList[i] + 4])
} else if (el.countType == 3) {
this.inputData[this.numberList[i] + 2] = this.sendCountType3(this.inputDataNew[this.numberList[i] + 2])
this.inputData[this.numberList[i] + 4] = this.sendCountType3(this.inputDataNew[this.numberList[i] + 4])
} else if (el.countType == 4) {
this.inputData[this.numberList[i] + 2] = this.sendCountType4(this.inputDataNew[this.numberList[i] + 2])
this.inputData[this.numberList[i] + 4] = this.sendCountType4(this.inputDataNew[this.numberList[i] + 4])
}
}
})
}
},
//
getCountData() {
for (var i = 0; i < 6; i++) {
this.typeList.forEach((el, index) => {
if (el.value == this.inputData[this.numberList[i]]) {
if (el.countType == 0) {
this.inputDataNew[this.numberList[i] + 2] = this.inputData[this.numberList[i] + 2]
this.inputDataNew[this.numberList[i] + 4] = this.inputData[this.numberList[i] + 4]
} else if (el.countType == 1) {
this.inputDataNew[this.numberList[i] + 2] = this.countType1(this.inputData[this.numberList[i] + 2])
this.inputDataNew[this.numberList[i] + 4] = this.countType1(this.inputData[this.numberList[i] + 4])
} else if (el.countType == 2) {
this.inputDataNew[this.numberList[i] + 2] = this.countType2(this.inputData[this.numberList[i] + 2])
this.inputDataNew[this.numberList[i] + 4] = this.countType2(this.inputData[this.numberList[i] + 4])
} else if (el.countType == 3) {
this.inputDataNew[this.numberList[i] + 2] = this.countType3(this.inputData[this.numberList[i] + 2])
this.inputDataNew[this.numberList[i] + 4] = this.countType3(this.inputData[this.numberList[i] + 4])
} else if (el.countType == 4) {
this.inputDataNew[this.numberList[i] + 2] = this.countType4(this.inputData[this.numberList[i] + 2])
this.inputDataNew[this.numberList[i] + 4] = this.countType4(this.inputData[this.numberList[i] + 4])
}
}
})
}
},
getSensorType() {
this.typeList.forEach((el, index) => {
if (el.value == this.inputData[this.numberList[this.active]]) {
this.sensorType = el.label
}
})
},
toIndex(index) {
this.active = index
},
padString(str, length) {
return str.padStart(length, '0');
},
changeOpen() {
var inputData = this.inputData
var num = 10200
var listIndex = 16
var listnum = Math.floor(this.active / listIndex) + 1
console.log(this['list' + listnum],123,'list' + listnum);
var listData = this['list' + listnum].split('')
if (Number(listData[listIndex - 1 - (this.active % listIndex)])) {
listData[listData.length - 1 - (this.active % listIndex)] = '0'
this['list' + listnum] = listData.join('')
this.openList.splice(this.openList.indexOf(this.active), 1)
} else {
listData[listData.length - 1 - (this.active % listIndex)] = '1'
this['list' + listnum] = listData.join('')
this.openList.push(this.active)
}
this.$forceUpdate()
var listNew = listData.join("");
var dataNum = {
target: {
value: parseInt(listNew, 2),
},
};
// console.log(num + listnum, dataNum);
this.changeBtn(10200 + listnum -1, dataNum);
},
getData272() {
var inputData = this.inputData
// 96
this.openList = []
this.list1 = this.padString(inputData['10200'].toString(2), 16)
this.list2 = this.padString(inputData['10201'].toString(2), 16)
this.list3 = this.padString(inputData['10202'].toString(2), 16)
this.list4 = this.padString(inputData['10203'].toString(2), 16)
this.list5 = this.padString(inputData['10204'].toString(2), 16)
this.list6 = this.padString(inputData['10205'].toString(2), 16)
var number = 16
for (var i = 0; i < number; i++) {
if (Number(this.list1[this.list1.length - 1 - i])) {
this.openList.push(i)
}
}
for (var j = 0; j < number; j++) {
if (Number(this.list2[this.list2.length - 1 - j])) {
this.openList.push(j + 16)
}
}
for (var k = 0; k < number; k++) {
if (Number(this.list3[this.list3.length - 1 - k])) {
this.openList.push(k + 32)
}
}
for (var l = 0; l < number; l++) {
if (Number(this.list4[this.list4.length - 1 - l])) {
this.openList.push(l + 48)
}
}
for (var m = 0; m < number; m++) {
if (Number(this.list5[this.list5.length - 1 - m])) {
this.openList.push(m + 64)
}
}
for (var n = 0; n < number; n++) {
if (Number(this.list6[this.list6.length - 1 - n])) {
this.openList.push(n + 80)
}
}
},
dataInit() {
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readFi_sensorchannelfi(data).then((res) => {
this.loading.close()
if (res.data.code == 200) {
this.inputData = JSON.parse(JSON.stringify(res.data.data));
this.inputDataNew = res.data.data;
this.getData272()
this.getSensorType()
this.getCountData()
} else {
this.$message.error(res.data.msg);
}
});
},
//
selectValue(e) {
var store = this.$store.state
store.nowInput = e.target.value
e.currentTarget.select();
},
getSendData(number) {
var number1 = number
this.typeList.some((el, index) => {
if (el.value == this.inputData[this.numberList[this.active]]) {
if (el.countType == 0) {
number1 = number
} else if (el.countType == 1) {
number1 = this.sendCountType1(number)
} else if (el.countType == 2) {
number1 = this.sendCountType2(number)
} else if (el.countType == 3) {
number1 = this.sendCountType3(number)
} else if (el.countType == 4) {
number1 = this.sendCountType4(number)
}
}
})
return number1
},
//
change1(code, el) {
// var store = this.$store.state
// var data = {
// equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
// regAddress: code,
// num: this.getSendData(el.target.value),
// };
// this.delayTimer(0, data);
},
//
blurChange1(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: this.getSendData(el.target.value),
}; //
if (data.num != this.inputData[code]) {
// this.timer && clearInterval(this.timer);
this.changeData(data);
}
// if (this.timer) {
// this.timer && clearInterval(this.timer);
// this.changeData(data);
// }
},
//
blurChange(code, el) {
var store = this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value,
}; //
if (data.num != this.inputData[code]) {
// this.timer && clearInterval(this.timer);
this.changeData(data);
}
// 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) {
var store = this.$store.state
this.api.postwriteFi_write(data).then((res) => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: "success",
});
store.nowInput = ''
this.getSaveCountData()
// this.dataInit();
for (var i = 0; i < 48; i++) {
if (this.numberList[i] == data.regAddress) {
this.inputData[this.numberList[i]] = data.num
}
}
this.getCountData()
} else {
this.inputData[data.regAddress] = store.nowInput
this.$message.error(res.data.msg);
}
this.timer = null
});
},
},
}
</script>
<style lang="scss"></style>

View File

@ -0,0 +1,249 @@
<template>
<div class="irrigateSet sensorSet">
<div class="table-title">
<img src="../../assets/img/intrinsicParameter.png" alt=""> {{
$store.state.equipmentList[$store.state.equipmentIndex - 1].deviceTypeName }}状态显示
</div>
<div class="flex-view">
<div class="input-main input-main-w120">
<template v-for="item, index in dataInfo2_list">
<span>{{ item.title }}</span>
<input v-model="item.timer" type="text" value="60" disabled placeholder="60" />
<span>{{ item.unit }}</span>
</template>
</div>
</div>
<div class="flex-view">
<div class="open-btn" :class="inputData['3012'] ? 'active' : ''">
<img v-if="inputData['3012']" src="../../assets/image/irrigateSet-icon2-act.png" alt="" />
<img v-else src="../../assets/image/irrigateSet-icon2.png" alt="" />
进水泵
</div>
</div>
<div class="flex-view">
<div class="open-btn w-250" :class="right2Index.indexOf(index) != -1 ? 'active' : ''"
v-for="(item, index) in rightList2" >{{ item }}
</div>
<!-- <div class="open-btn w-250" :class="right2Index.indexOf(index) != -1 ? 'active' : ''"
v-for="(item, index) in rightList2.slice(4, 8)">{{ item }}
</div> -->
</div>
<div class="flex-view">
<div class="input-main-80">
<span>电磁阀控制通道</span>
<template v-for="(item, index) in 16 * 6">
<input v-if="centerBottom.indexOf(index) != -1" disabled :value="`${index + 1}#`"
type="text" placeholder="0" />
</template>
</div>
</div>
<div style="padding: 10px 10px 0;">
土壤温湿度传感器数据
</div>
<div class="flex-view">
<div>
<template v-for="item,index in 40">
<div class="input-main-80" v-if="index<(inputData[3102]?inputData[3102]:0)" :key="index">
<span>{{ index + 1 }}#土壤温度传感器</span>
<input disabled :value="inputData[3103+index]?(inputData[3103+index]-400)/10:0"
type="text" placeholder="0" />
</div>
</template>
</div>
<div>
<template v-for="item,index in 40">
<div class="input-main-80" v-if="index<(inputData[3102]?inputData[3102]:0)" :key="index">
<span>{{ index + 1 }}#土壤湿度传感器</span>
<input disabled :value="inputData[3062+index]?inputData[3062+index]/10:0"
type="text" placeholder="0" />
</div>
</template>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
inputData: [],
loading: null,
dataInfo2_list: [{
title: '灌溉剩余时长',
timer: '0',
unit: 'min'
},
{
title: '本次灌溉量',
timer: '0',
unit: 'L'
},
{
title: '启动方式',
timer: '无',
unit: ''
},
{
title: '执行灌溉组号',
timer: '0',
unit: ''
},
],
openType: '',
right2Index: [],
centerBottom: [],
rightList2: ['外控信号1#',
'外控信号2#',
'外控信号3#',
'外控信号4#',
'高液位信号',
'中液位信号',
'低液位信号',
'电机信号',
],
}
},
mounted() {
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.dataInit()
let that = this
this.timer_ = setInterval(function() {
that.dataInit();
}, 5000);
},
methods: {
dataInit() {
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.getFI_getState(data).then((res) => {
this.loading.close()
if (res.data.code == 200) {
this.inputData = res.data.data;
this.getDataInfo2()
this.getcenterBottom() //
this.getData29() //29 /
} else {
this.$message.error(res.data.msg);
}
});
},
getDataInfo2() {
var inputData = this.inputData
this.dataInfo2_list[0].timer = this.countData(inputData['3013'])
this.dataInfo2_list[1].timer = this.countData(inputData['3014'])
this.dataInfo2_list[2].timer = this.countData(inputData['3011'])
this.dataInfo2_list[3].timer = this.countData(inputData['3015'])
},
getType29(index) {
if (index == 0) {
return '手动开启动'
} else if (index == 1) {
return '外控模式启动'
} else if (index == 2) {
return '光照积累启动'
} else if (index == 3) {
return '土壤湿度控制'
} else if (index == 4) {
return '间隔启动'
} else if (index == 5) {
return '定时启动'
} else {
return '无'
}
},
//
getData29() {
var number = this.padString(this.inputData['3011'].toString(2), 14)
var index = 6
var typeNumber = -1
for (var i = 0; i < index; i++) {
if (Number(number[i])) {
typeNumber = i
}
}
this.openType = this.getType29(typeNumber)
this.dataInfo2_list[2].timer = this.getType29(typeNumber)
var statusIndex = 8
let list = []
for (var j = 0; j < statusIndex; j++) {
if (Number(number[number.length - 1 - j])) {
if (j == 0) {
list.push(1)
} else if (j == 1) {
list.push(0)
} else {
list.push(j)
}
}
}
this.right2Index = list
console.log(this.right2Index);
},
padString(str, length) {
return str.padStart(length, '0');
},
countData(data) {
if (data) {
return data
} else {
return 0
}
},
getcenterBottom() {
// 96
this.centerBottom = []
var inputData = this.inputData
var list1 = this.padString(inputData['3016'].toString(2), 16)
var list2 = this.padString(inputData['3017'].toString(2), 16)
var list3 = this.padString(inputData['3018'].toString(2), 16)
var list4 = this.padString(inputData['3019'].toString(2), 16)
var list5 = this.padString(inputData['3020'].toString(2), 16)
var list6 = this.padString(inputData['3021'].toString(2), 16)
var number = 16
for (var i = 0; i < number; i++) {
if (Number(list1[list1.length - 1 - i])) {
this.centerBottom.push(i)
}
}
for (var j = 0; j < number; j++) {
if (Number(list2[list2.length - 1 - j])) {
this.centerBottom.push(j + 16)
}
}
for (var k = 0; k < number; k++) {
if (Number(list3[list3.length - 1 - k])) {
this.centerBottom.push(k + 32)
}
}
for (var l = 0; l < number; l++) {
if (Number(list4[list4.length - 1 - l])) {
this.centerBottom.push(l + 48)
}
}
for (var m = 0; m < number; m++) {
if (Number(list5[list5.length - 1 - m])) {
this.centerBottom.push(m + 64)
}
}
for (var n = 0; n < number; n++) {
if (Number(list6[list6.length - 1 - n])) {
this.centerBottom.push(n + 80)
}
}
},
},
}
</script>
<style lang="scss"></style>

View File

@ -0,0 +1,308 @@
<template>
<div class="irrigateSet systemSet">
<div class="export">
<label for="upInput">
<div class="export-btn">导入设定值</div>
</label>
<div class="export-btn" @click="downLoadData"></div>
<input ref="fileInput" style="display: none" multiple id="upInput" type="file" accept=".txt" @change="changeTxt" />
</div>
<div class="table-title">
<img src="../../assets/image/system.png" alt=""> 系统参数设置
</div>
<div class="flex-view border-none padding-none">
<div class="input-main-80" style="width: auto;">
<span>软件版本号</span>
<input disabled v-model="inputData['3039']" type="text" placeholder="0">
<span></span>
</div>
<div class="input-main">
<span>智能灌溉控制器</span>
<input disabled v-model="inputData['3040']" type="text" placeholder="0">
<span></span>
</div>
<div class="input-main-80" style="width: auto;">
<span>智能灌溉控制器</span>
<input disabled v-model="inputData['3041']" type="text" placeholder="0">
<span></span>
</div>
</div>
<div class="flex-view">
<div class="input-main">
<span>信号质量</span>
<input disabled @blur="blurChange('3032', $event)" v-model="inputData['3032']" @input="change('3032', $event)" type="number" placeholder="0">
</div>
<div class="input-main">
<span>SIM</span>
<input disabled @blur="blurChange('3033', $event)" v-model="inputData['3033']" @input="change('3033', $event)" type="number" placeholder="0">
</div>
<div class="input-main">
<span>4G</span>
<input disabled @blur="blurChange('3034', $event)" v-model="inputData['3034']" @input="change('3034', $event)" type="number" placeholder="0">
</div>
<br>
<div class="input-main-80" style="width: 100%;">
<span>IP</span>
<input disabled @blur="blurChange('3035', $event)" v-model="inputData['3035']" @input="change('3035', $event)" type="number" placeholder="0">
<input disabled @blur="blurChange('3036', $event)" v-model="inputData['3036']" @input="change('3036', $event)" type="number" placeholder="0">
<input disabled @blur="blurChange('3037', $event)" v-model="inputData['3037']" @input="change('3037', $event)" type="number" placeholder="0">
<input disabled @blur="blurChange('3038', $event)" v-model="inputData['3038']" @input="change('3038', $event)" type="number" placeholder="0">
</div>
</div>
<div class="flex-view" style="border: none;">
<div class="input-main-80">
<span>ICCID</span>
<input disabled @blur="blurChange('3022', $event)" v-model="inputData['3022']" @input="change16to10('3022', $event)" type="text" placeholder="0">
<input disabled @blur="blurChange('3023', $event)" v-model="inputData['3023']" @input="change16to10('3023', $event)" type="text" placeholder="0">
<input disabled @blur="blurChange('3024', $event)" v-model="inputData['3024']" @input="change16to10('3024', $event)" type="text" placeholder="0">
<input disabled @blur="blurChange('3025', $event)" v-model="inputData['3025']" @input="change16to10('3025', $event)" type="text" placeholder="0">
<input disabled @blur="blurChange('3026', $event)" v-model="inputData['3026']" @input="change16to10('3026', $event)" type="text" placeholder="0">
<input disabled @blur="blurChange('3027', $event)" v-model="inputData['3027']" @input="change16to10('3027', $event)" type="text" placeholder="0">
<input disabled @blur="blurChange('3028', $event)" v-model="inputData['3028']" @input="change16to10('3028', $event)" type="text" placeholder="0">
<input disabled @blur="blurChange('3029', $event)" v-model="inputData['3029']" @input="change16to10('3029', $event)" type="text" placeholder="0">
<input disabled @blur="blurChange('3030', $event)" v-model="inputData['3030']" @input="change16to10('3030', $event)" type="text" placeholder="0">
<input disabled @blur="blurChange('3031', $event)" v-model="inputData['3031']" @input="change16to10('3031', $event)" type="text" placeholder="0">
</div>
<div class="input-main-one">
<span>ICCID</span>
<input disabled v-model="ICCID" type="text" placeholder="0">
</div>
<div class="system-tips">
说明:4G:=0,无网络;=2,2G网络;=4,4G网络 <br>
SIM:=0,SIM卡正常;=1,无SIM卡;=2,SIM卡异常(网络注册失败)<br>
信号质量:CSQ&lt;11 信号很差;11&lt;CSQ&lt;18,信号不稳定;CSQ&gt;18,信号稳定,最大是31.
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
inputData: [],
loading:null,
ICCID:''
}
},
mounted() {
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.dataInit()
//input
let inputList = document.querySelectorAll('input');
for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue;//input
}
},
methods: {
//
downLoadData() {
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
var store = this.$store.state
var index = store.equipmentIndex;
var devicecode=store.equipmentList[index - 1].deviceId
this.api.FIreadvaluedownload(devicecode).then(res => {
// blob
this.loading.close()
const blob = new Blob([res.data], { type: 'text/txt' });
// a
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
//
link.setAttribute('download', `智能灌溉-${devicecode}.txt`);
//
document.body.appendChild(link);
link.click();
//
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
})
},
//
changeTxt(e) {
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
var store = this.$store.state
var deviceId=store.equipmentList[store.equipmentIndex - 1].deviceId
const files = e.target.files
const that = this
for (let i = 0; i < files.length; i++) {
const formData = new FormData()
console.log(files[i])
formData.append('file', files[i])
const fileContent = URL.createObjectURL(files[i])
formData.append('devicecode', deviceId)
this.api.upLoadFIwritevalue(formData).then((res) => {
this.loading.close()
if (res.data.code == 200) {
this.$message.success(res.data.msg);
}else{
this.$message.error(res.data.msg);
}
})
}
setTimeout(() => {
this.$refs.fileInput.value = ''
}, 100)
},
change16to10(code,el){
var num=parseInt(el.target.value,16)
var dataNum={
target:{
value:num
}
}
this.change(code, dataNum)
},
fliter2(string){
var data=''
if(string.length<2){
data='0'+string
}else{
data=string
}
return data
},
dataInit() {
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.getFI_getState(data).then((res) => {
this.loading.close()
if (res.data.code == 200) {
this.inputData = res.data.data;
this.inputData['3022']= this.fliter2(this.inputData['3022'].toString(16))
this.inputData['3023']= this.fliter2(this.inputData['3023'].toString(16))
this.inputData['3024']= this.fliter2(this.inputData['3024'].toString(16))
this.inputData['3025']= this.fliter2(this.inputData['3025'].toString(16))
this.inputData['3026']= this.fliter2(this.inputData['3026'].toString(16))
this.inputData['3027']= this.fliter2(this.inputData['3027'].toString(16))
this.inputData['3028']= this.fliter2(this.inputData['3028'].toString(16))
this.inputData['3029']= this.fliter2(this.inputData['3029'].toString(16))
this.inputData['3030']= this.fliter2(this.inputData['3030'].toString(16))
this.inputData['3031']= this.fliter2(this.inputData['3031'].toString(16))
this.inputData['3039'] = 'REV:' + this.inputData['3039']
this.inputData['3040'] = this.getType(this.inputData['3040'])
} else {
this.$message.error(res.data.msg);
}
});
this.api.readControl_getFIIccid(data).then(res=>{
if(res.data.code==200){
this.ICCID=res.data.msg
}else{
this.$message.error(res.data.msg);
}
})
},
getType(index) {
if (index == 0) {
return '智能灌溉控制器正常'
} else if (index == 1) {
return '智能灌溉控制器待锁机'
} else if (index == 2) {
return '智能灌溉控制器已锁机'
} else {
return ' '
}
},
//
selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
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 (store.nowInput != el.target.value) {
this.changeData(data);
}
// if (this.timer) {
// this.timer && clearInterval(this.timer);
// this.changeData(data);
// }
},
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) {
// var store = this.$store.state
// this.api.postWriteFs(data).then((res) => {
// if (res.data.code == 200) {
// this.$message({
// message: res.data.msg,
// type: "success",
// });
// store.nowInput=''
// // this.dataInit();
// } else {
// this.inputData[data.regAddress]=store.nowInput
// this.$message.error(res.data.msg);
// }
// this.timer = null
// });
},
},
}
</script>
<style lang="scss">
</style>

View File

@ -0,0 +1,288 @@
<template>
<div class="irrigateSet upload">
<div class="table-title">
<img src="../../assets/image/upload.png" alt=""> 数据上传
</div>
<div class="flex-view">
<div class="input-main">
<span>环境数据上传时间</span>
<input @blur="blurChange('10000', $event)" v-model="inputData['10000']" @input="change('10000', $event)" type="number" placeholder="0">
<span></span>
</div>
</div>
<div class="flex-view border-none">
<div class="upload-view">
<div class="page-title upload-title">
气象站
</div>
<div class="upload-content">
<div @click="selList1(index)" v-for="item, index in list1" :key="index">
<div v-if="actList1.indexOf(index) == -1" class="no-sel"></div>
<div v-else class="sel"></div>
{{ item }}
</div>
</div>
</div>
<div class="upload-view">
<div class="page-title upload-title">
水肥参数
</div>
<div class="upload-content">
<div @click="selList2(index)" v-for="item, index in list2" :key="index">
<div v-if="actList2.indexOf(index) == -1" class="no-sel"></div>
<div v-else class="sel"></div>
{{ item }}
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
actList1: [],
actList1New: [],
list1: ['室外平均温度传感器',
'室外平均湿度传感器',
'室外平均光照传感器',
'室外平均风速传感器',
'室外平均风向传感器',
'室外平均雨雪传感器',
'室外平均雨量传感器',
'气象站电池电压(V)',
'气象站信号强度(RSSI)',
'气象站信噪比(SNR)',
'室外平均露点温度',
'室外平均C02传感器',
'室外平均土温传感器',
'室外平均土湿传感器',
'室外平均大气压传感器',
"室外平均太阳总辐射传感器",],
actList2: [],
actList2New: [],
list2: ['目标水肥PH数据',
'目标水肥EC数据',
'平均水肥PH数据',
'平均水肥EC数据',
'1#水肥PH数据',
'1#水肥EC数据',
'2#水肥PH数据',
'2#水肥EC数据',
'1#通道传感器数据',
'2#通道传感器数据',
'3#通道传感器数据',
'4#通道传感器数据',
'5#通道传感器数据',
'6#通道传感器数据',
"1#水温传感器数据",
"2#水温传感器数据",
],
inputData: [],
loading:null,
}
},
mounted() {
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
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');
},
//bit0
getAct1() {
this.actList1=[]
var num = this.inputData['10001']
var num2 = this.padString(num.toString(2), 16)
this.actList1New=num2.split("")
this.actList1New.forEach((el,index)=>{
if(el=='1'){
this.actList1.push(this.actList1New.length-index-1)
}
})
},
getAct2() {
this.actList2=[]
var num = this.inputData['10002']
var num2 = this.padString(num.toString(2), 16)
this.actList2New=num2.split("")
this.actList2New.forEach((el,index)=>{
if(el=='1'){
this.actList2.push(this.actList2New.length-index-1)
}
})
},
dataInit() {
this.actList1New = []
this.list1.forEach((el, index) => {
this.actList1New.push('0')
})
this.actList1New = []
this.list2.forEach((el, index) => {
this.actList1New.push('0')
})
var store = this.$store.state
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readFi_datauploadfi(data).then((res) => {
this.loading.close()
if (res.data.code == 200) {
this.inputData = res.data.data;
this.getAct1()
this.getAct2()
} else {
this.$message.error(res.data.msg);
}
});
},
//
selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
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 (store.nowInput != el.target.value) {
this.changeData(data);
}
// 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) {
var store = this.$store.state
this.api.postWriteFs(data).then((res) => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: "success",
});
store.nowInput=''
// this.dataInit();
} else {
this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
}
this.timer = null
});
},
selList1(index) {
if (this.actList1.indexOf(index) == -1) {
this.actList1.push(index)
} else {
this.actList1.splice(this.actList1.indexOf(index), 1)
}
this.actList1New=['0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0',]
this.actList1.forEach((el, index) => {
this.actList1New[this.actList1New.length-el-1] = '1'
})
var num = this.actList1New.join("");
var dataNum = {
target: {
value: parseInt(num, 2),
},
};
this.changeBtn('500', dataNum);
},
selList2(index) {
if (this.actList2.indexOf(index) == -1) {
this.actList2.push(index)
} else {
this.actList2.splice(this.actList2.indexOf(index), 1)
}
this.actList2New=['0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0',]
this.actList2.forEach((el, index) => {
this.actList2New[this.actList2New.length-el-1] = '1'
})
console.log(this.actList2,this.actList2New,this.actList2New.join(""));
var num = this.actList2New.join("");
var dataNum = {
target: {
value: parseInt(num, 2),
},
};
this.changeBtn('501', dataNum);
},
},
}
</script>
<style lang="scss"></style>

27
src/views/soil.vue 100644
View File

@ -0,0 +1,27 @@
<template>
<div class="formula control">
<setParamsSoil></setParamsSoil>
<div class="page-content">
<router-view></router-view>
</div>
</div>
</template>
<script>
import setParamsSoil from "../components/setParamsSoil.vue";
export default {
components: {
setParamsSoil,
},
//
beforeDestroy() {
var store = this.$store.state;
},
data() {
return {};
},
mounted() {},
methods: {},
};
</script>
<style lang="scss">
</style>