tree显示设备状态:停止、连接成功、连接断开
This commit is contained in:
parent
2633fbe886
commit
0265a53207
@ -34,13 +34,19 @@ namespace IoTGateway.ViewModel.BasicData.DeviceConfigVMs
|
|||||||
.OrderBy(x => x.Parent.Index).ThenBy(x => x.Parent.DeviceName)
|
.OrderBy(x => x.Parent.Index).ThenBy(x => x.Parent.DeviceName)
|
||||||
.OrderBy(x => x.Index).ThenBy(x => x.DeviceName)
|
.OrderBy(x => x.Index).ThenBy(x => x.DeviceName)
|
||||||
.GetTreeSelectListItems(Wtm, x => x.DeviceName);
|
.GetTreeSelectListItems(Wtm, x => x.DeviceName);
|
||||||
|
|
||||||
|
var deviceService = Wtm.ServiceProvider.GetService(typeof(DeviceService)) as DeviceService;
|
||||||
foreach (var device in AllDevices)
|
foreach (var device in AllDevices)
|
||||||
{
|
{
|
||||||
foreach (var item in device.Children)
|
foreach (var item in device.Children)
|
||||||
{
|
{
|
||||||
item.Text = item.Text;
|
var deviceThread = deviceService.DeviceThreads.Where(x => x._device.ID.ToString() == (string)item.Value).FirstOrDefault();
|
||||||
item.Icon = "layui-icon layui-icon-link";
|
if (deviceThread != null)
|
||||||
|
item.Icon = deviceThread._device.AutoStart ? (deviceThread._driver.IsConnected ? "layui-icon layui-icon-link" : "layui-icon layui-icon-unlink") : "layui-icon layui-icon-pause";
|
||||||
|
|
||||||
|
item.Text = " "+item.Text;
|
||||||
item.Expended = true;
|
item.Expended = true;
|
||||||
|
item.Selected =item.Value.ToString() == IoTBackgroundService.ConfigSelectDeviceId.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
base.InitListVM();
|
base.InitListVM();
|
||||||
|
@ -31,7 +31,7 @@ namespace IoTGateway.ViewModel.BasicData.DeviceConfigVMs
|
|||||||
.GetSelectListItems(Wtm, y => y.DeviceName);
|
.GetSelectListItems(Wtm, y => y.DeviceName);
|
||||||
if (Entity.DeviceId != null)
|
if (Entity.DeviceId != null)
|
||||||
{
|
{
|
||||||
if (Entity.EnumInfo != null)
|
if (!string.IsNullOrEmpty(Entity.EnumInfo))
|
||||||
{
|
{
|
||||||
AllTypes = new List<ComboSelectListItem>();
|
AllTypes = new List<ComboSelectListItem>();
|
||||||
var EnumInfos = JsonSerializer.Deserialize<Dictionary<string, int>>(Entity.EnumInfo);
|
var EnumInfos = JsonSerializer.Deserialize<Dictionary<string, int>>(Entity.EnumInfo);
|
||||||
|
@ -47,10 +47,11 @@ namespace IoTGateway.ViewModel.BasicData.DeviceVariableVMs
|
|||||||
{
|
{
|
||||||
var deviceThread = deviceService.DeviceThreads.Where(x => x._device.ID.ToString() == (string)item.Value).FirstOrDefault();
|
var deviceThread = deviceService.DeviceThreads.Where(x => x._device.ID.ToString() == (string)item.Value).FirstOrDefault();
|
||||||
if (deviceThread != null)
|
if (deviceThread != null)
|
||||||
item.Icon = deviceThread._device.AutoStart ? (deviceThread._driver.IsConnected ? "layui-icon-link" : "layui-icon-unlink") : "layui-icon-pause";
|
item.Icon = deviceThread._device.AutoStart ? (deviceThread._driver.IsConnected ? "layui-icon layui-icon-link" : "layui-icon layui-icon-unlink") : "layui-icon layui-icon-pause";
|
||||||
|
|
||||||
item.Text = item.Text;
|
item.Text = " " + item.Text;
|
||||||
item.Expended = true;
|
item.Expended = true;
|
||||||
|
item.Selected = item.Value.ToString() == IoTBackgroundService.VariableSelectDeviceId.ToString();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
<wt:row items-per-row="ItemsPerRowEnum.Two">
|
||||||
@*<wt:textbox field="Entity.DeviceConfigName" />*@
|
@*<wt:textbox field="Entity.DeviceConfigName" />*@
|
||||||
@{
|
@{
|
||||||
if (Model.Entity.EnumInfo != null)
|
if (!string.IsNullOrEmpty(Model.Entity.EnumInfo))
|
||||||
{
|
{
|
||||||
<wt:combobox field="Entity.Value" items="AllTypes" />
|
<wt:combobox field="Entity.Value" items="AllTypes" />
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
autoReload="true"
|
autoReload="true"
|
||||||
internalLogLevel="Info"
|
internalLogLevel="Error"
|
||||||
internalLogFile="./logs/internal-nlog-AspNetCore.txt">
|
internalLogFile="./logs/internal-nlog-AspNetCore.txt">
|
||||||
|
|
||||||
<!-- enable asp.net core layout renderers -->
|
<!-- enable asp.net core layout renderers -->
|
||||||
|
@ -201,8 +201,8 @@ layui.define('form', function(exports){
|
|||||||
if(options.isJump && item.href){
|
if(options.isJump && item.href){
|
||||||
return '<a href="'+ item.href +'" target="_blank" class="'+ ELEM_TEXT +'">'+ (item.title || item.label || options.text.defaultNodeName) +'</a>';
|
return '<a href="'+ item.href +'" target="_blank" class="'+ ELEM_TEXT +'">'+ (item.title || item.label || options.text.defaultNodeName) +'</a>';
|
||||||
} else {
|
} else {
|
||||||
return '<span class="' + ELEM_TEXT + (item.disabled ? ' ' + DISABLED : '') + '"><i class="layui-icon ' + (item.icon || '') + '"></i>' + (item.title || item.label || options.text.defaultNodeName) + '</span>';
|
return '<span class="' + ELEM_TEXT + (item.disabled ? ' ' + DISABLED : '') + '"><i class="iconfont ' + (item.icon || '') + '"></i>' + (item.title || item.label || options.text.defaultNodeName) + '</span>';
|
||||||
//return '<span class="' + ELEM_TEXT + (item.disabled ? ' ' + DISABLED : '') + '">' + (item.title || item.label || options.text.defaultNodeName) + '</span>';
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
,'</div>'
|
,'</div>'
|
||||||
|
@ -10,6 +10,9 @@ namespace WalkingTec.Mvvm.TagHelpers.LayUI
|
|||||||
[JsonPropertyName("title")]
|
[JsonPropertyName("title")]
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("icon")]
|
||||||
|
public string Icon { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("id")]
|
[JsonPropertyName("id")]
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
@ -176,6 +176,7 @@ layui.use(['tree'],function(){{
|
|||||||
{
|
{
|
||||||
Id = s.Value.ToString(),
|
Id = s.Value.ToString(),
|
||||||
Title = s.Text,
|
Title = s.Text,
|
||||||
|
Icon = s.Icon,
|
||||||
Url = s.Url,
|
Url = s.Url,
|
||||||
Expand = s.Expended,
|
Expand = s.Expended,
|
||||||
Level = level,
|
Level = level,
|
||||||
|
Loading…
Reference in New Issue
Block a user