vesselList.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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/icon_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="#C39A58"
  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="vesselClick(item)" v-for="item in vesselOptions" :class="item.dictValue==vessel?'item ellipsis active':'item ellipsis'">
  24. <text class="line" v-if="item.dictValue==vessel"></text>
  25. {{$parseText(item.dictLabel,4)}}
  26. </view>
  27. <view v-if="tabIndex==2" @click="regionClick(item)" v-for="item in regionOptions" :class="item.dictLabel==region?'item ellipsis active':'item ellipsis'">
  28. <text class="line" v-if="item.dictLabel==region"></text>
  29. {{$parseText(item.dictLabel,4)}}
  30. </view>
  31. </view>
  32. </view>
  33. <view class="right" >
  34. <view class="title">{{title}}</view>
  35. <scroll-view @scrolltolower="scrolltolower" scroll-y="true" style="height: calc(100vh - 180rpx);">
  36. <view class="items">
  37. <view class="r-item" @click="showDetail(item)" v-for="item in dataList">
  38. <view class="r-left">{{item.vesselName}}</view>
  39. <view class="r-right">
  40. <image src="../static/images/fire.png"></image>
  41. </view>
  42. </view>
  43. </view>
  44. </scroll-view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import {getDictByKey} from '@/api/common.js'
  51. import {getVesselList} from '@/api/index.js'
  52. export default {
  53. data() {
  54. return {
  55. tabIndex:1,
  56. vessel:"",
  57. region:"",
  58. title:"",
  59. pageNum:1,
  60. pageSize:20,
  61. vesselOptions:[],
  62. regionOptions:[],
  63. tabs: [
  64. {name:"按经络查询",id:"1"},
  65. {name:"按部位查询",id:"2"}
  66. ],
  67. keyword: '',
  68. dataList: []
  69. };
  70. },
  71. onLoad() {
  72. this.getDictByKey("sys_vessel");
  73. this.getDictByKey("sys_vessel_region");
  74. this.getVesselList()
  75. },
  76. methods:{
  77. scrolltolower(e){
  78. this.pageNum++;
  79. this.getVesselList()
  80. console.log(e)
  81. },
  82. regionClick(item){
  83. this.vessel=""
  84. this.region=item.dictLabel;
  85. this.title=item.dictLabel;
  86. this.pageNum=1;
  87. this.getVesselList()
  88. },
  89. vesselClick(item){
  90. this.region=""
  91. this.vessel=item.dictLabel;
  92. this.title=item.dictLabel;
  93. this.pageNum=1;
  94. this.getVesselList()
  95. },
  96. getDictByKey(key){
  97. var data={key:key}
  98. getDictByKey(data).then(
  99. res => {
  100. if(res.code==200){
  101. if(key=="sys_vessel"){
  102. this.vesselOptions=res.data;
  103. }
  104. if(key=="sys_vessel_region"){
  105. this.regionOptions=res.data;
  106. }
  107. }
  108. },
  109. err => {
  110. }
  111. );
  112. },
  113. tabChange(item) {
  114. this.tabIndex = item.id
  115. this.getVesselList()
  116. },
  117. doSearch(){
  118. this.pageNum=1;
  119. this.getVesselList()
  120. },
  121. getVesselList() {
  122. //联网加载数据
  123. var that = this;
  124. var data = {
  125. vessel:this.vessel,
  126. region:this.region,
  127. keyword:this.keyword,
  128. pageNum: this.pageNum,
  129. pageSize: this.pageSize
  130. };
  131. // uni.showLoading({
  132. // title:"加载中..."
  133. // })
  134. getVesselList(data).then(res => {
  135. // uni.hideLoading()
  136. if(res.code==200){
  137. //设置列表数据
  138. if (this.pageNum == 1) {
  139. that.dataList = res.data.list;
  140. } else {
  141. that.dataList = that.dataList.concat(res.data.list);
  142. }
  143. }else{
  144. uni.showToast({
  145. icon:'none',
  146. title: "请求失败",
  147. });
  148. that.dataList = [];
  149. }
  150. });
  151. },
  152. // 查看详情
  153. showDetail(item) {
  154. uni.navigateTo({
  155. url: './vesselDetails?id=' + item.id
  156. })
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="scss">
  162. .content{
  163. height: 100%;
  164. overflow: hidden;
  165. }
  166. .top-box{
  167. width: 100%;
  168. height: 180rpx;
  169. background-color: #FFFFFF;
  170. .search-cont{
  171. padding: 16upx 30upx;
  172. .inner{
  173. box-sizing: border-box;
  174. width: 100%;
  175. height: 72upx;
  176. background: #F7F7F7;
  177. border-radius: 36upx;
  178. display: flex;
  179. align-items: center;
  180. padding: 0 30upx;
  181. .icon-search{
  182. width: 28upx;
  183. height: 28upx;
  184. margin-right: 20upx;
  185. }
  186. input{
  187. height: 60upx;
  188. line-height: 60upx;
  189. flex: 1;
  190. }
  191. }
  192. }
  193. .tabs{
  194. }
  195. }
  196. .cont-box{
  197. height: calc(100% - 180rpx);
  198. display: flex;
  199. align-items: flex-start;
  200. justify-content: flex-start;
  201. .left{
  202. padding: 30rpx 0rpx;
  203. width: 240rpx;
  204. height: 100%;
  205. overflow-y: auto;
  206. display: flex;
  207. flex-direction: column;
  208. align-items: flex-start;
  209. justify-content: flex-start;
  210. .items{
  211. width: 240rpx;
  212. width: 100%;
  213. display: flex;
  214. flex-direction: column;
  215. align-items: center;
  216. justify-content: flex-start;
  217. .item{
  218. width: 240rpx;
  219. padding: 0rpx 20rpx;
  220. display: flex;
  221. align-items: center;
  222. justify-content: flex-start;
  223. font-size: 32upx;
  224. font-family: PingFang SC;
  225. font-weight: normal;
  226. color: #111111;
  227. font-weight: 500;
  228. line-height: 80upx;
  229. .line{
  230. margin-right: 15rpx;
  231. border-radius: 5rpx;
  232. width: 8rpx;
  233. height:30rpx;
  234. background-color: #C39A58;
  235. }
  236. }
  237. .active{
  238. background-color: #fff;
  239. font-weight: bold;
  240. color: #C39A58;
  241. }
  242. }
  243. }
  244. .right{
  245. padding: 30rpx 15rpx;
  246. background-color: #fff;
  247. height: 100%;
  248. overflow-y: auto;
  249. display: flex;
  250. flex-direction: column;
  251. align-items: flex-start;
  252. justify-content: flex-start;
  253. width: calc(100% - 240rpx);
  254. .title{
  255. font-size: 40upx;
  256. font-family: PingFang SC;
  257. font-weight: bold;
  258. color: #C39A58;
  259. line-height: 80upx;
  260. }
  261. .items{
  262. width: 100%;
  263. display: flex;
  264. flex-direction: column;
  265. align-items: flex-start;
  266. justify-content: flex-start;
  267. .r-item{
  268. line-height: 80rpx;
  269. width: 100%;
  270. display: flex;
  271. align-items: center;
  272. justify-content: flex-start;
  273. .r-left{
  274. flex: 1;
  275. font-size: 32upx;
  276. font-family: PingFang SC;
  277. font-weight: 500;
  278. color: #080808;
  279. }
  280. .r-right{
  281. padding: 0rpx 20rpx;
  282. display: flex;
  283. align-items: center;
  284. justify-content: center;
  285. image{
  286. width: 22rpx;
  287. height:30rpx;
  288. }
  289. }
  290. }
  291. }
  292. }
  293. }
  294. </style>