<template>
	<view>
		<uni-data-select v-model="selVaule" :localdata="range" :placeholder="placeholder" :disabled="disabled" @change="onchange"></uni-data-select>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	const selVaule = defineModel({
		type: String
	});
	
	const props = defineProps(["placeholder","disabled"]);
	const range = ref([]);
	const userZone = uni.getStorageSync('userZone');
	const userOperation = uni.getStorageSync('userOperation');
	for (let i = 0, len = userZone.length; i < len; i++) { 
	  const item = userZone[i];
		for (let j = 0, len = userOperation.length; j < len; j++) {
			const oitem = userOperation[j];
			if(oitem.zoneId != item.id) continue;
			const sitem = {
				value: oitem.regionId,
				text: item.name + '-' + oitem.regionName
			}
			range.value.push(sitem);
		}
	}
	
	const onchange = (value) => {
		if (value == "") return;
		selVaule.value = value;
	}
</script>

<style>
</style>