廖井涛
2025-03-25 768e16999a8ce4bb500490ee76c659aa61ea1783
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<script setup>
import {defineEmits, ref} from "vue";
 
const value1 = ref('')
const value2 = ref('')
 
const options1 = [
  {
    value: 'Option1',
    label: '5',
  },
  {
    value: 'Option2',
    label: '6',
  },
  {
    value: 'Option3',
    label: '8',
  },
  {
    value: 'Option4',
    label: '10',
  },
  {
    value: 'Option5',
    label: '12',
  },
]
const options2 = [
  {
    value: 'Option1',
    label: '白玻',
  },
  {
    value: 'Option2',
    label: '灰镜',
  },
  {
    value: 'Option3',
    label: 'Low-e',
  },
]
 
const emit = defineEmits(['send-data-inventory',]);
const props = defineProps({
  closeDialog: Function
});
 
const CheckInventory = () => {
  const selectedLabel1 = options1.find((option) => option.value === value1.value)?.label || '';
  const selectedLabel2 = options2.find((option) => option.value === value2.value)?.label || '';
  // 判断两个值是否都被选择了,如果有一个为空字符串,则提示并返回,不执行后续操作
  if (!selectedLabel1 ||!selectedLabel2) {
    window.alert('请选择相关选项');
    return;
  }
  props.closeDialog(1);
  emit('send-data-inventory', selectedLabel1,selectedLabel2);
};
 
</script>
 
<template>
  <div id="box">
    <div>
      <span>厚度(mm):</span>
      <el-select v-model="value1" clearable style="width: 240px">
        <el-option
            v-for="item in options1"
            :key="item.value"
            :label="item.label"
            :value="item.value"
        />
      </el-select>
    </div>
 
    <div style="margin-top: 30px">
    <span>玻璃类型:</span>
      <el-select v-model="value2"  clearable  style="width: 240px; margin-left: 23px">
        <el-option
            v-for="item in options2"
            :key="item.value"
            :label="item.label"
            :value="item.value"
        />
      </el-select>
    </div>
 
    <div style="float: right; margin:-55px 35px 0 0;">
      <el-button type="primary" @click="CheckInventory">查询</el-button>
    </div>
  </div>
</template>
 
<style scoped>
#box {
  width: 100%;
  height: 100%;
  padding: 10px;
  margin-top: -20px;
  border-radius: 5px;
}
</style>