appJs.jsp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
  2. <%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
  3. <script>
  4. /* *************************** 模块初始化 ***************************** */
  5. var app = {
  6. grid: null,
  7. $searchStatusName: $('#status'),//转台文本匡对象
  8. $searchBtn: $('.l-trigger-search'),//搜索按钮
  9. dialog: null,
  10. init: function () {
  11. this.bindEvents();
  12. this.initForm();
  13. },
  14. initForm: function () {
  15. var me = this;
  16. $('.m-retrieve-area').show();
  17. $("#txtName").ligerSearch({
  18. onClick:function(value){
  19. me.reloadGrid();
  20. }});
  21. var appStatus = liger.get("statusName").value;
  22. if(appStatus ==undefined || appStatus ==null || appStatus.length<=0){
  23. liger.get("statusName").selectValue("");
  24. }
  25. me.grid = $("#div_grid").ligerGrid({
  26. url: '${contextRoot}/app/getAppList',
  27. parms: {
  28. name: $('#txtName').val(),
  29. status:appStatus
  30. },
  31. columns: [
  32. {display: '应用名称', id: 'id', name: 'name', width: '15%'},
  33. {display: '英文名', name: 'code', width: '10%'},
  34. {display: '图标', name: 'icon', width: '10%',height:'50',align: 'center', render: function (rowdata, rowindex, value) {
  35. return ' <div style="vertical-align:middle;"><img style="width: 50px; height: 50px;" src="${contextRoot}/'+ rowdata.icon+'" /></div>';
  36. }},
  37. {display: '开发者', name: 'developer', width: '10%'},
  38. {display: '状态', name: 'status', width: '10%',align: 'center', render: function (rowdata, rowindex, value) {
  39. if(rowdata.status==1 ){
  40. return ' <div style="vertical-align:middle;margin-top: 10px;"><span>有效 </span></div>';
  41. }else if(rowdata.status==0){
  42. return ' <div style="vertical-align:middle;margin-top: 10px;"><span>无效 </span></div>';
  43. }
  44. }},
  45. {display: '应用地址', name: 'appUrl', width: '15%'},
  46. {
  47. display: '操作', name: 'operator', width: '35%', render: function (row) {
  48. var html = '<div class="m-inline-buttons" style="width:350px;">';
  49. html += "<a class=\"m-btn\" style=\"padding-right:10px\" onclick=\"app.dialogDetail('"+row.id+"')\">查看详情</a>";
  50. html += "<a class=\"m-btn\" style=\"padding-right:10px\" onclick=\"app.appServiceManage('"+row.id+"')\">服务管理</a>";
  51. // html += "<a class=\"m-btn\" onclick=\"app.dialogDetail('"+row.id+"')\">应用标准</a>";
  52. html += "<a class=\"m-btn-edit\" onclick=\"app.editorDialog('"+row.id+"')\"></a>";
  53. html += "<a class=\"m-btn-delete\" onclick=\"app.delete('"+row.id+"')\"></a>";
  54. html += '</div>';
  55. return html;
  56. }
  57. }
  58. ],
  59. onDblClickRow: function (row) {
  60. me.editorDialog(row.id);
  61. }
  62. });
  63. },
  64. bindEvents: function () {
  65. var me = this;
  66. $('#div_new_record').click(function () {
  67. me.editorDialog();
  68. });
  69. $("#statusName").ligerComboBox({data : [{"value":"全部","code":""},{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
  70. cancelable:false,
  71. onSuccess:function(data){
  72. }});
  73. $(".l-text").css("display","inline-block");
  74. $(".l-text-wrapper").css("display","inline-block");
  75. },
  76. delete:function(id){
  77. var message = "确定要删除该应用信息吗?";
  78. jQuery.ligerDialog.confirm(message, function (confirm) {
  79. if (confirm)
  80. {
  81. $.ajax({ //ajax处理
  82. type: "POST",
  83. url : "${contextRoot}/app/deleteApp",
  84. dataType : "json",
  85. data:{id:id},
  86. cache:false,
  87. success :function(data){
  88. if(data.successFlg) {
  89. $.ligerDialog.success(data.message);
  90. app.grid.reload();
  91. }
  92. else{
  93. $.ligerDialog.error(data.message);
  94. }
  95. },
  96. error :function(data){
  97. $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
  98. }
  99. });
  100. }
  101. });
  102. },
  103. //刷新列表数据
  104. reloadGrid: function () {
  105. this.grid.set({
  106. parms: {name: $('#txtName').val(),status:$('#statusName_val').val()}
  107. });
  108. this.grid.reload();
  109. },
  110. //编辑弹窗
  111. editorDialog: function (id) {
  112. var me = this;
  113. var title = "新增应用";
  114. var params = null;
  115. if (id != undefined && id != null) {
  116. title = "编辑应用";
  117. params = {"id": id};
  118. }
  119. me.dialog = $.ligerDialog.open({
  120. height: 500,
  121. width: 500,
  122. title: title,
  123. url: '${contextRoot}/app/editorApp',
  124. //load: true,
  125. urlParms: params
  126. });
  127. },
  128. dialogDetail: function (id) {
  129. var me = this;
  130. var title = "应用详情";
  131. var params = null;
  132. if (id != undefined && id != null) {
  133. params = {"id": id};
  134. }
  135. me.dialog = $.ligerDialog.open({
  136. height: 500,
  137. width: 500,
  138. title: title,
  139. url: '${contextRoot}/app/appDetail',
  140. //load: true,
  141. urlParms: params
  142. });
  143. },
  144. appServiceManage: function (id) {
  145. indexPage.openChildPage("",'${contextRoot}/app/initAppService?appId='+id);
  146. },
  147. anthorize: function (id) {
  148. },
  149. //弹窗返回
  150. dialogSuccess: function (message) {
  151. $.ligerDialog.success(message);
  152. app.reloadGrid();
  153. app.dialog.close();
  154. }
  155. };
  156. $(function () {
  157. app.init();
  158. });
  159. </script>