downloadList.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <BasicTable @register="registerTable">
  3. <template #toolbar>
  4. <a-button type="primary" @click="exportExcel" v-if="getCheckPerm('download-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 { DownList,DownExport } from '/@/api/order'
  40. import { downloadByData, } from '/@/utils/file/download';
  41. import { usePermissionStore } from '/@/store/modules/permission';
  42. import { dowmColumns,equitySearchForm } from '../account/details/data'
  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 { createConfirm } = useMessage();
  56. const permissionStore = usePermissionStore();
  57. const { getCheckPerm } = permissionStore;
  58. const [registerTable] = useTable({
  59. api: DownList,
  60. title: '下载列表',
  61. // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
  62. columns: dowmColumns,
  63. useSearchForm: true,
  64. formConfig: equitySearchForm,
  65. showTableSetting: true,
  66. showIndexColumn:false,
  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. return T
  80. },
  81. fetchSetting: {
  82. pageField: 'pageNum',
  83. sizeField: 'pageSize',
  84. listField: 'list',
  85. totalField: 'total',
  86. },
  87. canResize: true,
  88. });
  89. function handleDelete(record: Recordable) {
  90. console.log('点击了删除', record);
  91. }
  92. function handleOpen(record: Recordable) {
  93. console.log('点击了启用', record);
  94. }
  95. function exportExcel() {
  96. createConfirm({
  97. iconType: 'warning',
  98. title: () => h('span', '温馨提示'),
  99. content: () => h('span', isSearch.value?'确认导出搜索结果?':'确认导出全部?'),
  100. onOk: async () => {
  101. DownExport()
  102. },
  103. });
  104. }
  105. return {
  106. registerTable,
  107. handleDelete,
  108. handleOpen,
  109. exportExcel,
  110. getCheckPerm,
  111. };
  112. },
  113. });
  114. </script>