index.vue 8.5 KB

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