<template>
	<view class="" style="background-color:#fff;">
		<view class="uni-flex uni-row" style="display: flex;align-items: center;">
			物料
			<uni-easyinput ref='scanInput' v-model="partCode" @confirm="confirmPartCode" @clear="clear"
				style='font-size: 18px;padding: 10rpx 20rpx;' placeholder="请输入物料号" @iconClick="">
			</uni-easyinput>
		</view>
		<view class="">
			<u-select v-model="showPartCode" mode="single-column" :list="list" @confirm="confirmSelectPartCode">
			</u-select>
		</view>
	</view>

</template>

<script>
	export default {
		components: {},

		data() {
			return {
				partCode: "",
				showPartCode: false,
			}
		},
		props: {
			list: {
				type: Object,
				default: []
			}

		},
		watch: {
			// recommend

		},
		methods: {
			confirmPartCode() {
				if (this.partCode == '') {
					uni.showToast({
						title: "请扫描物料"
					})
					return;
				}
				this.showPartCode = true;
			},
			confirmSelectPartCode(e) {
				this.partCode = e[0].label
				this.$emit("confirmSelectPartCode", this.partCode)

			},
			clear() {
				this.partCode = "";
				this.$emit("clearPartCode", this.partCode)
			}
		}
	}
</script>

<style>
</style>
