<!-- Description: 事件大屏-信息窗体 Author: 李亚光 Date: 2024-07-18 --> <script lang="ts" setup name="infoWindow"> import { detailAlarm } from '@/api/home/alarm/current' import { toHumpObject } from '@/utils/String' const dialogFormVisible = ref(false) const overlay = ref() const infoWindow = ref() // 弹窗展示数据信息 const info = ref<any>({ alarmMsg: '', alarmTime: '', alarmContent: '', position: '', address: '', }) // 弹窗展示的内容 // 初始化 const loading = ref(true) const initDialog = (e: any) => { console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info dialogFormVisible.value = true // 获取报警信息 loading.value = true detailAlarm(info.value.id).then((res) => { info.value = toHumpObject(res.data) info.value.alarmType = e.info.alarmType loading.value = false }).catch(() => { loading.value = false }) } defineExpose({ initDialog }) // 关闭 const close = () => { infoWindow.value.close() } const $router = useRouter() const detail = () => { $router.push({ name: 'AlarmCurrent', query: { row: JSON.stringify({ ...info.value, id: info.value.id, alarmId: info.value.id }), }, }) } </script> <template> <div v-show="dialogFormVisible" class="container" @mouseleave="() => { }"> <div class="header"> <div style="display: flex;align-items: center;"> <div class="icon-alarm" /> <div class="title"> {{ info?.alarmType }} </div> </div> <span class="close11" @click="close">×</span> </div> <div v-loading="loading" class="contnt-alarm"> <div class="item-alarm"> <div class="alarm-name"> 报警时间: </div> <div class="alarm-value"> {{ info?.alarmTime }} </div> </div> <div class="item-alarm"> <div class="alarm-name"> 报警原因: </div> <div class="alarm-value"> {{ info?.alarmContent }} </div> </div> <div class="item-alarm"> <div class="alarm-name"> 位置: </div> <div class="alarm-value"> <!-- {{ info?.ledgerNumber }} {{ info?.ledgerName }} --> {{ info?.address }} </div> </div> <div class="item-alarm"> <div class="alarm-name"> 详细地址: </div> <div class="alarm-value"> {{ info?.position }} </div> </div> <div class="item-alarm"> <div class="alarm-name"> 管理单位: </div> <div class="alarm-value"> {{ info?.deptName }} </div> </div> <div class="item-alarm"> <div class="alarm-name"> 产权单位: </div> <div class="alarm-value"> {{ info?.propertyOwner }} </div> </div> <div class="item-alarm"> <div class="alarm-name"> 管理方式: </div> <div class="alarm-value"> {{ info?.manageType }} </div> </div> <!-- <div class="btns"> <el-button size="small" @click="detail"> 查看 </el-button> <el-button size="small" style="margin-left: 15px;" @click="close"> 关闭 </el-button> </div> --> </div> </div> </template> <style lang="scss" scoped> ::v-deep(.el-loading-mask) { background-color: rgba($color: #0b0b0f, $alpha: 95%); } .container { width: 390px; // padding: 0 10px; background: rgba($color: #0d263b, $alpha: 95%); // border: 2px solid #79b5e6; position: relative; .header { background-color: #ee6c7c; padding: 0 10px; height: 30px; display: flex; align-items: center; justify-content: space-between; .icon-alarm { width: 25px; height: 25px; background: url("@/assets/images/dashboard/alarm.png") no-repeat center / cover; } .title { padding-left: 10px; color: #fff; } .close11 { font-size: 18px; color: #fff; &:hover { cursor: pointer; color: #ccc; } } } .contnt-alarm { padding: 10px; .item-alarm { display: flex; color: #fff; padding: 3px 0; .alarm-name { padding-left: 10px; width: 25%; box-sizing: border-box; text-align: justify; text-align-last: justify; } .alarm-value { padding-left: 10px; padding-right: 10px; box-sizing: border-box; // .alarm-name{ width: 75%; // } } } .btns { width: 100%; margin-top: 10px; display: flex; justify-items: center; // justify-content: center; justify-content: end; } } } </style>