<template>
  <view class="uni-flex u-col-center" style="padding-top: 15rpx; padding-bottom: 15rpx; padding-left: 10rpx; padding-right: 10rpx; font-size: 32rpx">
    <view class="uni-flex uni-row u-col-center" @click="showLocation">
      <view style="font-size: 30rpx">
        {{ title }}
        <!-- <text style="font-size: 35rpx;">{{title}}&nbsp {{locationCode}} </text> -->
        <text style="font-size: 25rpx; color: #3fbaff" v-if="locationCode == '' && isShowEdit == true">&nbsp 请扫描</text>
        <text style="font-size: 25rpx; color: #3fbaff">&nbsp {{ locationCode }}</text>
      </view>
      <image v-if="isShowEdit" style="width: 30rpx; height: 30rpx; margin: 6rpx 10rpx 0px; display: inline-block" src="/static/icons/icons_edit.svg"></image>
    </view>
    <win-scan-location ref="scanLocationCode" :title="title" @getLocation="getLocation" :locationAreaTypeList="locationAreaTypeList"></win-scan-location>
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import winScanLocation from '@/mycomponents/scan/winScanLocation.vue'

const props = defineProps({
  title: {
    type: String,
    default: '需求库位'
  },
  locationCode: {
    type: String,
    default: ''
  },
  isShowEdit: {
    type: Boolean,
    default: true
  },
  locationAreaTypeList: {
    type: Array,
    default: null
  }
})
const scanLocationCode = ref()
const showLocation = () => {
  if (props.isShowEdit) {
    scanLocationCode.value.openScanPopup()
  }
}
// 扫描源库位
const getLocation = (location, code) => {
  emit('getLocation', location, code)
}

// 传递给父类
const emit = defineEmits(['getLocation'])
</script>

<style></style>
