form.html 3.9 KB

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