home.js 10 KB

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