|
@ -5,8 +5,8 @@
|
|
|
/* *************************** 模块初始化 ***************************** */
|
|
|
var editorParam = {
|
|
|
//form
|
|
|
dbListUrl:"${contextRoot}/tenant/dataBase/getDataBaseValues",
|
|
|
actionUrl:"${contextRoot}/tenant/addTenant",
|
|
|
dbListUrl: "${contextRoot}/tenant/dataBase/getDataBaseValues",
|
|
|
actionUrl: "${contextRoot}/tenant/addTenant",
|
|
|
|
|
|
init: function () {
|
|
|
var me = this;
|
|
@ -17,9 +17,10 @@
|
|
|
|
|
|
},
|
|
|
toDisable: function () {
|
|
|
if ($("#flag").val()=='disabled') {
|
|
|
if ($("#flag").val() == 'disabled') {
|
|
|
$("#btnEditor").show();
|
|
|
$("#btnSave").hide();
|
|
|
$("input[name='cnName']").attr("disabled", "disabled");
|
|
|
$("input[name='name']").attr("disabled", "disabled");
|
|
|
$("input[name='loginName']").attr("disabled", "disabled");
|
|
|
$("input[name='passward']").attr("disabled", "disabled");
|
|
@ -31,40 +32,40 @@
|
|
|
},
|
|
|
initForm: function () {
|
|
|
var me = this;
|
|
|
var data;
|
|
|
var data;
|
|
|
var modelString = "${model.id}";
|
|
|
if(modelString!=undefined && modelString!=null && modelString.length>0)
|
|
|
{
|
|
|
if (modelString != undefined && modelString != null && modelString.length > 0) {
|
|
|
var valid = "${model.valid}";
|
|
|
var dataSourceId = "${model.dataSourceId}";
|
|
|
|
|
|
liger.get("valid").selectValue(valid);
|
|
|
liger.get("dataSourceId").selectValue(dataSourceId);
|
|
|
|
|
|
data={
|
|
|
data = {
|
|
|
id: "${model.id}",
|
|
|
name: "${model.name}",
|
|
|
loginName: "${model.loginName}",
|
|
|
valid: valid,
|
|
|
password: "${model.password}",
|
|
|
schema: "${model.schema}",
|
|
|
dataSourceId: dataSourceId,
|
|
|
cnName: "${model.cnName}",
|
|
|
loginName: "${model.loginName}",
|
|
|
valid: valid,
|
|
|
password: "${model.password}",
|
|
|
schema: "${model.schema}",
|
|
|
dataSourceId: dataSourceId,
|
|
|
};
|
|
|
me.actionUrl = "${contextRoot}/tenant/updateTenant";
|
|
|
}else{
|
|
|
} else {
|
|
|
liger.get("valid").selectValue("1");//默认有效
|
|
|
liger.get("dataSourceId").selectValue("1");//默认有效
|
|
|
|
|
|
}
|
|
|
$("#div_info_form").ligerAutoForm({
|
|
|
data:data,
|
|
|
validate:{
|
|
|
name:"required",
|
|
|
loginName:"required",
|
|
|
password:"required",
|
|
|
scheme:"required",
|
|
|
data: data,
|
|
|
validate: {
|
|
|
name: "required",
|
|
|
loginName: "required",
|
|
|
password: "required",
|
|
|
scheme: "required",
|
|
|
valid: {
|
|
|
required:true
|
|
|
required: true
|
|
|
}
|
|
|
},
|
|
|
|
|
@ -74,78 +75,81 @@
|
|
|
var me = this;
|
|
|
$.ajax({ //ajax处理
|
|
|
type: "GET",
|
|
|
url : me.dbListUrl,
|
|
|
dataType : "json",
|
|
|
url: me.dbListUrl,
|
|
|
dataType: "json",
|
|
|
async: false,
|
|
|
data:{"q":q},
|
|
|
cache:false,
|
|
|
success :function(data){
|
|
|
if(data.successFlg) {
|
|
|
data: {"q": q},
|
|
|
cache: false,
|
|
|
success: function (data) {
|
|
|
if (data.successFlg) {
|
|
|
debugger
|
|
|
$("#dataSourceId").ligerComboBox({data : data.detailModelList,
|
|
|
cancelable:false,
|
|
|
onSuccess:function(data){
|
|
|
$("#dataSourceId").ligerComboBox({
|
|
|
data: data.detailModelList,
|
|
|
cancelable: false,
|
|
|
onSuccess: function (data) {
|
|
|
alert(1111);
|
|
|
}});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
else{
|
|
|
else {
|
|
|
$.ligerDialog.error(data.message);
|
|
|
}
|
|
|
},
|
|
|
error :function(data){
|
|
|
$.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
|
|
|
error: function (data) {
|
|
|
$.ligerDialog.error("Status:" + data.status + "(" + data.statusText + ")");
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
bindEvents: function () {
|
|
|
var me = this;
|
|
|
$(".m-form-bottom").on("click","#btnSave",function () {
|
|
|
$("#btnSave").css("pointer-events","none");
|
|
|
$(".m-form-bottom").on("click", "#btnSave", function () {
|
|
|
$("#btnSave").css("pointer-events", "none");
|
|
|
$("#name_icon").removeClass("required");
|
|
|
if($("#name_icon").val()=="") {
|
|
|
if ($("#name_icon").val() == "") {
|
|
|
$("#name_icon").addClass("required");
|
|
|
if(!$("#div_info_form").ligerAutoForm("validate")){
|
|
|
if (!$("#div_info_form").ligerAutoForm("validate")) {
|
|
|
return;
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
if(!$("#div_info_form").ligerAutoForm("validate")){
|
|
|
if (!$("#div_info_form").ligerAutoForm("validate")) {
|
|
|
return;
|
|
|
}
|
|
|
var data = $("#div_info_form").ligerAutoForm("getData");
|
|
|
$.ajax({ //ajax处理
|
|
|
type: "POST",
|
|
|
url : me.actionUrl,
|
|
|
dataType : "json",
|
|
|
data:data,
|
|
|
cache:false,
|
|
|
success :function(data){
|
|
|
if(data.successFlg) {
|
|
|
url: me.actionUrl,
|
|
|
dataType: "json",
|
|
|
data: data,
|
|
|
cache: false,
|
|
|
success: function (data) {
|
|
|
if (data.successFlg) {
|
|
|
parent.tenant.dialogSuccess(data.message);
|
|
|
}
|
|
|
else{
|
|
|
else {
|
|
|
$.ligerDialog.error(data.message);
|
|
|
}
|
|
|
$("#btnSave").css("pointer-events","");
|
|
|
$("#btnSave").css("pointer-events", "");
|
|
|
},
|
|
|
error :function(data){
|
|
|
$.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
|
|
|
$("#btnSave").css("pointer-events","");
|
|
|
error: function (data) {
|
|
|
$.ligerDialog.error("Status:" + data.status + "(" + data.statusText + ")");
|
|
|
$("#btnSave").css("pointer-events", "");
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
$(".m-form-bottom").on("click","#btnEditor",function () {
|
|
|
$("#btnEditor").hide();
|
|
|
$("#btnSave").show();
|
|
|
$("input[name='name']").removeAttr("disabled");
|
|
|
$("input[name='loginName']").removeAttr("disabled");
|
|
|
$("input[name='password']").removeAttr("disabled");
|
|
|
$("input[name='schema']").removeAttr("disabled");
|
|
|
$("input[name='valid']").removeAttr("disabled");
|
|
|
$("input[name='datasourceId']").removeAttr("disabled");
|
|
|
$("#flag").val("");
|
|
|
$(".m-form-bottom").on("click", "#btnEditor", function () {
|
|
|
$("#btnEditor").hide();
|
|
|
$("#btnSave").show();
|
|
|
$("input[name='name']").removeAttr("disabled");
|
|
|
$("input[name='cnName']").removeAttr("disabled");
|
|
|
$("input[name='loginName']").removeAttr("disabled");
|
|
|
$("input[name='password']").removeAttr("disabled");
|
|
|
$("input[name='schema']").removeAttr("disabled");
|
|
|
$("input[name='valid']").removeAttr("disabled");
|
|
|
$("input[name='datasourceId']").removeAttr("disabled");
|
|
|
$("#flag").val("");
|
|
|
});
|
|
|
$(".m-form-bottom").on("click","#btnCancel",function () {
|
|
|
$(".m-form-bottom").on("click", "#btnCancel", function () {
|
|
|
parent.tenant.dialog.close();
|
|
|
});
|
|
|
|
|
@ -153,16 +157,17 @@
|
|
|
// var q = $(this).val();
|
|
|
// me.selectDBs(q);
|
|
|
// });
|
|
|
$("#valid").ligerComboBox({data : [{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
|
|
|
cancelable:false,
|
|
|
onSuccess:function(data){
|
|
|
}});
|
|
|
$("#valid").ligerComboBox({
|
|
|
data: [{"value": "有效", "code": "1"}, {"value": "无效", "code": "0"}],
|
|
|
cancelable: false,
|
|
|
onSuccess: function (data) {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$(function () {
|
|
|
editorParam.init();
|
|
|
|