Parcourir la source

Signed-off-by: zhaobao <528046418@qq.com>

zhaobao il y a 1 an
Parent
commit
0aabbd6103

+ 16 - 0
api/aqpt/checklistRecordHazardApi.js

@@ -0,0 +1,16 @@
+import {request} from '@/utils/request.js'
+
+export function getChecklistHazardRecordView(recordId) {
+  return request({
+    url: `/checklist/hazard/record/view/${recordId}`,
+    method: 'GET'
+  })
+}
+
+export function initChecklistHazardRecordView(data) {
+  return request({
+    url: '/checklist/hazard/record/init',
+    method: 'POST',
+    data
+  })
+}

+ 2 - 4
config/index.js

@@ -1,10 +1,8 @@
 export default {
     base: {
       // dev: 'https://api.xazhyc.com',
-	  dev: 'http://1.15.92.205:7001',
-	  // dev: 'http://192.168.3.253:7001',
-	  // dev:"http://36.137.171.123:7001",
-      // pro: 'https://api.xazhyc.com',
+	   dev: 'http://36.137.171.123:7001',
+	   //dev: 'http://192.168.3.5:7001',
 	   pro: 'http://36.137.171.123:7001'
     },
 	appID: '10007',

+ 16 - 0
pages.json

@@ -222,6 +222,22 @@
 		        "enablePullDownRefresh": false
 		    }
 		    
+		},
+		{
+			"path" : "pages/app_views/checkList/hazardRecord/hazardRecord",
+			"style" : 
+			{
+				"navigationBarTitleText" : "任务处理",
+				"enablePullDownRefresh" : false
+			}
+		},
+		{
+			"path" : "pages/app_views/checkList/hazardRecord/form",
+			"style" : 
+			{
+				"navigationBarTitleText" : "任务处理",
+				"enablePullDownRefresh" : false
+			}
 		}
     ],
 	"tabBar": {

+ 34 - 14
pages/app_views/checkList/form/form.vue

@@ -24,7 +24,7 @@
 
 <script>
 	import {upload} from '@/api/system/upload.js'	
-	import {updateChecklistPoint,getchecklistRecord} from '@/api/aqpt/checklistPoint.js'
+	import {updateChecklistPoint,getchecklistRecord,checklistComplete} from '@/api/aqpt/checklistPoint.js'
 	export default {
 		data() {
 			return {
@@ -135,23 +135,43 @@
 				// 	}
 				// })
 				// this.goOnNext();	
+				let idx=this.itemList.findIndex(item=>item.pointId===point.pointId)
+				this.itemList[idx].checkResult=this.formData.checkResult
 				this.batchHandle()
 			},
 			// 批量处理未处理的
 			batchHandle(){
 				let point=uni.getStorageSync('point')
 				if(this.handles.length<1){
-					uni.showToast({
-						icon:'none',
-						title:"处理完毕",
-						duration:1000,
-						complete() {
-							uni.redirectTo({
-								url:`/pages/app_views/checkList/index/index?type=form&id=${point.checklistId}&recordId=${point.recordId}`
+					const key=this.itemList.find(item=>item.checkResult===-1)
+					if(!key){
+						console.log('全部通过')
+						console.log({
+							itemList:JSON.parse(JSON.stringify(this.itemList))
+						})
+						checklistComplete(point.recordId,point.checklistId).then(()=>{
+							uni.$emit('type',1)						
+							uni.switchTab({
+								url:'/pages/history/history'
 							})
-						}
-					})	
-					return					
+						}).catch(()=>{
+							uni.showToast({
+								icon:"none",
+								title:"操作失败"
+							})
+						})
+					}else{
+						uni.showToast({
+							icon:'none',
+							title:"处理完毕请核实!",
+							duration:1000,
+							complete() {
+								uni.redirectTo({
+									url:`/pages/app_views/checkList/index/index?type=form&id=${point.checklistId}&recordId=${point.recordId}`
+								})
+							}
+						})
+					}				
 				}
 				let nextPoint=this.handles[0]
 				this.formData={
@@ -203,9 +223,9 @@
 				this.formData.attachList=attachList
 			},			
 		},
-		// onUnload() {			
-		// 	uni.removeStorageSync('point')
-		// }
+		onUnload() {			
+			uni.removeStorageSync('point')
+		}
 	}
 </script>
 

+ 237 - 0
pages/app_views/checkList/hazardRecord/form.vue

@@ -0,0 +1,237 @@
+<template>
+	<view class="wrap">
+		<uni-section :title="measure.hazardTitle" type="line">
+			<uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="300" label-position="top">
+				<uni-forms-item label="检查内容" required>
+				  {{measure.measureContent}}
+				</uni-forms-item>				
+				<uni-forms-item label="检查结果" name="checkResult" required>
+					<view class="uni-data-checkbox-wrap">
+						<uni-data-checkbox v-model="formData.checkResult" :localdata="checkResults" />				
+					</view>
+				</uni-forms-item>	
+				<uni-forms-item label="备注" name="remark">
+				  <uni-easyinput v-model="formData.remark" type="textarea" :maxlength="-1" autoHeight placeholder="备注" />
+				</uni-forms-item>
+				<uni-file-picker  v-model="formData.attachList" 
+				 fileMediatype="image" 
+				 title="请上传附件"
+				 limit="1"
+				 @select="uploadSuccess"
+				 @delete="deleteFile"></uni-file-picker>	
+			</uni-forms>
+		</uni-section>
+		<button type="primary" @click="onSubmit" class="submit-BT">提交</button>		
+	</view>
+</template>
+
+<script>
+import {upload} from '@/api/system/upload.js'	
+import { 
+	getChecklistHazardRecordById, 
+	updateChecklistHazardRecordDoing ,
+} from '@/api/aqpt/checklistHazardRecordApi'
+import { getChecklistHazardRecordView } from '@/api/aqpt/checklistRecordHazardApi'
+	export default {
+		data() {
+			return {
+				checkResults:[
+					{text:"通过",value:1},
+					{text:"不通过",value:-1},
+				],
+				formData:{
+					checkResult:1,	
+					remark:"",
+					attachList:[]
+				},
+				rules:{},
+				measure:{},
+				handles:[],
+				itemList:[]
+			}
+		},
+		created() {
+			this.init()
+		},
+		methods: {
+			init(){
+				let measure=uni.getStorageSync('measure');
+				this.measure=measure;
+				this.getLocation()
+				this.getchecklist()
+			},
+			getchecklist(){
+				getChecklistHazardRecordView(this.measure.recordId).then((res)=>{
+					let itemList=res.data.hazardList
+					let measures=[]						
+					for(let i=0;i<itemList.length;i++){
+						if(itemList[i].riskList){
+							itemList[i].riskList.map(child=>{
+								child.recordList.map(measure=>{
+									measures.push(measure)
+								})
+							})
+						}						
+					}
+					let index=measures.findIndex(item=>item.measureId===this.measure.measureId)
+					if(index>0){
+						let temp=measures[0];
+						measures[0]=JSON.parse(JSON.stringify(this.measure))
+						measures[index]=temp
+					}					
+					this.handles=measures					
+				})
+			},
+			getLocation(){
+				const self=this;
+				uni.getLocation({
+					type: 'wgs84',
+					success: function (res) {
+						self.formData.dutyLongitude=res.longitude
+						self.formData.dutyLatitude=res.latitude
+					}
+				});		
+			},
+			async onSubmit() {
+				let measure=uni.getStorageSync('measure')
+				let attachList=[]
+				for(let i=0;i<this.formData.attachList.length;i++){
+					let filePath=this.formData.attachList[i].url
+					let fileresq=await upload({filePath,formData:{
+						additions: `经度:${this.formData.dutyLongitude};纬度:${this.formData.dutyLatitude}`
+					}}).catch(()=>{
+						uni.showToast({
+							icon:'none',
+							title:"提交失败!"
+						})	
+					})
+					if(fileresq.includes('html')){
+						uni.showToast({
+							icon:'none',
+							title:"图片上传异常"
+						})
+						return
+					}					
+					fileresq=JSON.parse(fileresq)
+					attachList.push(fileresq.data)		
+				}
+				await updateChecklistHazardRecordDoing({
+					recordId:measure.recordId,
+					checklistId:measure.checklistId,
+					riskId:measure.riskId,
+					hazardId:measure.hazardId,
+					measureId:measure.measureId,
+					checkResult:this.formData.checkResult,
+					remark:this.formData.remark,
+					attachList,
+				}).catch(()=>{
+					uni.showToast({
+						icon:'none',
+						title:"提交失败!"
+					})				
+				})	
+				this.batchHandle()
+			},
+			// 批量处理未处理的
+			batchHandle(){
+				let measure=uni.getStorageSync('measure')
+				let handles=JSON.parse(JSON.stringify(this.handles))
+				handles.shift()	
+				this.handles=handles
+				if(handles.length<1){
+					uni.showToast({
+						icon:'none',
+						title:"处理完毕",
+						duration:1000,
+						complete() {
+							uni.redirectTo({
+								url:`/pages/index/detail/detail?type=task&name=待办任务`
+							})
+						}
+					})	
+					return					
+				}
+				this.formData={
+					checkResult:1,	
+					remark:"",
+					attachList:[]
+				}
+				uni.setStorageSync('measure',handles[0]);
+				this.measure=handles[0];								
+			},
+			// 批量处理未处理的【按顺序走到最后一个】
+			goOnNext(){
+				let point=uni.getStorageSync('point')				
+				let pointIdex=this.itemList.findIndex(item=>point.pointId===item.pointId)
+				let handles=this.itemList.slice(pointIdex+1);			
+				let nextPointIdx=handles.findIndex(item=>(!item.checkResult))
+					nextPointIdx=nextPointIdx+pointIdex
+				if(handles.length<1||nextPointIdx<0){
+					uni.showToast({
+						icon:'none',
+						title:"处理完毕",
+						duration:1000,
+						complete() {
+							uni.redirectTo({
+								url:`/pages/app_views/checkList/index/index?type=form&id=${point.checklistId}&recordId=${point.recordId}`
+							})
+						}
+					})	
+					return
+				}			
+				this.formData={
+					checkResult:1,	
+					remark:"",
+					attachList:[]
+				}						
+				let nextPoint=this.itemList[nextPointIdx+1]				
+				uni.setStorageSync('measure',nextPoint);//防止测试刷新数据丢失
+				this.measure=nextPoint;					
+			},
+			uploadSuccess(e){
+				let attachList=JSON.parse(JSON.stringify(this.formData.attachList))
+				attachList.push(e.tempFiles[0])
+				this.formData.attachList=attachList
+			},
+			deleteFile(e){							
+				let attachList=JSON.parse(JSON.stringify(this.formData.attachList))
+				attachList.filter(item=>item.uuid!==e.tempFile.uuid)
+				this.formData.attachList=attachList
+			},			
+		},
+		onUnload() {			
+			uni.removeStorageSync('point')
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+.wrap{
+	padding: 20rpx;
+	padding-bottom: 200rpx;
+	.submit-BT {
+		width: 750rpx;
+		color: #4D73FF;
+		text-align: center;
+		font-size: 32rpx;
+		padding-bottom: 68rpx;
+		background-color: #fff;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		z-index: 99;
+		box-shadow: 0px 0px 12px 0px #0000000A;
+		border-radius: 8px 8px 0px 0px
+	}
+	::v-deep .uni-forms-item{
+		.uni-forms-item__content{
+			.uni-data-checkbox-wrap{
+				height: 100%;
+				display: flex;
+				align-items: center;					
+			}
+	
+		}		
+	}
+}
+</style>

+ 242 - 0
pages/app_views/checkList/hazardRecord/hazardRecord.vue

@@ -0,0 +1,242 @@
+<template>
+	<view class="page">
+		<view class="wrap">
+			<template v-if="itemList.length>0">
+				<view class="checklist" v-for="(hazardlist,idx) in itemList" :key="idx">
+					<view class="title more">{{hazardlist.hazardTitle}}</view>
+					<view class="item-cont" v-if="hazardlist.riskList&&hazardlist.riskList.length>0">
+						<view class="checklistItem" v-for="(riskItem,itemIdx) in hazardlist.riskList" :key="itemIdx">
+							<view class="itemTitle more"> {{riskItem.riskTitle}}</view>
+							<view  class="point-cont" v-if="riskItem.recordList&&riskItem.recordList.length>0">
+								<view class="point" v-for="(measure,measureIdx) in riskItem.recordList" :key="measureIdx" @click="check(measure)">
+									<view class="pointContent">
+											<text style="padding-right: 5px;">{{measureIdx+1}})</text>
+											<text>{{measure.measureContent}}</text>
+									</view>
+									<view class="status">{{measure.checkResult|checkResultFilter}}</view>
+								</view>
+							</view>
+						</view>				
+					</view>				
+				</view>
+				<view class="handle-container">	
+					<view class="handle" @click="handleSubmit(1)">全部通过</view>
+					<view class="handle" @click="handleSubmit(2)">全不通过</view>	
+					<view class="handle" @click="handleSubmit(3)">提交</view>
+					<view class="handle" @click="handleSubmit(4)">撤销</view>
+					<view class="handle" @click="handleSubmit(5)">转交</view>
+				</view>
+			</template>
+			<template v-else>没有可处理的清单^-_-^</template>
+		</view>		
+	</view>
+</template>
+<script>
+import { getChecklistHazardRecordView } from '@/api/aqpt/checklistRecordHazardApi'
+import { batchUpdateChecklistHazardRecordDoing } from '@/api/aqpt/checklistHazardRecordApi'
+import {cancelCheckTask,completeCheckTask} from '@/api/aqpt/task.js'	
+	export default {
+		data() {
+			return {
+				defaultProps: {
+					id: 'itemId', 
+					children: 'children',
+					label: 'itemTitle'
+				},
+				accountInfo:{},
+				divider: false,
+				edit: true,
+				itemList:[],
+				recordId:undefined,
+				checklistId:undefined,
+				handleVisiable:false,
+				type:undefined,
+				status:undefined,
+				taskTitle:""
+			}
+		},
+		  filters: {
+		    checkResultFilter(i) {
+			  if (i >= 0) {
+			    const strs = [
+			      '未检查',
+			      '通过'
+			    ]
+			    return strs[i]
+			  } else {
+			    if (i === -1) {
+			      return '未通过'
+			    } else if (i === -2) {
+			      return '发现隐患'
+			    }
+			  }
+		    }
+		  },
+		onLoad({rid,cid,title}) {
+			this.checklistId=cid	
+			this.recordId=rid	
+			let accountInfo=uni.getStorageSync('accountInfo')
+			this.accountInfo=accountInfo
+			this.taskTitle=title
+			this.getchecklistRecord(rid)
+		},
+		methods: {
+			getchecklistRecord(recordId){
+				getChecklistHazardRecordView(recordId).then((res)=>{
+					this.itemList=res.data.hazardList
+					this.status=res.data.status				
+				})
+			},
+			check(measure){		
+				uni.setStorageSync("measure",measure)
+				uni.navigateTo({
+					url:"/pages/index/handle/task/hazardRecord/form"
+				})								
+			},
+			handleSubmit(type){
+				let recordId=this.recordId;
+				let checklistId=this.checklistId;
+				if(type===1){
+					batchUpdateChecklistHazardRecordDoing(recordId,1).then(()=>{
+						this.getchecklistRecord(checklistId,recordId)
+					})
+				}
+				if(type===2){
+					batchUpdateChecklistHazardRecordDoing(recordId,-1).then(()=>{
+						this.getchecklistRecord(checklistId,recordId)
+					})
+				}				
+				if(type===3){//完成
+					completeCheckTask(recordId).then(()=>{				
+						uni.switchTab({
+							url:'/pages/index/index'
+						})
+					}).catch(()=>{
+						uni.showToast({
+							icon:"none",
+							title:"操作失败"
+						})
+					})
+				}
+				if(type===4){//放弃
+					cancelCheckTask(recordId).then(()=>{
+						uni.switchTab({
+							url:'/pages/index/index'
+						})
+					}).catch(()=>{
+						uni.showToast({
+							icon:"none",
+							title:"操作失败"
+						})
+					})
+				}	
+				if(type===5){//转交
+					let taskTitle=this.taskTitle;
+					uni.navigateTo({
+						url:`/pages/index/handle/task/checkList/form/transferCheckTask?tid=${recordId}&title=${taskTitle}`
+					})
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.page{
+		background-color: #F5F6F8;
+		padding: 20rpx;
+		min-height: 100vh;
+		box-sizing: border-box;
+		margin-bottom: 100rpx;
+		.page-head{
+			text-align: right;
+			padding-bottom: 10rpx;
+			.handle{
+				display: inline-block;
+				background-color: #3384FF;
+				color: #fff;
+				padding: 10rpx 15rpx;
+				box-sizing: border-box;
+				border-right: 1rpx solid #eaeaea;
+				font-size: 30rpx;
+				text-align: center;
+				&:nth-child(4){
+					border: 0;
+				}
+			}
+		}
+	}	
+	.wrap{
+		padding: 20rpx;
+		background-color: #fff;
+		.checklist{
+			.title{
+				color: #222222;
+				font-size: 32rpx;
+				height: 98rpx;
+				line-height: 98rpx;
+				overflow: hidden;
+				text-overflow: ellipsis;
+				border-bottom: 1px dashed #E8E8E8;				
+			}
+			.more{
+				background-image: url('/static/tree_more.png');
+				background-size: 30rpx 30rpx;
+				padding-left: 40rpx;
+				background-position: center left;
+				background-repeat: no-repeat;
+			}
+			.item-cont{
+				padding-left: 20rpx;
+				border-bottom: 1px dashed #E8E8E8;	
+				.checklistItem{
+					.itemTitle{
+						color: #222222;
+						font-size: 32rpx;	
+						height: 98rpx;
+						line-height: 98rpx;
+					}
+				}
+				.point-cont{
+					padding-left: 30rpx;
+					.point{
+						display: flex;						
+						color: #666;
+						font-size: 28rpx;	
+						// height: 98rpx;
+						// line-height: 98rpx;
+						.pointContent{
+							flex: 1;
+						}
+					}
+				}
+			}
+		}
+			
+		.handle-container{
+			position: fixed;
+			width: 100%;
+			left: 0;
+			bottom: 0;
+			background-color: #fff;
+			display: flex;
+			justify-content: center;
+			align-items: center;
+			border-top: 1rpx solid #eaeaea;
+			.handle{
+				display:block;
+				background-color: #3384FF;
+				color: #fff;
+				padding: 15rpx 0;
+				width: 20%;
+				box-sizing: border-box;
+				border-right: 1rpx solid #eaeaea;
+				font-size: 26rpx;
+				text-align: center;
+				&:last-child{
+					border: 0;
+				}
+			}
+		}
+	}
+</style>

+ 1 - 6
pages/app_views/checkList/index/index.vue

@@ -74,12 +74,7 @@
 				this.handleVisiable=true
 			}else{
 				this.getchecklistRecord(id,recordId)			
-			}
-		},
-		onShow() {
-			let point=uni.getStorageSync('point')
-			if(!point)return			
-			this.getchecklistRecord(point.checklistId,point.recordId)	
+			}		
 		},
 		methods: {
 			async initCheckList(checklistId){

+ 1 - 1
pages/app_views/problem_feedback/record/record.vue

@@ -8,7 +8,7 @@
 			<view class="attach-wrap">
 				<view class="lable">附件</view>
 				<view class="attach-cont">
-					<image :src="attach.fileUrl" class="attach" mode="widthFix" v-for="(attach,index) in viewData.attachList" @click="showImg(index,viewData.attachList)"></image>							
+					<image :src="attach.fileUrl" class="attach" mode="widthFix" v-for="(attach,index) in viewData.attachList" @click="showImg(index,viewData.attachList)" :key="index"></image>							
 				</view>		
 			</view>
 		</view>