index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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, onMounted } 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. // 注册实时数据表格
  110. const { tableContext: ctxRealtime, onExportXls: onExportXlsTime } = useListPage({
  111. tableProps: {
  112. columns,
  113. api: getProvinceAlarm,
  114. formConfig: {
  115. labelWidth: 120,
  116. schemas: [
  117. {
  118. label: '煤矿名称',
  119. field: 'deptId',
  120. component: 'MineCascader', // 自定义组件名
  121. colProps: { span: 6 },
  122. rules: [],
  123. },
  124. ],
  125. showAdvancedButton: false,
  126. schemaGroupNames: ['常规查询'],
  127. },
  128. pagination: true,
  129. striped: true,
  130. useSearchForm: true,
  131. bordered: true,
  132. showIndexColumn: false,
  133. actionColumn: {
  134. width: 80,
  135. title: '操作',
  136. dataIndex: 'action',
  137. slots: { customRender: 'action' },
  138. fixed: undefined,
  139. },
  140. },
  141. exportConfig: {
  142. url: '/ventanaly-province/province/alarm/exportProvinceAlarmReal',
  143. name: '内外压差变化风险分析',
  144. params: {
  145. alarmType: 'sourcePressureAlarm',
  146. },
  147. },
  148. });
  149. const [registerRealtimeTable] = ctxRealtime;
  150. const { goafOptions, goafId, hiscode, resolveValue, registerModal, openModal, initGoafOptions, handleResolve } = useInitForm();
  151. // 注册历史数据表格
  152. const { tableContext, onExportXls } = useListPage({
  153. tableProps: {
  154. columns,
  155. // columns: historyColumns,
  156. api: (params) => {
  157. if (!goafId.value) {
  158. message.info('请先选择煤矿及老空区');
  159. return Promise.reject();
  160. }
  161. params.goafId = goafId.value;
  162. return getProvinceAlarmHistory(params);
  163. },
  164. formConfig: {
  165. model: { customField: hiscode },
  166. labelWidth: 120,
  167. schemas: [
  168. // {
  169. // label: '开始时间',
  170. // field: 'startTime',
  171. // component: 'DatePicker',
  172. // defaultValue: dayjs().add(-30, 'day').format('YYYY-MM-DD HH:mm:ss'),
  173. // componentProps: {
  174. // showTime: true,
  175. // placeholder: '请选择开始时间',
  176. // valueFormat: 'YYYY-MM-DD HH:mm:ss',
  177. // },
  178. // colProps: { span: 6 },
  179. // rules: [{ required: true, message: '请选择开始时间' }],
  180. // },
  181. // {
  182. // label: '结束时间',
  183. // field: 'endTime',
  184. // component: 'DatePicker',
  185. // defaultValue: dayjs(),
  186. // componentProps: {
  187. // showTime: true,
  188. // placeholder: '请选择结束时间',
  189. // valueFormat: 'YYYY-MM-DD HH:mm:ss',
  190. // },
  191. // colProps: { span: 6 },
  192. // rules: [{ required: true, message: '请选择结束时间' }],
  193. // },
  194. {
  195. label: '煤矿名称',
  196. field: 'customField',
  197. component: 'MineCascader', // 自定义组件名
  198. componentProps: {
  199. initFromStore: false,
  200. syncToStore: false,
  201. changeOnSelect: false,
  202. onChange: (e) => {
  203. historyTable.setLoading(true);
  204. initGoafOptions(e).finally(() => {
  205. historyTable.setLoading(false);
  206. });
  207. },
  208. },
  209. colProps: { span: 6 },
  210. rules: [],
  211. },
  212. ...historicalFormSchema,
  213. ],
  214. showAdvancedButton: false,
  215. schemaGroupNames: ['常规查询'],
  216. },
  217. pagination: true,
  218. striped: true,
  219. useSearchForm: true,
  220. bordered: true,
  221. showIndexColumn: true,
  222. showActionColumn: false,
  223. },
  224. exportConfig: {
  225. url: '/province/alarm/exportProvinceAlarmHistory',
  226. name: '历史数据',
  227. params: {
  228. alarmType: 'sourcePressureAlarm',
  229. goafId,
  230. },
  231. },
  232. });
  233. const [registerHistoryTable, historyTable] = tableContext;
  234. async function getAlarmTotalData() {
  235. const params = {
  236. alarmType: 'sourcePressureAlarm',
  237. };
  238. const result = await getProvinceAlarmNum(params);
  239. boardData.value[1].value = result.alarmLevel1;
  240. boardData.value[2].value = result.alarmLevel2;
  241. boardData.value[3].value = result.alarmLevel3;
  242. boardData.value[4].value = result.alarmLevel4;
  243. boardData.value[0].value = result.alarmLevel1 + result.alarmLevel2 + result.alarmLevel3 + result.alarmLevel4;
  244. }
  245. onMounted(() => {
  246. // 页面挂载时的逻辑
  247. getAlarmTotalData();
  248. });
  249. </script>
  250. <style lang="less" scoped>
  251. @import url(../../common/board.less);
  252. </style>