index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  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. </div>
  395. </div>
  396. </div>
  397. </div>
  398. </template>
  399. <script>
  400. import { exportTeacherSalary } from "@/api/generalSettings";
  401. import { courseType, courseListType } from "@/utils/searchArray";
  402. import { Export } from "@/utils/downLoadFile";
  403. import cleanDeep from "clean-deep";
  404. import dayjs from "dayjs";
  405. import axios from "axios";
  406. import qs from "qs";
  407. import { getToken } from "@/utils/auth";
  408. import load from "@/utils/loading";
  409. export default {
  410. name: "reportForm",
  411. data() {
  412. return {
  413. mouth: "",
  414. organIdList: [],
  415. teacherDefaultSalaryOrganId: "",
  416. courseArray: courseType,
  417. courseListType,
  418. courseScheduleType: [],
  419. musicTeamNum: [],
  420. studentOrganId: "",
  421. studentMonth: "",
  422. attendanceOrganId: [],
  423. attendanceCourseType: "MUSIC",
  424. timer: [],
  425. leBaoTimer: [],
  426. AccountOrganId: [],
  427. AccountTimer: [],
  428. AccountDetailOrganId: [],
  429. AccountDetailTimer: [],
  430. trainOrganId: null,
  431. };
  432. },
  433. mounted() {
  434. this.$store.dispatch("setBranchs");
  435. },
  436. methods: {
  437. exportSalar() {
  438. if (!this.mouth) {
  439. this.$message.error("请选择导出月份");
  440. return;
  441. }
  442. // let courseTypeList = this.courseScheduleType.join(',')
  443. let url = "/api-web/export/teacherSalary";
  444. let data = { date: this.mouth };
  445. const options = {
  446. method: "POST",
  447. headers: {
  448. Authorization: getToken(),
  449. },
  450. data: qs.stringify(cleanDeep(data)),
  451. url,
  452. responseType: "blob",
  453. };
  454. this.$confirm("您确定导出课酬", "提示", {
  455. confirmButtonText: "确定",
  456. cancelButtonText: "取消",
  457. type: "warning",
  458. })
  459. .then(() => {
  460. load.startLoading();
  461. axios(options)
  462. .then((res) => {
  463. let blob = new Blob([res.data], {
  464. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  465. type: "application/vnd.ms-excel;charset=utf-8",
  466. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  467. });
  468. let text = new Response(blob).text();
  469. text.then((res) => {
  470. // 判断是否报错
  471. if (res.indexOf("code") != -1) {
  472. let json = JSON.parse(res);
  473. this.$message.error(json.msg);
  474. } else {
  475. let objectUrl = URL.createObjectURL(blob);
  476. let link = document.createElement("a");
  477. let nowTime = new Date();
  478. let ymd =
  479. nowTime.getFullYear() +
  480. "" +
  481. (nowTime.getMonth() + 1) +
  482. "" +
  483. nowTime.getDate();
  484. let fname = ymd + "课酬.xls"; //下载文件的名字
  485. link.href = objectUrl;
  486. link.setAttribute("download", fname);
  487. document.body.appendChild(link);
  488. link.click();
  489. }
  490. });
  491. load.endLoading();
  492. })
  493. .catch((error) => {
  494. this.$message.error("导出数据失败,请联系管理员");
  495. load.endLoading();
  496. });
  497. })
  498. .catch(() => {});
  499. },
  500. exportMusicGroup() {
  501. if (this.organIdList.length < 1) {
  502. this.$message.error("请至少选择一个分部");
  503. return;
  504. }
  505. let url = "/api-web/export/musicGroupRegister";
  506. let data = { organIds: this.organIdList.join(",") };
  507. const options = {
  508. method: "POST",
  509. headers: {
  510. Authorization: getToken(),
  511. },
  512. data: qs.stringify(cleanDeep(data)),
  513. url,
  514. responseType: "blob",
  515. };
  516. this.$confirm("您确定导出招生情况汇总表", "提示", {
  517. confirmButtonText: "确定",
  518. cancelButtonText: "取消",
  519. type: "warning",
  520. })
  521. .then(() => {
  522. load.startLoading();
  523. axios(options)
  524. .then((res) => {
  525. let blob = new Blob([res.data], {
  526. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  527. type: "application/vnd.ms-excel;charset=utf-8",
  528. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  529. });
  530. let text = new Response(blob).text();
  531. text.then((res) => {
  532. // 判断是否报错
  533. if (res.indexOf("code") != -1) {
  534. let json = JSON.parse(res);
  535. this.$message.error(json.msg);
  536. } else {
  537. let objectUrl = URL.createObjectURL(blob);
  538. let link = document.createElement("a");
  539. let nowTime = new Date();
  540. let ymd =
  541. nowTime.getFullYear() +
  542. "" +
  543. (nowTime.getMonth() + 1) +
  544. "" +
  545. nowTime.getDate();
  546. let fname = ymd + "招生情况汇总表.xls"; //下载文件的名字
  547. link.href = objectUrl;
  548. link.setAttribute("download", fname);
  549. document.body.appendChild(link);
  550. link.click();
  551. }
  552. });
  553. load.endLoading();
  554. })
  555. .catch((error) => {
  556. this.$message.error("导出数据失败,请联系管理员");
  557. load.endLoading();
  558. });
  559. })
  560. .catch(() => {});
  561. },
  562. exportDefaultSalary() {
  563. let organIdList = this.teacherDefaultSalaryOrganId.join(",");
  564. let url = "/api-web/export/teacherDefaultSalary";
  565. let data = { organIdList };
  566. const options = {
  567. method: "POST",
  568. headers: {
  569. Authorization: getToken(),
  570. },
  571. data: qs.stringify(cleanDeep(data)),
  572. url,
  573. responseType: "blob",
  574. };
  575. this.$confirm("您确定导出老师默认课酬表", "提示", {
  576. confirmButtonText: "确定",
  577. cancelButtonText: "取消",
  578. type: "warning",
  579. })
  580. .then(() => {
  581. load.startLoading();
  582. axios(options)
  583. .then((res) => {
  584. let blob = new Blob([res.data], {
  585. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  586. type: "application/vnd.ms-excel;charset=utf-8",
  587. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  588. });
  589. let text = new Response(blob).text();
  590. text.then((res) => {
  591. // 判断是否报错
  592. if (res.indexOf("code") != -1) {
  593. let json = JSON.parse(res);
  594. this.$message.error(json.msg);
  595. } else {
  596. let objectUrl = URL.createObjectURL(blob);
  597. let link = document.createElement("a");
  598. let nowTime = new Date();
  599. let ymd =
  600. nowTime.getFullYear() +
  601. "" +
  602. (nowTime.getMonth() + 1) +
  603. "" +
  604. nowTime.getDate();
  605. let fname = ymd + "老师默认课酬表.xls"; //下载文件的名字
  606. link.href = objectUrl;
  607. link.setAttribute("download", fname);
  608. document.body.appendChild(link);
  609. link.click();
  610. }
  611. });
  612. load.endLoading();
  613. })
  614. .catch((error) => {
  615. this.$message.error("导出数据失败,请联系管理员");
  616. load.endLoading();
  617. });
  618. })
  619. .catch(() => {});
  620. },
  621. exportMusicTeamNum() {
  622. let organIds = this.musicTeamNum.join(",");
  623. let url = "/api-web/export/musicGroupNormalStudentNum";
  624. let data = { organIds };
  625. const options = {
  626. method: "POST",
  627. headers: {
  628. Authorization: getToken(),
  629. },
  630. data: qs.stringify(cleanDeep(data)),
  631. url,
  632. responseType: "blob",
  633. };
  634. this.$confirm("您确定导出乐团在读人数", "提示", {
  635. confirmButtonText: "确定",
  636. cancelButtonText: "取消",
  637. type: "warning",
  638. })
  639. .then(() => {
  640. load.startLoading();
  641. axios(options)
  642. .then((res) => {
  643. let blob = new Blob([res.data], {
  644. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  645. type: "application/vnd.ms-excel;charset=utf-8",
  646. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  647. });
  648. let text = new Response(blob).text();
  649. text.then((res) => {
  650. // 判断是否报错
  651. if (res.indexOf("code") != -1) {
  652. let json = JSON.parse(res);
  653. this.$message.error(json.msg);
  654. } else {
  655. let objectUrl = URL.createObjectURL(blob);
  656. let link = document.createElement("a");
  657. let nowTime = new Date();
  658. let ymd =
  659. nowTime.getFullYear() +
  660. "" +
  661. (nowTime.getMonth() + 1) +
  662. "" +
  663. nowTime.getDate();
  664. let fname = ymd + "乐团在读人数.xls"; //下载文件的名字
  665. link.href = objectUrl;
  666. link.setAttribute("download", fname);
  667. document.body.appendChild(link);
  668. link.click();
  669. }
  670. });
  671. load.endLoading();
  672. })
  673. .catch((error) => {
  674. this.$message.error("导出数据失败,请联系管理员");
  675. load.endLoading();
  676. });
  677. })
  678. .catch(() => {});
  679. },
  680. exportStudent() {
  681. if (!this.studentMonth) {
  682. this.$message.error("请选择导出月份");
  683. return;
  684. }
  685. let studentOrganId = this.studentOrganId.join(",");
  686. let url = "/api-web/export/studentOrder";
  687. let data = { organIds: studentOrganId, date: this.studentMonth };
  688. const options = {
  689. method: "POST",
  690. headers: {
  691. Authorization: getToken(),
  692. },
  693. data: qs.stringify(cleanDeep(data)),
  694. url,
  695. responseType: "blob",
  696. };
  697. this.$confirm("您确定导出回款统计", "提示", {
  698. confirmButtonText: "确定",
  699. cancelButtonText: "取消",
  700. type: "warning",
  701. })
  702. .then(() => {
  703. load.startLoading();
  704. axios(options)
  705. .then((res) => {
  706. let blob = new Blob([res.data], {
  707. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  708. type: "application/vnd.ms-excel;charset=utf-8",
  709. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  710. });
  711. let text = new Response(blob).text();
  712. text.then((res) => {
  713. // 判断是否报错
  714. if (res.indexOf("code") != -1) {
  715. let json = JSON.parse(res);
  716. this.$message.error(json.msg);
  717. } else {
  718. let objectUrl = URL.createObjectURL(blob);
  719. let link = document.createElement("a");
  720. let nowTime = new Date();
  721. let ymd =
  722. nowTime.getFullYear() +
  723. "" +
  724. (nowTime.getMonth() + 1) +
  725. "" +
  726. nowTime.getDate();
  727. let fname = ymd + "回款统计.xls"; //下载文件的名字
  728. link.href = objectUrl;
  729. link.setAttribute("download", fname);
  730. document.body.appendChild(link);
  731. link.click();
  732. }
  733. });
  734. load.endLoading();
  735. })
  736. .catch((error) => {
  737. this.$message.error("导出数据失败,请联系管理员");
  738. load.endLoading();
  739. });
  740. })
  741. .catch(() => {});
  742. },
  743. exportAttendance() {
  744. let classStartDate, classEndDate;
  745. if (this.timer && this.timer.length > 0) {
  746. classStartDate = this.timer[0];
  747. classEndDate = this.timer[1];
  748. } else {
  749. classStartDate = null;
  750. classEndDate = null;
  751. }
  752. Export(
  753. this,
  754. {
  755. url: "/api-web/export/exportStudentAttendances",
  756. fileName: "学生考勤.xls",
  757. method: "post",
  758. params: qs.stringify({
  759. organId: this.attendanceOrganId.join(","),
  760. groupType: this.attendanceCourseType,
  761. classStartDate,
  762. classEndDate,
  763. }),
  764. },
  765. "您确定导出学生考勤?"
  766. );
  767. },
  768. exportTrain() {
  769. if (!this.trainOrganId) {
  770. this.$message.error("请选择分部");
  771. return;
  772. }
  773. Export(
  774. this,
  775. {
  776. url: "/api-web/export/cloudStudyStudentTrainData",
  777. fileName: "云教练学员统计.xls",
  778. method: "post",
  779. params: qs.stringify({
  780. organId: this.trainOrganId
  781. }),
  782. },
  783. "您确定导出云教练学员统计?"
  784. );
  785. },
  786. exportLeBao() {
  787. let endTime, startTime;
  788. if (this.leBaoTimer && this.leBaoTimer.length > 1) {
  789. startTime = this.leBaoTimer[0];
  790. let end = this.leBaoTimer[1];
  791. end = new Date(end);
  792. end = new Date(end.getFullYear(), end.getMonth() + 1, 0);
  793. endTime = dayjs(end).format("YYYY-MM-DD");
  794. } else {
  795. this.$message.error("请选择导出月份");
  796. return;
  797. }
  798. Export(
  799. this,
  800. {
  801. url: "/api-web/studentInstrument/export",
  802. fileName: "乐保订单.xls",
  803. method: "get",
  804. params: { startTime: startTime, endTime: endTime },
  805. },
  806. "您确定导出乐保订单?"
  807. );
  808. },
  809. exportAccount(){
  810. let endTime, startTime;
  811. if (this.AccountTimer && this.AccountTimer.length > 1) {
  812. startTime = this.AccountTimer[0];
  813. endTime = this.AccountTimer[1];
  814. }else{
  815. startTime=null;
  816. endTime=null;
  817. }
  818. Export(
  819. this,
  820. {
  821. url: "/api-web/export/userCoursesAccount",
  822. fileName: "课程余额明细.xls",
  823. method: "post",
  824. params: qs.stringify({ startTime: startTime, endTime: endTime,organId: this.AccountOrganId.join(",") }),
  825. },
  826. "您确定导出课程余额明细?"
  827. );
  828. },
  829. exportDetailAccount(){
  830. let endTime, startTime;
  831. if (this.AccountDetailTimer && this.AccountDetailTimer.length > 1) {
  832. startTime = this.AccountDetailTimer[0];
  833. endTime = this.AccountDetailTimer[1];
  834. }else{
  835. startTime=null;
  836. endTime=null;
  837. }
  838. Export(
  839. this,
  840. {
  841. url: "/api-web/export/userCashAccountDetail",
  842. fileName: "账户余额明细.xls",
  843. method: "post",
  844. params:qs.stringify( { startTime: startTime, endTime: endTime,organId: this.AccountDetailOrganId.join(",") })
  845. },
  846. "您确定导出账户余额明细?"
  847. );
  848. }
  849. },
  850. // AccountDetailTimer
  851. };
  852. </script>
  853. <style lang="scss" scoped>
  854. .m-container {
  855. .m-core {
  856. margin-top: 20px;
  857. .m-wrap {
  858. display: flex;
  859. flex-direction: row;
  860. justify-content: flex-start;
  861. width: 100%;
  862. // align-items: center;
  863. .newBand {
  864. margin: 0 5px 0 10px;
  865. }
  866. .title {
  867. width: 150px;
  868. height: 40px;
  869. line-height: 40px;
  870. text-align: right;
  871. color: #606266;
  872. }
  873. .organSelect {
  874. width: 220px !important;
  875. }
  876. .el-tooltip.micon {
  877. width: 20px;
  878. height: 20px;
  879. position: relative;
  880. top: 12px;
  881. }
  882. }
  883. }
  884. }
  885. /deep/.el-input__icon.el-icon-date {
  886. height: 40px !important;
  887. }
  888. </style>