listTask.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  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. <u-select v-model="selectTaskInfoCode" :default-value="selectTaskInfoCodeValue" value-name="value"
  14. label-name="name" @confirm="selectTaskInfoCodeConfirm" :list="codeList"></u-select>
  15. <u-picker mode="time" v-model="completionTimeShow" @confirm="completionTimeConfirm"
  16. :default-time="completionTime" :params="params"></u-picker>
  17. <view class="viewTop" >
  18. <u-tabs :list="tabslist"
  19. style=" width: 50%;"
  20. :current="current" @change="change"></u-tabs>
  21. <view class="select" @click="selectTaskInfoCodeBtn">
  22. <view class="selectSpan">
  23. {{codeN?codeN:'全部类型'}}
  24. </view>
  25. <u-icon name="arrow-down" size="32" color="#AAAAAA"></u-icon>
  26. </view>
  27. <view class="select" @click="completionTimeShow=true">
  28. <view class="selectSpan">
  29. {{completionTimeN}}
  30. </view>
  31. <u-icon name="arrow-down" size="32" color="#AAAAAA"></u-icon>
  32. </view>
  33. </view>
  34. <view class="list" >
  35. <view class="item"
  36. v-for="(item,index) in list"
  37. @click="gotoTask(item)"
  38. :key="index">
  39. <view class="body">
  40. <view class="line1">
  41. <view class="title">
  42. {{item.errorCodeText}}
  43. </view>
  44. <view class="status " :class="'status'+item.status">
  45. {{item.statusN}}
  46. </view>
  47. </view>
  48. <view class="line2">
  49. <view class="value" v-if="item.deviceName">
  50. 设备编号 {{item.deviceName}}
  51. </view>
  52. <view class="value">
  53. 设备网点 {{item.stationName}}
  54. </view>
  55. <view class="value">
  56. 创建时间 {{item.createTime}}
  57. </view>
  58. </view>
  59. <view class="line3">
  60. <u-button type="info" v-if="item.status==1" size="mini">查看</u-button>
  61. <u-button type="primary" v-if="item.status==0" size="mini" >去处理</u-button>
  62. </view>
  63. </view>
  64. </view>
  65. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
  66. </view>
  67. <view class="floating-button">
  68. <view class="button" @click="gotoUrl('/pages/task/addTask')" >
  69. 故障上报
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import * as API from '@/apis/pagejs/pagesTask.js'
  76. import {
  77. currentTimeStamp,
  78. parseUnixTime,newDate,nextMonth
  79. } from '@/apis/utils'
  80. export default {
  81. data() {
  82. return {
  83. queryName: "",
  84. testName: "",
  85. list:[],
  86. codeList:[],
  87. listForm:{
  88. pageIndex: 1,
  89. pageSize: 20,
  90. recordsTotal: 1,
  91. status:0
  92. },
  93. lockId:"",
  94. lockName:"",
  95. codeN: "",
  96. code: "",
  97. selectTaskInfoCode: false,
  98. selectTaskInfoCodeValue: [0],
  99. completionTime: "",
  100. completionTimeShow: false,
  101. params: {
  102. year: true,
  103. month: true,
  104. day: false,
  105. hour: false,
  106. minute: false,
  107. second: false,
  108. timestamp: false,
  109. },
  110. current:0,
  111. tabslist:[
  112. {
  113. name: '待处理'
  114. }, {
  115. name: '已处理'
  116. }
  117. ]
  118. };
  119. },
  120. onLoad(op) {
  121. if(op.status){
  122. if('geterrList0'==op.status){
  123. this.current=0
  124. this.listForm.status=0
  125. }
  126. if('geterrList1'==op.status){
  127. this.current=1
  128. this.listForm.status=1
  129. }
  130. }
  131. if(op.lockId){
  132. this.lockId=op.lockId
  133. this.lockName=op.lockName
  134. this.listForm.lockId=op.lockId;
  135. }
  136. this.completionTime = parseUnixTime(currentTimeStamp(),'{y}-{m}-1')
  137. this.findByCatalogName({
  138. catalogName: '设备故障类型'
  139. }, "codeList")
  140. this.getList()
  141. },
  142. onReachBottom() {
  143. if (this.list.length < this.listForm.recordsTotal) {
  144. this.myLoadmore();
  145. }
  146. },
  147. computed:{
  148. completionTimeN(){
  149. return parseUnixTime(newDate(this.completionTime ),'{y}年{m}月')
  150. }
  151. },
  152. methods: {
  153. testBtn() {
  154. this.queryName=this.testName
  155. this.listForm.queryContent=this.queryName
  156. this.getList()
  157. },
  158. completionTimeConfirm(e) {
  159. console.log(e)
  160. this.completionTime = e.year+"-"+e.month+"-1"
  161. this.getList(1)
  162. },
  163. findByCatalogName(obj, listName) {
  164. API.findByCatalogName(obj).then((res) => {
  165. var arr = res.data.dataDictionaryList
  166. this.codeList = [
  167. {
  168. name:"全部类型",
  169. value: ""
  170. },
  171. ...arr
  172. ]
  173. }).catch(error => {
  174. uni.hideLoading();
  175. uni.showToast({
  176. title: error,
  177. icon: "none"
  178. })
  179. })
  180. },
  181. selectTaskInfoCodeBtn() {
  182. if (this.code) {
  183. //this.selectTaskInfoCodeValue=[parseInt(this.bindInfo.type)-1]
  184. var i = this.codeList.findIndex(item => {
  185. return item.value == this.code
  186. })
  187. this.selectTaskInfoCodeValue = [i]
  188. }
  189. this.selectTaskInfoCode = true;
  190. },
  191. selectTaskInfoCodeConfirm(e) {
  192. console.log(e)
  193. this.codeN = e[0].label
  194. this.code = e[0].value
  195. this.listForm.errorCode=this.code
  196. this.getList(1)
  197. },
  198. gotoSelectLock(){
  199. uni.navigateTo({
  200. url: '/pages/task/selectStation?isAll=1',
  201. events: {
  202. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  203. acceptDataFromOpenerPage: (item)=>{
  204. console.log(item)
  205. this.lockName=item.item.name
  206. this.listForm.lockId=item.item.id
  207. this.getList(1)
  208. this.$forceUpdate()
  209. },
  210. }
  211. })
  212. },
  213. customBack(){
  214. if(this.lockId){
  215. uni.switchTab({
  216. url:"/pages/index/index"
  217. })
  218. }else{
  219. uni.navigateBack()
  220. }
  221. },
  222. gotoTask(k){
  223. uni.navigateTo({
  224. url: '/pages/task/maintenanceTaks?id='+k.id,
  225. events: {
  226. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  227. acceptDataFromOpenerPage: (data)=>{
  228. console.log(data)
  229. this.getList(1)
  230. },
  231. }
  232. })
  233. },
  234. change(e){
  235. this.current=e
  236. this.listForm.pageIndex=0
  237. this.listForm.status=e
  238. this.list =[]
  239. this.getList()
  240. },
  241. myLoadmore(){
  242. this.listForm.pageIndex += 1;
  243. this.getList()
  244. },
  245. getList(bl) {
  246. if(bl){
  247. this.listForm.pageIndex = 1
  248. }
  249. uni.showLoading({
  250. title: "加载中",
  251. mask: true,
  252. })
  253. if(this.completionTime){
  254. this.listForm.startTime=this.completionTime
  255. var sz=this.completionTime.split('-')
  256. this.listForm.endTime=nextMonth(sz[0],sz[1],sz[2])
  257. }
  258. API.errList(this.listForm).then((res) => {
  259. var list=this.list
  260. if (this.listForm.pageIndex == 1) {
  261. list = res.data.data;
  262. } else {
  263. list = [
  264. ...list,
  265. ...res.data.data
  266. ];
  267. }
  268. this.list = res.data.data
  269. uni.hideLoading();
  270. }).catch(error => {
  271. uni.hideLoading();
  272. uni.showToast({
  273. title: error,
  274. icon: "none"
  275. })
  276. })
  277. },
  278. }
  279. }
  280. </script>
  281. <style lang="scss" scoped>
  282. .list {
  283. padding: 24rpx 24rpx;
  284. padding-bottom: 120rpx;
  285. .item {
  286. border-radius: 16rpx;
  287. display: flex;
  288. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  289. background-color: rgba(255,255,255,1);
  290. // padding: 12rpx 0;
  291. margin-bottom: 12rpx ;
  292. .img {
  293. width: 72rpx;
  294. height: 72rpx;
  295. }
  296. .body {
  297. //margin: 0 12rpx;
  298. width: 100%;
  299. .line1,.line2,.line3{
  300. padding: 24rpx;
  301. }
  302. .line3{
  303. text-align: end;
  304. }
  305. .line2 {
  306. color: rgba(119,119,119,1);
  307. font-size: 24rpx;
  308. //margin-top: 8rpx;
  309. border-bottom:2rpx solid rgba(232,232,232,1);
  310. .value:not(:last-child) {
  311. margin-bottom: 16rpx;
  312. }
  313. }
  314. .line1 {
  315. display: flex;
  316. justify-content: space-between;
  317. border-bottom:2rpx solid rgba(232,232,232,1);
  318. .title {
  319. color: rgba(51, 51, 51, 1);
  320. font-size: 28rpx;
  321. font-weight: bold;
  322. }
  323. .status {
  324. background-color: rgba(255, 61, 0, 1);
  325. font-size: 24rpx;
  326. color:#fff;
  327. padding: 2rpx 8rpx;
  328. //border-radius: 8rpx;
  329. }
  330. .status0 {
  331. background-color: #FF7B00;
  332. }
  333. .status1 {
  334. background-color: #007aff;
  335. }
  336. .status2 {
  337. background-color: #ff9900;
  338. }
  339. .status3 {
  340. background-color: #19be6b;
  341. }
  342. .status4 {
  343. border: 2rpx solid rgba(255, 61, 0, 1);
  344. color: rgba(255, 61, 0, 1);
  345. }
  346. }
  347. }
  348. }
  349. // .item:not(:last-child) {
  350. // border-bottom:2rpx solid rgba(232,232,232,1);
  351. // }
  352. }
  353. .viewTop{
  354. border-bottom: 2rpx solid #e8e8e8;
  355. background-color: #fff;
  356. display: flex;
  357. justify-content: space-between;
  358. align-items: center;
  359. .select{
  360. padding: 0px 10rpx;
  361. font-size: 30rpx;
  362. display: flex;
  363. .selectSpan{
  364. text-align: end;
  365. overflow: hidden;
  366. text-overflow: ellipsis;
  367. white-space: nowrap; /* 禁止换行,强制单行 */
  368. }
  369. }
  370. }
  371. .search {
  372. padding: 16rpx 32rpx;
  373. background: #fff;
  374. .searchBox {
  375. display: flex;
  376. align-items: center;
  377. background: #F2F2F2;
  378. padding: 2rpx 16rpx;
  379. border-radius: 16rpx;
  380. justify-content: space-between;
  381. }
  382. }
  383. .floating-button {
  384. z-index: 999;
  385. position: fixed;
  386. bottom: 0;
  387. width: 100%;
  388. display: flex;
  389. height: 120rpx;
  390. justify-content: center;
  391. background-color: rgba(255,255,255,1);
  392. .button{
  393. margin-top: 24rpx;
  394. border-radius: 50px;
  395. height: 80rpx;
  396. width: 80%;
  397. display: flex;
  398. align-items: center;
  399. justify-content: center;
  400. padding:12rpx;
  401. background-color: rgba(22,119,255,1);
  402. color: rgba(255,255,255,1);
  403. font-size: 36rpx;
  404. }
  405. }
  406. </style>