index.vue 15 KB

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