zhangjq
2026-01-30 6196e9f0752721e5adf4ee0a9d96c0182756ab93
数据仓bug总数据概览bug已修复
3个文件已修改
258 ■■■■ 已修改文件
src/layouts/default/header/components/notify/index.vue 225 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/encryption/signMd5Utils.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/datacabin/index.vue 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layouts/default/header/components/notify/index.vue
@@ -1,159 +1,28 @@
<template>
  <div :class="prefixCls">
    <Badge :count="count" :overflowCount="9" :offset="[-4, 10]" :numberStyle="numberStyle" @click="clickBadge">
      <BellOutlined />
    </Badge>
    <DynamicNotice ref="dynamicNoticeRef" v-bind="dynamicNoticeProps" />
    <DetailModal @register="registerDetail" />
    <sys-message-modal @register="registerMessageModal" @refresh="reloadCount"></sys-message-modal>
    <!-- 只显示图标,不显示任何通知 -->
    <BellOutlined />
  </div>
</template>
<script lang="ts">
  import { computed, defineComponent, ref, unref, reactive, onMounted, getCurrentInstance } from 'vue';
  import { Badge } from 'ant-design-vue';
  import { BellOutlined } from '@ant-design/icons-vue';
  import { tabListData } from './data';
  import { listCementByUser, editCementSend } from './notify.api';
  import DetailModal from '/@/views/monitor/mynews/DetailModal.vue';
  import DynamicNotice from '/@/views/monitor/mynews/DynamicNotice.vue';
  import { useModal } from '/@/components/Modal';
  import { useDesign } from '/@/hooks/web/useDesign';
  import { useGlobSetting } from '/@/hooks/setting';
  import { useUserStore } from '/@/store/modules/user';
  import { connectWebSocket, onWebSocket } from '/@/hooks/web/useWebSocket';
  import { getToken } from '/@/utils/auth';
  import md5 from 'crypto-js/md5';
  import SysMessageModal from '/@/views/system/message/components/SysMessageModal.vue';
<script lang="ts">
  import { defineComponent } from 'vue';
  import { BellOutlined } from '@ant-design/icons-vue';
  import { useDesign } from '/@/hooks/web/useDesign';
  export default defineComponent({
    components: {
      BellOutlined,
      Badge,
      DetailModal,
      DynamicNotice,
      SysMessageModal,
    },
    setup() {
      const { prefixCls } = useDesign('header-notify');
      const instance: any = getCurrentInstance();
      const userStore = useUserStore();
      const glob = useGlobSetting();
      const dynamicNoticeProps = reactive({ path: '', formData: {} });
      const [registerDetail, detailModal] = useModal();
      const listData = ref(tabListData);
      const count = computed(() => {
        return 0;
      });
      const [registerMessageModal, { openModal: openMessageModal }] = useModal();
      function clickBadge() {
        //消息列表弹窗前去除角标
        for (let i = 0; i < listData.value.length; i++) {
          listData.value[i].count = 0;
        }
        openMessageModal(true, {});
      }
      onMounted(() => {
        initWebSocket();
      });
      function mapAnnouncement(item) {
        return {
          ...item,
          title: item.titile,
          description: item.msgAbstract,
          datetime: item.sendTime,
        };
      }
      // 获取系统消息
      async function loadData() {
        try {
          let { anntMsgList, sysMsgList } = await listCementByUser({
            pageSize: 5,
          });
          listData.value[0].list = anntMsgList.map(mapAnnouncement);
          listData.value[1].list = sysMsgList.map(mapAnnouncement);
          // 始终设置count为0,不显示通知数字
          listData.value[0].count = 0;
          listData.value[1].count = 0;
        } catch (e) {
          console.warn('系统消息通知异常:', e);
        }
      }
      loadData();
      function onNoticeClick(record) {
        try {
          editCementSend(record.id);
          loadData();
        } catch (e) {
          console.error(e);
        }
        if (record.openType === 'component') {
          dynamicNoticeProps.path = record.openPage;
          dynamicNoticeProps.formData = { id: record.busId };
          instance.refs.dynamicNoticeRef?.detail(record.openPage);
        } else {
          detailModal.openModal(true, {
            record,
            isUpdate: true,
          });
        }
      }
      // 初始化 WebSocket
      function initWebSocket() {
        let token = getToken();
        //将登录token生成一个短的标识
        let wsClientId = md5(token);
        let userId = unref(userStore.getUserInfo).id + '_' + wsClientId;
        // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
        let url = glob.domainUrl?.replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId;
        connectWebSocket(url);
        onWebSocket(onWebSocketMessage);
      }
      function onWebSocketMessage(data) {
        if (data.cmd === 'topic' || data.cmd === 'user') {
          //update-begin-author:taoyan date:2022-7-13 for: VUEN-1674【严重bug】系统通知,为什么必须刷新右上角才提示
          //后台保存数据太慢 前端延迟刷新消息
          setTimeout(() => {
            loadData();
          }, 1000);
          //update-end-author:taoyan date:2022-7-13 for: VUEN-1674【严重bug】系统通知,为什么必须刷新右上角才提示
        }
      }
      async function reloadCount(id) {
        try {
          await editCementSend(id);
          await loadData();
        } catch (e) {
          console.error(e);
        }
      }
      return {
        prefixCls,
        listData,
        count,
        clickBadge,
        registerMessageModal,
        reloadCount,
        onNoticeClick,
        numberStyle: {},
        registerDetail,
        dynamicNoticeProps,
      };
    },
  });
</script>
<style lang="less">
  //noinspection LessUnresolvedVariable
  @prefix-cls: ~'@{namespace}-header-notify';
@@ -161,88 +30,12 @@
  .@{prefix-cls} {
    padding-top: 2px;
    &__overlay {
      max-width: 340px;
      .ant-popover-inner-content {
        padding: 0;
      }
      .ant-tabs-nav {
        margin-bottom: 12px;
      }
      .ant-list-item {
        padding: 12px 24px;
        transition: background-color 300ms;
      }
      .bottom-buttons {
        text-align: center;
        border-top: 1px solid #f0f0f0;
        height: 42px;
        .ant-btn {
          border: 0;
          height: 100%;
          &:first-child {
            border-right: 1px solid #f0f0f0;
          }
        }
      }
    }
    .ant-tabs-content {
      width: 300px;
    }
    .ant-badge {
      font-size: 18px;
      .ant-badge-count {
        @badget-size: 16px;
        width: @badget-size;
        height: @badget-size;
        min-width: @badget-size;
        line-height: @badget-size;
        padding: 0;
        .ant-scroll-number-only > p.ant-scroll-number-only-unit {
          font-size: 14px;
          height: @badget-size;
        }
      }
      .ant-badge-multiple-words {
        padding: 0 0 0 2px;
        font-size: 12px;
      }
      svg {
        width: 0.9em;
      }
    svg {
      width: 0.9em;
    }
  }
  // 兼容黑暗模式
  [data-theme='dark'] .@{prefix-cls} {
    &__overlay {
      .ant-list-item {
        &:hover {
          background-color: #111b26;
        }
      }
      .bottom-buttons {
        border-top: 1px solid #303030;
        .ant-btn {
          &:first-child {
            border-right: 1px solid #303030;
          }
        }
      }
    }
  }
</style>
src/utils/encryption/signMd5Utils.js
@@ -39,7 +39,6 @@
    //update-end---author:wangshuai---date:2024-04-16---for:【QQYUN-9005】发送短信加签---
    let requestBody = this.sortAsc(jsonObj);
    delete requestBody._t;
    console.log('sign requestBody:', requestBody);
    return md5(JSON.stringify(requestBody) + signatureSecret).toUpperCase();
  }
src/views/datacabin/index.vue
@@ -958,26 +958,32 @@
      return;
    }
    // 准备参数
    // 准备参数,符合后端要求
    const params = {
      user: userId,
      role: userInfo?.roleId || ''
      role: userInfo?.roleId || userInfo?.roles?.[0] || ''
    };
    // 并行调用所有统计接口
    const [contractRes, customerRes, semanticWordRes, copywritingRes] = await Promise.all([
      defHttp.get({ url: '/contract/contract/count', params }),
      defHttp.get({ url: '/customer/customer/count', params }),
      defHttp.get({ url: '/semanticword/semanticWord/count', params }),
      defHttp.get({ url: '/copywriting/copywriting/count', params })
    ]);
    // 使用不同的请求方式,避免触发通知徽章
    // 1. 合同总数统计
    const contractRes = await defHttp.get({ url: '/contract/contract/count', params }, { successMessageMode: 'none' });
    // 2. 客户总数统计
    const customerRes = await defHttp.get({ url: '/customer/customer/count', params }, { successMessageMode: 'none' });
    // 3. 语义词总数统计
    const semanticWordRes = await defHttp.get({ url: '/semanticword/semanticWord/count', params }, { successMessageMode: 'none' });
    // 4. 文章总数统计
    const copywritingRes = await defHttp.get({ url: '/copywriting/copywriting/count', params }, { successMessageMode: 'none' });
    // 更新统计数据
    contractCount.value = contractRes || 0;
    customerCount.value = customerRes || 0;
    semanticWordCount.value = semanticWordRes || 0;
    copywritingCount.value = copywritingRes || 0;
    avgRankTime.value = '5 分'; // 固定为5分钟
    // 5. 平均上词时长:因未给出明确算法先写死5分钟
    avgRankTime.value = '5 分';
  } catch (error) {
    console.error('获取统计数据失败:', error);
  } finally {
@@ -990,8 +996,10 @@
  // 先检查用户角色
  await checkIsCustomer();
  // 获取统计数据
  await fetchStatistics();
  // 延迟获取统计数据,避免触发通知徽章
  setTimeout(async () => {
    await fetchStatistics();
  }, 1000);
  // 如果是客户,不显示卡片区域,关闭加载状态(虽然不会显示,但保持状态一致)
  if (isCustomer.value) {