新增个人信息修改

This commit is contained in:
RuoYi
2018-05-05 02:06:25 +08:00
parent ba37447239
commit 6f6a9c8ca0
19 changed files with 244 additions and 53 deletions

View File

@ -138,15 +138,27 @@ $(function(){
}
// 获取选中复选框项
$.getCheckeds = function (_name) {
var roleIds = "";
var checkeds = "";
$('input:checkbox[name="' + _name + '"]:checked').each(function(i) {
if (0 == i) {
roleIds = $(this).val();
checkeds = $(this).val();
} else {
roleIds += ("," + $(this).val());
checkeds += ("," + $(this).val());
}
});
return roleIds;
return checkeds;
}
// 获取选中复选框项
$.getSelects = function (_name) {
var selects = "";
$('#' + _name + ' option:selected').each(function (i) {
if (0 == i) {
selects = $(this).val();
} else {
selects += ("," + $(this).val());
}
});
return selects;
}
// 复选框事件绑定
if ($.fn.select2 !== undefined) {

View File

@ -51,9 +51,10 @@ function add() {
var password = $("input[name='password']").val();
var email = $("input[name='email']").val();
var phonenumber = $("input[name='phonenumber']").val();
var sex = $("input[name='sex']:checked").val();
var status = $("input[name='status']").is(':checked') == true ? 0 : 1;
var roleIds = $.getCheckeds("role");
var postIds = $("#post").val() + "";
var postIds = $.getSelects("post");
$.ajax({
cache : true,
type : "POST",
@ -66,6 +67,7 @@ function add() {
"password": password,
"email": email,
"phonenumber": phonenumber,
"sex": sex,
"status": status,
"roleIds": roleIds,
"postIds": postIds

View File

@ -27,9 +27,10 @@ function update() {
var password = $("input[name='password']").val();
var email = $("input[name='email']").val();
var phonenumber = $("input[name='phonenumber']").val();
var sex = $("input[name='sex']:checked").val();
var status = $("input[name='status']").is(':checked') == true ? 0 : 1;
var roleIds = $.getCheckeds("role");
var postIds = $("#post").val() + "";
var postIds = $.getSelects("post");
$.ajax({
cache : true,
type : "POST",
@ -41,6 +42,7 @@ function update() {
"password": password,
"email": email,
"phonenumber": phonenumber,
"sex": sex,
"status": status,
"roleIds": roleIds,
"postIds": postIds