|
|
@{ ViewBag.Title = "Form"; Layout = "~/Views/Shared/_Form.cshtml"; } <script> var keyValue = $.request("keyValue"); $(function () {
initControl(); if (!!keyValue) { $.ajax({ url: "/SystemManage/User/GetFormJson", data: { keyValue: keyValue }, dataType: "json", async: false, success: function (data) { $("#form1").formSerialize(data); $("#F_UserPassword").val("******").attr('disabled', 'disabled'); } }); }
$("#F_RoleId").change(function () { var RoleName = $("#F_RoleId option:checked").text(); if (RoleName != "供应商") { $("#th_VenCode").hide(); $("#td_VenCode").hide(); } else { $("#th_VenCode").show(); $("#td_VenCode").show(); } }); var VenCode = $("#F_VenCode").val(); if (VenCode != null && VenCode != "") { $("#F_VenCode").attr("disabled", "disabled"); } }); function initControl() { $("#F_Gender").bindSelect() $("#F_IsAdministrator").bindSelect() $("#F_EnabledMark").bindSelect() $("#F_OrganizeId").bindSelect({ url: "/SystemManage/Organize/GetTreeSelectJson" }); $("#F_DepartmentId").bindSelect({ url: "/SystemManage/Organize/GetTreeSelectJson", }); $("#F_RoleId").bindSelect({ url: "/SystemManage/Role/GetGridJson", id: "F_Id", text: "F_FullName" }); $("#F_DutyId").bindSelect({ url: "/SystemManage/Duty/GetGridJson", id: "F_Id", text: "F_FullName" }); $("#F_Location").bindSelect({ url: "/SystemManage/User/GetWorkPoint", id: "WorkPointCode", text: "WorkPointName" }); $.ajax({ url: "/SystemManage/User/GetCurrentRole", data: { keyValue: keyValue }, dataType: "json", async: false, success: function (data) { var RoleName = data.RoleName; if (RoleName != "admin") { $("#F_RoleId").attr("disabled", "disabled"); $("#F_IsAdministrator").attr("disabled", "disabled"); $("#F_EnabledMark").attr("disabled", "disabled"); $("#F_Location").attr("disabled", "disabled"); //$("#th_VenCode").hide(); //$("#td_VenCode").hide(); } } });
} function submitForm() { if (!$('#form1').formValid()) { return false; } var RoleName = $("#F_RoleId option:checked").text(); if (RoleName == "供应商") { var VenCode = $("#F_VenCode").val(); if (VenCode == '') { $.modalAlertNew("WMS00005"); return false; } }
$.submitForm({ url: "/SystemManage/User/SubmitForm?keyValue=" + keyValue, param: $("#form1").formSerialize(), success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) } </script> <form id="form1"> <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;"> <ul class="nav nav-tabs"> <li class="active"><a href="#">基本信息</a></li> </ul> <div style="padding-top: 20px; margin-right: 30px;"> <table class="form"> <tr> <th class="formTitle">账户</th> <td class="formValue"> <input id="F_Account" name="F_Account" type="text" class="form-control required" placeholder="请输入账户" /> </td> <th class="formTitle">密码</th> <td class="formValue"> <input id="F_UserPassword" name="F_UserPassword" type="password" class="form-control required" placeholder="请输入密码" /> </td> </tr> <tr> <th class="formTitle">姓名</th> <td class="formValue"> <input id="F_RealName" name="F_RealName" type="text" class="form-control required" placeholder="请输入姓名" /> </td> <th class="formTitle">角色</th> <td class="formValue"> <select id="F_RoleId" name="F_RoleId" class="form-control required"> <option value="">==请选择==</option> </select> </td> </tr> <tr> <th class="formTitle">手机</th> <td class="formValue"> <input id="F_MobilePhone" name="F_MobilePhone" type="text" class="form-control" /> </td> <th class="formTitle">邮箱</th> <td class="formValue"> <input id="F_Email" name="F_Email" type="text" class="form-control" /> </td> </tr> <tr> <th class="formTitle">类型</th> <td class="formValue"> <select id="F_IsAdministrator" name="F_IsAdministrator" class="form-control"> <option value="false">普通用户</option> <option value="true">系统管理员</option> </select> </td> <th class="formTitle">允许登录</th> <td class="formValue"> <select id="F_EnabledMark" name="F_EnabledMark" class="form-control"> <option value="true">是</option> <option value="false">否</option> </select> </td> </tr> <tr> <th class="formTitle">站点</th> <td class="formValue"> <select id="F_Location" name="F_Location" class="form-control required"> <option value="">==请选择==</option> </select> </td> <th class="formTitle" class="formTitle">供应商编码</th> <td class="formValue"> <input id="F_VenCode" name="F_VenCode" type="text" class="form-control" /> </td> </tr> <tr> <th class="formTitle" valign="top" style="padding-top: 5px;"> 备注 </th> <td class="formValue" colspan="3"> <textarea id="F_Description" name="F_Description" class="form-control" style="height: 60px;"></textarea> </td> </tr> </table> </div> </div> </form>
|