diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/Ass_AcceptanceController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/Ass_AcceptanceController.cs index 2f67d13be..6a6878213 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/Ass_AcceptanceController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/Ass_AcceptanceController.cs @@ -61,6 +61,16 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers { return View(); } + /// + /// 表单页 + /// + /// + [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); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.js index 8813d610a..269a2d086 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.js @@ -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()) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.cshtml new file mode 100644 index 000000000..ce7e3e6b0 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.cshtml @@ -0,0 +1,34 @@ +@{ + ViewBag.Title = "采购申请"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + +
+
+
申请单号
+ +
+
+
申请名称
+ +
+ +
+
总价
+ +
+
+
申请时间
+ +
+
+
申请人
+ +
+
+
+
+
+@Html.AppendJsFile("/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.js new file mode 100644 index 000000000..f2672480e --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/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 '审批中'; + // } else if (cellvalue === '2') { + // return '已审核'; + // } else { + // return '草稿'; + // } + // } + //}, + { 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(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Index.js index 69739a218..cf83fb196 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Index.js @@ -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) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 41dfb570c..e91548038 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -852,6 +852,7 @@ + @@ -7345,6 +7346,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_Acceptance/Ass_AcceptanceService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_Acceptance/Ass_AcceptanceService.cs index 4634fd4d7..0d602d828 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_Acceptance/Ass_AcceptanceService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_Acceptance/Ass_AcceptanceService.cs @@ -232,17 +232,14 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem { try { - if (p1 == 2) - { - var entity = this.BaseRepository() - .FindEntity(a => a.ProcessId == parameterProcessId); - if (null != entity) - { - entity.Status = p1.ToString(); - } - - this.BaseRepository().Update(entity); + var entity = this.BaseRepository() + .FindEntity(a => a.ProcessId == parameterProcessId); + if (null != entity) + { + entity.Status = p1.ToString(); } + + this.BaseRepository().Update(entity); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainService.cs index 0f188278f..baa82d7f8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainService.cs @@ -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(strSql.ToString(),dp, pagination); + return this.BaseRepository().FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) { @@ -97,7 +97,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem { try { - return this.BaseRepository().FindEntity(t=>t.ProcessId == processId); + return this.BaseRepository().FindEntity(t => t.ProcessId == processId); } catch (Exception ex) { @@ -124,7 +124,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem { try { - this.BaseRepository().Delete(t=>t.Id == keyValue); + this.BaseRepository().Delete(t => t.Id == keyValue); } catch (Exception ex) { @@ -155,7 +155,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem entity.Modify(keyValue); db.Update(entity); db.Delete(t => t.MainId == keyValue); - + } else { @@ -202,17 +202,14 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem { try { - if (p1 == 2) - { - var entity = this.BaseRepository() - .FindEntity(a => a.ProcessId == parameterProcessId); - if (null != entity) - { - entity.Status = p1; - } - - this.BaseRepository().Update(entity); + var entity = this.BaseRepository() + .FindEntity(a => a.ProcessId == parameterProcessId); + if (null != entity) + { + entity.Status = p1; } + + this.BaseRepository().Update(entity); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/Ass_AcceptanceMethod.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/Ass_AcceptanceMethod.cs index 3624ca804..96872bec7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/Ass_AcceptanceMethod.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/Ass_AcceptanceMethod.cs @@ -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); } } }