MonitorTable1.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div class="monitor-table">
  3. <!-- <BasicTable @register="registerTable" :rowSelection="rowSelection">
  4. <template #action="{ record }">
  5. <TableAction :actions="getActions(record)" :dropDownActions="getDropDownAction(record)" />
  6. </template>
  7. </BasicTable> -->
  8. <!-- <a-table :row-selection="rowSelection" :columns="columns.value" :data-source="dataTableSource" row-key="dataIndex">
  9. <template #name="{ text }">
  10. <a>{{ text }}</a>
  11. </template>
  12. </a-table> -->
  13. </div>
  14. </template>
  15. <script lang="ts" name="system-user" setup>
  16. //ts语法
  17. import { computed } from '@vue/reactivity';
  18. import { debug } from 'console';
  19. import { defineExpose, toRaw, watch, ref } from 'vue';
  20. import { BasicColumn } from '/@/components/Table';
  21. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  22. const props = defineProps({
  23. columnsType: {
  24. type: String,
  25. required: true,
  26. },
  27. dataSource: {
  28. type: Array,
  29. required: true,
  30. },
  31. searchFormSchema: {
  32. type: Array,
  33. default: () => [],
  34. },
  35. list: {
  36. type: Function,
  37. // required: true,
  38. },
  39. designScope: {
  40. type: String,
  41. },
  42. title: {
  43. type: String,
  44. },
  45. });
  46. const dataTableSource = ref([]);
  47. watch(
  48. () => props.dataSource,
  49. (newVal) => {
  50. const list = [];
  51. newVal.forEach((item) => {
  52. list.push(toRaw(item));
  53. });
  54. dataTableSource.value = list;
  55. }
  56. );
  57. const columns = getTableHeaderColumns(props.columnsType);
  58. /**
  59. * 操作列定义
  60. * @param record
  61. */
  62. function getActions(record) {
  63. return [
  64. {
  65. label: '详情',
  66. onClick: openDetail.bind(null, record),
  67. },
  68. ];
  69. }
  70. const rowSelection = {
  71. onChange: (selectedRowKeys: [], selectedRows: BasicColumn[]) => {
  72. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
  73. },
  74. // getCheckboxProps: (record: BasicColumn) => ({
  75. // disabled: record.name === 'Disabled User', // Column configuration not to be checked
  76. // name: record.name,
  77. // }),
  78. };
  79. function openDetail(record) {
  80. record;
  81. }
  82. </script>
  83. <style scoped lang="less">
  84. @ventSpace: zxm;
  85. :deep(.@{ventSpace}-table-body) {
  86. height: auto !important;
  87. }
  88. .monitor-table {
  89. width: 100%;
  90. }
  91. </style>