You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Index.js 11 KiB

4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2020-02-03 14:37
  5. * 描 述:疫情记录
  6. */
  7. var refreshGirdData;
  8. var createrID = request('createrID');
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.initGird();
  14. page.bind();
  15. },
  16. bind: function () {
  17. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  18. page.search(queryJson);
  19. }, 220, 400);
  20. $('#Type').lrDataItemSelect({ code: 'EUserType' });
  21. // 刷新
  22. $('#lr_refresh').on('click', function () {
  23. location.reload();
  24. });
  25. // 新增
  26. $('#lr_add').on('click', function () {
  27. learun.layerForm({
  28. id: 'formDetail',
  29. title: '新增',
  30. url: top.$.rootUrl + '/PersonnelManagement/EpidemicSituationCopy/Form',
  31. width: 1000,
  32. height: 650,
  33. callBack: function (id) {
  34. return top[id].acceptClick(refreshGirdData);
  35. }
  36. });
  37. });
  38. // 编辑
  39. $('#lr_edit').on('click', function () {
  40. var keyValue = $('#gridtable').jfGridValue('ID');
  41. if (learun.checkrow(keyValue)) {
  42. learun.layerForm({
  43. id: 'formDetail',
  44. title: '编辑',
  45. url: top.$.rootUrl + '/PersonnelManagement/EpidemicSituationCopy/Form?keyValue=' + keyValue,
  46. width: 1000,
  47. height: 650,
  48. callBack: function (id) {
  49. return top[id].acceptClick(refreshGirdData);
  50. }
  51. });
  52. }
  53. });
  54. // 删除
  55. $('#lr_delete').on('click', function () {
  56. var keyValue = $('#gridtable').jfGridValue('ID');
  57. if (learun.checkrow(keyValue)) {
  58. learun.layerConfirm('是否确认删除该项!', function (res) {
  59. if (res) {
  60. learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/EpidemicSituation/DeleteForm', { keyValue: keyValue }, function () {
  61. refreshGirdData();
  62. });
  63. }
  64. });
  65. }
  66. });
  67. },
  68. // 初始化列表
  69. initGird: function () {
  70. $('#gridtable').lrAuthorizeJfGrid({
  71. url: top.$.rootUrl + '/PersonnelManagement/EpidemicSituation/GetPageList',
  72. headData: [
  73. {
  74. label: "填表人员", name: "Creater", width: 100, align: "left",
  75. formatterAsync: function (callback, value, row, op, $cell) {
  76. learun.clientdata.getAsync('custmerData', {
  77. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
  78. key: value,
  79. keyId: 'f_userid',
  80. callback: function (_data) {
  81. callback(_data['f_realname']);
  82. }
  83. });
  84. }
  85. },
  86. {
  87. label: "填报日期", name: "CreateTime", width: 100, align: "left",
  88. formatter: function (value, row) {
  89. return dateFormat("YYYY-mm-dd", new Date(value));
  90. }
  91. },
  92. {
  93. label: "类别", name: "Type", width: 100, align: "left",
  94. formatterAsync: function (callback, value, row, op, $cell) {
  95. learun.clientdata.getAsync('dataItem', {
  96. key: value,
  97. code: 'EUserType',
  98. callback: function (_data) {
  99. callback(_data.text);
  100. }
  101. });
  102. }
  103. },
  104. {
  105. label: "所在部门", name: "Department", width: 100, align: "left",
  106. formatterAsync: function (callback, value, row, op, $cell) {
  107. console.log(row);
  108. if (row.StudentSource) {
  109. callback(row.StudentSource);
  110. } else {
  111. learun.clientdata.getAsync('custmerData', {
  112. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
  113. key: value,
  114. keyId: 'id',
  115. callback: function (_data) {
  116. callback(_data['name']);
  117. }
  118. });
  119. }
  120. }
  121. },
  122. {
  123. label: "性别", name: "Gender", width: 100, align: "left",
  124. formatterAsync: function (callback, value, row, op, $cell) {
  125. learun.clientdata.getAsync('dataItem', {
  126. key: value,
  127. code: 'usersex',
  128. callback: function (_data) {
  129. callback(_data.text);
  130. }
  131. });
  132. }
  133. },
  134. { label: "家庭住址", name: "HomeAddress", width: 100, align: "left" },
  135. {
  136. label: "健康状况", name: "HealthSituation", width: 100, align: "left",
  137. //formatterAsync: function (callback, value, row, op, $cell) {
  138. // learun.clientdata.getAsync('dataItem', {
  139. // key: value,
  140. // code: 'EpiHealth',
  141. // callback: function (_data) {
  142. // callback(_data.text);
  143. // }
  144. // });
  145. //}
  146. formatter: function (cellvalue, row) {
  147. if (cellvalue == 0) {
  148. return '<span class=\"label label-success\">健康</span>';
  149. } else if (cellvalue == 1) {
  150. return '<span class=\"label label-danger\">异常</span>';
  151. }
  152. }
  153. },
  154. {
  155. label: "是否外出", name: "IsOut", width: 100, align: "left",
  156. //formatterAsync: function (callback, value, row, op, $cell) {
  157. // learun.clientdata.getAsync('dataItem', {
  158. // key: value,
  159. // code: 'YesOrNoInt',
  160. // callback: function (_data) {
  161. // callback(_data.text);
  162. // }
  163. // });
  164. //}
  165. formatter: function (cellvalue, row) {
  166. if (cellvalue === 0) {
  167. return '<span class=\"label label-success\">否</span>';
  168. } else if (cellvalue === 1) {
  169. return '<span class=\"label label-danger\">是</span>';
  170. }
  171. }
  172. },
  173. {
  174. label: "家人异常", name: "HasFamily", width: 100, align: "left",
  175. formatter: function (cellvalue, row) {
  176. if (cellvalue === 0) {
  177. return '<span class=\"label label-success\">否</span>';
  178. } else if (cellvalue === 1) {
  179. return '<span class=\"label label-danger\">是</span>';
  180. }
  181. }
  182. },
  183. {
  184. label: "疫区人异常", name: "HasPeople", width: 100, align: "left",
  185. formatter: function (cellvalue, row) {
  186. if (cellvalue === 0) {
  187. return '<span class=\"label label-success\">否</span>';
  188. } else if (cellvalue === 1) {
  189. return '<span class=\"label label-danger\">是</span>';
  190. }
  191. }
  192. },
  193. { label: "联系方式", name: "Mobile", width: 100, align: "left" },
  194. { label: "当前地址", name: "Objective", width: 100, align: "left" },
  195. ],
  196. mainId: 'ID',
  197. isPage: true
  198. });
  199. page.search();
  200. },
  201. search: function (param) {
  202. param = param || {};
  203. var loginInfo = top.learun.clientdata.get(['userinfo']);
  204. console.log('人员id' + createrID);
  205. if (createrID) {
  206. param.Creater = createrID;
  207. } else {
  208. param.Creater = loginInfo.userId;
  209. }
  210. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  211. }
  212. };
  213. refreshGirdData = function () {
  214. page.search();
  215. };
  216. page.init();
  217. }
  218. function dateFormat(fmt, date) {
  219. let ret;
  220. const opt = {
  221. "Y+": date.getFullYear().toString(), // 年
  222. "m+": (date.getMonth() + 1).toString(), // 月
  223. "d+": date.getDate().toString(), // 日
  224. "H+": date.getHours().toString(), // 时
  225. "M+": date.getMinutes().toString(), // 分
  226. "S+": date.getSeconds().toString() // 秒
  227. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  228. };
  229. for (let k in opt) {
  230. ret = new RegExp("(" + k + ")").exec(fmt);
  231. if (ret) {
  232. fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
  233. };
  234. };
  235. return fmt;
  236. }