index.vue 14 KB

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