升级至 .net6

This commit is contained in:
dd 2022-01-24 23:10:56 +08:00
parent 7f59e9a3f3
commit 30f07f7172
171 changed files with 1562 additions and 22403 deletions

View File

@ -105,7 +105,22 @@
"ProjectGuid": "c8c82c05-defd-4e79-9772-b5ea3d2e5d88",
"DisplayName": "DriverAllenBradley",
"ColorIndex": 3
},
"1f9122c1-19de-4a8b-9a00-d59e592ecc3a": {
"ProjectGuid": "1f9122c1-19de-4a8b-9a00-d59e592ecc3a",
"DisplayName": "IoTGateway",
"ColorIndex": 4
},
"5c12ebfb-b152-48c6-aa52-71128f246594": {
"ProjectGuid": "5c12ebfb-b152-48c6-aa52-71128f246594",
"DisplayName": "Plugin",
"ColorIndex": 5
},
"96d436b4-4703-4448-a879-b69ace89ca11": {
"ProjectGuid": "96d436b4-4703-4448-a879-b69ace89ca11",
"DisplayName": "WalkingTec.Mvvm.Mvc",
"ColorIndex": 6
}
},
"NextColorIndex": 4
"NextColorIndex": 7
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
FROM mcr.microsoft.com/dotnet/aspnet:6.0-buster-slim AS base
WORKDIR /app
EXPOSE 518
EXPOSE 1888
@ -9,7 +9,7 @@ RUN apt-get update
RUN apt-get install libgdiplus -y
RUN apt-get install nano -y
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0-buster-slim AS build
WORKDIR /src
COPY ["IoTGateway/IoTGateway.csproj", "IoTGateway/"]

View File

@ -1,16 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<PreserveCompilationReferences>true</PreserveCompilationReferences>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.9">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -0,0 +1,798 @@
// <auto-generated />
using System;
using IoTGateway.DataAccess;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace IoTGateway.DataAccess.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20220124063657_platforms")]
partial class platforms
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.1");
modelBuilder.Entity("IoTGateway.Model.Device", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<bool>("AutoStart")
.HasColumnType("INTEGER");
b.Property<string>("CreateBy")
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<string>("DeviceName")
.HasColumnType("TEXT");
b.Property<int>("DeviceTypeEnum")
.HasColumnType("INTEGER");
b.Property<Guid?>("DriverId")
.HasColumnType("TEXT");
b.Property<uint>("Index")
.HasColumnType("INTEGER");
b.Property<Guid?>("ParentId")
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.HasKey("ID");
b.HasIndex("DriverId");
b.HasIndex("ParentId");
b.ToTable("Devices");
});
modelBuilder.Entity("IoTGateway.Model.DeviceConfig", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("CreateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<string>("DeviceConfigName")
.HasColumnType("TEXT");
b.Property<Guid?>("DeviceId")
.HasColumnType("TEXT");
b.Property<string>("EnumInfo")
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("ID");
b.HasIndex("DeviceId");
b.ToTable("DeviceConfigs");
});
modelBuilder.Entity("IoTGateway.Model.DeviceVariable", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<int>("DataType")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<string>("DeviceAddress")
.HasColumnType("TEXT");
b.Property<Guid?>("DeviceId")
.HasColumnType("TEXT");
b.Property<string>("Expressions")
.HasColumnType("TEXT");
b.Property<string>("Method")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<int>("ProtectType")
.HasColumnType("INTEGER");
b.HasKey("ID");
b.HasIndex("DeviceId");
b.ToTable("DeviceVariables");
});
modelBuilder.Entity("IoTGateway.Model.Driver", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("AssembleName")
.HasColumnType("TEXT");
b.Property<int>("AuthorizesNum")
.HasColumnType("INTEGER");
b.Property<string>("CreateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<string>("DriverName")
.HasColumnType("TEXT");
b.Property<string>("FileName")
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.HasKey("ID");
b.ToTable("Drivers");
});
modelBuilder.Entity("IoTGateway.Model.SystemConfig", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("CreateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<string>("GatewayName")
.HasColumnType("TEXT");
b.Property<int>("IoTPlatformType")
.HasColumnType("INTEGER");
b.Property<string>("MqttIp")
.HasColumnType("TEXT");
b.Property<int>("MqttPort")
.HasColumnType("INTEGER");
b.Property<string>("MqttUName")
.HasColumnType("TEXT");
b.Property<string>("MqttUPwd")
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.HasKey("ID");
b.ToTable("SystemConfig");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.ActionLog", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("ActionName")
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<DateTime>("ActionTime")
.HasColumnType("TEXT");
b.Property<string>("ActionUrl")
.HasMaxLength(250)
.HasColumnType("TEXT");
b.Property<string>("CreateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<double>("Duration")
.HasColumnType("REAL");
b.Property<string>("IP")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("ITCode")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("LogType")
.HasColumnType("INTEGER");
b.Property<string>("ModuleName")
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<string>("Remark")
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.HasKey("ID");
b.ToTable("ActionLogs");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.DataPrivilege", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("CreateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<string>("Domain")
.HasColumnType("TEXT");
b.Property<string>("GroupCode")
.HasColumnType("TEXT");
b.Property<string>("RelateId")
.HasColumnType("TEXT");
b.Property<string>("TableName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.Property<string>("UserCode")
.HasColumnType("TEXT");
b.HasKey("ID");
b.ToTable("DataPrivileges");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FileAttachment", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("ExtraInfo")
.HasColumnType("TEXT");
b.Property<byte[]>("FileData")
.HasColumnType("BLOB");
b.Property<string>("FileExt")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("TEXT");
b.Property<string>("FileName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("HandlerInfo")
.HasColumnType("TEXT");
b.Property<long>("Length")
.HasColumnType("INTEGER");
b.Property<string>("Path")
.HasColumnType("TEXT");
b.Property<string>("SaveMode")
.HasColumnType("TEXT");
b.Property<DateTime>("UploadTime")
.HasColumnType("TEXT");
b.HasKey("ID");
b.ToTable("FileAttachments");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkGroup", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("CreateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<string>("GroupCode")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("GroupName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("GroupRemark")
.HasColumnType("TEXT");
b.Property<string>("TenantCode")
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.HasKey("ID");
b.ToTable("FrameworkGroups");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkMenu", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("ActionName")
.HasColumnType("TEXT");
b.Property<string>("ClassName")
.HasColumnType("TEXT");
b.Property<int?>("DisplayOrder")
.IsRequired()
.HasColumnType("INTEGER");
b.Property<string>("Domain")
.HasColumnType("TEXT");
b.Property<bool>("FolderOnly")
.HasColumnType("INTEGER");
b.Property<string>("Icon")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<bool>("IsInherit")
.HasColumnType("INTEGER");
b.Property<bool?>("IsInside")
.IsRequired()
.HasColumnType("INTEGER");
b.Property<bool>("IsPublic")
.HasColumnType("INTEGER");
b.Property<string>("MethodName")
.HasColumnType("TEXT");
b.Property<string>("ModuleName")
.HasColumnType("TEXT");
b.Property<string>("PageName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<Guid?>("ParentId")
.HasColumnType("TEXT");
b.Property<bool>("ShowOnMenu")
.HasColumnType("INTEGER");
b.Property<string>("Url")
.HasColumnType("TEXT");
b.HasKey("ID");
b.HasIndex("ParentId");
b.ToTable("FrameworkMenus");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkRole", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("CreateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<string>("RoleCode")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("RoleName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("RoleRemark")
.HasColumnType("TEXT");
b.Property<string>("TenantCode")
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.HasKey("ID");
b.ToTable("FrameworkRoles");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUser", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Address")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("CellPhone")
.HasColumnType("TEXT");
b.Property<string>("CreateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int?>("Gender")
.HasColumnType("INTEGER");
b.Property<string>("HomePhone")
.HasMaxLength(30)
.HasColumnType("TEXT");
b.Property<string>("ITCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<bool>("IsValid")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("TEXT");
b.Property<Guid?>("PhotoId")
.HasColumnType("TEXT");
b.Property<string>("TenantCode")
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.Property<string>("ZipCode")
.HasColumnType("TEXT");
b.HasKey("ID");
b.HasIndex("PhotoId");
b.ToTable("FrameworkUsers");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUserGroup", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("CreateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<string>("GroupCode")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.Property<string>("UserCode")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("ID");
b.ToTable("FrameworkUserGroups");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUserRole", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("CreateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<string>("RoleCode")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.Property<string>("UserCode")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("ID");
b.ToTable("FrameworkUserRoles");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FunctionPrivilege", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<bool?>("Allowed")
.IsRequired()
.HasColumnType("INTEGER");
b.Property<string>("CreateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<Guid>("MenuItemId")
.HasColumnType("TEXT");
b.Property<string>("RoleCode")
.HasColumnType("TEXT");
b.Property<string>("UpdateBy")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("TEXT");
b.HasKey("ID");
b.HasIndex("MenuItemId");
b.ToTable("FunctionPrivileges");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.PersistedGrant", b =>
{
b.Property<Guid>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime>("Expiration")
.HasColumnType("TEXT");
b.Property<string>("RefreshToken")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("Type")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("UserCode")
.HasColumnType("TEXT");
b.HasKey("ID");
b.ToTable("PersistedGrants");
});
modelBuilder.Entity("IoTGateway.Model.Device", b =>
{
b.HasOne("IoTGateway.Model.Driver", "Driver")
.WithMany()
.HasForeignKey("DriverId");
b.HasOne("IoTGateway.Model.Device", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId");
b.Navigation("Driver");
b.Navigation("Parent");
});
modelBuilder.Entity("IoTGateway.Model.DeviceConfig", b =>
{
b.HasOne("IoTGateway.Model.Device", "Device")
.WithMany("DeviceConfigs")
.HasForeignKey("DeviceId");
b.Navigation("Device");
});
modelBuilder.Entity("IoTGateway.Model.DeviceVariable", b =>
{
b.HasOne("IoTGateway.Model.Device", "Device")
.WithMany("DeviceVariables")
.HasForeignKey("DeviceId");
b.Navigation("Device");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkMenu", b =>
{
b.HasOne("WalkingTec.Mvvm.Core.FrameworkMenu", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId");
b.Navigation("Parent");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUser", b =>
{
b.HasOne("WalkingTec.Mvvm.Core.FileAttachment", "Photo")
.WithMany()
.HasForeignKey("PhotoId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("Photo");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FunctionPrivilege", b =>
{
b.HasOne("WalkingTec.Mvvm.Core.FrameworkMenu", "MenuItem")
.WithMany("Privileges")
.HasForeignKey("MenuItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MenuItem");
});
modelBuilder.Entity("IoTGateway.Model.Device", b =>
{
b.Navigation("Children");
b.Navigation("DeviceConfigs");
b.Navigation("DeviceVariables");
});
modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkMenu", b =>
{
b.Navigation("Children");
b.Navigation("Privileges");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IoTGateway.DataAccess.Migrations
{
public partial class platforms : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Disperse",
table: "SystemConfig",
newName: "IoTPlatformType");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "IoTPlatformType",
table: "SystemConfig",
newName: "Disperse");
}
}
}

View File

@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace IoTGateway.DataAccess.Migrations
{
[DbContext(typeof(DataContext))]
@ -13,8 +15,7 @@ namespace IoTGateway.DataAccess.Migrations
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.9");
modelBuilder.HasAnnotation("ProductVersion", "6.0.1");
modelBuilder.Entity("IoTGateway.Model.Device", b =>
{
@ -193,12 +194,12 @@ namespace IoTGateway.DataAccess.Migrations
b.Property<DateTime?>("CreateTime")
.HasColumnType("TEXT");
b.Property<bool>("Disperse")
.HasColumnType("INTEGER");
b.Property<string>("GatewayName")
.HasColumnType("TEXT");
b.Property<int>("IoTPlatformType")
.HasColumnType("INTEGER");
b.Property<string>("MqttIp")
.HasColumnType("TEXT");

View File

@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<PreserveCompilationReferences>true</PreserveCompilationReferences>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Plugins\PluginInterface\PluginInterface.csproj" />
<ProjectReference Include="..\WalkingTec.Mvvm\WalkingTec.Mvvm.Core\WalkingTec.Mvvm.Core.csproj" />

View File

@ -15,7 +15,23 @@ namespace IoTGateway.Model
public string MqttUName { get; set; }
[Display(Name = "Mqtt密码")]
public string MqttUPwd { get; set; }
[Display(Name = "离散输出")]
public bool Disperse { get; set; }
[Display(Name = "输出平台")]
public IoTPlatformType IoTPlatformType { get; set; }
}
public enum IoTPlatformType
{
[Display(Name = "ThingsBoard")]
ThingsBoard =0,
[Display(Name = "IoTSharp")]
IoTSharp =1,
[Display(Name = "阿里物联网平台")]
AliCloudIoT=2,
[Display(Name = "腾讯智能云")]
TencentIoTHub =3,
[Display(Name = "百度物联网通信")]
BaiduIoTCore =4,
[Display(Name = "中移OneNet")]
OneNET =5
}
}

View File

@ -15,6 +15,7 @@ namespace IoTGateway.ViewModel.BasicData.DeviceVMs
[Display(Name = "名称")]
public String DeviceName { get; set; }
public List<ComboSelectListItem> AllDrivers { get; set; }
[Display(Name = "驱动")]
public Guid? DriverId { get; set; }
[Display(Name = "自启动")]
public Boolean? AutoStart { get; set; }

View File

@ -33,11 +33,11 @@ namespace IoTGateway.ViewModel.Config.SystemConfigVMs
{
return new List<GridColumn<SystemConfig_View>>{
this.MakeGridHeader(x => x.GatewayName),
this.MakeGridHeader(x => x.IoTPlatformType),
this.MakeGridHeader(x => x.MqttIp),
this.MakeGridHeader(x => x.MqttPort),
this.MakeGridHeader(x => x.MqttUName),
this.MakeGridHeader(x => x.MqttUPwd),
this.MakeGridHeader(x => x.Disperse),
this.MakeGridHeaderAction(width: 200)
};
}
@ -53,7 +53,7 @@ namespace IoTGateway.ViewModel.Config.SystemConfigVMs
MqttPort = x.MqttPort,
MqttUName = x.MqttUName,
MqttUPwd = x.MqttUPwd,
Disperse = x.Disperse,
IoTPlatformType = x.IoTPlatformType,
})
.OrderBy(x => x.ID);
return query;

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<PreserveCompilationReferences>true</PreserveCompilationReferences>
</PropertyGroup>

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
@ -56,33 +57,34 @@ namespace WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkMenuVMs
private object GenerateCheckBox(FrameworkMenu_ListView item)
{
string rv = "";
StringBuilder rv = new StringBuilder();
if (item.FolderOnly == false)
{
rv.Append($"<input do-not-use-selectall hidden lay-skin='primary' type='checkbox' title='{Localizer["Sys.All"]}'>");
if (item.IsInside == true)
{
var others = item.Children?.ToList();
rv += UIService.MakeCheckBox(item.Allowed, Localizer["Sys.MainPage"], "menu_" + item.ID, "1");
rv.Append(UIService.MakeCheckBox(item.Allowed, Localizer["Sys.MainPage"], "menu_" + item.ID, "1"));
if (others != null)
{
foreach (var c in others)
{
string actionname = "";
if(c.ActionName != null)
if (c.ActionName != null)
{
actionname = Localizer[c.ActionName];
actionname = Localizer[c.ActionName];
}
rv += UIService.MakeCheckBox(c.Allowed, actionname, "menu_" + c.ID, "1");
rv.Append(UIService.MakeCheckBox(c.Allowed, actionname, "menu_" + c.ID, "1"));
}
}
}
else
{
rv += UIService.MakeCheckBox(item.Allowed, Localizer["Sys.MainPage"], "menu_" + item.ID, "1");
rv.Append(UIService.MakeCheckBox(item.Allowed, Localizer["Sys.MainPage"], "menu_" + item.ID, "1"));
}
}
return rv;
return rv.ToString();
}
@ -122,16 +124,16 @@ namespace WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkMenuVMs
{
var data = DC.Set<FrameworkMenu>().ToList();
var topdata = data.Where(x => x.ParentId == null).ToList().FlatTree(x => x.DisplayOrder).Where(x => x.IsInside == false || x.FolderOnly == true || x.Url.EndsWith("/Index") || x.MethodName == null).ToList();
var topdata = data.Where(x => x.ParentId == null).ToList().FlatTree(x => x.DisplayOrder).Where(x => x.IsInside == false || x.FolderOnly == true || x.Url.EndsWith("/Index") || string.IsNullOrEmpty(x.MethodName)).ToList();
foreach (var item in topdata)
{
if (item.PageName?.StartsWith("MenuKey.") == true)
{
item.PageName =Localizer[item.PageName];
item.PageName = Localizer[item.PageName];
}
if (item.ModuleName?.StartsWith("MenuKey.") == true)
{
item.ModuleName = Localizer[item.ModuleName];
item.ModuleName = Localizer[item.ModuleName];
}
}
@ -139,7 +141,7 @@ namespace WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkMenuVMs
if (SearcherMode == ListVMSearchModeEnum.Custom2)
{
var pris = DC.Set<FunctionPrivilege>()
.Where(x => x.RoleCode == DC.Set<FrameworkRole>().CheckID(Searcher.RoleID,null).Select(x=>x.RoleCode).FirstOrDefault()).ToList();
.Where(x => x.RoleCode == DC.Set<FrameworkRole>().CheckID(Searcher.RoleID, null).Select(x => x.RoleCode).FirstOrDefault()).ToList();
var allowed = pris.Where(x => x.Allowed == true).Select(x => x.MenuItemId).ToList();
var denied = pris.Where(x => x.Allowed == false).Select(x => x.MenuItemId).ToList();
int order = 0;

View File

@ -75,16 +75,7 @@ namespace WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkMenuVMs
}
var modules = Wtm.GlobaInfo.AllModule;
var toRemove = new List<SimpleModule>();
foreach (var item in modules)
{
if (item.IgnorePrivillege)
{
toRemove.Add(item);
}
}
var m = Utils.ResetModule(modules);
toRemove.ForEach(x => m.Remove(x));
AllModules = m.ToListItems(y => y.ModuleName, y => y.FullName);
if (string.IsNullOrEmpty(SelectedModule) == false || (string.IsNullOrEmpty(Entity.Url) == false && Entity.IsInside == true))
@ -113,7 +104,7 @@ namespace WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkMenuVMs
MSD.AddModelError("SelectedModule", Localizer["Validate.{0}required", Localizer["_Admin.Module"]]);
}
var modules = Wtm.GlobaInfo.AllModule;
var test = DC.Set<FrameworkMenu>().Where(x => x.ClassName == this.SelectedModule && (x.MethodName == null || x.MethodName == "Index") && x.ID != Entity.ID).FirstOrDefault();
var test = DC.Set<FrameworkMenu>().Where(x => x.ClassName == this.SelectedModule && (string.IsNullOrEmpty(x.MethodName) || x.MethodName == "Index") && x.ID != Entity.ID).FirstOrDefault();
if (test != null)
{
MSD.AddModelError(" error", Localizer["_Admin.ModuleHasSet"]);

View File

@ -25,7 +25,7 @@ namespace WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkRoleVMs
.Where(x => x.RoleCode == Entity.RoleCode && x.Allowed == true).Select(x => x.MenuItemId)
.ToList();
var data = DC.Set<FrameworkMenu>().ToList();
var topdata = data.Where(x => x.ParentId == null).ToList().FlatTree(x => x.DisplayOrder).Where(x => x.IsInside == false || x.FolderOnly == true || x.MethodName == null).ToList();
var topdata = data.Where(x => x.ParentId == null).ToList().FlatTree(x => x.DisplayOrder).Where(x => x.IsInside == false || x.FolderOnly == true || string.IsNullOrEmpty(x.MethodName)).ToList();
int order = 0;
var data2 = topdata.Select(x => new Page_View
{

View File

@ -3,20 +3,30 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text.Json.Serialization;
using Microsoft.EntityFrameworkCore;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkRoleVMs;
namespace WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkUserVms
{
public class FrameworkUserBatchVM : BaseBatchVM<FrameworkUser, FrameworkUser_BatchEdit>
{
[JsonIgnore]
public FrameworkRoleListVM RoleListVM { get; set; }
public FrameworkUserBatchVM()
{
ListVM = new FrameworkUserListVM();
LinkedVM = new FrameworkUser_BatchEdit();
}
protected override void InitVM()
{
RoleListVM = Wtm.CreateVM<FrameworkRoleListVM>();
}
public override bool DoBatchEdit()
{
var entityList = DC.Set<FrameworkUser>().AsNoTracking().CheckIDs(Ids.ToList()).ToList();

View File

@ -3,43 +3,43 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31919.166
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTGateway", "IoTGateway\IoTGateway.csproj", "{68ABBDF2-1485-4756-9A94-6AFA874D69A3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTGateway", "IoTGateway\IoTGateway.csproj", "{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTGateway.Model", "IoTGateway.Model\IoTGateway.Model.csproj", "{C2978E5D-E71E-4882-8EF1-4014E8565A77}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTGateway.Model", "IoTGateway.Model\IoTGateway.Model.csproj", "{44619988-9F09-4714-9532-A44FAF8275FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTGateway.DataAccess", "IoTGateway.DataAccess\IoTGateway.DataAccess.csproj", "{9E7C8C77-643F-45CF-8EDC-5B032C51D563}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTGateway.DataAccess", "IoTGateway.DataAccess\IoTGateway.DataAccess.csproj", "{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTGateway.ViewModel", "IoTGateway.ViewModel\IoTGateway.ViewModel.csproj", "{00E91FC1-D5CF-416A-AAAF-61567E368DCD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTGateway.ViewModel", "IoTGateway.ViewModel\IoTGateway.ViewModel.csproj", "{E63C22D5-5F9B-4671-B115-40721B27F09F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{FBED048F-7AB9-4348-AD56-F9BF4D9E3A55}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{2C665127-D9D0-445E-80A9-FD459673D454}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin", "Plugins\Plugin\Plugin.csproj", "{61D79F77-09EF-4A98-A50B-043B1D72C111}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WalkingTec.Mvvm", "WalkingTec.Mvvm", "{0DD65BFB-EDC4-49CD-857C-6CCAAAF1CDFB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PluginInterface", "Plugins\PluginInterface\PluginInterface.csproj", "{E5F79995-AB61-41F4-820D-BA39967B406B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WalkingTec.Mvvm.Core", "WalkingTec.Mvvm\WalkingTec.Mvvm.Core\WalkingTec.Mvvm.Core.csproj", "{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Drivers", "Drivers", "{52D96C24-2F2F-49B5-9F29-00414DEA41D8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WalkingTec.Mvvm.Mvc", "WalkingTec.Mvvm\WalkingTec.Mvvm.Mvc\WalkingTec.Mvvm.Mvc.csproj", "{96D436B4-4703-4448-A879-B69ACE89CA11}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WalkingTec.Mvvm", "WalkingTec.Mvvm", "{98B1C9F0-028C-48D8-8148-54B69CCA4590}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WalkingTec.Mvvm.TagHelpers.LayUI", "WalkingTec.Mvvm\WalkingTec.Mvvm.TagHelpers.LayUI\WalkingTec.Mvvm.TagHelpers.LayUI.csproj", "{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WalkingTec.Mvvm.Core", "WalkingTec.Mvvm\WalkingTec.Mvvm.Core\WalkingTec.Mvvm.Core.csproj", "{C2672620-8E65-486C-B967-C4C673F8DA0F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin", "Plugins\Plugin\Plugin.csproj", "{5C12EBFB-B152-48C6-AA52-71128F246594}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WalkingTec.Mvvm.Mvc", "WalkingTec.Mvvm\WalkingTec.Mvvm.Mvc\WalkingTec.Mvvm.Mvc.csproj", "{B370F699-965B-4D86-93B1-0F022C95B5C9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PluginInterface", "Plugins\PluginInterface\PluginInterface.csproj", "{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WalkingTec.Mvvm.TagHelpers.LayUI", "WalkingTec.Mvvm\WalkingTec.Mvvm.TagHelpers.LayUI\WalkingTec.Mvvm.TagHelpers.LayUI.csproj", "{81CBFD0E-1D89-440A-8CC3-E32672504FF4}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Drivers", "Drivers", "{D05CFF72-D58C-418A-8F52-B06848DAC4F1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverModbusMaster", "Plugins\Drivers\DriverModbusMaster\DriverModbusMaster.csproj", "{4FC43620-00B1-48C1-A5A0-02FCC038FB08}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverAllenBradley", "Plugins\Drivers\DriverAllenBradley\DriverAllenBradley.csproj", "{3106F31C-0502-42D3-A27B-BDD2199D72CC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverSiemensS7", "Plugins\Drivers\DriverSiemensS7\DriverSiemensS7.csproj", "{B884FBE3-C8C5-471E-B629-12ECA0FC5DAC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverMitsubishi", "Plugins\Drivers\DriverMitsubishi\DriverMitsubishi.csproj", "{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverOPCUaClient", "Plugins\Drivers\DriverOPCUaClient\DriverOPCUaClient.csproj", "{DABB562D-5EB7-4F9D-90EF-424C2BF63A4D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverModbusMaster", "Plugins\Drivers\DriverModbusMaster\DriverModbusMaster.csproj", "{8E2D91DC-DEE4-4843-8D09-6FC06651527E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverMTConnect", "Plugins\Drivers\DriverMTConnect\DriverMTConnect.csproj", "{0602DC6C-FB26-41B1-972E-298679826E3F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverMTConnect", "Plugins\Drivers\DriverMTConnect\DriverMTConnect.csproj", "{64D4C755-33DD-4103-908B-82FA63C5BFB2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverMitsubishi", "Plugins\Drivers\DriverMitsubishi\DriverMitsubishi.csproj", "{6D926CD7-5FF9-489B-9049-7030AE8059C9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverOPCUaClient", "Plugins\Drivers\DriverOPCUaClient\DriverOPCUaClient.csproj", "{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverOmronFins", "Plugins\Drivers\OmronFins\DriverOmronFins.csproj", "{92E2BB84-C7EC-418E-879A-40B891CAE6E7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverSiemensS7", "Plugins\Drivers\DriverSiemensS7\DriverSiemensS7.csproj", "{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverAllenBradley", "Plugins\Drivers\DriverAllenBradley\DriverAllenBradley.csproj", "{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverOmronFins", "Plugins\Drivers\DriverOmronFins\DriverOmronFins.csproj", "{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -47,88 +47,88 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{68ABBDF2-1485-4756-9A94-6AFA874D69A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68ABBDF2-1485-4756-9A94-6AFA874D69A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68ABBDF2-1485-4756-9A94-6AFA874D69A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68ABBDF2-1485-4756-9A94-6AFA874D69A3}.Release|Any CPU.Build.0 = Release|Any CPU
{C2978E5D-E71E-4882-8EF1-4014E8565A77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2978E5D-E71E-4882-8EF1-4014E8565A77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2978E5D-E71E-4882-8EF1-4014E8565A77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2978E5D-E71E-4882-8EF1-4014E8565A77}.Release|Any CPU.Build.0 = Release|Any CPU
{9E7C8C77-643F-45CF-8EDC-5B032C51D563}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9E7C8C77-643F-45CF-8EDC-5B032C51D563}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E7C8C77-643F-45CF-8EDC-5B032C51D563}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E7C8C77-643F-45CF-8EDC-5B032C51D563}.Release|Any CPU.Build.0 = Release|Any CPU
{00E91FC1-D5CF-416A-AAAF-61567E368DCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00E91FC1-D5CF-416A-AAAF-61567E368DCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00E91FC1-D5CF-416A-AAAF-61567E368DCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00E91FC1-D5CF-416A-AAAF-61567E368DCD}.Release|Any CPU.Build.0 = Release|Any CPU
{61D79F77-09EF-4A98-A50B-043B1D72C111}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61D79F77-09EF-4A98-A50B-043B1D72C111}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61D79F77-09EF-4A98-A50B-043B1D72C111}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61D79F77-09EF-4A98-A50B-043B1D72C111}.Release|Any CPU.Build.0 = Release|Any CPU
{E5F79995-AB61-41F4-820D-BA39967B406B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5F79995-AB61-41F4-820D-BA39967B406B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5F79995-AB61-41F4-820D-BA39967B406B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5F79995-AB61-41F4-820D-BA39967B406B}.Release|Any CPU.Build.0 = Release|Any CPU
{C2672620-8E65-486C-B967-C4C673F8DA0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2672620-8E65-486C-B967-C4C673F8DA0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2672620-8E65-486C-B967-C4C673F8DA0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2672620-8E65-486C-B967-C4C673F8DA0F}.Release|Any CPU.Build.0 = Release|Any CPU
{B370F699-965B-4D86-93B1-0F022C95B5C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B370F699-965B-4D86-93B1-0F022C95B5C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B370F699-965B-4D86-93B1-0F022C95B5C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B370F699-965B-4D86-93B1-0F022C95B5C9}.Release|Any CPU.Build.0 = Release|Any CPU
{81CBFD0E-1D89-440A-8CC3-E32672504FF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{81CBFD0E-1D89-440A-8CC3-E32672504FF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{81CBFD0E-1D89-440A-8CC3-E32672504FF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{81CBFD0E-1D89-440A-8CC3-E32672504FF4}.Release|Any CPU.Build.0 = Release|Any CPU
{4FC43620-00B1-48C1-A5A0-02FCC038FB08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FC43620-00B1-48C1-A5A0-02FCC038FB08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FC43620-00B1-48C1-A5A0-02FCC038FB08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FC43620-00B1-48C1-A5A0-02FCC038FB08}.Release|Any CPU.Build.0 = Release|Any CPU
{B884FBE3-C8C5-471E-B629-12ECA0FC5DAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B884FBE3-C8C5-471E-B629-12ECA0FC5DAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B884FBE3-C8C5-471E-B629-12ECA0FC5DAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B884FBE3-C8C5-471E-B629-12ECA0FC5DAC}.Release|Any CPU.Build.0 = Release|Any CPU
{DABB562D-5EB7-4F9D-90EF-424C2BF63A4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DABB562D-5EB7-4F9D-90EF-424C2BF63A4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DABB562D-5EB7-4F9D-90EF-424C2BF63A4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DABB562D-5EB7-4F9D-90EF-424C2BF63A4D}.Release|Any CPU.Build.0 = Release|Any CPU
{0602DC6C-FB26-41B1-972E-298679826E3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0602DC6C-FB26-41B1-972E-298679826E3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0602DC6C-FB26-41B1-972E-298679826E3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0602DC6C-FB26-41B1-972E-298679826E3F}.Release|Any CPU.Build.0 = Release|Any CPU
{6D926CD7-5FF9-489B-9049-7030AE8059C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D926CD7-5FF9-489B-9049-7030AE8059C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D926CD7-5FF9-489B-9049-7030AE8059C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D926CD7-5FF9-489B-9049-7030AE8059C9}.Release|Any CPU.Build.0 = Release|Any CPU
{92E2BB84-C7EC-418E-879A-40B891CAE6E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92E2BB84-C7EC-418E-879A-40B891CAE6E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92E2BB84-C7EC-418E-879A-40B891CAE6E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92E2BB84-C7EC-418E-879A-40B891CAE6E7}.Release|Any CPU.Build.0 = Release|Any CPU
{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88}.Release|Any CPU.Build.0 = Release|Any CPU
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Release|Any CPU.Build.0 = Release|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Release|Any CPU.Build.0 = Release|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Release|Any CPU.Build.0 = Release|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Release|Any CPU.Build.0 = Release|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Release|Any CPU.Build.0 = Release|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Release|Any CPU.ActiveCfg = Release|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Release|Any CPU.Build.0 = Release|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Release|Any CPU.Build.0 = Release|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Release|Any CPU.Build.0 = Release|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Release|Any CPU.Build.0 = Release|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Release|Any CPU.Build.0 = Release|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Release|Any CPU.Build.0 = Release|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Release|Any CPU.Build.0 = Release|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Release|Any CPU.Build.0 = Release|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Release|Any CPU.Build.0 = Release|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Release|Any CPU.Build.0 = Release|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{61D79F77-09EF-4A98-A50B-043B1D72C111} = {FBED048F-7AB9-4348-AD56-F9BF4D9E3A55}
{E5F79995-AB61-41F4-820D-BA39967B406B} = {FBED048F-7AB9-4348-AD56-F9BF4D9E3A55}
{52D96C24-2F2F-49B5-9F29-00414DEA41D8} = {FBED048F-7AB9-4348-AD56-F9BF4D9E3A55}
{C2672620-8E65-486C-B967-C4C673F8DA0F} = {98B1C9F0-028C-48D8-8148-54B69CCA4590}
{B370F699-965B-4D86-93B1-0F022C95B5C9} = {98B1C9F0-028C-48D8-8148-54B69CCA4590}
{81CBFD0E-1D89-440A-8CC3-E32672504FF4} = {98B1C9F0-028C-48D8-8148-54B69CCA4590}
{4FC43620-00B1-48C1-A5A0-02FCC038FB08} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{B884FBE3-C8C5-471E-B629-12ECA0FC5DAC} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{DABB562D-5EB7-4F9D-90EF-424C2BF63A4D} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{0602DC6C-FB26-41B1-972E-298679826E3F} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{6D926CD7-5FF9-489B-9049-7030AE8059C9} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{92E2BB84-C7EC-418E-879A-40B891CAE6E7} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E} = {0DD65BFB-EDC4-49CD-857C-6CCAAAF1CDFB}
{96D436B4-4703-4448-A879-B69ACE89CA11} = {0DD65BFB-EDC4-49CD-857C-6CCAAAF1CDFB}
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF} = {0DD65BFB-EDC4-49CD-857C-6CCAAAF1CDFB}
{5C12EBFB-B152-48C6-AA52-71128F246594} = {2C665127-D9D0-445E-80A9-FD459673D454}
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954} = {2C665127-D9D0-445E-80A9-FD459673D454}
{D05CFF72-D58C-418A-8F52-B06848DAC4F1} = {2C665127-D9D0-445E-80A9-FD459673D454}
{3106F31C-0502-42D3-A27B-BDD2199D72CC} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{8E2D91DC-DEE4-4843-8D09-6FC06651527E} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{64D4C755-33DD-4103-908B-82FA63C5BFB2} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1F219808-E6E8-4C1D-B846-41F2F7CF20FA}

File diff suppressed because one or more lines are too long

View File

@ -2,14 +2,14 @@
@inject IStringLocalizer<Program> Localizer;
<wt:form vm="@Model">
<wt:quote>注意:tb只能使用非离散输出模式否则平台无法解析</wt:quote>
<wt:quote>注意:目前只实现了iotsharp和tb的遥测数据上传</wt:quote>
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.GatewayName" />
<wt:combobox field="Entity.IoTPlatformType" />
<wt:textbox field="Entity.MqttIp" />
<wt:textbox field="Entity.MqttPort" />
<wt:textbox field="Entity.MqttUName" />
<wt:textbox field="Entity.MqttUPwd" />
<wt:switch field="Entity.Disperse" />
</wt:row>
<wt:hidden field="Entity.ID" />
<wt:row align="AlignEnum.Right">

View File

@ -5,5 +5,5 @@
<wt:row items-per-row="ItemsPerRowEnum.Three">
</wt:row>
</wt:searchpanel>
<wt:quote>注意:tb只能使用非离散输出模式否则平台无法解析</wt:quote>
<wt:quote>注意:目前只实现了iotsharp和tb的遥测数据上传</wt:quote>
<wt:grid vm="@Model" url="/Config/SystemConfig/Search" />

View File

@ -78,7 +78,7 @@ namespace WalkingTec.Mvvm.Admin.Api
forapi.Groups = user.Groups;
forapi.PhotoId = user.PhotoId;
var roleIDs = Wtm.LoginUserInfo.Roles.Select(x => x.RoleCode).ToList();
var data = DC.Set<FrameworkMenu>().Where(x => x.MethodName == null).ToList();
var data = DC.Set<FrameworkMenu>().Where(x => string.IsNullOrEmpty(x.MethodName)).ToList();
var topdata = data.Where(x => x.ParentId == null && x.ShowOnMenu).ToList().FlatTree(x => x.DisplayOrder).Where(x => (x.IsInside == false || x.FolderOnly == true || string.IsNullOrEmpty(x.MethodName)) && x.ShowOnMenu).ToList();
var allowed = DC.Set<FunctionPrivilege>()
.AsNoTracking()
@ -193,7 +193,7 @@ namespace WalkingTec.Mvvm.Admin.Api
var ms = new List<SimpleMenuApi>();
var roleIDs = Wtm.LoginUserInfo.Roles.Select(x => x.RoleCode).ToList();
var data = DC.Set<FrameworkMenu>().Where(x => x.MethodName == null).ToList();
var data = DC.Set<FrameworkMenu>().Where(x => string.IsNullOrEmpty(x.MethodName)).ToList();
var topdata = data.Where(x => x.ParentId == null && x.ShowOnMenu).ToList().FlatTree(x => x.DisplayOrder).Where(x => (x.IsInside == false || x.FolderOnly == true || string.IsNullOrEmpty(x.MethodName)) && x.ShowOnMenu).ToList();
var allowed = DC.Set<FunctionPrivilege>()
.AsNoTracking()
@ -259,7 +259,7 @@ namespace WalkingTec.Mvvm.Admin.Api
{
HttpContext.Session.Clear();
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
HttpContext.Response.Redirect("/");
Ok();
}
}

View File

@ -1,8 +1,8 @@
// WTM默认页面 Wtm buidin page
// WTM默认页面 Wtm buidin page
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
@ -21,24 +21,24 @@ namespace WalkingTec.Mvvm.Admin.Api
{
[HttpPost("[action]")]
[ActionDescription("UploadFile")]
public IActionResult Upload([FromServices] WtmFileProvider fp, string sm = null, string groupName = null, string subdir=null,string extra = null,string csName= null)
public IActionResult Upload([FromServices] WtmFileProvider fp, string sm = null, string groupName = null, string subdir = null, string extra = null, string csName = null)
{
var FileData = Request.Form.Files[0];
var file = fp.Upload(FileData.FileName, FileData.Length, FileData.OpenReadStream(),groupName,subdir,extra,sm,Wtm.CreateDC(cskey:csName));
var file = fp.Upload(FileData.FileName, FileData.Length, FileData.OpenReadStream(), groupName, subdir, extra, sm, Wtm.CreateDC(cskey: csName));
return Ok(new { Id = file.GetID(), Name = file.FileName });
}
[HttpPost("[action]")]
[ActionDescription("UploadPic")]
public IActionResult UploadImage([FromServices] WtmFileProvider fp,int? width = null, int? height = null, string sm = null, string groupName = null, string subdir = null, string extra = null, string csName = null)
public IActionResult UploadImage([FromServices] WtmFileProvider fp, int? width = null, int? height = null, string sm = null, string groupName = null, string subdir = null, string extra = null, string csName = null)
{
if (width == null && height == null)
{
return Upload(fp,sm,groupName,csName);
return Upload(fp, sm, groupName, csName);
}
var FileData = Request.Form.Files[0];
Image oimage = Image.FromStream(FileData.OpenReadStream());
Image oimage = Image.Load(FileData.OpenReadStream());
if (oimage == null)
{
return BadRequest(Localizer["Sys.UploadFailed"]);
@ -52,9 +52,10 @@ namespace WalkingTec.Mvvm.Admin.Api
height = width * oimage.Height / oimage.Width;
}
MemoryStream ms = new MemoryStream();
oimage.GetThumbnailImage(width.Value, height.Value, null, IntPtr.Zero).Save(ms, System.Drawing.Imaging.ImageFormat.Png);
oimage.Mutate(x => x.Resize(width.Value, height.Value));
oimage.SaveAsJpeg(ms);
ms.Position = 0;
var file = fp.Upload(FileData.FileName, FileData.Length, ms, groupName,subdir, extra, sm, Wtm.CreateDC(cskey: csName));
var file = fp.Upload(FileData.FileName, FileData.Length, ms, groupName, subdir, extra, sm, Wtm.CreateDC(cskey: csName));
oimage.Dispose();
ms.Dispose();
@ -68,6 +69,7 @@ namespace WalkingTec.Mvvm.Admin.Api
[HttpGet("[action]/{id}")]
[ActionDescription("GetFileName")]
[Public]
public IActionResult GetFileName([FromServices] WtmFileProvider fp, string id, string csName = null)
{
return Ok(fp.GetFileName(id, ConfigInfo.CreateDC(csName)));
@ -75,6 +77,7 @@ namespace WalkingTec.Mvvm.Admin.Api
[HttpGet("[action]/{id}")]
[ActionDescription("GetFile")]
[Public]
public async Task<IActionResult> GetFile([FromServices] WtmFileProvider fp, string id, string csName = null, int? width = null, int? height = null)
{
var file = fp.GetFile(id, true, ConfigInfo.CreateDC(csName));
@ -88,7 +91,7 @@ namespace WalkingTec.Mvvm.Admin.Api
{
if (width != null || height != null)
{
Image oimage = Image.FromStream(file.DataStream);
Image oimage = Image.Load(file.DataStream);
if (oimage != null)
{
if (width == null)
@ -100,7 +103,8 @@ namespace WalkingTec.Mvvm.Admin.Api
height = oimage.Height * width / oimage.Width;
}
var ms = new MemoryStream();
oimage.GetThumbnailImage(width.Value, height.Value, null, IntPtr.Zero).Save(ms, System.Drawing.Imaging.ImageFormat.Png);
oimage.Mutate(x => x.Resize(width.Value, height.Value));
oimage.SaveAsJpeg(ms);
ms.Position = 0;
await ms?.CopyToAsync(Response.Body);
file.DataStream.Dispose();
@ -125,8 +129,10 @@ namespace WalkingTec.Mvvm.Admin.Api
}
}
[HttpGet("[action]/{id}")]
[ActionDescription("DownloadFile")]
[Public]
public IActionResult DownloadFile([FromServices] WtmFileProvider fp, string id, string csName = null)
{
var file = fp.GetFile(id, true, ConfigInfo.CreateDC(csName));
@ -149,7 +155,7 @@ namespace WalkingTec.Mvvm.Admin.Api
public IActionResult DeletedFile([FromServices] WtmFileProvider fp, string id, string csName = null)
{
fp.DeleteFile(id, ConfigInfo.CreateDC(csName));
return Ok();
return Ok(true);
}
}
}

View File

@ -175,7 +175,7 @@ namespace WalkingTec.Mvvm.Mvc.Admin.Controllers
public async Task<ActionResult> RefreshMenu()
{
Cache.Delete("FFMenus");
var userids = DC.Set<FrameworkUser>().Select(x => x.ID.ToString().ToLower()).ToArray();
var userids = DC.Set<FrameworkUser>().Select(x => x.ITCode.ToString().ToLower()).ToArray();
await Wtm.RemoveUserCache(userids);
return FFResult().Alert(Localizer["Sys.OprationSuccess"]);
}

View File

@ -8,7 +8,7 @@
<wt:hidden field="DpLists[i].List.Searcher.TableName" />
<wt:combobox multi-select="false" field="DpLists[i].IsAll" yes-text="@Localizer["_Admin.AllPris"]" no-text="@Localizer["_Admin.SelectPris"]" empty-text="@Localizer["_Admin.NoPris"]" label-text="@Model.DpLists[i].DpName" change-func="IsAllChange@(i)" />
<wt:row id="selector@(i)">
<wt:selector list-vm="DpLists[i].List" field="DpLists[i].SelectedIds" text-bind="DpLists[i].List.EntityList[0].Name" label-text="">
<wt:selector list-vm="DpLists[i].List" field="DpLists[i].SelectedIds" text-bind="DpLists[i].List.EntityList[0].Name" val-bind="DpLists[i].List.EntityList[0].ID" label-text="">
<wt:searchpanel vm="DpLists[i].List">
<wt:row items-per-row=" ItemsPerRowEnum.Two">
<wt:textbox field="DpLists[i].List.Searcher.Filter" />

View File

@ -13,5 +13,26 @@
<wt:closebutton />
</wt:row>
</wt:form>
<script>
$().ready(function () {
var $selectAll = $('input[do-not-use-selectall]+div');
$selectAll.each(function (index, dom) {
var existUnchecked = $(dom).nextAll('div:not(.layui-form-checked)').length;
if (existUnchecked == 0) {
$(dom).click();
}
});
$selectAll.on('click', function (value) {
var $el = $(this);
if ($el.hasClass('layui-form-checked')) {
$el.nextAll('div:not(.layui-form-checked)').click();
}
else {
$el.nextAll('div.layui-form-checked').click();
}
});
});
</script>
<!-- WTM默认页面 Wtm buidin page-->

View File

@ -4,9 +4,14 @@
<wt:form vm="@Model">
<div style="margin-bottom:10px">@Localizer["Sys.BatchEditConfirm"] </div>
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:checkbox field="LinkedVM.SelectedRolesCodes" items="LinkedVM.AllRoles" />
</wt:row>
<wt:selector list-vm="RoleListVM" field="LinkedVM.SelectedRolesCodes" text-bind="RoleListVM.EntityList[0].RoleName" val-bind="RoleListVM.EntityList[0].RoleCode">
<wt:searchpanel vm="RoleListVM">
<wt:row items-per-row=" ItemsPerRowEnum.Two">
<wt:textbox field="RoleListVM.Searcher.RoleCode" />
<wt:textbox field="RoleListVM.Searcher.RoleName" />
</wt:row>
</wt:searchpanel>
</wt:selector>
<wt:hidden field="Ids" />
<wt:grid vm="ListVM" use-local-data="true" height="300" hidden-checkbox="true" hidden-panel="true" />
<wt:row align="AlignEnum.Right">

View File

@ -26,7 +26,7 @@
<wt:combobox field="Entity.Gender" />
</wt:row>
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.CellPhone" />
<wt:textbox field="Entity.CellPhone" default-value="13912345678"/>
<wt:textbox field="Entity.HomePhone" />
</wt:row>
<wt:row items-per-row="ItemsPerRowEnum.Two">

View File

@ -2,7 +2,7 @@
<wt:form vm="@Model">
<wt:row items-per-row=" ItemsPerRowEnum.Two">
<wt:image field="Entity.PhotoId" width="300" />
<wt:image field="Entity.PhotoId" width="128" />
<wt:display field="Entity.ITCode" />
<wt:display field="Entity.Name" />
<wt:display field="Entity.Gender" />

View File

@ -26,7 +26,7 @@
<wt:combobox field="Entity.Gender" />
</wt:row>
<wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:textbox field="Entity.CellPhone" />
<wt:textbox field="Entity.CellPhone" default-value="13912345678"/>
<wt:textbox field="Entity.HomePhone" />
</wt:row>
<wt:row items-per-row="ItemsPerRowEnum.Two">

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<SatelliteResourceLanguages>zh-Hans,en</SatelliteResourceLanguages>
@ -9,32 +9,24 @@
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<UserSecretsId>109f0b79-49c8-4cb6-9aa4-44ab3b35b753</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
<PackageReference Include="MQTTnet" Version="3.1.1" />
<PackageReference Include="MQTTnet.AspNetCore" Version="3.1.1" />
<PackageReference Include="MQTTnet.Extensions.ManagedClient" Version="3.1.1" />
<PackageReference Include="MQTTnet.Extensions.Rpc" Version="3.1.1" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IoTGateway.Model\IoTGateway.Model.csproj" />
<ProjectReference Include="..\IoTGateway.DataAccess\IoTGateway.DataAccess.csproj" />
<ProjectReference Include="..\IoTGateway.ViewModel\IoTGateway.ViewModel.csproj" />
<ProjectReference Include="..\Plugins\Plugin\Plugin.csproj" />
<ProjectReference Include="..\WalkingTec.Mvvm\WalkingTec.Mvvm.Mvc\WalkingTec.Mvvm.Mvc.csproj" />
<ProjectReference Include="..\WalkingTec.Mvvm\WalkingTec.Mvvm.TagHelpers.LayUI\WalkingTec.Mvvm.TagHelpers.LayUI.csproj" />
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
</Project>

View File

@ -14,6 +14,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<ProjectGuid>68abbdf2-1485-4756-9a94-6afa874d69a3</ProjectGuid>
<SelfContained>false</SelfContained>
</PropertyGroup>

View File

@ -5,6 +5,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PublishTargetUrl>E:\workbench\iotgateway\IoTGateway\bin\Release\net5.0\publish\</_PublishTargetUrl>
<History>True|2022-01-16T14:02:51.6829056Z;True|2022-01-16T13:59:48.3664224+08:00;True|2021-12-24T19:18:19.0736393+08:00;True|2021-12-24T16:46:49.1192015+08:00;True|2021-12-24T16:23:28.9214784+08:00;True|2021-12-24T15:20:08.6401847+08:00;True|2021-12-17T19:11:07.1655146+08:00;True|2021-12-12T14:11:08.8380502+08:00;</History>
<History>True|2021-12-24T11:18:19.0736393Z;True|2021-12-24T16:46:49.1192015+08:00;True|2021-12-24T16:23:28.9214784+08:00;True|2021-12-24T15:20:08.6401847+08:00;True|2021-12-17T19:11:07.1655146+08:00;True|2021-12-12T14:11:08.8380502+08:00;</History>
</PropertyGroup>
</Project>

View File

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@ -36,7 +35,7 @@ namespace IoTGateway
public void ConfigureServices(IServiceCollection services)
{
services.AddDistributedMemoryCache();
services.AddWtmSession(36000, ConfigRoot);
services.AddWtmSession(360000, ConfigRoot);
services.AddWtmCrossDomain(ConfigRoot);
services.AddWtmAuthentication(ConfigRoot);
services.AddWtmHttpClient(ConfigRoot);
@ -47,11 +46,10 @@ namespace IoTGateway
{
options.UseWtmMvcOptions();
})
.AddJsonOptions(options =>
{
.AddJsonOptions(options => {
options.UseWtmJsonOptions();
})
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
.ConfigureApiBehaviorOptions(options =>
{
options.UseWtmApiOptions();
@ -59,8 +57,7 @@ namespace IoTGateway
.AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
.AddWtmDataAnnotationsLocalization(typeof(Program));
services.AddWtmContext(ConfigRoot, (options) =>
{
services.AddWtmContext(ConfigRoot, (options)=> {
options.DataPrivileges = DataPrivilegeSettings();
options.CsSelector = CSSelector;
options.FileSubDirSelector = SubDirSelector;
@ -69,9 +66,9 @@ namespace IoTGateway
//MQTTServer
services.AddHostedMqttServer(mqttServer =>
{
mqttServer.WithoutDefaultEndpoint();
})
{
mqttServer.WithoutDefaultEndpoint();
})
.AddMqttConnectionHandler()
.AddConnections();
@ -81,6 +78,7 @@ namespace IoTGateway
services.AddSingleton<DrvierService>();
services.AddSingleton<UAService>();
services.AddSingleton<MyMqttClient>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@ -108,7 +106,6 @@ namespace IoTGateway
})
};
app.UseExceptionHandler(configs.CurrentValue.ErrorHandler);
app.UseStaticFiles(pvd);
app.UseWtmStaticFiles();
@ -138,6 +135,8 @@ namespace IoTGateway
});
app.UseWtmContext();
}
/// <summary>

View File

@ -46,12 +46,12 @@
<ul class="loginForm">
<li>
<i><img src="~/images/icon-login04.png" /></i>
<input type="text" name="ITCode" placeholder="@Model.Localizer["Login.InputUserName"]" class="login-input" autocomplete="off" value="admin">
</li>
<input type="text" name="ITCode" placeholder="admin" class="login-input" autocomplete="off" value="@Model.ITCode">
</li>@*@Model.Localizer["Login.InputUserName"]*@
<li>
<i style="width: 16px;"><img src="~/images/icon-login01.png" /></i>
<input type="password" name="Password" placeholder="@Model.Localizer["Login.InputPassword"]" class="login-input" value="000000">
</li>
<input type="password" name="Password" placeholder="000000" class="login-input" value="@Model.Password">
</li>@*@Model.Localizer["Login.InputPassword"]*@
<li>
<i><img src="~/images/icon-login03.png" /></i>
<input type="text" name="VerifyCode" placeholder="@Model.Localizer["Login.InputValidation"]" class="login-input">

View File

@ -83,19 +83,19 @@
"JwtOptions": {
"Issuer": "http://localhost",
"Audience": "http://localhost",
"Expires": 36000,
"Expires": 360000,
"SecurityKey": "superSecretKey@345",
"RefreshTokenExpires": 864000,
"RefreshTokenExpires": 8640000,
"LoginPath": "/_Framework/Redirect401"
},
"CookieOptions": {
"Issuer": "http://localhost",
"Audience": "http://localhost",
"Domain": "",
"Expires": 36000,
"Expires": 360000,
"SlidingExpiration": true,
"SecurityKey": "superSecretKey@345",
"RefreshTokenExpires": 864000,
"RefreshTokenExpires": 8640000,
"LoginPath": "/Login/Login"
},
"Domains": {

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -1,314 +1,2 @@
/**
@Namecarousel 轮播模块
@LicenseMIT
*/
layui.define('jquery', function(exports){
"use strict";
var $ = layui.$
,hint = layui.hint()
,device = layui.device()
//外部接口
,carousel = {
config: {} //全局配置项
//设置全局项
,set: function(options){
var that = this;
that.config = $.extend({}, that.config, options);
return that;
}
//事件
,on: function(events, callback){
return layui.onevent.call(this, MOD_NAME, events, callback);
}
}
//字符常量
,MOD_NAME = 'carousel', ELEM = '.layui-carousel', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'layui-disabled'
,ELEM_ITEM = '>*[carousel-item]>*', ELEM_LEFT = 'layui-carousel-left', ELEM_RIGHT = 'layui-carousel-right', ELEM_PREV = 'layui-carousel-prev', ELEM_NEXT = 'layui-carousel-next', ELEM_ARROW = 'layui-carousel-arrow', ELEM_IND = 'layui-carousel-ind'
//构造器
,Class = function(options){
var that = this;
that.config = $.extend({}, that.config, carousel.config, options);
that.render();
};
//默认配置
Class.prototype.config = {
width: '600px'
,height: '280px'
,full: false //是否全屏
,arrow: 'hover' //切换箭头默认显示状态hover/always/none
,indicator: 'inside' //指示器位置inside/outside/none
,autoplay: true //是否自动切换
,interval: 3000 //自动切换的时间间隔不能低于800ms
,anim: '' //动画类型default/updown/fade
,trigger: 'click' //指示器的触发方式click/hover
,index: 0 //初始开始的索引
};
//轮播渲染
Class.prototype.render = function(){
var that = this
,options = that.config;
options.elem = $(options.elem);
if(!options.elem[0]) return;
that.elemItem = options.elem.find(ELEM_ITEM);
if(options.index < 0) options.index = 0;
if(options.index >= that.elemItem.length) options.index = that.elemItem.length - 1;
if(options.interval < 800) options.interval = 800;
//是否全屏模式
if(options.full){
options.elem.css({
position: 'fixed'
,width: '100%'
,height: '100%'
,zIndex: 9999
});
} else {
options.elem.css({
width: options.width
,height: options.height
});
}
options.elem.attr('lay-anim', options.anim);
//初始焦点状态
that.elemItem.eq(options.index).addClass(THIS);
//指示器等动作
if(that.elemItem.length <= 1) return;
that.indicator();
that.arrow();
that.autoplay();
that.events();
};
//重置轮播
Class.prototype.reload = function(options){
var that = this;
clearInterval(that.timer);
that.config = $.extend({}, that.config, options);
that.render();
};
//获取上一个等待条目的索引
Class.prototype.prevIndex = function(){
var that = this
,options = that.config;
var prevIndex = options.index - 1;
if(prevIndex < 0){
prevIndex = that.elemItem.length - 1;
}
return prevIndex;
};
//获取下一个等待条目的索引
Class.prototype.nextIndex = function(){
var that = this
,options = that.config;
var nextIndex = options.index + 1;
if(nextIndex >= that.elemItem.length){
nextIndex = 0;
}
return nextIndex;
};
//索引递增
Class.prototype.addIndex = function(num){
var that = this
,options = that.config;
num = num || 1;
options.index = options.index + num;
//index不能超过轮播总数量
if(options.index >= that.elemItem.length){
options.index = 0;
}
};
//索引递减
Class.prototype.subIndex = function(num){
var that = this
,options = that.config;
num = num || 1;
options.index = options.index - num;
//index不能超过轮播总数量
if(options.index < 0){
options.index = that.elemItem.length - 1;
}
};
//自动轮播
Class.prototype.autoplay = function(){
var that = this
,options = that.config;
if(!options.autoplay) return;
clearInterval(that.timer);
that.timer = setInterval(function(){
that.slide();
}, options.interval);
};
//箭头
Class.prototype.arrow = function(){
var that = this
,options = that.config;
//模板
var tplArrow = $([
'<button class="layui-icon '+ ELEM_ARROW +'" lay-type="sub">'+ (options.anim === 'updown' ? '&#xe619;' : '&#xe603;') +'</button>'
,'<button class="layui-icon '+ ELEM_ARROW +'" lay-type="add">'+ (options.anim === 'updown' ? '&#xe61a;' : '&#xe602;') +'</button>'
].join(''));
//预设基础属性
options.elem.attr('lay-arrow', options.arrow);
//避免重复插入
if(options.elem.find('.'+ELEM_ARROW)[0]){
options.elem.find('.'+ELEM_ARROW).remove();
};
options.elem.append(tplArrow);
//事件
tplArrow.on('click', function(){
var othis = $(this)
,type = othis.attr('lay-type')
that.slide(type);
});
};
//指示器
Class.prototype.indicator = function(){
var that = this
,options = that.config;
//模板
var tplInd = that.elemInd = $(['<div class="'+ ELEM_IND +'"><ul>'
,function(){
var li = [];
layui.each(that.elemItem, function(index){
li.push('<li'+ (options.index === index ? ' class="layui-this"' : '') +'></li>');
});
return li.join('');
}()
,'</ul></div>'].join(''));
//预设基础属性
options.elem.attr('lay-indicator', options.indicator);
//避免重复插入
if(options.elem.find('.'+ELEM_IND)[0]){
options.elem.find('.'+ELEM_IND).remove();
};
options.elem.append(tplInd);
if(options.anim === 'updown'){
tplInd.css('margin-top', -(tplInd.height()/2));
}
//事件
tplInd.find('li').on(options.trigger === 'hover' ? 'mouseover' : options.trigger, function(){
var othis = $(this)
,index = othis.index();
if(index > options.index){
that.slide('add', index - options.index);
} else if(index < options.index){
that.slide('sub', options.index - index);
}
});
};
//滑动切换
Class.prototype.slide = function(type, num){
var that = this
,elemItem = that.elemItem
,options = that.config
,thisIndex = options.index
,filter = options.elem.attr('lay-filter');
if(that.haveSlide) return;
//滑动方向
if(type === 'sub'){
that.subIndex(num);
elemItem.eq(options.index).addClass(ELEM_PREV);
setTimeout(function(){
elemItem.eq(thisIndex).addClass(ELEM_RIGHT);
elemItem.eq(options.index).addClass(ELEM_RIGHT);
}, 50);
} else { //默认递增滑
that.addIndex(num);
elemItem.eq(options.index).addClass(ELEM_NEXT);
setTimeout(function(){
elemItem.eq(thisIndex).addClass(ELEM_LEFT);
elemItem.eq(options.index).addClass(ELEM_LEFT);
}, 50);
};
//移除过度类
setTimeout(function(){
elemItem.removeClass(THIS + ' ' + ELEM_PREV + ' ' + ELEM_NEXT + ' ' + ELEM_LEFT + ' ' + ELEM_RIGHT);
elemItem.eq(options.index).addClass(THIS);
that.haveSlide = false; //解锁
}, 300);
//指示器焦点
that.elemInd.find('li').eq(options.index).addClass(THIS)
.siblings().removeClass(THIS);
that.haveSlide = true;
layui.event.call(this, MOD_NAME, 'change('+ filter +')', {
index: options.index
,prevIndex: thisIndex
,item: elemItem.eq(options.index)
});
};
//事件处理
Class.prototype.events = function(){
var that = this
,options = that.config;
if(options.elem.data('haveEvents')) return;
//移入移出容器
options.elem.on('mouseenter', function(){
clearInterval(that.timer);
}).on('mouseleave', function(){
that.autoplay();
});
options.elem.data('haveEvents', true);
};
//核心入口
carousel.render = function(options){
var inst = new Class(options);
return inst;
};
exports(MOD_NAME, carousel);
});
/** layui-v2.5.7 MIT License */
;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(clearInterval(e.timer),e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['<button class="layui-icon '+u+'" lay-type="sub">'+("updown"===n.anim?"&#xe619;":"&#xe603;")+"</button>",'<button class="layui-icon '+u+'" lay-type="add">'+("updown"===n.anim?"&#xe61a;":"&#xe602;")+"</button>"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['<div class="'+c+'"><ul>',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("<li"+(n.index===e?' class="layui-this"':"")+"></li>")}),i.join("")}(),"</ul></div>"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a<n.index&&e.slide("sub",n.index-a)})},m.prototype.slide=function(e,i){var n=this,l=n.elemItem,u=n.config,c=u.index,m=u.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),l.eq(u.index).addClass(d),setTimeout(function(){l.eq(c).addClass(r),l.eq(u.index).addClass(r)},50)):(n.addIndex(i),l.eq(u.index).addClass(s),setTimeout(function(){l.eq(c).addClass(o),l.eq(u.index).addClass(o)},50)),setTimeout(function(){l.removeClass(a+" "+d+" "+s+" "+o+" "+r),l.eq(u.index).addClass(a),n.haveSlide=!1},300),n.elemInd.find("li").eq(u.index).addClass(a).siblings().removeClass(a),n.haveSlide=!0,layui.event.call(this,t,"change("+m+")",{index:u.index,prevIndex:c,item:l.eq(u.index)}))},m.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){clearInterval(e.timer)}).on("mouseleave",function(){e.autoplay()}),i.elem.data("haveEvents",!0))},n.render=function(e){var i=new m(e);return i},e(t,n)});

View File

@ -1,60 +1,2 @@
/**
@Namecode 代码修饰器
@LicenseMIT
*/
layui.define('jquery', function(exports){
"use strict";
var $ = layui.$;
exports('code', function(options){
var elems = [];
options = options || {};
options.elem = $(options.elem||'.layui-code');
options.lang = 'lang' in options ? options.lang : 'code';
options.elem.each(function(){
elems.push(this);
});
layui.each(elems.reverse(), function(index, item){
var othis = $(item), html = othis.html();
//转义HTML标签
if(othis.attr('lay-encode') || options.encode){
html = html.replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&amp;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/'/g, '&#39;').replace(/"/g, '&quot;')
}
othis.html('<ol class="layui-code-ol"><li>' + html.replace(/[\r\t\n]+/g, '</li><li>') + '</li></ol>')
if(!othis.find('>.layui-code-h3')[0]){
othis.prepend('<h3 class="layui-code-h3">'+ (othis.attr('lay-title')||options.title||'&lt;/&gt;') + '<a href="javascript:;">'+ (othis.attr('lay-lang')||options.lang||'') +'</a>' + '</h3>');
}
var ol = othis.find('>.layui-code-ol');
othis.addClass('layui-box layui-code-view');
//识别皮肤
if(othis.attr('lay-skin') || options.skin){
othis.addClass('layui-code-' +(othis.attr('lay-skin') || options.skin));
}
//按行数适配左边距
if((ol.find('li').length/100|0) > 0){
ol.css('margin-left', (ol.find('li').length/100|0) + 'px');
}
//设置最大高度
if(othis.attr('lay-height') || options.height){
ol.css('max-height', othis.attr('lay-height') || options.height);
}
});
});
}).addcss('modules/code.css?v=1', 'skincodecss');
/** layui-v2.5.7 MIT License */
;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")),c.html('<ol class="layui-code-ol"><li>'+o.replace(/[\r\t\n]+/g,"</li><li>")+"</li></ol>"),c.find(">.layui-code-h3")[0]||c.prepend('<h3 class="layui-code-h3">'+(c.attr("lay-title")||e.title||"code")+(e.about?'<a href="'+l+'" target="_blank">layui.code</a>':"")+"</h3>");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss");

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,176 +1,2 @@
/**
@Name flow 流加载组件
@LicenseMIT
*/
layui.define('jquery', function(exports){
"use strict";
var $ = layui.$, Flow = function(options){}
,ELEM_MORE = 'layui-flow-more'
,ELEM_LOAD = '<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon ">&#xe63e;</i>';
//主方法
Flow.prototype.load = function(options){
var that = this, page = 0, lock, isOver, lazyimg, timer;
options = options || {};
var elem = $(options.elem); if(!elem[0]) return;
var scrollElem = $(options.scrollElem || document); //滚动条所在元素
var mb = options.mb || 50; //与底部的临界距离
var isAuto = 'isAuto' in options ? options.isAuto : true; //是否自动滚动加载
var end = options.end || '没有更多了'; //“末页”显示文案
//滚动条所在元素是否为document
var notDocment = options.scrollElem && options.scrollElem !== document;
//加载更多
var ELEM_TEXT = '<cite>加载更多</cite>'
,more = $('<div class="layui-flow-more"><a href="javascript:;">'+ ELEM_TEXT +'</a></div>');
if(!elem.find('.layui-flow-more')[0]){
elem.append(more);
}
//加载下一个元素
var next = function(html, over){
html = $(html);
more.before(html);
over = over == 0 ? true : null;
over ? more.html(end) : more.find('a').html(ELEM_TEXT);
isOver = over;
lock = null;
lazyimg && lazyimg();
};
//触发请求
var done = function(){
lock = true;
more.find('a').html(ELEM_LOAD);
typeof options.done === 'function' && options.done(++page, next);
};
done();
//不自动滚动加载
more.find('a').on('click', function(){
var othis = $(this);
if(isOver) return;
lock || done();
});
//如果允许图片懒加载
if(options.isLazyimg){
var lazyimg = that.lazyimg({
elem: options.elem + ' img'
,scrollElem: options.scrollElem
});
}
if(!isAuto) return that;
scrollElem.on('scroll', function(){
var othis = $(this), top = othis.scrollTop();
if(timer) clearTimeout(timer);
if(isOver || !elem.width()) return; //如果已经结束,或者元素处于隐藏状态,则不执行滚动加载
timer = setTimeout(function(){
//计算滚动所在容器的可视高度
var height = notDocment ? othis.height() : $(window).height();
//计算滚动所在容器的实际高度
var scrollHeight = notDocment
? othis.prop('scrollHeight')
: document.documentElement.scrollHeight;
//临界点
if(scrollHeight - top - height <= mb){
lock || done();
}
}, 100);
});
return that;
};
//图片懒加载
Flow.prototype.lazyimg = function(options){
var that = this, index = 0, haveScroll;
options = options || {};
var scrollElem = $(options.scrollElem || document); //滚动条所在元素
var elem = options.elem || 'img';
//滚动条所在元素是否为document
var notDocment = options.scrollElem && options.scrollElem !== document;
//显示图片
var show = function(item, height){
var start = scrollElem.scrollTop(), end = start + height;
var elemTop = notDocment ? function(){
return item.offset().top - scrollElem.offset().top + start;
}() : item.offset().top;
/* 始终只加载在当前屏范围内的图片 */
if(elemTop >= start && elemTop <= end){
if(!item.attr('src')){
var src = item.attr('lay-src');
layui.img(src, function(){
var next = that.lazyimg.elem.eq(index);
item.attr('src', src).removeAttr('lay-src');
/* 当前图片加载就绪后,检测下一个图片是否在当前屏 */
next[0] && render(next);
index++;
});
}
}
}, render = function(othis, scroll){
//计算滚动所在容器的可视高度
var height = notDocment ? (scroll||scrollElem).height() : $(window).height();
var start = scrollElem.scrollTop(), end = start + height;
that.lazyimg.elem = $(elem);
if(othis){
show(othis, height);
} else {
//计算未加载过的图片
for(var i = 0; i < that.lazyimg.elem.length; i++){
var item = that.lazyimg.elem.eq(i), elemTop = notDocment ? function(){
return item.offset().top - scrollElem.offset().top + start;
}() : item.offset().top;
show(item, height);
index = i;
//如果图片的top坐标超出了当前屏则终止后续图片的遍历
if(elemTop > end) break;
}
}
};
render();
if(!haveScroll){
var timer;
scrollElem.on('scroll', function(){
var othis = $(this);
if(timer) clearTimeout(timer)
timer = setTimeout(function(){
render(null, othis);
}, 50);
});
haveScroll = true;
}
return render;
};
//暴露接口
exports('flow', new Flow());
});
/** layui-v2.5.7 MIT License */
;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon ">&#xe63e;</i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),!i&&f.width()&&(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;s<t.lazyimg.elem.length;s++){var v=t.lazyimg.elem.eq(s),y=a?function(){return v.offset().top-n.offset().top+m}():v.offset().top;if(c(v,f),i=s,y>u)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,309 +1,2 @@
/**
@Name : laypage 分页组件
@LicenseMIT
*/
layui.define(function(exports){
"use strict";
var doc = document
,id = 'getElementById'
,tag = 'getElementsByTagName'
//字符常量
,MOD_NAME = 'laypage', DISABLED = 'layui-disabled'
//构造器
,Class = function(options){
var that = this;
that.config = options || {};
that.config.index = ++laypage.index;
that.render(true);
};
//判断传入的容器类型
Class.prototype.type = function(){
var config = this.config;
if(typeof config.elem === 'object'){
return config.elem.length === undefined ? 2 : 3;
}
};
//分页视图
Class.prototype.view = function(){
var that = this
,config = that.config
,groups = config.groups = 'groups' in config ? (config.groups|0) : 5; //连续页码个数
//排版
config.layout = typeof config.layout === 'object'
? config.layout
: ['prev', 'page', 'next'];
config.count = config.count|0; //数据总数
config.curr = (config.curr|0) || 1; //当前页
//每页条数的选择项
config.limits = typeof config.limits === 'object'
? config.limits
: [10, 20, 30, 40, 50];
config.limit = (config.limit|0) || 10; //默认条数
//总页数
config.pages = Math.ceil(config.count/config.limit) || 1;
//当前页不能超过总页数
if(config.curr > config.pages){
config.curr = config.pages;
}
//连续分页个数不能低于0且不能大于总页数
if(groups < 0){
groups = 1;
} else if (groups > config.pages){
groups = config.pages;
}
config.prev = 'prev' in config ? config.prev : '&#x4E0A;&#x4E00;&#x9875;'; //上一页文本
config.next = 'next' in config ? config.next : '&#x4E0B;&#x4E00;&#x9875;'; //下一页文本
//计算当前组
var index = config.pages > groups
? Math.ceil( (config.curr + (groups > 1 ? 1 : 0)) / (groups > 0 ? groups : 1) )
: 1
//视图片段
,views = {
//上一页
prev: function(){
return config.prev
? '<a href="javascript:;" class="layui-laypage-prev'+ (config.curr == 1 ? (' ' + DISABLED) : '') +'" data-page="'+ (config.curr - 1) +'">'+ config.prev +'</a>'
: '';
}()
//页码
,page: function(){
var pager = [];
//数据量为0时不输出页码
if(config.count < 1){
return '';
}
//首页
if(index > 1 && config.first !== false && groups !== 0){
pager.push('<a href="javascript:;" class="layui-laypage-first" data-page="1" title="&#x9996;&#x9875;">'+ (config.first || 1) +'</a>');
}
//计算当前页码组的起始页
var halve = Math.floor((groups-1)/2) //页码数等分
,start = index > 1 ? config.curr - halve : 1
,end = index > 1 ? (function(){
var max = config.curr + (groups - halve - 1);
return max > config.pages ? config.pages : max;
}()) : groups;
//防止最后一组出现“不规定”的连续页码数
if(end - start < groups - 1){
start = end - groups + 1;
}
//输出左分割符
if(config.first !== false && start > 2){
pager.push('<span class="layui-laypage-spr">&#x2026;</span>')
}
//输出连续页码
for(; start <= end; start++){
if(start === config.curr){
//当前页
pager.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+ (/^#/.test(config.theme) ? 'style="background-color:'+ config.theme +';"' : '') +'></em><em>'+ start +'</em></span>');
} else {
pager.push('<a href="javascript:;" data-page="'+ start +'">'+ start +'</a>');
}
}
//输出输出右分隔符 & 末页
if(config.pages > groups && config.pages > end && config.last !== false){
if(end + 1 < config.pages){
pager.push('<span class="layui-laypage-spr">&#x2026;</span>');
}
if(groups !== 0){
pager.push('<a href="javascript:;" class="layui-laypage-last" title="&#x5C3E;&#x9875;" data-page="'+ config.pages +'">'+ (config.last || config.pages) +'</a>');
}
}
return pager.join('');
}()
//下一页
,next: function(){
return config.next
? '<a href="javascript:;" class="layui-laypage-next'+ (config.curr == config.pages ? (' ' + DISABLED) : '') +'" data-page="'+ (config.curr + 1) +'">'+ config.next +'</a>'
: '';
}()
//数据总数
,count: '<span class="layui-laypage-count">共 '+ config.count +' 条</span>'
//每页条数
,limit: function(){
var options = ['<span class="layui-laypage-limits"><select lay-ignore>'];
layui.each(config.limits, function(index, item){
options.push(
'<option value="'+ item +'"'
+(item === config.limit ? 'selected' : '')
+'>'+ item +' 条/页</option>'
);
});
return options.join('') +'</select></span>';
}()
//刷新当前页
,refresh: ['<a href="javascript:;" data-page="'+ config.curr +'" class="layui-laypage-refresh">'
,'<i class="layui-icon layui-icon-refresh"></i>'
,'</a>'].join('')
//跳页区域
,skip: function(){
return ['<span class="layui-laypage-skip">&#x5230;&#x7B2C;'
,'<input type="text" min="1" value="'+ config.curr +'" class="layui-input">'
,'&#x9875;<button type="button" class="layui-laypage-btn">&#x786e;&#x5b9a;</button>'
,'</span>'].join('');
}()
};
return ['<div class="layui-box layui-laypage layui-laypage-'+ (config.theme ? (
/^#/.test(config.theme) ? 'molv' : config.theme
) : 'default') +'" id="layui-laypage-'+ config.index +'">'
,function(){
var plate = [];
layui.each(config.layout, function(index, item){
if(views[item]){
plate.push(views[item])
}
});
return plate.join('');
}()
,'</div>'].join('');
};
//跳页的回调
Class.prototype.jump = function(elem, isskip){
if(!elem) return;
var that = this
,config = that.config
,childs = elem.children
,btn = elem[tag]('button')[0]
,input = elem[tag]('input')[0]
,select = elem[tag]('select')[0]
,skip = function(){
var curr = input.value.replace(/\s|\D/g, '')|0;
if(curr){
config.curr = curr;
that.render();
}
};
if(isskip) return skip();
//页码
for(var i = 0, len = childs.length; i < len; i++){
if(childs[i].nodeName.toLowerCase() === 'a'){
laypage.on(childs[i], 'click', function(){
var curr = this.getAttribute('data-page')|0;
if(curr < 1 || curr > config.pages) return;
config.curr = curr;
that.render();
});
}
}
//条数
if(select){
laypage.on(select, 'change', function(){
var value = this.value;
if(config.curr*value > config.count){
config.curr = Math.ceil(config.count/value);
}
config.limit = value;
that.render();
});
}
//确定
if(btn){
laypage.on(btn, 'click', function(){
skip();
});
}
};
//输入页数字控制
Class.prototype.skip = function(elem){
if(!elem) return;
var that = this, input = elem[tag]('input')[0];
if(!input) return;
laypage.on(input, 'keyup', function(e){
var value = this.value
,keyCode = e.keyCode;
if(/^(37|38|39|40)$/.test(keyCode)) return;
if(/\D/.test(value)){
this.value = value.replace(/\D/, '');
}
if(keyCode === 13){
that.jump(elem, true)
}
});
};
//渲染分页
Class.prototype.render = function(load){
var that = this
,config = that.config
,type = that.type()
,view = that.view();
if(type === 2){
config.elem && (config.elem.innerHTML = view);
} else if(type === 3){
config.elem.html(view);
} else {
if(doc[id](config.elem)){
doc[id](config.elem).innerHTML = view;
}
}
config.jump && config.jump(config, load);
var elem = doc[id]('layui-laypage-' + config.index);
that.jump(elem);
if(config.hash && !load){
location.hash = '!'+ config.hash +'='+ config.curr;
}
that.skip(elem);
};
//外部接口
var laypage = {
//分页渲染
render: function(options){
var o = new Class(options);
return o.index;
}
,index: layui.laypage ? (layui.laypage.index + 10000) : 0
,on: function(elem, even, fn){
elem.attachEvent ? elem.attachEvent('on'+ even, function(e){ //for ie
e.target = e.srcElement;
fn.call(elem, e);
}) : elem.addEventListener(even, fn, false);
return this;
}
}
exports(MOD_NAME, laypage);
});
/** layui-v2.5.7 MIT License */
;layui.define(function(e){"use strict";var t=document,a="getElementById",r="getElementsByTagName",n="laypage",i="layui-disabled",u=function(e){var t=this;t.config=e||{},t.config.index=++p.index,t.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,t=e.config,a=t.groups="groups"in t?0|t.groups:5;t.layout="object"==typeof t.layout?t.layout:["prev","page","next"],t.count=0|t.count,t.curr=0|t.curr||1,t.limits="object"==typeof t.limits?t.limits:[10,20,30,40,50],t.limit=0|t.limit||10,t.pages=Math.ceil(t.count/t.limit)||1,t.curr>t.pages&&(t.curr=t.pages),a<0?a=1:a>t.pages&&(a=t.pages),t.prev="prev"in t?t.prev:"&#x4E0A;&#x4E00;&#x9875;",t.next="next"in t?t.next:"&#x4E0B;&#x4E00;&#x9875;",t.rpptext="rpptext"in t?t.rpptext:"条/页",t.totaltext="totaltext"in t?t.totaltext:"共",t.recordtext="recordtext"in t?t.recordtext:"条",t.gototext="gototext"in t?t.gototext:"&#x5230;&#x7B2C;",t.pagetext="pagetext"in t?t.pagetext:"页",t.oktext="oktext"in t?t.oktext:"&#x786e;&#x5b9a;";var r=t.pages>a?Math.ceil((t.curr+(a>1?1:0))/(a>0?a:1)):1,n={prev:function(){return t.prev?'<a href="javascript:;" class="layui-laypage-prev'+(1==t.curr?" "+i:"")+'" data-page="'+(t.curr-1)+'">'+t.prev+"</a>":""}(),page:function(){var e=[];if(t.count<1)return"";r>1&&t.first!==!1&&0!==a&&e.push('<a href="javascript:;" class="layui-laypage-first" data-page="1" title="&#x9996;&#x9875;">'+(t.first||1)+"</a>");var n=Math.floor((a-1)/2),i=r>1?t.curr-n:1,u=r>1?function(){var e=t.curr+(a-n-1);return e>t.pages?t.pages:e}():a;for(u-i<a-1&&(i=u-a+1),t.first!==!1&&i>2&&e.push('<span class="layui-laypage-spr">&#x2026;</span>');i<=u;i++)i===t.curr?e.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+(/^#/.test(t.theme)?'style="background-color:'+t.theme+';"':"")+"></em><em>"+i+"</em></span>"):e.push('<a href="javascript:;" data-page="'+i+'">'+i+"</a>");return t.pages>a&&t.pages>u&&t.last!==!1&&(u+1<t.pages&&e.push('<span class="layui-laypage-spr">&#x2026;</span>'),0!==a&&e.push('<a href="javascript:;" class="layui-laypage-last" title="&#x5C3E;&#x9875;" data-page="'+t.pages+'">'+(t.last||t.pages)+"</a>")),e.join("")}(),next:function(){return t.next?'<a href="javascript:;" class="layui-laypage-next'+(t.curr==t.pages?" "+i:"")+'" data-page="'+(t.curr+1)+'">'+t.next+"</a>":""}(),count:'<span class="layui-laypage-count">'+t.totaltext+" "+t.count+" "+t.recordtext+"</span>",limit:function(){var e=['<span class="layui-laypage-limits"><select lay-ignore>'];return layui.each(t.limits,function(a,r){e.push('<option value="'+r+'"'+(r===t.limit?"selected":"")+">"+r+" "+t.rpptext+"</option>")}),e.join("")+"</select></span>"}(),refresh:['<a href="javascript:;" data-page="'+t.curr+'" class="layui-laypage-refresh">','<i class="layui-icon layui-icon-refresh"></i>',"</a>"].join(""),skip:function(){return['<span class="layui-laypage-skip">'+t.gototext,'<input type="text" min="1" value="'+t.curr+'" class="layui-input">',t.pagetext+'<button type="button" class="layui-laypage-btn">'+t.oktext+"</button>","</span>"].join("")}()};return['<div class="layui-box layui-laypage layui-laypage-'+(t.theme?/^#/.test(t.theme)?"molv":t.theme:"default")+'" id="layui-laypage-'+t.index+'">',function(){var e=[];return layui.each(t.layout,function(t,a){n[a]&&e.push(n[a])}),e.join("")}(),"</div>"].join("")},u.prototype.jump=function(e,t){if(e){var a=this,n=a.config,i=e.children,u=e[r]("button")[0],l=e[r]("input")[0],s=e[r]("select")[0],o=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(n.curr=e,a.render())};if(t)return o();for(var c=0,g=i.length;c<g;c++)"a"===i[c].nodeName.toLowerCase()&&p.on(i[c],"click",function(){var e=0|this.getAttribute("data-page");e<1||e>n.pages||(n.curr=e,a.render())});s&&p.on(s,"change",function(){var e=this.value;n.curr*e>n.count&&(n.curr=Math.ceil(n.count/e)),n.limit=e,a.render()}),u&&p.on(u,"click",function(){o()})}},u.prototype.skip=function(e){if(e){var t=this,a=e[r]("input")[0];a&&p.on(a,"keyup",function(a){var r=this.value,n=a.keyCode;/^(37|38|39|40)$/.test(n)||(/\D/.test(r)&&(this.value=r.replace(/\D/,"")),13===n&&t.jump(e,!0))})}},u.prototype.render=function(e){var r=this,n=r.config,i=r.type(),u=r.view();2===i?n.elem&&(n.elem.innerHTML=u):3===i?n.elem.html(u):t[a](n.elem)&&(t[a](n.elem).innerHTML=u),n.jump&&n.jump(n,e);var p=t[a]("layui-laypage-"+n.index);r.jump(p),n.hash&&!e&&(location.hash="!"+n.hash+"="+n.curr),r.skip(p)};var p={render:function(e){var t=new u(e);return t.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,t,a){return e.attachEvent?e.attachEvent("on"+t,function(t){t.target=t.srcElement,a.call(e,t)}):e.addEventListener(t,a,!1),this}};e(n,p)});

View File

@ -1,122 +1,2 @@
/**
@Name : laytpl 模板引擎
@LicenseMIT
*/
layui.define(function(exports){
"use strict";
var config = {
open: '{{',
close: '}}'
};
var tool = {
exp: function(str){
return new RegExp(str, 'g');
},
//匹配满足规则内容
query: function(type, _, __){
var types = [
'#([\\s\\S])+?', //js语句
'([^{#}])*?' //普通字段
][type || 0];
return exp((_||'') + config.open + types + config.close + (__||''));
},
escape: function(html){
return String(html||'').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&amp;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/'/g, '&#39;').replace(/"/g, '&quot;');
},
error: function(e, tplog){
var error = 'Laytpl Error: ';
typeof console === 'object' && console.error(error + e + '\n'+ (tplog || ''));
return error + e;
}
};
var exp = tool.exp, Tpl = function(tpl){
this.tpl = tpl;
};
Tpl.pt = Tpl.prototype;
window.errors = 0;
//编译模版
Tpl.pt.parse = function(tpl, data){
var that = this, tplog = tpl;
var jss = exp('^'+config.open+'#', ''), jsse = exp(config.close+'$', '');
tpl = tpl.replace(/\s+|\r|\t|\n/g, ' ')
.replace(exp(config.open+'#'), config.open+'# ')
.replace(exp(config.close+'}'), '} '+config.close).replace(/\\/g, '\\\\')
//不匹配指定区域的内容
.replace(exp(config.open + '!(.+?)!' + config.close), function(str){
str = str.replace(exp('^'+ config.open + '!'), '')
.replace(exp('!'+ config.close), '')
.replace(exp(config.open + '|' + config.close), function(tag){
return tag.replace(/(.)/g, '\\$1')
});
return str
})
//匹配JS规则内容
.replace(/(?="|')/g, '\\').replace(tool.query(), function(str){
str = str.replace(jss, '').replace(jsse, '');
return '";' + str.replace(/\\/g, '') + ';view+="';
})
//匹配普通字段
.replace(tool.query(1), function(str){
var start = '"+(';
if(str.replace(/\s/g, '') === config.open+config.close){
return '';
}
str = str.replace(exp(config.open+'|'+config.close), '');
if(/^=/.test(str)){
str = str.replace(/^=/, '');
start = '"+_escape_(';
}
return start + str.replace(/\\/g, '') + ')+"';
});
tpl = '"use strict";var view = "' + tpl + '";return view;';
try{
that.cache = tpl = new Function('d, _escape_', tpl);
return tpl(data, tool.escape);
} catch(e){
delete that.cache;
return tool.error(e, tplog);
}
};
Tpl.pt.render = function(data, callback){
var that = this, tpl;
if(!data) return tool.error('no data');
tpl = that.cache ? that.cache(data, tool.escape) : that.parse(that.tpl, data);
if(!callback) return tpl;
callback(tpl);
};
var laytpl = function(tpl){
if(typeof tpl !== 'string') return tool.error('Template not found');
return new Tpl(tpl);
};
laytpl.config = function(options){
options = options || {};
for(var i in options){
config[i] = options[i];
}
};
laytpl.v = '1.2.0';
exports('laytpl', laytpl);
});
/** layui-v2.5.7 MIT License */
;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")},error:function(e,r){var c="Laytpl Error";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});

File diff suppressed because one or more lines are too long

View File

@ -1,218 +1,2 @@
/**
@Title: rate 评分评星组件
@LicenseMIT
*/
layui.define('jquery',function(exports){
"use strict";
var $ = layui.jquery
//外部接口
,rate = {
config: {}
,index: layui.rate ? (layui.rate.index + 10000) : 0
//设置全局项
,set: function(options){
var that = this;
that.config = $.extend({}, that.config, options);
return that;
}
//事件
,on: function(events, callback){
return layui.onevent.call(this, MOD_NAME, events, callback);
}
}
//操作当前实例
,thisRate = function(){
var that = this
,options = that.config;
return {
setvalue: function(value){
that.setvalue.call(that, value);
}
,config: options
}
}
//字符常量
,MOD_NAME = 'rate',ELEM_VIEW = 'layui-rate', ICON_RATE = 'layui-icon-rate', ICON_RATE_SOLID = 'layui-icon-rate-solid', ICON_RATE_HALF = 'layui-icon-rate-half'
,ICON_SOLID_HALF = 'layui-icon-rate-solid layui-icon-rate-half', ICON_SOLID_RATE = 'layui-icon-rate-solid layui-icon-rate', ICON_HALF_RATE = 'layui-icon-rate layui-icon-rate-half'
//构造器
,Class = function(options){
var that = this;
that.index = ++rate.index;
that.config = $.extend({}, that.config, rate.config, options);
that.render();
};
//默认配置
Class.prototype.config = {
length: 5 //初始长度
,text: false //是否显示评分等级
,readonly: false //是否只读
,half: false //是否可以半星
,value: 0 //星星选中个数
,theme: ''
};
//评分渲染
Class.prototype.render = function(){
var that = this
,options = that.config
,style = options.theme ? ('style="color: '+ options.theme + ';"') : '';
options.elem = $(options.elem);
//最大值不能大于总长度
if(options.value > options.length){
options.value = options.length;
}
//如果没有选择半星的属性,却给了小数的数值,统一向上或向下取整
if(parseInt(options.value) !== options.value){
if(!options.half){
options.value = (Math.ceil(options.value) - options.value) < 0.5 ? Math.ceil(options.value): Math.floor(options.value)
}
}
//组件模板
var temp = '<ul class="layui-rate" '+ (options.readonly ? 'readonly' : '') +'>';
for(var i = 1;i <= options.length;i++){
var item = '<li class="layui-inline"><i class="layui-icon '
+ (i>Math.floor(options.value)?ICON_RATE:ICON_RATE_SOLID)
+ '" '+ style +'></i></li>';
if(options.half){
if(parseInt(options.value) !== options.value){
if(i == Math.ceil(options.value)){
temp = temp + '<li><i class="layui-icon layui-icon-rate-half" '+ style +'></i></li>';
}else{
temp = temp + item
}
}else{
temp = temp + item
}
}else{
temp = temp +item;
}
}
temp += '</ul>' + (options.text ? ('<span class="layui-inline">'+ options.value + '星') : '') + '</span>';
//开始插入替代元素
var othis = options.elem
,hasRender = othis.next('.' + ELEM_VIEW);
//生成替代元素
hasRender[0] && hasRender.remove(); //如果已经渲染则Rerender
that.elemTemp = $(temp);
options.span = that.elemTemp.next('span');
options.setText && options.setText(options.value);
othis.html(that.elemTemp);
othis.addClass("layui-inline");
//如果不是只读,那么进行触控事件
if(!options.readonly) that.action();
};
//评分重置
Class.prototype.setvalue = function(value){
var that = this
,options = that.config ;
options.value = value ;
that.render();
};
//li触控事件
Class.prototype.action = function(){
var that = this
,options = that.config
,_ul = that.elemTemp
,wide = _ul.find("i").width();
_ul.children("li").each(function(index){
var ind = index + 1
,othis = $(this);
//点击
othis.on('click', function(e){
//将当前点击li的索引值赋给value
options.value = ind;
if(options.half){
//获取鼠标在li上的位置
var x = e.pageX - $(this).offset().left;
if(x <= wide / 2){
options.value = options.value - 0.5;
}
}
if(options.text) _ul.next("span").text(options.value + "星");
options.choose && options.choose(options.value);
options.setText && options.setText(options.value);
});
//移入
othis.on('mousemove', function(e){
_ul.find("i").each(function(){
$(this).addClass(ICON_RATE).removeClass(ICON_SOLID_HALF)
});
_ul.find("i:lt(" + ind + ")").each(function(){
$(this).addClass(ICON_RATE_SOLID).removeClass(ICON_HALF_RATE)
});
// 如果设置可选半星那么判断鼠标相对li的位置
if(options.half){
var x = e.pageX - $(this).offset().left;
if(x <= wide / 2){
othis.children("i").addClass(ICON_RATE_HALF).removeClass(ICON_RATE_SOLID)
}
}
})
//移出
othis.on('mouseleave', function(){
_ul.find("i").each(function(){
$(this).addClass(ICON_RATE).removeClass(ICON_SOLID_HALF)
});
_ul.find("i:lt(" + Math.floor(options.value) + ")").each(function(){
$(this).addClass(ICON_RATE_SOLID).removeClass(ICON_HALF_RATE)
});
//如果设置可选半星,根据分数判断是否有半星
if(options.half){
if(parseInt(options.value) !== options.value){
_ul.children("li:eq(" + Math.floor(options.value) + ")").children("i").addClass(ICON_RATE_HALF).removeClass(ICON_SOLID_RATE)
}
}
})
})
};
//事件处理
Class.prototype.events = function(){
var that = this
,options = that.config;
};
//核心入口
rate.render = function(options){
var inst = new Class(options);
return thisRate.call(inst);
};
exports(MOD_NAME, rate);
})
/** layui-v2.5.7 MIT License */
;layui.define("jquery",function(e){"use strict";var a=layui.jquery,l={config:{},index:layui.rate?layui.rate.index+1e4:0,set:function(e){var l=this;return l.config=a.extend({},l.config,e),l},on:function(e,a){return layui.onevent.call(this,n,e,a)}},i=function(){var e=this,a=e.config;return{setvalue:function(a){e.setvalue.call(e,a)},config:a}},n="rate",t="layui-rate",o="layui-icon-rate",u="layui-icon-rate-solid",s="layui-icon-rate-half",r="layui-icon-rate-solid layui-icon-rate-half",c="layui-icon-rate-solid layui-icon-rate",f="layui-icon-rate layui-icon-rate-half",v=function(e){var i=this;i.index=++l.index,i.config=a.extend({},i.config,l.config,e),i.render()};v.prototype.config={length:5,text:!1,readonly:!1,half:!1,value:0,theme:""},v.prototype.render=function(){var e=this,l=e.config,i=l.theme?'style="color: '+l.theme+';"':"";l.elem=a(l.elem),l.value>l.length&&(l.value=l.length),parseInt(l.value)!==l.value&&(l.half||(l.value=Math.ceil(l.value)-l.value<.5?Math.ceil(l.value):Math.floor(l.value)));for(var n='<ul class="layui-rate" '+(l.readonly?"readonly":"")+">",s=1;s<=l.length;s++){var r='<li class="layui-inline"><i class="layui-icon '+(s>Math.floor(l.value)?o:u)+'" '+i+"></i></li>";l.half&&parseInt(l.value)!==l.value&&s==Math.ceil(l.value)?n=n+'<li><i class="layui-icon layui-icon-rate-half" '+i+"></i></li>":n+=r}n+="</ul>"+(l.text?'<span class="layui-inline">'+l.value+"星":"")+"</span>";var c=l.elem,f=c.next("."+t);f[0]&&f.remove(),e.elemTemp=a(n),l.span=e.elemTemp.next("span"),l.setText&&l.setText(l.value),c.html(e.elemTemp),c.addClass("layui-inline"),l.readonly||e.action()},v.prototype.setvalue=function(e){var a=this,l=a.config;l.value=e,a.render()},v.prototype.action=function(){var e=this,l=e.config,i=e.elemTemp,n=i.find("i").width();i.children("li").each(function(e){var t=e+1,v=a(this);v.on("click",function(e){if(l.value=t,l.half){var o=e.pageX-a(this).offset().left;o<=n/2&&(l.value=l.value-.5)}l.text&&i.next("span").text(l.value+"星"),l.choose&&l.choose(l.value),l.setText&&l.setText(l.value)}),v.on("mousemove",function(e){if(i.find("i").each(function(){a(this).addClass(o).removeClass(r)}),i.find("i:lt("+t+")").each(function(){a(this).addClass(u).removeClass(f)}),l.half){var c=e.pageX-a(this).offset().left;c<=n/2&&v.children("i").addClass(s).removeClass(u)}}),v.on("mouseleave",function(){i.find("i").each(function(){a(this).addClass(o).removeClass(r)}),i.find("i:lt("+Math.floor(l.value)+")").each(function(){a(this).addClass(u).removeClass(f)}),l.half&&parseInt(l.value)!==l.value&&i.children("li:eq("+Math.floor(l.value)+")").children("i").addClass(s).removeClass(c)})})},v.prototype.events=function(){var e=this;e.config},l.render=function(e){var a=new v(e);return i.call(a)},e(n,l)});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,213 +1,2 @@
/**
@Nameutil 工具集组件
@LicenseMIT
*/
layui.define('jquery', function(exports){
"use strict";
var $ = layui.$
//外部接口
,util = {
//固定块
fixbar: function(options){
var ELEM = 'layui-fixbar', TOP_BAR = 'layui-fixbar-top'
,dom = $(document), body = $('body')
,is, timer;
options = $.extend({
showHeight: 200 //出现TOP的滚动条高度临界值
}, options);
options.bar1 = options.bar1 === true ? '&#xe606;' : options.bar1;
options.bar2 = options.bar2 === true ? '&#xe607;' : options.bar2;
options.bgcolor = options.bgcolor ? ('background-color:' + options.bgcolor) : '';
var icon = [options.bar1, options.bar2, '&#xe604;'] //图标信息、问号、TOP
,elem = $(['<ul class="'+ ELEM +'">'
,options.bar1 ? '<li class="layui-icon" lay-type="bar1" style="'+ options.bgcolor +'">'+ icon[0] +'</li>' : ''
,options.bar2 ? '<li class="layui-icon" lay-type="bar2" style="'+ options.bgcolor +'">'+ icon[1] +'</li>' : ''
,'<li class="layui-icon '+ TOP_BAR +'" lay-type="top" style="'+ options.bgcolor +'">'+ icon[2] +'</li>'
,'</ul>'].join(''))
,topBar = elem.find('.'+TOP_BAR)
,scroll = function(){
var stop = dom.scrollTop();
if(stop >= (options.showHeight)){
is || (topBar.show(), is = 1);
} else {
is && (topBar.hide(), is = 0);
}
};
if($('.'+ ELEM)[0]) return;
typeof options.css === 'object' && elem.css(options.css);
body.append(elem), scroll();
//bar点击事件
elem.find('li').on('click', function(){
var othis = $(this), type = othis.attr('lay-type');
if(type === 'top'){
$('html,body').animate({
scrollTop : 0
}, 200);
}
options.click && options.click.call(this, type);
});
//Top显示控制
dom.on('scroll', function(){
clearTimeout(timer);
timer = setTimeout(function(){
scroll();
}, 100);
});
}
//倒计时
,countdown: function(endTime, serverTime, callback){
var that = this
,type = typeof serverTime === 'function'
,end = new Date(endTime).getTime()
,now = new Date((!serverTime || type) ? new Date().getTime() : serverTime).getTime()
,count = end - now
,time = [
Math.floor(count/(1000*60*60*24)) //天
,Math.floor(count/(1000*60*60)) % 24 //时
,Math.floor(count/(1000*60)) % 60 //分
,Math.floor(count/1000) % 60 //秒
];
if(type) callback = serverTime;
var timer = setTimeout(function(){
that.countdown(endTime, now + 1000, callback);
}, 1000);
callback && callback(count > 0 ? time : [0,0,0,0], serverTime, timer);
if(count <= 0) clearTimeout(timer);
return timer;
}
//某个时间在当前时间的多久前
,timeAgo: function(time, onlyDate){
var that = this
,arr = [[], []]
,stamp = new Date().getTime() - new Date(time).getTime();
//返回具体日期
if(stamp > 1000*60*60*24*31){
stamp = new Date(time);
arr[0][0] = that.digit(stamp.getFullYear(), 4);
arr[0][1] = that.digit(stamp.getMonth() + 1);
arr[0][2] = that.digit(stamp.getDate());
//是否输出时间
if(!onlyDate){
arr[1][0] = that.digit(stamp.getHours());
arr[1][1] = that.digit(stamp.getMinutes());
arr[1][2] = that.digit(stamp.getSeconds());
}
return arr[0].join('-') + ' ' + arr[1].join(':');
}
//30天以内返回“多久前”
if(stamp >= 1000*60*60*24){
return ((stamp/1000/60/60/24)|0) + '天前';
} else if(stamp >= 1000*60*60){
return ((stamp/1000/60/60)|0) + '小时前';
} else if(stamp >= 1000*60*3){ //3分钟以内为刚刚
return ((stamp/1000/60)|0) + '分钟前';
} else if(stamp < 0){
return '未来';
} else {
return '刚刚';
}
}
//数字前置补零
,digit: function(num, length){
var str = '';
num = String(num);
length = length || 2;
for(var i = num.length; i < length; i++){
str += '0';
}
return num < Math.pow(10, length) ? str + (num|0) : num;
}
//转化为日期格式字符
,toDateString: function(time, format){
var that = this
,date = new Date(time || new Date())
,ymd = [
that.digit(date.getFullYear(), 4)
,that.digit(date.getMonth() + 1)
,that.digit(date.getDate())
]
,hms = [
that.digit(date.getHours())
,that.digit(date.getMinutes())
,that.digit(date.getSeconds())
];
format = format || 'yyyy-MM-dd HH:mm:ss';
return format.replace(/yyyy/g, ymd[0])
.replace(/MM/g, ymd[1])
.replace(/dd/g, ymd[2])
.replace(/HH/g, hms[0])
.replace(/mm/g, hms[1])
.replace(/ss/g, hms[2]);
}
//防 xss 攻击
,escape: function(html){
return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&amp;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(/'/g, '&#39;').replace(/"/g, '&quot;');
}
,unescape: function(str){
return String(str || '').replace(/\&amp;/g, '&')
.replace(/\&lt;/g, '<').replace(/\&gt;/g, '>')
.replace(/\&#39;/, '\'').replace(/\&quot;/, '"');
}
//批量事件
,event: function(attr, obj, eventType){
var _body = $('body');
eventType = eventType || 'click';
//记录事件回调集合
obj = util.event[attr] = $.extend(true, util.event[attr], obj) || {};
//清除委托事件
util.event.UTIL_EVENT_CALLBACK = util.event.UTIL_EVENT_CALLBACK || {};
_body.off(eventType, '*['+ attr +']', util.event.UTIL_EVENT_CALLBACK[attr])
//绑定委托事件
util.event.UTIL_EVENT_CALLBACK[attr] = function(){
var othis = $(this)
,key = othis.attr(attr);
(typeof obj[key] === 'function') && obj[key].call(this, othis);
};
//清除旧事件,绑定新事件
_body.on(eventType, '*['+ attr +']', util.event.UTIL_EVENT_CALLBACK[attr]);
return obj;
}
};
// DOM 尺寸变化该创意来自http://benalman.com/projects/jquery-resize-plugin/
/*
!function(a,b,c){"$:nomunge";function l(){f=b[g](function(){d.each(function(){var b=a(this),c=b.width(),d=b.height(),e=a.data(this,i);(c!==e.w||d!==e.h)&&b.trigger(h,[e.w=c,e.h=d])}),l()},e[j])}var f,d=a([]),e=a.resize=a.extend(a.resize,{}),g="setTimeout",h="resize",i=h+"-special-event",j="delay",k="throttleWindow";e[j]=250,e[k]=!0,a.event.special[h]={setup:function(){if(!e[k]&&this[g])return!1;var b=a(this);d=d.add(b),a.data(this,i,{w:b.width(),h:b.height()}),1===d.length&&l()},teardown:function(){if(!e[k]&&this[g])return!1;var b=a(this);d=d.not(b),b.removeData(i),d.length||clearTimeout(f)},add:function(b){function f(b,e,f){var g=a(this),h=a.data(this,i)||{};h.w=e!==c?e:g.width(),h.h=f!==c?f:g.height(),d.apply(this,arguments)}if(!e[k]&&this[g])return!1;var d;return a.isFunction(b)?(d=b,f):(d=b.handler,b.handler=f,void 0)}}}($,window);
*/
//暴露接口
exports('util', util);
});
/** layui-v2.5.7 MIT License */
;layui.define("jquery",function(e){"use strict";var t=layui.$,i={fixbar:function(e){var i,n,a="layui-fixbar",o="layui-fixbar-top",r=t(document),l=t("body");e=t.extend({showHeight:200},e),e.bar1=e.bar1===!0?"&#xe606;":e.bar1,e.bar2=e.bar2===!0?"&#xe607;":e.bar2,e.bgcolor=e.bgcolor?"background-color:"+e.bgcolor:"";var c=[e.bar1,e.bar2,"&#xe604;"],u=t(['<ul class="'+a+'">',e.bar1?'<li class="layui-icon" lay-type="bar1" style="'+e.bgcolor+'">'+c[0]+"</li>":"",e.bar2?'<li class="layui-icon" lay-type="bar2" style="'+e.bgcolor+'">'+c[1]+"</li>":"",'<li class="layui-icon '+o+'" lay-type="top" style="'+e.bgcolor+'">'+c[2]+"</li>","</ul>"].join("")),g=u.find("."+o),s=function(){var t=r.scrollTop();t>=e.showHeight?i||(g.show(),i=1):i&&(g.hide(),i=0)};t("."+a)[0]||("object"==typeof e.css&&u.css(e.css),l.append(u),s(),u.find("li").on("click",function(){var i=t(this),n=i.attr("lay-type");"top"===n&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,n)}),r.on("scroll",function(){clearTimeout(n),n=setTimeout(function(){s()},100)}))},countdown:function(e,t,i){var n=this,a="function"==typeof t,o=new Date(e).getTime(),r=new Date(!t||a?(new Date).getTime():t).getTime(),l=o-r,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=t);var u=setTimeout(function(){n.countdown(e,r+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,u),l<=0&&clearTimeout(u),u},timeAgo:function(e,t){var i=this,n=[[],[]],a=(new Date).getTime()-new Date(e).getTime();return a>26784e5?(a=new Date(e),n[0][0]=i.digit(a.getFullYear(),4),n[0][1]=i.digit(a.getMonth()+1),n[0][2]=i.digit(a.getDate()),t||(n[1][0]=i.digit(a.getHours()),n[1][1]=i.digit(a.getMinutes()),n[1][2]=i.digit(a.getSeconds())),n[0].join("-")+" "+n[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=18e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var n=e.length;n<t;n++)i+="0";return e<Math.pow(10,t)?i+(0|e):e},toDateString:function(e,t){var i=this,n=new Date(e||new Date),a=[i.digit(n.getFullYear(),4),i.digit(n.getMonth()+1),i.digit(n.getDate())],o=[i.digit(n.getHours()),i.digit(n.getMinutes()),i.digit(n.getSeconds())];return t=t||"yyyy-MM-dd HH:mm:ss",t.replace(/yyyy/g,a[0]).replace(/MM/g,a[1]).replace(/dd/g,a[2]).replace(/HH/g,o[0]).replace(/mm/g,o[1]).replace(/ss/g,o[2])},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")},event:function(e,n,a){var o=t("body");return a=a||"click",n=i.event[e]=t.extend(!0,i.event[e],n)||{},i.event.UTIL_EVENT_CALLBACK=i.event.UTIL_EVENT_CALLBACK||{},o.off(a,"*["+e+"]",i.event.UTIL_EVENT_CALLBACK[e]),i.event.UTIL_EVENT_CALLBACK[e]=function(){var i=t(this),a=i.attr(e);"function"==typeof n[a]&&n[a].call(this,i)},o.on(a,"*["+e+"]",i.event.UTIL_EVENT_CALLBACK[e]),n}};!function(e,t,i){"$:nomunge";function n(){a=t[l](function(){o.each(function(){var t=e(this),i=t.width(),n=t.height(),a=e.data(this,u);(i!==a.w||n!==a.h)&&t.trigger(c,[a.w=i,a.h=n])}),n()},r[g])}var a,o=e([]),r=e.resize=e.extend(e.resize,{}),l="setTimeout",c="resize",u=c+"-special-event",g="delay",s="throttleWindow";r[g]=250,r[s]=!0,e.event.special[c]={setup:function(){if(!r[s]&&this[l])return!1;var t=e(this);o=o.add(t),e.data(this,u,{w:t.width(),h:t.height()}),1===o.length&&n()},teardown:function(){if(!r[s]&&this[l])return!1;var t=e(this);o=o.not(t),t.removeData(u),o.length||clearTimeout(a)},add:function(t){function n(t,n,o){var r=e(this),l=e.data(this,u)||{};l.w=n!==i?n:r.width(),l.h=o!==i?o:r.height(),a.apply(this,arguments)}if(!r[s]&&this[l])return!1;var a;return e.isFunction(t)?(a=t,n):(a=t.handler,void(t.handler=n))}}}(t,window),e("util",i)});

View File

@ -96,102 +96,46 @@ namespace DriverAllenBradley
switch (ioarg.ValueType)
{
case PluginInterface.DataTypeEnum.Bit:
var resultBit = plc.ReadBoolean(ioarg.Address);
if (resultBit.IsSucceed)
ret.Value = resultBit.Value == true ? 1 : 0;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadBoolean(ioarg.Address).Value == true ? 1 : 0;
break;
case PluginInterface.DataTypeEnum.Bool:
var resultBool = plc.ReadBoolean(ioarg.Address);
if (resultBool.IsSucceed)
ret.Value = resultBool.Value == true ? 1 : 0;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadBoolean(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.UByte:
var resultUByte = plc.ReadByte(ioarg.Address);
if (resultUByte.IsSucceed)
ret.Value = resultUByte.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadByte(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Byte:
var resultByte = plc.ReadByte(ioarg.Address);
if (resultByte.IsSucceed)
ret.Value = (sbyte)resultByte.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = (sbyte)plc.ReadByte(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint16:
var resultUint = plc.ReadUInt16(ioarg.Address);
if (resultUint.IsSucceed)
ret.Value = resultUint.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value =plc.ReadUInt16(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int16:
var resultInt = plc.ReadInt16(ioarg.Address);
if (resultInt.IsSucceed)
ret.Value = resultInt.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadInt16(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint32:
var resultUint32 = plc.ReadUInt32(ioarg.Address);
if (resultUint32.IsSucceed)
ret.Value = resultUint32.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value =plc.ReadUInt32(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int32:
var resultInt32 = plc.ReadInt32(ioarg.Address);
if (resultInt32.IsSucceed)
ret.Value = resultInt32.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadInt32(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Float:
var resultFloat = plc.ReadFloat(ioarg.Address);
if (resultFloat.IsSucceed)
ret.Value = resultFloat.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadFloat(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Double:
var resultDouble = plc.ReadDouble(ioarg.Address);
if (resultDouble.IsSucceed)
ret.Value = resultDouble.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadDouble(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint64:
var resultUint64 = plc.ReadUInt64(ioarg.Address);
if (resultUint64.IsSucceed)
ret.Value = resultUint64.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadUInt64(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int64:
var resultInt64 = plc.ReadInt64(ioarg.Address);
if (resultInt64.IsSucceed)
ret.Value = resultInt64.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadInt64(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.AsciiString:
var resultIntAsciiStr = plc.ReadString(ioarg.Address);
if (resultIntAsciiStr.IsSucceed)
ret.Value = resultIntAsciiStr.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadString(ioarg.Address);
break;
case PluginInterface.DataTypeEnum.Utf8String:
var resultIntUtf8Str = plc.ReadString(ioarg.Address);
if (resultIntUtf8Str.IsSucceed)
ret.Value = resultIntUtf8Str.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadString(ioarg.Address);
break;
default:
break;

View File

@ -1,9 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net5.0/drivers</OutputPath>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net6.0/drivers</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@ -13,5 +15,4 @@
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
</Project>

View File

@ -1,10 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net5.0/drivers</OutputPath>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net6.0/drivers</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="opennetcf-mtconnect-client" Version="1.0.17160" />

View File

@ -1,9 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net5.0/drivers</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net6.0/drivers</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@ -13,5 +15,4 @@
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
</Project>

View File

@ -100,102 +100,46 @@ namespace DriverMitsubishi
switch (ioarg.ValueType)
{
case PluginInterface.DataTypeEnum.Bit:
var resultBit = plc.ReadBoolean(ioarg.Address);
if (resultBit.IsSucceed)
ret.Value = resultBit.Value == true ? 1 : 0;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadBoolean(ioarg.Address).Value == true ? 1 : 0;
break;
case PluginInterface.DataTypeEnum.Bool:
var resultBool = plc.ReadBoolean(ioarg.Address);
if (resultBool.IsSucceed)
ret.Value = resultBool.Value == true ? 1 : 0;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadBoolean(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.UByte:
var resultUByte = plc.ReadByte(ioarg.Address);
if (resultUByte.IsSucceed)
ret.Value = resultUByte.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadByte(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Byte:
var resultByte = plc.ReadByte(ioarg.Address);
if (resultByte.IsSucceed)
ret.Value = (sbyte)resultByte.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = (sbyte)plc.ReadByte(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint16:
var resultUint = plc.ReadUInt16(ioarg.Address);
if (resultUint.IsSucceed)
ret.Value = resultUint.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value =plc.ReadUInt16(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int16:
var resultInt = plc.ReadInt16(ioarg.Address);
if (resultInt.IsSucceed)
ret.Value = resultInt.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadInt16(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint32:
var resultUint32 = plc.ReadUInt32(ioarg.Address);
if (resultUint32.IsSucceed)
ret.Value = resultUint32.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value =plc.ReadUInt32(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int32:
var resultInt32 = plc.ReadInt32(ioarg.Address);
if (resultInt32.IsSucceed)
ret.Value = resultInt32.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadInt32(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Float:
var resultFloat = plc.ReadFloat(ioarg.Address);
if (resultFloat.IsSucceed)
ret.Value = resultFloat.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadFloat(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Double:
var resultDouble = plc.ReadDouble(ioarg.Address);
if (resultDouble.IsSucceed)
ret.Value = resultDouble.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadDouble(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint64:
var resultUint64 = plc.ReadUInt64(ioarg.Address);
if (resultUint64.IsSucceed)
ret.Value = resultUint64.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadUInt64(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int64:
var resultInt64 = plc.ReadInt64(ioarg.Address);
if (resultInt64.IsSucceed)
ret.Value = resultInt64.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadInt64(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.AsciiString:
var resultIntAsciiStr = plc.ReadString(ioarg.Address);
if (resultIntAsciiStr.IsSucceed)
ret.Value = resultIntAsciiStr.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadString(ioarg.Address);
break;
case PluginInterface.DataTypeEnum.Utf8String:
var resultIntUtf8Str = plc.ReadString(ioarg.Address);
if (resultIntUtf8Str.IsSucceed)
ret.Value = resultIntUtf8Str.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadString(ioarg.Address);
break;
default:
break;

View File

@ -1,24 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<OutputPath>../../../IoTGateway/bin/Debug/net5.0/drivers</OutputPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net6.0/drivers</OutputPath>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.IO.Ports">
<HintPath>System.IO.Ports.dll</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="System.IO.Ports">
<HintPath>System.IO.Ports.dll</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
</Project>

View File

@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net5.0/drivers</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net6.0/drivers</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client" Version="1.4.367.75" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client" Version="1.4.367.75" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net6.0/drivers</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IoTClient" Version="1.0.22" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,160 @@
using IoTClient.Clients.PLC;
using IoTClient.Enums;
using PluginInterface;
using System;
using System.Text;
namespace DriverOmronFins
{
[DriverSupported("OmronFins")]
[DriverInfoAttribute("OmronFins", "V1.0.0", "Copyright WHD-IoTClient© 2022-01-15")]
public class OmronFins : IDriver
{
private OmronFinsClient plc = null;
#region
[ConfigParameter("设备Id")]
public Guid DeviceId { get; set; }
[ConfigParameter("IP地址")]
public string IpAddress { get; set; } = "127.0.0.1";
[ConfigParameter("端口号")]
public int Port { get; set; } = 6000;
[ConfigParameter("超时时间ms")]
public int Timeout { get; set; } = 3000;
[ConfigParameter("最小通讯周期ms")]
public uint MinPeriod { get; set; } = 3000;
#endregion
public OmronFins(Guid deviceId)
{
DeviceId = deviceId;
}
public bool IsConnected
{
get
{
return plc != null && plc.Connected;
}
}
public bool Connect()
{
try
{
plc = new OmronFinsClient(IpAddress, Port);
plc.Open();
}
catch (Exception)
{
return false;
}
return IsConnected;
}
public bool Close()
{
try
{
plc?.Close();
return !IsConnected;
}
catch (Exception)
{
return false;
}
}
public void Dispose()
{
try
{
plc = null;
}
catch (Exception)
{
}
}
[Method("读西门子PLC标准地址", description: "读西门子PLC标准地址")]
public DriverReturnValueModel Read(DriverAddressIoArgModel ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (plc != null && this.IsConnected)
{
try
{
switch (ioarg.ValueType)
{
case PluginInterface.DataTypeEnum.Bit:
ret.Value = plc.ReadBoolean(ioarg.Address).Value == true ? 1 : 0;
break;
case PluginInterface.DataTypeEnum.Bool:
ret.Value = plc.ReadBoolean(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.UByte:
ret.Value = plc.ReadByte(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Byte:
ret.Value = (sbyte)plc.ReadByte(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint16:
ret.Value =plc.ReadUInt16(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int16:
ret.Value = plc.ReadInt16(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint32:
ret.Value =plc.ReadUInt32(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int32:
ret.Value = plc.ReadInt32(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Float:
ret.Value = plc.ReadFloat(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Double:
ret.Value = plc.ReadDouble(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint64:
ret.Value = plc.ReadUInt64(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int64:
ret.Value = plc.ReadInt64(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.AsciiString:
ret.Value = plc.ReadString(ioarg.Address);
break;
case PluginInterface.DataTypeEnum.Utf8String:
ret.Value = plc.ReadString(ioarg.Address);
break;
default:
break;
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
}
}

View File

@ -1,12 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net5.0/drivers</OutputPath>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net6.0/drivers</OutputPath>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
</Project>

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using DateTime = S7.Net.Types.DateTime;
using Timer = S7.Net.Types.Timer;
namespace S7.Net
{

View File

@ -96,102 +96,46 @@ namespace DriverOmronFins
switch (ioarg.ValueType)
{
case PluginInterface.DataTypeEnum.Bit:
var resultBit = plc.ReadBoolean(ioarg.Address);
if (resultBit.IsSucceed)
ret.Value = resultBit.Value == true ? 1 : 0;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadBoolean(ioarg.Address).Value == true ? 1 : 0;
break;
case PluginInterface.DataTypeEnum.Bool:
var resultBool = plc.ReadBoolean(ioarg.Address);
if (resultBool.IsSucceed)
ret.Value = resultBool.Value == true ? 1 : 0;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadBoolean(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.UByte:
var resultUByte = plc.ReadByte(ioarg.Address);
if (resultUByte.IsSucceed)
ret.Value = resultUByte.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadByte(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Byte:
var resultByte = plc.ReadByte(ioarg.Address);
if (resultByte.IsSucceed)
ret.Value = (sbyte)resultByte.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = (sbyte)plc.ReadByte(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint16:
var resultUint = plc.ReadUInt16(ioarg.Address);
if (resultUint.IsSucceed)
ret.Value = resultUint.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value =plc.ReadUInt16(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int16:
var resultInt = plc.ReadInt16(ioarg.Address);
if (resultInt.IsSucceed)
ret.Value = resultInt.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadInt16(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint32:
var resultUint32 = plc.ReadUInt32(ioarg.Address);
if (resultUint32.IsSucceed)
ret.Value = resultUint32.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value =plc.ReadUInt32(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int32:
var resultInt32 = plc.ReadInt32(ioarg.Address);
if (resultInt32.IsSucceed)
ret.Value = resultInt32.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadInt32(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Float:
var resultFloat = plc.ReadFloat(ioarg.Address);
if (resultFloat.IsSucceed)
ret.Value = resultFloat.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadFloat(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Double:
var resultDouble = plc.ReadDouble(ioarg.Address);
if (resultDouble.IsSucceed)
ret.Value = resultDouble.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadDouble(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Uint64:
var resultUint64 = plc.ReadUInt64(ioarg.Address);
if (resultUint64.IsSucceed)
ret.Value = resultUint64.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadUInt64(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.Int64:
var resultInt64 = plc.ReadInt64(ioarg.Address);
if (resultInt64.IsSucceed)
ret.Value = resultInt64.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadInt64(ioarg.Address).Value;
break;
case PluginInterface.DataTypeEnum.AsciiString:
var resultIntAsciiStr = plc.ReadString(ioarg.Address);
if (resultIntAsciiStr.IsSucceed)
ret.Value = resultIntAsciiStr.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadString(ioarg.Address);
break;
case PluginInterface.DataTypeEnum.Utf8String:
var resultIntUtf8Str = plc.ReadString(ioarg.Address);
if (resultIntUtf8Str.IsSucceed)
ret.Value = resultIntUtf8Str.Value;
else
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Value = plc.ReadString(ioarg.Address);
break;
default:
break;

View File

@ -16,7 +16,7 @@ namespace Plugin
{
public class DrvierService//: IDependency
{
string DriverPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"drivers/net5.0");
string DriverPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"drivers/net6.0");
string[] driverFiles;
public List<DriverInfo> DriverInfos = new List<DriverInfo>();
public DrvierService(IConfiguration ConfigRoot)

View File

@ -70,25 +70,34 @@ namespace Plugin
{
try
{
string TopicBase = "v1/gateway/telemetry";
if (!systemConfig.Disperse)
_mqttClient.PublishAsync(TopicBase, JsonConvert.SerializeObject(SendModel));
else
switch (systemConfig.IoTPlatformType)
{
foreach (var payload in SendModel[device.DeviceName])
{
foreach (var kv in payload.Values)
case IoTPlatformType.ThingsBoard:
_mqttClient.PublishAsync("v1/gateway/telemetry", JsonConvert.SerializeObject(SendModel));
break;
case IoTPlatformType.IoTSharp:
foreach (var payload in SendModel[device.DeviceName])
{
_mqttClient.PublishAsync($"{TopicBase}/{device.DeviceName}/{kv.Key}", kv.Value?.ToString());
//更新到UAService
_uaNodeManager.UpdateNode($"{device.Parent.DeviceName}.{device.DeviceName}.{kv.Key}", kv.Value);
_mqttClient.PublishAsync($"devices/{device.DeviceName}/telemetry", JsonConvert.SerializeObject(payload.Values));
}
break;
case IoTPlatformType.AliCloudIoT:
case IoTPlatformType.TencentIoTHub:
case IoTPlatformType.BaiduIoTCore:
case IoTPlatformType.OneNET:
default:
break;
}
foreach (var payload in SendModel[device.DeviceName])
{
foreach (var kv in payload.Values)
{
//更新到UAService
_uaNodeManager.UpdateNode($"{device.Parent.DeviceName}.{device.DeviceName}.{kv.Key}", kv.Value);
}
}
}
catch (Exception ex)
{

View File

@ -1,11 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DynamicExpresso.Core" Version="2.9.7" />
<PackageReference Include="DynamicExpresso.Core" Version="2.10.0" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="MQTTnet" Version="3.1.1" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.4.367.75" />

View File

@ -230,7 +230,7 @@ namespace Quickstarts
}
item.AppendFormat(":{0}", session.Id);
}
Console.WriteLine(item.ToString());
//Console.WriteLine(item.ToString());
}
}

View File

@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>

View File

@ -311,7 +311,8 @@ namespace WalkingTec.Mvvm.Core
{
val = FC["LinkedVM." + pro.Name + "[]"];
}
if (proToSet != null && val != null)
var valuetoset = pro.GetValue(LinkedVM);
if (proToSet != null && val != null && valuetoset != null)
{
var hasvalue = true;
if ( val is StringValues sv && StringValues.IsNullOrEmpty(sv) == true)
@ -320,7 +321,7 @@ namespace WalkingTec.Mvvm.Core
}
if (hasvalue)
{
proToSet.SetValue(entity, pro.GetValue(LinkedVM));
proToSet.SetValue(entity, valuetoset);
}
}
}

View File

@ -202,10 +202,10 @@ namespace WalkingTec.Mvvm.Core.Extensions
//如果没有指定忽略权限则拼接权限过滤的where条件
if (ignorDataPrivilege == false)
{
query = AppendSelfDPWhere(query,wtmcontext,dps);
query = AppendSelfDPWhere(query, wtmcontext, dps);
}
if (typeof(IPersistPoco).IsAssignableFrom( typeof(T)))
if (typeof(IPersistPoco).IsAssignableFrom(typeof(T)))
{
var mod = new IsValidModifier();
var newExp = mod.Modify(query.Expression);
@ -277,23 +277,15 @@ namespace WalkingTec.Mvvm.Core.Extensions
private static IQueryable<T> AppendSelfDPWhere<T>(IQueryable<T> query, WTMContext wtmcontext, List<SimpleDataPri> dps) where T : TopBasePoco
{
var dpsSetting = wtmcontext?.DataPrivilegeSettings;
Type modelTye = typeof(T);
bool isBasePoco = typeof(IBasePoco).IsAssignableFrom(modelTye);
ParameterExpression pe = Expression.Parameter(modelTye);
Expression peid = Expression.Property(pe, modelTye.GetSingleProperty("ID"));
ParameterExpression pe = Expression.Parameter(typeof(T));
Expression peid = Expression.Property(pe, typeof(T).GetSingleProperty("ID"));
//循环数据权限加入到where条件中达到自动过滤的效果
Expression selfexp = Expression.NotEqual(Expression.Constant(1), Expression.Constant(1));
if(isBasePoco == true)
{
selfexp = Expression.Equal(Expression.Property(pe, "CreateBy"), Expression.Constant(wtmcontext.LoginUserInfo?.ITCode));
}
if (dpsSetting?.Where(x => x.ModelName == query.ElementType.Name).SingleOrDefault() != null)
{
//如果dps参数是空则生成 1!=1 这种错误的表达式,这样就查不到任何数据了
if (dps == null)
{
query = query.Where(Expression.Lambda<Func<T, bool>>(selfexp, pe));
query = query.Where(Expression.Lambda<Func<T, bool>>(Expression.NotEqual(Expression.Constant(1), Expression.Constant(1)), pe));
}
else
{
@ -301,14 +293,13 @@ namespace WalkingTec.Mvvm.Core.Extensions
var ids = dps.Where(x => x.TableName == query.ElementType.Name).Select(x => x.RelateId).ToList();
if (ids == null || ids.Count() == 0)
{
query = query.Where(Expression.Lambda<Func<T, bool>>(selfexp, pe));
query = query.Where(Expression.Lambda<Func<T, bool>>(Expression.NotEqual(Expression.Constant(1), Expression.Constant(1)), pe));
}
else
{
if (!ids.Contains(null))
{
var exp = Expression.OrElse(selfexp, ids.GetContainIdExpression(typeof(T), pe).Body);
query = query.Where(Expression.Lambda<Func<T, bool>>(exp,pe));
query = query.Where(ids.GetContainIdExpression<T>());
}
}
}
@ -324,7 +315,7 @@ namespace WalkingTec.Mvvm.Core.Extensions
/// <param name="wtmcontext"></param>
/// <param name="IdFields">关联表外键</param>
/// <returns>修改后的查询语句</returns>
public static IQueryable<T> DPWhere<T>(this IQueryable<T> baseQuery, WTMContext wtmcontext, params Expression<Func<T, object>>[] IdFields) where T:TopBasePoco
public static IQueryable<T> DPWhere<T>(this IQueryable<T> baseQuery, WTMContext wtmcontext, params Expression<Func<T, object>>[] IdFields) where T : TopBasePoco
{
var dps = wtmcontext?.LoginUserInfo?.DataPrivileges;
//循环所有关联外键
@ -351,7 +342,7 @@ namespace WalkingTec.Mvvm.Core.Extensions
}
//var test = DPWhere(baseQuery, dps, tableNameList, IdFields);
return DPWhere(baseQuery,wtmcontext,tableNameList, IdFields);
return DPWhere(baseQuery, wtmcontext, tableNameList, IdFields);
}
#region AddBy YOUKAI 20160310
@ -364,24 +355,17 @@ namespace WalkingTec.Mvvm.Core.Extensions
/// <param name="tableName">关联数据权限的表名,如果关联外键为自身,则参数第一个为自身</param>
/// <param name="IdFields">关联表外键</param>
/// <returns>修改后的查询语句</returns>
public static IQueryable<T> DPWhere<T>(this IQueryable<T> baseQuery,WTMContext wtmcontext,List<string> tableName, params Expression<Func<T, object>>[] IdFields) where T:TopBasePoco
public static IQueryable<T> DPWhere<T>(this IQueryable<T> baseQuery, WTMContext wtmcontext, List<string> tableName, params Expression<Func<T, object>>[] IdFields) where T : TopBasePoco
{
var dps = wtmcontext?.LoginUserInfo?.DataPrivileges;
Type modelTye = typeof(T);
bool isBasePoco = typeof(IBasePoco).IsAssignableFrom(modelTye);
// var dpsSetting = BaseVM.AllDPS;
ParameterExpression pe = Expression.Parameter(modelTye);
ParameterExpression pe = Expression.Parameter(typeof(T));
Expression left1 = Expression.Constant(1);
Expression right1 = Expression.Constant(1);
Expression trueExp = Expression.Equal(left1, right1);
Expression falseExp = Expression.NotEqual(left1, right1);
Expression finalExp = null;
Expression selfexp = falseExp;
if (isBasePoco == true)
{
selfexp = Expression.Equal(Expression.Property(pe, "CreateBy"), Expression.Constant(wtmcontext.LoginUserInfo?.ITCode));
}
int tindex = 0;
//循环所有关联外键
foreach (var IdField in IdFields)
@ -415,7 +399,7 @@ namespace WalkingTec.Mvvm.Core.Extensions
//如果dps为空则拼接一个返回假的表达式这样就查询不出任何数据
if (dps == null)
{
exp = selfexp;
exp = falseExp;
}
else
{
@ -451,7 +435,15 @@ namespace WalkingTec.Mvvm.Core.Extensions
//如果没有关联的id则拼接一个返回假的where是语句查询不到任何数据
if (ids == null || ids.Count() == 0)
{
exp = selfexp;
exp = falseExp;
//if (peid.Type == typeof(Guid))
//{
// exp = Expression.Equal(peid, Expression.Constant(Guid.NewGuid()));
//}
//else
//{
// exp = Expression.Equal(peid, Expression.Constant(null));
//}
}
//如果有关联 Id
else
@ -485,7 +477,6 @@ namespace WalkingTec.Mvvm.Core.Extensions
{
exp = ids.GetContainIdExpression(typeof(T), pe, peid).Body;
}
exp = Expression.OrElse(selfexp, exp);
}
}
}
@ -601,7 +592,7 @@ namespace WalkingTec.Mvvm.Core.Extensions
return rv;
}
public static IQueryable<T> CheckID<T>(this IQueryable<T> baseQuery, object val, Expression<Func<T, object>> member=null)
public static IQueryable<T> CheckID<T>(this IQueryable<T> baseQuery, object val, Expression<Func<T, object>> member = null)
{
ParameterExpression pe = Expression.Parameter(typeof(T));
PropertyInfo idproperty = null;
@ -625,7 +616,7 @@ namespace WalkingTec.Mvvm.Core.Extensions
idproperty = typeof(T).GetSingleProperty("ParentId");
Expression peid = Expression.Property(pe, idproperty);
var p = Expression.Call(peid, "ToString", new Type[] { });
if(val == null)
if (val == null)
{
return baseQuery.Where(Expression.Lambda<Func<T, bool>>(Expression.Equal(peid, Expression.Constant(null)), pe));
}
@ -638,7 +629,7 @@ namespace WalkingTec.Mvvm.Core.Extensions
public static IQueryable<T> CheckIDs<T>(this IQueryable<T> baseQuery, List<string> val, Expression<Func<T, object>> member = null)
{
if(val == null)
if (val == null)
{
return baseQuery;
}
@ -658,7 +649,7 @@ namespace WalkingTec.Mvvm.Core.Extensions
}
public static IQueryable<T> CheckNotNull<T>(this IQueryable<T> baseQuery, Expression<Func<T,object>> member)
public static IQueryable<T> CheckNotNull<T>(this IQueryable<T> baseQuery, Expression<Func<T, object>> member)
{
return baseQuery.CheckNotNull<T>(member.GetPropertyName());
}
@ -695,7 +686,7 @@ namespace WalkingTec.Mvvm.Core.Extensions
{
return baseQuery;
}
else if(val is string s && string.IsNullOrEmpty(s))
else if (val is string s && string.IsNullOrEmpty(s))
{
return baseQuery;
}

View File

@ -71,7 +71,7 @@ namespace WalkingTec.Mvvm.Core.Json
{
if(item.Value == null)
{
if (options.IgnoreNullValues == false)
if (options.DefaultIgnoreCondition == JsonIgnoreCondition.Never)
{
writer.WriteNull(item.Key);
}

View File

@ -54,12 +54,9 @@ namespace WalkingTec.Mvvm.Core.Json
rv.DefaultIgnoreCondition = op.DefaultIgnoreCondition;
rv.DictionaryKeyPolicy = op.DictionaryKeyPolicy;
rv.Encoder = op.Encoder;
rv.IgnoreNullValues = op.IgnoreNullValues;
rv.IgnoreReadOnlyFields = op.IgnoreReadOnlyFields;
rv.IgnoreReadOnlyProperties = op.IgnoreReadOnlyProperties;
rv.IncludeFields = op.IncludeFields;
rv.DefaultIgnoreCondition = op.DefaultIgnoreCondition;
rv.DictionaryKeyPolicy = op.DictionaryKeyPolicy;
rv.MaxDepth = op.MaxDepth;
rv.NumberHandling = op.NumberHandling;
rv.ReadCommentHandling = op.ReadCommentHandling;

View File

@ -69,7 +69,7 @@ namespace WalkingTec.Mvvm.Core
.Select(x => x.LogLevel).FirstOrDefault();
if (level == null)
{
level = LogLevel.Error;
level = LogLevel.None;
}
if (logLevel >= level)
{

View File

@ -655,9 +655,9 @@ namespace WalkingTec.Mvvm.Core
return stringDecrypted;
}
private static DESCryptoServiceProvider GenerateDESCryptoServiceProvider(string key)
private static DES GenerateDESCryptoServiceProvider(string key)
{
DESCryptoServiceProvider dCrypter = new DESCryptoServiceProvider();
var dCrypter = DES.Create();
string sTemp;
if (dCrypter.LegalKeySizes.Length > 0)
@ -730,7 +730,7 @@ namespace WalkingTec.Mvvm.Core
private static string MD5String(byte[] buffer)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
var md5 = MD5.Create();
byte[] cryptBuffer = md5.ComputeHash(buffer);
StringBuilder sb = new StringBuilder();
foreach (byte item in cryptBuffer)

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Description>WalkingTec.Mvvm</Description>
<AssemblyName>WalkingTec.Mvvm.Core</AssemblyName>
<Title>$(AssemblyName)</Title>
@ -13,32 +13,32 @@
<PackageReference Include="DotNetCore.NPOI" Version="1.2.3" />
<PackageReference Include="Fare" Version="2.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.DataAnnotations.Validation" Version="3.2.0-rc1.20223.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.9">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.9">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.9" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.7" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="5.21.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.2" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="6.21.5" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="5.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
</ItemGroup>

View File

@ -203,7 +203,7 @@ namespace WalkingTec.Mvvm.Mvc.Filters
{
check = m.Groups[1] + "[0]" + m.Groups[2];
}
if (model.FC.ContainsKey(check) == false)
if (model.FC.Keys.Any(x=>x.ToLower() == check.ToLower()) == false)
{
ctrl.ModelState.Remove(v);
}
@ -263,9 +263,9 @@ namespace WalkingTec.Mvvm.Mvc.Filters
var ctrlActDesc = context.ActionDescriptor as ControllerActionDescriptor;
//get viewname
string viewName = "";
if(context.Result is PartialViewResult pvr)
if (context.Result is PartialViewResult pvr)
{
viewName = pvr.ViewName??"";
viewName = pvr.ViewName ?? "";
if (viewName?.StartsWith("/") == false)
{
var viewEngine = context.HttpContext.RequestServices.GetRequiredService<ICompositeViewEngine>();

View File

@ -47,7 +47,7 @@ namespace WalkingTec.Mvvm.Mvc
public static void UseWtmJsonOptions(this JsonOptions options)
{
options.JsonSerializerOptions.PropertyNamingPolicy = null;
options.JsonSerializerOptions.IgnoreNullValues = true;
options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
options.JsonSerializerOptions.NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString;
options.JsonSerializerOptions.AllowTrailingCommas = true;
options.JsonSerializerOptions.Converters.Add(new DateTimeConverter());

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Description>WalkingTec.Mvvm</Description>
<AssemblyName>WalkingTec.Mvvm.Mvc</AssemblyName>
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
@ -59,11 +59,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="5.0.9" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.5" />
<PackageReference Include="VueCliMiddleware" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta13" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="VueCliMiddleware" Version="6.0.0" />
</ItemGroup>

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
@ -16,6 +14,12 @@ using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using SixLabors.Fonts;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using WalkingTec.Mvvm.Core.Models;
@ -307,7 +311,7 @@ namespace WalkingTec.Mvvm.Mvc
}
var FileData = Request.Form.Files[0];
Image oimage = Image.FromStream(FileData.OpenReadStream());
Image oimage = Image.Load(FileData.OpenReadStream());
if (oimage == null)
{
return JsonMore(new { Id = string.Empty, Name = string.Empty }, StatusCodes.Status404NotFound);
@ -321,7 +325,8 @@ namespace WalkingTec.Mvvm.Mvc
height = width * oimage.Height / oimage.Width;
}
MemoryStream ms = new MemoryStream();
oimage.GetThumbnailImage(width.Value, height.Value, null, IntPtr.Zero).Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
oimage.Mutate(x => x.Resize(width.Value, height.Value));
oimage.SaveAsJpeg(ms);
ms.Position = 0;
var file = fp.Upload(FileData.FileName, ms.Length, ms, groupName,subdir,extra,sm, Wtm.CreateDC(cskey: _DONOT_USE_CS));
@ -368,7 +373,7 @@ namespace WalkingTec.Mvvm.Mvc
try
{
rv = file.DataStream;
Image oimage = Image.FromStream(rv);
Image oimage = Image.Load(rv);
if (oimage != null && (width != null || height != null))
{
if (width == null)
@ -380,7 +385,8 @@ namespace WalkingTec.Mvvm.Mvc
height = oimage.Height * width / oimage.Width;
}
var ms = new MemoryStream();
oimage.GetThumbnailImage(width.Value, height.Value, null, IntPtr.Zero).Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
oimage.Mutate(x => x.Resize(width.Value, height.Value));
oimage.SaveAsJpeg(ms);
rv.Dispose();
rv = ms;
}
@ -632,8 +638,8 @@ namespace WalkingTec.Mvvm.Mvc
LocalizeMenu(resultMenus);
return Content(JsonSerializer.Serialize(new { Code = 200, Msg = string.Empty, Data = resultMenus }, new JsonSerializerOptions()
{
IgnoreNullValues = true
}), "application/json");
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault
}), "application/json") ;
}
else
{
@ -644,7 +650,7 @@ namespace WalkingTec.Mvvm.Mvc
LocalizeMenu(resultMenus);
return Content(JsonSerializer.Serialize(new { Code = 200, Msg = string.Empty, Data = resultMenus }, new JsonSerializerOptions()
{
IgnoreNullValues = true
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault
}), "application/json");
}
}
@ -714,7 +720,7 @@ namespace WalkingTec.Mvvm.Mvc
{
int codeW = 80;
int codeH = 30;
int fontSize = 16;
int fontSize = 20;
string chkCode = string.Empty;
Color[] color = { Color.Black, Color.Red, Color.Blue, Color.Green, Color.Orange, Color.Brown, Color.DarkBlue, Color.PaleGreen };
string[] font = { "Times New Roman" };
@ -729,34 +735,32 @@ namespace WalkingTec.Mvvm.Mvc
HttpContext.Session.Set<string>("verify_code", chkCode);
//创建画布
Bitmap bmp = new Bitmap(codeW, codeH);
Graphics g = Graphics.FromImage(bmp);
g.Clear(Color.Linen);
Image bmp = new Image<Rgba32>(codeW, codeH);
//画噪线
for (int i = 0; i < 3; i++)
{
int x1 = rnd.Next(codeW);
int y1 = rnd.Next(codeH);
int x2 = rnd.Next(codeW);
int y2 = rnd.Next(codeH);
float x1 = rnd.Next(codeW);
float y1 = rnd.Next(codeH);
float x2 = rnd.Next(codeW);
float y2 = rnd.Next(codeH);
Color clr = color[rnd.Next(color.Length)];
g.DrawLine(new Pen(clr), x1, y1, x2, y2);
bmp.Mutate(x => x.DrawLines(clr, 1.0f, new PointF(x1,y1), new PointF(x2,y2)));
}
//画验证码
for (int i = 0; i < chkCode.Length; i++)
{
string fnt = font[rnd.Next(font.Length)];
Font ft = new Font(fnt, fontSize);
Font ft = new Font(SystemFonts.Find(fnt), fontSize);
Color clr = color[rnd.Next(color.Length)];
g.DrawString(chkCode[i].ToString(), ft, new SolidBrush(clr), (float)i * 18, (float)0);
bmp.Mutate(x => x.DrawText(chkCode[i].ToString(),ft,clr,new PointF((float)i * 18, (float)0)));
}
//将验证码写入图片内存流中以image/png格式输出
MemoryStream ms = new MemoryStream();
try
{
bmp.Save(ms, ImageFormat.Png);
bmp.SaveAsPng(ms);
return File(ms.ToArray(), "image/jpeg");
}
catch (Exception)
@ -765,7 +769,6 @@ namespace WalkingTec.Mvvm.Mvc
}
finally
{
g.Dispose();
bmp.Dispose();
}
}

View File

@ -557,7 +557,7 @@ namespace WalkingTec.Mvvm.TagHelpers.LayUI
}
var joption = new JsonSerializerOptions();
joption.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
joption.IgnoreNullValues = true;
joption.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
output.PostElement.AppendHtml($@"
<script>
var {Id}option = null;

View File

@ -90,8 +90,12 @@ namespace WalkingTec.Mvvm.TagHelpers.LayUI
if (m2.Success)
{
var gridvar = m2.Groups[1].Value.Trim();
var idfieldname = IdField?.Name ?? "notsetid";
idfieldname = Regex.Replace(idfieldname, ".*?Searcher\\.","");
var levelfieldname = LevelField?.Name ?? "notsetlevel";
levelfieldname = Regex.Replace(levelfieldname, ".*?Searcher\\.", "");
cusmtomclick = $@"
$.extend({gridid}defaultfilter.where,{{'{IdField?.Name?.Replace("Searcher.","") ?? "notsetid"}':data.data.id, '{LevelField?.Name?.Replace("Searcher.", "") ?? "notsetlevel"}':data.data.level }});
$.extend({gridid}defaultfilter.where,{{'{idfieldname}':data.data.id, '{levelfieldname}':data.data.level }});
layui.table.reload('{gridid}',{{where: {gridid}defaultfilter.where}});
";
}

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Description>WalkingTec.Mvvm</Description>
<AssemblyName>WalkingTec.Mvvm.TagHelpers.LayUI</AssemblyName>
<Title>$(AssemblyName)</Title>

View File

@ -1,18 +0,0 @@
FROM mcr.microsoft.com/dotnet/core/sdk:5.0-alpine AS build
WORKDIR /app
COPY . .
RUN dotnet publish "./IoTGateway/IoTGateway.csproj" -c Release -o /app/out
FROM mcr.microsoft.com/dotnet/core/aspnet:5.0-alpine AS runtime
WORKDIR /app
COPY --from=build /app/out ./
# install libgdiplus for System.Drawing
RUN apk add libgdiplus --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted && \
apk add terminus-font
ENV ASPNETCORE_URLS http://+:80
ENV ASPNETCORE_ENVIRONMENT Production
ENTRYPOINT ["dotnet", "IoTGateway.dll"]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More