SpecialRecord.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.plm.record.SpecialRecord', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. GridUtil: Ext.create('erp.util.GridUtil'),
  6. BaseUtil: Ext.create('erp.util.BaseUtil'),
  7. views:[
  8. 'plm.record.RecordLog','core.form.Panel','core.grid.Panel2','core.toolbar.Toolbar','core.button.Upload','core.button.DownLoad',
  9. 'core.button.Add','core.button.Submit','core.button.Audit','core.button.Save','core.button.Close','core.button.Print',
  10. 'core.button.Upload','core.button.Update','core.button.Delete','core.button.ResAudit','core.button.DeleteDetail',
  11. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','common.datalist.GridPanel','plm.record.SpecialTreePanel',
  12. ],
  13. init:function(){
  14. var me = this;
  15. me.attachcount = 0;
  16. this.control({
  17. 'erpSpecialTreePanel': {
  18. itemmousedown: function(selModel, record){
  19. if(record.get('leaf')){
  20. var id=record.data.id;
  21. Ext.get('grid').hide();
  22. Ext.getCmp('form').show();
  23. Ext.Ajax.request({//拿到grid的columns
  24. url : basePath + 'common/loadNewFormStore.action',
  25. async: false,
  26. params: {
  27. caller: caller,
  28. condition:"wr_id="+id
  29. },
  30. method : 'post',
  31. callback : function(options,success,response){
  32. var res = new Ext.decode(response.responseText);
  33. var data=new Ext.decode(res.data);
  34. Ext.getCmp('form').getForm().setValues(data)
  35. Ext.getCmp('wr_progress').updateProgress(data.wr_taskpercentdone/100,'当前任务进度:'+Math.round(data.wr_taskpercentdone)+'%');
  36. }
  37. });
  38. if(id!=''){
  39. Ext.Ajax.request({//拿到grid的columns
  40. url : basePath + 'common/getFormAttachs.action',
  41. async: false,
  42. params: {
  43. caller: caller,
  44. keyvalue: id
  45. },
  46. method : 'post',
  47. callback : function(options,success,response){
  48. var res = new Ext.decode(response.responseText);
  49. if(res.exception || res.exceptionInfo){
  50. showError(res.exceptionInfo);
  51. return;
  52. }
  53. attach = res.attach != null ? res.attach : [];
  54. }
  55. });
  56. if(!Ext.getCmp('container')){
  57. Ext.getCmp('form').add({
  58. title:'相关文件',
  59. id:'container',
  60. style: {borderColor:'green', borderStyle:'solid', borderWidth:'0px'},
  61. xtype:'container',
  62. columnWidth:1
  63. });
  64. }
  65. Ext.getCmp('container').removeAll();
  66. var items = new Array();
  67. items.push({
  68. style: 'background:#CDBA96;',
  69. html: '<h1>相关附件:</h1>',
  70. });
  71. Ext.each(attach, function(){
  72. var path = this.fa_path;
  73. var name = '';
  74. if(contains(path, '\\', true)){
  75. name = path.substring(path.lastIndexOf('\\') + 1);
  76. } else {
  77. name = path.substring(path.lastIndexOf('/') + 1);
  78. }
  79. items.push({
  80. style: 'background:#C6E2FF;',
  81. html: '<img src="' + basePath + 'resource/images/mainpage/things.png" width=16 height=16/>' +
  82. '<span>文件:' + name + '<a href="' + basePath + "common/download.action?path=" + path + '">下载</a></span>',
  83. });
  84. });
  85. Ext.getCmp('container').add(items);
  86. }
  87. }
  88. },
  89. afterrender:function(panel){
  90. var item=new Object();
  91. var button=new Object();
  92. button.xtype='button';
  93. button.cls='btn-cls';
  94. button.text='查看列表';
  95. button.iconCls='x-button-icon-addgroup';
  96. button.style='margin-left:20px;';
  97. button.handler=function open(){
  98. Ext.get('grid').show();
  99. Ext.getCmp('form').hide();
  100. };
  101. panel.add(button);
  102. },
  103. },
  104. 'erpSaveButton': {
  105. afterrender: function(btn){
  106. btn.hide();
  107. },
  108. },
  109. 'erpUpdateButton':{
  110. afterrender: function(btn){
  111. btn.hide();
  112. },
  113. },
  114. 'erpCloseButton': {
  115. afterrender: function(btn){
  116. Ext.getCmp('wr_redcord').setHeight(280);
  117. btn.hide();
  118. },
  119. },
  120. 'erpUploadButton':{
  121. afterrender: function(btn){
  122. btn.hide();
  123. },
  124. }
  125. });
  126. },
  127. getForm: function(btn){
  128. return btn.ownerCt.ownerCt;
  129. },
  130. });