index.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <ContentWrap>
  3. <!-- 列表 -->
  4. <XTable @register="registerTable">
  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="exportList('退款订单.xls')"
  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. </XTable>
  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 { useI18n } from '@/hooks/web/useI18n'
  37. import { useXTable } from '@/hooks/web/useXTable'
  38. import { allSchemas } from './refund.data'
  39. import * as RefundApi from '@/api/pay/refund'
  40. const { t } = useI18n() // 国际化
  41. // 列表相关的变量
  42. const [registerTable, { exportList }] = useXTable({
  43. allSchemas: allSchemas,
  44. getListApi: RefundApi.getRefundPageApi,
  45. exportListApi: RefundApi.exportRefundApi
  46. })
  47. // ========== CRUD 相关 ==========
  48. const dialogVisible = ref(false) // 是否显示弹出层
  49. const detailData = ref() // 详情 Ref
  50. // 详情操作
  51. const handleDetail = async (rowId: number) => {
  52. // 设置数据
  53. detailData.value = RefundApi.getRefundApi(rowId)
  54. dialogVisible.value = true
  55. }
  56. </script>