famousPrescribeList.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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="#018C39"
  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. console.log(e)
  88. },
  89. typeClick(item){
  90. this.indication=""
  91. this.belongBook="";
  92. this.prescribeType=parseInt(item.dictValue);
  93. console.log(this.prescribeType)
  94. this.title=item.dictLabel;
  95. this.pageNum=1;
  96. this.getFamousPrescribeList()
  97. },
  98. bookClick(item){
  99. this.indication=""
  100. this.prescribeType=0;
  101. this.belongBook=item.dictLabel;
  102. this.title=item.dictLabel;
  103. this.pageNum=1;
  104. this.getFamousPrescribeList()
  105. },
  106. indicationClick(item){
  107. console.log(item)
  108. this.belongBook=""
  109. this.prescribeType=0;
  110. this.indication=item.dictLabel;
  111. this.title=item.dictLabel;
  112. this.pageNum=1;
  113. this.getFamousPrescribeList()
  114. },
  115. getDictByKey(key){
  116. var data={key:key}
  117. getDictByKey(data).then(
  118. res => {
  119. if(res.code==200){
  120. if(key=="sys_famous_prescribe_type"){
  121. this.typeOptions=res.data;
  122. if(this.typeOptions!=null&&this.typeOptions.length>0){
  123. this.typeClick(this.typeOptions[0])
  124. }
  125. }
  126. if(key=="sys_famous_prescribe_indication"){
  127. this.indicationOptions=res.data;
  128. }
  129. if(key=="sys_famous_prescribe_book"){
  130. this.bookOptions=res.data;
  131. }
  132. }
  133. },
  134. err => {
  135. }
  136. );
  137. },
  138. tabChange(item) {
  139. this.tabIndex = item.id
  140. this.getFamousPrescribeList()
  141. },
  142. doSearch(){
  143. this.pageNum=1;
  144. this.getFamousPrescribeList()
  145. },
  146. getFamousPrescribeList() {
  147. //联网加载数据
  148. var that = this;
  149. var data = {
  150. indication:this.indication,
  151. belongBook:this.belongBook,
  152. prescribeType:this.prescribeType,
  153. keyword:this.keyword,
  154. pageNum: this.pageNum,
  155. pageSize: this.pageSize
  156. };
  157. uni.showLoading({
  158. title:"加载中..."
  159. })
  160. getFamousPrescribeList(data).then(res => {
  161. uni.hideLoading()
  162. if(res.code==200){
  163. //设置列表数据
  164. if (this.pageNum == 1) {
  165. that.dataList = res.data.list;
  166. } else {
  167. that.dataList = that.dataList.concat(res.data.list);
  168. }
  169. }else{
  170. uni.showToast({
  171. icon:'none',
  172. title: "请求失败",
  173. });
  174. that.dataList = [];
  175. }
  176. });
  177. },
  178. // 查看详情
  179. showDetail(item) {
  180. uni.navigateTo({
  181. url: './famousPrescribeDetails?id=' + item.id
  182. })
  183. }
  184. }
  185. }
  186. </script>
  187. <style lang="scss">
  188. .content{
  189. height: 100%;
  190. overflow: hidden;
  191. }
  192. .top-box{
  193. width: 100%;
  194. height: 180rpx;
  195. background-color: #FFFFFF;
  196. .search-cont{
  197. padding: 16upx 30upx;
  198. .inner{
  199. box-sizing: border-box;
  200. width: 100%;
  201. height: 72upx;
  202. background: #F7F7F7;
  203. border-radius: 36upx;
  204. display: flex;
  205. align-items: center;
  206. padding: 0 30upx;
  207. .icon-search{
  208. width: 28upx;
  209. height: 28upx;
  210. margin-right: 20upx;
  211. }
  212. input{
  213. height: 60upx;
  214. line-height: 60upx;
  215. flex: 1;
  216. }
  217. }
  218. }
  219. .tabs{
  220. }
  221. }
  222. .cont-box{
  223. height: calc(100% - 180rpx);
  224. display: flex;
  225. align-items: flex-start;
  226. justify-content: flex-start;
  227. .left{
  228. padding: 30rpx 0rpx;
  229. width: 240rpx;
  230. height: 100%;
  231. overflow-y: auto;
  232. display: flex;
  233. flex-direction: column;
  234. align-items: flex-start;
  235. justify-content: flex-start;
  236. .items{
  237. width: 240rpx;
  238. width: 100%;
  239. display: flex;
  240. flex-direction: column;
  241. align-items: center;
  242. justify-content: flex-start;
  243. .item{
  244. width: 240rpx;
  245. padding: 0rpx 20rpx;
  246. display: flex;
  247. align-items: center;
  248. justify-content: flex-start;
  249. font-size: 32upx;
  250. font-family: PingFang SC;
  251. font-weight: normal;
  252. color: #111111;
  253. font-weight: 500;
  254. line-height: 80upx;
  255. .line{
  256. margin-right: 15rpx;
  257. border-radius: 5rpx;
  258. width: 8rpx;
  259. height:30rpx;
  260. background-color: #018C39;
  261. }
  262. }
  263. .active{
  264. background-color: #fff;
  265. font-weight: bold;
  266. color: #018C39;
  267. }
  268. }
  269. }
  270. .right{
  271. padding: 30rpx 15rpx;
  272. background-color: #fff;
  273. height: 100%;
  274. overflow-y: auto;
  275. display: flex;
  276. flex-direction: column;
  277. align-items: flex-start;
  278. justify-content: flex-start;
  279. width: calc(100% - 240rpx);
  280. .title{
  281. font-size: 40upx;
  282. font-family: PingFang SC;
  283. font-weight: bold;
  284. color: #018C39;
  285. line-height: 80upx;
  286. }
  287. .items{
  288. width: 100%;
  289. display: flex;
  290. flex-direction: column;
  291. align-items: flex-start;
  292. justify-content: flex-start;
  293. .r-item{
  294. line-height: 80rpx;
  295. width: 100%;
  296. display: flex;
  297. align-items: center;
  298. justify-content: flex-start;
  299. .r-left{
  300. flex: 1;
  301. font-size: 32upx;
  302. font-family: PingFang SC;
  303. font-weight: 500;
  304. color: #080808;
  305. }
  306. .r-right{
  307. padding: 0rpx 20rpx;
  308. display: flex;
  309. align-items: center;
  310. justify-content: center;
  311. image{
  312. width: 22rpx;
  313. height:30rpx;
  314. }
  315. }
  316. }
  317. }
  318. }
  319. }
  320. </style>