lingyunUser.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. define(function (require) {
  2. return function (context) {
  3. var $grid1, $form, $coma;
  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. var widgets = {
  14. // 搜索分类检索
  15. selectTableUnit: {
  16. url: 'app/whepi/home/selectLYbumen.js',
  17. bind: {
  18. unitId: 'unitId',
  19. unit: 'unit',
  20. },
  21. },
  22. };
  23. // 下拉选清空并重新赋值
  24. function reloadValuea(_datas) {
  25. if ($coma) {
  26. $coma.combobox('clear');// 清除当前的选项
  27. $coma.combobox('loadData', _datas);// 重新加载数据
  28. }
  29. }
  30. // 获取联机下拉选二级信息
  31. function getList(id) {
  32. id = id == undefined ? 0 : id
  33. var _datas = [];
  34. _datas.push({
  35. "id": "",
  36. "text": "全部",
  37. "selected": true
  38. });
  39. $.yvan.ajax({
  40. url: api('/home/getDepartmentIdLYepi.json?unitId=' + id),
  41. method: 'GET',
  42. async: true,
  43. success: function (data) {
  44. if (data.data != null && data.data != undefined) {
  45. for (var i = 0; i < data.data.length; i++) {
  46. _datas.push({
  47. "id": data.data[i].departmentId,
  48. "text": data.data[i].departmentName
  49. })
  50. }
  51. reloadValuea(_datas);
  52. }
  53. }
  54. });
  55. return _datas;
  56. }
  57. // 检索条件查询
  58. function queryGrid1() {
  59. var queryForm = $form.formGet();
  60. $grid1.reload({
  61. mtype: 'POST',
  62. url: api('/sweepCode/selectLingyunUser'),
  63. queryParams: queryForm
  64. }, true);
  65. }
  66. var queryToolbar = {
  67. xtype: 'toolbar',
  68. title: '用户管理',
  69. items: [
  70. {
  71. text: '查询', iconCls: 'fa fa-search', onClick: function () {
  72. queryGrid1();
  73. }
  74. }, {
  75. text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
  76. $form.formClear();
  77. queryGrid1();
  78. }
  79. }, {
  80. text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
  81. App.closeMe(this);
  82. }
  83. }
  84. ]
  85. };
  86. var queryForm = {
  87. onRender: function () {
  88. $form = $(this);
  89. },
  90. xtype: 'form',
  91. items: [[
  92. {
  93. xtype: 'textbox',
  94. label: '检索条件',
  95. name: 'queryProperties',
  96. prompt: "用户名称/电话号码",
  97. labelWidth: 'auto',
  98. events: {keydown: enterQueryGrid1}, width: 200
  99. },
  100. {xtype: 'hidden', name: 'unitId'},
  101. {
  102. name: 'reportStatus',
  103. xtype: 'combobox',
  104. label: '是否上报',
  105. data: [{id: '', text: '全部'}, {id: '0', text: '有数据未上报'}, {id: '1', text: '已上报'}, {id: '2', text: '无数据'}],
  106. value: '',
  107. onChange: function (value) {
  108. queryGrid1();
  109. },
  110. },
  111. {
  112. xtype: 'searchbox',
  113. label: '部门',
  114. labelWidth: 'auto',
  115. name: 'unit',
  116. prompt: "部门",
  117. width: 250,
  118. widget: widgets.selectTableUnit,// 弹出框方法
  119. onChange: function (value) {
  120. if (!isNotNullOrEmpty(value)) {
  121. $form.formSet({
  122. unitId : 0
  123. })
  124. }
  125. getList($form.formGet().unitId);
  126. queryGrid1();
  127. },
  128. },
  129. {
  130. xtype: 'combobox',
  131. label: '二级部门',
  132. name: 'departmentId',
  133. labelWidth: 'auto',
  134. width: 280,
  135. value: '',
  136. data: getList(),
  137. onRender: function () {
  138. $coma = $(this);
  139. },
  140. onValue: function (data) {
  141. },
  142. onChange: function () {
  143. queryGrid1();
  144. }
  145. },
  146. {
  147. name: 'date',
  148. label: '导出时间',
  149. prompt: '导出时间',
  150. xtype: 'datebox',
  151. labelWidth: 'auto',
  152. width: 200,
  153. },],[
  154. {
  155. name: 'msStatus',
  156. xtype: 'combobox',
  157. label: '个人上报状态',
  158. data: [{id: '', text: '全部'}, {id: '1', text: '未上报'}, {id: '2', text: '正常'}, {id: '3', text: '异常'}],
  159. value: '',
  160. onChange: function (value) {
  161. queryGrid1();
  162. },
  163. },
  164. {
  165. name: 'isContact',
  166. xtype: 'combobox',
  167. label: '家人确诊或接触',
  168. data: [{id: '', text: '全部'}, {id: '1', text: '否'}, {id: '2', text: '是'}],
  169. value: '',
  170. onChange: function (value) {
  171. queryGrid1();
  172. },
  173. },
  174. {
  175. name: 'isSuspected',
  176. xtype: 'combobox',
  177. label: '家人健康异常',
  178. data: [{id: '', text: '全部'}, {id: '1', text: '否'}, {id: '2', text: '是'}],
  179. value: '',
  180. onChange: function (value) {
  181. queryGrid1();
  182. },
  183. },
  184. {
  185. name: 'isTrip',
  186. xtype: 'combobox',
  187. label: '是否出行',
  188. data: [{id: '', text: '全部'}, {id: '1', text: '否'}, {id: '2', text: '是'}],
  189. value: '',
  190. onChange: function (value) {
  191. queryGrid1();
  192. },
  193. },
  194. ]]
  195. };
  196. return {
  197. north: {
  198. height: 132,
  199. /* split: true,
  200. border: false,*///底框是否可变动
  201. items: [
  202. queryToolbar,
  203. queryForm
  204. ]
  205. },
  206. center: {
  207. height: '60%',
  208. split: true,
  209. items:
  210. {
  211. onRender: function () {
  212. $grid1 = $(this);
  213. queryGrid1()
  214. },
  215. xtype: 'grid',
  216. toolbar: {
  217. xtype: 'toolbar',
  218. title: '用户列表',
  219. items: [
  220. {
  221. text: '生成健康及旅居申请表', iconCls: 'fa fa-cloud-upload', onClick: function () {
  222. var row = $grid1.checkedData();
  223. if (row.length == 0) {
  224. $.yvan.msg('请至少选择一行数据');
  225. return;
  226. }
  227. var ids = "";
  228. for (var i = 0; i < row.length; i++) {
  229. ids += row[i].userId + ","
  230. }
  231. ids=ids.substring(0,ids.length-1);
  232. window.open(api('/export/lyReports?userId=' + ids));
  233. }
  234. },
  235. {
  236. text: '生成隔离人员解除隔离审批表', iconCls: 'fa fa-cloud-upload', onClick: function () {
  237. var row = $grid1.checkedData();
  238. if (row.length == 0) {
  239. $.yvan.msg('请至少选择一行数据');
  240. return;
  241. }
  242. var ids = "";
  243. for (var i = 0; i < row.length; i++) {
  244. ids += row[i].userId + ","
  245. }
  246. ids=ids.substring(0,ids.length-1);
  247. window.open(api('/export/lyApproves?userId=' + ids));
  248. }
  249. },
  250. {
  251. text: '导出人员报表', iconCls: 'fa fa-cloud-upload', onClick: function () {
  252. var queryProperties = $form.formGet().queryProperties;
  253. var unitId = $form.formGet().unitId;
  254. var date = $form.formGet().date;
  255. if ( date == null || date == "") {
  256. $.yvan.msg('请选择导出时间');
  257. return
  258. }
  259. var msStatus = $form.formGet().msStatus;
  260. var isContact = $form.formGet().isContact;
  261. var isSuspected = $form.formGet().isSuspected;
  262. var isTrip = $form.formGet().isTrip;
  263. var departmentId = $form.formGet().departmentId;
  264. window.open(api('/sweepCode/exSelectLingyunUser?queryProperties='+queryProperties+"&unitId="+unitId + "&date="+date+
  265. '&msStatus='+msStatus+'&isContact='+isContact+'&isSuspected='+isSuspected+'&isTrip='+isTrip + '&departmentId=' + departmentId));
  266. }
  267. },
  268. {
  269. text: '导出正常复工人员', iconCls: 'fa fa-cloud-upload', onClick: function () {
  270. var unitId = $form.formGet().unitId;
  271. window.open(api('/returnWork/exReturnWork?unitId='+unitId));
  272. }
  273. },
  274. {
  275. text: '查看人员上报情况', iconCls: 'fa fa-search', onClick: function () {
  276. var row = $grid1.rowData();
  277. if ( row == null || row == undefined || row.userId == null || row.userId == "") {
  278. $.yvan.msg('请选择数据');
  279. return
  280. }
  281. $.yvan.showDialog(this,
  282. require('/app/whepi/lingyun/dialogDetail.js')({
  283. userId: row.userId,
  284. linkman: row.linkman,
  285. confirm: function () {
  286. // $grid2.reload();
  287. }
  288. })
  289. );
  290. }
  291. },
  292. {
  293. text: '查看人员可复工状况', iconCls: 'fa fa-search', onClick: function () {
  294. var row = $grid1.rowData();
  295. if ( row == null || row == undefined || row.userId == null || row.userId == "") {
  296. $.yvan.msg('请选择数据');
  297. return
  298. }
  299. $.yvan.showDialog(this,
  300. require('/app/whepi/lingyun/dialogFugong.js')({
  301. userId: row.userId,
  302. confirm: function () {
  303. // $grid2.reload();
  304. }
  305. })
  306. );
  307. }
  308. },
  309. ]
  310. },
  311. multiselect: true, /// 表格多选
  312. idField: 'userId',
  313. editable: true,
  314. editOnSelected: true,
  315. autoSizeColumns: true,
  316. columns:
  317. [
  318. [
  319. {field: 'userId', title: '用户ID', hidden: true},
  320. {field: 'linkman', title: '姓名', maxWidth: 200, align: 'left',},
  321. {field: 'loudong', title: '部门名称', maxWidth: 200, align: 'left',},
  322. {field: 'departmentName', title: '二级部门', maxWidth: 200, align: 'left',},
  323. {
  324. field: 'returnWork', title: '今日复工', maxWidth: 100, align: 'center', formatter: function (value) {
  325. if (value == 1) {
  326. return "<span style='color: green;'>允许复工<span>";
  327. } else if (value == 0) {
  328. return "<span style='color: red;'>禁止复工<span>";
  329. }
  330. }
  331. },
  332. {field: 'reportStatus', title: '上报', hidden: true},
  333. {
  334. field: 'msStatus', title: '个人上报状态', maxWidth: 100, align: 'center', formatter: function (value, row) {
  335. if (row.rowData.reportStatus == 0) {
  336. return "<span style='color: #ffb717;'>未上报<span>";
  337. } else if (value == 1) {
  338. return "<span style='color: green;'>正常<span>";
  339. } else {
  340. return "<span style='color: red;'>异常<span>";
  341. }
  342. }
  343. },
  344. {field: 'phone', title: '联系电话', maxWidth: 200, align: 'left',},
  345. {field: 'doorplate', title: '工号', maxWidth: 200, align: 'left',},
  346. {field: 'bingqingDesc', title: '病情表述', align: 'left',},
  347. {field: 'isContactDesc', title: '家人确诊或接触', align: 'left',formatter: function (value) {
  348. if (value == "否") {
  349. return "<span style='color: green;'>否<span>";
  350. } else {
  351. return "<span style='color: red;'>是<span>";
  352. }
  353. }
  354. },
  355. {field: 'isSuspectedDesc', title: '家人健康异常', align: 'left',formatter: function (value) {
  356. if (value == "否") {
  357. return "<span style='color: green;'>否<span>";
  358. } else {
  359. return "<span style='color: red;'>是<span>";
  360. }
  361. }
  362. },
  363. {field: 'workLoalDesc', title: '工作驻地', maxWidth: 200, align: 'left',},
  364. {field: 'todayLoalDesc', title: '今晚住地', maxWidth: 200, align: 'left',},
  365. {field: 'autoLocal', title: '定位地区', maxWidth: 200, align: 'left',},
  366. {field: 'autoAddr', title: '定位地址', maxWidth: 200, align: 'left',},
  367. {field: 'isTripDesc', title: '是否出行', maxWidth: 200, align: 'left',},
  368. {field: 'tripDetDesc', title: '出行详细', align: 'left',},
  369. ]
  370. ]
  371. }
  372. }
  373. };
  374. };
  375. }
  376. );