operateStudent.vue 12 KB

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