
 <template>
 	<view class="operation-body">
 		<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110upx" leftWidth="200rpx" leftText="选择监控"
 			leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
 		<multiple-select
 			class="multipleSelect"
 		      v-model="formData.vchannels"
 		      :data="vchannelOptions"
 		      :default-selected="defaultSelected"
 		      @confirm="saveConfirm"
			  @cancel = "saveCancel"
 			  :value="multipleShow"
 		    ></multiple-select>
	</view>
 </template>
 
 <script>
 	var that;
 	
	import multipleSelect from "./../../components/multiple-select.vue";
 	import nonNullCheck from './../../utils/nonNullCheck.js';
 	export default {
 		name: "operation",
 		components: {
 		    multipleSelect,
 		  },
 		data() {
 			return {
				defaultSelected: [], //默认选中项
				serviceList: [],//传递给子组件的数据
 				formData: {
 					algo: '',
					vchannels:[],
 				},
				multipleShow:true,
 				vchannelOptions: [],
 			}
 		},
 		
 		onLoad(params) {
 			this.formData.algo = params.algo;
 		},
 		onShow() {
 			this.getVchannelOptions();
 		},
 		methods: {
 			getVchannelOptions() {
				this.$u.api.tdevice({ type: 60, page: 0}).then(res=>{
					this.vchannelOptions = res;
				})
 			},
 			saveConfirm(data){
				debugger;
				console.log(data)
				let that = this;
				let ids = [];
				data.forEach(item=>{
					ids.push(item.id)
				})
				that.formData.vchannels = ids;
				console.log(that.formData)
				// that.$u.api.algoCreate(that.formData).then(res=>{
				// 	uni.navigateBack({
				// 		delta: 1
				// 	})
				// })
			},
			saveCancel(){
				uni.navigateBack({
					delta: 1
				})
			},
 			/* 参数验证 */
 			paramsCheck() {
 				
 				if (!nonNullCheck(this.formData.area)) {
 					uni.showToast({
 						title: '请选择监控设备',
 						icon: "none"
 					})
 					return false;
 				}
 				
 				return true;
 			},
 			goBack() {
 				uni.navigateBack({
 					delta: 1
 				})
 			},
 			
 			
 		}
 	}
 </script>
 
 <style scoped>
 	/* 主体 */
 	>>>.uni-navbar__header,
 	>>>.uni-status-bar {
 		background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
 	}
 	.operation-body {
 		background-color: #f3fbff;
 		padding-bottom: 20rpx;
 	}
 	.operation-body>>>uni-input {
 		/* height: 100%; */
 		font-size: 30rpx;
 	}
 
 	>>>.uni-navbar-btn-text text {
 		font-size: 32rpx !important;
 	}
 

	.multipleSelect{
	}
 </style>
 