ReportFirstPage.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <page-layer>
  3. <template #header>
  4. <div style="text-align: center">
  5. 统计日期:
  6. <span v-if="kssj1" style="color: #fc6c34;">
  7. {{ kssj1 }} 至 {{ jssj1 }}
  8. </span>
  9. <span v-else style="color: #fc6c34;">当前</span>
  10. 统计机构名称:<span style="color: #fc6c34;">长沙泰和医院</span>
  11. 指标名称: <span style="color: #fc6c34;">{{ reportInfo1.reportName }}</span>
  12. 统计结果描述: <span style="color: #fc6c34;">{{ reportInfo1.overview }}{{ reportInfo1.unit }}</span>
  13. <el-button type="primary" icon="Search" style="margin-left: 10px;" @click="selectReportMx">明细数据
  14. </el-button>
  15. <el-button type="primary" icon="Download" style="margin-left: 10px;" @click="exportReportFirst">导出数据
  16. </el-button>
  17. </div>
  18. </template>
  19. <template #aside>
  20. <el-table :data="reportData" :height="tableHeight" highlight-current-row row-key="childKey" stripe border
  21. @row-dblclick="reportSecondInfo">
  22. <el-table-column prop="x" :label="x1Name" width="120"></el-table-column>
  23. <el-table-column prop="y" :label="y1Name"></el-table-column>
  24. </el-table>
  25. </template>
  26. <template #main>
  27. <div style="width: 80%; height: 400px; margin-bottom: 5px;" id="firstPie"></div>
  28. <div style="width: 80%; height: 400px" id="firstDst"></div>
  29. </template>
  30. </page-layer>
  31. <el-dialog v-if="props.reportFirst.tableInfo.sndGroup !== 'patient'" :title="titleChart" v-model="sndDrawer" fullscreen
  32. destroy-on-close>
  33. <ReportSecondPage :reportSecond="reportSecond" />
  34. </el-dialog>
  35. <el-dialog v-else :title="titleChart" v-model="patientDrawer" width="80%" style="height: 800px" top="40px" destroy-on-close>
  36. <ReportPatientPage :reportPatient="reportPatient" />
  37. </el-dialog>
  38. <el-dialog :title="titleChart" v-model="patientMxDrawer" style="height: 800px" width="80%" top="40px" destroy-on-close>
  39. <ReportPatientPage :reportPatient="reportPatient" />
  40. </el-dialog>
  41. </template>
  42. <script setup name="ReportFirst">
  43. import { ref, nextTick } from "vue"
  44. import { clone } from '@/utils/clone'
  45. import PageLayer from '@/layout/PageLayer.vue'
  46. import { highBarUtils, highPieUtils } from '@/utils/high-charts'
  47. import { selectReportGroup } from '@/api/reports/high-report'
  48. import { Export } from '@/utils/ExportExcel'
  49. import ReportSecondPage from '@/components/operate-monitoring/ReportSecondPage.vue'
  50. import ReportPatientPage from '@/components/operate-monitoring/ReportPatientPage.vue'
  51. const tableHeight = window.innerHeight - 105
  52. const props = defineProps({
  53. reportFirst: {
  54. type: Object,
  55. default: {}
  56. }
  57. })
  58. nextTick(() => {
  59. showFirstPst()
  60. })
  61. // 报表基本信息
  62. const reportInfo1 = ref({})
  63. // 报表展示值
  64. const reportData = ref({})
  65. // 表格展示信息
  66. const tableData = ref({})
  67. // 查询信息
  68. const param1 = ref({})
  69. const x1Name = ref('')
  70. const y1Name = ref('')
  71. const kssj1 = ref('')
  72. const jssj1 = ref('')
  73. reportData.value = props.reportFirst.data
  74. reportInfo1.value = props.reportFirst.row
  75. tableData.value = props.reportFirst.tableInfo
  76. param1.value = props.reportFirst.params
  77. kssj1.value = props.reportFirst.kssj
  78. jssj1.value = props.reportFirst.jssj
  79. const showFirstPst = () => {
  80. let barTitle = reportInfo1.value.reportName
  81. let yAxisName = '单位:' + reportInfo1.value.unit
  82. let tipUnit = reportInfo1.value.unit
  83. let xdata = []
  84. let ydata = []
  85. let pieData = []
  86. x1Name.value = tableData.value.fstName
  87. y1Name.value = reportInfo1.value.unit
  88. reportData.value.forEach((item) => {
  89. let pieInfo = {}
  90. pieInfo.value = item.y
  91. pieInfo.name = item.x
  92. pieInfo.unit = reportInfo1.value.unit
  93. xdata.push(item.x)
  94. ydata.push(item.y)
  95. pieData.push(pieInfo)
  96. })
  97. highBarUtils(firstDst, barTitle, xdata, ydata, barTitle, yAxisName, tipUnit, 1)
  98. highPieUtils(firstPie, barTitle, pieData)
  99. }
  100. // 钻取的查询结果
  101. const sndDrawer = ref(false)
  102. const reportSecond = ref({})
  103. const patientDrawer = ref(false)
  104. const reportPatient = ref({})
  105. const titleChart = ref('')
  106. const reportSecondInfo = (row) => {
  107. reportInfo1.value.fstName = row.x
  108. reportInfo1.value.fstValue = row.y
  109. let params = clone(param1.value)
  110. params.fstName = row.x
  111. // 下一级是病人,则走最后固定的病人明细展示页面
  112. let sndGroup = tableData.value.sndGroup
  113. if (sndGroup === 'patient') {
  114. titleChart.value = reportInfo1.value.reportName
  115. patientDrawer.value = true
  116. reportPatient.value.row = reportInfo1.value
  117. reportPatient.value.params = clone(params)
  118. } else {
  119. selectReportGroup(params).then((res) => {
  120. reportSecond.value = res
  121. titleChart.value = res.title
  122. sndDrawer.value = true
  123. reportSecond.value.row = reportInfo1.value
  124. reportSecond.value.kssj = kssj1.value
  125. reportSecond.value.jssj = jssj1.value
  126. reportSecond.value.params = clone(params)
  127. })
  128. }
  129. }
  130. // 直接查询病人明细结果
  131. const patientMxDrawer = ref(false)
  132. const selectReportMx = () => {
  133. let params = clone(param1.value)
  134. titleChart.value = reportInfo1.value.reportName
  135. patientMxDrawer.value = true
  136. reportPatient.value.row = reportInfo1.value
  137. reportPatient.value.params = clone(params)
  138. }
  139. const exportReportFirst = () => {
  140. if (reportData.value.length <= 0) {
  141. ElMessage({
  142. message: '没有可以导出的数据!',
  143. type: 'warning',
  144. duration: 2500,
  145. showClose: true,
  146. })
  147. }
  148. let title = {
  149. x: x1Name.value,
  150. y: y1Name.value
  151. }
  152. Export(reportData.value, title, reportInfo1.value.reportName);
  153. }
  154. </script>