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.

FormView.js 25 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  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. $('#Creater').lrDataSourceSelect({ code: 'BaseUser', value: 'f_userid', text: 'f_realname' });
  19. $('#Department').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name' });
  20. $('#UnitName').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
  21. $('#Type').lrDataItemSelect({
  22. code: 'EUserType', select: function (item) {
  23. if (item) {
  24. if (item.id == "5") {
  25. $("#Departmentdiv").hide();
  26. $("#StudentSourcediv").show();
  27. } else {
  28. $("#StudentSourcediv").hide();
  29. $("#Departmentdiv").show();
  30. }
  31. } else {
  32. $("#PeopleDetails").parent().hide();
  33. }
  34. }
  35. });
  36. $('#RelationShip').lrDataItemSelect({ code: 'ERelationship' });
  37. $('#OutReason').lrDataItemSelect({ code: 'OutReason' });
  38. $('#HealthSituation').lrDataItemSelect({ code: 'EpiHealth' });
  39. $('#IsOut').lrDataItemSelect({
  40. code: 'YesOrNoInt',
  41. select: function (item) {
  42. if (item) {
  43. if (item.text == "是") {
  44. $("#PassPlaces").parent().show();
  45. } else {
  46. $("#PassPlaces").parent().hide();
  47. }
  48. } else {
  49. $("#PassPlaces").parent().hide();
  50. }
  51. }
  52. });
  53. $('#HasFamily').lrDataItemSelect({
  54. code: 'YesOrNoInt',
  55. select: function (item) {
  56. if (item) {
  57. if (item.text == "是") {
  58. $("#ContactsDetails").parent().show();
  59. } else {
  60. $("#ContactsDetails").parent().hide();
  61. }
  62. } else {
  63. $("#ContactsDetails").parent().hide();
  64. }
  65. }
  66. });
  67. $('#HasPeople').lrDataItemSelect({
  68. code: 'YesOrNoInt',
  69. select: function (item) {
  70. if (item) {
  71. if (item.text == "是") {
  72. $("#PeopleDetails").parent().show();
  73. } else {
  74. $("#PeopleDetails").parent().hide();
  75. }
  76. } else {
  77. $("#PeopleDetails").parent().hide();
  78. }
  79. }
  80. });
  81. $('#Gender').lrDataItemSelect({ code: 'usersex' });
  82. $('#Provice').lrDataSourceSelect({
  83. code: 'DIC_PROVINCE', value: 'pcode', text: 'pname',
  84. select: function (item) {
  85. if (!!item) {
  86. $('#OutArea').lrselectRefresh({
  87. url: "/DIC_CITY/GetListByProvinceCode",
  88. param: { ProvinceCode: item.pcode },
  89. value: 'CCODE',
  90. text: 'CNAME'
  91. });
  92. $('#City').lrselectRefresh({
  93. url: "",
  94. data: []
  95. });
  96. }
  97. }
  98. });
  99. $('#OutArea').lrselect({
  100. select: function (item) {
  101. if (!!item) {
  102. $('#City').lrselectRefresh({
  103. url: top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode",
  104. param: { cityCode: item.CCODE },
  105. value: 'ACODE',
  106. text: 'ANAME'
  107. });
  108. }
  109. }
  110. });
  111. $('#City').lrselect();
  112. $('#Vehicle').lrDataItemSelect({ code: 'Vehicle' });
  113. $('#PassPlaces').jfGrid({
  114. headData: [
  115. {
  116. label: '类别', name: 'PassType', width: 100, align: 'left'
  117. , edit: {
  118. type: 'select',
  119. init: function (row, $edit) {
  120. },
  121. datatype: 'dataItem',
  122. code: 'EpiPassType'
  123. }
  124. },
  125. {
  126. label: '省', name: 'Province', width: 100, align: 'left'
  127. , edit: {
  128. type: 'select',
  129. init: function (row, $edit) {
  130. },
  131. datatype: 'dataSource',
  132. code: 'DIC_PROVINCE',
  133. op: {
  134. value: 'pcode',
  135. text: 'pname',
  136. title: 'pname'
  137. }
  138. }
  139. }, {
  140. label: '市', name: 'City', width: 100, align: 'left',
  141. formatter: function (value, row, op, $cell) {
  142. var province = row.Province;
  143. var res;
  144. learun.httpSync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) {
  145. $.each(data, function (_index, _item) {
  146. if (value == _item.CCODE) {
  147. res = _item.CNAME;
  148. }
  149. });
  150. });
  151. return res;
  152. },
  153. edit: {
  154. type: 'select',
  155. init: function (row, $self) {
  156. var province = row.Province;
  157. learun.httpAsync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) {
  158. var res = [];
  159. $.each(data, function (_index, _item) {
  160. res.push(_item);
  161. });
  162. $self.lrselectRefresh({
  163. data: res,
  164. });
  165. });
  166. },
  167. op: {
  168. value: 'CCODE',
  169. text: 'CNAME',
  170. title: 'CNAME',
  171. }
  172. }
  173. },
  174. {
  175. label: '区域', name: 'Area', width: 100, align: 'left',
  176. formatter: function (value, row, op, $cell) {
  177. var cityCode = row.City;
  178. var res;
  179. learun.httpSync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) {
  180. $.each(data, function (_index, _item) {
  181. if (value == _item.ACODE) {
  182. res = _item.ANAME;
  183. }
  184. });
  185. });
  186. return res;
  187. },
  188. edit: {
  189. type: 'select',
  190. init: function (row, $edit) {
  191. var cityCode = row.City;
  192. learun.httpAsync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) {
  193. var res = [];
  194. $.each(data, function (_index, _item) {
  195. res.push(_item);
  196. });
  197. $edit.lrselectRefresh({
  198. data: res,
  199. });
  200. });
  201. },
  202. op: {
  203. value: 'ACODE',
  204. text: 'ANAME',
  205. title: 'ANAME'
  206. }
  207. }
  208. },
  209. {
  210. label: '详细地址', name: 'Address', width: 100, align: 'left'
  211. , edit: {
  212. type: 'input',
  213. }
  214. },
  215. {
  216. label: '时间', name: 'Time', width: 100, align: 'left', edit: { type: 'datatime' }
  217. },
  218. {
  219. label: '交通工具', name: 'Vehicle', width: 100, align: 'left', edit: {
  220. type: 'select',
  221. init: function (row, $edit) {
  222. },
  223. datatype: 'dataItem',
  224. code: 'Vehicle'
  225. }
  226. },
  227. {
  228. label: '班次号', name: 'VehicleNo', width: 100, align: 'left'
  229. , edit: {
  230. type: 'input',
  231. }
  232. }],
  233. isMultiselect: true,
  234. isEdit: true,
  235. height: 200
  236. });
  237. $('#ContactsDetails').jfGrid({
  238. headData: [
  239. {
  240. label: '名字', name: 'Name', width: 100, align: 'left',
  241. edit: { type: 'input' }
  242. },
  243. {
  244. label: '性别', name: 'Gender', width: 100, align: 'left'
  245. , edit: {
  246. type: 'select',
  247. init: function (row, $edit) {
  248. },
  249. datatype: 'dataItem',
  250. code: 'usersex'
  251. }
  252. },
  253. {
  254. label: '联系方式', name: 'Mobile', width: 100, align: 'left', edit: { type: 'input' }
  255. },
  256. {
  257. label: '隔离方式', name: 'QTType', width: 100, align: 'left'
  258. , edit: {
  259. type: 'select',
  260. init: function (data, $edit) {
  261. },
  262. datatype: 'dataItem',
  263. code: 'QuarantineType'
  264. }
  265. },
  266. {
  267. label: '省', name: 'Province', width: 100, align: 'left'
  268. , edit: {
  269. type: 'select',
  270. init: function (row, $edit) {
  271. },
  272. datatype: 'dataSource',
  273. code: 'DIC_PROVINCE',
  274. op: {
  275. value: 'pcode',
  276. text: 'pname',
  277. title: 'pname'
  278. }
  279. }
  280. }, {
  281. label: '市', name: 'City', width: 100, align: 'left',
  282. formatter: function (value, row, op, $cell) {
  283. var province = row.Province;
  284. var res;
  285. learun.httpSync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) {
  286. $.each(data, function (_index, _item) {
  287. if (value == _item.CCODE) {
  288. res = _item.CNAME;
  289. }
  290. });
  291. });
  292. return res;
  293. },
  294. edit: {
  295. type: 'select',
  296. init: function (row, $self) {
  297. var province = row.Province;
  298. learun.httpAsync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) {
  299. var res = [];
  300. $.each(data, function (_index, _item) {
  301. res.push(_item);
  302. });
  303. $self.lrselectRefresh({
  304. data: res,
  305. });
  306. });
  307. },
  308. op: {
  309. value: 'CCODE',
  310. text: 'CNAME',
  311. title: 'CNAME',
  312. }
  313. }
  314. },
  315. {
  316. label: '区域', name: 'Area', width: 100, align: 'left',
  317. formatter: function (value, row, op, $cell) {
  318. var cityCode = row.City;
  319. var res;
  320. learun.httpSync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) {
  321. $.each(data, function (_index, _item) {
  322. if (value == _item.ACODE) {
  323. res = _item.ANAME;
  324. }
  325. });
  326. });
  327. return res;
  328. },
  329. edit: {
  330. type: 'select',
  331. init: function (row, $edit) {
  332. var cityCode = row.City;
  333. learun.httpAsync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) {
  334. var res = [];
  335. $.each(data, function (_index, _item) {
  336. res.push(_item);
  337. });
  338. $edit.lrselectRefresh({
  339. data: res,
  340. });
  341. });
  342. },
  343. op: {
  344. value: 'ACODE',
  345. text: 'ANAME',
  346. title: 'ANAME'
  347. }
  348. }
  349. },
  350. {
  351. label: '隔离地点', name: 'QTAddress', width: 100, align: 'left', edit: { type: 'input' }
  352. },
  353. {
  354. label: '隔离时间', name: 'QTTime', width: 100, align: 'left'
  355. , edit: {
  356. type: 'datatime',
  357. dateformat: '1'
  358. }
  359. },
  360. {
  361. label: '接触隔离时间', name: 'QTContactTime', width: 100, align: 'left'
  362. , edit: {
  363. type: 'datatime',
  364. dateformat: '1'
  365. }
  366. },
  367. {
  368. label: '健康状况', name: 'Fever', width: 100, align: 'left'
  369. , edit: {
  370. type: 'select',
  371. init: function (data, $edit) {
  372. },
  373. datatype: 'dataItem',
  374. code: 'EpiHealth'
  375. }
  376. },
  377. ],
  378. isMultiselect: true,
  379. isEdit: true,
  380. height: 200
  381. });
  382. $('#PeopleDetails').jfGrid({
  383. headData: [
  384. {
  385. label: '名字', name: 'Name', width: 100, align: 'left',
  386. edit: { type: 'input' }
  387. },
  388. {
  389. label: '性别', name: 'Gender', width: 100, align: 'left'
  390. , edit: {
  391. type: 'select',
  392. init: function (row, $edit) {
  393. },
  394. datatype: 'dataItem',
  395. code: 'usersex'
  396. }
  397. },
  398. {
  399. label: '联系方式', name: 'Mobile', width: 100, align: 'left', edit: { type: 'input' }
  400. },
  401. {
  402. label: '隔离方式', name: 'QTType', width: 100, align: 'left'
  403. , edit: {
  404. type: 'select',
  405. init: function (data, $edit) {
  406. },
  407. datatype: 'dataItem',
  408. code: 'QuarantineType'
  409. }
  410. },
  411. {
  412. label: '省', name: 'Province', width: 100, align: 'left'
  413. , edit: {
  414. type: 'select',
  415. init: function (row, $edit) {
  416. },
  417. datatype: 'dataSource',
  418. code: 'DIC_PROVINCE',
  419. op: {
  420. value: 'pcode',
  421. text: 'pname',
  422. title: 'pname'
  423. }
  424. }
  425. }, {
  426. label: '市', name: 'City', width: 100, align: 'left',
  427. formatter: function (value, row, op, $cell) {
  428. var province = row.Province;
  429. var res;
  430. learun.httpSync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) {
  431. $.each(data, function (_index, _item) {
  432. if (value == _item.CCODE) {
  433. res = _item.CNAME;
  434. }
  435. });
  436. });
  437. return res;
  438. },
  439. edit: {
  440. type: 'select',
  441. init: function (row, $self) {
  442. var province = row.Province;
  443. learun.httpAsync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) {
  444. var res = [];
  445. $.each(data, function (_index, _item) {
  446. res.push(_item);
  447. });
  448. $self.lrselectRefresh({
  449. data: res,
  450. });
  451. });
  452. },
  453. op: {
  454. value: 'CCODE',
  455. text: 'CNAME',
  456. title: 'CNAME',
  457. }
  458. }
  459. },
  460. {
  461. label: '区域', name: 'Area', width: 100, align: 'left',
  462. formatter: function (value, row, op, $cell) {
  463. var cityCode = row.City;
  464. var res;
  465. learun.httpSync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) {
  466. $.each(data, function (_index, _item) {
  467. if (value == _item.ACODE) {
  468. res = _item.ANAME;
  469. }
  470. });
  471. });
  472. return res;
  473. },
  474. edit: {
  475. type: 'select',
  476. init: function (row, $edit) {
  477. var cityCode = row.City;
  478. learun.httpAsync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) {
  479. var res = [];
  480. $.each(data, function (_index, _item) {
  481. res.push(_item);
  482. });
  483. $edit.lrselectRefresh({
  484. data: res,
  485. });
  486. });
  487. },
  488. op: {
  489. value: 'ACODE',
  490. text: 'ANAME',
  491. title: 'ANAME'
  492. }
  493. }
  494. },
  495. {
  496. label: '隔离地点', name: 'QTAddress', width: 100, align: 'left', edit: { type: 'input' }
  497. },
  498. {
  499. label: '隔离时间', name: 'QTTime', width: 100, align: 'left'
  500. , edit: {
  501. type: 'datatime',
  502. dateformat: '1'
  503. }
  504. },
  505. {
  506. label: '接触隔离时间', name: 'QTContactTime', width: 100, align: 'left'
  507. , edit: {
  508. type: 'datatime',
  509. dateformat: '1'
  510. }
  511. },
  512. {
  513. label: '健康状况', name: 'Fever', width: 100, align: 'left'
  514. , edit: {
  515. type: 'select',
  516. init: function (data, $edit) {
  517. },
  518. datatype: 'dataItem',
  519. code: 'EpiHealth'
  520. }
  521. },
  522. ],
  523. isMultiselect: true,
  524. isEdit: true,
  525. height: 200
  526. });
  527. },
  528. initData: function () {
  529. if (!!keyValue) {
  530. $.lrSetForm(top.$.rootUrl + '/PersonnelManagement/EpidemicSituationCopy/GetFormData?keyValue=' + keyValue, function (data) {
  531. for (var id in data) {
  532. if (!!data[id].length && data[id].length > 0) {
  533. $('#' + id).jfGridSet('refreshdata', data[id]);
  534. }
  535. else {
  536. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  537. }
  538. }
  539. });
  540. }
  541. }
  542. };
  543. // 保存数据
  544. acceptClick = function (callBack) {
  545. if (!$('body').lrValidform()) {
  546. return false;
  547. }
  548. var postData = {};
  549. postData.strEntity = JSON.stringify($('[data-table="EpidemicSituation"]').lrGetFormData());
  550. postData.strcontactsDetailsList = JSON.stringify($('#ContactsDetails').jfGridGet('rowdatas'));
  551. postData.passPlaceDetailsList = JSON.stringify($('#PassPlaces').jfGridGet('rowdatas'));
  552. postData.strpeopleDetailsList = JSON.stringify($('#PeopleDetails').jfGridGet('rowdatas'));
  553. $.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/EpidemicSituationCopy/SaveForm?keyValue=' + keyValue, postData, function (res) {
  554. // 保存成功后才回调
  555. if (!!callBack) {
  556. callBack();
  557. }
  558. });
  559. };
  560. page.init();
  561. }