You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/projects/Infrastructure/Views/Shared/EditorTemplates/CascaderSelect.cshtml

17 lines
1.1 KiB

@*@using Infrastructure.Web.Mvc
@{
var metadata = ViewData.ModelMetadata as Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadata;
var attribute = (metadata.Attributes.Attributes.FirstOrDefault(o => o.GetType() == typeof(AjaxSelectAttribute)) as AjaxSelectAttribute);
var url = attribute.GetAjaxUrl(Url);
var list = (ViewData[ViewData.ModelMetadata.PropertyName + "AjaxSelectList"] as List<AjaxSelectListItem>) ?? new List<AjaxSelectListItem>();
var id = Html.IdForModel();
var name = Html.NameForModel();
var selected= (Model as Guid?).HasValue?list.Select(o=>o.Value).ToJson(true):"[]";
var options = list.First().ToJson(true);
<input type="text" id="@id" name="@name" value="@Model" style="position: absolute;left: -99999px;">
<el-cascader style="width:100%;" ref="@id" :value='@Html.Raw(selected)'
:options='@Html.Raw(options)'
v-on:change="VeChange($event,'@id')"
:props="{checkStrictly: true,lazy:true,lazyLoad:VeLoad,id:'@id',url:'@url&parentId='}">
</el-cascader>
}*@