statistics.vue 9.8 KB

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