UI转数据 调用form统一的 FuncHandlerParseFormValue
abp_example/ExampleForm.Application.Contracts/usermodels/RoleInfoDto.cs
diff --git a/abp_example/ExampleForm.Application.Contracts/usermodels/RoleInfoDto.cs b/abp_example/ExampleForm.Application.Contracts/usermodels/RoleInfoDto.cs
index ed41a2a..4caa87a 100644
--- a/abp_example/ExampleForm.Application.Contracts/usermodels/RoleInfoDto.cs
+++ b/abp_example/ExampleForm.Application.Contracts/usermodels/RoleInfoDto.cs
@@ -1,10 +1,9 @@
using Newtonsoft.Json;
-using ExampleForm.Application.Contracts;
+using PasteApeart.Application.Contracts;
using PasteApeart.Helper;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
-using PasteApeart.Application.Contracts;
namespace ExampleForm.usermodels
{
@@ -569,6 +568,13 @@ namespace ExampleForm.usermodels
[Description("查询")]
public class InputQueryRoleInfo : InputSearchBase
{
+ /// <summary>
+ ///
+ /// </summary>
+ public InputQueryRoleInfo()
+ {
+ orderby = "sortStr";
+ }
/// <summary>
/// 父级ID 基于父级ID查询
@@ -609,11 +615,14 @@ namespace ExampleForm.usermodels
public EnumModel AuthType { get; set; } = EnumModel.ok;
/// <summary>
- /// 排序 这个字段是隐藏的
+ /// 时间转
/// </summary>
- [PasteHidden]
- [Description("排序 这个字段是隐藏的")]
- public new string orderby { get; set; } = "SortStr";
+ [PasteDaterange("sdate", "edate", "", "times")]
+ public long sdate { get; set; }
+ /// <summary>
+ ///
+ /// </summary>
+ public long edate { get; set; }
}
}
\ No newline at end of file
abp_example/ExampleForm.Application/usermodels/RoleInfoAppService.cs
diff --git a/abp_example/ExampleForm.Application/usermodels/RoleInfoAppService.cs b/abp_example/ExampleForm.Application/usermodels/RoleInfoAppService.cs
index 50010b2..500ce1e 100644
--- a/abp_example/ExampleForm.Application/usermodels/RoleInfoAppService.cs
+++ b/abp_example/ExampleForm.Application/usermodels/RoleInfoAppService.cs
@@ -1,12 +1,11 @@
using ExampleForm.Application;
-using ExampleForm.Application.Contracts;
using ExampleForm.Handler;
+using ExpressiveSharp;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using PasteApeart.Application.Contracts;
-using PasteApeart.Handler;
using PasteApeart.Handler.Level;
using PasteApeart.Helper;
using PasteApeart.Helper.Extensions;
@@ -148,7 +147,7 @@ namespace ExampleForm.usermodels
_model.Properties.RemoveAll(x => x.Name == "button");
}
}
- var _query_model = BuilderHelper.DynamicReadModelProperty(new InputQueryRoleInfo());
+ var _query_model = BuilderHelper.AttributeReadModelProperty(new InputQueryRoleInfo());
if (_query_model != null)
{
_model.QueryProperties = _query_model.Properties;
@@ -188,14 +187,39 @@ namespace ExampleForm.usermodels
RoleType = a.RoleType,
SortStr = a.SortStr,
Sort = a.Sort,
- ExtendFather = role.ToRoleShort()
+ ExtendFather = role.ToRoleShort(),// LinqExtend.AsRoleShort(role)
};
+
+ //var query = from a in _dbContext.RoleInfo
+ //.WhereIf(!string.IsNullOrEmpty(input.word), x => x.Name.Contains(input.word) || x.Desc.Contains(input.word))
+ //.WhereIf(input.FatherId != 0, x => x.FatherId == input.FatherId)
+ //.WhereIf(input.role_type != EnumRoleType.All, x => x.RoleType == input.role_type)
+ // join b in _dbContext.RoleInfo on a.FatherId equals b.Id into c
+ // from role in c.DefaultIfEmpty()
+ // select new RoleInfoListDto
+ // {
+ // Id = a.Id,
+ // Desc = a.Desc,
+ // FatherId = a.FatherId,
+ // Icon = a.Icon,
+ // IsEnable = a.IsEnable,
+ // Level = a.Level,
+ // Model = a.Model,
+ // Name = a.Name,
+ // Path = a.Path,
+ // Role = a.Role,
+ // RoleType = a.RoleType,
+ // SortStr = a.SortStr,
+ // Sort = a.Sort,
+ // ExtendFather = role != null ? new RoleShort { Id = role.Id, Name = role.Name } : null
+ // };
+
//var query = _query.WhereIf(!string.IsNullOrEmpty(input.word), x => x.Name.Contains(input.word) || x.Desc.Contains(input.word))
// .WhereIf(input.FatherId != 0, x => x.FatherId == input.FatherId)
// .WhereIf(input.role_type != EnumRoleType.All, x => x.RoleType == input.role_type);
var _pagedto = new PagedResultDto<RoleInfoListDto>();
_pagedto.TotalCount = await query.CountAsync();
- var dataList = await query.PasteOrderBy(input.orderby).Page(input.page, input.size).ToListAsync();
+ var dataList = await query.AsExpressive().PasteOrderBy(input.orderby).Page(input.page, input.size).ToListAsync();
if (input.GradeId > 0)
{
var binds = await _dbContext.GradeRole.Where(x => x.GradeId == input.GradeId).Select(x => x.RoleId).ToArrayAsync();
abp_example/ExampleForm.Domain/AppConfig.cs
diff --git a/abp_example/ExampleForm.Domain/AppConfig.cs b/abp_example/ExampleForm.Domain/AppConfig.cs
index c35aca6..d401e47 100644
--- a/abp_example/ExampleForm.Domain/AppConfig.cs
+++ b/abp_example/ExampleForm.Domain/AppConfig.cs
@@ -20,11 +20,11 @@ namespace ExampleForm
/// <summary>
///
/// </summary>
- public string RootAccount { get; set; }
+ public string RootAccount { get; set; } = "admin@admin.com";
/// <summary>
///
/// </summary>
- public string RootPassword { get; set; }
+ public string RootPassword { get; set; } = "123456";
}
}
abp_example/ExampleForm.Domain/enummodels/EnumRoleType.cs
diff --git a/abp_example/ExampleForm.Domain/enummodels/EnumRoleType.cs b/abp_example/ExampleForm.Domain/enummodels/EnumRoleType.cs
index 3a938d1..685be02 100644
--- a/abp_example/ExampleForm.Domain/enummodels/EnumRoleType.cs
+++ b/abp_example/ExampleForm.Domain/enummodels/EnumRoleType.cs
@@ -1,4 +1,4 @@
-using System.ComponentModel;
+using System.ComponentModel;
namespace ExampleForm
{
@@ -14,7 +14,7 @@ namespace ExampleForm
[Description("全部")]
All = -1,
/// <summary>
- /// <![CDATA[<i_*_style="color:green;">权限</i>]]>
+ /// 权限
/// </summary>
[Description("权限")]
Role = 0,
abp_example/ExampleForm.EntityFrameworkCore/ExampleForm.EntityFrameworkCore.csproj
diff --git a/abp_example/ExampleForm.EntityFrameworkCore/ExampleForm.EntityFrameworkCore.csproj b/abp_example/ExampleForm.EntityFrameworkCore/ExampleForm.EntityFrameworkCore.csproj
index f09bdd6..a318a7f 100644
--- a/abp_example/ExampleForm.EntityFrameworkCore/ExampleForm.EntityFrameworkCore.csproj
+++ b/abp_example/ExampleForm.EntityFrameworkCore/ExampleForm.EntityFrameworkCore.csproj
@@ -44,6 +44,8 @@
</PropertyGroup>
<ItemGroup>
+ <PackageReference Include="EntityFrameworkCore.Projectables" Version="6.0.6" />
+ <PackageReference Include="ExpressiveSharp.EntityFrameworkCore" Version="1.0.0" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" Version="8.3.4" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.Sqlite" Version="8.3.4" />
<ProjectReference Include="..\ExampleForm.Domain\ExampleForm.Domain.csproj" />
abp_example/ExampleForm.Handler/ExampleFormHandlerModule.cs
diff --git a/abp_example/ExampleForm.Handler/ExampleFormHandlerModule.cs b/abp_example/ExampleForm.Handler/ExampleFormHandlerModule.cs
index 149316f..2aa0c46 100644
--- a/abp_example/ExampleForm.Handler/ExampleFormHandlerModule.cs
+++ b/abp_example/ExampleForm.Handler/ExampleFormHandlerModule.cs
@@ -2,11 +2,11 @@ using ExampleForm.usermodels;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
-using PasteApeart;
using PasteApeart.Handler;
using PasteApeart.Handler.common;
using PasteApeart.Handler.Level;
using PasteApeart.Handler.rabbit;
+using Volo.Abp.DependencyInjection;
using Volo.Abp.Modularity;
namespace ExampleForm
@@ -52,6 +52,33 @@ namespace ExampleForm
typeof(UserInfoDto).Assembly.GetTypes())
);
+ //依赖注入IEventHadnler
+ var handlers = typeof(ExampleFormHandlerModule).Assembly
+ .GetTypes()
+ .Where(t => !t.IsAbstract &&
+ !t.IsGenericType &&
+ t.GetInterfaces()
+ .Any(i => i.IsGenericType &&
+ i.GetGenericTypeDefinition() == typeof(IEventHandler<>)));
+ foreach (var handler in handlers)
+ {
+ var interfaceType = handler.GetInterfaces()
+ .First(i => i.IsGenericType &&
+ i.GetGenericTypeDefinition() == typeof(IEventHandler<>));
+ if (typeof(ISingletonDependency).IsAssignableFrom(handler))
+ {
+ context.Services.AddSingleton(interfaceType, handler);
+ }
+ else if (typeof(IScopedDependency).IsAssignableFrom(handler))
+ {
+ context.Services.AddScoped(interfaceType, handler);
+ }
+ else // 默认使用 ITransientDependency
+ {
+ context.Services.AddTransient(interfaceType, handler);
+ }
+ }
+
}
}
}
abp_example/ExampleForm.Handler/common/LinqExtend.cs
diff --git a/abp_example/ExampleForm.Handler/common/LinqExtend.cs b/abp_example/ExampleForm.Handler/common/LinqExtend.cs
index e9bccfb..86f026a 100644
--- a/abp_example/ExampleForm.Handler/common/LinqExtend.cs
+++ b/abp_example/ExampleForm.Handler/common/LinqExtend.cs
@@ -1,4 +1,4 @@
-using ExampleForm.testmodels;
+using ExampleForm.testmodels;
using ExampleForm.usermodels;
namespace ExampleForm.Handler
@@ -74,19 +74,33 @@ namespace ExampleForm.Handler
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
+ [ExpressiveSharp.Expressive(AllowBlockBody = true)]
public static RoleShort ToRoleShort(this RoleInfo input)
{
- if (input == null)
+ return input == null ? null : new RoleShort
{
- return null;
- }
- return new RoleShort
+ Id = input.Id,
+ Name = input.Name,
+ };
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ [ExpressiveSharp.Expressive(AllowBlockBody = true)]
+ public static RoleShort AsRoleShort(RoleInfo input)
+ {
+ return input == null ? null : new RoleShort
{
Id = input.Id,
Name = input.Name,
};
}
+
+
///// <summary>
/////
///// </summary>
@@ -146,7 +160,7 @@ namespace ExampleForm.Handler
/// <returns></returns>
public static RoleInfoUpdateDto ToRoleUpdateDto(this RoleInfo a, RoleInfo rol)
{
-
+
return new RoleInfoUpdateDto
{
Id = a.Id,
abp_example/ExampleForm.HttpApi.Host/ExampleForm.Application.Contracts.xml
diff --git a/abp_example/ExampleForm.HttpApi.Host/ExampleForm.Application.Contracts.xml b/abp_example/ExampleForm.HttpApi.Host/ExampleForm.Application.Contracts.xml
index 7a10b94..7aa050b 100644
--- a/abp_example/ExampleForm.HttpApi.Host/ExampleForm.Application.Contracts.xml
+++ b/abp_example/ExampleForm.HttpApi.Host/ExampleForm.Application.Contracts.xml
@@ -1649,6 +1649,11 @@
查询
</summary>
</member>
+ <member name="M:ExampleForm.usermodels.InputQueryRoleInfo.#ctor">
+ <summary>
+
+ </summary>
+ </member>
<member name="P:ExampleForm.usermodels.InputQueryRoleInfo.FatherId">
<summary>
父级ID 基于父级ID查询
@@ -1669,9 +1674,14 @@
授权类型
</summary>
</member>
- <member name="P:ExampleForm.usermodels.InputQueryRoleInfo.orderby">
+ <member name="P:ExampleForm.usermodels.InputQueryRoleInfo.sdate">
<summary>
- 排序 这个字段是隐藏的
+ 时间转
+ </summary>
+ </member>
+ <member name="P:ExampleForm.usermodels.InputQueryRoleInfo.edate">
+ <summary>
+
</summary>
</member>
<member name="T:ExampleForm.usermodels.UserGradeAddDto">
abp_example/ExampleForm.HttpApi.Host/ExampleForm.Domain.xml
diff --git a/abp_example/ExampleForm.HttpApi.Host/ExampleForm.Domain.xml b/abp_example/ExampleForm.HttpApi.Host/ExampleForm.Domain.xml
index 9d14f7f..9208984 100644
--- a/abp_example/ExampleForm.HttpApi.Host/ExampleForm.Domain.xml
+++ b/abp_example/ExampleForm.HttpApi.Host/ExampleForm.Domain.xml
@@ -296,7 +296,7 @@
</member>
<member name="F:ExampleForm.EnumRoleType.Role">
<summary>
- <![CDATA[<i_*_style="color:green;">权限</i>]]>
+ 权限
</summary>
</member>
<member name="F:ExampleForm.EnumRoleType.Menu">
framework/PasteApeart.Helper/PasteApeartAttribute.cs
diff --git a/framework/PasteApeart.Helper/PasteApeartAttribute.cs b/framework/PasteApeart.Helper/PasteApeartAttribute.cs
index 96f23a1..083989f 100644
--- a/framework/PasteApeart.Helper/PasteApeartAttribute.cs
+++ b/framework/PasteApeart.Helper/PasteApeartAttribute.cs
@@ -246,7 +246,7 @@ namespace PasteApeart.Helper
/// </summary>
/// <param name="_sdate">开始日期字段 默认为sdate</param>
/// <param name="_edate">结束日期字段 默认为edate</param>
- /// <param name="args3">备用</param>
+ /// <param name="args3">输入的格式,默认为yyyy-MM-dd HH:mm:ss 可以理解为UI格式</param>
/// <param name="out_format">输出格式,默认为时间格式不填,你可以填写times时间戳秒和timems时间戳毫秒格式</param>
public PasteDaterangeAttribute(string _sdate = "sdate", string _edate = "edate", string args3 = null, string out_format = null)
{
manage/page/pasteform/form.js
diff --git a/manage/page/pasteform/form.js b/manage/page/pasteform/form.js
index cceb037..8dca2c5 100644
--- a/manage/page/pasteform/form.js
+++ b/manage/page/pasteform/form.js
@@ -1384,6 +1384,7 @@ function FuncHandlerParseFormValue(_info) {
break;
case "daterange":
{
+
if (item.attributes) {
for (let _attribute of item.attributes) {
if (_attribute.name == 'daterange') {
@@ -4319,10 +4320,7 @@ function handlerExchangeItemToUIData(item) {
break;
case "datetime":
{
- if (item.dataType && item.dataType == "daterange") {
- return;
- }
- item.dataType = "datetime";
+
var _format = "yyyy-MM-dd HH:mm:ss";
if (_attribute.args1) {
_format = _attribute.args1;
@@ -4349,6 +4347,10 @@ function handlerExchangeItemToUIData(item) {
}
}
}
+ if (item.dataType && item.dataType == "daterange") {
+ return;
+ }
+ item.dataType = "datetime";
}
break;
case "point":
manage/page/pasteform/index.js
diff --git a/manage/page/pasteform/index.js b/manage/page/pasteform/index.js
index 6aa98f3..064aedd 100644
--- a/manage/page/pasteform/index.js
+++ b/manage/page/pasteform/index.js
@@ -2513,193 +2513,197 @@ function InitUiData() {
* @param {*} _info
*/
function handlerInputValue(_info) {
- if (_global_data_properties) {
- _global_data_properties.forEach(item => {
- switch (item.dataType) {
- case "daterange":
- {
- if (item.attributes) {
- for (let _attribute of item.attributes) {
- if (_attribute.name == 'daterange') {
- var _value = _info[item.name];//获取当前选中的值
- if (_value) {
- var splits = _value.split(' ');
- if (splits.length == 3) {
- let _start = `${splits[0]} 00:00:00`;
- let _end = `${splits[2]} 00:00:00`;
- if (_attribute.args1) {
- // _info[_attribute.args1] = _start;
- setValueToSameLevel(item.name, _info, _attribute.args1, _start);
- }
- if (_attribute.args2) {
- // _info[_attribute.args2] = _end;
- // setValueToSameLevel(item.name, _info, _attribute.args2, _end);
- if (_config.next_end_date) {
- let _next_end = new Date(_end);
- _next_end.setDate(_next_end.getDate() + 1);
- let _next_end_str = `${_next_end.getFullYear()}-${(_next_end.getMonth() + 1).toString().padStart(2, '0')}-${_next_end.getDate().toString().padStart(2, '0')} 00:00:00`;
- setValueToSameLevel(item.name, _info, _attribute.args2, _next_end_str);
- } else {
- setValueToSameLevel(item.name, _info, _attribute.args2, _end);
- }
- }
- if (_attribute.args4) {
- switch (_attribute.args4) {
- case "times":
- {
- let _times = new Date(_start).getTime() / 1000;
- let _timee = new Date(_end).getTime() / 1000;
- // _info[_attribute.args1] = _times;
- // _info[_attribute.args2] = _timee;
- setValueToSameLevel(item.name, _info, _attribute.args1, _times);
- setValueToSameLevel(item.name, _info, _attribute.args2, _timee);
- }
- break;
- case "timems":
- {
- let _times = new Date(_start).getTime();
- let _timee = new Date(_end).getTime();
- // _info[_attribute.args1] = _times;
- // _info[_attribute.args2] = _timee;
- setValueToSameLevel(item.name, _info, _attribute.args1, _times);
- setValueToSameLevel(item.name, _info, _attribute.args2, _timee);
- }
- break;
- }
- }
- }
- }
- break;
- }
- }
- }
- }
- break;
- case "Guid":
- case "DateTime":
- {
- if (!item.required) {
- if (_info[item.name] == "null" || _info[item.name] == '') {
- delete _info[item.name];
- }
- }
- }
- break;
- case "selects":
- case "lselect":
- {
- //基于结果进行值拼接!
- var _elcs = $(`[name=${item.name}]`).find('.selected');
- if (_elcs && _elcs.length > 0) {
- var _array = new Array();
- for (var k = 0; k < _elcs.length; k++) {
- _array.push($(_elcs[k]).attr('value'));
- }
- if (item.dataFrom.indexOf("[]") >= 0) {
- if (IsNumberArrayDataType(item.dataFrom)) {
- var _newarray = new Array();
- _array.forEach(_ary => {
- _newarray.push(Number(_ary));
- });
- _info[item.name] = _newarray;
- } else {
- _info[item.name] = _array;
- }
- } else {
- //string
-
- if (IsNumberDataType(item.dataFrom)) {
- _info[item.name] = Number(_array[0]);
- } else {
- var _splitchar = ',';
- if (item.attributes) {
- for (var _attribute of item.attributes) {
- if (_attribute.name == item.dataType) {
- if (_attribute.args2) {
- _splitchar = _attribute.args2;
- }
- break;
- }
- }
- }
- _info[item.name] = _array.join(_splitchar);
- }
- }
- }
- }
- break;
- case "splitarray":
- {
- var _split_char = ',';//默认值使用逗号隔开
- var _split = funcFindAttribute(item.attributes, "splitarray");
- if (_split) {
- if (_split.args1) {
- _split_char = _split.args1;
- }
- }
- if (_info.hasOwnProperty(item.name)) {
- var _val = _info[item.name];
- if (_val) {
- _val = _val.replace(/,/g, _split_char);
- if (IsNumberArrayDataType(item.dataFrom)) {
- var strs = _val.split(_split_char);
- var arr = new Array();
- for (var ia of strs) {
- arr.push(Number(ia));
- }
- _info[item.name] = arr;
- } else {
- _info[item.name] = _val.split(_split_char);
- }
- } else {
- delete _info[item.name];
- }
+ FuncHandlerParseFormValue(_info);
- }
- }
- break;
- case "fentoyuan":
- {
- var _value = _info[item.name];
- if (_value) {
- _info[item.name] = Number((_value * 100).toFixed(2));// Number(Math.fround(_value * 100));
- }
- }
- break;
- }
- if (typeof (item.value) == 'number') {
- if (!_info.hasOwnProperty(item.name)) {
- _info[item.name] = 0;
- }
- }
+ //旧版本 上面是新版本 二合一模式
+ // if (_global_data_properties) {
+ // _global_data_properties.forEach(item => {
+ // switch (item.dataType) {
+ // case "daterange":
+ // {
+ // if (item.attributes) {
+ // for (let _attribute of item.attributes) {
+ // if (_attribute.name == 'daterange') {
+ // var _value = _info[item.name];//获取当前选中的值
+ // if (_value) {
+ // var splits = _value.split(' ');
+ // if (splits.length == 3) {
+ // let _start = `${splits[0]} 00:00:00`;
+ // let _end = `${splits[2]} 00:00:00`;
+ // if (_attribute.args1) {
+ // // _info[_attribute.args1] = _start;
+ // setValueToSameLevel(item.name, _info, _attribute.args1, _start);
+ // }
+ // if (_attribute.args2) {
+ // // _info[_attribute.args2] = _end;
+ // // setValueToSameLevel(item.name, _info, _attribute.args2, _end);
+ // if (_config.next_end_date) {
+ // let _next_end = new Date(_end);
+ // _next_end.setDate(_next_end.getDate() + 1);
+ // let _next_end_str = `${_next_end.getFullYear()}-${(_next_end.getMonth() + 1).toString().padStart(2, '0')}-${_next_end.getDate().toString().padStart(2, '0')} 00:00:00`;
+ // setValueToSameLevel(item.name, _info, _attribute.args2, _next_end_str);
+ // } else {
+ // setValueToSameLevel(item.name, _info, _attribute.args2, _end);
+ // }
+ // }
+
+ // if (_attribute.args4) {
+ // switch (_attribute.args4) {
+ // case "times":
+ // {
+ // let _times = new Date(_start).getTime() / 1000;
+ // let _timee = new Date(_end).getTime() / 1000;
+ // // _info[_attribute.args1] = _times;
+ // // _info[_attribute.args2] = _timee;
+ // setValueToSameLevel(item.name, _info, _attribute.args1, _times);
+ // setValueToSameLevel(item.name, _info, _attribute.args2, _timee);
+ // }
+ // break;
+ // case "timems":
+ // {
+ // let _times = new Date(_start).getTime();
+ // let _timee = new Date(_end).getTime();
+ // // _info[_attribute.args1] = _times;
+ // // _info[_attribute.args2] = _timee;
+ // setValueToSameLevel(item.name, _info, _attribute.args1, _times);
+ // setValueToSameLevel(item.name, _info, _attribute.args2, _timee);
+ // }
+ // break;
+ // }
+ // }
+ // }
+ // }
+ // break;
+ // }
+ // }
+ // }
+ // }
+ // break;
+ // case "Guid":
+ // case "DateTime":
+ // {
+ // if (!item.required) {
+ // if (_info[item.name] == "null" || _info[item.name] == '') {
+ // delete _info[item.name];
+ // }
+ // }
+ // }
+ // break;
+ // case "selects":
+ // case "lselect":
+ // {
+ // //基于结果进行值拼接!
+ // var _elcs = $(`[name=${item.name}]`).find('.selected');
+ // if (_elcs && _elcs.length > 0) {
+ // var _array = new Array();
+ // for (var k = 0; k < _elcs.length; k++) {
+ // _array.push($(_elcs[k]).attr('value'));
+ // }
+ // if (item.dataFrom.indexOf("[]") >= 0) {
+ // if (IsNumberArrayDataType(item.dataFrom)) {
+ // var _newarray = new Array();
+ // _array.forEach(_ary => {
+ // _newarray.push(Number(_ary));
+ // });
+ // _info[item.name] = _newarray;
+ // } else {
+ // _info[item.name] = _array;
+ // }
+ // } else {
+ // //string
+
+ // if (IsNumberDataType(item.dataFrom)) {
+ // _info[item.name] = Number(_array[0]);
+ // } else {
+ // var _splitchar = ',';
+ // if (item.attributes) {
+ // for (var _attribute of item.attributes) {
+ // if (_attribute.name == item.dataType) {
+ // if (_attribute.args2) {
+ // _splitchar = _attribute.args2;
+ // }
+ // break;
+ // }
+ // }
+ // }
+ // _info[item.name] = _array.join(_splitchar);
+ // }
+ // }
+ // }
+ // }
+ // break;
+ // case "splitarray":
+ // {
+ // var _split_char = ',';//默认值使用逗号隔开
+ // var _split = funcFindAttribute(item.attributes, "splitarray");
+ // if (_split) {
+ // if (_split.args1) {
+ // _split_char = _split.args1;
+ // }
+ // }
+ // if (_info.hasOwnProperty(item.name)) {
+ // var _val = _info[item.name];
+ // if (_val) {
+ // _val = _val.replace(/,/g, _split_char);
+ // if (IsNumberArrayDataType(item.dataFrom)) {
+ // var strs = _val.split(_split_char);
+ // var arr = new Array();
+ // for (var ia of strs) {
+ // arr.push(Number(ia));
+ // }
+ // _info[item.name] = arr;
+ // } else {
+ // _info[item.name] = _val.split(_split_char);
+ // }
+ // } else {
+ // delete _info[item.name];
+ // }
+
+ // }
+ // }
+ // break;
+ // case "fentoyuan":
+ // {
+ // var _value = _info[item.name];
+ // if (_value) {
+ // _info[item.name] = Number((_value * 100).toFixed(2));// Number(Math.fround(_value * 100));
+ // }
+ // }
+ // break;
+ // }
+ // if (typeof (item.value) == 'number') {
+ // if (!_info.hasOwnProperty(item.name)) {
+ // _info[item.name] = 0;
+ // }
+ // }
- if (item.nullable) {
- var _value = null;
- if (_info.hasOwnProperty(item.name)) {
- _value = _info[item.name];
- }
- //null的问题应该是API处理
- if (!_value) {
- delete _info[item.name];
- }
- switch (item.dataFrom) {
- case "DateTime":
- case "Guid":
- {
- if (_info[item.name] == "null" || _info[item.name] == '') {
- delete _info[item.name];
- }
- }
- break;
- }
- }
- //int类型的0可能被忽略,这样后台会命中比如默认值-1的情况
+ // if (item.nullable) {
+ // var _value = null;
+ // if (_info.hasOwnProperty(item.name)) {
+ // _value = _info[item.name];
+ // }
+ // //null的问题应该是API处理
+ // if (!_value) {
+ // delete _info[item.name];
+ // }
+ // switch (item.dataFrom) {
+ // case "DateTime":
+ // case "Guid":
+ // {
+ // if (_info[item.name] == "null" || _info[item.name] == '') {
+ // delete _info[item.name];
+ // }
+ // }
+ // break;
+ // }
+ // }
+ // //int类型的0可能被忽略,这样后台会命中比如默认值-1的情况
- });
- } else {
- //request=one模式下,可能会这样,则需要从query中拼接数据
- }
+ // });
+ // } else {
+ // //request=one模式下,可能会这样,则需要从query中拼接数据
+ // }
}