Sfoglia il codice sorgente

积分订单暂时不允许兑换

xgb 6 giorni fa
parent
commit
9346caf495

+ 23 - 0
src/api/app/statistics/courseFinishAppReport.js

@@ -0,0 +1,23 @@
+import request from "@/utils/request"
+
+/**
+ * 获取APP完课统计数据
+ */
+export function getCourseFinishAppReport(query) {
+  return request({
+    url: '/app/statistics/courseFinishAppReport',
+    method: 'get',
+    params: query
+  })
+}
+
+/**
+ * 导出APP完课统计数据
+ */
+export function exportCourseFinishAppReport(query) {
+  return request({
+    url: '/app/statistics/exportCourseFinishAppReport',
+    method: 'get',
+    params: query
+  })
+}

+ 179 - 0
src/views/app/statistics/courseFinishAppReport/index.vue

@@ -0,0 +1,179 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="85px">
+      <el-form-item label="统计维度" prop="dimensionType">
+        <el-select v-model="queryParams.dimensionType" placeholder="请选择统计维度" clearable size="small" style="width: 150px" @change="handleQuery">
+          <el-option label="默认总计" value="" />
+          <el-option label="公司维度" value="company" />
+          <el-option label="项目维度" value="project" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="统计日期" prop="dateRange">
+        <el-date-picker
+          v-model="dateRange"
+          type="daterange"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          value-format="yyyy-MM-dd"
+          :picker-options="pickerOptions"
+          @change="handleDateChange"
+          clearable
+          size="small">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['app:statistics:courseFinishAppReport:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="reportList">
+      <el-table-column label="时间" align="center" prop="statDate" min-width="220" />
+      <el-table-column v-if="queryParams.dimensionType === 'company'" label="公司名称" align="center" prop="companyName" min-width="150" />
+      <el-table-column v-if="queryParams.dimensionType === 'project'" label="项目名称" align="center" prop="projectName" min-width="150" />
+      <el-table-column label="总完播" align="center" prop="totalFinishCount" />
+      <el-table-column label="APP完播" align="center" prop="appFinishCount" />
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { getCourseFinishAppReport, exportCourseFinishAppReport } from "@/api/app/statistics/courseFinishAppReport";
+
+export default {
+  name: "CourseFinishAppReport",
+  data() {
+    return {
+      loading: true,
+      exportLoading: false,
+      showSearch: true,
+      total: 0,
+      reportList: [],
+      dateRange: [],
+
+      pickerOptions: {
+        onPick: ({ maxDate, minDate }) => {
+          this.pickerMinDate = minDate.getTime();
+          if (maxDate) {
+            this.pickerMinDate = '';
+          }
+        },
+        disabledDate: (time) => {
+          if (this.pickerMinDate !== '') {
+            const day30 = 30 * 24 * 3600 * 1000;
+            const maxTime = this.pickerMinDate + day30;
+            const minTime = this.pickerMinDate - day30;
+            return time.getTime() > maxTime || time.getTime() < minTime;
+          }
+          return false;
+        }
+      },
+
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        startDate: null,
+        endDate: null,
+        dimensionType: '',
+        companyId: null,
+        projectId: null
+      }
+    };
+  },
+  created() {
+    const today = this.formatDate(new Date());
+    this.dateRange = [today, today];
+    this.queryParams.startDate = today;
+    this.queryParams.endDate = today;
+    this.getList();
+  },
+  methods: {
+    formatDate(date) {
+      const year = date.getFullYear();
+      const month = String(date.getMonth() + 1).padStart(2, '0');
+      const day = String(date.getDate()).padStart(2, '0');
+      return `${year}-${month}-${day}`;
+    },
+
+    getList() {
+      this.loading = true;
+      getCourseFinishAppReport(this.queryParams).then(response => {
+        this.reportList = response.rows || [];
+        this.total = response.total || 0;
+        this.loading = false;
+      }).catch(() => {
+        this.loading = false;
+      });
+    },
+
+    handleDateChange(value) {
+      this.dateRange = value;
+      if (value && value.length === 2) {
+        this.queryParams.startDate = value[0];
+        this.queryParams.endDate = value[1];
+      } else {
+        this.queryParams.startDate = null;
+        this.queryParams.endDate = null;
+      }
+    },
+
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+
+    resetQuery() {
+      this.dateRange = [];
+      this.queryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        startDate: null,
+        endDate: null,
+        dimensionType: '',
+        companyId: null,
+        projectId: null
+      };
+      this.handleQuery();
+    },
+
+    handleExport() {
+      this.$confirm('是否确认导出APP完课统计数据?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportCourseFinishAppReport(this.queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {
+        this.exportLoading = false;
+      });
+    }
+  }
+};
+</script>