Former-commit-id: fdf4fda115fafe05fbd3c39d2937f27af1f81fee
Former-commit-id: 549eb73e1bad961799e0696e932f03f1c5f9db60
1.0
wanggang 5 years ago
parent 12df383da0
commit 5b40ef948a

@ -11,22 +11,22 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" /> <meta name="renderer" content="webkit" />
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" /> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
<link rel="shortcut icon" href="/favicon.ico" /> <link rel="shortcut icon" href="~/favicon.ico" />
<link rel="stylesheet" href="/lib/fontawesome-free/css/all.min.css" /> <link rel="stylesheet" href="~/lib/fontawesome-free/css/all.min.css" />
<link rel="stylesheet" href="/lib/ionicons/css/ionicons.min.css" /> <link rel="stylesheet" href="~/lib/ionicons/css/ionicons.min.css" />
<link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css" /> <link rel="stylesheet" href="~/lib/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="/lib/admin-lte/css/adminlte.min.css" /> <link rel="stylesheet" href="~/lib/admin-lte/css/adminlte.min.css" />
<link rel="stylesheet" href="/lib/fancybox/jquery.fancybox.min.css" /> <link rel="stylesheet" href="~/lib/fancybox/jquery.fancybox.min.css" />
<link rel="stylesheet" href="/lib/sweetalert2/dist/sweetalert2.min.css" /> <link rel="stylesheet" href="~/lib/sweetalert2/dist/sweetalert2.min.css" />
<link rel="stylesheet" href="/lib/jquery-datetimepicker/jquery.datetimepicker.min.css" /> <link rel="stylesheet" href="~/lib/jquery-datetimepicker/jquery.datetimepicker.min.css" />
<link rel="stylesheet" href="/lib/sweetalert2/dist/sweetalert2.min.css" /> <link rel="stylesheet" href="~/lib/sweetalert2/dist/sweetalert2.min.css" />
<link rel="stylesheet" href="/lib/select2/css/select2.min.css" /> <link rel="stylesheet" href="~/lib/select2/css/select2.min.css" />
<link rel="stylesheet" href="/lib/select2/dist/select2-bootstrap4.min.css" /> <link rel="stylesheet" href="~/lib/select2/dist/select2-bootstrap4.min.css" />
<link rel="stylesheet" href="/lib/tree-multiselect/jquery.tree-multiselect.min.css" /> <link rel="stylesheet" href="~/lib/tree-multiselect/jquery.tree-multiselect.min.css" />
<link rel="stylesheet" href="/lib/kindeditor/themes/default/default.css" /> <link rel="stylesheet" href="~/lib/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/lib/toastr/toastr.min.css"> <link rel="stylesheet" href="~/lib/toastr/toastr.min.css">
<link rel="stylesheet" href="/lib/jqcron/jqCron.css"> <link rel="stylesheet" href="~/lib/jqcron/jqCron.css">
<link rel="stylesheet" href="/css/site.css"> <link rel="stylesheet" href="~/css/site.css">
<title>@HtmlTitle</title> <title>@HtmlTitle</title>
@RenderSection("styles", required: false) @RenderSection("styles", required: false)
</head> </head>

@ -1,25 +1,44 @@
using Infrastructure.Application; using Infrastructure.Application;
using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace IoT.Shared.Application.Models namespace IoT.Shared.Application.Models
{ {
/// <summary>
/// Defines the <see cref="EditProductModel" />.
/// </summary>
[Display(Name = "产品")] [Display(Name = "产品")]
public class EditProductModel : EditModel public class EditProductModel : EditModel
{ {
/// <summary>
/// Gets or sets the Name.
/// </summary>
[Display(Name = "产品名称")] [Display(Name = "产品名称")]
[Required(ErrorMessage = nameof(RequiredAttribute))]
public string Name { get; set; } public string Name { get; set; }
/// <summary>
/// Gets or sets the Number.
/// </summary>
[Display(Name = "产品型号")] [Display(Name = "产品型号")]
[Required(ErrorMessage = nameof(RequiredAttribute))]
public string Number { get; set; } public string Number { get; set; }
/// <summary>
/// Gets or sets the Image.
/// </summary>
[Display(Name = "图片")] [Display(Name = "图片")]
[DataType(DataType.ImageUrl)] [DataType(DataType.ImageUrl)]
public string Image { get; set; } public string Image { get; set; }
/// <summary>
/// Gets or sets the Path.
/// </summary>
[Display(Name = "路径")] [Display(Name = "路径")]
public string Path { get; set; } public string Path { get; set; }
/// <summary>
/// Gets or sets the ApiJson.
/// </summary>
[Display(Name = "ApiJson")] [Display(Name = "ApiJson")]
[DataType(DataType.MultilineText)] [DataType(DataType.MultilineText)]
public string ApiJson { get; set; } public string ApiJson { get; set; }

@ -6,12 +6,14 @@ using IoT.Shared.Application.Domain.Entities;
using IoT.Shared.Application.Models; using IoT.Shared.Application.Models;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System; using System;
using System.Linq; using System.Linq;
namespace IoT.Shared.Areas.IoTCenter.Controlls namespace IoT.Shared.Areas.IoTCenter.Controlls
{ {
/// <summary>
/// Defines the <see cref="IoTProductController" />.
/// </summary>
[Authorize] [Authorize]
[ApiController] [ApiController]
[Route("IoTCenter/[controller]/[action]")] [Route("IoTCenter/[controller]/[action]")]
@ -19,13 +21,28 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
[ControllerScope(ControllerScopeType.Platform)] [ControllerScope(ControllerScopeType.Platform)]
public class IoTProductController : SharedController<IoTProduct, EditProductModel> public class IoTProductController : SharedController<IoTProduct, EditProductModel>
{ {
/// <summary>
/// Defines the _ajax.
/// </summary>
private readonly AjaxBaseController _ajax; private readonly AjaxBaseController _ajax;
/// <summary>
/// Initializes a new instance of the <see cref="IoTProductController"/> class.
/// </summary>
/// <param name="repo">The repo<see cref="IRepository{IoTProduct}"/>.</param>
/// <param name="ajax">The ajax<see cref="AjaxBaseController"/>.</param>
/// <param name="sp">The sp<see cref="IServiceProvider"/>.</param>
public IoTProductController(IRepository<IoTProduct> repo, AjaxBaseController ajax, IServiceProvider sp) : base(repo, sp) public IoTProductController(IRepository<IoTProduct> repo, AjaxBaseController ajax, IServiceProvider sp) : base(repo, sp)
{ {
this._ajax = ajax; this._ajax = ajax;
} }
/// <summary>
/// The Query.
/// </summary>
/// <param name="model">The model<see cref="PagedListModel{EditProductModel}"/>.</param>
/// <param name="query">The query<see cref="IQueryable{IoTProduct}"/>.</param>
/// <returns>The <see cref="IQueryable{IoTProduct}"/>.</returns>
public override IQueryable<IoTProduct> Query(PagedListModel<EditProductModel> model, IQueryable<IoTProduct> query) public override IQueryable<IoTProduct> Query(PagedListModel<EditProductModel> model, IQueryable<IoTProduct> query)
{ {
return base.Query(model, query) return base.Query(model, query)

@ -41,7 +41,8 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
if (model.ParentId.HasValue) if (model.ParentId.HasValue)
{ {
var name = this.Repo.ReadOnlyTable() var name = this.Repo.ReadOnlyTable()
.Where(o => o.Left < entity.Left && o.Left > 1).ToList() .Where(o=>o.ParentId!=null)
.Where(o => o.Left < entity.Left && o.Right > entity.Right).ToList()
.ToList() .ToList()
.ToTree() .ToTree()
.FirstOrDefault(o => o.Id == model.ParentId.Value)?.GetDisplayName(); .FirstOrDefault(o => o.Id == model.ParentId.Value)?.GetDisplayName();
Loading…
Cancel
Save