新功能:
1.部门显示组件
This commit is contained in:
28
web/src/components/dept-format/index.vue
Normal file
28
web/src/components/dept-format/index.vue
Normal file
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<div>
|
||||
{{ data }}
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {defineProps,ref,watch} from 'vue'
|
||||
import {useDeptInfoStore} from '/@/stores/modules/dept'
|
||||
const props = defineProps({
|
||||
modelValue:{
|
||||
type: Number || String
|
||||
}
|
||||
})
|
||||
const data = ref()
|
||||
watch(()=>{
|
||||
return props.modelValue
|
||||
},async (newVal)=>{
|
||||
const deptInfoStore = useDeptInfoStore()
|
||||
const result = await deptInfoStore.getParentDeptById(newVal)
|
||||
if(result?.nodes){
|
||||
let name = ""
|
||||
result.nodes.forEach((item:any,index:number)=>{
|
||||
name += index>0?`/${item.name}`:item.name
|
||||
})
|
||||
data.value = name
|
||||
}
|
||||
},{immediate: true} )
|
||||
</script>
|
||||
Reference in New Issue
Block a user