SysAuthAccessSecretListView.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="full-height page-container">
  3. <SmartTable @register="registerTable" :size="getTableSize">
  4. <template #table-operation="{ row }">
  5. <SmartVxeTableAction :actions="getActions(row)" />
  6. </template>
  7. </SmartTable>
  8. </div>
  9. </template>
  10. <script lang="ts" setup>
  11. import { useI18n } from '@/hooks/web/useI18n';
  12. import { useSizeSetting } from '@/hooks/setting/UseSizeSetting';
  13. import {
  14. ActionItem,
  15. SmartTable,
  16. SmartVxeTableAction,
  17. useSmartTable,
  18. } from '@/components/SmartTable';
  19. import {
  20. getTableColumns,
  21. getFormSchemas,
  22. getSearchFormSchemas,
  23. } from './SysAuthAccessSecretListView.config';
  24. import { listApi, deleteApi, getByIdApi, saveUpdateApi } from './SysAuthAccessSecretListView.api';
  25. const { t } = useI18n();
  26. const { getTableSize } = useSizeSetting();
  27. const getActions = (row: Recordable): ActionItem[] => {
  28. return [
  29. {
  30. label: t('common.button.edit'),
  31. onClick: () => editByRowModal(row),
  32. },
  33. ];
  34. };
  35. const [registerTable, { editByRowModal }] = useSmartTable({
  36. id: 'smart-system-tool-accessSecret',
  37. customConfig: { storage: true },
  38. columns: getTableColumns(),
  39. height: 'auto',
  40. border: true,
  41. sortConfig: {
  42. remote: true,
  43. },
  44. rowConfig: {
  45. isHover: true,
  46. },
  47. showOverflow: 'tooltip',
  48. pagerConfig: true,
  49. useSearchForm: true,
  50. searchFormConfig: {
  51. schemas: getSearchFormSchemas(t),
  52. searchWithSymbol: true,
  53. colon: true,
  54. layout: 'inline',
  55. actionColOptions: {
  56. span: undefined,
  57. },
  58. compact: true,
  59. },
  60. addEditConfig: {
  61. formConfig: {
  62. schemas: getFormSchemas(t),
  63. colon: true,
  64. baseColProps: { span: 24 },
  65. labelCol: { span: 6 },
  66. wrapperCol: { span: 17 },
  67. },
  68. },
  69. proxyConfig: {
  70. ajax: {
  71. query: (params) => listApi(params.ajaxParameter),
  72. save: ({ body: { insertRecords, updateRecords } }) =>
  73. saveUpdateApi([...insertRecords, ...updateRecords]),
  74. delete: ({ body: { removeRecords } }) => deleteApi(removeRecords),
  75. getById: (params) => getByIdApi(params.id),
  76. },
  77. },
  78. toolbarConfig: {
  79. zoom: true,
  80. refresh: true,
  81. column: { columnOrder: true },
  82. buttons: [
  83. {
  84. code: 'ModalAdd',
  85. },
  86. {
  87. code: 'delete',
  88. },
  89. ],
  90. },
  91. });
  92. </script>