statistics.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="公司名" prop="companyId">
  5. <el-select filterable style="width: 220px" v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">
  6. <el-option
  7. v-for="item in companys"
  8. :key="item.companyId"
  9. :label="item.companyName"
  10. :value="item.companyId"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="课程" prop="courseId">
  15. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  16. <el-option
  17. v-for="dict in courseLists"
  18. :key="dict.dictValue"
  19. :label="dict.dictLabel"
  20. :value="dict.dictValue"
  21. />
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="小节" prop="videoId">
  25. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  26. <el-option
  27. v-for="dict in videoList"
  28. :key="dict.dictValue"
  29. :label="dict.dictLabel"
  30. :value="dict.dictValue"
  31. />
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="企微昵称" prop="nickName">
  35. <el-input
  36. v-model="queryParams.nickName"
  37. placeholder="请输入企微昵称"
  38. clearable
  39. size="small"
  40. @keyup.enter.native="handleQuery"
  41. />
  42. </el-form-item>
  43. <el-form-item label="创建时间" prop="createTime">
  44. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  48. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  49. </el-form-item>
  50. </el-form>
  51. <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange" show-summary>
  52. <el-table-column type="selection" width="55" align="center" />
  53. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  54. <el-table-column label="发课时间" align="center" prop="createTime"/>
  55. <el-table-column label="课程名称" align="center" prop="courseName" />
  56. <el-table-column label="小节名称" align="center" prop="videoName" />
  57. <el-table-column label="待看课" align="center" prop="type3" />
  58. <el-table-column label="看课中" align="center" prop="type1" />
  59. <el-table-column label="已完课" align="center" prop="type2" />
  60. <el-table-column label="看课中断" align="center" prop="type4" />
  61. <el-table-column label="注册用户待看课数" align="center" prop="isUserWaitNumber" />
  62. <el-table-column label="未注册用户待看课数" align="center" prop="noUserWaitNumber" />
  63. <el-table-column label="上线率" align="center" prop="onLineRate" />
  64. <el-table-column label="完课率" align="center" prop="finishedRate" />
  65. <!-- <el-table-column label="消耗红包金额" align="center" prop="redAmount" />-->
  66. </el-table>
  67. <pagination
  68. v-show="total>0"
  69. :total="total"
  70. :page.sync="queryParams.pageNum"
  71. :limit.sync="queryParams.pageSize"
  72. @pagination="getList"
  73. />
  74. </div>
  75. </template>
  76. <script>
  77. import { listCourseWatchLog, getCourseWatchLog, delCourseWatchLog, addCourseWatchLog, updateCourseWatchLog, exportCourseWatchLog,statisticsList } from "@/api/course/qw/courseWatchLog";
  78. import { courseList,videoList } from '@/api/course/courseRedPacketLog'
  79. import {getCompanyList} from "@/api/company/company";
  80. export default {
  81. name: "CourseWatchLog",
  82. data() {
  83. return {
  84. companys:[],
  85. activeName:"00",
  86. createTime:null,
  87. courseLists:[],
  88. videoList:[],
  89. logTypeOptions:[],
  90. // 遮罩层
  91. loading: false,
  92. // 导出遮罩层
  93. exportLoading: false,
  94. // 选中数组
  95. ids: [],
  96. // 非单个禁用
  97. single: true,
  98. // 非多个禁用
  99. multiple: true,
  100. // 显示搜索条件
  101. showSearch: true,
  102. // 总条数
  103. total: 0,
  104. // 短链课程看课记录表格数据
  105. courseWatchLogList: [],
  106. // 弹出层标题
  107. title: "",
  108. // 是否显示弹出层
  109. open: false,
  110. // 查询参数
  111. queryParams: {
  112. pageNum: 1,
  113. pageSize: 10,
  114. userId: null,
  115. nickName: null,
  116. videoId: null,
  117. logType: null,
  118. qwExternalContactId: null,
  119. duration: null,
  120. qwUserId: null,
  121. companyUserId: null,
  122. companyId: null,
  123. courseId: null,
  124. sTime:null,
  125. eTime:null,
  126. scheduleStartTime: null,
  127. scheduleEndTime: null,
  128. },
  129. // 表单参数
  130. form: {},
  131. // 表单校验
  132. rules: {
  133. },
  134. scheduleTime: null,
  135. };
  136. },
  137. created() {
  138. getCompanyList().then(response => {
  139. this.companys = response.data;
  140. if(this.companys!=null&&this.companys.length>0){
  141. this.companyId=this.companys[0].companyId;
  142. this.getTreeselect();
  143. }
  144. });
  145. courseList().then(response => {
  146. this.courseLists = response.list;
  147. });
  148. this.getList();
  149. this.getDicts("sys_course_watch_log_type").then(response => {
  150. this.logTypeOptions = response.data;
  151. });
  152. },
  153. methods: {
  154. courseChange(row){
  155. this.queryParams.videoId=null;
  156. if(row === ''){
  157. this.videoList=[];
  158. return
  159. }
  160. videoList(row).then(response => {
  161. this.videoList=response.list
  162. });
  163. },
  164. change() {
  165. if (this.createTime != null) {
  166. this.queryParams.sTime = this.createTime[0];
  167. this.queryParams.eTime = this.createTime[1];
  168. } else {
  169. this.queryParams.sTime = null;
  170. this.queryParams.eTime = null;
  171. }
  172. },
  173. handleClickX(tab,event){
  174. this.activeName=tab.name;
  175. if(tab.name=="00"){
  176. this.queryParams.logType=null;
  177. }else{
  178. this.queryParams.logType=tab.name;
  179. }
  180. this.getList()
  181. },
  182. /** 查询短链课程看课记录列表 */
  183. getList() {
  184. this.loading = true;
  185. statisticsList(this.queryParams).then(response => {
  186. this.courseWatchLogList = response.rows;
  187. this.total = response.total;
  188. this.loading = false;
  189. });
  190. },
  191. // 取消按钮
  192. cancel() {
  193. this.open = false;
  194. this.reset();
  195. },
  196. // 表单重置
  197. reset() {
  198. this.form = {
  199. logId: null,
  200. userId: null,
  201. videoId: null,
  202. logType: null,
  203. createTime: null,
  204. updateTime: null,
  205. qwExternalContactId: null,
  206. duration: null,
  207. qwUserId: null,
  208. companyUserId: null,
  209. companyId: null,
  210. courseId: null
  211. };
  212. this.resetForm("form");
  213. },
  214. /** 搜索按钮操作 */
  215. handleQuery() {
  216. if(this.queryParams.companyId == null) {
  217. this.$message.warning("公司不能为空!")
  218. return;
  219. }
  220. this.queryParams.pageNum = 1;
  221. this.getList();
  222. },
  223. /** 重置按钮操作 */
  224. resetQuery() {
  225. this.resetForm("queryForm");
  226. this.createTime = null;
  227. this.scheduleTime = null;
  228. this.queryParams.sTime = null;
  229. this.queryParams.eTime = null;
  230. this.queryParams.scheduleStartTime = null;
  231. this.queryParams.scheduleEndTime = null;
  232. this.handleQuery();
  233. },
  234. // 多选框选中数据
  235. handleSelectionChange(selection) {
  236. this.ids = selection.map(item => item.logId)
  237. this.single = selection.length!==1
  238. this.multiple = !selection.length
  239. },
  240. /** 新增按钮操作 */
  241. handleAdd() {
  242. this.reset();
  243. this.open = true;
  244. this.title = "添加短链课程看课记录";
  245. },
  246. /** 修改按钮操作 */
  247. handleUpdate(row) {
  248. this.reset();
  249. const logId = row.logId || this.ids
  250. getCourseWatchLog(logId).then(response => {
  251. this.form = response.data;
  252. this.open = true;
  253. this.title = "修改短链课程看课记录";
  254. });
  255. },
  256. /** 提交按钮 */
  257. submitForm() {
  258. this.$refs["form"].validate(valid => {
  259. if (valid) {
  260. if (this.form.logId != null) {
  261. updateCourseWatchLog(this.form).then(response => {
  262. this.msgSuccess("修改成功");
  263. this.open = false;
  264. this.getList();
  265. });
  266. } else {
  267. addCourseWatchLog(this.form).then(response => {
  268. this.msgSuccess("新增成功");
  269. this.open = false;
  270. this.getList();
  271. });
  272. }
  273. }
  274. });
  275. },
  276. /** 删除按钮操作 */
  277. handleDelete(row) {
  278. const logIds = row.logId || this.ids;
  279. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  280. confirmButtonText: "确定",
  281. cancelButtonText: "取消",
  282. type: "warning"
  283. }).then(function() {
  284. return delCourseWatchLog(logIds);
  285. }).then(() => {
  286. this.getList();
  287. this.msgSuccess("删除成功");
  288. }).catch(() => {});
  289. },
  290. /** 导出按钮操作 */
  291. handleExport() {
  292. const queryParams = this.queryParams;
  293. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  294. confirmButtonText: "确定",
  295. cancelButtonText: "取消",
  296. type: "warning"
  297. }).then(() => {
  298. this.exportLoading = true;
  299. return exportCourseWatchLog(queryParams);
  300. }).then(response => {
  301. this.download(response.msg);
  302. this.exportLoading = false;
  303. }).catch(() => {});
  304. },
  305. handleScheduleTimeChange(val) {
  306. if (val) {
  307. this.queryParams.scheduleStartTime = val[0];
  308. this.queryParams.scheduleEndTime = val[1];
  309. } else {
  310. this.queryParams.scheduleStartTime = null;
  311. this.queryParams.scheduleEndTime = null;
  312. }
  313. },
  314. }
  315. };
  316. </script>