form.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. {% extends "base.html" %}
  2. {% block title %}
  3. {% endblock %}
  4. {% block head %}
  5. <script type="text/javascript">
  6. var submitForm = function($dialog, $grid, $pjq) {
  7. if ($('form').form('validate')) {
  8. var url;
  9. if ($(':input[name="data.id"]').val().length > 0) {
  10. url = sy.contextPath + '/base/syorganization!update.action';
  11. } else {
  12. url = sy.contextPath + '/base/syorganization!save.action';
  13. }
  14. $.post(url, sy.serializeObject($('form')), function(result) {
  15. if (result.success) {
  16. $grid.treegrid('reload');
  17. $dialog.dialog('destroy');
  18. } else {
  19. $pjq.messager.alert('提示', result.msg, 'error');
  20. }
  21. }, 'json');
  22. }
  23. };
  24. var showIcons = function() {
  25. var dialog = parent.sy.modalDialog({
  26. title : '浏览小图标',
  27. url : sy.contextPath + '/style/icons.jsp',
  28. buttons : [ {
  29. text : '确定',
  30. handler : function() {
  31. dialog.find('iframe').get(0).contentWindow.selectIcon(dialog, $('#iconCls'));
  32. }
  33. } ]
  34. });
  35. };
  36. $(function() {
  37. if ($(':input[name="data.id"]').val().length > 0) {
  38. parent.$.messager.progress({
  39. text : '数据加载中....'
  40. });
  41. $.post(sy.contextPath + '/base/syorganization!getById.action', {
  42. id : $(':input[name="data.id"]').val()
  43. }, function(result) {
  44. if (result.id != undefined) {
  45. $('form').form('load', {
  46. 'data.id' : result.id,
  47. 'data.name' : result.name,
  48. 'data.address' : result.address,
  49. 'data.syorganization.id' : result.pid,
  50. 'data.iconCls' : result.iconCls,
  51. 'data.seq' : result.seq,
  52. 'data.code' : result.code
  53. });
  54. $('#iconCls').attr('class', result.iconCls);//设置背景图标
  55. }
  56. parent.$.messager.progress('close');
  57. }, 'json');
  58. }
  59. });
  60. </script>
  61. {% endblock %}
  62. {% block body %}
  63. <form method="post" class="form">
  64. <fieldset>
  65. <legend>机构基本信息</legend>
  66. <table class="table" style="width: 100%;">
  67. <tr>
  68. <th>编号</th>
  69. <td><input name="data.id" value="{{ id }}" readonly="readonly" /></td>
  70. <th>机构名称</th>
  71. <td><input name="data.name" class="easyui-validatebox" data-options="required:true" /></td>
  72. </tr>
  73. <tr>
  74. <th>机构编码</th>
  75. <td><input name="data.code" /></td>
  76. <th>顺序</th>
  77. <td><input name="data.seq" class="easyui-numberspinner" data-options="required:true,min:0,max:100000,editable:false" style="width: 155px;" value="100" /></td>
  78. </tr>
  79. <tr>
  80. <th>上级机构</th>
  81. <td>
  82. <select id="syorganization_id" name="data.syorganization.id" class="easyui-combotree" data-options="editable:false,idField:'id',textField:'name',parentField:'pid',url:'{{ contextPath }}/base/syorganization!doNotNeedSecurity_comboTree.action'" style="width: 155px;"></select>
  83. <img class="iconImg ext-icon-cross" onclick="$('#syorganization_id').combotree('clear');" title="清空" />
  84. </td>
  85. <th>机构图标</th>
  86. <td>
  87. <input id="iconCls" name="data.iconCls" readonly="readonly" style="padding-left: 18px; width: 134px;" /><img class="iconImg ext-icon-zoom" onclick="showIcons();" title="浏览图标" />&nbsp;
  88. <img class="iconImg ext-icon-cross" onclick="$('#iconCls').val('');$('#iconCls').attr('class','');" title="清空" />
  89. </td>
  90. </tr>
  91. <tr>
  92. <th>机构地址</th>
  93. <td><input name="data.address" /></td>
  94. <th></th>
  95. <td></td>
  96. </tr>
  97. </table>
  98. </fieldset>
  99. </form>
  100. {% endblock %}