mirror of
https://gitee.com/cai_xiao_feng/lowflow-design.git
synced 2025-12-07 08:38:23 +08:00
内容添加
This commit is contained in:
parent
b8f937f073
commit
96e39f2c7b
@ -1,7 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ApprovalNode} from './index'
|
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, User} from '~/api/modules/user'
|
||||||
|
import {getList as getRoles, Role} from '~/api/modules/role'
|
||||||
|
import {Field} from "~/components/Render/interface";
|
||||||
|
|
||||||
export interface ApprovalContentProps {
|
export interface ApprovalContentProps {
|
||||||
node: ApprovalNode
|
node: ApprovalNode
|
||||||
@ -9,6 +11,9 @@ export interface ApprovalContentProps {
|
|||||||
|
|
||||||
const $props = withDefaults(defineProps<ApprovalContentProps>(), {})
|
const $props = withDefaults(defineProps<ApprovalContentProps>(), {})
|
||||||
const content = ref<string>('')
|
const content = ref<string>('')
|
||||||
|
const {fields} = inject<{
|
||||||
|
fields: Ref<Field[]>
|
||||||
|
}>('nodeHooks')!
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
const props = $props.node
|
const props = $props.node
|
||||||
if (props.assigneeType === 'choice') {
|
if (props.assigneeType === 'choice') {
|
||||||
@ -18,9 +23,11 @@ watchEffect(() => {
|
|||||||
} else if (props.assigneeType === 'leader') {
|
} else if (props.assigneeType === 'leader') {
|
||||||
content.value = props.leader === 1 ? '直属上级' : `${props.leader}级上级`
|
content.value = props.leader === 1 ? '直属上级' : `${props.leader}级上级`
|
||||||
} else if (props.assigneeType === 'formUser') {
|
} 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') {
|
} 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') {
|
} else if (props.assigneeType === 'user') {
|
||||||
if (props.users.length > 0) {
|
if (props.users.length > 0) {
|
||||||
getList(props.users).then(res => {
|
getList(props.users).then(res => {
|
||||||
@ -33,7 +40,11 @@ watchEffect(() => {
|
|||||||
}
|
}
|
||||||
} else if (props.assigneeType === 'role') {
|
} else if (props.assigneeType === 'role') {
|
||||||
if (props.roles.length > 0) {
|
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 {
|
} else {
|
||||||
content.value = '未指定角色'
|
content.value = '未指定角色'
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user