liyongli před 2 roky
rodič
revize
5b1b9fdd48

+ 0 - 2
src/config/index.js

@@ -13,8 +13,6 @@ if (process.env.NODE_ENV !== "development") {
   kuyunApi = base + "/cxzx-fm";
   leverAudience = base;
   //   isRelease = true;
-}else {
-    url2 = "http://172.17.17.201:9000"
 }
 
 export default {

+ 137 - 90
src/config/tableCol.js

@@ -4,7 +4,7 @@ export default {
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -17,44 +17,50 @@ export default {
       {
         label: "发稿量",
         key: "publishCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "阅读量",
         key: "readCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
-    //   {
-    //     label: "本月累计阅读量",
-    //     key: "monthReadCount",
-    //     type: 'number'
-    //   },
+      //   {
+      //     label: "本月累计阅读量",
+      //     key: "monthReadCount",
+      //     type: 'number'
+      //   },
       {
         label: "粉丝数",
         key: "fans",
-        type: 'number'
+        type: "number",
+        sortable: "custom"
       },
       {
         label: "分享量",
         key: "shareCount",
-        type: "number"
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "点赞量",
         key: "likeCount",
-        type: "number"
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "评论量",
         key: "commentCount",
-        type: "number"
+        type: "number",
+        sortable: "custom",
       },
     ],
     微信: [
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -67,39 +73,43 @@ export default {
       {
         label: "发稿量",
         key: "publishCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "阅读量",
         key: "readCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
-    //   {
-    //     label: "本月累计阅读量",
-    //     key: "monthReadCount",
-    //     type: 'number'
-    //   },
+      //   {
+      //     label: "本月累计阅读量",
+      //     key: "monthReadCount",
+      //     type: 'number'
+      //   },
       {
         label: "粉丝数",
         key: "fans",
-        type: 'number'
+        type: "number",
+        sortable: "custom"
       },
       {
         label: "分享量",
         key: "shareCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "收藏数",
         key: "favCount",
-        type: 'number'
+        type: "number",
       },
     ],
     头条: [
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -112,24 +122,26 @@ export default {
       {
         label: "发稿量",
         key: "publishCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "阅读量",
         key: "readCount",
-        type: 'number'
-      },
-    //   {
-    //     label: "本月累计阅读量",
-    //     key: "monthReadCount",
-    //     type: 'number'
-    //   },
+        type: "number",
+        sortable: "custom",
+      },
+      //   {
+      //     label: "本月累计阅读量",
+      //     key: "monthReadCount",
+      //     type: 'number'
+      //   },
     ],
     抖音: [
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -142,38 +154,43 @@ export default {
       {
         label: "发稿量",
         key: "publishCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "阅读量",
         key: "readCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
-    //   {
-    //     label: "本月累计阅读量",
-    //     key: "monthReadCount",
-    //     type: 'number'
-    //   },
+      //   {
+      //     label: "本月累计阅读量",
+      //     key: "monthReadCount",
+      //     type: 'number'
+      //   },
       {
         label: "分享量",
         key: "shareCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "点赞量",
         key: "likeCount",
-        type: 'number'
-      },
-    //   {
-    //     label: "粉丝数",
-    //     key: "fans",
-    //   },
+        type: "number",
+        sortable: "custom",
+      },
+      //   {
+      //     label: "粉丝数",
+      //     key: "fans",
+      //    sortable: "custom"
+      //   },
     ],
     快手: [
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -186,34 +203,38 @@ export default {
       {
         label: "发稿量",
         key: "publishCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "阅读量",
         key: "readCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
-    //   {
-    //     label: "本月累计阅读量",
-    //     key: "monthReadCount",
-    //     type: 'number'
-    //   },
+      //   {
+      //     label: "本月累计阅读量",
+      //     key: "monthReadCount",
+      //     type: 'number'
+      //   },
       {
         label: "评论量",
         key: "commentCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "点赞量",
         key: "likeCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
     ],
     B站: [
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -226,18 +247,20 @@ export default {
       {
         label: "发稿量",
         key: "publishCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "阅读量",
         key: "readCount",
-        type: 'number'
-      },
-    //   {
-    //     label: "本月累计阅读量",
-    //     key: "monthReadCount",
-    //     type: 'number'
-    //   },
+        type: "number",
+        sortable: "custom",
+      },
+      //   {
+      //     label: "本月累计阅读量",
+      //     key: "monthReadCount",
+      //     type: 'number'
+      //   },
     ],
   },
   list: {
@@ -245,7 +268,7 @@ export default {
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -262,33 +285,38 @@ export default {
       {
         label: "点击量",
         key: "playCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "分享量",
         key: "shareCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "点赞量",
         key: "likeCount",
-        type: "number"
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "评论量",
         key: "commentCount",
-        type: "number"
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "发布时间",
         key: "publishTime",
+        sortable: "custom",
       },
     ],
     微信: [
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -305,28 +333,32 @@ export default {
       {
         label: "转发量",
         key: "shareCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "点击量",
         key: "playCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "分享量",
         key: "shareCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "发布时间",
         key: "publishTime",
+        sortable: "custom",
       },
     ],
     头条: [
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -343,23 +375,26 @@ export default {
       {
         label: "转发量",
         key: "shareCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "点击量",
         key: "playCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "发布时间",
         key: "publishTime",
+        sortable: "custom",
       },
     ],
     抖音: [
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -376,33 +411,38 @@ export default {
       {
         label: "转发量",
         key: "shareCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "点击量",
         key: "playCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "分享量",
         key: "shareCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "点赞量",
         key: "likeCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "发布时间",
         key: "publishTime",
+        sortable: "custom",
       },
     ],
     快手: [
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -419,28 +459,32 @@ export default {
       {
         label: "点击量",
         key: "playCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "发布时间",
         key: "publishTime",
+        sortable: "custom",
       },
       {
         label: "评论量",
         key: "commentCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "点赞量",
         key: "likeCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
     ],
     B站: [
       {
         label: "排名",
         key: "index",
-        width: 50
+        width: 50,
       },
       {
         label: "部门",
@@ -457,16 +501,19 @@ export default {
       {
         label: "转发量",
         key: "shareCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "点击量",
         key: "playCount",
-        type: 'number'
+        type: "number",
+        sortable: "custom",
       },
       {
         label: "发布时间",
         key: "publishTime",
+        sortable: "custom",
       },
     ],
   },

+ 27 - 3
src/views/Department/index.vue

@@ -75,10 +75,12 @@
               backgroundColor: '#f4f5f7',
               color: '#606266',
             }"
+            ref="table1"
             align="center"
             :data="tableData"
             empty-text="暂无数据"
             style="width: 100%"
+            @sort-change="sort_change"
           >
             <template v-for="(item, i) in agg" :key="i">
               <el-table-column
@@ -87,6 +89,8 @@
                 show-overflow-tooltip
                 :prop="item.key"
                 :label="item.label"
+                :sortable="item.sortable"
+                :sort-orders="item.sortable ? ['descending', null] : []"
               >
                 <template #default="scope">
                   {{
@@ -105,10 +109,12 @@
               backgroundColor: '#f4f5f7',
               color: '#606266',
             }"
+            ref="table2"
             align="center"
             empty-text="暂无数据"
             :data="tableList"
             style="width: 100%"
+            @sort-change="sort_change"
           >
             <template v-for="(item, i) in list" :key="i">
               <el-table-column
@@ -117,6 +123,8 @@
                 show-overflow-tooltip
                 :prop="item.key"
                 :label="item.label"
+                :sortable="item.sortable"
+                :sort-orders="item.sortable ? ['descending', null] : []"
               >
                 <template #default="scope">
                   {{
@@ -154,6 +162,7 @@ import { formatter } from "@/utils/tool";
 
 import config from "@/config/index";
 let tableDataListOri = [];
+let sort = null;
 export default {
   name: "RealData",
   data() {
@@ -246,13 +255,15 @@ export default {
       };
       if (new Date(item.dt) - new Date(p.dt) < 0) p.dt = item.dt;
       this.form = p;
+      this.$refs.table1.clearSort();
+      this.$refs.table2.clearSort();
+      sort = null;
       this.onSubmit();
     },
     cChange(num) {
       this.page = num;
     },
     onExport() {
-      console.log(this.formRael);
       if (!this.formRael.dt || this.formRael.dt.length != 2) return;
       const startd = this.dateFormat(this.formRael.dt[0] || 0);
       const starte = this.dateFormat(this.formRael.dt[1] || 0);
@@ -267,11 +278,15 @@ export default {
     disabledDate(time) {
       return time.getTime() > Date.now() - 86400000;
     },
+    sort_change(type) {
+      sort = type.prop;
+      this.onSubmit();
+    },
     onSubmit() {
       const data = this.formatListData();
       this.page = 0;
       this.tableData = [];
-      this.total = [];
+      this.total = 0;
       this.load = true;
       const l = ElLoading.default.service();
       Promise.all([platform(data), platformlistData(data)])
@@ -323,7 +338,7 @@ export default {
       const loginname = JSON.parse(
         window.parent.localStorage.userinfo || "{}"
       ).loginname;
-      return {
+      const p = {
         platform: this.form.platform || this.pListData[0],
         start: startd
           ? [startd.year, startd.month, startd.day].join("-")
@@ -334,6 +349,8 @@ export default {
         match: this.form.match,
         userId: loginname,
       };
+      sort && (p.sort = sort);
+      return p;
     },
   },
   components: {},
@@ -423,4 +440,11 @@ export default {
   border-color: #fb7299;
   color: #fff;
 }
+
+.program .ascending{
+    display: none;
+}
+.program .descending{
+    top: 0.3em;
+}
 </style>

+ 5 - 12
src/views/NMedia/Overview.vue

@@ -469,20 +469,13 @@ export default {
           },
         },
         visualMap: {
-          //   min,
-          //   max: list[0].userSum,
-          //   realtime: false,
-          //   calculable: true,
-          //   inRange: {
-          //     color: ["lightskyblue", "yellow", "orangered"],
-          //   },
           type: "piecewise",
           pieces: [
-            {min: 0, max: 1000, label: "活跃用户数< 1000", color: '#02a7f0'},
-            {max: 1000, min: 2500, label: "1000<=活跃用户数< 2500", color: '#95f204'},
-            {min: 2500, max: 5000, label: "2500<=活跃用户数< 5000", color: '#ffff00'},
-            {min: 5000, max: 10000, label: "5000<= 活跃用户数< 10000", color: '#f59a23'},
-            {min: 10000, label: "活跃用户数>= 10000", color: '#d9001b'},
+            {gte: 0, lt: 1000, label: "活跃用户数< 1000", color: '#02a7f0'},
+            {gte: 1000, lt: 2500, label: "1000<=活跃用户数< 2500", color: '#95f204'},
+            {gte: 2500, lt: 5000, label: "2500<=活跃用户数< 5000", color: '#ffff00'},
+            {gte: 5000, lt: 10000, label: "5000<= 活跃用户数< 10000", color: '#f59a23'},
+            {gte: 10000, label: "活跃用户数>= 10000", color: '#d9001b'},
           ],
         },
         series: [

+ 52 - 20
src/views/ReportForm/ReportForm.vue

@@ -12,10 +12,10 @@
           <el-button
             :class="
               'colorBtn ' +
-                btnGroup[item.platform].class +
-                (form.platform == item.platform
-                  ? ' ' + btnGroup[item.platform].class + 'act'
-                  : '')
+              btnGroup[item.platform].class +
+              (form.platform == item.platform
+                ? ' ' + btnGroup[item.platform].class + 'act'
+                : '')
             "
             v-for="item in pListData"
             :key="item.platform"
@@ -56,7 +56,7 @@
           </el-date-picker>
         </el-form-item>
         <el-form-item label="关键词">
-            <el-input v-model="form.match" placeholder="检索关键词" clearable />
+          <el-input v-model="form.match" placeholder="检索关键词" clearable />
         </el-form-item>
         <el-form-item style="float: right">
           <el-button type="primary" @click="onSubmit" :loading="load">
@@ -75,10 +75,12 @@
               backgroundColor: '#f4f5f7',
               color: '#606266',
             }"
+            ref="table1"
             align="center"
             :data="tableData"
             empty-text="暂无数据"
             style="width: 100%"
+            @sort-change="sort_change"
           >
             <template v-for="(item, i) in agg" :key="i">
               <el-table-column
@@ -87,6 +89,8 @@
                 show-overflow-tooltip
                 :prop="item.key"
                 :label="item.label"
+                :sortable="item.sortable"
+                :sort-orders="item.sortable ? ['descending', null] : []"
               >
                 <template #default="scope">
                   {{
@@ -105,10 +109,12 @@
               backgroundColor: '#f4f5f7',
               color: '#606266',
             }"
+            ref="table2"
             align="center"
             empty-text="暂无数据"
             :data="tableList"
             style="width: 100%"
+            @sort-change="sort_change"
           >
             <template v-for="(item, i) in list" :key="i">
               <el-table-column
@@ -117,6 +123,8 @@
                 show-overflow-tooltip
                 :prop="item.key"
                 :label="item.label"
+                :sortable="item.sortable"
+                :sort-orders="item.sortable ? ['descending', null] : []"
               >
                 <template #default="scope">
                   {{
@@ -153,6 +161,7 @@ import { platformList, platformlistData, platform } from "@/api/index";
 import { formatter } from "@/utils/tool";
 import config from "@/config/index";
 let tableDataListOri = [];
+let sort = null;
 export default {
   name: "RealData",
   data() {
@@ -191,7 +200,7 @@ export default {
       form: {
         platform: "",
         dt: [],
-        match: ""
+        match: "",
       },
       formRael: { platform: "", dt: [] },
       tableData: [],
@@ -199,21 +208,21 @@ export default {
     };
   },
   mounted() {
-    platformList('?kh=1').then(res => {
+    platformList("?kh=1").then(res => {
       const first = res[0] || { platform: "", dt: "" };
       this.form = {
-        dt: [first.dt,first.dt],
+        dt: [first.dt, first.dt],
         platform: first.platform,
       };
       this.formRael = {
-        dt: [first.dt,first.dt],
+        dt: [first.dt, first.dt],
         platform: first.platform || "",
       };
       this.pListData = res || [];
       this.onSubmit();
     });
   },
-  computed: {    
+  computed: {
     agg() {
       if (!this.formRael.platform) return [];
       return config.tableCol.agg[this.formRael.platform];
@@ -241,10 +250,13 @@ export default {
       let p = {
         platform: item.platform,
         dt: this.form.dt,
-        match: this.form.match
+        match: this.form.match,
       };
       if (new Date(item.dt) - new Date(p.dt) < 0) p.dt = item.dt;
       this.form = p;
+      this.$refs.table1.clearSort();
+      this.$refs.table2.clearSort();
+      sort = null;
       this.onSubmit();
     },
     cChange(num) {
@@ -255,23 +267,31 @@ export default {
       const startd = this.dateFormat(this.formRael.dt[0] || 0);
       const starte = this.dateFormat(this.formRael.dt[1] || 0);
       window.open(
-        config.base.url2 + "/new-media/export?start=" + [startd.year, startd.month, startd.day].join("-") + "&end=" + [starte.year, starte.month, starte.day].join("-")
+        config.base.url2 +
+          "/new-media/export?start=" +
+          [startd.year, startd.month, startd.day].join("-") +
+          "&end=" +
+          [starte.year, starte.month, starte.day].join("-")
       );
     },
     disabledDate(time) {
       return time.getTime() > Date.now() - 86400000;
     },
+    sort_change(type) {
+      sort = type.prop;
+      this.onSubmit();
+    },
     onSubmit() {
       const data = this.formatListData();
       this.page = 0;
       this.tableData = [];
-      this.total = [];
+      this.total = 0;
       this.load = true;
       const l = ElLoading.default.service();
       Promise.all([platform(data), platformlistData(data)])
         .then(list => {
           this.formRael = data;
-          this.formRael.dt = [this.formRael.start,this.formRael.end];
+          this.formRael.dt = [this.formRael.start, this.formRael.end];
           this.tableData = (list[0] || []).map((v, i) => {
             v.index = i + 1;
             return v;
@@ -314,12 +334,18 @@ export default {
     formatListData() {
       const startd = this.form.dt[0] ? this.dateFormat(this.form.dt[0]) : false;
       const starte = this.form.dt[1] ? this.dateFormat(this.form.dt[1]) : false;
-      return {
+      const p = {
         platform: this.form.platform || this.pListData[0],
-        start: startd ? [startd.year, startd.month, startd.day].join("-") : undefined, 
-        end: starte ? [starte.year, starte.month, starte.day].join("-") : undefined,
-        match: this.form.match
+        start: startd
+          ? [startd.year, startd.month, startd.day].join("-")
+          : undefined,
+        end: starte
+          ? [starte.year, starte.month, starte.day].join("-")
+          : undefined,
+        match: this.form.match,
       };
+      sort && (p.sort = sort);
+      return p;
     },
   },
   components: {},
@@ -409,7 +435,13 @@ export default {
   border-color: #fb7299;
   color: #fff;
 }
-.el-table th>.cell{
-    white-space: nowrap;
+.el-table th > .cell {
+  white-space: nowrap;
+}
+.program .ascending{
+    display: none;
+}
+.program .descending{
+    top: 0.25em;
 }
 </style>