You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.3 KiB

3 years ago
var AddDialog = function (parent) {
this.Parent = parent;
this.Setup = function () {
$("#sure-btn").on("click", this.OnSureButtonClick.bind(this));
$("#cancel-btn").on("click", this.HideDialog.bind(this));
$("#close").on("click", this.HideDialog.bind(this));
};
this.Show = function () {
$('#add-dialog').show();
};
this.OnSureButtonClick = function () {
3 years ago
this.validation();
};
this.validation = function () {
if ($("#name").textbox('getValue').trim() === '' || $("#name").textbox('getValue').trim === null) {
alert('请输入机构名称');
return
} else {
this.AddOrg();
this.HideDialog();
}
3 years ago
};
this.AddOrg = function () {
$.ajax({
type: "POST",
dataType: 'text',
url: '/OrgManagement/Add',
data: {
3 years ago
Name: $("#name").textbox('getValue')
3 years ago
},
success: function () {
this.Parent.ReLoadTableData();
}.bind(this)
});
3 years ago
};
this.HideDialog = function () {
$('#add-dialog').hide();
3 years ago
this.clearInput();
3 years ago
};
3 years ago
this.clearInput = function () {
$("#name").textbox('setValue', '');
};
3 years ago
};