defectRuleProblem.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div class="box">
  3. <div class="box_wrapper">
  4. <SearchBoxVue :data="searchData" :codes="tableShowCode" @search="handleSearch" @reset="handleReset" @codesChange="handleCodesChange" />
  5. <TableBoxVue :loading="loading" :data="tableData" :codes="tableShowCode" @export="handelExport" style="margin-top: -40px;" />
  6. <div style="overflow: hidden;">
  7. <el-pagination
  8. v-if="tableData && tableData.length !== 0"
  9. :total="paginationData.total"
  10. background
  11. class="table-pagination"
  12. :page-size="paginationData.limit"
  13. :current-page.sync="paginationData.page"
  14. layout="total, sizes, prev, pager, next, jumper"
  15. @size-change="SizeChangeEvent"
  16. @current-change="pageHasChanged"
  17. />
  18. </div>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import SearchBoxVue from './components/SearchBox2.vue'
  24. import TableBoxVue from './components/TableBox2.vue'
  25. import { errorDetailsListExport } from '@/api/excel'
  26. export default {
  27. components: {
  28. SearchBoxVue,
  29. TableBoxVue
  30. },
  31. data() {
  32. return {
  33. loading: false,
  34. searchData: {
  35. AAA28: '',
  36. dep_id: '',
  37. start_time: '',
  38. end_time: '',
  39. type: '',
  40. level: '',
  41. desc: '',
  42. AEE04: '',
  43. AEE08: '',
  44. ICD10_NAME: '',
  45. ICD10_ID1: '',
  46. ICD9_NAME: '',
  47. ICD9_ID1: ''
  48. },
  49. tableData: [],
  50. paginationData: {
  51. total: 0,
  52. page: 1,
  53. limit: 10
  54. },
  55. error_rule: '',
  56. tableShowCode: [
  57. 'field',
  58. 'desc',
  59. 'AAA28',
  60. 'AAA01',
  61. 'time',
  62. 'AAC11N',
  63. 'AEE08',
  64. 'AEE04',
  65. 'type',
  66. 'level',
  67. 'ICD10_NAME',
  68. 'ICD10_ID1',
  69. 'ICD9_NAME',
  70. 'ICD9_ID1'
  71. ]
  72. }
  73. },
  74. created() {
  75. this.error_rule = this.$route.query.error_rule
  76. this.getList()
  77. },
  78. methods: {
  79. // 展示字段变化
  80. handleCodesChange(val) {
  81. localStorage.setItem('surgery_talbe_codes', val)
  82. this.$set(this, 'tableShowCode', val)
  83. },
  84. getList() {
  85. const {
  86. page,
  87. limit
  88. } = this.paginationData
  89. const params = {
  90. ...this.searchData,
  91. error_rule: this.error_rule,
  92. page,
  93. page_size: limit
  94. }
  95. this.$axios.post('/home_quality/errorDetailsList', params).then(res => {
  96. this.tableData = res.data.list
  97. this.paginationData.total = res.data.count
  98. });
  99. },
  100. SizeChangeEvent(val) {
  101. this.paginationData.limit = val
  102. this.getList()
  103. },
  104. pageHasChanged(val) {
  105. this.paginationData.page = val
  106. this.getList()
  107. },
  108. handleSearch() {
  109. this.paginationData.page = 1
  110. this.getList()
  111. },
  112. handelExport() {
  113. errorDetailsListExport(...this.searchData).then(res => {
  114. const content = res.data; // 后台返回二进制数据
  115. const blob = new Blob([content]);
  116. const fileName = `缺陷问题详情.csv`;
  117. if ('download' in document.createElement('a')) {
  118. // 非IE下载
  119. const elink = document.createElement('a');
  120. elink.download = fileName;
  121. elink.style.display = 'none';
  122. elink.href = URL.createObjectURL(blob);
  123. document.body.appendChild(elink);
  124. elink.click();
  125. URL.revokeObjectURL(elink.href); // 释放URL 对象
  126. document.body.removeChild(elink);
  127. } else {
  128. // IE10+下载
  129. navigator.msSaveBlob(blob, fileName);
  130. }
  131. });
  132. },
  133. handleReset() {
  134. this.paginationData.page = 1
  135. this.paginationData.limit = 10
  136. this.searchData = {
  137. AAA28: '',
  138. dep_id: '',
  139. start_time: '',
  140. end_time: '',
  141. type: '',
  142. level: '',
  143. desc: '',
  144. AEE04: '',
  145. AEE08: '',
  146. ICD10_NAME: '',
  147. ICD10_ID1: '',
  148. ICD9_NAME: '',
  149. ICD9_ID1: ''
  150. }
  151. this.tableData = []
  152. this.getList()
  153. }
  154. }
  155. }
  156. </script>
  157. <style lang="scss" scoped>
  158. .box {
  159. user-select: none;
  160. padding: 16px;
  161. .box_wrapper {
  162. padding: 16px;
  163. padding: 16px;
  164. background: #fff;
  165. border-radius: 5px;
  166. position: relative;
  167. }
  168. .table-pagination {
  169. float: right;
  170. }
  171. }
  172. </style>