listTask.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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.lockId){
  77. this.lockId=op.lockId
  78. this.lockName=op.lockName
  79. this.listForm.lockId=op.lockId;
  80. }
  81. this.getList()
  82. },
  83. onReachBottom() {
  84. if (this.list.length < this.listForm.recordsTotal) {
  85. this.myLoadmore();
  86. }
  87. },
  88. methods: {
  89. gotoSelectLock(){
  90. uni.navigateTo({
  91. url: '/pages/task/selectLock?isAll=1',
  92. events: {
  93. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  94. acceptDataFromOpenerPage: (item)=>{
  95. console.log(item)
  96. this.lockName=item.item.name
  97. this.listForm.lockId=item.item.id
  98. this.getList(1)
  99. this.$forceUpdate()
  100. },
  101. }
  102. })
  103. },
  104. customBack(){
  105. if(this.lockId){
  106. uni.switchTab({
  107. url:"/pages/index/index"
  108. })
  109. }else{
  110. uni.navigateBack()
  111. }
  112. },
  113. gotoTask(k){
  114. uni.navigateTo({
  115. url: '/pages/task/maintenanceTaks?id='+k.id,
  116. events: {
  117. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  118. acceptDataFromOpenerPage: (data)=>{
  119. console.log(data)
  120. this.getList(1)
  121. },
  122. }
  123. })
  124. },
  125. change(e){
  126. this.current=e
  127. this.listForm.pageIndex=0
  128. this.listForm.status=e
  129. this.list =[]
  130. this.getList()
  131. },
  132. myLoadmore(){
  133. this.listForm.pageIndex += 1;
  134. this.getList()
  135. },
  136. getList(bl) {
  137. if(bl){
  138. this.listForm.pageIndex = 1
  139. }
  140. uni.showLoading({
  141. title: "加载中",
  142. mask: true,
  143. })
  144. API.errList(this.listForm).then((res) => {
  145. var list=[]
  146. if (this.listForm.pageIndex == 1) {
  147. list = res.data.data;
  148. } else {
  149. list = [
  150. ...list,
  151. ...res.data.data
  152. ];
  153. }
  154. this.list = res.data.data
  155. uni.hideLoading();
  156. }).catch(error => {
  157. uni.hideLoading();
  158. uni.showToast({
  159. title: error,
  160. icon: "none"
  161. })
  162. })
  163. },
  164. }
  165. }
  166. </script>
  167. <style lang="scss" scoped>
  168. .list {
  169. padding: 24rpx 32rpx;
  170. background-color: rgba(255,255,255,1);
  171. .item {
  172. display: flex;
  173. border-bottom: 1px solid rgba(232, 232, 232, 1);
  174. padding: 12rpx 0;
  175. margin: 12rpx 0;
  176. .img {
  177. width: 72rpx;
  178. height: 72rpx;
  179. }
  180. .body {
  181. margin: 0 12rpx;
  182. width: 100%;
  183. .line1,
  184. .line2 {
  185. display: flex;
  186. justify-content: space-between;
  187. }
  188. .line2 {
  189. color: rgba(119,119,119,1);
  190. font-size: 24rpx;
  191. margin-top: 8rpx;
  192. }
  193. .line1 {
  194. .title {
  195. color: rgba(51, 51, 51, 1);
  196. font-size: 28rpx;
  197. font-weight: bold;
  198. }
  199. .status {
  200. background-color: rgba(255, 61, 0, 1);
  201. font-size: 24rpx;
  202. color:#fff;
  203. padding: 2rpx 8rpx;
  204. //border-radius: 4px;
  205. }
  206. .status0 {
  207. background-color: rgba(255, 61, 0, 1);
  208. }
  209. .status1 {
  210. background-color: #007aff;
  211. }
  212. .status2 {
  213. background-color: #ff9900;
  214. }
  215. .status3 {
  216. background-color: #19be6b;
  217. }
  218. .status4 {
  219. border: 1px solid rgba(255, 61, 0, 1);
  220. color: rgba(255, 61, 0, 1);
  221. }
  222. }
  223. .errorDesc{
  224. margin: 8rpx 0;
  225. width: 480rpx;
  226. color: #777777;
  227. font-size: 24rpx;
  228. overflow: hidden;
  229. text-overflow: ellipsis;
  230. white-space: nowrap; /* 禁止换行,强制单行 */
  231. }
  232. }
  233. }
  234. // .item:not(:last-child) {
  235. // border-bottom:1px solid rgba(232,232,232,1);
  236. // }
  237. }
  238. .viewTop{
  239. border-bottom: 1px solid #e8e8e8;
  240. background-color: #fff;
  241. display: flex;
  242. justify-content: space-between;
  243. align-items: center;
  244. .select{
  245. padding: 0px 15px;
  246. font-size: 30rpx;
  247. display: flex;
  248. .selectSpan{
  249. text-align: end;
  250. width: 200rpx;
  251. overflow: hidden;
  252. text-overflow: ellipsis;
  253. white-space: nowrap; /* 禁止换行,强制单行 */
  254. }
  255. }
  256. }
  257. </style>