/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 * 创建人:超级管理员 * 日 期:2021-06-01 11:49 * 描 述:收文报告 */ var refreshGirdData; var bootstrap = function ($, learun) { "use strict"; var processId = ''; var logbegin = ''; var logend = ''; var page = { init: function () { page.initGird(); page.bind(); }, bind: function () { $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { page.search(queryJson); }, 220, 400); $('#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, // 默认 selectfn: function (begin, end) { logbegin = begin; logend = end; page.search(); } }); // 查询 $('#btn_Search').on('click', function () { var keyword = $('#txt_Keyword').val(); page.search({ keyword: keyword }); }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); // 新增 $('#lr_add').on('click', function () { learun.layerForm({ id: 'form', title: '新增', url: top.$.rootUrl + '/EducationalAdministration/Dispatch/Form?WorkName=' + 1 + '&DisOffice=' + 1, width: 800, height: 380, callBack: function (id) { var res = false; // 验证数据 res = top[id].validForm(); // 保存数据 if (res) { res = top[id].save('', function () { page.search(); }); } return res; } }); }); // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { var FlowNo = $('#gridtable').jfGridValue('FlowNo'); if (FlowNo != 0) { learun.alert.warning("当前项目已提交不能编辑!"); return; } learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/EducationalAdministration/Dispatch/Form?keyValue=' + keyValue + '&WorkName=' + 1 + '&DisOffice=' + 1, width: 800, height: 380, callBack: function (id) { var res = false; // 验证数据 res = top[id].validForm(); // 保存数据 if (res) { res = top[id].save('', function () { page.search(); }); } return res; } }); } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { var FlowNo = $('#gridtable').jfGridValue('FlowNo'); if (FlowNo != 0) { learun.alert.warning("当前项目已提交不能删除!"); return; } learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Dispatch/DeleteForm', { keyValue: keyValue }, function () { page.search(); }); } }); } }); //提交 $('#lr_submit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { var FlowNo = $('#gridtable').jfGridValue('FlowNo'); if (FlowNo != 0) { learun.alert.warning("当前项目已提交,请耐心等待审批!"); return; } learun.layerConfirm('是否确认提交该项!', function (res) { if (res) { processId = learun.newGuid(); learun.postForm(top.$.rootUrl + '/EducationalAdministration/Dispatch/ModifyStatus', { keyValue: keyValue, pastatus: 1, processId: processId }, function (res) { refreshGirdData(res, {}); }); } }); } }); // 打印 $('#lr_print').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { var FlowNo = $('#gridtable').jfGridValue('FlowNo'); if (FlowNo < 2) { learun.alert.warning("当前项目未审核通过,不能打印!"); return; } learun.layerForm({ id: 'from', title: '收文通告', url: top.$.rootUrl + '/EducationalAdministration/Dispatch/Print?keyValue=' + keyValue, width: 1200, height: 1200, callBack: null }); } }); // 添加传阅人 $('#lr_setread').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); var loginInfo = learun.clientdata.get(['userinfo']); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '添加传阅人员', url: top.$.rootUrl + '/EducationalAdministration/Dispatch/SelectForm?objectId=' + keyValue + '&companyId=' + loginInfo.F_CompanyId + '&departmentId=' + loginInfo.F_DepartmentId + '&category=1', width: 800, height: 520, callBack: function (id) { return top[id].acceptClick(); } }); } }); //查阅 $('#lr_read').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { var FlowNo = $('#gridtable').jfGridValue('FlowNo'); if (FlowNo != 2) { learun.alert.warning("当前项目不能查阅!"); return; } learun.layerForm({ id: 'form', title: '查阅', url: top.$.rootUrl + '/EducationalAdministration/Dispatch/ReadForm?keyValue=' + keyValue, width: 800, height: 380, callBack: function (id) { learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Dispatch/ReadLD', { keyValue: keyValue }, function (res) { }); } }); } }); }, // 初始化列表 initGird: function () { $('#gridtable').lrAuthorizeJfGrid({ url: top.$.rootUrl + '/EducationalAdministration/Dispatch/GetPageList', headData: [ { label: "来文单位", name: "DisFrom", width: 400, align: "center" }, { label: "字", name: "DisWork", width: 150, align: "center" }, { label: "号", name: "DisMark", width: 150, align: "center" }, { label: "年", name: "DisYear", width: 100, align: "center" }, { label: "月", name: "DisMonth", width: 50, align: "center" }, { label: "日", name: "DisDay", width: 50, align: "center" }, { label: "事由", name: "Reasons", width: 500, align: "center", formatterAsync: function (callback, value, row, op, $cell) { $.ajax({ url: '/LR_SystemModule/Annexes/GetAnnexesFileList', data: { folderId: value }, type: 'GET', dataType: "json", async: false, cache: false, success: function (res) { var bb = ''; $.each(res.data, function (i, item) { bb += item.F_FileName.substring(0, item.F_FileName.indexOf(".")) + ',' }) //$.each(res.data, function(i, item) { // bb += '' + // item.F_FileName.substring(0,item.F_FileName.indexOf(".")) + // ',   '; //}) callback(bb); } }); } }, { label: "发起人", name: "CreateUser", width: 100, align: "center" }, { label: "发起时间", name: "CreateTime", width: 100, align: "center", formatter: function (cellvalue) { return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm'); } }, { label: "审批状态", name: "FlowNo", width: 100, align: "center", formatter: function (cellvalue, row) { if (cellvalue == 0) { return '草稿'; } if (cellvalue == 1) { return '审批中'; } else if (cellvalue == 2) { return '审批通过'; } } } ], mainId: 'Id', sidx: 'RenderDate', sord: 'desc', isPage: true }); page.search(); }, search: function (param) { param = param || {}; param.WorkName = 1; param.StartTime = logbegin; param.EndTime = logend; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); }, }; refreshGirdData = function (res, postData) { if (res.code == 200) { var DisFrom = $('#gridtable').jfGridValue('DisFrom'); var Reasons = $('#gridtable').jfGridValue('Reasons'); $.ajax({ url: '/LR_SystemModule/Annexes/GetAnnexesFileList', data: { folderId: Reasons }, type: 'GET', dataType: "json", async: false, cache: false, success: function (res) { var bb = ''; $.each(res.data, function (i, item) { bb += item.F_FileName.substring(0, item.F_FileName.indexOf(".")) + ',' }) Reasons = bb; } }); // 发起流程 var postData = { //schemeCode: 'Dispatch',// 本地 schemeCode: 'DBSW',//线上 title: "(" + DisFrom + ") " + Reasons, processId: processId, level: '1', }; learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) { learun.loading(false); }); page.search(); } }; page.init(); } function downLoad(fileId, fileTwo) { if (fileTwo) { top.learun.postFormSilence(top.$.rootUrl + '/PersonnelManagement/MP_QualityObjectives/AddRecord', { fileId: fileTwo }, function () { }); } top.learun.download({ url: top.$.rootUrl + '/LR_SystemModule/Annexes/DownAnnexesFile', param: { fileId: fileId, __RequestVerificationToken: $.lrToken }, method: 'POST' }); }