80 lines
2.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 版 本 PIT-ADMS V7.0.3 敏捷开发框架
* Copyright (c) 2013-2018 Hexagon PPM
* 创建人:研发部
* 日 期2017.04.05
* 描 述:添加明细
*/
var parentId = request('parentId');
var itemCode = request('itemCode');
var keyValue = '';
var acceptClick;
var bootstrap = function ($, learun) {
"use strict";
var selectedRow = top.selectedDataItemRow;
var page = {
init: function () {
page.bind();
page.initData();
},
bind: function () {
/*检测重复项*/
$('#F_ItemName').on('blur', function () {
$.lrExistField(keyValue, 'F_ItemName', top.$.rootUrl + '/LR_SystemModule/DataItem/ExistDetailItemName', { itemCode: itemCode });
});
$('#F_ItemValue').on('blur', function () {
$.lrExistField(keyValue, 'F_ItemValue', top.$.rootUrl + '/LR_SystemModule/DataItem/ExistDetailItemValue', { itemCode: itemCode });
});
},
initData: function () {
if (!!selectedRow) {
keyValue = selectedRow.F_ItemDetailId || '';
$('#form').lrSetFormData(selectedRow);
}
else {
$('#F_ParentId').val(parentId);
}
}
};
// 保存数据
acceptClick = function (callBack) {
if (!$('#form').lrValidform()) {
return false;
}
var postData = $('#form').lrGetFormData(keyValue);
$.lrSaveForm(top.$.rootUrl + '/LR_SystemModule/DataItem/SaveDetailForm?keyValue=' + keyValue + "&itemCode=" + itemCode, postData, function (res) {
// 保存成功后才回调
if (!!callBack) {
//更新缓存
var storage = {
get: function (name) {
if (localStorage) {
return JSON.parse(localStorage.getItem(name)) || {};
}
},
set: function (name, data) {
if (localStorage) {
localStorage.setItem(name, JSON.stringify(data));
}
}
};
var ver = storage.get("dataItemData").ver || "";
learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/DataItem/GetMap', { ver: ver }, function (data) {
console.log(data);
if (!data) {
} else {
if (data.ver) {
storage.set("dataItemData", data);
}
}
});
callBack();
}
});
};
page.init();
}