| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 | 
							- <template>
 
- 	<view class="warning-handle-page">
 
- 	  <uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="300" label-position="top">
 
- 		<uni-forms-item label="处理动作"  required >
 
- 			<div class="uni-data-checkbox-wrap">
 
- 				 <view class="action":class="action===1?'active':''" @click="changeAction(1)">  
 
- 					<text>完成处理</text>
 
- 				 </view>
 
- 				 <view class="action":class="action===2?'active':''" @click="changeAction(2)">  
 
- 					<text>转交</text>
 
- 				 </view>
 
- 			</div>
 
- 		</uni-forms-item>
 
- 		<uni-forms-item v-if="handleRemarkVisible" label="原因分析" prop="actionRemark">
 
- 		  <uni-easyinput v-model="formData.warnReason" type="textarea" :maxlength="-1" autoHeight placeholder="原因分析" />
 
- 		</uni-forms-item>
 
- 		<uni-forms-item v-if="handleRemarkVisible" label="处理措施" prop="actionRemark">
 
- 		  <uni-easyinput v-model="formData.handleMeasure" type="textarea" :maxlength="-1" autoHeight placeholder="处理说明" />
 
- 		</uni-forms-item>
 
- 		<uni-forms-item v-if="handlerVisible" label="执行人" prop="accountIdTo">
 
- 		  <uni-data-select v-model="formData.accountId" :localdata="userList"></uni-data-select>
 
- 		</uni-forms-item>
 
- 		<uni-forms-item v-if="handlerVisible" label="备注" prop="remark">
 
- 			<uni-easyinput v-model="transferData.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>	
 
- 		<view class="btn-group">
 
- 		  <uni-button type="primary" @click="handleSubmit">提交</uni-button>
 
- 		</view>
 
- 	  </uni-forms>		
 
- 	</view>
 
- </template>
 
- <script>
 
- 	import {getUserList} from '@/api/system/user.js'
 
- 	import { getWarningById, completeWarning, transferWarning } from '@/api/aqpt/warningApi'
 
- 	export default {
 
- 		data() {
 
- 			return {
 
- 				formData:{
 
- 					warnId: undefined,
 
- 					attachList: []					
 
- 				},
 
- 				transferData:{
 
- 					
 
- 				},
 
- 				viewData:{},
 
- 				rules:{},
 
- 				userList:[],
 
- 				action:1,
 
- 				warnId:undefined,
 
- 				handleRemarkVisible:false,
 
- 				handlerVisible:false
 
- 			}
 
- 		},
 
- 		created() {
 
- 			this.changeAction(1)
 
- 			this.getUserList()
 
- 		},
 
- 		onLoad({id}) {
 
- 			this.warnId=id	
 
- 			this.getData()
 
- 		},
 
- 		methods: {
 
- 			// Fetch Data
 
- 			getData() {
 
- 			  const warnId = this.warnId
 
- 			  getWarningById(warnId).then((resp) => {
 
- 				const { data } = resp
 
- 				this.viewData = data
 
- 			  })
 
- 			},			
 
- 			changeAction(iMode){
 
- 			  this.action=iMode;
 
- 			  if (iMode === 1) {
 
- 				this.handleRemarkVisible = true
 
- 				this.handlerVisible = false
 
- 			  } else if (iMode === 2) {
 
- 				this.handleRemarkVisible = false
 
- 				this.handlerVisible = true
 
- 			  }				
 
- 			},
 
- 			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
 
- 				})
 
- 			},	
 
- 			// 提交
 
- 			handleSubmit() {
 
- 				  const action = this.action
 
- 				  if (action === 1) {
 
- 					completeWarning(this.formData).then((resp) => {
 
- 					  const { msg } = resp
 
- 					  uni.showToast({
 
- 						icon:"none",
 
- 						title:msg||'处理成功!'
 
- 					  })
 
- 					  setTimeout(()=>{
 
- 					  	uni.navigateBack()  
 
- 					  },1000)
 
- 					})
 
- 				  } else {
 
- 					let user=this.userList.filter(item=>this.formData.accountId===item.accountId)[0]
 
- 					this.handleSelectUser(user)
 
- 					transferWarning(this.warnId, this.transferData).then((resp) => {
 
- 					  const { msg } = resp
 
- 					  uni.showToast({
 
- 						icon:"none",
 
- 						title:msg||'处理成功!'
 
- 					  })
 
- 					  setTimeout(()=>{
 
- 						uni.navigateBack()  
 
- 					  },1000)
 
- 					})
 
- 				}
 
- 			},
 
- 			handleSelectUser(obj) {
 
- 			  this.transferData.accountIdTo = obj.accountId
 
- 			  this.transferData.groupIdTo = obj.groupId
 
- 			  this.transferData.positionIdTo = obj.positionId
 
- 			  this.transferData.accountNameTo = obj.accountName
 
- 			  this.transferData.groupNameTo = obj.groupName
 
- 			  this.transferData.positionNameTo = obj.positionName
 
- 			},					
 
- 		}
 
- 	}
 
- </script>
 
- <style lang="scss" scoped>
 
- .warning-handle-page{
 
- 	padding: 32rpx;
 
- 	::v-deep .uni-forms-item{
 
- 		.uni-forms-item__content{
 
- 			.uni-data-checkbox-wrap{
 
- 				height: 100%;
 
- 				display: flex;
 
- 				align-items: center;
 
- 				.action{
 
- 					padding: 22rpx 32rpx;
 
- 					background-color: #fff;
 
- 					border-radius: 2px;
 
- 					margin-right: 20rpx;
 
- 					font-size: 28rpx;
 
- 					line-height: 1;
 
- 					&.active{
 
- 						background: rgba(77, 115, 255, 0.16);
 
- 						color: #4D73FF;
 
- 					}
 
- 				}
 
- 			}
 
- 	
 
- 		}		
 
- 	}
 
- 	.btn-group{
 
- 		margin-top: 100rpx;
 
- 	}
 
- }
 
- </style>
 
 
  |