Skip to content

Commit

Permalink
节点内容优化
Browse files Browse the repository at this point in the history
  • Loading branch information
caidefeng committed Dec 30, 2023
1 parent 8a7e3c2 commit 30abab5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions src/views/flowDesign/nodes/Approval/content.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {defineComponent, inject, PropType, ref, Ref, VNode} from "vue";
import {defineComponent, inject, PropType, ref, Ref, VNode, watchEffect} from "vue";
import {ApprovalNode} from './index'
import {Field} from "~/components/Render/interface";
import {getList as getRoles} from '~/api/modules/role'
Expand All @@ -17,7 +17,7 @@ export default defineComponent({
fields: Ref<Field[]>
}>('nodeHooks')!
const content = ref<VNode>(<span></span>);
const renderContent = (): VNode => {
watchEffect(() => {
if (props.node.assigneeType === 'choice') {
content.value = <span>{`发起人自选(${props.node.choice ? '多选' : '单选'})`}</span>
} else if (props.node.assigneeType === 'self') {
Expand Down Expand Up @@ -53,13 +53,12 @@ export default defineComponent({
} else {
content.value = <span>{props.node.name}</span>
}
return content.value
}
})
return {
renderContent
content
}
},
render() {
return <el-text>{this.renderContent()}</el-text>
return <el-text>{this.content}</el-text>
}
})
11 changes: 5 additions & 6 deletions src/views/flowDesign/nodes/Cc/content.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {defineComponent, PropType, ref, VNode} from "vue";
import {defineComponent, PropType, ref, VNode, watchEffect} from "vue";
import {CcNode} from './index'
import {getList as getUsers} from '~/api/modules/user'

Expand All @@ -11,7 +11,7 @@ export default defineComponent({
},
setup(props) {
const content = ref<VNode>(<span></span>);
const renderContent = (): VNode => {
watchEffect(() => {
if (props.node.users.length > 0) {
getUsers(props.node.users).then(res => {
if (res.success) {
Expand All @@ -21,13 +21,12 @@ export default defineComponent({
} else {
content.value = <span>未指定人员</span>
}
return content.value
}
})
return {
renderContent
content
}
},
render() {
return <el-text>{this.renderContent()}</el-text>
return <el-text>{this.content}</el-text>
}
})

0 comments on commit 30abab5

Please sign in to comment.