operateStudent.vue 12 KB

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