Browse Source

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

zhaobao 1 năm trước cách đây
mục cha
commit
43dd856b13

+ 34 - 1
api/aqpt/task.js

@@ -40,4 +40,37 @@ export function getMyWaitingTaskTop(limit) {
     url: `/task/myWaiting/top/${limit}`,
     method: 'GET'
   })
-}
+}
+/**
+ * Transfer CheckTask
+ * @param data
+ */
+export function transferCheckTask(data) {
+  return request({
+    url: `/check/task/transfer`,
+    method: 'PUT',
+    data
+  })
+}
+
+/**
+ * Cancel CheckTask
+
+ * @param taskId
+ */
+export function cancelCheckTask(taskId) {
+  return request({
+    url: `/check/task/cancel/${taskId}`,
+    method: 'PUT'
+  })
+}
+/**
+ * Complete CheckTask
+ * @param taskId
+ */
+export function completeCheckTask(taskId) {
+  return request({
+    url: `/check/task/complete/${taskId}`,
+    method: 'PUT'
+  })
+}

+ 11 - 0
api/aqpt/taskApi.js

@@ -137,3 +137,14 @@ export function cancelTask(taskId) {
     method: 'PUT'
   })
 }
+/**
+ * 列表查询我的待办Task:
+ * @param limit待办数目
+ * @returns
+ */
+export function getMyWaitingTaskTop(limit) {
+  return request({
+    url: `/task/myWaiting/top/${limit}`,
+    method: 'GET'
+  })
+}

+ 8 - 0
pages.json

@@ -128,6 +128,14 @@
 				"navigationBarTitleText" : "告警处理",
 				"enablePullDownRefresh" : false
 			}
+		},
+		{
+			"path" : "pages/index/handle/task/checkList/form/transferCheckTask",
+			"style" : 
+			{
+				"navigationBarTitleText" : "转交任务",
+				"enablePullDownRefresh" : false
+			}
 		}
     ],
 	"tabBar": {

+ 136 - 0
pages/index/handle/task/checkList/form/transferCheckTask.vue

@@ -0,0 +1,136 @@
+<template>
+	<view class="wrap">
+		<uni-section :title="title" type="line">
+			<uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="300" label-position="top">
+				<uni-forms-item label="执行人" name="accountId" required>
+				  <uni-data-select v-model="accountId" :localdata="userList"></uni-data-select>
+				</uni-forms-item>				
+				<uni-forms-item label="备注" name="remark">
+				  <uni-easyinput v-model="formData.taskDesc" type="textarea" :maxlength="-1" autoHeight placeholder="备注" />
+				</uni-forms-item>
+			</uni-forms>
+		</uni-section>
+		<button type="primary" @click="onSubmit" class="submit-BT">提交</button>		
+	</view>
+</template>
+
+<script>
+	import {transferCheckTask} from '@/api/aqpt/task.js'
+	import {getUserList,} from '@/api/system/user.js'	
+	export default {
+		data() {
+			return {
+				userList:[],
+				accountId:undefined,						
+				formData:{
+					taskId: undefined,
+					groupIdTo: undefined,
+					positionIdTo: undefined,
+					accountIdTo: undefined, // 执行人
+					groupNameTo: undefined,
+					positionNameTo: undefined,
+					accountNameTo: undefined,
+					taskDesc:""
+				},
+				rules:{},
+				title:"任务转交"
+			}
+		},
+		onBackPress() {
+
+		},
+		onLoad({tid,title}) {
+			this.formData.taskId=tid;
+			this.title=title;
+			this.getUserList()
+		},
+		methods: {
+			getUserList(){
+				getUserList().then((res)=>{
+					var userList=[]
+					for (var i = 0; i < res.data.length; i++) {
+						userList.push({
+								value: -i, 
+								text: res.data[i].name,
+								disable:true
+						})
+						for(let j = 0; j < res.data[i].children.length; j++){
+							userList.push({
+								...res.data[i].children[j],
+								value: res.data[i].children[j].accountId, 
+								text: res.data[i].children[j].accountName
+							})							
+						}
+					}
+					this.userList=userList
+				})
+			},			
+			async onSubmit() {
+				let user=this.userList.filter(item=>this.accountId===item.accountId)[0]
+				this.handleUser(user)					
+				if(!this.accountId){
+					uni.showToast({
+						icon:'none',
+						title:"请选择转交人员"
+					})	
+					return
+				}
+				await transferCheckTask(this.formData).then(()=>{
+					uni.showToast({
+						icon:'none',
+						title:"转交成功!",
+						complete() {
+							uni.switchTab({
+								url:'/pages/index/index'
+							})
+						}
+					})					
+				})
+				.catch(()=>{
+					uni.showToast({
+						icon:'none',
+						title:"提交失败!"
+					})				
+				})
+			},
+			handleUser(user){
+				this.formData.groupIdTo=user.groupId,
+				this.formData.positionIdTo=user.positionId
+				this.formData.accountIdTo=user.accountId
+				this.formData.groupNameTo=user.groupName
+				this.formData.positionNameTo=user.positionName
+				this.formData.accountNameTo=user.accountName			
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+.wrap{
+	padding: 20rpx;
+	.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>

+ 57 - 25
pages/index/handle/task/task.vue

@@ -1,5 +1,9 @@
 <template>
 	<view class="page">
+<!-- 		<view class="page-head">
+			<view class="handle" @click="handleSubmit(1)">全部通过</view>
+			<view class="handle" @click="handleSubmit(2)">全不通过</view>				
+		</view> -->
 		<view class="wrap">
 			<template v-if="itemList.length>0">
 				<view class="checklist" v-for="(checklist,idx) in itemList" :key="idx">
@@ -28,11 +32,12 @@
 						</view>				
 					</view>					
 				</view>
-				<view class="handle-container" v-if="handleVisiable">
-					<view class="handle" @click="handleSubmit(3)">全部通过</view>
-					<view class="handle" @click="handleSubmit(4)">全不通过</view>				
-					<view class="handle" @click="handleSubmit(1)">提交</view>
-					<view class="handle" @click="handleSubmit(2)">撤销</view>				
+				<view class="handle-container" v-if="handleVisiable">	
+					<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>
@@ -46,6 +51,7 @@
 		checklistCancel,
 		checklistBatchUpdate,
 	} from '@/api/aqpt/checklistPoint.js'
+	import {cancelCheckTask,completeCheckTask} from '@/api/aqpt/task.js'	
 	export default {
 		data() {
 			return {
@@ -62,14 +68,16 @@
 				checklistId:undefined,
 				handleVisiable:false,
 				type:undefined,
-				status:undefined
+				status:undefined,
+				taskTitle:""
 			}
 		},
-		onLoad({rid,cid}) {
+		onLoad({rid,cid,title}) {
 			this.checklistId=cid	
 			this.recordId=rid	
 			let accountInfo=uni.getStorageSync('accountInfo')
 			this.accountInfo=accountInfo
+			this.taskTitle=title
 			this.getchecklistRecord(cid,rid)
 		},
 		methods: {
@@ -90,8 +98,18 @@
 			handleSubmit(type){
 				let recordId=this.recordId;
 				let checklistId=this.checklistId;
-				if(type===1){//完成
-					checklistComplete(recordId,checklistId).then(()=>{				
+				if(type===1){
+					checklistBatchUpdate(recordId,1).then(()=>{
+						this.getchecklistRecord(checklistId,recordId)
+					})
+				}
+				if(type===2){
+					checklistBatchUpdate(recordId,-1).then(()=>{
+						this.getchecklistRecord(checklistId,recordId)
+					})
+				}				
+				if(type===3){//完成
+					completeCheckTask(recordId).then(()=>{				
 						uni.switchTab({
 							url:'/pages/index/index'
 						})
@@ -102,8 +120,8 @@
 						})
 					})
 				}
-				if(type===2){//放弃
-					checklistCancel(recordId).then(()=>{
+				if(type===4){//放弃
+					cancelCheckTask(recordId).then(()=>{
 						uni.switchTab({
 							url:'/pages/index/index'
 						})
@@ -113,17 +131,13 @@
 							title:"操作失败"
 						})
 					})
-				}
-				if(type===3){
-					checklistBatchUpdate(recordId,1).then(()=>{
-						this.getchecklistRecord(checklistId,recordId)
+				}	
+				if(type===5){//转交
+					let taskTitle=this.taskTitle;
+					uni.navigateTo({
+						url:`/pages/index/handle/task/checkList/form/transferCheckTask?tid=${recordId}&title=${taskTitle}`
 					})
 				}
-				if(type===4){
-					checklistBatchUpdate(recordId,-1).then(()=>{
-						this.getchecklistRecord(checklistId,recordId)
-					})
-				}			
 			}
 		}
 	}
@@ -136,6 +150,23 @@
 		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;
@@ -183,6 +214,7 @@
 				}
 			}
 		}
+			
 		.handle-container{
 			position: fixed;
 			width: 100%;
@@ -194,16 +226,16 @@
 			align-items: center;
 			border-top: 1rpx solid #eaeaea;
 			.handle{
-				display: inline-block;
+				display:block;
 				background-color: #3384FF;
 				color: #fff;
-				padding: 15rpx 20rpx;
-				width: 25%;
+				padding: 15rpx 0;
+				width: 20%;
 				box-sizing: border-box;
 				border-right: 1rpx solid #eaeaea;
-				font-size: 30rpx;
+				font-size: 26rpx;
 				text-align: center;
-				&:nth-child(4){
+				&:last-child(){
 					border: 0;
 				}
 			}

+ 7 - 3
pages/index/index.vue

@@ -207,7 +207,7 @@
 	import {getRecentListByLimit,getArtByList} from '@/api/system/art.js'
 	import { getAlertByPage } from '@/api/aqpt/alertApi.js';
 	import { getDangerByPage } from '@/api/aqpt/dangerApi.js';
-	import { getTaskByPage } from '@/api/aqpt/taskApi.js';
+	import { getTaskByPage,getMyWaitingTaskTop } from '@/api/aqpt/taskApi.js';
 	import { getMyWarningWaitingTop } from '@/api/aqpt/warning.js';	
 	import { handleCheckTask } from '@/api/aqpt/checkTaskApi'
 	import{
@@ -327,7 +327,11 @@
 					this.dangerList=res.data
 					this.dangerTotal=res.total
 				})
-				getTaskByPage(params).then((res)=>{
+				// getTaskByPage(params).then((res)=>{
+				// 	this.taskList=res.data
+				// 	this.taskTotal=res.total
+				// })	
+				getMyWaitingTaskTop(5).then((res)=>{
 					this.taskList=res.data
 					this.taskTotal=res.total
 				})				
@@ -358,7 +362,7 @@
 					// } else if (checklistTypeId === 3) {// ScoreRecordView											  
 					// }					
 					uni.navigateTo({
-						url:`/pages/index/handle/task/task?rid=${item.taskId}&cid=${checklistId}`
+						url:`/pages/index/handle/task/task?rid=${item.taskId}&cid=${checklistId}&title=${item.taskTitle}`
 					})	
 				})