|
|
@@ -28,7 +28,6 @@ var bootstrap = function ($, learun) { |
|
|
|
init: function () { |
|
|
|
$('.lr-form-wrap').lrscroll(); |
|
|
|
$("#detailadd").on('click', function () { |
|
|
|
selectedRow = null; |
|
|
|
learun.layerForm({ |
|
|
|
id: 'formitem', |
|
|
|
title: '新增明细', |
|
|
@@ -41,18 +40,16 @@ var bootstrap = function ($, learun) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
$("#detaildel").on('click', function () { |
|
|
|
var keyValue = $('#Ass_AssetsOutItemApply').jfGridValue('AOIId'); |
|
|
|
console.log(keyValue); |
|
|
|
var keyValue = $('#Ass_AssetsOutItemApply').jfGridValue('AOICode'); |
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
learun.layerConfirm('是否确认删除该项!', function (res, index) { |
|
|
|
if (res) { |
|
|
|
$.each(tempdatra, function (key, val) { |
|
|
|
if (tempdatra[key].AOIId === keyValue) { |
|
|
|
pricecount -= tempdatra[key].AOIPrice * tempdatra[key].AOIStock; |
|
|
|
if (tempdatra[key].AOICode === keyValue) { |
|
|
|
//pricecount -= tempdatra[key].AOIPrice * tempdatra[key].AOIStock; |
|
|
|
tempdatra.splice(key, 1); |
|
|
|
} |
|
|
|
}); |
|
|
|
$("#AOPrice").val(pricecount); |
|
|
|
$('#Ass_AssetsOutItemApply').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); |
|
|
|
top.layer.close(index); |
|
|
|
} |
|
|
@@ -83,7 +80,7 @@ var bootstrap = function ($, learun) { |
|
|
|
}); |
|
|
|
//新房间 |
|
|
|
$('#AOINewRoomId').lrselect({ value: 'RId', text: 'RCode', allowSearch: true }); |
|
|
|
$('#AOINewDepartment').lrselect({ |
|
|
|
$('#AOINewDepartment').lrDepartmentSelect({ |
|
|
|
type: 'tree', |
|
|
|
allowSearch: true, |
|
|
|
url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree', |
|
|
@@ -112,6 +109,7 @@ var bootstrap = function ($, learun) { |
|
|
|
param: {} |
|
|
|
}); |
|
|
|
$('#AOStorageId').lrDataSourceSelect({ code: 'Ass_StorageData', value: 'sid', text: 'sname' }); |
|
|
|
console.log($('#Ass_AssetsOutItemApply').val()) |
|
|
|
$('#Ass_AssetsOutItemApply').jfGrid({ |
|
|
|
headData: [ |
|
|
|
{ |
|
|
@@ -162,97 +160,6 @@ var bootstrap = function ($, learun) { |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "原部门", name: "AOIOldDepartment", 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: "AOIStorageId", width: 100, align: "left", |
|
|
|
formatterAsync: function (callback, value, row, op, $cell) { |
|
|
|
learun.clientdata.getAsync('custmerData', { |
|
|
|
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData', |
|
|
|
key: value, |
|
|
|
keyId: 'sid', |
|
|
|
callback: function (_data) { |
|
|
|
callback(_data['sname']); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "原房间", name: "AOIRoomId", width: 100, align: "left", |
|
|
|
formatterAsync: function (callback, value, row, op, $cell) { |
|
|
|
learun.clientdata.getAsync('custmerData', { |
|
|
|
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_Storage_Room', |
|
|
|
key: value, |
|
|
|
keyId: 'rid', |
|
|
|
callback: function (_data) { |
|
|
|
callback(_data['rcode']); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "新使用人", name: "AOINewUsePeople", width: 100, align: "left", |
|
|
|
formatterAsync: function (callback, value, row, op, $cell) { |
|
|
|
learun.clientdata.getAsync('custmerData', { |
|
|
|
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser', |
|
|
|
key: value, |
|
|
|
keyId: 'f_userid', |
|
|
|
callback: function (_data) { |
|
|
|
callback(_data['f_realname']); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "新部门", name: "AOINewDepartment", 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: "AOINewStorageId", width: 100, align: "left", |
|
|
|
formatterAsync: function (callback, value, row, op, $cell) { |
|
|
|
learun.clientdata.getAsync('custmerData', { |
|
|
|
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData', |
|
|
|
key: value, |
|
|
|
keyId: 'sid', |
|
|
|
callback: function (_data) { |
|
|
|
callback(_data['sname']); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "新房间", name: "AOINewRoomId", width: 100, align: "left", |
|
|
|
formatterAsync: function (callback, value, row, op, $cell) { |
|
|
|
learun.clientdata.getAsync('custmerData', { |
|
|
|
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_Storage_Room', |
|
|
|
key: value, |
|
|
|
keyId: 'rid', |
|
|
|
callback: function (_data) { |
|
|
|
callback(_data['rcode']); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: '资产型号', name: 'AOIModel', width: 100, align: 'left' |
|
|
|
}, |
|
|
@@ -262,12 +169,12 @@ var bootstrap = function ($, learun) { |
|
|
|
{ |
|
|
|
label: '资产规格', name: 'AOISpecification', width: 100, align: 'left' |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: '用途', name: 'AOIUse', width: 100, align: 'left' |
|
|
|
}, |
|
|
|
//{ |
|
|
|
// label: '用途', name: 'AOIUse', width: 100, align: 'left' |
|
|
|
//}, |
|
|
|
], |
|
|
|
height: 400, |
|
|
|
mainId: 'AOIId', |
|
|
|
mainId: 'AAIId', |
|
|
|
reloadSelected: false |
|
|
|
}); |
|
|
|
}, |
|
|
@@ -276,14 +183,14 @@ var bootstrap = function ($, learun) { |
|
|
|
$.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApply/GetFormData?keyValue=' + keyValue, function (data) { |
|
|
|
for (var id in data) { |
|
|
|
if (!!data[id].length && data[id].length > 0) { |
|
|
|
$('#' + id).jfGridSet('refreshdata', data[id]); |
|
|
|
//$('#' + id).jfGridSet('refreshdata', data[id]); |
|
|
|
tempdatra = data[id]; |
|
|
|
} |
|
|
|
else { |
|
|
|
$('[data-table="' + id + '"]').lrSetFormData(data[id]); |
|
|
|
if (data[id].AOPrice) { |
|
|
|
pricecount = data[id].AOPrice; |
|
|
|
} |
|
|
|
//if (data[id].AOPrice) { |
|
|
|
// pricecount = data[id].AOPrice; |
|
|
|
//} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
@@ -294,25 +201,45 @@ var bootstrap = function ($, learun) { |
|
|
|
}; |
|
|
|
refreshGirdData = function (temprow) { |
|
|
|
var ifnewrow = true; |
|
|
|
$.each(tempdatra, function (key, val) { |
|
|
|
if (tempdatra[key].AOIId === temprow.AOIId) { |
|
|
|
tempdatra[key] = temprow; |
|
|
|
ifnewrow = false; |
|
|
|
} |
|
|
|
}); |
|
|
|
if (ifnewrow) { |
|
|
|
tempdatra.push(temprow); |
|
|
|
} |
|
|
|
//总价计算 |
|
|
|
pricecount = 0; |
|
|
|
for (var i = 0; i < tempdatra.length; i++) { |
|
|
|
pricecount += tempdatra[i].AOIPrice * tempdatra[i].AOIStock; |
|
|
|
} |
|
|
|
$("#AOPrice").val(pricecount); |
|
|
|
var list = []; |
|
|
|
$.each(temprow, |
|
|
|
function (i, item) { |
|
|
|
var entity = { |
|
|
|
//AOICode: item.AICode, |
|
|
|
AOICode: item.AICodeNumJY, |
|
|
|
AOIName: item.AIASSName, |
|
|
|
AOISpecification: item.AISpecification, |
|
|
|
AOITId: item.AIASSClass, |
|
|
|
AOIUserPeople: item.AIUsePeople, |
|
|
|
AOIRoomId: item.AIIStoragePosition, |
|
|
|
AOIPrice: item.AIAssValue, |
|
|
|
AOIUnit: item.AIUnits, |
|
|
|
AOIEName: '', |
|
|
|
AOIManufacturer: item.AIManufacturer, |
|
|
|
AOIModel: item.AISpecificationtype, |
|
|
|
AOIId: learun.newGuid() |
|
|
|
} |
|
|
|
list.push(entity); |
|
|
|
|
|
|
|
}); |
|
|
|
$.each(list, |
|
|
|
function (j, item2) { |
|
|
|
$.each(tempdatra, |
|
|
|
function (key, val) { |
|
|
|
|
|
|
|
if (tempdatra[key].AOICode === item2.AOICode) { |
|
|
|
tempdatra[key] = item2; |
|
|
|
ifnewrow = false; |
|
|
|
} |
|
|
|
}); |
|
|
|
if (ifnewrow) { |
|
|
|
tempdatra.push(item2); |
|
|
|
} |
|
|
|
}); |
|
|
|
$('#Ass_AssetsOutItemApply').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); |
|
|
|
}; |
|
|
|
function sortNumber(a, b) { |
|
|
|
return a.AOIOrder - b.AOIOrder; |
|
|
|
return 1;//a.AAIOrder - b.AAIOrder; |
|
|
|
} |
|
|
|
// 设置表单数据 |
|
|
|
setFormData = function (processId) { |
|
|
@@ -324,7 +251,7 @@ var bootstrap = function ($, learun) { |
|
|
|
} |
|
|
|
else { |
|
|
|
if (id == 'Ass_AssetsOutApply') { |
|
|
|
keyValue = data[id].AOId; |
|
|
|
//keyValue = data[id].AOId; |
|
|
|
} |
|
|
|
$('[data-table="' + id + '"]').lrSetFormData(data[id]); |
|
|
|
} |
|
|
|