famousPrescribeList.vue 7.7 KB

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