Disease.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div class="prescription">
  3. <!-- 顶部筛选 -->
  4. <div class="screening flex-plane-start-b">
  5. <div class="screening-form flex-vertical-center-l flex-wrap">
  6. <div class="screening-item flex-vertical-center-l">
  7. <span>疾病名称:</span>
  8. <div class="input">
  9. <el-input size="mini" v-model="form.name" placeholder="请输入"></el-input>
  10. </div>
  11. </div>
  12. <!-- <div class="screening-item flex-vertical-center-l">
  13. <span>功效:</span>
  14. <div class="input">
  15. <el-input v-model="form.gongxiao" placeholder="请输入"></el-input>
  16. </div>
  17. </div> -->
  18. <el-button size="mini" type="primary" @click="search">搜索</el-button>
  19. <el-button size="mini" type="warning" @click="clearFilter">清空</el-button>
  20. </div>
  21. <!-- <div class="total">
  22. 共 <span>123</span>味药
  23. </div> -->
  24. </div>
  25. <!-- 主体部分 -->
  26. <div class="prescr-body">
  27. <!-- 顶部tab -->
  28. <div class="p-tab flex-vertical-center-l">
  29. <div :class="tab_current==index?'flex-center p-active':'flex-center'" v-for="(item,index) in tabs"
  30. :key="index" @click="tabCahnge(index);scroll($event)">
  31. {{item.deptName}}
  32. </div>
  33. </div>
  34. <!-- 底部数据表格 -->
  35. <div class="table-data">
  36. <div class="flex-center table-name" v-for="(item,index) in list" :key="index" :title="item.disname"
  37. @click="$router.push({path:'/index/diseased?disid='+item.disid})">{{item.disname}}</div>
  38. <div class="flex-center findmore" @click="loadMoreData">
  39. <span>更多</span>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. import {
  47. getDiseaseList,
  48. getDiseaseClass
  49. } from '@/api/knowledge.js'
  50. export default {
  51. data() {
  52. return {
  53. form: {
  54. name: '',
  55. gongxiao: ''
  56. },
  57. page: 1,
  58. list: [],
  59. loadMore: true,
  60. tabs: [],
  61. tab_current: 0
  62. }
  63. },
  64. created() {
  65. this.getDiseaseClass()
  66. },
  67. methods: {
  68. clearFilter() {
  69. this.form.name = ''
  70. this.getDiseaseList()
  71. },
  72. search() {
  73. this.page = 1
  74. this.loadMore = true
  75. this.getDiseaseList()
  76. },
  77. tabCahnge(index) {
  78. this.page = 1
  79. this.loadMore = true
  80. this.tab_current = index
  81. this.getDiseaseList()
  82. },
  83. scroll(event) {
  84. try { event.target.scrollIntoView({ behavior: 'smooth', inline: 'center' }); } catch (e) {}
  85. },
  86. loadMoreData() {
  87. this.getDiseaseList(this.loadMore)
  88. },
  89. // 获取疾病数据
  90. async getDiseaseList(load = true) {
  91. if (!load) {
  92. this.$message.warning('没有更多数据')
  93. return
  94. }
  95. let params = {
  96. keyword: this.form.name,
  97. pageid: this.page,
  98. pagesize: 100,
  99. serchtype: '',
  100. deptid: this.tabs[this.tab_current].deptId
  101. }
  102. let res = await getDiseaseList(params)
  103. if (res.code == 0) {
  104. if (this.page > 1) {
  105. this.list = [...this.list, ...res.data.diseases]
  106. } else {
  107. this.list = res.data.diseases
  108. }
  109. if (this.page <= res.data.TotalPageCount) {
  110. this.page += 1
  111. } else {
  112. this.loadMore = false
  113. this.$message.warning('没有更多数据')
  114. }
  115. }
  116. },
  117. // 获取疾病分类
  118. async getDiseaseClass() {
  119. let res = await getDiseaseClass()
  120. if (res.code == 0) {
  121. this.tabs = res.data
  122. this.getDiseaseList()
  123. }
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="scss" scoped>
  129. @import '../../style/common.scss';
  130. @import '../../style/base.scss';
  131. .prescription {
  132. .total {
  133. font-size: 14px;
  134. font-family: PingFang SC;
  135. font-weight: 400;
  136. color: #333333;
  137. margin-bottom: 20px;
  138. span {
  139. color: #FF3A3A;
  140. }
  141. }
  142. .prescr-body {
  143. margin-top: 10px;
  144. .p-tab {
  145. flex-wrap: nowrap;
  146. overflow-x: auto;
  147. > div {
  148. flex-shrink: 0;
  149. min-width: 70px;
  150. width: auto;
  151. }
  152. }
  153. }
  154. .table-data {
  155. padding: 10px 10px;
  156. background: #FFFFFF;
  157. border-radius: 0px 5px 5px 5px;
  158. height: 65vh;
  159. overflow: auto;
  160. div {
  161. display: inline-block;
  162. width: 90px;
  163. height: 44px;
  164. line-height: 44px;
  165. text-align: center;
  166. background: #F5F5F5;
  167. border-radius: 4px;
  168. font-size: 14px;
  169. font-family: PingFang SC;
  170. font-weight: 400;
  171. color: #000000;
  172. margin: 0 10px 10px 0;
  173. cursor: pointer;
  174. overflow: hidden;
  175. text-overflow: ellipsis;
  176. white-space: nowrap;
  177. }
  178. }
  179. .findmore {
  180. background: #FFAE45 !important;
  181. color: #fff !important;
  182. }
  183. }
  184. </style>
  185. <style lang="scss" scoped>
  186. @media screen and (min-width:1681px) and (max-width:1920px) {
  187. .prescription {
  188. .table-data {
  189. height: 79vh;
  190. }
  191. }
  192. }
  193. @media screen and (min-width:1601px) and (max-width:1680px) {
  194. .prescription {
  195. .table-data {
  196. height: 78vh;
  197. }
  198. }
  199. }
  200. @media screen and (min-width:1361px) and (max-width:1600px) {
  201. .prescription {
  202. .table-data {
  203. height: 68vh;
  204. }
  205. }
  206. }
  207. @media screen and(min-width:1281px) and (max-width:1360px) {
  208. .prescription {
  209. .table-data {
  210. height: 68vh;
  211. }
  212. }
  213. }
  214. </style>