li.shaoyi 7 miesięcy temu
rodzic
commit
8ac3cd8be9

+ 11 - 12
src/packages/pc/router/index.ts

@@ -1,5 +1,5 @@
 import { createWebHashHistory, RouteRecordRaw } from 'vue-router'
-import { useLoginStore, useRouterStore } from '@/stores'
+import { useLoginStore, useRouterStore, i18n } from '@/stores'
 import dynamicRouter from './dynamicRouter'
 import historyRouter from './historyRouter'
 import service from '@/services'
@@ -79,42 +79,41 @@ const router = historyRouter.create({
 
 // 路由跳转拦截
 router.beforeEach((to, from, next) => {
-    const isLoginOrRegister = to.name === 'login' || to.name === 'register';
-    const title = to.meta.title;
-    document.title = title ? `MTP - ${title}` : 'MTP';
+    const isLoginOrRegister = to.name === 'login' || to.name === 'register'
+    document.title = i18n.global.t('app.name')
 
     // 判断服务是否加载完成
     if (service.isReady) {
         if (loginStore.token) {
             if (dynamicRouter.isReady) {
                 if (isLoginOrRegister) {
-                    next('/');
+                    next('/')
                 } else {
-                    next();
+                    next()
                 }
             } else {
                 // 注册动态路由
-                dynamicRouter.registerRoutes();
-                next({ ...to, replace: true });
+                dynamicRouter.registerRoutes()
+                next({ ...to, replace: true })
             }
         } else {
             if (isLoginOrRegister) {
-                next();
+                next()
             } else {
                 next({
                     name: 'login',
                     query: { redirect: to.fullPath },
-                });
+                })
             }
         }
     } else {
         if (to.name === 'boot' || to.name === 'login') {
-            next();
+            next()
         } else {
             next({
                 name: 'boot',
                 query: { redirect: to.fullPath },
-            });
+            })
         }
     }
 })

+ 26 - 21
src/packages/pc/views/report/instprofitshare/index.vue

@@ -32,14 +32,16 @@
             </app-filter>
         </template>
         <app-table :data="dataList" :columns="tableColumns" :loading="loading" :highlight-current-row="false"
-            :span-method="objectSpanMethod" :summary-method="getSummaries" show-summary>
+            :span-method="arraySpanMethod" :summary-method="getSummaries" show-summary>
             <template #headerLeft>
                 <app-operation :data-list="getActionButtons(['query_internal_profitshare_export'])"
                     @click="(code: string) => openComponent(code)" />
             </template>
             <!-- 商品/市场 -->
-            <template #goodsname="{ row }">
-                <el-link type="primary" @click="openComponent('Details', row)">{{ row.goodsname }}</el-link>
+            <template #goodscode="{ row }">
+                <el-link type="primary" @click="openComponent('Details', row)">
+                    {{ row.goodscode || row.goodsid }}
+                </el-link>
             </template>
         </app-table>
         <component :is="componentMap.get(componentId)" v-bind="{ record, queryParams }" @closed="closeComponent"
@@ -86,23 +88,6 @@ const { dataList, loading, run } = useRequest(shareAmountQuery, {
     }
 })
 
-// 计算行合并值
-const objectSpanMethod = (data: { rowIndex: number; columnIndex: number; }) => {
-    if (data.columnIndex < 2) {
-        if (data.rowIndex === 0) {
-            return {
-                rowspan: dataList.value.length,
-                colspan: 1,
-            }
-        } else {
-            return {
-                rowspan: 0,
-                colspan: 0,
-            }
-        }
-    }
-}
-
 const { queryParams, filterOption, getQueryParams, resetFilters } = useDataFilter<Model.ShareAmountQueryReq>({
     filters: [
         {
@@ -162,10 +147,30 @@ const dateFormat = computed(() => {
     }
 })
 
+// 计算行合并值
+const arraySpanMethod = (data: { row: Model.ShareAmountQueryRsp; rowIndex: number; columnIndex: number; }) => {
+    if (data.columnIndex < 2) {
+        let rowspan = 1
+        // 统计当前行与后续行中相同名称的数量
+        for (let i = data.rowIndex + 1; i < dataList.value.length; i++) {
+            if (dataList.value[i].areatype === data.row.areatype) {
+                rowspan++
+            } else {
+                break
+            }
+        }
+        // 如果上一行和当前行名称相同
+        if (data.rowIndex > 0 && dataList.value[data.rowIndex - 1].areatype === data.row.areatype) {
+            return [0, 0] // 隐藏单元格
+        }
+        return [rowspan, 1] // 合并行数,列数保持为 1
+    }
+}
+
 const tableColumns = ref<Model.TableColumn[]>([
     { field: 'areatype', label: 'report.instprofitshare.areatype', formatValue: (val) => roleTypeEnum.getEnumTypeName(val) },
     { field: 'areaaccountid', label: 'report.instprofitshare.areaaccountid' },
-    { field: 'goodsname', label: 'report.instprofitshare.goodsname' },
+    { field: 'goodscode', label: 'report.instprofitshare.goodsname' },
     { field: 'tradefeetype', label: 'report.instprofitshare.searchtype', formatValue: (val) => divideFeekindEnum.getEnumTypeName(val) },
     { field: 'totalcount', label: 'report.instprofitshare.totalcount' },
     { field: 'totalfee', label: 'report.instprofitshare.totalfee' },

+ 19 - 14
src/packages/pc/views/report/profitshare/components/details/index.vue

@@ -3,7 +3,7 @@
     <teleport to="#appPageTeleport">
         <app-view>
             <app-table :data="dataList" :columns="tableColumns" :loading="loading" :highlight-current-row="false"
-                :span-method="objectSpanMethod" :summary-method="getSummaries" show-summary>
+                :span-method="arraySpanMethod" :summary-method="getSummaries" show-summary>
                 <template #headerLeft>
                     <span>{{ `${formatDate}【${record.areaname}】分润明细月报表` }}</span>
                 </template>
@@ -13,8 +13,10 @@
                     </div>
                 </template>
                 <!-- 商品/市场 -->
-                <template #goodsname="{ row }">
-                    <el-link type="primary" @click="showComponent('Details', row)">{{ row.goodsname }}</el-link>
+                <template #goodscode="{ row }">
+                    <el-link type="primary" @click="showComponent('Details', row)">
+                        {{ row.goodscode || row.goodsid }}
+                    </el-link>
                 </template>
             </app-table>
             <component ref="componentRef" :is="componentMap.get(componentId)" v-bind="componentProps"
@@ -82,26 +84,29 @@ const { dataList, loading } = useRequest(shareAmountQuery, {
 })
 
 // 计算行合并值
-const objectSpanMethod = (data: { rowIndex: number; columnIndex: number; }) => {
+const arraySpanMethod = (data: { row: Model.ShareAmountQueryRsp; rowIndex: number; columnIndex: number; }) => {
     if (data.columnIndex < 2) {
-        if (data.rowIndex === 0) {
-            return {
-                rowspan: dataList.value.length,
-                colspan: 1,
-            }
-        } else {
-            return {
-                rowspan: 0,
-                colspan: 0,
+        let rowspan = 1
+        // 统计当前行与后续行中相同名称的数量
+        for (let i = data.rowIndex + 1; i < dataList.value.length; i++) {
+            if (dataList.value[i].areatype === data.row.areatype) {
+                rowspan++
+            } else {
+                break
             }
         }
+        // 如果上一行和当前行名称相同
+        if (data.rowIndex > 0 && dataList.value[data.rowIndex - 1].areatype === data.row.areatype) {
+            return [0, 0] // 隐藏单元格
+        }
+        return [rowspan, 1] // 合并行数,列数保持为 1
     }
 }
 
 const tableColumns = ref<Model.TableColumn[]>([
     { field: 'areatype', label: 'report.profitshare.areatype', formatValue: (val) => roleTypeEnum.getEnumTypeName(val) },
     { field: 'areaaccountid', label: 'report.profitshare.areaaccountid' },
-    { field: 'goodsname', label: 'report.profitshare.goodsname' },
+    { field: 'goodscode', label: 'report.profitshare.goodsname' },
     { field: 'tradefeetype', label: 'report.profitshare.searchtype', formatValue: (val) => divideFeekindEnum.getEnumTypeName(val) },
     { field: 'totalcount', label: 'report.profitshare.totalcount' },
     { field: 'totalfee', label: 'report.profitshare.totalfee' },

+ 22 - 1
src/packages/pc/views/report/profitshare/index.vue

@@ -37,7 +37,8 @@
                 </template>
             </app-filter>
         </template>
-        <app-table :data="dataList" :columns="tableColumns" :loading="loading">
+        <app-table :data="dataList" :columns="tableColumns" :loading="loading" :highlight-current-row="false"
+            :span-method="arraySpanMethod">
             <template #headerLeft>
                 <app-operation :data-list="getActionButtons(['query_internal_profitshare_export'])"
                     @click="(code: string) => openComponent(code)" />
@@ -148,6 +149,26 @@ const dateFormat = computed(() => {
     }
 })
 
+// 计算行合并值
+const arraySpanMethod = (data: { row: Model.ShareAmountQueryPlatRsp; rowIndex: number; columnIndex: number; }) => {
+    if (data.columnIndex === 0) {
+        let rowspan = 1
+        // 统计当前行与后续行中相同名称的数量
+        for (let i = data.rowIndex + 1; i < dataList.value.length; i++) {
+            if (dataList.value[i].areaname === data.row.areaname) {
+                rowspan++
+            } else {
+                break
+            }
+        }
+        // 如果上一行和当前行名称相同
+        if (data.rowIndex > 0 && dataList.value[data.rowIndex - 1].areaname === data.row.areaname) {
+            return [0, 0] // 隐藏单元格
+        }
+        return [rowspan, 1] // 合并行数,列数保持为 1
+    }
+}
+
 const tableColumns = ref<Model.TableColumn[]>([
     { field: 'areaname', label: '会员/机构' },
     { field: 'areatype', label: 'report.profitshare.areatype', formatValue: (val) => roleTypeEnum.getEnumTypeName(val) },

+ 1 - 0
src/types/model/report.d.ts

@@ -89,6 +89,7 @@ declare namespace Model {
         areaname: string; // 会员/机构 reletype == 1
         areatype: number; // 角色
         divideamount: number; // 分润金额
+        goodscode: string;
         goodsid: number;
         goodsname: string; // 商品/市场 会员/机构 reletype != 1
         memberuserid: number;