|
@@ -5,15 +5,15 @@ $(function(){
|
|
|
getRationLibs();
|
|
|
})
|
|
|
|
|
|
-function addressdirect(){
|
|
|
+function addEvent_Addressdirect(){
|
|
|
$("tr:gt(0)").each(function() {
|
|
|
var td, a;
|
|
|
td = $("td:eq(0)", $(this));
|
|
|
a = $('a', td);
|
|
|
- a.attr('href', "/rationLibEditor/rationLib" + "?rationname=" + a.text());
|
|
|
+ a.attr('href', "/rationRepository/ration" + "?repository=" + a.text());
|
|
|
})
|
|
|
}
|
|
|
-function deleteLib(){
|
|
|
+function addEvent_DeleteLib(){
|
|
|
$("tr:gt(0)").each(function() {
|
|
|
var td0, a1,td2,a2;
|
|
|
td2 = $("td:eq(2)", $(this));
|
|
@@ -28,7 +28,7 @@ function deleteLib(){
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-function editLib(){
|
|
|
+function addEvent_EditLib(){
|
|
|
$("tr:gt(0)").each(function() {
|
|
|
var td0, a1,td2,a2;
|
|
|
td2 = $("td:eq(2)", $(this));
|
|
@@ -46,7 +46,7 @@ $("#deleteLib").click(function(){
|
|
|
var rationLibName = $("#did").val();
|
|
|
$.ajax({
|
|
|
type:"POST",
|
|
|
- url:"http://localhost:6060/rationLibEditor/deleteRationLibs",
|
|
|
+ url:"api/deleteRationLibs",
|
|
|
dataType:"json",
|
|
|
data:{"rationName": rationLibName},
|
|
|
cache:false,
|
|
@@ -64,18 +64,18 @@ $("#deleteLib").click(function(){
|
|
|
function getRationLibs(){
|
|
|
$.ajax({
|
|
|
type:"POST",
|
|
|
- url:"http://localhost:6060/rationLibEditor/getRationDisplayNames",
|
|
|
+ url:"api/getRationDisplayNames",
|
|
|
dataType:"json",
|
|
|
cache:false,
|
|
|
- timeout:50000,
|
|
|
+ timeout:5000,
|
|
|
success:function(result){
|
|
|
$("tbody tr").html("");
|
|
|
for(var i=0;i<result.data.length;i++){
|
|
|
- addLibTag(result.data[i].displayName);
|
|
|
+ addLibTag(result.data[i].dispName);
|
|
|
}
|
|
|
- addressdirect();
|
|
|
- deleteLib();
|
|
|
- editLib();
|
|
|
+ addEvent_Addressdirect();
|
|
|
+ addEvent_DeleteLib();
|
|
|
+ addEvent_EditLib();
|
|
|
},
|
|
|
error:function(iqXHR,textStatus,errorThrown){
|
|
|
alert("error "+textStatus+" "+errorThrown);
|
|
@@ -90,21 +90,21 @@ function addLibTag(string){
|
|
|
var a = $("a",$td0);
|
|
|
var str = string;
|
|
|
a.text(str);
|
|
|
- var date = new Date().format("yyyy-MM-dd");
|
|
|
+ var date = new Date().Format("yyyy-MM-dd");
|
|
|
$td1.text(date);
|
|
|
$tr.appendTo("tbody");
|
|
|
}
|
|
|
|
|
|
-function addRation(str) {
|
|
|
+function addRationRepository(rationObj) {
|
|
|
$.ajax({
|
|
|
type:"POST",
|
|
|
- url:"http://localhost:6060/rationLibEditor/addRationLib",
|
|
|
+ url:"api/addRationRepository",
|
|
|
dataType:"json",
|
|
|
- data:{"rationDisPlayName": str},
|
|
|
+ data:{"rationRepObj": JSON.stringify(rationObj)},
|
|
|
cache:false,
|
|
|
- timeout:50000,
|
|
|
+ timeout:5000,
|
|
|
success:function(result){
|
|
|
-
|
|
|
+ //
|
|
|
},
|
|
|
error:function(iqXHR,textStatus,errorThrown){
|
|
|
alert("error "+textStatus+" "+errorThrown);
|
|
@@ -120,12 +120,16 @@ $("#rationAdd").click(function(){
|
|
|
var a = $("a",$td0);
|
|
|
var str = $("#addInput").val();
|
|
|
a.text(str);
|
|
|
- var date = new Date().format("yyyy-MM-dd");
|
|
|
+ var date = new Date().Format("yyyy-MM-dd");
|
|
|
$td1.text(date);
|
|
|
$tr.appendTo("tbody");
|
|
|
- addRation(str);
|
|
|
- addressdirect();
|
|
|
- deleteLib();
|
|
|
+ var newRationRepObj = {};
|
|
|
+ newRationRepObj.dispName = str;
|
|
|
+ newRationRepObj.appType = "建筑";
|
|
|
+ newRationRepObj.descr = "";
|
|
|
+ addRationRepository(newRationRepObj);
|
|
|
+ addEvent_Addressdirect();
|
|
|
+ addEvent_DeleteLib();
|
|
|
});
|
|
|
|
|
|
$("#edtOK").click(function(){
|
|
@@ -133,7 +137,7 @@ $("#edtOK").click(function(){
|
|
|
var newStr = $("#inputRation").val();
|
|
|
$.ajax({
|
|
|
type:"POST",
|
|
|
- url:"http://localhost:6060/rationLibEditor/editRationLibs",
|
|
|
+ url:"api/editRationLibs",
|
|
|
dataType:"json",
|
|
|
data:{"rationName": str,"newName":newStr},
|
|
|
cache:false,
|
|
@@ -148,24 +152,5 @@ $("#edtOK").click(function(){
|
|
|
})
|
|
|
|
|
|
});
|
|
|
-Date.prototype.format = function(fmt) {
|
|
|
- var o = {
|
|
|
- "M+" : this.getMonth()+1,
|
|
|
- "d+" : this.getDate(),
|
|
|
- "h+" : this.getHours(),
|
|
|
- "m+" : this.getMinutes(),
|
|
|
- "s+" : this.getSeconds(),
|
|
|
- "q+" : Math.floor((this.getMonth()+3)/3),
|
|
|
- "S" : this.getMilliseconds()
|
|
|
- };
|
|
|
- if(/(y+)/.test(fmt)) {
|
|
|
- fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
|
|
|
- }
|
|
|
- for(var k in o) {
|
|
|
- if(new RegExp("("+ k +")").test(fmt)){
|
|
|
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
|
|
|
- }
|
|
|
- }
|
|
|
- return fmt;
|
|
|
-}
|
|
|
+
|
|
|
autoFlashHeight();
|