Merge pull request 'pc-master' (#124) from pc-master into portal

Reviewed-on: #124
portal
xiaomeng 2024-03-05 07:58:58 +00:00
commit 538a3c741c
3 changed files with 315 additions and 300 deletions

View File

@ -9,17 +9,17 @@
</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">
? '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 ? "离线" : "在线" }}
@ -34,6 +34,7 @@
</el-collapse>
</div>
</template>
<script>
export default {
data() {
@ -78,292 +79,253 @@ export default {
this.api.getcontrol_cpermission(data).then((res) => {
this.routerList = [];
this.purview = res.data.data;
var isParamInArray = this.purview.some((obj) => obj["id"] === 8); //
var isParamInArray1 = this.purview.some((obj) => obj["id"] === 9); //
var isParamInArray2 = this.purview.some((obj) => obj["id"] === 6); //
var isParamInArray3 = this.purview.some((obj) => obj["id"] === 5); //
var isParamInArray4 = this.purview.some((obj) => obj["id"] === 7); //
var isParamInArray5 = this.purview.some((obj) => obj["id"] === 1); //
var isParamInArray6 = this.purview.some((obj) => obj["id"] === 3); //
var isParamInArray7 = this.purview.some((obj) => obj["id"] === 4); //
var isParamInArray8 = this.purview.some((obj) => obj["id"] === 11); //1
var isParamInArray9 = this.purview.some((obj) => obj["id"] === 12); //2
var isParamInArray10 = this.purview.some((obj) => obj["id"] === 13); //3
var isParamInArray11 = this.purview.some((obj) => obj["id"] === 14); //4
var isParamInArray12 = this.purview.some((obj) => obj["id"] === 15); //5
var isParamInArray13 = this.purview.some((obj) => obj["id"] === 16); //6
var isParamInArray14 = this.purview.some((obj) => obj["id"] === 17); //7
var isParamInArray15 = this.purview.some((obj) => obj["id"] === 18); //8
var isParamInArray16 = this.purview.some((obj) => obj["id"] === 19); //
var isParamInArray17 = this.purview.some((obj) => obj["id"] === 20); //
var isParamInArray18 = this.purview.some((obj) => obj["id"] === 21); //
var isParamInArray19 = this.purview.some((obj) => obj["id"] === 22); //
var isParamInArray20 = this.purview.some((obj) => obj["id"] === 23);//
var isParamInArray21 = this.purview.some((obj) => obj["id"] === 24);//
var isParamInArray22 = this.purview.some((obj) => obj["id"] === 25);//
var isParamInArray23 = this.purview.some((obj) => obj["id"] === 26);//湿
var isParamInArray24 = this.purview.some((obj) => obj["id"] === 2);//
var isParamInArray25 = this.purview.some((obj) => obj["id"] === 27);//
if (isParamInArray) {
this.routerList.push(
{ name: "加热水泵", list: [], router: "waterPump", isRouter: true },
{
name: "地热风机",
list: [],
router: "geothermalFan",
isRouter: true,
},
{ name: "上风口", list: [], router: "uptake", isRouter: true },
{ name: "下风口", list: [], router: "downtake", isRouter: true },
{ name: "卷被", list: [], router: "rollByRoll", isRouter: true },
{ name: "除雪", list: [], router: "snowRemoval", isRouter: true }
);
if (
this.routerNow != "/waterPump" &&
this.routerNow != "/geothermalFan" &&
this.routerNow != "/uptake" &&
this.routerNow != "/downtake" &&
this.routerNow != "/rollByRoll" &&
this.routerNow != "/snowRemoval"
) {
//
var store = this.$store.state;
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readControl_fiveControl(data).then((res) => {
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'])
//downtake
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'])
//rollByRoll
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['21532'] = this.countData(store.ControlData['21532'])
store.ControlData['21533'] = this.countData10(store.ControlData['21533'])
store.ControlData['21562'] = this.countData10(store.ControlData['21562'])
this.purview.forEach((el, index) => {
if (el.id == 1) {
this.routerList.push(
{
id: el.id, sort: el.sort,
name: el.nickName,
router: "targetTemperature",
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 }
],
},
);
} 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) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, 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 },
], router: "sunroofControl",
});
}
}
if (isParamInArray1) {
this.routerList.push(
{
name: "日光温室特殊参数(丽水项目)",
router: "skylight",
list: [
{ name: "顶卷膜1", status: -1, router: "skylight", index: 1 },
{ name: "顶卷膜2", status: -1, router: "skylight", index: 2 },
{ name: "顶卷膜3", status: -1, router: "skylight", index: 3 },
{ name: "顶卷膜4", status: -1, router: "skylight", index: 4 },
],
},
{
name: "风机(丽水项目)",
router: "fan",
list: [
{ name: "风机1", status: -1, router: "fan", index: 1 },
{ name: "风机2", status: -1, router: "fan", index: 2 },
{ name: "风机3", status: -1, router: "fan", index: 3 },
{ name: "风机4", status: -1, router: "fan", index: 4 },
{ name: "风机5", status: -1, router: "fan", index: 5 },
],
} else if (el.id == 25) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [
{ name: '外遮阳1', status: -1, router: 'outsizeSunshade', index: 1 },
{ name: '外遮阳2', status: -1, router: 'outsizeSunshade', index: 2 },
], router: "outsizeSunshade",
});
} else if (el.id == 24) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [
{ name: '内遮阳1', status: -1, router: 'insizeSunshade', index: 1 },
{ name: '内遮阳2', status: -1, router: 'insizeSunshade', index: 2 },
], router: "insizeSunshade",
});
} else if (el.id == 27) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [
{ name: '内保温1', status: -1, router: 'internalInsulation', index: 1 },
{ name: '内保温2', status: -1, router: 'internalInsulation', index: 2 },
], router: "internalInsulation",
});
} else if (el.id == 26) {
this.routerList.push({
id: el.id, sort: el.sort, name: el.nickName, list: [
{ name: '风机', status: -1, router: 'wetFan', index: 1 },
{ name: '湿帘泵', status: -1, router: 'wetFan', index: 2 },
{ name: '湿帘外翻窗', status: -1, router: 'wetFan', index: 3 },
], router: "wetFan"
});
} else if (el.id == 21) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [
{ name: '环流风扇1', status: -1, router: 'circulationCan', index: 1 },
{ name: '环流风扇2', status: -1, router: 'circulationCan', index: 2 },
], router: "circulationCan",
});
} else if (el.id == 20) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [], router: "LED",
isRouter: true,
});
} else if (el.id == 23) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName, list: [
{ name: '高压微雾1', status: -1, router: 'coercionMist', index: 1 },
{ name: '高压微雾2', status: -1, router: 'coercionMist', index: 2 },
], 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")) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName,
list: [],
router: "electromagneticControl"
});
}
);
}
if (isParamInArray2) {
this.routerList.push({
name: "传感器输入合成",
list: [],
router: "synthesis-con",
isRouter: true,
});
}
if (isParamInArray3) {
this.routerList.push({
name: "传感器通道配置",
list: [],
router: "sensorSet-con",
isRouter: true,
});
}
if (isParamInArray4) {
this.routerList.push({
name: "数据上传",
list: [],
router: "upload-con",
isRouter: true,
});
}
if (isParamInArray5) {
this.routerList.push(
{
name: "目标值",
router: "targetTemperature,targetHumidity,targetCo2",
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 }
],
},
);
}
if (isParamInArray6) {
this.routerList.push(
{
name: "报警设置",
router: "alarmSettings",
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 });
} else if (el.id == 12) {
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 });
} else if (el.id == 14) {
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 });
} else if (el.id == 16) {
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 });
} else if (el.id == 18) {
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,
name: el.nickName,
list: [],
isRouter: true
},
);
}
if (isParamInArray7) {
this.routerList.push({ name: "设备固有参数", list: [], router: "intrinsicParameter", isRouter: true });
}
router: "sensorSet-con",
isRouter: true,
});
} else if (el.id == 6) {
this.routerList.push({
id: el.id, sort: el.sort,
name: el.nickName,
list: [],
router: "synthesis-con",
isRouter: true,
});
} else if (el.id == 7) {
this.routerList.push({
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 });
} else if (el.id == 4) {
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 });
} 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,
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 }
);
if (
this.routerNow != "/waterPump" &&
this.routerNow != "/geothermalFan" &&
this.routerNow != "/uptake" &&
this.routerNow != "/downtake" &&
this.routerNow != "/rollByRoll" &&
this.routerNow != "/snowRemoval"
) {
//
var store = this.$store.state;
var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
};
this.api.readControl_fiveControl(data).then((res) => {
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'])
if (isParamInArray8 || isParamInArray9 || isParamInArray10 || isParamInArray11 || isParamInArray12 || isParamInArray13 || isParamInArray14 || isParamInArray15) {
//downtake
store.ControlData["21544"] = this.countData(store.ControlData["21544"]);
this.routerList.push({
name: "电磁自动控制", list: [], router: "electromagneticControl"
},);
let targetObject = this.routerList.find(item => item.name === '电磁自动控制');
if (isParamInArray8) {
targetObject.list.push({ name: '1#电磁阀', status: -1, router: 'electromagneticControl', index: 1 });
//geothermalFan
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'])
//snowRemoval
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'])
});
}
} else if (el.id == 9) {
this.routerList.push(
{
id: el.id, sort: el.sort,
name: "日光温室特殊参数(丽水项目)",
router: "skylight",
list: [
{ name: "顶卷膜1", status: -1, router: "skylight", index: 1 },
{ name: "顶卷膜2", status: -1, router: "skylight", index: 2 },
{ name: "顶卷膜3", status: -1, router: "skylight", index: 3 },
{ name: "顶卷膜4", status: -1, router: "skylight", index: 4 },
],
},
{
id: el.id, sort: el.sort,
name: "风机(丽水项目)",
router: "fan",
list: [
{ name: "风机1", status: -1, router: "fan", index: 1 },
{ name: "风机2", status: -1, router: "fan", index: 2 },
{ name: "风机3", status: -1, router: "fan", index: 3 },
{ name: "风机4", status: -1, router: "fan", index: 4 },
{ name: "风机5", status: -1, router: "fan", index: 5 },
],
}
);
}
if (isParamInArray9) {
targetObject.list.push({ name: '2#电磁阀', status: -1, router: 'electromagneticControl', index: 2 });
}
if (isParamInArray10) {
targetObject.list.push({ name: '3#电磁阀', status: -1, router: 'electromagneticControl', index: 3 });
}
if (isParamInArray11) {
targetObject.list.push({ name: '4#电磁阀', status: -1, router: 'electromagneticControl', index: 4 });
}
if (isParamInArray12) {
targetObject.list.push({ name: '5#电磁阀', status: -1, router: 'electromagneticControl', index: 5 });
}
if (isParamInArray13) {
targetObject.list.push({ name: '6#电磁阀', status: -1, router: 'electromagneticControl', index: 6 });
}
if (isParamInArray14) {
targetObject.list.push({ name: '7#电磁阀', status: -1, router: 'electromagneticControl', index: 7 });
}
if (isParamInArray15) {
targetObject.list.push({ name: '8#电磁阀', status: -1, router: 'electromagneticControl', index: 8 });
}
}
})
// this.routerList.sort((a, b) => a.sort - b.sort);
if (isParamInArray16) {
this.routerList.push({
name: "通风窗控制", 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 },
], router: "sunroofControl",
});
}
if (isParamInArray17) {
this.routerList.push({
name: "补光灯", list: [], router: "LED",
isRouter: true,
});
}
if (isParamInArray18) {
this.routerList.push({
name: "环流风扇", list: [
{ name: '环流风扇1', status: -1, router: 'circulationCan', index: 1 },
{ name: '环流风扇2', status: -1, router: 'circulationCan', index: 2 },
], router: "circulationCan",
});
}
if (isParamInArray19) {
this.routerList.push({ name: "厂家内部参数配置", list: [], router: "parameterSet", isRouter: true });
}
if (isParamInArray20) {
this.routerList.push({
name: "高压微雾", list: [
{ name: '高压微雾1', status: -1, router: 'coercionMist', index: 1 },
{ name: '高压微雾2', status: -1, router: 'coercionMist', index: 2 },
], router: "coercionMist"
});
}
if (isParamInArray21) {
this.routerList.push({
name: "内遮阳控制", list: [
{ name: '内遮阳1', status: -1, router: 'insizeSunshade', index: 1 },
{ name: '内遮阳2', status: -1, router: 'insizeSunshade', index: 2 },
], router: "insizeSunshade",
});
}
if (isParamInArray22) {
this.routerList.push({
name: "外遮阳控制", list: [
{ name: '外遮阳1', status: -1, router: 'outsizeSunshade', index: 1 },
{ name: '外遮阳2', status: -1, router: 'outsizeSunshade', index: 2 },
], router: "outsizeSunshade",
});
}
if (isParamInArray23) {
this.routerList.push({ name: "风机湿帘", list: [
{ name: '风机', status: -1, router: 'wetFan', index: 1 },
{ name: '湿帘泵', status: -1, router: 'wetFan', index: 2 },
{ name: '湿帘外翻窗', status: -1, router: 'wetFan', index: 3 },
], router: "wetFan" });
}
if (isParamInArray24) {
this.routerList.push({ name: "强制输出参数", list: [], router: "forceOutput", isRouter: true });
}
if (isParamInArray25) {
this.routerList.push({
name: "内保温", list: [
{ name: '内保温1', status: -1, router: 'internalInsulation', index: 1 },
{ name: '内保温2', status: -1, router: 'internalInsulation', index: 2 },
], router: "internalInsulation",
});
}
this.routerList.push( { name: '系统参数配置', list: [], router: 'systemSet-con', isRouter: true, },);
this.routerList.push({ name: '系统参数配置', list: [], router: 'systemSet-con', isRouter: true, },);
console.log(this.routerList);
setTimeout(() => {
var router = this.$route.query
if (router.token && router.userid){
return
}
this.$router.push({ path: `/${this.routerList[0].router}` });
}, 0);
if (router.token && router.userid) {
return
}
this.$router.push({ path: `/${this.routerList[0].router}` });
}, 0);
});
},
//
toHome(index) {
@ -416,6 +378,7 @@ export default {
},
};
</script>
<style lang="scss" scoped>
.set-params {
width: 280px;
@ -475,5 +438,4 @@ export default {
}
}
}
</style>
</style>

View File

@ -83,7 +83,7 @@ export default {
activeNames: [3],
leftList: [
{ name: '首页', img: require('../assets/image/index-icon.png'), list: [], router: 'realTime', isRouter: true, },
{ name: '温室', routerList: ['realTime','historyData','exitSettings','videoMonitoring', '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: '温室', routerList: ['realTime','dataAnalysis','historyData','exitSettings','videoMonitoring', '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','historyData', 'irrigateSet','videoMonitoring', 'PIDSet', 'systemSet', 'upload', 'sensorSet', 'realTime', 'history', 'dataAnalysis'], img: require('../assets/image/left-img2.png'), list: [] },
{ name: '生态气象站', routerList: ['realTime','historyData','exitSettings', '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-img3.png'), list: [] },

View File

@ -10,12 +10,12 @@
<div class="search-right">
<span>时间段</span>
<el-date-picker v-model="value1" unlink-panels type="daterange" range-separator=""
start-placeholder="开始日期" end-placeholder="结束日期">
<el-date-picker v-model="dateRange" type="datetimerange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间">
</el-date-picker>
<div class="input-btn">
<div class="btn blue">
查询
<div class="btn blue" @click="search">
查询
</div>
</div>
@ -28,39 +28,92 @@
</div>
</div>
</template>
<script>
import { realTimeLine } from '@/assets/js/charts'
export default {
data() {
return {
value1: '',
indexs: 1,
indexs: 1,
dateRange: [],
}
},
watch:{
$route(newVal, oldVal) {
const that = this;
const store = this.$store.state
this.dataInit()
},
},
mounted() {
this.indexs = this.$route.query.index ? this.$route.query.index : 1;
this.dataInit()
},
methods: {
dataInit() {
var store = this.$store.state
var equipmentId=store.equipmentList[this.indexs - 1].deviceId
var data1 = store.equipmentList[this.indexs - 1].deviceId
getTime(time) {
//
var chinaTime = new Date(time);
this.api.postFsdata(data1).then(res => {
// UTC
var utcTime = new Date(chinaTime.getTime() - chinaTime.getTimezoneOffset() * 60000);
// UTC2024-02-17 00:00:00
var formattedTime = utcTime.toISOString().slice(0, 19).replace('T', ' ');
return formattedTime
},
search() {
this.getData()
},
timeInit() {
const start = new Date()
start.setHours(0, 0, 0, 0)
const end = new Date()
this.dateRange = [start, end]
},
dataInit() {
this.timeInit()
setTimeout(() => {
this.getData()
}, 0);
},
getData() {
var store = this.$store.state
var index = store.equipmentIndex;
var data = {
equipmentId: store.equipmentList[index - 1].deviceId,
startTime: this.getTime(this.dateRange[0]),
endTime: this.getTime(this.dateRange[1]),
page: 1,
pageSize: 999,
isEquipment: store.equipmentList[index - 1].deviceName == 30 ? 1 : 0
}
this.api.selFsTime(data).then(res => {
if (res.data.code == 200) {
var chartsData = res.data.data
var chartsData = res.data.data.data.map(item => {
return {
time: item.updateTime,
value: item.equipment.map(equipmentItem => {
return {
name: equipmentItem.environmentDataId,
value: equipmentItem.environmentData,
time: equipmentItem.updateTime
};
})
};
});
realTimeLine('realTime-line', chartsData)
} else {
this.$message.error(res.data.msg);
}
})
}
},
},
}
</script>
<style lang="scss"></style>
<style lang="scss"></style>