watchLog.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  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"
  6. @change="updateQwuser()">
  7. <el-option
  8. v-for="dict in myQwUserList"
  9. :key="dict.dictValue"
  10. :label="dict.dictLabel + '('+dict.corpName+')'"
  11. :value="dict.dictValue"
  12. />
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="客户ID" prop="qwExternalContactId">
  16. <el-input
  17. v-model="queryParams.qwExternalContactId"
  18. placeholder="请输入会员ID"
  19. clearable
  20. size="small"
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. <el-form-item label="会员ID" prop="userId">
  25. <el-input
  26. v-model="queryParams.userId"
  27. placeholder="请输入会员ID"
  28. clearable
  29. size="small"
  30. @keyup.enter.native="handleQuery"
  31. />
  32. </el-form-item>
  33. <el-form-item label="会员昵称" prop="nickName">
  34. <el-input
  35. v-model="queryParams.nickName"
  36. placeholder="请输入会员昵称"
  37. clearable
  38. size="small"
  39. @keyup.enter.native="handleQuery"
  40. />
  41. </el-form-item>
  42. <el-form-item label="企微客户昵称" prop="nickName">
  43. <el-input
  44. v-model="queryParams.externalUserName"
  45. placeholder="请输入企微客户昵称"
  46. clearable
  47. size="small"
  48. @keyup.enter.native="handleQuery"
  49. />
  50. </el-form-item>
  51. <el-form-item label="课程" prop="courseId">
  52. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small"
  53. @change="courseChange(queryParams.courseId)">
  54. <el-option
  55. v-for="dict in courseLists"
  56. :key="dict.dictValue"
  57. :label="dict.dictLabel"
  58. :value="dict.dictValue"
  59. />
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item label="小节" prop="videoId">
  63. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  64. <el-option
  65. v-for="dict in videoList"
  66. :key="dict.dictValue"
  67. :label="dict.dictLabel"
  68. :value="dict.dictValue"
  69. />
  70. </el-select>
  71. </el-form-item>
  72. <el-form-item label="营期时间" prop="scheduleTime">
  73. <el-date-picker
  74. v-model="scheduleTime"
  75. type="daterange"
  76. size="small"
  77. style="width: 240px"
  78. value-format="yyyy-MM-dd"
  79. range-separator="-"
  80. start-placeholder="开始日期"
  81. end-placeholder="结束日期"
  82. @change="handleScheduleTimeChange">
  83. </el-date-picker>
  84. </el-form-item>
  85. <el-form-item label="创建时间" prop="createTime">
  86. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd"
  87. type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
  88. @change="createChange"></el-date-picker>
  89. </el-form-item>
  90. <el-form-item label="最新更新时间" prop="updateTime">
  91. <el-date-picker v-model="updateTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange"
  92. range-separator="-" start-placeholder="开始日期"
  93. end-placeholder="结束日期" @change="updateChange"></el-date-picker>
  94. </el-form-item>
  95. <el-form-item>
  96. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  97. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  98. </el-form-item>
  99. </el-form>
  100. <el-row :gutter="10" class="mb8">
  101. <el-col :span="1.5">
  102. <el-button
  103. type="warning"
  104. plain
  105. icon="el-icon-download"
  106. size="mini"
  107. :loading="exportLoading"
  108. @click="handleExport"
  109. v-hasPermi="['course:courseWatchLog:myExport']"
  110. >导出
  111. </el-button>
  112. </el-col>
  113. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  114. </el-row>
  115. <el-tabs type="card" v-model="activeName" @tab-click="handleClickX">
  116. <el-tab-pane label="全部" name="00"></el-tab-pane>
  117. <el-tab-pane v-for="(item,index) in logTypeOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  118. </el-tabs>
  119. <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange">
  120. <el-table-column type="selection" width="55" align="center"/>
  121. <el-table-column label="记录编号" align="center" prop="logId"/>
  122. <el-table-column label="客户昵称" align="center" prop="externalUserName"/>
  123. <!-- <el-table-column label="会员ID" align="center" prop="userId"/>-->
  124. <el-table-column label="客户头像" align="center" prop="externalUserAvatar">
  125. <template slot-scope="scope">
  126. <el-popover
  127. placement="right"
  128. title=""
  129. trigger="hover">
  130. <img slot="reference" :src="scope.row.externalUserAvatar" style="width: 50px;height: 50px">
  131. <img :src="scope.row.externalUserAvatar" style="max-width: 200px;max-height: 200px">
  132. </el-popover>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="课程名称" align="center" prop="courseName"/>
  136. <el-table-column label="小节名称" align="center" prop="videoName"/>
  137. <el-table-column label="记录类型" align="center" prop="logType">
  138. <template slot-scope="scope">
  139. <dict-tag :options="logTypeOptions" :value="scope.row.logType"/>
  140. </template>
  141. </el-table-column>
  142. <el-table-column label="播放时长" align="center" prop="duration"/>
  143. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName"/>-->
  144. <!-- <el-table-column label="所属公司" align="center" prop="companyName"/>-->
  145. <!-- <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>-->
  146. <el-table-column label="所属企微" align="center" prop="qwUserName"/>
  147. <!-- <el-table-column label="所属发送方式" align="center" prop="sendType"/>-->
  148. <el-table-column label="创建时间" align="center" prop="createTime" width="100px"/>
  149. <el-table-column label="更新时间" align="center" prop="updateTime" width="100px" />
  150. <el-table-column label="完课时间" align="center" prop="finishTime" width="100px" />
  151. <el-table-column label="营期时间" align="center" prop="campPeriodTime" />
  152. <el-table-column
  153. fixed="right"
  154. label="操作"
  155. width="100">
  156. <template slot-scope="scope">
  157. <el-button @click="openAnswerLogFun(scope.row)" type="text" size="small">答题记录</el-button>
  158. <el-button @click="openRedLogFun(scope.row)" type="text" size="small">红包记录</el-button>
  159. </template>
  160. </el-table-column>
  161. </el-table>
  162. <pagination
  163. v-show="total>0"
  164. :total="total"
  165. :page.sync="queryParams.pageNum"
  166. :limit.sync="queryParams.pageSize"
  167. @pagination="getList"
  168. />
  169. <el-drawer title="答题记录" :visible.sync="openAnswerLog" size="70%" append-to-body>
  170. <el-table border v-loading="" :data="answerLogsList">
  171. <el-table-column label="会员用户" align="center" prop="userName">
  172. <template slot-scope="scope">
  173. <div style="display: flex;white-space: nowrap">
  174. <div style="margin: auto">
  175. {{ scope.row.userName }}
  176. </div>
  177. <el-popover
  178. placement="right"
  179. title=""
  180. trigger="hover">
  181. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  182. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  183. </el-popover>
  184. </div>
  185. </template>
  186. </el-table-column>
  187. <el-table-column label="课程名称" align="center" prop="courseName"/>
  188. <el-table-column label="小节名称" align="center" prop="videoName"/>
  189. <el-table-column label="是否全部正确" align="center" prop="isRight">
  190. <template slot-scope="scope">
  191. <dict-tag :options="sysCompanyOr" :value="scope.row.isRight"></dict-tag>
  192. </template>
  193. </el-table-column>
  194. <el-table-column label="销售名称" align="center" prop="companyUserName"/>
  195. <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>
  196. <el-table-column label="公司名称" align="center" prop="companyName"/>
  197. <el-table-column label="创建时间" align="center" prop="createTime"/>
  198. </el-table>
  199. <pagination
  200. v-show="answerLogTotal>0"
  201. :total="answerLogTotal"
  202. :page.sync="answerLogQueryParams.pageNum"
  203. :limit.sync="answerLogQueryParams.pageSize"
  204. @pagination="answerLogList"
  205. />
  206. </el-drawer>
  207. <el-drawer title="红包记录" :visible.sync="openRedLog" size="70%" append-to-body>
  208. <el-table border v-loading="" :data="redLogsList">
  209. <el-table-column type="selection" width="55" align="center" />
  210. <el-table-column label="记录编号" align="center" prop="logId" />
  211. <el-table-column label="批次单号" align="center" prop="outBatchNo" />
  212. <el-table-column label="课程名称" align="center" prop="courseId" >
  213. <template slot-scope="scope">
  214. <span prop="status" v-for="(item, index) in courseLists" v-if="scope.row.courseId==item.dictValue">{{item.dictLabel}}</span>
  215. </template>
  216. </el-table-column>
  217. <el-table-column label="小节名称" align="center" prop="title" />
  218. <!-- <el-table-column label="会员id" align="center" prop="userId" />-->
  219. <el-table-column label="会员用户" align="center" prop="fsNickName">
  220. <template slot-scope="scope">
  221. <div style="display: flex;white-space: nowrap">
  222. <div style="margin: auto">
  223. {{scope.row.fsNickName}}
  224. </div>
  225. <el-popover
  226. placement="right"
  227. title=""
  228. trigger="hover">
  229. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  230. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  231. </el-popover>
  232. </div>
  233. </template>
  234. </el-table-column>
  235. <!-- <el-table-column label="会员电话" align="center" prop="phone" />-->
  236. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName" />-->
  237. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  238. <el-table-column label="转帐金额" align="center" prop="amount" />
  239. <el-table-column label="状态" align="center" prop="status" >
  240. <template slot-scope="scope">
  241. <el-tag>{{ scope.row.status === 0 ? "发送中" : "已完成" }}</el-tag>
  242. </template>
  243. </el-table-column>
  244. <el-table-column label="所属企微" align="center" prop="qwUserName" />
  245. <el-table-column label="创建时间" align="center" prop="createTime" />
  246. </el-table>
  247. <pagination
  248. v-show="redLogTotal>0"
  249. :total="redLogTotal"
  250. :page.sync="redLogQueryParams.pageNum"
  251. :limit.sync="redLogQueryParams.pageSize"
  252. @pagination="redLogList"
  253. />
  254. </el-drawer>
  255. </div>
  256. </template>
  257. <script>
  258. import {
  259. addCourseWatchLog,
  260. delCourseWatchLog,
  261. exportCourseWatchLog,
  262. getCourseWatchLog,
  263. myListCourseWatchLog,
  264. updateCourseWatchLog
  265. } from "@/api/course/courseWatchLog";
  266. import {courseList, myListCourseRedPacketLog, videoList} from '@/api/course/courseRedPacketLog'
  267. import {myListLogs} from "@/api/course/courseAnswerlogs";
  268. import {getMyQwUserList} from "@/api/qw/user";
  269. export default {
  270. name: "CourseWatchLog",
  271. data() {
  272. return {
  273. activeName:"2",
  274. createTime: null,
  275. updateTime:null,
  276. courseLists: [],
  277. videoList: [],
  278. myQwUserList: [],
  279. logTypeOptions: [],
  280. // 遮罩层
  281. loading: true,
  282. // 导出遮罩层
  283. exportLoading: false,
  284. // 选中数组
  285. ids: [],
  286. // 非单个禁用
  287. single: true,
  288. scheduleTime: null,
  289. // 非多个禁用
  290. multiple: true,
  291. // 显示搜索条件
  292. showSearch: true,
  293. sysCompanyOr: [],
  294. // 总条数
  295. total: 0,
  296. // 短链课程看课记录表格数据
  297. courseWatchLogList: [],
  298. openAnswerLog: false,
  299. loadingAnswerLog: true,
  300. answerLogsList: [],
  301. answerLogTotal: 0,
  302. answerLogQueryParams: {
  303. pageNum: 1,
  304. pageSize: 10,
  305. },
  306. openRedLog: false,
  307. loadingRedLog: true,
  308. redLogsList: [],
  309. redLogTotal: 0,
  310. redLogQueryParams: {
  311. pageNum: 1,
  312. pageSize: 10,
  313. },
  314. // 弹出层标题
  315. title: "",
  316. // 是否显示弹出层
  317. open: false,
  318. // 查询参数
  319. queryParams: {
  320. pageNum: 1,
  321. pageSize: 10,
  322. userId: null,
  323. videoId: null,
  324. nickName: null,
  325. logType: 2,
  326. qwExternalContactId: null,
  327. externalUserName:null,
  328. duration: null,
  329. qwUserId: null,
  330. companyUserId: null,
  331. companyId: null,
  332. courseId: null,
  333. sTime: null,
  334. eTime: null,
  335. upSTime:null,
  336. upETime:null,
  337. scheduleStartTime: null,
  338. scheduleEndTime: null,
  339. },
  340. // 表单参数
  341. form: {},
  342. // 表单校验
  343. rules: {}
  344. };
  345. },
  346. created() {
  347. courseList().then(response => {
  348. this.courseLists = response.list;
  349. });
  350. this.getList();
  351. this.getDicts("sys_course_watch_log_type").then(response => {
  352. this.logTypeOptions = response.data;
  353. });
  354. this.getDicts("sys_company_or").then(response => {
  355. this.sysCompanyOr = response.data;
  356. });
  357. getMyQwUserList().then(response => {
  358. this.myQwUserList = response.data;
  359. });
  360. },
  361. methods: {
  362. courseChange(row) {
  363. this.queryParams.videoId = null;
  364. if (row === '') {
  365. this.videoList = [];
  366. return
  367. }
  368. videoList(row).then(response => {
  369. this.videoList = response.list
  370. });
  371. },
  372. updateQwuser() {
  373. for (const user of this.myQwUserList) {
  374. if (user.dictValue == this.queryParams.qwUserId) {
  375. this.queryParams.corpId = user.corpId;
  376. break;
  377. }
  378. }
  379. this.getList();
  380. },
  381. createChange() {
  382. if (this.createTime != null) {
  383. this.queryParams.sTime = this.createTime[0];
  384. this.queryParams.eTime = this.createTime[1];
  385. } else {
  386. this.queryParams.sTime = null;
  387. this.queryParams.eTime = null;
  388. }
  389. },
  390. updateChange(){
  391. if (this.updateTime != null) {
  392. this.queryParams.upSTime = this.updateTime[0];
  393. this.queryParams.upETime = this.updateTime[1];
  394. } else {
  395. this.queryParams.upSTime = null;
  396. this.queryParams.upETime = null;
  397. }
  398. },
  399. handleClickX(tab) {
  400. this.activeName=tab.name;
  401. if(tab.name=="00"){
  402. this.queryParams.logType=null;
  403. }else{
  404. this.queryParams.logType=tab.name;
  405. }
  406. this.getList()
  407. },
  408. handleScheduleTimeChange(val) {
  409. if (val) {
  410. this.queryParams.scheduleStartTime = val[0];
  411. this.queryParams.scheduleEndTime = val[1];
  412. } else {
  413. this.queryParams.scheduleStartTime = null;
  414. this.queryParams.scheduleEndTime = null;
  415. }
  416. },
  417. /** 查询短链课程看课记录列表 */
  418. getList() {
  419. this.loading = true;
  420. let param = JSON.parse(JSON.stringify(this.queryParams));
  421. if (param.logType == "10") {
  422. param.logType = null;
  423. }
  424. myListCourseWatchLog(param).then(response => {
  425. this.courseWatchLogList = response.rows;
  426. this.total = response.total;
  427. this.loading = false;
  428. });
  429. },
  430. // 取消按钮
  431. cancel() {
  432. this.open = false;
  433. this.reset();
  434. },
  435. // 表单重置
  436. reset() {
  437. this.form = {
  438. logId: null,
  439. userId: null,
  440. videoId: null,
  441. logType: null,
  442. createTime: null,
  443. updateTime: null,
  444. qwExternalContactId: null,
  445. externalUserName:null,
  446. duration: null,
  447. qwUserId: null,
  448. companyUserId: null,
  449. companyId: null,
  450. courseId: null,
  451. scheduleStartTime: null,
  452. scheduleEndTime: null,
  453. };
  454. this.scheduleTime=null;
  455. this.resetForm("form");
  456. },
  457. /** 搜索按钮操作 */
  458. handleQuery() {
  459. this.queryParams.pageNum = 1;
  460. this.getList();
  461. },
  462. /** 重置按钮操作 */
  463. resetQuery() {
  464. this.resetForm("queryForm");
  465. this.createTime = null;
  466. this.queryParams.sTime = null;
  467. this.queryParams.eTime = null;
  468. this.queryParams.upSTime = null;
  469. this.queryParams.upETime = null;
  470. this.queryParams.scheduleStartTime = null;
  471. this.queryParams.scheduleEndTime = null;
  472. this.scheduleTime=null;
  473. this.updateTime=null;
  474. this.handleQuery();
  475. },
  476. // 多选框选中数据
  477. handleSelectionChange(selection) {
  478. this.ids = selection.map(item => item.logId)
  479. this.single = selection.length !== 1
  480. this.multiple = !selection.length
  481. },
  482. /** 新增按钮操作 */
  483. handleAdd() {
  484. this.reset();
  485. this.open = true;
  486. this.title = "添加短链课程看课记录";
  487. },
  488. /** 修改按钮操作 */
  489. handleUpdate(row) {
  490. this.reset();
  491. const logId = row.logId || this.ids
  492. getCourseWatchLog(logId).then(response => {
  493. this.form = response.data;
  494. this.open = true;
  495. this.title = "修改短链课程看课记录";
  496. });
  497. },
  498. /** 提交按钮 */
  499. submitForm() {
  500. this.$refs["form"].validate(valid => {
  501. if (valid) {
  502. if (this.form.logId != null) {
  503. updateCourseWatchLog(this.form).then(response => {
  504. this.msgSuccess("修改成功");
  505. this.open = false;
  506. this.getList();
  507. });
  508. } else {
  509. addCourseWatchLog(this.form).then(response => {
  510. this.msgSuccess("新增成功");
  511. this.open = false;
  512. this.getList();
  513. });
  514. }
  515. }
  516. });
  517. },
  518. /** 删除按钮操作 */
  519. handleDelete(row) {
  520. const logIds = row.logId || this.ids;
  521. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  522. confirmButtonText: "确定",
  523. cancelButtonText: "取消",
  524. type: "warning"
  525. }).then(function () {
  526. return delCourseWatchLog(logIds);
  527. }).then(() => {
  528. this.getList();
  529. this.msgSuccess("删除成功");
  530. }).catch(() => {
  531. });
  532. },
  533. /** 导出按钮操作 */
  534. handleExport() {
  535. const queryParams = this.queryParams;
  536. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  537. confirmButtonText: "确定",
  538. cancelButtonText: "取消",
  539. type: "warning"
  540. }).then(() => {
  541. this.exportLoading = true;
  542. return exportCourseWatchLog(queryParams);
  543. }).then(response => {
  544. this.download(response.msg);
  545. this.exportLoading = false;
  546. }).catch(() => {
  547. });
  548. },
  549. openAnswerLogFun(row) {
  550. this.openAnswerLog = true;
  551. this.answerLogQueryParams.watchLogId = row.logId;
  552. this.answerLogList();
  553. },
  554. answerLogList() {
  555. this.loadingAnswerLog = true;
  556. myListLogs(this.answerLogQueryParams).then(e => {
  557. this.answerLogsList = e.rows;
  558. this.answerLogTotal = e.total;
  559. this.loadingAnswerLog = false;
  560. })
  561. },
  562. openRedLogFun(row) {
  563. this.openRedLog = true;
  564. this.redLogQueryParams.watchLogId = row.logId;
  565. this.redLogList();
  566. },
  567. redLogList() {
  568. this.loadingRedLog = true;
  569. console.info(this.redLogQueryParams)
  570. myListCourseRedPacketLog(this.redLogQueryParams).then(e => {
  571. this.redLogsList = e.rows;
  572. this.redLogTotal = e.total;
  573. this.loadingRedLog = false;
  574. })
  575. },
  576. }
  577. };
  578. </script>