ljc 1 месяц назад
Родитель
Сommit
4fe56693d8
2 измененных файлов с 130 добавлено и 103 удалено
  1. 5 1
      composables/useMenuSplit.ts
  2. 125 102
      pages/ib/report.vue

+ 5 - 1
composables/useMenuSplit.ts

@@ -255,8 +255,12 @@ export function useMenuSplit(handleClick1: (item: MenuItem) => void) {
             label: 'Home.page_ib.item3',
             label: 'Home.page_ib.item3',
             icon: 'crm-newspaper',
             icon: 'crm-newspaper',
             children: [
             children: [
-                { path: '/pages/ib/report', label: 'Home.page_ib.item3', icon: 'icon-withdrawal' },
+                // { path: '/pages/ib/report', label: 'Home.page_ib.item3', icon: 'icon-withdrawal' },
                 { path: '/pages/ib/complexReport', label: 'Home.page_ib.item11', icon: 'icon-withdrawal' },
                 { path: '/pages/ib/complexReport', label: 'Home.page_ib.item11', icon: 'icon-withdrawal' },
+              { path: '/pages/ib/report?type=1', label: 'Ib.Report.Title1', icon: 'icon-withdrawal' },
+              { path: '/pages/ib/report?type=2', label: 'Ib.Report.Title2', icon: 'icon-withdrawal' },
+              { path: '/pages/ib/report?type=3', label: 'Ib.Report.Title3', icon: 'icon-withdrawal' },
+              { path: '/pages/ib/report?type=6', label: 'news_add_field.IbReport.Title6', icon: 'icon-withdrawal' },
             ],
             ],
         },
         },
       // 推广
       // 推广

+ 125 - 102
pages/ib/report.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
   <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
   <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
-    <cwg-header :title="t('Home.page_ib.item3')" />
-    <uni-loading v-if="loading" />
+    <cwg-header :title="titleList[reportType]" />
+    <uni-loading v-if="loading"/>
     <view v-else class="account-content">
     <view v-else class="account-content">
       <view class="search-content">
       <view class="search-content">
         <view class="search-bar">
         <view class="search-bar">
@@ -19,15 +19,16 @@
 </template>
 </template>
 
 
 <script setup lang="ts">
 <script setup lang="ts">
-// 报告
-import { ref, computed, onMounted, watch, nextTick } from 'vue'
-import { useI18n } from 'vue-i18n'
-import Config from '@/config/index'
-import { ibApi } from '@/service/ib'
-import { useReportConst } from '@/pages/ib/const/report'
-import { useFilters } from '@/composables/useFilters'
-import { isAfterJuly28 } from '@/utils/dateUtils'
-import useUserStore from '@/stores/use-user-store'
+  // 报告
+  import { ref, computed, onMounted, watch, nextTick } from 'vue'
+  import { useI18n } from 'vue-i18n'
+  import { onLoad } from '@dcloudio/uni-app'
+  import Config from '@/config/index'
+  import { ibApi } from '@/service/ib'
+  import { useReportConst } from '@/pages/ib/const/report'
+  import { useFilters } from '@/composables/useFilters'
+  import { isAfterJuly28 } from '@/utils/dateUtils'
+  import useUserStore from '@/stores/use-user-store'
 
 
 const { numberFormat } = useFilters()
 const { numberFormat } = useFilters()
 const { t } = useI18n()
 const { t } = useI18n()
@@ -37,18 +38,26 @@ const { userInfo } = useUserStore()
 const tableRef = ref(null)
 const tableRef = ref(null)
 const loading = ref(false)
 const loading = ref(false)
 
 
-const typeList = computed(() => [
-  { text: t('Ib.Report.Title1'), value: 1 },
-  { text: t('Ib.Report.Title2'), value: 2 },
-  { text: t('Ib.Report.Title3'), value: 3 },
-  { text: t('Ib.Report.Title6'), value: 4 },
-  // 新增代理
-  // { text: t('Ib.Report.Title5'), value: 5 },
-  { text: t('news_add_field.IbReport.Title6'), value: 6 },
-  { text: t('Ib.Report.Title7'), value: 7 },
-  //  加点报告
-  // { text: t('Ib.Report.Title8'), value: 24 },
-])
+  const typeList = computed(() => [
+    { text: t('Ib.Report.Title1'), value: 1 },
+    { text: t('Ib.Report.Title2'), value: 2 },
+    { text: t('Ib.Report.Title3'), value: 3 },
+    // { text: t('Ib.Report.Title6'), value: 4 },
+    // 新增代理
+    // { text: t('Ib.Report.Title5'), value: 5 },
+    { text: t('news_add_field.IbReport.Title6'), value: 6 },
+    // { text: t('Ib.Report.Title7'), value: 7 },
+    //  加点报告
+    // { text: t('Ib.Report.Title8'), value: 24 },
+  ])
+  const titleList = computed(() => {
+    return {
+      1: t('Ib.Report.Title1'),
+      2: t('Ib.Report.Title2'),
+      3: t('Ib.Report.Title3'),
+      6: t('news_add_field.IbReport.Title6'),
+    }
+  })
 
 
 const detailTypeList = computed(() => [
 const detailTypeList = computed(() => [
   { text: t('Ib.Report.Tit1'), value: 1 },
   { text: t('Ib.Report.Tit1'), value: 1 },
@@ -69,33 +78,33 @@ const month = String(now.getMonth() + 1).padStart(2, '0')
 const day = String(now.getDate()).padStart(2, '0')
 const day = String(now.getDate()).padStart(2, '0')
 const defaultDateRange = [`${year}-${month}-01`, `${year}-${month}-${day}`]
 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 reportType = ref(1)
+
+  const searchParams = ref<any>({
+    detail_type: null,
+    customType: 0,
+    platform: 'MT4',
+    agentId: '',
+    login: '',
+    cId: '',
+    isShort: 0,
+    date: defaultDateRange,
+  })
 
 
 const filterFields = ref([])
 const filterFields = ref([])
 
 
-const search = ref({
-  reportType: 1,
-  detail_type: null as number | null,
-  customType: 0,
-  platform: 'MT4',
-  startDate: defaultDateRange[0],
-  endDate: defaultDateRange[1],
-  date: defaultDateRange,
-  agentId: '',
-  login: '',
-  cId: '',
-  isShort: 0,
-})
+  const search = ref({
+    detail_type: null as number | null,
+    customType: 0,
+    platform: 'MT4',
+    startDate: defaultDateRange[0],
+    endDate: defaultDateRange[1],
+    date: defaultDateRange,
+    agentId: '',
+    login: '',
+    cId: '',
+    isShort: 0,
+  })
 
 
 const country = computed(() => {
 const country = computed(() => {
   return userInfo.customInfo.country
   return userInfo.customInfo.country
@@ -237,8 +246,10 @@ const getSummaries = (param: any) => {
   return sums
   return sums
 }
 }
 
 
-const handleSearch = (params: any) => {
-  const payload: any = { ...params }
+  const handleSearch = (params: any) => {
+    console.log(params,'params')
+    // 默认类型为页面参数
+    const payload: any = { ...params,reportType: reportType.value }
 
 
   let finalAgentId = payload.agentId_0
   let finalAgentId = payload.agentId_0
   for (let i = agentLevels.value.length - 1; i >= 0; i--) {
   for (let i = agentLevels.value.length - 1; i >= 0; i--) {
@@ -308,38 +319,42 @@ const initIbTree = async () => {
   }
   }
 }
 }
 
 
-// 表格列配置 根据types 切换
-const columns = computed(() => {
-  if (search.value.reportType === 3) {
-    return columnList.value[`3_${search.value.detail_type}`] || []
-  }
-  return columnList.value[search.value.reportType] || []
-})
+  // 表格列配置 根据types 切换
+  const columns = computed(() => {
+    console.log(reportType.value,'23')
 
 
-const mobilePrimaryFields = computed(() => {
-  let list: any[] = []
-  if (search.value.reportType === 3) {
-    list = mobileList.value[`3_${search.value.detail_type}`] || []
-  } else {
-    list = mobileList.value[search.value.reportType] || []
-  }
-  return [
-    ...list,
-    {
-      prop: 'more',
-      type: 'more',
-      width: 20,
-      align: 'right',
-    },
-  ]
-})
+    if (reportType.value == 3) {
+      console.log(columnList.value[`3_${search.value.detail_type}`])
+      return columnList.value[`3_${search.value.detail_type}`] || []
+    }
+    console.log(columnList.value[reportType.value])
+    return columnList.value[reportType.value] || []
+  })
 
 
-// 接口 根据types 切换(动态代理不同类型报表API)
-const listApi = computed(() => {
-  return async (params: any) => {
-    let apiFn = ibApi.tradeDw
-    const type = search.value.reportType
-    const detailType = search.value.detail_type
+  const mobilePrimaryFields = computed(() => {
+    let list: any[] = []
+    if (reportType.value === 3) {
+      list = mobileList.value[`3_${search.value.detail_type}`] || []
+    } else {
+      list = mobileList.value[reportType.value] || []
+    }
+    return [
+      ...list,
+      {
+        prop: 'more',
+        type: 'more',
+        width: 20,
+        align: 'right',
+      },
+    ]
+  })
+
+  // 接口 根据types 切换(动态代理不同类型报表API)
+  const listApi = computed(() => {
+    return async (params: any) => {
+      let apiFn = ibApi.tradeDw
+      const type = reportType.value
+      const detailType = search.value.detail_type
 
 
     if (type == 1) apiFn = ibApi.tradeDw
     if (type == 1) apiFn = ibApi.tradeDw
     else if (type == 2) apiFn = ibApi.tradeAgentCommission
     else if (type == 2) apiFn = ibApi.tradeAgentCommission
@@ -394,29 +409,37 @@ watch(() => searchParams.value.customType, (val) => {
   search.value.customType = val
   search.value.customType = val
 })
 })
 
 
-watch(() => searchParams.value.isShort, (val) => {
-  search.value.isShort = val
-})
-
-onMounted(async () => {
-  loading.value = true
-  await initIbTree()
-  setFields()
-  loading.value = false
-})
-const setFields = () => {
-  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,
-    },
-  ]
+  watch(() => searchParams.value.isShort, (val) => {
+    search.value.isShort = val
+  })
+  onLoad((options) => {
+    console.log(options?.type,'type')
+    // search.value.reportType = options?.type;
+    // searchParams.value.reportType = options?.type;
+    reportType.value = options?.type
+    nextTick(()=>{
+      setFields()
+    })
+  });
+  onMounted(async () => {
+    loading.value = true
+    await initIbTree()
+    loading.value = false
+  })
+  const setFields = () => {
+    const type = Number(reportType.value ?? 1)
+    const fields = []
+    // const fields: any[] = [
+    //   {
+    //     key: 'reportType',
+    //     type: 'select',
+    //     label: t('Home.page_ib.item3'),
+    //     placeholder: t('placeholder.choose'),
+    //     options: typeList.value,
+    //     defaultValue: 1,
+    //     isSelect: true,
+    //   },
+    // ]
 
 
   if (type === 3) {
   if (type === 3) {
     fields.push({
     fields.push({