<!-- *******************  服务措施  *******************  -->
<template>
	<view class="picker-box">
		<view class="u-flex u-row-between" @click="openPicker">
			<view class="txt u-flex-1">{{item.fieldsTitle}}</view>
			<u-icon name="arrow-right" color="#666" size="28"></u-icon>
		</view>
		<u-picker v-model="showPicker" :rangeKey="rangeKey" @columnchange="columnchange" mode="multiSelector" @confirm="pickerConfirm" :default-selector='[0, 1]' :range="settings"></u-picker>
	</view>
</template>

<script>
	import objMixin from './objMixin'
	export default {
		name: 'XhPicker',
		components: {},
		mixins: [objMixin],
		props: {
			// 当mode=selector或者mode=multiSelector时，提供的默认选中的下标
			defaultSelector: {
				type: Array,
				default() {
					return [0];
				}
			},
			// 当 range 是一个 Array＜Object＞ 时，通过 range-key 来指定 Object 中 key 的值作为选择器显示内容
			rangeKey: {
				type: String,
				default: ''
			},
		},
		filters:{},
		data() {
			return {
				showPicker:false,
				settings:[
					[1, 2, 3], 
					[4, 5, 6]
				]
			}
		},
		computed: {
			// settings() {
			// 	let setting = [
			// 		[1, 2, 3], 
			// 		[4, 5, 6]
			// 	]
			// 	return setting
			// 	// return this.item.settings || []
			// }
		},
		watch: {},
		mounted() {},
		methods: {
			openPicker(){
				this.showPicker = true
			},
			pickerConfirm(data){
				
				let result = []
				data&&data.map((item,index)=>{
					let val = this.settings[index][item]
					result.push(val)
				})
				this.dataValue = result
				this.valueChange(result)
			},
			columnchange(data){
				// 树列改变时进行联动操作
				const {column ,index} = data
				let arr = [9,10,50]
				this.settings.splice(column+1,1,arr)
			},
		}
	}
</script>
<style lang="scss" scoped>

</style>
