调编辑界面

master
MysticBoy 3 years ago
parent 7bd515ff8e
commit f1cb86d12d

@ -19,6 +19,7 @@ namespace IoTSharp.Gateway.Modbus.Data
}
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))]
[JsonConverter(typeof(StringEnumConverter))]
public enum DataType
{
Boolean,

@ -34,6 +34,6 @@ namespace IoTSharp.Gateway.Modbus.Data
/// </summary>
public string? DeviceNameFormat { get; set; }
public List<PointMapping>? PointMappings { get; set; }
public List<PointMapping>? PointMappings { get; set; } = new List<PointMapping>();
}
}

@ -17,6 +17,7 @@ namespace IoTSharp.Gateway.Modbus.Data
/// 如果是DataType为String 则需指定编码格式CodePage
/// 如果是DataType为Double 如果Length是2个寄存器就是4个字节 则是float 如果是4个寄存器那就是8个字节 就是double
/// </summary>
public DataType DataType { get; set; }
/// <summary>
/// 数据分类

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -26,7 +26,6 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.6" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.16.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.6" />
<PackageReference Include="SilkierQuartz" Version="5.0.356" />
</ItemGroup>
</Project>

@ -1,6 +1,6 @@
@page
@model IoTSharp.Gateway.Modbus.Pages.PointMapAdmin.CreateModel
@using IoTSharp.Gateway.Modbus.Data;
@{
ViewData["Title"] = "Create";
}
@ -20,17 +20,17 @@
</div>
<div class="form-group">
<label asp-for="PointMapping.DataType" class="control-label"></label>
<select asp-for="PointMapping.DataType" class="form-control"></select>
<select asp-for="PointMapping.DataType" class="form-control" asp-items="@Html.GetEnumSelectList(typeof(IoTSharp.Gateway.Modbus.Data.DataType))"></select>
<span asp-validation-for="PointMapping.DataType" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="PointMapping.DataCatalog" class="control-label"></label>
<select asp-for="PointMapping.DataCatalog" class="form-control"></select>
<select asp-for="PointMapping.DataCatalog" class="form-control" asp-items="@Html.GetEnumSelectList(typeof(IoTSharp.Gateway.Modbus.Data.DataCatalog))"></select>
<span asp-validation-for="PointMapping.DataCatalog" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="PointMapping.FunCode" class="control-label"></label>
<select asp-for="PointMapping.FunCode" class="form-control"></select>
<select asp-for="PointMapping.FunCode" class="form-control" asp-items="@Html.GetEnumSelectList(typeof(IoTSharp.Gateway.Modbus.Data.FunCode))" ></select>
<span asp-validation-for="PointMapping.FunCode" class="text-danger"></span>
</div>
<div class="form-group">

@ -21,17 +21,17 @@
</div>
<div class="form-group">
<label asp-for="PointMapping.DataType" class="control-label"></label>
<select asp-for="PointMapping.DataType" class="form-control"></select>
<select asp-for="PointMapping.DataType" class="form-control" asp-items="@Html.GetEnumSelectList(typeof(IoTSharp.Gateway.Modbus.Data.DataType))" ></select>
<span asp-validation-for="PointMapping.DataType" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="PointMapping.DataCatalog" class="control-label"></label>
<select asp-for="PointMapping.DataCatalog" class="form-control"></select>
<select asp-for="PointMapping.DataCatalog" class="form-control" asp-items="@Html.GetEnumSelectList(typeof(IoTSharp.Gateway.Modbus.Data.DataCatalog))" ></select>
<span asp-validation-for="PointMapping.DataCatalog" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="PointMapping.FunCode" class="control-label"></label>
<select asp-for="PointMapping.FunCode" class="form-control"></select>
<select asp-for="PointMapping.FunCode" class="form-control" asp-items="@Html.GetEnumSelectList(typeof(IoTSharp.Gateway.Modbus.Data.FunCode))" ></select>
<span asp-validation-for="PointMapping.FunCode" class="text-danger"></span>
</div>
<div class="form-group">

@ -20,11 +20,11 @@ namespace IoTSharp.Gateway.Modbus.Pages.PointMapAdmin
public IList<PointMapping> PointMapping { get;set; } = default!;
public async Task OnGetAsync()
public async Task OnGetAsync(Guid? id)
{
if (_context.PointMappings != null)
if (_context.PointMappings != null && id!=null)
{
PointMapping = await _context.PointMappings.ToListAsync();
PointMapping = await _context.PointMappings.Include(pt => pt.Owner).Where(fm => fm.Owner!=null && fm.Owner.Id == id).ToListAsync();
}
}
}

@ -1,4 +1,8 @@
<!DOCTYPE html>
@using Microsoft.AspNetCore.Identity
@inject SignInManager<IdentityUser> SignInManager
@inject UserManager<IdentityUser> UserManager
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
@ -22,6 +26,13 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
</li>
@if (SignInManager.IsSignedIn(User))
{
<li class="nav-item">
<a class="nav-link text-dark" href="/SlaveAdmin">Modbus 从机管理</a>
</li>
}
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
</li>

@ -45,6 +45,7 @@
</td>
<td>
<a asp-page="./Edit" asp-route-id="@item.Id">Edit</a> |
<a href="/PointMapAdmin?id=@item.Id">点位映射</a> |
<a asp-page="./Details" asp-route-id="@item.Id">Details</a> |
<a asp-page="./Delete" asp-route-id="@item.Id">Delete</a>
</td>

@ -1,7 +1,7 @@
using IoTSharp.Gateway.Modbus.Data;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using SilkierQuartz;
namespace IoTSharp.Gateway.Modbus
{
@ -18,19 +18,10 @@ namespace IoTSharp.Gateway.Modbus
builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount=false)
.AddEntityFrameworkStores<ApplicationDbContext>();
builder.Services.AddRazorPages();
builder.Services.AddSilkierQuartz(option =>
{
option.VirtualPathRoot = "/SilkierQuartz";
option.UseLocalTime = true;
option.DefaultDateFormat = "yyyy-MM-dd";
option.DefaultTimeFormat = "HH:mm:ss";
}, auth=>
{
auth.AccessRequirement = SilkierQuartzAuthenticationOptions.SimpleAccessRequirement.AllowAnonymous;
});
builder.Services.AddRazorPages();
var app = builder.Build();
// Configure the HTTP request pipeline.
@ -52,10 +43,10 @@ namespace IoTSharp.Gateway.Modbus
app.UseAuthentication();
app.UseAuthorization();
app.UseSilkierQuartz();
app.MapRazorPages();
app.Run();
}
}

Loading…
Cancel
Save