index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <div class="monitoring-page">
  4. <!-- 新增Tabs组件区分实时/历史数据 -->
  5. <Tabs v-model:activeKey="activeTab" type="line" class="common-page-tabs">
  6. <TabPane tab="实时监测" key="realtime">
  7. <div class="board-info">
  8. <MiniBoard
  9. v-for="(item, index) in boardData"
  10. :key="index"
  11. type="A"
  12. :label="item.label"
  13. :value="item.value"
  14. layout="label-top"
  15. class="board-item"
  16. />
  17. </div>
  18. <!-- 实时数据表格 -->
  19. <BasicTable @register="registerRealtimeTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
  20. <template #action="{ record }">
  21. <div class="action-buttons">
  22. <!-- 操作按钮 -->
  23. <button @click="openModal(record)" class="resolved-btn" title="解决">
  24. <SvgIcon name="details" />
  25. </button>
  26. </div>
  27. </template>
  28. <template #resetBefore>
  29. <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXlsTime"> 导出 </a-button>
  30. </template>
  31. </BasicTable>
  32. </TabPane>
  33. <TabPane tab="历史数据" key="history">
  34. <!-- 历史数据表格 -->
  35. <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
  36. <!-- <template #action="{ record }">
  37. <div class="action-buttons">
  38. <button @click="openModal(record, 'history')" class="action-btn">
  39. <SvgIcon name="details" />
  40. </button>
  41. </div>
  42. </template> -->
  43. <template #resetBefore>
  44. <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
  45. </template>
  46. <template #form-goaf-select>
  47. <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" />
  48. </template>
  49. </BasicTable>
  50. </TabPane>
  51. </Tabs>
  52. <!-- 弹窗组件 -->
  53. <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况" @ok="handleResolve">
  54. <a-textarea class="ml-10px" :style="{ width: `calc(100% - 20px)` }" v-model:value="resolveValue" placeholder="请输入解决情况" :rows="4" />
  55. </BasicModal>
  56. </div>
  57. </template>
  58. <script setup lang="ts">
  59. import { ref } from 'vue';
  60. import { BasicTable } from '/@/components/Table';
  61. import { Tabs, TabPane, message } from 'ant-design-vue';
  62. import MiniBoard from '/@/components/Configurable/detail/MiniBoard.vue';
  63. import { SvgIcon } from '/@/components/Icon';
  64. // 引入模拟数据
  65. import { columns } from './autoFireOutAnalysis.data';
  66. import { getProvinceAlarm, getProvinceAlarmHistory, getProvinceAlarmNum } from './autoFireOut.api';
  67. import { useInitForm } from '../../common/analysis';
  68. import { BasicModal } from '/@/components/Modal/index';
  69. import { historicalFormSchema } from '/@/views/monitor/sealedMonitor/monitor.data';
  70. // import { useIntervalFn } from '@vueuse/core';
  71. import { useListPage } from '/@/hooks/system/useListPage';
  72. // 激活的Tab页签
  73. const activeTab = ref('realtime');
  74. const boardData = ref([
  75. {
  76. label: '存在风险情况数量',
  77. value: '-',
  78. },
  79. {
  80. label: '低风险',
  81. value: '-',
  82. },
  83. {
  84. label: '一般风险',
  85. value: '-',
  86. },
  87. {
  88. label: '较高风险',
  89. value: '-',
  90. },
  91. {
  92. label: '高风险',
  93. value: '-',
  94. },
  95. ]);
  96. const wrappedGetMineData = (params) => {
  97. // 调用原接口
  98. return Promise.all([getAlarmTotalData(params), getProvinceAlarm(params)]).then(([__, res]) => res);
  99. };
  100. // 注册实时数据表格
  101. const { tableContext: ctxRealtime, onExportXls: onExportXlsTime } = useListPage({
  102. tableProps: {
  103. columns,
  104. api: wrappedGetMineData,
  105. formConfig: {
  106. labelWidth: 120,
  107. schemas: [
  108. {
  109. label: '煤矿名称',
  110. field: 'deptId',
  111. component: 'MineCascader', // 自定义组件名
  112. colProps: { span: 6 },
  113. rules: [],
  114. },
  115. ],
  116. showAdvancedButton: false,
  117. schemaGroupNames: ['常规查询'],
  118. },
  119. pagination: true,
  120. striped: true,
  121. useSearchForm: true,
  122. bordered: true,
  123. showIndexColumn: false,
  124. actionColumn: {
  125. width: 80,
  126. title: '操作',
  127. dataIndex: 'action',
  128. slots: { customRender: 'action' },
  129. fixed: undefined,
  130. },
  131. },
  132. exportConfig: {
  133. url: '/ventanaly-province/province/alarm/exportProvinceAlarmReal',
  134. name: '自燃发火隐患分级',
  135. params: {
  136. alarmType: 'fireAlarmOut',
  137. },
  138. },
  139. });
  140. const [registerRealtimeTable] = ctxRealtime;
  141. const { goafOptions, goafId, hiscode, resolveValue, registerModal, openModal, initGoafOptions, handleResolve } = useInitForm();
  142. // 注册历史数据表格
  143. const { tableContext, onExportXls } = useListPage({
  144. tableProps: {
  145. columns,
  146. // columns: historyColumns,
  147. api: (params) => {
  148. if (!goafId.value) {
  149. message.info('请先选择煤矿及老空区');
  150. return Promise.reject();
  151. }
  152. params.goafId = goafId.value;
  153. return getProvinceAlarmHistory(params);
  154. },
  155. formConfig: {
  156. model: { customField: hiscode },
  157. labelWidth: 120,
  158. schemas: [
  159. // {
  160. // label: '开始时间',
  161. // field: 'startTime',
  162. // component: 'DatePicker',
  163. // defaultValue: dayjs().add(-30, 'day').format('YYYY-MM-DD HH:mm:ss'),
  164. // componentProps: {
  165. // showTime: true,
  166. // placeholder: '请选择开始时间',
  167. // valueFormat: 'YYYY-MM-DD HH:mm:ss',
  168. // },
  169. // colProps: { span: 6 },
  170. // rules: [{ required: true, message: '请选择开始时间' }],
  171. // },
  172. // {
  173. // label: '结束时间',
  174. // field: 'endTime',
  175. // component: 'DatePicker',
  176. // defaultValue: dayjs(),
  177. // componentProps: {
  178. // showTime: true,
  179. // placeholder: '请选择结束时间',
  180. // valueFormat: 'YYYY-MM-DD HH:mm:ss',
  181. // },
  182. // colProps: { span: 6 },
  183. // rules: [{ required: true, message: '请选择结束时间' }],
  184. // },
  185. {
  186. label: '煤矿名称',
  187. field: 'customField',
  188. component: 'MineCascader', // 自定义组件名
  189. componentProps: {
  190. initFromStore: false,
  191. syncToStore: false,
  192. changeOnSelect: false,
  193. onChange: (e) => {
  194. historyTable.setLoading(true);
  195. initGoafOptions(e).finally(() => {
  196. historyTable.setLoading(false);
  197. });
  198. },
  199. },
  200. colProps: { span: 6 },
  201. rules: [],
  202. },
  203. ...historicalFormSchema,
  204. ],
  205. showAdvancedButton: false,
  206. schemaGroupNames: ['常规查询'],
  207. },
  208. pagination: true,
  209. striped: true,
  210. useSearchForm: true,
  211. bordered: true,
  212. showIndexColumn: true,
  213. showActionColumn: false,
  214. },
  215. exportConfig: {
  216. url: '/province/alarm/exportProvinceAlarmHistory',
  217. name: '历史数据',
  218. params: {
  219. alarmType: 'fireAlarmOut',
  220. goafId,
  221. },
  222. },
  223. });
  224. const [registerHistoryTable, historyTable] = tableContext;
  225. async function getAlarmTotalData(p) {
  226. const params = {
  227. ...p,
  228. alarmType: 'fireAlarmOut',
  229. };
  230. const result = await getProvinceAlarmNum(params);
  231. boardData.value[1].value = result.alarmLevel1;
  232. boardData.value[2].value = result.alarmLevel2;
  233. boardData.value[3].value = result.alarmLevel3;
  234. boardData.value[4].value = result.alarmLevel4;
  235. boardData.value[0].value = result.alarmLevel1 + result.alarmLevel2 + result.alarmLevel3 + result.alarmLevel4;
  236. }
  237. </script>
  238. <style lang="less" scoped>
  239. @import url(../../common/board.less);
  240. </style>