mirror of
https://gitee.com/cai_xiao_feng/lowflow-design.git
synced 2025-12-06 16:18:22 +08:00
内容添加
This commit is contained in:
parent
b8f937f073
commit
96e39f2c7b
@ -1,7 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import {ApprovalNode} from './index'
|
||||
import {ref, watchEffect} from "vue";
|
||||
import {inject, Ref, ref, watchEffect} from "vue";
|
||||
import {getList, User} from '~/api/modules/user'
|
||||
import {getList as getRoles, Role} from '~/api/modules/role'
|
||||
import {Field} from "~/components/Render/interface";
|
||||
|
||||
export interface ApprovalContentProps {
|
||||
node: ApprovalNode
|
||||
@ -9,6 +11,9 @@ export interface ApprovalContentProps {
|
||||
|
||||
const $props = withDefaults(defineProps<ApprovalContentProps>(), {})
|
||||
const content = ref<string>('')
|
||||
const {fields} = inject<{
|
||||
fields: Ref<Field[]>
|
||||
}>('nodeHooks')!
|
||||
watchEffect(() => {
|
||||
const props = $props.node
|
||||
if (props.assigneeType === 'choice') {
|
||||
@ -18,9 +23,11 @@ watchEffect(() => {
|
||||
} else if (props.assigneeType === 'leader') {
|
||||
content.value = props.leader === 1 ? '直属上级' : `${props.leader}级上级`
|
||||
} else if (props.assigneeType === 'formUser') {
|
||||
content.value = '表单内人员'
|
||||
const title = fields.value.find(e => e.id === props.formUser)?.title || props.formUser || '?'
|
||||
content.value = `表单内(${title})人员`
|
||||
} else if (props.assigneeType === 'formRole') {
|
||||
content.value = '表单内角色'
|
||||
const title = fields.value.find(e => e.id === props.formRole)?.title || props.formRole || '?'
|
||||
content.value = `表单内(${title})角色`
|
||||
} else if (props.assigneeType === 'user') {
|
||||
if (props.users.length > 0) {
|
||||
getList(props.users).then(res => {
|
||||
@ -33,7 +40,11 @@ watchEffect(() => {
|
||||
}
|
||||
} else if (props.assigneeType === 'role') {
|
||||
if (props.roles.length > 0) {
|
||||
// 可以从异步后端查询出角色名,显示在content中
|
||||
getRoles(props.roles).then(res => {
|
||||
if(res.success){
|
||||
content.value = res.data.map((item: Role) => item.name).join('、')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
content.value = '未指定角色'
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user