RecordLog.js 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.plm.record.RecordLog', {
  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','core.form.FileField','core.form.MultiField','core.form.YnField'
  12. ],
  13. init:function(){
  14. var me = this;
  15. me.attachcount = 0;
  16. this.control({
  17. 'erpGridPanel2': {
  18. //itemclick: this.onGridItemClick
  19. },
  20. 'erpSaveButton': {
  21. afterrender: function(btn){
  22. btn.hide();
  23. },
  24. },
  25. 'erpUpdateButton':{
  26. afterrender: function(btn){
  27. btn.hide();
  28. },
  29. },
  30. 'erpCloseButton': {
  31. afterrender: function(btn){
  32. var value=Ext.getCmp('wr_taskpercentdone').getValue();
  33. var unit=Ext.getCmp('wr_assignpercent').getValue();
  34. var percent=Ext.getCmp('wr_percentdone');
  35. percent.setReadOnly(true);
  36. value=value+(percent.value)*unit/100;
  37. Ext.getCmp('wr_progress').updateProgress(value/100,'当前任务进度:'+Math.round(value)+'%');
  38. Ext.getCmp('wr_redcord').setHeight(320);
  39. var form=me.getForm(btn);
  40. var attachs=Ext.getCmp("wr_attachs").getValue();
  41. if(attachs!=null){
  42. Ext.Ajax.request({//拿到grid的columns
  43. url : basePath + 'common/getFilePaths.action',
  44. async: false,
  45. params: {
  46. id:attachs
  47. },
  48. method : 'post',
  49. callback : function(options,success,response){
  50. var res = new Ext.decode(response.responseText);
  51. if(res.exception || res.exceptionInfo){
  52. showError(res.exceptionInfo);
  53. return;
  54. }
  55. attach = res.files != null ? res.files : [];
  56. }
  57. });
  58. form.add({
  59. title:'相关文件',
  60. id:'container',
  61. style: {borderColor:'green', borderStyle:'solid', borderWidth:'0px'},
  62. xtype:'container',
  63. columnWidth:1
  64. });
  65. var items = new Array();
  66. items.push({
  67. style: 'background:#CDBA96;',
  68. html: '<h1>相关文件:</h1>',
  69. });
  70. Ext.each(attach, function(){
  71. var path = this.fp_path;
  72. var name = '';
  73. if(contains(path, '\\', true)){
  74. name = path.substring(path.lastIndexOf('\\') + 1);
  75. } else {
  76. name = path.substring(path.lastIndexOf('/') + 1);
  77. }
  78. items.push({
  79. style: 'background:#C6E2FF;',
  80. html: '<img src="' + basePath + 'resource/images/mainpage/things.png" width=16 height=16/>' +
  81. '<span>文件:' + name + '<a href="' + basePath + "common/download.action?path=" + path + '">下载</a></span>',
  82. });
  83. });
  84. Ext.getCmp('container').add(items);
  85. }
  86. },
  87. click: function(btn){
  88. this.FormUtil.beforeClose(this);
  89. }
  90. },
  91. });
  92. },
  93. getForm: function(btn){
  94. return btn.ownerCt.ownerCt;
  95. },
  96. });