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.

315 lines
9.1 KiB

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