zhengyiming
1 天以前 a441299ebbfca9567ced69f669f68569b6f7ca0c
fix: 修改数据看板
3个文件已修改
38 ■■■■ 已修改文件
src/utils/common/common.ts 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/DataBoard/DataBoardHome.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/DataBoard/hooks/index.ts 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/common/common.ts
@@ -87,6 +87,31 @@
    if (!realPhoneNumber) return '';
    return realPhoneNumber.replace(/^(\d{3})(\d*)(\d{4})$/, '$1 $2 $3');
  }
  /**
   * 字符串脱敏:中间替换为*
   * @param {string} str - 待处理的字符串
   */
  static maskString({ str, start = 3, end = 2 }: { str: string; start?: number; end?: number }) {
    // 空值/非字符串处理
    if (!str || typeof str !== 'string') return str || '';
    const len = str.length;
    // 边界场景:长度≤5时,无需替换(前3+后2已覆盖全部字符)
    if (len <= 5) return str;
    // 截取前3个字符
    const prefix = str.slice(0, start);
    // 截取后2个字符
    const suffix = str.slice(-end);
    // 中间需要替换的长度 = 总长度 - 前3 - 后2
    const middleLength = len - start - end;
    // 生成对应长度的*
    const middle = '*'.repeat(middleLength);
    // 拼接结果
    return prefix + middle + suffix;
  }
}
export function paginateList<T>(list: T[], pageIndex: number, pageSize: number) {
src/views/DataBoard/DataBoardHome.vue
@@ -46,7 +46,7 @@
          </div>
        </div>
        <div class="data-board-home-content-right">
          <DataBoardContentItem title="交易Top5企业">
          <DataBoardContentItem title="交易Top企业">
            <DataBoardTableView
              :tableData="dataBoardOutputValueRankList"
              unit="元"
@@ -54,14 +54,14 @@
              customerName="交易额"
            ></DataBoardTableView>
          </DataBoardContentItem>
          <DataBoardContentItem title="劳务人员Top5企业">
          <DataBoardContentItem title="劳务人员Top企业">
            <DataBoardTableView
              :tableData="enterpriseClientUserRankList"
              unit="人"
              customerName="人员数量"
            ></DataBoardTableView>
          </DataBoardContentItem>
          <DataBoardContentItem title="平台消费Top5企业" :hasBottom="false">
          <DataBoardContentItem title="平台消费Top企业" :hasBottom="false">
            <DataBoardTableView
              :tableData="bountyUseAmountRankList"
              unit="元"
src/views/DataBoard/hooks/index.ts
@@ -1,6 +1,7 @@
import { useQuery } from '@tanstack/vue-query';
import { useIntervalFn } from '@vueuse/core';
import * as dataBoardServices from '@/services/api/DataBoard';
import { StringUtils } from '@/utils';
export function useIntervalValue<T>(initValue: T) {
  const value = ref(initValue);
@@ -157,7 +158,7 @@
  const bountyUseAmountRankList = computed(() =>
    detail.value.items?.map((x) => ({
      name: x.enterpriseName,
      name: StringUtils.maskString({ str: x.enterpriseName }),
      value: x.amount,
    }))
  );
@@ -291,7 +292,7 @@
  const dataBoardOutputValueRankList = computed(() =>
    detail.value.items?.map((x) => ({
      name: x.enterpriseName,
      name: StringUtils.maskString({ str: x.enterpriseName }),
      value: x.outputValue,
    }))
  );
@@ -320,7 +321,7 @@
  const enterpriseClientUserRankList = computed(() =>
    detail.value.items?.map((x) => ({
      name: x.enterpriseName,
      name: StringUtils.maskString({ str: x.enterpriseName }),
      value: x.count,
    }))
  );