$(function() {
|
cheackForm("from");
|
$("title").text("权限标识管理 - " + systemTitle);
|
});
|
var vm = new Vue({
|
el:'#rapp',
|
data:{
|
showList: true,
|
title: null,
|
resource: {}
|
},
|
methods: {
|
saveOrUpdate: function () {
|
//校验必填
|
// var isVaild = true;
|
// $(":input").each(function () {
|
// if ($(this).attr('validate')) {
|
// var text = $(this).val();
|
// if (text == '' || text == null || text == 'None') {
|
// $(this).css("borderColor","red");
|
// isVaild = false;
|
// }
|
// }
|
// })
|
// if (!isVaild) {
|
// return false;
|
// }
|
var url = vm.resource.resourceid == null ? "sys/resource/save" : "sys/resource/update";
|
if($("#from").valid()) {
|
$.ajax({
|
type: "POST",
|
url: restServerBaseURL + url,
|
contentType: "application/json",
|
data: JSON.stringify(vm.resource),
|
success: function (r) {
|
if (r.code === 0) {
|
alert('操作成功', function () {
|
if (vm.title == "新增") {
|
window.location.href = window.location.href + '?Id=' + r.resourceid;
|
} else {
|
window.location.reload();
|
}
|
if (parent.opener.vm && parent.opener.vm.reload) {
|
parent.opener.vm.reload(1);
|
}
|
});
|
} else {
|
alert(r.msg);
|
}
|
}
|
});
|
}
|
},
|
getInfo: function(resourceid){
|
$.get(restServerBaseURL + "sys/resource/info/"+resourceid, function(r){
|
vm.resource = r.resource;
|
});
|
},
|
},
|
created: function(){
|
var search = window.location.search;
|
var id = "";
|
if(search.indexOf("?") > -1) {
|
search = search.replace("?", "");
|
id = search.split('=')[1];
|
}
|
if(id == ""){
|
this.title = "新增";
|
this.resource = {};
|
$.ajax({
|
type: "GET",
|
url: restServerBaseURL + "sys/systeminfo/queryListAll",
|
contentType: "application/json",
|
success: function(msg) {
|
var systemList = msg.systemList;
|
vm.resource.appid = getAppId();//赋默认值
|
jQuery.each(systemList, function(i, item) {
|
jQuery("#selectId").append("<option value=" + item.appid + ">" + item.appfullname + "</option>");
|
});
|
}
|
});
|
|
} else {
|
this.title = "修改";
|
var thisobj = this;
|
$.ajax({
|
type: "GET",
|
url: restServerBaseURL + "sys/systeminfo/queryListAll",
|
contentType: "application/json",
|
success: function(msg) {
|
var systemList = msg.systemList;
|
jQuery.each(systemList, function(i, item) {
|
jQuery("#selectId").append("<option value=" + item.appid + ">" + item.appfullname + "</option>");
|
});
|
thisobj.getInfo(id);
|
}
|
});
|
|
}
|
}
|
});
|
|
$(function () {
|
$("[validate='true']").on("input propertychange keydown change",function(){
|
if ($(this).val() != '') {
|
$(this).css("borderColor",'');
|
}
|
})
|
})
|