queryId.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. define(function (require) {
  2. return function (context) {
  3. var $grid, $form;
  4. //列表查询
  5. function queryGrid1() {
  6. $grid.jqGrid("clearGridData"); // 清除表格数据
  7. var obj = $form.formGet();
  8. $grid.reload({
  9. url: api('/sys/Code/query'),
  10. mtype: 'POST',
  11. queryParams: obj
  12. });
  13. }
  14. return {
  15. onRender: function () {
  16. queryGrid1();
  17. },
  18. north: {
  19. border: false,
  20. split: true,
  21. height: 90,
  22. items: [{
  23. xtype: 'toolbar',
  24. title: 'ID管理',
  25. items: [
  26. {
  27. text: '查询', iconCls: 'fa fa-search', onClick: function () {
  28. queryGrid1();
  29. }
  30. },
  31. {
  32. text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
  33. $form.formClear();
  34. queryGrid1();
  35. }
  36. },
  37. {
  38. text: '新增', iconCls: 'fa fa-plus-circle', onClick: function () {
  39. var dlg = require('/app/sys/sysCode/dialogId.js')({
  40. isEdit: false,
  41. ok: function () {
  42. $grid.reload();
  43. }
  44. });
  45. $.yvan.showDialog(this, dlg);
  46. }
  47. },
  48. {
  49. text: '编辑', iconCls: 'fa fa-pencil-square-o', onClick: function () {
  50. var row = $grid.rowData();
  51. if (!row) {
  52. $.yvan.msg('请选择一行数据');
  53. }
  54. var dlg = require('/app/sys/sysCode/dialogId.js')({
  55. isEdit: true,
  56. row: row,
  57. ok: function () {
  58. $grid.reload();
  59. }
  60. });
  61. $.yvan.showDialog(this, dlg);
  62. }
  63. },
  64. {
  65. text: '删除', iconCls: 'fa fa-trash-o fa-lg', onClick: function () {
  66. var row = $grid.rowData();
  67. if (!row) {
  68. $.yvan.msg('请先选择一行数据');
  69. return;
  70. }
  71. $.yvan.confirm('确定删除ID标识[' + row.idName + "] ?", {
  72. yes: function () {
  73. $.yvan.ajax({
  74. url: api('/sys/Code/delete'),
  75. data: {
  76. idName: row.idName
  77. },
  78. method: 'post',
  79. success: function (data) {
  80. $.yvan.msg(data.msg);
  81. $grid.reload();
  82. },
  83. error: function (data) {
  84. $.yvan.msg(data.msg);
  85. }
  86. });
  87. }
  88. });
  89. }
  90. },
  91. {
  92. text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
  93. App.closeMe();
  94. }
  95. }
  96. ]
  97. }, {
  98. xtype: 'form',
  99. onRender: function () {
  100. $form = $(this);
  101. },
  102. items: [[
  103. {name: 'idName', label: 'ID标识'},
  104. {name: 'idDesc', label: '标识说明'}
  105. ]]
  106. }]
  107. },
  108. center: {
  109. border: true,
  110. split: true,
  111. items: {
  112. xtype: 'grid',
  113. onRender: function () {
  114. $grid = $(this);
  115. },
  116. // dataProcess: function (root) {
  117. // for (var i = 0; i < root.data.length; i++) {
  118. // root.data[i].idDesc = root.data[i].idDesc + "aaa";
  119. // }
  120. // },
  121. toolbar: {
  122. xtype: 'toolbar',
  123. title: 'ID列表'
  124. },
  125. idField: 'idName',
  126. columns: [[
  127. {field: 'idName', title: 'ID标识'},
  128. {field: 'idDesc', title: '标识说明'},
  129. {field: 'idType', title: '编号生成规则'},
  130. {field: 'idExpress', title: '序号类型'}
  131. ]]
  132. }
  133. }
  134. }
  135. }
  136. });