|
|
@ -1,8 +1,10 @@ |
|
|
|
var EditDialog = function (parent) { |
|
|
|
this.Parent = parent; |
|
|
|
this.OrgId = null; |
|
|
|
this.User = {}; |
|
|
|
|
|
|
|
this.Setup = function () { |
|
|
|
this.InitOrgList(); |
|
|
|
|
|
|
|
$("#sex span").on("click", this.OnSexButtonClick.bind(this)); |
|
|
|
$("#edit-sure-btn").on("click", this.OnSureButtonClick.bind(this)); |
|
|
|
$("#edit-cancel-btn").on("click", this.HideDialog.bind(this)); |
|
|
@ -10,8 +12,7 @@ |
|
|
|
}; |
|
|
|
|
|
|
|
this.Show = function (data) { |
|
|
|
console.log(data); |
|
|
|
this.OrgId = data.OrgId; |
|
|
|
this.User = data; |
|
|
|
$('#edit-dialog').show(); |
|
|
|
$("#username").textbox('setValue', data.RealName); |
|
|
|
$("#account").textbox('setValue', data.LoginName); |
|
|
@ -20,13 +21,40 @@ |
|
|
|
parseInt($('#sex span').eq(1).attr('gender')) === data.Gender ? $('#sex span').eq(1).addClass('active') : $('#sex span').eq(1).removeClass('active'); |
|
|
|
}; |
|
|
|
|
|
|
|
this.InitOrgList = function () { |
|
|
|
$.ajax({ |
|
|
|
type: "POST", |
|
|
|
dataType: 'text', |
|
|
|
url: '/OrgManagement/Query', |
|
|
|
data: { |
|
|
|
pageIndex: 1, |
|
|
|
pageSize: 10000 |
|
|
|
}, |
|
|
|
success: function (result) { |
|
|
|
$('#edit-dialog-org-list').combobox({ |
|
|
|
valueField: 'Id', |
|
|
|
textField: 'Name', |
|
|
|
editable: false, |
|
|
|
data: JSON.parse(result).rows |
|
|
|
}); |
|
|
|
|
|
|
|
$('#edit-dialog-org-list').combobox('setValue', this.User.OrgId); |
|
|
|
}.bind(this) |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
this.OnSexButtonClick = function (event) { |
|
|
|
$('#sex span').removeClass("active"); |
|
|
|
$(event.target).addClass("active"); |
|
|
|
}; |
|
|
|
|
|
|
|
this.OnSureButtonClick = function () { |
|
|
|
console.log(this.getUserParams()) |
|
|
|
this.User.OrgId = $('#edit-dialog-org-list').combobox('getValue'); |
|
|
|
this.User.Gender = parseInt($('#sex span.active').attr('gender')); |
|
|
|
this.User.RealName = $("#username").textbox('getValue'); |
|
|
|
this.User.LoginName = $('#account').textbox('getValue'); |
|
|
|
this.User.LoginPassWord = $('#password').textbox('getValue'); |
|
|
|
|
|
|
|
this.EditUser(); |
|
|
|
this.HideDialog(); |
|
|
|
}; |
|
|
@ -42,28 +70,18 @@ |
|
|
|
type: "POST", |
|
|
|
dataType: 'text', |
|
|
|
url: '/UserManagement/Update', |
|
|
|
data: this.getUserParams(), |
|
|
|
success: function (result) { |
|
|
|
console.log(this.getUserParams()) |
|
|
|
data: this.User, |
|
|
|
success: function () { |
|
|
|
this.Parent.ReLoadTableData(); |
|
|
|
}.bind(this) |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
this.clearInput = function () { |
|
|
|
$('#edit-dialog-org-list').combobox('setValue', ''), |
|
|
|
$("#username").textbox('setValue', ''), |
|
|
|
$('#account').textbox('setValue', ''), |
|
|
|
$('#password').textbox('setValue', ''), |
|
|
|
$('#sex span').eq(0).addClass("active"); |
|
|
|
}; |
|
|
|
|
|
|
|
this.getUserParams = function () { |
|
|
|
return { |
|
|
|
OrgId: this.OrgId, |
|
|
|
Gender: parseInt($('#sex span.active').attr('gender')), |
|
|
|
RealName: $("#username").textbox('getValue'), |
|
|
|
LoginName: $('#account').textbox('getValue'), |
|
|
|
LoginPassword: $('#password').textbox('getValue') |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |