This commit is contained in:
home孙 2025-01-11 11:23:30 +08:00
parent e673081acb
commit 105b2918ac
7 changed files with 2981 additions and 1181 deletions

View File

@ -433,6 +433,10 @@ fanwetcurtain(data) {
readfilllight(data) {
return sendGetRequest(`/readControl/readfilllight`, data)
},
//CO2补气
co2replenishment(data) {
return sendGetRequest(`/readControl/co2replenishment`, data)
},
//内保温
interiorthermalinsulation(data) {
return sendGetRequest(`/readControl/interiorthermalinsulation`, data)

View File

@ -9,25 +9,49 @@
</div>
<el-collapse v-model="$store.state.activeNames">
<template v-for="(item, index) in routerList">
<el-collapse-item :class="routerNow == item.router || item.router.indexOf(routerNow) != -1 ? 'active' : ''"
:name="index + 1" :key="index" v-if="!item.isRouter">
<el-collapse-item
:class="
routerNow == item.router || item.router.indexOf(routerNow) != -1
? '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">
<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">
<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>
<div
@click="toRouter(item)"
:class="routerNow == item.router ? 'active' : ''"
class="no-list"
v-else
>
{{ item.name }}
</div>
</template>
@ -52,9 +76,8 @@ export default {
},
"$store.state.equipmentIndex"(newName, oldName) {
var store = this.$store.state;
var item = store.equipmentList[store.equipmentIndex - 1]
var item = store.equipmentList[store.equipmentIndex - 1];
if (item.deviceName == 10 || item.deviceName == 30) {
this.dataInit();
}
},
@ -67,246 +90,450 @@ export default {
methods: {
countData(data) {
if (data) {
return (data - 400) / 10
return (data - 400) / 10;
} else {
return 0
return 0;
}
},
// x/10
countData10(data) {
if (data) {
return data / 10
return data / 10;
} else {
return 0
return 0;
}
},
toNewList(list, list2) {
let newList = list.map((item, index) => {
// nickName name
const match = list2[index];
return match ? { ...item, name: match.nickName ? match.nickName : item.name } : item;
return match
? { ...item, name: match.nickName ? match.nickName : item.name }
: item;
});
return newList
return newList;
},
dataInit() {
const that = this
const that = this;
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
text: "加载中",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
});
var store = this.$store.state;
var data = store.equipmentList[store.equipmentIndex - 1].deviceId;
this.api.getcontrol_cpermission(data).then((res) => {
this.routerList = [];
this.purview = res.data.data;
this.purview.forEach((el, index) => {
if(el.state==1){
return
if (el.state == 1) {
return;
}
if (el.id == 1) {
var list = [
{ name: "目标温度", list: [], router: "targetTemperature", isRouter: true, index: 1 },
{ name: "目标湿度", list: [], router: "targetHumidity", isRouter: true, index: 2 },
{ name: "目标CO2", list: [], router: "targetCo2", isRouter: true, index: 3 }
]
let newList
if (el.child.length) {
newList = that.toNewList(list, el.child)
} else {
newList = list
}
this.routerList.push(
{
id: el.id, sort: el.sort,
name: el.nickName,
router: "targetTemperature",
list: newList,
},
);
} else if (el.id == 3) {
this.routerList.push(
{
id: el.id, sort: el.sort,
name: el.nickName,
router: "alarmSettings",
name: "目标温度",
list: [],
isRouter: true
router: "targetTemperature",
isRouter: true,
index: 1,
},
);
} else if (el.id == 19) {
var list = [
{ name: '通风窗1', status: -1, router: 'sunroofControl', index: 1 },
{ name: '通风窗2', status: -1, router: 'sunroofControl', index: 2 },
{ name: '通风窗3', status: -1, router: 'sunroofControl', index: 3 },
{ name: '通风窗4', status: -1, router: 'sunroofControl', index: 4 },
{ name: '通风窗5', status: -1, router: 'sunroofControl', index: 5 },
{ name: '通风窗6', status: -1, router: 'sunroofControl', index: 6 },
]
let newList
{
name: "目标湿度",
list: [],
router: "targetHumidity",
isRouter: true,
index: 2,
},
{
name: "目标CO2",
list: [],
router: "targetCo2",
isRouter: true,
index: 3,
},
];
let newList;
if (el.child.length) {
newList = that.toNewList(list, el.child)
newList = that.toNewList(list, el.child);
} else {
newList = list
newList = list;
}
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: newList, router: "sunroofControl",
id: el.id,
sort: el.sort,
name: el.nickName,
router: "targetTemperature",
list: newList,
});
} else if (el.id == 3) {
this.routerList.push({
id: el.id,
sort: el.sort,
name: el.nickName,
router: "alarmSettings",
list: [],
isRouter: true,
});
} else if (el.id == 19) {
var list = [
{
name: "通风窗1",
status: -1,
router: "sunroofControl",
index: 1,
},
{
name: "通风窗2",
status: -1,
router: "sunroofControl",
index: 2,
},
{
name: "通风窗3",
status: -1,
router: "sunroofControl",
index: 3,
},
{
name: "通风窗4",
status: -1,
router: "sunroofControl",
index: 4,
},
{
name: "通风窗5",
status: -1,
router: "sunroofControl",
index: 5,
},
{
name: "通风窗6",
status: -1,
router: "sunroofControl",
index: 6,
},
];
let newList;
if (el.child.length) {
newList = that.toNewList(list, el.child);
} else {
newList = list;
}
this.routerList.push({
id: el.id,
sort: el.sort,
name: el.nickName,
list: newList,
router: "sunroofControl",
});
} else if (el.id == 25) {
var list = [
{ name: '外遮阳1', status: -1, router: 'outsizeSunshade', index: 1 },
{ name: '外遮阳2', status: -1, router: 'outsizeSunshade', index: 2 },
]
let newList
{
name: "外遮阳1",
status: -1,
router: "outsizeSunshade",
index: 1,
},
{
name: "外遮阳2",
status: -1,
router: "outsizeSunshade",
index: 2,
},
];
let newList;
if (el.child.length) {
newList = that.toNewList(list, el.child)
newList = that.toNewList(list, el.child);
} else {
newList = list
newList = list;
}
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: newList, router: "outsizeSunshade",
id: el.id,
sort: el.sort,
name: el.nickName,
list: newList,
router: "outsizeSunshade",
});
} else if (el.id == 24) {
var list = [
{ name: '内遮阳1', status: -1, router: 'insizeSunshade', index: 1 },
{ name: '内遮阳2', status: -1, router: 'insizeSunshade', index: 2 },
]
let newList
{
name: "内遮阳1",
status: -1,
router: "insizeSunshade",
index: 1,
},
{
name: "内遮阳2",
status: -1,
router: "insizeSunshade",
index: 2,
},
];
let newList;
if (el.child.length) {
newList = that.toNewList(list, el.child)
newList = that.toNewList(list, el.child);
} else {
newList = list
newList = list;
}
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: newList, router: "insizeSunshade",
id: el.id,
sort: el.sort,
name: el.nickName,
list: newList,
router: "insizeSunshade",
});
} else if (el.id == 27) {
var list = [
{ name: '内保温1', status: -1, router: 'internalInsulation', index: 1 },
{ name: '内保温2', status: -1, router: 'internalInsulation', index: 2 },
]
let newList
{
name: "内保温1",
status: -1,
router: "internalInsulation",
index: 1,
},
{
name: "内保温2",
status: -1,
router: "internalInsulation",
index: 2,
},
];
let newList;
if (el.child.length) {
newList = that.toNewList(list, el.child)
newList = that.toNewList(list, el.child);
} else {
newList = list
newList = list;
}
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: newList, router: "internalInsulation",
id: el.id,
sort: el.sort,
name: el.nickName,
list: newList,
router: "internalInsulation",
});
} else if (el.id == 29) {
var list = [
{ name: '立面保温1', status: -1, router: 'facadeInsulation', index: 1 },
{ name: '立面保温2', status: -1, router: 'facadeInsulation', index: 2 },
{ name: '立面保温3', status: -1, router: 'facadeInsulation', index: 3 },
{ name: '立面保温4', status: -1, router: 'facadeInsulation', index: 4 },
]
let newList
{
name: "立面保温1",
status: -1,
router: "facadeInsulation",
index: 1,
},
{
name: "立面保温2",
status: -1,
router: "facadeInsulation",
index: 2,
},
{
name: "立面保温3",
status: -1,
router: "facadeInsulation",
index: 3,
},
{
name: "立面保温4",
status: -1,
router: "facadeInsulation",
index: 4,
},
];
let newList;
if (el.child.length) {
newList = that.toNewList(list, el.child)
newList = that.toNewList(list, el.child);
} else {
newList = list
newList = list;
}
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: newList, router: "facadeInsulation",
id: el.id,
sort: el.sort,
name: el.nickName,
list: newList,
router: "facadeInsulation",
});
} else if (el.id == 26) {
var list = [
{ name: '风机', status: -1, router: 'wetFan', index: 1 },
{ name: '湿帘泵', status: -1, router: 'wetFan', index: 2 },
{ name: '湿帘外翻窗', status: -1, router: 'wetFan', index: 3 },
]
let newList
if (el.child.length) {
newList=that.toNewList(list,el.child)
} else {
newList = list
}
{ name: "风机", status: -1, router: "wetFan", index: 1 },
{ name: "湿帘泵", status: -1, router: "wetFan", index: 2 },
{ name: "湿帘外翻窗", status: -1, router: "wetFan", index: 3 },
];
let newList;
if (el.child.length) {
newList = that.toNewList(list, el.child);
} else {
newList = list;
}
this.routerList.push({
id: el.id, sort: el.sort, name: el.nickName, list: newList, router: "wetFan"
id: el.id,
sort: el.sort,
name: el.nickName,
list: newList,
router: "wetFan",
});
} else if (el.id == 21) {
var list = [
{ name: '环流风扇1', status: -1, router: 'circulationCan', index: 1 },
{ name: '环流风扇2', status: -1, router: 'circulationCan', index: 2 },
]
let newList
if (el.child.length) {
newList=that.toNewList(list,el.child)
} else {
newList = list
}
{
name: "环流风扇1",
status: -1,
router: "circulationCan",
index: 1,
},
{
name: "环流风扇2",
status: -1,
router: "circulationCan",
index: 2,
},
];
let newList;
if (el.child.length) {
newList = that.toNewList(list, el.child);
} else {
newList = list;
}
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: newList, router: "circulationCan",
id: el.id,
sort: el.sort,
name: el.nickName,
list: newList,
router: "circulationCan",
});
} else if (el.id == 28) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [], router: "air-conditioning",
id: el.id,
sort: el.sort,
name: el.nickName,
list: [],
router: "air-conditioning",
isRouter: true,
});
}else if (el.id == 20) {
} else if (el.id == 20) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [], router: "LED",
id: el.id,
sort: el.sort,
name: el.nickName,
list: [],
router: "LED",
isRouter: true,
});
} else if (el.id == 23) {
var list = [
{ name: '高压微雾1', status: -1, router: 'coercionMist', index: 1 },
{ name: '高压微雾2', status: -1, router: 'coercionMist', index: 2 },
]
let newList
if (el.child.length) {
newList=that.toNewList(list,el.child)
} else {
newList = list
}
{
name: "高压微雾1",
status: -1,
router: "coercionMist",
index: 1,
},
{
name: "高压微雾2",
status: -1,
router: "coercionMist",
index: 2,
},
];
let newList;
if (el.child.length) {
newList = that.toNewList(list, el.child);
} else {
newList = list;
}
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: newList, router: "coercionMist"
id: el.id,
sort: el.sort,
name: el.nickName,
list: newList,
router: "coercionMist",
});
} else if (el.id == 11 || el.id == 12 || el.id == 13 || el.id == 14 || el.id == 15 || el.id == 16 || el.id == 17 || el.id == 18) {
if (!this.routerList.some(item => item.router === "electromagneticControl")) {
} else if (
el.id == 11 ||
el.id == 12 ||
el.id == 13 ||
el.id == 14 ||
el.id == 15 ||
el.id == 16 ||
el.id == 17 ||
el.id == 18
) {
if (
!this.routerList.some(
(item) => item.router === "electromagneticControl"
)
) {
this.routerList.push({
id: el.id, sort: el.sort,
name: '电磁阀',
id: el.id,
sort: el.sort,
name: "电磁阀",
list: [],
router: "electromagneticControl"
router: "electromagneticControl",
});
}
let targetObject = this.routerList.find(item => item.router === 'electromagneticControl');
let targetObject = this.routerList.find(
(item) => item.router === "electromagneticControl"
);
if (el.id == 11) {
targetObject.list.push({ name: el.nickName, status: -1, router: 'electromagneticControl', index: 1 });
targetObject.list.push({
name: el.nickName,
status: -1,
router: "electromagneticControl",
index: 1,
});
} else if (el.id == 12) {
targetObject.list.push({ name: el.nickName, status: -1, router: 'electromagneticControl', index: 2 });
targetObject.list.push({
name: el.nickName,
status: -1,
router: "electromagneticControl",
index: 2,
});
} else if (el.id == 13) {
targetObject.list.push({ name: el.nickName, status: -1, router: 'electromagneticControl', index: 3 });
targetObject.list.push({
name: el.nickName,
status: -1,
router: "electromagneticControl",
index: 3,
});
} else if (el.id == 14) {
targetObject.list.push({ name: el.nickName, status: -1, router: 'electromagneticControl', index: 4 });
targetObject.list.push({
name: el.nickName,
status: -1,
router: "electromagneticControl",
index: 4,
});
} else if (el.id == 15) {
targetObject.list.push({ name: el.nickName, status: -1, router: 'electromagneticControl', index: 5 });
targetObject.list.push({
name: el.nickName,
status: -1,
router: "electromagneticControl",
index: 5,
});
} else if (el.id == 16) {
targetObject.list.push({ name: el.nickName, status: -1, router: 'electromagneticControl', index: 6 });
targetObject.list.push({
name: el.nickName,
status: -1,
router: "electromagneticControl",
index: 6,
});
} else if (el.id == 17) {
targetObject.list.push({ name: el.nickName, status: -1, router: 'electromagneticControl', index: 7 });
targetObject.list.push({
name: el.nickName,
status: -1,
router: "electromagneticControl",
index: 7,
});
} else if (el.id == 18) {
targetObject.list.push({ name: el.nickName, status: -1, router: 'electromagneticControl', index: 8 });
targetObject.list.push({
name: el.nickName,
status: -1,
router: "electromagneticControl",
index: 8,
});
}
} else if (el.id == 5) {
this.routerList.push({
id: el.id, sort: el.sort,
id: el.id,
sort: el.sort,
name: el.nickName,
list: [],
router: "sensorSet-con",
@ -314,7 +541,8 @@ if (el.child.length) {
});
} else if (el.id == 6) {
this.routerList.push({
id: el.id, sort: el.sort,
id: el.id,
sort: el.sort,
name: el.nickName,
list: [],
router: "synthesis-con",
@ -322,33 +550,88 @@ if (el.child.length) {
});
} else if (el.id == 7) {
this.routerList.push({
id: el.id, sort: el.sort,
id: el.id,
sort: el.sort,
name: el.nickName,
list: [],
router: "upload-con",
isRouter: true,
});
} else if (el.id == 2) {
this.routerList.push({ id: el.id, sort: el.sort, name: el.nickName, list: [], router: "forceOutput", isRouter: true });
this.routerList.push({
id: el.id,
sort: el.sort,
name: el.nickName,
list: [],
router: "forceOutput",
isRouter: true,
});
} else if (el.id == 4) {
this.routerList.push({ id: el.id, sort: el.sort, name: el.nickName, list: [], router: "intrinsicParameter", isRouter: true });
this.routerList.push({
id: el.id,
sort: el.sort,
name: el.nickName,
list: [],
router: "intrinsicParameter",
isRouter: true,
});
} else if (el.id == 22) {
this.routerList.push({ name: el.nickName, list: [], router: "parameterSet", isRouter: true });
this.routerList.push({
name: el.nickName,
list: [],
router: "parameterSet",
isRouter: true,
});
} else if (el.id == 8) {
this.routerList.push(
{ id: el.id, sort: el.sort, name: "加热水泵", list: [], router: "waterPump", isRouter: true },
{
id: el.id, sort: el.sort,
id: el.id,
sort: el.sort,
name: "加热水泵",
list: [],
router: "waterPump",
isRouter: true,
},
{
id: el.id,
sort: el.sort,
name: "地热风机",
list: [],
router: "geothermalFan",
isRouter: true,
},
{ id: el.id, sort: el.sort, name: "上风口", list: [], router: "uptake", isRouter: true },
{ id: el.id, sort: el.sort, name: "下风口", list: [], router: "downtake", isRouter: true },
{ id: el.id, sort: el.sort, name: "卷被", list: [], router: "rollByRoll", isRouter: true },
{ id: el.id, sort: el.sort, name: "除雪", list: [], router: "snowRemoval", isRouter: true }
{
id: el.id,
sort: el.sort,
name: "上风口",
list: [],
router: "uptake",
isRouter: true,
},
{
id: el.id,
sort: el.sort,
name: "下风口",
list: [],
router: "downtake",
isRouter: true,
},
{
id: el.id,
sort: el.sort,
name: "卷被",
list: [],
router: "rollByRoll",
isRouter: true,
},
{
id: el.id,
sort: el.sort,
name: "除雪",
list: [],
router: "snowRemoval",
isRouter: true,
}
);
if (
this.routerNow != "/waterPump" &&
@ -360,50 +643,76 @@ if (el.child.length) {
) {
this.loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
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,
deviceId:
store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readControl_fiveControl(data).then((res) => {
this.loading.close()
store.ControlData = res.data.data
this.loading.close();
store.ControlData = res.data.data;
//waterPump
store.ControlData['21521'] = this.countData(store.ControlData['21521'])
store.ControlData['21522'] = this.countData10(store.ControlData['21522'])
store.ControlData['21523'] = this.countData(store.ControlData['21523'])
store.ControlData['21524'] = this.countData(store.ControlData['21524'])
store.ControlData["21521"] = this.countData(
store.ControlData["21521"]
);
store.ControlData["21522"] = this.countData10(
store.ControlData["21522"]
);
store.ControlData["21523"] = this.countData(
store.ControlData["21523"]
);
store.ControlData["21524"] = this.countData(
store.ControlData["21524"]
);
//downtake
store.ControlData["21544"] = this.countData(store.ControlData["21544"]);
store.ControlData["21544"] = this.countData(
store.ControlData["21544"]
);
//geothermalFan
store.ControlData['21527'] = this.countData(store.ControlData['21527'])
store.ControlData['21528'] = this.countData10(store.ControlData['21528'])
store.ControlData["21527"] = this.countData(
store.ControlData["21527"]
);
store.ControlData["21528"] = this.countData10(
store.ControlData["21528"]
);
//rollByRoll
store.ControlData['21552'] = this.countData(store.ControlData['21552'])
store.ControlData['21550'] = this.countData10(store.ControlData['21550'])
store.ControlData["21552"] = this.countData(
store.ControlData["21552"]
);
store.ControlData["21550"] = this.countData10(
store.ControlData["21550"]
);
//snowRemoval
store.ControlData['21544'] = this.countData(store.ControlData['21544'])
store.ControlData["21544"] = this.countData(
store.ControlData["21544"]
);
//
store.ControlData['21532'] = this.countData(store.ControlData['21532'])
store.ControlData['21533'] = this.countData10(store.ControlData['21533'])
store.ControlData['21562'] = this.countData10(store.ControlData['21562'])
store.ControlData["21532"] = this.countData(
store.ControlData["21532"]
);
store.ControlData["21533"] = this.countData10(
store.ControlData["21533"]
);
store.ControlData["21562"] = this.countData10(
store.ControlData["21562"]
);
});
}
} else if (el.id == 9) {
this.routerList.push(
{
id: el.id, sort: el.sort,
id: el.id,
sort: el.sort,
name: "日光温室特殊参数(山地型温室)",
router: "skylight",
list: [
@ -414,7 +723,8 @@ if (el.child.length) {
],
},
{
id: el.id, sort: el.sort,
id: el.id,
sort: el.sort,
name: "风机(山地型温室)",
router: "fan",
list: [
@ -426,25 +736,45 @@ if (el.child.length) {
],
}
);
} else if (el.id == 30) {
var list = [
{ name: "CO2补气", status: -1, router: "CO2", index: 1 },
{ name: "CO2补气", status: -1, router: "CO2", index: 2 },
];
let newList;
if (el.child.length) {
newList = that.toNewList(list, el.child);
} else {
newList = list;
}
this.routerList.push({
id: el.id,
sort: el.sort,
name: el.nickName,
list: newList,
router: "CO2",
});
}
})
});
// this.routerList.sort((a, b) => a.sort - b.sort);
this.routerList.push({ name: '系统参数配置', list: [], router: 'systemSet-con', isRouter: true, },);
this.routerList.push({
name: "系统参数配置",
list: [],
router: "systemSet-con",
isRouter: true,
});
var router = this.$route.query
var router = this.$route.query;
if (router.token && router.userid) {
return
return;
}
if (this.$route.name == this.routerList[0].router) {
return
return;
}
this.$router.push({ path: `/${this.routerList[0].router}` });
});
},
//
toHome(index) {
@ -479,18 +809,24 @@ if (el.child.length) {
// }
else {
if (item.index) {
if (item.router == this.routerNow && item.index == this.$route.query.id) {
return
if (
item.router == this.routerNow &&
item.index == this.$route.query.id
) {
return;
}
this.$router.push({ path: `/${item.router}`,query:{id:item.index,name:item.name} })
this.$router.push({
path: `/${item.router}`,
query: { id: item.index, name: item.name },
});
return
return;
}
if (item.router == this.routerNow) {
return
return;
}
this.$router.push({ name: item.router,query:{name:item.name} });
this.$router.push({ name: item.router, query: { name: item.name } });
}
}
},
@ -524,7 +860,8 @@ if (el.child.length) {
}
.el-collapse-item {
&.active {}
&.active {
}
}
.no-list {
@ -545,7 +882,7 @@ if (el.child.length) {
padding-left: 10px;
cursor: pointer;
>div {
> div {
width: 260px;
height: 40px;
// background: rgba(255, 255, 255, 0.1);

View File

@ -147,6 +147,10 @@ const routes = [
path: '/fan',
name: 'fan',
component: () => import('../views/page/fan.vue')
},{
path: '/CO2',
name: 'CO2',
component: () => import('../views/page/CO2.vue')
},{
path: '/skylight',
name: 'skylight',

535
src/views/page/CO2.vue Normal file
View File

@ -0,0 +1,535 @@
<template>
<div class="wetFan">
<div class="table-title">
<img src="../../assets/img/targetCo2.png" alt="" />{{ pageName }}
</div>
<div class="title-tips">
工作方式选择
<div class="input-btn">
<div
class="btn btn-tips"
@click="changeOpen(0)"
:class="
inputData[this.startList[this.indexs - 1]] == 0 ? 'blue' : 'green'
"
>
{{
inputData[this.startList[this.indexs - 1]] == 0 ? "无效" : "有效"
}}
</div>
</div>
</div>
<div class="flex-view">
<div class="input-btn">
<div
class="btn"
@click="changeOpen(1)"
:class="
inputData[this.startList[this.indexs - 1]] == 1 ? 'blue' : 'green'
"
>
<img src="../../assets/image/irrigateSet2.png" alt="" />自动运行
</div>
<div
class="btn"
@click="changeOpen(2)"
:class="
inputData[this.startList[this.indexs - 1]] == 2 ? 'blue' : 'green'
"
>
<img src="../../assets/image/irrigateSet3.png" alt="" />手动打开
</div>
<div
class="btn"
@click="changeOpen(3)"
:class="
inputData[this.startList[this.indexs - 1]] == 3 ? 'blue' : 'green'
"
>
<img src="../../assets/image/irrigateSet1.png" alt="" />手动关闭
</div>
</div>
</div>
<div class="flex-view padding-none border-none shrink-none">
<div class="input-sel input-sel-w180">
<span>光照来源选择</span>
<el-dropdown
@command="handleCommand1($event, startList[indexs - 1] + 2)"
>
<div class="el-dropdown-link">
<input
v-model="inputDataNew[startList[indexs - 1] + 2]"
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>
<div class="flex-view padding-none border-none shrink-none">
<div class="input-main-80">
<span>光照确定时间</span>
<input
@blur="blurChange(startList[indexs - 1] + 3, $event)"
v-model="inputData[startList[indexs - 1] + 3]"
@input="change(startList[indexs - 1] + 3, $event)"
type="text"
placeholder="0"
/>
<span>分钟</span>
</div>
</div>
<div class="flex-view padding-none border-none shrink-none">
<div class="input-main-80">
<span>补气工作限制</span>
<input
@blur="blurChange(startList[indexs - 1] + 4, $event)"
v-model="inputData[startList[indexs - 1] + 4]"
@input="change(startList[indexs - 1] + 4, $event)"
type="text"
placeholder="0"
/>
<span>:</span>
<input
@blur="blurChange(startList[indexs - 1] + 5, $event)"
v-model="inputData[startList[indexs - 1] + 5]"
@input="change(startList[indexs - 1] + 5, $event)"
type="text"
placeholder="0"
/>
<span></span>
<input
@blur="blurChange(startList[indexs - 1] + 6, $event)"
v-model="inputData[startList[indexs - 1] + 6]"
@input="change(startList[indexs - 1] + 6, $event)"
type="text"
placeholder="0"
/>
<span>:</span>
<input
@blur="blurChange(startList[indexs - 1] + 7, $event)"
v-model="inputData[startList[indexs - 1] + 7]"
@input="change(startList[indexs - 1] + 7, $event)"
type="text"
placeholder="0"
/>
</div>
</div>
<div class="flex-view padding-none border-none shrink-none">
<div class="input-btn">
<div
class="btn btn-w80"
@click="changeIndexOpen1(0)"
:class="actList2[0] == '1' ? 'blue' : 'off'"
>
{{ actList2[0] == "1" ? "有效" : "无效" }}
</div>
</div>
<div class="input-main-80">
<span>光照大于</span>
<input
@blur="blurChange10(startList[indexs - 1] + 8, $event)"
v-model="inputData[startList[indexs - 1] + 8]"
@input="changeCount10(startList[indexs - 1] + 8, $event)"
type="text"
placeholder="0"
/>
<span>KLU,允许补气</span>
</div>
</div>
<div class="flex-view padding-none border-none shrink-none">
<div class="input-btn">
<div
class="btn btn-w80"
@click="changeIndexOpen1(1)"
:class="actList2[1] == '1' ? 'blue' : 'off'"
>
{{ actList2[1] == "1" ? "有效" : "无效" }}
</div>
</div>
<div class="input-main-80">
<span>室内温度大于</span>
<input
@blur="blurChange(startList[indexs - 1] + 9, $event)"
v-model="inputData[startList[indexs - 1] + 9]"
@input="change(startList[indexs - 1] + 9, $event)"
type="text"
placeholder="0"
/>
<span>允许补气</span>
</div>
</div>
<div class="flex-view padding-none border-none shrink-none">
<div class="input-main-80">
<span>二氧化碳浓度低于</span>
<input
@blur="blurChange(startList[indexs - 1] + 10, $event)"
v-model="inputData[startList[indexs - 1] + 10]"
@input="change(startList[indexs - 1] + 10, $event)"
type="text"
placeholder="0"
/>
<span>ppm,开始补气</span>
</div>
</div>
<div class="flex-view padding-none border-none shrink-none">
<div class="input-main-80">
<span>二氧化碳浓度高于</span>
<input
@blur="blurChange(startList[indexs - 1] + 11, $event)"
v-model="inputData[startList[indexs - 1] + 11]"
@input="change(startList[indexs - 1] + 11, $event)"
type="text"
placeholder="0"
/>
<span>ppm,停止补气</span>
</div>
</div>
<div class="flex-view padding-none border-none shrink-none">
<div class="input-main-80">
<span>开启</span>
<input
@blur="blurChange(startList[indexs - 1] + 12, $event)"
v-model="inputData[startList[indexs - 1] + 12]"
@input="change(startList[indexs - 1] + 12, $event)"
type="text"
placeholder="0"
/>
<span> 关闭多少</span>
<input
@blur="blurChange(startList[indexs - 1] + 13, $event)"
v-model="inputData[startList[indexs - 1] + 13]"
@input="change(startList[indexs - 1] + 13, $event)"
type="text"
placeholder="0"
/>
<span>进行间隔补气</span>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
inputData: [],
inputDataNew: [],
indexs: 1,
actList1: [],
actList2: [],
startList: [22360, 22378],
loading: null,
pageName: "CO2补气",
typeList1: [
{ label: "室外光照", value: 0 },
{ label: "室内光照", value: 1 },
],
};
},
watch: {
$route(newVal, oldVal) {
const that = this;
this.indexs = this.$route.query.id ? this.$route.query.id : 1;
if (this.$route.query.name) {
this.pageName = this.$route.query.name;
}
setTimeout(() => {
that.getActive1();
that.getActive2();
}, 0);
},
"$store.state.equipmentIndex"(newVal, oldVal) {
this.dataInit();
},
},
mounted() {
const that = this;
this.indexs = this.$route.query.id ? this.$route.query.id : 1;
setTimeout(() => {
that.dataInit();
}, 0);
//input
let inputList = document.querySelectorAll("input");
for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue; //input
}
if (this.$route.query.name) {
this.pageName = this.$route.query.name;
}
},
methods: {
// 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;
}
},
// (x - 400) / 10
countData(data) {
if (data) {
return (data - 400) / 10;
} else {
return 0;
}
},
//
blurChangeCount(code, el) {
var store = this.$store.state;
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: el.target.value * 10 + 400,
}; //
if (store.nowInput != el.target.value) {
this.changeData(data);
}
// if (this.timer) {
// this.timer && clearInterval(this.timer);
// this.changeData(data);
// }
},
changeCountData(code, el) {
var data = el.target.value * 10 + 400;
var sendData = {
target: {
value: data,
},
};
this.change(code, sendData);
},
getData1(data) {
var name = "";
this.typeList1.forEach((el, index) => {
if (el.value == data) {
name = el.label;
}
});
return name;
},
handleCommand1(command, code) {
this.typeList1.forEach((el, index) => {
if (el.value == command) {
this.inputDataNew[code] = el.label;
}
});
this.inputData[code] = command;
var dataNum = {
target: {
value: command,
},
};
this.changeBtn(code, dataNum);
},
//
changeIndexOpen1(active) {
if (this.actList2[active] == "1") {
this.actList2[active] = "0";
} else {
this.actList2[active] = "1";
}
this.$forceUpdate();
var revList = this.actList2.slice().reverse();
var num = revList.join("");
var dataNum = {
target: {
value: parseInt(num, 2),
},
};
this.changeBtn(this.startList[this.indexs - 1] + 1, dataNum);
},
getActive1() {
this.actList1 = [];
var num = this.inputData[this.startList[this.indexs - 1]];
var num1 = this.padString(num.toString(2), 4);
var openListNew = [];
openListNew = num1.split("");
this.actList1 = openListNew.reverse();
},
getActive2() {
this.actList2 = [];
var num = this.inputData[this.startList[this.indexs - 1] + 1];
var num1 = this.padString(num.toString(2), 2);
var openListNew = [];
openListNew = num1.split("");
this.actList2 = openListNew.reverse();
},
//
changeOpen(index) {
this.inputData[this.startList[this.indexs - 1]] = index;
var dataNum = {
target: {
value: index,
},
};
this.changeBtn(this.startList[this.indexs - 1], dataNum);
},
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.co2replenishment(data).then((res) => {
this.loading.close();
if (res.data.code == 200) {
this.inputData = res.data.data;
this.inputDataNew = JSON.parse(JSON.stringify(res.data.data));
this.getActive1();
this.getActive2();
this.startList.forEach((el, index) => {
this.inputData[el + 8] = this.countData10(this.inputData[el + 8]);
this.inputDataNew[el + 2] = this.getData1(this.inputData[el + 2]);
});
}
});
},
//
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);
},
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>

File diff suppressed because it is too large Load Diff

View File

@ -236,6 +236,66 @@
<div>当前设备无效</div>
</div>
</div>
<!-- 冷暖风机 -->
<div class="status-view-content" v-else-if="item.type == 18">
<div v-if="item.open != 0" class="status-true">
<div class="status-true-sel">
<div class="sel-auto">
<img v-if="item.open == 1" src="../../assets/img/status-true-sel.png" alt="">
<img v-else src="../../assets/img/status-true-nosel.png" alt="">
自动控制
</div>
<div class="sel-phone">
<img v-if="item.open != 1" src="../../assets/img/status-true-sel.png" alt="">
<img v-else src="../../assets/img/status-true-nosel.png" alt="">
手机控制
</div>
</div>
<div class="status-true-sel">
<div class="sel-auto">
<img v-if="item.count == 1" src="../../assets/img/status-true-sel.png" alt="">
<img v-else src="../../assets/img/status-true-nosel.png" alt="">
加热模式
</div>
<div class="sel-phone">
<img v-if="item.count != 1" src="../../assets/img/status-true-sel.png" alt="">
<img v-else src="../../assets/img/status-true-nosel.png" alt="">
制冷模式
</div>
</div>
<div class="status-fan">
<div class="btn" :class="item.status[0] == 1 ? 'blue' : 'off'">
<img class="fan-img" v-if="item.status[1] == 1" src="../../assets/img/fan-on.png"
alt="">
<img v-else src="../../assets/img/fan-off.png" alt="">
<span>1#通道</span>
</div>
<div class="btn" :class="item.status[1] == 1 ? 'blue' : 'off'">
<img class="fan-img" v-if="item.status[2] == 1" src="../../assets/img/fan-on.png"
alt="">
<img v-else src="../../assets/img/fan-off.png" alt="">
<span>2#通道</span>
</div>
<div class="btn" :class="item.status[2] == 1 ? 'blue' : 'off'">
<img class="fan-img" v-if="item.status[3] == 1" src="../../assets/img/fan-on.png"
alt="">
<img v-else src="../../assets/img/fan-off.png" alt="">
<span>3#通道</span>
</div>
<div class="btn" :class="item.status[3] == 1 ? 'blue' : 'off'">
<img class="fan-img" v-if="item.status[4] == 1" src="../../assets/img/fan-on.png"
alt="">
<img v-else src="../../assets/img/fan-off.png" alt="">
<span>4#通道</span>
</div>
<div style="display: none;"></div>
</div>
</div>
<div v-else class="status-noTrue">
<img src="../../assets/img/status-no.png" alt="">
<div>当前设备无效</div>
</div>
</div>
<!-- 顶卷膜及其他 -->
<div class="status-view-content" v-else>
<div v-if="item.open != 0" class="status-true">
@ -274,7 +334,7 @@
<span>{{ item.index == 1 ? '开启' : '关闭' }}</span>
</div>
</div>
<div class="status-true-text" v-if="item.type == 15">
<div class="status-true-text" v-if="item.type == 15|| item.type == 17">
<div class="status-true-text-left">计算结果</div>
<div class="status-true-text-right">
{{ item.count }}</div>
@ -810,7 +870,7 @@ export default {
} else {
return ''
}
} else if (item.type == 4) {
} else if (item.type == 4||item.type == 17) {
//
if (index == 0) {
return require('../../assets/img/fan-off.png')
@ -1636,7 +1696,15 @@ export default {
statusList.push(statusData)
} else if (el.id ==38) {
//
var statusData = { name: el.nickName, type:11, id: el.id, open: res.data.data['1160'], progress: 0, index: res.data.data['1161'], count: res.data.data['1162'] }
var statusData = { name: el.nickName, type:17, id: el.id, open: res.data.data['1160'], progress: 0, index: res.data.data['1161'], count: res.data.data['1162'] }
statusList.push(statusData)
} else if (el.id ==40||el.id ==41) {
//CO2
var statusData = { name: el.nickName, type:11, id: el.id, open: res.data.data[(1178 + ((el.id - 40) * 2))], progress: 0, index: res.data.data[(1179 + ((el.id - 40) * 2))], count: 0 }
statusList.push(statusData)
}else if (el.id ==39) {
//CO2
var statusData = { name: el.nickName, type:18, id: el.id, open: res.data.data['1175'], progress: 0, index: res.data.data['1177'], count: res.data.data['1176'] }
statusList.push(statusData)
}

View File

@ -118,16 +118,16 @@
<span>跳过通风窗直接启动风机</span>
</div>
</div>
<!-- <div class="flex-view border-none shrink-none padding-none">
<div class="flex-view border-none shrink-none padding-none">
<div class="input-btn">
<div class="btn btn-w80" @click="changeIndexOpen1(2)" :class="actList2[2] == '1' ? 'blue' : 'off'">
{{actList2[2] == '1' ? '有效' : '无效'}}
</div>
</div>
<div class="input-main-80">
<span>预留条件</span>
<span>通风窗达到最大降温启动风机条件</span>
</div>
</div> -->
</div>
<div class="flex-view shrink-none padding-none">
<div class="input-btn">
<div class="btn btn-w80" @click="changeIndexOpen1(3)" :class="actList2[3] == '1' ? 'blue' : 'off'">