index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. <!-- 晚报数据表格 -->
  8. <BasicTable @register="registerRealtimeTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
  9. <template #action="{ record }">
  10. <div class="action-buttons">
  11. <!-- 操作按钮 -->
  12. <button @click="openModal(record)" class="resolved-btn" title="解决">
  13. <SvgIcon name="details" />
  14. </button>
  15. </div>
  16. </template>
  17. <template #resetBefore>
  18. <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXlsTime"> 导出 </a-button>
  19. </template>
  20. </BasicTable>
  21. </TabPane>
  22. <TabPane tab="历史数据" key="history">
  23. <!-- 历史数据表格 -->
  24. <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
  25. <!-- <template #action="{ record }">
  26. <div class="action-buttons">
  27. <button @click="openModal(record, 'history')" class="action-btn">
  28. <SvgIcon name="details" />
  29. </button>
  30. </div>
  31. </template> -->
  32. <template #resetBefore>
  33. <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
  34. </template>
  35. <template #form-goaf-select>
  36. <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" />
  37. </template>
  38. </BasicTable>
  39. </TabPane>
  40. </Tabs>
  41. <!-- 弹窗组件 -->
  42. <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况" @ok="handleResolve">
  43. <a-textarea class="ml-10px" :style="{ width: `calc(100% - 20px)` }" v-model:value="resolveValue" placeholder="请输入解决情况" :rows="4" />
  44. </BasicModal>
  45. </div>
  46. </template>
  47. <script setup lang="ts">
  48. import { ref } from 'vue';
  49. import { BasicTable } from '/@/components/Table';
  50. import { Tabs, TabPane, message } from 'ant-design-vue';
  51. import { SvgIcon } from '/@/components/Icon';
  52. // 引入模拟数据
  53. import { columns } from './reportAnalysis.data';
  54. import { getProvinceAlarm, getProvinceAlarmHistory } from './report.api';
  55. import { useInitForm } from '../../common/analysis';
  56. import { BasicModal } from '/@/components/Modal/index';
  57. import { historicalFormSchema } from '/@/views/monitor/sealedMonitor/monitor.data';
  58. // import { useIntervalFn } from '@vueuse/core';
  59. import { useListPage } from '/@/hooks/system/useListPage';
  60. // 激活的Tab页签
  61. const activeTab = ref('realtime');
  62. // 注册晚报数据表格
  63. const { tableContext: ctxRealtime, onExportXls: onExportXlsTime } = useListPage({
  64. tableProps: {
  65. columns,
  66. api: getProvinceAlarm,
  67. formConfig: {
  68. labelWidth: 120,
  69. schemas: [
  70. {
  71. label: '煤矿名称',
  72. field: 'deptId',
  73. component: 'MineCascader', // 自定义组件名
  74. colProps: { span: 6 },
  75. rules: [],
  76. },
  77. ],
  78. showAdvancedButton: false,
  79. schemaGroupNames: ['常规查询'],
  80. },
  81. pagination: true,
  82. striped: true,
  83. useSearchForm: true,
  84. bordered: true,
  85. showIndexColumn: false,
  86. actionColumn: {
  87. width: 80,
  88. title: '操作',
  89. dataIndex: 'action',
  90. slots: { customRender: 'action' },
  91. fixed: undefined,
  92. },
  93. },
  94. exportConfig: {
  95. url: '/ventanaly-province/province/alarm/exportProvinceAlarmReal',
  96. name: '自燃发火隐患分级',
  97. params: {
  98. alarmType: 'lateReport',
  99. },
  100. },
  101. });
  102. const [registerRealtimeTable] = ctxRealtime;
  103. const { goafOptions, goafId, hiscode, resolveValue, registerModal, openModal, initGoafOptions, handleResolve } = useInitForm();
  104. // 注册历史数据表格
  105. const { tableContext, onExportXls } = useListPage({
  106. tableProps: {
  107. columns,
  108. // columns: historyColumns,
  109. api: (params) => {
  110. if (!goafId.value) {
  111. message.info('请先选择煤矿及老空区');
  112. return Promise.reject();
  113. }
  114. params.goafId = goafId.value;
  115. return getProvinceAlarmHistory(params);
  116. },
  117. formConfig: {
  118. model: { customField: hiscode },
  119. labelWidth: 120,
  120. schemas: [
  121. {
  122. label: '煤矿名称',
  123. field: 'customField',
  124. component: 'MineCascader', // 自定义组件名
  125. componentProps: {
  126. initFromStore: false,
  127. syncToStore: false,
  128. changeOnSelect: false,
  129. onChange: (e) => {
  130. historyTable.setLoading(true);
  131. initGoafOptions(e).finally(() => {
  132. historyTable.setLoading(false);
  133. });
  134. },
  135. },
  136. colProps: { span: 6 },
  137. rules: [],
  138. },
  139. ...historicalFormSchema,
  140. ],
  141. showAdvancedButton: false,
  142. schemaGroupNames: ['常规查询'],
  143. },
  144. pagination: true,
  145. striped: true,
  146. useSearchForm: true,
  147. bordered: true,
  148. showIndexColumn: true,
  149. showActionColumn: false,
  150. },
  151. exportConfig: {
  152. url: '/province/alarm/exportProvinceAlarmHistory',
  153. name: '历史数据',
  154. params: {
  155. alarmType: 'lateReport',
  156. goafId,
  157. },
  158. },
  159. });
  160. const [registerHistoryTable, historyTable] = tableContext;
  161. </script>
  162. <style lang="less" scoped>
  163. @import url(../../common/board.less);
  164. </style>