index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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="companyUserName">
  32. <el-input
  33. v-model="queryParams.companyUserName"
  34. placeholder="请输入所属销售"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item label="课程" prop="courseId">
  41. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  42. <el-option
  43. v-for="dict in courseLists"
  44. :key="dict.dictValue"
  45. :label="dict.dictLabel"
  46. :value="dict.dictValue"
  47. />
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item label="小节" prop="videoId">
  51. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  52. <el-option
  53. v-for="dict in videoList"
  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="scheduleTime">
  61. <el-date-picker
  62. v-model="scheduleTime"
  63. type="daterange"
  64. size="small"
  65. style="width: 240px"
  66. value-format="yyyy-MM-dd"
  67. range-separator="-"
  68. start-placeholder="开始日期"
  69. end-placeholder="结束日期"
  70. @change="handleScheduleTimeChange">
  71. </el-date-picker>
  72. </el-form-item>
  73. <el-form-item label="创建时间" prop="createTime">
  74. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange"
  75. range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="createChange"></el-date-picker>
  76. </el-form-item>
  77. <el-form-item label="最新更新时间" prop="updateTime">
  78. <el-date-picker v-model="updateTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange"
  79. range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="updateChange"></el-date-picker>
  80. </el-form-item>
  81. <el-form-item>
  82. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  83. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  84. </el-form-item>
  85. </el-form>
  86. <el-row :gutter="10" class="mb8">
  87. <el-col :span="1.5">
  88. <el-button
  89. type="warning"
  90. plain
  91. icon="el-icon-download"
  92. size="mini"
  93. :loading="exportLoading"
  94. @click="handleExport"
  95. v-hasPermi="['course:courseWatchLog:export']"
  96. >导出</el-button>
  97. </el-col>
  98. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  99. </el-row>
  100. <el-tabs type="card" v-model="activeName" @tab-click="handleClickX">
  101. <el-tab-pane label="全部" name="00"></el-tab-pane>
  102. <el-tab-pane v-for="(item,index) in logTypeOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  103. </el-tabs>
  104. <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange">
  105. <el-table-column type="selection" width="55" align="center" />
  106. <el-table-column label="记录编号" align="center" prop="logId" />
  107. <el-table-column label="客户昵称" align="center" prop="externalUserName"/>
  108. <!-- <el-table-column label="会员ID" align="center" prop="userId"/>-->
  109. <el-table-column label="客户头像" align="center" prop="externalUserAvatar">
  110. <template slot-scope="scope">
  111. <el-popover
  112. placement="right"
  113. title=""
  114. trigger="hover">
  115. <img slot="reference" :src="scope.row.externalUserAvatar" style="width: 50px;height: 50px">
  116. <img :src="scope.row.externalUserAvatar" style="max-width: 200px;max-height: 200px">
  117. </el-popover>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="课程名称" align="center" prop="courseName" />
  121. <el-table-column label="小节名称" align="center" prop="videoName" />
  122. <el-table-column label="记录类型" align="center" prop="logType">
  123. <template slot-scope="scope">
  124. <dict-tag :options="logTypeOptions" :value="scope.row.logType"/>
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="播放时长" align="center" prop="duration" />
  128. <el-table-column label="所属销售" align="center" prop="companyUserName" />
  129. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  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="finishTime" />
  135. <el-table-column label="营期时间" align="center" prop="campPeriodTime" />
  136. </el-table>
  137. <pagination
  138. v-show="total>0"
  139. :total="total"
  140. :page.sync="queryParams.pageNum"
  141. :limit.sync="queryParams.pageSize"
  142. @pagination="getList"
  143. />
  144. </div>
  145. </template>
  146. <script>
  147. import { listCourseWatchLog, getCourseWatchLog, delCourseWatchLog, addCourseWatchLog, updateCourseWatchLog, exportCourseWatchLog } from "@/api/course/courseWatchLog";
  148. import {allList}from "@/api/company/company";
  149. import { courseList,videoList } from '@/api/course/courseRedPacketLog'
  150. export default {
  151. name: "CourseWatchLog",
  152. data() {
  153. return {
  154. activeName:"2",
  155. createTime:null,
  156. updateTime:null,
  157. courseLists:[],
  158. videoList:[],
  159. logTypeOptions:[],
  160. // 遮罩层
  161. loading: true,
  162. // 导出遮罩层
  163. exportLoading: false,
  164. // 选中数组
  165. ids: [],
  166. // 非单个禁用
  167. single: true,
  168. // 非多个禁用
  169. multiple: true,
  170. // 显示搜索条件
  171. showSearch: true,
  172. // 总条数
  173. total: 0,
  174. // 短链课程看课记录表格数据
  175. courseWatchLogList: [],
  176. // 弹出层标题
  177. title: "",
  178. // 是否显示弹出层
  179. open: false,
  180. // 查询参数
  181. queryParams: {
  182. pageNum: 1,
  183. pageSize: 10,
  184. userId: null,
  185. nickName: null,
  186. videoId: null,
  187. logType: 2,
  188. qwExternalContactId: null,
  189. externalUserName:null,
  190. duration: null,
  191. qwUserId: null,
  192. companyUserId: null,
  193. companyId: null,
  194. courseId: null,
  195. sTime:null,
  196. eTime:null,
  197. upSTime:null,
  198. upETime:null,
  199. scheduleStartTime: null,
  200. scheduleEndTime: null,
  201. },
  202. // 表单参数
  203. form: {},
  204. // 表单校验
  205. rules: {
  206. },
  207. scheduleTime: null,
  208. };
  209. },
  210. created() {
  211. courseList().then(response => {
  212. this.courseLists = response.list;
  213. });
  214. this.getList();
  215. this.getDicts("sys_course_watch_log_type").then(response => {
  216. this.logTypeOptions = response.data;
  217. });
  218. },
  219. methods: {
  220. courseChange(row){
  221. this.queryParams.videoId=null;
  222. if(row === ''){
  223. this.videoList=[];
  224. return
  225. }
  226. videoList(row).then(response => {
  227. this.videoList=response.list
  228. });
  229. },
  230. createChange() {
  231. if (this.createTime != null) {
  232. this.queryParams.sTime = this.createTime[0];
  233. this.queryParams.eTime = this.createTime[1];
  234. } else {
  235. this.queryParams.sTime = null;
  236. this.queryParams.eTime = null;
  237. }
  238. },
  239. updateChange(){
  240. if (this.updateTime != null) {
  241. this.queryParams.upSTime = this.updateTime[0];
  242. this.queryParams.upETime = this.updateTime[1];
  243. } else {
  244. this.queryParams.upSTime = null;
  245. this.queryParams.upETime = null;
  246. }
  247. },
  248. handleClickX(tab,event){
  249. this.activeName=tab.name;
  250. if(tab.name=="00"){
  251. this.queryParams.logType=null;
  252. }else{
  253. this.queryParams.logType=tab.name;
  254. }
  255. this.getList()
  256. },
  257. /** 查询短链课程看课记录列表 */
  258. getList() {
  259. this.loading = true;
  260. if(this.queryParams.logType == "10"){
  261. this.queryParams.logType = null;
  262. }
  263. listCourseWatchLog(this.queryParams).then(response => {
  264. this.courseWatchLogList = response.rows;
  265. this.total = response.total;
  266. this.loading = false;
  267. });
  268. },
  269. // 取消按钮
  270. cancel() {
  271. this.open = false;
  272. this.reset();
  273. },
  274. // 表单重置
  275. reset() {
  276. this.form = {
  277. logId: null,
  278. userId: null,
  279. videoId: null,
  280. logType: null,
  281. createTime: null,
  282. updateTime: null,
  283. qwExternalContactId: null,
  284. externalUserName:null,
  285. duration: null,
  286. qwUserId: null,
  287. companyUserId: null,
  288. companyId: null,
  289. courseId: null,
  290. scheduleStartTime: null,
  291. scheduleEndTime: null,
  292. };
  293. this.scheduleTime=null;
  294. this.resetForm("form");
  295. },
  296. /** 搜索按钮操作 */
  297. handleQuery() {
  298. this.queryParams.pageNum = 1;
  299. this.getList();
  300. },
  301. /** 重置按钮操作 */
  302. resetQuery() {
  303. this.resetForm("queryForm");
  304. this.createTime = null;
  305. this.scheduleTime = null;
  306. this.queryParams.sTime = null;
  307. this.queryParams.eTime = null;
  308. this.queryParams.upSTime = null;
  309. this.queryParams.upETime = null;
  310. this.queryParams.scheduleStartTime = null;
  311. this.queryParams.scheduleEndTime = null;
  312. this.scheduleTime=null;
  313. this.updateTime=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 exportCourseWatchLog(queryParams);
  382. }).then(response => {
  383. this.download(response.msg);
  384. this.exportLoading = false;
  385. }).catch(() => {});
  386. },
  387. handleScheduleTimeChange(val) {
  388. if (val) {
  389. this.queryParams.scheduleStartTime = val[0];
  390. this.queryParams.scheduleEndTime = val[1];
  391. } else {
  392. this.queryParams.scheduleStartTime = null;
  393. this.queryParams.scheduleEndTime = null;
  394. }
  395. },
  396. }
  397. };
  398. </script>