<template>
	<view style="background-color: #fff;padding-bottom: 110rpx;" v-if="deptList.length != 0">
		<u-radio-group v-model="checkboxValue1" placement="column" iconPlacement="right"  @change="checkboxChange">
			<u-collapse accordion @open="open">
				<u-collapse-item :title='dateChange'>			
					<view class="checkitem" v-for=" i in deptList" :key="i.NO" >
						<u-radio shape="square"  :label="i.status+'--'+i.name" :name="i.userId" size="24" @change="change2(i)"> </u-radio >
					</view>	
				</u-collapse-item>
			</u-collapse>
		</u-radio-group>
		<view style="position: fixed;bottom: 0;left: 0;width: 100%;height: 100rpx;background-color: #fff;box-sizing: border-box;padding: 20rpx;">
			<u-button type="primary" text="确认" @click="submit"></u-button>
		</view>
	</view>
</template>

<script>
import checkbox from '../../uni_modules/uview-ui/libs/config/props/checkbox'
	export default {
		data() {
			return {
				checkboxValue1:[],
				userList: [],
				deptList: [],
				allUserList: [],
				nameList:[],
				idList:[],
				dateChange:null,
				userChange:null
			}
		},
		onLoad(options){
			this.dateChange=options.dataChange+' '+'值班人员'
			// this.getjsPeo(options)
			this.gettiaobanPeople(options)
		},
		onNavigationBarButtonTap(e) {


		},
		methods: {
			gettiaobanPeople(options){
				uni.$u.http.post('/duty/duty/getConditionUsers',{
					dateStr:options.dataChange
				}).then((res)=>{
					console.log(res)
					this.deptList=res.rows
				})
			},
			change2(val){
				console.log('val',val)
				this.userChange=val.status+'-'+val.name
			},
			//获取下一节点接收人信息
			// getjsPeo(options) {
			// 	uni.$u.http.get('/jflow/restful/GenerNextStepNodeEmps', {
			// 		params: {
			// 			workid: options.workid,
			// 			token: uni.getStorageSync('jtoken'),
			// 			flowNo: options.flowNo,
			// 			toNodeID: options.id
			// 		}
			// 	}).then(res => {
			// 		console.log(res)
			// 		if(getApp().globalData.peoList.length != 0){
			// 			this.nameList = getApp().globalData.peoList.split(",")
			// 			this.idList = getApp().globalData.peoDeptList.split(",")
			// 			this.checkboxValue1 = getApp().globalData.peoIdList.split(",")
			// 		}
			// 		this.allUserList = res.Emps;
			// 		this.userList = res.Emps;
			// 		this.$forceUpdate()
			// 		if(res.Depts.length>1&&res.Depts[0].Name=="河北省卫计委综合监督执法局"){
			// 			this.deptList = res.Depts.splice(1)
			// 		}else{
			// 			this.deptList = res.Depts
			// 		}
					
			// 	})
			// },
			// //选择人员
			checkboxChange(e){
				console.log('e',e)
				
			},
			//折叠面板打开
			open(e){
				// console.log(e)
			},
			// change2(e){
			// 	if(this.nameList.indexOf(e.Name)==-1){
			// 		this.nameList.push(e.Name)
			// 		this.idList.push(e.FK_Dept)
			// 	}else{
			// 		this.nameList.splice(this.nameList.indexOf(e.Name),1)
			// 		this.idList.splice(this.nameList.indexOf(e.Name),1)
			// 	}
			// },
			submit(){
				console.log('submit',this.checkboxValue1)
				if(this.checkboxValue1.length == 0){
					uni.showToast({
						title:"请选择人员",
						icon:"none"
					})
				}else{
					getApp().globalData.adjustUserId=this.checkboxValue1
					getApp().globalData.user=this.userChange
					console.log(this.userChange)
					// getApp().globalData.peoList = this.nameList.join(",")
					// getApp().globalData.peoIdList = this.checkboxValue1.join(",")
					// getApp().globalData.peoDeptList = this.idList.join(",")
					uni.$emit('query' , {a : 'one'})
					uni.navigateBack()
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.checkitem{
		// display: flex;
		// align-items: center;
		// justify-content: space-between;
		font-size: 32rpx;
		padding: 20rpx 0;
		border-bottom: 1px solid #eaeaea;

	}
	::v-deep .u-collapse-item__content__text{
		background-color: #f7f7f7;
	}
	::v-deep .u-cell__title-text{
		font-size: 32rpx;
	}
</style>
