/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) * Copyright (c) 2013-2018 北京泉江科技有限公司 * 创建人:超级管理员 * 日 期:2020-04-30 10:32 * 描 述:合同管理 */ 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 () { $('#ContractCategoryId').lrDataSourceSelect({ code: 'ContractCategory', value: 'id', text: 'name' }); $('#EmpId').lrDataSourceSelect({ code: 'EmpInfo', value: 'empid', text: 'empname', select: function (item) { if (!!item) { $('#F_CompanyId').lrselectSet(item.f_companyid); $('#F_DepartmentId').lrselectSet(item.f_departmentid); $('#TitleOfTechPostNo').val(item.titleoftechpostno); $('#FictitiousRetireTime').val(item.fictitiousretiretime); } } }); //校区 $('#F_CompanyId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname', select: function (item) { if (!!item) { // 部门 $('#F_DepartmentId').lrselectRefresh({ type: 'tree', // 是否允许搜索 allowSearch: true, // 访问数据接口地址 url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree', // 访问数据接口参数 param: { companyId: item.f_companyid, parentId: '0' } }); } } }); // 部门选择 $('#F_DepartmentId').lrselect(); $('#ProbationPeriod').lrDataItemSelect({ code: 'ProbationPeriod' }); $('#ContractDeadline').lrDataItemSelect({ code: 'ContractDeadline' }); $('#SalaryStandardUnit').lrDataItemSelect({ code: 'SalaryStandardUnit' }); $('#OperateUserId').lrselect({ allowSearch: true, url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/GetUserList', value: "F_UserId", text: "F_RealName" }); $('#OperateUserId').lrselectSet(learun.clientdata.get(['userinfo']).userId); //签订日期 $("#SignDate").val(getFormatDate()); }, initData: function () { if (!!keyValue) { $.lrSetForm(top.$.rootUrl + '/PersonnelManagement/ContractManagement/GetFormData?keyValue=' + keyValue, function (data) { for (var id in data) { if (!!data[id].length && data[id].length > 0) { $('#' + id).jfGridSet('refreshdata', data[id]); } else { $('.need[data-table="' + id + '"]').lrSetFormData(data[id]); } //当前合同有效期 var s = data[id]["ContractStartDate"] != (null && "") ? data[id]["ContractStartDate"].slice(0, 10) : ""; var e = data[id]["ContractEndDate"] != (null && "") ? data[id]["ContractEndDate"].slice(0, 10) : ""; $("#OldContractDate").html(s + " 至 " + e); //合同有效期开始 $("#ContractStartDate").val(getFormatNextDate(e)); } }); } } }; // 保存数据 acceptClick = function (callBack) { if (!$('body').lrValidform()) { return false; } var postData = { strEntity: JSON.stringify($('body').lrGetFormData()) }; $.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/ContractManagement/SaveFormRenew?keyValue=' + keyValue, postData, function (res) { // 保存成功后才回调 if (!!callBack) { callBack(); } }); }; page.init(); } //获取当前时间 function getFormatDate() { var nowDate = new Date(); var year = nowDate.getFullYear(); var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) : nowDate.getMonth() + 1; var date = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate(); return year + "-" + month + "-" + date; } //获取下一天 function getFormatNextDate(date) { if (date == "") { date = new Date(); } else { date = new Date(date); } var nextDate = new Date(date.getTime() + 24 * 60 * 60 * 1000); var year = nextDate.getFullYear(); var month = nextDate.getMonth() + 1 < 10 ? "0" + (nextDate.getMonth() + 1) : nextDate.getMonth() + 1; var date = nextDate.getDate() < 10 ? "0" + nextDate.getDate() : nextDate.getDate(); return year + "-" + month + "-" + date; }