index.vue 12 KB

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