report.ts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. import { useI18n } from 'vue-i18n'
  2. import { isAfterJuly28 } from '@/utils/dateUtils'
  3. import { useFilters } from '../../../composables/useFilters'
  4. import { computed } from 'vue'
  5. export const useReportConst = () => {
  6. const { t } = useI18n()
  7. const { numberFormat } = useFilters()
  8. const groupCurrency1 = (type: string) => {
  9. if (type == 'GBP') return '£'
  10. if (type == 'USD') return '$'
  11. if (type == 'EUR') return '€'
  12. if (type == 'USC') return '¢'
  13. return '$'
  14. }
  15. const groupTypeName = (type: string | number) => {
  16. if (type == '1') return t('AccountType.ClassicAccount')
  17. if (type == '2') return t('AccountType.SeniorAccount')
  18. if (type == '3') return isAfterJuly28() ? '--' : t('AccountType.AgencyAccount')
  19. if (type == '5') return t('AccountType.SpeedAccount')
  20. if (type == '6') return t('AccountType.SpeedAccount')
  21. if (type == '7') return t('AccountType.StandardAccount')
  22. if (type == '8') return t('AccountType.CentAccount')
  23. return '--'
  24. }
  25. const platformOptions = [
  26. { text: 'MT4', value: 'MT4' },
  27. { text: 'MT5', value: 'MT5' },
  28. ]
  29. const customTypeList = computed(() => [
  30. { text: t('AccountType.ClassicAccount'), value: 1 },
  31. { text: t('AccountType.ClassicAccount'), value: 2 },
  32. !isAfterJuly28() ? { text: t('AccountType.ClassicAccount'), value: 3 } : '',
  33. { text: t('AccountType.ClassicAccount'), value: 7 },
  34. { text: t('AccountType.ClassicAccount'), value: 8 },
  35. ].filter((v) => !!v))
  36. const columnList = computed(() => ({
  37. '1': [
  38. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  39. { prop: 'login', label: t('Label.TradingAccount') },
  40. { prop: 'name', label: t('Label.Name') },
  41. {
  42. prop: 'deposit', label: t('Label.Deposit'),
  43. formatter: ({ row }) => {
  44. return `${groupCurrency1(row.currency)}${numberFormat(row.deposit ?? '0')}`
  45. },
  46. },
  47. {
  48. prop: 'withdrawal', label: t('Label.Withdrawals'),
  49. formatter: ({ row }) => {
  50. return `${groupCurrency1(row.currency)}${numberFormat(row.withdrawal ?? '0')}`
  51. },
  52. },
  53. {
  54. prop: 'credit', label: t('Label.Credit'),
  55. formatter: ({ row }) => {
  56. return `${groupCurrency1(row.currency)}${numberFormat(row.credit ?? '0')}`
  57. },
  58. },
  59. { prop: 'closeTime', label: t('Label.CloseTime') },
  60. ],
  61. '2': [
  62. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  63. { prop: 'login', label: t('Label.TradingAccount') },
  64. {
  65. prop: 'groupType', label: t('Label.Type'),
  66. type: 'tag',
  67. tagMap: {
  68. 1: t('AccountType.ClassicAccount'),
  69. 2: t('AccountType.SeniorAccount'),
  70. 3: !isAfterJuly28() ? t('AccountType.AgencyAccount') : '',
  71. 4: t('AccountType.ProfessionalAccount'),
  72. 5: t('AccountType.SpeedAccount'),
  73. 6: t('AccountType.SpeedAccount'),
  74. 7: t('AccountType.StandardAccount'),
  75. 8: t('AccountType.CentAccount'),
  76. },
  77. },
  78. { prop: 'symbol', label: t('Label.Varieties') },
  79. {
  80. prop: 'volume', label: t('Label.Volume'),
  81. formatter: ({ row }) => {
  82. return `${numberFormat(row.volume ?? '0')}/${t('Label.Lot')}`
  83. },
  84. },
  85. {
  86. prop: 'rebateAmount', label: t('Label.rebateAmount'),
  87. formatter: ({ row }) => {
  88. return `${groupCurrency1(row.currency)}${numberFormat(row.rebateAmount ?? '0')}`
  89. },
  90. },
  91. {
  92. prop: 'rebatePoint', label: t('Label.rebatePoint'),
  93. formatter: ({ row }) => {
  94. return `${groupCurrency1(row.currency)}${numberFormat(row.rebatePoint ?? '0')}/${t('Label.Lot')}`
  95. },
  96. },
  97. {
  98. prop: 'commissionAmount', label: t('Label.commissionAmount'),
  99. formatter: ({ row }) => {
  100. return `${groupCurrency1(row.currency)}${numberFormat(row.commissionAmount ?? '0')}`
  101. },
  102. },
  103. {
  104. prop: 'commissionPoint', label: t('Label.commissionPoint'),
  105. formatter: ({ row }) => {
  106. return `${groupCurrency1(row.currency)}${numberFormat(row.commissionPoint ?? '0')}/${t('Label.Lot')}`
  107. },
  108. },
  109. { prop: 'openTime', label: t('Label.OpenTime') },
  110. { prop: 'closeTime', label: t('Label.CloseTime') },
  111. ],
  112. '3_1': [
  113. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  114. { prop: 'login', label: t('Label.TradingAccount') },
  115. { prop: 'order', label: t('Label.OrderNumber') },
  116. { prop: 'platform', label: t('Label.Platform') },
  117. { prop: 'cmdName', label: t('Label.Type') },
  118. { prop: 'symbol', label: t('Label.Varieties') },
  119. {
  120. prop: 'openPrice', label: t('Label.OpenPrice'),
  121. formatter: ({ row }) => {
  122. return `${numberFormat(row.openPrice ?? '0')}`
  123. },
  124. },
  125. { prop: 'openTime', label: t('Label.OpenTime') },
  126. {
  127. prop: 'closePrice', label: t('Label.ClosePrice'),
  128. formatter: ({ row }) => {
  129. return `${numberFormat(row.closePrice ?? '0')}`
  130. },
  131. },
  132. { prop: 'closeTime', label: t('Label.CloseTime') },
  133. { prop: 'tp', label: t('Label.EP') },
  134. { prop: 'sl', label: t('Label.EL') },
  135. {
  136. prop: 'commission', label: t('Label.OutsideCommission'),
  137. formatter: ({ row }) => {
  138. return `${numberFormat(row.commission ?? '0')}`
  139. },
  140. },
  141. {
  142. prop: 'volume', label: t('Label.Volume'),
  143. formatter: ({ row }) => {
  144. return `${numberFormat(row.volume ?? '0')}/${t('Label.Lot')}`
  145. },
  146. },
  147. {
  148. prop: 'storage', label: t('Label.StorageFee'),
  149. formatter: ({ row }) => {
  150. return `${groupCurrency1(row.currency)}${numberFormat(row.storage ?? '0')}`
  151. },
  152. },
  153. {
  154. prop: 'profit', label: t('Label.ProfitLoss'),
  155. formatter: ({ row }) => {
  156. return `${groupCurrency1(row.currency)}${numberFormat(row.profit ?? '0')}`
  157. },
  158. },
  159. {
  160. prop: 'totalProfit', label: t('Label.TotalProfitLoss'),
  161. formatter: ({ row }) => {
  162. return `${groupCurrency1(row.currency)}${numberFormat(row.totalProfit ?? '0')}`
  163. },
  164. },
  165. ],
  166. '3_2': [
  167. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  168. { prop: 'login', label: t('Label.TradingAccount') },
  169. { prop: 'order', label: t('Label.OrderNumber') },
  170. { prop: 'platform', label: t('Label.Platform') },
  171. { prop: 'cmdName', label: t('Label.Type') },
  172. { prop: 'symbol', label: t('Label.Varieties') },
  173. {
  174. prop: 'openPrice', label: t('Label.OpenPrice'),
  175. formatter: ({ row }) => {
  176. return `${numberFormat(row.openPrice ?? '0')}`
  177. },
  178. },
  179. { prop: 'openTime', label: t('Label.OpenTime') },
  180. {
  181. prop: 'closePrice', label: t('Label.ClosePrice'),
  182. formatter: ({ row }) => {
  183. return `${numberFormat(row.closePrice ?? '0')}`
  184. },
  185. },
  186. { prop: 'closeTime', label: t('Label.CloseTime') },
  187. { prop: 'tp', label: t('Label.EP') },
  188. { prop: 'sl', label: t('Label.EL') },
  189. {
  190. prop: 'commission', label: t('Label.OutsideCommission'),
  191. formatter: ({ row }) => {
  192. return `${numberFormat(row.commission ?? '0')}`
  193. },
  194. },
  195. {
  196. prop: 'volume', label: t('Label.Volume'),
  197. formatter: ({ row }) => {
  198. return `${numberFormat(row.volume ?? '0')}/${t('Label.Lot')}`
  199. },
  200. },
  201. {
  202. prop: 'storage', label: t('Label.StorageFee'),
  203. formatter: ({ row }) => {
  204. return `${groupCurrency1(row.currency)}${numberFormat(row.storage ?? '0')}`
  205. },
  206. },
  207. {
  208. prop: 'profit', label: t('Label.ProfitLoss'),
  209. formatter: ({ row }) => {
  210. return `${groupCurrency1(row.currency)}${numberFormat(row.profit ?? '0')}`
  211. },
  212. },
  213. {
  214. prop: 'totalProfit', label: t('Label.TotalProfitLoss'),
  215. formatter: ({ row }) => {
  216. return `${groupCurrency1(row.currency)}${numberFormat(row.totalProfit ?? '0')}`
  217. },
  218. },
  219. ],
  220. '3_3': [
  221. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  222. { prop: 'login', label: t('Label.TradingAccount') },
  223. { prop: 'order', label: t('Label.OrderNumber') },
  224. { prop: 'platform', label: t('Label.Platform') },
  225. { prop: 'cmdName', label: t('Label.Type') },
  226. { prop: 'symbol', label: t('Label.Varieties') },
  227. {
  228. prop: 'openPrice', label: t('Label.OpenPrice'),
  229. formatter: ({ row }) => {
  230. return `${numberFormat(row.openPrice ?? '0')}`
  231. },
  232. },
  233. { prop: 'openTime', label: t('Label.OpenTime') },
  234. {
  235. prop: 'closePrice', label: t('Label.ClosePrice'),
  236. formatter: ({ row }) => {
  237. return `${numberFormat(row.closePrice ?? '0')}`
  238. },
  239. },
  240. { prop: 'closeTime', label: t('Label.CloseTime') },
  241. { prop: 'tp', label: t('Label.EP') },
  242. { prop: 'sl', label: t('Label.EL') },
  243. {
  244. prop: 'commission', label: t('Label.OutsideCommission'),
  245. formatter: ({ row }) => {
  246. return `${numberFormat(row.commission ?? '0')}`
  247. },
  248. },
  249. {
  250. prop: 'volume', label: t('Label.Volume'),
  251. formatter: ({ row }) => {
  252. return `${numberFormat(row.volume ?? '0')}/${t('Label.Lot')}`
  253. },
  254. },
  255. {
  256. prop: 'storage', label: t('Label.StorageFee'),
  257. formatter: ({ row }) => {
  258. return `${groupCurrency1(row.currency)}${numberFormat(row.storage ?? '0')}`
  259. },
  260. },
  261. {
  262. prop: 'profit', label: t('Label.ProfitLoss'),
  263. formatter: ({ row }) => {
  264. return `${groupCurrency1(row.currency)}${numberFormat(row.profit ?? '0')}`
  265. },
  266. },
  267. {
  268. prop: 'totalProfit', label: t('Label.TotalProfitLoss'),
  269. formatter: ({ row }) => {
  270. return `${groupCurrency1(row.currency)}${numberFormat(row.totalProfit ?? '0')}`
  271. },
  272. },
  273. ],
  274. '3_4': [
  275. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  276. { prop: 'login', label: t('Label.TradingAccount') },
  277. { prop: 'order', label: t('Label.OrderNumber') },
  278. { prop: 'platform', label: t('Label.Platform') },
  279. { prop: 'cmdName', label: t('Label.Type') },
  280. { prop: 'symbol', label: t('Label.Varieties') },
  281. {
  282. prop: 'openPrice', label: t('Label.OpenPrice'),
  283. formatter: ({ row }) => {
  284. return `${numberFormat(row.openPrice ?? '0')}`
  285. },
  286. },
  287. { prop: 'openTime', label: t('Label.OpenTime') },
  288. { prop: 'tp', label: t('Label.EP') },
  289. { prop: 'sl', label: t('Label.EL') },
  290. {
  291. prop: 'volume', label: t('Label.Volume'),
  292. formatter: ({ row }) => {
  293. return `${numberFormat(row.volume ?? '0')}/${t('Label.Lot')}`
  294. },
  295. },
  296. {
  297. prop: 'storage', label: t('Label.StorageFee'),
  298. formatter: ({ row }) => {
  299. return `${groupCurrency1(row.currency)}${numberFormat(row.storage ?? '0')}`
  300. },
  301. },
  302. {
  303. prop: 'profit', label: t('Label.ProfitLoss'),
  304. formatter: ({ row }) => {
  305. return `${groupCurrency1(row.currency)}${numberFormat(row.profit ?? '0')}`
  306. },
  307. },
  308. ],
  309. '4': [
  310. { prop: 'cId', label: t('Label.CidAccount') },
  311. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  312. { prop: 'login', label: t('Label.TradingAccount') },
  313. {
  314. prop: 'groupType', label: t('Label.AccountType'),
  315. formatter: ({ row }) => {
  316. return groupTypeName(row.groupType)
  317. },
  318. },
  319. { prop: 'name', label: t('Label.Name') },
  320. { prop: 'platform', label: t('Label.Platform') },
  321. { prop: 'leverage', label: t('Label.Leverage') },
  322. { prop: 'margin', label: t('Label.margin') },
  323. {
  324. prop: 'commission', label: t('Label.OutsideCommission'),
  325. formatter: ({ row }) => {
  326. return `$${row.commission ?? '0'}`
  327. },
  328. },
  329. {
  330. prop: 'credit', label: t('Label.Credit'),
  331. formatter: ({ row }) => {
  332. return `$${row.credit ?? '0'}`
  333. },
  334. },
  335. {
  336. prop: 'balance', label: t('Label.Amount'),
  337. formatter: ({ row }) => {
  338. return `$${row.balance ?? '0'}`
  339. },
  340. },
  341. {
  342. prop: 'equity', label: t('Label.equity'),
  343. formatter: ({ row }) => {
  344. return `$${row.equity ?? '0'}`
  345. },
  346. },
  347. { prop: 'floating', label: t('Label.FloatingPL') },
  348. { prop: 'registration', label: t('Label.RegistrationTime') },
  349. ],
  350. '5': [
  351. { prop: 'ibNo', label: t('Label.IBAccount') },
  352. { prop: 'pIbNo', label: t('Label.AttributionNumber') },
  353. { prop: 'name', label: t('Label.Name') },
  354. { prop: 'addTime', label: t('Label.RegistrationTime') },
  355. ],
  356. '6': [
  357. { prop: 'ibNo', label: t('Label.IBAccount') },
  358. { prop: 'typeName', label: t('Label.OperatingMode') },
  359. { prop: 'balanceTypeName', label: t('Label.CommissionType') },
  360. {
  361. prop: 'amount', label: t('Label.AmountMoney'),
  362. formatter: ({ row }) => {
  363. return numberFormat(row.amount ?? '0')
  364. },
  365. },
  366. { prop: 'addTime', label: t('Label.ProcessingDate') },
  367. ],
  368. '7': [
  369. { prop: 'cId', label: 'CID' },
  370. { prop: 'ibNo', label: t('Label.IBAccount') },
  371. { prop: 'name', label: t('Label.Name') },
  372. { prop: 'login', label: t('Label.TradingAccount') },
  373. { prop: 'platform', label: t('Label.Platform') },
  374. { prop: 'fxVolume', label: t('Label.fxVolume') },
  375. { prop: 'cfdVolume', label: t('Label.cfdVolume') },
  376. { prop: 'indexVolume', label: t('Label.indexVolume') },
  377. { prop: 'metalVolume', label: t('Label.metalVolume') },
  378. ],
  379. '24': [
  380. { prop: 'cId', label: t('Label.CidAccount') },
  381. { prop: 'ticket', label: t('Label.OrderNumber') },
  382. { prop: 'login', label: t('Label.TradingAccount') },
  383. { prop: 'symbol', label: t('Label.Varieties') },
  384. { prop: 'openTime', label: t('Label.OpenTime') },
  385. { prop: 'closeTime', label: t('Label.CloseTime') },
  386. { prop: 'customType', label: t('Label.Type'),
  387. type: 'tag',
  388. tagMap: {
  389. 1: t('AccountType.ClassicAccount'),
  390. 2: t('AccountType.SeniorAccount'),
  391. 5: t('AccountType.SpeedAccount'),
  392. 6: t('AccountType.NewSpeedAccount'),
  393. 7: t('AccountType.StandardAccount'),
  394. 8: t('AccountType.CentAccount'),
  395. },
  396. },
  397. { prop: 'point', label: t('Label.Rebates') },
  398. { prop: 'pointValue', label: t('Ib.Report.Title9') },
  399. { prop: 'volume', label: t('Label.Volume'),
  400. formatter: ({ row }) => {
  401. return `${numberFormat(row.volume ?? '0')}/${t('Label.Lot')}`
  402. },
  403. },
  404. { prop: 'rebate', label: t('Label.Commission'),
  405. formatter: ({ row }) => {
  406. return `$${row.rebate ?? '0'}`
  407. },
  408. },
  409. { prop: 'ibNo', label: t('Label.AgentNumber') },
  410. { prop: 'platform', label: t('Label.Platform') },
  411. ],
  412. }))
  413. const mobileList = computed(() => ({
  414. '1': [
  415. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  416. { prop: 'login', label: t('Label.TradingAccount') },
  417. { prop: 'name', label: t('Label.Name') },
  418. ],
  419. '2': [
  420. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  421. { prop: 'login', label: t('Label.TradingAccount') },
  422. {
  423. prop: 'groupType', label: t('Label.Type'),
  424. type: 'tag',
  425. tagMap: {
  426. 1: t('AccountType.ClassicAccount'),
  427. 2: t('AccountType.SeniorAccount'),
  428. 3: !isAfterJuly28() ? t('AccountType.AgencyAccount') : '',
  429. 4: t('AccountType.ProfessionalAccount'),
  430. 5: t('AccountType.SpeedAccount'),
  431. 6: t('AccountType.SpeedAccount'),
  432. 7: t('AccountType.StandardAccount'),
  433. 8: t('AccountType.CentAccount'),
  434. },
  435. },
  436. ],
  437. '3_1': [
  438. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  439. { prop: 'login', label: t('Label.TradingAccount') },
  440. { prop: 'order', label: t('Label.OrderNumber') },
  441. ],
  442. '3_2': [
  443. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  444. { prop: 'login', label: t('Label.TradingAccount') },
  445. { prop: 'order', label: t('Label.OrderNumber') },
  446. ],
  447. '3_3': [
  448. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  449. { prop: 'login', label: t('Label.TradingAccount') },
  450. { prop: 'order', label: t('Label.OrderNumber') },
  451. ],
  452. '3_4': [
  453. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  454. { prop: 'login', label: t('Label.TradingAccount') },
  455. { prop: 'order', label: t('Label.OrderNumber') },
  456. ],
  457. '4': [
  458. { prop: 'cId', label: t('Label.CidAccount') },
  459. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  460. { prop: 'login', label: t('Label.TradingAccount') },
  461. ],
  462. '5': [
  463. { prop: 'ibNo', label: t('Label.IBAccount') },
  464. { prop: 'pIbNo', label: t('Label.AttributionNumber') },
  465. { prop: 'name', label: t('Label.Name') },
  466. ],
  467. '6': [
  468. { prop: 'ibNo', label: t('Label.IBAccount') },
  469. { prop: 'typeName', label: t('Label.OperatingMode') },
  470. { prop: 'balanceTypeName', label: t('Label.CommissionType') },
  471. ],
  472. '7': [
  473. { prop: 'cId', label: 'CID' },
  474. { prop: 'ibNo', label: t('Label.IBAccount') },
  475. { prop: 'name', label: t('Label.Name') },
  476. ],
  477. '24': [
  478. { prop: 'cId', label: t('Label.CidAccount') },
  479. { prop: 'ticket', label: t('Label.OrderNumber') },
  480. { prop: 'login', label: t('Label.TradingAccount') },
  481. ],
  482. }))
  483. return { columnList, mobileList, platformOptions, customTypeList, groupCurrency1, groupTypeName }
  484. }