myCourseWatchLog.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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="qwUserId">
  5. <el-select v-model="queryParams.qwUserId" placeholder="企微账号" clearable size="small" @change="updateQwuser()">
  6. <el-option
  7. v-for="dict in myQwUserList"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel + '('+dict.corpName+')'"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="客户ID" prop="qwExternalContactId">
  15. <el-input
  16. v-model="queryParams.qwExternalContactId"
  17. placeholder="请输入会员ID"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="会员ID" prop="userId">
  24. <el-input
  25. v-model="queryParams.userId"
  26. placeholder="请输入会员ID"
  27. clearable
  28. size="small"
  29. @keyup.enter.native="handleQuery"
  30. />
  31. </el-form-item>
  32. <el-form-item label="会员昵称" prop="nickName">
  33. <el-input
  34. v-model="queryParams.nickName"
  35. placeholder="请输入会员昵称"
  36. clearable
  37. size="small"
  38. @keyup.enter.native="handleQuery"
  39. />
  40. </el-form-item>
  41. <el-form-item label="企微客户昵称" prop="nickName">
  42. <el-input
  43. v-model="queryParams.externalUserName"
  44. placeholder="请输入企微客户昵称"
  45. clearable
  46. size="small"
  47. @keyup.enter.native="handleQuery"
  48. />
  49. </el-form-item>
  50. <el-form-item label="课程" prop="courseId">
  51. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  52. <el-option
  53. v-for="dict in courseLists"
  54. :key="dict.dictValue"
  55. :label="dict.dictLabel"
  56. :value="dict.dictValue"
  57. />
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="小节" prop="videoId">
  61. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  62. <el-option
  63. v-for="dict in videoList"
  64. :key="dict.dictValue"
  65. :label="dict.dictLabel"
  66. :value="dict.dictValue"
  67. />
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item label="创建时间" prop="createTime">
  71. <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>
  72. </el-form-item>
  73. <el-table-column label="完课时间" align="center" prop="finishTime" />
  74. <el-table-column label="营期时间" align="center" prop="campPeriodTime" />
  75. <el-form-item>
  76. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  77. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  78. </el-form-item>
  79. </el-form>
  80. <el-row :gutter="10" class="mb8">
  81. <el-col :span="1.5">
  82. <el-button
  83. type="warning"
  84. plain
  85. icon="el-icon-download"
  86. size="mini"
  87. :loading="exportLoading"
  88. @click="handleExport"
  89. v-hasPermi="['course:courseWatchLog:myExport']"
  90. >导出</el-button>
  91. </el-col>
  92. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  93. </el-row>
  94. <el-tabs type="card" v-model="queryParams.logType" @tab-click="handleClickX">
  95. <el-tab-pane label="全部" name="10"></el-tab-pane>
  96. <el-tab-pane v-for="(item,index) in logTypeOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  97. </el-tabs>
  98. <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange">
  99. <el-table-column type="selection" width="55" align="center" />
  100. <el-table-column label="记录编号" align="center" prop="logId" />
  101. <el-table-column label="企微客户" align="center" prop="externalUserName"/>
  102. <el-table-column label="会员ID" align="center" prop="userId" />
  103. <el-table-column label="会员昵称" align="center" prop="fsNickName">
  104. <template slot-scope="scope">
  105. <div style="display: flex;white-space: nowrap">
  106. <div style="margin: auto">
  107. {{scope.row.fsNickName}}
  108. </div>
  109. <el-popover
  110. placement="right"
  111. title=""
  112. trigger="hover">
  113. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  114. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  115. </el-popover>
  116. </div>
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="课程名称" align="center" prop="courseName" />
  120. <el-table-column label="小节名称" align="center" prop="videoName" />
  121. <el-table-column label="记录类型" align="center" prop="logType">
  122. <template slot-scope="scope">
  123. <dict-tag :options="logTypeOptions" :value="scope.row.logType"/>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="播放时长" align="center" prop="duration" />
  127. <el-table-column label="所属销售" align="center" prop="companyUserName" />
  128. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  129. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  130. <el-table-column label="企微账号" align="center" prop="qwUserName" />
  131. <!-- <el-table-column label="所属发送方式" align="center" prop="sendType" />-->
  132. <el-table-column label="创建时间" align="center" prop="createTime" />
  133. <!-- <el-table-column label="更新时间" align="center" prop="updateTime" />-->
  134. <el-table-column label="完课时间" align="center" prop="lastHeartbeatTime" />
  135. </el-table>
  136. <pagination
  137. v-show="total>0"
  138. :total="total"
  139. :page.sync="queryParams.pageNum"
  140. :limit.sync="queryParams.pageSize"
  141. @pagination="getList"
  142. />
  143. </div>
  144. </template>
  145. <script>
  146. import {
  147. myListCourseWatchLog,
  148. getCourseWatchLog,
  149. delCourseWatchLog,
  150. addCourseWatchLog,
  151. updateCourseWatchLog,
  152. exportCourseWatchLog,
  153. exportCourseWatchLogMy
  154. } from "@/api/course/courseWatchLog";
  155. import { courseList,videoList } from '@/api/course/courseRedPacketLog'
  156. import {getMyQwUserList} from "@/api/qw/user";
  157. import {allListTagGroup} from "@/api/qw/tagGroup";
  158. import {listTag} from "@/api/qw/tag";
  159. export default {
  160. name: "CourseWatchLog",
  161. data() {
  162. return {
  163. createTime:null,
  164. courseLists:[],
  165. videoList:[],
  166. myQwUserList:[],
  167. logTypeOptions:[],
  168. // 遮罩层
  169. loading: true,
  170. // 导出遮罩层
  171. exportLoading: false,
  172. // 选中数组
  173. ids: [],
  174. // 非单个禁用
  175. single: true,
  176. // 非多个禁用
  177. multiple: true,
  178. // 显示搜索条件
  179. showSearch: true,
  180. // 总条数
  181. total: 0,
  182. // 短链课程看课记录表格数据
  183. courseWatchLogList: [],
  184. // 弹出层标题
  185. title: "",
  186. // 是否显示弹出层
  187. open: false,
  188. // 查询参数
  189. queryParams: {
  190. pageNum: 1,
  191. pageSize: 10,
  192. userId: null,
  193. videoId: null,
  194. nickName:null,
  195. logType: "10",
  196. qwExternalContactId: null,
  197. externalUserName:null,
  198. duration: null,
  199. qwUserId: null,
  200. companyUserId: null,
  201. companyId: null,
  202. courseId: null,
  203. sTime:null,
  204. eTime:null,
  205. scheduleStartTime: null,
  206. scheduleEndTime: null,
  207. },
  208. // 表单参数
  209. form: {},
  210. // 表单校验
  211. rules: {
  212. }
  213. };
  214. },
  215. created() {
  216. courseList().then(response => {
  217. this.courseLists = response.list;
  218. });
  219. this.getList();
  220. this.getDicts("sys_course_watch_log_type_new").then(response => {
  221. this.logTypeOptions = response.data;
  222. });
  223. getMyQwUserList().then(response => {
  224. this.myQwUserList = response.data;
  225. });
  226. },
  227. methods: {
  228. courseChange(row){
  229. this.queryParams.videoId=null;
  230. if(row === ''){
  231. this.videoList=[];
  232. return
  233. }
  234. videoList(row).then(response => {
  235. this.videoList=response.list
  236. });
  237. },
  238. updateQwuser(){
  239. for (const user of this.myQwUserList) {
  240. if (user.dictValue == this.queryParams.qwUserId) {
  241. this.queryParams.corpId=user.corpId;
  242. break;
  243. }
  244. }
  245. this.getList();
  246. },
  247. change() {
  248. if (this.createTime != null) {
  249. this.queryParams.sTime = this.createTime[0];
  250. this.queryParams.eTime = this.createTime[1];
  251. } else {
  252. this.queryParams.sTime = null;
  253. this.queryParams.eTime = null;
  254. }
  255. },
  256. handleClickX(tab){
  257. if(tab.name==="10"){
  258. this.queryParams.logType=null;
  259. }else{
  260. this.queryParams.logType=tab.name;
  261. }
  262. this.getList()
  263. },
  264. /** 查询短链课程看课记录列表 */
  265. getList() {
  266. this.loading = true;
  267. myListCourseWatchLog(this.queryParams).then(response => {
  268. this.courseWatchLogList = response.rows;
  269. this.total = response.total;
  270. this.loading = false;
  271. });
  272. },
  273. // 取消按钮
  274. cancel() {
  275. this.open = false;
  276. this.reset();
  277. },
  278. // 表单重置
  279. reset() {
  280. this.form = {
  281. logId: null,
  282. userId: null,
  283. videoId: null,
  284. logType: null,
  285. createTime: null,
  286. updateTime: null,
  287. qwExternalContactId: null,
  288. externalUserName:null,
  289. duration: null,
  290. qwUserId: null,
  291. companyUserId: null,
  292. companyId: null,
  293. courseId: null,
  294. scheduleStartTime: null,
  295. scheduleEndTime: null,
  296. };
  297. this.scheduleTime=null;
  298. this.resetForm("form");
  299. },
  300. /** 搜索按钮操作 */
  301. handleQuery() {
  302. this.queryParams.pageNum = 1;
  303. this.getList();
  304. },
  305. /** 重置按钮操作 */
  306. resetQuery() {
  307. this.resetForm("queryForm");
  308. this.createTime = null;
  309. this.queryParams.sTime = null;
  310. this.queryParams.eTime = null;
  311. this.queryParams.scheduleStartTime = null;
  312. this.queryParams.scheduleEndTime = null;
  313. this.scheduleTime=null;
  314. this.handleQuery();
  315. },
  316. // 多选框选中数据
  317. handleSelectionChange(selection) {
  318. this.ids = selection.map(item => item.logId)
  319. this.single = selection.length!==1
  320. this.multiple = !selection.length
  321. },
  322. /** 新增按钮操作 */
  323. handleAdd() {
  324. this.reset();
  325. this.open = true;
  326. this.title = "添加短链课程看课记录";
  327. },
  328. /** 修改按钮操作 */
  329. handleUpdate(row) {
  330. this.reset();
  331. const logId = row.logId || this.ids
  332. getCourseWatchLog(logId).then(response => {
  333. this.form = response.data;
  334. this.open = true;
  335. this.title = "修改短链课程看课记录";
  336. });
  337. },
  338. /** 提交按钮 */
  339. submitForm() {
  340. this.$refs["form"].validate(valid => {
  341. if (valid) {
  342. if (this.form.logId != null) {
  343. updateCourseWatchLog(this.form).then(response => {
  344. this.msgSuccess("修改成功");
  345. this.open = false;
  346. this.getList();
  347. });
  348. } else {
  349. addCourseWatchLog(this.form).then(response => {
  350. this.msgSuccess("新增成功");
  351. this.open = false;
  352. this.getList();
  353. });
  354. }
  355. }
  356. });
  357. },
  358. /** 删除按钮操作 */
  359. handleDelete(row) {
  360. const logIds = row.logId || this.ids;
  361. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  362. confirmButtonText: "确定",
  363. cancelButtonText: "取消",
  364. type: "warning"
  365. }).then(function() {
  366. return delCourseWatchLog(logIds);
  367. }).then(() => {
  368. this.getList();
  369. this.msgSuccess("删除成功");
  370. }).catch(() => {});
  371. },
  372. /** 导出按钮操作 */
  373. handleExport() {
  374. const queryParams = this.queryParams;
  375. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  376. confirmButtonText: "确定",
  377. cancelButtonText: "取消",
  378. type: "warning"
  379. }).then(() => {
  380. this.exportLoading = true;
  381. return exportCourseWatchLogMy(queryParams);
  382. }).then(response => {
  383. this.download(response.msg);
  384. this.exportLoading = false;
  385. }).catch(() => {});
  386. }
  387. }
  388. };
  389. </script>