index.vue 12 KB

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