index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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 action-btn" title="解决">
  27. <SvgIcon name="solved" />
  28. </button>
  29. <button @click="handleGoToPageQuery(record, '/warningAnalysis/connectAnalysis')" class="action-btn" title="智能分析数据">
  30. <SvgIcon name="chart" />
  31. </button>
  32. </div>
  33. </template>
  34. <template #resetBefore>
  35. <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXlsTime"> 导出 </a-button>
  36. </template>
  37. </BasicTable>
  38. </TabPane>
  39. <TabPane tab="历史数据" key="history">
  40. <!-- 历史数据表格 -->
  41. <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
  42. <template #action="{ record }">
  43. <div class="action-buttons">
  44. <button @click="handleGoToPageQuery(record, '/warningAnalysis/connectAnalysis')" class="action-btn" title="智能分析数据">
  45. <SvgIcon name="chart" />
  46. </button>
  47. </div>
  48. </template>
  49. <template #resetBefore>
  50. <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 导出 </a-button>
  51. </template>
  52. <template #form-goaf-select>
  53. <a-select v-model:value="goafId" :options="goafOptions" placeholder="请选择" @change="historyTable.reload" />
  54. </template>
  55. </BasicTable>
  56. </TabPane>
  57. </Tabs>
  58. <!-- 弹窗组件 -->
  59. <!-- <a-modal
  60. style="top: 30%; left: 170px"
  61. v-model:visible="visibleModal"
  62. :width="450"
  63. title="实时分析数据"
  64. @ok="handleOkEdit"
  65. @cancel="handleCancelEdit"
  66. >
  67. <a-table></a-table>
  68. </a-modal> -->
  69. <!-- 弹窗组件 -->
  70. <BasicModal @register="registerModal" :width="600" :minHeight="100" centered title="处理情况" @ok="handleResolve">
  71. <a-textarea class="ml-10px" :style="{ width: `calc(100% - 20px)` }" v-model:value="resolveValue" placeholder="请输入解决情况" :rows="4" />
  72. </BasicModal>
  73. </template>
  74. <script setup lang="ts">
  75. import { ref } from 'vue';
  76. import { BasicTable } from '/@/components/Table';
  77. import { Tabs, TabPane } from 'ant-design-vue';
  78. import MiniBoard from '/@/components/Configurable/detail/MiniBoard.vue';
  79. import { SvgIcon } from '/@/components/Icon';
  80. // 引入模拟数据
  81. import { columns } from './pressureDiffAnalysis.data';
  82. import { getProvinceAlarm, getProvinceAlarmHistory, getProvinceAlarmNum } from './pressureDiff.api';
  83. import { useInitForm, RISK_ANALYSIS_OPTIONS } from '../../common/analysis';
  84. import { BasicModal } from '/@/components/Modal/index';
  85. import { historicalFormSchema } from '/@/views/monitor/sealedMonitor/monitor.data';
  86. import { useListPage } from '/@/hooks/system/useListPage';
  87. import { advancedRoutePush } from '/@/utils';
  88. // 激活的Tab页签
  89. const activeTab = ref('realtime');
  90. const boardData = ref([
  91. {
  92. label: '存在风险情况数量',
  93. value: '-',
  94. },
  95. {
  96. label: '低风险',
  97. value: '-',
  98. },
  99. {
  100. label: '一般风险',
  101. value: '-',
  102. },
  103. {
  104. label: '较高风险',
  105. value: '-',
  106. },
  107. {
  108. label: '高风险',
  109. value: '-',
  110. },
  111. ]);
  112. const wrappedGetMineData = (params) => {
  113. // 调用原接口
  114. return Promise.all([getAlarmTotalData(params), getProvinceAlarm(params)]).then(([__, res]) => res);
  115. };
  116. // 注册实时数据表格
  117. const { tableContext: ctxRealtime, onExportXls: onExportXlsTime } = useListPage({
  118. tableProps: {
  119. immediate: false,
  120. columns,
  121. api: wrappedGetMineData,
  122. formConfig: {
  123. autoSearch: true,
  124. labelWidth: 120,
  125. schemas: [
  126. {
  127. label: '煤矿名称',
  128. field: 'deptId',
  129. component: 'MineCascader',
  130. colProps: { span: 6 },
  131. rules: [],
  132. },
  133. {
  134. label: '风险分析',
  135. field: 'alarmLevel',
  136. component: 'Select',
  137. componentProps: {
  138. options: RISK_ANALYSIS_OPTIONS,
  139. placeholder: '请选择风险等级',
  140. allowClear: true,
  141. },
  142. colProps: { span: 6 },
  143. },
  144. ],
  145. showAdvancedButton: false,
  146. schemaGroupNames: ['常规查询'],
  147. },
  148. pagination: true,
  149. striped: true,
  150. useSearchForm: true,
  151. bordered: true,
  152. showIndexColumn: false,
  153. actionColumn: {
  154. width: 80,
  155. title: '操作',
  156. dataIndex: 'action',
  157. slots: { customRender: 'action' },
  158. fixed: undefined,
  159. },
  160. },
  161. exportConfig: {
  162. url: '/ventanaly-province/province/alarm/exportProvinceAlarmReal',
  163. name: '内外压差变化风险分析',
  164. params: {
  165. alarmType: 'sourcePressureAlarm',
  166. },
  167. },
  168. });
  169. const [registerRealtimeTable] = ctxRealtime;
  170. const { goafOptions, goafId, hiscode, resolveValue, registerModal, openModal, initGoafOptions, handleResolve } = useInitForm();
  171. // 注册历史数据表格
  172. const { tableContext, onExportXls } = useListPage({
  173. tableProps: {
  174. immediate: false,
  175. columns,
  176. // columns: historyColumns,
  177. api: async (params) => {
  178. await initGoafOptions(params.deptId);
  179. if (!goafId.value) {
  180. return Promise.resolve([]);
  181. }
  182. params.goafId = goafId.value;
  183. return getProvinceAlarmHistory(params);
  184. },
  185. formConfig: {
  186. autoSearch: true,
  187. model: { deptId: hiscode },
  188. labelWidth: 120,
  189. schemas: [
  190. // {
  191. // label: '开始时间',
  192. // field: 'startTime',
  193. // component: 'DatePicker',
  194. // defaultValue: dayjs().add(-30, 'day').format('YYYY-MM-DD HH:mm:ss'),
  195. // componentProps: {
  196. // showTime: true,
  197. // placeholder: '请选择开始时间',
  198. // valueFormat: 'YYYY-MM-DD HH:mm:ss',
  199. // },
  200. // colProps: { span: 6 },
  201. // rules: [{ required: true, message: '请选择开始时间' }],
  202. // },
  203. // {
  204. // label: '结束时间',
  205. // field: 'endTime',
  206. // component: 'DatePicker',
  207. // defaultValue: dayjs(),
  208. // componentProps: {
  209. // showTime: true,
  210. // placeholder: '请选择结束时间',
  211. // valueFormat: 'YYYY-MM-DD HH:mm:ss',
  212. // },
  213. // colProps: { span: 6 },
  214. // rules: [{ required: true, message: '请选择结束时间' }],
  215. // },
  216. {
  217. label: '煤矿名称',
  218. field: 'deptId',
  219. component: 'MineCascader', // 自定义组件名
  220. componentProps: {
  221. initFromStore: false,
  222. syncToStore: false,
  223. changeOnSelect: false,
  224. // onChange: (e) => {
  225. // historyTable.setLoading(true);
  226. // initGoafOptions(e).finally(() => {
  227. // historyTable.setLoading(false);
  228. // });
  229. // },
  230. },
  231. colProps: { span: 6 },
  232. rules: [],
  233. },
  234. ...historicalFormSchema,
  235. {
  236. label: '风险分析',
  237. field: 'alarmLevel',
  238. component: 'Select',
  239. componentProps: {
  240. options: RISK_ANALYSIS_OPTIONS,
  241. placeholder: '请选择风险等级',
  242. allowClear: true,
  243. },
  244. colProps: { span: 6 },
  245. },
  246. ],
  247. showAdvancedButton: false,
  248. schemaGroupNames: ['常规查询'],
  249. },
  250. pagination: true,
  251. striped: true,
  252. useSearchForm: true,
  253. bordered: true,
  254. showIndexColumn: true,
  255. // showActionColumn: false,
  256. },
  257. exportConfig: {
  258. url: '/province/alarm/exportProvinceAlarmHistory',
  259. name: '历史数据',
  260. params: {
  261. alarmType: 'sourcePressureAlarm',
  262. goafId,
  263. },
  264. },
  265. });
  266. const [registerHistoryTable, historyTable] = tableContext;
  267. async function getAlarmTotalData(p) {
  268. const params = {
  269. ...p,
  270. alarmType: 'sourcePressureAlarm',
  271. };
  272. const result = await getProvinceAlarmNum(params);
  273. boardData.value[1].value = result.alarmLevel1;
  274. boardData.value[2].value = result.alarmLevel2;
  275. boardData.value[3].value = result.alarmLevel3;
  276. boardData.value[4].value = result.alarmLevel4;
  277. boardData.value[0].value = result.alarmLevel1 + result.alarmLevel2 + result.alarmLevel3 + result.alarmLevel4;
  278. }
  279. /**
  280. * 通用页面跳转方法
  281. * @param record 当前行数据
  282. * @param path 目标路径
  283. */
  284. function handleGoToPageQuery(record: any, path: string) {
  285. advancedRoutePush({
  286. path,
  287. query: { deptId: record.deptId, goafId: record.goafId, filter: 'sourcePressure' },
  288. });
  289. }
  290. </script>
  291. <style lang="less" scoped>
  292. @import url(../../common/board.less);
  293. </style>