<template>
	<view>
		<u-form-item
			:label="label"
			:prop="prop"
			:required="required"
			@click="visible = true"
		>
			<div class="select_content">
				<u-input
					:value="name || '请选择'"
					border="none"
					input-align="right"
					readonly
				></u-input>
				<u-icon name="arrow-right" />
			</div>
		</u-form-item>
		<u-line />
		<hidden-level
			:value="id"
			:visible.sync="visible"
			:is-show-neglect="isShowNeglect"
			:is-show-more="isShowMore"
			:is-show-major="isShowMajor"
			@confirm="fnConfirm"
		/>
	</view>
</template>

<script>
import HiddenLevel from "./hidden_level.vue";

export default {
	components: { HiddenLevel },

	props: {
		label: {
			type: String,
			default: "隐患级别",
		},
		prop: {
			type: String,
			default: "",
		},
		required: {
			type: Boolean,
			default: true,
		},
		isShowNeglect: {
			type: Boolean,
			default: true,
		},
		isShowMore: {
			type: Boolean,
			default: true,
		},
		isShowMajor: {
			type: Boolean,
			default: true,
		},
		name: {
			type: String,
			required: true,
		},
		id: {
			type: String,
			required: true,
		},
	},

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

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

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