无人机管理后台前端(已迁走)
rain
2025-06-12 0082fa417fb2af9add3406bf05ab3e3e45890c34
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
<!-- 关联算法和综合业务 -->
<template>
    <div class="task-algorithm" v-if="showAlgorithm">
        <el-select
            :teleported="false"
            :style="{ width: pxToRem(setWidth) }"
            v-model="ai_types"
            multiple
            collapse-tags
            collapse-tags-tooltip
            placeholder="支持多项选择"
            clearable
            @change="handleAlgorithmChange"
        >
            <el-option v-for="item in taskAlgorithm" :key="item.id" :label="item.dictValue" :value="item.dictKey" />
        </el-select>
    </div>
    <div class="task-business" v-if="showBusiness">
        <el-select
            :teleported="false"
            :style="{ width: pxToRem(setWidth) }"
            v-model="industry_type"
            placeholder="请选择类型"
            clearable
            @change="handleBusinessChange"
        >
            <el-option v-for="item in taskBusiness" :key="item.id" :label="item.dictValue" :value="item.dictKey" />
        </el-select>
    </div>
</template>
 
<script setup>
import { getMultipleDictionary } from '@/api/job/task'
import { pxToRem } from '@/utils/rem'
 
// 接收父组件传参
const props = defineProps({
    showAlgorithm: {
        type: Boolean,
        default: false,
    },
    showBusiness: {
        type: Boolean,
        default: false,
    },
    setWidth: {
        type: String,
        default: '100%',
    },
})
 
// 算法
let ai_types = ref('')
let taskAlgorithm = ref([])
// 综合业务
let industry_type = ref('')
let taskBusiness = ref([])
 
// 请求字典字段
const requestDictionary = () => {
    getMultipleDictionary('SF,HYLB').then(res => {
        if (res.code !== 0) {
            // 处理数据
            taskAlgorithm.value = res.data.data['SF']
            taskBusiness.value = res.data.data['HYLB']
        }
    })
}
const emit = defineEmits(['algorithmChange', 'businessChange'])
// 算法选择事件
const handleAlgorithmChange = value => {
    emit('algorithmChange', value)
}
// 业务选择事件
const handleBusinessChange = value => {
    emit('businessChange', value)
}
 
onMounted(() => {
    requestDictionary()
})
</script>
<style scoped lang="scss">
// :deep(.el-tag, .el-tag.el-tag--primary),
// :deep(.el-tag.el-tag--info) {
//     --el-tag-bg-color: none !important;
//     --el-tag-border-color: none !important;
//     --el-tag-hover-color: none !important;
//     color: #fff !important;
// }
</style>