listTask.vue 6.3 KB

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