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.
 
 
 
 
 
 

122 lines
5.2 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2020-04-30 10:32
  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. $('#ContractCategoryId').lrDataSourceSelect({ code: 'ContractCategory', value: 'id', text: 'name' });
  19. $('#EmpId').lrDataSourceSelect({
  20. code: 'EmpInfo', value: 'empid', text: 'empname', select: function (item) {
  21. if (!!item) {
  22. $('#F_CompanyId').lrselectSet(item.f_companyid);
  23. $('#F_DepartmentId').lrselectSet(item.f_departmentid);
  24. $('#TitleOfTechPostNo').val(item.titleoftechpostno);
  25. $('#FictitiousRetireTime').val(item.fictitiousretiretime);
  26. }
  27. }
  28. });
  29. //校区
  30. $('#F_CompanyId').lrDataSourceSelect({
  31. code: 'company', value: 'f_companyid', text: 'f_fullname',
  32. select: function (item) {
  33. if (!!item) {
  34. // 部门
  35. $('#F_DepartmentId').lrselectRefresh({
  36. type: 'tree',
  37. // 是否允许搜索
  38. allowSearch: true,
  39. // 访问数据接口地址
  40. url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree',
  41. // 访问数据接口参数
  42. param: { companyId: item.f_companyid, parentId: '0' }
  43. });
  44. }
  45. }
  46. });
  47. // 部门选择
  48. $('#F_DepartmentId').lrselect();
  49. $('#ProbationPeriod').lrDataItemSelect({ code: 'ProbationPeriod' });
  50. $('#ContractDeadline').lrDataItemSelect({ code: 'ContractDeadline' });
  51. $('#SalaryStandardUnit').lrDataItemSelect({ code: 'SalaryStandardUnit' });
  52. $('#OperateUserId').lrselect({
  53. allowSearch: true,
  54. url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/GetUserList',
  55. value: "F_UserId",
  56. text: "F_RealName"
  57. });
  58. $('#OperateUserId').lrselectSet(learun.clientdata.get(['userinfo']).userId);
  59. //签订日期
  60. $("#SignDate").val(getFormatDate());
  61. },
  62. initData: function () {
  63. if (!!keyValue) {
  64. $.lrSetForm(top.$.rootUrl + '/PersonnelManagement/ContractManagement/GetFormData?keyValue=' + keyValue, function (data) {
  65. for (var id in data) {
  66. if (!!data[id].length && data[id].length > 0) {
  67. $('#' + id).jfGridSet('refreshdata', data[id]);
  68. }
  69. else {
  70. $('.need[data-table="' + id + '"]').lrSetFormData(data[id]);
  71. }
  72. //当前合同有效期
  73. var s = data[id]["ContractStartDate"] != (null && "") ? data[id]["ContractStartDate"].slice(0, 10) : "";
  74. var e = data[id]["ContractEndDate"] != (null && "") ? data[id]["ContractEndDate"].slice(0, 10) : "";
  75. $("#OldContractDate").html(s + " 至 " + e);
  76. //合同有效期开始
  77. $("#ContractStartDate").val(getFormatNextDate(e));
  78. }
  79. });
  80. }
  81. }
  82. };
  83. // 保存数据
  84. acceptClick = function (callBack) {
  85. if (!$('body').lrValidform()) {
  86. return false;
  87. }
  88. var postData = {
  89. strEntity: JSON.stringify($('body').lrGetFormData())
  90. };
  91. $.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/ContractManagement/SaveFormRenew?keyValue=' + keyValue, postData, function (res) {
  92. // 保存成功后才回调
  93. if (!!callBack) {
  94. callBack();
  95. }
  96. });
  97. };
  98. page.init();
  99. }
  100. //获取当前时间
  101. function getFormatDate() {
  102. var nowDate = new Date();
  103. var year = nowDate.getFullYear();
  104. var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) : nowDate.getMonth() + 1;
  105. var date = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
  106. return year + "-" + month + "-" + date;
  107. }
  108. //获取下一天
  109. function getFormatNextDate(date) {
  110. if (date == "") {
  111. date = new Date();
  112. } else {
  113. date = new Date(date);
  114. }
  115. var nextDate = new Date(date.getTime() + 24 * 60 * 60 * 1000);
  116. var year = nextDate.getFullYear();
  117. var month = nextDate.getMonth() + 1 < 10 ? "0" + (nextDate.getMonth() + 1) : nextDate.getMonth() + 1;
  118. var date = nextDate.getDate() < 10 ? "0" + nextDate.getDate() : nextDate.getDate();
  119. return year + "-" + month + "-" + date;
  120. }