appJs.jsp 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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="${dfs}/'+ 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\" style=\"padding-right:10px\" onclick=\"app.appFunctionManage('"+row.id+"','"+row.name+"')\">功能管理</a>";
  50. // html += "<a class=\"m-btn\" onclick=\"app.dialogDetail('"+row.id+"')\">应用标准</a>";
  51. html += "<a class=\"m-btn-edit\" onclick=\"app.editorDialog('"+row.id+"','')\"></a>";
  52. html += "<a class=\"m-btn-delete\" onclick=\"app.delete('"+row.id+"','"+row.icon+"')\"></a>";
  53. html += '</div>';
  54. return html;
  55. }
  56. }
  57. ],
  58. onDblClickRow: function (row) {
  59. me.editorDialog(row.id);
  60. }
  61. });
  62. },
  63. bindEvents: function () {
  64. var me = this;
  65. var flag = false;
  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. initIsTriggerEvent: false,
  72. onSelected: function (value)
  73. {
  74. if (flag) {
  75. me.reloadGrid();
  76. } else {
  77. flag = true;
  78. }
  79. },
  80. onSuccess:function(data){
  81. }});
  82. $(".l-text").css("display","inline-block");
  83. $(".l-text-wrapper").css("display","inline-block");
  84. },
  85. delete:function(id,icon){
  86. var message = "确定要删除该应用信息吗?";
  87. jQuery.ligerDialog.confirm(message, function (confirm) {
  88. if (confirm)
  89. {
  90. _deleteFileAfterUpdate(icon);
  91. $.ajax({ //ajax处理
  92. type: "POST",
  93. url : "${contextRoot}/app/deleteApp",
  94. dataType : "json",
  95. data:{id:id},
  96. cache:false,
  97. success :function(data){
  98. if(data.successFlg) {
  99. $.ligerDialog.success(data.message);
  100. app.grid.reload();
  101. }
  102. else{
  103. $.ligerDialog.error(data.message);
  104. }
  105. },
  106. error :function(data){
  107. $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
  108. }
  109. });
  110. }
  111. });
  112. },
  113. //刷新列表数据
  114. reloadGrid: function () {
  115. this.grid.set({
  116. parms: {name: $('#txtName').val(),status:$('#statusName_val').val()}
  117. });
  118. this.grid.reload();
  119. },
  120. //编辑弹窗
  121. editorDialog: function (id, flag) {
  122. var me = this;
  123. var title = "新增应用";
  124. var params = null;
  125. if (id != undefined && id != null) {
  126. title = "编辑应用";
  127. params = {"id": id, "flag": flag};
  128. }
  129. me.dialog = $.ligerDialog.open({
  130. height: 600,
  131. width: 500,
  132. title: title,
  133. url: '${contextRoot}/app/editorApp',
  134. //load: true,
  135. urlParms: params
  136. });
  137. },
  138. dialogDetail: function (id) {
  139. var me = this;
  140. var title = "应用详情";
  141. var params = null;
  142. if (id != undefined && id != null) {
  143. params = {"id": id};
  144. }
  145. me.dialog = $.ligerDialog.open({
  146. height: 500,
  147. width: 500,
  148. title: title,
  149. url: '${contextRoot}/app/appDetail',
  150. //load: true,
  151. urlParms: params
  152. });
  153. },
  154. appServiceManage: function (id) {
  155. indexPage.openChildPage("",'${contextRoot}/app/initAppService?appId='+id);
  156. },
  157. appFunctionManage: function (id,name) {
  158. var data = {
  159. 'dataModel':id+","+name
  160. }
  161. indexPage.openChildPage("",'${contextRoot}/app/feature/initial','',data);
  162. },
  163. anthorize: function (id) {
  164. },
  165. //弹窗返回
  166. dialogSuccess: function (message) {
  167. $.ligerDialog.success(message);
  168. app.reloadGrid();
  169. app.dialog.close();
  170. }
  171. };
  172. function _deleteFileAfterUpdate(fileId){
  173. if(null == fileId || fileId.length == 0){
  174. return;
  175. }
  176. var url = "${dfs}/" + fileId;
  177. $.ajax({
  178. url: url,
  179. type: 'DELETE',
  180. async: false,
  181. success: function(){
  182. console.log("旧文件删除成功");
  183. }
  184. });
  185. }
  186. $(function () {
  187. app.init();
  188. });
  189. </script>