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.
 
 
 
 
 
 

105 lines
4.3 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. $("#ContractStartDate").val(getFormatDate());
  63. },
  64. initData: function () {
  65. if (!!keyValue) {
  66. $.lrSetForm(top.$.rootUrl + '/PersonnelManagement/ContractManagement/GetFormData?keyValue=' + keyValue, function (data) {
  67. for (var id in data) {
  68. if (!!data[id].length && data[id].length > 0) {
  69. $('#' + id).jfGridSet('refreshdata', data[id]);
  70. }
  71. else {
  72. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  73. }
  74. }
  75. });
  76. }
  77. }
  78. };
  79. // 保存数据
  80. acceptClick = function (callBack) {
  81. if (!$('body').lrValidform()) {
  82. return false;
  83. }
  84. var postData = {
  85. strEntity: JSON.stringify($('body').lrGetFormData())
  86. };
  87. $.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/ContractManagement/SaveForm?keyValue=' + keyValue, postData, function (res) {
  88. // 保存成功后才回调
  89. if (!!callBack) {
  90. callBack();
  91. }
  92. });
  93. };
  94. page.init();
  95. }
  96. //获取当前时间
  97. function getFormatDate() {
  98. var nowDate = new Date();
  99. var year = nowDate.getFullYear();
  100. var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) : nowDate.getMonth() + 1;
  101. var date = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
  102. return year + "-" + month + "-" + date;
  103. }