giveList.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div>
  3. <BasicTable @register="registerTimeTable">
  4. <template #action="{ record }">
  5. <TableAction
  6. :actions="[
  7. {
  8. label: record.sceneCount || '-',
  9. onClick: handleCreate.bind(null, record),
  10. },
  11. ]"
  12. />
  13. </template>
  14. </BasicTable>
  15. <sceneListModal @register="register" />
  16. </div>
  17. </template>
  18. <script lang="ts">
  19. import { defineComponent } from 'vue';
  20. import { BasicTable, useTable, FormProps, TableAction } from '/@/components/Table';
  21. import { userShareList } from '/@/api/account';
  22. import { userListSchema } from './data';
  23. import { useI18n } from '/@/hooks/web/useI18n';
  24. import { usePermissionStore } from '/@/store/modules/permission';
  25. import sceneListModal from './sceneListModal.vue';
  26. import { useModal } from '/@/components/Modal';
  27. export default defineComponent({
  28. components: {
  29. BasicTable,
  30. sceneListModal,
  31. TableAction,
  32. },
  33. setup() {
  34. const { t } = useI18n();
  35. const permissionStore = usePermissionStore();
  36. const [register, { openModal }] = useModal();
  37. const { getCheckPerm } = permissionStore;
  38. const searchForm: Partial<FormProps> = {
  39. labelWidth: 100,
  40. schemas: [
  41. {
  42. field: 'ryNickName',
  43. label: '姓名',
  44. component: 'Input',
  45. componentProps: {
  46. maxLength: 100,
  47. },
  48. colProps: {
  49. xl: 6,
  50. xxl: 6,
  51. },
  52. },
  53. {
  54. field: 'ryNo',
  55. label: '人员编号',
  56. component: 'Input',
  57. componentProps: {
  58. maxLength: 100,
  59. },
  60. colProps: {
  61. xl: 8,
  62. xxl: 8,
  63. },
  64. },
  65. ],
  66. };
  67. const [registerTimeTable, { reload }] = useTable({
  68. api: userShareList,
  69. columns: userListSchema,
  70. useSearchForm: true,
  71. formConfig: searchForm,
  72. showTableSetting: true,
  73. showIndexColumn: false,
  74. searchInfo: { type: 1 },
  75. rowKey: 'id',
  76. fetchSetting: {
  77. pageField: 'pageNum',
  78. sizeField: 'pageSize',
  79. listField: 'list',
  80. totalField: 'total',
  81. },
  82. actionColumn: {
  83. width: 100,
  84. title: '场景',
  85. dataIndex: 'action',
  86. slots: { customRender: 'action' },
  87. },
  88. canResize: true,
  89. });
  90. function handleCreate(record) {
  91. openModal(true, record);
  92. }
  93. function tabChange(val: string) {
  94. console.log('tabChange', val);
  95. reload();
  96. }
  97. function handleOpen(record) {
  98. console.log('点击了启用', record);
  99. }
  100. return {
  101. registerTimeTable,
  102. handleOpen,
  103. tabChange,
  104. reload,
  105. register,
  106. getCheckPerm,
  107. handleCreate,
  108. t,
  109. };
  110. },
  111. });
  112. </script>
  113. <style lang="less" scoped>
  114. .desc-wrap-BasicTable {
  115. background-color: #f0f2f5;
  116. .vben-basic-table-form-container {
  117. padding: 0;
  118. }
  119. }
  120. </style>