浏览代码

增加统计排序

asd123a20 2 年之前
父节点
当前提交
3387c81914
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/views/stat/activity/index.vue

+ 5 - 0
src/views/stat/activity/index.vue

@@ -101,6 +101,11 @@ export default {
     /** 人数信息 */
     /** 人数信息 */
     async getUserList() {
     async getUserList() {
       const typeUser = await userCountByTag(this.queryParams);
       const typeUser = await userCountByTag(this.queryParams);
+      // 用户群体按字典排序
+      typeUser.data.sort((a, b) =>
+        (this.dict.type.user_tags.find(tag => tag.label === a.name)?.raw.dictSort ?? Infinity) -
+        (this.dict.type.user_tags.find(tag => tag.label === b.name)?.raw.dictSort ?? Infinity)
+      );
       const allUser = await userTotalTimesByTag(this.queryParams);
       const allUser = await userTotalTimesByTag(this.queryParams);
       const allData = [{ name: '总人次', value: allUser.data }];
       const allData = [{ name: '总人次', value: allUser.data }];
       this.userData = [ ...allData, ...typeUser?.data ];
       this.userData = [ ...allData, ...typeUser?.data ];