index.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <div class="p-4">
  4. <BasicTable @register="registerTable" :scroll="{ x: 'fit-content' }">
  5. <template #action="{ record }">
  6. <button @click="handleGoToPage(record, `/sealed/${record.code}`)" class="action-btn" title="老空区永久密闭监测数据">
  7. <SvgIcon name="database" />
  8. </button>
  9. </template>
  10. </BasicTable>
  11. </div>
  12. </template>
  13. <script setup lang="ts">
  14. import { BasicTable, useTable } from '/@/components/Table';
  15. import { dataColumns } from './closed.data';
  16. import { getClosedAccessCount } from '../basicInfo.api';
  17. import { SvgIcon } from '/@/components/Icon';
  18. import { useMineDepartmentStore } from '/@/store/modules/mine';
  19. import { ref, watch } from 'vue';
  20. import { advancedRoutePush } from '/@/utils';
  21. // 路由实例
  22. const mineStore = useMineDepartmentStore();
  23. const deptId = ref();
  24. // 注册表格并获取相关方法
  25. const [registerTable, { reload, setLoading }] = useTable({
  26. title: '老空区永久密闭统计',
  27. api: () => {
  28. setLoading(true);
  29. return getClosedAccessCount({ deptId: deptId.value }).finally(() => {
  30. setLoading(false);
  31. });
  32. }, // 数据统计接口
  33. columns: dataColumns,
  34. pagination: false,
  35. useSearchForm: false,
  36. // showTableSetting: true,
  37. bordered: true,
  38. showIndexColumn: false,
  39. // canResize: false,
  40. actionColumn: {
  41. width: 80,
  42. title: '操作',
  43. dataIndex: 'action',
  44. slots: { customRender: 'action' },
  45. },
  46. });
  47. /**
  48. * 通用页面跳转方法
  49. * @param record 当前行数据
  50. * @param path 目标路径
  51. */
  52. function handleGoToPage(record: any, path: string) {
  53. // 跳转时携带当前煤矿的编号作为参数(根据实际需求调整携带的参数)
  54. advancedRoutePush({
  55. path,
  56. // query: {
  57. // orderNo: record.orderNo, // 煤矿编号
  58. // mineName: record.mineName // 煤矿名称
  59. // }
  60. });
  61. }
  62. watch(
  63. () => mineStore.getDepartId,
  64. (v) => {
  65. deptId.value = v || mineStore.getRootId;
  66. reload();
  67. },
  68. {
  69. immediate: true,
  70. }
  71. );
  72. </script>
  73. <style lang="less" scoped>
  74. .action-btn {
  75. cursor: pointer;
  76. margin-right: 10px;
  77. &:last-child {
  78. margin-right: 0;
  79. }
  80. }
  81. </style>