You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1233 lines
39 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="box">
  3. <div>
  4. <div class="middlebox">
  5. <div class="contenttitle">
  6. 收费统计 /
  7. <span class="contenttitleBold">收费员报表</span>
  8. </div>
  9. </div>
  10. <div :style="'display: block;'">
  11. <div
  12. style="
  13. background-color: #fff;
  14. padding: 15px;
  15. border-radius: 8px;
  16. display: flex;
  17. flex-wrap: wrap;
  18. margin-bottom: 10px;
  19. height: 35px;
  20. margin-top: 7px;
  21. "
  22. >
  23. <div class="query">
  24. <span>收费员</span>
  25. <el-select
  26. v-model="username"
  27. placeholder="请选择"
  28. size="small"
  29. multiple
  30. style="width: 100px"
  31. >
  32. <el-option
  33. v-for="item in registrardata"
  34. :key="item.id"
  35. :label="item.surname"
  36. :value="item.id"
  37. >
  38. </el-option>
  39. </el-select>
  40. </div>
  41. <div class="query">
  42. <span>开始日期</span>
  43. <el-date-picker
  44. type="date"
  45. placeholder="选择开始日期"
  46. size="small"
  47. v-model="startDate"
  48. value-format="yyyy-MM-dd"
  49. editable
  50. style="width: 180px"
  51. >
  52. </el-date-picker>
  53. </div>
  54. <div class="query">
  55. <span>结束日期</span>
  56. <el-date-picker
  57. type="date"
  58. placeholder="选择结束日期"
  59. size="small"
  60. v-model="endDate"
  61. value-format="yyyy-MM-dd"
  62. editable
  63. style="width: 180px"
  64. >
  65. </el-date-picker>
  66. </div>
  67. <div class="query">
  68. <span>报表格式</span>
  69. <el-select
  70. v-model="format"
  71. placeholder="请选择格式"
  72. size="small"
  73. @change="changeValue"
  74. style="width: 100px"
  75. >
  76. <el-option label="支付方式" value="0" />
  77. <el-option label="发票类型" value="1" />
  78. <el-option label="组合项目" value="2" />
  79. </el-select>
  80. </div>
  81. <div class="query">
  82. <el-button size="small" @click="onSubmit" class="commonbutton"
  83. >查询</el-button
  84. >
  85. </div>
  86. <div class="query">
  87. <el-button size="small" @click="handleExport" class="commonbutton"
  88. >导出excel</el-button
  89. >
  90. </div>
  91. <div class="query">
  92. <el-button size="small" @click="onPrint" class="commonbutton"
  93. >打印</el-button
  94. >
  95. </div>
  96. <div class="query">
  97. <el-button size="small" @click="columnarChart" class="commonbutton"
  98. >柱状图</el-button
  99. >
  100. </div>
  101. <div class="query">
  102. <el-button size="small" @click="peiChart" class="commonbutton"
  103. >饼图</el-button
  104. >
  105. </div>
  106. </div>
  107. <div
  108. style="
  109. display: flex;
  110. justify-content: space-between;
  111. position: relative;
  112. "
  113. id="domTable"
  114. >
  115. <div
  116. style="
  117. width: 47.7%;
  118. background-color: #fff;
  119. padding: 15px;
  120. border-radius: 8px;
  121. "
  122. ref="imageDom0"
  123. v-show="format == 0"
  124. >
  125. <div>
  126. <el-table
  127. border
  128. :span-method="objectStandardSpanMethod"
  129. :height="
  130. flag
  131. ? window.pageHeight < 600
  132. ? 415
  133. : window.pageHeight - 185 - 20
  134. : ''
  135. "
  136. :data="standardTableData"
  137. id="standardTableData"
  138. ref="standardTableData"
  139. style="width: 100%"
  140. :header-cell-class-name="headerStyle"
  141. :cell-style="tableRowClassName"
  142. show-summary
  143. :summary-method="
  144. (param) => paymodesummarizeRegisterCount(param, sumTotalMoney)
  145. "
  146. >
  147. <el-table-column label="收费员支付方式统计报表">
  148. <el-table-column
  149. :label="'时间:' + startDate + '至' + endDate"
  150. >
  151. <el-table-column
  152. :label="
  153. '收费票据数量:' +
  154. chargeCount +
  155. '退费票据数量:' +
  156. chargeBackCount
  157. "
  158. >
  159. <el-table-column
  160. prop="chargeName"
  161. label="收费员"
  162. ></el-table-column>
  163. <el-table-column
  164. prop="payModeName"
  165. label="支付方式"
  166. ></el-table-column>
  167. <el-table-column
  168. prop="chargeMoney"
  169. label="收费金额"
  170. ></el-table-column>
  171. <el-table-column prop="chargeBackMoney" label="退费金额">
  172. </el-table-column>
  173. <el-table-column prop="totalMoney" label="合计金额">
  174. </el-table-column>
  175. </el-table-column>
  176. </el-table-column>
  177. </el-table-column>
  178. </el-table>
  179. </div>
  180. </div>
  181. <div
  182. style="
  183. width: 47.7%;
  184. background-color: #fff;
  185. padding: 15px;
  186. border-radius: 8px;
  187. "
  188. ref="imageDom1"
  189. v-show="format == 1"
  190. >
  191. <div>
  192. <el-table
  193. border
  194. show-summary
  195. :summary-method="invoicesummarizeRegisterCount"
  196. :height="
  197. flag
  198. ? window.pageHeight < 600
  199. ? 415
  200. : window.pageHeight - 185 - 20
  201. : ''
  202. "
  203. :data="tableData"
  204. id="tableData"
  205. ref="tableData"
  206. style="width: 100%"
  207. :header-cell-class-name="headerStyle"
  208. >
  209. <el-table-column label="收费员发票类型统计报表">
  210. <el-table-column
  211. :label="'时间:' + startDate + '至' + endDate"
  212. >
  213. <el-table-column
  214. :label="
  215. '收费票据数量:' +
  216. invoicechargeCount +
  217. '退费票据数量:' +
  218. invoicechargeBackCount
  219. "
  220. >
  221. <template slot-scope="scope">
  222. <el-table
  223. :data="scope.row.chargeDetails.invoiceTypeDetails"
  224. border
  225. show-summary
  226. :summary-method="summarizeRegisterCounts"
  227. >
  228. <el-table-column label="收费">
  229. <el-table-column
  230. label="发票类型"
  231. prop="invoiceTypeName"
  232. ></el-table-column>
  233. <el-table-column
  234. label="金额"
  235. prop="invoiceTypeMoney"
  236. ></el-table-column>
  237. </el-table-column>
  238. </el-table>
  239. <el-table
  240. :data="scope.row.chargeBackDetails.invoiceTypeDetails"
  241. border
  242. show-summary
  243. :summary-method="summarizeRegisterCounts"
  244. >
  245. <el-table-column label="退费">
  246. <el-table-column
  247. label="发票类型"
  248. prop="invoiceTypeName"
  249. ></el-table-column>
  250. <el-table-column
  251. label="金额"
  252. prop="invoiceTypeMoney"
  253. ></el-table-column>
  254. </el-table-column>
  255. </el-table>
  256. </template>
  257. </el-table-column>
  258. </el-table-column>
  259. </el-table-column>
  260. </el-table>
  261. </div>
  262. </div>
  263. <div
  264. style="
  265. width: 47.7%;
  266. background-color: #fff;
  267. padding: 15px;
  268. border-radius: 8px;
  269. "
  270. ref="imageDom2"
  271. v-show="format == 2"
  272. >
  273. <el-table
  274. border
  275. :height="
  276. flag
  277. ? window.pageHeight < 600
  278. ? 415
  279. : window.pageHeight - 185 - 20
  280. : ''
  281. "
  282. :data="projectTableData"
  283. id="projectTableData"
  284. ref="projectTableData"
  285. style="width: 100%"
  286. :header-cell-class-name="headerStyle"
  287. show-summary
  288. :summary-method="reportasbitemNamesummarizeRegisterCount"
  289. >
  290. <el-table-column label="收费员组合项目统计报表">
  291. <el-table-column :label="'时间:' + startDate + '至' + endDate">
  292. <template slot-scope="scope">
  293. <el-table :data="scope.row.details" border show-summary
  294. :summary-method="asbitemNamesummarizeRegisterCounts">
  295. <el-table-column
  296. :label="scope.row.itemTypeName"
  297. >
  298. <el-table-column
  299. label="组合项目"
  300. prop="asbitemName"
  301. ></el-table-column>
  302. <el-table-column
  303. label="收款金额"
  304. prop="chargeMoney"
  305. ></el-table-column>
  306. </el-table-column>
  307. </el-table>
  308. </template>
  309. </el-table-column>
  310. </el-table-column>
  311. </el-table>
  312. </div>
  313. <div
  314. :style="
  315. 'width: 47.7%;overflow: hidden;height:' +
  316. (window.pageHeight < 600 ? 415 : window.pageHeight - 185 - 20) +
  317. 'px;background-color: #fff; padding: 15px; border-radius: 8px;'
  318. "
  319. >
  320. <div
  321. style="
  322. font-size: 20px;
  323. font-weight: 700;
  324. color: #232748;
  325. font-family: 'NotoSansSC-Bold';
  326. text-align: center;
  327. "
  328. >
  329. 收费员支付方式统计报表
  330. </div>
  331. <div
  332. :style="
  333. 'height:' +
  334. (window.pageHeight < 600 ? 387 : window.pageHeight - 185 - 48) +
  335. 'px;'
  336. "
  337. >
  338. <ChartBlock ref="chart2"></ChartBlock>
  339. </div>
  340. </div>
  341. </div>
  342. </div>
  343. </div>
  344. </div>
  345. </template>
  346. <script>
  347. import { mapState, mapActions } from "vuex";
  348. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  349. import ChartBlock from "../../components/workload/chartsBlock";
  350. import { exportToExcel } from "../../utlis/Export2Excel";
  351. import html2canvas from "html2canvas";
  352. import printJs from "print-js";
  353. import { projectlist } from "@/request/commonapi";
  354. export default {
  355. components: {
  356. ChartBlock,
  357. },
  358. data() {
  359. return {
  360. registrardata: [],
  361. username: [],
  362. startDate: "",
  363. endDate: "",
  364. tableData: [],
  365. standardTableData: [],
  366. projectTableData: [],
  367. seriesData: [],
  368. yAxisData: [],
  369. flag: true,
  370. arr1: [],
  371. pieData: [],
  372. spanMap: {},
  373. spanMaps: {},
  374. mergedColumns: ["itemTypeName", "doctorName"],
  375. mergedColumnes: ["itemTypeName"],
  376. oldTableData: [],
  377. format: "0",
  378. chargeCount: "",
  379. chargeBackCount: "",
  380. invoicechargeCount: "",
  381. invoicechargeBackCount: "",
  382. sumTotalMoney: "",
  383. };
  384. },
  385. created() {
  386. this.getList();
  387. },
  388. mounted() {
  389. this.getNowTime();
  390. },
  391. methods: {
  392. tableRowClassName({ row, column, rowIndex, columnIndex }) {
  393. if (row.payModeName == "合计") {
  394. return { backgroundColor: "#F5F7FA" };
  395. }
  396. },
  397. changeValue(value) {
  398. if (value == 0) {
  399. this.$nextTick(() => {
  400. this.$refs.standardTableData.doLayout();
  401. });
  402. } else if (value == 1) {
  403. this.$nextTick(() => {
  404. this.$refs.tableData.doLayout();
  405. });
  406. } else {
  407. this.$nextTick(() => {
  408. this.$refs.projectTableData.doLayout();
  409. });
  410. }
  411. },
  412. peiChart() {
  413. let option2 = {
  414. // title: {
  415. // text: "医生工作量统计",
  416. // left: "center",
  417. // },
  418. tooltip: {
  419. trigger: "item",
  420. confine: true,
  421. },
  422. legend: {
  423. data: this.yAxisData,
  424. orient: "horizontal",
  425. right: "3%",
  426. top: "0%",
  427. },
  428. grid: {
  429. show: false,
  430. left: "0%",
  431. right: "0%",
  432. top: "0%",
  433. bottom: "0%",
  434. containLabel: true,
  435. },
  436. series: [
  437. {
  438. type: "pie",
  439. label: {
  440. show: true,
  441. formatter: "{b} : {c} ({d}%)", // b代表名称,c代表对应值,d代表百分比
  442. },
  443. data: this.pieData,
  444. },
  445. ],
  446. };
  447. this.$refs.chart2.setOption(option2);
  448. },
  449. columnarChart() {
  450. let option2 = {
  451. // title: {
  452. // text: "医生工作量统计",
  453. // left: "center",
  454. // },
  455. tooltip: {
  456. trigger: "axis",
  457. confine: true,
  458. },
  459. legend: {
  460. type: "scroll",
  461. orient: "horizontal",
  462. right: "3%",
  463. top: "0%",
  464. },
  465. grid: {
  466. show: false,
  467. left: "0%",
  468. right: "0%",
  469. top: "0%",
  470. bottom: "0%",
  471. containLabel: true,
  472. },
  473. xAxis: {
  474. type: "value",
  475. axisLabel: {
  476. textStyle: {
  477. fontSize: "14",
  478. },
  479. },
  480. axisLine: {
  481. show: true,
  482. },
  483. },
  484. yAxis: {
  485. type: "category",
  486. data: this.yAxisData,
  487. axisLabel: {
  488. textStyle: {
  489. fontSize: "14",
  490. },
  491. },
  492. },
  493. series: [
  494. {
  495. name: "合计金额",
  496. type: "bar",
  497. data: this.seriesData,
  498. },
  499. ],
  500. };
  501. this.$refs.chart2.setOption(option2);
  502. },
  503. headerStyle({ row, column, rowIndex, columnIndex }) {
  504. if (rowIndex === 1) {
  505. return "left-align";
  506. }
  507. if (rowIndex === 2) {
  508. return "left-align";
  509. }
  510. },
  511. paymodesummarizeRegisterCount(param, sumTotalMoney) {
  512. let that = this;
  513. const { columns, data } = param;
  514. const sums = [];
  515. columns.forEach((column, index) => {
  516. if (index === 0) {
  517. sums[index] = "合计";
  518. return;
  519. }
  520. if (index === 4) {
  521. console.log(sumTotalMoney);
  522. sums[index] = sumTotalMoney;
  523. return;
  524. }
  525. });
  526. return sums;
  527. },
  528. invoicesummarizeRegisterCount(param) {
  529. const { columns, data } = param;
  530. const sums = [];
  531. if(data.length>0){
  532. columns.forEach((column, index) => {
  533. if (index === 0) {
  534. let sumPrice = 0;
  535. let chargeDetails = data[0].chargeDetails;
  536. let chargeBackDetails = data[0].chargeBackDetails;
  537. sumPrice = Number(
  538. chargeDetails.totalMoney - chargeBackDetails.totalMoney
  539. ).toFixed(2);
  540. sums[index] = "收费扣除退费余计:" + sumPrice;
  541. return;
  542. }
  543. });
  544. }
  545. return sums;
  546. },
  547. reportasbitemNamesummarizeRegisterCount(param) {
  548. const { columns, data } = param;
  549. const sums = [];
  550. columns.forEach((column, index) => {
  551. if (index === 0) {
  552. let sumPrice = 0;
  553. for(let i=0;i<this.projectTableData.length;i++){
  554. sumPrice =(Number(sumPrice)+Number(this.projectTableData[i].totalMoney)).toFixed(2);
  555. }
  556. sums[index] = "合计" + sumPrice;
  557. return;
  558. }
  559. });
  560. return sums;
  561. },
  562. summarizeRegisterCount(param) {
  563. const { columns, data } = param;
  564. const sums = [];
  565. columns.forEach((column, index) => {
  566. if (index === 0) {
  567. sums[index] = "合计";
  568. return;
  569. }
  570. const values = data.map((item) => Number(item[column.property]));
  571. if (index === 1) {
  572. sums[index] = values.reduce((prev, curr) => {
  573. const value = Number(curr);
  574. if (!isNaN(value)) {
  575. return prev + curr;
  576. } else {
  577. return prev;
  578. }
  579. }, 0);
  580. sums[index] = "共" + sums[index] + "人";
  581. } else {
  582. sums[index] = "";
  583. }
  584. });
  585. return sums;
  586. },
  587. onPrint() {
  588. this.flag = false;
  589. let index = "";
  590. if (this.format == 0) {
  591. index = "imageDom0";
  592. } else if (this.format == 1) {
  593. index = "imageDom1";
  594. } else {
  595. index = "imageDom2";
  596. }
  597. this.$nextTick(() => {
  598. let width = this.$refs[index].style.width;
  599. let cloneDom = this.$refs[index].cloneNode(true);
  600. let imageDom = this.$refs[index];
  601. cloneDom.style.position = "absolute";
  602. cloneDom.style.top = "0px";
  603. cloneDom.style.zIndex = "-1";
  604. cloneDom.style.width = width;
  605. console.log(cloneDom);
  606. imageDom.appendChild(cloneDom);
  607. html2canvas(cloneDom).then((canvas) => {
  608. // 转成图片,生成图片地址
  609. const url = canvas.toDataURL("image/png");
  610. printJs({
  611. printable: url,
  612. type: "image",
  613. documentTitle: "", // 标题
  614. style: `@media print { @page {size: auto; margin: 0 0 0 0; } body{margin:0 5px}canvas{page-break-after: always;page-break-inside: avoid;
  615. page-break-after: avoid;
  616. page-break-before: avoid;}}`, // 去除页眉页脚
  617. });
  618. });
  619. cloneDom.style.display = "none";
  620. this.flag = true;
  621. });
  622. },
  623. summarizeRegisterCounts(param) {
  624. const { columns, data } = param;
  625. const sums = [];
  626. columns.forEach((column, index) => {
  627. if (index === 0) {
  628. sums[index] = "合计";
  629. return;
  630. }
  631. if (index === 1) {
  632. let sum = 0;
  633. data.forEach((data, index) => {
  634. sum += Number(data.invoiceTypeMoney);
  635. });
  636. sums[index] = sum;
  637. return;
  638. }
  639. });
  640. return sums;
  641. },
  642. asbitemNamesummarizeRegisterCounts(param) {
  643. const { columns, data } = param;
  644. const sums = [];
  645. columns.forEach((column, index) => {
  646. if (index === 0) {
  647. sums[index] = "合计";
  648. return;
  649. }
  650. if (index === 1) {
  651. let sum = 0;
  652. data.forEach((data, index) => {
  653. sum =(Number(sum)+Number(data.chargeMoney)).toFixed(2);
  654. });
  655. sums[index] = sum;
  656. return;
  657. }
  658. });
  659. return sums;
  660. },
  661. onSubmit() {
  662. let that = this;
  663. if (this.startDate == "") {
  664. return this.$message({
  665. message: "请先选择开始日期",
  666. type: "error",
  667. });
  668. }
  669. if (this.endDate == "") {
  670. return this.$message({
  671. message: "请先选择结束日期",
  672. type: "error",
  673. });
  674. }
  675. if (this.format == 0) {
  676. postapi(
  677. "/api/app/charge-report/get-toll-collector-fee-report-in-pay-mode",
  678. {
  679. userIds: that.username,
  680. startDate: that.startDate,
  681. endDate: that.endDate,
  682. }
  683. ).then((res) => {
  684. if (res.code != -1) {
  685. this.pieData = [];
  686. this.yAxisData = [];
  687. this.seriesData = [];
  688. that.computedStandardTableData(res.data.chargeDetails);
  689. // that.standardTableData = [...res.data.chargeDetails];
  690. that.chargeCount = res.data.chargeCount;
  691. that.chargeBackCount = res.data.chargeBackCount;
  692. that.sumTotalMoney = res.data.sumTotalMoney;
  693. }
  694. });
  695. } else if (this.format == 1) {
  696. postapi(
  697. "/api/app/charge-report/get-toll-collector-fee-report-in-invoice-type",
  698. {
  699. userIds: that.username,
  700. startDate: that.startDate,
  701. endDate: that.endDate,
  702. }
  703. ).then((res) => {
  704. if (res.code != -1) {
  705. that.tableData = [];
  706. that.tableData.push(res.data);
  707. that.invoicechargeCount = res.data.chargeCount;
  708. that.invoicechargeBackCount = res.data.chargeBackCount;
  709. }
  710. });
  711. } else {
  712. postapi(
  713. "/api/app/charge-report/get-toll-collector-fee-report-in-asbitem",
  714. {
  715. userIds: that.username,
  716. startDate: that.startDate,
  717. endDate: that.endDate,
  718. }
  719. ).then((res) => {
  720. if (res.code != -1) {
  721. that.projectTableData=[...res.data]
  722. // let newTableData = [];
  723. // let objs = {
  724. // customerName: "",
  725. // children: [],
  726. // };
  727. // for (let i = 0; i < res.data.length; i++) {
  728. // let Index = newTableData.findIndex((item) => {
  729. // return item.customerName === res.data[i].customerName;
  730. // });
  731. // let obj = JSON.parse(JSON.stringify(objs));
  732. // if (Index == -1) {
  733. // obj.customerName = res.data[i].customerName;
  734. // newTableData.push(obj);
  735. // }
  736. // }
  737. // for (let i = 0; i < res.data.length; i++) {
  738. // for (let j = 0; j < newTableData.length; j++) {
  739. // if (res.data[i].customerName === newTableData[j].customerName) {
  740. // newTableData[j].children.push(res.data[i]);
  741. // }
  742. // }
  743. // }
  744. // that.computedProjectTableData(newTableData);
  745. }
  746. });
  747. }
  748. },
  749. setdates(data) {
  750. for (var i = 0; i < data.length; i++) {
  751. if (i === 0) {
  752. this.mergedColumns.forEach((column) => {
  753. this.spanMap[column] = {
  754. spanArr: [1],
  755. pos: 0,
  756. // index:i
  757. };
  758. });
  759. } else {
  760. this.mergedColumns.forEach((column) => {
  761. if (data[i][column] === data[i - 1][column]) {
  762. this.spanMap[column].spanArr[this.spanMap[column].pos] += 1;
  763. this.spanMap[column].spanArr.push(0);
  764. } else {
  765. this.spanMap[column].spanArr.push(1);
  766. this.spanMap[column].pos = i;
  767. }
  768. // this.spanMap[column].index=i
  769. });
  770. }
  771. }
  772. },
  773. setProjectdates(data) {
  774. for (var i = 0; i < data.length; i++) {
  775. if (i === 0) {
  776. this.mergedColumnes.forEach((column) => {
  777. this.spanMaps[column] = {
  778. spanArr: [1],
  779. pos: 0,
  780. // index:i
  781. };
  782. });
  783. } else {
  784. this.mergedColumnes.forEach((column) => {
  785. if (data[i][column] === data[i - 1][column]) {
  786. this.spanMaps[column].spanArr[this.spanMaps[column].pos] += 1;
  787. this.spanMaps[column].spanArr.push(0);
  788. } else {
  789. this.spanMaps[column].spanArr.push(1);
  790. this.spanMaps[column].pos = i;
  791. }
  792. // this.spanMap[column].index=i
  793. });
  794. }
  795. }
  796. },
  797. setStandardDates(arr) {
  798. var obj = {},
  799. k,
  800. arr1 = [];
  801. this.arr1 = [];
  802. for (var i = 0, len = arr.length; i < len; i++) {
  803. k = arr[i].chargeName; //需要合并的字段
  804. if (obj[k]) obj[k]++;
  805. else obj[k] = 1;
  806. }
  807. //保存结果{el-'元素',count-出现次数}
  808. for (var o in obj) {
  809. for (let i = 0; i < obj[o]; i++) {
  810. if (i === 0) {
  811. this.arr1.push(obj[o]);
  812. } else {
  813. this.arr1.push(0);
  814. }
  815. }
  816. }
  817. },
  818. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  819. let index = rowIndex;
  820. if (index === 0 && columnIndex === 0) {
  821. for (let i = 0; i < this.tableData.length; i++) {
  822. if (row.customerName === this.tableData[i].customerName) {
  823. this.setdates(this.tableData[i].children);
  824. }
  825. }
  826. }
  827. if (this.spanMap[column.property]) {
  828. const _row = this.spanMap[column.property].spanArr[rowIndex];
  829. const _col = _row > 0 ? 1 : 0;
  830. return {
  831. rowspan: _row,
  832. colspan: _col,
  833. };
  834. }
  835. },
  836. objectStandardSpanMethod({ row, column, rowIndex, columnIndex }) {
  837. if (columnIndex === 0) {
  838. let _row = this.arr1[rowIndex];
  839. let _col = this.arr1[rowIndex] > 0 ? 1 : 0;
  840. return [_row, _col];
  841. }
  842. },
  843. objectProjectSpanMethod({ row, column, rowIndex, columnIndex }) {
  844. let index = rowIndex;
  845. if (index === 0 && columnIndex === 0) {
  846. for (let i = 0; i < this.projectTableData.length; i++) {
  847. if (row.customerName === this.projectTableData[i].customerName) {
  848. this.setProjectdates(this.projectTableData[i].children);
  849. }
  850. }
  851. }
  852. if (this.spanMaps[column.property]) {
  853. const _row = this.spanMaps[column.property].spanArr[rowIndex];
  854. const _col = _row > 0 ? 1 : 0;
  855. return {
  856. rowspan: _row,
  857. colspan: _col,
  858. };
  859. }
  860. },
  861. getList() {
  862. getapi("/api/identity/users/getlist").then((res) => {
  863. if (res.code != -1) {
  864. this.registrardata = [...res.data.items];
  865. }
  866. });
  867. },
  868. getNowTime() {
  869. var now = new Date();
  870. var year = now.getFullYear(); // 得到年份
  871. var month = now.getMonth(); // 得到月份
  872. var date = now.getDate(); // 得到日期
  873. month = month + 1;
  874. month = month.toString().padStart(2, "0");
  875. date = date.toString().padStart(2, "0");
  876. var defaultDate = `${year}-${month}-${date}`;
  877. this.startDate = defaultDate;
  878. this.endDate = defaultDate;
  879. },
  880. ForwardRanking(data) {
  881. for (let i = 0; i < data.length; i++) {
  882. data[i].children.sort(function (a, b) {
  883. return a.itemTypeName > b.itemTypeName ? -1 : 1; //根据名称属性进行排序
  884. });
  885. data[i].children.sort(function (a, b) {
  886. if (a.itemTypeName === b.itemTypeName)
  887. return a.doctorName > b.doctorName ? -1 : 1; //根据名称属性进行排序
  888. });
  889. }
  890. this.tableData = data;
  891. console.log(this.tableData);
  892. // this.setdates(this.tableData[0].children);
  893. },
  894. ForwardStandardRanking(data, p) {
  895. for (var i = 0; i < data.length - 1; i++) {
  896. for (var j = 0; j < data.length - 1 - i; j++) {
  897. var dd = data[j][p].localeCompare(data[j + 1][p], "zh"); //1---前者往后移,-1===位置不变
  898. if (dd > 0) {
  899. var temp = data[j];
  900. data[j] = data[j + 1];
  901. data[j + 1] = temp;
  902. }
  903. }
  904. }
  905. this.standardTableData = data;
  906. this.setStandardDates(this.standardTableData);
  907. },
  908. ForwardProjectRanking(data) {
  909. for (let i = 0; i < data.length; i++) {
  910. data[i].children.sort(function (a, b) {
  911. return a.itemTypeName > b.itemTypeName ? -1 : 1; //根据名称属性进行排序
  912. });
  913. // data[i].children.sort(function (a, b) {
  914. // if (a.itemTypeName === b.itemTypeName)
  915. // return a.asbitemName > b.asbitemName ? -1 : 1; //根据名称属性进行排序
  916. // });
  917. }
  918. this.projectTableData = data;
  919. },
  920. computedTableData(tableData) {
  921. const newData = [...tableData]; // 创建一个新的数组,避免修改原始数据
  922. const totalRows = {
  923. customerName: "",
  924. itemTypeName: "",
  925. asbitemName: "合计",
  926. doctorName: "",
  927. doctorCheckCount: 0,
  928. avgStandardPrice: 0,
  929. avgChargePrice: 0,
  930. sumStandardPrice: 0,
  931. sumChargePrice: 0,
  932. }; // 合计行的数据
  933. let newTableData = [];
  934. let obj = {
  935. customerName: "",
  936. children: [],
  937. };
  938. let ojk = {
  939. itemTypeName: "",
  940. children: {},
  941. };
  942. for (let i = 0; i < tableData.length; i++) {
  943. let objs = JSON.parse(JSON.stringify(obj));
  944. objs.customerName = tableData[i].customerName;
  945. for (let j = 0; j < tableData[i].children.length; j++) {
  946. let ojks = JSON.parse(JSON.stringify(ojk));
  947. let Index = objs.children.findIndex((item) => {
  948. return item.itemTypeName === tableData[i].children[j].itemTypeName;
  949. });
  950. if (Index == -1) {
  951. ojks.itemTypeName = tableData[i].children[j].itemTypeName;
  952. objs.children.push(ojks);
  953. }
  954. }
  955. for (let j = 0; j < tableData[i].children.length; j++) {
  956. for (let k = 0; k < objs.children.length; k++) {
  957. let item = tableData[i].children[j].doctorName;
  958. if (
  959. objs.children[k].itemTypeName ===
  960. tableData[i].children[j].itemTypeName
  961. ) {
  962. objs.children[k].children[item] =
  963. objs.children[k].children[item] + 1 || 1;
  964. }
  965. }
  966. }
  967. newTableData.push(objs);
  968. }
  969. for (let i = 0; i < newTableData.length; i++) {
  970. for (let j = 0; j < tableData.length; j++) {
  971. if (tableData[j].customerName === newTableData[i].customerName) {
  972. for (let k = 0; k < newTableData[i].children.length; k++) {
  973. Object.keys(newTableData[i].children[k].children).forEach(
  974. (key) => {
  975. let totalRow = JSON.parse(JSON.stringify(totalRows));
  976. tableData[j].children.forEach((item) => {
  977. if (
  978. item.itemTypeName ===
  979. newTableData[i].children[k].itemTypeName &&
  980. item.doctorName == key
  981. ) {
  982. totalRow.customerName = item.customerName;
  983. totalRow.itemTypeName = item.itemTypeName;
  984. totalRow.doctorName = item.doctorName;
  985. totalRow.doctorCheckCount += item.doctorCheckCount;
  986. totalRow.avgStandardPrice =
  987. (totalRow.avgStandardPrice * 100000 +
  988. item.avgStandardPrice * 100000) /
  989. 100000;
  990. totalRow.avgChargePrice =
  991. (totalRow.avgChargePrice * 100000 +
  992. item.avgChargePrice * 100000) /
  993. 100000;
  994. totalRow.sumStandardPrice =
  995. (totalRow.sumStandardPrice * 100000 +
  996. item.sumStandardPrice * 100000) /
  997. 100000;
  998. totalRow.sumChargePrice =
  999. (totalRow.sumChargePrice * 100000 +
  1000. item.sumChargePrice * 100000) /
  1001. 100000;
  1002. }
  1003. });
  1004. tableData[j].children.push(totalRow);
  1005. }
  1006. );
  1007. }
  1008. }
  1009. }
  1010. }
  1011. this.ForwardRanking(tableData);
  1012. },
  1013. computedProjectTableData(tableData) {
  1014. const newData = [...tableData]; // 创建一个新的数组,避免修改原始数据
  1015. const totalRows = {
  1016. customerName: "",
  1017. itemTypeName: "",
  1018. asbitemName: "合计",
  1019. doctorCheckCount: 0,
  1020. avgStandardPrice: 0,
  1021. avgChargePrice: 0,
  1022. sumStandardPrice: 0,
  1023. sumChargePrice: 0,
  1024. }; // 合计行的数据
  1025. let newTableData = [];
  1026. let obj = {
  1027. customerName: "",
  1028. children: {},
  1029. };
  1030. // let ojk = {
  1031. // itemTypeName: "",
  1032. // children: {},
  1033. // };
  1034. for (let i = 0; i < tableData.length; i++) {
  1035. let objs = JSON.parse(JSON.stringify(obj));
  1036. objs.customerName = tableData[i].customerName;
  1037. for (let j = 0; j < tableData[i].children.length; j++) {
  1038. var item = tableData[i].children[j].itemTypeName;
  1039. objs.children[item] = objs.children[item] + 1 || 1;
  1040. // let ojks = JSON.parse(JSON.stringify(ojk));
  1041. // let Index = objs.children.findIndex((item) => {
  1042. // return item.itemTypeName === tableData[i].children[j].itemTypeName;
  1043. // });
  1044. // if (Index == -1) {
  1045. // ojks.itemTypeName = tableData[i].children[j].itemTypeName;
  1046. // objs.children.push(ojks);
  1047. // }
  1048. }
  1049. // for (let j = 0; j < tableData[i].children.length; j++) {
  1050. // for (let k = 0; k < objs.children.length; k++) {
  1051. // let item = tableData[i].children[j].asbitemName;
  1052. // if (
  1053. // objs.children[k].itemTypeName ===
  1054. // tableData[i].children[j].itemTypeName
  1055. // ) {
  1056. // objs.children[k].children[item] =
  1057. // objs.children[k].children[item] + 1 || 1;
  1058. // }
  1059. // }
  1060. // }
  1061. newTableData.push(objs);
  1062. }
  1063. for (let i = 0; i < newTableData.length; i++) {
  1064. for (let j = 0; j < tableData.length; j++) {
  1065. if (tableData[j].customerName === newTableData[i].customerName) {
  1066. Object.keys(newTableData[i].children).forEach((key) => {
  1067. let totalRow = JSON.parse(JSON.stringify(totalRows));
  1068. tableData[j].children.forEach((item) => {
  1069. if (item.itemTypeName === key) {
  1070. totalRow.customerName = item.customerName;
  1071. totalRow.itemTypeName = item.itemTypeName;
  1072. // totalRow.asbitemName = item.asbitemName;
  1073. totalRow.doctorCheckCount += item.doctorCheckCount;
  1074. totalRow.avgStandardPrice =
  1075. (totalRow.avgStandardPrice * 100000 +
  1076. item.avgStandardPrice * 100000) /
  1077. 100000;
  1078. totalRow.avgChargePrice =
  1079. (totalRow.avgChargePrice * 100000 +
  1080. item.avgChargePrice * 100000) /
  1081. 100000;
  1082. totalRow.sumStandardPrice =
  1083. (totalRow.sumStandardPrice * 100000 +
  1084. item.sumStandardPrice * 100000) /
  1085. 100000;
  1086. totalRow.sumChargePrice =
  1087. (totalRow.sumChargePrice * 100000 +
  1088. item.sumChargePrice * 100000) /
  1089. 100000;
  1090. }
  1091. });
  1092. tableData[j].children.push(totalRow);
  1093. });
  1094. }
  1095. }
  1096. }
  1097. console.log(tableData);
  1098. this.ForwardProjectRanking(tableData);
  1099. },
  1100. computedStandardTableData(tableData) {
  1101. const newData = [...tableData]; // 创建一个新的数组,避免修改原始数据
  1102. const totalRows = {
  1103. chargeName: "",
  1104. payModeName: "合计",
  1105. chargeMoney: 0,
  1106. chargeBackMoney: 0,
  1107. totalMoney: 0,
  1108. }; // 合计行的数据
  1109. let pies = {
  1110. name: "",
  1111. value: 0,
  1112. };
  1113. let obj = {};
  1114. for (let i = 0; i < tableData.length; i++) {
  1115. var item = tableData[i].chargeName;
  1116. obj[item] = obj[item] + 1 || 1;
  1117. }
  1118. Object.keys(obj).forEach((key) => {
  1119. let totalRow = JSON.parse(JSON.stringify(totalRows));
  1120. let pie = JSON.parse(JSON.stringify(pies));
  1121. tableData.forEach((item) => {
  1122. if (item.chargeName == key) {
  1123. totalRow.chargeName = item.chargeName;
  1124. pie.name = item.chargeName;
  1125. totalRow.chargeMoney =
  1126. (totalRow.chargeMoney * 100000 + item.chargeMoney * 100000) /
  1127. 100000;
  1128. totalRow.chargeBackMoney =
  1129. (totalRow.chargeBackMoney * 100000 +
  1130. item.chargeBackMoney * 100000) /
  1131. 100000;
  1132. totalRow.totalMoney =
  1133. (totalRow.totalMoney * 100000 + item.totalMoney * 100000) /
  1134. 100000;
  1135. pie.value = totalRow.totalMoney;
  1136. }
  1137. });
  1138. newData.push(totalRow);
  1139. this.pieData.push(pie);
  1140. this.yAxisData.push(totalRow.chargeName);
  1141. this.seriesData.push(totalRow.totalMoney);
  1142. });
  1143. this.ForwardStandardRanking(newData, "chargeName");
  1144. this.columnarChart();
  1145. },
  1146. handleExport() {
  1147. if (this.format == 0) {
  1148. exportToExcel("#standardTableData", "收费员支付方式统计报表", false);
  1149. } else if (this.format == 1) {
  1150. let index = 4;
  1151. let list = [];
  1152. list.push(index);
  1153. // for (let i = 0; i < this.tableData.length - 1; i++) {
  1154. // index += this.tableData[i].children.length + 3;
  1155. // list.push(index);
  1156. // }
  1157. exportToExcel("#tableData", "收费员发票类型统计报表", true, list);
  1158. } else {
  1159. let index = 3;
  1160. let list = [];
  1161. list.push(index);
  1162. for (let i = 0; i < this.projectTableData.length - 1; i++) {
  1163. index += this.projectTableData[i].details.length + 4;
  1164. list.push(index);
  1165. }
  1166. exportToExcel("#projectTableData", "收费员组合项目统计报表", true, list);
  1167. }
  1168. },
  1169. },
  1170. computed: {
  1171. ...mapState(["window", "dict", "patientRegister", "report"]),
  1172. },
  1173. updated() {
  1174. this.$nextTick(() => {
  1175. this.$refs.tableData.doLayout();
  1176. });
  1177. this.$nextTick(() => {
  1178. this.$refs.standardTableData.doLayout();
  1179. });
  1180. this.$nextTick(() => {
  1181. this.$refs.projectTableData.doLayout();
  1182. });
  1183. },
  1184. };
  1185. </script>
  1186. <style scoped>
  1187. @import "../../assets/css/global_button.css";
  1188. @import "../../assets/css/global_dialog.css";
  1189. @import "../../assets/css/global_table.css";
  1190. @import "../../assets/css/global_form.css";
  1191. @import "../../assets/css/global_input.css";
  1192. @import "../../assets/css/global.css";
  1193. .query {
  1194. margin-right: 15px;
  1195. display: flex;
  1196. justify-content: center;
  1197. align-items: center;
  1198. font-size: 14px;
  1199. color: #232748;
  1200. font-size: 400;
  1201. font-family: "NotoSansSC-Regular";
  1202. }
  1203. .box {
  1204. display: flex;
  1205. flex-direction: column;
  1206. }
  1207. :deep .left-align .cell {
  1208. text-align: left !important;
  1209. }
  1210. /* ::v-deep .el-table__body-wrapper::-webkit-scrollbar {
  1211. width: 0px;
  1212. background: rgba(213, 215, 220, 0.3);
  1213. border: none;
  1214. }
  1215. ::v-deep .el-table__body-wrapper::-webkit-scrollbar-track {
  1216. border: none;
  1217. } */
  1218. ::v-deep .el-table th.gutter {
  1219. display: none;
  1220. width: 0;
  1221. }
  1222. ::v-deep .el-table colgroup col[name="gutter"] {
  1223. display: none;
  1224. width: 0;
  1225. }
  1226. ::v-deep .el-table__body {
  1227. width: 100% !important;
  1228. }
  1229. </style>