index.vue 14 KB

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