66 lines
2.1 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 selectedRow = top.layer_ClassifyIndex.selectedRow;
var keyValue = '';
var acceptClick;
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
page.bind();
page.initData();
},
bind: function () {
// 上级
$('#F_ParentId').lrselect({
url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetClassifyTree',
type: 'tree',
allowSearch: true,
maxHeight:225
}).lrselectSet(parentId);
/*检测重复项*/
$('#F_ItemName').on('blur', function () {
$.lrExistField(keyValue, 'F_ItemName', top.$.rootUrl + '/LR_SystemModule/DataItem/ExistItemName');
});
$('#F_ItemCode').on('blur', function () {
$.lrExistField(keyValue, 'F_ItemCode', top.$.rootUrl + '/LR_SystemModule/DataItem/ExistItemCode');
});
},
initData: function () {
if (!!selectedRow) {
keyValue = selectedRow.F_ItemId || '';
$('#form').lrSetFormData(selectedRow);
}
}
};
// 保存数据
acceptClick = function (callBack) {
if (!$('#form').lrValidform()) {
return false;
}
var postData = $('#form').lrGetFormData(keyValue);
if (postData["F_ParentId"] == '' || postData["F_ParentId"] == ' ') {
postData["F_ParentId"] = '0';
}
else if (postData["F_ParentId"] == keyValue) {
learun.alert.error('上级不能是自己本身');
return false;
}
$.lrSaveForm(top.$.rootUrl + '/LR_SystemModule/DataItem/SaveClassifyForm?keyValue=' + keyValue, postData, function (res) {
// 保存成功后才回调
if (!!callBack) {
callBack();
}
});
};
page.init();
}