VastDatalist.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.common.VastDatalist', {
  3. extend: 'Ext.app.Controller',
  4. views:[
  5. 'common.vastDatalist.Viewport','common.vastDatalist.GridPanel','core.grid.YnColumn',
  6. 'common.vastDatalist.Toolbar','core.button.VastDelete','core.button.VastPost',
  7. 'core.button.VastClose','core.button.VastReStart','core.button.VastFreeze',
  8. 'core.button.VastSend','core.button.VastAudit','core.button.VastSubmit',
  9. 'core.button.VastSave','core.button.VastSpare','core.button.VastSimulate',
  10. 'core.button.VastWriexam','core.button.VastInterview','core.button.VastJointalcpool',
  11. 'core.button.VastWritemark','core.button.VastIntermark','core.button.VastTurnfullmemb',
  12. 'core.button.VastTurnover','core.button.VastTurnCaree','core.button.Turnfullmemb',
  13. 'core.button.TurnPosition','core.button.TurnCaree','core.button.VastSocailaccount',
  14. 'core.button.VastSocailsecu','core.button.VastGet','core.button.VastSendOut',
  15. 'core.button.AgreeToPrice','core.button.AgreeAllToPrice','core.button.NotAgreeToPrice',
  16. 'core.button.Sync'
  17. ],
  18. init:function(){
  19. var me = this;
  20. this.control({
  21. 'erpVastDeleteButton': {//btn.url在GridButton里面配置
  22. click: function(btn){
  23. me.vastDeal(btn.url || 'common/vastDelete.action');
  24. }
  25. },
  26. 'erpVastCloseButton': {
  27. click: function(btn){
  28. me.vastDeal(btn.url || 'common/vastClose.action');
  29. }
  30. },
  31. 'erpVastReStartButton': {
  32. click: function(btn){
  33. me.vastDeal(btn.url || 'common/vastResStart.action');
  34. }
  35. },
  36. 'erpVastFreezeButton': {
  37. click: function(btn){
  38. me.vastDeal(btn.url || 'common/vastFreeze.action');
  39. }
  40. },
  41. 'erpVastSendButton': {
  42. click: function(btn){
  43. me.vastDeal(btn.url || 'common/vastSend.action');
  44. }
  45. },
  46. 'erpVastAuditButton': {
  47. click: function(btn){
  48. me.vastDeal(btn.url || 'common/vastAudit.action');
  49. }
  50. },
  51. 'erpVastSubmitButton': {
  52. click: function(btn){
  53. me.vastDeal(btn.url || 'common/vastSubmit.action');
  54. }
  55. },
  56. 'erpVastSaveButton': {
  57. click: function(btn){
  58. me.vastSave(btn.url || 'common/vastSave.action');
  59. }
  60. },
  61. 'erpVastSpareButton': {
  62. click: function(btn){
  63. me.vastDeal(btn.url || 'common/vastSpare.action');
  64. }
  65. },
  66. 'erpVastSimulateButton': {
  67. click: function(btn){
  68. me.vastDeal(btn.url || 'common/vastSimulate.action');
  69. }
  70. },
  71. 'erpVastWriexamButton':{
  72. click: function(btn){
  73. me.vastDeal(btn.url || 'hr/emplmana/vastWriexam.action');
  74. }
  75. },
  76. 'erpVastInterviewButton':{
  77. click: function(btn){
  78. me.vastDeal(btn.url || 'hr/emplmana/vastInterview.action');
  79. }
  80. },
  81. 'erpVastJointalcpoolButton':{
  82. click: function(btn){
  83. me.vastDeal(btn.url || 'hr/emplmana/vastJointalcpool.action');
  84. }
  85. },
  86. 'erpVastWritemarkButton':{
  87. click: function(btn){
  88. me.vastMark(btn.url || 'hr/emplmana/vastWritemark.action','re_mark');
  89. }
  90. },
  91. 'erpVastIntermarkButton':{
  92. click: function(btn){
  93. me.vastMark(btn.url || 'hr/emplmana/vastIntermark.action','re_intermark');
  94. }
  95. },
  96. 'erpVastSocailaccountButton':{
  97. click: function(btn){
  98. me.vastMark(btn.url || 'hr/emplmana/vastSocailaccount.action','em_accumucard');
  99. }
  100. },
  101. 'erpVastSocailsecuButton':{
  102. click: function(btn){
  103. me.vastMark(btn.url || 'hr/emplmana/vastSocailsecu.action','em_socailcard');
  104. }
  105. },
  106. 'erpVastTurnfullmembButton':{
  107. click: function(btn){
  108. me.vastDealreload(btn.url || 'hr/emplmana/vastTurnfullmemb.action');
  109. }
  110. },
  111. 'erpVastTurnoverButton':{
  112. click: function(btn){
  113. me.vastDealreload(btn.url || 'hr/emplmana/vastTurnover.action');
  114. }
  115. },
  116. 'erpVastTurnCareeButton':{
  117. click: function(btn){
  118. me.vastDeal(btn.url || 'hr/emplmana/vastTurnCaree.action');
  119. }
  120. },
  121. 'erpTurnfullmembButton':{
  122. click: function(btn){
  123. me.vastDeal(btn.url || 'hr/emplmana/turnfullmemb.action');
  124. }
  125. },
  126. 'erpTurnPositionButton':{
  127. click: function(btn){
  128. me.vastDeal(btn.url || 'hr/emplmana/turnPosition.action');
  129. }
  130. },
  131. 'erpTurnCareeButton':{
  132. click: function(btn){
  133. me.vastDeal(btn.url || 'hr/emplmana/turnCaree.action');
  134. }
  135. },
  136. 'erpVastGetButton': {
  137. click: function(btn){
  138. me.vastSave(btn.url || 'common/vastSave.action');
  139. }
  140. },
  141. 'erpVastSendOutButton': {
  142. click: function(btn){
  143. me.vastSave(btn.url || 'common/vastSave.action');
  144. }
  145. },
  146. 'erpAgreeToPriceButton': {
  147. click: function(btn){
  148. me.vastDeal(btn.url || 'common/vastAgreeTurnPrice.action?_noc=1');
  149. }
  150. },
  151. 'erpNotAgreeToPriceButton': {
  152. click: function(btn){
  153. me.vastDeal(btn.url || 'common/vastNotAgreeTurnPrice.action?_noc=1');
  154. }
  155. },
  156. 'button[id=closebutton]':{
  157. afterrender:function(btn){
  158. btn.ownerCt.ownerCt.getButtons();
  159. }
  160. },
  161. 'erpSyncButton': {
  162. afterrender: function(btn) {
  163. btn.caller = caller;
  164. var grid = btn.ownerCt.ownerCt;
  165. if(typeof keyField !== 'undefined') {
  166. grid.selModel.on('selectionchange', function(sel, selected){
  167. var ids = [];
  168. Ext.Array.each(selected, function(){
  169. ids.push(this.get(keyField));
  170. });
  171. btn.syncdatas = ids.join(',');
  172. });
  173. }
  174. }
  175. }
  176. });
  177. },
  178. vastDealreload: function(url){
  179. var grid = Ext.getCmp('grid');
  180. var records = grid.getMultiSelected();
  181. if(records.length > 0){
  182. var id = new Array();
  183. Ext.each(records, function(record, index){
  184. id[index] = record.data[keyField];
  185. });
  186. var main = parent.Ext.getCmp("content-panel");
  187. main.getActiveTab().setLoading(true);//loading...
  188. Ext.Ajax.request({
  189. url : basePath + url,
  190. params: {
  191. caller: caller,
  192. id: id
  193. },
  194. method : 'post',
  195. callback : function(options,success,response){
  196. main.getActiveTab().setLoading(false);
  197. var localJson = new Ext.decode(response.responseText);
  198. if(localJson.exceptionInfo){
  199. showError(localJson.exceptionInfo);
  200. return "";
  201. }
  202. if(localJson.success){
  203. Ext.Msg.alert("提示", "处理成功!", function(){
  204. window.location.reload();
  205. /*main.getActiveTab().close();*/
  206. });
  207. }
  208. }
  209. });
  210. }
  211. },
  212. vastDeal: function(url){
  213. var grid = Ext.getCmp('grid');
  214. var records = grid.getMultiSelected();
  215. if(records.length > 0){
  216. var id = new Array();
  217. Ext.each(records, function(record, index){
  218. id[index] = record.data[keyField];
  219. });
  220. var main = parent.Ext.getCmp("content-panel");
  221. main.getActiveTab().setLoading(true);//loading...
  222. Ext.Ajax.request({
  223. url : basePath + url,
  224. params: {
  225. caller: caller,
  226. id: id
  227. },
  228. method : 'post',
  229. callback : function(options,success,response){
  230. main.getActiveTab().setLoading(false);
  231. var localJson = new Ext.decode(response.responseText);
  232. if(localJson.exceptionInfo){
  233. showError(localJson.exceptionInfo);
  234. return "";
  235. }
  236. if(localJson.success){
  237. Ext.Msg.alert("提示", "处理成功!", function(){
  238. //window.location.reload();
  239. main.getActiveTab().close();
  240. });
  241. }
  242. }
  243. });
  244. }
  245. },
  246. vastMark: function(url,field){
  247. var grid = Ext.getCmp('grid');
  248. var records = grid.multiselected;
  249. if(records.length > 0){
  250. var id = new Array();
  251. var mark = new Array();
  252. Ext.each(records, function(record, index){
  253. id[index] = record.data[keyField];
  254. mark[index] = record.data[field];
  255. });
  256. var main = parent.Ext.getCmp("content-panel");
  257. main.getActiveTab().setLoading(true);//loading...
  258. Ext.Ajax.request({
  259. url : basePath + url,
  260. params: {
  261. caller: caller,
  262. id: id,
  263. mark:mark
  264. },
  265. method : 'post',
  266. callback : function(options,success,response){
  267. main.getActiveTab().setLoading(false);
  268. var localJson = new Ext.decode(response.responseText);
  269. if(localJson.exceptionInfo){
  270. showError(localJson.exceptionInfo);
  271. return "";
  272. }
  273. if(localJson.success){
  274. Ext.Msg.alert("提示", "处理成功!", function(){
  275. main.getActiveTab().close();
  276. });
  277. }
  278. }
  279. });
  280. }
  281. },
  282. vastSave: function(url){
  283. var grid = Ext.getCmp('grid');
  284. var data = grid.getEffectData();
  285. if(data.length > 0){
  286. var main = parent.Ext.getCmp("content-panel");
  287. main.getActiveTab().setLoading(true);//loading...
  288. Ext.Ajax.request({
  289. url : basePath + url,
  290. params: {
  291. caller: caller,
  292. data: Ext.encode(data)
  293. },
  294. method : 'post',
  295. callback : function(options,success,response){
  296. main.getActiveTab().setLoading(false);
  297. var localJson = new Ext.decode(response.responseText);
  298. if(localJson.exceptionInfo){
  299. showError(localJson.exceptionInfo);
  300. return "";
  301. }
  302. if(localJson.success){
  303. Ext.Msg.alert("提示", "处理成功!", function(){
  304. window.location.href = window.location.href;
  305. });
  306. }
  307. }
  308. });
  309. }
  310. }
  311. });