e3abf9d9c3a8429f69729480c2adb7f0cb9e3fb6.svn-base 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. function goBack(params) {
  2. //获取iframe中的元素值
  3. var iframe =parent.document.getElementsByName("frmright")[0];
  4. iframe.src = $.pathname()+"/page/system/externalSystem/intelligence.jsp"+params;
  5. }
  6. /**
  7. * 解析查询条件
  8. * @returns {___anonymous229_230}
  9. */
  10. function resolveUrl(){
  11. var encondeCondition=window.location.search;
  12. var condition= decodeURI(encondeCondition.substring(1,encondeCondition.length));
  13. var conditionArr=condition.split("&");
  14. var condJson={};
  15. for(var item in conditionArr){
  16. var temArr=conditionArr[item].split("=");
  17. condJson[temArr[0]]=temArr[1];
  18. }
  19. return condJson;
  20. }
  21. /**
  22. * 重置
  23. * @param id
  24. */
  25. function reset(){
  26. $("#content").val("");
  27. $("#date").val("");
  28. }
  29. /**
  30. * 保存
  31. */
  32. function save(id){
  33. $.post($.pathname() + "/ws/IntelligenceService/IntelligenceService/update",{content:$("#content").val(),date:$("#date").val(),id:id},function(result){
  34. if(result.state=="SUCCESS"){
  35. top.Dialog.alert("增加成功",function(){});
  36. }else{
  37. top.Dialog.alert("增加失败",function(){});
  38. }
  39. })
  40. }
  41. /*
  42. * 初始化
  43. */
  44. function init(id){
  45. $.post($.pathname() + "/ws/IntelligenceService/IntelligenceService/getInfo",{id:id},function(result){
  46. if(result.state=="FAILURE") throw new Error("查询失败");
  47. if(result.rows.length>0){
  48. $("#content").val(result.rows[0].PLANKINFO);
  49. $("#date").val(result.rows[0].PLANKDATE);
  50. }
  51. },"json");
  52. }
  53. /*
  54. * 加载
  55. */
  56. $(function(){
  57. $("#back").on("click",function(){
  58. goBack(window.location.search);
  59. });
  60. init(resolveUrl().id);
  61. $("#save").on("click",function(){
  62. save(resolveUrl().id);
  63. });
  64. $("#reset").on("click",function(){
  65. reset();
  66. });
  67. });