accountList.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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, nextTick } 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 = ref({
  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 = [
  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. search.value = payload
  60. nextTick(() => {
  61. tableRef.value?.refreshTable?.()
  62. })
  63. }
  64. const handleReset = (params: any) => {
  65. search.value = {
  66. ...params,
  67. platform: 'MT4',
  68. }
  69. nextTick(() => {
  70. tableRef.value?.refreshTable?.()
  71. })
  72. }
  73. // 表格列配置
  74. const columns = ref([
  75. {
  76. prop: 'login',
  77. label: t('Label.Login'),
  78. align: 'center',
  79. },
  80. {
  81. prop: 'name',
  82. label: t('Ib.Custom.NameLabel'),
  83. align: 'center',
  84. },
  85. {
  86. prop: 'platform',
  87. label: t('Label.Platform'),
  88. align: 'center',
  89. },
  90. {
  91. prop: 'groupName',
  92. label: t('Label.GroupName'),
  93. align: 'center',
  94. },
  95. {
  96. prop: 'type',
  97. type: 'tag',
  98. label: t('Label.LoginType'),
  99. align: 'center',
  100. tagMap: {
  101. 1: t('AccountType.ClassicAccount'),
  102. 2: t('AccountType.SeniorAccount'),
  103. 5: t('AccountType.SpeedAccount'),
  104. 6: t('AccountType.SpeedAccount'),
  105. 7: t('AccountType.StandardAccount'),
  106. 8: t('AccountType.CentAccount'),
  107. },
  108. },
  109. {
  110. prop: 'Leverage',
  111. label: t('Label.Leverage'),
  112. align: 'center',
  113. formatter: ({ row }) => row.leverage ? `1:${row.leverage}` : '--',
  114. },
  115. {
  116. prop: 'currency',
  117. label: t('Label.Currency'),
  118. align: 'center',
  119. },
  120. {
  121. prop: 'balance',
  122. label: t('Label.LoginBalance'),
  123. align: 'center',
  124. formatter: ({ row }) => numberFormat(row.balance ?? 0),
  125. },
  126. {
  127. prop: 'countryEnName',
  128. label: t('Label.Country'),
  129. align: 'center',
  130. },
  131. {
  132. prop: 'registration',
  133. label: t('Label.ApplyTime'),
  134. align: 'center',
  135. },
  136. ])
  137. const mobilePrimaryFields = ref([
  138. {
  139. prop: 'login',
  140. label: t('Label.Login'),
  141. align: 'center',
  142. },
  143. {
  144. prop: 'name',
  145. label: t('Ib.Custom.NameLabel'),
  146. align: 'center',
  147. },
  148. {
  149. prop: 'platform',
  150. label: t('Label.Platform'),
  151. align: 'center',
  152. },
  153. {
  154. prop: 'more',
  155. type: 'more',
  156. width: 20,
  157. align: 'right',
  158. },
  159. ])
  160. const listApi = ref(ibApi.accountSubs)
  161. </script>
  162. <style lang="scss" scoped>
  163. @import "@/uni.scss";
  164. .search-content {
  165. display: flex;
  166. justify-content: space-between;
  167. }
  168. </style>