index.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>
  5. 报表中心
  6. </h2>
  7. <div class="m-core">
  8. <div class="m-wrap">
  9. <div class="title">课酬导出:</div>
  10. <el-date-picker
  11. v-model="mouth"
  12. type="month"
  13. placeholder="选择月"
  14. value-format="yyyy-MM-dd"
  15. ></el-date-picker>
  16. <!-- <el-select v-model.trim="courseScheduleType"
  17. style="marginLeft:10px"
  18. filterable
  19. clearable
  20. multiple
  21. placeholder="课程类型">
  22. <el-option v-for="(item, index) in courseArray"
  23. :key="index"
  24. :label="item.label"
  25. :value="item.value"></el-option>
  26. </el-select> -->
  27. <el-button
  28. style="margin-left: 10px"
  29. type="primary"
  30. @click="exportSalar"
  31. v-permission="'export/teacherSalary'"
  32. >导出</el-button
  33. >
  34. <el-tooltip placement="top" popper-class="mTooltip">
  35. <div slot="content">将只导出当前选择月份已结算的课程课酬。</div>
  36. <i
  37. class="el-icon-question micon el-tooltip"
  38. style="font-size: 18px; color: #f56c6c"
  39. v-permission="'export/teacherSalary'"
  40. ></i>
  41. </el-tooltip>
  42. </div>
  43. <el-divider></el-divider>
  44. <div class="m-core">
  45. <div class="m-wrap">
  46. <div class="title">乐团招生汇总:</div>
  47. <select-all
  48. v-model.trim="organIdList"
  49. class="organSelect"
  50. style="width: 100%"
  51. filterable
  52. placeholder="请选择分部"
  53. multiple
  54. clearable
  55. >
  56. <el-option
  57. v-for="(item, index) in selects.branchs"
  58. :key="index"
  59. :label="item.name"
  60. :value="item.id"
  61. ></el-option>
  62. </select-all>
  63. <el-button
  64. style="margin-left: 10px"
  65. type="primary"
  66. @click="exportMusicGroup"
  67. v-permission="'export/musicGroupRegister'"
  68. >导出</el-button
  69. >
  70. <el-tooltip placement="top" popper-class="mTooltip">
  71. <div slot="content">
  72. 请选择分部后,导出招生情况汇总表,分部可多选
  73. </div>
  74. <i
  75. class="el-icon-question micon el-tooltip"
  76. v-permission="'export/musicGroupRegister'"
  77. style="font-size: 18px; color: #f56c6c"
  78. ></i>
  79. </el-tooltip>
  80. </div>
  81. </div>
  82. <el-divider></el-divider>
  83. <div class="m-core">
  84. <div class="m-wrap">
  85. <div class="title">老师默认课酬:</div>
  86. <select-all
  87. v-model.trim="teacherDefaultSalaryOrganId"
  88. class="organSelect"
  89. style="width: 100%"
  90. filterable
  91. placeholder="请选择分部"
  92. multiple
  93. clearable
  94. >
  95. <el-option
  96. v-for="(item, index) in selects.branchs"
  97. :key="index"
  98. :label="item.name"
  99. :value="item.id"
  100. ></el-option>
  101. </select-all>
  102. <el-button
  103. style="margin-left: 10px"
  104. type="primary"
  105. @click="exportDefaultSalary"
  106. v-permission="'export/teacherDefaultSalary'"
  107. >导出</el-button
  108. >
  109. <el-tooltip placement="top" popper-class="mTooltip">
  110. <div slot="content">请选择分部后,导出老师列表及老师课酬信息</div>
  111. <i
  112. class="el-icon-question micon el-tooltip"
  113. style="font-size: 18px; color: #f56c6c"
  114. v-permission="'export/teacherDefaultSalary'"
  115. ></i>
  116. </el-tooltip>
  117. </div>
  118. </div>
  119. <el-divider></el-divider>
  120. <div class="m-core">
  121. <div class="m-wrap">
  122. <div class="title">乐团在读人数:</div>
  123. <select-all
  124. v-model.trim="musicTeamNum"
  125. class="organSelect"
  126. style="width: 100%"
  127. filterable
  128. multiple
  129. placeholder="请选择分部"
  130. clearable
  131. >
  132. <el-option
  133. v-for="(item, index) in selects.branchs"
  134. :key="index"
  135. :label="item.name"
  136. :value="item.id"
  137. ></el-option>
  138. </select-all>
  139. <el-button
  140. style="margin-left: 10px"
  141. type="primary"
  142. @click="exportMusicTeamNum"
  143. v-permission="'export/musicGroupNormalStudentNum'"
  144. >导出</el-button
  145. >
  146. <el-tooltip placement="top" popper-class="mTooltip">
  147. <div slot="content">请选择分部后,导出乐团在读人数信息</div>
  148. <i
  149. class="el-icon-question micon el-tooltip"
  150. style="font-size: 18px; color: #f56c6c"
  151. v-permission="'export/teacherDefaultSalary'"
  152. ></i>
  153. </el-tooltip>
  154. </div>
  155. </div>
  156. <el-divider></el-divider>
  157. <div class="m-core">
  158. <div class="m-wrap">
  159. <div class="title">回款统计:</div>
  160. <select-all
  161. v-model.trim="studentOrganId"
  162. class="organSelect"
  163. style="width: 100%"
  164. filterable
  165. placeholder="请选择分部"
  166. multiple
  167. clearable
  168. >
  169. <el-option
  170. v-for="(item, index) in selects.branchs"
  171. :key="index"
  172. :label="item.name"
  173. :value="item.id"
  174. ></el-option>
  175. </select-all>
  176. <el-date-picker
  177. style="margin-left: 15px"
  178. v-model="studentMonth"
  179. type="month"
  180. placeholder="选择月"
  181. value-format="yyyy-MM-dd"
  182. ></el-date-picker>
  183. <el-button
  184. style="margin-left: 10px"
  185. type="primary"
  186. @click="exportStudent"
  187. v-permission="'export/studentOrder'"
  188. >导出</el-button
  189. >
  190. <el-tooltip placement="top" popper-class="mTooltip">
  191. <div slot="content">请选择分部和月份,导出回款统计</div>
  192. <i
  193. class="el-icon-question micon el-tooltip"
  194. style="font-size: 18px; color: #f56c6c"
  195. v-permission="'export/studentOrder'"
  196. ></i>
  197. </el-tooltip>
  198. </div>
  199. </div>
  200. <el-divider></el-divider>
  201. <div class="m-core">
  202. <div class="m-wrap">
  203. <div class="title">学生考勤:</div>
  204. <select-all
  205. v-model.trim="attendanceOrganId"
  206. class="organSelect"
  207. style="width: 100%"
  208. filterable
  209. multiple
  210. placeholder="请选择分部"
  211. clearable
  212. >
  213. <el-option
  214. v-for="(item, index) in selects.branchs"
  215. :key="index"
  216. :label="item.name"
  217. :value="item.id"
  218. ></el-option>
  219. </select-all>
  220. <el-select
  221. v-model.trim="attendanceCourseType"
  222. class="organSelect"
  223. style="margin-left: 15px; width: 100%"
  224. filterable
  225. placeholder="请选择课程类型"
  226. >
  227. <el-option
  228. v-for="(item, index) in courseListType"
  229. :key="index"
  230. :label="item.label"
  231. :value="item.value"
  232. ></el-option>
  233. </el-select>
  234. <el-date-picker
  235. v-model.trim="timer"
  236. style="width: 420px; margin-left: 15px"
  237. type="daterange"
  238. value-format="yyyy-MM-dd"
  239. range-separator="至"
  240. start-placeholder="上课开始日期"
  241. end-placeholder="上课结束日期"
  242. :picker-options="{
  243. firstDayOfWeek: 1,
  244. }"
  245. ></el-date-picker>
  246. <el-button
  247. style="margin-left: 10px"
  248. type="primary"
  249. @click="exportAttendance"
  250. v-permission="'export/exportStudentAttendances'"
  251. >导出</el-button
  252. >
  253. </div>
  254. </div>
  255. <el-divider></el-divider>
  256. <div class="m-core">
  257. <div class="m-wrap">
  258. <div class="title">课程余额明细:</div>
  259. <select-all
  260. v-model.trim="AccountOrganId"
  261. class="organSelect"
  262. style="width: 100%"
  263. filterable
  264. multiple
  265. placeholder="请选择分部"
  266. clearable
  267. >
  268. <el-option
  269. v-for="(item, index) in selects.branchs"
  270. :key="index"
  271. :label="item.name"
  272. :value="item.id"
  273. ></el-option>
  274. </select-all>
  275. <el-date-picker
  276. v-model.trim="AccountTimer"
  277. style="width: 420px; margin-left: 15px"
  278. type="daterange"
  279. value-format="yyyy-MM-dd"
  280. range-separator="至"
  281. start-placeholder="开始日期"
  282. end-placeholder="结束日期"
  283. :picker-options="{
  284. firstDayOfWeek: 1,
  285. }"
  286. ></el-date-picker>
  287. <el-button
  288. style="margin-left: 10px"
  289. type="primary"
  290. @click="exportAccount"
  291. v-permission="'export/userCoursesAccount/4388'"
  292. >导出</el-button
  293. >
  294. </div>
  295. </div>
  296. <el-divider></el-divider>
  297. <div class="m-core">
  298. <div class="m-wrap">
  299. <div class="title">账户余额明细:</div>
  300. <select-all
  301. v-model.trim="AccountDetailOrganId"
  302. class="organSelect"
  303. style="width: 100%"
  304. filterable
  305. multiple
  306. placeholder="请选择分部"
  307. clearable
  308. >
  309. <el-option
  310. v-for="(item, index) in selects.branchs"
  311. :key="index"
  312. :label="item.name"
  313. :value="item.id"
  314. ></el-option>
  315. </select-all>
  316. <el-date-picker
  317. v-model.trim="AccountDetailTimer"
  318. style="width: 420px; margin-left: 15px"
  319. type="daterange"
  320. value-format="yyyy-MM-dd"
  321. range-separator="至"
  322. start-placeholder="开始日期"
  323. end-placeholder="结束日期"
  324. :picker-options="{
  325. firstDayOfWeek: 1,
  326. }"
  327. ></el-date-picker>
  328. <el-button
  329. style="margin-left: 10px"
  330. type="primary"
  331. @click="exportDetailAccount"
  332. v-permission="'export/userCashAccountDetail/4389'"
  333. >导出</el-button
  334. >
  335. </div>
  336. </div>
  337. <el-divider></el-divider>
  338. <div class="m-core">
  339. <div class="m-wrap">
  340. <div class="title">乐保订单导出:</div>
  341. <el-date-picker
  342. v-model="leBaoTimer"
  343. style="width: 420px; margin-left: 15px"
  344. type="monthrange"
  345. value-format="yyyy-MM-dd"
  346. range-separator="至"
  347. start-placeholder="开始月份"
  348. end-placeholder="结束月份"
  349. >
  350. </el-date-picker>
  351. <el-button
  352. style="margin-left: 10px"
  353. type="primary"
  354. @click="exportLeBao"
  355. v-permission="'studentInstrument/export'"
  356. >导出</el-button
  357. >
  358. <!-- <el-tooltip placement="top"
  359. popper-class="mTooltip">
  360. <div slot="content">
  361. 请选择分部和月份,导出回款统计
  362. </div>
  363. <i class="el-icon-question micon el-tooltip"
  364. style="font-size: 18px; color: #F56C6C"
  365. v-permission="'export/studentOrder'"></i>
  366. </el-tooltip> -->
  367. </div>
  368. </div>
  369. <el-divider></el-divider>
  370. <div class="m-core">
  371. <div class="m-wrap">
  372. <div class="title">云教练学员统计:</div>
  373. <el-select
  374. v-model.trim="trainOrganId"
  375. class="organSelect"
  376. style="width: 100%"
  377. filterable
  378. placeholder="请选择分部"
  379. clearable
  380. >
  381. <el-option
  382. v-for="(item, index) in selects.branchs"
  383. :key="index"
  384. :label="item.name"
  385. :value="item.id"
  386. ></el-option>
  387. </el-select>
  388. <el-button
  389. style="margin-left: 10px"
  390. type="primary"
  391. @click="exportTrain"
  392. v-permission="'export/cloudStudyStudentTrainData'"
  393. >导出</el-button
  394. >
  395. </div>
  396. </div>
  397. <el-divider></el-divider>
  398. <div class="m-core">
  399. <div class="m-wrap">
  400. <div class="title">问卷调查:</div>
  401. <el-select
  402. v-model.trim="questionActiveType"
  403. class="organSelect"
  404. style="width: 100%"
  405. filterable
  406. placeholder="请选择导出类型"
  407. clearable
  408. >
  409. <el-option
  410. label="云教练用户反馈"
  411. value="CLOUD_TEACHER_FEEDBACK"
  412. ></el-option>
  413. </el-select>
  414. <el-button
  415. style="margin-left: 10px"
  416. type="primary"
  417. @click="exportQuestion"
  418. v-if="$helpers.permission('questionnaireUserResult/export/report')"
  419. >导出</el-button
  420. >
  421. </div>
  422. </div>
  423. <el-divider></el-divider>
  424. <div class="m-core">
  425. <div class="m-wrap">
  426. <div class="title">VIP网管课耗导出:</div>
  427. <select-all
  428. v-model.trim="vipOrganId"
  429. class="organSelect"
  430. style="width: 100%"
  431. filterable
  432. placeholder="请选择分部"
  433. clearable
  434. >
  435. <el-option
  436. v-for="(item, index) in selects.branchs"
  437. :key="index"
  438. :label="item.name"
  439. :value="item.id"
  440. ></el-option>
  441. </select-all>
  442. <el-button
  443. style="margin-left: 10px"
  444. type="primary"
  445. @click="exportVip"
  446. v-permission="'export/studentVipPractice'"
  447. >导出</el-button
  448. >
  449. </div>
  450. </div>
  451. </div>
  452. </div>
  453. </template>
  454. <script>
  455. import { exportTeacherSalary } from "@/api/generalSettings";
  456. import { courseType, courseListType } from "@/utils/searchArray";
  457. import { Export } from "@/utils/downLoadFile";
  458. import cleanDeep from "clean-deep";
  459. import dayjs from "dayjs";
  460. import axios from "axios";
  461. import qs from "qs";
  462. import { getToken } from "@/utils/auth";
  463. import load from "@/utils/loading";
  464. export default {
  465. name: "reportForm",
  466. data() {
  467. return {
  468. mouth: "",
  469. organIdList: [],
  470. teacherDefaultSalaryOrganId: "",
  471. courseArray: courseType,
  472. courseListType,
  473. courseScheduleType: [],
  474. musicTeamNum: [],
  475. studentOrganId: "",
  476. studentMonth: "",
  477. attendanceOrganId: [],
  478. attendanceCourseType: "MUSIC",
  479. timer: [],
  480. leBaoTimer: [],
  481. AccountOrganId: [],
  482. AccountTimer: [],
  483. AccountDetailOrganId: [],
  484. AccountDetailTimer: [],
  485. trainOrganId: null,
  486. questionActiveType: "CLOUD_TEACHER_FEEDBACK",
  487. vipOrganId: [],
  488. };
  489. },
  490. mounted() {
  491. this.$store.dispatch("setBranchs");
  492. },
  493. methods: {
  494. exportSalar() {
  495. if (!this.mouth) {
  496. this.$message.error("请选择导出月份");
  497. return;
  498. }
  499. // let courseTypeList = this.courseScheduleType.join(',')
  500. let url = "/api-web/export/teacherSalary";
  501. let data = { date: this.mouth };
  502. const options = {
  503. method: "POST",
  504. headers: {
  505. Authorization: getToken(),
  506. },
  507. data: qs.stringify(cleanDeep(data)),
  508. url,
  509. responseType: "blob",
  510. };
  511. this.$confirm("您确定导出课酬", "提示", {
  512. confirmButtonText: "确定",
  513. cancelButtonText: "取消",
  514. type: "warning",
  515. })
  516. .then(() => {
  517. load.startLoading();
  518. axios(options)
  519. .then((res) => {
  520. let blob = new Blob([res.data], {
  521. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  522. type: "application/vnd.ms-excel;charset=utf-8",
  523. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  524. });
  525. let text = new Response(blob).text();
  526. text.then((res) => {
  527. // 判断是否报错
  528. if (res.indexOf("code") != -1) {
  529. let json = JSON.parse(res);
  530. this.$message.error(json.msg);
  531. } else {
  532. let objectUrl = URL.createObjectURL(blob);
  533. let link = document.createElement("a");
  534. let nowTime = new Date();
  535. let ymd =
  536. nowTime.getFullYear() +
  537. "" +
  538. (nowTime.getMonth() + 1) +
  539. "" +
  540. nowTime.getDate();
  541. let fname = ymd + "课酬.xls"; //下载文件的名字
  542. link.href = objectUrl;
  543. link.setAttribute("download", fname);
  544. document.body.appendChild(link);
  545. link.click();
  546. }
  547. });
  548. load.endLoading();
  549. })
  550. .catch((error) => {
  551. this.$message.error("导出数据失败,请联系管理员");
  552. load.endLoading();
  553. });
  554. })
  555. .catch(() => {});
  556. },
  557. exportMusicGroup() {
  558. if (this.organIdList.length < 1) {
  559. this.$message.error("请至少选择一个分部");
  560. return;
  561. }
  562. let url = "/api-web/export/musicGroupRegister";
  563. let data = { organIds: this.organIdList.join(",") };
  564. const options = {
  565. method: "POST",
  566. headers: {
  567. Authorization: getToken(),
  568. },
  569. data: qs.stringify(cleanDeep(data)),
  570. url,
  571. responseType: "blob",
  572. };
  573. this.$confirm("您确定导出招生情况汇总表", "提示", {
  574. confirmButtonText: "确定",
  575. cancelButtonText: "取消",
  576. type: "warning",
  577. })
  578. .then(() => {
  579. load.startLoading();
  580. axios(options)
  581. .then((res) => {
  582. let blob = new Blob([res.data], {
  583. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  584. type: "application/vnd.ms-excel;charset=utf-8",
  585. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  586. });
  587. let text = new Response(blob).text();
  588. text.then((res) => {
  589. // 判断是否报错
  590. if (res.indexOf("code") != -1) {
  591. let json = JSON.parse(res);
  592. this.$message.error(json.msg);
  593. } else {
  594. let objectUrl = URL.createObjectURL(blob);
  595. let link = document.createElement("a");
  596. let nowTime = new Date();
  597. let ymd =
  598. nowTime.getFullYear() +
  599. "" +
  600. (nowTime.getMonth() + 1) +
  601. "" +
  602. nowTime.getDate();
  603. let fname = ymd + "招生情况汇总表.xls"; //下载文件的名字
  604. link.href = objectUrl;
  605. link.setAttribute("download", fname);
  606. document.body.appendChild(link);
  607. link.click();
  608. }
  609. });
  610. load.endLoading();
  611. })
  612. .catch((error) => {
  613. this.$message.error("导出数据失败,请联系管理员");
  614. load.endLoading();
  615. });
  616. })
  617. .catch(() => {});
  618. },
  619. exportDefaultSalary() {
  620. let organIdList = this.teacherDefaultSalaryOrganId.join(",");
  621. let url = "/api-web/export/teacherDefaultSalary";
  622. let data = { organIdList };
  623. const options = {
  624. method: "POST",
  625. headers: {
  626. Authorization: getToken(),
  627. },
  628. data: qs.stringify(cleanDeep(data)),
  629. url,
  630. responseType: "blob",
  631. };
  632. this.$confirm("您确定导出老师默认课酬表", "提示", {
  633. confirmButtonText: "确定",
  634. cancelButtonText: "取消",
  635. type: "warning",
  636. })
  637. .then(() => {
  638. load.startLoading();
  639. axios(options)
  640. .then((res) => {
  641. let blob = new Blob([res.data], {
  642. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  643. type: "application/vnd.ms-excel;charset=utf-8",
  644. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  645. });
  646. let text = new Response(blob).text();
  647. text.then((res) => {
  648. // 判断是否报错
  649. if (res.indexOf("code") != -1) {
  650. let json = JSON.parse(res);
  651. this.$message.error(json.msg);
  652. } else {
  653. let objectUrl = URL.createObjectURL(blob);
  654. let link = document.createElement("a");
  655. let nowTime = new Date();
  656. let ymd =
  657. nowTime.getFullYear() +
  658. "" +
  659. (nowTime.getMonth() + 1) +
  660. "" +
  661. nowTime.getDate();
  662. let fname = ymd + "老师默认课酬表.xls"; //下载文件的名字
  663. link.href = objectUrl;
  664. link.setAttribute("download", fname);
  665. document.body.appendChild(link);
  666. link.click();
  667. }
  668. });
  669. load.endLoading();
  670. })
  671. .catch((error) => {
  672. this.$message.error("导出数据失败,请联系管理员");
  673. load.endLoading();
  674. });
  675. })
  676. .catch(() => {});
  677. },
  678. exportMusicTeamNum() {
  679. let organIds = this.musicTeamNum.join(",");
  680. let url = "/api-web/export/musicGroupNormalStudentNum";
  681. let data = { organIds };
  682. const options = {
  683. method: "POST",
  684. headers: {
  685. Authorization: getToken(),
  686. },
  687. data: qs.stringify(cleanDeep(data)),
  688. url,
  689. responseType: "blob",
  690. };
  691. this.$confirm("您确定导出乐团在读人数", "提示", {
  692. confirmButtonText: "确定",
  693. cancelButtonText: "取消",
  694. type: "warning",
  695. })
  696. .then(() => {
  697. load.startLoading();
  698. axios(options)
  699. .then((res) => {
  700. let blob = new Blob([res.data], {
  701. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  702. type: "application/vnd.ms-excel;charset=utf-8",
  703. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  704. });
  705. let text = new Response(blob).text();
  706. text.then((res) => {
  707. // 判断是否报错
  708. if (res.indexOf("code") != -1) {
  709. let json = JSON.parse(res);
  710. this.$message.error(json.msg);
  711. } else {
  712. let objectUrl = URL.createObjectURL(blob);
  713. let link = document.createElement("a");
  714. let nowTime = new Date();
  715. let ymd =
  716. nowTime.getFullYear() +
  717. "" +
  718. (nowTime.getMonth() + 1) +
  719. "" +
  720. nowTime.getDate();
  721. let fname = ymd + "乐团在读人数.xls"; //下载文件的名字
  722. link.href = objectUrl;
  723. link.setAttribute("download", fname);
  724. document.body.appendChild(link);
  725. link.click();
  726. }
  727. });
  728. load.endLoading();
  729. })
  730. .catch((error) => {
  731. this.$message.error("导出数据失败,请联系管理员");
  732. load.endLoading();
  733. });
  734. })
  735. .catch(() => {});
  736. },
  737. exportStudent() {
  738. if (!this.studentMonth) {
  739. this.$message.error("请选择导出月份");
  740. return;
  741. }
  742. let studentOrganId = this.studentOrganId.join(",");
  743. let url = "/api-web/export/studentOrder";
  744. let data = { organIds: studentOrganId, date: this.studentMonth };
  745. const options = {
  746. method: "POST",
  747. headers: {
  748. Authorization: getToken(),
  749. },
  750. data: qs.stringify(cleanDeep(data)),
  751. url,
  752. responseType: "blob",
  753. };
  754. this.$confirm("您确定导出回款统计", "提示", {
  755. confirmButtonText: "确定",
  756. cancelButtonText: "取消",
  757. type: "warning",
  758. })
  759. .then(() => {
  760. load.startLoading();
  761. axios(options)
  762. .then((res) => {
  763. let blob = new Blob([res.data], {
  764. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  765. type: "application/vnd.ms-excel;charset=utf-8",
  766. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  767. });
  768. let text = new Response(blob).text();
  769. text.then((res) => {
  770. // 判断是否报错
  771. if (res.indexOf("code") != -1) {
  772. let json = JSON.parse(res);
  773. this.$message.error(json.msg);
  774. } else {
  775. let objectUrl = URL.createObjectURL(blob);
  776. let link = document.createElement("a");
  777. let nowTime = new Date();
  778. let ymd =
  779. nowTime.getFullYear() +
  780. "" +
  781. (nowTime.getMonth() + 1) +
  782. "" +
  783. nowTime.getDate();
  784. let fname = ymd + "回款统计.xls"; //下载文件的名字
  785. link.href = objectUrl;
  786. link.setAttribute("download", fname);
  787. document.body.appendChild(link);
  788. link.click();
  789. }
  790. });
  791. load.endLoading();
  792. })
  793. .catch((error) => {
  794. this.$message.error("导出数据失败,请联系管理员");
  795. load.endLoading();
  796. });
  797. })
  798. .catch(() => {});
  799. },
  800. exportAttendance() {
  801. let classStartDate, classEndDate;
  802. if (this.timer && this.timer.length > 0) {
  803. classStartDate = this.timer[0];
  804. classEndDate = this.timer[1];
  805. } else {
  806. classStartDate = null;
  807. classEndDate = null;
  808. }
  809. Export(
  810. this,
  811. {
  812. url: "/api-web/export/exportStudentAttendances",
  813. fileName: "学生考勤.xls",
  814. method: "post",
  815. params: qs.stringify({
  816. organId: this.attendanceOrganId.join(","),
  817. groupType: this.attendanceCourseType,
  818. classStartDate,
  819. classEndDate,
  820. }),
  821. },
  822. "您确定导出学生考勤?"
  823. );
  824. },
  825. exportTrain() {
  826. if (!this.trainOrganId) {
  827. this.$message.error("请选择分部");
  828. return;
  829. }
  830. Export(
  831. this,
  832. {
  833. url: "/api-web/export/cloudStudyStudentTrainData",
  834. fileName: "云教练学员统计.xls",
  835. method: "post",
  836. params: qs.stringify({
  837. organId: this.trainOrganId,
  838. }),
  839. },
  840. "您确定导出云教练学员统计?"
  841. );
  842. },
  843. exportQuestion() {
  844. Export(
  845. this,
  846. {
  847. url: "/api-web/questionnaireUserResult/export",
  848. fileName: "问卷调查.xls",
  849. method: "get",
  850. params: { activeType: this.questionActiveType },
  851. },
  852. "您确定导出问卷调查?"
  853. );
  854. },
  855. exportLeBao() {
  856. let endTime, startTime;
  857. if (this.leBaoTimer && this.leBaoTimer.length > 1) {
  858. startTime = this.leBaoTimer[0];
  859. let end = this.leBaoTimer[1];
  860. end = new Date(end);
  861. end = new Date(end.getFullYear(), end.getMonth() + 1, 0);
  862. endTime = dayjs(end).format("YYYY-MM-DD");
  863. } else {
  864. this.$message.error("请选择导出月份");
  865. return;
  866. }
  867. Export(
  868. this,
  869. {
  870. url: "/api-web/studentInstrument/export",
  871. fileName: "乐保订单.xls",
  872. method: "get",
  873. params: { startTime: startTime, endTime: endTime },
  874. },
  875. "您确定导出乐保订单?"
  876. );
  877. },
  878. exportAccount() {
  879. let endTime, startTime;
  880. if (this.AccountTimer && this.AccountTimer.length > 1) {
  881. startTime = this.AccountTimer[0];
  882. endTime = this.AccountTimer[1];
  883. } else {
  884. startTime = null;
  885. endTime = null;
  886. }
  887. Export(
  888. this,
  889. {
  890. url: "/api-web/export/userCoursesAccount",
  891. fileName: "课程余额明细.xls",
  892. method: "post",
  893. params: qs.stringify({
  894. startTime: startTime,
  895. endTime: endTime,
  896. organId: this.AccountOrganId.join(","),
  897. }),
  898. },
  899. "您确定导出课程余额明细?"
  900. );
  901. },
  902. exportDetailAccount() {
  903. let endTime, startTime;
  904. if (this.AccountDetailTimer && this.AccountDetailTimer.length > 1) {
  905. startTime = this.AccountDetailTimer[0];
  906. endTime = this.AccountDetailTimer[1];
  907. } else {
  908. startTime = null;
  909. endTime = null;
  910. }
  911. Export(
  912. this,
  913. {
  914. url: "/api-web/export/userCashAccountDetail",
  915. fileName: "账户余额明细.xls",
  916. method: "post",
  917. params: qs.stringify({
  918. startTime: startTime,
  919. endTime: endTime,
  920. organId: this.AccountDetailOrganId.join(","),
  921. }),
  922. },
  923. "您确定导出账户余额明细?"
  924. );
  925. },
  926. exportVip() {
  927. if (!this.vipOrganId.length < 0) {
  928. this.$message.error("请选择分部");
  929. return;
  930. }
  931. let data = qs.stringify({
  932. organId: this.vipOrganId.join(","),
  933. });
  934. let url = "/api-web/export/studentVipPractice";
  935. const options = {
  936. method: "POST",
  937. headers: {
  938. Authorization: getToken(),
  939. },
  940. data: qs.stringify(cleanDeep(data)),
  941. url,
  942. responseType: "json",
  943. };
  944. this.$confirm("您确定导出VIP网管课耗", "提示", {
  945. confirmButtonText: "确定",
  946. cancelButtonText: "取消",
  947. type: "warning",
  948. })
  949. .then(() => {
  950. load.startLoading();
  951. axios(options)
  952. .then((res) => {
  953. load.endLoading();
  954. if (res.data.code == 200) {
  955. this.$message.info(res.data.msg);
  956. } else {
  957. this.$message.error(res.data.msg);
  958. }
  959. // this.$confirm(res.data.data, "提示", {
  960. // confirmButtonText: "确定",
  961. // cancelButtonText: "取消",
  962. // type: "warning",
  963. // }).then(() => {
  964. // }).catch(err => {
  965. // })
  966. })
  967. .catch((error) => {
  968. this.$message.error("导出数据失败,请联系管理员");
  969. load.endLoading();
  970. });
  971. })
  972. .catch(() => {});
  973. // Export(
  974. // this,
  975. // {
  976. // url: "/api-web/export/studentVipPractice",
  977. // fileName: "vip网管课.xls",
  978. // method: "post",
  979. // params: qs.stringify({
  980. // organId: this.vipOrganId.join(',')
  981. // }),
  982. // },
  983. // "您确定导出vip网管课?"
  984. // );
  985. },
  986. },
  987. // AccountDetailTimer
  988. };
  989. </script>
  990. <style lang="scss" scoped>
  991. .m-container {
  992. .m-core {
  993. margin-top: 20px;
  994. .m-wrap {
  995. display: flex;
  996. flex-direction: row;
  997. justify-content: flex-start;
  998. width: 100%;
  999. // align-items: center;
  1000. .newBand {
  1001. margin: 0 5px 0 10px;
  1002. }
  1003. .title {
  1004. width: 150px;
  1005. height: 40px;
  1006. line-height: 40px;
  1007. text-align: right;
  1008. color: #606266;
  1009. }
  1010. .organSelect {
  1011. width: 220px !important;
  1012. }
  1013. .el-tooltip.micon {
  1014. width: 20px;
  1015. height: 20px;
  1016. position: relative;
  1017. top: 12px;
  1018. }
  1019. }
  1020. }
  1021. }
  1022. /deep/.el-input__icon.el-icon-date {
  1023. height: 40px !important;
  1024. }
  1025. </style>