SeeSynergyForm.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. Ext.define('erp.view.oa.myProcess.synergy.SeeSynergyForm',{ //文档查看界面
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.erpSeeSynergyFormPanel',
  4. id: 'form',
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. region: 'center',
  7. frame : true,
  8. fieldDefaults: {
  9. labelWidth: 80,
  10. cls: 'form-field-allowBlank'
  11. },
  12. layout: {
  13. type: 'vbox',//hbox水平盒布局
  14. align: 'stretch' // Child items are stretched to full width子面板高度充满父容器
  15. },
  16. items: [{
  17. xtype: 'displayfield',
  18. fieldLabel: '标题',
  19. id:'sy_title',
  20. name: 'sy_title'
  21. }, {
  22. xtype: 'displayfield',
  23. fieldLabel: '协同类型',
  24. id:'sy_type',
  25. name: 'sy_type'
  26. }, {
  27. xtype: 'displayfield',
  28. fieldLabel: '发布日期',
  29. name: 'sy_date',
  30. id: 'sy_date'
  31. }, {
  32. xtype: 'displayfield',
  33. fieldLabel: '发布人',
  34. name: 'sy_releaser',
  35. id: 'sy_releaser'
  36. }, {
  37. xtype: 'displayfield',
  38. fieldLabel: '附件',
  39. name: 'attach',
  40. id: 'attach'
  41. }, {
  42. xtype: 'htmleditor',
  43. fieldLabel: '',
  44. height: 300,
  45. name: 'sy_content',
  46. readOnly: true,
  47. id: 'sy_content'
  48. }],
  49. buttonAlign: 'center',
  50. buttons: [{
  51. // id: 'update',
  52. // text: $I18N.common.button.erpUpdateButton,
  53. // iconCls: 'x-button-icon-submit',
  54. // cls: 'x-btn-gray'
  55. // },{
  56. id: 'delete',
  57. text: $I18N.common.button.erpDeleteButton,
  58. iconCls: 'x-button-icon-delete',
  59. cls: 'x-btn-gray'
  60. },{
  61. // id: 'export',
  62. // text: $I18N.common.button.erpExportButton,
  63. // iconCls: 'x-button-icon-submit',
  64. // cls: 'x-btn-gray'
  65. // },{
  66. id: 'print',
  67. text: $I18N.common.button.erpPrintButton,
  68. iconCls: 'x-button-icon-print',
  69. cls: 'x-btn-gray'
  70. },{
  71. id: 'close',
  72. text: '关闭',
  73. iconCls: 'group-close',
  74. cls: 'x-btn-gray'
  75. }],
  76. initComponent : function(){
  77. this.callParent(arguments);
  78. this.getSynergyDetail(getUrlParam('id'));
  79. },
  80. getSynergyDetail: function(id){
  81. // parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  82. var me = this;
  83. Ext.Ajax.request({//拿到grid的columns
  84. url : basePath + "oa/myProcess/synergy/getSynergy.action",
  85. params: {
  86. id: id
  87. },
  88. method : 'post',
  89. callback : function(options, success, response){
  90. // parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  91. // console.log(response);
  92. var res = new Ext.decode(response.responseText);
  93. if(res.exceptionInfo){
  94. showError(res.exceptionInfo);return;
  95. }
  96. if(!res.synergy){
  97. return;
  98. } else {
  99. Ext.getCmp('sy_title').setValue(res.synergy.sy_title);
  100. Ext.getCmp('sy_content').setValue(res.synergy.sy_content);
  101. Ext.getCmp('sy_type').setValue(res.synergy.sy_type);
  102. Ext.getCmp('sy_releaser').setValue(res.synergy.sy_releaser);
  103. // Ext.getCmp('attach').setValue(res.synergy.sy_attach_id);
  104. if(res.synergy.sy_attach_id != null && res.synergy.sy_attach_id != ''){
  105. var text = "";
  106. var attach = res.synergy.sy_attach_id.split(',');
  107. // var attach = new Array();
  108. Ext.each(attach, function(a, index){
  109. Ext.Ajax.request({//拿到grid的columns
  110. url : basePath + "oa/myProcess/synergy/getAttach.action",
  111. params: {
  112. id: a
  113. },
  114. method : 'post',
  115. async: false,
  116. callback : function(options, success, response){
  117. // parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  118. // console.log(response);
  119. var res = new Ext.decode(response.responseText);
  120. if(res.exceptionInfo){
  121. showError(res.exceptionInfo);return;
  122. }
  123. if(res.success){
  124. attach[index] = res.path;
  125. // alert(attach[index]);
  126. }
  127. }
  128. });
  129. });
  130. console.log(attach);
  131. Ext.each(attach, function(a, index){
  132. var path = a.toString();
  133. if(me.BaseUtil.contains(a, '\\', true)){
  134. text += "&nbsp;&nbsp;<a class='mail-attach' href='" + basePath + "common/download.action?path=" + path + "'>" + a.substring(a.lastIndexOf('\\') + 1) + "</a>";
  135. } else {
  136. text += "&nbsp;&nbsp;<a class='mail-attach' href='" + basePath + "common/download.action?path=" + path + "'>" + a.substring(a.lastIndexOf('/') + 1) + "</a>";
  137. }
  138. });
  139. alert(text);
  140. Ext.getCmp('attach').setValue(text);
  141. } else {
  142. Ext.getCmp('attach').hide();
  143. }
  144. Ext.getCmp('sy_date').setValue(Ext.util.Format.date(new Date(res.synergy.sy_date),'Y-m-d H:i:s'));
  145. }
  146. }
  147. });
  148. }
  149. });