index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <customHeader>{{ orgname }}预警历史监控系统</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: 350 }">
  26. <template #form-onExportXls>
  27. <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls()"> 导出</a-button>
  28. </template>
  29. <template #bodyCell="{ column, record }">
  30. <template v-if="column.dict">
  31. <!-- 除了 101(蓝色预警)其他都是红色字体 -->
  32. <span v-if="column.dataIndex === 'nwartype'" :class="{ 'color-#ff3823': ['102', '103', '104', '201', '1001'].includes(record.nwartype) }">
  33. {{ render.renderDictText(record.nwartype, 'leveltype') || '-' }}
  34. </span>
  35. <span v-else>
  36. {{ render.renderDictText(record[column.dataIndex], column.dict) || '-' }}
  37. </span>
  38. </template>
  39. </template>
  40. </BasicTable>
  41. <BasicTable v-if="activeKey == 'manageAuto'" ref="alarmHistory" @register="registerTable" :scroll="{ x: 0, y: 350 }">
  42. <template #form-onExportXls>
  43. <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls()"> 导出</a-button>
  44. </template>
  45. <template #bodyCell="{ column, record }">
  46. <template v-if="column.dict">
  47. <!-- 除了 101(蓝色预警)其他都是红色字体 -->
  48. <span v-if="column.dataIndex === 'nwartype'" :class="{ 'color-#ff3823': ['102', '103', '104', '201', '1001'].includes(record.nwartype) }">
  49. {{ render.renderDictText(record.nwartype, 'leveltype') || '-' }}
  50. </span>
  51. <span v-else>
  52. {{ render.renderDictText(record[column.dataIndex], column.dict) || '-' }}
  53. </span>
  54. </template>
  55. </template>
  56. </BasicTable>
  57. </div>
  58. </template>
  59. <script lang="ts" name="system-user" setup>
  60. //ts语法
  61. import { watch, ref, defineExpose, onMounted, reactive } from 'vue';
  62. import { BasicTable } from '/@/components/Table';
  63. import { useListPage } from '/@/hooks/system/useListPage';
  64. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  65. import { manageAutoColumns1 } from './alarm.data';
  66. import { getAutoScrollContainer } from '/@/utils/common/compUtils';
  67. import { list, getEachMineWarnCountInfo } from './warning.api';
  68. import { useRoute } from 'vue-router';
  69. import customHeader from '/@/components/vent/customHeader.vue';
  70. import { render } from '/@/utils/common/renderUtils';
  71. const props = defineProps({
  72. formConfig: {
  73. type: Object as PropType<FormProps> | undefined,
  74. default: undefined,
  75. },
  76. });
  77. const route = useRoute();
  78. let statisticsList = reactive<any[]>([
  79. { title: '通风', valueT: 0, valueB: '' },
  80. { title: '粉尘', valueT: 0, valueB: '' },
  81. { title: '瓦斯', valueT: 0, valueB: '' },
  82. { title: '火灾', valueT: 0, valueB: '' },
  83. { title: '安全监测', valueT: 0, valueB: '' },
  84. ]);
  85. const activeKey = ref('device');
  86. const alarmHistory = ref();
  87. const deviceColumns = getTableHeaderColumns('alarm_history') as [];
  88. const dataColumns = ref(deviceColumns);
  89. const paramType = ref('alarmLog');
  90. // 列表页面公共参数、方法
  91. const { tableContext, onExportXls } = useListPage({
  92. tableProps: {
  93. api: list,
  94. columns: dataColumns,
  95. canResize: true,
  96. showTableSetting: false,
  97. showActionColumn: false,
  98. showIndexColumn: true,
  99. bordered: false,
  100. size: 'small',
  101. formConfig: {
  102. labelAlign: 'left',
  103. showAdvancedButton: false,
  104. // autoAdvancedCol: 4,
  105. // labelWidth:50,
  106. schemas: [
  107. {
  108. label: '是否解决',
  109. field: 'isOk',
  110. defaultValue: false,
  111. component: 'Select',
  112. componentProps: {
  113. options: [
  114. {
  115. label: '未解决',
  116. value: false,
  117. },
  118. {
  119. label: '已解决',
  120. value: true,
  121. },
  122. ],
  123. },
  124. colProps: { span: 4 },
  125. },
  126. {
  127. label: '系统',
  128. field: 'systemType',
  129. component: 'Select',
  130. componentProps: {
  131. options: [
  132. {
  133. label: '通风',
  134. value: 'ventS',
  135. },
  136. {
  137. label: '防灭火',
  138. value: 'fireS',
  139. },
  140. {
  141. label: '防尘',
  142. value: 'dustS',
  143. },
  144. {
  145. label: '瓦斯',
  146. value: 'gasS',
  147. },
  148. ],
  149. },
  150. colProps: { span: 3 },
  151. },
  152. {
  153. label: '矿编码',
  154. field: 'orgcode',
  155. component: 'Select',
  156. defaultValue: 'sdmtjtbetmk',
  157. componentProps: {
  158. options: [
  159. {
  160. label: '布尔台煤矿',
  161. value: 'sdmtjtbetmk',
  162. },
  163. {
  164. label: '活鸡兔井',
  165. value: 'sdmtjtdltmkhjtj',
  166. },
  167. {
  168. label: '大柳塔井',
  169. value: 'sdmtjtdltmk',
  170. },
  171. {
  172. label: '补连塔煤矿',
  173. value: 'sdmtjtbltmk',
  174. },
  175. {
  176. label: '上湾煤矿',
  177. value: 'sdmtjtswmk',
  178. },
  179. {
  180. label: '锦界煤矿',
  181. value: 'sdmtjtjjmk',
  182. },
  183. {
  184. label: '哈拉沟煤矿',
  185. value: 'sdmtjthlgmk',
  186. },
  187. {
  188. label: '柳塔煤矿',
  189. value: 'sdmtjtltmk',
  190. },
  191. {
  192. label: '石圪台煤矿',
  193. value: 'sdmtjtsgtmk',
  194. },
  195. {
  196. label: '保德煤矿',
  197. value: 'sdmtjtbdmk',
  198. },
  199. {
  200. label: '寸草塔煤矿',
  201. value: 'sdmtjtcctmk',
  202. },
  203. {
  204. label: '寸草塔二矿',
  205. value: 'sdmtjtcctrk',
  206. },
  207. {
  208. label: '榆家粱煤矿',
  209. value: 'sdmtjtyjlmk',
  210. },
  211. {
  212. label: '乌兰木伦煤矿',
  213. value: 'sdmtjtwlmlmk',
  214. },
  215. ],
  216. },
  217. colProps: { span: 3 },
  218. },
  219. {
  220. field: 'starttime',
  221. label: '开始时间',
  222. component: 'DatePicker',
  223. componentProps: {
  224. showTime: true,
  225. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  226. getPopupContainer: getAutoScrollContainer,
  227. },
  228. colProps: {
  229. span: 4,
  230. },
  231. },
  232. {
  233. field: 'endtime',
  234. label: '结束时间',
  235. component: 'DatePicker',
  236. componentProps: {
  237. showTime: true,
  238. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  239. getPopupContainer: getAutoScrollContainer,
  240. },
  241. colProps: {
  242. span: 4,
  243. },
  244. },
  245. ],
  246. },
  247. fetchSetting: {
  248. listField: 'records',
  249. },
  250. pagination: {
  251. current: 1,
  252. pageSize: 10,
  253. pageSizeOptions: ['10', '30', '50', '100'],
  254. },
  255. beforeFetch(params) {
  256. params.type = paramType.value;
  257. return params;
  258. },
  259. },
  260. exportConfig: {
  261. name: '预警历史列表',
  262. url: '/safety/ventanalyAlarmLog/exportXls',
  263. },
  264. });
  265. //注册table数据
  266. const [registerTable, { reload, setLoading, getForm }] = tableContext;
  267. function onChangeTab(tab) {
  268. if (tab === 'device') {
  269. paramType.value = 'alarmLog';
  270. dataColumns.value = deviceColumns;
  271. } else {
  272. paramType.value = 'autoLog';
  273. dataColumns.value = manageAutoColumns1;
  274. }
  275. }
  276. //获取预警统计信息
  277. async function getEachMineWarnCountInfoList() {
  278. let res = await getEachMineWarnCountInfo({});
  279. console.log(res, '监测数量预警状态------');
  280. statisticsList[0].valueT = res.ventSWarnInfo.totalNum || 0;
  281. statisticsList[0].valueB = res.ventSWarnInfo.maxWarnLevel || '';
  282. statisticsList[1].valueT = res.dustSWarnInfo.totalNum || 0;
  283. statisticsList[1].valueB = res.dustSWarnInfo.maxWarnLevel || '';
  284. statisticsList[2].valueT = res.gasSWarnInfo.totalNum || 0;
  285. statisticsList[2].valueB = res.gasSWarnInfo.maxWarnLevel || '';
  286. statisticsList[3].valueT = res.fireSWarnInfo.totalNum || 0;
  287. statisticsList[3].valueB = res.fireSWarnInfo.maxWarnLevel || '';
  288. statisticsList[4].valueT = res.synthesizeSWarnInfo.totalNum || 0;
  289. statisticsList[4].valueB = res.synthesizeSWarnInfo.maxWarnLevel || '';
  290. }
  291. const orgname = ref<any>('');
  292. onMounted(async () => {
  293. orgname.value = route.query.orgname;
  294. getEachMineWarnCountInfoList();
  295. });
  296. defineExpose({ setLoading });
  297. </script>
  298. <style scoped lang="less">
  299. @import '/@/design/theme.less';
  300. @ventSpace: zxm;
  301. :deep(.zxm-table-container) {
  302. max-height: 720px !important;
  303. }
  304. :deep(.ventSpace-table-body) {
  305. height: auto !important;
  306. }
  307. :deep(.zxm-picker) {
  308. height: 30px !important;
  309. }
  310. :deep(.@{ventSpace}-picker-dropdown) {
  311. position: absolute !important;
  312. top: 35px !important;
  313. left: 0 !important;
  314. }
  315. @{theme-deepblue} {
  316. .data-statistics {
  317. --image-vent-tf: url('/@/assets/images/themify/deepblue/vent-tf.png');
  318. --image-dust-fc: url('/@/assets/images/themify/deepblue/dust-fc.png');
  319. --image-gas-ws: url('/@/assets/images/themify/deepblue/gas-ws.png');
  320. --image-fire-fz: url('/@/assets/images/themify/deepblue/fire-fz.png');
  321. --image-aqjc: url('/@/assets/images/themify/deepblue/aqjc.png');
  322. --image-his-one: url('/@/assets/images/themify/deepblue/his-one.png');
  323. }
  324. .tab-box {
  325. --table-border: #0eb3ff66;
  326. --tab-bg: linear-gradient(#001325, #051f4a);
  327. --image-top-btn: url('/@/assets/images/themify/deepblue/top-btn.png');
  328. --image-top-btn-select: url('/@/assets/images/themify/deepblue/top-btn-select.png');
  329. }
  330. }
  331. .data-statistics {
  332. --image-vent-tf: url('/@/assets/images/vent-tf.png');
  333. --image-dust-fc: url('/@/assets/images/dust-fc.png');
  334. --image-gas-ws: url('/@/assets/images/gas-ws.png');
  335. --image-fire-fz: url('/@/assets/images/fire-fz.png');
  336. --image-aqjc: url('/@/assets/images/aqjc.png');
  337. --image-his-one: url('/@/assets/images/his-one.png');
  338. height: 200px;
  339. padding: 20px;
  340. margin-top: 90px;
  341. background-color: #0ebbff15;
  342. display: flex;
  343. justify-content: space-between;
  344. align-items: center;
  345. .statistics-box {
  346. display: flex;
  347. flex: 1;
  348. height: 100%;
  349. justify-content: center;
  350. align-items: center;
  351. .left-box {
  352. position: relative;
  353. width: 138px;
  354. height: 100%;
  355. .box-title {
  356. position: absolute;
  357. left: 50%;
  358. bottom: 18px;
  359. transform: translate(-50%, 0);
  360. color: #fff;
  361. }
  362. }
  363. &:nth-child(1) .left-box {
  364. background: var(--image-vent-tf) no-repeat center;
  365. background-size: 100% auto;
  366. }
  367. &:nth-child(2) .left-box {
  368. background: var(--image-dust-fc) no-repeat center;
  369. background-size: 100% auto;
  370. }
  371. &:nth-child(3) .left-box {
  372. background: var(--image-gas-ws) no-repeat center;
  373. background-size: 100% auto;
  374. }
  375. &:nth-child(4) .left-box {
  376. background: var(--image-fire-fz) no-repeat center;
  377. background-size: 100% auto;
  378. }
  379. &:nth-child(5) .left-box {
  380. background: var(--image-aqjc) no-repeat center;
  381. background-size: 100% auto;
  382. }
  383. .right-box {
  384. position: relative;
  385. width: 215px;
  386. height: 100%;
  387. display: flex;
  388. flex-direction: column;
  389. justify-content: space-around;
  390. align-items: center;
  391. .box-text {
  392. position: relative;
  393. width: 100%;
  394. height: 40px;
  395. color: #fff;
  396. background: var(--image-his-one) no-repeat center;
  397. background-size: 100% 100%;
  398. .text-label {
  399. position: absolute;
  400. left: 20px;
  401. top: 50%;
  402. transform: translate(0, -50%);
  403. }
  404. .text-value {
  405. position: absolute;
  406. left: 130px;
  407. top: 50%;
  408. transform: translate(0, -50%);
  409. font-family: 'douyuFont';
  410. }
  411. }
  412. .warning-state {
  413. .text-value {
  414. color: aqua !important;
  415. font-family: 'douyuFont';
  416. }
  417. }
  418. }
  419. }
  420. }
  421. .tab-box {
  422. --table-border: #0efcff44;
  423. --tab-bg: linear-gradient(#001325, #012e4f);
  424. --image-top-btn: url('/@/assets/images/top-btn.png');
  425. --image-top-btn-select: url('/@/assets/images/top-btn-select.png');
  426. display: flex;
  427. color: #fff;
  428. position: relative;
  429. top: 11px;
  430. background: var(--tab-bg);
  431. :deep(.zxm-tabs-nav) {
  432. margin: 0 !important;
  433. .zxm-tabs-tab {
  434. width: 180px;
  435. height: 45px;
  436. background: var(--image-top-btn) center no-repeat;
  437. background-size: cover;
  438. display: flex;
  439. justify-content: center;
  440. font-size: 16px;
  441. }
  442. .zxm-tabs-tab-active {
  443. width: 180px;
  444. position: relative;
  445. background: var(--image-top-btn-select) center no-repeat;
  446. background-size: cover;
  447. .zxm-tabs-tab-btn {
  448. color: #fff !important;
  449. }
  450. }
  451. .zxm-tabs-ink-bar {
  452. width: 0 !important;
  453. }
  454. .zxm-tabs-tab + .zxm-tabs-tab {
  455. margin: 0 !important;
  456. }
  457. }
  458. }
  459. .alarm-history-table {
  460. width: 100%;
  461. background-color: #0ebbff15;
  462. position: relative;
  463. margin-top: 10px;
  464. &::after {
  465. position: absolute;
  466. content: '';
  467. width: calc(100% + 10px);
  468. height: 2px;
  469. top: 0px;
  470. left: -10px;
  471. border-bottom: 1px solid var(--table-border);
  472. }
  473. }
  474. </style>