complexReport.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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. ],
  72. defaultValue: 0,
  73. clearable: true
  74. },
  75. { key: 'date', label: t('placeholder.Start') + ' - ' + t('placeholder.End'), type: 'daterange' },
  76. ])
  77. // 表格列配置
  78. const columns = computed(() => [
  79. {
  80. prop: 'cId',
  81. label: t('Label.CidAccount'),
  82. align: 'center',
  83. },
  84. {
  85. prop: 'customName',
  86. label: t('Documentary.Report.item19'),
  87. align: 'center',
  88. formatter: ({ row }: any) => row.customName || '--',
  89. },
  90. {
  91. prop: 'login',
  92. label: t('Label.TradingAccount'),
  93. align: 'center',
  94. formatter: ({ row }: any) => row.login || '--',
  95. },
  96. {
  97. prop: 'groupType',
  98. type: 'tag',
  99. label: t('Documentary.Report.item20'),
  100. align: 'center',
  101. width: 110,
  102. tagMap: {
  103. 1: t('AccountType.ClassicAccount'),
  104. 2: t('AccountType.SeniorAccount'),
  105. 5: t('AccountType.SpeedAccount'),
  106. 6: t('AccountType.NewSpeedAccount'),
  107. 7: t('AccountType.StandardAccount'),
  108. 8: t('AccountType.CentAccount'),
  109. },
  110. },
  111. // {
  112. // prop: 'ibNo',
  113. // label: t('Label.AgentNumber'),
  114. // align: 'center',
  115. // formatter: ({ row }: any) => row.ibNo || '--',
  116. // },
  117. // {
  118. // prop: 'salesNo',
  119. // label: t('Label.Encode'),
  120. // align: 'center',
  121. // formatter: ({ row }: any) => row.salesNo || '--',
  122. // },
  123. // {
  124. // prop: 'salesName',
  125. // label: '销售姓名',
  126. // align: 'center',
  127. // formatter: ({ row }: any) => row.salesName || '--',
  128. // },
  129. {
  130. prop: 'deposit',
  131. label: t('Documentary.Report.item21'),
  132. align: 'center',
  133. sortable: 'custom',
  134. formatter: ({ row }: any) => row.deposit ? numberDecimal(row.deposit) : '0.00',
  135. },
  136. {
  137. prop: 'withdrawal',
  138. label: t('Documentary.Report.item22'),
  139. align: 'center',
  140. sortable: 'custom',
  141. formatter: ({ row }: any) => row.withdrawal ? numberDecimal(row.withdrawal) : '0.00',
  142. },
  143. {
  144. prop: 'netDeposit',
  145. label: t('Documentary.Report.item23'),
  146. align: 'center',
  147. sortable: 'custom',
  148. formatter: ({ row }: any) => row.netDeposit ? numberDecimal(row.netDeposit) : '0.00',
  149. },
  150. {
  151. prop: 'volume',
  152. label: t('Documentary.Report.item24'),
  153. align: 'center',
  154. sortable: 'custom',
  155. formatter: ({ row }: any) => row.volume ? numberDecimal(row.volume) : '0.00',
  156. },
  157. {
  158. prop: 'sumRebate',
  159. label: t('Documentary.Report.item25'),
  160. align: 'center',
  161. sortable: 'custom',
  162. formatter: ({ row }: any) => row.sumRebate ? numberDecimal(row.sumRebate) : '0.00',
  163. },
  164. {
  165. prop: 'storage',
  166. label: t('Documentary.Report.item26'),
  167. align: 'center',
  168. sortable: 'custom',
  169. formatter: ({ row }: any) => row.storage ? numberDecimal(row.storage) : '0.00',
  170. },
  171. {
  172. prop: 'balance',
  173. label: t('Label.Balance'),
  174. align: 'center',
  175. sortable: 'custom',
  176. formatter: ({ row }: any) => row.balance != null && row.balance !== '' ? numberDecimal(row.balance) : '--',
  177. },
  178. {
  179. prop: 'equity',
  180. label: t('Label.equity'),
  181. align: 'center',
  182. sortable: 'custom',
  183. formatter: ({ row }: any) => row.equity != null && row.equity !== '' ? numberDecimal(row.equity) : '--',
  184. },
  185. {
  186. prop: 'profit',
  187. label: t('Documentary.tradingCenter.item128'),
  188. align: 'center',
  189. sortable: 'custom',
  190. formatter: ({ row }: any) => row.profit ? numberDecimal(row.profit) : '0.00',
  191. },
  192. {
  193. prop: 'marginLevel',
  194. label: t('Label.MarginLevel'),
  195. align: 'center',
  196. sortable: 'custom',
  197. formatter: ({ row }: any) => row.marginLevel || '--',
  198. },
  199. {
  200. prop: 'credit',
  201. label: t('Label.Credit'),
  202. align: 'center',
  203. sortable: 'custom',
  204. formatter: ({ row }: any) => row.credit != null && row.credit !== '' ? numberDecimal(row.credit) : '--',
  205. },
  206. {
  207. prop: 'regDate',
  208. label: t('Label.RegDate'),
  209. align: 'center',
  210. formatter: ({ row }: any) => row.regDate || '--',
  211. },
  212. ])
  213. const mobilePrimaryFields = computed(()=>[
  214. {
  215. prop: 'cId',
  216. label: t('Label.CidAccount'),
  217. align: 'center',
  218. },
  219. {
  220. prop: 'customName',
  221. label: '客户姓名',
  222. align: 'center',
  223. formatter: ({ row }: any) => row.customName || '--',
  224. },
  225. {
  226. prop: 'login',
  227. label: t('Label.TradingAccount'),
  228. align: 'center',
  229. formatter: ({ row }: any) => row.login || '--',
  230. },
  231. {
  232. prop: 'more',
  233. type: 'more',
  234. width: 20,
  235. align: 'right',
  236. },
  237. ])
  238. const handleSearch = (params: any) => {
  239. Object.assign(search, params)
  240. nextTick(() => {
  241. tableRef.value?.refreshTable?.()
  242. })
  243. }
  244. const handleReset = (params: any) => {
  245. Object.assign(search, {
  246. ...params,
  247. platform: null,
  248. groupType: 0,
  249. })
  250. nextTick(() => {
  251. tableRef.value?.refreshTable?.()
  252. })
  253. }
  254. const handleSortChange = (params: any) => {
  255. Object.assign(search, {
  256. orderColumn: params.prop,
  257. orderType: params.order,
  258. })
  259. nextTick(() => {
  260. tableRef.value?.refreshTable?.()
  261. })
  262. }
  263. </script>
  264. <style lang="scss" scoped>
  265. @import "@/uni.scss";
  266. .search-content {
  267. display: flex;
  268. justify-content: space-between;
  269. }
  270. </style>