$(function() {
|
//cheackForm("valuefrom");
|
$("title").text("系统字典管理 - " + systemTitle);
|
});
|
var vm = new Vue({
|
el: '#rapp',
|
data: {
|
showList: true,
|
title: null,
|
fieldvalue: {},
|
form1: null
|
},
|
methods: {
|
saveOrUpdate: function () {
|
if ($("#valuefrom").valid()) {
|
if (vm.title == "新增") {
|
var url = "sys/fieldvalue/save";
|
}
|
if (vm.title == "编辑") {
|
var url = "sys/fieldvalue/update";
|
}
|
$.ajax({
|
type: "POST",
|
url: restServerBaseURL + url,
|
contentType: "application/json",
|
data: JSON.stringify(vm.fieldvalue),
|
success: function (r) {
|
if (r.code === 0) {
|
alert('操作成功', function () {
|
if (vm.title == "新增") {
|
window.location.href = window.location.href+r.valueid;
|
}else{
|
window.location.reload();
|
}
|
if(parent.opener.vm && parent.opener.vm.reload){
|
parent.opener.vm.reload();
|
}
|
});
|
} else {
|
alert(r.msg);
|
}
|
}
|
});
|
}
|
},
|
getInfo: function (valueid) {
|
$.get(restServerBaseURL + "sys/fieldvalue/info/" + valueid, function (r) {
|
vm.fieldvalue = r.fieldvalue;
|
});
|
},
|
getUser: function() {
|
$.ajax({
|
type: "get",
|
url: restServerBaseURL + "org/user/info",
|
async: true,
|
dataType: 'json',
|
success: function (data) {
|
if (data.code != 0) {
|
alert(data.msg);
|
return;
|
} else {
|
vm.fieldvalue.rcreateuser = data.user.nickname;
|
}
|
}
|
});
|
}
|
},
|
created: function(){
|
var search = window.location.search;
|
var fkey = "";
|
var valueid = "";
|
search = search.replace("?", "");
|
var Param = search.split('&');
|
fkey = Param[0].split('=')[1];
|
valueid = Param[1].split('=')[1];
|
if(valueid == ""){
|
this.title = "新增";
|
this.fieldvalue = { fkey: fkey};
|
this.getUser();
|
} else {
|
this.title = "编辑";
|
|
this.getInfo(valueid);
|
}
|
}
|
});
|