index-mine.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <customHeader>预警历史监控系统</customHeader>
  3. <div class="data-statistics">
  4. <div class="statistics-box" v-for="(item, index) in statisticsList" :key="index">
  5. <div class="left-box">
  6. <div class="box-title">{{ item.title }}</div>
  7. </div>
  8. <div class="right-box">
  9. <div class="box-text">
  10. <div class="text-label">监测数量</div>
  11. <div class="text-value">{{ item.valueT }}</div>
  12. </div>
  13. <div class="warning-state box-text">
  14. <div class="text-label">预警状态</div>
  15. <div class="text-value">{{ item.valueB }}</div>
  16. </div>
  17. </div>
  18. </div>
  19. </div>
  20. <a-tabs class="tab-box" v-model:activeKey="activeKey" @change="onChangeTab">
  21. <a-tab-pane tab="设备预警历史" key="device" />
  22. <a-tab-pane tab="联动预警历史" key="manageAuto" />
  23. </a-tabs>
  24. <div class="alarm-history-table">
  25. <BasicTable v-if="activeKey == 'device'" ref="alarmHistory" @register="registerTable" :scroll="{ x: 0, y: 340 }">
  26. <template #form-onExportXls>
  27. <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls()"> 导出</a-button>
  28. </template>
  29. </BasicTable>
  30. <BasicTable v-if="activeKey == 'manageAuto'" ref="alarmHistory" @register="registerTable" :scroll="{ x: 0, y: 340 }">
  31. <template #form-onExportXls>
  32. <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls()"> 导出</a-button>
  33. </template>
  34. </BasicTable>
  35. </div>
  36. </template>
  37. <script lang="ts" name="system-user" setup>
  38. //ts语法
  39. import { watch, ref, defineExpose, onMounted, reactive } from 'vue';
  40. import { BasicTable } from '/@/components/Table';
  41. import { useListPage } from '/@/hooks/system/useListPage';
  42. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  43. import { manageAutoColumns } from './alarm.data';
  44. import { getAutoScrollContainer } from '/@/utils/common/compUtils';
  45. import { getAlarmLogList, getManageAutoLogList, getWarnCountInfo } from './warning.api';
  46. import { useRoute } from 'vue-router';
  47. import customHeader from '/@/components/vent/customHeader.vue';
  48. const props = defineProps({
  49. formConfig: {
  50. type: Object as PropType<FormProps> | undefined,
  51. default: undefined,
  52. },
  53. });
  54. const route = useRoute();
  55. let statisticsList = reactive<any[]>([
  56. { title: '通风', valueT: 0, valueB: '' },
  57. { title: '粉尘', valueT: 0, valueB: '' },
  58. { title: '瓦斯', valueT: 0, valueB: '' },
  59. { title: '火灾', valueT: 0, valueB: '' },
  60. { title: '安全监测', valueT: 0, valueB: '' },
  61. ]);
  62. const activeKey = ref('device');
  63. const alarmHistory = ref();
  64. const deviceColumns = getTableHeaderColumns('alarm_history') as [];
  65. const dataColumns = ref(deviceColumns);
  66. const list = ref<any>(getAlarmLogList);
  67. // 列表页面公共参数、方法
  68. const { tableContext, onExportXls } = useListPage({
  69. tableProps: {
  70. api: list,
  71. columns: dataColumns,
  72. canResize: true,
  73. showTableSetting: false,
  74. showActionColumn: false,
  75. bordered: false,
  76. size: 'small',
  77. formConfig: {
  78. labelAlign: 'left',
  79. showAdvancedButton: false,
  80. // autoAdvancedCol: 2,
  81. schemas: [
  82. {
  83. label: '是否解决',
  84. // field: 'isok',
  85. field: 'isOk',
  86. component: 'Select',
  87. componentProps: {
  88. options: [
  89. {
  90. label: '未解决',
  91. value: false,
  92. },
  93. {
  94. label: '已解决',
  95. value: true,
  96. },
  97. ],
  98. },
  99. colProps: { span: 4 },
  100. },
  101. {
  102. label: '所属系统',
  103. // field: 'kindtype',systemType
  104. field: 'systemType',
  105. component: 'Select',
  106. componentProps: {
  107. options: [
  108. {
  109. label: '通风',
  110. value: 'ventS',
  111. },
  112. {
  113. label: '防灭火',
  114. value: 'fireS',
  115. },
  116. {
  117. label: '防尘',
  118. value: 'dustS',
  119. },
  120. {
  121. label: '瓦斯',
  122. value: 'gasS',
  123. },
  124. ],
  125. },
  126. colProps: { span: 4 },
  127. },
  128. // {
  129. // label: '设备类型',
  130. // field: 'deviceKind',
  131. // component: 'MTreeSelect',
  132. // componentProps: {
  133. // virtual: false,
  134. // },
  135. // colProps: { span: 4 },
  136. // },
  137. {
  138. field: 'starttime',
  139. label: '开始时间',
  140. component: 'DatePicker',
  141. componentProps: {
  142. showTime: true,
  143. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  144. getPopupContainer: getAutoScrollContainer,
  145. },
  146. colProps: {
  147. span: 4,
  148. },
  149. },
  150. {
  151. field: 'endtime',
  152. label: '结束时间',
  153. component: 'DatePicker',
  154. componentProps: {
  155. showTime: true,
  156. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  157. getPopupContainer: getAutoScrollContainer,
  158. },
  159. colProps: {
  160. span: 4,
  161. },
  162. },
  163. ],
  164. },
  165. fetchSetting: {
  166. listField: 'records',
  167. },
  168. pagination: {
  169. current: 1,
  170. pageSize: 10,
  171. pageSizeOptions: ['10', '30', '50', '100'],
  172. },
  173. beforeFetch(params) {
  174. // if (!params['deviceKind']) {
  175. // params['deviceKind'] = null;
  176. // }
  177. return params;
  178. },
  179. },
  180. exportConfig: {
  181. name: '预警历史列表',
  182. url: '/safety/ventanalyAlarmLog/exportXls',
  183. },
  184. });
  185. //注册table数据
  186. const [registerTable, { reload, setLoading, getForm }] = tableContext;
  187. function onChangeTab(tab) {
  188. if (tab === 'device') {
  189. list.value = getAlarmLogList;
  190. dataColumns.value = deviceColumns;
  191. } else {
  192. list.value = getManageAutoLogList;
  193. dataColumns.value = manageAutoColumns;
  194. }
  195. }
  196. //获取预警统计信息
  197. async function getEachMineWarnCountInfoList() {
  198. let res = await getWarnCountInfo({});
  199. statisticsList[0].valueT = res.ventSWarnInfo.totalNum || 0;
  200. statisticsList[0].valueB = res.ventSWarnInfo.maxWarnLevel || '';
  201. statisticsList[1].valueT = res.dustSWarnInfo.totalNum || 0;
  202. statisticsList[1].valueB = res.dustSWarnInfo.maxWarnLevel || '';
  203. statisticsList[2].valueT = res.gasSWarnInfo.totalNum || 0;
  204. statisticsList[2].valueB = res.gasSWarnInfo.maxWarnLevel || '';
  205. statisticsList[3].valueT = res.fireSWarnInfo.totalNum || 0;
  206. statisticsList[3].valueB = res.fireSWarnInfo.maxWarnLevel || '';
  207. statisticsList[4].valueT = res.synthesizeSWarnInfo.totalNum || 0;
  208. statisticsList[4].valueB = res.synthesizeSWarnInfo.maxWarnLevel || '';
  209. }
  210. onMounted(async () => {
  211. getEachMineWarnCountInfoList();
  212. });
  213. defineExpose({ setLoading });
  214. </script>
  215. <style scoped lang="less">
  216. @ventSpace: zxm;
  217. :deep(.zxm-table-container) {
  218. max-height: 720px !important;
  219. }
  220. :deep(.ventSpace-table-body) {
  221. height: auto !important;
  222. }
  223. :deep(.zxm-picker) {
  224. height: 30px !important;
  225. }
  226. :deep(.@{ventSpace}-picker-dropdown) {
  227. position: absolute !important;
  228. top: 35px !important;
  229. left: 0 !important;
  230. }
  231. .data-statistics {
  232. height: 200px;
  233. padding: 20px;
  234. margin-top: 90px;
  235. background-color: #0ebbff15;
  236. display: flex;
  237. justify-content: space-between;
  238. align-items: center;
  239. .statistics-box {
  240. display: flex;
  241. flex: 1;
  242. height: 100%;
  243. justify-content: center;
  244. align-items: center;
  245. .left-box {
  246. position: relative;
  247. width: 138px;
  248. height: 100%;
  249. .box-title {
  250. position: absolute;
  251. left: 50%;
  252. bottom: 18px;
  253. transform: translate(-50%, 0);
  254. color: #fff;
  255. }
  256. }
  257. &:nth-child(1) .left-box {
  258. background: url('../../../../assets/images/vent-tf.png') no-repeat center;
  259. background-size: 100% auto;
  260. }
  261. &:nth-child(2) .left-box {
  262. background: url('../../../../assets/images/dust-fc.png') no-repeat center;
  263. background-size: 100% auto;
  264. }
  265. &:nth-child(3) .left-box {
  266. background: url('../../../../assets/images/gas-ws.png') no-repeat center;
  267. background-size: 100% auto;
  268. }
  269. &:nth-child(4) .left-box {
  270. background: url('../../../../assets/images/fire-fz.png') no-repeat center;
  271. background-size: 100% auto;
  272. }
  273. &:nth-child(5) .left-box {
  274. background: url('../../../../assets/images/aqjc.png') no-repeat center;
  275. background-size: 100% auto;
  276. }
  277. .right-box {
  278. position: relative;
  279. width: 215px;
  280. height: 100%;
  281. display: flex;
  282. flex-direction: column;
  283. justify-content: space-around;
  284. align-items: center;
  285. .box-text {
  286. position: relative;
  287. width: 100%;
  288. height: 40px;
  289. color: #fff;
  290. background: url('../../../../assets/images/his-one.png') no-repeat center;
  291. background-size: 100% 100%;
  292. .text-label {
  293. position: absolute;
  294. left: 20px;
  295. top: 50%;
  296. transform: translate(0, -50%);
  297. }
  298. .text-value {
  299. position: absolute;
  300. left: 130px;
  301. top: 50%;
  302. transform: translate(0, -50%);
  303. font-family: 'douyuFont';
  304. }
  305. }
  306. .warning-state {
  307. .text-value {
  308. color: aqua !important;
  309. font-family: 'douyuFont';
  310. }
  311. }
  312. }
  313. }
  314. }
  315. .tab-box {
  316. display: flex;
  317. color: #fff;
  318. position: relative;
  319. top: 11px;
  320. background: linear-gradient(#001325, #012e4f);
  321. :deep(.zxm-tabs-nav) {
  322. margin: 0 !important;
  323. .zxm-tabs-tab {
  324. width: 180px;
  325. height: 45px;
  326. background: url('@/assets/images/top-btn.png') center no-repeat;
  327. background-size: cover;
  328. display: flex;
  329. justify-content: center;
  330. font-size: 16px;
  331. }
  332. .zxm-tabs-tab-active {
  333. width: 180px;
  334. position: relative;
  335. background: url('@/assets/images/top-btn-select.png') center no-repeat;
  336. background-size: cover;
  337. .zxm-tabs-tab-btn {
  338. color: #fff !important;
  339. }
  340. }
  341. .zxm-tabs-ink-bar {
  342. width: 0 !important;
  343. }
  344. .zxm-tabs-tab + .zxm-tabs-tab {
  345. margin: 0 !important;
  346. }
  347. }
  348. }
  349. .alarm-history-table {
  350. width: 100%;
  351. background-color: #0ebbff15;
  352. position: relative;
  353. margin-top: 10px;
  354. &::after {
  355. position: absolute;
  356. content: '';
  357. width: calc(100% + 10px);
  358. height: 2px;
  359. top: 0px;
  360. left: -10px;
  361. border-bottom: 1px solid #0efcff44;
  362. }
  363. }
  364. </style>