queryId.js 4.0 KB

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