Merge pull request 'feat : 抄送和if判断' (#644) from master into prod

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/644
This commit is contained in:
clay
2024-08-02 11:37:35 +00:00
6 changed files with 130 additions and 91 deletions

View File

@@ -59,7 +59,7 @@ export const useProcessStore = defineStore('process', () => {
const getFormMap = () => {
//表单映射对象
const map = new Map();
processData.value.formItems.forEach(item => itemToMap(map, item))
processData.value.formItems?.forEach(item => itemToMap(map, item))
return map
}

View File

@@ -73,6 +73,7 @@ export const CONDITION_PROPS = {
//抄送节点默认属性
export const CC_PROPS = {
assignedType: "ASSIGN_USER", //审批类型
shouldAdd: false,
assignedUser: [],
formPerms: []

View File

@@ -254,11 +254,8 @@
import {useProcessStore} from '@/stores/processStore.js'
import UserPicker from '../common/UserPicker.vue'
import RolePicker from '../common/RolePicker.vue'
import Ellipsis from '../common/Ellipsis.vue'
import RoleItems from "../common/RoleItems.vue";
import {computed, defineProps} from 'vue'
import {checkMatrix} from "../../../../api/user/user";
import {ElNotification} from "element-plus";
const processStore = useProcessStore()

View File

@@ -1,20 +1,32 @@
<template>
<el-button size="mini" icon="Plus" type="primary" @click="selectUser" round style="margin-bottom: 10px">选择抄送人
</el-button>
<!-- <div class="option">-->
<!-- <el-checkbox label="允许发起人添加抄送人" v-model="shouldAdd"></el-checkbox>-->
<!-- </div>-->
<el-form-item label="⚙ 选择审批对象" prop="text" class="user-type">
<el-radio-group v-model="nodeProps.assignedType">
<el-radio v-for="item in approvalTypes" :label="item.type" :key="item.type">{{ item.name }}</el-radio>
</el-radio-group>
<!-- <div v-else>-->
<!-- <span class="item-desc">发起人自己作为审批人进行审批</span>-->
<!-- </div>-->
</el-form-item>
<div v-if="nodeProps.assignedType === 'ASSIGN_USER'">
<el-button size="mini" icon="Plus" type="primary" @click="selectUser" round>选择抄送人</el-button>
<avatar-ellipsis :row="3" :user-info="assignedUser"/>
<user-picker title="请选择抄送人" multiple ref="userPicker" :v-model="assignedUser" @ok="selectedUser"/>
</div>
<!-- <div class="option">-->
<!-- <el-checkbox label="允许发起人添加抄送人" v-model="shouldAdd"></el-checkbox>-->
<!-- </div>-->
<!-- <org-items v-model="select"/>-->
<avatar-ellipsis :row="3" :user-info="assignedUser" :showArrow="false" />
<user-picker title="请选择抄送人" multiple ref="userPicker" v-model:value="assignedUser" @ok="selectedUser"/>
</template>
<script setup>
import {useProcessStore} from '@/stores/processStore.js'
import {computed, defineProps} from 'vue'
import UserPicker from "../common/UserPicker.vue";
import AvatarEllipsis from "../common/AvatarEllipsis.vue";
const userPicker = ref()
const processStore = useProcessStore()
const userPicker=ref()
const props = defineProps({
config: {
type: Object,
@@ -23,6 +35,10 @@ const props = defineProps({
}
}
})
const approvalTypes = reactive([
{name: "指定人员", type: "ASSIGN_USER"},
{name: "财务部门研发投入核算对接人", type: "FINANCIAL_ASSOCIATE"},
])
const shouldAdd = computed({
get() {
return props.config.shouldAdd || false
@@ -31,6 +47,10 @@ const shouldAdd = computed({
props.config.shouldAdd = val
}
})
const nodeProps = computed(() => {
return processStore.getSelectedNode().props;
})
const assignedUser = computed({
get() {
return props.config.assignedUser || []
@@ -43,16 +63,16 @@ const selectUser = () => {
userPicker.value.showUserPicker()
}
const selectedUser = (select) => {
// let userInfoList = []
// for (let val of select) {
// let userInfo = {
// id: val.id,
// name: val.name,
// avatar: val.avatar,
// }
// userInfoList.push(userInfo)
// }
assignedUser.value = select
let userInfoList = []
for (let val of select) {
let userInfo = {
id: val.id,
name: val.name,
avatar: val.avatar,
}
userInfoList.push(userInfo)
}
assignedUser.value = userInfoList
}
</script>

View File

@@ -1,46 +1,51 @@
<template>
<div v-for="(group, index) in selectedNode.props.groups" :key="index + '_g'" class="group">
<div class="group-header">
<!-- <span class="group-name">条件组 {{ groupNames[index] }}</span>-->
<span class="group-name">条件</span>
<div class="group-cp">
<!-- <span>组内条件关系</span>-->
<!-- <el-switch v-model="group.groupType" active-color="#409EFF"-->
<!-- inactive-color="#c1c1c1" active-value="AND" inactive-value="OR"-->
<!-- active-text="且" inactive-text="或"/>-->
</div>
<!-- <div>-->
<div class="group-operation">
<el-popover placement="bottom" title="选择审批条件" width="300" trigger="click">
<template #reference>
<el-icon :size="18" class="group-icon">
<Plus/>
</el-icon>
</template>
<div>以下条件将决定具体的审批流程</div>
<el-checkbox-group v-model="group.cids" value-key="id">
<el-checkbox :label="condition.id" v-for="(condition, cindex) in conditionList" :key="condition.id"
@change="conditionChange(cindex, group)">
{{ condition.title }}
</el-checkbox>
</el-checkbox-group>
</el-popover>
<!-- <el-icon :size="18" class="group-icon" @click="delGroup(index)">-->
<!-- <Close/>-->
<!-- </el-icon>-->
<!-- </div>-->
<!-- <div>-->
<div v-for="(group, index) in selectedNode.props.groups" :key="index + '_g'" class="group">
<div class="group-header">
<!-- <span class="group-name">条件组 {{ groupNames[index] }}</span>-->
<span class="group-name">条件</span>
<div class="group-cp">
<span>组内条件关系</span>
<el-switch v-model="group.groupType" active-color="#409EFF"
inactive-color="#c1c1c1" active-value="AND" inactive-value="OR"
active-text="" inactive-text=""/>
</div>
<div class="group-operation">
<el-popover placement="bottom" title="选择审批条件" width="300" trigger="click">
<template #reference>
<el-icon :size="18" class="group-icon">
<Plus/>
</el-icon>
</template>
<div>以下条件将决定具体的审批流程</div>
<el-checkbox-group v-model="group.cids" value-key="id">
<el-checkbox :label="condition.id" v-for="(condition, cindex) in conditionList" :key="condition.id"
@change="conditionChange(cindex, group)">
{{ condition.title }}
</el-checkbox>
</el-checkbox-group>
</el-popover>
<!-- <el-icon :size="18" class="group-icon" @click="delGroup(index)">-->
<!-- <Close/>-->
<!-- </el-icon>-->
</div>
</div>
</div>
<div class="group-content">
<p v-if="group.conditions.length === 0">点击右上角 + 添加条件</p>
<div v-else>
<el-form ref="condition-form">
<!--构建表达式-->
<el-form-item v-for="(condition, cindex) in group.conditions" :key="condition.id + '_' + cindex">
<ellipsis slot="label" hover-tip :content="condition.title"/>
<span v-if="condition.valueType === ValueType.string">
<div class="group-content">
<p v-if="group.conditions.length === 0">点击右上角 + 添加条件</p>
<div v-else>
<el-form ref="condition-form">
<!--构建表达式-->
<el-form-item v-for="(condition, cindex) in group.conditions" :key="condition.id + '_' + cindex">
<ellipsis slot="label" hover-tip :content="condition.title"/>
<span v-if="condition.valueType === ValueType.string">
<el-select placeholder="判断符" style="width: 120px;" v-model="condition.compare"
@change="condition.value = []" filterable clearable>
<el-option label="等于" value="="></el-option>
<el-option label="不等于" value="!="></el-option>
<el-option label="包含在" value="IN"></el-option>
</el-select>
<span v-if="isSelect(condition.id)" style="margin-left: 10px">
@@ -56,13 +61,14 @@
</el-select>
</span>
<span v-else style="margin-left: 10px">
<el-input v-if="condition.compare === '='" style="width: 280px;" placeholder="输入比较值"
<el-input v-if="condition.compare === '=' ||condition.compare === '!='" style="width: 280px;"
placeholder="输入比较值"
v-model="condition.value[0]"/>
<el-select v-else style="width: 280px;" multiple clearable filterable allow-create size="small"
v-model="condition.value" placeholder="输入可能包含的值"></el-select>
</span>
</span>
<span v-else-if="condition.valueType === ValueType.number">
<span v-else-if="condition.valueType === ValueType.number">
<el-select size="small" placeholder="判断符" style="width: 120px;" v-model="condition.compare" filterable
clearable>
<el-option :label="exp.label" :value="exp.value" :key="exp.value" v-for="exp in explains"></el-option>
@@ -83,7 +89,7 @@
</span>
</span>
</span>
<span v-else-if="condition.valueType === ValueType.company">
<span v-else-if="condition.valueType === ValueType.company">
<span class="item-desc" style="margin-right: 20px">公司</span>
<el-select placeholder="判断符" style="width: 120px;" v-model="condition.compare" filterable clearable>
<el-option label="等于" value="="></el-option>
@@ -99,14 +105,18 @@
style="width: 240px"
/>
</span>
<el-icon class="delete-icon" @click="delSubCondition(group, cindex)">
<Minus/>
</el-icon>
</el-form-item>
</el-form>
<el-icon class="delete-icon" @click="delSubCondition(group, cindex)">
<Minus/>
</el-icon>
</el-form-item>
</el-form>
</div>
</div>
</div>
</div>
<!-- </div>-->
<!-- <div>-->
<!-- <el-input placeholder="请输入表达式"></el-input>-->
<!-- </div>-->
</template>
<script setup>
@@ -124,7 +134,7 @@ const companyList = ref([])
// const orgType = ref('user')
const showOrgSelect = ref(false)
const groupNames = ref(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'])
const supportTypes = ref([ValueType.number, ValueType.string,ValueType.company])
const supportTypes = ref([ValueType.number, ValueType.string, ValueType.company])
const explains = ref(
[
{label: '等于', value: '='},
@@ -190,7 +200,6 @@ const conditionValType = (type) => {
}
const filterConditionMosr = (list) => {
console.log(processFromPerms.value)
processFromPerms.value.forEach((item) => {
// console.log(item)
if (item.required && supportTypes.value.indexOf(item.valueType) > -1) {
@@ -237,8 +246,8 @@ const delSubCondition = (group, index) => {
const conditionChange = (index, group) => {
//条件组进行发生了改变
//判断新增的
group.cids.forEach(cid => {
if (0 > group.conditions.findIndex(cd => cd.id === cid)) {
group.cids?.forEach(cid => {
if (0 > group.conditions?.findIndex(cd => cd.id === cid)) {
//新增条件
let condition = {...conditionList.value[index]}
condition.compare = '';

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
}