lingyunUserOnJob.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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. xtype: 'searchbox',
  103. label: '部门',
  104. labelWidth: 'auto',
  105. name: 'unit',
  106. prompt: "部门",
  107. width: 250,
  108. widget: widgets.selectTableUnit,// 弹出框方法
  109. onChange: function (value) {
  110. if (!isNotNullOrEmpty(value)) {
  111. $form.formSet({
  112. unitId : 0
  113. })
  114. }
  115. getList($form.formGet().unitId);
  116. queryGrid1();
  117. },
  118. },
  119. {
  120. xtype: 'combobox',
  121. label: '二级部门',
  122. name: 'departmentId',
  123. labelWidth: 'auto',
  124. width: 280,
  125. value: '',
  126. data: getList(),
  127. onRender: function () {
  128. $coma = $(this);
  129. },
  130. onValue: function (data) {
  131. },
  132. onChange: function () {
  133. queryGrid1();
  134. }
  135. },
  136. {
  137. name: 'isBand',
  138. xtype: 'combobox',
  139. label: '是否绑定',
  140. data: [{id: '', text: '全部'}, {id: '1', text: '否'}, {id: '2', text: '是'}],
  141. value: '',
  142. onChange: function (value) {
  143. queryGrid1();
  144. },
  145. },
  146. ]]
  147. };
  148. return {
  149. north: {
  150. height: 88,
  151. /* split: true,
  152. border: false,*///底框是否可变动
  153. items: [
  154. queryToolbar,
  155. queryForm
  156. ]
  157. },
  158. center: {
  159. height: '60%',
  160. split: true,
  161. items:
  162. {
  163. onRender: function () {
  164. $grid1 = $(this);
  165. queryGrid1()
  166. },
  167. xtype: 'grid',
  168. toolbar: {
  169. xtype: 'toolbar',
  170. title: '用户列表',
  171. items: [
  172. {
  173. text: '离职', iconCls: 'fa fa fa-pencil-square-o fa-lg', onClick: function () {
  174. var row = $grid1.checkedData();
  175. if (row.length == 0) {
  176. $.yvan.msg('请至少选择一行数据');
  177. return;
  178. }
  179. var ids = "";
  180. for (var i=0; i<row.length; i++) {
  181. ids += row[i].houseId + ","
  182. }
  183. $.yvan.confirm('确定勾选的这' + row.length + '条人员做离职处理吗?', {
  184. yes: function (index) {
  185. $.yvan.ajax({
  186. method: 'post',
  187. url: api('/user/resignUser'),
  188. data: {ids: ids},
  189. success: function (data) {
  190. $.yvan.msg("操作成功");
  191. $grid1.reload();
  192. queryGrid1();
  193. }
  194. });
  195. }
  196. });
  197. }
  198. },
  199. {
  200. text: '工号变更', iconCls: 'fa fa fa-pencil-square-o fa-lg', onClick: function () {
  201. var row = $grid1.rowData();
  202. if ( row == null || row == undefined || row.userId == null || row.userId == "") {
  203. $.yvan.msg('请选择数据');
  204. return
  205. }
  206. $.yvan.showDialog(this,
  207. require('/app/whepi/lingyun/editUser.js')({
  208. isEdit: false,
  209. houseId: row.houseId,
  210. linkman: row.linkman,
  211. doorplate: row.doorplate,
  212. confirm: function () {
  213. queryGrid1();
  214. }
  215. })
  216. );
  217. }
  218. },
  219. {
  220. text: '部门变更', iconCls: 'fa fa fa-pencil-square-o fa-lg', onClick: function () {
  221. var row = $grid1.checkedData();
  222. if (row.length == 0) {
  223. $.yvan.msg('请至少选择一行数据');
  224. return;
  225. }
  226. var ids = "";
  227. for (var i=0; i<row.length; i++) {
  228. ids += row[i].houseId + ","
  229. }
  230. $.yvan.showDialog(this,
  231. require('/app/whepi/lingyun/addUser.js')({
  232. isEdit: true,
  233. ids: ids,
  234. confirm: function () {
  235. queryGrid1();
  236. }
  237. })
  238. );
  239. }
  240. },
  241. ]
  242. },
  243. multiselect: true, /// 表格多选
  244. idField: 'userId',
  245. editable: true,
  246. editOnSelected: true,
  247. autoSizeColumns: true,
  248. columns:
  249. [
  250. [
  251. {field: 'userId', title: '用户ID', hidden: true},
  252. {field: 'houseId', title: 'houseId', hidden: true},
  253. {field: 'linkman', title: '姓名', maxWidth: 200, align: 'left',},
  254. {field: 'loudong', title: '部门名称', maxWidth: 200, align: 'left',},
  255. {field: 'departmentName', title: '二级部门', maxWidth: 200, align: 'left',},
  256. {
  257. field: 'returnWork', title: '今日复工', maxWidth: 100, align: 'center', formatter: function (value) {
  258. if (value == 1) {
  259. return "<span style='color: green;'>允许复工<span>";
  260. } else if (value == 0) {
  261. return "<span style='color: red;'>禁止复工<span>";
  262. }
  263. }
  264. },
  265. {field: 'reportStatus', title: '上报', hidden: true},
  266. {
  267. field: 'msStatus', title: '个人上报状态', maxWidth: 100, align: 'center', formatter: function (value, row) {
  268. if (row.rowData.reportStatus == 0) {
  269. return "<span style='color: #ffb717;'>未上报<span>";
  270. } else if (value == 1) {
  271. return "<span style='color: green;'>正常<span>";
  272. } else {
  273. return "<span style='color: red;'>异常<span>";
  274. }
  275. }
  276. },
  277. {field: 'phone', title: '联系电话', maxWidth: 200, align: 'left',},
  278. {field: 'doorplate', title: '工号', maxWidth: 200, align: 'left',},
  279. {field: 'oldOpenId', title: '旧openId', hidden: true},
  280. {field: 'isBand', title: '是否绑定', maxWidth: 200, align: 'center', formatter: function (value, row) {
  281. if (row.rowData.oldOpenId) {
  282. return "<span style='color: green;'>是<span>";
  283. } else {
  284. return "<span style='color: red;'>否<span>";
  285. }
  286. }
  287. },
  288. {field: 'bingqingDesc', title: '病情表述', align: 'left',},
  289. {field: 'isContactDesc', title: '家人确诊或接触', align: 'left',formatter: function (value) {
  290. if (value == "否") {
  291. return "<span style='color: green;'>否<span>";
  292. } else {
  293. return "<span style='color: red;'>是<span>";
  294. }
  295. }
  296. },
  297. {field: 'isSuspectedDesc', title: '家人健康异常', align: 'left',formatter: function (value) {
  298. if (value == "否") {
  299. return "<span style='color: green;'>否<span>";
  300. } else {
  301. return "<span style='color: red;'>是<span>";
  302. }
  303. }
  304. },
  305. {field: 'workLoalDesc', title: '工作驻地', maxWidth: 200, align: 'left',},
  306. {field: 'todayLoalDesc', title: '今晚住地', maxWidth: 200, align: 'left',},
  307. {field: 'autoLocal', title: '定位地区', maxWidth: 200, align: 'left',},
  308. {field: 'autoAddr', title: '定位地址', maxWidth: 200, align: 'left',},
  309. {field: 'isTripDesc', title: '是否出行', maxWidth: 200, align: 'left',},
  310. {field: 'tripDetDesc', title: '出行详细', align: 'left',},
  311. ]
  312. ]
  313. }
  314. }
  315. };
  316. };
  317. }
  318. );