DetailModalFire.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <BasicModal @register="register" :title="titleName" width="100%" v-bind="$attrs" @ok="onSubmit" @cancel="onSubmit" :defaultFullscreen="true">
  3. <div class="alarm-modal">
  4. <div class="containers">
  5. <div class="alarm-menu">
  6. <div class="type-btn" v-if="isShowModule">
  7. <div :class="activeIndex == index ? 'btn1' : 'btn'" v-for="(item, index) in typeMenuList" :key="index" @click="btnClick(index)">
  8. {{ item.name }}
  9. </div>
  10. </div>
  11. <div class="card-btn">
  12. <div :class="activeIndex1 == ind ? 'btn1' : 'btn'" v-for="(item, ind) in menuList" :key="ind" @click="cardClick(ind, item)">
  13. <div class="text">{{ item.name }}</div>
  14. <div class="warn">{{ item.warn }}</div>
  15. </div>
  16. </div>
  17. </div>
  18. <div class="alarm-content">
  19. <!-- <div class="toggle-btn">
  20. <div :class="activeIndex2 == ind ? 'btn-item1' : 'btn-item'" v-for="(items, ind) in btnList" :key="ind"
  21. @click="toggleClick(ind)">
  22. {{ items.label }}
  23. </div>
  24. </div> -->
  25. <component :is="componentName[current]" :listData="listData" />
  26. </div>
  27. </div>
  28. </div>
  29. </BasicModal>
  30. </template>
  31. <script lang="ts" setup>
  32. import { onMounted, ref, defineEmits, reactive, onUnmounted, watch, markRaw, defineAsyncComponent, defineProps } from 'vue';
  33. import { BasicModal, useModalInner } from '/@/components/Modal';
  34. import { typeMenuList, componentName } from './fire.data';
  35. import { sysTypeWarnList, sysWarn } from './alarm.api';
  36. let props = defineProps({
  37. moduleName: String,
  38. });
  39. let listData = ref({}); //详情数据
  40. let isShowModule = ref(true); //是否显示内外因火灾切换按钮
  41. let titleName = ref('');
  42. let menuList = reactive<any[]>([]); //左侧菜单列表
  43. //内外因火灾激活索引
  44. let activeIndex = ref(0);
  45. //当前激活菜单的索引
  46. let activeIndex1 = ref(0);
  47. //当前加载组件
  48. let current = ref('fireWork');
  49. //实时/历史数据激活索引
  50. let activeIndex2 = ref(0);
  51. // //实时历史数据按钮列表
  52. // let btnList = reactive([{ label: '实时' }]);
  53. const emit = defineEmits(['close', 'register']);
  54. // 注册 modal
  55. const [register, { closeModal }] = useModalInner();
  56. async function onSubmit() {
  57. emit('close');
  58. closeModal();
  59. }
  60. //内外因火灾选项切换
  61. function btnClick(ind) {
  62. activeIndex.value = ind;
  63. switch (ind) {
  64. case 0:
  65. activeIndex1.value = 0;
  66. current.value = 'fireWork';
  67. menuList.forEach((el) => {
  68. el.type = 'on';
  69. });
  70. break;
  71. case 1:
  72. activeIndex1.value = 0;
  73. current.value = 'mainWell';
  74. menuList.forEach((el) => {
  75. el.type = 'out';
  76. });
  77. break;
  78. }
  79. }
  80. //菜单选项切换
  81. function cardClick(ind, item) {
  82. console.log(ind, 'index');
  83. activeIndex1.value = ind;
  84. if (props.moduleName == 'fire') {
  85. switch (ind) {
  86. case 0:
  87. current.value = item.type == 'on' ? 'fireWork' : 'mainWell';
  88. break;
  89. case 1:
  90. current.value = item.type == 'on' ? 'closeWall' : 'subStation';
  91. break;
  92. case 2:
  93. current.value = item.type == 'on' ? 'otherMonitor' : 'otherOut';
  94. break;
  95. }
  96. } else if (props.moduleName == 'tf') {
  97. getSysWarnList(item.deviceID, 'vent');
  98. }
  99. }
  100. //获取预警详情弹窗左侧数据
  101. function getSysTypeWarnList(data) {
  102. sysTypeWarnList({ type: data }).then((res) => {
  103. menuList.length = 0;
  104. if (props.moduleName == 'tf') {
  105. res.forEach((el) => {
  106. menuList.push({
  107. name: el.deviceName,
  108. warn: el.netStatus ? '高风险' : '低风险',
  109. type: 'on',
  110. deviceID: el.deviceID,
  111. });
  112. });
  113. getSysWarnList(menuList[0].deviceID, 'vent');
  114. console.log(menuList, '通风预警详情');
  115. }
  116. });
  117. }
  118. //获取预警详情弹窗右侧数据
  119. function getSysWarnList(id, type) {
  120. sysWarn({ sysid: id, type: type }).then((res) => {
  121. console.log(res, '预警详情弹窗右侧数据');
  122. listData.value = res;
  123. });
  124. }
  125. watch(
  126. () => props.moduleName,
  127. (val) => {
  128. if (val == 'fire') {
  129. titleName.value = '火灾监测';
  130. isShowModule.value = true;
  131. getSysTypeWarnList('fire');
  132. current.value = 'fireWork';
  133. } else if (val == 'dust') {
  134. titleName.value = '粉尘监测';
  135. isShowModule.value = false;
  136. getSysTypeWarnList('dust');
  137. current.value = 'dustPage';
  138. } else if (val == 'tf') {
  139. titleName.value = '通风监测';
  140. isShowModule.value = false;
  141. current.value = 'ventilate';
  142. getSysTypeWarnList('vent');
  143. } else {
  144. titleName.value = '瓦斯监测';
  145. isShowModule.value = false;
  146. getSysTypeWarnList('gas');
  147. current.value = 'gasPage';
  148. }
  149. },
  150. { immediate: true }
  151. );
  152. onMounted(async () => {});
  153. onUnmounted(() => {});
  154. </script>
  155. <style scoped lang="less">
  156. @import '/@/design/vent/color.less';
  157. @import '/@/design/vent/modal.less';
  158. .alarm-modal {
  159. position: relative;
  160. z-index: 999;
  161. max-height: calc(100vh - 150px);
  162. .@{ventSpace}-tabs {
  163. max-height: calc(100vh - 100px);
  164. }
  165. .containers {
  166. width: 100%;
  167. height: calc(100vh - 159px);
  168. display: flex;
  169. justify-content: space-between;
  170. .alarm-menu {
  171. height: 100%;
  172. width: 262px;
  173. .type-btn {
  174. width: 192px;
  175. height: 28px;
  176. line-height: 28px;
  177. border: 1px solid #0058ee;
  178. margin-bottom: 20px;
  179. border-radius: 5px;
  180. box-sizing: border-box;
  181. display: flex;
  182. justify-content: space-between;
  183. .btn {
  184. width: 50%;
  185. height: 100%;
  186. font-size: 14px;
  187. text-align: center;
  188. color: #fff;
  189. cursor: pointer;
  190. }
  191. .btn1 {
  192. width: 50%;
  193. height: 100%;
  194. font-size: 14px;
  195. color: #fff;
  196. text-align: center;
  197. border-radius: 2px;
  198. background: #0058ee;
  199. cursor: pointer;
  200. }
  201. }
  202. .card-btn {
  203. width: 100%;
  204. height: calc(100% - 48px);
  205. overflow-y: auto;
  206. .btn {
  207. position: relative;
  208. width: 212px;
  209. height: 99px;
  210. margin-bottom: 30px;
  211. font-family: 'douyuFont';
  212. background: url('../../../../assets/images/fire/no-choice.png') no-repeat;
  213. background-size: 100% 100%;
  214. cursor: pointer;
  215. .text {
  216. width: 80%;
  217. position: absolute;
  218. left: 50%;
  219. top: 22px;
  220. font-size: 16px;
  221. color: #01fefc;
  222. text-align: center;
  223. transform: translate(-50%, 0);
  224. }
  225. .warn {
  226. width: 100%;
  227. position: absolute;
  228. left: 50%;
  229. top: 68px;
  230. font-size: 16px;
  231. color: #fff;
  232. text-align: center;
  233. transform: translate(-50%, 0);
  234. }
  235. }
  236. .btn1 {
  237. position: relative;
  238. width: 262px;
  239. height: 99px;
  240. margin-bottom: 30px;
  241. font-family: 'douyuFont';
  242. background: url('../../../../assets//images//fire/choice.png') no-repeat;
  243. background-size: 100% 100%;
  244. cursor: pointer;
  245. .text {
  246. width: 80%;
  247. position: absolute;
  248. left: 50%;
  249. top: 22px;
  250. font-size: 16px;
  251. color: #01fefc;
  252. text-align: center;
  253. transform: translate(-62%, 0);
  254. }
  255. .warn {
  256. width: 100%;
  257. position: absolute;
  258. left: 50%;
  259. top: 68px;
  260. font-size: 16px;
  261. color: #fff;
  262. text-align: center;
  263. transform: translate(-60%, 0);
  264. }
  265. }
  266. }
  267. }
  268. .alarm-content {
  269. width: calc(100% - 282px);
  270. height: 100%;
  271. margin-left: 20px;
  272. background: url('../../../../assets//images/fire/border.png') no-repeat;
  273. background-size: 100% 100%;
  274. // .toggle-btn {
  275. // position: absolute;
  276. // right: 10px;
  277. // top: -34px;
  278. // display: flex;
  279. // .btn-item {
  280. // width: 157px;
  281. // height: 36px;
  282. // line-height: 36px;
  283. // text-align: center;
  284. // color: #fff;
  285. // font-size: 14px;
  286. // cursor: pointer;
  287. // background: url('../../../../assets//images//fire/tab-2.png') no-repeat;
  288. // }
  289. // .btn-item1 {
  290. // width: 157px;
  291. // height: 36px;
  292. // line-height: 36px;
  293. // text-align: center;
  294. // color: #fff;
  295. // font-size: 14px;
  296. // cursor: pointer;
  297. // background: url('../../../../assets/images//fire/tab-1.png') no-repeat;
  298. // }
  299. // }
  300. }
  301. }
  302. }
  303. :deep(.@{ventSpace}-tabs-tabpane-active) {
  304. height: 100%;
  305. }
  306. :deep(.@{ventSpace}-tabs-card) {
  307. .@{ventSpace}-tabs-tab {
  308. background: linear-gradient(#2cd1ff55, #1eb0ff55);
  309. border-color: #74e9fe;
  310. border-radius: 0%;
  311. &:hover {
  312. color: #64d5ff;
  313. }
  314. }
  315. .@{ventSpace}-tabs-tab.@{ventSpace}-tabs-tab-active .@{ventSpace}-tabs-tab-btn {
  316. color: aqua;
  317. }
  318. .@{ventSpace}-tabs-nav::before {
  319. border-color: #74e9fe;
  320. }
  321. .@{ventSpace}-picker,
  322. .@{ventSpace}-select-selector {
  323. width: 100% !important;
  324. background: #00000017 !important;
  325. border: 1px solid @vent-form-item-boder !important;
  326. input,
  327. .@{ventSpace}-select-selection-item,
  328. .@{ventSpace}-picker-suffix {
  329. color: #fff !important;
  330. }
  331. .@{ventSpace}-select-selection-placeholder {
  332. color: #b7b7b7 !important;
  333. }
  334. }
  335. .@{ventSpace}-pagination-next,
  336. .action,
  337. .@{ventSpace}-select-arrow,
  338. .@{ventSpace}-picker-separator {
  339. color: #fff !important;
  340. }
  341. .@{ventSpace}-table-cell-row-hover {
  342. background: #264d8833 !important;
  343. }
  344. .@{ventSpace}-table-row-selected {
  345. background: #00c0a311 !important;
  346. td {
  347. background-color: #00000000 !important;
  348. }
  349. }
  350. .@{ventSpace}-table-thead {
  351. // background: linear-gradient(#004a8655 0%, #004a86aa 10%) !important;
  352. background: #3d9dd45d !important;
  353. & > tr > th,
  354. .@{ventSpace}-table-column-title {
  355. // color: #70f9fc !important;
  356. border-color: #84f2ff !important;
  357. border-left: none !important;
  358. border-right: none !important;
  359. padding: 7px;
  360. }
  361. }
  362. .@{ventSpace}-table-tbody {
  363. tr > td {
  364. padding: 12px;
  365. }
  366. }
  367. .@{ventSpace}-table-tbody > tr:hover.@{ventSpace}-table-row > td {
  368. background-color: #26648855 !important;
  369. }
  370. .jeecg-basic-table-row__striped {
  371. // background: #97efff11 !important;
  372. td {
  373. background-color: #97efff11 !important;
  374. }
  375. }
  376. }
  377. </style>