index.vue 14 KB

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