仿钉钉流程设计器- 条件规则问题修复

This commit is contained in:
jason 2024-05-13 20:54:14 +08:00
parent e1fc9039b2
commit 4f24141689
2 changed files with 32 additions and 28 deletions

View File

@ -167,22 +167,21 @@ export const COMPARISON_OPERATORS : DictDataVO = [
{
value: '!=',
label: '不等于',
},
{
value: '>',
label: '大于',
},
{
value: '>=',
label: '大于等于',
},
{
value: '<',
label: '小于',
},
{
value: '<=',
label: '小于等于',
}
// 待完善
// {
// value: '>',
// label: '大于',
// },
// {
// value: '>=',
// label: '大于等于',
// },
// {
// value: '<',
// label: '小于',
// },
// {
// value: '<=',
// label: '小于等于',
// }
]

View File

@ -4,7 +4,7 @@
v-model="settingVisible"
:show-close="false"
:size="588"
:before-close="handleClose"
:before-close=" handleClose"
>
<template #header>
<div class="config-header">
@ -216,12 +216,13 @@ const closeDrawer = () => {
settingVisible.value = false
}
const handleClose = async (done: (cancel?: boolean) => void) => {
if( await saveConfig()){
done(false); // false
}else {
done();
}
const handleClose = async (done: (cancel?: boolean) => void) => {
const isSuccess = await saveConfig();
if ( !isSuccess) {
done(true); // true
} else {
done();
}
}
//
const formRules = reactive({
@ -231,13 +232,12 @@ const formRules = reactive({
const formRef = ref() // Ref
//
const saveConfig = async () => {
const saveConfig = async () => {
if (!currentNode.value.attributes.defaultFlow) {
//
//
if (!formRef) return false
const valid = await formRef.value.validate()
if (!valid) return false
const showText = getShowText();
if(!showText){
return false;
@ -269,7 +269,7 @@ const getShowText = () : string => {
const conditionGroup = conditionGroups.value.conditions.map( item => {
return '(' + item.rules.map( rule => {
if ( rule.leftSide && rule.rightSide) {
return getFieldTitle(rule.leftSide) + " " + rule.opName + " " + rule.rightSide
return getFieldTitle(rule.leftSide) + " " + getOpName(rule.opCode) + " " + rule.rightSide
}else {
//
warningMesg = '请完善条件规则'
@ -370,6 +370,11 @@ const getFieldTitle = (field:string) : string => {
return item?.title;
}
const getOpName = (opCode: string) : string => {
const opName = COMPARISON_OPERATORS.find( item => item.value === opCode)
return opName?.label
}
</script>
<style lang="scss" scoped>