var vm = new Vue({
|
el:'#rapp',
|
data:{
|
showList: true,
|
title: null,
|
userAuth: {}
|
},
|
methods: {
|
query: function () {
|
vm.reload();
|
},
|
add: function(){
|
vm.showList = false;
|
vm.title = "新增";
|
vm.userAuth = {};
|
},
|
update: function () {
|
var authId = getSelectedRow();
|
if(authId == null){
|
return ;
|
}
|
vm.showList = false;
|
vm.title = "修改";
|
|
vm.getInfo(authId)
|
},
|
saveOrUpdate: function () {
|
var url = vm.userAuth.authId == null ? "org/userauth/save" : "org/userauth/update";
|
$.ajax({
|
type: "POST",
|
url: restServerBaseURL + url,
|
contentType: "application/json",
|
data: JSON.stringify(vm.userAuth),
|
success: function(r){
|
if(r.code === 0){
|
alert('操作成功', function(){
|
vm.reload();
|
});
|
}else{
|
alert(r.msg);
|
}
|
}
|
});
|
},
|
del: function (authIds) {
|
// var authIds = getSelectedRows();
|
if(authIds == null){
|
return ;
|
}
|
//
|
confirm('确定要删除选中的记录?', function(){
|
$.ajax({
|
type: "POST",
|
url: restServerBaseURL + "org/userauth/delete",
|
contentType: "application/json",
|
data: JSON.stringify(authIds),
|
success: function(r){
|
if(r.code == 0){
|
alert('操作成功', function(){
|
vm.reload();
|
});
|
}else{
|
alert(r.msg);
|
}
|
}
|
});
|
});
|
},
|
getInfo: function(authId){
|
$.get(restServerBaseURL + "org/userauth/info/"+authId, function(r){
|
vm.userAuth = r.userAuth;
|
});
|
},
|
reload: function () {
|
vm.showList = true;
|
var page = $("#jqGrid").jqGrid('getGridParam','page');
|
$("#jqGrid").jqGrid('setGridParam',{
|
page:page
|
}).trigger("reloadGrid");
|
},
|
refresh: function () {
|
vm.showList = true;
|
window.location.reload();
|
},
|
auditForUserAccess:function (){
|
vm.userAuth.authResult=$('input:radio[name=auditResult]:checked').val();
|
$.ajax({
|
type: "POST",
|
url: restServerBaseURL + "org/userauth/audit",
|
contentType: "application/json",
|
data: JSON.stringify(vm.userAuth),
|
success: function(r){
|
if(r.code == 0){
|
alert('操作成功', function(){
|
$("#ModelClose").click();
|
});
|
}else{
|
alert(r.msg,function(){
|
$("#ModelClose").click();
|
});
|
}
|
}
|
});
|
}
|
|
},created: function(){
|
var search = window.location.search;
|
var userId = "";
|
if(search.indexOf("?") > -1){
|
search = search.replace("?", "");
|
userId = search.split('=')[1];
|
}
|
if(userId == ""){
|
this.title = "新增";
|
this.user = {};
|
} else {
|
this.title = "编辑";
|
|
this.getInfo(userId);
|
}
|
}
|
});
|