watchLogStatistics.vue 9.1 KB

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