纽威
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.

183 lines
7.1 KiB

3 years ago
  1. @{
  2. ViewBag.Title = "Form";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <script>
  6. var keyValue = $.request("keyValue");
  7. $(function () {
  8. initControl();
  9. if (!!keyValue) {
  10. $.ajax({
  11. url: "/SystemManage/User/GetFormJson",
  12. data: { keyValue: keyValue },
  13. dataType: "json",
  14. async: false,
  15. success: function (data) {
  16. $("#form1").formSerialize(data);
  17. $("#F_UserPassword").val("******").attr('disabled', 'disabled');
  18. }
  19. });
  20. }
  21. $("#F_RoleId").change(function () {
  22. var RoleName = $("#F_RoleId option:checked").text();
  23. if (RoleName != "供应商") {
  24. $("#th_VenCode").hide();
  25. $("#td_VenCode").hide();
  26. }
  27. else {
  28. $("#th_VenCode").show();
  29. $("#td_VenCode").show();
  30. }
  31. });
  32. var VenCode = $("#F_VenCode").val();
  33. if (VenCode != null && VenCode != "") {
  34. $("#F_VenCode").attr("disabled", "disabled");
  35. }
  36. });
  37. function initControl() {
  38. $("#F_Gender").bindSelect()
  39. $("#F_IsAdministrator").bindSelect()
  40. $("#F_EnabledMark").bindSelect()
  41. $("#F_OrganizeId").bindSelect({
  42. url: "/SystemManage/Organize/GetTreeSelectJson"
  43. });
  44. $("#F_DepartmentId").bindSelect({
  45. url: "/SystemManage/Organize/GetTreeSelectJson",
  46. });
  47. $("#F_RoleId").bindSelect({
  48. url: "/SystemManage/Role/GetGridJson",
  49. id: "F_Id",
  50. text: "F_FullName"
  51. });
  52. $("#F_DutyId").bindSelect({
  53. url: "/SystemManage/Duty/GetGridJson",
  54. id: "F_Id",
  55. text: "F_FullName"
  56. });
  57. $("#F_Location").bindSelect({
  58. url: "/SystemManage/User/GetWorkPoint",
  59. id: "WorkPointCode",
  60. text: "WorkPointName"
  61. });
  62. $.ajax({
  63. url: "/SystemManage/User/GetCurrentRole",
  64. data: { keyValue: keyValue },
  65. dataType: "json",
  66. async: false,
  67. success: function (data) {
  68. var RoleName = data.RoleName;
  69. if (RoleName != "admin") {
  70. $("#F_RoleId").attr("disabled", "disabled");
  71. $("#F_IsAdministrator").attr("disabled", "disabled");
  72. $("#F_EnabledMark").attr("disabled", "disabled");
  73. $("#F_Location").attr("disabled", "disabled");
  74. //$("#th_VenCode").hide();
  75. //$("#td_VenCode").hide();
  76. }
  77. }
  78. });
  79. }
  80. function submitForm() {
  81. if (!$('#form1').formValid()) {
  82. return false;
  83. }
  84. var RoleName = $("#F_RoleId option:checked").text();
  85. if (RoleName == "供应商") {
  86. var VenCode = $("#F_VenCode").val();
  87. if (VenCode == '') {
  88. $.modalAlert("请输入供应商编码!");
  89. return false;
  90. }
  91. }
  92. $.submitForm({
  93. url: "/SystemManage/User/SubmitForm?keyValue=" + keyValue,
  94. param: $("#form1").formSerialize(),
  95. success: function () {
  96. $.currentWindow().$("#gridList").trigger("reloadGrid");
  97. }
  98. })
  99. }
  100. </script>
  101. <form id="form1">
  102. <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
  103. <ul class="nav nav-tabs">
  104. <li class="active"><a href="#">基本信息</a></li>
  105. </ul>
  106. <div style="padding-top: 20px; margin-right: 30px;">
  107. <table class="form">
  108. <tr>
  109. <th class="formTitle">账户</th>
  110. <td class="formValue">
  111. <input id="F_Account" name="F_Account" type="text" class="form-control required" placeholder="请输入账户" />
  112. </td>
  113. <th class="formTitle">密码</th>
  114. <td class="formValue">
  115. <input id="F_UserPassword" name="F_UserPassword" type="password" class="form-control required" placeholder="请输入密码" />
  116. </td>
  117. </tr>
  118. <tr>
  119. <th class="formTitle">姓名</th>
  120. <td class="formValue">
  121. <input id="F_RealName" name="F_RealName" type="text" class="form-control required" placeholder="请输入姓名" />
  122. </td>
  123. <th class="formTitle">角色</th>
  124. <td class="formValue">
  125. <select id="F_RoleId" name="F_RoleId" class="form-control required">
  126. <option value="">==请选择==</option>
  127. </select>
  128. </td>
  129. </tr>
  130. <tr>
  131. <th class="formTitle">手机</th>
  132. <td class="formValue">
  133. <input id="F_MobilePhone" name="F_MobilePhone" type="text" class="form-control" />
  134. </td>
  135. <th class="formTitle">邮箱</th>
  136. <td class="formValue">
  137. <input id="F_Email" name="F_Email" type="text" class="form-control" />
  138. </td>
  139. </tr>
  140. <tr>
  141. <th class="formTitle">类型</th>
  142. <td class="formValue">
  143. <select id="F_IsAdministrator" name="F_IsAdministrator" class="form-control">
  144. <option value="false">普通用户</option>
  145. <option value="true">系统管理员</option>
  146. </select>
  147. </td>
  148. <th class="formTitle">允许登录</th>
  149. <td class="formValue">
  150. <select id="F_EnabledMark" name="F_EnabledMark" class="form-control">
  151. <option value="true">是</option>
  152. <option value="false">否</option>
  153. </select>
  154. </td>
  155. </tr>
  156. <tr>
  157. <th class="formTitle">站点</th>
  158. <td class="formValue">
  159. <select id="F_Location" name="F_Location" class="form-control required">
  160. <option value="">==请选择==</option>
  161. </select>
  162. </td>
  163. <th id="th_VenCode" class="formTitle">供应商编码</th>
  164. <td id="td_VenCode">
  165. <input id="F_VenCode" name="F_VenCode" type="text" class="form-control" />
  166. </td>
  167. </tr>
  168. <tr>
  169. <th class="formTitle" valign="top" style="padding-top: 5px;">
  170. 备注
  171. </th>
  172. <td class="formValue" colspan="3">
  173. <textarea id="F_Description" name="F_Description" class="form-control" style="height: 60px;"></textarea>
  174. </td>
  175. </tr>
  176. </table>
  177. </div>
  178. </div>
  179. </form>