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.
 
 
 
 

59 lines
1.7 KiB

var AddDialog = function (parent) {
this.Parent = parent;
this.Setup = function () {
$(".sex-select span").on("click", this.OnSexButtonClick.bind(this));
$("#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.OnSexButtonClick = function (event) {
$('.sex-select span').removeClass("active");
$(event.target).addClass("active");
};
this.OnSureButtonClick = function () {
this.AddUser();
this.HideDialog();
};
this.HideDialog = function () {
$('#add-dialog').hide();
this.clearInput();
};
this.AddUser = function () {
$.ajax({
type: "POST",
dataType: 'text',
url: '/UserManagement/Add',
data: this.getUserParams(),
success: function () {
this.Parent.ReLoadTableData();
}.bind(this)
});
};
this.clearInput = function () {
$("#name").textbox('setValue', '');
$('#loginAccount').textbox('setValue', '');
$('#loginPassword').textbox('setValue', '');
$('.sex-select span').eq(0).addClass("active");
};
this.getUserParams = function () {
return {
OrgId: 1,
Gender: parseInt($('.sex-select span.active').attr('gender')),
RealName: $("#name").textbox('getValue'),
LoginName: $('#loginAccount').textbox('getValue'),
LoginPassword: $('#loginPassword').textbox('getValue')
}
};
};