import.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. define(function (require) {
  2. return function (context) {
  3. var $dlg, $grid1, $form;
  4. // 输入搜索文本后点击回车按钮查询列表
  5. function enterQueryGrid1(e) {
  6. if (e.keyCode === 13) {
  7. var tmp = $(this).val();
  8. $form.formSet({queryProperties: tmp});
  9. queryGrid1();
  10. }
  11. }
  12. function queryGrid() {
  13. $grid1.jqGrid("clearGridData");
  14. var queryForm = $form.formGet();
  15. queryForm.jmId = context.jmId,
  16. $grid1.reload({
  17. mtype: 'POST',
  18. url: api('/zhihuibu/tgDetail'),
  19. queryParams: queryForm
  20. }, true);
  21. }
  22. var queryToolbar = {
  23. xtype: 'toolbar',
  24. title: '需求统计',
  25. items: [
  26. {
  27. text: '查询', iconCls: 'fa fa-search', onClick: function () {
  28. queryGrid();
  29. }
  30. }, {
  31. text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
  32. $form.formClear();
  33. queryGrid();
  34. }
  35. }, {
  36. text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
  37. $dlg.window('close');
  38. }
  39. }
  40. ]
  41. };
  42. // 搜索条件
  43. var queryForm = {
  44. onRender: function () {
  45. $form = $(this);
  46. },
  47. xtype: 'form',
  48. items: [[
  49. {
  50. xtype: 'textbox',
  51. label: '检索条件',
  52. name: 'queryProperties',
  53. prompt: '小区',
  54. labelWidth: 'auto',
  55. events: {keydown: enterQueryGrid1}, width: 350
  56. },
  57. ]]
  58. };
  59. // 列表2增删改查按钮
  60. var gridToolbar2 = {
  61. xtype: 'toolbar',
  62. title: '需求列表',
  63. items: [
  64. {
  65. text: '导出excel', iconCls: 'fa fa-external-link-square', onClick: function () {
  66. var queryForm = $form.formGet();
  67. $.yvan.download({
  68. method: 'GET',
  69. url: api('/tuangou/member/list/exportList?jmId=' + context.jmId + "&queryProperties=" + queryForm.queryProperties),
  70. fileName: '资源需求物资-' + $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss') + '.xlsx'
  71. });
  72. }
  73. },
  74. ]
  75. };
  76. return {
  77. xtype: 'dialog',
  78. dialogId: 'dialogimport',
  79. title: '',
  80. width: '100%',
  81. height: '100%',
  82. onOpen: function () {
  83. $dlg = $(this);
  84. queryGrid();
  85. },
  86. north: {
  87. height: 90,
  88. split: true,
  89. border: false,
  90. items: [
  91. queryToolbar,
  92. queryForm
  93. ]
  94. },
  95. center: {
  96. border: false,
  97. items: {
  98. onRender: function () {
  99. $grid1 = $(this);
  100. },
  101. autoSizeColumns: true,
  102. xtype: 'grid',
  103. toolbar: gridToolbar2,
  104. columns: [[
  105. {field: 'uptownName', title: '小区名称', align: 'left'},
  106. {field: 'ridgepole', title: '楼栋', align: 'left'},
  107. {field: 'unit', title: '单元', align: 'left'},
  108. {field: 'houseNumber', title: '门牌号', align: 'left'},
  109. {field: 'buyCount', title: '数量', align: 'left'},
  110. {field: 'phone', title: '联系方式', align: 'center'},
  111. {field: 'myRemark', title: '需求备注', minWidth: 100, maxWidth: 200},
  112. ]],
  113. }
  114. }
  115. };
  116. };
  117. });