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.
 
 
 
 
 
 

342 lines
16 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 refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var startTime;
  11. var endTime;
  12. var page = {
  13. init: function () {
  14. page.initGird();
  15. page.bind();
  16. },
  17. bind: function () {
  18. // 时间搜索框
  19. $('#datesearch').lrdate({
  20. dfdata: [
  21. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  22. { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  23. { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  24. { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }
  25. ],
  26. // 月
  27. mShow: false,
  28. premShow: false,
  29. // 季度
  30. jShow: false,
  31. prejShow: false,
  32. // 年
  33. ysShow: false,
  34. yxShow: false,
  35. preyShow: false,
  36. yShow: false,
  37. // 默认
  38. dfvalue: '1',
  39. selectfn: function (begin, end) {
  40. startTime = begin;
  41. endTime = end;
  42. page.search();
  43. }
  44. });
  45. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  46. page.search(queryJson);
  47. }, 300, 400);
  48. $('#ContractCategoryId').lrDataSourceSelect({ code: 'ContractCategory', value: 'id', text: 'name' });
  49. $('#EmpId').lrDataSourceSelect({ code: 'EmpInfo', value: 'empid', text: 'empname' });
  50. //校区
  51. $('#F_CompanyId').lrDataSourceSelect({
  52. code: 'company', value: 'f_companyid', text: 'f_fullname',
  53. select: function (item) {
  54. if (!!item) {
  55. // 部门
  56. $('#F_DepartmentId').lrselectRefresh({
  57. type: 'tree',
  58. // 是否允许搜索
  59. allowSearch: true,
  60. // 访问数据接口地址
  61. url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree',
  62. // 访问数据接口参数
  63. param: { companyId: item.f_companyid, parentId: '0' }
  64. });
  65. }
  66. }
  67. });
  68. // 部门选择
  69. $('#F_DepartmentId').lrselect();
  70. $('#ContractDeadline').lrDataItemSelect({ code: 'ContractDeadline' });
  71. // 刷新
  72. $('#lr_refresh').on('click', function () {
  73. location.reload();
  74. });
  75. // 新增
  76. $('#lr_add').on('click', function () {
  77. learun.layerForm({
  78. id: 'form',
  79. title: '新增',
  80. url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/Form',
  81. width: 1000,
  82. height: 800,
  83. callBack: function (id) {
  84. return top[id].acceptClick(refreshGirdData);
  85. }
  86. });
  87. });
  88. // 编辑
  89. $('#lr_edit').on('click', function () {
  90. var keyValue = $('#gridtable').jfGridValue('Id');
  91. if (learun.checkrow(keyValue)) {
  92. var ContractStatus = $('#gridtable').jfGridValue('ContractStatus');
  93. if (ContractStatus !== "1" && ContractStatus !== "2") {
  94. learun.alert.warning("当前合同已失效!");
  95. return false;
  96. }
  97. learun.layerForm({
  98. id: 'form',
  99. title: '编辑',
  100. url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/Form?keyValue=' + keyValue,
  101. width: 1000,
  102. height: 800,
  103. callBack: function (id) {
  104. return top[id].acceptClick(refreshGirdData);
  105. }
  106. });
  107. }
  108. });
  109. // 删除
  110. $('#lr_delete').on('click', function () {
  111. var keyValue = $('#gridtable').jfGridValue('Id');
  112. if (learun.checkrow(keyValue)) {
  113. learun.layerConfirm('是否确认删除该项!', function (res) {
  114. if (res) {
  115. learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/ContractManagement/DeleteForm', { keyValue: keyValue }, function () {
  116. refreshGirdData();
  117. });
  118. }
  119. });
  120. }
  121. });
  122. //  查看
  123. $('#lr_view').on('click', function () {
  124. var keyValue = $('#gridtable').jfGridValue('Id');
  125. if (learun.checkrow(keyValue)) {
  126. learun.layerForm({
  127. id: 'formview',
  128. title: '查看',
  129. url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/FormView?keyValue=' + keyValue,
  130. width: 1000,
  131. height: 800,
  132. btn: null
  133. });
  134. }
  135. });
  136. //  续签
  137. $('#lr_renew').on('click', function () {
  138. var keyValue = $('#gridtable').jfGridValue('Id');
  139. if (learun.checkrow(keyValue)) {
  140. var ContractStatus = $('#gridtable').jfGridValue('ContractStatus');
  141. if (ContractStatus !== "2") {
  142. learun.alert.warning("当前合同已失效!");
  143. return false;
  144. }
  145. learun.layerForm({
  146. id: 'formRenew',
  147. title: '续签合同',
  148. url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/FormRenew?keyValue=' + keyValue,
  149. width: 1000,
  150. height: 800,
  151. callBack: function (id) {
  152. return top[id].acceptClick(refreshGirdData);
  153. }
  154. });
  155. }
  156. });
  157. //  终止
  158. $('#lr_terminal').on('click', function () {
  159. var keyValue = $('#gridtable').jfGridValue('Id');
  160. if (learun.checkrow(keyValue)) {
  161. var ContractStatus = $('#gridtable').jfGridValue('ContractStatus');
  162. if (ContractStatus !== "1" && ContractStatus !== "2") {
  163. learun.alert.warning("当前合同已失效!");
  164. return false;
  165. }
  166. learun.layerForm({
  167. id: 'formTerminate',
  168. title: '终止合同',
  169. url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/FormTerminate?keyValue=' + keyValue,
  170. width: 800,
  171. height: 600,
  172. callBack: function (id) {
  173. return top[id].acceptClick(refreshGirdData);
  174. }
  175. });
  176. }
  177. });
  178. //  解除
  179. $('#lr_remove').on('click', function () {
  180. var keyValue = $('#gridtable').jfGridValue('Id');
  181. if (learun.checkrow(keyValue)) {
  182. var ContractStatus = $('#gridtable').jfGridValue('ContractStatus');
  183. if (ContractStatus !== "1" && ContractStatus !== "2") {
  184. learun.alert.warning("当前合同已失效!");
  185. return false;
  186. }
  187. learun.layerForm({
  188. id: 'formRemove',
  189. title: '解除合同',
  190. url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/FormRemove?keyValue=' + keyValue,
  191. width: 800,
  192. height: 600,
  193. callBack: function (id) {
  194. return top[id].acceptClick(refreshGirdData);
  195. }
  196. });
  197. }
  198. });
  199. },
  200. // 初始化列表
  201. initGird: function () {
  202. $('#gridtable').lrAuthorizeJfGrid({
  203. url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/GetPageList',
  204. headData: [
  205. {
  206. label: "合同类别", name: "ContractCategoryId", width: 150, align: "left",
  207. formatterAsync: function (callback, value, row, op, $cell) {
  208. learun.clientdata.getAsync('custmerData', {
  209. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ContractCategory',
  210. key: value,
  211. keyId: 'id',
  212. callback: function (_data) {
  213. callback(_data['name']);
  214. }
  215. });
  216. }
  217. },
  218. {
  219. label: "教职工", name: "EmpId", width: 100, align: "left",
  220. formatterAsync: function (callback, value, row, op, $cell) {
  221. learun.clientdata.getAsync('custmerData', {
  222. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  223. key: value,
  224. keyId: 'empid',
  225. callback: function (_data) {
  226. callback(_data['empname']);
  227. }
  228. });
  229. }
  230. },
  231. {
  232. label: "员工状态", name: "SelfIsInActiveStatus", width: 100, align: "left",
  233. formatterAsync: function (callback, value, row, op, $cell) {
  234. learun.clientdata.getAsync('dataItem', {
  235. key: value,
  236. code: 'JobStatus',
  237. callback: function (_data) {
  238. callback(_data.text);
  239. }
  240. });
  241. }
  242. },
  243. {
  244. label: "所属部门", name: "SelfF_DepartmentId", width: 100, align: "left",
  245. formatterAsync: function (callback, value, row, op, $cell) {
  246. learun.clientdata.getAsync('custmerData', {
  247. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
  248. key: value,
  249. keyId: 'id',
  250. callback: function (_data) {
  251. callback(_data['name']);
  252. }
  253. });
  254. }
  255. },
  256. {
  257. label: "任职部门", name: "F_DepartmentId", width: 100, align: "left",
  258. formatterAsync: function (callback, value, row, op, $cell) {
  259. learun.clientdata.getAsync('custmerData', {
  260. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
  261. key: value,
  262. keyId: 'id',
  263. callback: function (_data) {
  264. callback(_data['name']);
  265. }
  266. });
  267. }
  268. },
  269. { label: "担任岗位", name: "TitleOfTechPostNo", width: 100, align: "left" },
  270. {
  271. label: "合同状态", name: "ContractStatus", width: 100, align: "left",
  272. formatterAsync: function (callback, value, row, op, $cell) {
  273. learun.clientdata.getAsync('dataItem', {
  274. key: value,
  275. code: 'ContractStatus',
  276. callback: function (_data) {
  277. callback(_data.text);
  278. }
  279. });
  280. }
  281. },
  282. { label: "合同编号", name: "ContractNum", width: 100, align: "left" },
  283. { label: "签订日期", name: "SignDate", width: 100, align: "left" },
  284. { label: "合同有效期开始", name: "ContractStartDate", width: 100, align: "left" },
  285. { label: "合同有效期结束", name: "ContractEndDate", width: 100, align: "left" },
  286. {
  287. label: "经办人", name: "OperateUserId", width: 100, align: "left",
  288. formatterAsync: function (callback, value, row, op, $cell) {
  289. learun.clientdata.getAsync('custmerData', {
  290. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
  291. key: value,
  292. keyId: 'f_userid',
  293. callback: function (_data) {
  294. callback(_data['f_realname']);
  295. }
  296. });
  297. }
  298. },
  299. { label: "终止日期", name: "TerminateDate", width: 90, align: "left" },
  300. {
  301. label: "终止原因", name: "TerminateReason", width: 100, align: "left",
  302. formatterAsync: function (callback, value, row, op, $cell) {
  303. learun.clientdata.getAsync('dataItem', {
  304. key: value,
  305. code: 'TerminateReason',
  306. callback: function (_data) {
  307. callback(_data.text);
  308. }
  309. });
  310. }
  311. },
  312. { label: "解除日期", name: "RemoveDate", width: 90, align: "left" },
  313. {
  314. label: "解除原因", name: "RemoveReason", width: 100, align: "left",
  315. formatterAsync: function (callback, value, row, op, $cell) {
  316. learun.clientdata.getAsync('dataItem', {
  317. key: value,
  318. code: 'RemoveReason',
  319. callback: function (_data) {
  320. callback(_data.text);
  321. }
  322. });
  323. }
  324. },
  325. ],
  326. mainId: 'Id',
  327. isPage: true
  328. });
  329. },
  330. search: function (param) {
  331. param = param || {};
  332. param.StartTime = startTime;
  333. param.EndTime = endTime;
  334. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  335. }
  336. };
  337. refreshGirdData = function () {
  338. page.search();
  339. };
  340. page.init();
  341. }