my.vue 15 KB

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