statistics.vue 9.5 KB

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