my.vue 14 KB

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