my.vue 15 KB

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