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
| <template>
| <el-form-item label="任务">
| <el-select
| :model-value="modelValue"
| @change="handleChange"
| placeholder="任务"
| size="small"
| class="w-150"
| >
| <el-option
| v-for="(s, i) in missionList"
| :key="i"
| :label="s.label"
| :value="s.value"
| />
| </el-select>
| </el-form-item>
| </template>
|
| <script>
| import missionApi from '@/api/missionApi';
| import { useFetchData } from '@/composables/fetchData';
|
| export default {
| setup() {
| const { loading, fetchData } = useFetchData();
| return { loading, fetchData };
| },
| props: {
| type: String,
| modelValue: String
| },
| emits: ['update:modelValue'],
| data() {
| return {
| missionList: []
| };
| },
| methods: {
| fetchMission() {
| this.fetchData((page, pageSize) => {
| return missionApi
| .fethchMission({ type: this.type, page, pageSize })
| .then((res) => {
| this.missionList = res.data.map((item) => {
| return {
| label: item.missionCode,
| value: item.missionCode
| };
| });
| if (this.missionList.length > 0) {
| this.handleChange(this.missionList[0].value);
| }
| return res.head;
| });
| });
| },
| handleChange(value) {
| this.$emit('update:modelValue', value);
| }
| },
| mounted() {
| this.fetchMission();
| }
| };
| </script>
| <style>
| /* :deep() .el-form-item__label {
| color: red !important;
| } */
| </style>
|
|