@@ -58,6 +58,7 @@ var bootstrap = function ($, learun) {
$('#CardStatus').lrDataItemSelect({ code: 'CardStatus' });
$('#StorageId').lrDataSourceSelect({ code: 'Ass_StorageData', value: 'sid', text: 'sname' });
$('#DepreciationStatus').lrDataItemSelect({ code: 'DepreciationStatus' });
$('#Status').lrselect({ data: [{ id: "0", text: "未审核" }, { id: "2", text: "已审核" }] });
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
@@ -88,9 +89,13 @@ var bootstrap = function ($, learun) {
$('#lr_edit').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('FAId');
if (learun.checkrow(keyValue)) {
if (keyValue.indexOf(",") != -1) {
learun.alert.warning("只能选择一条记录进行编辑!");
return false;
}
var Status = $('#gridtable').jfGridValue('Status');
if (Status !== 0) {
learun.alert.warning("当前项目已提交不能编辑!");
if (Status == 2 ) {
learun.alert.warning("当前项目已审核 不能编辑!");
return;
}
learun.layerForm({
@@ -119,8 +124,12 @@ var bootstrap = function ($, learun) {
var keyValue = $('#gridtable').jfGridValue('FAId');
if (learun.checkrow(keyValue)) {
var Status = $('#gridtable').jfGridValue('Status');
if (Status !== 0) {
learun.alert.warning("当前项目已提交不能删除!");
//if (Status !== 0) {
// learun.alert.warning("当前项目已提交不能删除!");
// return;
//}
if (Status.indexOf('2') != -1) {
learun.alert.warning("选中记录中包含已审核项目,不能删除!");
return;
}
learun.layerConfirm('是否确认删除该项!', function (res) {
@@ -132,62 +141,113 @@ var bootstrap = function ($, learun) {
});
}
});
// 查看
$('#lr_view').on('click', function () {
//审核
$('#lr_check').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('FAId');
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'formAss_FixAssets',
title: '查看固定资产',
url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/FormView?keyValue=' + keyValue,
width: 1000,
height: 800,
btn: null
var Status = $('#gridtable').jfGridValue('Status');
if (Status.indexOf('2') != -1) {
learun.alert.warning("选中记录中包含已审核项目!");
return;
}
learun.layerConfirm('是否确认审核该项!', function (res) {
if (res) {
learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/Lock', { keyValue: keyValue, status: 2 }, function () {
page.search();
});
}
});
}
});
// 提交
$('#lr_submit').on('click', function () {
//取消审核
$('#lr_cancelCheck').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('FAId');
if (learun.checkrow(keyValue)) {
var Status = $('#gridtable').jfGridValue('Status');
if (Status !== 0 ) {
learun.alert.warning("当前项目已提交,请耐心等待审批 !");
if (Status.indexOf('0') != -1 ) {
learun.alert.warning("选中记录中包含未审核项目 !");
return;
}
learun.layerConfirm('是否确认提交 该项!', function (res) {
learun.layerConfirm('是否确认取消审核 该项!', function (res) {
if (res) {
processId = learun.newGuid();
learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/ChangeStatusById', { keyValue: keyValue, status: 1, processId: processId }, function (res) {
refreshGirdData(res, {});
learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/Lock', { keyValue: keyValue, status: 0 }, function () {
page.search();
});
}
});
}
});
///上传
$('#lr_import').on('click',
function () {
// 查看
$('#lr_view').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('FAId');
if (learun.checkrow(keyValue)) {
if (keyValue.indexOf(",") != -1) {
learun.alert.warning("只能选择一条记录进行查看!");
return false;
}
learun.layerForm({
id: 'form',
title: '导入',
url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/ImportForm',
width: 600,
height: 400,
btn: null,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
id: 'formAss_FixAssets',
title: '查看固定资产',
url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/FormView?keyValue=' + keyValue,
width: 1000,
height: 800,
btn: null
});
}
});
// 提交
//$('#lr_submit').on('click', function () {
// var keyValue = $('#gridtable').jfGridValue('FAId');
// if (learun.checkrow(keyValue)) {
// var Status = $('#gridtable').jfGridValue('Status');
// if (Status !== 0) {
// learun.alert.warning("当前项目已提交,请耐心等待审批!");
// return;
// }
// learun.layerConfirm('是否确认提交该项!', function (res) {
// if (res) {
// processId = learun.newGuid();
// learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/ChangeStatusById', { keyValue: keyValue, status: 1, processId: processId }, function (res) {
// refreshGirdData(res, {});
// });
// }
// });
// }
//});
///上传
$('#lr_import').on('click', function () {
learun.layerForm({
id: 'form',
title: '导入',
url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/ImportForm',
width: 600,
height: 400,
btn: null,
end: function () { page.search(); }
});
});
},
// 初始化列表
initGird: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssets/GetPageList',
headData: [
{
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 if (cellvalue === 3) {
return '<span class=\"label label-danger\">审核未通过</span>';
} else {
return '<span class=\"label label-default\" >未审核</span>';
}
}
},
{ label: "资产编号", name: "FACode", width: 100, align: "left" },
{ label: "资产名称", name: "FAName", width: 100, align: "left" },
{
@@ -390,25 +450,12 @@ var bootstrap = function ($, learun) {
});
}
},
{
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 if (cellvalue === 3) {
return '<span class=\"label label-danger\">审核未通过</span>';
} else {
return '<span class=\"label label-default\" >草稿</span>';
}
}
}
],
mainId: 'FAId',
isPage: true,
isMultiselect: true,
sidx: 'FACode,FAName',
sord:'asc'
sord: 'asc'
});
page.search();
},
@@ -417,21 +464,21 @@ var bootstrap = function ($, learun) {
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
}
};
refreshGirdData = function (res, postData) {
if (!!res) {
if (res.code == 200) {
// 发起流程
var postData = {
schemeCode: 'Ass_FixAssets',// 填写流程对应模板编号
processId: processId,
level: '1',
};
learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
learun.loading(false);
});
}
page.search();
}
};
// refreshGirdData = function (res, postData) {
// if (!!res) {
// if (res.code == 200) {
// // 发起流程
// var postData = {
// schemeCode: 'Ass_FixAssets',// 填写流程对应模板编号
// processId: processId,
// level: '1',
// };
// learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
// learun.loading(false);
// });
// }
// page.search();
// }
// };
page.init();
}