accountList.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Home.page_ib.item10')" />
  4. <view class="account-content">
  5. <view class="search-content">
  6. <view class="search-bar">
  7. <cwg-complex-search :fields="filterFields" v-model="searchParams" @search="handleSearch" @reset="handleReset" />
  8. </view>
  9. </view>
  10. <cwg-tabel
  11. ref="tableRef"
  12. :columns="columns"
  13. :mobilePrimaryFields="mobilePrimaryFields"
  14. :queryParams="search"
  15. :api="listApi"
  16. :show-operation="true"
  17. :showPagination="true"
  18. >
  19. <template #action="{ row }">
  20. <cwg-dropdown :menu-list="menuList(row)" @menuClick="handleMenuClick">
  21. <view class="pc-header-btn">
  22. <cwg-icon name="crm-ellipsis" :size="24" />
  23. </view>
  24. </cwg-dropdown>
  25. </template>
  26. </cwg-tabel>
  27. </view>
  28. </cwg-page-wrapper>
  29. </template>
  30. <script setup lang="ts">
  31. // 账户管理
  32. import { ref,reactive, nextTick,computed } from 'vue'
  33. import { useI18n } from 'vue-i18n'
  34. import { ibApi } from '@/service/ib'
  35. import { useFilters } from '@/composables/useFilters'
  36. const { numberFormat } = useFilters()
  37. const { t } = useI18n()
  38. const searchParams = ref({})
  39. const search = reactive({
  40. cId: '',
  41. login: '',
  42. platform: 'MT4',
  43. startDate: '',
  44. endDate: '',
  45. })
  46. const platformOptions = [
  47. { text: 'MT4', value: 'MT4' },
  48. { text: 'MT5', value: 'MT5' },
  49. ]
  50. const filterFields =computed(()=> [
  51. { key: 'platform', type: 'select', label: t('Label.Platform'), placeholder: t('placeholder.choose'), options: platformOptions, defaultValue: 'MT4', isSelect: true },
  52. { key: 'login', type: 'input', label: t('Label.Login'), placeholder: t('Label.Login'), defaultValue: '' },
  53. { key: 'cId', type: 'input', label: 'CID', placeholder: 'CID', defaultValue: '' },
  54. { key: 'date', label: t('placeholder.Start') + ' - ' + t('placeholder.End'), type: 'daterange' },
  55. ])
  56. const tableRef = ref<any>(null)
  57. const handleSearch = (params: any) => {
  58. const payload = { ...params }
  59. Object.assign(search, payload)
  60. nextTick(() => {
  61. tableRef.value?.refreshTable?.()
  62. })
  63. }
  64. const handleReset = (params: any) => {
  65. Object.assign(search, params,{platform: 'MT4'})
  66. nextTick(() => {
  67. tableRef.value?.refreshTable?.()
  68. })
  69. }
  70. // 表格列配置
  71. const columns = computed(()=>[
  72. {
  73. prop: 'login',
  74. label: t('Label.Login'),
  75. align: 'center',
  76. },
  77. {
  78. prop: 'name',
  79. label: t('Ib.Custom.NameLabel'),
  80. align: 'center',
  81. },
  82. {
  83. prop: 'platform',
  84. label: t('Label.Platform'),
  85. align: 'center',
  86. },
  87. {
  88. prop: 'groupName',
  89. label: t('Label.GroupName'),
  90. align: 'center',
  91. },
  92. {
  93. prop: 'type',
  94. type: 'tag',
  95. label: t('Label.LoginType'),
  96. align: 'center',
  97. tagMap: {
  98. 1: t('AccountType.ClassicAccount'),
  99. 2: t('AccountType.SeniorAccount'),
  100. 5: t('AccountType.SpeedAccount'),
  101. 6: t('AccountType.SpeedAccount'),
  102. 7: t('AccountType.StandardAccount'),
  103. 8: t('AccountType.CentAccount'),
  104. },
  105. },
  106. {
  107. prop: 'Leverage',
  108. label: t('Label.Leverage'),
  109. align: 'center',
  110. formatter: ({ row }) => row.leverage ? `1:${row.leverage}` : '--',
  111. },
  112. {
  113. prop: 'currency',
  114. label: t('Label.Currency'),
  115. align: 'center',
  116. },
  117. {
  118. prop: 'balance',
  119. label: t('Label.LoginBalance'),
  120. align: 'center',
  121. formatter: ({ row }) => numberFormat(row.balance ?? 0),
  122. },
  123. {
  124. prop: 'countryEnName',
  125. label: t('Label.Country'),
  126. align: 'center',
  127. },
  128. {
  129. prop: 'registration',
  130. label: t('Label.ApplyTime'),
  131. align: 'center',
  132. },
  133. ])
  134. const mobilePrimaryFields = computed(()=>[
  135. {
  136. prop: 'login',
  137. label: t('Label.Login'),
  138. align: 'center',
  139. },
  140. {
  141. prop: 'name',
  142. label: t('Ib.Custom.NameLabel'),
  143. align: 'center',
  144. },
  145. {
  146. prop: 'platform',
  147. label: t('Label.Platform'),
  148. align: 'center',
  149. },
  150. {
  151. prop: 'more',
  152. type: 'more',
  153. width: 20,
  154. align: 'right',
  155. },
  156. ])
  157. const listApi = ref(ibApi.accountSubs)
  158. </script>
  159. <style lang="scss" scoped>
  160. @import "@/uni.scss";
  161. .search-content {
  162. display: flex;
  163. justify-content: space-between;
  164. }
  165. </style>