EditDatalist.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.common.EditDatalist', {
  3. extend: 'Ext.app.Controller',
  4. requires: ['erp.util.BaseUtil', 'erp.util.FormUtil', 'erp.util.RenderUtil'],
  5. views:[
  6. 'common.editDatalist.Viewport','common.editDatalist.GridPanel','common.editDatalist.Toolbar','core.form.FtField',
  7. 'core.grid.TfColumn','core.grid.YnColumn','core.trigger.DbfindTrigger','core.form.FtDateField','core.form.FtFindField',
  8. 'core.form.FtNumberField','core.form.MonthDateField'
  9. ],
  10. init:function(){
  11. this.BaseUtil = Ext.create('erp.util.BaseUtil');
  12. this.FormUtil = Ext.create('erp.util.FormUtil');
  13. this.control({
  14. 'erpEditDatalistGridPanel': {
  15. afterrender:function(grid){
  16. if(Ext.isIE){
  17. document.body.attachEvent('onkeydown', function(){
  18. if(window.event.ctrlKey && window.event.keyCode == 67){//Ctrl + C
  19. var e = window.event;
  20. if(e.srcElement) {
  21. window.clipboardData.setData('text', e.srcElement.innerHTML);
  22. }
  23. }
  24. });
  25. } else {
  26. grid.getEl().dom.addEventListener("mouseover", function(e){
  27. if(e.ctrlKey){
  28. var Contextvalue=e.target.textContent==""?e.target.value:e.target.textContent;
  29. textarea_text = parent.document.getElementById("textarea_text");
  30. textarea_text.value=Contextvalue;
  31. textarea_text.focus();
  32. textarea_text.select();
  33. }
  34. });
  35. }
  36. }
  37. },
  38. 'erpVastDeleteButton': {
  39. click: function(btn){
  40. var dlwin = new Ext.window.Window({
  41. id : 'dlwin',
  42. title: btn.text,
  43. height: "100%",
  44. width: "80%",
  45. maximizable : true,
  46. buttonAlign : 'center',
  47. layout : 'anchor',
  48. items: [{
  49. tag : 'iframe',
  50. frame : true,
  51. anchor : '100% 100%',
  52. layout : 'fit',
  53. html : '<iframe id="iframe_dl_'+caller+'" src="'+basePath+'jsps/common/vastDatalist.jsp?urlcondition='+condition+'&whoami='+caller+'" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>'
  54. }],
  55. buttons : [{
  56. text: btn.text,
  57. iconCls: btn.iconCls,
  58. cls: 'x-btn-gray-1',
  59. handler: function(){
  60. }
  61. },{
  62. text : '关 闭',
  63. iconCls: 'x-button-icon-close',
  64. cls: 'x-btn-gray',
  65. handler : function(){
  66. Ext.getCmp('dlwin').close();
  67. }
  68. }]
  69. });
  70. dlwin.show();
  71. }
  72. },
  73. 'erpRefreshButton': {
  74. click: function(btn){
  75. Ext.Ajax.request({
  76. url: basePath + (btn.url || 'fa/gs/copyAccountRegister/refreshQuery.action'),
  77. params: {
  78. },
  79. method: 'post',
  80. callback: function(opt, s, r) {
  81. var rs = Ext.decode(r.responseText);
  82. if(rs.exceptionInfo){
  83. showError(rs.exceptionInfo);
  84. return "";
  85. }
  86. if(rs.success){
  87. Ext.Msg.alert("提示", "刷新成功!", function(){
  88. window.location.reload();
  89. });
  90. }
  91. }
  92. });
  93. }
  94. },
  95. 'erpVastSaveButton': {
  96. click: function(btn) {
  97. var grid = btn.ownerCt.ownerCt,
  98. data = grid.getEffectData();
  99. if(data.length > 0) {
  100. grid.setLoading(true);
  101. Ext.Ajax.request({
  102. url : basePath + (btn.url || 'common/vastSave.action'),
  103. params: {
  104. caller: caller,
  105. data: Ext.encode(data)
  106. },
  107. method : 'post',
  108. callback : function(options,success,response){
  109. grid.setLoading(false);
  110. var rs = new Ext.decode(response.responseText);
  111. if(rs.exceptionInfo){
  112. showError(rs.exceptionInfo);
  113. return "";
  114. }
  115. if(rs.success){
  116. Ext.Msg.alert("提示", "保存成功!", function(){
  117. window.location.reload();
  118. });
  119. }
  120. }
  121. });
  122. }
  123. }
  124. },
  125. 'erpVastGetButton': {
  126. click: function(btn) {
  127. var grid = btn.ownerCt.ownerCt,
  128. data = grid.getEffectData();
  129. if(data.length > 0) {
  130. grid.setLoading(true);
  131. Ext.Ajax.request({
  132. url : basePath + (btn.url || 'common/vastSave.action'),
  133. params: {
  134. caller: caller,
  135. data: Ext.encode(data)
  136. },
  137. method : 'post',
  138. callback : function(options,success,response){
  139. grid.setLoading(false);
  140. var rs = new Ext.decode(response.responseText);
  141. if(rs.exceptionInfo){
  142. showError(rs.exceptionInfo);
  143. return "";
  144. }
  145. if(rs.success){
  146. Ext.Msg.alert("提示", "保存成功!", function(){
  147. window.location.reload();
  148. });
  149. }
  150. }
  151. });
  152. }
  153. }
  154. },
  155. 'erpVastSendOutButton': {
  156. click: function(btn) {
  157. var grid = btn.ownerCt.ownerCt,
  158. data = grid.getEffectData();
  159. if(data.length > 0) {
  160. grid.setLoading(true);
  161. Ext.Ajax.request({
  162. url : basePath + (btn.url || 'common/vastSave.action'),
  163. params: {
  164. caller: caller,
  165. data: Ext.encode(data)
  166. },
  167. method : 'post',
  168. callback : function(options,success,response){
  169. grid.setLoading(false);
  170. var rs = new Ext.decode(response.responseText);
  171. if(rs.exceptionInfo){
  172. showError(rs.exceptionInfo);
  173. return "";
  174. }
  175. if(rs.success){
  176. Ext.Msg.alert("提示", "保存成功!", function(){
  177. window.location.reload();
  178. });
  179. }
  180. }
  181. });
  182. }
  183. }
  184. }
  185. });
  186. }
  187. });