equityList.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <BasicTable @register="registerTable">
  3. <template #toolbar>
  4. <a-button type="primary" @click="exportExcel" v-if="getCheckPerm('rights-order-export')"> 导出</a-button>
  5. </template>
  6. <template #bodyCell="{ column, record }">
  7. <template v-if="column.key === 'action'">
  8. <TableAction
  9. stopButtonPropagation
  10. :actions="[
  11. {
  12. label: '删除',
  13. //icon: 'ic:outline-delete-outline',
  14. onClick: handleDelete.bind(null, record),
  15. },
  16. ]"
  17. :dropDownActions="[
  18. {
  19. label: '启用',
  20. popConfirm: {
  21. title: '是否启用?',
  22. confirm: handleOpen.bind(null, record),
  23. },
  24. },
  25. ]"
  26. />
  27. </template>
  28. </template>
  29. </BasicTable>
  30. </template>
  31. <script lang="ts">
  32. import { defineComponent, h, ref } from 'vue';
  33. import { BasicTable, useTable, TableAction, BasicColumn, TableImg, FormProps } from '/@/components/Table';
  34. import { PageWrapper } from '/@/components/Page';
  35. import { Time } from '/@/components/Time';
  36. import { Descriptions } from 'ant-design-vue';
  37. import { useI18n } from '/@/hooks/web/useI18n';
  38. import { useMessage } from '/@/hooks/web/useMessage';
  39. import { equityColumns,equitySearchForm } from '../account/details/data'
  40. import { downloadByData, } from '/@/utils/file/download';
  41. import { IncrementList,IncrementExport } from '/@/api/order'
  42. import { usePermissionStore } from '/@/store/modules/permission';
  43. export default defineComponent({
  44. components: {
  45. BasicTable,
  46. TableAction,
  47. PageWrapper,
  48. TableImg,
  49. [Descriptions.name]: Descriptions,
  50. [Descriptions.Item.name]: Descriptions.Item,
  51. },
  52. setup() {
  53. const { t } = useI18n();
  54. const isSearch = ref(false)
  55. const { createMessage,createConfirm } = useMessage();
  56. const permissionStore = usePermissionStore();
  57. const { getCheckPerm } = permissionStore;
  58. const [registerTable] = useTable({
  59. api: IncrementList,
  60. title: '权益列表',
  61. // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
  62. columns: equityColumns,
  63. useSearchForm: true,
  64. showIndexColumn:false,
  65. formConfig: equitySearchForm,
  66. showTableSetting: true,
  67. rowKey: 'id',
  68. beforeFetch:(T)=>{
  69. const {ctivated,tradeNum,userName,orderSn} = T
  70. if(ctivated||tradeNum||userName||orderSn){
  71. isSearch.value = true
  72. }else{
  73. isSearch.value = false
  74. }
  75. if(T.ctivated){
  76. T.startTime = T.ctivated[0]
  77. T.endTime = T.ctivated[1]
  78. }
  79. console.log('beforeFetch',T)
  80. return T
  81. },
  82. fetchSetting: {
  83. pageField: 'pageNum',
  84. sizeField: 'pageSize',
  85. listField: 'list',
  86. totalField: 'total',
  87. },
  88. canResize: true,
  89. });
  90. function handleDelete(record: Recordable) {
  91. console.log('点击了删除', record);
  92. }
  93. function handleOpen(record: Recordable) {
  94. console.log('点击了启用', record);
  95. }
  96. function exportExcel() {
  97. createConfirm({
  98. iconType: 'warning',
  99. title: () => h('span', '温馨提示'),
  100. content: () => h('span', isSearch.value?'确认导出搜索结果?':'确认导出全部?'),
  101. onOk: async () => {
  102. IncrementExport()
  103. },
  104. });
  105. }
  106. return {
  107. registerTable,
  108. handleDelete,
  109. handleOpen,
  110. exportExcel,
  111. getCheckPerm,
  112. };
  113. },
  114. });
  115. </script>