Former-commit-id: cc16c30c3f7f6a190f85d95fd09036611c6095a5
Former-commit-id: ceb709031e3578245d2e31f8baf8eca3567ad263
1.0
wanggang 5 years ago
parent 364fc128ba
commit 2a2d119a09

@ -5,7 +5,7 @@ namespace Infrastructure.Application.Entites.Settings
public enum SettingType
{
[Display(Name = "整数")]
Integer32 = 10,
Int32 = 10,
[Display(Name = "浮点数")]
Doubule = 20,
@ -14,7 +14,7 @@ namespace Infrastructure.Application.Entites.Settings
Boolean = 30,
[Display(Name = "文本")]
Text = 40,
String = 40,
[Display(Name = "Html")]
Html = 50,

@ -5,14 +5,7 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label required" for="@Html.IdFor(o=>o.Value)">@Html.DisplayNameFor(o => o.Value)</label>
<div class="col-sm-6">
@if (template == "Integer32" || template == "Doubule")
{
@Html.TextBoxFor(o => o.Value, Model.Value, new { @class = "form-control" })
}
else
{
@Html.EditorFor(o => o.Value, template)
}
@Html.EditorFor(o => o.Value, template)
@Html.ValidationMessageFor(o => o.Value)
</div>
<div class="col-sm-2">

@ -10,7 +10,7 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label required" for="@Html.IdFor(o=>o.Name)">@Html.DisplayNameFor(o => o.Name)</label>
<div class="col-sm-6">
@Html.EditorFor(o => o.Name, "Text")
@Html.EditorFor(o => o.Name)
@Html.ValidationMessageFor(o => o.Name)
</div>
<div class="col-sm-2">

@ -1,20 +1,25 @@
@using System.Reflection
@using Microsoft.AspNetCore.Mvc.Controllers
@using Infrastructure.Web.Mvc
@{
var scope = ViewBag.ControllerScope as string;
var scope = (Url.ActionContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.GetCustomAttribute<ControllerScopeAttribute>()?.Scope;
}
<div class="card">
<div class="form-horizontal">
<div class="card-body">
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !pm.HideSurroundingHtml))
{
if(scope=="Organ"&&prop.PropertyName=="OrganId")
var metadata = prop as Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadata;
if (scope != null && scope == ControllerScopeType.Organ && prop.PropertyName == "OrganId")
{
Html.Hidden(prop.PropertyName);
continue;
}
var uihit = prop.DataTypeName ?? prop.TemplateHint;
<div class="form-group row" title="@uihit">
@Html.Label(prop.PropertyName, prop.GetDisplayName() + "", new { @class = "col-sm-2 col-form-label" })
<div class="col-sm-8">
<div class="form-control form-control-display">
@Html.Label(prop.PropertyName, prop.GetDisplayName() + "", new { @class = "col-sm-1 col-form-label",style= "text-align: right;" })
<div class="col-sm-11">
<div class="form-control" style="border-color:transparent;">
@Html.Display(prop.PropertyName, uihit)
</div>
</div>

@ -0,0 +1 @@
@Html.CheckBox("", new { style = "width:20px;height:20px;margin:2px 0;" })

@ -0,0 +1 @@
@Html.TextBox(null, null, new { @class = "form-control" })

@ -0,0 +1 @@
@Html.TextBox(null, null, new { @class = "form-control single" })

@ -1,5 +1,8 @@
@using System.Reflection
@using Microsoft.AspNetCore.Mvc.Controllers
@using Infrastructure.Web.Mvc
@{
HtmlTitle = ViewContext.ViewData.ModelMetadata.ModelType.GetDisplayName();
var scope = (Url.ActionContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.GetCustomAttribute<ControllerScopeAttribute>()?.Scope;
var controller = this.ViewContext.RouteData.Values["controller"].ToString();
var action = this.ViewContext.RouteData.Values["action"].ToString();
var url = HtmlAction ?? (ViewData.Keys.Any(o => o.ToLower() == "returnurl") ? Url.Action(null, null, new { ReturnUrl = ViewData["ReturnUrl"] }) : Url.Action(null, null));
@ -9,10 +12,46 @@
<div class="card-body">
@Html.AntiForgeryToken()
<div class="form-group row">
<div class="col-sm-2 col-form-label"></div>
<div class="col-sm-1 col-form-label"></div>
@Html.ValidationSummary(true, "错误:", new { @class = "text-danger col-sm-8" }, "div")
</div>
@(await Html.PartialAsync("Input.cshtml"))
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !pm.HideSurroundingHtml))
{
var metadata = prop as Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadata;
if (scope != null && scope == ControllerScopeType.Organ && prop.PropertyName == "OrganId")
{
Html.Hidden(prop.PropertyName);
continue;
}
var uihit = prop.DataTypeName ?? prop.TemplateHint;
<div class="form-group row @prop.ModelType.Name @uihit">
@Html.Label(prop.PropertyName, prop.GetDisplayName() + "", new { @class = "col-sm-1 col-form-label", style = "text-align: right;" })
<div class="col-sm-5">
@if (metadata.Attributes.Attributes.Any(o => o.GetType() == typeof(System.ComponentModel.ReadOnlyAttribute)))
{
@Html.Hidden(prop.PropertyName)
@Html.Display(prop.PropertyName, uihit)
}
else
{
@Html.Editor(prop.PropertyName, uihit)
}
@Html.ValidationMessage(prop.PropertyName, new { @class = "text-danger" })
</div>
<div class="col-sm-6">
@{
if (metadata != null)
{
var attr = metadata.Attributes.Attributes.OfType<System.ComponentModel.DescriptionAttribute>().FirstOrDefault() as System.ComponentModel.DescriptionAttribute;
if (attr != null && attr.Description != null)
{
<span class="form-control form-control-display">@attr.Description</span>
}
}
}
</div>
</div>
}
<div class="form-group row">
<div class="col-sm-2"> </div>
<div class="col-sm-8">

@ -0,0 +1 @@
@Html.TextBox(null, null, new { @class = "form-control" })

@ -1,14 +1,17 @@
@using System.Reflection
@using Microsoft.AspNetCore.Mvc.Controllers
@using Infrastructure.Web.Mvc
@{
var scope = (Url.ActionContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.GetCustomAttribute<ControllerScopeAttribute>()?.Scope;
var inputClass = "form-control";
var scope = ViewBag.ControllerScope as string;
}
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit))
{
var uihit = prop.TemplateHint ?? prop.DataTypeName;
var name = "query." + prop.PropertyName;
if(scope=="Organ"&&prop.PropertyName=="OrganId")
if (scope != null && scope == ControllerScopeType.Organ && prop.PropertyName == "OrganId")
{
@Html.Hidden(prop.PropertyName)
Html.Hidden(prop.PropertyName);
continue;
}
if (prop.PropertyName == "Id" || prop.PropertyName == "DisplayOrder" || uihit == "ImageUrl" || uihit == "MultiSelectList")
@ -17,39 +20,17 @@
}
else
{
<div class="col-12 col-sm-6 col-md-4 col-lg-3">
<div class="form-group row">
<label class="col-sm-3 col-form-label" for="@prop.PropertyName" data-ui="@uihit @prop.UnderlyingOrModelType">@prop.GetDisplayName():</label>
<div class="col-sm-9">
@if (prop.ModelType == typeof(string) ||
prop.UnderlyingOrModelType == typeof(Int32) ||
prop.UnderlyingOrModelType == typeof(Int64)||
prop.UnderlyingOrModelType == typeof(System.Single)||
prop.UnderlyingOrModelType == typeof(System.Double)||
prop.UnderlyingOrModelType == typeof(System.Decimal))
{
@Html.TextBox(prop.PropertyName, null, new { name=name,@class = inputClass })
}
else if(prop.IsNullableValueType&&prop.UnderlyingOrModelType == typeof(bool))
{
var items=new List<SelectListItem>(){new SelectListItem{ Value="true",Text="是"},new SelectListItem{Value="false",Text="否"}};
var list = new SelectList(items, "Value", "Text");
@Html.DropDownList(prop.PropertyName, list,"请选择", new { @class = inputClass })
}
else if(prop.IsNullableValueType&&prop.IsEnum)
{
var items=Enum.GetValues(prop.UnderlyingOrModelType).Cast<Enum>()
.Select(o => new SelectListItem { Value = o.GetValue().ToString(), Text = o.GetDisplayName() })
.ToList();
var list = new SelectList(items, "Value", "Text");
@Html.DropDownList(prop.PropertyName, list,"请选择", new { @class = inputClass })
}
else
{
@Html.Editor(prop.PropertyName, prop.DataTypeName ?? prop.TemplateHint, prop.AdditionalValues)
}
if (prop.IsNullableValueType && prop.UnderlyingOrModelType == typeof(bool))
{
uihit = "SearchTemplates/Boolean.cshtml";
}
<div class="col-12 col-sm-6 col-md-4 col-lg-3">
<div class="form-group row">
<label class="col-sm-3 col-form-label" for="@prop.PropertyName" data-ui="@uihit @prop.UnderlyingOrModelType">@prop.GetDisplayName():</label>
<div class="col-sm-9">
@Html.Editor(prop.PropertyName, uihit, prop.AdditionalValues)
</div>
</div>
</div>
</div>
</div>
}
}
}

@ -0,0 +1,5 @@
@{
var items = new List<SelectListItem>() { new SelectListItem { Value = "true", Text = "是" }, new SelectListItem { Value = "false", Text = "否" } };
var list = new SelectList(items, "Value", "Text");
@Html.DropDownList(null, list, "请选择", new { @class = "form-control" })
}

@ -38,22 +38,22 @@
<ul class="navbar-nav ml-auto">
@if (User.Identity.IsAuthenticated)
{
<li class="nav-item">
<a href="@Url.Action("Index","Account",new { area=""})" class="@GetLinkClass(area:"",controller:"Account")">@User.Identity.Name</a>
</li>
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Logout","Account",new { area=""})" click="logout">退出</a>
</li>
<li class="nav-item">
<a href="@Url.Action("Index","Account",new { area=""})" class="@GetLinkClass(area:"",controller:"Account")">@User.Identity.Name</a>
</li>
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Logout","Account",new { area=""})" click="logout">退出</a>
</li>
}
else
{
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Register","Account",new { area=""})">注册</a>
</li>
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Login","Account",new { area=""})">登录</a>
</li>
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Register","Account",new { area=""})">注册</a>
</li>
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Login","Account",new { area=""})">登录</a>
</li>
}
</ul>
</nav>
@ -80,18 +80,18 @@
<div class="container-fluid">
@if (!HideBread)
{
<div class="row mb-2">
<div class="col-sm-6">
<h1>@HtmlTitle</h1>
<div class="row mb-2">
<div class="col-sm-6">
<h1>@HtmlTitle</h1>
</div>
<div class="col-sm-6">
@*<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="@Url.Action("Index","Home")">首页</a></li>
@RenderSection("bread", false)
<li class="breadcrumb-item active">@HtmlTitle</li>
</ol>*@
</div>
</div>
<div class="col-sm-6">
@*<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="@Url.Action("Index","Home")">首页</a></li>
@RenderSection("bread", false)
<li class="breadcrumb-item active">@HtmlTitle</li>
</ol>*@
</div>
</div>
}
@RenderBody()
</div>

@ -349,7 +349,7 @@ namespace Infrastructure.Web
var file = "db.sql";
if (context.Database.EnsureCreated())
{
context.Set<Setting>().Add(new Setting { Name = "Version", Value = Helper.Instance.GetVersion(), Type = SettingType.Text });
context.Set<Setting>().Add(new Setting { Name = "Version", Value = Helper.Instance.GetVersion(), Type = SettingType.String });
context.SaveChanges();
if (File.Exists(file))
{

@ -108,35 +108,35 @@ namespace IoTNode
db.SaveChanges();
//
var set = db.Set<Setting>();
set.Add(new Setting { Name = "name", Value = this._cfg.GetValue("seed:NodeName", "节点"), Type = SettingType.Text });
set.Add(new Setting { Name = "name", Value = this._cfg.GetValue("seed:NodeName", "节点"), Type = SettingType.String });
set.Add(new Setting { Name = "logo", Value = "/images/logo.png", Type = SettingType.ImageUrl });
set.Add(new Setting { Name = "copyright", Value = "Copyright © {0} Company. All rights reserved", Type = SettingType.Html });
//
var macAddress = Helper.Instance.GetMacAddress();
set.Add(new Setting { Name = "sn", Value = macAddress, Type = SettingType.Text });
set.Add(new Setting { Name = "sn", Value = macAddress, Type = SettingType.String });
set.Add(new Setting
{
Name = "code",
Value = this._env.IsDevelopment() ? Helper.Instance.MacEncrypt(Helper.Instance.GetMacAddress()) : "根据mac生成的授权码",
Type = SettingType.Text
Type = SettingType.String
});
//
var host = this._cfg.GetValue("seed:host", "localhost");
var stream = this._cfg.GetValue("seed:stream", "localhost");
var delay = this._cfg.GetValue("seed:delay", "100");
set.Add(new Setting { Name = "debug", Value = "false", Type = SettingType.Text });
set.Add(new Setting { Name = "notify:enabled", Value = "true", Type = SettingType.Text });
set.Add(new Setting { Name = "notify:host", Value = $"http://{host}/platform", Type = SettingType.Text });
set.Add(new Setting { Name = "timer.seconds", Value = "180", Type = SettingType.Text });
set.Add(new Setting { Name = "onvif.timer", Value = "1", Type = SettingType.Text });
set.Add(new Setting { Name = "onvif.speed", Value = "0.2", Type = SettingType.Text });
set.Add(new Setting { Name = "camera.usr", Value = "admin", Type = SettingType.Text });
set.Add(new Setting { Name = "camera.pwd", Value = "dsideal123", Type = SettingType.Text });
set.Add(new Setting { Name = "stream.rtmp", Value = stream, Type = SettingType.Text });
set.Add(new Setting { Name = "ffmpeg.args", Value = " -y -threads {0} -rtsp_transport tcp -use_wallclock_as_timestamps 1 -stimeout 3000000 -i \"{1}\" -fflags +genpts -c copy -f flv \"{2}\"", Type = SettingType.Text });
set.Add(new Setting { Name = "fbee.writelist", Value = "", Type = SettingType.Text });
set.Add(new Setting { Name = "camera.writelist", Value = "", Type = SettingType.Text });
set.Add(new Setting { Name = "delay", Value = delay, Type = SettingType.Text });
set.Add(new Setting { Name = "debug", Value = "false", Type = SettingType.String });
set.Add(new Setting { Name = "notify:enabled", Value = "true", Type = SettingType.String });
set.Add(new Setting { Name = "notify:host", Value = $"http://{host}/platform", Type = SettingType.String });
set.Add(new Setting { Name = "timer.seconds", Value = "180", Type = SettingType.String });
set.Add(new Setting { Name = "onvif.timer", Value = "1", Type = SettingType.String });
set.Add(new Setting { Name = "onvif.speed", Value = "0.2", Type = SettingType.String });
set.Add(new Setting { Name = "camera.usr", Value = "admin", Type = SettingType.String });
set.Add(new Setting { Name = "camera.pwd", Value = "dsideal123", Type = SettingType.String });
set.Add(new Setting { Name = "stream.rtmp", Value = stream, Type = SettingType.String });
set.Add(new Setting { Name = "ffmpeg.args", Value = " -y -threads {0} -rtsp_transport tcp -use_wallclock_as_timestamps 1 -stimeout 3000000 -i \"{1}\" -fflags +genpts -c copy -f flv \"{2}\"", Type = SettingType.String });
set.Add(new Setting { Name = "fbee.writelist", Value = "", Type = SettingType.String });
set.Add(new Setting { Name = "camera.writelist", Value = "", Type = SettingType.String });
set.Add(new Setting { Name = "delay", Value = delay, Type = SettingType.String });
db.SaveChanges();
var organ = this._cfg.GetValue("seed:organ", "默认机构");
db.Set<IoT.Shared.Application.Domain.Entities.IoTGateway>().Add(new IoT.Shared.Application.Domain.Entities.IoTGateway

@ -34,7 +34,7 @@ namespace IoT.Shared.Application.Models
public string Logout { get; set; }
[Display(Name = "禁用")]
public bool Disabled { get; set; }
public bool? Disabled { get; set; }
[Display(Name = "序号")]
public int DisplayOrder { get; set; }

@ -425,33 +425,33 @@ namespace Platform
//
var set = db.Set<Setting>();
set.Add(new Setting { Name = "name", Value = "物联平台", Type = SettingType.Text });
set.Add(new Setting { Name = "name", Value = "物联平台", Type = SettingType.String });
set.Add(new Setting { Name = "logo", Value = "/images/logo.png", Type = SettingType.ImageUrl });
set.Add(new Setting { Name = "copyright", Value = "Copyright © {0} Company. All rights reserved", Type = SettingType.Html });
set.Add(new Setting { Name = "iosAppUrl", Value = "itms-services://?action=download-manifest&url=https://iot.edusoa.com/IoTCenter/Info.plist", Type = SettingType.Text });
set.Add(new Setting { Name = "iosAppUrl", Value = "itms-services://?action=download-manifest&url=https://iot.edusoa.com/IoTCenter/Info.plist", Type = SettingType.String });
//
var macAddress = Helper.Instance.GetMacAddress();
set.Add(new Setting { Name = "sn", Value = macAddress, Type = SettingType.Text });
set.Add(new Setting { Name = "id", Value = macAddress.Md5(), Type = SettingType.Text });
set.Add(new Setting { Name = "code", Value = "根据id生成的授权码", Type = SettingType.Text });
set.Add(new Setting { Name = "delay", Value = "500", Type = SettingType.Text });
set.Add(new Setting { Name = "sn", Value = macAddress, Type = SettingType.String });
set.Add(new Setting { Name = "id", Value = macAddress.Md5(), Type = SettingType.String });
set.Add(new Setting { Name = "code", Value = "根据id生成的授权码", Type = SettingType.String });
set.Add(new Setting { Name = "delay", Value = "500", Type = SettingType.String });
db.SaveChanges();
//
set.Add(new Setting { Name = "AccessTokenTimeout", Value = "1440", Type = SettingType.Text });
set.Add(new Setting { Name = "RefreshTokenTimeout", Value = "518400", Type = SettingType.Text });
set.Add(new Setting { Name = "MaxFailedAccessAttemptsBeforeLockout", Value = "5", Type = SettingType.Text });
set.Add(new Setting { Name = "DefaultAccountLockoutMinutes", Value = "10", Type = SettingType.Text });
set.Add(new Setting { Name = "CaptchaSeconds", Value = "60", Type = SettingType.Text });
set.Add(new Setting { Name = "RegisterDisabled", Value = "false", Type = SettingType.Text });
set.Add(new Setting { Name = "AccessTokenTimeout", Value = "1440", Type = SettingType.String });
set.Add(new Setting { Name = "RefreshTokenTimeout", Value = "518400", Type = SettingType.String });
set.Add(new Setting { Name = "MaxFailedAccessAttemptsBeforeLockout", Value = "5", Type = SettingType.String });
set.Add(new Setting { Name = "DefaultAccountLockoutMinutes", Value = "10", Type = SettingType.String });
set.Add(new Setting { Name = "CaptchaSeconds", Value = "60", Type = SettingType.String });
set.Add(new Setting { Name = "RegisterDisabled", Value = "false", Type = SettingType.String });
//
set.Add(new Setting { Name = "email:host", Value = "nbaxp.com", Type = SettingType.Text });
set.Add(new Setting { Name = "email:port", Value = "25", Type = SettingType.Text });
set.Add(new Setting { Name = "email:user", Value = "admin@nbaxp.com", Type = SettingType.Text });
set.Add(new Setting { Name = "email:password", Value = "123456", Type = SettingType.Text });
set.Add(new Setting { Name = "sms", Value = "false", Type = SettingType.Text });
set.Add(new Setting { Name = "sms:url", Value = "https://api.netease.im/sms/sendcode.action", Type = SettingType.Text });
set.Add(new Setting { Name = "sms:key", Value = "123456", Type = SettingType.Text });
set.Add(new Setting { Name = "sms:secret", Value = "123456", Type = SettingType.Text });
set.Add(new Setting { Name = "email:host", Value = "nbaxp.com", Type = SettingType.String });
set.Add(new Setting { Name = "email:port", Value = "25", Type = SettingType.String });
set.Add(new Setting { Name = "email:user", Value = "admin@nbaxp.com", Type = SettingType.String });
set.Add(new Setting { Name = "email:password", Value = "123456", Type = SettingType.String });
set.Add(new Setting { Name = "sms", Value = "false", Type = SettingType.String });
set.Add(new Setting { Name = "sms:url", Value = "https://api.netease.im/sms/sendcode.action", Type = SettingType.String });
set.Add(new Setting { Name = "sms:key", Value = "123456", Type = SettingType.String });
set.Add(new Setting { Name = "sms:secret", Value = "123456", Type = SettingType.String });
//
db.Set<IoTGatewayCategory>().Add(new IoTGatewayCategory { Name = "智慧教室", Template = "node" });

Loading…
Cancel
Save