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.

337 lines
9.1 KiB

1 year 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-cascader
  26. v-model="customerOrgIds"
  27. @change="onchange"
  28. placeholder="请选择单位"
  29. :options="patientRegister.customerOrgTreeAll"
  30. :props="{
  31. value: 'id',
  32. label: 'displayName',
  33. children: 'treeChildren',
  34. expandTrigger: 'hover',
  35. multiple: true,
  36. emitPath:false,
  37. checkStrictly:true
  38. }"
  39. filterable
  40. size="small"
  41. collapse-tags
  42. ></el-cascader>
  43. </div>
  44. <div class="query">
  45. <span>开始日期</span>
  46. <el-date-picker
  47. type="date"
  48. placeholder="选择开始日期"
  49. size="small"
  50. v-model="startDate"
  51. value-format="yyyy-MM-dd"
  52. editable
  53. style="width: 177px;"
  54. >
  55. </el-date-picker>
  56. </div>
  57. <div class="query">
  58. <span>结束日期</span>
  59. <el-date-picker
  60. type="date"
  61. placeholder="选择结束日期"
  62. size="small"
  63. v-model="endDate"
  64. value-format="yyyy-MM-dd"
  65. editable
  66. style="width: 177px;"
  67. >
  68. </el-date-picker>
  69. </div>
  70. <div class="query">
  71. <el-button @click="btnQuery" size="small" class="commonbutton"
  72. >查询</el-button
  73. >
  74. </div>
  75. <div class="query">
  76. <el-button @click="handleExport" size="small" class="commonbutton"
  77. >导出excel</el-button
  78. >
  79. </div>
  80. <div class="query">
  81. <el-button @click="onPrint" size="small" class="commonbutton"
  82. >打印</el-button
  83. >
  84. </div>
  85. </div>
  86. <div
  87. ref="imageDom"
  88. style="background-color: #fff; padding: 15px; border-radius: 8px"
  89. >
  90. <el-table
  91. :data="dataList"
  92. border
  93. width="45%"
  94. :height="
  95. flag
  96. ? window.pageHeight < 600
  97. ? 415
  98. : window.pageHeight - 185 - 20
  99. : ''
  100. "
  101. row-key="id"
  102. highlight-current-row
  103. ref="dataList"
  104. :row-class-name="tableRowClassName"
  105. id="table"
  106. show-summary
  107. :summary-method="getSummaries"
  108. >
  109. <el-table-column prop="customerOrgName" label="单位" />
  110. <el-table-column prop="medicalStartDate" label="体检开始日期" />
  111. <el-table-column prop="registerCount" label="登记人数" />
  112. <el-table-column prop="checkCount" label="实检人数" />
  113. <el-table-column prop="registerStandardAmount" label="登记总金额" />
  114. <el-table-column
  115. prop="registerChargeAmount"
  116. label="登记折后总金额"
  117. />
  118. <el-table-column prop="checkStandardAmount" label="实检总金额" />
  119. <el-table-column prop="checkChargeAmount" label="实检折后总金额" />
  120. <el-table-column prop="checkItemStandardAmount" label="实检项目金额" />
  121. <el-table-column prop="checkItemChargeAmount" label="实检项目折后总金额" />
  122. </el-table>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </template>
  128. <script>
  129. import moment from "moment";
  130. import { mapState, mapActions } from "vuex";
  131. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  132. import {
  133. dddw,
  134. objCopy,
  135. arrayReduce,
  136. arrayExistObj,
  137. tcdate,
  138. } from "@/utlis/proFunc";
  139. import { exportToExcel } from "../../utlis/Export2Excel";
  140. import html2canvas from "html2canvas";
  141. import printJs from "print-js";
  142. export default {
  143. data() {
  144. return {
  145. dataList: [], //列表数据
  146. startDate: "",
  147. endDate: "",
  148. customerOrgIds: [],
  149. flag: true
  150. };
  151. },
  152. created() {
  153. this.dictInit();
  154. },
  155. //挂载完成
  156. mounted() {
  157. this.getNowTime();
  158. },
  159. computed: {
  160. ...mapState(["window", "dict", "patientRegister", "report"]),
  161. },
  162. methods: {
  163. moment,
  164. dddw,
  165. //数据初始化
  166. dictInit() {
  167. //体检单位树
  168. getapi("/api/app/customerorg/getbycodeall").then((res) => {
  169. if (res.code == 1) {
  170. this.patientRegister.customerOrgTreeAll = res.data;
  171. tcdate(this.patientRegister.customerOrgTreeAll);
  172. }
  173. });
  174. console.log("patientRegister", this.patientRegister);
  175. },
  176. onchange(v) {
  177. console.log(v)
  178. },
  179. tableRowClassName({ row, rowIndex }) {
  180. switch (row.isCharge) {
  181. case "N":
  182. return "danger";
  183. default:
  184. return "";
  185. }
  186. },
  187. getSummaries(param) {
  188. const { columns, data } = param;
  189. const sums = [];
  190. columns.forEach((column, index) => {
  191. if (index === 0) {
  192. sums[index] = "合计";
  193. return;
  194. }
  195. if (index === 1) {
  196. sums[index] = data.length + " 人";
  197. }
  198. });
  199. return sums;
  200. },
  201. getNowTime() {
  202. var now = new Date();
  203. var year = now.getFullYear(); // 得到年份
  204. var month = now.getMonth(); // 得到月份
  205. var date = now.getDate(); // 得到日期
  206. month = month + 1;
  207. month = month.toString().padStart(2, "0");
  208. date = date.toString().padStart(2, "0");
  209. var defaultDate = `${year}-${month}-${date}`;
  210. this.startDate = defaultDate;
  211. this.endDate = defaultDate;
  212. },
  213. //查询
  214. btnQuery() {
  215. let that = this;
  216. if (this.startDate == "") {
  217. return this.$message({
  218. message: "请先选择开始日期",
  219. type: "error",
  220. });
  221. }
  222. if (this.endDate == "") {
  223. return this.$message({
  224. message: "请先选择结束日期",
  225. type: "error",
  226. });
  227. }
  228. postapi(
  229. "/api/app/CustomerReport/GetSummaryOfUnitCostsReport",{
  230. customerOrgIds:that.customerOrgIds,
  231. startDate:that.startDate,
  232. endDate:that.endDate
  233. }).then((res) => {
  234. if (res.code != -1) {
  235. that.dataList = res.data;
  236. that.$nextTick(() => {
  237. that.$refs.dataList.doLayout();
  238. });
  239. }
  240. });
  241. },
  242. onPrint() {
  243. this.flag = false;
  244. this.$nextTick(() => {
  245. let width = this.$refs.imageDom.style.width;
  246. let cloneDom = this.$refs.imageDom.cloneNode(true);
  247. let imageDom = this.$refs.imageDom;
  248. cloneDom.style.position = "absolute";
  249. cloneDom.style.top = "0px";
  250. cloneDom.style.zIndex = "-1";
  251. cloneDom.style.width = width;
  252. console.log(cloneDom);
  253. imageDom.appendChild(cloneDom);
  254. html2canvas(cloneDom).then((canvas) => {
  255. // 转成图片,生成图片地址
  256. const url = canvas.toDataURL("image/png");
  257. printJs({
  258. printable: url,
  259. type: "image",
  260. documentTitle: "", // 标题
  261. style: "@page{size:auto;margin: 0cm 1cm 0cm 1cm;}", // 去除页眉页脚
  262. });
  263. });
  264. cloneDom.style.display = "none";
  265. this.flag = true;
  266. });
  267. },
  268. handleExport() {
  269. exportToExcel("#table", "单位体检统计", false);
  270. },
  271. },
  272. //监听事件
  273. watch: {
  274. //触发查询事件
  275. // "patientRegister.query.times"(newVal, oldVal) {
  276. // if (newVal != oldVal) {
  277. // //alert('触发查询事件')
  278. // this.query();
  279. // }
  280. // },
  281. },
  282. };
  283. </script>
  284. <style scoped>
  285. @import "../../assets/css/global_button.css";
  286. @import "../../assets/css/global_dialog.css";
  287. @import "../../assets/css/global_table.css";
  288. @import "../../assets/css/global_form.css";
  289. @import "../../assets/css/global_input.css";
  290. @import "../../assets/css/global.css";
  291. .query {
  292. margin-right: 10px;
  293. display: flex;
  294. justify-content: center;
  295. align-items: center;
  296. font-size: 14px;
  297. color: #232748;
  298. font-size: 400;
  299. font-family: "NotoSansSC-Regular";
  300. }
  301. .box {
  302. display: flex;
  303. flex-direction: column;
  304. }
  305. ::v-deep .el-input__inner {
  306. /*text-align: center;*/
  307. padding-left: 5px;
  308. padding-right: 15px;
  309. }
  310. ::v-deep .el-input__icon {
  311. width: 15px;
  312. /* 输入框下拉箭头或清除图标 默认 25 */
  313. }
  314. ::v-deep .el-input-group__append {
  315. padding: 0 5px;
  316. /* 控件默认 0 20px;*/
  317. }
  318. ::v-deep .el-icon-search:before {
  319. color: #00f;
  320. }
  321. .query:last-child {
  322. margin-right: 0;
  323. }
  324. ::v-deep .el-cascader__search-input{
  325. margin: 0 0 0 5px;
  326. }
  327. </style>