liyongli 1 năm trước cách đây
mục cha
commit
2d5ce70029
2 tập tin đã thay đổi với 59 bổ sung7 xóa
  1. 13 0
      src/api/index.js
  2. 46 7
      src/views/Content/index.vue

+ 13 - 0
src/api/index.js

@@ -1315,3 +1315,16 @@ export function getLiveByCol(data) {
     data,
   });
 }
+
+/**
+ * 获取app对应栏目
+ * @return {AxjxPromise}
+ */
+export function getAppColumn(data) {
+    return ajax({
+      urlType: 'leverAudience',
+      url: '/cxzx-program/new-media/content/channels',
+      method: 'POST',
+      data,
+    });
+  }

+ 46 - 7
src/views/Content/index.vue

@@ -24,6 +24,7 @@
             start-placeholder="开始日期"
             end-placeholder="结束日期"
             :clearable="false"
+            @change="dateChange"
           >
           </el-date-picker>
         </el-form-item>
@@ -96,6 +97,22 @@
             </el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="栏目">
+          <el-select
+            collapse-tags
+            clearable
+            v-model="form.appColumn"
+            placeholder="请选择栏目"
+          >
+            <el-option
+              v-for="item in appColumn"
+              :key="item"
+              :label="item"
+              :value="item"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item style="float: right">
           <el-button type="primary" @click="onSubmit">查询</el-button>
           <el-button size="small" type="primary" @click="onExport">
@@ -356,6 +373,7 @@ import {
   getContentChart,
   getContentPage,
   getContentTotle,
+  getAppColumn,
 } from '@/api/index';
 
 import countTo from '@/components/counto/vue-countTo.vue';
@@ -403,6 +421,7 @@ export default {
       top: [],
       total: [],
       client: [],
+      appColumn: [],
     };
   },
   async mounted() {
@@ -435,6 +454,7 @@ export default {
       },
       true
     );
+    this.getAppColFun();
     this.form = {
       //   app: (this.cycle[0] || { value: "" }).value,
       app: defaultAppNameFunc(this.cycle),
@@ -445,11 +465,28 @@ export default {
       page: 1,
       size: 20,
       sortBy: '',
+      appColumn: '不限',
     };
     this.onSubmit();
   },
   computed: {},
   methods: {
+    dateChange() {
+      this.form.appColumn = '不限';
+      this.appColumn = [];
+      this.getAppColFun();
+    },
+    async getAppColFun() {
+      const start = this.form.date[0] || new Date(Date.now() - 604800000);
+      const end = this.form.date[1] || new Date(Date.now() - 604800000);
+      const appColumn = await getAppColumn({
+        app: this.form.app || defaultAppNameFunc(this.cycle),
+        start,
+        end,
+      });
+      const col = appColumn || [];
+      this.appColumn = ['不限', ...col];
+    },
     tableChange(e) {
       this.form.page = 1;
       this.form.sortBy = e.column ? e.column.property : '';
@@ -498,7 +535,8 @@ export default {
         match: this.match,
         sortBy: this.form.sortBy,
         lib: this.form.client == -1 ? undefined : this.form.client,
-        order: this.form.order
+        order: this.form.order,
+        channelName: this.form.appColumn === '不限' || !this.form.appColumn ? undefined : this.form.appColumn,
       };
       getContentPage(this.lastParams).then(r => (this.table = r || {}));
       getContentTotle({
@@ -770,6 +808,11 @@ export default {
           };
         });
       });
+
+      // 切换应用时重置栏目
+      this.form.appColumn = '不限';
+      this.appColumn = [];
+      this.getAppColFun();
     },
     changeversion(v) {
       if (!v.length) return (this.form.version = [-1]);
@@ -784,12 +827,8 @@ export default {
       this.form.version = ver;
     },
     onExport() {
-      const S = this.lastParams.start
-        ? this.lastParams.start
-        : undefined;
-      const E = this.lastParams.end
-        ? this.lastParams.end
-        : undefined;
+      const S = this.lastParams.start ? this.lastParams.start : undefined;
+      const E = this.lastParams.end ? this.lastParams.end : undefined;
       const app = this.lastParams.app || this.form.app;
       const version =
         this.form.version == -1 ? undefined : this.form.version.join(',');