liyongli 2 年之前
父節點
當前提交
b25da571cf
共有 5 個文件被更改,包括 86 次插入57 次删除
  1. 1 2
      package.json
  2. 2 0
      src/config/index.js
  3. 36 36
      src/config/tableCol.js
  4. 28 10
      src/views/Department/index.vue
  5. 19 9
      src/views/ReportForm/ReportForm.vue

+ 1 - 2
package.json

@@ -4,8 +4,7 @@
   "private": true,
   "scripts": {
     "serve": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service serve",
-    "build1": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service build & node ./saveGit.js",
-    "build": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service build",
+    "build": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service build & node ./saveGit.js",
     "lint": "vue-cli-service lint",
     "dll": "webpack --progress --config ./webpack.dll.js"
   },

+ 2 - 0
src/config/index.js

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

+ 36 - 36
src/config/tableCol.js

@@ -20,15 +20,15 @@ export default {
         type: 'number'
       },
       {
-        label: "阅读量",
+        label: "阅读量",
         key: "readCount",
         type: 'number'
       },
-      {
-        label: "本月累计阅读量",
-        key: "monthReadCount",
-        type: 'number'
-      },
+    //   {
+    //     label: "本月累计阅读量",
+    //     key: "monthReadCount",
+    //     type: 'number'
+    //   },
       {
         label: "粉丝数",
         key: "fans",
@@ -70,15 +70,15 @@ export default {
         type: 'number'
       },
       {
-        label: "阅读量",
+        label: "阅读量",
         key: "readCount",
         type: 'number'
       },
-      {
-        label: "本月累计阅读量",
-        key: "monthReadCount",
-        type: 'number'
-      },
+    //   {
+    //     label: "本月累计阅读量",
+    //     key: "monthReadCount",
+    //     type: 'number'
+    //   },
       {
         label: "粉丝数",
         key: "fans",
@@ -115,15 +115,15 @@ export default {
         type: 'number'
       },
       {
-        label: "阅读量",
+        label: "阅读量",
         key: "readCount",
         type: 'number'
       },
-      {
-        label: "本月累计阅读量",
-        key: "monthReadCount",
-        type: 'number'
-      },
+    //   {
+    //     label: "本月累计阅读量",
+    //     key: "monthReadCount",
+    //     type: 'number'
+    //   },
     ],
     抖音: [
       {
@@ -145,15 +145,15 @@ export default {
         type: 'number'
       },
       {
-        label: "阅读量",
+        label: "阅读量",
         key: "readCount",
         type: 'number'
       },
-      {
-        label: "本月累计阅读量",
-        key: "monthReadCount",
-        type: 'number'
-      },
+    //   {
+    //     label: "本月累计阅读量",
+    //     key: "monthReadCount",
+    //     type: 'number'
+    //   },
       {
         label: "分享量",
         key: "shareCount",
@@ -189,15 +189,15 @@ export default {
         type: 'number'
       },
       {
-        label: "阅读量",
+        label: "阅读量",
         key: "readCount",
         type: 'number'
       },
-      {
-        label: "本月累计阅读量",
-        key: "monthReadCount",
-        type: 'number'
-      },
+    //   {
+    //     label: "本月累计阅读量",
+    //     key: "monthReadCount",
+    //     type: 'number'
+    //   },
       {
         label: "评论量",
         key: "commentCount",
@@ -229,15 +229,15 @@ export default {
         type: 'number'
       },
       {
-        label: "阅读量",
+        label: "阅读量",
         key: "readCount",
         type: 'number'
       },
-      {
-        label: "本月累计阅读量",
-        key: "monthReadCount",
-        type: 'number'
-      },
+    //   {
+    //     label: "本月累计阅读量",
+    //     key: "monthReadCount",
+    //     type: 'number'
+    //   },
     ],
   },
   list: {

+ 28 - 10
src/views/Department/index.vue

@@ -47,7 +47,9 @@
         <el-form-item label="日期">
           <el-date-picker
             v-model="form.dt"
-            type="date"
+            type="daterange"
+            start-placeholder="开始时间"
+            end-placeholder="结束时间"
             :disabled-date="time => disabledDate(time)"
             placeholder="日期"
           >
@@ -189,10 +191,10 @@ export default {
       activeTab: "agg",
       form: {
         platform: "",
-        dt: "",
+        dt: [],
         match: "",
       },
-      formRael: { platform: "", dt: "" },
+      formRael: { platform: "", dt: [] },
       tableData: [],
       pListData: [],
     };
@@ -201,11 +203,11 @@ export default {
     platformList().then(res => {
       const first = res[0] || { platform: "", dt: "" };
       this.form = {
-        dt: first.dt,
+        dt: [first.dt, first.dt],
         platform: first.platform,
       };
       this.formRael = {
-        dt: first.dt,
+        dt: [first.dt, first.dt],
         platform: first.platform || "",
       };
       this.pListData = res || [];
@@ -250,9 +252,16 @@ export default {
       this.page = num;
     },
     onExport() {
-      if (!this.formRael.dt) return;
+      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);
       window.open(
-        config.base.url2 + "/new-media/export?dt=" + this.formRael.dt
+        config.base.url2 +
+          "/new-media/export?start=" +
+          [startd.year, startd.month, startd.day].join("-") +
+          "&end=" +
+          [starte.year, starte.month, starte.day].join("-")
       );
     },
     disabledDate(time) {
@@ -261,12 +270,14 @@ export default {
     onSubmit() {
       const data = this.formatListData();
       this.page = 0;
+      this.tableData = [];
+      this.total = [];
       this.load = true;
       const l = ElLoading.default.service();
       Promise.all([platform(data), platformlistData(data)])
         .then(list => {
-          console.log(list);
           this.formRael = data;
+          this.formRael.dt = [this.formRael.start,this.formRael.end];
           this.tableData = (list[0] || []).map((v, i) => {
             v.index = i + 1;
             return v;
@@ -281,6 +292,7 @@ export default {
           l.close();
         })
         .catch(() => {
+          this.load = false;
           l.close();
         });
     },
@@ -306,13 +318,19 @@ export default {
       };
     },
     formatListData() {
-      const d = this.dateFormat(this.form.dt);
+      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;
       const loginname = JSON.parse(
         window.parent.localStorage.userinfo || "{}"
       ).loginname;
       return {
         platform: this.form.platform || this.pListData[0],
-        dt: [d.year, d.month, d.day].join("-"),
+        start: startd
+          ? [startd.year, startd.month, startd.day].join("-")
+          : undefined,
+        end: starte
+          ? [starte.year, starte.month, starte.day].join("-")
+          : undefined,
         match: this.form.match,
         userId: loginname,
       };

+ 19 - 9
src/views/ReportForm/ReportForm.vue

@@ -47,7 +47,9 @@
         <el-form-item label="日期">
           <el-date-picker
             v-model="form.dt"
-            type="date"
+            type="daterange"
+            start-placeholder="开始时间"
+            end-placeholder="结束时间"
             :disabled-date="time => disabledDate(time)"
             placeholder="日期"
           >
@@ -188,10 +190,10 @@ export default {
       activeTab: "agg",
       form: {
         platform: "",
-        dt: "",
+        dt: [],
         match: ""
       },
-      formRael: { platform: "", dt: "" },
+      formRael: { platform: "", dt: [] },
       tableData: [],
       pListData: [],
     };
@@ -200,11 +202,11 @@ export default {
     platformList('?kh=1').then(res => {
       const first = res[0] || { platform: "", dt: "" };
       this.form = {
-        dt: first.dt,
+        dt: [first.dt,first.dt],
         platform: first.platform,
       };
       this.formRael = {
-        dt: first.dt,
+        dt: [first.dt,first.dt],
         platform: first.platform || "",
       };
       this.pListData = res || [];
@@ -249,9 +251,11 @@ export default {
       this.page = num;
     },
     onExport() {
-      if (!this.formRael.dt) return;
+      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);
       window.open(
-        config.base.url2 + "/new-media/export?dt=" + this.formRael.dt
+        config.base.url2 + "/new-media/export?start=" + [startd.year, startd.month, startd.day].join("-") + "&end=" + [starte.year, starte.month, starte.day].join("-")
       );
     },
     disabledDate(time) {
@@ -260,11 +264,14 @@ export default {
     onSubmit() {
       const data = this.formatListData();
       this.page = 0;
+      this.tableData = [];
+      this.total = [];
       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.tableData = (list[0] || []).map((v, i) => {
             v.index = i + 1;
             return v;
@@ -279,6 +286,7 @@ export default {
           l.close();
         })
         .catch(() => {
+          this.load = false;
           l.close();
         });
     },
@@ -304,10 +312,12 @@ export default {
       };
     },
     formatListData() {
-      const d = this.dateFormat(this.form.dt);
+      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 {
         platform: this.form.platform || this.pListData[0],
-        dt: [d.year, d.month, d.day].join("-"),
+        start: startd ? [startd.year, startd.month, startd.day].join("-") : undefined, 
+        end: starte ? [starte.year, starte.month, starte.day].join("-") : undefined,
         match: this.form.match
       };
     },