<template>
	<view>
		<u-form-item
			:label="label"
			:prop="prop"
			:required="required"
			@click="visible = true"
		>
			<view class="select_content">
				<u-input
					:value="name || '请选择'"
					border="none"
					input-align="right"
					readonly
				/>
				<u-icon name="arrow-right"></u-icon>
			</view>
		</u-form-item>
		<u-line />
		<hidden-type :visible.sync="visible" :value="id" @confirm="fnConfirm" />
	</view>
</template>

<script>
import HiddenType from "./hidden_type.vue";

export default {
	components: { HiddenType },

	props: {
		name: {
			type: String,
			required: true,
		},
		id: {
			type: String,
			required: true,
		},
		label: {
			type: String,
			default: "隐患类型",
		},
		prop: {
			type: String,
			default: "",
		},
		required: {
			type: Boolean,
			default: true,
		},
	},

	data() {
		return {
			visible: false,
		};
	},

	methods: {
		fnConfirm(evt) {
			this.name = evt[0].name;
			this.id = evt[0].id;
			this.visible = false;
		},
	},
};
</script>

<style scoped lang="scss"></style>
