|
- /* * 版 本 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 page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- page.search(queryJson);
- }, 220, 400);
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/EducationalAdministration/Dispatch/Form?DisTitle=' + 2 + '&DisOffice=' + 2,
- width: 1000,
- height: 700,
- 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 + '&DisTitle=' + 2 + '&DisOffice=' + 2,
- width: 1000,
- height: 700,
- 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 () {
- });
- }
- });
- }
- });
- //提交
- $('#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
- });
- }
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/EducationalAdministration/Dispatch/GetPageList',
- headData: [
- { label: "工作名称", name: "WorkName", width: 200, align: "center" },
- //{ label: "标题", name: "DisTitle", width: 200, align: "center" },
- {
- label: "标题", name: "DisTitle", width: 250, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'Dispatch',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- { label: "来文", name: "DisFrom", width: 100, align: "center" },
- { label: "字", name: "DisWork", width: 80, align: "center" },
- { label: "号", name: "DisMark", width: 80, align: "center" },
- { label: "份数", name: "Copies", width: 50, 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: 150, align: "center" },
- //{ label: "附件", name: "AttachmentName", width: 100, align: "center" },
- { label: "呈送意见", name: "Render", width: 100, align: "center" },
- {
- label: "呈送时间", name: "RenderDate", width: 100, align: "center",
- },
- { label: "收文", name: "DisOffice", width: 100, align: "center" },
- { label: "批示", name: "Instructions", width: 100, align: "center" },
- {
- label: "审批状态", name: "FlowNo", width: 100, align: "center",
- formatter: function (cellvalue, row) {
- if (cellvalue == 0) {
- return '<span class=\"label label-warning\">草稿</span>';
- } if (cellvalue == 1) {
- return '<span class=\"label label-warning\">审批中</span>';
- } else if (cellvalue == 2) {
- return '<span class=\"label label-success\">审批通过</span>';
- }
- }
- }
- ],
- mainId: 'Id',
- isPage: true
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- param.DisTitle = 2;
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function (res, postData) {
- if (res.code == 200) {
- // 发起流程
- var postData = {
- schemeCode: 'Dispatch',// 填写流程对应模板编号
- processId: processId,
- level: '1',
- };
- learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
- learun.loading(false);
- });
- page.search();
- }
- };
- page.init();
- }
|