index.vue 13 KB

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