@@ -61,6 +61,16 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单页 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult FormView() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
@@ -113,10 +123,12 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers | |||
[AjaxOnly] | |||
public ActionResult GetFormDataByProcessId(string processId) | |||
{ | |||
var Ass_AcceptanceData = ass_AcceptanceIBLL.GetEntityByProcessId(processId); | |||
var Ass_AcceptanceMainData = ass_AcceptanceMainIBLL.GetEntityByProcessId(processId); | |||
var Ass_AcceptanceData = ass_AcceptanceIBLL.GetAss_AcceptanceListByMainId(Ass_AcceptanceMainData.Id); | |||
var jsonData = new | |||
{ | |||
Ass_Acceptance = Ass_AcceptanceData, | |||
Ass_AcceptanceMain = Ass_AcceptanceMainData, | |||
Ass_Acceptance = Ass_AcceptanceData | |||
}; | |||
return Success(jsonData); | |||
} | |||
@@ -203,23 +203,23 @@ var bootstrap = function ($, learun) { | |||
return 1;//a.AAIOrder - b.AAIOrder; | |||
} | |||
// 设置表单数据 | |||
setFormData = function (processId) { | |||
if (!!processId) { | |||
$.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoApply/GetFormDataByProcessId?processId=' + processId, function (data) { | |||
for (var id in data) { | |||
if (!!data[id] && data[id].length > 0) { | |||
$('#' + id).jfGridSet('refreshdata', data[id]); | |||
} | |||
else { | |||
if (id == 'Ass_AcceptanceMain') { | |||
keyValue = data[id].Id; | |||
} | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
//setFormData = function (processId) { | |||
// if (!!processId) { | |||
// $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoApply/GetFormDataByProcessId?processId=' + processId, function (data) { | |||
// for (var id in data) { | |||
// if (!!data[id] && data[id].length > 0) { | |||
// $('#' + id).jfGridSet('refreshdata', data[id]); | |||
// } | |||
// else { | |||
// if (id == 'Ass_AcceptanceMain') { | |||
// keyValue = data[id].Id; | |||
// } | |||
// $('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
// } | |||
// } | |||
// }); | |||
// } | |||
//} | |||
// 验证数据是否填写完整 | |||
validForm = function () { | |||
if (!$('.lr-form-wrap').lrValidform()) { | |||
@@ -0,0 +1,34 @@ | |||
@{ | |||
ViewBag.Title = "采购申请"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<script> | |||
var NewCode = "@ViewBag.Code"; | |||
</script> | |||
<div class="lr-form-wrap"> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_AcceptanceMain"> | |||
<div class="lr-form-item-title">申请单号</div> | |||
<input id="Code" type="text" class="form-control" readonly="readonly" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_AcceptanceMain"> | |||
<div class="lr-form-item-title">申请名称</div> | |||
<input id="Name" type="text" class="form-control" readonly/> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_AcceptanceMain"> | |||
<div class="lr-form-item-title">总价</div> | |||
<input id="TotalPrice" type="text" class="form-control" readonly="readonly" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_AcceptanceMain"> | |||
<div class="lr-form-item-title">申请时间</div> | |||
<input id="CreateTime" type="text" readonly class="form-control currentInfo lr-currentInfo-time" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_AcceptanceMain"> | |||
<div class="lr-form-item-title">申请人</div> | |||
<input id="CreateUserId" type="text" readonly class="form-control currentInfo lr-currentInfo-user" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item lr-form-item-grid"> | |||
<div id="Ass_Acceptance"></div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.js") |
@@ -0,0 +1,261 @@ | |||
/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) | |||
* Copyright (c) 2013-2018 北京泉江科技有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2019-03-25 12:00 | |||
* 描 述:入库申请 | |||
*/ | |||
var acceptClick; | |||
var keyValue = request('keyValue'); | |||
// 设置权限 | |||
var setAuthorize; | |||
// 设置表单数据 | |||
var setFormData; | |||
// 验证数据是否填写完整 | |||
var validForm; | |||
// 保存数据 | |||
var save; | |||
var refreshGirdData; | |||
var selectedRow; | |||
var tempdatra = new Array(); | |||
//总价计算 | |||
var pricecount = 0; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
// 设置权限 | |||
setAuthorize = function (data) { | |||
if (!!data) { | |||
for (var field in data) { | |||
if (data[field].isLook != 1) {// 如果没有查看权限就直接移除 | |||
$('#' + data[field].fieldId).parent().remove(); | |||
} | |||
else { | |||
if (data[field].isEdit != 1) { | |||
$('#' + data[field].fieldId).attr('disabled', 'disabled'); | |||
if ($('#' + data[field].fieldId).hasClass('lrUploader-wrap')) { | |||
$('#' + data[field].fieldId).css({ 'padding-right': '58px' }); | |||
$('#' + data[field].fieldId).find('.btn-success').remove(); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
}; | |||
var page = { | |||
init: function () { | |||
$('.lr-form-wrap').lrscroll(); | |||
$("#detailadd").on('click', function () { | |||
selectedRow = null; | |||
learun.layerForm({ | |||
id: 'formitem', | |||
title: '新增明细', | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/FormItem', | |||
width: 860, | |||
height: 600, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
}); | |||
$("#detailedit").on('click', function () { | |||
var keyValue = $('#Ass_Acceptance').jfGridValue('Id'); | |||
selectedRow = $('#Ass_Acceptance').jfGridGet('rowdata'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'formitem', | |||
title: '编辑明细', | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/FormItem?keyValue=' + keyValue, | |||
width: 860, | |||
height: 600, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
} | |||
}); | |||
$("#detaildel").on('click', function () { | |||
var keyValue = $('#Ass_Acceptance').jfGridValue('Id'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res, index) { | |||
if (res) { | |||
$.each(tempdatra, function (key, val) { | |||
if (tempdatra[key].MainId === keyValue) { | |||
pricecount -= tempdatra[key].TotalPrice; | |||
tempdatra.splice(key, 1); | |||
} | |||
}); | |||
$("#Price").val(pricecount); | |||
$('#Ass_Acceptance').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); | |||
top.layer.close(index); | |||
} | |||
}); | |||
} | |||
}); | |||
page.bind(); | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
$('#CreateTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')); | |||
$('#CreateUserId')[0].lrvalue = learun.clientdata.get(['userinfo']).userId; | |||
$('#CreateUserId').val(learun.clientdata.get(['userinfo']).realName); | |||
//$('#CreateDeptId').lrselect({ | |||
// type: 'tree', | |||
// // 展开最大高度 | |||
// maxHeight: 200, | |||
// // 是否允许搜索 | |||
// allowSearch: true, | |||
// // 访问数据接口地址 | |||
// url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree' | |||
//}); | |||
$('#Ass_Acceptance').jfGrid({ | |||
headData: [ | |||
{ label: "设备名称", name: "Name", width: 100, align: "left" }, | |||
{ label: "品牌", name: "Manufacturer", width: 100, align: "left" }, | |||
{ label: "规格型号", name: "Model", width: 100, align: "left" }, | |||
{ label: "单位", name: "Unit", width: 100, align: "left" }, | |||
{ label: "数量", name: "Stock", width: 100, align: "left" }, | |||
{ label: "单价", name: "Price", width: 100, align: "left" }, | |||
{ label: "总价", name: "TotalPrice", width: 100, align: "left" }, | |||
{ | |||
label: "使用部门", name: "DepartmentId", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('department', { | |||
key: value, | |||
callback: function (_data) { | |||
callback(_data.name); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "使用人", name: "UserID", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsyncReal('user', { | |||
key: value, | |||
callback: function (_data) { | |||
callback(_data.name); | |||
} | |||
}); | |||
} | |||
}, | |||
{ label: "放置地点", name: "Place", width: 100, align: "left" }, | |||
//{ | |||
// 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" }, | |||
], | |||
height: 400, | |||
mainId: 'Id', | |||
reloadSelected: false, | |||
}); | |||
}, | |||
initData: function () { | |||
if (!!keyValue) { | |||
$.lrSetForm( | |||
top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetFormData?keyValue=' + keyValue, | |||
function (data) { | |||
for (var id in data) { | |||
if (!!data[id].length && data[id].length > 0) { | |||
$('#' + id).jfGridSet('refreshdata', data[id]); | |||
tempdatra = data[id]; | |||
} else { | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
if (data[id].TotalPrice) { | |||
pricecount = data[id].TotalPrice; | |||
} | |||
} | |||
} | |||
}); | |||
} else { | |||
$("#Code").val(NewCode); | |||
} | |||
} | |||
}; | |||
// 设置表单数据 | |||
setFormData = function(processId, param, callback) { | |||
if (!!processId) { | |||
$.lrSetForm( | |||
top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetFormDataByProcessId?processId=' + processId, | |||
function(data) { | |||
for (var id in data) { | |||
if (!!data[id] && data[id].length > 0) { | |||
$('#' + id).jfGridSet('refreshdata', data[id]); | |||
} else { | |||
if (id == 'Ass_AcceptanceMain' && data[id]) { | |||
keyValue = data[id].Id; | |||
} | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
} | |||
} | |||
}); | |||
} | |||
callback && callback(); | |||
}; | |||
refreshGirdData = function (temprow) { | |||
var ifnewrow = true; | |||
$.each(tempdatra, function (key, val) { | |||
if (tempdatra[key].MainId === temprow.Id) { | |||
tempdatra[key] = temprow; | |||
ifnewrow = false; | |||
} | |||
}); | |||
if (ifnewrow) { | |||
tempdatra.push(temprow); | |||
} | |||
//总价计算 | |||
pricecount = 0; | |||
for (var i = 0; i < tempdatra.length; i++) { | |||
pricecount = parseFloat(pricecount) +parseFloat(tempdatra[i].TotalPrice); | |||
} | |||
$("#TotalPrice").val(pricecount); | |||
$('#Ass_Acceptance').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); | |||
}; | |||
function sortNumber(a, b) { | |||
return 1;//a.AAIOrder - b.AAIOrder; | |||
} | |||
// 验证数据是否填写完整 | |||
validForm = function () { | |||
if (!$('.lr-form-wrap').lrValidform()) { | |||
return false; | |||
} | |||
var datas = $('#Ass_Acceptance').jfGridGet('rowdatas'); | |||
if (datas == null || datas.length == 0) { | |||
learun.alert.warning("申请未包含明细!请先新增明细!"); | |||
return false; | |||
} | |||
return true; | |||
}; | |||
// 保存数据 | |||
save = function (processId, callBack, i) { | |||
var res = { | |||
code: 200 | |||
}; | |||
if (!!callBack) { | |||
callBack(res, {}, i); | |||
} | |||
//var postData = {}; | |||
//var formData = $('[data-table="Ass_AcceptanceMain"]').lrGetFormData(); | |||
//if (!!processId) { | |||
// formData.ProcessId = processId; | |||
//} | |||
//postData.strEntity = JSON.stringify(formData); | |||
//postData.strass_Ass_AcceptanceList = JSON.stringify($('#Ass_Acceptance').jfGridGet('rowdatas')); | |||
//$.lrSaveForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// // 保存成功后才回调 | |||
// if (!!callBack) { | |||
// callBack(res, formData, i); | |||
// } | |||
//}); | |||
}; | |||
page.init(); | |||
} |
@@ -77,14 +77,14 @@ var bootstrap = function ($, learun) { | |||
// 查看 | |||
$('#lr_view').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
var keyValue = $('#gridtable').jfGridValue('Id'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '查看', | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/ViewForm?keyValue=' + keyValue, | |||
width: 600, | |||
height: 400, | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/FormView?keyValue=' + keyValue, | |||
width: 1000, | |||
height: 700, | |||
btn: null | |||
}); | |||
} | |||
@@ -115,7 +115,7 @@ var bootstrap = function ($, learun) { | |||
// 提交 | |||
$('#lr_submit').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
var keyValue = $('#gridtable').jfGridValue('Id'); | |||
if (learun.checkrow(keyValue)) { | |||
var SendFlag = $('#gridtable').jfGridValue('Status'); | |||
if (SendFlag != 0) { | |||
@@ -852,6 +852,7 @@ | |||
<Content Include="Areas\AssetManagementSystem\Views\AssScrap\Form.js" /> | |||
<Content Include="Areas\AssetManagementSystem\Views\AssScrap\FormView.js" /> | |||
<Content Include="Areas\AssetManagementSystem\Views\AssScrap\Index.js" /> | |||
<Content Include="Areas\AssetManagementSystem\Views\Ass_Acceptance\FormView.js" /> | |||
<Content Include="Areas\AssetManagementSystem\Views\Ass_Acceptance\Form.js" /> | |||
<Content Include="Areas\AssetManagementSystem\Views\Ass_Acceptance\ViewForm.js" /> | |||
<Content Include="Areas\AssetManagementSystem\Views\Ass_AllocationItem\Form.js" /> | |||
@@ -7345,6 +7346,7 @@ | |||
<Content Include="Areas\AssetManagementSystem\Views\Ass_AssetsInfoItemApply\FormJYHC.cshtml" /> | |||
<Content Include="Areas\AssetManagementSystem\Views\Ass_AssetsInfoApply\FormViewJYHC.cshtml" /> | |||
<Content Include="Areas\AssetManagementSystem\Views\Ass_Acceptance\Form.cshtml" /> | |||
<Content Include="Areas\AssetManagementSystem\Views\Ass_Acceptance\FormView.cshtml" /> | |||
<None Include="Areas\EducationalAdministration\Views\SchoolNews\Index.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuEnroll\StuTuition.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuEnroll\IsHelpForm.cshtml" /> | |||
@@ -232,17 +232,14 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
{ | |||
try | |||
{ | |||
if (p1 == 2) | |||
{ | |||
var entity = this.BaseRepository() | |||
.FindEntity<Ass_AcceptanceEntity>(a => a.ProcessId == parameterProcessId); | |||
if (null != entity) | |||
{ | |||
entity.Status = p1.ToString(); | |||
} | |||
this.BaseRepository().Update(entity); | |||
var entity = this.BaseRepository() | |||
.FindEntity<Ass_AcceptanceEntity>(a => a.ProcessId == parameterProcessId); | |||
if (null != entity) | |||
{ | |||
entity.Status = p1.ToString(); | |||
} | |||
this.BaseRepository().Update(entity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -49,7 +49,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
dp.Add("CreateUserId", "%" + queryParam["CreateUserId"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.CreateUserId=@CreateUserId "); | |||
} | |||
return this.BaseRepository().FindList<Ass_AcceptanceMainEntity>(strSql.ToString(),dp, pagination); | |||
return this.BaseRepository().FindList<Ass_AcceptanceMainEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -97,7 +97,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository().FindEntity<Ass_AcceptanceMainEntity>(t=>t.ProcessId == processId); | |||
return this.BaseRepository().FindEntity<Ass_AcceptanceMainEntity>(t => t.ProcessId == processId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -124,7 +124,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
{ | |||
try | |||
{ | |||
this.BaseRepository().Delete<Ass_AcceptanceMainEntity>(t=>t.Id == keyValue); | |||
this.BaseRepository().Delete<Ass_AcceptanceMainEntity>(t => t.Id == keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -155,7 +155,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
entity.Modify(keyValue); | |||
db.Update(entity); | |||
db.Delete<Ass_AcceptanceEntity>(t => t.MainId == keyValue); | |||
} | |||
else | |||
{ | |||
@@ -202,17 +202,14 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
{ | |||
try | |||
{ | |||
if (p1 == 2) | |||
{ | |||
var entity = this.BaseRepository() | |||
.FindEntity<Ass_AcceptanceMainEntity>(a => a.ProcessId == parameterProcessId); | |||
if (null != entity) | |||
{ | |||
entity.Status = p1; | |||
} | |||
this.BaseRepository().Update(entity); | |||
var entity = this.BaseRepository() | |||
.FindEntity<Ass_AcceptanceMainEntity>(a => a.ProcessId == parameterProcessId); | |||
if (null != entity) | |||
{ | |||
entity.Status = p1; | |||
} | |||
this.BaseRepository().Update(entity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -9,18 +9,18 @@ namespace Learun.Application.WorkFlow | |||
{ | |||
public class Ass_AcceptanceMethod : IWorkFlowMethod | |||
{ | |||
Ass_AcceptanceIBLL ass_AcceptanceIBLL = new Ass_AcceptanceBLL(); | |||
Ass_AcceptanceMainIBLL ass_AcceptanceMainIBLL = new Ass_AcceptanceMainBLL(); | |||
public void Execute(WfMethodParameter parameter) | |||
{ | |||
if (parameter.code == "agree") | |||
{ | |||
ass_AcceptanceIBLL.ChangeStatusByProcessId(parameter.processId, 2); | |||
ass_AcceptanceMainIBLL.ChangeStatusByProcessId(parameter.processId, 2); | |||
} | |||
else | |||
{ | |||
ass_AcceptanceIBLL.ChangeStatusByProcessId(parameter.processId, 0); | |||
ass_AcceptanceMainIBLL.ChangeStatusByProcessId(parameter.processId, 0); | |||
} | |||
} | |||
} | |||