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

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: '!=', value: '!=',
label: '不等于', 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" v-model="settingVisible"
:show-close="false" :show-close="false"
:size="588" :size="588"
:before-close="handleClose" :before-close=" handleClose"
> >
<template #header> <template #header>
<div class="config-header"> <div class="config-header">
@ -217,9 +217,10 @@ const closeDrawer = () => {
} }
const handleClose = async (done: (cancel?: boolean) => void) => { const handleClose = async (done: (cancel?: boolean) => void) => {
if( await saveConfig()){ const isSuccess = await saveConfig();
done(false); // false if ( !isSuccess) {
}else { done(true); // true
} else {
done(); done();
} }
} }
@ -237,7 +238,6 @@ const saveConfig = async () => {
if (!formRef) return false if (!formRef) return false
const valid = await formRef.value.validate() const valid = await formRef.value.validate()
if (!valid) return false if (!valid) return false
const showText = getShowText(); const showText = getShowText();
if(!showText){ if(!showText){
return false; return false;
@ -269,7 +269,7 @@ const getShowText = () : string => {
const conditionGroup = conditionGroups.value.conditions.map( item => { const conditionGroup = conditionGroups.value.conditions.map( item => {
return '(' + item.rules.map( rule => { return '(' + item.rules.map( rule => {
if ( rule.leftSide && rule.rightSide) { if ( rule.leftSide && rule.rightSide) {
return getFieldTitle(rule.leftSide) + " " + rule.opName + " " + rule.rightSide return getFieldTitle(rule.leftSide) + " " + getOpName(rule.opCode) + " " + rule.rightSide
}else { }else {
// //
warningMesg = '请完善条件规则' warningMesg = '请完善条件规则'
@ -370,6 +370,11 @@ const getFieldTitle = (field:string) : string => {
return item?.title; return item?.title;
} }
const getOpName = (opCode: string) : string => {
const opName = COMPARISON_OPERATORS.find( item => item.value === opCode)
return opName?.label
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>