complexReport.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Home.page_ib.item11')" />
  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. :showSummary="true"
  19. @sort-change="handleSortChange"
  20. >
  21. <template #action="{ row }">
  22. <cwg-dropdown :menu-list="menuList(row)" @menuClick="handleMenuClick">
  23. <view class="pc-header-btn">
  24. <cwg-icon name="crm-ellipsis" :size="24" />
  25. </view>
  26. </cwg-dropdown>
  27. </template>
  28. </cwg-tabel>
  29. </view>
  30. </cwg-page-wrapper>
  31. </template>
  32. <script setup lang="ts">
  33. // 账户管理
  34. import { ref, nextTick, computed, reactive } from 'vue'
  35. import { useI18n } from 'vue-i18n'
  36. import { ibApi } from '@/service/ib'
  37. import { useFilters } from '@/composables/useFilters'
  38. const { numberDecimal } = useFilters()
  39. const { t } = useI18n()
  40. const searchParams = ref({})
  41. const search = reactive({
  42. cId: '',
  43. customName: '',
  44. login: '',
  45. groupType: 0,
  46. platform: null,
  47. date: null
  48. })
  49. const listApi = ref(ibApi.ComplexReport)
  50. const tableRef = ref<any>(null)
  51. const platformOptions = [
  52. { text: 'MT4', value: 'MT4' },
  53. { text: 'MT5', value: 'MT5' },
  54. ]
  55. const filterFields = computed(() => [
  56. { key: 'platform', type: 'select', label: t('Label.Platform'), placeholder: t('placeholder.choose'), options: platformOptions,defaultValue: null, clearable: true },
  57. { key: 'cId', type: 'input', label: t('Label.CidAccount'), placeholder: t('Label.CidAccount'), defaultValue: '' },
  58. { key: 'customName', type: 'input', label: t('Documentary.Report.item19'), placeholder: t('Documentary.Report.item19'), defaultValue: '' },
  59. { key: 'login', type: 'input', label: t('Label.TradingAccount'), placeholder: t('Label.TradingAccount'), defaultValue: '' },
  60. {
  61. key: 'groupType',
  62. type: 'select',
  63. label: t('Documentary.Report.item20'),
  64. placeholder: t('Documentary.Report.item20'),
  65. options: [
  66. { text: t('State.All'), value: 0 },
  67. { text: t('AccountType.SeniorAccount'), value: 2 },
  68. // { text: t('AccountType.NewSpeedAccount'), value: 6 },
  69. { text: t('AccountType.StandardAccount'), value: 7 },
  70. { text: t('AccountType.CentAccount'), value: 8 },
  71. { text: t('AccountType.CommissionAccount'), value: -1 },
  72. ],
  73. defaultValue: 0,
  74. clearable: true
  75. },
  76. { key: 'date', label: t('placeholder.Start') + ' - ' + t('placeholder.End'), type: 'daterange' },
  77. ])
  78. // 表格列配置
  79. const columns = computed(() => [
  80. {
  81. prop: 'cId',
  82. label: t('Label.CidAccount'),
  83. align: 'center',
  84. },
  85. {
  86. prop: 'customName',
  87. label: t('Documentary.Report.item19'),
  88. align: 'center',
  89. formatter: ({ row }: any) => row.customName || '--',
  90. },
  91. {
  92. prop: 'login',
  93. label: t('Label.TradingAccount'),
  94. align: 'center',
  95. formatter: ({ row }: any) => row.login || '--',
  96. },
  97. {
  98. prop: 'groupType',
  99. type: 'tag',
  100. label: t('Documentary.Report.item20'),
  101. align: 'center',
  102. width: 110,
  103. tagMap: {
  104. 1: t('AccountType.ClassicAccount'),
  105. 2: t('AccountType.SeniorAccount'),
  106. 5: t('AccountType.SpeedAccount'),
  107. 6: t('AccountType.NewSpeedAccount'),
  108. 7: t('AccountType.StandardAccount'),
  109. 8: t('AccountType.CentAccount'),
  110. '-1': t('AccountType.CommissionAccount'),
  111. },
  112. },
  113. // {
  114. // prop: 'ibNo',
  115. // label: t('Label.AgentNumber'),
  116. // align: 'center',
  117. // formatter: ({ row }: any) => row.ibNo || '--',
  118. // },
  119. // {
  120. // prop: 'salesNo',
  121. // label: t('Label.Encode'),
  122. // align: 'center',
  123. // formatter: ({ row }: any) => row.salesNo || '--',
  124. // },
  125. // {
  126. // prop: 'salesName',
  127. // label: '销售姓名',
  128. // align: 'center',
  129. // formatter: ({ row }: any) => row.salesName || '--',
  130. // },
  131. {
  132. prop: 'deposit',
  133. label: t('Documentary.Report.item21'),
  134. align: 'center',
  135. sortable: 'custom',
  136. formatter: ({ row }: any) => row.deposit ? numberDecimal(row.deposit) : '0.00',
  137. },
  138. {
  139. prop: 'withdrawal',
  140. label: t('Documentary.Report.item22'),
  141. align: 'center',
  142. sortable: 'custom',
  143. formatter: ({ row }: any) => row.withdrawal ? numberDecimal(row.withdrawal) : '0.00',
  144. },
  145. {
  146. prop: 'netDeposit',
  147. label: t('Documentary.Report.item23'),
  148. align: 'center',
  149. sortable: 'custom',
  150. formatter: ({ row }: any) => row.netDeposit ? numberDecimal(row.netDeposit) : '0.00',
  151. },
  152. {
  153. prop: 'volume',
  154. label: t('Documentary.Report.item24'),
  155. align: 'center',
  156. sortable: 'custom',
  157. formatter: ({ row }: any) => row.volume ? numberDecimal(row.volume) : '0.00',
  158. },
  159. {
  160. prop: 'sumRebate',
  161. label: t('Documentary.Report.item25'),
  162. align: 'center',
  163. sortable: 'custom',
  164. formatter: ({ row }: any) => row.sumRebate ? numberDecimal(row.sumRebate) : '0.00',
  165. },
  166. {
  167. prop: 'storage',
  168. label: t('Documentary.Report.item26'),
  169. align: 'center',
  170. sortable: 'custom',
  171. formatter: ({ row }: any) => row.storage ? numberDecimal(row.storage) : '0.00',
  172. },
  173. {
  174. prop: 'balance',
  175. label: t('Label.Balance'),
  176. align: 'center',
  177. sortable: 'custom',
  178. formatter: ({ row }: any) => row.balance != null && row.balance !== '' ? numberDecimal(row.balance) : '--',
  179. },
  180. {
  181. prop: 'equity',
  182. label: t('Label.equity'),
  183. align: 'center',
  184. sortable: 'custom',
  185. formatter: ({ row }: any) => row.equity != null && row.equity !== '' ? numberDecimal(row.equity) : '--',
  186. },
  187. {
  188. prop: 'profit',
  189. label: t('Documentary.tradingCenter.item128'),
  190. align: 'center',
  191. sortable: 'custom',
  192. formatter: ({ row }: any) => row.profit ? numberDecimal(row.profit) : '0.00',
  193. },
  194. {
  195. prop: 'marginLevel',
  196. label: t('Label.MarginLevel'),
  197. align: 'center',
  198. sortable: 'custom',
  199. formatter: ({ row }: any) => row.marginLevel || '--',
  200. },
  201. {
  202. prop: 'credit',
  203. label: t('Label.Credit'),
  204. align: 'center',
  205. sortable: 'custom',
  206. formatter: ({ row }: any) => row.credit != null && row.credit !== '' ? numberDecimal(row.credit) : '--',
  207. },
  208. {
  209. prop: 'regDate',
  210. label: t('Label.RegDate'),
  211. align: 'center',
  212. formatter: ({ row }: any) => row.regDate || '--',
  213. },
  214. ])
  215. const mobilePrimaryFields = computed(()=>[
  216. {
  217. prop: 'cId',
  218. label: t('Label.CidAccount'),
  219. align: 'center',
  220. },
  221. {
  222. prop: 'customName',
  223. label: t('Documentary.Report.item19'),
  224. align: 'center',
  225. formatter: ({ row }: any) => row.customName || '--',
  226. },
  227. {
  228. prop: 'login',
  229. label: t('Label.TradingAccount'),
  230. align: 'center',
  231. formatter: ({ row }: any) => row.login || '--',
  232. },
  233. {
  234. prop: 'more',
  235. type: 'more',
  236. width: 20,
  237. align: 'right',
  238. },
  239. ])
  240. const handleSearch = (params: any) => {
  241. Object.assign(search, params)
  242. nextTick(() => {
  243. tableRef.value?.refreshTable?.()
  244. })
  245. }
  246. const handleReset = (params: any) => {
  247. Object.assign(search, {
  248. ...params,
  249. platform: null,
  250. groupType: 0,
  251. })
  252. nextTick(() => {
  253. tableRef.value?.refreshTable?.()
  254. })
  255. }
  256. const handleSortChange = (params: any) => {
  257. Object.assign(search, {
  258. orderColumn: params.prop,
  259. orderType: params.order,
  260. })
  261. nextTick(() => {
  262. tableRef.value?.refreshTable?.()
  263. })
  264. }
  265. </script>
  266. <style lang="scss" scoped>
  267. @import "@/uni.scss";
  268. .search-content {
  269. display: flex;
  270. justify-content: space-between;
  271. }
  272. </style>