userCourseWatchLog.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <div class="apcontainer">
  3. <el-tabs type="card" v-model="activeName" @tab-click="handleClickX">
  4. <el-tab-pane label="全部" name="00"></el-tab-pane>
  5. <el-tab-pane v-for="(item,index) in logTypeOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  6. </el-tabs>
  7. <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange">
  8. <el-table-column type="selection" width="55" align="center" />
  9. <el-table-column label="记录编号" align="center" prop="logId" />
  10. <el-table-column label="用户账号" align="center" prop="userName" />
  11. <el-table-column label="企微客户" align="center" prop="externalUserName" v-if="queryParams.sourceType == 2"/>
  12. <el-table-column label="会员昵称" align="center" prop="fsNickName">
  13. <template slot-scope="scope">
  14. <div style="display: flex;white-space: nowrap">
  15. <div style="margin: auto">
  16. {{scope.row.fsNickName}}
  17. </div>
  18. <el-popover
  19. placement="right"
  20. title=""
  21. trigger="hover">
  22. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  23. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  24. </el-popover>
  25. </div>
  26. </template>
  27. </el-table-column>
  28. <el-table-column label="项目" align="center" prop="projectName" />
  29. <el-table-column label="课程名称" align="center" prop="courseName" />
  30. <el-table-column label="小节名称" align="center" prop="videoName" />
  31. <el-table-column label="企微员工名称" align="center" prop="qwUserName" v-if="queryParams.sourceType == 2"/>
  32. <el-table-column label="记录类型" align="center" prop="logType">
  33. <template slot-scope="scope">
  34. <dict-tag :options="logTypeOptions" :value="scope.row.logType"/>
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="播放时长" align="center" prop="duration" />
  38. <el-table-column label="所属销售" align="center" prop="companyUserName" />
  39. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  40. <!-- <el-table-column label="企微员工名称" align="center" prop="qwUserName" />-->
  41. <el-table-column label="所属发送方式" align="center" prop="sendType" />
  42. <el-table-column label="创建时间" align="center" prop="createTime" />
  43. <el-table-column label="更新时间" align="center" prop="updateTime" />
  44. <el-table-column label="完课时间" align="center" prop="finishTime" />
  45. <el-table-column label="营期时间" align="center" prop="campPeriodTime" />
  46. </el-table>
  47. <pagination
  48. v-show="total>0"
  49. :total="total"
  50. :page.sync="queryParams.pageNum"
  51. :limit.sync="queryParams.pageSize"
  52. @pagination="getList"
  53. />
  54. </div>
  55. </template>
  56. <script>
  57. import { listCourseWatchLog, getCourseWatchLog, delCourseWatchLog, addCourseWatchLog, updateCourseWatchLog, exportCourseWatchLog } from "@/api/course/courseWatchLog";
  58. import {allList}from "@/api/company/company";
  59. import { courseList,videoList } from '@/api/course/courseRedPacketLog'
  60. import {getUserList} from "@/api/company/companyUser";
  61. import {getFsUserList} from "@/api/users/user";
  62. export default {
  63. name: "CourseWatchLog",
  64. data() {
  65. return {
  66. userSourceTypeOptions: [],
  67. activeName:"00",
  68. createTime:null,
  69. updateTime:null,
  70. courseLists:[],
  71. videoList:[],
  72. logTypeOptions:[],
  73. queryUserLoading: false,
  74. // 遮罩层
  75. loading: true,
  76. // 导出遮罩层
  77. exportLoading: false,
  78. // 选中数组
  79. ids: [],
  80. // 非单个禁用
  81. single: true,
  82. // 非多个禁用
  83. multiple: true,
  84. // 显示搜索条件
  85. showSearch: true,
  86. // 总条数
  87. total: 0,
  88. companyUserList: [],
  89. // 短链课程看课记录表格数据
  90. courseWatchLogList: [],
  91. fsUserList: [],
  92. // 弹出层标题
  93. title: "",
  94. // 是否显示弹出层
  95. open: false,
  96. // 查询参数
  97. queryParams: {
  98. pageNum: 1,
  99. pageSize: 10,
  100. userId: null,
  101. nickName: null,
  102. videoId: null,
  103. logType: null,
  104. qwExternalContactId: null,
  105. externalUserName:null,
  106. duration: null,
  107. qwUserId: null,
  108. companyUserId: null,
  109. companyId: null,
  110. courseId: null,
  111. sTime:null,
  112. eTime:null,
  113. upSTime:null,
  114. upETime:null,
  115. scheduleStartTime: null,
  116. scheduleEndTime: null,
  117. },
  118. // 表单参数
  119. form: {},
  120. // 表单校验
  121. rules: {
  122. },
  123. scheduleTime: null,
  124. };
  125. },
  126. created() {
  127. courseList().then(response => {
  128. this.courseLists = response.list;
  129. });
  130. this.getList();
  131. this.getDicts("sys_course_watch_log_type").then(response => {
  132. this.logTypeOptions = response.data;
  133. });
  134. getUserList().then(res=>{
  135. if(res.code === 200) {
  136. this.companyUserList = res.data
  137. }
  138. })
  139. getFsUserList({}).then(res=>{
  140. if(res.code === 200) {
  141. this.fsUserList = res.data
  142. }
  143. })
  144. this.getDicts('user_source_type').then(response => {
  145. this.userSourceTypeOptions = response.data;
  146. })
  147. },
  148. computed: {
  149. sourceTypeModel: {
  150. get() {
  151. return this.queryParams.sourceType !== null && this.queryParams.sourceType !== undefined ? this.queryParams.sourceType.toString() : null;
  152. },
  153. set(newVal) {
  154. this.queryParams.sourceType = newVal;
  155. }
  156. }
  157. },
  158. methods: {
  159. getUserWatchLog(id) {
  160. this.queryParams.userId = id
  161. this.getList()
  162. },
  163. courseChange(row){
  164. this.queryParams.videoId=null;
  165. if(row === ''){
  166. this.videoList=[];
  167. return
  168. }
  169. videoList(row).then(response => {
  170. this.videoList=response.list
  171. });
  172. },
  173. handleClickX(tab,event){
  174. this.activeName=tab.name;
  175. if(tab.name=="00"){
  176. this.queryParams.logType=null;
  177. }else{
  178. this.queryParams.logType=tab.name;
  179. }
  180. this.getList()
  181. },
  182. /** 查询短链课程看课记录列表 */
  183. getList() {
  184. this.loading = true;
  185. if(this.queryParams.logType == "10"){
  186. this.queryParams.logType = null;
  187. }
  188. listCourseWatchLog(this.queryParams).then(response => {
  189. this.courseWatchLogList = response.rows;
  190. this.total = response.total;
  191. this.loading = false;
  192. });
  193. },
  194. // 取消按钮
  195. cancel() {
  196. this.open = false;
  197. this.reset();
  198. },
  199. // 表单重置
  200. reset() {
  201. this.form = {
  202. logId: null,
  203. userId: null,
  204. videoId: null,
  205. logType: null,
  206. createTime: null,
  207. updateTime: null,
  208. qwExternalContactId: null,
  209. externalUserName:null,
  210. duration: null,
  211. qwUserId: null,
  212. companyUserId: null,
  213. companyId: null,
  214. courseId: null,
  215. scheduleStartTime: null,
  216. scheduleEndTime: null,
  217. };
  218. this.scheduleTime=null;
  219. this.resetForm("form");
  220. },
  221. /** 搜索按钮操作 */
  222. handleQuery() {
  223. this.queryParams.pageNum = 1;
  224. this.getList();
  225. },
  226. /** 重置按钮操作 */
  227. resetQuery() {
  228. this.resetForm("queryForm");
  229. this.createTime = null;
  230. this.scheduleTime = null;
  231. this.queryParams.sTime = null;
  232. this.queryParams.eTime = null;
  233. this.queryParams.upSTime = null;
  234. this.queryParams.upETime = null;
  235. this.queryParams.scheduleStartTime = null;
  236. this.queryParams.scheduleEndTime = null;
  237. this.scheduleTime=null;
  238. this.updateTime=null;
  239. this.handleQuery();
  240. },
  241. // 多选框选中数据
  242. handleSelectionChange(selection) {
  243. this.ids = selection.map(item => item.logId)
  244. this.single = selection.length!==1
  245. this.multiple = !selection.length
  246. },
  247. /** 新增按钮操作 */
  248. handleAdd() {
  249. this.reset();
  250. this.open = true;
  251. this.title = "添加短链课程看课记录";
  252. },
  253. /** 修改按钮操作 */
  254. handleUpdate(row) {
  255. this.reset();
  256. const logId = row.logId || this.ids
  257. getCourseWatchLog(logId).then(response => {
  258. this.form = response.data;
  259. this.open = true;
  260. this.title = "修改短链课程看课记录";
  261. });
  262. },
  263. /** 提交按钮 */
  264. submitForm() {
  265. this.$refs["form"].validate(valid => {
  266. if (valid) {
  267. if (this.form.logId != null) {
  268. updateCourseWatchLog(this.form).then(response => {
  269. this.msgSuccess("修改成功");
  270. this.open = false;
  271. this.getList();
  272. });
  273. } else {
  274. addCourseWatchLog(this.form).then(response => {
  275. this.msgSuccess("新增成功");
  276. this.open = false;
  277. this.getList();
  278. });
  279. }
  280. }
  281. });
  282. },
  283. /** 删除按钮操作 */
  284. handleDelete(row) {
  285. const logIds = row.logId || this.ids;
  286. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  287. confirmButtonText: "确定",
  288. cancelButtonText: "取消",
  289. type: "warning"
  290. }).then(function() {
  291. return delCourseWatchLog(logIds);
  292. }).then(() => {
  293. this.getList();
  294. this.msgSuccess("删除成功");
  295. }).catch(() => {});
  296. },
  297. /** 导出按钮操作 */
  298. handleExport() {
  299. const queryParams = this.queryParams;
  300. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  301. confirmButtonText: "确定",
  302. cancelButtonText: "取消",
  303. type: "warning"
  304. }).then(() => {
  305. this.exportLoading = true;
  306. return exportCourseWatchLog(queryParams);
  307. }).then(response => {
  308. this.download(response.msg);
  309. this.exportLoading = false;
  310. }).catch(() => {});
  311. },
  312. handleScheduleTimeChange(val) {
  313. if (val) {
  314. this.queryParams.scheduleStartTime = val[0];
  315. this.queryParams.scheduleEndTime = val[1];
  316. } else {
  317. this.queryParams.scheduleStartTime = null;
  318. this.queryParams.scheduleEndTime = null;
  319. }
  320. },
  321. }
  322. };
  323. </script>