watchLogStatistics.vue 9.5 KB

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