home.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. define(function (require) {
  2. return function (context) {
  3. var $form, $form1;
  4. // 弹框的方式
  5. var widgets = {
  6. // 搜索分类检索
  7. selectTable: {
  8. url: 'app/whepi/home/selectUptown.js',
  9. bind: {
  10. uptownId: 'uptownId',
  11. uptownName: 'uptownName',
  12. },
  13. },
  14. };
  15. //检查查询
  16. function queryGrid1() {
  17. var obj = $form.formGet();
  18. if (obj.we == "") {
  19. $.yvan.msg('请选择电话号码');
  20. return false;
  21. }
  22. return true;
  23. }
  24. //检查查询
  25. function queryGrid2() {
  26. var obj = $form1.formGet();
  27. if (obj.uptownId == "") {
  28. $.yvan.msg('请选择小区');
  29. return false;
  30. }
  31. if (obj.date == "") {
  32. $.yvan.msg('请选择导出时间');
  33. return false;
  34. }
  35. return true;
  36. }
  37. return {
  38. center: {
  39. border: false,
  40. title: '数据处理',
  41. items: [
  42. {
  43. onRender: function () {
  44. $form = $(this);
  45. },
  46. xtype: 'formgroup',
  47. title: '',
  48. items: [
  49. [
  50. {
  51. xtype: 'textbox',
  52. label: '电话号码',
  53. name: 'we',
  54. prompt: '请输入要添加的电话号码',
  55. labelWidth: 'auto',
  56. id: 'we',
  57. },
  58. ]
  59. ]
  60. },
  61. {
  62. xtype: 'group',
  63. title: '具体操作',
  64. items: [
  65. [{xtype: 'offset'},
  66. {
  67. xtype: 'button', text: '升级业委会角色', class: 'button-blue', onClick: function () {
  68. if (!queryGrid1()) {
  69. return;
  70. }
  71. var a = $form.formGet()
  72. $.yvan.confirm('确定升级该号码的业委会角色?', {
  73. yes: function (index) {
  74. $.yvan.ajax({
  75. method: 'post',
  76. url: api('/epi/admin/addRole'),
  77. data: $form.formGet(),
  78. success: function (data) {
  79. $.yvan.msg('操作成功');
  80. return;
  81. }
  82. });
  83. }
  84. });
  85. }
  86. },
  87. ],
  88. ]
  89. },
  90. {
  91. onRender: function () {
  92. $form1 = $(this);
  93. },
  94. xtype: 'formgroup',
  95. title: '导出数据',
  96. items: [
  97. [
  98. {xtype: 'hidden', name: 'uptownId'},
  99. {
  100. xtype: 'searchbox',
  101. label: '小区',
  102. name: 'uptownName',
  103. prompt: "小区",
  104. width: '400px',
  105. widget: widgets.selectTable,// 弹出框方法
  106. labelWidth: '120px',
  107. onChange: function (value) {
  108. if (!isNotNullOrEmpty(value)) {
  109. $form.formSet({
  110. userId: ''
  111. })
  112. }
  113. },
  114. },
  115. {
  116. name: 'date',
  117. label: '导出时间',
  118. prompt: '导出时间',
  119. xtype: 'datebox',
  120. labelWidth: 'auto',
  121. width: 250,
  122. },
  123. ]
  124. ]
  125. },
  126. {
  127. xtype: 'group',
  128. title: '具体操作',
  129. items: [
  130. [{xtype: 'offset'},
  131. {
  132. xtype: 'button', text: '导出小区正常家庭上报', class: 'button-blue', onClick: function () {
  133. if (!queryGrid2()) {
  134. return;
  135. }
  136. var uptownId = $form1.formGet().uptownId;
  137. var date = $form1.formGet().date;
  138. window.open(api('/epi/yeweihui/exportRiBao?uptownId=' + uptownId + '&date=' + date));
  139. }
  140. },
  141. {
  142. xtype: 'button', text: '导出凌云正常家庭上报', class: 'button-blue', onClick: function () {
  143. var obj = $form1.formGet();
  144. if (obj.date == "") {
  145. $.yvan.msg('请选择导出时间');
  146. return false;
  147. }
  148. var date = $form1.formGet().date;
  149. window.open(api('/epi/lun/exportRiBao?date=' + date));
  150. }
  151. },
  152. {
  153. xtype: 'button', text: '导出小区家庭上报明细', class: 'button-blue', onClick: function () {
  154. if (!queryGrid2()) {
  155. return;
  156. }
  157. var uptownId = $form1.formGet().uptownId;
  158. var date = $form1.formGet().date;
  159. window.open(api('/epi/yeweihui/EXR?uptownId=' + uptownId + '&date=' + date));
  160. }
  161. },
  162. ],
  163. ]
  164. },
  165. ]
  166. },
  167. };
  168. };
  169. });