index.vue 16 KB

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