/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) * Copyright (c) 2013-2018 北京泉江科技有限公司 * 创建人:超级管理员 * 日 期:2020-02-03 14:37 * 描 述:疫情记录 */ var acceptClick; var keyValue = request('keyValue'); var bootstrap = function ($, learun) { "use strict"; var page = { init: function () { $('.lr-form-wrap').lrscroll(); page.bind(); page.initData(); }, bind: function () { $('#Creater').lrDataSourceSelect({ code: 'BaseUser', value: 'f_userid', text: 'f_realname' }); $('#Department').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name' }); $('#UnitName').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' }); $('#Type').lrDataItemSelect({ code: 'EUserType' }); $('#RelationShip').lrDataItemSelect({ code: 'ERelationship' }); $('#OutReason').lrDataItemSelect({ code: 'OutReason' }); $('#HealthSituation').lrDataItemSelect({ code: 'EpiHealth' }); $('#IsOut').lrDataItemSelect({ code: 'YesOrNoInt', select: function (item) { if (item) { console.log(item); if (item.text == "是") { $("#PassPlaces").parent().show(); } else { $("#PassPlaces").parent().hide(); } } else { $("#PassPlaces").parent().hide(); } } }); $('#HasFamily').lrDataItemSelect({ code: 'YesOrNoInt', select: function (item) { if (item) { console.log(item); if (item.text == "是") { $("#ContactsDetails").parent().show(); } else { $("#ContactsDetails").parent().hide(); } } else { $("#ContactsDetails").parent().hide(); } } }); $('#HasPeople').lrDataItemSelect({ code: 'YesOrNoInt', select: function (item) { if (item) { console.log(item); if (item.text == "是") { $("#PeopleDetails").parent().show(); } else { $("#PeopleDetails").parent().hide(); } } else { $("#PeopleDetails").parent().hide(); } } }); $('#Gender').lrDataItemSelect({ code: 'usersex' }); $('#Provice').lrDataSourceSelect({ code: 'DIC_PROVINCE', value: 'pcode', text: 'pname', select: function (item) { if (!!item) { $('#OutArea').lrselectRefresh({ url: "/DIC_CITY/GetListByProvinceCode", param: { ProvinceCode: item.pcode }, value: 'CCODE', text: 'CNAME' }); $('#City').lrselectRefresh({ url: "", data: [] }); } } }); $('#OutArea').lrselect({ select: function (item) { if (!!item) { $('#City').lrselectRefresh({ url: top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", param: { cityCode: item.CCODE }, value: 'ACODE', text: 'ANAME' }); } } }); $('#City').lrselect(); $('#Vehicle').lrDataItemSelect({ code: 'Vehicle' }); $('#PassPlaces').jfGrid({ headData: [ { label: '类别', name: 'PassType', width: 100, align: 'left' , edit: { type: 'select', init: function (row, $edit) { }, datatype: 'dataItem', code: 'EpiPassType' } }, { label: '省', name: 'Province', width: 100, align: 'left' , edit: { type: 'select', init: function (row, $edit) { }, datatype: 'dataSource', code: 'DIC_PROVINCE', op: { value: 'pcode', text: 'pname', title: 'pname' } } }, { label: '市', name: 'City', width: 100, align: 'left', formatter: function (value, row, op, $cell) { var province = row.Province; var res; learun.httpSync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) { $.each(data, function (_index, _item) { if (value == _item.CCODE) { res = _item.CNAME; } }); }); return res; }, edit: { type: 'select', init: function (row, $self) { var province = row.Province; learun.httpAsync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) { var res = []; $.each(data, function (_index, _item) { res.push(_item); }); $self.lrselectRefresh({ data: res, }); }); }, op: { value: 'CCODE', text: 'CNAME', title: 'CNAME', } } }, { label: '区域', name: 'Area', width: 100, align: 'left', formatter: function (value, row, op, $cell) { var cityCode = row.City; var res; learun.httpSync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) { $.each(data, function (_index, _item) { if (value == _item.ACODE) { res = _item.ANAME; } }); }); return res; }, edit: { type: 'select', init: function (row, $edit) { var cityCode = row.City; learun.httpAsync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) { var res = []; $.each(data, function (_index, _item) { res.push(_item); }); $edit.lrselectRefresh({ data: res, }); }); }, op: { value: 'ACODE', text: 'ANAME', title: 'ANAME' } } }, { label: '详细地址', name: 'Address', width: 100, align: 'left' , edit: { type: 'input', } }, { label: '时间', name: 'Time', width: 100, align: 'left', edit: { type: 'datatime' } }, { label: '交通工具', name: 'Vehicle', width: 100, align: 'left', edit: { type: 'select', init: function (row, $edit) { }, datatype: 'dataItem', code: 'Vehicle' } }, { label: '班次号', name: 'VehicleNo', width: 100, align: 'left' , edit: { type: 'input', } }], isMultiselect: true, isEdit: true, height: 200 }); $('#ContactsDetails').jfGrid({ headData: [ { label: '名字', name: 'Name', width: 100, align: 'left', edit: { type: 'input' } }, { label: '性别', name: 'Gender', width: 100, align: 'left' , edit: { type: 'select', init: function (row, $edit) { }, datatype: 'dataItem', code: 'usersex' } }, { label: '联系方式', name: 'Mobile', width: 100, align: 'left', edit: { type: 'input' } }, { label: '隔离方式', name: 'QTType', width: 100, align: 'left' , edit: { type: 'select', init: function (data, $edit) { }, datatype: 'dataItem', code: 'QuarantineType' } }, { label: '省', name: 'Province', width: 100, align: 'left' , edit: { type: 'select', init: function (row, $edit) { }, datatype: 'dataSource', code: 'DIC_PROVINCE', op: { value: 'pcode', text: 'pname', title: 'pname' } } }, { label: '市', name: 'City', width: 100, align: 'left', formatter: function (value, row, op, $cell) { var province = row.Province; var res; learun.httpSync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) { $.each(data, function (_index, _item) { if (value == _item.CCODE) { res = _item.CNAME; } }); }); return res; }, edit: { type: 'select', init: function (row, $self) { var province = row.Province; learun.httpAsync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) { var res = []; $.each(data, function (_index, _item) { res.push(_item); }); $self.lrselectRefresh({ data: res, }); }); }, op: { value: 'CCODE', text: 'CNAME', title: 'CNAME', } } }, { label: '区域', name: 'Area', width: 100, align: 'left', formatter: function (value, row, op, $cell) { var cityCode = row.City; var res; learun.httpSync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) { $.each(data, function (_index, _item) { if (value == _item.ACODE) { res = _item.ANAME; } }); }); return res; }, edit: { type: 'select', init: function (row, $edit) { var cityCode = row.City; learun.httpAsync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) { var res = []; $.each(data, function (_index, _item) { res.push(_item); }); $edit.lrselectRefresh({ data: res, }); }); }, op: { value: 'ACODE', text: 'ANAME', title: 'ANAME' } } }, { label: '隔离地点', name: 'QTAddress', width: 100, align: 'left', edit: { type: 'input' } }, { label: '隔离时间', name: 'QTTime', width: 100, align: 'left' , edit: { type: 'datatime', dateformat: '1' } }, { label: '接触隔离时间', name: 'QTContactTime', width: 100, align: 'left' , edit: { type: 'datatime', dateformat: '1' } }, { label: '健康状况', name: 'Fever', width: 100, align: 'left' , edit: { type: 'select', init: function (data, $edit) { }, datatype: 'dataItem', code: 'EpiHealth' } }, ], isMultiselect: true, isEdit: true, height: 200 }); $('#PeopleDetails').jfGrid({ headData: [ { label: '名字', name: 'Name', width: 100, align: 'left', edit: { type: 'input' } }, { label: '性别', name: 'Gender', width: 100, align: 'left' , edit: { type: 'select', init: function (row, $edit) { }, datatype: 'dataItem', code: 'usersex' } }, { label: '联系方式', name: 'Mobile', width: 100, align: 'left', edit: { type: 'input' } }, { label: '隔离方式', name: 'QTType', width: 100, align: 'left' , edit: { type: 'select', init: function (data, $edit) { }, datatype: 'dataItem', code: 'QuarantineType' } }, { label: '省', name: 'Province', width: 100, align: 'left' , edit: { type: 'select', init: function (row, $edit) { }, datatype: 'dataSource', code: 'DIC_PROVINCE', op: { value: 'pcode', text: 'pname', title: 'pname' } } }, { label: '市', name: 'City', width: 100, align: 'left', formatter: function (value, row, op, $cell) { var province = row.Province; var res; learun.httpSync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) { $.each(data, function (_index, _item) { if (value == _item.CCODE) { res = _item.CNAME; } }); }); return res; }, edit: { type: 'select', init: function (row, $self) { var province = row.Province; learun.httpAsync('GET', '/DIC_CITY/GetListByProvinceCode', { ProvinceCode: province }, function (data) { var res = []; $.each(data, function (_index, _item) { res.push(_item); }); $self.lrselectRefresh({ data: res, }); }); }, op: { value: 'CCODE', text: 'CNAME', title: 'CNAME', } } }, { label: '区域', name: 'Area', width: 100, align: 'left', formatter: function (value, row, op, $cell) { var cityCode = row.City; var res; learun.httpSync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) { $.each(data, function (_index, _item) { if (value == _item.ACODE) { res = _item.ANAME; } }); }); return res; }, edit: { type: 'select', init: function (row, $edit) { var cityCode = row.City; learun.httpAsync('GET', top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", { cityCode: cityCode }, function (data) { var res = []; $.each(data, function (_index, _item) { res.push(_item); }); $edit.lrselectRefresh({ data: res, }); }); }, op: { value: 'ACODE', text: 'ANAME', title: 'ANAME' } } }, { label: '隔离地点', name: 'QTAddress', width: 100, align: 'left', edit: { type: 'input' } }, { label: '隔离时间', name: 'QTTime', width: 100, align: 'left' , edit: { type: 'datatime', dateformat: '1' } }, { label: '接触隔离时间', name: 'QTContactTime', width: 100, align: 'left' , edit: { type: 'datatime', dateformat: '1' } }, { label: '健康状况', name: 'Fever', width: 100, align: 'left' , edit: { type: 'select', init: function (data, $edit) { }, datatype: 'dataItem', code: 'EpiHealth' } }, ], isMultiselect: true, isEdit: true, height: 200 }); var loginInfo = top.learun.clientdata.get(['userinfo']); //添加当前登录人员 if (!keyValue) { $("#Creater").val(loginInfo.realName); var time = new Date(); var _dateFmt = $("#CreateTime").attr('data-dateFmt') || 'yyyy-MM-dd'; $("#CreateTime").val(learun.formatDate(time.toLocaleDateString(), _dateFmt)); $('#Department').lrselectSet(loginInfo.departmentId); $('#UnitName').lrselectSet(loginInfo.companyId); $('#Gender').lrselectSet(loginInfo.gender); $('#Mobile').lrselectSet(loginInfo.mobile); $('#Creater').lrselectSet(loginInfo.userId); $('#Objective').val(returnCitySN.cname); //loginInfo.userId if (loginInfo.Description == "学生") { $("#Type").lrselectSet(5); learun.httpSync('GET', top.$.rootUrl + "/PersonnelManagement/EpidemicSituationCopy/GetStudentSource", { studentId: loginInfo.account }, function (data) { console.log(data); $('#StudentSource').val(data.res); $('#HomeAddress').val(data.Address); }); } else { learun.httpSync('GET', top.$.rootUrl + "/PersonnelManagement/EpidemicSituationCopy/GetEmpSource", { empId: loginInfo.userId }, function (data) { $('#HomeAddress').val(data.Address); }); } } if (loginInfo.Description == "学生") { $('#Department').parent().hide(); $('#StudentSource').parent().show(); } else { $('#Department').parent().show(); $('#StudentSource').parent().hide(); } }, initData: function () { if (!!keyValue) { $.lrSetForm(top.$.rootUrl + '/PersonnelManagement/EpidemicSituationCopy/GetFormData?keyValue=' + keyValue, function (data) { for (var id in data) { if (!!data[id].length && data[id].length > 0) { $('#' + id).jfGridSet('refreshdata', data[id]); } else { $('[data-table="' + id + '"]').lrSetFormData(data[id]); } } }); } } }; // 保存数据 acceptClick = function (callBack) { if (!$('body').lrValidform()) { return false; } var postData = {}; postData.strEntity = JSON.stringify($('[data-table="EpidemicSituation"]').lrGetFormData()); postData.strcontactsDetailsList = JSON.stringify($('#ContactsDetails').jfGridGet('rowdatas')); postData.passPlaceDetailsList = JSON.stringify($('#PassPlaces').jfGridGet('rowdatas')); postData.strpeopleDetailsList = JSON.stringify($('#PeopleDetails').jfGridGet('rowdatas')); $.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/EpidemicSituationCopy/SaveForm?keyValue=' + keyValue, postData, function (res) { // 保存成功后才回调 if (!!callBack) { callBack(); } }); }; page.init(); }