statistics.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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>
  52. <pagination
  53. v-show="total>0"
  54. :total="total"
  55. :page.sync="queryParams.pageNum"
  56. :limit.sync="queryParams.pageSize"
  57. @pagination="getList"
  58. />
  59. </div>
  60. </template>
  61. <script>
  62. import { listCourseWatchLog, getCourseWatchLog, delCourseWatchLog, addCourseWatchLog, updateCourseWatchLog, exportCourseWatchLog,statisticsList } from "@/api/course/qw/courseWatchLog";
  63. import { courseList,videoList } from '@/api/course/courseRedPacketLog'
  64. export default {
  65. name: "CourseWatchLog",
  66. data() {
  67. return {
  68. activeName:"00",
  69. createTime:null,
  70. courseLists:[],
  71. videoList:[],
  72. logTypeOptions:[],
  73. // 遮罩层
  74. loading: true,
  75. // 导出遮罩层
  76. exportLoading: false,
  77. // 选中数组
  78. ids: [],
  79. // 非单个禁用
  80. single: true,
  81. // 非多个禁用
  82. multiple: true,
  83. // 显示搜索条件
  84. showSearch: true,
  85. // 总条数
  86. total: 0,
  87. // 短链课程看课记录表格数据
  88. courseWatchLogList: [],
  89. // 弹出层标题
  90. title: "",
  91. // 是否显示弹出层
  92. open: false,
  93. // 查询参数
  94. queryParams: {
  95. pageNum: 1,
  96. pageSize: 10,
  97. userId: null,
  98. nickName: null,
  99. videoId: null,
  100. logType: null,
  101. qwExternalContactId: null,
  102. duration: null,
  103. qwUserId: null,
  104. companyUserId: null,
  105. companyId: null,
  106. courseId: null,
  107. sTime:null,
  108. eTime:null,
  109. scheduleStartTime: null,
  110. scheduleEndTime: null,
  111. },
  112. // 表单参数
  113. form: {},
  114. // 表单校验
  115. rules: {
  116. },
  117. scheduleTime: null,
  118. };
  119. },
  120. created() {
  121. courseList().then(response => {
  122. this.courseLists = response.list;
  123. });
  124. this.getList();
  125. this.getDicts("sys_course_watch_log_type").then(response => {
  126. this.logTypeOptions = response.data;
  127. });
  128. },
  129. methods: {
  130. courseChange(row){
  131. this.queryParams.videoId=null;
  132. if(row === ''){
  133. this.videoList=[];
  134. return
  135. }
  136. videoList(row).then(response => {
  137. this.videoList=response.list
  138. });
  139. },
  140. change() {
  141. if (this.createTime != null) {
  142. this.queryParams.sTime = this.createTime[0];
  143. this.queryParams.eTime = this.createTime[1];
  144. } else {
  145. this.queryParams.sTime = null;
  146. this.queryParams.eTime = null;
  147. }
  148. },
  149. handleClickX(tab,event){
  150. this.activeName=tab.name;
  151. if(tab.name=="00"){
  152. this.queryParams.logType=null;
  153. }else{
  154. this.queryParams.logType=tab.name;
  155. }
  156. this.getList()
  157. },
  158. /** 查询短链课程看课记录列表 */
  159. getList() {
  160. this.loading = true;
  161. statisticsList(this.queryParams).then(response => {
  162. this.courseWatchLogList = response.rows;
  163. this.total = response.total;
  164. this.loading = false;
  165. });
  166. },
  167. // 取消按钮
  168. cancel() {
  169. this.open = false;
  170. this.reset();
  171. },
  172. // 表单重置
  173. reset() {
  174. this.form = {
  175. logId: null,
  176. userId: null,
  177. videoId: null,
  178. logType: null,
  179. createTime: null,
  180. updateTime: null,
  181. qwExternalContactId: null,
  182. duration: null,
  183. qwUserId: null,
  184. companyUserId: null,
  185. companyId: null,
  186. courseId: null
  187. };
  188. this.resetForm("form");
  189. },
  190. /** 搜索按钮操作 */
  191. handleQuery() {
  192. this.queryParams.pageNum = 1;
  193. this.getList();
  194. },
  195. /** 重置按钮操作 */
  196. resetQuery() {
  197. this.resetForm("queryForm");
  198. this.createTime = null;
  199. this.scheduleTime = null;
  200. this.queryParams.sTime = null;
  201. this.queryParams.eTime = null;
  202. this.queryParams.scheduleStartTime = null;
  203. this.queryParams.scheduleEndTime = null;
  204. this.handleQuery();
  205. },
  206. // 多选框选中数据
  207. handleSelectionChange(selection) {
  208. this.ids = selection.map(item => item.logId)
  209. this.single = selection.length!==1
  210. this.multiple = !selection.length
  211. },
  212. /** 新增按钮操作 */
  213. handleAdd() {
  214. this.reset();
  215. this.open = true;
  216. this.title = "添加短链课程看课记录";
  217. },
  218. /** 修改按钮操作 */
  219. handleUpdate(row) {
  220. this.reset();
  221. const logId = row.logId || this.ids
  222. getCourseWatchLog(logId).then(response => {
  223. this.form = response.data;
  224. this.open = true;
  225. this.title = "修改短链课程看课记录";
  226. });
  227. },
  228. /** 提交按钮 */
  229. submitForm() {
  230. this.$refs["form"].validate(valid => {
  231. if (valid) {
  232. if (this.form.logId != null) {
  233. updateCourseWatchLog(this.form).then(response => {
  234. this.msgSuccess("修改成功");
  235. this.open = false;
  236. this.getList();
  237. });
  238. } else {
  239. addCourseWatchLog(this.form).then(response => {
  240. this.msgSuccess("新增成功");
  241. this.open = false;
  242. this.getList();
  243. });
  244. }
  245. }
  246. });
  247. },
  248. /** 删除按钮操作 */
  249. handleDelete(row) {
  250. const logIds = row.logId || this.ids;
  251. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  252. confirmButtonText: "确定",
  253. cancelButtonText: "取消",
  254. type: "warning"
  255. }).then(function() {
  256. return delCourseWatchLog(logIds);
  257. }).then(() => {
  258. this.getList();
  259. this.msgSuccess("删除成功");
  260. }).catch(() => {});
  261. },
  262. /** 导出按钮操作 */
  263. handleExport() {
  264. const queryParams = this.queryParams;
  265. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  266. confirmButtonText: "确定",
  267. cancelButtonText: "取消",
  268. type: "warning"
  269. }).then(() => {
  270. this.exportLoading = true;
  271. return exportCourseWatchLog(queryParams);
  272. }).then(response => {
  273. this.download(response.msg);
  274. this.exportLoading = false;
  275. }).catch(() => {});
  276. },
  277. handleScheduleTimeChange(val) {
  278. if (val) {
  279. this.queryParams.scheduleStartTime = val[0];
  280. this.queryParams.scheduleEndTime = val[1];
  281. } else {
  282. this.queryParams.scheduleStartTime = null;
  283. this.queryParams.scheduleEndTime = null;
  284. }
  285. },
  286. }
  287. };
  288. </script>