index.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!-- 结算管理-分润付款确认 -->
  2. <template>
  3. <app-view>
  4. <template #header>
  5. <app-filter :options="filterOptons" />
  6. </template>
  7. <app-table :data="dataList" showIndex :columns="tableColumns" :loading="loading">
  8. <template #footer>
  9. <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex"
  10. @change="onSearch" />
  11. </template>
  12. </app-table>
  13. <component :is="componentMap.get(componentId)" v-bind="{ record, queryParams }" @closed="closeComponent"
  14. v-if="componentId" />
  15. </app-view>
  16. </template>
  17. <script lang="ts" setup>
  18. import { shallowRef } from 'vue'
  19. import { ElMessage } from 'element-plus'
  20. import { useRequest } from '@/hooks/request'
  21. import { useDataFilter } from '@/hooks/datatable'
  22. import { sharedayquery } from '@/services/api/settlement'
  23. import { useOperation } from '@/hooks/operation'
  24. import AppTable from '@pc/components/base/table/index.vue'
  25. import AppFilter from '@pc/components/base/table-filter/index.vue'
  26. import AppPagination from '@pc/components/base/pagination/index.vue'
  27. const queryParams = shallowRef<Model.ShareDayQueryReq>()
  28. const { filterOptons, getQueryParams } = useDataFilter<Model.ShareDayQueryReq>()
  29. const { componentMap, componentId, record, closeComponent } = useOperation<Model.ShareDayQueryReq>({
  30. onClose: () => onSearch()
  31. })
  32. const { dataList, total, pageSize, pageIndex, loading, run } = useRequest(sharedayquery, {
  33. params: {
  34. pageNum: 1,
  35. pageSize: 20,
  36. },
  37. onError: (err) => {
  38. ElMessage.error(err)
  39. }
  40. })
  41. const tableColumns = shallowRef<Model.TableColumn[]>([
  42. { field: 'tradedate', label: '交易日' },
  43. { field: 'totalcount', label: '总笔数 ' },
  44. { field: 'divideamount', label: '总分润金额 ' },
  45. { field: 'totalpay', label: '总已付 ' },
  46. { field: 'operate', label: '操作' }
  47. ])
  48. filterOptons.buttonList = [
  49. { lable: '查询', className: 'el-button--primary', onClick: () => onSearch() },
  50. { lable: '重置', className: 'el-button--primary', onClick: () => onSearch(true) }
  51. ]
  52. // 处理请求参数
  53. const processRequiredParams = (callback: (params: Model.ShareDayQueryReq) => void, clear = false) => {
  54. const qs = getQueryParams(clear)
  55. queryParams.value = qs
  56. callback(qs)
  57. }
  58. const onSearch = (clear = false) => {
  59. processRequiredParams((qs) => run(qs), clear)
  60. }
  61. </script>