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.

Form.js 7.9 KiB

4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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 acceptClick;
  8. var keyValue = request('keyValue');
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. $('.lr-form-wrap').lrscroll();
  14. page.bind();
  15. page.initData();
  16. },
  17. bind: function () {
  18. $('#Department').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name' });
  19. $('#UnitName').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
  20. $('#Type').lrDataItemSelect({ code: 'EUserType' });
  21. $('#RelationShip').lrDataItemSelect({ code: 'ERelationship' });
  22. $('#OutReason').lrDataItemSelect({ code: 'OutReason' });
  23. $('#Gender').lrDataItemSelect({ code: 'usersex' });
  24. $('#Provice').lrDataSourceSelect({
  25. code: 'DIC_PROVINCE', value: 'pcode', text: 'pname',
  26. select: function (item) {
  27. if (!!item) {
  28. $('#OutArea').lrselectRefresh({
  29. url: "/DIC_CITY/GetListByProvinceCode",
  30. param: { ProvinceCode: item.pcode },
  31. value: 'CCODE',
  32. text: 'CNAME'
  33. });
  34. $('#City').lrselectRefresh({
  35. url: "",
  36. data: []
  37. });
  38. }
  39. }
  40. });
  41. $('#OutArea').lrselect({
  42. select: function (item) {
  43. if (!!item) {
  44. $('#City').lrselectRefresh({
  45. url: top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode",
  46. param: { cityCode: item.CCODE },
  47. value: 'ACODE',
  48. text: 'ANAME'
  49. });
  50. }
  51. }
  52. });
  53. $('#City').lrselect();
  54. $('#Vehicle').lrDataItemSelect({ code: 'Vehicle' });
  55. $('#ContactsDetails').jfGrid({
  56. headData: [
  57. {
  58. label: '名字', name: 'Name', width: 100, align: 'left',
  59. edit: { type: 'input' }
  60. },
  61. {
  62. label: '性别', name: 'Gender', width: 100, align: 'left'
  63. , edit: {
  64. type: 'select',
  65. init: function (row, $edit) {
  66. console.log(row);
  67. console.log($edit);
  68. },
  69. datatype: 'dataItem',
  70. code: 'usersex'
  71. }
  72. },
  73. // {
  74. // label: '区域', name: 'Area', width: 100, align: 'left'
  75. // , edit: {
  76. // type: 'select',
  77. // init: function (row, $edit) {
  78. // var province = '110000';
  79. // learun.httpAsync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) {
  80. // var res = [];
  81. // $.each(data, function (_index, _item) {
  82. // res.push({ value: _item.CCODE, text: _item.CNAME });
  83. // });
  84. // $edit.lrselectRefresh({
  85. // data: res,
  86. // });
  87. // });
  88. // },
  89. // datatype: 'dataItem',
  90. // code: 'usersex'
  91. // }
  92. //},
  93. {
  94. label: '联系方式', name: 'Mobile', width: 100, align: 'left', edit: { type: 'input' }
  95. },
  96. {
  97. label: '身份证号', name: 'IDCard', width: 100, align: 'left', edit: { type: 'input' }
  98. },
  99. {
  100. label: '隔离方式', name: 'QTType', width: 100, align: 'left'
  101. , edit: {
  102. type: 'select',
  103. init: function (data, $edit) {
  104. },
  105. datatype: 'dataItem',
  106. code: 'QuarantineType'
  107. }
  108. },
  109. {
  110. label: '隔离地点', name: 'QTAddress', width: 100, align: 'left', edit: { type: 'input' }
  111. },
  112. {
  113. label: '隔离时间', name: 'QTTime', width: 100, align: 'left'
  114. , edit: {
  115. type: 'datatime',
  116. dateformat: '1'
  117. }
  118. },
  119. {
  120. label: '接触隔离时间', name: 'QTContactTime', width: 100, align: 'left'
  121. , edit: {
  122. type: 'datatime',
  123. dateformat: '1'
  124. }
  125. },
  126. {
  127. label: '是否发热', name: 'Fever', width: 100, align: 'left'
  128. , edit: {
  129. type: 'select',
  130. init: function (data, $edit) {
  131. },
  132. datatype: 'dataItem',
  133. code: 'YesOrNoInt'
  134. }
  135. },
  136. ],
  137. isMultiselect: true,
  138. isEdit: true,
  139. height: 200
  140. });
  141. //添加当前登录人员
  142. if ($("#Creater").val() == '') {
  143. var loginInfo = top.learun.clientdata.get(['userinfo']);
  144. console.log(loginInfo);
  145. $("#Creater").val(loginInfo.realName);
  146. var time = new Date();
  147. var _dateFmt = $("#CreateTime").attr('data-dateFmt') || 'yyyy-MM-dd';
  148. $("#CreateTime").val(learun.formatDate(time.toLocaleDateString(), _dateFmt));
  149. $('#Department').lrselectSet(loginInfo.departmentId);
  150. $('#UnitName').lrselectSet(loginInfo.companyId);
  151. }
  152. },
  153. initData: function () {
  154. if (!!keyValue) {
  155. $.lrSetForm(top.$.rootUrl + '/PersonnelManagement/EpidemicSituation/GetFormData?keyValue=' + keyValue, function (data) {
  156. for (var id in data) {
  157. if (!!data[id].length && data[id].length > 0) {
  158. $('#' + id).jfGridSet('refreshdata', data[id]);
  159. }
  160. else {
  161. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  162. }
  163. }
  164. });
  165. }
  166. }
  167. };
  168. // 保存数据
  169. acceptClick = function (callBack) {
  170. if (!$('body').lrValidform()) {
  171. return false;
  172. }
  173. var postData = {};
  174. postData.strEntity = JSON.stringify($('[data-table="EpidemicSituation"]').lrGetFormData());
  175. postData.strcontactsDetailsList = JSON.stringify($('#ContactsDetails').jfGridGet('rowdatas'));
  176. $.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/EpidemicSituation/SaveForm?keyValue=' + keyValue, postData, function (res) {
  177. // 保存成功后才回调
  178. if (!!callBack) {
  179. callBack();
  180. }
  181. });
  182. };
  183. page.init();
  184. }