| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- @using VberZero
- @using VberAdmin.Web.Models.Table
- @using VberZero.Session
- @using VberAdmin.Web.Models.Input
- @using VberAdmin.Web.Models.Modals
- @{
- string activeMenu = PermissionNames.VberSystemMgFunctionMg;
- ViewBag.ActiveMenu = activeMenu;
-
- string functionType = ViewBag.FunctionType;
- var table = new VmTable(VzConsts.ApiAppUrl + "Function/GetAll", activeMenu)
- .WithTree()
- .AddItems(new List<VmTableItem>()
- {
- new VmTableItem("displayName", L("functionName")),
- new VmTableItem("functionType", L("functionType"), "TypeFormatter"),
- new VmTableItem("url", L("functionUrl")),
- new VmTableItem("icon", L("functionIcon"), "IconFormatter"),
- new VmTableItem("sort", L("functionSort")),
- //new VmTableItem("", L("Actions"), "ActionsFormatter"),
- });
- var inputs = new List<VmInputBase>()
- {
- new VmInputHidden("id"),
- new VmInputHidden("parentNo"),
- new VmInput("parentName", L("functionParent")).WithDisabled(),
- //new Input("functionNo", L("functionNo")),
- new VmInput("displayName", L("functionName")).WithRequired(),
- new VmInputNumber("sort", L("functionSort")).WithRange(0,1000),
- new VmInput("icon", L("functionIcon")),
- };
- if (AbpSession.GetUserName() == VberZero.BaseSystem.Users.User.AdminUserName)
- {
- inputs.AddRange(new List<VmInputBase>
- {
- new VmInput("functionType", L("functionType")).WithSelect(ViewBag.FunctionType),
- new VmInput("url", L("functionUrl")),
- new VmInput("class", L("functionClass")),
- new VmInput("script", L("functionScript")),
- });
- }
- var modal = new VmModal( )
- .WithHeaderAndFooter(L("function"),"")
- .WithBody(new VmModalBody().AddInputs(inputs));
- }
- @await Html.PartialAsync("_Table",table)
- @await Html.PartialAsync("_Modal", modal)
- @section scripts
- {
- <script>
- $(function() {
- let funs= LoadTable();
- funs['btnRefresh'] = function (url) {
- console.log("Refresh");
- $.vbAjax1({ url: url });
- };
- });
- </script>
- <script>
- function IconFormatter(v) {
- if (v !== "") {
- return '<span class=" ' + v + '"></span>';
- }
- return v;
- }
-
- function TypeFormatter(v) {
- let functionTypeName = $('#hid-functionType option[value="' + v + '"]').text();
- switch (v) {
- case 9:
- return '<span class="badge badge-light-warning">' + functionTypeName + '</span>';
- case 1:
- return '<span class="badge badge-light-danger">' + functionTypeName + '</span>';
- case 2:
- return '<span class="badge badge-light-info">' + functionTypeName + '</span>';
- case 3:
- return '<span class="badge badge-light-success">' + functionTypeName + '</span>';
- default:
- return v;
- }
- }
- </script>
- }
- <section style="display:none">
- <select id="hid-functionType">
- @Html.Raw(functionType)
- </select>
- </section>
|