index.vue 30 KB

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