123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 |
- <template>
- <customHeader :options="options" @change="getSelectRow" :optionValue="optionValue"> 火灾监测预警 </customHeader>
- <div class="fireWarn">
- <a-button preIcon="ant-design:rollback-outlined" type="text" size="small"
- style="position: absolute;left:15px;top:15px;color: #fff;" @click="getBack">返回</a-button>
- <div class="alarm-menu">
- <div class="type-btn">
- <div :class="activeIndex == index ? 'btn1' : 'btn'" v-for="(item, index) in typeMenuList" :key="index"
- @click="btnClick(index)">
- {{ item.name }}
- </div>
- </div>
- <div class="card-btn">
- <div :class="activeIndex1 == ind ? 'btn1' : 'btn'" v-for="(item, ind) in menuList" :key="ind"
- @click="cardClick(ind, item)">
- <div class="text">{{ item.name }}</div>
- <div class="warn">{{ item.warn }}</div>
- </div>
- </div>
- </div>
- <div class="fire-content">
- <component :is="componentName[currentLoad]" :listData="listData" :strType="strType"></component>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import { ref, reactive, onMounted, onUnmounted } from 'vue'
- import { typeMenuList, componentName } from '../common.data'
- import { sysTypeWarnList, sysWarn } from '../common.api'
- import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
- import { useRouter } from 'vue-router';
- import CustomHeader from '/@/components/vent/customHeader.vue';
- const { options, optionValue, getSelectRow, getSysDataSource } = useSystemSelect('sys_surface_caimei'); // 参数为场景类型(设备类型管理中可以查询到)
- //当前加载组件
- let currentLoad = ref('')
- //内外因火灾激活索引
- let activeIndex = ref(0);
- //当前激活菜单的索引
- let activeIndex1 = ref(0);
- let menuList = reactive<any[]>([]); //左侧菜单列表
- let menuList1 = reactive({
- external: [],
- internal: [],
- });
- //详情数据
- let listData = reactive({
- common: {},
- bundletube: [],
- fiber: [],
- fire: [],
- co:[],
- smoke: [],
- spray: [],
- temperature: [],
- }); //详情数据
- let strType = ref(''); //火灾外因-区别工作面和煤层
- let router = useRouter()
- // https获取监测数据
- let timer: null | NodeJS.Timeout = null;
- function getMonitor(deviceID, flag?) {
- timer = setTimeout(
- async () => {
- await getSysWarnList(deviceID, 'fire');
- if (timer) {
- timer = null;
- }
- getMonitor(deviceID);
- },
- flag ? 0 : 1000
- );
- }
- //返回首页
- function getBack() {
- router.push('/monitorChannel/monitor-alarm-home')
- }
- //获取左侧菜单列表
- async function getMenuList() {
- let res = await sysTypeWarnList({ type: 'fire' })
- console.log(res, '火灾左侧菜单列表-------')
- if (res.length != 0) {
- menuList.length = 0
- menuList1.external = res.external;
- menuList1.internal = res.internal;
- menuList1.internal.forEach((el) => {
- menuList.push({
- name: el.systemname,
- warn: '低风险',
- type: 'on',
- deviceID: el.id,
- strtype: el.strtype,
- });
- });
- getMonitor(menuList[0].deviceID, true);
- }
- }
- //获取预警详情弹窗右侧数据
- function getSysWarnList(id, type) {
- sysWarn({ sysid: id, type: type }).then((res) => {
- listData.bundletube = res.bundletube;
- listData.fiber = res.fiber;
- listData.fire = res.fire;
- listData.co=res.co;
- listData.smoke = res.smoke;
- listData.spray = res.spray;
- listData.temperature = res.temperature;
- loadZj();
- });
- }
- //内外因火灾、预警指标选项切换
- function btnClick(ind) {
- activeIndex.value = ind;
- switch (ind) {
- case 0:
- activeIndex1.value = 0;
- menuList.length = 0;
- currentLoad.value = '';
- menuList1.internal.forEach((el) => {
- menuList.push({
- name: el.systemname,
- warn: '低风险',
- type: 'on',
- deviceID: el.id,
- strtype: el.strtype,
- });
- });
- clearTimeout(timer);
- getClearList();
- getMonitor(menuList[0].deviceID, true);
- break;
- case 1:
- activeIndex1.value = 0;
- menuList.length = 0;
- currentLoad.value = '';
- if (menuList1.external.length != 0) {
- menuList1.external.forEach((el) => {
- menuList.push({
- name: el.systemname,
- warn: '低风险',
- type: 'out',
- deviceID: el.id,
- strtype: el.strtype,
- });
- });
- clearTimeout(timer);
- getClearList();
- getMonitor(menuList[0].deviceID, true);
- strType.value = menuList[0].strtype;
- } else {
- menuList.length = 0;
- clearTimeout(timer);
- currentLoad.value = '';
- }
- break;
- case 2:
- activeIndex1.value = 0;
- menuList.length = 0;
- currentLoad.value = 'warnTargetFire';
- break;
- }
- }
- //菜单选项切换
- function cardClick(ind, item) {
- activeIndex1.value = ind;
- strType.value = item.strtype;
- clearTimeout(timer);
- getClearList();
- currentLoad.value = '';
- getMonitor(item.deviceID, true);
- }
- //加载组件
- function loadZj() {
- if (!activeIndex.value && listData.fiber.length != 0 && listData.bundletube.length != 0) {
- currentLoad.value = 'fireWork';
- } else if (!activeIndex.value && listData.bundletube.length != 0) {
- currentLoad.value = 'closeWall';
- } else if (activeIndex.value && activeIndex.value!=2) {
- currentLoad.value = 'mainWell';
- }else if(activeIndex.value==2){
- currentLoad.value = 'warnTargetFire';
- } else {
- currentLoad.value = '';
- }
- }
- //清空数据
- function getClearList() {
- listData.common = {};
- listData.bundletube.length = 0;
- listData.fiber.length = 0;
- listData.fire.length = 0;
- listData.co.length=0;
- listData.smoke.length = 0;
- listData.spray.length = 0;
- listData.temperature.length = 0;
- }
- onMounted(() => {
- getMenuList()
- })
- onUnmounted(() => {
- if (timer) {
- clearTimeout(timer);
- timer = undefined;
- }
- });
- </script>
- <style lang="less" scoped>
- .fireWarn {
- width: 100%;
- height: 100%;
- padding: 80px 10px 15px 10px;
- box-sizing: border-box;
- display: flex;
- justify-content: space-between;
- .alarm-menu {
- height: 100%;
- width: 15%;
- .type-btn {
- width: 100%;
- height: 28px;
- line-height: 28px;
- border: 1px solid #0058ee;
- margin-bottom: 20px;
- border-radius: 5px;
- box-sizing: border-box;
- display: flex;
- justify-content: space-between;
- .btn {
- width: 33%;
- height: 100%;
- font-size: 14px;
- text-align: center;
- color: #fff;
- cursor: pointer;
- }
- .btn1 {
- width: 33%;
- height: 100%;
- font-size: 14px;
- color: #fff;
- text-align: center;
- border-radius: 2px;
- background: #0058ee;
- cursor: pointer;
- }
- }
- .card-btn {
- width: 100%;
- height: calc(100% - 48px);
- overflow-y: auto;
- .btn {
- position: relative;
- width: 81%;
- height: 14%;
- margin-bottom: 10%;
- font-family: 'douyuFont';
- background: url('../../../../../assets/images/fire/no-choice.png') no-repeat;
- background-size: 100% 100%;
- cursor: pointer;
- .text {
- width: 80%;
- position: absolute;
- left: 50%;
- top: 28px;
- font-size: 16px;
- color: #01fefc;
- text-align: center;
- transform: translate(-50%, 0);
- }
- .warn {
- width: 100%;
- position: absolute;
- left: 50%;
- bottom: 14px;
- font-size: 14px;
- color: #fff;
- text-align: center;
- transform: translate(-50%, 0);
- }
- }
- .btn1 {
- position: relative;
- width: 100%;
- height: 14%;
- margin-bottom: 10%;
- font-family: 'douyuFont';
- background: url('../../../../../assets/images/fire/choice.png') no-repeat;
- background-size: 100% 100%;
- cursor: pointer;
- .text {
- width: 80%;
- position: absolute;
- left: 50%;
- top: 28px;
- font-size: 16px;
- color: #01fefc;
- text-align: center;
- transform: translate(-62%, 0);
- }
- .warn {
- width: 100%;
- position: absolute;
- left: 50%;
- bottom: 14px;
- font-size: 14px;
- color: #fff;
- text-align: center;
- transform: translate(-60%, 0);
- }
- }
- }
- }
- .fire-content {
- width: calc(85% - 10px);
- height: 100%;
- margin-left: 10px;
- background: url('../../../../../assets/images/fire/border.png') no-repeat;
- background-size: 100% 100%;
- }
- }
- </style>
|