PAL画布重名校验

This commit is contained in:
zhal 2022-07-28 15:10:08 +08:00
parent 58c3cfe082
commit 531cbdab8c

View File

@ -4,25 +4,37 @@
var UI = {
init : function() {
// 修改标题
$(".diagram_title").bind("click", function() {
if ($(this).hasClass("readonly")) {
return;
}
var title = $(this).text();
$(this).hide();
$("#title_container").append("<input type='text' maxlength='400'/>");
$("#title_container").children("input").val(title.replace(/(^\s+)|(\s+$)/g, "")).select();
$("#title_container").children("input").bind("blur",
function() {
changeTitle();
}).bind("keydown", function(e) {
if (e.keyCode == 13) {
changeTitle();
// 修改标题
$(".diagram_title").bind("click", function() {
$.simpleAlert("close");
if ($(this).hasClass("readonly")) {
return;
}
var title = $(this).text();
if(methodId=="control.kpi" || methodId=="data.form" || methodId=="org.role"){
$.simpleAlert("该模型不允许修改名称!", 'error');
return;
}
$(this).hide();
$("#title_container").append("<input type='text' maxlength='400'/>");
$("#title_container").children("input").val(title.replace(/(^\s+)|(\s+$)/g, "")).select();
$("#title_container").children("input").bind("blur",
function() {
Nameverify();
}).bind("keydown", function(e) {
if (e.keyCode == 13) {
Nameverify();
}
});
});
});
function changeTitle() {
/**
* 重名校验
* @constructor
*/
function Nameverify() {
var newTitle = $.trim($("#title_container").children("input").val());
newTitle = newTitle.replace(/(^\s+)|(\s+$)/g, "");
var oldTitle = $(".diagram_title").text();
@ -38,6 +50,47 @@ var UI = {
$("title").text(title);
$(".diagram_title").text(title).show();
$("#title_container").children("input").remove();
$.ajax({
type: "POST",
url: "./jd",
data: {
sid: sid,
cmd: "com.actionsoft.apps.coe.pal_pl_repository_designer_checkname",
title:newTitle,
method:methodId
},
success: function (r, textStatus, jqXHR) {
if (r.data.result == 'ok') {
changeTitle(newTitle);
} else {
console.log(r);
$.simpleAlert(newTitle+"名称重复,请重新输入!!!", 'error');
}
},
error: function (jqXHR, textStatus, errorThrown) {
$.simpleAlert(errorThrown, 'err');
console.log(jqXHR)
console.log(textStatus)
console.log(errorThrown)
}
});
}
function changeTitle(title) {
/*var newTitle = $.trim($("#title_container").children("input").val());
newTitle = newTitle.replace(/(^\s+)|(\s+$)/g, "");
var oldTitle = $(".diagram_title").text();
oldTitle = oldTitle.replace(/(^\s+)|(\s+$)/g, "");
if (newTitle != oldTitle && chartId != "") {
var msgObj = {
action : "changeTitle",
title : newTitle
};
CLB.send(msgObj);
}*/
$("title").text(title);
$(".diagram_title").text(title).show();
$("#title_container").children("input").remove();
// 更新父级的相关数据
awsui.ajax.request({
url : './jd?cmd=com.actionsoft.apps.coe.pal_pl_repository_designer_updatetitle&sid='