index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <BasicTable @register="registerTable">
  4. <template #action="{ record }">
  5. <button @click="handleGoToPage(record, `/sealed/${record.areaId}`)" class="action-btn">
  6. <SvgIcon name="data" />
  7. </button>
  8. <button @click="handleGoToPage(record, '/basicInfo/accessStatistics')" class="action-btn">
  9. <SvgIcon name="info" />
  10. </button>
  11. <button @click="handleGoToPage(record, '/warningAnalysis/connectAnalysis')" class="action-btn">
  12. <SvgIcon name="chart" />
  13. </button>
  14. </template>
  15. </BasicTable>
  16. </template>
  17. <script setup lang="ts">
  18. import { useRouter } from 'vue-router';
  19. import { BasicTable, useTable } from '/@/components/Table';
  20. import { columns, searchFormSchema } from './minesInfo.data';
  21. import { SvgIcon } from '/@/components/Icon';
  22. import { getMineData } from '../basicInfo.api';
  23. // 路由实例
  24. const router = useRouter();
  25. // 注册表格并获取相关方法
  26. const [registerTable] = useTable({
  27. title: '矿山信息表格',
  28. api: getMineData, // 数据统计接口
  29. columns,
  30. formConfig: {
  31. labelWidth: 120,
  32. schemas: searchFormSchema,
  33. showAdvancedButton: false,
  34. schemaGroupNames: ['常规查询'],
  35. },
  36. pagination: true,
  37. useSearchForm: true,
  38. // showTableSetting: true,
  39. bordered: true,
  40. showIndexColumn: false,
  41. scroll: { x: 'max-content' },
  42. // canResize: false,
  43. actionColumn: {
  44. width: 180,
  45. title: '操作',
  46. dataIndex: 'action',
  47. slots: { customRender: 'action' },
  48. },
  49. });
  50. /**
  51. * 通用页面跳转方法
  52. * @param record 当前行数据
  53. * @param path 目标路径
  54. */
  55. function handleGoToPage(record: any, path: string) {
  56. // 跳转时携带当前煤矿的编号作为参数(根据实际需求调整携带的参数)
  57. router.push({
  58. path,
  59. // query: {
  60. // orderNo: record.orderNo, // 煤矿编号
  61. // mineName: record.mineName // 煤矿名称
  62. // }
  63. });
  64. }
  65. </script>
  66. <style lang="less" scoped></style>