feat : 抄送和if判断

This commit is contained in:
clay
2024-08-02 19:36:37 +08:00
parent 36bb362fd7
commit 5111897d13
6 changed files with 130 additions and 91 deletions

View File

@@ -1,6 +1,8 @@
<template>
<node :title="config.name" :show-error="showError" :select-user="selectUser" :mode="mode" :content="content" :node-id="config.id"
:error-info="errorInfo" :show-avatar="true" :user-info="config.props.assignedUser" nodeType="carbonCopyRecipient"
<node :title="config.name" :show-error="showError" :select-user="selectUser" :mode="mode" :content="content"
:node-id="config.id"
:error-info="errorInfo"
:show-avatar="config.props.assignedType === 'ASSIGN_USER'" :user-info="config.props.assignedUser"
@selected="emit('selected')" @delNode="emit('delNode')" @insertNode="type => emit('insertNode', type)"
placeholder="请设置抄送人" :header-bgc="headerBgc" :header-icon="Promotion"/>
</template>
@@ -8,6 +10,7 @@
<script setup>
import Node from './Node.vue'
import {defineProps, defineEmits, computed, defineExpose} from "vue";
const emit = defineEmits(['insertNode', 'selected', 'delNode'])
const props = defineProps({
config: {
@@ -41,27 +44,36 @@ const selectUser = computed(() => {
})
const content = computed(() => {
if (props.config.props.shouldAdd) {
return '由发起人指定'
} else if (props.config.props.assignedUser.length > 0) {
let texts = []
props.config.props.assignedUser.forEach(org => texts.push(org.name))
return String(texts).replaceAll(',', '、')
if (props.assignedType === 'ASSIGN_USER') {
if (props.config.props.shouldAdd) {
return '由发起人指定'
} else if (props.config.props.assignedUser.length > 0) {
let texts = []
props.config.props.assignedUser.forEach(org => texts.push(org.name))
return String(texts).replaceAll(',', '、')
} else {
return null
}
} else {
return null
return "财务部门研发投入核算对接人"
}
})
//校验数据配置的合法性
const validate = (err) => {
showError.value = false
if (props.config.props.shouldAdd) {
showError.value = false
} else if (props.config.props.assignedUser.length === 0) {
showError.value = true
errorInfo.value = '请选择需要抄送的人员'
}
if (showError.value) {
err.push(`抄送节点 ${props.config.name} 未设置抄送人`)
if (props.assignedType === 'ASSIGN_USER') {
showError.value = false
if (props.config.props.shouldAdd) {
showError.value = false
} else if (props.config.props.assignedUser.length === 0) {
showError.value = true
errorInfo.value = '请选择需要抄送的人员'
}
if (showError.value) {
err.push(`抄送节点 ${props.config.name} 未设置抄送人`)
}
} else {
errorInfo.value = false
}
return !showError.value
}