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
| <template>
| <el-form-item label="设备">
| <el-select
| :model-value="modelValue"
| @update:model-value="handleChange"
| placeholder="设备"
| size="small"
| class="w-120"
| >
| <el-option
| v-for="(s, i) in deviceList"
| :key="i"
| :label="s.label"
| :value="s.value"
| />
| </el-select>
| </el-form-item>
| </template>
|
| <script>
| export default {
| props: {
| type: String,
| modelValue: String
| },
| emits: ['update:modelValue'],
| data() {
| return {};
| },
| computed: {
| deviceList() {
| const t = this.type ? this.type : '0a';
| return [1, 2, 3].map((v) => {
| const label = `${this.getDeviceType(t)}设备${v}号`;
| const value = `${t}000000000${v}`;
| return {
| label: label,
| value: value
| };
| });
| }
| },
| watch: {
| deviceList(nV, oV) {
| if (nV != oV) {
| this.handleChange(nV[0].value);
| }
| }
| },
| methods: {
| handleChange(value) {
| this.$emit('update:modelValue', value);
| },
| getDeviceType(t) {
| switch (t) {
| case '0a':
| return '车载';
| case '0b':
| return '无人机';
| case '0c':
| return '无人船';
| default:
| return '车载';
| }
| }
| },
| mounted() {
| this.handleChange(this.deviceList[0].value);
| }
| };
| </script>
| <style scoped></style>
|
|