index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <ContentWrap>
  3. <!-- 列表 -->
  4. <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
  5. <template #toolbar_buttons>
  6. <!-- 操作:导出 -->
  7. <XButton
  8. type="warning"
  9. preIcon="ep:download"
  10. :title="t('action.export')"
  11. v-hasPermi="['pay:refund:export']"
  12. @click="handleExport()"
  13. />
  14. </template>
  15. <template #actionbtns_default="{ row }">
  16. <!-- 操作:详情 -->
  17. <XTextButton
  18. preIcon="ep:view"
  19. :title="t('action.detail')"
  20. v-hasPermi="['pay:refund:query']"
  21. @click="handleDetail(row.id)"
  22. />
  23. </template>
  24. </vxe-grid>
  25. </ContentWrap>
  26. <XModal v-model="dialogVisible" :title="t('action.detail')">
  27. <!-- 对话框(详情) -->
  28. <Descriptions :schema="allSchemas.detailSchema" :data="detailData" />
  29. <!-- 操作按钮 -->
  30. <template #footer>
  31. <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
  32. </template>
  33. </XModal>
  34. </template>
  35. <script setup lang="ts" name="Refund">
  36. import { ref } from 'vue'
  37. import { useI18n } from '@/hooks/web/useI18n'
  38. import { useVxeGrid } from '@/hooks/web/useVxeGrid'
  39. import { VxeGridInstance } from 'vxe-table'
  40. import { allSchemas } from './refund.data'
  41. import * as RefundApi from '@/api/pay/refund'
  42. const { t } = useI18n() // 国际化
  43. // 列表相关的变量
  44. const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
  45. const { gridOptions, exportList } = useVxeGrid<RefundApi.RefundVO>({
  46. allSchemas: allSchemas,
  47. getListApi: RefundApi.getRefundPageApi,
  48. exportListApi: RefundApi.exportRefundApi
  49. })
  50. // 导出操作
  51. const handleExport = async () => {
  52. await exportList(xGrid, '退款订单.xls')
  53. }
  54. // ========== CRUD 相关 ==========
  55. const dialogVisible = ref(false) // 是否显示弹出层
  56. const detailData = ref() // 详情 Ref
  57. // 详情操作
  58. const handleDetail = async (rowId: number) => {
  59. // 设置数据
  60. detailData.value = RefundApi.getRefundApi(rowId)
  61. dialogVisible.value = true
  62. }
  63. </script>