index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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="courseName">
  14. <el-input
  15. v-model="queryParams.courseName"
  16. placeholder="请输入课程名称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="视频标题" prop="videoTitle">
  23. <el-input
  24. v-model="queryParams.videoTitle"
  25. placeholder="请输入视频标题"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="销售公司" prop="companyName">
  32. <el-input
  33. v-model="queryParams.companyName"
  34. placeholder="请输入销售公司名称"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item label="课程日期" prop="courseStartDateTime">
  41. <el-date-picker clearable size="small"
  42. v-model="queryParams.courseStartDateTime"
  43. type="date"
  44. value-format="yyyy-MM-dd"
  45. placeholder="选择课程开始日期">
  46. </el-date-picker>
  47. </el-form-item>
  48. <el-form-item label="销售名称" prop="companyUserName">
  49. <el-input
  50. v-model="queryParams.companyUserName"
  51. placeholder="请输入销售名称"
  52. clearable
  53. size="small"
  54. @keyup.enter.native="handleQuery"
  55. />
  56. </el-form-item>
  57. <el-form-item label="营期日期" prop="periodStartingTime">
  58. <el-date-picker clearable size="small"
  59. v-model="queryParams.periodStartingTime"
  60. type="date"
  61. value-format="yyyy-MM-dd"
  62. placeholder="选择营期开始日期">
  63. </el-date-picker>
  64. </el-form-item>
  65. <el-form-item>
  66. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  67. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  68. </el-form-item>
  69. </el-form>
  70. <el-row :gutter="10" class="mb8">
  71. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  72. </el-row>
  73. <el-table border v-loading="loading" :data="userWatchCourseStatisticsList" @selection-change="handleSelectionChange">
  74. <el-table-column type="selection" width="55" align="center" />
  75. <el-table-column label="营期名称" align="center" prop="periodName" />
  76. <el-table-column label="课程名称" align="center" prop="courseName" />
  77. <el-table-column label="视频标题" align="center" prop="videoTitle" />
  78. <el-table-column label="销售公司" align="center" prop="companyName" />
  79. <el-table-column label="课程日期" align="center" prop="courseStartDateTime" />
  80. <el-table-column label="销售名称" align="center" prop="companyUserName" />
  81. <el-table-column label="营期日期" align="center" prop="periodStartingTime" />
  82. <el-table-column label="新增会员数量" align="center" prop="newUserNum" />
  83. <el-table-column label="会员数量" align="center" prop="userNum" />
  84. <el-table-column label="观看人数" align="center" prop="watchNum" />
  85. <el-table-column label="完播人数" align="center" prop="completeWatchNum" />
  86. <el-table-column label="完播率" align="center" prop="completeWatchRate" />
  87. <el-table-column label="答题人数" align="center" prop="answerNum" />
  88. <el-table-column label="答题正确人数" align="center" prop="answerRightNum" />
  89. <el-table-column label="答题正确率" align="center" prop="answerRightRate" />
  90. <el-table-column label="红包领取数量" align="center" prop="redPacketNum" />
  91. <el-table-column label="红包领取总额" align="center" prop="redPacketAmount" />
  92. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  93. <template slot-scope="scope">
  94. <el-button
  95. size="mini"
  96. type="text"
  97. icon="el-icon-edit"
  98. @click="handleUpdate(scope.row)"
  99. v-hasPermi="['course:userWatchCourseStatistics:edit']"
  100. >修改</el-button>
  101. <el-button
  102. size="mini"
  103. type="text"
  104. icon="el-icon-delete"
  105. @click="handleDelete(scope.row)"
  106. v-hasPermi="['course:userWatchCourseStatistics:remove']"
  107. >删除</el-button>
  108. </template>
  109. </el-table-column>
  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 { listUserWatchCourseStatistics, getUserWatchCourseStatistics, delUserWatchCourseStatistics, addUserWatchCourseStatistics, updateUserWatchCourseStatistics, exportUserWatchCourseStatistics } 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. },
  258. // 表单参数
  259. form: {},
  260. // 表单校验
  261. rules: {
  262. }
  263. };
  264. },
  265. created() {
  266. this.getList();
  267. },
  268. methods: {
  269. /** 查询会员看课统计-按课程统计列表 */
  270. getList() {
  271. this.loading = true;
  272. listUserWatchCourseStatistics(this.queryParams).then(response => {
  273. this.userWatchCourseStatisticsList = response.rows;
  274. this.total = response.total;
  275. this.loading = false;
  276. });
  277. },
  278. // 取消按钮
  279. cancel() {
  280. this.open = false;
  281. this.reset();
  282. },
  283. // 表单重置
  284. reset() {
  285. this.form = {
  286. id: null,
  287. periodId: null,
  288. periodName: null,
  289. courseId: null,
  290. courseName: null,
  291. videoId: null,
  292. videoTitle: null,
  293. companyId: null,
  294. companyName: null,
  295. companyUserId: null,
  296. courseStartDateTime: null,
  297. companyUserName: null,
  298. periodStartingTime: null,
  299. newUserNum: null,
  300. userNum: null,
  301. watchNum: null,
  302. completeWatchNum: null,
  303. completeWatchRate: null,
  304. answerNum: null,
  305. answerRightNum: null,
  306. answerRightRate: null,
  307. redPacketNum: null,
  308. redPacketAmount: null
  309. };
  310. this.resetForm("form");
  311. },
  312. /** 搜索按钮操作 */
  313. handleQuery() {
  314. this.queryParams.pageNum = 1;
  315. this.getList();
  316. },
  317. /** 重置按钮操作 */
  318. resetQuery() {
  319. this.resetForm("queryForm");
  320. this.handleQuery();
  321. },
  322. // 多选框选中数据
  323. handleSelectionChange(selection) {
  324. this.ids = selection.map(item => item.id)
  325. this.single = selection.length!==1
  326. this.multiple = !selection.length
  327. },
  328. /** 新增按钮操作 */
  329. handleAdd() {
  330. this.reset();
  331. this.open = true;
  332. this.title = "添加会员看课统计-按课程统计";
  333. },
  334. /** 修改按钮操作 */
  335. handleUpdate(row) {
  336. this.reset();
  337. const id = row.id || this.ids
  338. getUserWatchCourseStatistics(id).then(response => {
  339. this.form = response.data;
  340. this.open = true;
  341. this.title = "修改会员看课统计-按课程统计";
  342. });
  343. },
  344. /** 提交按钮 */
  345. submitForm() {
  346. this.$refs["form"].validate(valid => {
  347. if (valid) {
  348. if (this.form.id != null) {
  349. updateUserWatchCourseStatistics(this.form).then(response => {
  350. this.msgSuccess("修改成功");
  351. this.open = false;
  352. this.getList();
  353. });
  354. } else {
  355. addUserWatchCourseStatistics(this.form).then(response => {
  356. this.msgSuccess("新增成功");
  357. this.open = false;
  358. this.getList();
  359. });
  360. }
  361. }
  362. });
  363. },
  364. /** 删除按钮操作 */
  365. handleDelete(row) {
  366. const ids = row.id || this.ids;
  367. this.$confirm('是否确认删除会员看课统计-按课程统计编号为"' + ids + '"的数据项?', "警告", {
  368. confirmButtonText: "确定",
  369. cancelButtonText: "取消",
  370. type: "warning"
  371. }).then(function() {
  372. return delUserWatchCourseStatistics(ids);
  373. }).then(() => {
  374. this.getList();
  375. this.msgSuccess("删除成功");
  376. }).catch(() => {});
  377. },
  378. /** 导出按钮操作 */
  379. handleExport() {
  380. const queryParams = this.queryParams;
  381. this.$confirm('是否确认导出所有会员看课统计-按课程统计数据项?', "警告", {
  382. confirmButtonText: "确定",
  383. cancelButtonText: "取消",
  384. type: "warning"
  385. }).then(() => {
  386. this.exportLoading = true;
  387. return exportUserWatchCourseStatistics(queryParams);
  388. }).then(response => {
  389. this.download(response.msg);
  390. this.exportLoading = false;
  391. }).catch(() => {});
  392. }
  393. }
  394. };
  395. </script>