accompanyList.vue 22 KB

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