report.ts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. import { useI18n } from 'vue-i18n'
  2. import { isAfterJuly28,formatDate } 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('vu.Label.Date'),
  111. formatter: ({ row }) => {
  112. return formatDate(row.closeTime)
  113. },
  114. },
  115. { prop: 'action', label: t('Label.Action'),slot:'action' },
  116. ],
  117. '3_1': [
  118. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  119. { prop: 'login', label: t('Label.TradingAccount') },
  120. { prop: 'order', label: t('Label.OrderNumber') },
  121. { prop: 'platform', label: t('Label.Platform') },
  122. { prop: 'cmdName', label: t('Label.Type') },
  123. { prop: 'symbol', label: t('Label.Varieties') },
  124. {
  125. prop: 'openPrice', label: t('Label.OpenPrice'),
  126. formatter: ({ row }) => {
  127. return `${numberFormat(row.openPrice ?? '0')}`
  128. },
  129. },
  130. { prop: 'openTime', label: t('Label.OpenTime') },
  131. {
  132. prop: 'closePrice', label: t('Label.ClosePrice'),
  133. formatter: ({ row }) => {
  134. return `${numberFormat(row.closePrice ?? '0')}`
  135. },
  136. },
  137. { prop: 'closeTime', label: t('Label.CloseTime') },
  138. { prop: 'tp', label: t('Label.EP') },
  139. { prop: 'sl', label: t('Label.EL') },
  140. {
  141. prop: 'commission', label: t('Label.OutsideCommission'),
  142. formatter: ({ row }) => {
  143. return `${numberFormat(row.commission ?? '0')}`
  144. },
  145. },
  146. {
  147. prop: 'volume', label: t('Label.Volume'),
  148. formatter: ({ row }) => {
  149. return `${numberFormat(row.volume ?? '0')}/${t('Label.Lot')}`
  150. },
  151. },
  152. {
  153. prop: 'storage', label: t('Label.StorageFee'),
  154. formatter: ({ row }) => {
  155. return `${groupCurrency1(row.currency)}${numberFormat(row.storage ?? '0')}`
  156. },
  157. },
  158. {
  159. prop: 'profit', label: t('Label.ProfitLoss'),
  160. formatter: ({ row }) => {
  161. return `${groupCurrency1(row.currency)}${numberFormat(row.profit ?? '0')}`
  162. },
  163. },
  164. {
  165. prop: 'totalProfit', label: t('Label.TotalProfitLoss'),
  166. formatter: ({ row }) => {
  167. return `${groupCurrency1(row.currency)}${numberFormat(row.totalProfit ?? '0')}`
  168. },
  169. },
  170. ],
  171. '3_2': [
  172. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  173. { prop: 'login', label: t('Label.TradingAccount') },
  174. { prop: 'order', label: t('Label.OrderNumber') },
  175. { prop: 'platform', label: t('Label.Platform') },
  176. { prop: 'cmdName', label: t('Label.Type') },
  177. { prop: 'symbol', label: t('Label.Varieties') },
  178. {
  179. prop: 'openPrice', label: t('Label.OpenPrice'),
  180. formatter: ({ row }) => {
  181. return `${numberFormat(row.openPrice ?? '0')}`
  182. },
  183. },
  184. { prop: 'openTime', label: t('Label.OpenTime') },
  185. {
  186. prop: 'closePrice', label: t('Label.ClosePrice'),
  187. formatter: ({ row }) => {
  188. return `${numberFormat(row.closePrice ?? '0')}`
  189. },
  190. },
  191. { prop: 'closeTime', label: t('Label.CloseTime') },
  192. { prop: 'tp', label: t('Label.EP') },
  193. { prop: 'sl', label: t('Label.EL') },
  194. {
  195. prop: 'commission', label: t('Label.OutsideCommission'),
  196. formatter: ({ row }) => {
  197. return `${numberFormat(row.commission ?? '0')}`
  198. },
  199. },
  200. {
  201. prop: 'volume', label: t('Label.Volume'),
  202. formatter: ({ row }) => {
  203. return `${numberFormat(row.volume ?? '0')}/${t('Label.Lot')}`
  204. },
  205. },
  206. {
  207. prop: 'storage', label: t('Label.StorageFee'),
  208. formatter: ({ row }) => {
  209. return `${groupCurrency1(row.currency)}${numberFormat(row.storage ?? '0')}`
  210. },
  211. },
  212. {
  213. prop: 'profit', label: t('Label.ProfitLoss'),
  214. formatter: ({ row }) => {
  215. return `${groupCurrency1(row.currency)}${numberFormat(row.profit ?? '0')}`
  216. },
  217. },
  218. {
  219. prop: 'totalProfit', label: t('Label.TotalProfitLoss'),
  220. formatter: ({ row }) => {
  221. return `${groupCurrency1(row.currency)}${numberFormat(row.totalProfit ?? '0')}`
  222. },
  223. },
  224. ],
  225. '3_3': [
  226. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  227. { prop: 'login', label: t('Label.TradingAccount') },
  228. { prop: 'order', label: t('Label.OrderNumber') },
  229. { prop: 'platform', label: t('Label.Platform') },
  230. { prop: 'cmdName', label: t('Label.Type') },
  231. { prop: 'symbol', label: t('Label.Varieties') },
  232. {
  233. prop: 'openPrice', label: t('Label.OpenPrice'),
  234. formatter: ({ row }) => {
  235. return `${numberFormat(row.openPrice ?? '0')}`
  236. },
  237. },
  238. { prop: 'openTime', label: t('Label.OpenTime') },
  239. {
  240. prop: 'closePrice', label: t('Label.ClosePrice'),
  241. formatter: ({ row }) => {
  242. return `${numberFormat(row.closePrice ?? '0')}`
  243. },
  244. },
  245. { prop: 'closeTime', label: t('Label.CloseTime') },
  246. { prop: 'tp', label: t('Label.EP') },
  247. { prop: 'sl', label: t('Label.EL') },
  248. {
  249. prop: 'commission', label: t('Label.OutsideCommission'),
  250. formatter: ({ row }) => {
  251. return `${numberFormat(row.commission ?? '0')}`
  252. },
  253. },
  254. {
  255. prop: 'volume', label: t('Label.Volume'),
  256. formatter: ({ row }) => {
  257. return `${numberFormat(row.volume ?? '0')}/${t('Label.Lot')}`
  258. },
  259. },
  260. {
  261. prop: 'storage', label: t('Label.StorageFee'),
  262. formatter: ({ row }) => {
  263. return `${groupCurrency1(row.currency)}${numberFormat(row.storage ?? '0')}`
  264. },
  265. },
  266. {
  267. prop: 'profit', label: t('Label.ProfitLoss'),
  268. formatter: ({ row }) => {
  269. return `${groupCurrency1(row.currency)}${numberFormat(row.profit ?? '0')}`
  270. },
  271. },
  272. {
  273. prop: 'totalProfit', label: t('Label.TotalProfitLoss'),
  274. formatter: ({ row }) => {
  275. return `${groupCurrency1(row.currency)}${numberFormat(row.totalProfit ?? '0')}`
  276. },
  277. },
  278. ],
  279. '3_4': [
  280. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  281. { prop: 'login', label: t('Label.TradingAccount') },
  282. { prop: 'order', label: t('Label.OrderNumber') },
  283. { prop: 'platform', label: t('Label.Platform') },
  284. { prop: 'cmdName', label: t('Label.Type') },
  285. { prop: 'symbol', label: t('Label.Varieties') },
  286. {
  287. prop: 'openPrice', label: t('Label.OpenPrice'),
  288. formatter: ({ row }) => {
  289. return `${numberFormat(row.openPrice ?? '0')}`
  290. },
  291. },
  292. { prop: 'openTime', label: t('Label.OpenTime') },
  293. { prop: 'tp', label: t('Label.EP') },
  294. { prop: 'sl', label: t('Label.EL') },
  295. {
  296. prop: 'volume', label: t('Label.Volume'),
  297. formatter: ({ row }) => {
  298. return `${numberFormat(row.volume ?? '0')}/${t('Label.Lot')}`
  299. },
  300. },
  301. {
  302. prop: 'storage', label: t('Label.StorageFee'),
  303. formatter: ({ row }) => {
  304. return `${groupCurrency1(row.currency)}${numberFormat(row.storage ?? '0')}`
  305. },
  306. },
  307. {
  308. prop: 'profit', label: t('Label.ProfitLoss'),
  309. formatter: ({ row }) => {
  310. return `${groupCurrency1(row.currency)}${numberFormat(row.profit ?? '0')}`
  311. },
  312. },
  313. ],
  314. '4': [
  315. { prop: 'cId', label: t('Label.CidAccount') },
  316. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  317. { prop: 'login', label: t('Label.TradingAccount') },
  318. {
  319. prop: 'groupType', label: t('Label.AccountType'),
  320. formatter: ({ row }) => {
  321. return groupTypeName(row.groupType)
  322. },
  323. },
  324. { prop: 'name', label: t('Label.Name') },
  325. { prop: 'platform', label: t('Label.Platform') },
  326. { prop: 'leverage', label: t('Label.Leverage') },
  327. { prop: 'margin', label: t('Label.margin') },
  328. {
  329. prop: 'commission', label: t('Label.OutsideCommission'),
  330. formatter: ({ row }) => {
  331. return `$${row.commission ?? '0'}`
  332. },
  333. },
  334. {
  335. prop: 'credit', label: t('Label.Credit'),
  336. formatter: ({ row }) => {
  337. return `$${row.credit ?? '0'}`
  338. },
  339. },
  340. {
  341. prop: 'balance', label: t('Label.Amount'),
  342. formatter: ({ row }) => {
  343. return `$${row.balance ?? '0'}`
  344. },
  345. },
  346. {
  347. prop: 'equity', label: t('Label.equity'),
  348. formatter: ({ row }) => {
  349. return `$${row.equity ?? '0'}`
  350. },
  351. },
  352. { prop: 'floating', label: t('Label.FloatingPL') },
  353. { prop: 'registration', label: t('Label.RegistrationTime') },
  354. ],
  355. '5': [
  356. { prop: 'ibNo', label: t('Label.IBAccount') },
  357. { prop: 'pIbNo', label: t('Label.AttributionNumber') },
  358. { prop: 'name', label: t('Label.Name') },
  359. { prop: 'addTime', label: t('Label.RegistrationTime') },
  360. ],
  361. '6': [
  362. { prop: 'ibNo', label: t('Label.IBAccount') },
  363. { prop: 'typeName', label: t('Label.OperatingMode') },
  364. { prop: 'balanceTypeName', label: t('Label.CommissionType') },
  365. {
  366. prop: 'amount', label: t('Label.AmountMoney'),
  367. formatter: ({ row }) => {
  368. return numberFormat(row.amount ?? '0')
  369. },
  370. },
  371. { prop: 'addTime', label: t('Label.ProcessingDate') },
  372. ],
  373. '7': [
  374. { prop: 'cId', label: 'CID' },
  375. { prop: 'ibNo', label: t('Label.IBAccount') },
  376. { prop: 'name', label: t('Label.Name') },
  377. { prop: 'login', label: t('Label.TradingAccount') },
  378. { prop: 'platform', label: t('Label.Platform') },
  379. { prop: 'fxVolume', label: t('Label.fxVolume') },
  380. { prop: 'cfdVolume', label: t('Label.cfdVolume') },
  381. { prop: 'indexVolume', label: t('Label.indexVolume') },
  382. { prop: 'metalVolume', label: t('Label.metalVolume') },
  383. ],
  384. '24': [
  385. { prop: 'cId', label: t('Label.CidAccount') },
  386. { prop: 'ticket', label: t('Label.OrderNumber') },
  387. { prop: 'login', label: t('Label.TradingAccount') },
  388. { prop: 'symbol', label: t('Label.Varieties') },
  389. { prop: 'openTime', label: t('Label.OpenTime') },
  390. { prop: 'closeTime', label: t('Label.CloseTime') },
  391. { prop: 'customType', label: t('Label.Type'),
  392. type: 'tag',
  393. tagMap: {
  394. 1: t('AccountType.ClassicAccount'),
  395. 2: t('AccountType.SeniorAccount'),
  396. 5: t('AccountType.SpeedAccount'),
  397. 6: t('AccountType.NewSpeedAccount'),
  398. 7: t('AccountType.StandardAccount'),
  399. 8: t('AccountType.CentAccount'),
  400. },
  401. },
  402. { prop: 'point', label: t('Label.Rebates') },
  403. { prop: 'pointValue', label: t('Ib.Report.Title9') },
  404. { prop: 'volume', label: t('Label.Volume'),
  405. formatter: ({ row }) => {
  406. return `${numberFormat(row.volume ?? '0')}/${t('Label.Lot')}`
  407. },
  408. },
  409. { prop: 'rebate', label: t('Label.Commission'),
  410. formatter: ({ row }) => {
  411. return `$${row.rebate ?? '0'}`
  412. },
  413. },
  414. { prop: 'ibNo', label: t('Label.AgentNumber') },
  415. { prop: 'platform', label: t('Label.Platform') },
  416. ],
  417. }))
  418. const mobileList = computed(() => ({
  419. '1': [
  420. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  421. { prop: 'login', label: t('Label.TradingAccount') },
  422. { prop: 'name', label: t('Label.Name') },
  423. ],
  424. '2': [
  425. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  426. { prop: 'login', label: t('Label.TradingAccount') },
  427. { prop: 'closeTime', label: t('vu.Label.Date'),
  428. formatter: ({ row }) => {
  429. return formatDate(row.closeTime)
  430. },
  431. },
  432. ],
  433. '3_1': [
  434. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  435. { prop: 'login', label: t('Label.TradingAccount') },
  436. { prop: 'order', label: t('Label.OrderNumber') },
  437. ],
  438. '3_2': [
  439. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  440. { prop: 'login', label: t('Label.TradingAccount') },
  441. { prop: 'order', label: t('Label.OrderNumber') },
  442. ],
  443. '3_3': [
  444. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  445. { prop: 'login', label: t('Label.TradingAccount') },
  446. { prop: 'order', label: t('Label.OrderNumber') },
  447. ],
  448. '3_4': [
  449. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  450. { prop: 'login', label: t('Label.TradingAccount') },
  451. { prop: 'order', label: t('Label.OrderNumber') },
  452. ],
  453. '4': [
  454. { prop: 'cId', label: t('Label.CidAccount') },
  455. { prop: 'ibNo', label: t('Label.AttributionNumber') },
  456. { prop: 'login', label: t('Label.TradingAccount') },
  457. ],
  458. '5': [
  459. { prop: 'ibNo', label: t('Label.IBAccount') },
  460. { prop: 'pIbNo', label: t('Label.AttributionNumber') },
  461. { prop: 'name', label: t('Label.Name') },
  462. ],
  463. '6': [
  464. { prop: 'ibNo', label: t('Label.IBAccount') },
  465. { prop: 'typeName', label: t('Label.OperatingMode') },
  466. { prop: 'balanceTypeName', label: t('Label.CommissionType') },
  467. ],
  468. '7': [
  469. { prop: 'cId', label: 'CID' },
  470. { prop: 'ibNo', label: t('Label.IBAccount') },
  471. { prop: 'name', label: t('Label.Name') },
  472. ],
  473. '24': [
  474. { prop: 'cId', label: t('Label.CidAccount') },
  475. { prop: 'ticket', label: t('Label.OrderNumber') },
  476. { prop: 'login', label: t('Label.TradingAccount') },
  477. ],
  478. }))
  479. return { columnList, mobileList, platformOptions, customTypeList, groupCurrency1, groupTypeName }
  480. }