Browse Source

故障记录

zhengkaixin 1 month ago
parent
commit
baf3b4e7b6
3 changed files with 405 additions and 39 deletions
  1. 307 0
      pages/task/listTask.vue
  2. 80 36
      pages/task/maintenanceTaks.vue
  3. 18 3
      pages/task/selectLock.vue

+ 307 - 0
pages/task/listTask.vue

@@ -0,0 +1,307 @@
+<template>
+	<view>
+		<u-navbar title="故障记录" title-color="#101010" :customBack="customBack" ></u-navbar>
+		<view  class="viewTop" >
+			<u-tabs :list="tabslist" 
+			 style="   width: 50%;"
+			 :current="current" @change="change"></u-tabs>
+			 <view class="select" @click="gotoSelectLock">
+				<view class="selectSpan">
+					{{lockName?lockName:'选择地锁'}}
+				</view>
+				 <u-icon name="arrow-down" size="32" color="#AAAAAA"></u-icon>
+			 </view>
+		</view>
+		
+
+		<view class="list"  >
+			<view class="item" 
+			 v-for="(item,index) in list" 
+			 @click="gotoTask(item)"
+			 :key="index">
+				<view class="icon">
+					
+					<image class="img" v-if="item.errorCodeImage" :src="item.errorCodeImage" mode=""></image>
+					
+					<image class="img" v-else src="@/assets/img/taskstatus/status3.png" mode=""></image>
+				</view>
+				<view class="body">
+					<view class="line1">
+						<view class="title">
+							{{item.errorCodeText}}
+		
+						</view>
+						<view class="status " :class="'status'+item.status">
+							{{item.statusN}}
+		
+						</view>
+					</view>
+					
+					<view class="line2">
+						<view class="value">
+							{{item.createTime}}
+		
+						</view>
+						<view class="value">
+							{{item.parkingName}} 
+		
+						</view>
+					</view>
+					<view class="errorDesc" v-if="item.errorDesc">
+						描述:{{item.errorDesc}}
+						
+					</view>
+		
+				</view>
+				<u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
+			</view>
+			
+			
+		</view>
+		<u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
+		
+	</view>
+</template>
+
+<script>
+	import * as API from '@/apis/pagejs/pagesTask.js'
+	
+	export default {
+		data() {
+			return {
+				list:[],
+				listForm:{
+					pageIndex: 1,
+					pageSize: 20,
+					recordsTotal: 1,
+					status:0
+				},
+				lockId:"",
+				lockName:"",
+				current:0,
+				tabslist:[
+					{
+						name: '待处理'
+					}, {
+						name: '已处理'
+					}
+				]
+			};
+		},
+		onLoad(op) {
+			if(op.lockId){
+				this.lockId=op.lockId
+				this.lockName=op.lockName
+				this.listForm.lockId=op.lockId;
+			}
+			this.getList()
+		},
+		onReachBottom() {
+			if (this.list.length < this.listForm.recordsTotal) {
+				this.myLoadmore();
+			}
+		},
+		methods: {
+			gotoSelectLock(){
+				uni.navigateTo({
+				  url: '/pages/task/selectLock?isAll=1',
+				  events: {
+				    // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
+				    acceptDataFromOpenerPage: (item)=>{
+						console.log(item)
+						
+						this.lockName=item.item.name
+						this.listForm.lockId=item.item.id
+						this.getList(1)
+						this.$forceUpdate()
+						
+				    },
+				 
+				  }
+				 
+				})
+			},
+			customBack(){
+				if(this.lockId){
+					uni.reLaunch({
+						url:"/pages/index/index"
+					})
+				}else{
+					uni.navigateBack()
+				}
+			},
+			gotoTask(k){
+				uni.navigateTo({
+				  url: '/pages/task/maintenanceTaks?id='+k.id,
+				  events: {
+				    // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
+				    acceptDataFromOpenerPage: (data)=>{
+						console.log(data)
+						this.getList(1)
+				    },
+				 
+				  }
+				 
+				})
+			},
+			change(e){
+				this.current=e
+				this.listForm.pageIndex=0
+				this.listForm.status=e
+				this.list =[]
+				this.getList()
+			},
+			
+			myLoadmore(){
+				this.listForm.pageIndex += 1;
+				this.getList()
+			},
+			getList(bl) {
+				if(bl){
+					this.listForm.pageIndex = 1
+				}
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+							 
+				API.errList(this.listForm).then((res) => {
+					var list=[]
+					
+					if (this.listForm.pageIndex == 1) {
+						list = res.data.data;
+					} else {
+						list = [
+							...list,
+							...res.data.data
+						];
+					}
+					this.list = res.data.data
+					uni.hideLoading();
+				
+				}).catch(error => {
+				
+					uni.hideLoading();
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+		}
+		
+	}
+</script>
+
+<style lang="scss" scoped>
+
+		.list {
+			padding: 24rpx 32rpx;
+background-color: rgba(255,255,255,1);
+			.item {
+				display: flex;
+				border-bottom: 1px solid rgba(232, 232, 232, 1);
+				padding: 12rpx 0;
+				margin: 12rpx 0;
+
+				.img {
+					width: 72rpx;
+					height: 72rpx;
+
+				}
+
+				.body {
+					margin: 0 12rpx;
+					width: 100%;
+
+					.line1,
+					.line2 {
+
+						display: flex;
+						justify-content: space-between;
+					}
+					.line2 {
+						color: rgba(119,119,119,1);
+						font-size: 24rpx;
+						margin-top: 8rpx;
+					}
+					.line1 {
+						.title {
+							color: rgba(51, 51, 51, 1);
+							font-size: 28rpx;
+							font-weight: bold;
+						}
+
+						.status {
+							background-color:  rgba(255, 61, 0, 1);
+							font-size: 24rpx;
+							color:#fff;
+							padding: 2rpx 8rpx;
+							//border-radius: 4px;
+
+						}
+						
+						.status0 {
+							background-color:  rgba(255, 61, 0, 1);
+							
+						}
+						.status1 {
+							background-color:  #007aff;
+							
+						}
+
+						.status2 {
+							background-color:  #ff9900;
+							
+						}
+
+						.status3 {
+							background-color:  #19be6b;
+							
+						}
+
+						.status4 {
+							border: 1px solid rgba(255, 61, 0, 1);
+							color: rgba(255, 61, 0, 1);
+						}
+					}
+					
+					.errorDesc{
+						margin: 8rpx 0;
+						 width: 480rpx;
+						     color: #777777;
+						     font-size: 24rpx;
+						 overflow: hidden;
+						    text-overflow: ellipsis;
+						    white-space: nowrap; /* 禁止换行,强制单行 */
+					}
+				}
+			}
+
+			// .item:not(:last-child) {
+			//   border-bottom:1px solid rgba(232,232,232,1);
+			// }
+		}
+		
+		.viewTop{
+			border-bottom: 1px solid #e8e8e8;
+			background-color: #fff;
+			    display: flex;
+			    justify-content: space-between;
+				    align-items: center;
+					.select{
+						    padding: 0px 15px;
+							font-size: 30rpx;
+							    display: flex;
+								
+							.selectSpan{
+								    text-align: end;
+								width: 200rpx;
+								overflow: hidden;
+								   text-overflow: ellipsis;
+								   white-space: nowrap; /* 禁止换行,强制单行 */
+							}
+					}
+				
+		}
+</style>

+ 80 - 36
pages/task/maintenanceTaks.vue

@@ -1,6 +1,9 @@
 <template>
 	<view  class="jpmain  " >
-			<u-navbar  title="维修结果" title-color="#101010"></u-navbar>
+			<u-navbar  title="维修结果" title-color="#101010"></u-navbar>
+			
+			
+			
 			<view class="list" >
 				<view class="item">
 					<view class="name">
@@ -12,28 +15,43 @@
 						
 					</view>
 				</view>
-				<view class="item item-plus">
-					
+				<view class="item item-plus"  v-if="floorlockErrorRecord.errorDesc">
+					<view class="name">
+						问题描述				
+					</view>
 					<view class="value">
 						{{floorlockErrorRecord.errorDesc}}
 						
 					</view>
 				</view>
-				<view class="item item-plus">
-					
+				<view class="item item-plus" v-if="imgList.length">
+					<view class="name">
+						照片				
+					</view>
 					<view class="value" style="display: block;">
-						<img  class="viewImg" v-for="(item,i) in imgList" :key="i"
+						<img  class="viewImg" v-for="(item,i) in imgList"
+						  @click="previewImage(i,'imgList')"
+						 :key="i"
 						 :src="item" mode=""></img>
 						
 					</view>
 				</view>
 				
+				<view class="item">
+					<view class="name">
+						创建时间
 				
+					</view>
+					<view class="value">
+						{{floorlockErrorRecord.createTime}}
+						
+					</view>
+				</view>
 			</view>
 			
 			
 			<view class="list" >
-				<view class="item">
+				<view class="item"  @click="gotoUrl('/pages/lockTab/dataLock?id='+floorlockInfo.id)" >
 					<view class="name">
 						地锁编号
 				
@@ -77,35 +95,58 @@
 				
 			</view>
 			<view class="list" >
-				
+				<view class="item">
+					<view class="name">
+						处理时间
+				
+					</view>
+					<view class="value">
+						{{floorlockErrorRecord.updateTime}}
+						
+					</view>
+				</view>
 				<view class="item item-plus"  >
 					<view class="name">
-						问题描述
-				
+						处理结果				
 					</view>
-					<view class="value" >
-						<textarea placeholder="请简单描述处理内容" 
+					<view class="value"  v-if="floorlockErrorRecord.status==0" >
+						<textarea placeholder="请记录处理步骤及结果" 
 						placeholder-class="textareaclass"
 						v-model="taskInfo.desc"
 						class="textarea"></textarea>
+					</view>
+					<view class="value"  v-else >
+						<textarea placeholder="请记录处理步骤及结果" 
+						placeholder-class="textareaclass"
+						v-model="floorlockErrorRecord.repairDesc"
+						class="textarea"></textarea>
 					</view>
 				</view>
 				<view class="item item-plus"  >
 					<view class="name">
-						上传图片
+						现场照片
+
 				
 					</view>
-					<view class="value" >
+					<view class="value" v-if="floorlockErrorRecord.status==0" >
 						<u-upload name="photoFile"
 								ref="uUpload"
 								 :form-data="formData" :header="header" :action="action"
 								  :file-list="listPic" ></u-upload>
+					</view>
+					<view class="value"  v-else >
+						
+						<img  class="viewImg" v-for="(item,i) in repairImageList"
+						  @click="previewImage(i,'repairImageList')"
+						 :key="i"
+						 :src="item" mode=""></img>
+						 
 					</view>
 				</view>
 			</view>
 			
 			
-			<view class="floating-button">
+			<view class="floating-button"  v-if="floorlockErrorRecord.status==0" >
 				<view class="button"  @click="submit" >
 					
 					提交
@@ -148,13 +189,17 @@
 				codeList:[],
 				id:"",
 				imgList:[],
+				repairImageList:[],
 			};
 		},
 		onLoad(op) {
 			this.action=process.jphelp.BASE_URL+"uploadPicture"
 			this.formData.subFolder="/floorlock/inspection/updateErr"
 			var token=this.jphelp.getToken()
-			
+			this.header={
+					
+				'Authorization':token
+			}
 			this.id=op.id
 			this.errDetails()
 			
@@ -168,12 +213,12 @@
 			})
 		},
 		methods:{
-			previewImage(img) {
-				let imgs = [];
-				imgs.push(img);
+			previewImage(i,name) {
+				let imgs = this[name];
+				//imgs.push(img);
 				uni.previewImage({
 					urls: imgs,
-					current: 0
+					current: i
 				})
 			},
 			navigate() {
@@ -185,6 +230,9 @@
 				uni.showLoading({
 			
 				})
+				setTimeout(()=>{
+					uni.hideLoading()
+				},3*1000)
 				WxJsApi.openLocation({
 					latitude: parseFloat(item.latitude), //目的地latitude
 					longitude: parseFloat(item.longitude), //目的地longitude
@@ -218,6 +266,9 @@
 					if(this.floorlockErrorRecord.errorImage){
 						this.imgList=this.floorlockErrorRecord.errorImage.split(',')
 					}
+					if(this.floorlockErrorRecord.repairImage){
+						this.repairImageList=this.floorlockErrorRecord.repairImage.split(',')
+					}
 					
 					uni.hideLoading();
 				
@@ -231,18 +282,7 @@
 				})
 			},
 			submit(){
-				if(!this.taskInfo.lockId){
-					uni.showToast({
-						title:"选择需要上报的地锁"
-					})
-					 return
-				}
-				if(!this.taskInfo.code){
-					uni.showToast({
-						title:"请选择故障类型"
-					})
-					 return
-				}
+				
 				
 				let files = [];
 				// 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
@@ -259,7 +299,7 @@
 				})
 				//(imgUrl);
 				this.taskInfo.images = imgUrl.join(',');
-				
+				this.taskInfo.id=this.id;
 				
 				
 				uni.showLoading({
@@ -267,12 +307,16 @@
 					mask: true,
 				})
 				
-				API.errDetails(this.taskInfo).then((res) => {
+				API.updateErr(this.taskInfo).then((res) => {
+					
+					const eventChannel = this.getOpenerEventChannel();
+					
+					eventChannel.emit('acceptDataFromOpenerPage', {})
 					
 					uni.showModal({
 						title: '提示',
 						showCancel: false,
-						content: "上报成功",
+						content: "操作成功",
 						success: res1 => {
 							if (res1.confirm) {
 								uni.navigateBack()
@@ -281,7 +325,7 @@
 							}
 						}
 					})
-				
+					
 					uni.hideLoading();
 				
 				}).catch(error => {

+ 18 - 3
pages/task/selectLock.vue

@@ -11,7 +11,18 @@
 				</view>
 			</view>
 		</view>
-		<view class="body2">
+		<view class="body2">
+			<view class="item" v-if="isAll"  @click="returnName( {id:''})">
+				<view class="v">
+					
+			
+					<view class="v1" >
+						查询全部
+					</view>
+					
+				</view>
+				<u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
+			</view>
 			<view class="item" v-for="(item,i) in list" :key="i"
 				@click="returnName( item)">
 				<view class="v">
@@ -46,10 +57,14 @@
 				list: [],
 				testName: "",
 				queryName: "",
-				type: 1,
+				type: 1,
+				isAll: 0,
 			};
 		},
-		onLoad(op) {
+		onLoad(op) {
+			if (op.isAll) {
+				this.isAll = op.isAll
+			}
 			if (op.type) {
 				this.type = op.type
 			}