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/Platform/Views/Home/Index2.cshtml

62 lines
1.7 KiB

@model Platform.ViewModels.HomeModel
@{
HideBread = true;
var organTreeJson = new object[] { Convert(Model.Organ) }.ToJson();
}
<br />
<div class="row">
<div class="col-2">
<div class="card" style="min-height:100%;">
<div class="card-header">
机构及下属机构
</div>
<div class="card-body">
<a-tree :tree-data="nodes" show-line="true" default-expand-all="true" :default-selected-keys="selected" v-on:select="onSelect">
</a-tree>
</div>
</div>
</div>
<div class="col-10">
<div class="card" style="min-height:100%;">
<div class="card-header">
机构概况
</div>
<div class="card-body">
</div>
</div>
</div>
</div>
</a-row>
@section scripts{
<script>
var nodes = @Html.Raw(organTreeJson);
var app = new Vue({
el: '#app',
data: function () {
return {
nodes,
selected:['@Html.Raw(Model.OrganNumber)']
};
},
methods: {
onSelect: function (selectedKeys, info) {
window.location = '@Url.Action()?organNumber='+selectedKeys[0];
console.log('selected', selectedKeys, info);
}
}
});
</script>
}
@functions{
object Convert(Organ root)
{
return new
{
title = root.Name,
key = root.Number,
children = root.Children.Select(o => Convert(o))
};
}
}