appJs.jsp 7.0 KB

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