watchLogStatistics.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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="avatar">
  38. <template slot-scope="scope">
  39. <el-popover
  40. placement="right"
  41. title=""
  42. trigger="hover">
  43. <img slot="reference" :src="scope.row.avatar" style="width: 40px;height: 40px">
  44. <img :src="scope.row.avatar" style="max-width: 250px;max-height: 250px">
  45. </el-popover>
  46. </template>
  47. </el-table-column>
  48. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName" /> -->
  49. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  50. <el-table-column label="创建时间" align="center" prop="createTime" />
  51. <el-table-column label="进线时间" align="center" prop="userCreateTime" />
  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,watchLogStatistics,watchLogStatisticsExport } from "@/api/course/courseWatchLog";
  64. import {allList}from "@/api/company/company";
  65. import { courseList,videoList } from '@/api/course/courseRedPacketLog'
  66. import {getDateRange} from "@/utils/common";
  67. export default {
  68. name: "CourseWatchLog",
  69. data() {
  70. return {
  71. activeName:"00",
  72. createTime:null,
  73. updateTime: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. externalUserName:null,
  107. duration: null,
  108. qwUserId: null,
  109. companyUserId: null,
  110. companyId: null,
  111. courseId: null,
  112. sTime:null,
  113. eTime:null,
  114. upSTime:null,
  115. upETime:null,
  116. scheduleStartTime: null,
  117. scheduleEndTime: null,
  118. },
  119. // 表单参数
  120. form: {},
  121. // 表单校验
  122. rules: {
  123. },
  124. scheduleTime: null,
  125. };
  126. },
  127. created() {
  128. // // 设置默认时间范围为最近7天
  129. // this.createTime = getDateRange(7);
  130. // // 设置查询参数的时间
  131. // this.queryParams.sTime = this.createTime[0];
  132. // this.queryParams.eTime = this.createTime[1];
  133. courseList().then(response => {
  134. this.courseLists = response.list;
  135. });
  136. this.getList();
  137. this.getDicts("sys_course_watch_log_type").then(response => {
  138. this.logTypeOptions = response.data;
  139. });
  140. },
  141. methods: {
  142. courseChange(row){
  143. this.queryParams.videoId=null;
  144. if(row === ''){
  145. this.videoList=[];
  146. return
  147. }
  148. videoList(row).then(response => {
  149. this.videoList=response.list
  150. });
  151. },
  152. createChange() {
  153. if (this.createTime != null) {
  154. this.queryParams.sTime = this.createTime[0];
  155. this.queryParams.eTime = this.createTime[1];
  156. } else {
  157. this.queryParams.sTime = null;
  158. this.queryParams.eTime = null;
  159. }
  160. },
  161. updateChange(){
  162. if (this.updateTime != null) {
  163. this.queryParams.upSTime = this.updateTime[0];
  164. this.queryParams.upETime = this.updateTime[1];
  165. } else {
  166. this.queryParams.upSTime = null;
  167. this.queryParams.upETime = null;
  168. }
  169. },
  170. handleClickX(tab,event){
  171. this.activeName=tab.name;
  172. if(tab.name=="00"){
  173. this.queryParams.logType=null;
  174. }else{
  175. this.queryParams.logType=tab.name;
  176. }
  177. this.getList()
  178. },
  179. /** 查询短链课程看课记录列表 */
  180. getList() {
  181. this.loading = true;
  182. if(this.queryParams.logType == "10"){
  183. this.queryParams.logType = null;
  184. }
  185. watchLogStatistics(this.queryParams).then(response => {
  186. this.courseWatchLogList = response.rows;
  187. this.total = response.total;
  188. this.loading = false;
  189. });
  190. },
  191. // 取消按钮
  192. cancel() {
  193. this.open = false;
  194. this.reset();
  195. },
  196. // 表单重置
  197. reset() {
  198. this.form = {
  199. logId: null,
  200. userId: null,
  201. videoId: null,
  202. logType: null,
  203. createTime: null,
  204. updateTime: null,
  205. qwExternalContactId: null,
  206. externalUserName:null,
  207. duration: null,
  208. qwUserId: null,
  209. companyUserId: null,
  210. companyId: null,
  211. courseId: null,
  212. scheduleStartTime: null,
  213. scheduleEndTime: null,
  214. };
  215. this.scheduleTime=null;
  216. this.resetForm("form");
  217. },
  218. /** 搜索按钮操作 */
  219. handleQuery() {
  220. if (!this.queryParams.sTime || !this.queryParams.eTime) {
  221. this.$message.warning("请选择创建时间");
  222. return;
  223. }
  224. this.queryParams.pageNum = 1;
  225. this.getList();
  226. },
  227. /** 重置按钮操作 */
  228. resetQuery() {
  229. this.resetForm("queryForm");
  230. this.createTime = null;
  231. this.scheduleTime = null;
  232. this.queryParams.sTime = null;
  233. this.queryParams.eTime = null;
  234. this.queryParams.upSTime = null;
  235. this.queryParams.upETime = null;
  236. this.queryParams.scheduleStartTime = null;
  237. this.queryParams.scheduleEndTime = null;
  238. this.queryParams.externalUserName=null;
  239. this.scheduleTime=null;
  240. this.updateTime=null;
  241. this.handleQuery();
  242. },
  243. // 多选框选中数据
  244. handleSelectionChange(selection) {
  245. this.ids = selection.map(item => item.logId)
  246. this.single = selection.length!==1
  247. this.multiple = !selection.length
  248. },
  249. /** 新增按钮操作 */
  250. handleAdd() {
  251. this.reset();
  252. this.open = true;
  253. this.title = "添加短链课程看课记录";
  254. },
  255. /** 修改按钮操作 */
  256. handleUpdate(row) {
  257. this.reset();
  258. const logId = row.logId || this.ids
  259. getCourseWatchLog(logId).then(response => {
  260. this.form = response.data;
  261. this.open = true;
  262. this.title = "修改短链课程看课记录";
  263. });
  264. },
  265. /** 提交按钮 */
  266. submitForm() {
  267. this.$refs["form"].validate(valid => {
  268. if (valid) {
  269. if (this.form.logId != null) {
  270. updateCourseWatchLog(this.form).then(response => {
  271. this.msgSuccess("修改成功");
  272. this.open = false;
  273. this.getList();
  274. });
  275. } else {
  276. addCourseWatchLog(this.form).then(response => {
  277. this.msgSuccess("新增成功");
  278. this.open = false;
  279. this.getList();
  280. });
  281. }
  282. }
  283. });
  284. },
  285. /** 删除按钮操作 */
  286. handleDelete(row) {
  287. const logIds = row.logId || this.ids;
  288. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  289. confirmButtonText: "确定",
  290. cancelButtonText: "取消",
  291. type: "warning"
  292. }).then(function() {
  293. return delCourseWatchLog(logIds);
  294. }).then(() => {
  295. this.getList();
  296. this.msgSuccess("删除成功");
  297. }).catch(() => {});
  298. },
  299. /** 导出按钮操作 */
  300. handleExport() {
  301. const queryParams = this.queryParams;
  302. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  303. confirmButtonText: "确定",
  304. cancelButtonText: "取消",
  305. type: "warning"
  306. }).then(() => {
  307. this.exportLoading = true;
  308. return watchLogStatisticsExport(queryParams);
  309. }).then(response => {
  310. this.download(response.msg);
  311. this.exportLoading = false;
  312. }).catch(() => {});
  313. },
  314. handleScheduleTimeChange(val) {
  315. if (val) {
  316. this.queryParams.scheduleStartTime = val[0];
  317. this.queryParams.scheduleEndTime = val[1];
  318. } else {
  319. this.queryParams.scheduleStartTime = null;
  320. this.queryParams.scheduleEndTime = null;
  321. }
  322. },
  323. }
  324. };
  325. </script>