mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-22 11:33:07 +08:00
fix: mqtt脚本检查功能中的类型转换错误
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
@using ThingsGateway.Gateway.Application
|
||||
|
||||
<div class="col-12 col-md-12">
|
||||
<Textarea Value=@Script ValueChanged=@ScriptChanged ValueExpression="()=>Script" ShowLabelTooltip="true"
|
||||
<Textarea Value=@Script ValueChanged=@Change ValueExpression="()=>Script" ShowLabelTooltip="true"
|
||||
rows="10" ShowLabel="true" />
|
||||
</div>
|
||||
<div class="col-12 col-md-12">
|
||||
|
@@ -24,10 +24,19 @@ public partial class ScriptCheck
|
||||
public string Script { get; set; }
|
||||
[Parameter, EditorRequired]
|
||||
public EventCallback<string> ScriptChanged { get; set; }
|
||||
private async Task Change(string script)
|
||||
{
|
||||
|
||||
Script = script;
|
||||
if (ScriptChanged.HasDelegate)
|
||||
await ScriptChanged.InvokeAsync(script);
|
||||
|
||||
}
|
||||
private Type type;
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Input = Data.ToJsonNetString();
|
||||
type = Data.GetType();
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
@@ -35,7 +44,7 @@ public partial class ScriptCheck
|
||||
{
|
||||
try
|
||||
{
|
||||
Data = Input.FromJsonNetString<IEnumerable<object>>();
|
||||
Data = (IEnumerable<object>)Newtonsoft.Json.JsonConvert.DeserializeObject(Input, type);
|
||||
var value = Data.GetDynamicModel(Script);
|
||||
Output = value.ToJsonNetString();
|
||||
}
|
||||
|
Reference in New Issue
Block a user