Parcourir la source

总后台统计管理新增完课统计和小程序观课统计

luolinsong il y a 1 mois
Parent
commit
740477c1ee

+ 15 - 0
src/api/course/qw/courseWatchLog.js

@@ -134,3 +134,18 @@ export function getSignProjectName() {
   })
 }
 
+export function getAppIdList(query) {
+  return request({
+    url: '/course/courseWatchLog/getAppIdList',
+    method: 'get',
+    params: query
+  })
+}
+
+export function getUserIdList(query) {
+  return request({
+    url: '/course/courseWatchLog/getUserIdList',
+    method: 'get',
+    params: query
+  })
+}

+ 180 - 0
src/views/course/sop/appIdList.vue

@@ -0,0 +1,180 @@
+<template>
+  <div class="app-container">
+    <!-- 搜索区域 -->
+    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="100px">
+     <el-form-item label="公司名称" prop="companyId" >
+        <el-select v-model="queryParams.companyId" placeholder="请选择所属公司" filterable size="small">
+          <el-option v-for="(option, index) in companyList" :key="index" :value="option.dictValue" :label="option.dictLabel"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="小程序ID" prop="appId">
+       <el-select v-model="queryParams.appId" placeholder="请选择所属小程序" clearable size="small">
+          <el-option
+            v-for="item in appMallOptions"
+            :key="item.appId"
+            :label="item.appName"
+            :value="item.appId"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        label="创建时间"
+        prop="createTime"
+        :rules="[{ required: true, message: '创建时间不能为空', trigger: 'change' }]"
+      >
+        <el-date-picker
+          v-model="queryParams.createTime"
+          type="date"
+          placeholder="请选择创建日期"
+          value-format="yyyy-MM-dd"
+          size="small"
+          style="width: 180px"
+          :clearable="false"
+        />
+      </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-table
+      border
+      v-loading="loading"
+      :data="appRegisterList"
+      style="width: 100%; margin-top: 20px;"
+    >
+      <el-table-column label="序号" type="index" align="center" width="60" />
+      <el-table-column label="公司名称" align="center" prop="companyName" />
+      <el-table-column label="小程序名称" align="center" prop="appName" />
+      <el-table-column label="总观看人数" align="center" prop="appAllNum" width="120">
+        <template slot-scope="scope">
+          <el-tag type="primary">{{ scope.row.appAllNum }}</el-tag>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页 -->
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { getAppIdList } from "@/api/course/qw/courseWatchLog";
+import {getMiniProgramList } from "@/api/hisStore/storePayment";
+import { allList } from '@/api/company/company'
+
+export default {
+  name: "AppRegisterStatistics",
+  data() {
+    return {
+      loading: true,
+      total: 0,
+      appRegisterList: [],
+      appMallOptions:[],
+      companyList:[],
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        companyName: null,
+        appId: null,
+        createTime: this.getCurrentDate() // 设置默认值为当前时间
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getMiniProgramList();
+    this.getAllCompany();
+  },
+  methods: {
+    /** 获取当前日期(YYYY-MM-DD格式) */
+    getCurrentDate() {
+      const now = new Date();
+      const year = now.getFullYear();
+      const month = String(now.getMonth() + 1).padStart(2, '0');
+      const day = String(now.getDate()).padStart(2, '0');
+      return `${year}-${month}-${day}`;
+    },
+
+    getAllCompany() {
+      allList().then(response => {
+        this.companyList = response.rows;
+        this.companyList.push({dictLabel: "无",
+            dictValue: "0"})
+      });
+    },
+
+    // 获取小程序选项列表
+    getMiniProgramList() {
+      this.appMallOptions = []
+      getMiniProgramList().then(response => {
+        const { code, data } = response
+        if (code === 200) {
+          this.appMallOptions = data.map(v => {
+            return { appId: v.appid, appName: v.name }
+          })
+        }
+      }).catch(error => {
+        console.error('获取小程序列表失败:', error)
+        this.$message.error('获取小程序列表失败')
+      })
+    },
+
+    /** 查询列表 */
+    getList() {
+      // 验证创建时间是否为空
+      if (!this.queryParams.createTime) {
+        this.$message.warning('请选择创建时间')
+        return
+      }
+
+      this.loading = true;
+      getAppIdList(this.queryParams).then(response => {
+        this.appRegisterList = response.rows || [];
+        this.total = response.total || 0;
+        this.loading = false;
+      }).catch(() => {
+        this.loading = false;
+      });
+    },
+
+    /** 搜索按钮操作 */
+    handleQuery() {
+      // 验证表单
+      this.$refs.queryForm.validate(valid => {
+        if (valid) {
+          this.queryParams.pageNum = 1;
+          this.getList();
+        } else {
+          this.$message.warning('请填写完整查询条件')
+        }
+      });
+    },
+
+    /** 重置按钮操作 */
+    resetQuery() {
+      // 重置表单
+      this.$refs.queryForm.resetFields();
+      // 重置后恢复默认当前时间
+      this.queryParams.createTime = this.getCurrentDate();
+      // 重置后立即查询
+      this.queryParams.pageNum = 1;
+      this.getList();
+    }
+  }
+};
+</script>
+
+<style scoped>
+.app-container {
+  padding: 20px;
+}
+</style>

+ 173 - 0
src/views/course/sop/userIdList.vue

@@ -0,0 +1,173 @@
+<template>
+  <div class="app-container">
+    <!-- 搜索区域 -->
+    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="100px">
+<!--      <el-form-item label="公司名称" prop="companyName">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.companyName"-->
+<!--          placeholder="请输入公司名称"-->
+<!--          clearable-->
+<!--          size="small"-->
+<!--          style="width: 180px"-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="小程序ID" prop="appId">-->
+<!--       <el-select v-model="queryParams.appId" placeholder="请选择所属小程序" clearable size="small">-->
+<!--          <el-option-->
+<!--            v-for="item in appMallOptions"-->
+<!--            :key="item.appId"-->
+<!--            :label="item.appName"-->
+<!--            :value="item.appId"-->
+<!--          />-->
+<!--        </el-select>-->
+<!--      </el-form-item>-->
+      <el-form-item
+        label="创建时间"
+        prop="createTime"
+        :rules="[{ required: true, message: '创建时间不能为空', trigger: 'change' }]"
+      >
+        <el-date-picker
+          v-model="queryParams.createTime"
+          type="date"
+          placeholder="请选择创建日期"
+          value-format="yyyy-MM-dd"
+          size="small"
+          style="width: 180px"
+          :clearable="false"
+        />
+      </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-table
+      border
+      v-loading="loading"
+      :data="appRegisterList"
+      style="width: 100%; margin-top: 20px;"
+    >
+      <el-table-column label="序号" type="index" align="center" width="60" />
+      <el-table-column label="公司名称" align="center" prop="companyName" />
+      <el-table-column label="个微完播人数" align="center" prop="typeOneAll" />
+      <el-table-column label="企微完播人数" align="center" prop="typeTwoAll" />
+      <el-table-column label="总完播人数" align="center" prop="typeAll" />
+      <el-table-column label="总观看人数" align="center" prop="allUserId" />
+
+    </el-table>
+
+    <!-- 分页 -->
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import {getUserIdList } from "@/api/course/qw/courseWatchLog";
+import {getMiniProgramList } from "@/api/hisStore/storePayment";
+
+export default {
+  name: "AppRegisterStatistics",
+  data() {
+    return {
+      loading: true,
+      total: 0,
+      appRegisterList: [],
+      appMallOptions:[],
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        companyName: null,
+        appId: null,
+        createTime: this.getCurrentDate() // 设置默认值为当前时间
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getMiniProgramList();
+  },
+  methods: {
+    /** 获取当前日期(YYYY-MM-DD格式) */
+    getCurrentDate() {
+      const now = new Date();
+      const year = now.getFullYear();
+      const month = String(now.getMonth() + 1).padStart(2, '0');
+      const day = String(now.getDate()).padStart(2, '0');
+      return `${year}-${month}-${day}`;
+    },
+
+    // 获取小程序选项列表
+    getMiniProgramList() {
+      this.appMallOptions = []
+      getMiniProgramList().then(response => {
+        const { code, data } = response
+        if (code === 200) {
+          this.appMallOptions = data.map(v => {
+            return { appId: v.appid, appName: v.name }
+          })
+        }
+      }).catch(error => {
+        console.error('获取小程序列表失败:', error)
+        this.$message.error('获取小程序列表失败')
+      })
+    },
+
+    /** 查询列表 */
+    getList() {
+      // 验证创建时间是否为空
+      if (!this.queryParams.createTime) {
+        this.$message.warning('请选择创建时间')
+        return
+      }
+
+      this.loading = true;
+      getUserIdList(this.queryParams).then(response => {
+        this.appRegisterList = response.rows || [];
+        this.total = response.total || 0;
+        this.loading = false;
+      }).catch(() => {
+        this.loading = false;
+      });
+    },
+
+    /** 搜索按钮操作 */
+    handleQuery() {
+      // 验证表单
+      this.$refs.queryForm.validate(valid => {
+        if (valid) {
+          this.queryParams.pageNum = 1;
+          this.getList();
+        } else {
+          this.$message.warning('请填写完整查询条件')
+        }
+      });
+    },
+
+    /** 重置按钮操作 */
+    resetQuery() {
+      // 重置表单
+      this.$refs.queryForm.resetFields();
+      // 重置后恢复默认当前时间
+      this.queryParams.createTime = this.getCurrentDate();
+      // 重置后立即查询
+      this.queryParams.pageNum = 1;
+      this.getList();
+    }
+  }
+};
+</script>
+
+<style scoped>
+.app-container {
+  padding: 20px;
+}
+</style>