project-manager-ui/src/components/Business/AttachClassify/AttachClassifySelect.vue
2025-02-12 18:04:54 +08:00

84 lines
1.5 KiB
Vue

<template>
<el-cascader
v-model="selectValue"
:placeholder="placeholder"
:clearable="clearable"
filterable
v-on="$listeners"
style="width: 100%;"
:options="options"
:show-all-levels="false"
:props="{
emitPath: false,
multiple: multiple,
expandTrigger: 'hover',
checkStrictly: checkStrictly,
label: 'name',
value: 'id'
}"
/>
</template>
<script>
import { listAttachClassifyAll } from '@/api/bst/attachClassify';
export default {
name: "AttachClassifySelect",
props: {
value: {
type: [String, Array],
default: null
},
placeholder: {
type: String,
default: "请选择分类"
},
disabled: {
type: Boolean,
default: false
},
productType: {
type: String,
default: null
},
multiple: {
type: Boolean,
default: false
},
checkStrictly: {
type: Boolean,
default: false
},
clearable: {
type: Boolean,
default: false
}
},
data() {
return {
options: [],
};
},
computed: {
selectValue: {
get() {
return this.value;
},
set(val) {
this.$emit("input", val);
}
}
},
created() {
this.getOptions();
},
methods: {
getOptions() {
listAttachClassifyAll().then(response => {
this.options = this.handleTree(response.data, 'id', 'parentId', 'children');
});
},
}
};
</script>