|
@@ -29,126 +29,28 @@ var bootstrap = function ($, learun) { |
|
|
$('.lr-form-wrap').lrscroll(); |
|
|
$('.lr-form-wrap').lrscroll(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#detailadd").on('click', function () { |
|
|
$("#detailadd").on('click', function () { |
|
|
$('#detailaddbutton').trigger('click'); |
|
|
|
|
|
}); |
|
|
|
|
|
$("#detailaddbutton").lrlayerselect({ |
|
|
|
|
|
treeUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsType/GetAllTree', |
|
|
|
|
|
treeParentId: 'atptid', |
|
|
|
|
|
treeValueId: 'atid', |
|
|
|
|
|
treeTextId: 'aname', |
|
|
|
|
|
dataUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetList', |
|
|
|
|
|
dataTreeId: 'ATId', |
|
|
|
|
|
dataValueId: 'aiid', |
|
|
|
|
|
dataTextId: 'aname', |
|
|
|
|
|
|
|
|
|
|
|
grid: [ |
|
|
|
|
|
{ label: '资产编号', name: 'aicodenumjy', width: 150, align: 'left' }, |
|
|
|
|
|
{ label: '资产名称', name: 'aname', width: 150, align: 'left' }, |
|
|
|
|
|
{ label: "英文名称", name: "aename", width: 100, align: "left" }, |
|
|
|
|
|
{ |
|
|
|
|
|
label: '楼宇名称', name: 'aiistorageid', 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: "aiistorageposition", width: 150, 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: 'aiisinstorage', width: 150, align: 'left', formatter: function (val, row) { |
|
|
|
|
|
if (val) { |
|
|
|
|
|
return '在库'; |
|
|
|
|
|
} else { |
|
|
|
|
|
return '否'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
{ label: "资产型号", name: "amodel", width: 150, align: "left" }, |
|
|
|
|
|
{ label: "生产厂家", name: "amanufacturer", width: 150, 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_AssetsInfoItem/GetDatas?keyValue=' + values, function (data) { |
|
|
|
|
|
if (data) { |
|
|
|
|
|
|
|
|
|
|
|
$.each(data, function (i, item) { |
|
|
|
|
|
|
|
|
|
|
|
var ifnewrow = true; |
|
|
|
|
|
$.each(tempdatra, function (key, val) { |
|
|
|
|
|
if (tempdatra[key].AAIAId === item.AAIAId) { |
|
|
|
|
|
ifnewrow = false; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
if (ifnewrow) { |
|
|
|
|
|
tempdatra.push(item); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
$('#Ass_ScrapItem').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
} |
|
|
} |
|
|
}, |
|
|
|
|
|
isMultiple: true |
|
|
|
|
|
}); |
|
|
|
|
|
$("#detailedit").on('click', function () { |
|
|
|
|
|
//Ass_ScrapItem |
|
|
|
|
|
var keyValue = $('#Ass_ScrapItem').jfGridValue('AAIId'); |
|
|
|
|
|
selectedRow = $('#Ass_ScrapItem').jfGridGet('rowdata'); |
|
|
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
|
|
learun.layerForm({ |
|
|
|
|
|
id: 'formitem', |
|
|
|
|
|
title: '编辑明细', |
|
|
|
|
|
url: top.$.rootUrl + '/AssetManagementSystem/Ass_ScrapItem/Form?keyValue=' + keyValue, |
|
|
|
|
|
width: 860, |
|
|
|
|
|
height: 600, |
|
|
|
|
|
callBack: function (id) { |
|
|
|
|
|
return top[id].acceptClick(refreshGirdData); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$("#detaildel").on('click', function () { |
|
|
$("#detaildel").on('click', function () { |
|
|
var keyValue = $('#Ass_ScrapItem').jfGridValue('AAIId'); |
|
|
var keyValue = $('#Ass_ScrapItem').jfGridValue('AAIId'); |
|
|
if (learun.checkrow(keyValue)) { |
|
|
if (learun.checkrow(keyValue)) { |
|
|
learun.layerConfirm('是否确认删除该项!', function (res, index) { |
|
|
learun.layerConfirm('是否确认删除该项!', function (res, index) { |
|
|
if (res) { |
|
|
if (res) { |
|
|
$.each(tempdatra, function (key, val) { |
|
|
$.each(tempdatra, function (key, val) { |
|
|
if (tempdatra[key].AAIId === keyValue) { |
|
|
|
|
|
pricecount -= tempdatra[key].AAIPrice * tempdatra[key].AAIStock; |
|
|
|
|
|
|
|
|
if (tempdatra[key] && tempdatra[key].AAIId == keyValue) { |
|
|
|
|
|
//pricecount -= tempdatra[key].AAIPrice * tempdatra[key].AAIStock; |
|
|
tempdatra.splice(key, 1); |
|
|
tempdatra.splice(key, 1); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
@@ -253,19 +155,54 @@ var bootstrap = function ($, learun) { |
|
|
|
|
|
|
|
|
refreshGirdData = function (temprow) { |
|
|
refreshGirdData = function (temprow) { |
|
|
var ifnewrow = true; |
|
|
var ifnewrow = true; |
|
|
$.each(tempdatra, function (key, val) { |
|
|
|
|
|
if (tempdatra[key].AAIId === temprow.AAIId) { |
|
|
|
|
|
tempdatra[key] = temprow; |
|
|
|
|
|
ifnewrow = false; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
if (ifnewrow) { |
|
|
|
|
|
tempdatra.push(temprow); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
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, |
|
|
|
|
|
AAIStorage: item.AIIStorageId, |
|
|
|
|
|
AAILocation: item.AIIStoragePosition, |
|
|
|
|
|
AAIId: 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); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
//var ifnewrow = true; |
|
|
|
|
|
//$.each(tempdatra, function (key, val) { |
|
|
|
|
|
// if (tempdatra[key].AAIId === temprow.AAIId) { |
|
|
|
|
|
// tempdatra[key] = temprow; |
|
|
|
|
|
// ifnewrow = false; |
|
|
|
|
|
// } |
|
|
|
|
|
//}); |
|
|
|
|
|
//if (ifnewrow) { |
|
|
|
|
|
// tempdatra.push(temprow); |
|
|
|
|
|
//} |
|
|
$('#Ass_ScrapItem').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); |
|
|
$('#Ass_ScrapItem').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); |
|
|
}; |
|
|
}; |
|
|
function sortNumber(a, b) { |
|
|
function sortNumber(a, b) { |
|
|
return a.AAIOrder - b.AAIOrder; |
|
|
|
|
|
|
|
|
return 1; //a.AAIOrder - b.AAIOrder; |
|
|
} |
|
|
} |
|
|
// 设置表单数据 |
|
|
// 设置表单数据 |
|
|
setFormData = function (processId) { |
|
|
setFormData = function (processId) { |
|
|