mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-14 21:36:44 +08:00
-- 项目创建修改
This commit is contained in:
62
src/components/project/OrgClass.vue
Normal file
62
src/components/project/OrgClass.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<a-tree-select
|
||||
v-model:value="id"
|
||||
style="width: 100%"
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
placeholder="自动带出 可修改"
|
||||
allow-clear
|
||||
:tree-data="options"
|
||||
:fieldNames="{
|
||||
children: 'treeChildList',
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
}"
|
||||
:disabled="viewDetail ? true : false"
|
||||
@change="change"
|
||||
dropdownClassName="treeDropdown"
|
||||
>
|
||||
</a-tree-select>
|
||||
</template>
|
||||
<script>
|
||||
import {onMounted, reactive, toRefs, watch} from "vue";
|
||||
import {useStore} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "OrgClass",
|
||||
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Number,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const store = useStore();
|
||||
|
||||
const state = reactive({
|
||||
options: [],
|
||||
id: props.value
|
||||
});
|
||||
watch(state.id, () => {
|
||||
ctx.emit('update:modelValue', state.id)
|
||||
})
|
||||
onMounted(() => {
|
||||
state.options = [{id: props.modelValue, name: props.name}, ...store.state.orgtreeList]
|
||||
})
|
||||
function change(key, obj) {
|
||||
ctx.emit('update:name', obj[0])
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
change
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user