index.vue 12 KB

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