form.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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/syrole!update.action';
  11. } else {
  12. url = sy.contextPath + '/base/syrole!save.action';
  13. }
  14. $.post(url, sy.serializeObject($('form')), function(result) {
  15. if (result.success) {
  16. $grid.datagrid('load');
  17. $dialog.dialog('destroy');
  18. } else {
  19. $pjq.messager.alert('提示', result.msg, 'error');
  20. }
  21. }, 'json');
  22. }
  23. };
  24. $(function() {
  25. if ($(':input[name="data.id"]').val().length > 0) {
  26. parent.$.messager.progress({
  27. text : '数据加载中....'
  28. });
  29. $.post(sy.contextPath + '/base/syrole!getById.action', {
  30. id : $(':input[name="data.id"]').val()
  31. }, function(result) {
  32. if (result.id != undefined) {
  33. $('form').form('load', {
  34. 'data.id' : result.id,
  35. 'data.name' : result.name,
  36. 'data.description' : result.description,
  37. 'data.seq' : result.seq
  38. });
  39. }
  40. parent.$.messager.progress('close');
  41. }, 'json');
  42. }
  43. });
  44. </script>
  45. {% endblock %}
  46. {% block body %}
  47. <body>
  48. <form method="post" class="form">
  49. <fieldset>
  50. <legend>角色基本信息</legend>
  51. <table class="table" style="width: 100%;">
  52. <tr>
  53. <th>编号</th>
  54. <td><input name="data.id" value="{{id}}" readonly="readonly" /></td>
  55. <th>角色名称</th>
  56. <td><input name="data.name" class="easyui-validatebox" data-options="required:true" /></td>
  57. </tr>
  58. <tr>
  59. <th>顺序</th>
  60. <td><input name="data.seq" class="easyui-numberspinner" data-options="required:true,min:0,max:100000,editable:false" style="width: 155px;" value="100" /></td>
  61. <th>角色描述</th>
  62. <td><textarea name="data.description"></textarea></td>
  63. </tr>
  64. </table>
  65. </fieldset>
  66. </form>
  67. </body>
  68. {% endblock %}