123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512 |
- <template>
- <BasicModal @register="register" :title="titleName" width="100%" v-bind="$attrs" @ok="onSubmit" @cancel="onSubmit"
- :defaultFullscreen="true">
- <div class="alarm-modal">
- <div class="containers">
- <div class="alarm-menu">
- <div class="type-btn" v-if="isShowModule">
- <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="alarm-content">
- <component :is="componentName[current]" :listData="listData" />
- </div>
- </div>
- </div>
- </BasicModal>
- </template>
- <script lang="ts" setup>
- import { onMounted, ref, defineEmits, reactive, onUnmounted, watch, markRaw, defineAsyncComponent, defineProps } from 'vue';
- import { BasicModal, useModalInner } from '/@/components/Modal';
- import { typeMenuList, componentName } from './fire.data';
- import { sysTypeWarnList, sysWarn } from './alarm.api';
- let props = defineProps({
- moduleName: String,
- });
- let timer: null | NodeJS.Timeout = null;
- let listData = reactive({
- common: {},
- bundletube: [],
- fiber: [],
- fire: [],
- smoke: [],
- spray: [],
- temperature: [],
- }); //详情数据
- let isShowModule = ref(true); //是否显示内外因火灾切换按钮
- let titleName = ref('');
- let menuList = reactive<any[]>([]); //左侧菜单列表
- let menuList1 = reactive({
- external: [],
- internal: []
- })
- //内外因火灾激活索引
- let activeIndex = ref(0);
- //当前激活菜单的索引
- let activeIndex1 = ref(0);
- //当前加载组件
- let current = ref('');
- const emit = defineEmits(['close', 'register']);
- // 注册 modal
- const [register, { closeModal }] = useModalInner();
- async function onSubmit() {
- activeIndex1.value = 0;
- clearInterval(timer)
- emit('close');
- closeModal();
- }
- //内外因火灾选项切换
- function btnClick(ind) {
- activeIndex.value = ind;
- switch (ind) {
- case 0:
- activeIndex1.value = 0;
- menuList = menuList1.internal.map(el => {
- return {
- name: el.systemname,
- warn: '低风险',
- type: 'on',
- deviceID: el.id,
- }
- })
- clearInterval(timer)
- getSysWarnList(menuList[0].deviceID, 'fire');
- break;
- case 1:
- activeIndex1.value = 0;
- menuList = menuList1.external.map(el => {
- return {
- name: el.systemname,
- warn: '低风险',
- type: 'out',
- deviceID: el.id,
- }
- })
- clearInterval(timer)
- getSysWarnList(menuList[0].deviceID, 'fire');
- break;
- }
- }
- //菜单选项切换
- function cardClick(ind, item) {
- activeIndex1.value = ind;
- if (props.moduleName == 'fire') {
- // switch (ind) {
- // case 0:
- // current.value = item.type == 'on' ? 'fireWork' : 'mainWell';
- // break;
- // case 1:
- // current.value = item.type == 'on' ? 'closeWall' : 'subStation';
- // // current.value = item.type == 'on' ? 'closeWall' : 'fireWork';
- // break;
- // case 2:
- // current.value = item.type == 'on' ? 'otherMonitor' : 'otherMonitor';
- // break;
- // }
- clearInterval(timer)
- getSysWarnList(item.deviceID, 'fire');
- } else if (props.moduleName == 'vent') {
- clearInterval(timer)
- getSysWarnList(item.deviceID, 'vent');
- } else if (props.moduleName == 'dust') {
- clearInterval(timer)
- getSysWarnList(item.deviceID, 'dust');
- } else if (props.moduleName == 'gas') {
- clearInterval(timer)
- getSysWarnList(item.deviceID, 'gas');
- }
- }
- //加载组件
- function loadZj() {
- if (!activeIndex.value && listData.fiber.length != 0 && listData.bundletube.length != 0) {
- current.value = 'fireWork'
- } else if (!activeIndex.value && listData.bundletube.length != 0) {
- current.value = 'closeWall'
- } else if (activeIndex.value) {
- current.value = 'mainWell'
- }else {
- current.value = ''
- }
- }
- //获取预警详情弹窗左侧数据
- function getSysTypeWarnList(data) {
- sysTypeWarnList({ type: data }).then((res) => {
- menuList.length = 0;
- if (props.moduleName == 'vent') {
- res.forEach((el) => {
- menuList.push({
- name: el.deviceName,
- warn: el.netStatus ? '高风险' : '低风险',
- type: 'on',
- deviceID: el.deviceID,
- });
- });
- clearInterval(timer)
- getSysWarnList(menuList[0].deviceID, 'vent');
- } else if (props.moduleName == 'fire') {
- menuList1.external = res.external
- menuList1.internal = res.internal
- menuList1.internal.forEach(el => {
- menuList.push({
- name: el.systemname,
- warn: '低风险',
- type: 'on',
- deviceID: el.id,
- });
- })
- clearInterval(timer)
- getSysWarnList(menuList[0].deviceID, 'fire');
- } else if (props.moduleName == 'dust') {
- res.forEach((el) => {
- menuList.push({
- name: el.systemname,
- warn: '低风险',
- type: 'on',
- deviceID: el.id,
- });
- });
- clearInterval(timer)
- getSysWarnList(menuList[0].deviceID, 'dust');
- } else if (props.moduleName == 'gas') {
- res.forEach((el) => {
- menuList.push({
- name: el.systemname,
- warn: '低风险',
- type: 'on',
- deviceID: el.id,
- });
- });
- clearInterval(timer)
- getSysWarnList(menuList[0].deviceID, 'gas');
- }
- });
- }
- //获取预警详情弹窗右侧数据
- function getSysWarnList(id, type) {
- timer = setInterval(() => {
- sysWarn({ sysid: id, type: type }).then((res) => {
- if (type == 'fire') {
- let data=[
- {
- readData:{
- temperature:10,
- ch2val:'1.1',
- chval:'1.1',
- co2val:'1.1',
- coval:'1.1',
- gasval:'1.1'
- },
- readTime:'2023-12-22',
- strinstallpos:'测试'
- }
- ]
- listData.bundletube = data,
- listData.fiber = res.fiber
- listData.fire = res.fire,
- listData.smoke = res.smoke,
- listData.spray = res.spray,
- listData.temperature = res.temperature,
- console.log(listData, '火灾详情弹窗右侧数据');
- loadZj()
- } else if (type == 'vent' || type == 'dust' || type == 'gas') {
- console.log(res, '详情')
- listData.common = res
- }
- });
- }, 1000)
- }
- watch(
- () => props.moduleName,
- (val) => {
- if (val == 'fire') {
- current.value = '';
- titleName.value = '火灾监测';
- isShowModule.value = true;
- getSysTypeWarnList('fire');
- } else if (val == 'dust') {
- current.value = '';
- titleName.value = '粉尘监测';
- isShowModule.value = false;
- current.value = 'dustPage';
- getSysTypeWarnList('dust');
- } else if (val == 'vent') {
- current.value = '';
- titleName.value = '通风监测';
- isShowModule.value = false;
- current.value = 'ventilate';
- getSysTypeWarnList('vent');
- } else if (val == 'gas') {
- current.value = '';
- titleName.value = '瓦斯监测';
- isShowModule.value = false;
- current.value = 'gasPage';
- getSysTypeWarnList('gas');
- }
- },
- { immediate: true, deep: true }
- );
- onMounted(async () => { });
- </script>
- <style scoped lang="less">
- @import '/@/design/vent/color.less';
- @import '/@/design/vent/modal.less';
- .alarm-modal {
- position: relative;
- z-index: 999;
- max-height: calc(100vh - 150px);
- .@{ventSpace}-tabs {
- max-height: calc(100vh - 100px);
- }
- .containers {
- width: 100%;
- height: calc(100vh - 159px);
- display: flex;
- justify-content: space-between;
- .alarm-menu {
- height: 100%;
- width: 272px;
- .type-btn {
- width: 192px;
- 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: 50%;
- height: 100%;
- font-size: 14px;
- text-align: center;
- color: #fff;
- cursor: pointer;
- }
- .btn1 {
- width: 50%;
- 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: 212px;
- height: 99px;
- margin-bottom: 30px;
- 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: 22px;
- font-size: 16px;
- color: #01fefc;
- text-align: center;
- transform: translate(-50%, 0);
- }
- .warn {
- width: 100%;
- position: absolute;
- left: 50%;
- top: 68px;
- font-size: 16px;
- color: #fff;
- text-align: center;
- transform: translate(-50%, 0);
- }
- }
- .btn1 {
- position: relative;
- width: 262px;
- height: 99px;
- margin-bottom: 30px;
- 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: 22px;
- font-size: 16px;
- color: #01fefc;
- text-align: center;
- transform: translate(-62%, 0);
- }
- .warn {
- width: 100%;
- position: absolute;
- left: 50%;
- top: 68px;
- font-size: 16px;
- color: #fff;
- text-align: center;
- transform: translate(-60%, 0);
- }
- }
- }
- }
- .alarm-content {
- width: calc(100% - 282px);
- height: 100%;
- margin-left: 10px;
- background: url('../../../../assets//images/fire/border.png') no-repeat;
- background-size: 100% 100%;
- }
- }
- }
- :deep(.@{ventSpace}-tabs-tabpane-active) {
- height: 100%;
- }
- :deep(.@{ventSpace}-tabs-card) {
- .@{ventSpace}-tabs-tab {
- background: linear-gradient(#2cd1ff55, #1eb0ff55);
- border-color: #74e9fe;
- border-radius: 0%;
- &:hover {
- color: #64d5ff;
- }
- }
- .@{ventSpace}-tabs-tab.@{ventSpace}-tabs-tab-active .@{ventSpace}-tabs-tab-btn {
- color: aqua;
- }
- .@{ventSpace}-tabs-nav::before {
- border-color: #74e9fe;
- }
- .@{ventSpace}-picker,
- .@{ventSpace}-select-selector {
- width: 100% !important;
- background: #00000017 !important;
- border: 1px solid @vent-form-item-boder !important;
- input,
- .@{ventSpace}-select-selection-item,
- .@{ventSpace}-picker-suffix {
- color: #fff !important;
- }
- .@{ventSpace}-select-selection-placeholder {
- color: #b7b7b7 !important;
- }
- }
- .@{ventSpace}-pagination-next,
- .action,
- .@{ventSpace}-select-arrow,
- .@{ventSpace}-picker-separator {
- color: #fff !important;
- }
- .@{ventSpace}-table-cell-row-hover {
- background: #264d8833 !important;
- }
- .@{ventSpace}-table-row-selected {
- background: #00c0a311 !important;
- td {
- background-color: #00000000 !important;
- }
- }
- .@{ventSpace}-table-thead {
- // background: linear-gradient(#004a8655 0%, #004a86aa 10%) !important;
- background: #3d9dd45d !important;
- &>tr>th,
- .@{ventSpace}-table-column-title {
- // color: #70f9fc !important;
- border-color: #84f2ff !important;
- border-left: none !important;
- border-right: none !important;
- padding: 7px;
- }
- }
- .@{ventSpace}-table-tbody {
- tr>td {
- padding: 12px;
- }
- }
- .@{ventSpace}-table-tbody>tr:hover.@{ventSpace}-table-row>td {
- background-color: #26648855 !important;
- }
- .jeecg-basic-table-row__striped {
- // background: #97efff11 !important;
- td {
- background-color: #97efff11 !important;
- }
- }
- }
- </style>
|