listTask.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <view>
  3. <u-navbar title="故障记录" title-color="#101010" :customBack="customBack" ></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" :show-action="false"
  8. :animation="true"></u-search>
  9. <u-button type="primary" size="mini" @click="testBtn">搜素</u-button>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="viewTop" >
  14. <u-tabs :list="tabslist"
  15. style=" width: 50%;"
  16. :current="current" @change="change"></u-tabs>
  17. <view class="select" @click="gotoSelectLock">
  18. <view class="selectSpan">
  19. {{lockName?lockName:'选择地锁'}}
  20. </view>
  21. <u-icon name="arrow-down" size="32" color="#AAAAAA"></u-icon>
  22. </view>
  23. </view>
  24. <view class="list" >
  25. <view class="item"
  26. v-for="(item,index) in list"
  27. @click="gotoTask(item)"
  28. :key="index">
  29. <view class="body">
  30. <view class="line1">
  31. <view class="title">
  32. {{item.errorCodeText}}
  33. </view>
  34. <view class="status " :class="'status'+item.status">
  35. {{item.statusN}}
  36. </view>
  37. </view>
  38. <view class="line2">
  39. <view class="value">
  40. 设备编号 {{item.parkingName}}
  41. </view>
  42. <view class="value">
  43. 设备网点 {{item.parkingName}}
  44. </view>
  45. <view class="value">
  46. 创建时间 {{item.createTime}}
  47. </view>
  48. </view>
  49. <view class="line3">
  50. <u-button type="info" size="mini">查看</u-button>
  51. <u-button type="primary" size="mini" >去处理</u-button>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
  57. <view class="floating-button">
  58. <view class="button" @click="submit" >
  59. 故障上报
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import * as API from '@/apis/pagejs/pagesTask.js'
  66. export default {
  67. data() {
  68. return {
  69. list:[],
  70. listForm:{
  71. pageIndex: 1,
  72. pageSize: 20,
  73. recordsTotal: 1,
  74. status:0
  75. },
  76. lockId:"",
  77. lockName:"",
  78. current:0,
  79. tabslist:[
  80. {
  81. name: '待处理'
  82. }, {
  83. name: '已处理'
  84. }
  85. ]
  86. };
  87. },
  88. onLoad(op) {
  89. if(op.status){
  90. if('geterrList0'==op.status){
  91. this.current=0
  92. this.listForm.status=0
  93. }
  94. if('geterrList1'==op.status){
  95. this.current=1
  96. this.listForm.status=1
  97. }
  98. }
  99. if(op.lockId){
  100. this.lockId=op.lockId
  101. this.lockName=op.lockName
  102. this.listForm.lockId=op.lockId;
  103. }
  104. this.getList()
  105. },
  106. onReachBottom() {
  107. if (this.list.length < this.listForm.recordsTotal) {
  108. this.myLoadmore();
  109. }
  110. },
  111. methods: {
  112. gotoSelectLock(){
  113. uni.navigateTo({
  114. url: '/pages/task/selectStation?isAll=1',
  115. events: {
  116. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  117. acceptDataFromOpenerPage: (item)=>{
  118. console.log(item)
  119. this.lockName=item.item.name
  120. this.listForm.lockId=item.item.id
  121. this.getList(1)
  122. this.$forceUpdate()
  123. },
  124. }
  125. })
  126. },
  127. customBack(){
  128. if(this.lockId){
  129. uni.switchTab({
  130. url:"/pages/index/index"
  131. })
  132. }else{
  133. uni.navigateBack()
  134. }
  135. },
  136. gotoTask(k){
  137. uni.navigateTo({
  138. url: '/pages/task/maintenanceTaks?id='+k.id,
  139. events: {
  140. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  141. acceptDataFromOpenerPage: (data)=>{
  142. console.log(data)
  143. this.getList(1)
  144. },
  145. }
  146. })
  147. },
  148. change(e){
  149. this.current=e
  150. this.listForm.pageIndex=0
  151. this.listForm.status=e
  152. this.list =[]
  153. this.getList()
  154. },
  155. myLoadmore(){
  156. this.listForm.pageIndex += 1;
  157. this.getList()
  158. },
  159. getList(bl) {
  160. if(bl){
  161. this.listForm.pageIndex = 1
  162. }
  163. uni.showLoading({
  164. title: "加载中",
  165. mask: true,
  166. })
  167. API.errList(this.listForm).then((res) => {
  168. var list=[]
  169. if (this.listForm.pageIndex == 1) {
  170. list = res.data.data;
  171. } else {
  172. list = [
  173. ...list,
  174. ...res.data.data
  175. ];
  176. }
  177. this.list = res.data.data
  178. uni.hideLoading();
  179. }).catch(error => {
  180. uni.hideLoading();
  181. uni.showToast({
  182. title: error,
  183. icon: "none"
  184. })
  185. })
  186. },
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. .list {
  192. padding: 24rpx 24rpx;
  193. .item {
  194. border-radius: 8px;
  195. display: flex;
  196. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  197. background-color: rgba(255,255,255,1);
  198. // padding: 12rpx 0;
  199. margin-bottom: 12rpx ;
  200. .img {
  201. width: 72rpx;
  202. height: 72rpx;
  203. }
  204. .body {
  205. //margin: 0 12rpx;
  206. width: 100%;
  207. .line1,.line2,.line3{
  208. padding: 24rpx;
  209. }
  210. .line3{
  211. text-align: end;
  212. }
  213. .line2 {
  214. color: rgba(119,119,119,1);
  215. font-size: 24rpx;
  216. //margin-top: 8rpx;
  217. border-bottom:2rpx solid rgba(232,232,232,1);
  218. .value:not(:last-child) {
  219. margin-bottom: 16rpx;
  220. }
  221. }
  222. .line1 {
  223. display: flex;
  224. justify-content: space-between;
  225. border-bottom:2rpx solid rgba(232,232,232,1);
  226. .title {
  227. color: rgba(51, 51, 51, 1);
  228. font-size: 28rpx;
  229. font-weight: bold;
  230. }
  231. .status {
  232. background-color: rgba(255, 61, 0, 1);
  233. font-size: 24rpx;
  234. color:#fff;
  235. padding: 2rpx 8rpx;
  236. //border-radius: 8rpx;
  237. }
  238. .status0 {
  239. background-color: #FF7B00;
  240. }
  241. .status1 {
  242. background-color: #007aff;
  243. }
  244. .status2 {
  245. background-color: #ff9900;
  246. }
  247. .status3 {
  248. background-color: #19be6b;
  249. }
  250. .status4 {
  251. border: 2rpx solid rgba(255, 61, 0, 1);
  252. color: rgba(255, 61, 0, 1);
  253. }
  254. }
  255. }
  256. }
  257. // .item:not(:last-child) {
  258. // border-bottom:2rpx solid rgba(232,232,232,1);
  259. // }
  260. }
  261. .viewTop{
  262. border-bottom: 2rpx solid #e8e8e8;
  263. background-color: #fff;
  264. display: flex;
  265. justify-content: space-between;
  266. align-items: center;
  267. .select{
  268. padding: 0px 15px;
  269. font-size: 30rpx;
  270. display: flex;
  271. .selectSpan{
  272. text-align: end;
  273. width: 200rpx;
  274. overflow: hidden;
  275. text-overflow: ellipsis;
  276. white-space: nowrap; /* 禁止换行,强制单行 */
  277. }
  278. }
  279. }
  280. .search {
  281. padding: 16rpx 32rpx;
  282. background: #fff;
  283. .searchBox {
  284. display: flex;
  285. align-items: center;
  286. background: #F2F2F2;
  287. padding: 2rpx 16rpx;
  288. border-radius: 8px;
  289. justify-content: space-between;
  290. }
  291. }
  292. .floating-button {
  293. z-index: 999;
  294. position: fixed;
  295. bottom: 0; /* 距离底部 20px */
  296. width: 100%;
  297. display: flex;
  298. height: 120rpx;
  299. justify-content: center;
  300. background-color: rgba(255,255,255,1);
  301. .button{
  302. margin-top: 24rpx;
  303. border-radius: 50px;
  304. height: 80rpx;
  305. width: 80%;
  306. display: flex;
  307. align-items: center;
  308. justify-content: center;
  309. padding:12rpx;
  310. background-color: rgba(22,119,255,1);
  311. color: rgba(255,255,255,1);
  312. font-size: 36rpx;
  313. }
  314. }
  315. </style>