index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <div class="deviceMonitorWarn">
  3. <customHeader>设备监测预警</customHeader>
  4. <a-button
  5. preIcon="ant-design:rollback-outlined"
  6. type="text"
  7. size="small"
  8. style="position: absolute; left: 15px; top: -66px; color: var(--vent-font-color)"
  9. @click="getBack"
  10. v-if="hasPermission('deviceWarn:return')"
  11. >返回</a-button
  12. >
  13. <div class="content">
  14. <div class="left-box">
  15. <div class="left-box-content">
  16. <div v-for="(item, index) in cardList" :key="index" @click="cardClick(item, index)">
  17. <div v-if="item.title" class="card-box">
  18. <img :src="activeIndex == index ? item.url1 : item.url" alt="" />
  19. <div class="card-item">
  20. <div class="item-title">
  21. {{ item.title }}
  22. </div>
  23. <div class="item-sum">
  24. <span>总数:</span>
  25. <span> {{ item.sumVal }}</span>
  26. </div>
  27. <div class="item-warn">
  28. <span>报警数:</span>
  29. <span> {{ item.warnVal }}</span>
  30. </div>
  31. <div class="item-close">
  32. <span>断开数:</span>
  33. <span> {{ item.closeVal }}</span>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="right-box">
  41. <div class="right-box-content">
  42. <div class="alarm-history-table">
  43. <BasicTable :key="isShow" ref="alarmHistory" @register="registerTable" :scroll="{ x: 0, y: 590 }">
  44. <template #form-onExportXls>
  45. <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls()"> 导出</a-button>
  46. </template>
  47. <template #bodyCell="{ column, record }">
  48. <template v-if="column.dataIndex === 'nwartype'">
  49. <!-- 除了 101(蓝色预警)其他都是红色字体 -->
  50. <span :class="{ 'color-#ff3823': ['102', '103', '104', '201', '1001'].includes(record.nwartype) }">
  51. {{ render.renderDictText(record.nwartype, 'leveltype') || '-' }}
  52. </span>
  53. </template>
  54. </template>
  55. </BasicTable>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </template>
  62. <script setup lang="ts">
  63. import { ref, nextTick, reactive, onMounted, onUnmounted } from 'vue';
  64. import customHeader from '/@/components/vent/customHeader.vue';
  65. import { getTotalList, getAlarmLogList } from './deviceMonitorWarn.api';
  66. import { cardList } from './deviceMonitorWarn.data';
  67. import { BasicTable } from '/@/components/Table';
  68. import { useListPage } from '/@/hooks/system/useListPage';
  69. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  70. import { getAutoScrollContainer } from '/@/utils/common/compUtils';
  71. import { useRouter } from 'vue-router';
  72. import { render } from '/@/utils/common/renderUtils';
  73. import { usePermission } from '/@/hooks/web/usePermission';
  74. const props = defineProps({
  75. formConfig: {
  76. type: Object as PropType<FormProps> | undefined,
  77. default: undefined,
  78. },
  79. });
  80. const { hasPermission } = usePermission();
  81. let router = useRouter();
  82. let activeIndex = ref(0);
  83. let devicekindType = ref('modelsensor');
  84. let isShow = ref(0);
  85. const deviceColumns = getTableHeaderColumns('alarm_history') as [];
  86. const dataColumns = ref(deviceColumns);
  87. // 列表页面公共参数、方法
  88. const { tableContext, onExportXls } = useListPage({
  89. tableProps: {
  90. api: getAlarmLogList,
  91. columns: dataColumns,
  92. canResize: true,
  93. showTableSetting: false,
  94. showActionColumn: false,
  95. showIndexColumn: true,
  96. bordered: false,
  97. size: 'small',
  98. formConfig: {
  99. labelAlign: 'left',
  100. showAdvancedButton: false,
  101. actionColOptions: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },
  102. schemas: [
  103. {
  104. label: '是否解决',
  105. // field: 'isok',
  106. field: 'isOk',
  107. defaultValue: false,
  108. component: 'Select',
  109. componentProps: {
  110. options: [
  111. {
  112. label: '未解决',
  113. value: false,
  114. },
  115. {
  116. label: '已解决',
  117. value: true,
  118. },
  119. ],
  120. },
  121. colProps: { span: 8 },
  122. },
  123. {
  124. label: '所属系统',
  125. // field: 'kindtype',systemType
  126. field: 'systemType',
  127. component: 'Select',
  128. componentProps: {
  129. options: [
  130. {
  131. label: '通风',
  132. value: 'ventS',
  133. },
  134. {
  135. label: '防灭火',
  136. value: 'fireS',
  137. },
  138. {
  139. label: '防尘',
  140. value: 'dustS',
  141. },
  142. {
  143. label: '瓦斯',
  144. value: 'gasS',
  145. },
  146. ],
  147. },
  148. colProps: { span: 8 },
  149. },
  150. // {
  151. // label: '设备类型',
  152. // field: 'deviceKind',
  153. // component: 'MTreeSelect',
  154. // componentProps: {
  155. // virtual: false,
  156. // },
  157. // colProps: { span: 8 },
  158. // },
  159. {
  160. field: 'starttime',
  161. label: '开始时间',
  162. component: 'DatePicker',
  163. componentProps: {
  164. showTime: true,
  165. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  166. getPopupContainer: getAutoScrollContainer,
  167. },
  168. colProps: {
  169. span: 8,
  170. },
  171. },
  172. ],
  173. },
  174. fetchSetting: {
  175. listField: 'records',
  176. },
  177. pagination: {
  178. current: 1,
  179. pageSize: 10,
  180. pageSizeOptions: ['10', '30', '50', '100'],
  181. },
  182. beforeFetch(params) {
  183. params['deviceKind'] = devicekindType.value;
  184. return params;
  185. },
  186. },
  187. exportConfig: {
  188. name: '预警历史列表',
  189. url: '/safety/ventanalyAlarmLog/exportXls',
  190. },
  191. });
  192. //注册table数据
  193. const [registerTable, { reload, setLoading, getForm }] = tableContext;
  194. //返回上一级
  195. function getBack() {
  196. router.push('/monitorChannel/monitor-alarm-home');
  197. }
  198. //选项切换
  199. function cardClick(item, index) {
  200. activeIndex.value = index;
  201. devicekindType.value = item.devicekind;
  202. isShow.value = new Date().getTime();
  203. }
  204. //获取左侧选项数据
  205. async function getDeviceCard() {
  206. let res = await getTotalList();
  207. console.log(res, '左侧选项数据----------');
  208. cardList.forEach((el) => {
  209. if (res.device[el.name]) {
  210. el.sumVal = res.device[el.name].totalcount || 0;
  211. el.warnVal = res.device[el.name].count || 0;
  212. el.closeVal = res.device[el.name].netstatus || 0;
  213. el.devicekind = res.device[el.name].code || '';
  214. el.title = res.device[el.name].name || '';
  215. }
  216. });
  217. }
  218. onMounted(() => {
  219. getDeviceCard();
  220. });
  221. defineExpose({ setLoading });
  222. </script>
  223. <style lang="less" scoped>
  224. @import '/@/design/theme.less';
  225. @{theme-deepblue} {
  226. .deviceMonitorWarn {
  227. --image-border: url('/@/assets/images/themify/deepblue/fire/border.png');
  228. }
  229. }
  230. .deviceMonitorWarn {
  231. --image-border: url('/@/assets/images/fire/border.png');
  232. position: relative;
  233. width: calc(100% - 20px);
  234. height: calc(100% - 90px);
  235. position: relative;
  236. margin: 80px 10px 10px 10px;
  237. .content {
  238. position: relative;
  239. width: 100%;
  240. height: 100%;
  241. display: flex;
  242. justify-content: space-between;
  243. align-items: center;
  244. .left-box {
  245. width: 45%;
  246. height: 100%;
  247. // margin-right: 15px;
  248. padding: 10px;
  249. box-sizing: border-box;
  250. // background: url('@/assets/images/fire/bj1.png') no-repeat center;
  251. // background-size: 100% 100%;
  252. .left-box-content {
  253. height: 100%;
  254. display: flex;
  255. justify-content: flex-start;
  256. align-items: flex-start;
  257. flex-wrap: wrap;
  258. overflow-y: auto;
  259. div {
  260. .card-box {
  261. position: relative;
  262. width: 265px;
  263. height: 112px;
  264. margin: 0px 5px;
  265. img {
  266. position: absolute;
  267. left: 0;
  268. width: 100%;
  269. height: 100%;
  270. }
  271. .card-item {
  272. position: relative;
  273. width: 100%;
  274. height: 100%;
  275. color: var(--vent-font-color);
  276. .item-title {
  277. position: absolute;
  278. left: 130px;
  279. top: 20px;
  280. font-size: 12px;
  281. font-family: 'douyuFont';
  282. color: var(--vent-table-action-link);
  283. }
  284. .item-sum {
  285. position: absolute;
  286. left: 130px;
  287. top: 40px;
  288. }
  289. .item-warn {
  290. position: absolute;
  291. left: 130px;
  292. top: 60px;
  293. }
  294. .item-close {
  295. position: absolute;
  296. left: 130px;
  297. top: 80px;
  298. }
  299. }
  300. }
  301. }
  302. }
  303. }
  304. .right-box {
  305. width: 55%;
  306. height: 100%;
  307. background: var(--image-border) no-repeat center;
  308. background-size: 100% 100%;
  309. .right-box-content {
  310. height: 100%;
  311. .alarm-history-table {
  312. width: 100%;
  313. position: relative;
  314. &::after {
  315. position: absolute;
  316. content: '';
  317. width: calc(100% + 10px);
  318. height: 2px;
  319. top: 0px;
  320. left: -10px;
  321. border-bottom: 1px solid #0efcff44;
  322. }
  323. }
  324. }
  325. }
  326. }
  327. }
  328. </style>