specialPersonnel.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. define(function (require) {
  2. return function (context) {
  3. var $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. // 检索条件查询
  13. function queryGrid1() {
  14. var queryForm = $form.formGet();
  15. $grid1.reload({
  16. mtype: 'POST',
  17. url: api('/OutUser/selectAllOutUser'),
  18. queryParams: queryForm
  19. }, true);
  20. }
  21. var queryToolbar = {
  22. xtype: 'toolbar',
  23. title: '特殊人员详情',
  24. items: [
  25. {
  26. text: '查询', iconCls: 'fa fa-search', onClick: function () {
  27. queryGrid1();
  28. }
  29. }, {
  30. text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
  31. $form.formClear();
  32. queryGrid1();
  33. }
  34. }, {
  35. text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
  36. App.closeMe(this);
  37. }
  38. }
  39. ]
  40. };
  41. var queryForm = {
  42. onRender: function () {
  43. $form = $(this);
  44. },
  45. xtype: 'form',
  46. items: [[
  47. {
  48. xtype: 'textbox',
  49. label: '检索条件',
  50. name: 'queryProperties',
  51. prompt: "小区名称/联系人姓名",
  52. labelWidth: 'auto',
  53. events: {keydown: enterQueryGrid1}, width: 350
  54. },
  55. {
  56. xtype: 'textbox',
  57. label: '电话',
  58. name: 'phone',
  59. prompt: "小区名称",
  60. labelWidth: 'auto',
  61. events: {keydown: enterQueryGrid1}, width: 350
  62. },
  63. ]]
  64. };
  65. return {
  66. north: {
  67. height: 88,
  68. /* split: true,
  69. border: false,*///底框是否可变动
  70. items: [
  71. queryToolbar,
  72. queryForm
  73. ]
  74. },
  75. center: {
  76. height: '60%',
  77. split: true,
  78. items:
  79. {
  80. onRender: function () {
  81. $grid1 = $(this);
  82. queryGrid1()
  83. },
  84. xtype: 'grid',
  85. toolbar: {
  86. xtype: 'toolbar',
  87. title: '特殊人员详情',
  88. items: [
  89. {
  90. text: '添加', iconCls: 'fa fa-plus-circle fa-lg', onClick: function () {
  91. $.yvan.showDialog(this,
  92. require('/app/whepi/scan/addOutUser.js')({
  93. isEdit: false,
  94. confirm: function () {
  95. queryGrid1();
  96. }
  97. })
  98. );
  99. }
  100. },
  101. {
  102. text: '删除', iconCls: 'fa fa fa-pencil-square-o fa-lg', onClick: function () {
  103. var row = $grid1.checkedData();
  104. if (row.length == 0) {
  105. $.yvan.msg('请至少选择一行数据');
  106. return;
  107. }
  108. var ids = "";
  109. for (var i=0; i<row.length; i++) {
  110. ids += row[i].tuId + ","
  111. }
  112. $.yvan.ajax({
  113. url: api('/OutUser/deleteOutUser'),
  114. data: {ids: ids},
  115. method: 'post',
  116. async: false,
  117. success: function (data) {
  118. queryGrid1();
  119. }
  120. });
  121. }
  122. }
  123. ]
  124. },
  125. multiselect: true, /// 表格多选
  126. idField: 'tuId',
  127. editable: true,
  128. editOnSelected: true,
  129. autoSizeColumns: true,
  130. columns:
  131. [
  132. [
  133. {field: 'tuId', title: '用户ID', hidden: true},
  134. {field: 'userId', title: '用户ID', hidden: true},
  135. {field: 'uptownName', title: '小区', maxWidth: 200, align: 'left',},
  136. {field: 'ridgepole', title: '栋', maxWidth: 200, align: 'left',},
  137. {field: 'unit', title: '单元', maxWidth: 200, align: 'left',},
  138. {field: 'name', title: '名字', maxWidth: 200, align: 'left',},
  139. {field: 'phone', title: '电话', maxWidth: 200, align: 'left',},
  140. {
  141. field: 'startDateStr', title: '开始时间', minWidth: 120, maxWidth: 300, align: 'left', editor: {
  142. xtype: 'datebox',
  143. required: true,
  144. onChange: function (value) {
  145. console.log(value)
  146. },
  147. maxlength: 50
  148. }
  149. },
  150. {
  151. field: 'endDateStr', title: '结束时间', minWidth: 120, maxWidth: 200, align: 'left', editor: {
  152. xtype: 'datebox',
  153. required: true,
  154. onChange: function (value) {
  155. console.log(value)
  156. },
  157. maxlength: 50
  158. }
  159. },
  160. ]
  161. ]
  162. }
  163. }
  164. };
  165. };
  166. }
  167. );