mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-16 06:16:46 +08:00
添加专业力模块
This commit is contained in:
91
src/components/growthpath/PostSelect.vue
Normal file
91
src/components/growthpath/PostSelect.vue
Normal file
@@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<a-select
|
||||
:getPopupContainer="
|
||||
(triggerNode) => {
|
||||
return triggerNode.parentNode || document.body;
|
||||
}
|
||||
"
|
||||
:mode="multiple"
|
||||
v-model:value="selectedValue"
|
||||
:style="{ width: width || '' }"
|
||||
placeholder="请选择岗位"
|
||||
:options="options"
|
||||
@change="onSelectChange"
|
||||
@search="handleSearch"
|
||||
allowClear
|
||||
showArrow
|
||||
showSearch
|
||||
></a-select>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, watch } from 'vue';
|
||||
import { getAllPosition } from "@/api/growthpath"
|
||||
export default {
|
||||
name: 'PostSelect',
|
||||
props: {
|
||||
value: String,
|
||||
multiple: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
isTrue: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
},
|
||||
emits: ['update:value'],
|
||||
setup(props, { emit }) {
|
||||
const selectedValue = ref(props.value);
|
||||
const options = ref([]);
|
||||
|
||||
async function fetchOptions() {
|
||||
try {
|
||||
const data = await getAllPosition({positionName: ''})
|
||||
options.value = data.data.data.map((item) => {
|
||||
return {
|
||||
id: item.positionId,
|
||||
label: item.positionName,
|
||||
value: item.positionName,
|
||||
};
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('error', error);
|
||||
}
|
||||
}
|
||||
|
||||
watch(props, () => {
|
||||
selectedValue.value = props.value;
|
||||
});
|
||||
|
||||
fetchOptions();
|
||||
|
||||
function onSelectChange(newVal,postList ) {
|
||||
emit('update:value', newVal);
|
||||
emit('update:postList', postList);
|
||||
console.log(newVal,postList,'aaaaaa')
|
||||
}
|
||||
async function handleSearch(val){
|
||||
console.log(val,'val')
|
||||
|
||||
}
|
||||
return {
|
||||
selectedValue,
|
||||
options,
|
||||
onSelectChange,
|
||||
handleSearch,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .ant-select-selection-overflow {
|
||||
flex-wrap: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user