|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2019-12-13 11:01
- * 描 述:印章使用
- */
- var refreshGirdData;
- var bootstrap = function ($, learun) {
- "use strict";
- var processId = '';
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/LR_LGManager/StampApply/Form',
- width: 600,
- height: 500,
- callBack: function (id) {
- var res = false;
- // 验证数据
- res = top[id].validForm();
- // 保存数据
- if (res) {
- //processId = learun.newGuid();
- //res = top[id].save(processId, refreshGirdData);
- res = top[id].save('', function () {
- page.search();
- });
- }
- return res;
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var AAStatus = $('#gridtable').jfGridValue('Status');
- console.log(AAStatus);
- if (AAStatus > 0) {
- learun.alert.warning("当前项目已提交不能编辑!");
- return;
- }
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/LR_LGManager/StampApply/Form?keyValue=' + keyValue,
- width: 600,
- height: 500,
- 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 AAStatus = $('#gridtable').jfGridValue('Status');
- if (AAStatus > 0) {
- learun.alert.warning("当前项目已提交不能编辑!");
- return;
- }
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/LR_LGManager/StampApply/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- //提交
- $('#lr_submit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- var AAStatus = $('#gridtable').jfGridValue('Status');
- console.log(AAStatus);
- if (AAStatus > 0) {
- learun.alert.warning("当前项目已提交,请耐心等待审批!");
- return;
- }
- learun.layerConfirm('是否确认提交该项!', function (res) {
- if (res) {
- processId = learun.newGuid();
- learun.postForm(top.$.rootUrl + '/LR_LGManager/StampApply/ModifyStatus', { keyValue: keyValue, pastatus: 1, processId: processId }, function (res) {
- refreshGirdData(res, {});
- });
- }
- });
- }
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/LR_LGManager/StampApply/GetPageList',
- headData: [
- { label: "使用部门", name: "UseDepartment", width: 100, align: "left" },
- {
- label: "用章情况", name: "StampSituration", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'JYStampType',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- {
- label: "用章选择", name: "StampType", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'JYStampCheck',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- {
- label: "状态", name: "Status", width: 100, align: "left",
- formatter: function (cellvalue, row) {
- if (cellvalue === 1) {
- return '<span class=\"label label-warning\">审批中</span>';
- } else if (cellvalue === 2) {
- return '<span class=\"label label-success\">审批通过</span>';
- } else {
- return '<span class=\"label label-default\" >草稿</span>';
- }
- }
- },
- { label: "备注", name: "Remark", width: 100, align: "left" },
- ],
- mainId: 'ID',
- isPage: true
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function (res, postData) {
- if (res.code == 200) {
- // 发起流程
- var postData = {
- schemeCode: 'StampApply',// 填写流程对应模板编号
- processId: processId,
- level: '1',
- };
- learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
- learun.loading(false);
- });
- page.search();
- }
- };
- page.init();
- }
|