index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="content-container">
  3. <el-row class="tool-bar">
  4. <div class="content-title">
  5. <span> {{ title }} </span>
  6. </div>
  7. <div class="select-search">
  8. <span class="search-label">年度:</span>
  9. <el-select v-model="conditions.year" filterable placeholder="年份" style="width:120px">
  10. <el-option label="2022年" :value="2022" />
  11. <el-option label="2023年" :value="2023" />
  12. <el-option label="2024年" :value="2024" />
  13. <el-option label="2025年" :value="2025" />
  14. <el-option label="2026年" :value="2026" />
  15. <el-option label="2027年" :value="2027" />
  16. </el-select>
  17. </div>
  18. <div class="select-search">
  19. <span class="search-label">月份:</span>
  20. <el-select v-model="conditions.month" filterable placeholder="月份" style="width:120px" clearable>
  21. <el-option label="1月" :value="1" />
  22. <el-option label="2月" :value="2" />
  23. <el-option label="3月" :value="3" />
  24. <el-option label="4月" :value="4" />
  25. <el-option label="5月" :value="5" />
  26. <el-option label="6月" :value="6" />
  27. <el-option label="7月" :value="7" />
  28. <el-option label="8月" :value="8" />
  29. <el-option label="9月" :value="9" />
  30. <el-option label="10月" :value="10" />
  31. <el-option label="11月" :value="11" />
  32. <el-option label="12月" :value="12" />
  33. </el-select>
  34. </div>
  35. <div class="right" style="min-width:400px;flex: 1;">
  36. <el-input v-model="conditions.keywords" class="search-input m-right-15" placeholder="请输入内容">
  37. <el-button slot="append" icon="el-icon-search" @click="getData()" />
  38. </el-input>
  39. <el-button class="filter-item" type="primary" icon="el-icon-document" size="mini" @click="handleExport">导出</el-button>
  40. <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-printer" size="mini" @click="handlePrint">打印</el-button>
  41. </div>
  42. </el-row>
  43. <el-row class="content-body">
  44. <vuescroll :ops="ops" style="height: calc(100vh - 250px)">
  45. <!--年度-->
  46. <el-table id="print_view" v-loading="listLoading" border :data="dataList">
  47. <el-table-column type="index" align="center" label="序号" width="80" />
  48. <el-table-column prop="year" header-align="center" align="center" width="300" label="部门">
  49. <template v-slot="{row}">
  50. <span> {{ row.groupName }} </span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="score" header-align="center" align="center" label="评分均值">
  54. <template v-slot="{row}">
  55. <span> {{ row.score }} </span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="score" header-align="center" align="center" label="评价目标数目">
  59. <template v-slot="{row}">
  60. <span> {{ row.targetQty }} </span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="score" header-align="center" align="center" label="评价次数">
  64. <template v-slot="{row}">
  65. <span> {{ row.recordQty }} </span>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. </vuescroll>
  70. </el-row>
  71. </div>
  72. </template>
  73. <script>
  74. import { mapGetters } from 'vuex'
  75. import vuescroll from 'vuescroll'
  76. import { groupByList } from '@/api/hos/satisfyStatisApi'
  77. export default {
  78. name: 'GroupSatisIndex',
  79. components: { vuescroll },
  80. mixins: [],
  81. props: {},
  82. data() {
  83. return {
  84. ops: {
  85. bar: {
  86. keepShow: false,
  87. background: 'rgba(144, 147, 153, 0.4)',
  88. onlyShowBarOnScroll: false
  89. }
  90. },
  91. title: '部门排名',
  92. listLoading: false,
  93. dataList: [],
  94. conditions: {
  95. keywords: undefined,
  96. groupId: undefined,
  97. year: undefined,
  98. month: undefined
  99. }
  100. }
  101. },
  102. computed: {
  103. ...mapGetters([
  104. 'userData'
  105. ])
  106. },
  107. mounted() {
  108. this.getData()
  109. },
  110. methods: {
  111. getData() {
  112. this.listLoading = true
  113. groupByList(this.conditions).then((resp) => {
  114. this.listLoading = false
  115. const { data } = resp
  116. this.dataList = data
  117. }).catch((error) => {
  118. console.log(error)
  119. })
  120. },
  121. // 导出评价记录
  122. handleExport() {
  123. if (this.recordList.length <= 0) {
  124. this.$message.info('数据为空')
  125. return
  126. }
  127. this.downloadLoading = true
  128. import('@/vendor/Export2Excel').then(excel => {
  129. const tHeader = ['科室', '年度', '评价次数', '得分']
  130. const filterVal = ['groupName', 'year', 'recordQty', 'score']
  131. const data = this.formatJson(filterVal, this.yearScoreList)
  132. excel.export_json_to_excel({
  133. header: tHeader,
  134. data,
  135. filename: '',
  136. autoWidth: true,
  137. bookType: 'xlsx'
  138. })
  139. this.downloadLoading = false
  140. })
  141. },
  142. handlePrint() {
  143. let iframe = document.getElementById('print-iframe')
  144. if (!iframe) {
  145. var el = document.querySelector('#print_view')
  146. iframe = document.createElement('IFRAME')
  147. var doc = null
  148. iframe.setAttribute('id', 'print-iframe')
  149. iframe.setAttribute('style', 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;')
  150. document.body.appendChild(iframe)
  151. doc = iframe.contentWindow.document
  152. const styleHtml = 'table{color:#fff;background-color:#0C3444;-webkit-print-color-adjust: exact;}' +
  153. 'td,th{padding:10px;}' +
  154. 'th{background:#306379;-webkit-print-color-adjust: exact;}' +
  155. 'td{background:#0C3444;-webkit-print-color-adjust: exact; }'
  156. doc.write(`<html><head><style media="print">@media print {${styleHtml}}</style></head><body style="zoom: 60%;">${el.innerHTML}</body></html>`)
  157. doc.close()
  158. iframe.contentWindow.focus()
  159. }
  160. iframe.contentWindow.print()
  161. document.body.removeChild(iframe)
  162. // if (navigator.userAgent.indexOf('MSIE') > 0) {
  163. // document.body.removeChild(iframe)
  164. // }
  165. },
  166. formatJson(filterVal, jsonData) {
  167. return jsonData.map(v => filterVal.map(j => {
  168. return v[j]
  169. }))
  170. }
  171. }
  172. }
  173. </script>
  174. <style lang="scss" scoped>
  175. .content-container {
  176. padding: 10px;
  177. margin: 10px;
  178. overflow: hidden;
  179. background: #193142;
  180. height: calc(100vh - 85px);
  181. p {
  182. margin: 0;
  183. line-height: 2em;
  184. padding: 0;
  185. }
  186. .tool-bar {
  187. display: flex;
  188. align-items: center;
  189. overflow: unset;
  190. .list-group {
  191. font-size: 14px;
  192. color: #C1C6C8;
  193. // overflow: hidden;
  194. padding:0 20px;
  195. .list-item {
  196. float: left;
  197. margin-right: 20px;
  198. cursor: pointer;
  199. &.active {
  200. color: #FFFFFF;
  201. border-bottom: 3px solid #08A6DC;
  202. }
  203. }
  204. }
  205. .search-label {
  206. text-align: right;
  207. font-size: 12px;
  208. font-weight: 400;
  209. color: #FFFFFF;
  210. line-height: 1;
  211. span {
  212. font-size: 20px;
  213. font-weight: 400;
  214. color: #FFFFFF;
  215. }
  216. }
  217. }
  218. }
  219. .select-search{
  220. margin-left: 20px;
  221. display: flex;
  222. justify-content: flex-start;
  223. align-items: center;
  224. }
  225. </style>