datalist.jsp 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. <script type="text/javascript" src="<%=basePath %>resource/ext/ext-all.js"></script>
  14. <script type="text/javascript" src="<%=basePath %>resource/i18n/i18n.js"></script>
  15. <script type="text/javascript" src="<%=basePath %>resource/ux/grid/GridHeaderFilters.js"></script>
  16. <script type="text/javascript" src="<%=basePath %>resource/ux/data/PagingMemoryProxy.js"></script>
  17. <script type="text/javascript">
  18. Ext.Loader.setConfig({
  19. enabled: true
  20. });//开启动态加载
  21. Ext.application({
  22. name: 'erp',//为应用程序起一个名字,相当于命名空间
  23. appFolder: basePath+'app',//app文件夹所在路径
  24. controllers: [//声明所用到的控制层
  25. 'common.Datalist'
  26. ],
  27. launch: function() {
  28. Ext.create('erp.view.common.datalist.Viewport');
  29. }
  30. });
  31. var caller = '';
  32. var condition = '';
  33. var parentDoc = getUrlParam('parentDoc');// 对于Ext.window嵌套的datalist.jsp,可以将window的id传入,以便操作
  34. var page = 1;
  35. var value = 0;
  36. var total = 0;
  37. var dataCount = 0;//结果总数
  38. var msg = '';
  39. var height = window.innerHeight;
  40. if(Ext.isIE){//ie不支持window.innerHeight;document.documentElement.clientHeight == 0
  41. height = screen.height*0.73;
  42. }
  43. var pageSize = parseInt(height*0.7/23);
  44. var keyField = "";
  45. var pfField = "";
  46. var url = "";
  47. var relative = null;
  48. var Contextvalue="";
  49. var LastValue="";
  50. var _self=null;
  51. //给datalist加上ctrl+alt+s键盘事件,自动跳转datalist配置界面
  52. function onDatalistKeyDown(){
  53. if(Ext.isIE){
  54. document.body.attachEvent('onkeydown', function(){//ie的事件名称不同,也不支持addEventListener
  55. if(window.event.altKey && window.event.ctrlKey && window.event.keyCode == 83){
  56. openTable('DataList维护(' + caller + ')', "jsps/ma/dataList.jsp?formCondition=dl_callerIS'" + caller + "'" +
  57. "&gridCondition=dld_callerIS'" + caller + "'");
  58. }
  59. });
  60. } else {
  61. document.body.addEventListener("keydown", function(e){
  62. if(Ext.isFF5){//firefox不支持window.event
  63. e = e || window.event;
  64. }
  65. if(e.altKey && e.ctrlKey && e.keyCode == 83){
  66. openTable('DataList维护(' + caller + ')', "jsps/ma/dataList.jsp?formCondition=dl_callerIS'" + caller + "'" +
  67. "&gridCondition=dld_callerIS'" + caller + "'");
  68. }
  69. });
  70. }
  71. }
  72. function openTable(title, url){
  73. var panel = Ext.getCmp('datalist' + caller);
  74. var main = parent.Ext.getCmp("content-panel");
  75. if(!panel){
  76. panel = {
  77. title : caller,
  78. tag : 'iframe',
  79. tabConfig:{tooltip: title},
  80. frame : true,
  81. border : false,
  82. layout : 'fit',
  83. iconCls : 'x-tree-icon-tab-tab',
  84. html : '<iframe id="iframe_maindetail_pageSet" src="' + basePath + url + '" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>',
  85. closable : true,
  86. listeners : {
  87. close : function(){
  88. main.setActiveTab(main.getActiveTab().id);
  89. }
  90. }
  91. };
  92. var p = main.add(panel);
  93. main.setActiveTab(p);
  94. }else{
  95. main.setActiveTab(panel);
  96. }
  97. }
  98. function openTable1(id, caller, title, link, key, detailKey, condition,relateMaster,limit){console.log(101);
  99. var main = parent.Ext.getCmp("content-panel");
  100. var item=main.items.items[0];
  101. var panel = Ext.getCmp('' + id);
  102. var url = parseUrl(link);
  103. if(id){
  104. if(caller){
  105. panel = Ext.getCmp(caller + id);
  106. if(url.indexOf('?')>0) {
  107. url = link + '&whoami=' + caller;
  108. }
  109. else url = link + '?whoami=' + caller;
  110. url = url + '&formCondition=' + key + '=' + id + '&gridCondition=' + detailKey + '=' + id;
  111. }
  112. } else {
  113. if(condition != null){
  114. url += '&urlcondition=' + parseUrl(condition);
  115. }
  116. }
  117. if(!limit){
  118. if(url.indexOf('?') > 0)
  119. url += '&_noc=1';
  120. else
  121. url += '?_noc=1';
  122. }
  123. if(relateMaster && relateMaster!='null'){
  124. url+='&newMaster='+relateMaster;
  125. }
  126. if( relateMaster && relateMaster!='null' ){
  127. var currentMaster = parent.window.sob;
  128. if ( currentMaster/* && currentMaster != relateMaster */) {// 无论账套是否一致都创建临时会话
  129. if (parent.Ext) {
  130. Ext.Ajax.request({
  131. url: basePath + 'common/changeMaster.action',
  132. params: {
  133. to: relateMaster
  134. },
  135. callback: function(opt, s, r) {
  136. if (s) {
  137. url+='&_center=1';
  138. var win = parent.Ext.create('Ext.Window', {
  139. width: '100%',
  140. height: '100%',
  141. draggable: false,
  142. closable: false,
  143. modal: true,
  144. title: '创建到账套' + relateMaster + '的临时会话',
  145. id:'modalwindow',
  146. historyMaster:currentMaster,
  147. relateMaster:currentMaster,
  148. html : '<iframe src="' + url + '" height="100%" width="100%" frameborder="0" style="border-width: 0px;padding: 0px;" scrolling="auto"></iframe>',
  149. buttonAlign: 'center',
  150. buttons: [{
  151. text: $I18N.common.button.erpCloseButton,
  152. cls: 'x-btn-blue',
  153. id: 'close',
  154. handler: function(b) {
  155. Ext.Ajax.request({
  156. url: basePath + 'common/changeMaster.action',
  157. params: {
  158. to: currentMaster
  159. },
  160. callback: function(opt, s, r) {
  161. if (s) {
  162. b.up('window').close();
  163. } else {
  164. alert('切换到原账套失败!');
  165. }
  166. }
  167. });
  168. }
  169. }]
  170. });
  171. win.show();
  172. } else {
  173. alert('无法创建到账套' + relateMaster + '的临时会话!');
  174. }
  175. }
  176. });
  177. }
  178. return;
  179. }
  180. }
  181. if(!panel){
  182. panel = {
  183. title : title.substring(0, title.toString().length > 5 ? 5 : title.toString().length),
  184. tag : 'iframe',
  185. tabConfig:{tooltip: title},
  186. border : false,
  187. layout : 'fit',
  188. iconCls : 'x-tree-icon-tab-tab',
  189. html : '<iframe id="iframe" src="' + basePath + url + '" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>',
  190. closable : true,
  191. listeners : {
  192. close : function(){
  193. main.setActiveTab(main.getActiveTab().id);
  194. }
  195. }
  196. };
  197. openTab(panel, panel.id);
  198. }else{
  199. main.setActiveTab(panel);
  200. }
  201. }
  202. function parseUrl(url) {
  203. var id = url.substring(url.lastIndexOf('?')+1);
  204. if (id == null) {
  205. id = url.substring(0,url.lastIndexOf('.'));
  206. }
  207. if(contains(url, 'session:em_uu', true)){
  208. url = url.replace(/session:em_uu/,em_uu);
  209. }
  210. if(contains(url, 'session:em_code', true)){
  211. url = url.replace(/session:em_code/, "'" + em_code + "'");
  212. }
  213. if(contains(url, 'sysdate', true)){
  214. url = url.replace(/sysdate/, "to_date('" + Ext.Date.toString(new Date()) + "','yyyy-mm-dd')");
  215. }
  216. if(contains(url, 'session:em_name', true)){
  217. url = url.replace(/session:em_name/,"'"+em_name+"'" );
  218. }
  219. return url;
  220. }
  221. function openTab(panel, id){
  222. var o = (typeof panel == "string" ? panel : id || panel.id);
  223. var main = parent.Ext.getCmp("content-panel");
  224. var tab = main.getComponent(o);
  225. if (tab) {
  226. main.setActiveTab(tab);
  227. } else if(typeof panel!="string"){
  228. panel.id = o;
  229. var p = main.add(panel);
  230. main.setActiveTab(p);
  231. }
  232. }
  233. </script>
  234. </head>
  235. <body onload="onDatalistKeyDown()">
  236. </body>
  237. </html>