@@ -4,16 +4,27 @@ | |||
} | |||
<div class="lr-form-wrap"> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Receive"> | |||
<div class="lr-form-item-title">标题</div> | |||
<input id="RTitle" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_PurchaseApply"> | |||
<div class="lr-form-item-title">申请人</div> | |||
<div id="ReceiveUser" readonly="readonly" class="form-control" ></div> | |||
<input id="ReceiveUser" type="text" readonly class="form-control currentInfo lr-currentInfo-user" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Receive"> | |||
<div class="lr-form-item-title">申请人部门</div> | |||
<div id="PDepartment" readonly="readonly" class="form-control" ></div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_PurchaseApply"> | |||
<div class="lr-form-item-title">申请部门<font face="宋体">*</font></div> | |||
<div id="PDepartment" isvalid="yes" checkexpession="NotNull" readonly></div> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Receive"> | |||
<div class="lr-form-item-title">申请时间</div> | |||
<input id="RTime" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd',onpicked: function () { $('#RTime').trigger('change'); } })" /> | |||
<input id="RTime" type="text" readonly class="form-control currentInfo lr-currentInfo-time" /> | |||
@*<input id="RTime" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', onpicked: function() { $('#RTime').trigger('change'); } })" />*@ | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">明细操作</div> | |||
<input id="detailadd" type="button" class="btn btn-success" value="新增明细" /> | |||
@*<input id="detailedit" type="button" class="btn btn-warning" value="编辑明细" />*@ | |||
<input id="detaildel" type="button" class="btn btn-danger" value="移除明细" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item lr-form-item-grid"> | |||
<div id="Ass_ReceiveItem"></div> | |||
@@ -14,117 +14,210 @@ var setFormData; | |||
var validForm; | |||
// 保存数据 | |||
var save; | |||
var refreshGirdData; | |||
var selectedRow; | |||
var tempdatra = new Array(); | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var page = { | |||
init: function () { | |||
$('.lr-form-wrap').lrscroll(); | |||
$("#detailadd").on('click', function () { | |||
selectedRow = null; | |||
learun.layerFormForPercent({ | |||
id: 'formitem', | |||
title: '新增明细', | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/IndexTwo', | |||
width: "90%", | |||
height: "90%", | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
}); | |||
$("#detaildel").on('click', function () { | |||
var keyValue = $('#Ass_ReceiveItem').jfGridValue('RIID'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res, index) { | |||
if (res) { | |||
$.each(tempdatra, function (key, val) { | |||
if (val && val.RIID === keyValue) { | |||
tempdatra.splice(key, 1); | |||
} | |||
}); | |||
$('#Ass_ReceiveItem').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); | |||
top.layer.close(index); | |||
} | |||
}); | |||
} | |||
}); | |||
page.bind(); | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
var loginInfo = top.learun.clientdata.get(['userinfo']); | |||
$('#ReceiveUser').lrDataSourceSelect({ code: 'teacheruserdata', value: 'f_userid', text: 'f_realname' }).lrselectSet(loginInfo.userId); | |||
$('#PDepartment').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name' }).lrselectSet(loginInfo.departmentId); | |||
$('#RTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')); | |||
$('#ReceiveUser')[0].lrvalue = learun.clientdata.get(['userinfo']).userId; | |||
$('#ReceiveUser').val(learun.clientdata.get(['userinfo']).realName); | |||
$('#PDepartment').lrselect({ | |||
type: 'tree', | |||
// 展开最大高度 | |||
maxHeight: 200, | |||
// 是否允许搜索 | |||
allowSearch: true, | |||
// 访问数据接口地址 | |||
url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree' | |||
}); | |||
$('#PDepartment').lrselectSet(learun.clientdata.get(['userinfo']).departmentId); | |||
$('#Ass_ReceiveItem').jfGrid({ | |||
headData: [ | |||
{ | |||
label: "资产名称", name: "AName", width: 100, align: "left", | |||
edit: { | |||
type: 'input', | |||
init: function (row, $edit) { | |||
}, | |||
}, | |||
label: '资产编号', name: 'AAICode', width: 150, align: 'left' | |||
}, | |||
{ | |||
label: "库存数量", name: "ACNum", width: 100, align: "left", | |||
label: '资产名称', name: 'AAIName', width: 150, align: 'left' | |||
}, | |||
{ | |||
label: "领取数量", name: "ANum", width: 100, align: "left", | |||
edit: { | |||
type: 'input', | |||
inputType: 'number', | |||
label: '资产类别', name: 'AAITId', width: 150, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_AssetsType', | |||
key: value, | |||
keyId: 'atid', | |||
callback: function (_data) { | |||
callback(_data['aname']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "资产编号", name: "AID", width: 100, align: "left", | |||
edit: { | |||
type: 'input', | |||
label: '单价', name: 'AAIPrice', width: 100, align: 'left' | |||
}, | |||
{ | |||
label: '单位', name: 'AAIUnit', width: 80, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('dataItem', { | |||
key: value, | |||
code: 'sldw', | |||
callback: function (_data) { | |||
callback(_data.text); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: '英文名称', name: 'AAIEName', width: 100, align: 'left' | |||
}, | |||
{ | |||
label: '资产型号', name: 'AAIModel', width: 100, align: 'left' | |||
}, | |||
{ | |||
label: '生产厂家', name: 'AAIManufacturer', width: 100, align: 'left' | |||
} | |||
], | |||
height: 400, | |||
mainId: 'RIID', | |||
isEdit: true, | |||
reloadSelected: false | |||
}); | |||
//$('#ReceiveUser').lrDataSourceSelect({ code: 'teacheruserdata', value: 'f_userid', text: 'f_realname' }).lrselectSet(loginInfo.userId); | |||
//$('#PDepartment').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name' }).lrselectSet(loginInfo.departmentId); | |||
$('#Ass_ReceiveItem').on('click', function (e) { | |||
var et = e.target || e.srcElement; | |||
var $et = $(et); | |||
if ($et.attr('rowindex') && $et.attr('rownum') && $et.attr('colname') == 'AName') { | |||
var $input = $('#jfgrid_edit_Ass_ReceiveItem_AName'); | |||
$input.removeClass('lr-layerselect').removeAttr('lrlayerselect').unbind('click')[0].dfop = null; | |||
//$('#Ass_ReceiveItem').jfGrid({ | |||
// headData: [ | |||
// { | |||
// label: "资产名称", name: "AName", width: 100, align: "left", | |||
// edit: { | |||
// type: 'input', | |||
// init: function (row, $edit) { | |||
// }, | |||
// }, | |||
$input.lrlayerselect({ | |||
treeUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsType/GetAllTree', | |||
treeParentId: 'atptid', | |||
treeValueId: 'atid', | |||
treeTextId: 'aname', | |||
dataUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetList', | |||
dataTreeId: 'ATId', | |||
dataValueId: 'AId', | |||
dataTextId: 'AName', | |||
// }, | |||
// { | |||
// label: "库存数量", name: "ACNum", width: 100, align: "left", | |||
// }, | |||
// { | |||
// label: "领取数量", name: "ANum", width: 100, align: "left", | |||
// edit: { | |||
// type: 'input', | |||
// inputType: 'number', | |||
// } | |||
// }, | |||
// { | |||
// label: "资产编号", name: "AID", width: 100, align: "left", | |||
// edit: { | |||
// type: 'input', | |||
// } | |||
// }, | |||
// ], | |||
// mainId: 'RIID', | |||
// isEdit: true, | |||
//}); | |||
//$('#Ass_ReceiveItem').on('click', function (e) { | |||
// var et = e.target || e.srcElement; | |||
// var $et = $(et); | |||
// if ($et.attr('rowindex') && $et.attr('rownum') && $et.attr('colname') == 'AName') { | |||
// var $input = $('#jfgrid_edit_Ass_ReceiveItem_AName'); | |||
// $input.removeClass('lr-layerselect').removeAttr('lrlayerselect').unbind('click')[0].dfop = null; | |||
grid: [ | |||
{ label: '资产编号', name: 'ACode', width: 200, align: 'left' }, | |||
{ label: '资产名称', name: 'AName', width: 200, align: 'left' }, | |||
{ label: "英文名称", name: "AEName", width: 200, align: "left" }, | |||
{ label: "资产型号", name: "AModel", width: 200, align: "left" }, | |||
{ label: "生产厂家", name: "AManufacturer", width: 200, align: "left" }, | |||
{ | |||
label: "供应商", name: "ASupplierId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_SupplierData', | |||
key: value, | |||
keyId: 'sid', | |||
callback: function (_data) { | |||
callback(_data['sname']); | |||
} | |||
}); | |||
} | |||
} | |||
], | |||
select: function (values, texts) { | |||
if (values && values.length > 0) { | |||
// $input.lrlayerselect({ | |||
// treeUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsType/GetAllTree', | |||
// treeParentId: 'atptid', | |||
// treeValueId: 'atid', | |||
// treeTextId: 'aname', | |||
// dataUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetList', | |||
// dataTreeId: 'ATId', | |||
// dataValueId: 'AId', | |||
// dataTextId: 'AName', | |||
$.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetFormData?keyValue=' + values[0], function (data) { | |||
data = data.Ass_AssetsInfo; | |||
var rowIndex = $et.attr('rowindex'); | |||
$input.val(data.AName); | |||
//$('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['AName'] = data.AName; | |||
//$('.jfgrid-data-cell[colname="AName"][rowIndex="' + rowIndex + '"]').attr('title', data.AName).html(data.AName); | |||
$input.trigger('propertychange'); | |||
// grid: [ | |||
// { label: '资产编号', name: 'ACode', width: 200, align: 'left' }, | |||
// { label: '资产名称', name: 'AName', width: 200, align: 'left' }, | |||
// { label: "英文名称", name: "AEName", width: 200, align: "left" }, | |||
// { label: "资产型号", name: "AModel", width: 200, align: "left" }, | |||
// { label: "生产厂家", name: "AManufacturer", width: 200, align: "left" }, | |||
// { | |||
// label: "供应商", name: "ASupplierId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { | |||
// learun.clientdata.getAsync('custmerData', { | |||
// url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_SupplierData', | |||
// key: value, | |||
// keyId: 'sid', | |||
// callback: function (_data) { | |||
// callback(_data['sname']); | |||
// } | |||
// }); | |||
// } | |||
// } | |||
// ], | |||
// select: function (values, texts) { | |||
// if (values && values.length > 0) { | |||
$('jfgrid_edit_Ass_ReceiveItem_' + 'ANum').val(0); | |||
$('.jfgrid-data-cell[colname="ANum"][rowIndex="' + rowIndex + '"]').attr('title', data.AId).html(0); | |||
$('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['ANum'] = 0; | |||
// $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetFormData?keyValue=' + values[0], function (data) { | |||
// data = data.Ass_AssetsInfo; | |||
// var rowIndex = $et.attr('rowindex'); | |||
// $input.val(data.AName); | |||
// $input.trigger('propertychange'); | |||
$('jfgrid_edit_Ass_ReceiveItem_' + 'AID').val(data.AId); | |||
$('.jfgrid-data-cell[colname="AID"][rowIndex="' + rowIndex + '"]').attr('title', data.AId).html(data.AId); | |||
$('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['AID'] = data.AId; | |||
// $('jfgrid_edit_Ass_ReceiveItem_' + 'ANum').val(0); | |||
// $('.jfgrid-data-cell[colname="ANum"][rowIndex="' + rowIndex + '"]').attr('title', data.AId).html(0); | |||
// $('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['ANum'] = 0; | |||
$('jfgrid_edit_Ass_ReceiveItem_' + 'ACNum').val(data.AId); | |||
$('.jfgrid-data-cell[colname="ACNum"][rowIndex="' + rowIndex + '"]').attr('title', data.AStock).html(data.AStock); | |||
$('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['ACNum'] = data.AStock; | |||
// $('jfgrid_edit_Ass_ReceiveItem_' + 'AID').val(data.AId); | |||
// $('.jfgrid-data-cell[colname="AID"][rowIndex="' + rowIndex + '"]').attr('title', data.AId).html(data.AId); | |||
// $('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['AID'] = data.AId; | |||
}); | |||
} | |||
}, | |||
isMultiple: false | |||
}); | |||
} | |||
}) | |||
// $('jfgrid_edit_Ass_ReceiveItem_' + 'ACNum').val(data.AId); | |||
// $('.jfgrid-data-cell[colname="ACNum"][rowIndex="' + rowIndex + '"]').attr('title', data.AStock).html(data.AStock); | |||
// $('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['ACNum'] = data.AStock; | |||
// }); | |||
// } | |||
// }, | |||
// isMultiple: false | |||
// }); | |||
// } | |||
//}) | |||
}, | |||
initData: function () { | |||
if (!!keyValue) { | |||
@@ -132,6 +225,7 @@ var bootstrap = function ($, learun) { | |||
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]); | |||
@@ -167,6 +261,47 @@ var bootstrap = function ($, learun) { | |||
} | |||
return true; | |||
}; | |||
refreshGirdData = function (temprow) { | |||
var ifnewrow = true; | |||
var list = []; | |||
$.each(temprow, | |||
function (i, item) { | |||
var entity = { | |||
//AAICode: item.AICode, | |||
AAICode: item.AICodeNumJY, | |||
AAIName: item.AIASSName, | |||
AAITId: item.AIASSClass, | |||
AAIPrice: item.AIAssValue, | |||
AAIUnit: item.AIUnits, | |||
AAIEName: '', | |||
AAIModel: item.AISpecificationtype, | |||
AAIManufacturer: item.AIManufacturer, | |||
RIID: learun.newGuid() | |||
} | |||
list.push(entity); | |||
}); | |||
$.each(list, | |||
function (j, item2) { | |||
$.each(tempdatra, | |||
function (key, val) { | |||
if (tempdatra[key].AAICode === item2.AAICode) { | |||
tempdatra[key] = item2; | |||
ifnewrow = false; | |||
} | |||
}); | |||
if (ifnewrow) { | |||
tempdatra.push(item2); | |||
} | |||
}); | |||
$('#Ass_ReceiveItem').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); | |||
}; | |||
function sortNumber(a, b) { | |||
return 1;//a.AAIOrder - b.AAIOrder; | |||
}; | |||
// 保存数据 | |||
save = function (processId, callBack, i) { | |||
var formData = $('body').lrGetFormData(); | |||
@@ -176,21 +311,21 @@ var bootstrap = function ($, learun) { | |||
var postData = { | |||
strEntity: JSON.stringify($('[data-table="Ass_Receive"]').lrGetFormData()), | |||
}; | |||
var itemList = $('#Ass_ReceiveItem').jfGridGet('rowdatas'); | |||
var num = 0; | |||
$.each(itemList, function (i, item) { | |||
if (item.ANum <= 0) { | |||
learun.alert.warning("请填写<" + item.AName + ">的申请数量"); | |||
num++; | |||
} | |||
if (item.ANum > item.ACNum) { | |||
learun.alert.warning("领取数量不能大于库存数量!"); | |||
num++; | |||
} | |||
}) | |||
if (num > 0) { | |||
return; | |||
} | |||
//var itemList = $('#Ass_ReceiveItem').jfGridGet('rowdatas'); | |||
//var num = 0; | |||
//$.each(itemList, function (i, item) { | |||
// if (item.ANum <= 0) { | |||
// learun.alert.warning("请填写<" + item.AName + ">的申请数量"); | |||
// num++; | |||
// } | |||
// if (item.ANum > item.ACNum) { | |||
// learun.alert.warning("领取数量不能大于库存数量!"); | |||
// num++; | |||
// } | |||
//}) | |||
//if (num > 0) { | |||
// return; | |||
//} | |||
postData.receItemList = JSON.stringify($('#Ass_ReceiveItem').jfGridGet('rowdatas')); | |||
$.lrSaveForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
@@ -4,16 +4,21 @@ | |||
} | |||
<div class="lr-form-wrap"> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Receive"> | |||
<div class="lr-form-item-title">标题</div> | |||
<input id="RTitle" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_PurchaseApply"> | |||
<div class="lr-form-item-title">申请人</div> | |||
<div id="ReceiveUser" readonly="readonly" class="form-control" ></div> | |||
<input id="ReceiveUser" type="text" readonly class="form-control currentInfo lr-currentInfo-user" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Receive"> | |||
<div class="lr-form-item-title">申请人部门</div> | |||
<div id="PDepartment" readonly="readonly" class="form-control" ></div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_PurchaseApply"> | |||
<div class="lr-form-item-title">申请部门<font face="宋体">*</font></div> | |||
<div id="PDepartment" isvalid="yes" checkexpession="NotNull" readonly></div> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Receive"> | |||
<div class="lr-form-item-title">申请时间</div> | |||
<input id="RTime" type="text" class="form-control lr-input-wdatepicker" readonly="readonly" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd',onpicked: function () { $('#RTime').trigger('change'); } })" /> | |||
<input id="RTime" type="text" readonly class="form-control currentInfo lr-currentInfo-time" /> | |||
@*<input id="RTime" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', onpicked: function() { $('#RTime').trigger('change'); } })" />*@ | |||
</div> | |||
<div class="col-xs-12 lr-form-item lr-form-item-grid"> | |||
<div id="Ass_ReceiveItem"></div> | |||
@@ -30,80 +30,52 @@ var bootstrap = function ($, learun) { | |||
$('#Ass_ReceiveItem').jfGrid({ | |||
headData: [ | |||
{ | |||
label: "资产名称", name: "AName", width: 100, align: "left", | |||
label: '资产编号', name: 'AAICode', width: 150, align: 'left' | |||
}, | |||
{ | |||
label: "数量", name: "ANum", width: 100, align: "left", | |||
label: '资产名称', name: 'AAIName', width: 150, align: 'left' | |||
}, | |||
{ | |||
label: "资产编号", name: "AID", width: 100, align: "left", | |||
label: '资产类别', name: 'AAITId', width: 150, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_AssetsType', | |||
key: value, | |||
keyId: 'atid', | |||
callback: function (_data) { | |||
callback(_data['aname']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: '单价', name: 'AAIPrice', width: 100, align: 'left' | |||
}, | |||
{ | |||
label: '单位', name: 'AAIUnit', width: 80, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('dataItem', { | |||
key: value, | |||
code: 'sldw', | |||
callback: function (_data) { | |||
callback(_data.text); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: '英文名称', name: 'AAIEName', width: 100, align: 'left' | |||
}, | |||
{ | |||
label: '资产型号', name: 'AAIModel', width: 100, align: 'left' | |||
}, | |||
{ | |||
label: '生产厂家', name: 'AAIManufacturer', width: 100, align: 'left' | |||
} | |||
], | |||
height: 400, | |||
mainId: 'RIID', | |||
reloadSelected: false | |||
}); | |||
$('#Ass_ReceiveItem').on('click', function (e) { | |||
var et = e.target || e.srcElement; | |||
var $et = $(et); | |||
if ($et.attr('rowindex') && $et.attr('rownum') && $et.attr('colname') == 'AName') { | |||
var $input = $('#jfgrid_edit_Ass_ReceiveItem_AName'); | |||
$input.removeClass('lr-layerselect').removeAttr('lrlayerselect').unbind('click')[0].dfop = null; | |||
$input.lrlayerselect({ | |||
treeUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsType/GetAllTree', | |||
treeParentId: 'atptid', | |||
treeValueId: 'atid', | |||
treeTextId: 'aname', | |||
dataUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetList', | |||
dataTreeId: 'ATId', | |||
dataValueId: 'AId', | |||
dataTextId: 'AName', | |||
grid: [ | |||
{ label: '资产编号', name: 'ACode', width: 200, align: 'left' }, | |||
{ label: '资产名称', name: 'AName', width: 200, align: 'left' }, | |||
{ label: "英文名称", name: "AEName", width: 200, align: "left" }, | |||
{ label: "资产型号", name: "AModel", width: 200, align: "left" }, | |||
{ label: "生产厂家", name: "AManufacturer", width: 200, align: "left" }, | |||
{ | |||
label: "供应商", name: "ASupplierId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_SupplierData', | |||
key: value, | |||
keyId: 'sid', | |||
callback: function (_data) { | |||
callback(_data['sname']); | |||
} | |||
}); | |||
} | |||
} | |||
], | |||
select: function (values, texts) { | |||
if (values && values.length > 0) { | |||
$.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetFormData?keyValue=' + values[0], function (data) { | |||
data = data.Ass_AssetsInfo; | |||
var rowIndex = $et.attr('rowindex'); | |||
$input.val(data.AName); | |||
$('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['AName'] = data.AName; | |||
$('.jfgrid-data-cell[colname="AName"][rowIndex="' + rowIndex + '"]').attr('title', data.AName).html(data.AName); | |||
$('jfgrid_edit_Ass_ReceiveItem_' + 'ANum').val(0); | |||
$('.jfgrid-data-cell[colname="ANum"][rowIndex="' + rowIndex + '"]').attr('title', data.AId).html(0); | |||
$('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['ANum'] = 0; | |||
$('jfgrid_edit_Ass_ReceiveItem_' + 'AID').val(data.AId); | |||
$('.jfgrid-data-cell[colname="AID"][rowIndex="' + rowIndex + '"]').attr('title', data.AId).html(data.AId); | |||
$('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['AID'] = data.AId; | |||
}); | |||
} | |||
}, | |||
isMultiple: false | |||
}); | |||
} | |||
}) | |||
}, | |||
initData: function () { | |||
if (!!keyValue) { | |||
@@ -148,12 +120,12 @@ var bootstrap = function ($, learun) { | |||
}; | |||
// 保存数据 | |||
save = function (processId, callBack, i) { | |||
var formData = {}; | |||
//var formData = {}; | |||
var res = {}; | |||
res.code = 200; | |||
if (!!processId) { | |||
formData.SProcessId = processId; | |||
} | |||
//if (!!processId) { | |||
// formData.PID = processId; | |||
//} | |||
callBack(res, i); | |||
}; | |||
page.init(); | |||
@@ -54,7 +54,7 @@ var bootstrap = function ($, learun) { | |||
title: '新增', | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/Form', | |||
width: 1000, | |||
height: 600, | |||
height: 700, | |||
callBack: function (id) { | |||
var res = false; | |||
// 验证数据 | |||
@@ -84,7 +84,7 @@ var bootstrap = function ($, learun) { | |||
id: 'form', | |||
title: '编辑', | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/Form?keyValue=' + keyValue, | |||
width: 800, | |||
width: 1000, | |||
height: 700, | |||
callBack: function (id) { | |||
var res = false; | |||
@@ -109,7 +109,7 @@ var bootstrap = function ($, learun) { | |||
id: 'forminfoitem', | |||
title: '查看', | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/FormView?keyValue=' + keyValue, | |||
width: 800, | |||
width: 1000, | |||
height: 700, | |||
btn: '', | |||
callBack: function (id) { | |||
@@ -160,14 +160,15 @@ var bootstrap = function ($, learun) { | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
$('#gridtable').lrAuthorizeJfGrid({ | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/GetPageList', | |||
headData: [ | |||
{ label: "标题", name: "RTitle", width: 100, align: "left" }, | |||
{ | |||
label: "申请人", name: "ReceiveUser", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata', | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser', | |||
key: value, | |||
keyId: 'f_userid', | |||
callback: function (_data) { | |||
@@ -20,6 +20,11 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
[Column("RID")] | |||
public string RID { get; set; } | |||
/// <summary> | |||
/// 标题 | |||
/// </summary> | |||
[Column("RTITLE")] | |||
public string RTitle { get; set; } | |||
/// <summary> | |||
/// 领取人 | |||
/// </summary> | |||
[Column("RECEIVEUSER")] | |||
@@ -55,6 +60,9 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
this.RID = Guid.NewGuid().ToString(); | |||
this.RTime = DateTime.Now; | |||
this.PStatus = "0"; | |||
var userinfo = LoginUserInfo.Get(); | |||
this.ReceiveUser = userinfo.userId; | |||
this.PDepartment = userinfo.departmentId; | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
@@ -34,6 +34,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
strSql.Append(@" | |||
t.RID, | |||
t.ReceiveUser, | |||
t.RTitle, | |||
t.PDepartment, | |||
t.PStatus, | |||
t.RTime | |||
@@ -92,7 +93,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository().FindEntity<Ass_ReceiveEntity>(a=>a.PID==ProcessID); | |||
return this.BaseRepository().FindEntity<Ass_ReceiveEntity>(a => a.PID == ProcessID); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -211,20 +212,20 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
db.Update(receiveEntity); | |||
//根据领取单减少资产库的库存 | |||
foreach (var item in receiveItem) | |||
{ | |||
var num = int.Parse(item.ANum); | |||
if (num > 0) | |||
{ | |||
var assInfoEntity = db.FindEntity<Ass_AssetsInfoEntity>(a => a.AId == item.AID); | |||
if (assInfoEntity.AStock >= num) | |||
{ | |||
assInfoEntity.AStock = assInfoEntity.AStock - num; | |||
db.Update(assInfoEntity); | |||
} | |||
} | |||
} | |||
//foreach (var item in receiveItem) | |||
//{ | |||
// var num = int.Parse(item.ANum); | |||
// if (num > 0) | |||
// { | |||
// var assInfoEntity = db.FindEntity<Ass_AssetsInfoEntity>(a => a.AId == item.AID); | |||
// if (assInfoEntity.AStock >= num) | |||
// { | |||
// assInfoEntity.AStock = assInfoEntity.AStock - num; | |||
// db.Update(assInfoEntity); | |||
// } | |||
// } | |||
//} | |||
} | |||
db.Commit(); | |||
@@ -20,25 +20,108 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
[Column("RIID")] | |||
public string RIID { get; set; } | |||
/// <summary> | |||
/// 资产编号 | |||
/// 申请单号 | |||
/// </summary> | |||
[Column("AID")] | |||
public string AID { get; set; } | |||
[Column("RID")] | |||
public string RID { get; set; } | |||
/// <summary> | |||
/// 资产名称 | |||
/// AAICode | |||
/// </summary> | |||
[Column("ANAME")] | |||
public string AName { get; set; } | |||
[Column("AAICODE")] | |||
public string AAICode { get; set; } | |||
/// <summary> | |||
/// 数量 | |||
/// AAIName | |||
/// </summary> | |||
[Column("ANUM")] | |||
public string ANum { get; set; } | |||
[Column("AAINAME")] | |||
public string AAIName { get; set; } | |||
/// <summary> | |||
/// 申请单号 | |||
/// AAITId | |||
/// </summary> | |||
[Column("RID")] | |||
public string RID { get; set; } | |||
[Column("AAITID")] | |||
public string AAITId { get; set; } | |||
/// <summary> | |||
/// AAIEName | |||
/// </summary> | |||
[Column("AAIENAME")] | |||
public string AAIEName { get; set; } | |||
/// <summary> | |||
/// AAIPhoto | |||
/// </summary> | |||
[Column("AAIPHOTO")] | |||
public string AAIPhoto { get; set; } | |||
/// <summary> | |||
/// AAIContent | |||
/// </summary> | |||
[Column("AAICONTENT")] | |||
public string AAIContent { get; set; } | |||
/// <summary> | |||
/// AAIOrder | |||
/// </summary> | |||
[Column("AAIORDER")] | |||
public int? AAIOrder { get; set; } | |||
/// <summary> | |||
/// AAIModel | |||
/// </summary> | |||
[Column("AAIMODEL")] | |||
public string AAIModel { get; set; } | |||
/// <summary> | |||
/// AAIManufacturer | |||
/// </summary> | |||
[Column("AAIMANUFACTURER")] | |||
public string AAIManufacturer { get; set; } | |||
/// <summary> | |||
/// AAISupplierId | |||
/// </summary> | |||
[Column("AAISUPPLIERID")] | |||
public string AAISupplierId { get; set; } | |||
/// <summary> | |||
/// AAISource | |||
/// </summary> | |||
[Column("AAISOURCE")] | |||
public string AAISource { get; set; } | |||
/// <summary> | |||
/// AAIPrice | |||
/// </summary> | |||
[Column("AAIPRICE")] | |||
public decimal? AAIPrice { get; set; } | |||
/// <summary> | |||
/// AAISTOCK | |||
/// </summary> | |||
[Column("AAISTOCK")] | |||
public decimal? AAIStock { get; set; } | |||
/// <summary> | |||
/// AAIUNIT | |||
/// </summary> | |||
[Column("AAIUNIT")] | |||
public string AAIUnit { get; set; } | |||
/// <summary> | |||
/// AAIREALNUM | |||
/// </summary> | |||
[Column("AAIREALNUM")] | |||
public decimal? AAIRealNum { get; set; } | |||
/// <summary> | |||
/// AAIREALNUM | |||
/// </summary> | |||
[Column("AISCHECK")] | |||
public bool? AIsCheck { get; set; } | |||
/// <summary> | |||
/// AResult | |||
/// </summary> | |||
[Column("ARESULT")] | |||
public int? AResult { get; set; } | |||
/// <summary> | |||
/// ARemark | |||
/// </summary> | |||
[Column("AREMARK")] | |||
public string ARemark { get; set; } | |||
/// <summary> | |||
/// AAddress | |||
/// </summary> | |||
[Column("AADDRESS")] | |||
public string AAddress { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
@@ -31,10 +31,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT "); | |||
strSql.Append(@" | |||
t.RIID, | |||
t.AName, | |||
t.AID, | |||
t.ANum | |||
t.* | |||
"); | |||
strSql.Append(" FROM Ass_ReceiveItem t "); | |||
strSql.Append(" WHERE 1=1 "); | |||