list.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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: 70%;"
  16. :current="current" @change="change"></u-tabs>
  17. <view class="select" @click="completionTimeShow=true">
  18. <view class="selectSpan">
  19. {{completionTimeN}}
  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.stationNo}}<span style="margin: 0 8rpx;color:rgba(119, 119, 119, 1);" >|</span>{{item.stationName}}
  33. </view>
  34. <view class="status " :class="'status'+item.status">
  35. {{item.statusN}}
  36. </view>
  37. </view>
  38. <view class="line2" v-if="item.status==0" >
  39. <view class="value">
  40. 上次巡检 {{item.lastInspectionTime}}
  41. </view>
  42. <view class="value">
  43. 截止时间 {{item.inspectionEndTime}}
  44. </view>
  45. </view>
  46. <view class="line2" v-if="item.status==1" >
  47. <view class="value">
  48. 本次巡检 {{item.inspectionTime}}
  49. </view>
  50. <view class="value">
  51. 巡检人员 {{item.inspectionUserName}}
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
  58. </view>
  59. </template>
  60. <script>
  61. import * as API from '@/apis/pagejs/pagesInspection.js'
  62. import {
  63. currentTimeStamp,
  64. parseUnixTime,newDate,nextMonth
  65. } from '@/apis/utils'
  66. export default {
  67. data() {
  68. return {
  69. queryName: "",
  70. testName: "",
  71. list:[],
  72. listForm:{
  73. pageIndex: 1,
  74. pageSize: 20,
  75. recordsTotal: 1,
  76. status:0
  77. },
  78. completionTime: "",
  79. completionTimeShow: false,
  80. lockId:"",
  81. lockName:"",
  82. current:0,
  83. tabslist:[
  84. {
  85. name: '未完成',
  86. status:0
  87. }, {
  88. name: '已完成',
  89. status:1
  90. }, {
  91. name: '全部',
  92. status:''
  93. }
  94. ]
  95. };
  96. },
  97. onLoad(op) {
  98. if(op.status){
  99. if('geterrList0'==op.status){
  100. this.current=0
  101. this.listForm.status=0
  102. }
  103. if('geterrList1'==op.status){
  104. this.current=1
  105. this.listForm.status=1
  106. }
  107. }
  108. if(op.lockId){
  109. this.lockId=op.lockId
  110. this.lockName=op.lockName
  111. this.listForm.lockId=op.lockId;
  112. }
  113. this.completionTime = parseUnixTime(currentTimeStamp(),'{y}-{m}-1')
  114. this.getList()
  115. },
  116. computed:{
  117. completionTimeN(){
  118. return parseUnixTime(newDate(this.completionTime ),'{y}年{m}月')
  119. }
  120. },
  121. onReachBottom() {
  122. if (this.list.length < this.listForm.recordsTotal) {
  123. this.myLoadmore();
  124. }
  125. },
  126. methods: {
  127. testBtn() {
  128. this.queryName=this.testName
  129. this.listForm.queryContent=this.queryName
  130. this.getList(1)
  131. },
  132. completionTimeConfirm(e) {
  133. console.log(e)
  134. this.completionTime = e.year+"-"+e.month+"-1"
  135. this.getList(1)
  136. },
  137. gotoSelectLock(){
  138. uni.navigateTo({
  139. url: '/pages/task/selectStation?isAll=1',
  140. events: {
  141. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  142. acceptDataFromOpenerPage: (item)=>{
  143. console.log(item)
  144. this.lockName=item.item.name
  145. this.listForm.lockId=item.item.id
  146. this.getList(1)
  147. this.$forceUpdate()
  148. },
  149. }
  150. })
  151. },
  152. customBack(){
  153. if(this.lockId){
  154. uni.switchTab({
  155. url:"/pages/index/index"
  156. })
  157. }else{
  158. uni.navigateBack()
  159. }
  160. },
  161. gotoTask(k){
  162. if(k.status==0){
  163. uni.navigateTo({
  164. url: '/pages/inspection/add?back=1&stationId='+k.stationId,
  165. events: {
  166. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  167. acceptDataFromOpenerPage: (data)=>{
  168. console.log(data)
  169. this.getList(1)
  170. },
  171. }
  172. })
  173. }else{
  174. uni.navigateTo({
  175. url: '/pages/inspection/info?id='+k.id,
  176. })
  177. }
  178. },
  179. change(e){
  180. this.current=e
  181. this.listForm.pageIndex=1
  182. this.listForm.status=this.tabslist[e].status
  183. this.list =[]
  184. this.getList()
  185. },
  186. myLoadmore(){
  187. this.listForm.pageIndex += 1;
  188. this.getList()
  189. },
  190. getList(bl) {
  191. if(bl){
  192. this.listForm.pageIndex = 1
  193. }
  194. uni.showLoading({
  195. title: "加载中",
  196. mask: true,
  197. })
  198. if(this.completionTime){
  199. this.listForm.startTime=this.completionTime
  200. var sz=this.completionTime.split('-')
  201. this.listForm.endTime=nextMonth(sz[0],sz[1],sz[2])
  202. }
  203. API.recordList(this.listForm).then((res) => {
  204. var list=this.list
  205. if (this.listForm.pageIndex == 1) {
  206. list = res.data.data;
  207. } else {
  208. list = [
  209. ...list,
  210. ...res.data.data
  211. ];
  212. }
  213. this.list = list
  214. this.listForm.recordsTotal=res.data.recordsTotal
  215. uni.hideLoading();
  216. }).catch(error => {
  217. uni.hideLoading();
  218. uni.showToast({
  219. title: error,
  220. icon: "none"
  221. })
  222. })
  223. },
  224. }
  225. }
  226. </script>
  227. <style lang="scss" scoped>
  228. .list {
  229. padding: 24rpx 24rpx;
  230. .item {
  231. border-radius: 16rpx;
  232. display: flex;
  233. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  234. background-color: rgba(255,255,255,1);
  235. // padding: 12rpx 0;
  236. margin-bottom: 12rpx ;
  237. .img {
  238. width: 72rpx;
  239. height: 72rpx;
  240. }
  241. .body {
  242. //margin: 0 12rpx;
  243. width: 100%;
  244. .line1,.line2,.line3{
  245. padding: 24rpx;
  246. }
  247. .line3{
  248. text-align: end;
  249. }
  250. .line2 {
  251. color: rgba(119,119,119,1);
  252. font-size: 24rpx;
  253. //margin-top: 8rpx;
  254. border-bottom:2rpx solid rgba(232,232,232,1);
  255. .value:not(:last-child) {
  256. margin-bottom: 16rpx;
  257. }
  258. }
  259. .line1 {
  260. display: flex;
  261. justify-content: space-between;
  262. border-bottom:2rpx solid rgba(232,232,232,1);
  263. .title {
  264. color: rgba(51, 51, 51, 1);
  265. font-size: 28rpx;
  266. font-weight: bold;
  267. }
  268. .status {
  269. background-color: rgba(255, 61, 0, 1);
  270. font-size: 24rpx;
  271. color:#fff;
  272. padding: 2rpx 8rpx;
  273. //border-radius: 8rpx;
  274. }
  275. .status0 {
  276. background-color: #FF7B00;
  277. }
  278. .status1 {
  279. background-color: #007aff;
  280. }
  281. .status2 {
  282. background-color: #ff9900;
  283. }
  284. .status3 {
  285. background-color: #19be6b;
  286. }
  287. .status4 {
  288. border: 2rpx solid rgba(255, 61, 0, 1);
  289. color: rgba(255, 61, 0, 1);
  290. }
  291. }
  292. }
  293. }
  294. // .item:not(:last-child) {
  295. // border-bottom:2rpx solid rgba(232,232,232,1);
  296. // }
  297. }
  298. .viewTop{
  299. border-bottom: 2rpx solid #e8e8e8;
  300. background-color: #fff;
  301. display: flex;
  302. justify-content: space-between;
  303. align-items: center;
  304. .select{
  305. padding: 0px 30rpx;
  306. font-size: 30rpx;
  307. display: flex;
  308. .selectSpan{
  309. text-align: end;
  310. width: 200rpx;
  311. overflow: hidden;
  312. text-overflow: ellipsis;
  313. white-space: nowrap; /* 禁止换行,强制单行 */
  314. }
  315. }
  316. }
  317. .search {
  318. padding: 16rpx 32rpx;
  319. background: #fff;
  320. .searchBox {
  321. display: flex;
  322. align-items: center;
  323. background: #F2F2F2;
  324. padding: 2rpx 16rpx;
  325. border-radius: 16rpx;
  326. justify-content: space-between;
  327. }
  328. }
  329. .floating-button {
  330. z-index: 999;
  331. position: fixed;
  332. bottom: 0;
  333. width: 100%;
  334. display: flex;
  335. height: 120rpx;
  336. justify-content: center;
  337. background-color: rgba(255,255,255,1);
  338. .button{
  339. margin-top: 24rpx;
  340. border-radius: 50px;
  341. height: 80rpx;
  342. width: 80%;
  343. display: flex;
  344. align-items: center;
  345. justify-content: center;
  346. padding:12rpx;
  347. background-color: rgba(22,119,255,1);
  348. color: rgba(255,255,255,1);
  349. font-size: 36rpx;
  350. }
  351. }
  352. </style>