dbfind.jsp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <%@ page language="java" contentType="text/html; charset=utf-8"
  2. pageEncoding="utf-8"%>
  3. <%
  4. String path = request.getContextPath();
  5. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  6. %>
  7. <!DOCTYPE html>
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  11. <link rel="stylesheet" type="text/css" href="<%=basePath %>resource/ext/resources/css/ext-all-gray.css"/>
  12. <link rel="stylesheet" href="<%=basePath %>resource/css/main.css" type="text/css"></link>
  13. <style>
  14. .custom-grid-autoheight .x-grid-row, .custom-grid-autoheight .x-grid-row .x-grid-cell,.custom-grid-autoheight .x-grid-cell-inner {
  15. height: auto !important;
  16. white-space: normal;
  17. }
  18. </style>
  19. <script type="text/javascript" src="<%=basePath %>resource/ext/ext-all.js"></script>
  20. <script type="text/javascript" src="<%=basePath %>resource/i18n/i18n.js"></script>
  21. <script type="text/javascript" src="<%=basePath %>resource/ux/grid/GridHeaderFilters.js"></script>
  22. <script type="text/javascript" src="<%=basePath %>resource/ux/data/PagingMemoryProxy.js"></script>
  23. <script type="text/javascript">
  24. Ext.Loader.setConfig({
  25. enabled: true
  26. });//开启动态加载
  27. var key = getUrlParam('key');
  28. var keyValue = getUrlParam('keyValue');
  29. if(Ext.isEmpty(keyValue)) {
  30. keyValue = '';
  31. }
  32. if(keyValue == 0 || keyValue == '0') {
  33. keyValue = '';
  34. }
  35. var caller = '';
  36. var keyField = '';
  37. var dbkind=getUrlParam('dbkind'), dbOrderby = getUrlParam('ob');
  38. var condition ="1=1";
  39. var dbfind = getUrlParam('dbfind');
  40. var which = 'form';
  41. var triggerId = getUrlParam('trigger');
  42. var trigger = parent.Ext.getCmp(triggerId);
  43. var dbCondition = getUrlParam('dbCondition');
  44. var dbBaseCondition = getUrlParam('dbBaseCondition');
  45. var dbGridCondition = getUrlParam('dbGridCondition');
  46. var likecondition= dbkind || Ext.isEmpty(keyValue) ? null :getLikeCondition(key , keyValue);//'upper(' + key + ") like '%" + keyValue.replace(/\'/g,"''") + "%'";
  47. if(!trigger || trigger.column || !trigger.ownerCt || trigger.hidden){//如果是grid的dbfind
  48. which = 'grid';
  49. dbfind=decodeURIComponent(dbfind);
  50. caller = dbfind.split('|')[0];
  51. keyField = dbfind.split('|')[1];
  52. likecondition=Ext.isEmpty(keyValue)?null:getLikeCondition(keyField , keyValue);
  53. if(dbGridCondition){
  54. condition=condition+" AND "+ decodeURIComponent(dbGridCondition).replace(/\s{1}IS\s{1}/g, '=');
  55. }
  56. } else {
  57. caller = getUrlParam('caller');
  58. }
  59. if(dbCondition){
  60. condition=condition+" AND "+ decodeURIComponent(dbCondition).replace(/\s{1}IS\s{1}/g, '=');
  61. }
  62. if(dbBaseCondition){
  63. condition=condition+" AND "+decodeURIComponent(dbBaseCondition).replace(/\s{1}IS\s{1}/g, '=').replace(/@/g,'%');
  64. }
  65. var page = 1;
  66. var value = 0;
  67. var total = 0;
  68. var dataCount = 0;
  69. var msg = '';
  70. var height = window.innerHeight;
  71. if(Ext.isIE){//ie不支持window.innerHeight;document.documentElement.clientHeight == 0
  72. height = screen.height*0.6;
  73. }
  74. var pageSize = parseInt(height*0.7/24);
  75. var dbfinds = [];
  76. Ext.application({
  77. name: 'erp',//为应用程序起一个名字,相当于命名空间
  78. appFolder: basePath+'app',//app文件夹所在路径
  79. controllers: [//声明所用到的控制层
  80. 'common.Dbfind'
  81. ],
  82. launch: function() {
  83. Ext.create('erp.view.common.dbfind.Viewport');
  84. }
  85. });
  86. //加上ctrl+alt+s键盘事件,自动跳转配置界面
  87. function onKeyDown(){
  88. if(Ext.isIE){
  89. document.body.attachEvent('onkeydown', function(){//ie的事件名称不同,也不支持addEventListener
  90. if(window.event.altKey && window.event.ctrlKey && window.event.keyCode == 83){
  91. openTable('Dbfind维护(' + caller + ')', "jsps/ma/dbFindSet.jsp?formCondition=ds_callerIS'" + caller + "'" +
  92. "&gridCondition=dd_callerIS'" + caller + "'");
  93. }
  94. });
  95. } else {
  96. document.body.addEventListener("keydown", function(e){
  97. if(Ext.isFF5){//firefox不支持window.event
  98. e = e || window.event;
  99. }
  100. if(e.altKey && e.ctrlKey && e.keyCode == 83){
  101. openTable('Dbfind维护(' + caller + ')', "jsps/ma/dbFindSet.jsp?formCondition=ds_callerIS'" + caller + "'" +
  102. "&gridCondition=dd_callerIS'" + caller + "'");
  103. }
  104. });
  105. }
  106. }
  107. function openTable(title, url){
  108. var panel = Ext.getCmp('datalist' + caller);
  109. var main = parent.Ext.getCmp("content-panel");
  110. if(!panel){
  111. panel = {
  112. title : caller,
  113. tag : 'iframe',
  114. tabConfig:{tooltip: title},
  115. frame : true,
  116. border : false,
  117. layout : 'fit',
  118. iconCls : 'x-tree-icon-tab-tab',
  119. html : '<iframe id="iframe_maindetail_pageSet" src="' + basePath + url + '" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>',
  120. closable : true,
  121. listeners : {
  122. close : function(){
  123. main.setActiveTab(main.getActiveTab().id);
  124. }
  125. }
  126. };
  127. var p = main.add(panel);
  128. main.setActiveTab(p);
  129. }else{
  130. main.setActiveTab(panel);
  131. }
  132. }
  133. function getLikeCondition(keyField,keyValue){
  134. if (trigger.isFast){
  135. return keyField + " like '" + keyValue.replace(/\'/g,"''") + "%'";
  136. }else
  137. return 'upper(' + keyField + ") like '%" + keyValue.toUpperCase().replace(/\'/g,"''") + "%'";
  138. }
  139. </script>
  140. </head>
  141. <body onload="onKeyDown();">
  142. </body>
  143. </html>