home.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. define(function (require) {
  2. return function (context) {
  3. var $form, $form1, $form2;
  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. selectTableUnit: {
  16. url: 'app/whepi/home/selectLYbumen.js',
  17. bind: {
  18. unitId: 'unitId',
  19. unit: 'unit',
  20. },
  21. },
  22. };
  23. //检查查询
  24. function queryGrid1() {
  25. var obj = $form.formGet();
  26. if (obj.we == "") {
  27. $.yvan.msg('请选择电话号码');
  28. return false;
  29. }
  30. return true;
  31. }
  32. //检查查询
  33. function queryGrid2() {
  34. var obj = $form1.formGet();
  35. if (obj.uptownId == "") {
  36. $.yvan.msg('请选择小区');
  37. return false;
  38. }
  39. if (obj.date == "") {
  40. $.yvan.msg('请选择导出时间');
  41. return false;
  42. }
  43. return true;
  44. }
  45. //检查查询
  46. function queryGrid3() {
  47. var obj = $form2.formGet();
  48. if (obj.date1 == "") {
  49. $.yvan.msg('请选择导出时间');
  50. return false;
  51. }
  52. return true;
  53. }
  54. return {
  55. center: {
  56. border: false,
  57. title: '数据处理',
  58. items: [
  59. {
  60. onRender: function () {
  61. $form = $(this);
  62. },
  63. xtype: 'formgroup',
  64. title: '',
  65. items: [
  66. [
  67. {
  68. xtype: 'textbox',
  69. label: '电话号码',
  70. name: 'we',
  71. prompt: '请输入要添加的电话号码',
  72. labelWidth: 'auto',
  73. id: 'we',
  74. },
  75. ]
  76. ]
  77. },
  78. {
  79. xtype: 'group',
  80. title: '具体操作',
  81. items: [
  82. [{xtype: 'offset'},
  83. {
  84. xtype: 'button', text: '升级业委会角色', class: 'button-blue', onClick: function () {
  85. if (!queryGrid1()) {
  86. return;
  87. }
  88. var a = $form.formGet()
  89. $.yvan.confirm('确定升级该号码的业委会角色?', {
  90. yes: function (index) {
  91. $.yvan.ajax({
  92. method: 'post',
  93. url: api('/epi/admin/addRole'),
  94. data: $form.formGet(),
  95. success: function (data) {
  96. $.yvan.msg('操作成功');
  97. return;
  98. }
  99. });
  100. }
  101. });
  102. }
  103. },
  104. ],
  105. ]
  106. },
  107. {
  108. onRender: function () {
  109. $form1 = $(this);
  110. },
  111. xtype: 'formgroup',
  112. title: '导出数据',
  113. items: [
  114. [
  115. {xtype: 'hidden', name: 'uptownId'},
  116. {
  117. xtype: 'searchbox',
  118. label: '小区',
  119. name: 'uptownName',
  120. prompt: "小区",
  121. width: '400px',
  122. widget: widgets.selectTable,// 弹出框方法
  123. labelWidth: '120px',
  124. onChange: function (value) {
  125. if (!isNotNullOrEmpty(value)) {
  126. $form1.formSet({
  127. uptownId: ''
  128. })
  129. }
  130. },
  131. },
  132. {
  133. name: 'date',
  134. label: '导出时间',
  135. prompt: '导出时间',
  136. xtype: 'datebox',
  137. labelWidth: 'auto',
  138. width: 250,
  139. },
  140. ]
  141. ]
  142. },
  143. {
  144. xtype: 'group',
  145. title: '具体操作',
  146. items: [
  147. [{xtype: 'offset'},
  148. {
  149. xtype: 'button', text: '导出小区正常家庭上报', class: 'button-blue', onClick: function () {
  150. if (!queryGrid2()) {
  151. return;
  152. }
  153. var uptownId = $form1.formGet().uptownId;
  154. var date = $form1.formGet().date;
  155. window.open(api('/yeweihui/exportRiBao?uptownId=' + uptownId + '&date=' + date));
  156. }
  157. },
  158. {
  159. xtype: 'button', text: '导出小区家庭上报明细', class: 'button-blue', onClick: function () {
  160. if (!queryGrid2()) {
  161. return;
  162. }
  163. var uptownId = $form1.formGet().uptownId;
  164. var date = $form1.formGet().date;
  165. window.open(api('/yeweihui/EXR?uptownId=' + uptownId + '&date=' + date));
  166. }
  167. },
  168. ],
  169. ]
  170. },
  171. {
  172. onRender: function () {
  173. $form2 = $(this);
  174. },
  175. xtype: 'formgroup',
  176. title: '导出数据',
  177. items: [
  178. [
  179. {xtype: 'hidden', name: 'unitId'},
  180. {
  181. xtype: 'searchbox',
  182. label: '部门',
  183. name: 'unit',
  184. prompt: "部门",
  185. width: '400px',
  186. widget: widgets.selectTableUnit,// 弹出框方法
  187. labelWidth: '120px',
  188. onChange: function (value) {
  189. if (!isNotNullOrEmpty(value)) {
  190. $form2.formSet({
  191. unitId: ''
  192. })
  193. }
  194. },
  195. },
  196. {
  197. name: 'date1',
  198. label: '导出时间',
  199. prompt: '导出时间',
  200. xtype: 'datebox',
  201. labelWidth: 'auto',
  202. width: 250,
  203. },
  204. ]
  205. ]
  206. },
  207. {
  208. xtype: 'group',
  209. title: '具体操作',
  210. items: [
  211. [{xtype: 'offset'},
  212. {
  213. xtype: 'button', text: '导出凌云正常家庭上报', class: 'button-blue', onClick: function () {
  214. if (!queryGrid3()) {
  215. return;
  216. }
  217. var date = $form2.formGet().date1;
  218. var unitId = $form2.formGet().unitId;
  219. window.open(api('/lun/exportRiBao?date=' + date + "&unitId=" + unitId));
  220. }
  221. },
  222. ],
  223. ]
  224. },
  225. ]
  226. },
  227. };
  228. };
  229. });