index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  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="periodName">
  5. <el-input
  6. v-model="queryParams.periodName"
  7. placeholder="请输入营期名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="营期线" prop="periodStartingTime">
  14. <el-date-picker clearable size="small"
  15. v-model="queryParams.periodStartingTime"
  16. type="date"
  17. value-format="yyyy-MM-dd"
  18. placeholder="选择营期线">
  19. </el-date-picker>
  20. </el-form-item>
  21. <el-form-item label="播出时间" prop="courseStartDateTime">
  22. <el-date-picker clearable size="small"
  23. v-model="queryParams.courseStartDateTime"
  24. type="date"
  25. value-format="yyyy-MM-dd"
  26. placeholder="选择课程开始日期">
  27. </el-date-picker>
  28. </el-form-item>
  29. <el-form-item label="课程名称" prop="courseName">
  30. <el-input
  31. v-model="queryParams.courseName"
  32. placeholder="请输入课程名称"
  33. clearable
  34. size="small"
  35. @keyup.enter.native="handleQuery"
  36. />
  37. </el-form-item>
  38. <el-form-item label="视频小节" prop="videoTitle">
  39. <el-input
  40. v-model="queryParams.videoTitle"
  41. placeholder="请输入视频标题"
  42. clearable
  43. size="small"
  44. @keyup.enter.native="handleQuery"
  45. />
  46. </el-form-item>
  47. <el-form-item label="销售公司" prop="companyName">
  48. <el-input
  49. v-model="queryParams.companyName"
  50. placeholder="请输入销售公司名称"
  51. clearable
  52. size="small"
  53. @keyup.enter.native="handleQuery"
  54. />
  55. </el-form-item>
  56. <el-form-item label="经销商" prop="companyBelongOwner">
  57. <el-input
  58. v-model="queryParams.companyBelongOwner"
  59. placeholder="请输入经销商归属"
  60. clearable
  61. size="small"
  62. @keyup.enter.native="handleQuery"
  63. />
  64. </el-form-item>
  65. <!-- <el-form-item label="所属销售" prop="companyUserName">-->
  66. <!-- <el-input-->
  67. <!-- v-model="queryParams.companyUserName"-->
  68. <!-- placeholder="请输入销售名称"-->
  69. <!-- clearable-->
  70. <!-- size="small"-->
  71. <!-- @keyup.enter.native="handleQuery"-->
  72. <!-- />-->
  73. <!-- </el-form-item>-->
  74. <el-form-item>
  75. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  76. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  77. </el-form-item>
  78. </el-form>
  79. <el-row :gutter="10" class="mb8">
  80. <el-col :span="1.5">
  81. <el-button
  82. type="warning"
  83. plain
  84. icon="el-icon-download"
  85. size="mini"
  86. :loading="exportLoading"
  87. @click="handleExport"
  88. >导出</el-button>
  89. </el-col>
  90. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  91. </el-row>
  92. <el-table border v-loading="loading" :data="userWatchCourseStatisticsList" @selection-change="handleSelectionChange">
  93. <el-table-column type="selection" width="55" align="center" />
  94. <el-table-column label="经销商归属" align="center" prop="companyBelongOwner" />
  95. <el-table-column label="营期名称" align="center" prop="periodName" />
  96. <el-table-column label="营期线" align="center" prop="periodStartingTime" />
  97. <el-table-column label="播出时间" align="center" prop="courseStartDateTime" />
  98. <el-table-column label="课程名称" align="center" prop="courseName" />
  99. <el-table-column label="视频小节" align="center" prop="videoTitle" />
  100. <el-table-column label="销售公司" align="center" prop="companyName" />
  101. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName" />-->
  102. <el-table-column label="新增会员" align="center" prop="newUserNum" />
  103. <el-table-column label="会员数量" align="center" prop="userNum" />
  104. <el-table-column label="观看人数" align="center" prop="watchNum" />
  105. <el-table-column label="上线率" align="center" prop="onlineRatePercent" />
  106. <el-table-column label="完播人数" align="center" prop="completeWatchNum" />
  107. <el-table-column label="完播率" align="center" prop="completeWatchRatePercent" />
  108. <el-table-column label="红包领取个数" align="center" prop="redPacketNum" />
  109. <el-table-column label="红包领取总额" align="center" prop="redPacketAmount" />
  110. </el-table>
  111. <pagination
  112. v-show="total>0"
  113. :total="total"
  114. :page.sync="queryParams.pageNum"
  115. :limit.sync="queryParams.pageSize"
  116. @pagination="getList"
  117. />
  118. <!-- 添加或修改会员看课统计-按课程统计对话框 -->
  119. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  120. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  121. <el-form-item label="营期id" prop="periodId">
  122. <el-input v-model="form.periodId" placeholder="请输入营期id" />
  123. </el-form-item>
  124. <el-form-item label="营期名称" prop="periodName">
  125. <el-input v-model="form.periodName" placeholder="请输入营期名称" />
  126. </el-form-item>
  127. <el-form-item label="课程id" prop="courseId">
  128. <el-input v-model="form.courseId" placeholder="请输入课程id" />
  129. </el-form-item>
  130. <el-form-item label="课程名称" prop="courseName">
  131. <el-input v-model="form.courseName" placeholder="请输入课程名称" />
  132. </el-form-item>
  133. <el-form-item label="视频id" prop="videoId">
  134. <el-input v-model="form.videoId" placeholder="请输入视频id" />
  135. </el-form-item>
  136. <el-form-item label="视频标题" prop="videoTitle">
  137. <el-input v-model="form.videoTitle" placeholder="请输入视频标题" />
  138. </el-form-item>
  139. <el-form-item label="销售公司id" prop="companyId">
  140. <el-input v-model="form.companyId" placeholder="请输入销售公司id" />
  141. </el-form-item>
  142. <el-form-item label="销售公司名称" prop="companyName">
  143. <el-input v-model="form.companyName" placeholder="请输入销售公司名称" />
  144. </el-form-item>
  145. <el-form-item label="销售id" prop="companyUserId">
  146. <el-input v-model="form.companyUserId" placeholder="请输入销售id" />
  147. </el-form-item>
  148. <el-form-item label="课程开始日期" prop="courseStartDateTime">
  149. <el-date-picker clearable size="small"
  150. v-model="form.courseStartDateTime"
  151. type="date"
  152. value-format="yyyy-MM-dd"
  153. placeholder="选择课程开始日期">
  154. </el-date-picker>
  155. </el-form-item>
  156. <el-form-item label="销售名称" prop="companyUserName">
  157. <el-input v-model="form.companyUserName" placeholder="请输入销售名称" />
  158. </el-form-item>
  159. <el-form-item label="营期开始日期" prop="periodStartingTime">
  160. <el-date-picker clearable size="small"
  161. v-model="form.periodStartingTime"
  162. type="date"
  163. value-format="yyyy-MM-dd"
  164. placeholder="选择营期开始日期">
  165. </el-date-picker>
  166. </el-form-item>
  167. <el-form-item label="新增会员数量" prop="newUserNum">
  168. <el-input v-model="form.newUserNum" placeholder="请输入新增会员数量" />
  169. </el-form-item>
  170. <el-form-item label="会员数量" prop="userNum">
  171. <el-input v-model="form.userNum" placeholder="请输入会员数量" />
  172. </el-form-item>
  173. <el-form-item label="观看人数" prop="watchNum">
  174. <el-input v-model="form.watchNum" placeholder="请输入观看人数" />
  175. </el-form-item>
  176. <el-form-item label="完播人数" prop="completeWatchNum">
  177. <el-input v-model="form.completeWatchNum" placeholder="请输入完播人数" />
  178. </el-form-item>
  179. <el-form-item label="完播率" prop="completeWatchRate">
  180. <el-input v-model="form.completeWatchRate" placeholder="请输入完播率" />
  181. </el-form-item>
  182. <el-form-item label="答题人数" prop="answerNum">
  183. <el-input v-model="form.answerNum" placeholder="请输入答题人数" />
  184. </el-form-item>
  185. <el-form-item label="答题正确人数" prop="answerRightNum">
  186. <el-input v-model="form.answerRightNum" placeholder="请输入答题正确人数" />
  187. </el-form-item>
  188. <el-form-item label="答题正确率" prop="answerRightRate">
  189. <el-input v-model="form.answerRightRate" placeholder="请输入答题正确率" />
  190. </el-form-item>
  191. <el-form-item label="红包领取个数" prop="redPacketNum">
  192. <el-input v-model="form.redPacketNum" placeholder="请输入红包领取数量" />
  193. </el-form-item>
  194. <el-form-item label="红包领取总额" prop="redPacketAmount">
  195. <el-input v-model="form.redPacketAmount" placeholder="请输入红包领取总额" />
  196. </el-form-item>
  197. </el-form>
  198. <div slot="footer" class="dialog-footer">
  199. <el-button type="primary" @click="submitForm">确 定</el-button>
  200. <el-button @click="cancel">取 消</el-button>
  201. </div>
  202. </el-dialog>
  203. </div>
  204. </template>
  205. <script>
  206. import { listUserWatchCourseStatisticsTotal, getUserWatchCourseStatistics, delUserWatchCourseStatistics, addUserWatchCourseStatistics, updateUserWatchCourseStatistics, exportUserWatchCourseStatisticsTotal } from "@/api/course/userWatchCourseStatistics";
  207. export default {
  208. name: "UserWatchCourseStatistics",
  209. data() {
  210. return {
  211. // 遮罩层
  212. loading: true,
  213. // 导出遮罩层
  214. exportLoading: false,
  215. // 选中数组
  216. ids: [],
  217. // 非单个禁用
  218. single: true,
  219. // 非多个禁用
  220. multiple: true,
  221. // 显示搜索条件
  222. showSearch: true,
  223. // 总条数
  224. total: 0,
  225. // 会员看课统计-按课程统计表格数据
  226. userWatchCourseStatisticsList: [],
  227. // 弹出层标题
  228. title: "",
  229. // 是否显示弹出层
  230. open: false,
  231. // 查询参数
  232. queryParams: {
  233. pageNum: 1,
  234. pageSize: 10,
  235. periodId: null,
  236. periodName: null,
  237. courseId: null,
  238. courseName: null,
  239. videoId: null,
  240. videoTitle: null,
  241. companyId: null,
  242. companyName: null,
  243. companyUserId: null,
  244. courseStartDateTime: null,
  245. companyUserName: null,
  246. periodStartingTime: null,
  247. newUserNum: null,
  248. userNum: null,
  249. watchNum: null,
  250. completeWatchNum: null,
  251. completeWatchRate: null,
  252. answerNum: null,
  253. answerRightNum: null,
  254. answerRightRate: null,
  255. redPacketNum: null,
  256. redPacketAmount: null,
  257. companyBelongOwner: null
  258. },
  259. // 表单参数
  260. form: {},
  261. // 表单校验
  262. rules: {
  263. }
  264. };
  265. },
  266. created() {
  267. this.getList();
  268. },
  269. methods: {
  270. /** 查询会员看课统计-按课程统计列表 */
  271. getList() {
  272. this.loading = true;
  273. listUserWatchCourseStatisticsTotal(this.queryParams).then(response => {
  274. this.userWatchCourseStatisticsList = response.rows;
  275. this.total = response.total;
  276. this.loading = false;
  277. });
  278. },
  279. // 取消按钮
  280. cancel() {
  281. this.open = false;
  282. this.reset();
  283. },
  284. // 表单重置
  285. reset() {
  286. this.form = {
  287. id: null,
  288. periodId: null,
  289. periodName: null,
  290. courseId: null,
  291. courseName: null,
  292. videoId: null,
  293. videoTitle: null,
  294. companyId: null,
  295. companyName: null,
  296. companyUserId: null,
  297. courseStartDateTime: null,
  298. companyUserName: null,
  299. periodStartingTime: null,
  300. newUserNum: null,
  301. userNum: null,
  302. watchNum: null,
  303. completeWatchNum: null,
  304. completeWatchRate: null,
  305. answerNum: null,
  306. answerRightNum: null,
  307. answerRightRate: null,
  308. redPacketNum: null,
  309. redPacketAmount: null
  310. };
  311. this.resetForm("form");
  312. },
  313. /** 搜索按钮操作 */
  314. handleQuery() {
  315. this.queryParams.pageNum = 1;
  316. this.getList();
  317. },
  318. /** 重置按钮操作 */
  319. resetQuery() {
  320. this.resetForm("queryForm");
  321. this.handleQuery();
  322. },
  323. // 多选框选中数据
  324. handleSelectionChange(selection) {
  325. this.ids = selection.map(item => item.id)
  326. this.single = selection.length!==1
  327. this.multiple = !selection.length
  328. },
  329. /** 新增按钮操作 */
  330. handleAdd() {
  331. this.reset();
  332. this.open = true;
  333. this.title = "添加会员看课统计-按课程统计";
  334. },
  335. /** 修改按钮操作 */
  336. handleUpdate(row) {
  337. this.reset();
  338. const id = row.id || this.ids
  339. getUserWatchCourseStatistics(id).then(response => {
  340. this.form = response.data;
  341. this.open = true;
  342. this.title = "修改会员看课统计-按课程统计";
  343. });
  344. },
  345. /** 提交按钮 */
  346. submitForm() {
  347. this.$refs["form"].validate(valid => {
  348. if (valid) {
  349. if (this.form.id != null) {
  350. updateUserWatchCourseStatistics(this.form).then(response => {
  351. this.msgSuccess("修改成功");
  352. this.open = false;
  353. this.getList();
  354. });
  355. } else {
  356. addUserWatchCourseStatistics(this.form).then(response => {
  357. this.msgSuccess("新增成功");
  358. this.open = false;
  359. this.getList();
  360. });
  361. }
  362. }
  363. });
  364. },
  365. /** 删除按钮操作 */
  366. handleDelete(row) {
  367. const ids = row.id || this.ids;
  368. this.$confirm('是否确认删除会员看课统计-按课程统计编号为"' + ids + '"的数据项?', "警告", {
  369. confirmButtonText: "确定",
  370. cancelButtonText: "取消",
  371. type: "warning"
  372. }).then(function() {
  373. return delUserWatchCourseStatistics(ids);
  374. }).then(() => {
  375. this.getList();
  376. this.msgSuccess("删除成功");
  377. }).catch(() => {});
  378. },
  379. /** 导出按钮操作 */
  380. handleExport() {
  381. const queryParams = this.queryParams;
  382. this.$confirm('是否确认导出当前数据项?', "警告", {
  383. confirmButtonText: "确定",
  384. cancelButtonText: "取消",
  385. type: "warning"
  386. }).then(() => {
  387. this.exportLoading = true;
  388. return exportUserWatchCourseStatisticsTotal(queryParams);
  389. }).then(response => {
  390. this.download(response.msg);
  391. this.exportLoading = false;
  392. }).catch(() => {});
  393. }
  394. }
  395. };
  396. </script>