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.

54 lines
1.4 KiB

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