mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 20:06:47 +08:00
52 lines
1.1 KiB
Vue
52 lines
1.1 KiB
Vue
<template>
|
|
<template v-if="tag">
|
|
<div>{{ options?.find(e => e.value == id)?.label || '' }}</div>
|
|
</template>
|
|
<template v-else>
|
|
<a-select
|
|
:getPopupContainer="
|
|
(triggerNode) => {
|
|
return triggerNode.parentNode || document.body;
|
|
}
|
|
"
|
|
v-model:value="id"
|
|
:options="options"
|
|
style="width: 100%"
|
|
placeholder="请选择项目级别"
|
|
@change="change"
|
|
:disabled="disabled"
|
|
/>
|
|
</template>
|
|
</template>
|
|
<script setup>
|
|
import {computed, defineEmits, defineProps, onMounted, ref} from "vue";
|
|
import {useStore} from "vuex";
|
|
|
|
|
|
const store = useStore();
|
|
const props = defineProps({
|
|
value: String,
|
|
disabled: String,
|
|
tag: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
})
|
|
|
|
const id = computed(() => {
|
|
return props.value || null
|
|
})
|
|
|
|
const emit = defineEmits({})
|
|
|
|
const options = ref([])
|
|
|
|
onMounted(() => {
|
|
options.value = store.state.projectLevel.map(e => ({value: parseInt(e.dictCode), label: e.dictName}))
|
|
})
|
|
|
|
function change(key) {
|
|
emit('update:value', key)
|
|
}
|
|
</script>
|