accompanyList.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. <template>
  2. <div class>
  3. <!-- <h2>
  4. <div class="squrt"></div>网管课列表
  5. </h2>-->
  6. <div class="topWrap">
  7. <div class="newBand"
  8. v-permission="'export/practiceGroup'"
  9. @click="onStudentExport"
  10. style="width: 120px;">网管课续费提醒</div>
  11. <div class="newBand"
  12. v-permission="'export/practiceGroupList'"
  13. @click="onPracticeExport"
  14. style="width: 120px;">网管课导出</div>
  15. </div>
  16. <div class="m-core">
  17. <el-form :inline="true"
  18. class="searchForm"
  19. v-model.trim="searchForm">
  20. <!-- 状态 指导老师 活动方案-->
  21. <el-form-item>
  22. <el-input v-model.trim="searchForm.search"
  23. @keyup.enter.native="search"
  24. placeholder="课程组名称"></el-input>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-select class="multiple"
  28. v-model.trim="searchForm.organIdList"
  29. filterable
  30. clearable
  31. placeholder="请选择分部">
  32. <el-option v-for="(item,index) in organList"
  33. :key="index"
  34. :label="item.name"
  35. :value="item.id"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item>
  39. <el-select v-model.trim="searchForm.practiceGroupType"
  40. clearable
  41. filterable
  42. placeholder="课程组类型">
  43. <el-option v-for="(item,index) in practiceGroupType"
  44. :key="index"
  45. :value="item.value"
  46. :label="item.label"></el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item prop="status">
  50. <el-select class="multiple"
  51. v-model.trim="searchForm.hasEducationalTeacherId"
  52. filterable
  53. clearable
  54. placeholder="是否有乐团主管">
  55. <el-option label="是"
  56. value="true"></el-option>
  57. <el-option label="否"
  58. value="false"></el-option>
  59. </el-select>
  60. </el-form-item>
  61. <el-form-item>
  62. <el-select v-model.trim="searchForm.teacherId"
  63. clearable
  64. filterable
  65. placeholder="指导老师">
  66. <el-option v-for="(item,index) in teacherList"
  67. :key="index"
  68. :value="item.id"
  69. :label="item.realName"></el-option>
  70. </el-select>
  71. </el-form-item>
  72. <el-form-item>
  73. <el-select v-model.trim="searchForm.groupStatus"
  74. clearable
  75. filterable
  76. placeholder="课程组状态">
  77. <el-option v-for="(item,index) in commGroupStatus"
  78. :key="index"
  79. :value="item.value"
  80. :label="item.label"></el-option>
  81. </el-select>
  82. </el-form-item>
  83. <el-form-item>
  84. <el-select v-model.trim="searchForm.firstOrRenew"
  85. clearable
  86. filterable
  87. placeholder="是否续费">
  88. <el-option label="首充"
  89. value="1"></el-option>
  90. <el-option label="续费"
  91. value="0"></el-option>
  92. <el-option label="免费"
  93. value="2"></el-option>
  94. </el-select>
  95. </el-form-item>
  96. <el-form-item>
  97. <el-button @click="search"
  98. type="danger">搜索</el-button>
  99. <el-button @click="onReSet"
  100. type="primary">重置</el-button>
  101. </el-form-item>
  102. </el-form>
  103. <!-- tab -->
  104. <div class="tableWrap">
  105. <el-table style="width: 100%"
  106. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  107. :data="tableData">
  108. <el-table-column align="center"
  109. prop="id"
  110. label="课程组编号"
  111. width="100"></el-table-column>
  112. <el-table-column align="center"
  113. prop="name"
  114. label="课程组名称"
  115. width="100"></el-table-column>
  116. <el-table-column align="center"
  117. prop="type"
  118. label="课程组类型"
  119. width="100">
  120. <template slot-scope="scope">
  121. <div>
  122. <p>{{scope.row.type | comType}}</p>
  123. </div>
  124. </template>
  125. </el-table-column>
  126. <el-table-column align="center"
  127. prop="organName"
  128. label="所属分部"></el-table-column>
  129. <!-- educationalTeacherId -->
  130. <el-table-column align="center"
  131. prop="educationalTeacherName"
  132. label="乐团主管"></el-table-column>
  133. <el-table-column align="center"
  134. prop="teacherName"
  135. label="指导老师"></el-table-column>
  136. <el-table-column align="center"
  137. prop="studentNum"
  138. label="班级人数"></el-table-column>
  139. <!-- <el-table-column align="center" label="课程单价">
  140. <template slot-scope="scope">
  141. <div>
  142. <p>线上:{{scope.row.onlineClassesUnitPrice}}</p>
  143. <p>线下:{{scope.row.offlineClassesUnitPrice}}</p>
  144. </div>
  145. </template>
  146. </el-table-column>-->
  147. <el-table-column align="center"
  148. label="当前课次">
  149. <template slot-scope="scope">
  150. <div>
  151. <p>{{scope.row.currentClassTimes + '/' + scope.row.totalClassTimes}}</p>
  152. </div>
  153. </template>
  154. </el-table-column>
  155. <el-table-column align="center"
  156. prop="coursesStartDate"
  157. label="开课时间"
  158. width="120">
  159. <template slot-scope="scope">
  160. <div>
  161. <p>{{scope.row.coursesStartDate | formatTimer}}</p>
  162. </div>
  163. </template>
  164. </el-table-column>
  165. <el-table-column align="center"
  166. prop="coursesExpireDate"
  167. label="结束时间"
  168. width="120">
  169. <template slot-scope="scope">
  170. <div>
  171. <p>{{scope.row.coursesExpireDate | formatTimer}}</p>
  172. </div>
  173. </template>
  174. </el-table-column>
  175. <el-table-column align="center"
  176. prop="groupStatus"
  177. label="课程组状态"
  178. width="100">
  179. <template slot-scope="scope">
  180. <div>
  181. <p>{{scope.row.groupStatus | comCourseGroup}}</p>
  182. </div>
  183. </template>
  184. </el-table-column>
  185. <el-table-column align="center"
  186. label="是否续费"
  187. fixed="right">
  188. <template slot-scope="scope">
  189. <div>
  190. <p v-if="scope.row.buyMonths == 0">免费</p>
  191. <p v-if="scope.row.buyMonths > 0">{{scope.row.beRenewGroupId>0?'续费':'首充'}}</p>
  192. </div>
  193. </template>
  194. </el-table-column>
  195. <el-table-column align="center"
  196. width="150"
  197. prop="memo"
  198. label="备注"
  199. fixed="right"></el-table-column>
  200. <el-table-column align="center"
  201. width="200"
  202. fixed="right"
  203. label="操作">
  204. <template slot-scope="scope">
  205. <div>
  206. <!-- v-permission="'courseSchedule/classStartDateAdjust'" v-if="!scope.row.isSettlement" -->
  207. <el-button type="text"
  208. @click="lookCrouse(scope.row)">查看</el-button>
  209. <el-button type="text"
  210. v-if="scope.row.groupStatus == 'NORMAL' && permission('practiceGroupManage/cancelGroup')"
  211. @click="closeCrouse(scope.row)">关闭</el-button>
  212. <el-button type="text"
  213. v-if="permission('practiceGroupManage/updateMemo')"
  214. @click="resetMemo(scope.row)">修改备注</el-button>
  215. </div>
  216. </template>
  217. </el-table-column>
  218. </el-table>
  219. <pagination :total="rules.total"
  220. :page.sync="rules.page"
  221. :limit.sync="rules.limit"
  222. :page-sizes="rules.page_size"
  223. @pagination="getList" />
  224. </div>
  225. </div>
  226. <el-dialog title="关闭课程组"
  227. width="400px"
  228. :visible.sync="closeVisible">
  229. <el-form :model="closeForm"
  230. ref="closeForm"
  231. label-position="right"
  232. label-width="80px;"
  233. :inline="true">
  234. <el-form-item label="是否退费"
  235. prop="isBasck">
  236. <el-radio v-model="closeForm.isBack"
  237. :label="true">是</el-radio>
  238. <el-radio v-model="closeForm.isBack"
  239. :label="false">否</el-radio>
  240. </el-form-item>
  241. <el-form-item label="退费金额"
  242. v-if="closeForm.isBack"
  243. prop="money">
  244. <el-input type="number"
  245. @mousewheel.native.prevent
  246. v-model.trim="closeForm.money"></el-input>
  247. </el-form-item>
  248. </el-form>
  249. <div slot="footer"
  250. class="dialog-footer">
  251. <el-button @click="closeVisible = false">取 消</el-button>
  252. <el-button type="primary"
  253. @click="submieCloseCrouse">确 定</el-button>
  254. </div>
  255. </el-dialog>
  256. <el-dialog title="备注"
  257. width="400px"
  258. :visible.sync="memoVisible">
  259. <el-input type="textarea"
  260. v-model.trim="memoForm.memo"
  261. :rows="7"
  262. :maxlength="255"
  263. show-word-limit></el-input>
  264. <div slot="footer"
  265. class="dialog-footer">
  266. <el-button @click="memoVisible = false">取 消</el-button>
  267. <el-button type="primary"
  268. @click="subMemo">确 定</el-button>
  269. </div>
  270. </el-dialog>
  271. </div>
  272. </template>
  273. <script>
  274. import pagination from "@/components/Pagination/index";
  275. import { permission } from "@/utils/directivePage";
  276. import cleanDeep from 'clean-deep'
  277. import { commGroupStatus, practiceGroupType } from "@/utils/searchArray";
  278. import {
  279. getTeacher,
  280. getEmployeeOrgan,
  281. practiceGroupManage,
  282. cancelGroup,
  283. practiceUpdateMemo
  284. } from "@/api/buildTeam";
  285. import axios from "axios";
  286. import { getToken } from "@/utils/auth";
  287. import load from "@/utils/loading";
  288. export default {
  289. components: { pagination },
  290. data () {
  291. return {
  292. searchForm: {
  293. search: null,
  294. status: null,
  295. teacherId: null,
  296. organIdList: null,
  297. firstOrRenew: null,
  298. practiceGroupType: null,
  299. groupStatus: null
  300. },
  301. closeForm: {
  302. isBack: false,
  303. money: null
  304. },
  305. memoForm: {
  306. memo: "",
  307. groupId: ""
  308. },
  309. memoVisible: false,
  310. closeVisible: false,
  311. activeRow: null,
  312. organList: [],
  313. statusList: [],
  314. teacherList: [],
  315. tableData: [],
  316. practiceGroupType: practiceGroupType,
  317. commGroupStatus: commGroupStatus,
  318. rules: {
  319. // 分页规则
  320. limit: 10, // 限制显示条数
  321. page: 1, // 当前页
  322. total: 0, // 总条数
  323. page_size: [10, 20, 40, 50] // 选择限制显示条数
  324. }
  325. };
  326. },
  327. created () {
  328. // if (this.$route.query.searchForm) {
  329. // this.$route.query.searchForm instanceof Object
  330. // ? (this.searchForm = this.$route.query.searchForm)
  331. // : (this.searchForm = JSON.parse(this.$route.query.searchForm));
  332. // }
  333. // if (this.$route.query.rules) {
  334. // this.$route.query.rules instanceof Object
  335. // ? (this.rules = this.$route.query.rules)
  336. // : (this.rules = JSON.parse(this.$route.query.rules));
  337. // }
  338. // this.init();
  339. },
  340. mounted () {
  341. if (this.$route.query.searchForm) {
  342. this.$route.query.searchForm instanceof Object
  343. ? (this.searchForm = this.$route.query.searchForm)
  344. : (this.searchForm = JSON.parse(this.$route.query.searchForm));
  345. }
  346. if (this.$route.query.rules) {
  347. this.$route.query.rules instanceof Object
  348. ? (this.rules = this.$route.query.rules)
  349. : (this.rules = JSON.parse(this.$route.query.rules));
  350. }
  351. this.init();
  352. },
  353. activated () {
  354. this.init();
  355. },
  356. methods: {
  357. init () {
  358. getEmployeeOrgan().then(res => {
  359. if (res.code == 200) {
  360. this.organList = res.data;
  361. }
  362. });
  363. // <!-- 状态 指导老师 活动方案-->
  364. getTeacher().then(res => {
  365. if (res.code == 200) {
  366. this.teacherList = res.data;
  367. }
  368. });
  369. this.getList();
  370. },
  371. permission (str, parent) {
  372. return permission(str, parent);
  373. },
  374. search () {
  375. this.rules.page = 1;
  376. this.getList();
  377. },
  378. onReSet () {
  379. this.searchForm = {
  380. search: null,
  381. status: null,
  382. teacherId: null,
  383. organIdList: null,
  384. firstOrRenew: null,
  385. practiceGroupType: null,
  386. groupStatus: null
  387. };
  388. this.search();
  389. },
  390. onStudentExport () {
  391. // 导出VIP课
  392. // let searchForm = this.searchForm;
  393. let data = {
  394. // teacherId: searchForm.teacherId || null,
  395. // activityId: searchForm.activityId || null,
  396. // organId: searchForm.orgin || null,
  397. // status: searchForm.status || null,
  398. // search: searchForm.search || null
  399. };
  400. let url = "/api-web/export/practiceGroup";
  401. const options = {
  402. method: "get",
  403. headers: {
  404. Authorization: getToken()
  405. },
  406. params: data,
  407. url,
  408. responseType: "blob"
  409. };
  410. this.$confirm("网管课续费提醒导出?", "提示", {
  411. confirmButtonText: "确定",
  412. cancelButtonText: "取消",
  413. type: "warning"
  414. })
  415. .then(() => {
  416. load.startLoading();
  417. axios(options)
  418. .then(res => {
  419. let blob = new Blob([res.data], {
  420. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  421. type: "application/vnd.ms-excel;charset=utf-8"
  422. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  423. });
  424. let text = new Response(blob).text();
  425. text.then(res => {
  426. // 判断是否报错
  427. if (res.indexOf("code") != -1) {
  428. let json = JSON.parse(res);
  429. this.$message.error(json.msg);
  430. } else {
  431. let objectUrl = URL.createObjectURL(blob);
  432. let link = document.createElement("a");
  433. let fname = "网管课续费提醒" + new Date().getTime(); //下载文件的名字
  434. link.href = objectUrl;
  435. link.setAttribute("download", fname);
  436. document.body.appendChild(link);
  437. link.click();
  438. }
  439. });
  440. load.endLoading();
  441. })
  442. .catch(error => {
  443. this.$message.error("导出数据失败,请联系管理员");
  444. load.endLoading();
  445. });
  446. })
  447. .catch(() => { });
  448. },
  449. onPracticeExport () {
  450. // 导出VIP课
  451. let searchForm = this.searchForm;
  452. let obj = {
  453. search: searchForm.search || null,
  454. teacherId: searchForm.teacherId || null,
  455. organId: searchForm.organIdList || null,
  456. hasEducationalTeacherId: searchForm.hasEducationalTeacherId || null,
  457. type: searchForm.firstOrRenew || null,
  458. practiceGroupType: searchForm.practiceGroupType || null,
  459. groupStatus: searchForm.groupStatus || null
  460. };
  461. let url = "/api-web/export/practiceGroupList";
  462. const options = {
  463. method: "get",
  464. headers: {
  465. Authorization: getToken()
  466. },
  467. params: cleanDeep(obj),
  468. url,
  469. responseType: "blob"
  470. };
  471. this.$confirm("网管课导出?", "提示", {
  472. confirmButtonText: "确定",
  473. cancelButtonText: "取消",
  474. type: "warning"
  475. })
  476. .then(() => {
  477. load.startLoading();
  478. axios(options)
  479. .then(res => {
  480. let blob = new Blob([res.data], {
  481. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  482. type: "application/vnd.ms-excel;charset=utf-8"
  483. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  484. });
  485. let text = new Response(blob).text();
  486. text.then(res => {
  487. // 判断是否报错
  488. if (res.indexOf("code") != -1) {
  489. let json = JSON.parse(res);
  490. this.$message.error(json.msg);
  491. } else {
  492. let objectUrl = URL.createObjectURL(blob);
  493. let link = document.createElement("a");
  494. let fname = "网管课" + new Date().getTime(); //下载文件的名字
  495. link.href = objectUrl;
  496. link.setAttribute("download", fname);
  497. document.body.appendChild(link);
  498. link.click();
  499. }
  500. });
  501. load.endLoading();
  502. })
  503. .catch(error => {
  504. this.$message.error("导出数据失败,请联系管理员");
  505. load.endLoading();
  506. });
  507. })
  508. .catch(() => { });
  509. },
  510. getList () {
  511. let obj = {
  512. search: this.searchForm.search || null,
  513. teacherId: this.searchForm.teacherId || null,
  514. organId: this.searchForm.organIdList || null,
  515. page: this.rules.page,
  516. rows: this.rules.limit,
  517. hasEducationalTeacherId:
  518. this.searchForm.hasEducationalTeacherId || null,
  519. type: this.searchForm.firstOrRenew || null,
  520. practiceGroupType: this.searchForm.practiceGroupType || null,
  521. groupStatus: this.searchForm.groupStatus || null
  522. };
  523. practiceGroupManage(obj).then(res => {
  524. if (res.code == 200) {
  525. this.tableData = res.data.rows;
  526. this.rules.total = res.data.total;
  527. }
  528. });
  529. },
  530. lookCrouse (row) {
  531. let rules = JSON.stringify(this.rules);
  532. let searchForm = JSON.stringify(this.searchForm);
  533. this.$router.push({
  534. path: "/business/accompanys",
  535. query: { id: row.id, rules, searchForm, type: row.type }
  536. });
  537. },
  538. closeCrouse (row) {
  539. this.activeRow = row;
  540. this.closeVisible = true;
  541. },
  542. courseVisibleClose () {
  543. // 关闭弹窗前
  544. },
  545. submieCloseCrouse () {
  546. // 提交关闭课程组
  547. if (this.closeForm.isBack) {
  548. if (!this.closeForm.money) {
  549. this.$message.error("请输入退费金额");
  550. return;
  551. }
  552. } else {
  553. this.closeForm.money = null;
  554. }
  555. // 请求数据
  556. cancelGroup({
  557. groupId: this.activeRow.id,
  558. groupType: "PRACTICE",
  559. refundAmount: this.closeForm.money
  560. }).then(res => {
  561. if (res.code == 200) {
  562. this.$message.success("关闭成功");
  563. this.getList();
  564. this.closeVisible = false;
  565. }
  566. });
  567. },
  568. resetMemo (row) {
  569. this.$set(this.memoForm, "memo", row.memo);
  570. this.$set(this.memoForm, "groupId", row.id);
  571. this.memoVisible = true;
  572. },
  573. subMemo () {
  574. practiceUpdateMemo(this.memoForm).then(res => {
  575. if (res.code == 200) {
  576. this.$message.success("修改成功");
  577. this.memoVisible = false;
  578. this.getList();
  579. }
  580. });
  581. }
  582. },
  583. watch: {
  584. closeVisible (val) {
  585. if (!val) {
  586. this.activeRow = null;
  587. (this.closeForm = {
  588. isBack: false,
  589. money: null
  590. }),
  591. this.$refs.closeForm.resetFields();
  592. this.closeVisible = false;
  593. }
  594. }
  595. }
  596. };
  597. </script>
  598. <style lang='scss' scoped>
  599. .topWrap {
  600. display: flex;
  601. flex-direction: row;
  602. justify-content: flex-start;
  603. div {
  604. margin-right: 10px;
  605. }
  606. }
  607. </style>