stationMy.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <view>
  3. <u-navbar title="关联场站" title-color="#101010"></u-navbar>
  4. <view class="top">
  5. <view class="search">
  6. <view class="searchBox">
  7. <u-search shape="square" placeholder="使用站点名称/编号搜索" maxlength="12" v-model="testName"
  8. :show-action="false" :animation="true"></u-search>
  9. <u-button type="primary" size="mini" @click="testBtn">搜素</u-button>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="list">
  14. <view class="item" v-for="(item,index) in list" :key="index">
  15. <view class="v1">
  16. {{item.stationNo}}<span class="y">|</span>{{item.name}}
  17. </view>
  18. <view class="v2" :class="{
  19. v3:item.inspectionCycle
  20. }">
  21. {{item.inspectionCycle?'巡检周期:'+item.inspectionCycle+'天':'未设置'}}
  22. </view>
  23. </view>
  24. </view>
  25. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
  26. <view class="floating-button">
  27. <view class="button " @click="gotoTask">
  28. 关联场站
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import * as API from '@/apis/pagejs/pagesTeam.js'
  35. export default {
  36. data() {
  37. return {
  38. list: [],
  39. listForm: {
  40. pageIndex: 1,
  41. pageSize: 20,
  42. recordsTotal: 1,
  43. status: 0,
  44. roleName: "XJ,XJADMIN",
  45. roleName: "XJ",
  46. },
  47. id: "",
  48. testName: "",
  49. queryName: "",
  50. };
  51. },
  52. onLoad(op) {
  53. this.id = op.id
  54. this.getList()
  55. },
  56. onShow() {
  57. },
  58. onReachBottom() {
  59. if (this.list.length < this.listForm.recordsTotal) {
  60. this.myLoadmore();
  61. }
  62. },
  63. methods: {
  64. gotoTask(){
  65. uni.navigateTo({
  66. url: '/pages/team/stationAdd?id='+this.id,
  67. events: {
  68. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  69. acceptDataFromOpenerPage: (data)=>{
  70. console.log(data)
  71. this.getList(1)
  72. },
  73. }
  74. })
  75. },
  76. myLoadmore() {
  77. this.listForm.pageIndex += 1;
  78. this.getList()
  79. },
  80. showqueryName(item) {
  81. if (this.queryName) {
  82. var name = item.name
  83. return name.indexOf(this.queryName) != -1
  84. } else {
  85. return true
  86. }
  87. },
  88. testBtn() {
  89. this.queryName = this.testName
  90. this.getList(1)
  91. },
  92. getList(bl) {
  93. if (bl) {
  94. this.listForm.pageIndex = 1
  95. }
  96. uni.showLoading({
  97. title: "加载中",
  98. mask: true,
  99. })
  100. this.listForm.id = this.id
  101. this.listForm.queryContent=this.queryName
  102. API.teamUserStation(this.listForm).then((res) => {
  103. var list = this.list
  104. if (this.listForm.pageIndex == 1) {
  105. list = res.data.data;
  106. } else {
  107. list = [
  108. ...list,
  109. ...res.data.data
  110. ];
  111. }
  112. this.list =list
  113. this.listForm.recordsTotal=res.data.recordsTotal
  114. uni.hideLoading();
  115. }).catch(error => {
  116. uni.hideLoading();
  117. uni.showToast({
  118. title: error,
  119. icon: "none"
  120. })
  121. })
  122. },
  123. }
  124. }
  125. </script>
  126. <style lang="scss" scoped>
  127. .list {
  128. padding-top: 20rpx;
  129. padding-bottom: 120rpx;
  130. .item:not(:last-child) {
  131. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  132. }
  133. .item {
  134. padding: 24rpx 32rpx;
  135. background: #fff;
  136. display: flex;
  137. flex-direction: row;
  138. justify-content: space-between;
  139. align-items: center;
  140. .vquery {
  141. display: flex;
  142. align-items: center;
  143. }
  144. .buildMode {
  145. font-size: 24rpx;
  146. border: 2rpx solid #bbbbbb;
  147. border-radius: 8rpx;
  148. color: #1677ff;
  149. padding: 2rpx 8rpx;
  150. margin: 0 8rpx;
  151. }
  152. .buildMode1 {
  153. color: #1677ff;
  154. border: 2rpx solid #1677ff;
  155. }
  156. .buildMode2 {
  157. color: #4CAF50;
  158. border: 2rpx solid #4CAF50;
  159. }
  160. .qName {
  161. color: #FF5100
  162. }
  163. .v1 {
  164. color: rgba(16, 16, 16, 1);
  165. font-size: 32rpx;
  166. }
  167. .y {
  168. margin: 0 8rpx;
  169. color: rgba(119, 119, 119, 1);
  170. }
  171. .v2 {
  172. color: red;
  173. font-size: 24rpx;
  174. white-space: pre;
  175. }
  176. .v3 {
  177. color: rgba(119, 119, 119, 1);
  178. font-size: 24rpx;
  179. }
  180. }
  181. }
  182. .top {
  183. border-bottom: 2rpx solid #e8e8e8;
  184. }
  185. .search {
  186. padding: 16rpx 32rpx;
  187. background: #fff;
  188. .searchBox {
  189. display: flex;
  190. align-items: center;
  191. background: #F2F2F2;
  192. padding: 2rpx 16rpx;
  193. border-radius: 16rpx;
  194. justify-content: space-between;
  195. }
  196. }
  197. .floating-button {
  198. z-index: 999;
  199. position: fixed;
  200. bottom: 0;
  201. width: 100%;
  202. display: flex;
  203. height: 120rpx;
  204. justify-content: space-around;
  205. background-color: rgba(255, 255, 255, 1);
  206. .button {
  207. margin-top: 24rpx;
  208. border-radius: 50px;
  209. height: 80rpx;
  210. width: 80%;
  211. display: flex;
  212. align-items: center;
  213. justify-content: center;
  214. padding: 12rpx;
  215. background-color: rgba(22, 119, 255, 1);
  216. color: rgba(255, 255, 255, 1);
  217. font-size: 32rpx;
  218. }
  219. }
  220. </style>