Former-commit-id: 0c110188b0e91457e1d3e10810d95961fea5fad8
Former-commit-id: 3baf87dbe854113b774250031dcafce25abb515d
1.0
wanggang 5 years ago
parent affe096ed7
commit cd876e2c2f

@ -6,6 +6,10 @@
@ViewData.Get(key.Value)
}
}
else if(ViewData.ModelMetadata.IsEnum)
{
@((Model as Enum)?.GetDisplayName());
}
else
{
@Model

@ -11,7 +11,7 @@
{
var enumType = ViewData.ModelMetadata.ModelType.GetGenericArguments()[0];
var items = enumType.GetEnumValues().Cast<object>()
.Select(o => new SelectListItem { Value = o.ToString(), Text = (Enum.Parse(enumType, o.ToString()) as Enum).GetDisplayName() })
.Select(o => new SelectListItem { Value = ((int)o).ToString(), Text = (Enum.Parse(enumType, o.ToString()) as Enum).GetDisplayName() })
.ToList();
list = new SelectList(items, "Value", "Text", Model);
@Html.DropDownList("", list, "请选择", new { @class = htmlClass })

@ -125,8 +125,8 @@ namespace Infrastructure.Web
o.DefaultApiVersion = new ApiVersion(1, 0);
o.ApiVersionReader = ApiVersionReader.Combine(
new UrlSegmentApiVersionReader()
//,new QueryStringApiVersionReader()
//,new HeaderApiVersionReader()
, new QueryStringApiVersionReader()
, new HeaderApiVersionReader()
);
});
services.AddControllers()
@ -412,4 +412,4 @@ namespace Infrastructure.Web
return Task.CompletedTask;
}
}
}
}

@ -16,7 +16,7 @@ namespace IoT.Shared.Application.Domain.Entities
[Display(Name = "乡级")]
Township = 40,
[Display(Name = "其他")]
[Display(Name = "自定义")]
Other = 1000
}
}

@ -13,7 +13,7 @@ namespace IoT.Shared.Application.Domain.Entities
[Display(Name = "房间")]
Room = 30,
[Display(Name = "其他")]
Other = 10000
[Display(Name = "自定义")]
Other = 1000
}
}

@ -5,18 +5,21 @@ namespace IoT.Shared.Application.Domain.Entities
public enum OrganType
{
[Display(Name = "企业")]
Type1 = 1,
Type1 = 10,
[Display(Name = "机关")]
Type3 = 3,
Type3 = 30,
[Display(Name = "事业单位")]
Type5 = 5,
Type5 = 50,
[Display(Name = "社会团体")]
Type7 = 7,
Type7 = 70,
[Display(Name = "其他组织机构")]
Type9 = 9
Type9 = 90,
[Display(Name = "自定义")]
Other = 1000
}
}

@ -13,6 +13,7 @@
<PackageReference Include="Microsoft.OpenApi.Readers" Version="1.2.3" />
<PackageReference Include="System.IO.Ports" Version="5.0.0" />
<PackageReference Include="Vibrant.InfluxDB.Client" Version="4.0.4" />
<PackageReference Include="UoN.ExpressiveAnnotations.NetCore" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="wwwroot\**\*" />

@ -2,6 +2,7 @@
using IoT.Shared.Application.Domain.Entities;
using System;
using System.ComponentModel.DataAnnotations;
using UoN.ExpressiveAnnotations.NetCore.Attributes;
namespace Platform.Application.Models
{
@ -23,6 +24,7 @@ namespace Platform.Application.Models
public AreaType? Type { get; set; }
[Display(Name = "自定义类型")]
[RequiredIf("Type==1000", ErrorMessage = "类型为自定时必须填写此字段")]
public string CustomType { get; set; }
[Display(Name = "上级")]

@ -3,6 +3,7 @@ using IoT.Shared.Application.Domain.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using UoN.ExpressiveAnnotations.NetCore.Attributes;
namespace Platform.Application.Models
{
@ -28,6 +29,7 @@ namespace Platform.Application.Models
public BuildingType? Type { get; set; }
[Display(Name = "自定义类型")]
[RequiredIf("Type==1000", ErrorMessage = "类型为自定时必须填写此字段")]
public string CustomType { get; set; }
[Display(Name = "上级")]

@ -2,6 +2,7 @@
using IoT.Shared.Application.Domain.Entities;
using System;
using System.ComponentModel.DataAnnotations;
using UoN.ExpressiveAnnotations.NetCore.Attributes;
namespace Platform.Application.Models
{
@ -35,6 +36,7 @@ namespace Platform.Application.Models
public OrganType? Type { get; set; }
[Display(Name = "自定义类型")]
[RequiredIf("Type==1000", ErrorMessage = "类型为自定时必须填写此字段")]
public string CustomType { get; set; }
}
}

@ -105,6 +105,7 @@ namespace Platform
new Organ
{
Area = db.Set<Area>().FirstOrDefault(o => o.Number == "changchun"),
Type= OrganType.Type5,
Name="默认教育局",
Number="jiaoyuju",
Children = new List<Organ>
@ -112,8 +113,16 @@ namespace Platform
new Organ
{
Area = db.Set<Area>().FirstOrDefault(o => o.Number == "nanguan"),
Type= OrganType.Type5,
Name="默认学校",
Number="xuexiao"
},
new Organ
{
Area = db.Set<Area>().FirstOrDefault(o => o.Number == "nanguan"),
Type= OrganType.Type1,
Name="其他学校",
Number="qitaxuexiao"
}
}
}

@ -123,4 +123,7 @@
<data name="RequiredAttribute" xml:space="preserve">
<value>必须输入{0}</value>
</data>
<data name="RequiredIfAttribute" xml:space="preserve">
<value>必须输入{0}</value>
</data>
</root>

@ -19,6 +19,7 @@ using Platform.Services;
using System;
using System.Collections.Generic;
using System.Transactions;
using UoN.ExpressiveAnnotations.NetCore.DependencyInjection;
namespace Platform
{
@ -68,6 +69,7 @@ namespace Platform
services.AddHangfire(o => o.UseSQLiteStorage("job.db"));
}
services.AddReverseProxy().LoadFromConfig(Configuration.GetSection("ReverseProxy"));
services.AddExpressiveAnnotations();
}
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
@ -114,4 +116,4 @@ namespace Platform
this.UseSignalR<IoTCenterHub>(endpoints);
}
}
}
}

@ -144,6 +144,7 @@
<script src="/lib/jquery-validation/jquery.validate.min.js"></script>
<script src="/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
<script src="/lib/jquery-ajax-unobtrusive/jquery.unobtrusive-ajax.min.js"></script>
<script src="/lib/expressive.annotations.validate/expressive.annotations.validate.min.js"></script>
<script src="/lib/fancybox/jquery.fancybox.min.js"></script>
<script src="/lib/sweetalert2/dist/sweetalert2.all.min.js"></script>
<script src="/lib/jquery-datetimepicker/jquery.datetimepicker.full.min.js"></script>

@ -81,6 +81,11 @@
"destination": "wwwroot/lib/jquery-ajax-unobtrusive/",
"files": [ "jquery.unobtrusive-ajax.min.js" ]
},
{
"library": "expressive-annotations-validate@2.7.0",
"destination": "wwwroot/lib/expressive.annotations.validate/",
"files": [ "expressive.annotations.validate.min.js" ]
},
{
"library": "vue@2.6.11",
"destination": "wwwroot/lib/vue/",

@ -23,12 +23,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{48C7AE84-0
D_5_41_10_4ZHXY_4projects_4lib_4package_1json__JsonSchema = http://json.schemastore.org/pyrseas-0.8
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IoT", "IoT", "{AE34E06D-C5C7-44BC-B168-85808318516C}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projects", "Projects", "{AE34E06D-C5C7-44BC-B168-85808318516C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebMVC", "WebMVC\WebMVC.csproj", "{C66B39B3-D863-4651-99CD-74104CA65C47}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UI", "UI", "{11BCB5F9-0020-463A-92FB-BC25E2A0BF75}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebSPA", "WebSPA\WebSPA.csproj", "{6F839910-580D-4CD1-A0C0-6FAF542B4480}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTDameon", "IoTDameon\IoTDameon.csproj", "{60596088-3C4E-4EA2-933A-B66CD269845B}"
@ -136,12 +134,12 @@ Global
{216F0A25-9F20-4235-9316-632AB94E854A} = {AE34E06D-C5C7-44BC-B168-85808318516C}
{F48CA65D-B2D6-4DB8-A396-A3FE913804FB} = {AE34E06D-C5C7-44BC-B168-85808318516C}
{BE6DEBC5-004F-4811-8BDC-67C74D9E8C2F} = {AE34E06D-C5C7-44BC-B168-85808318516C}
{C66B39B3-D863-4651-99CD-74104CA65C47} = {11BCB5F9-0020-463A-92FB-BC25E2A0BF75}
{6F839910-580D-4CD1-A0C0-6FAF542B4480} = {11BCB5F9-0020-463A-92FB-BC25E2A0BF75}
{C66B39B3-D863-4651-99CD-74104CA65C47} = {AE34E06D-C5C7-44BC-B168-85808318516C}
{6F839910-580D-4CD1-A0C0-6FAF542B4480} = {AE34E06D-C5C7-44BC-B168-85808318516C}
{60596088-3C4E-4EA2-933A-B66CD269845B} = {AE34E06D-C5C7-44BC-B168-85808318516C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0B7095FB-5E70-4EF8-805A-CB4A91AE4B0A}
BuildVersion_StartDate = 2000/1/1
SolutionGuid = {0B7095FB-5E70-4EF8-805A-CB4A91AE4B0A}
EndGlobalSection
EndGlobal

Loading…
Cancel
Save