Form.cshtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. @{
  2. ViewBag.Title = "用户管理";
  3. Layout = "~/Views/Shared/_FlowForm.cshtml";
  4. }
  5. <script>
  6. var keyValue = request('keyValue');
  7. var instanceId = "";
  8. var formId = "";
  9. $(function () {
  10. initControl();
  11. })
  12. //初始化控件
  13. function initControl() {
  14. //公司
  15. $("#OrganizeId").ComboBoxTree({
  16. url: "../../BaseManage/Organize/GetTreeJson",
  17. description: "==请选择==",
  18. height: "200px",
  19. allowSearch: true,
  20. }).bind("change", function () {
  21. var value = $(this).attr('data-value');
  22. //加载部门
  23. $("#DepartmentId").ComboBoxTree({
  24. url: "../../BaseManage/Department/GetTreeJson?organizeId=" + value,
  25. description: "==请选择==",
  26. allowSearch: true
  27. });
  28. //加载角色
  29. $("#RoleId").ComboBox({
  30. url: "../../BaseManage/Role/GetListJson?organizeId=" + value,
  31. id: "RoleId",
  32. text: "FullName",
  33. description: "==请选择==",
  34. allowSearch: true
  35. });
  36. //加载岗位
  37. $("#DutyId").ComboBox({
  38. url: "../../BaseManage/Post/GetListJson?organizeId=" + value,
  39. id: "RoleId",
  40. text: "FullName",
  41. description: "==请选择==",
  42. allowSearch: true
  43. });
  44. });
  45. //部门
  46. $("#DepartmentId").ComboBoxTree({
  47. description: "==请选择==",
  48. height: "200px",
  49. allowSearch: true
  50. }).bind("change", function () {
  51. var value = $(this).attr('data-value');
  52. //加载职位
  53. $("#PostId").ComboBox({
  54. url: "../../BaseManage/Job/GetListJson?organizeId=" + value,
  55. id: "RoleId",
  56. text: "FullName",
  57. description: "==请选择==",
  58. allowSearch: true
  59. });
  60. //加载主管
  61. $("#ManagerId").ComboBox({
  62. url: "../../BaseManage/User/GetListJson?departmentId=" + value,
  63. id: "UserId",
  64. text: "RealName",
  65. title: "Account",
  66. description: "==请选择==",
  67. allowSearch: true
  68. });
  69. });
  70. //岗位
  71. $("#DutyId").ComboBox({
  72. description: "==请选择==",
  73. height: "200px",
  74. allowSearch: true
  75. });
  76. //角色
  77. $("#RoleId").ComboBox({
  78. description: "==请选择==",
  79. height: "200px",
  80. allowSearch: true
  81. });
  82. //职位
  83. $("#PostId").ComboBox({
  84. description: "==请选择==",
  85. height: "200px",
  86. allowSearch: true
  87. });
  88. //主管
  89. $("#ManagerId").ComboBox({
  90. description: "==请选择==",
  91. height: "200px",
  92. allowSearch: true
  93. });
  94. //性别
  95. $("#Gender").ComboBox({
  96. description: "==请选择==",
  97. });
  98. //加载自定义表单
  99. var moduleId = top.$.cookie('currentmoduleId');
  100. $.SetForm({
  101. url: "../../AuthorizeManage/ModuleForm/GetEntityJsonByModuleId",
  102. param: { "keyValue": moduleId, "objectId": keyValue },
  103. async: true,
  104. success: function (data) {
  105. $('#frmpreview').frmPreview({
  106. tablecotent: data.form.FormJson,
  107. width: 700
  108. });
  109. formId = data.form.FormId;
  110. if (data.instance != null) {
  111. $('#frmpreview').frmSetData(JSON.parse(data.instance.FormInstanceJson));
  112. instanceId = data.instance.FormInstanceId;
  113. }
  114. }
  115. });
  116. //获取表单
  117. if (!!keyValue) {
  118. $.SetForm({
  119. url: "../../BaseManage/User/GetFormJson",
  120. param: { keyValue: keyValue },
  121. success: function (data) {
  122. $("#form1").SetWebControls(data);
  123. $("#OrganizeId").trigger("change");
  124. $("#DepartmentId").ComboBoxTreeSetValue(data.DepartmentId).trigger("change");
  125. $("#DutyId").ComboBoxSetValue(data.DutyId)
  126. $("#RoleId").ComboBoxSetValue(data.RoleId)
  127. $("#PostId").ComboBoxSetValue(data.PostId)
  128. $("#ManagerId").ComboBoxSetValue(data.ManagerId);
  129. $("#Birthday").val(formatDate(data.Birthday, "yyyy-MM-dd"));
  130. $("#Password").val("******").attr('disabled', 'disabled');
  131. }
  132. });
  133. }
  134. }
  135. //保存表单
  136. function AcceptClick() {
  137. if (!$('#form1').Validform()) {
  138. return false;
  139. }
  140. var postData = $("#form1").GetWebControls(keyValue);
  141. postData["DutyName"] = $("#DutyId").attr('data-text');
  142. postData["PostName"] = $("#PostId").attr('data-text');
  143. postData["Manager"] = $("#ManagerId").attr('data-text');
  144. if (postData["Birthday"] == "&nbsp;") {
  145. postData["Birthday"] = "";
  146. }
  147. var _instanceData = $("#frmpreview").frmGetData();
  148. var moduleFormInstanceEntity = { "FormId": formId, "FormInstanceJson": JSON.stringify(_instanceData) };
  149. $.SaveForm({
  150. url: "../../BaseManage/User/SaveForm",
  151. param: { "keyValue": keyValue, "strUserEntity": JSON.stringify(postData), "FormInstanceId": instanceId, "strModuleFormInstanceEntity": JSON.stringify(moduleFormInstanceEntity) },
  152. loading: "正在保存数据...",
  153. success: function (data) {
  154. $.currentIframe().$("#gridTable").trigger("reloadGrid");
  155. }
  156. })
  157. }
  158. </script>
  159. <div style="margin-left: 10px; margin-right: 10px;">
  160. <ul class="nav nav-tabs">
  161. <li class="active"><a href="#BaseInfo" data-toggle="tab">基本信息</a></li>
  162. <li><a href="#ExpandInfo" data-toggle="tab">扩展属性</a></li>
  163. </ul>
  164. <div class="tab-content" style="padding-top: 15px;">
  165. <div id="BaseInfo" class="tab-pane active" style=" padding-right: 30px;">
  166. <table class="form">
  167. <tr>
  168. <td class="formTitle">账户<font face="宋体">*</font></td>
  169. <td class="formValue">
  170. <input id="Account" type="text" onblur="$.ExistField(this.id,'../../BaseManage/User/ExistAccount')" class="form-control" placeholder="请输入账户" isvalid="yes" checkexpession="NotNull" />
  171. </td>
  172. <td class="formTitle">密码<font face="宋体">*</font></td>
  173. <td class="formValue">
  174. <input id="Password" type="text" class="form-control" placeholder="请输入密码" isvalid="yes" checkexpession="NotNull" />
  175. </td>
  176. </tr>
  177. <tr>
  178. <td class="formTitle">公司<font face="宋体">*</font></td>
  179. <td class="formValue">
  180. <div id="OrganizeId" type="selectTree" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
  181. </td>
  182. <td class="formTitle">部门<font face="宋体">*</font></td>
  183. <td class="formValue">
  184. <div id="DepartmentId" type="selectTree" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
  185. </td>
  186. </tr>
  187. <tr>
  188. <td class="formTitle">岗位</td>
  189. <td class="formValue">
  190. <div id="DutyId" type="select" class="ui-select"></div>
  191. </td>
  192. <td class="formTitle">职位</td>
  193. <td class="formValue">
  194. <div id="PostId" type="select" class="ui-select"></div>
  195. </td>
  196. </tr>
  197. <tr>
  198. <td class="formTitle">角色</td>
  199. <td class="formValue">
  200. <div id="RoleId" type="select" class="ui-select"></div>
  201. </td>
  202. <td class="formTitle">主管</td>
  203. <td class="formValue">
  204. <div id="ManagerId" type="select" class="ui-select"></div>
  205. </td>
  206. </tr>
  207. <tr>
  208. <td class="formTitle">工号</td>
  209. <td class="formValue">
  210. <input id="EnCode" type="text" class="form-control" /></td>
  211. <td class="formTitle">姓名<font face="宋体">*</font></td>
  212. <td class="formValue">
  213. <input id="RealName" type="text" class="form-control" placeholder="请输入姓名" isvalid="yes" checkexpession="NotNull" />
  214. </td>
  215. </tr>
  216. <tr>
  217. <td class="formTitle">性别</td>
  218. <td class="formValue">
  219. <div id="Gender" type="select" class="ui-select">
  220. <ul>
  221. <li data-value="1">男</li>
  222. <li data-value="0">女</li>
  223. </ul>
  224. </div>
  225. </td>
  226. <td class="formTitle">生日</td>
  227. <td class="formValue">
  228. <input id="Birthday" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" />
  229. </td>
  230. </tr>
  231. <tr>
  232. <td class="formTitle">手机</td>
  233. <td class="formValue">
  234. <input id="Mobile" type="text" class="form-control" /></td>
  235. <td class="formTitle">电话</td>
  236. <td class="formValue">
  237. <input id="Telephone" type="text" class="form-control" /></td>
  238. </tr>
  239. <tr>
  240. <td class="formTitle">邮箱</td>
  241. <td class="formValue">
  242. <input id="Email" type="text" class="form-control" /></td>
  243. <td class="formTitle">微信</td>
  244. <td class="formValue">
  245. <input id="WeChat" type="text" class="form-control" /></td>
  246. </tr>
  247. <tr>
  248. <td class="formTitle">QQ</td>
  249. <td class="formValue">
  250. <input id="OICQ" type="text" class="form-control" /></td>
  251. <td class="formTitle">MSN</td>
  252. <td class="formValue">
  253. <input id="" type="text" class="form-control" /></td>
  254. </tr>
  255. <tr>
  256. <th class="formTitle" valign="top" style="padding-top: 4px;">备注
  257. </th>
  258. <td class="formValue" colspan="3">
  259. <textarea id="Description" class="form-control" style="height: 50px;"></textarea>
  260. </td>
  261. </tr>
  262. </table>
  263. </div>
  264. <div id="ExpandInfo" class="tab-pane ">
  265. <div class="app_layout app_preview" style="border-top: 1px solid #ccc;" id="frmpreview"></div>
  266. </div>
  267. </div>
  268. </div>