/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
* 创建人:超级管理员
* 日 期:2021-05-28 14:18
* 描 述:支出预算管理
*/
var refreshGirdData;
var processId = '';
var ptype = '';
var url = '';
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
page.initGird();
page.bind();
page.initTree();
},
bind: function () {
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
page.search(queryJson);
}, 220, 400);
$('#PType').lrDataItemSelect({ code: 'payReimburseType' });
$('#PPayType').lrDataItemSelect({ code: 'fdPayType' });
$('#PTopSource').lrDataItemSelect({ code: 'fdPaySource' });
// 刷新
$('#lr_refresh').on('click', function () {
refreshGirdData();
});
// 查看
$('#lr_eye').on('click', function () {
page.eye();
});
// 新增
$('#lr_add').on('click', function () {
if (!ptype) {
learun.alert.warning("请选择类型!");
return;
}
learun.layerForm({
id: 'form',
title: '新增',
url: top.$.rootUrl + url + '?ptype=' + ptype,
width: 800,
height: 600,
callBack: function (id) {
return top[id].save('', refreshGirdData());
}
});
});
// 编辑
$('#lr_edit').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('PId');
var status = $('#gridtable').jfGridValue('PStatus');
if (status != 0) {
learun.alert.warning("当前项目已提交,不可编辑!");
return;
}
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'form',
title: '编辑',
url: top.$.rootUrl + url + '?keyValue=' + keyValue + '&ptype=' + ptype,
width: 800,
height: 600,
callBack: function (id) {
return top[id].save('', refreshGirdData());
}
});
}
});
// 删除
$('#lr_delete').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('PId');
var status = $('#gridtable').jfGridValue('PStatus');
if (status != 0) {
learun.alert.warning("当前项目已提交,不可删除!");
return;
}
if (learun.checkrow(keyValue)) {
learun.layerConfirm('是否确认删除该项!', function (res) {
if (res) {
learun.deleteForm(top.$.rootUrl + '/ReceiveSendFeeManagement/FD_PayManage/DeleteForm', { keyValue: keyValue }, function () {
refreshGirdData();
});
}
});
}
});
// 打印
$('#lr_print').on('click', function () {
//$('#gridtable').jqprintTable();
var keyValue = $('#gridtable').jfGridValue('PId');
var processId = $('#gridtable').jfGridValue('PProcessId');
var status = $('#gridtable').jfGridValue('PStatus');
if (status == '0') {
learun.alert.warning("请先提交当前项目!");
return;
}
if (learun.checkrow(keyValue)) {
var type = $('#gridtable').jfGridValue('PType');
//PType 1:基本承包经费外支出--专用经费报销流程; 2:基本承包经费支出--公用经费报销流程
if (type == '1') {
//基本承包经费外支出
learun.frameTab.open({ F_ModuleId: keyValue, F_Icon: 'fa magic', F_FullName: '打印【基本承包经费外支出】', F_UrlAddress: '/ReceiveSendFeeManagement/FD_PayManage/PrintSpecial?keyValue=' + keyValue + "&processId=" + processId });
}
else {
learun.frameTab.open({ F_ModuleId: keyValue, F_Icon: 'fa magic', F_FullName: '打印【基本承包经费支出】', F_UrlAddress: '/ReceiveSendFeeManagement/FD_PayManage/PrintPublic?keyValue=' + keyValue + "&processId=" + processId });
}
}
});
// 提交
$('#lr_submit').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('PId');
if (learun.checkrow(keyValue)) {
var status = $('#gridtable').jfGridValue('PStatus');
if (status != 0) {
learun.alert.warning("当前项目已提交,请耐心等待审批!");
return;
}
var PType = $('#gridtable').jfGridValue('PType');
learun.layerConfirm('是否确认提交该项!', function (res) {
if (res) {
processId = learun.newGuid();
learun.postForm(top.$.rootUrl + '/ReceiveSendFeeManagement/FD_PayManage/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
refreshGirdData(res, {}, PType);
});
}
});
}
});
},
initTree: function () {
$('#dataTree').lrtree({
url: top.$.rootUrl + '/ReceiveSendFeeManagement/FD_PayManage/GetPTypeTree',
nodeClick: function (item) {
ptype = item.value;
url = '/ReceiveSendFeeManagement/FD_PayManage/Form';
if (ptype == '2') {
//基本承包经费外支出
url = '/ReceiveSendFeeManagement/FD_PayManage/FormPublic';
}
page.search({ PType: ptype });
}
});
},
// 初始化列表
initGird: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/ReceiveSendFeeManagement/FD_PayManage/GetPageList',
headData: [
{
label: "报销类型",
name: "PType",
width: 160,
align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('dataItem',
{
key: value,
code: 'payReimburseType',
callback: function (_data) {
callback(_data.text);
}
});
}
},
{
label: "报销部门",
name: "PDept",
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: 'PTime', width: 200, align: "left" },
{
label: "付款方式",
name: "PPayType",
width: 100,
align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('dataItem',
{
key: value,
code: 'fdPayType',
callback: function (_data) {
callback(_data.text);
}
});
}
},
{ label: "发起人", name: "PUserName", width: 100, align: "left" },
{ label: "收款单位", name: "PPayee", width: 100, align: "left" },
{ label: "开户银行", name: "PPayeeBank", width: 100, align: "left" },
{ label: "银行账号", name: "PPayeeBankAccount", width: 100, align: "left" },
{ label: "收款人", name: "PCollectionUser", width: 100, align: "left" },
{ label: "开卡银行", name: "PCollectionBank1", width: 100, align: "left" },
{ label: "卡号", name: "PCollectionBankAccount1", width: 100, align: "left" },
{ label: "开卡银行", name: "PCollectionBank2", width: 100, align: "left" },
{ label: "卡号", name: "PCollectionBankAccount2", width: 100, align: "left" },
{ label: "资金支出用途", name: "PPurpose", width: 100, align: "left" },
{
label: "资金支出来源",
name: "PTopSource",
width: 100,
align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('dataItem',
{
key: value,
code: 'fdPaySource',
callback: function (_data) {
callback(_data.text);
}
});
}
},
{
label: "财政专项名称",
name: "PIncomeId",
width: 100,
align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('custmerData', {
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'incomeList',
key: value,
keyId: 'iid',
callback: function (_data) {
callback(_data['iname']);
}
});
}
},
{ label: "支出金额", name: "PAmount", width: 100, align: "left" },
{
label: "状态", name: "PStatus", width: 100, align: "left",
formatter: function (cellvalue) {
if (cellvalue == '0') {
return '草稿';
} else if (cellvalue == '1') {
return '进行中';
} else if (cellvalue == '2') {
return '已审批';
}
}
}
],
mainId: 'PId',
isPage: true
});
page.search();
},
search: function (param) {
param = param || {};
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
},
eye: function () {
var processId = $('#gridtable').jfGridValue('PProcessId') || '';
if (learun.checkrow(processId)) {
learun.frameTab.open({ F_ModuleId: 'monitor' + processId, F_FullName: '查看【支出预算】', F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/MonitorDetailsIndex?processId=' + processId });
}
}
};
//refreshGirdData = function () {
// $('#gridtable').jfGridSet('reload');
//};
refreshGirdData = function (res, postData, PType) {
if (res && res.code && res.code == 200) {
// 发起流程
var schemeCode = '';
//PType 1:基本承包经费外支出--专用经费报销流程; 2:基本承包经费支出--公用经费报销流程
if (PType == '1')
schemeCode = 'specialUseFunds';
else
schemeCode = 'publicFunds';
if (schemeCode) {
var postData = {
schemeCode: schemeCode,// 填写流程对应模板编号
processId: processId,
level: '1',
};
learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
learun.loading(false);
});
}
}
page.search();
};
page.init();
}