|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2020-04-30 10:32
- * 描 述:合同管理
- */
- var refreshGirdData;
- var bootstrap = function ($, learun) {
- "use strict";
- var startTime;
- var endTime;
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- // 时间搜索框
- $('#datesearch').lrdate({
- dfdata: [
- { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { 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') } },
- { 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') } },
- { 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') } }
- ],
- // 月
- mShow: false,
- premShow: false,
- // 季度
- jShow: false,
- prejShow: false,
- // 年
- ysShow: false,
- yxShow: false,
- preyShow: false,
- yShow: false,
- // 默认
- dfvalue: '1',
- selectfn: function (begin, end) {
- startTime = begin;
- endTime = end;
- page.search();
- }
- });
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- page.search(queryJson);
- }, 300, 400);
- $('#ContractCategoryId').lrDataSourceSelect({ code: 'ContractCategory', value: 'id', text: 'name' });
- $('#EmpId').lrDataSourceSelect({ code: 'EmpInfo', value: 'empid', text: 'empname' });
- //校区
- $('#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();
- $('#ContractDeadline').lrDataItemSelect({ code: 'ContractDeadline' });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/Form',
- width: 1000,
- height: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- var ContractStatus = $('#gridtable').jfGridValue('ContractStatus');
- if (ContractStatus !== "1" && ContractStatus !== "2") {
- learun.alert.warning("当前合同已失效!");
- return false;
- }
- learun.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/Form?keyValue=' + keyValue,
- width: 1000,
- height: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/ContractManagement/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- // 查看
- $('#lr_view').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'formview',
- title: '查看',
- url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/FormView?keyValue=' + keyValue,
- width: 1000,
- height: 800,
- btn: null
- });
- }
- });
- // 续签
- $('#lr_renew').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- var ContractStatus = $('#gridtable').jfGridValue('ContractStatus');
- if (ContractStatus !== "2") {
- learun.alert.warning("当前合同已失效!");
- return false;
- }
- learun.layerForm({
- id: 'formRenew',
- title: '续签合同',
- url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/FormRenew?keyValue=' + keyValue,
- width: 1000,
- height: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 终止
- $('#lr_terminal').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- var ContractStatus = $('#gridtable').jfGridValue('ContractStatus');
- if (ContractStatus !== "1" && ContractStatus !== "2") {
- learun.alert.warning("当前合同已失效!");
- return false;
- }
- learun.layerForm({
- id: 'formTerminate',
- title: '终止合同',
- url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/FormTerminate?keyValue=' + keyValue,
- width: 800,
- height: 600,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 解除
- $('#lr_remove').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- var ContractStatus = $('#gridtable').jfGridValue('ContractStatus');
- if (ContractStatus !== "1" && ContractStatus !== "2") {
- learun.alert.warning("当前合同已失效!");
- return false;
- }
- learun.layerForm({
- id: 'formRemove',
- title: '解除合同',
- url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/FormRemove?keyValue=' + keyValue,
- width: 800,
- height: 600,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/PersonnelManagement/ContractManagement/GetPageList',
- headData: [
- {
- label: "合同类别", name: "ContractCategoryId", width: 150, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ContractCategory',
- key: value,
- keyId: 'id',
- callback: function (_data) {
- callback(_data['name']);
- }
- });
- }
- },
- {
- label: "教职工", name: "EmpId", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
- key: value,
- keyId: 'empid',
- callback: function (_data) {
- callback(_data['empname']);
- }
- });
- }
- },
- {
- label: "员工状态", name: "SelfIsInActiveStatus", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'JobStatus',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- {
- label: "所属部门", name: "SelfF_DepartmentId", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
- key: value,
- keyId: 'id',
- callback: function (_data) {
- callback(_data['name']);
- }
- });
- }
- },
- {
- label: "任职部门", name: "F_DepartmentId", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
- key: value,
- keyId: 'id',
- callback: function (_data) {
- callback(_data['name']);
- }
- });
- }
- },
- { label: "担任岗位", name: "TitleOfTechPostNo", width: 100, align: "left" },
- {
- label: "合同状态", name: "ContractStatus", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'ContractStatus',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- { label: "合同编号", name: "ContractNum", width: 100, align: "left" },
- { label: "签订日期", name: "SignDate", width: 100, align: "left" },
- { label: "合同有效期开始", name: "ContractStartDate", width: 100, align: "left" },
- { label: "合同有效期结束", name: "ContractEndDate", width: 100, align: "left" },
- {
- label: "经办人", name: "OperateUserId", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
- key: value,
- keyId: 'f_userid',
- callback: function (_data) {
- callback(_data['f_realname']);
- }
- });
- }
- },
- { label: "终止日期", name: "TerminateDate", width: 90, align: "left" },
- {
- label: "终止原因", name: "TerminateReason", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'TerminateReason',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- { label: "解除日期", name: "RemoveDate", width: 90, align: "left" },
- {
- label: "解除原因", name: "RemoveReason", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'RemoveReason',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- ],
- mainId: 'Id',
- isPage: true
- });
- },
- search: function (param) {
- param = param || {};
- param.StartTime = startTime;
- param.EndTime = endTime;
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function () {
- page.search();
- };
- page.init();
- }
|