operateStudent.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>运营指标
  6. </h2>
  7. <div class="m-core">
  8. <el-form :inline="true"
  9. :model="searchForm">
  10. <el-form-item>
  11. <el-input v-model.trim="searchForm.search"
  12. @keyup.enter.native="search"
  13. placeholder="学生姓名 编号"></el-input>
  14. </el-form-item>
  15. <el-form-item prop="organId">
  16. <el-select class="multiple"
  17. v-model.trim="searchForm.organId"
  18. filterable
  19. clearable
  20. placeholder="请选择分部">
  21. <el-option v-for="(item,index) in organList"
  22. :key="index"
  23. :label="item.name"
  24. :value="item.id"></el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item>
  28. <el-select placeholder="老师姓名"
  29. v-model="searchForm.teacherId"
  30. clearable
  31. filterable>
  32. <el-option v-for="(item,index) in teacherList"
  33. :label="item.realName"
  34. :value="item.id"
  35. :key="index"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item>
  39. <el-select placeholder="参与运营指标"
  40. v-model="searchForm.operatingTag"
  41. clearable>
  42. <el-option label="是"
  43. value="1"></el-option>
  44. <el-option label="否"
  45. value="0"></el-option>
  46. </el-select>
  47. </el-form-item>
  48. <el-form-item>
  49. <el-select placeholder="有线上vip课"
  50. v-model="searchForm.hasVip"
  51. clearable>
  52. <el-option label="是"
  53. value="1"></el-option>
  54. <el-option label="否"
  55. value="0"></el-option>
  56. </el-select>
  57. </el-form-item>
  58. <el-form-item>
  59. <el-select placeholder="参与免费网管课"
  60. v-model="searchForm.hasFreePractice"
  61. clearable>
  62. <el-option label="是"
  63. value="1"></el-option>
  64. <el-option label="否"
  65. value="0"></el-option>
  66. </el-select>
  67. </el-form-item>
  68. <el-form-item>
  69. <el-select placeholder="有付费网管课"
  70. v-model="searchForm.hasBuyPractice"
  71. clearable>
  72. <el-option label="是"
  73. value="1"></el-option>
  74. <el-option label="否"
  75. value="0"></el-option>
  76. </el-select>
  77. </el-form-item>
  78. <el-form-item>
  79. <el-select placeholder="有乐团网管课"
  80. v-model="searchForm.hasMusicNetWork"
  81. clearable>
  82. <el-option label="是"
  83. value="1"></el-option>
  84. <el-option label="否"
  85. value="0"></el-option>
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item>
  89. <el-button type="danger"
  90. @click="search">搜索</el-button>
  91. <el-button @click="onReSet"
  92. type="primary">重置</el-button>
  93. <!-- export/isSettlementCourseSalarys -->
  94. <el-button @click="onExport"
  95. type="primary"
  96. v-permission="'export/operatingStudents'"
  97. style=" background: #14928a; border:1px solid #14928a;">导出</el-button>
  98. </el-form-item>
  99. </el-form>
  100. <div class="tableWrap">
  101. <el-table style="width: 100%"
  102. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  103. :data="tableList">
  104. <el-table-column align="center"
  105. prop="studentId"
  106. label="学员编号"></el-table-column>
  107. <el-table-column align="center"
  108. prop="studentName"
  109. label="学员姓名"></el-table-column>
  110. <el-table-column align="center"
  111. prop="organName"
  112. label="所属分部"></el-table-column>
  113. <el-table-column align="center"
  114. prop="teacherName"
  115. label="指导老师"></el-table-column>
  116. <el-table-column align="center"
  117. prop="operatingTag"
  118. label="参与运营指标">
  119. <template slot-scope="scope">
  120. <div>{{scope.row.operatingTag?'是':'否'}}</div>
  121. </template>
  122. </el-table-column>
  123. <el-table-column align="center"
  124. prop="vipTimes"
  125. label="有线上vip课">
  126. <template slot-scope="scope">
  127. <div>{{scope.row.vipTimes?'是':'否'}}</div>
  128. </template>
  129. </el-table-column>
  130. <el-table-column align="center"
  131. prop="freePracticeTimes"
  132. label="参与免费网管课">
  133. <template slot-scope="scope">
  134. <div>{{scope.row.freePracticeTimes?'是':'否'}}</div>
  135. </template>
  136. </el-table-column>
  137. <el-table-column align="center"
  138. prop="buyPracticeTimes"
  139. label="有付费网管课">
  140. <template slot-scope="scope">
  141. <div>{{scope.row.buyPracticeTimes?'是':'否'}}</div>
  142. </template>
  143. </el-table-column>
  144. <el-table-column align="center"
  145. prop="buyPracticeTimes"
  146. label="有乐团网管课">
  147. <template slot-scope="scope">
  148. <div>{{scope.row.musicNetWorkTimes?'是':'否'}}</div>
  149. </template>
  150. </el-table-column>
  151. </el-table>
  152. <pagination :total="rules.total"
  153. :page.sync="rules.page"
  154. :limit.sync="rules.limit"
  155. :page-sizes="rules.page_size"
  156. @pagination="getList" />
  157. </div>
  158. </div>
  159. </div>
  160. </template>
  161. <script>
  162. import axios from "axios";
  163. import { getToken } from "@/utils/auth";
  164. import pagination from "@/components/Pagination/index";
  165. import load from "@/utils/loading";
  166. import { getTeacher, getEmployeeOrgan } from "@/api/buildTeam";
  167. import { getOperatingStudents } from "@/api/operateManager";
  168. export default {
  169. components: { pagination },
  170. data () {
  171. return {
  172. searchForm: {
  173. search: null,
  174. organId: null,
  175. teacherId: null,
  176. hasBuyPractice: null,
  177. hasFreePractice: null,
  178. hasVip: null,
  179. operatingTag: null,
  180. hasMusicNetWork: null
  181. },
  182. teacherList: [],
  183. tableList: [],
  184. organList: [],
  185. rules: {
  186. // 分页规则
  187. limit: 10, // 限制显示条数
  188. page: 1, // 当前页
  189. total: 0, // 总条数
  190. page_size: [10, 20, 40, 50] // 选择限制显示条数
  191. }
  192. };
  193. },
  194. //生命周期 - 创建完成(可以访问当前this实例)
  195. created () { },
  196. activated () {
  197. this.init();
  198. },
  199. mounted () {
  200. getTeacher().then(res => {
  201. if (res.code == 200) {
  202. this.teacherList = res.data;
  203. }
  204. });
  205. getEmployeeOrgan().then(res => {
  206. if (res.code == 200) {
  207. this.organList = res.data;
  208. }
  209. });
  210. // 获取分部
  211. this.init();
  212. },
  213. methods: {
  214. init () {
  215. if (this.$route.query.teacherId) {
  216. this.searchForm.teacherId = this.$route.query.teacherId
  217. }
  218. if (this.$route.query.operatingTag) {
  219. this.searchForm.operatingTag = this.$route.query.operatingTag
  220. }
  221. this.getList();
  222. },
  223. getList () {
  224. let obj = this.getDate();
  225. getOperatingStudents(obj).then(res => {
  226. if (res.code == 200) {
  227. this.tableList = res.data.rows;
  228. this.rules.total = res.data.total;
  229. }
  230. });
  231. },
  232. search () {
  233. this.rules.page = 1;
  234. this.getList();
  235. },
  236. onReSet () {
  237. this.searchForm = {
  238. search: null,
  239. organId: null,
  240. teacherId: null,
  241. hasBuyPractice: null,
  242. hasFreePractice: null,
  243. hasVip: null,
  244. operatingTag: null
  245. };
  246. this.search();
  247. },
  248. onExport () {
  249. let url = "/api-web/export/operatingStudents";
  250. let obj = this.getDate();
  251. const options = {
  252. method: "get",
  253. headers: {
  254. Authorization: getToken()
  255. },
  256. url,
  257. params: obj,
  258. responseType: "blob"
  259. };
  260. this.$confirm("您确定导出列表?", "提示", {
  261. confirmButtonText: "确定",
  262. cancelButtonText: "取消",
  263. type: "warning"
  264. })
  265. .then(() => {
  266. load.startLoading();
  267. axios(options)
  268. .then(res => {
  269. let blob = new Blob([res.data], {
  270. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
  271. type: "application/vnd.ms-excel;charset=utf-8"
  272. // word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  273. });
  274. let text = new Response(blob).text();
  275. text.then(res => {
  276. // 判断是否报错
  277. if (res.indexOf("code") != -1) {
  278. let json = JSON.parse(res);
  279. this.$message.error(json.msg);
  280. } else {
  281. let objectUrl = URL.createObjectURL(blob);
  282. let link = document.createElement("a");
  283. let nowTime = new Date();
  284. let ymd =
  285. nowTime.getFullYear() +
  286. "" +
  287. (nowTime.getMonth() + 1) +
  288. "" +
  289. nowTime.getDate() +
  290. "" +
  291. nowTime.getHours() +
  292. "" +
  293. nowTime.getMinutes();
  294. let fname = ymd + "学员列表(运营)";
  295. link.href = objectUrl;
  296. link.setAttribute("download", fname);
  297. document.body.appendChild(link);
  298. link.click();
  299. }
  300. });
  301. load.endLoading();
  302. })
  303. .catch(error => {
  304. this.$message.error("导出数据失败,请联系管理员");
  305. load.endLoading();
  306. });
  307. })
  308. .catch(() => { });
  309. },
  310. getDate () {
  311. let obj = {
  312. search: this.searchForm.search || null,
  313. organId: this.searchForm.organId || null,
  314. teacherId: this.searchForm.teacherId || null,
  315. hasBuyPractice: this.searchForm.hasBuyPractice || null,
  316. hasFreePractice: this.searchForm.hasFreePractice || null,
  317. hasVip: this.searchForm.hasVip || null,
  318. operatingTag: this.searchForm.operatingTag || null,
  319. page: this.rules.page,
  320. rows: this.rules.limit,
  321. hasMusicNetWork: this.searchForm.hasMusicNetWork || null
  322. };
  323. return obj;
  324. }
  325. }
  326. };
  327. </script>
  328. <style lang='scss' scoped>
  329. </style>