mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
fix issue #I7XLQK checkbox控件值表单条件判断
This commit is contained in:
parent
24db84cda4
commit
19fc3bc933
@ -1,98 +1,118 @@
|
|||||||
// <copyright file="FlowLine.cs" company="openauth.net.cn">
|
// <copyright file="FlowLine.cs" company="openauth.net.cn">
|
||||||
// Copyright (c) 2019 openauth.net.cn. All rights reserved.
|
// Copyright (c) 2019 openauth.net.cn. All rights reserved.
|
||||||
// </copyright>
|
// </copyright>
|
||||||
// <author>www.cnblogs.com/yubaolee</author>
|
// <author>www.cnblogs.com/yubaolee</author>
|
||||||
// <date>2019-03-05</date>
|
// <date>2019-03-05</date>
|
||||||
// <summary>流程中的连线</summary>
|
// <summary>流程中的连线</summary>
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Infrastructure.Extensions;
|
using System.Linq;
|
||||||
using Newtonsoft.Json.Linq;
|
using Infrastructure;
|
||||||
|
using Infrastructure.Extensions;
|
||||||
namespace OpenAuth.App.Flow
|
using Newtonsoft.Json.Linq;
|
||||||
{
|
|
||||||
/// <summary>
|
namespace OpenAuth.App.Flow
|
||||||
/// 流程连线
|
{
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public class FlowLine
|
/// 流程连线
|
||||||
{
|
/// </summary>
|
||||||
public string id { get; set; }
|
public class FlowLine
|
||||||
public string label { get; set; }
|
{
|
||||||
public string type { get; set; }
|
public string id { get; set; }
|
||||||
public string from { get; set; }
|
public string label { get; set; }
|
||||||
public string to { get; set; }
|
public string type { get; set; }
|
||||||
public string name { get; set; }
|
public string from { get; set; }
|
||||||
public bool dash { get; set; }
|
public string to { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
/// <summary> 分支条件 </summary>
|
public bool dash { get; set; }
|
||||||
public List<DataCompare> Compares { get; set; }
|
|
||||||
|
/// <summary> 分支条件 </summary>
|
||||||
public bool Compare(JObject frmDataJson)
|
public List<DataCompare> Compares { get; set; }
|
||||||
{
|
|
||||||
bool result = true;
|
public bool Compare(JObject frmDataJson)
|
||||||
foreach (var compare in Compares)
|
{
|
||||||
{
|
bool result = true;
|
||||||
|
foreach (var compare in Compares)
|
||||||
bool isDecimal = decimal.TryParse(compare.Value, out decimal value);
|
{
|
||||||
var fieldVal = frmDataJson.GetValue(compare.FieldName.ToLower()).ToString();
|
|
||||||
|
bool isDecimal = decimal.TryParse(compare.Value, out decimal value);
|
||||||
if (isDecimal) //如果是数字或小数
|
var fieldVal = frmDataJson.GetValue(compare.FieldName.ToLower()).ToString();
|
||||||
{
|
|
||||||
decimal frmvalue = decimal.Parse(fieldVal); //表单中填写的值
|
if (isDecimal) //如果是数字或小数
|
||||||
|
{
|
||||||
switch (compare.Operation)
|
decimal frmvalue = 0;
|
||||||
{
|
if (fieldVal.Contains("["))//表单中的数据包含[],为数组,一般是checkbox的值
|
||||||
case DataCompare.Equal:
|
{
|
||||||
result &= compare.Value == fieldVal;
|
var tempvals = JsonHelper.Instance.Deserialize<List<decimal>>(fieldVal);
|
||||||
break;
|
frmvalue = tempvals.Max();
|
||||||
case DataCompare.Larger:
|
}
|
||||||
result &= frmvalue > value;
|
else
|
||||||
break;
|
{
|
||||||
case DataCompare.Less:
|
frmvalue = decimal.Parse(fieldVal); //表单中填写的值
|
||||||
result &= frmvalue < value;
|
}
|
||||||
break;
|
|
||||||
case DataCompare.LargerEqual:
|
switch (compare.Operation)
|
||||||
result &= frmvalue >= value;
|
{
|
||||||
break;
|
case DataCompare.Equal:
|
||||||
case DataCompare.LessEqual:
|
result &= compare.Value == fieldVal;
|
||||||
result &= frmvalue <= value;
|
break;
|
||||||
break;
|
case DataCompare.Larger:
|
||||||
}
|
result &= frmvalue > value;
|
||||||
}
|
break;
|
||||||
else //如果只是字符串,只判断相等
|
case DataCompare.Less:
|
||||||
{
|
result &= frmvalue < value;
|
||||||
result &= compare.Value == fieldVal;
|
break;
|
||||||
}
|
case DataCompare.LargerEqual:
|
||||||
|
result &= frmvalue >= value;
|
||||||
|
break;
|
||||||
}
|
case DataCompare.LessEqual:
|
||||||
|
result &= frmvalue <= value;
|
||||||
return result;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else //如果只是字符串,只判断相等
|
||||||
/// <summary>
|
{
|
||||||
/// 分支条件
|
if (fieldVal.Contains("["))//表单中的数据包含[],为数组,一般是checkbox的值
|
||||||
/// </summary>
|
{
|
||||||
public class DataCompare
|
var tempvals = JsonHelper.Instance.Deserialize<List<string>>(fieldVal);
|
||||||
{
|
result &= tempvals.Contains(compare.Value);
|
||||||
public const string Larger = ">";
|
}
|
||||||
public const string Less = "<";
|
else
|
||||||
public const string LargerEqual = ">=";
|
{
|
||||||
public const string LessEqual = "<=";
|
result &= compare.Value == fieldVal;
|
||||||
public const string NotEqual = "!=";
|
}
|
||||||
public const string Equal = "=";
|
|
||||||
|
}
|
||||||
/// <summary>操作类型比如大于/等于/小于</summary>
|
|
||||||
public string Operation { get; set; }
|
|
||||||
|
}
|
||||||
/// <summary> form种的字段名称 </summary>
|
|
||||||
public string FieldName { get; set; }
|
return result;
|
||||||
|
}
|
||||||
/// <summary> 字段类型:"form":为表单中的字段,后期扩展系统表等. </summary>
|
}
|
||||||
public string FieldType { get; set; }
|
|
||||||
|
/// <summary>
|
||||||
/// <summary>比较的值</summary>
|
/// 分支条件
|
||||||
public string Value { get; set; }
|
/// </summary>
|
||||||
}
|
public class DataCompare
|
||||||
}
|
{
|
||||||
|
public const string Larger = ">";
|
||||||
|
public const string Less = "<";
|
||||||
|
public const string LargerEqual = ">=";
|
||||||
|
public const string LessEqual = "<=";
|
||||||
|
public const string NotEqual = "!=";
|
||||||
|
public const string Equal = "=";
|
||||||
|
|
||||||
|
/// <summary>操作类型比如大于/等于/小于</summary>
|
||||||
|
public string Operation { get; set; }
|
||||||
|
|
||||||
|
/// <summary> form种的字段名称 </summary>
|
||||||
|
public string FieldName { get; set; }
|
||||||
|
|
||||||
|
/// <summary> 字段类型:"form":为表单中的字段,后期扩展系统表等. </summary>
|
||||||
|
public string FieldType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>比较的值</summary>
|
||||||
|
public string Value { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user