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/Areas/Admin/Views/Shared/_Script.cshtml

54 lines
1.9 KiB

@using System.Reflection
@using Microsoft.AspNetCore.Mvc.Controllers
@using Infrastructure.Web.Mvc
@{
var scope = (this.ViewContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.GetCustomAttribute<ControllerScopeAttribute>()?.Scope;
}
<script>
$(function () {
$('#OrganId').change(function () {
var id = $(this).find(':selected').val();
update('@Url.Action("GetOrganBuilding", "Ajax",new{area="IoTCenter",scope=scope})', id, "#ParentId");
update('@Url.Action("GetUser", "Ajax",new{area=""})', id, "#UserId");
});;
$('#Query_OrganId').change(function () {
var id = $(this).find(':selected').val();
update('@Url.Action("GetOrganBuilding", "Ajax",new{area=""})', id, "#Query_ParentId");
update('@Url.Action("GetUser", "Ajax",new{area=""})', id, "#Query_UserId");
});;
});
</script>
<script>
//
function VeLoad(node, resolve) {
var parentId = node.root ? null : node.value;
var url = this.url + parentId;
$.getJSON(url, function (data) {
console.log(data);
var parent = node;
var nodes = Enumerable.from(data)
.where(function (o) {
return !Enumerable.from(parent.children).any(function (o2) {
return o.value === o2.value;
});
}).toArray();
resolve(nodes);
});
}
function VeChange(value, id) {
app.$refs[id].value = value;
var text = value[value.length - 1];
$('#' + id).val(text);
console.log($('#' + id).val());
}
</script>
<script>
var app = new Vue({
el: '#app',
data: function () {
return {
a: 1
}
}
});
</script>