index.vue 16 KB

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