forked from drone/command-center-dashboard

罗广辉
2025-04-21 2800fa4f32f3900509cb4d6eefaf2bfaf54efdd7
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
<!-- 关联算法和综合业务 -->
<template>
  <div class="task-algorithm" v-if="showAlgorithm">
    <el-select :teleported="false" class="ztzf-select" :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" class="ztzf-select" :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/system/dictbiz';
import { pxToRem } from '@/utils/rem'
 
// 接收父组件传参
const props = defineProps({
  showAlgorithm: {
    type: Boolean,
    default: false
  },
  showBusiness: {
    type: Boolean,
    default: false
  },
  setWidth: {
    type: Number,
    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>