|
@@ -5,49 +5,7 @@
|
|
|
<view class="account-content">
|
|
<view class="account-content">
|
|
|
<view class="search-content">
|
|
<view class="search-content">
|
|
|
<view class="search-bar">
|
|
<view class="search-bar">
|
|
|
- <cwg-combox v-model:value="search.reportType" :options="typeList"
|
|
|
|
|
- :placeholder="t('placeholder.choose')" />
|
|
|
|
|
- <cwg-combox v-if="search.reportType == 3" v-model:value="search.detail_type" :options="detailTypeList"
|
|
|
|
|
- :placeholder="t('placeholder.choose')" />
|
|
|
|
|
- <view v-if="[1,3,4,7,24].includes(search.reportType)" class="report-platform">
|
|
|
|
|
- <view
|
|
|
|
|
- v-for="(item,index) in platformOptions"
|
|
|
|
|
- :key="index"
|
|
|
|
|
- class="checklist-box"
|
|
|
|
|
- :class="{
|
|
|
|
|
- 'active': item.value === search.platform,
|
|
|
|
|
- }"
|
|
|
|
|
- @click="changePlatformType(item.value)"
|
|
|
|
|
- >
|
|
|
|
|
- {{ item.text }}
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- <cwg-combox v-if="search.reportType == 24" v-model:value="search.customType" :options="customTypeList"
|
|
|
|
|
- :placeholder="t('placeholder.choose')" />
|
|
|
|
|
-
|
|
|
|
|
- <uni-data-picker class="agent-select" v-model="search.agentId" :localdata="agentIdOpts"
|
|
|
|
|
- :popup-title="t('State.All')" @change="handleItemChange" @nodeclick="onnodeclick"
|
|
|
|
|
- :map="{value:'value',text:'label'}"></uni-data-picker>
|
|
|
|
|
-
|
|
|
|
|
- <view class="search-input-box">
|
|
|
|
|
- <uni-easyinput v-if="['1', '2', '3', '4', '7'].includes(String(search.reportType))"
|
|
|
|
|
- v-model.trim="search.login" :placeholder="t('Label.TradingAccount')" />
|
|
|
|
|
- </view>
|
|
|
|
|
-
|
|
|
|
|
- <view class="search-input-box" v-if="search.reportType == 7">
|
|
|
|
|
- <uni-easyinput v-model.trim="search.cId" placeholder="CID" />
|
|
|
|
|
- </view>
|
|
|
|
|
-
|
|
|
|
|
- <cwg-combox v-if="search.reportType == 3 || search.reportType == 7" v-model:value="search.isShort"
|
|
|
|
|
- :options="isShortList" :placeholder="t('placeholder.choose')" />
|
|
|
|
|
-
|
|
|
|
|
- <uni-datetime-picker type="daterange" v-model="search.date"
|
|
|
|
|
- :placeholder="t('placeholder.Start') + ' - ' + t('placeholder.End')"
|
|
|
|
|
- @change="handleDateChange" />
|
|
|
|
|
- <button class="search-btn" @click="toSearch">{{ t('Ib.Report.Btn') }}</button>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view>
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <cwg-complex-search :fields="filterFields" v-model="searchParams" @search="handleSearch" @reset="handleReset" />
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
@@ -69,8 +27,7 @@
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
// 报告
|
|
// 报告
|
|
|
- import { ref, reactive, computed, onMounted, watch } from 'vue'
|
|
|
|
|
- import { onLoad } from '@dcloudio/uni-app'
|
|
|
|
|
|
|
+ import { ref, computed, onMounted, watch } from 'vue'
|
|
|
import { useI18n } from 'vue-i18n'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
import Config from '@/config/index'
|
|
import Config from '@/config/index'
|
|
|
import { ibApi } from '@/service/ib'
|
|
import { ibApi } from '@/service/ib'
|
|
@@ -80,8 +37,7 @@
|
|
|
import useUserStore from '@/stores/use-user-store'
|
|
import useUserStore from '@/stores/use-user-store'
|
|
|
|
|
|
|
|
const { numberFormat } = useFilters()
|
|
const { numberFormat } = useFilters()
|
|
|
- const { t, locale } = useI18n()
|
|
|
|
|
- const lang = locale.value
|
|
|
|
|
|
|
+ const { t } = useI18n()
|
|
|
let { Code } = Config
|
|
let { Code } = Config
|
|
|
const { userInfo } = useUserStore()
|
|
const { userInfo } = useUserStore()
|
|
|
const tableRef = ref(null)
|
|
const tableRef = ref(null)
|
|
@@ -110,14 +66,31 @@
|
|
|
{ text: t('Ib.Report.item2'), value: 2 },
|
|
{ text: t('Ib.Report.item2'), value: 2 },
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
|
|
+ const now = new Date()
|
|
|
|
|
+ const year = now.getFullYear()
|
|
|
|
|
+ const month = String(now.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
+ const day = String(now.getDate()).padStart(2, '0')
|
|
|
|
|
+ const defaultDateRange = [`${year}-${month}-01`, `${year}-${month}-${day}`]
|
|
|
|
|
+
|
|
|
|
|
+ const searchParams = ref<any>({
|
|
|
|
|
+ reportType: 1,
|
|
|
|
|
+ detail_type: null,
|
|
|
|
|
+ customType: 0,
|
|
|
|
|
+ platform: 'MT4',
|
|
|
|
|
+ agentId: '',
|
|
|
|
|
+ login: '',
|
|
|
|
|
+ cId: '',
|
|
|
|
|
+ isShort: 0,
|
|
|
|
|
+ date: defaultDateRange,
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
const search = ref({
|
|
const search = ref({
|
|
|
reportType: 1,
|
|
reportType: 1,
|
|
|
detail_type: null as number | null,
|
|
detail_type: null as number | null,
|
|
|
customType: 0,
|
|
customType: 0,
|
|
|
platform: 'MT4',
|
|
platform: 'MT4',
|
|
|
- date: [] as string[],
|
|
|
|
|
- startDate: '',
|
|
|
|
|
- endDate: '',
|
|
|
|
|
|
|
+ startDate: defaultDateRange[0],
|
|
|
|
|
+ endDate: defaultDateRange[1],
|
|
|
agentId: '',
|
|
agentId: '',
|
|
|
login: '',
|
|
login: '',
|
|
|
cId: '',
|
|
cId: '',
|
|
@@ -136,12 +109,8 @@
|
|
|
children: [],
|
|
children: [],
|
|
|
},
|
|
},
|
|
|
])
|
|
])
|
|
|
- const toSearch = () => {
|
|
|
|
|
- tableRef.value?.refreshTable()
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- const handleItemChange = (e: any) => {
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const handleItemChange = (e: any) => {}
|
|
|
|
|
|
|
|
const getSummaries = (param: any) => {
|
|
const getSummaries = (param: any) => {
|
|
|
const { columns, summaryData } = param
|
|
const { columns, summaryData } = param
|
|
@@ -223,8 +192,55 @@
|
|
|
|
|
|
|
|
return sums
|
|
return sums
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ const normalizePickerValue = (val: any) => {
|
|
|
|
|
+ if (Array.isArray(val)) return val[val.length - 1]
|
|
|
|
|
+ return val
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const handleSearch = (params: any) => {
|
|
|
|
|
+ const payload: any = { ...params }
|
|
|
|
|
+ if (payload.date && Array.isArray(payload.date) && payload.date.length === 2) {
|
|
|
|
|
+ payload.startDate = payload.date[0]
|
|
|
|
|
+ payload.endDate = payload.date[1]
|
|
|
|
|
+ } else {
|
|
|
|
|
+ payload.startDate = ''
|
|
|
|
|
+ payload.endDate = ''
|
|
|
|
|
+ }
|
|
|
|
|
+ delete payload.date
|
|
|
|
|
+
|
|
|
|
|
+ payload.agentId = normalizePickerValue(payload.agentId)
|
|
|
|
|
+
|
|
|
|
|
+ const type = Number(payload.reportType)
|
|
|
|
|
+ if (![1, 3, 4, 7, 24].includes(type)) payload.platform = ''
|
|
|
|
|
+ if (![1, 2, 3, 4, 7].includes(type)) payload.login = ''
|
|
|
|
|
+ if (type !== 7) payload.cId = ''
|
|
|
|
|
+ if (![3, 7].includes(type)) payload.isShort = 0
|
|
|
|
|
+ if (type !== 3) payload.detail_type = null
|
|
|
|
|
+ if (type !== 24) payload.customType = 0
|
|
|
|
|
+
|
|
|
|
|
+ search.value = {
|
|
|
|
|
+ reportType: payload.reportType,
|
|
|
|
|
+ detail_type: payload.detail_type,
|
|
|
|
|
+ customType: payload.customType,
|
|
|
|
|
+ platform: payload.platform,
|
|
|
|
|
+ startDate: payload.startDate,
|
|
|
|
|
+ endDate: payload.endDate,
|
|
|
|
|
+ agentId: payload.agentId,
|
|
|
|
|
+ login: payload.login,
|
|
|
|
|
+ cId: payload.cId,
|
|
|
|
|
+ isShort: payload.isShort,
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ tableRef.value?.refreshTable?.()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const handleReset = (emptyParams: any) => {
|
|
|
|
|
+ handleSearch(emptyParams)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const initIbTree = async () => {
|
|
const initIbTree = async () => {
|
|
|
- const res = await ibApi.ibTree({ pid: val })
|
|
|
|
|
|
|
+ const res = await ibApi.ibTree({ pid: 0 })
|
|
|
|
|
|
|
|
if (res.code === Code.StatusOK) {
|
|
if (res.code === Code.StatusOK) {
|
|
|
if (res.data && res.data.length > 0) {
|
|
if (res.data && res.data.length > 0) {
|
|
@@ -346,20 +362,6 @@
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- const handleDateChange = (val: any) => {
|
|
|
|
|
- if (val && val.length === 2) {
|
|
|
|
|
- search.value.startDate = val[0]
|
|
|
|
|
- search.value.endDate = val[1]
|
|
|
|
|
- } else {
|
|
|
|
|
- search.value.startDate = ''
|
|
|
|
|
- search.value.endDate = ''
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const changePlatformType = (type: string) => {
|
|
|
|
|
- search.value.platform = type
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
const groupCurrency1 = (type: string) => {
|
|
const groupCurrency1 = (type: string) => {
|
|
|
if (type == 'GBP') return '£'
|
|
if (type == 'GBP') return '£'
|
|
|
if (type == 'USD') return '$'
|
|
if (type == 'USD') return '$'
|
|
@@ -379,31 +381,89 @@
|
|
|
return '--'
|
|
return '--'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- watch(() => search.value.reportType, (val) => {
|
|
|
|
|
- if (val == 24) {
|
|
|
|
|
|
|
+ watch(() => searchParams.value.reportType, (val) => {
|
|
|
|
|
+ const type = Number(val)
|
|
|
|
|
+ search.value.reportType = type
|
|
|
|
|
+ if (type === 24) {
|
|
|
|
|
+ searchParams.value.customType = 0
|
|
|
|
|
+ searchParams.value.detail_type = null
|
|
|
search.value.customType = 0
|
|
search.value.customType = 0
|
|
|
search.value.detail_type = null
|
|
search.value.detail_type = null
|
|
|
- } else if (val == 3) {
|
|
|
|
|
- search.value.detail_type = 1
|
|
|
|
|
|
|
+ } else if (type === 3) {
|
|
|
|
|
+ if (searchParams.value.detail_type == null) searchParams.value.detail_type = 1
|
|
|
|
|
+ if (search.value.detail_type == null) search.value.detail_type = 1
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ searchParams.value.detail_type = null
|
|
|
search.value.detail_type = null
|
|
search.value.detail_type = null
|
|
|
|
|
+ searchParams.value.customType = 0
|
|
|
|
|
+ search.value.customType = 0
|
|
|
}
|
|
}
|
|
|
|
|
+ }, { immediate: true })
|
|
|
|
|
+
|
|
|
|
|
+ watch(() => searchParams.value.detail_type, (val) => {
|
|
|
|
|
+ search.value.detail_type = val == null ? null : Number(val)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ watch(() => searchParams.value.platform, (val) => {
|
|
|
|
|
+ search.value.platform = val
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ watch(() => searchParams.value.customType, (val) => {
|
|
|
|
|
+ search.value.customType = val
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ watch(() => searchParams.value.isShort, (val) => {
|
|
|
|
|
+ search.value.isShort = val
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
initIbTree()
|
|
initIbTree()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const filterFields = computed(() => {
|
|
|
|
|
+ const type = Number(searchParams.value.reportType ?? 1)
|
|
|
|
|
+ const fields: any[] = [
|
|
|
|
|
+ { key: 'reportType', type: 'select', label: t('Home.page_ib.item3'), placeholder: t('placeholder.choose'), options: typeList.value, defaultValue: 1, isSelect: true },
|
|
|
|
|
+ ]
|
|
|
|
|
|
|
|
- // 默认当月时间
|
|
|
|
|
- const now = new Date()
|
|
|
|
|
- const year = now.getFullYear()
|
|
|
|
|
- let month: string | number = now.getMonth() + 1
|
|
|
|
|
- if (month < 10) month = '0' + month
|
|
|
|
|
- const day = now.getDate()
|
|
|
|
|
- let dayStr = day < 10 ? '0' + day : day.toString()
|
|
|
|
|
- search.value.date = [`${year}-${month}-01`, `${year}-${month}-${dayStr}`]
|
|
|
|
|
- search.value.startDate = search.value.date[0]
|
|
|
|
|
- search.value.endDate = search.value.date[1]
|
|
|
|
|
|
|
+ if (type === 3) {
|
|
|
|
|
+ fields.push({ key: 'detail_type', type: 'select', label: t('placeholder.choose'), placeholder: t('placeholder.choose'), options: detailTypeList.value, defaultValue: 1, isSelect: true })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ([1, 3, 4, 7, 24].includes(type)) {
|
|
|
|
|
+ fields.push({ key: 'platform', type: 'select', label: t('Label.Platform'), placeholder: t('placeholder.choose'), options: platformOptions, defaultValue: 'MT4' })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (type === 24) {
|
|
|
|
|
+ fields.push({ key: 'customType', type: 'select', label: t('placeholder.choose'), placeholder: t('placeholder.choose'), options: customTypeList, defaultValue: 0, isSelect: true })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ fields.push({
|
|
|
|
|
+ key: 'agentId',
|
|
|
|
|
+ type: 'picker',
|
|
|
|
|
+ label: t('State.All'),
|
|
|
|
|
+ options: agentIdOpts.value,
|
|
|
|
|
+ popupTitle: t('State.All'),
|
|
|
|
|
+ map: { value: 'value', text: 'label' },
|
|
|
|
|
+ onChange: handleItemChange,
|
|
|
|
|
+ onNodeClick: onnodeclick,
|
|
|
|
|
+ defaultValue: '',
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ if ([1, 2, 3, 4, 7].includes(type)) {
|
|
|
|
|
+ fields.push({ key: 'login', type: 'input', label: t('Label.TradingAccount'), placeholder: t('Label.TradingAccount'), defaultValue: '' })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (type === 7) {
|
|
|
|
|
+ fields.push({ key: 'cId', type: 'input', label: 'CID', placeholder: 'CID', defaultValue: '' })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ([3, 7].includes(type)) {
|
|
|
|
|
+ fields.push({ key: 'isShort', type: 'select', label: t('placeholder.choose'), placeholder: t('placeholder.choose'), options: isShortList.value, defaultValue: 0, isSelect: true })
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ fields.push({ key: 'date', label: t('placeholder.Start') + ' - ' + t('placeholder.End'), type: 'daterange' })
|
|
|
|
|
+ return fields
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
@@ -460,4 +520,4 @@
|
|
|
line-height: px2rpx(36);
|
|
line-height: px2rpx(36);
|
|
|
margin: 0;
|
|
margin: 0;
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|