listTask.vue 10 KB

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