feat : 流程判断条件添加

This commit is contained in:
clay
2024-07-24 18:10:37 +08:00
parent fe8ca80452
commit b90ed53437
5 changed files with 139 additions and 120 deletions

View File

@@ -9,6 +9,7 @@ export const ValueType = {
date: 'Date',
user: 'User',
dept: 'Dept',
company: 'Company',
star: 'star',
dateRange: 'DateRange'
}

View File

@@ -111,7 +111,7 @@
<el-switch inactive-text="不跳过" active-text="跳过" v-model="nodeProps.skipSelf"></el-switch>
</el-form-item>
</span>
<el-form-item label="科创部矩阵" prop="dstiMatrix">
<el-form-item label="科创跳过" prop="dstiMatrix">
<el-switch inactive-text="审批" active-text="跳过"
v-model="nodeProps.dstiMatrix"></el-switch>
</el-form-item>
@@ -123,7 +123,7 @@
<el-switch inactive-text="不审批" active-text="审批" v-model="nodeProps.president"></el-switch>
</el-form-item>
</span>
<el-form-item label="重复审批" prop="duplicateApproval">
<el-form-item label="重复跳过" prop="duplicateApproval">
<el-switch inactive-text="" active-text=""
v-model="nodeProps.duplicateApproval"></el-switch>
</el-form-item>

View File

@@ -1,12 +1,13 @@
<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">条件组 {{ 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=""/>
<!-- <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">
@@ -24,13 +25,13 @@
</el-checkbox>
</el-checkbox-group>
</el-popover>
<el-icon :size="18" class="group-icon" @click="delGroup(index)">
<Close/>
</el-icon>
<!-- <el-icon :size="18" class="group-icon" @click="delGroup(index)">-->
<!-- <Close/>-->
<!-- </el-icon>-->
</div>
</div>
<div class="group-content">
<p v-if="group.conditions.length === 0">点击右上角 + 为本条件组添加条件</p>
<p v-if="group.conditions.length === 0">点击右上角 + 添加条件</p>
<div v-else>
<el-form ref="condition-form">
<!--构建表达式-->
@@ -44,7 +45,7 @@
</el-select>
<span v-if="isSelect(condition.id)" style="margin-left: 10px">
<el-select v-if="condition.compare === 'IN'" style="width: 280px;" clearable multiple size="small"
v-model="condition.value" placeholder="选择值" filterable >
v-model="condition.value" placeholder="选择值" filterable>
<el-option v-for="(option, oi) in getOptions(condition.id)" :key="oi" :label="option"
:value="option"></el-option>
</el-select>
@@ -62,7 +63,8 @@
</span>
</span>
<span v-else-if="condition.valueType === ValueType.number">
<el-select size="small" placeholder="判断符" style="width: 120px;" v-model="condition.compare" filterable clearable>
<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>
</el-select>
<span style="margin-left: 10px">
@@ -81,19 +83,22 @@
</span>
</span>
</span>
<span v-else-if="condition.valueType === ValueType.user">
<span class="item-desc" style="margin-right: 20px">属于某部门 / 为某些人其中之一</span>
<el-button size="mini" :icon="Plus" type="primary" @click="selectUser(condition.value, 'user')"
round>选择人员/部门</el-button>
<org-items :modelValue="users"/>
<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>
<el-option label="不等于" value="!="></el-option>
</el-select>
<el-tree-select
v-model="condition.value[0]"
@node-click="(data)=>{
condition.value[1] = data.label
}"
:data="companyList"
check-strictly
style="width: 240px"
/>
</span>
<span v-else-if="condition.valueType === ValueType.dept">
<span class="item-desc" style="margin-right: 20px">为某部门 / 某部门下的部门</span>
<el-button size="mini" :icon="Plus" type="primary" @click="selectUser(condition.value, 'dept')"
round>选择部门</el-button>
<org-items :modelValue="users"/>
</span>
<span v-else-if="condition.valueType === ValueType.date"></span>
<el-icon class="delete-icon" @click="delSubCondition(group, cindex)">
<Minus/>
</el-icon>
@@ -102,22 +107,20 @@
</div>
</div>
</div>
<org-picker title="请选择人员/部门" multiple ref="orgPicker" :v-model="users" @ok="selected"></org-picker>
</template>
<script setup>
import OrgPicker from "../common/UserPicker.vue";
import OrgItems from "../common/RoleItems.vue";
import {ValueType} from '@/views/workflow/form/ComponentsConfigExport.js'
import {computed, ref} from 'vue'
import {useProcessStore} from '@/stores/processStore.js'
import Ellipsis from '../common/Ellipsis.vue'
import {Plus, Minus} from '@element-plus/icons-vue'
import {getSubCompOpt} from '@/api/user/user.js';
const processStore = useProcessStore()
const orgPicker = ref()
const users = ref([])
const companyList = ref([])
// const orgType = ref('user')
const showOrgSelect = ref(false)
const groupNames = ref(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'])
@@ -186,19 +189,19 @@ const conditionValType = (type) => {
}
}
const selectUser = (value, orgType) => {
//选择用户,倒开组织选择器
// orgType.value = orgType
users.value = value
orgPicker.value.showUserPicker()
}
const filterConditionMosr = (list) => {
console.log(processFromPerms.value)
processFromPerms.value.forEach((item) => {
// console.log(item)
if (item.required && supportTypes.value.indexOf(item.valueType) > -1){
if (item.required && supportTypes.value.indexOf(item.valueType) > -1) {
list.push({title: item.title, id: item.id, valueType: item.valueType})
}
})
list.push({
title: '发起人公司',
id: 'subCompanyId',
valueType: ValueType.company
})
}
const filterCondition = (item, list) => {
@@ -255,6 +258,16 @@ const conditionChange = (index, group) => {
}
}
}
const getCompanyList = () => {
getSubCompOpt().then(res => {
companyList.value = res.data
})
}
getCompanyList()
</script>
<style lang="scss" scoped>

View File

@@ -99,6 +99,9 @@ const content = computed(() => {
case ValueType.string:
subConditionStr = getOrdinaryConditionContent(subCondition)
break;
case ValueType.company:
subConditionStr = `${subCondition.title}${subCondition.compare}${subCondition.value[1]?subCondition.value[1]:""}`
break;
}
subConditions.push(subConditionStr)
})

View File

@@ -1,8 +1,8 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import {fileURLToPath, URL} from 'node:url'
import {defineConfig} from 'vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import vue from '@vitejs/plugin-vue'
@@ -12,87 +12,89 @@ import viteSvgIcons from 'vite-plugin-svg-icons'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
vueJsx(),
AutoImport({
//自动导入vue相关函数
imports: ['vue','vue-router'],
resolvers: [
ElementPlusResolver(),
//自动导入图标组件
IconsResolver({
prefix: 'Icon',
plugins: [
vue(),
vueJsx(),
AutoImport({
//自动导入vue相关函数
imports: ['vue', 'vue-router'],
resolvers: [
ElementPlusResolver(),
//自动导入图标组件
IconsResolver({
prefix: 'Icon',
}),
],
}),
],
}),
Components({
dirs: ['src/components', 'src/fvcomponents'],
resolvers: [
// 自动注册图标组件
IconsResolver({
enabledRequirements: ['ep'],
Components({
dirs: ['src/components', 'src/fvcomponents'],
resolvers: [
// 自动注册图标组件
IconsResolver({
enabledRequirements: ['ep'],
}),
//自动导入组件
ElementPlusResolver()
],
}),
//自动导入组件
ElementPlusResolver()
],
}),
Icons({
autoInstall: true,
}),
viteSvgIcons({
// 指定需要缓存的图标文件夹
iconDirs: [path.resolve(__dirname, 'src/assets/svg')],
// 指定symbolId格式
symbolId: 'icon-[dir]-[name]',
}),
Inspect(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
Icons({
autoInstall: true,
}),
viteSvgIcons({
// 指定需要缓存的图标文件夹
iconDirs: [path.resolve(__dirname, 'src/assets/svg')],
// 指定symbolId格式
symbolId: 'icon-[dir]-[name]',
}),
Inspect(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: {
minify: 'esbuild',
terserOptions: {
compress: {
drop_console: false, // 生产环境移除log
drop_debugger: true // 生产环境禁用debugger
}
}
},
server: {
host: '0.0.0.0',
port: 8888,
strictPort: false,
open: true,
proxy: {
// '/api/workflow': {
// // target: 'http://frp.feashow.cn:31800/',
// target: 'http://clay.frp.feashow.cn/',
// // target: 'http://192.168.31.175:8000',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '')
// },
// '/api/admin': {
// // target: 'http://frp.feashow.cn:31800/',
// target: 'http://clay.frp.feashow.cn/',
// // target: 'http://192.168.31.175:8000',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '')
// },
'/api': {
// target: 'http://mosr.feashow.cn',
// target: 'http://kyglweb.scgzjy.com:8080/',
target: 'http://clay.frp.feashow.cn/',
// target: 'http://10.7.127.57:8000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
},
'/api/notice-ws': {
target: 'ws://mosr.feashow.cn/api/notice-ws',
ws: true,
changeOrigin: true,
}
}
}
},
build: {
minify: 'esbuild',
terserOptions: {
compress: {
drop_console: false, // 生产环境移除log
drop_debugger: true // 生产环境禁用debugger
}
}
},
server: {
host: '0.0.0.0',
port: 8888,
strictPort: false,
open: true,
proxy: {
// '/api/workflow': {
// // target: 'http://frp.feashow.cn:31800/',
// target: 'http://clay.frp.feashow.cn/',
// // target: 'http://192.168.31.175:8000',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '')
// },
// '/api/admin': {
// // target: 'http://frp.feashow.cn:31800/',
// target: 'http://clay.frp.feashow.cn/',
// // target: 'http://192.168.31.175:8000',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '')
// },
'/api': {
// target: 'http://mosr.feashow.cn/',
target: 'http://10.7.127.57:8000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
},
'/api/notice-ws': {
target: 'ws://mosr.feashow.cn/api/notice-ws',
ws: true,
changeOrigin: true,
}
}
}
})