index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <script lang="ts" setup>
  2. import type { VbenFormProps } from '@vben/common-ui';
  3. import type { VxeGridProps } from '#/adapter/vxe-table';
  4. import { Page, useVbenModal } from '@vben/common-ui';
  5. import { MdiDetail, MdiEdit } from '@vben/icons';
  6. import { useVbenVxeGrid } from '#/adapter/vxe-table';
  7. import { getSubsidyApplicationsListApi } from '#/api/subsidyapplications';
  8. import { $t } from '#/locales';
  9. import SubsidyApplicationsForm from './form.vue';
  10. const formOptions: VbenFormProps = {
  11. // 默认展开
  12. collapsed: true,
  13. // 控制表单是否显示折叠按钮
  14. showCollapseButton: true,
  15. // 按下回车时是否提交表单
  16. submitOnEnter: true,
  17. schema: [
  18. {
  19. component: 'Input',
  20. fieldName: 'subsidyapplicationsmerchantid',
  21. label: '渠道商ID',
  22. componentProps: {
  23. placeholder: $t('ui.placeholder.input'),
  24. allowClear: true,
  25. },
  26. },
  27. ],
  28. wrapperClass: 'grid-cols-1 md:grid-cols-3 lg:grid-cols-5',
  29. };
  30. const gridOptions: VxeGridProps<any> = {
  31. toolbarConfig: {
  32. custom: true,
  33. export: true,
  34. // import: true,
  35. refresh: true,
  36. zoom: true,
  37. },
  38. height: 'auto',
  39. exportConfig: {},
  40. pagerConfig: {},
  41. rowConfig: {
  42. isHover: true,
  43. },
  44. stripe: true,
  45. proxyConfig: {
  46. response: {
  47. result: 'Data',
  48. total: 'Total',
  49. },
  50. ajax: {
  51. query: async ({ page }, formValues) => {
  52. return await getSubsidyApplicationsListApi({
  53. pageindex: page.currentPage,
  54. rows: page.pageSize,
  55. ...formValues,
  56. });
  57. },
  58. },
  59. },
  60. columns: [
  61. { title: '补贴申请ID', field: 'subsidyapplicationsid', sortable: true },
  62. {
  63. title: '渠道商ID',
  64. field: 'subsidyapplicationsmerchantid',
  65. sortable: true,
  66. },
  67. {
  68. title: '补贴金额',
  69. field: 'subsidyapplicationssubsidyamount',
  70. sortable: true,
  71. },
  72. {
  73. title: '审批状态',
  74. field: 'subsidyapplicationsapprovalstatus',
  75. sortable: true,
  76. },
  77. {
  78. title: '申请日期',
  79. field: 'subsidyapplicationsapplydate',
  80. sortable: true,
  81. },
  82. {
  83. title: '操作',
  84. field: 'action',
  85. fixed: 'right',
  86. slots: { default: 'action' },
  87. width: 140,
  88. },
  89. ],
  90. };
  91. const [Grid, gridApi] = useVbenVxeGrid({ gridOptions, formOptions });
  92. const [Modal, modalApi] = useVbenModal({
  93. fullscreenButton: false,
  94. closeOnClickModal: false,
  95. closeOnPressEscape: false,
  96. connectedComponent: SubsidyApplicationsForm,
  97. });
  98. /* 创建 */
  99. // function handleCreate() {
  100. // modalApi.setData({ formType: 'create' }).open();
  101. // }
  102. /* 编辑 */
  103. function handleEdit(row: any) {
  104. modalApi.setData({ formType: 'edit', row }).open();
  105. }
  106. /* 详情 */
  107. function handleDetail(row: any) {
  108. modalApi.setData({ formType: 'detail', row }).open();
  109. }
  110. function handleFinish() {
  111. gridApi.reload();
  112. }
  113. </script>
  114. <template>
  115. <Page auto-content-height>
  116. <Grid table-title="补贴申请列表">
  117. <!-- <template #toolbar-tools>
  118. <el-button type="primary" @click="handleCreate"> 新增 </el-button>
  119. </template> -->
  120. <template #action="{ row }">
  121. <el-button
  122. round
  123. @click="() => handleDetail(row)"
  124. :icon="MdiDetail"
  125. class="!p-2"
  126. />
  127. <el-button
  128. round
  129. @click="() => handleEdit(row)"
  130. :icon="MdiEdit"
  131. class="!p-2"
  132. />
  133. </template>
  134. </Grid>
  135. <Modal @finish="handleFinish" />
  136. </Page>
  137. </template>