|
|
@@ -1,8 +1,8 @@ |
|
|
|
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) |
|
|
|
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 |
|
|
|
/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) |
|
|
|
* Copyright (c) 2013-2018 北京泉江科技有限公司 |
|
|
|
* 创建人:超级管理员 |
|
|
|
* 日 期:2020-11-18 10:46 |
|
|
|
* 描 述:资产验收 |
|
|
|
* 日 期:2019-03-25 12:00 |
|
|
|
* 描 述:入库申请 |
|
|
|
*/ |
|
|
|
var acceptClick; |
|
|
|
var keyValue = request('keyValue'); |
|
|
@@ -14,6 +14,11 @@ var setFormData; |
|
|
|
var validForm; |
|
|
|
// 保存数据 |
|
|
|
var save; |
|
|
|
var refreshGirdData; |
|
|
|
var selectedRow; |
|
|
|
var tempdatra = new Array(); |
|
|
|
//总价计算 |
|
|
|
var pricecount = 0; |
|
|
|
var bootstrap = function ($, learun) { |
|
|
|
"use strict"; |
|
|
|
// 设置权限 |
|
|
@@ -38,143 +43,345 @@ var bootstrap = function ($, learun) { |
|
|
|
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('AAIId'); |
|
|
|
var AAICode = $('#Ass_Acceptance').jfGridValue('AAICode'); |
|
|
|
selectedRow = $('#Ass_Acceptance').jfGridGet('rowdata'); |
|
|
|
|
|
|
|
if (learun.checkrow(AAICode)) { |
|
|
|
learun.layerForm({ |
|
|
|
id: 'formitem', |
|
|
|
title: '编辑明细', |
|
|
|
url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/FormItem?keyValue=' + keyValue, |
|
|
|
width: 860, |
|
|
|
height: 500, |
|
|
|
callBack: function (id) { |
|
|
|
return top[id].acceptClick(refreshGirdData); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
$("#detailadd").on('click', function () { |
|
|
|
selectedRow = null; |
|
|
|
learun.layerForm({ |
|
|
|
id: 'formitem', |
|
|
|
title: '新增明细', |
|
|
|
url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/FormItem', |
|
|
|
width: 860, |
|
|
|
height: 500, |
|
|
|
callBack: function (id) { |
|
|
|
return top[id].acceptClick(refreshGirdData); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
$("#detaildel").on('click', function () { |
|
|
|
var keyValue = $('#Ass_Acceptance').jfGridValue('AAICode'); |
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
learun.layerConfirm('是否确认删除该项!', function (res, index) { |
|
|
|
if (res) { |
|
|
|
$.each(tempdatra, function (key, val) { |
|
|
|
if (val && val.AAICode === keyValue) { |
|
|
|
pricecount -= (val.AAIPrice * val.AAIStock); |
|
|
|
tempdatra.splice(key, 1); |
|
|
|
} |
|
|
|
}); |
|
|
|
$("#TotalPrice").val(pricecount); |
|
|
|
$('#Ass_Acceptance').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); |
|
|
|
top.layer.close(index); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
page.bind(); |
|
|
|
page.initData(); |
|
|
|
}, |
|
|
|
bind: function () { |
|
|
|
$('#DepartmentId').lrselect({ |
|
|
|
type: 'tree', |
|
|
|
allowSearch: true, |
|
|
|
url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree', |
|
|
|
param: {}, |
|
|
|
select: function (val) { |
|
|
|
console.log(val.value); |
|
|
|
$('#UserID').lrselectRefresh({ url: '/LR_OrganizationModule/User/GetListByDepartmentId?departmentId=' + val.value }); |
|
|
|
} |
|
|
|
}); |
|
|
|
$('#UserID').lrselect({ text: 'F_RealName', value: 'F_UserId' }); |
|
|
|
$('#CreateTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')); |
|
|
|
$('#CreateUserId')[0].lrvalue = learun.clientdata.get(['userinfo']).userId; |
|
|
|
|
|
|
|
|
|
|
|
$("#AAOldCode").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" }, |
|
|
|
$('#CreateUserId').val(learun.clientdata.get(['userinfo']).realName); |
|
|
|
$('#Ass_Acceptance').jfGrid({ |
|
|
|
headData: [ |
|
|
|
//{ |
|
|
|
// label: '资产编号', name: 'AAICode', width: 150, align: 'left' |
|
|
|
//}, |
|
|
|
{ |
|
|
|
label: '设备名称', name: 'AAIName', width: 150, align: 'left' |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "供应商", name: "ASupplierId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { |
|
|
|
label: '规格型号', name: 'AAIModel', 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: 'AAIStock', width: 80, align: 'left' |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: '单价(元)', name: 'AAIPrice', width: 100, align: 'left' |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: '总价(元)', name: 'AAITId', width: 100, align: 'left', |
|
|
|
formatterAsync: function (callback, value, row, op, $cell) { |
|
|
|
callback(row.AAIPrice * row.AAIStock); |
|
|
|
} |
|
|
|
}, { |
|
|
|
label: '使用部门', name: 'AAIUseDeptId', width: 100, align: 'left', |
|
|
|
formatterAsync: function (callback, value, row, op, $cell) { |
|
|
|
learun.clientdata.getAsync('custmerData', { |
|
|
|
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_SupplierData', |
|
|
|
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata', |
|
|
|
key: value, |
|
|
|
keyId: 'sid', |
|
|
|
keyId: 'id', |
|
|
|
callback: function (_data) { |
|
|
|
callback(_data['sname']); |
|
|
|
callback(_data['name']); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
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; |
|
|
|
$('#Name').val(data.AName);//设备名称 |
|
|
|
$('#AAIUnit').lrselectSet(data.AUnit);//单位 |
|
|
|
$('#Model').val(data.AModel);//规格型号 |
|
|
|
$('#AAIManufacturer').val(data.AManufacturer);//品牌 |
|
|
|
$('#Price').val(data.APrice)//单价 |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
unknowselect: function () { |
|
|
|
$("#AAOldCode").find('span').text(""); |
|
|
|
$('#Name').val("");//设备名称 |
|
|
|
$('#Model').val("");//规格型号 |
|
|
|
$('#AAIManufacturer').val("");//品牌 |
|
|
|
}, |
|
|
|
isMultiple: false |
|
|
|
}); |
|
|
|
|
|
|
|
$('#Stock').bind('change', function () { |
|
|
|
var stock = $(this).val(); |
|
|
|
var price = $('#Price').val(); |
|
|
|
$('#TotalPrice').val(stock * price); |
|
|
|
}, { |
|
|
|
label: '放置地点', name: 'AAIStorageId', width: 150, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { |
|
|
|
var content = ''; |
|
|
|
learun.clientdata.getAsync('custmerData', { |
|
|
|
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData', |
|
|
|
key: value, |
|
|
|
keyId: 'sid', |
|
|
|
callback: function (_data) { |
|
|
|
if (_data['sname'] && _data['sname'] != 'undefined') { |
|
|
|
content += _data['sname']; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
learun.clientdata.getAsync('custmerData', { |
|
|
|
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_Storage_Room', |
|
|
|
key: row.AAIStoragePosition, |
|
|
|
keyId: 'rid', |
|
|
|
callback: function (_data) { |
|
|
|
if (_data['rcode'] && _data['rcode'] != 'undefined') { |
|
|
|
content += _data['rcode']; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
}) |
|
|
|
$('#Price').bind('change', function () { |
|
|
|
var stock = $('#Stock').val(); |
|
|
|
var price = $(this).val(); |
|
|
|
$('#TotalPrice').val(stock * price); |
|
|
|
callback(content); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: '使用人', name: 'AAIUseUserId', 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: 'ARemark', width: 180, 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: 'AAISource', width: 100, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { |
|
|
|
// learun.clientdata.getAsync('dataItem', { |
|
|
|
// key: value, |
|
|
|
// code: 'zcly', |
|
|
|
// callback: function (_data) { |
|
|
|
// callback(_data.text); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
//}, |
|
|
|
|
|
|
|
}) |
|
|
|
//{ |
|
|
|
// label: '生成资产明细', name: 'AAIHasDetail', width: 80, align: 'left', formatter: function (cellvalue) { |
|
|
|
// return (cellvalue === true || cellvalue === "true") ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>"; |
|
|
|
// } |
|
|
|
//}, |
|
|
|
|
|
|
|
//{ |
|
|
|
// label: '英文名称', name: 'AAIEName', width: 100, align: 'left' |
|
|
|
//}, |
|
|
|
//{ |
|
|
|
// label: '资产型号', name: 'AAIModel', width: 100, align: 'left' |
|
|
|
//}, |
|
|
|
//{ |
|
|
|
// label: '生产厂家', name: 'AAIManufacturer', width: 100, align: 'left' |
|
|
|
//}, |
|
|
|
//{ |
|
|
|
// label: '资产规格', name: 'AAISpecification', width: 100, align: 'left' |
|
|
|
//}, |
|
|
|
//{ |
|
|
|
// label: '用途', name: 'AAIUse', width: 100, align: 'left' |
|
|
|
//}, |
|
|
|
//{ |
|
|
|
// label: '供应商', name: 'AAISupplierId', 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']); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
//} |
|
|
|
], |
|
|
|
height: 400, |
|
|
|
mainId: 'AAIId', |
|
|
|
reloadSelected: false |
|
|
|
}); |
|
|
|
|
|
|
|
//打印 |
|
|
|
$('#detailprint').on('click', function () { |
|
|
|
var createTime = $('#CreateTime').val(); |
|
|
|
createTime = learun.formatDate(createTime, 'yyyy-MM-dd'); |
|
|
|
learun.layerForm({ |
|
|
|
id: 'print', |
|
|
|
title: '北京金隅科技学校固定资产验收单', |
|
|
|
url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/Print?createTime=' + createTime, |
|
|
|
width: 1100, |
|
|
|
height: 800, |
|
|
|
btn: null |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
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]); |
|
|
|
} |
|
|
|
else { |
|
|
|
$('[data-table="' + id + '"]').lrSetFormData(data[id]); |
|
|
|
$.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_Acceptance' && data[id]) { |
|
|
|
keyValue = data[id].ID; |
|
|
|
} |
|
|
|
$('[data-table="' + id + '"]').lrSetFormData(data[id]); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
refreshGirdData = function (temprow) { |
|
|
|
var ifnewrow = true; |
|
|
|
var list = []; |
|
|
|
//总价计算 |
|
|
|
pricecount = 0; |
|
|
|
//$.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, |
|
|
|
// 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].AAICode === temprow.AAICode) { |
|
|
|
tempdatra[key] = temprow; |
|
|
|
ifnewrow = false; |
|
|
|
} |
|
|
|
}); |
|
|
|
if (ifnewrow) { |
|
|
|
tempdatra.push(temprow); |
|
|
|
} |
|
|
|
for (var i = 0; i < tempdatra.length; i++) { |
|
|
|
pricecount = parseFloat(pricecount) + parseFloat(tempdatra[i].AAIPrice * tempdatra[i].AAIStock); |
|
|
|
} |
|
|
|
callback && callback(); |
|
|
|
} |
|
|
|
$("#TotalPrice").val(pricecount); |
|
|
|
$('#Ass_Acceptance').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); |
|
|
|
}; |
|
|
|
function sortNumber(a, b) { |
|
|
|
return a.AAIOrder - b.AAIOrder; |
|
|
|
}; |
|
|
|
// 验证数据是否填写完整 |
|
|
|
validForm = function () { |
|
|
|
if (!$('body').lrValidform()) { |
|
|
|
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 formData = $('body').lrGetFormData(); |
|
|
|
var postData = {}; |
|
|
|
var formData = $('[data-table="Ass_AcceptanceMain"]').lrGetFormData(); |
|
|
|
if (!!processId) { |
|
|
|
formData.ProcessId = processId; |
|
|
|
} |
|
|
|
var postData = { |
|
|
|
strEntity: JSON.stringify(formData) |
|
|
|
}; |
|
|
|
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, i); |
|
|
|
callBack(res, formData, i); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|