watchLog.vue 20 KB

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