my.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="企微昵称" prop="nickName">
  5. <el-input
  6. v-model="queryParams.nickName"
  7. placeholder="请输入企微昵称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="添加时间" prop="createTime">
  14. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  15. </el-form-item>
  16. <el-form-item>
  17. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  18. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  19. </el-form-item>
  20. </el-form>
  21. <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange" show-summary height="600">
  22. <el-table-column type="selection" width="55" align="center" />
  23. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  24. <!-- 发课时间 -->
  25. <el-table-column label="进线时间" align="center" prop="createTime"/>
  26. <!-- 进线数 -->
  27. <el-table-column label="进线数" align="center" prop="line" />
  28. <!-- 先导课上线 -->
  29. <el-table-column label="先导课上线" align="center" prop="firstOnline">
  30. <template slot-scope="scope">
  31. <span>{{ scope.row.firstOnline }}</span>
  32. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.firstOnline / scope.row.line) * 100).toFixed(2) }}%)</span>
  33. </template>
  34. </el-table-column>
  35. <!-- 先导课完课 -->
  36. <el-table-column label="先导课完课" align="center" prop="firstOver">
  37. <template slot-scope="scope">
  38. <span>{{ scope.row.firstOver }}</span>
  39. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.firstOver / scope.row.line) * 100).toFixed(2) }}%)</span>
  40. </template>
  41. </el-table-column>
  42. <!-- 首日上线 -->
  43. <el-table-column label="首日上线" align="center" prop="d1Online">
  44. <template slot-scope="scope">
  45. <span>{{ scope.row.d1Online }}</span>
  46. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.d1Online / scope.row.line) * 100).toFixed(2) }}%)</span>
  47. </template>
  48. </el-table-column>
  49. <!-- 首日完课 -->
  50. <el-table-column label="首日完课" align="center" prop="d1Over">
  51. <template slot-scope="scope">
  52. <span>{{ scope.row.d1Over }}</span>
  53. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.d1Over / scope.row.line) * 100).toFixed(2) }}%)</span>
  54. </template>
  55. </el-table-column>
  56. <!-- 综合报名数 -->
  57. <el-table-column label="综合报名数" align="center" prop="sign">
  58. <template slot-scope="scope">
  59. <span>{{ scope.row.sign }}</span>
  60. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.sign / scope.row.line) * 100).toFixed(2) }}%)</span>
  61. </template>
  62. </el-table-column>
  63. <!-- 互动数 -->
  64. <el-table-column label="互动数" align="center" prop="interact">
  65. <template slot-scope="scope">
  66. <span>{{ scope.row.interact }}</span>
  67. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.interact / scope.row.line) * 100).toFixed(2) }}%)</span>
  68. </template>
  69. </el-table-column>
  70. <!-- A级客户 -->
  71. <el-table-column label="A级客户" align="center" prop="a">
  72. <template slot-scope="scope">
  73. <span>{{ scope.row.a }}</span>
  74. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.a / scope.row.line) * 100).toFixed(2) }}%)</span>
  75. </template>
  76. </el-table-column>
  77. <!-- B级客户 -->
  78. <el-table-column label="B级客户" align="center" prop="b">
  79. <template slot-scope="scope">
  80. <span>{{ scope.row.b }}</span>
  81. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.b / scope.row.line) * 100).toFixed(2) }}%)</span>
  82. </template>
  83. </el-table-column>
  84. <!-- C级客户 -->
  85. <el-table-column label="C级客户" align="center" prop="c">
  86. <template slot-scope="scope">
  87. <span>{{ scope.row.c }}</span>
  88. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.c / scope.row.line) * 100).toFixed(2) }}%)</span>
  89. </template>
  90. </el-table-column>
  91. <!-- D级客户 -->
  92. <el-table-column label="D级客户" align="center" prop="d">
  93. <template slot-scope="scope">
  94. <span>{{ scope.row.d }}</span>
  95. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.d / scope.row.line) * 100).toFixed(2) }}%)</span>
  96. </template>
  97. </el-table-column>
  98. <!-- 流失数 -->
  99. <el-table-column label="流失数" align="center" prop="los">
  100. <template slot-scope="scope">
  101. <span>{{ scope.row.los }}</span>
  102. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.los / scope.row.line) * 100).toFixed(2) }}%)</span>
  103. </template>
  104. </el-table-column>
  105. <!-- 删除数 -->
  106. <el-table-column label="删除数" align="center" prop="del">
  107. <template slot-scope="scope">
  108. <span>{{ scope.row.del }}</span>
  109. <span style="font-size: 12px; color: #959595;margin-left: 5px;">({{ ((scope.row.del / scope.row.line) * 100).toFixed(2) }}%)</span>
  110. </template>
  111. </el-table-column>
  112. </el-table>
  113. <pagination
  114. v-show="total>0"
  115. :total="total"
  116. :page.sync="queryParams.pageNum"
  117. :limit.sync="queryParams.pageSize"
  118. @pagination="getList"
  119. />
  120. </div>
  121. </template>
  122. <script>
  123. import { listCourseWatchLog, getCourseWatchLog, delCourseWatchLog, addCourseWatchLog, updateCourseWatchLog, exportCourseWatchLog,statisticsList,qwWatchLogStatisticsList,myQwWatchLogStatisticsList } from "@/api/course/qw/courseWatchLog";
  124. import { courseList,videoList } from '@/api/course/courseRedPacketLog'
  125. export default {
  126. name: "CourseWatchLog",
  127. data() {
  128. return {
  129. activeName:"00",
  130. createTime:null,
  131. courseLists:[],
  132. videoList:[],
  133. logTypeOptions:[],
  134. // 遮罩层
  135. loading: true,
  136. // 导出遮罩层
  137. exportLoading: false,
  138. // 选中数组
  139. ids: [],
  140. // 非单个禁用
  141. single: true,
  142. // 非多个禁用
  143. multiple: true,
  144. // 显示搜索条件
  145. showSearch: true,
  146. // 总条数
  147. total: 0,
  148. // 短链课程看课记录表格数据
  149. courseWatchLogList: [],
  150. // 弹出层标题
  151. title: "",
  152. // 是否显示弹出层
  153. open: false,
  154. // 查询参数
  155. queryParams: {
  156. pageNum: 1,
  157. pageSize: 10,
  158. userId: null,
  159. nickName: null,
  160. videoId: null,
  161. logType: null,
  162. qwExternalContactId: null,
  163. duration: null,
  164. qwUserId: null,
  165. companyUserId: null,
  166. companyId: null,
  167. courseId: null,
  168. sTime:null,
  169. eTime:null,
  170. scheduleStartTime: null,
  171. scheduleEndTime: null,
  172. },
  173. // 表单参数
  174. form: {},
  175. // 表单校验
  176. rules: {
  177. },
  178. scheduleTime: null,
  179. };
  180. },
  181. created() {
  182. courseList().then(response => {
  183. this.courseLists = response.list;
  184. });
  185. this.getList();
  186. this.getDicts("sys_course_watch_log_type").then(response => {
  187. this.logTypeOptions = response.data;
  188. });
  189. },
  190. methods: {
  191. courseChange(row){
  192. this.queryParams.videoId=null;
  193. if(row === ''){
  194. this.videoList=[];
  195. return
  196. }
  197. videoList(row).then(response => {
  198. this.videoList=response.list
  199. });
  200. },
  201. change() {
  202. if (this.createTime != null) {
  203. this.queryParams.sTime = this.createTime[0];
  204. this.queryParams.eTime = this.createTime[1];
  205. } else {
  206. this.queryParams.sTime = null;
  207. this.queryParams.eTime = null;
  208. }
  209. },
  210. handleClickX(tab,event){
  211. this.activeName=tab.name;
  212. if(tab.name=="00"){
  213. this.queryParams.logType=null;
  214. }else{
  215. this.queryParams.logType=tab.name;
  216. }
  217. this.getList()
  218. },
  219. /** 查询短链课程看课记录列表 */
  220. getList() {
  221. this.loading = true;
  222. myQwWatchLogStatisticsList(this.queryParams).then(response => {
  223. this.courseWatchLogList = response.rows;
  224. this.total = response.total;
  225. this.loading = false;
  226. });
  227. },
  228. // 取消按钮
  229. cancel() {
  230. this.open = false;
  231. this.reset();
  232. },
  233. // 表单重置
  234. reset() {
  235. this.form = {
  236. logId: null,
  237. userId: null,
  238. videoId: null,
  239. logType: null,
  240. createTime: null,
  241. updateTime: null,
  242. qwExternalContactId: null,
  243. duration: null,
  244. qwUserId: null,
  245. companyUserId: null,
  246. companyId: null,
  247. courseId: null
  248. };
  249. this.resetForm("form");
  250. },
  251. /** 搜索按钮操作 */
  252. handleQuery() {
  253. this.queryParams.pageNum = 1;
  254. this.getList();
  255. },
  256. /** 重置按钮操作 */
  257. resetQuery() {
  258. this.resetForm("queryForm");
  259. this.createTime = null;
  260. this.scheduleTime = null;
  261. this.queryParams.sTime = null;
  262. this.queryParams.eTime = null;
  263. this.queryParams.scheduleStartTime = null;
  264. this.queryParams.scheduleEndTime = null;
  265. this.handleQuery();
  266. },
  267. // 多选框选中数据
  268. handleSelectionChange(selection) {
  269. this.ids = selection.map(item => item.logId)
  270. this.single = selection.length!==1
  271. this.multiple = !selection.length
  272. },
  273. /** 新增按钮操作 */
  274. handleAdd() {
  275. this.reset();
  276. this.open = true;
  277. this.title = "添加短链课程看课记录";
  278. },
  279. /** 修改按钮操作 */
  280. handleUpdate(row) {
  281. this.reset();
  282. const logId = row.logId || this.ids
  283. getCourseWatchLog(logId).then(response => {
  284. this.form = response.data;
  285. this.open = true;
  286. this.title = "修改短链课程看课记录";
  287. });
  288. },
  289. /** 提交按钮 */
  290. submitForm() {
  291. this.$refs["form"].validate(valid => {
  292. if (valid) {
  293. if (this.form.logId != null) {
  294. updateCourseWatchLog(this.form).then(response => {
  295. this.msgSuccess("修改成功");
  296. this.open = false;
  297. this.getList();
  298. });
  299. } else {
  300. addCourseWatchLog(this.form).then(response => {
  301. this.msgSuccess("新增成功");
  302. this.open = false;
  303. this.getList();
  304. });
  305. }
  306. }
  307. });
  308. },
  309. /** 删除按钮操作 */
  310. handleDelete(row) {
  311. const logIds = row.logId || this.ids;
  312. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  313. confirmButtonText: "确定",
  314. cancelButtonText: "取消",
  315. type: "warning"
  316. }).then(function() {
  317. return delCourseWatchLog(logIds);
  318. }).then(() => {
  319. this.getList();
  320. this.msgSuccess("删除成功");
  321. }).catch(() => {});
  322. },
  323. /** 导出按钮操作 */
  324. handleExport() {
  325. const queryParams = this.queryParams;
  326. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  327. confirmButtonText: "确定",
  328. cancelButtonText: "取消",
  329. type: "warning"
  330. }).then(() => {
  331. this.exportLoading = true;
  332. return exportCourseWatchLog(queryParams);
  333. }).then(response => {
  334. this.download(response.msg);
  335. this.exportLoading = false;
  336. }).catch(() => {});
  337. },
  338. handleScheduleTimeChange(val) {
  339. if (val) {
  340. this.queryParams.scheduleStartTime = val[0];
  341. this.queryParams.scheduleEndTime = val[1];
  342. } else {
  343. this.queryParams.scheduleStartTime = null;
  344. this.queryParams.scheduleEndTime = null;
  345. }
  346. },
  347. }
  348. };
  349. </script>