famousPrescribeList.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <view class="content">
  3. <view class="top-box">
  4. <!-- 搜索框 -->
  5. <view class="search-cont">
  6. <view class="inner">
  7. <image class="icon-search" src="/static/images/search.png" mode=""></image>
  8. <input type="text" v-model="keyword" placeholder="输入关键字搜索" confirm-type="search" @confirm="doSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
  9. </view>
  10. </view>
  11. <view class="tabs">
  12. <u-tabs
  13. :scrollable="false"
  14. :list="tabs"
  15. lineColor="#0bb3f2"
  16. @change="tabChange">
  17. </u-tabs>
  18. </view>
  19. </view>
  20. <view class="cont-box">
  21. <view class="left">
  22. <view class="items">
  23. <view v-if="tabIndex==1" @click="typeClick(item)" v-for="item in typeOptions" :class="item.dictValue==prescribeType?'item ellipsis active':'item ellipsis'">
  24. <text class="line" v-if="item.dictValue==prescribeType"></text>
  25. {{ utils.subString(item.dictLabel) }}
  26. </view>
  27. <view v-if="tabIndex==2" @click="indicationClick(item)" v-for="item in indicationOptions" :class="item.dictLabel==indication?'item ellipsis active':'item ellipsis'">
  28. <text class="line" v-if="item.dictLabel==indication"></text>
  29. {{ utils.subString(item.dictLabel) }}
  30. </view>
  31. <view v-if="tabIndex==3" @click="bookClick(item)" v-for="item in bookOptions" :class="item.dictLabel==belongBook?'item ellipsis active':'item ellipsis'">
  32. <text class="line" v-if="item.dictLabel==belongBook"></text>
  33. {{ utils.subString(item.dictLabel) }}
  34. </view>
  35. </view>
  36. </view>
  37. <view class="right" >
  38. <view class="title">{{title}}</view>
  39. <scroll-view @scrolltolower="scrolltolower" scroll-y="true" style="height: calc(100vh - 180rpx);">
  40. <view class="items">
  41. <view class="r-item" @click="showDetail(item)" v-for="item in dataList">
  42. <view class="r-left">{{item.prescribeName}}</view>
  43. <view class="r-right">
  44. <image src="/static/images/fire.png"></image>
  45. </view>
  46. </view>
  47. </view>
  48. </scroll-view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import {getDictByKey} from '@/api/common.js'
  55. import {getFamousPrescribeList} from '@/api/index.js'
  56. export default {
  57. data() {
  58. return {
  59. tabIndex:1,
  60. indication:"",
  61. belongBook:"",
  62. title:"",
  63. prescribeType:0,
  64. pageNum:1,
  65. pageSize:20,
  66. typeOptions:[],
  67. bookOptions:[],
  68. indicationOptions:[],
  69. tabs: [
  70. {name:"按类型",id:"1"},
  71. {name:"按疾病",id:"2"},
  72. {name:"按书籍",id:"3"}
  73. ],
  74. keyword: '',
  75. dataList: []
  76. };
  77. },
  78. onLoad() {
  79. this.getDictByKey("sys_famous_prescribe_type");
  80. this.getDictByKey("sys_famous_prescribe_indication");
  81. this.getDictByKey("sys_famous_prescribe_book");
  82. },
  83. methods:{
  84. scrolltolower(e){
  85. this.pageNum++;
  86. this.getFamousPrescribeList()
  87. },
  88. typeClick(item){
  89. this.indication=""
  90. this.belongBook="";
  91. this.prescribeType=parseInt(item.dictValue);
  92. this.title=item.dictLabel;
  93. this.pageNum=1;
  94. this.getFamousPrescribeList()
  95. },
  96. bookClick(item){
  97. this.indication=""
  98. this.prescribeType=0;
  99. this.belongBook=item.dictLabel;
  100. this.title=item.dictLabel;
  101. this.pageNum=1;
  102. this.getFamousPrescribeList()
  103. },
  104. indicationClick(item){
  105. this.belongBook=""
  106. this.prescribeType=0;
  107. this.indication=item.dictLabel;
  108. this.title=item.dictLabel;
  109. this.pageNum=1;
  110. this.getFamousPrescribeList()
  111. },
  112. getDictByKey(key){
  113. var data={key:key}
  114. getDictByKey(data).then(
  115. res => {
  116. if(res.code==200){
  117. if(key=="sys_famous_prescribe_type"){
  118. this.typeOptions=res.data;
  119. if(this.typeOptions!=null&&this.typeOptions.length>0){
  120. this.typeClick(this.typeOptions[0])
  121. }
  122. }
  123. if(key=="sys_famous_prescribe_indication"){
  124. this.indicationOptions=res.data;
  125. }
  126. if(key=="sys_famous_prescribe_book"){
  127. this.bookOptions=res.data;
  128. }
  129. }
  130. },
  131. err => {
  132. }
  133. );
  134. },
  135. tabChange(item) {
  136. this.tabIndex = item.id
  137. this.getFamousPrescribeList()
  138. },
  139. doSearch(){
  140. this.pageNum=1;
  141. this.getFamousPrescribeList()
  142. },
  143. getFamousPrescribeList() {
  144. //联网加载数据
  145. var that = this;
  146. var data = {
  147. indication:this.indication,
  148. belongBook:this.belongBook,
  149. prescribeType:this.prescribeType,
  150. keyword:this.keyword,
  151. pageNum: this.pageNum,
  152. pageSize: this.pageSize
  153. };
  154. uni.showLoading({
  155. title:"加载中..."
  156. })
  157. getFamousPrescribeList(data).then(res => {
  158. uni.hideLoading()
  159. if(res.code==200){
  160. //设置列表数据
  161. if (this.pageNum == 1) {
  162. that.dataList = res.data.list;
  163. } else {
  164. that.dataList = that.dataList.concat(res.data.list);
  165. }
  166. }else{
  167. uni.showToast({
  168. icon:'none',
  169. title: "请求失败",
  170. });
  171. that.dataList = [];
  172. }
  173. });
  174. },
  175. // 查看详情
  176. showDetail(item) {
  177. uni.navigateTo({
  178. url: './famousPrescribeDetails?id=' + item.id
  179. })
  180. }
  181. }
  182. }
  183. </script>
  184. <style lang="scss">
  185. .content{
  186. height: 100%;
  187. overflow: hidden;
  188. }
  189. .top-box{
  190. width: 100%;
  191. height: 180rpx;
  192. background-color: #FFFFFF;
  193. .search-cont{
  194. padding: 16upx 30upx;
  195. .inner{
  196. box-sizing: border-box;
  197. width: 100%;
  198. height: 72upx;
  199. background: #F7F7F7;
  200. border-radius: 36upx;
  201. display: flex;
  202. align-items: center;
  203. padding: 0 30upx;
  204. .icon-search{
  205. width: 28upx;
  206. height: 28upx;
  207. margin-right: 20upx;
  208. }
  209. input{
  210. height: 60upx;
  211. line-height: 60upx;
  212. flex: 1;
  213. }
  214. }
  215. }
  216. .tabs{
  217. }
  218. }
  219. .cont-box{
  220. height: calc(100% - 180rpx);
  221. display: flex;
  222. align-items: flex-start;
  223. justify-content: flex-start;
  224. .left{
  225. padding: 30rpx 0rpx;
  226. width: 240rpx;
  227. height: 100%;
  228. overflow-y: auto;
  229. display: flex;
  230. flex-direction: column;
  231. align-items: flex-start;
  232. justify-content: flex-start;
  233. .items{
  234. width: 240rpx;
  235. width: 100%;
  236. display: flex;
  237. flex-direction: column;
  238. align-items: center;
  239. justify-content: flex-start;
  240. .item{
  241. width: 240rpx;
  242. padding: 0rpx 20rpx;
  243. display: flex;
  244. align-items: center;
  245. justify-content: flex-start;
  246. font-size: 32upx;
  247. font-family: PingFang SC;
  248. font-weight: normal;
  249. color: #111111;
  250. font-weight: 500;
  251. line-height: 80upx;
  252. .line{
  253. margin-right: 15rpx;
  254. border-radius: 5rpx;
  255. width: 8rpx;
  256. height:30rpx;
  257. background-color: #0bb3f2;
  258. }
  259. }
  260. .active{
  261. background-color: #fff;
  262. font-weight: bold;
  263. color: #0bb3f2;
  264. }
  265. }
  266. }
  267. .right{
  268. padding: 30rpx 15rpx;
  269. background-color: #fff;
  270. height: 100%;
  271. overflow-y: auto;
  272. display: flex;
  273. flex-direction: column;
  274. align-items: flex-start;
  275. justify-content: flex-start;
  276. width: calc(100% - 240rpx);
  277. .title{
  278. font-size: 40upx;
  279. font-family: PingFang SC;
  280. font-weight: bold;
  281. color: #0bb3f2;
  282. line-height: 80upx;
  283. }
  284. .items{
  285. width: 100%;
  286. display: flex;
  287. flex-direction: column;
  288. align-items: flex-start;
  289. justify-content: flex-start;
  290. .r-item{
  291. line-height: 80rpx;
  292. width: 100%;
  293. display: flex;
  294. align-items: center;
  295. justify-content: flex-start;
  296. .r-left{
  297. flex: 1;
  298. font-size: 32upx;
  299. font-family: PingFang SC;
  300. font-weight: 500;
  301. color: #080808;
  302. }
  303. .r-right{
  304. padding: 0rpx 20rpx;
  305. display: flex;
  306. align-items: center;
  307. justify-content: center;
  308. image{
  309. width: 22rpx;
  310. height:30rpx;
  311. }
  312. }
  313. }
  314. }
  315. }
  316. }
  317. </style>