InstructionDetailForm.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. Ext.define('erp.view.oa.officialDocument.instruction.InstructionDetailForm',{
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.erpInstructionDetailFormPanel',
  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: 'ID',
  19. id:'in_id',
  20. name: 'in_id'
  21. },{
  22. xtype: 'displayfield',
  23. fieldLabel: '请示类型',
  24. id:'in_type',
  25. name: 'in_type'
  26. }, {
  27. xtype: 'displayfield',
  28. fieldLabel: '请示日期',
  29. id:'in_date',
  30. name: 'in_date'
  31. }, {
  32. xtype: 'displayfield',
  33. fieldLabel: '请示标题',
  34. id:'in_title',
  35. name: 'in_title'
  36. }, {
  37. xtype: 'displayfield',
  38. fieldLabel: '请示部门',
  39. name: 'in_dept',
  40. id: 'in_dept'
  41. }, {
  42. xtype: 'displayfield',
  43. fieldLabel: '秘密等级',
  44. name: 'in_secretlevel',
  45. id: 'in_secretlevel'
  46. }, {
  47. xtype: 'displayfield',
  48. fieldLabel: '紧急程度',
  49. name: 'in_emergencydegree',
  50. id: 'in_emergencydegree'
  51. }, {
  52. xtype: 'displayfield',
  53. fieldLabel: '附件',
  54. name: 'in_attach',
  55. id: 'in_attach'
  56. },{
  57. xtype: 'htmleditor',
  58. hideLabel: true,
  59. autoScroll: true,
  60. readOnly: true,
  61. height: height*0.8,
  62. name: 'in_context',
  63. id: 'in_context',
  64. anchor: '100%'//编辑框******
  65. }],
  66. buttonAlign: 'center',
  67. buttons: [{
  68. id: 'close',
  69. text: '关闭',
  70. iconCls: 'group-close',
  71. cls: 'x-btn-gray'
  72. }],
  73. initComponent : function(){
  74. this.callParent(arguments);
  75. this.getInstructionDetail(getUrlParam('id'));
  76. },
  77. getInstructionDetail: function(id){
  78. var me = this;
  79. // parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  80. Ext.Ajax.request({//拿到grid的columns
  81. url : basePath + "oa/officialDocument/getInstructionDetail.action",
  82. params: {
  83. id: id
  84. },
  85. method : 'post',
  86. callback : function(options, success, response){
  87. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  88. console.log(response);
  89. var res = new Ext.decode(response.responseText);
  90. if(res.exceptionInfo){
  91. showError(res.exceptionInfo);return;
  92. }
  93. if(!res.instruction){
  94. return;
  95. } else {
  96. // var day = new Date(Ext.util.Format.date(new Date(res.rod.rod_date))); //将日期值格式化
  97. // var today = new Array("星期天","星期一","星期二","星期三","星期四","星期五","星期六");
  98. Ext.getCmp('in_date').setValue(Ext.util.Format.date(new Date(res.instruction.in_date)));// + "(" + today[day.getDay()] + ")");
  99. Ext.getCmp('in_type').setValue(res.instruction.in_type);
  100. // Ext.getCmp('in_number').hide().setValue(res.instruction.in_number);
  101. Ext.getCmp('in_id').hide().setValue(res.instruction.in_id);
  102. Ext.getCmp('in_title').setValue(res.instruction.in_title);
  103. // Ext.getCmp('rod_subject').setValue(res.rod.rod_subject);
  104. Ext.getCmp('in_dept').setValue(res.instruction.in_dept);
  105. Ext.getCmp('in_secretlevel').setValue(res.instruction.in_secretLevel);
  106. Ext.getCmp('in_emergencydegree').setValue(res.instruction.in_emergencyDegree);
  107. Ext.getCmp('in_context').setValue(res.instruction.in_context);
  108. // Ext.getCmp('rod_registrant').setValue(res.rod_registrant);
  109. if(res.in_attach != ""){
  110. var attach = res.in_attach.split(';');
  111. var text = "";
  112. Ext.each(attach, function(a, index){
  113. var path = a.toString();
  114. if(me.BaseUtil.contains(a, '\\', true)){
  115. text += "&nbsp;&nbsp;<a class='mail-attach' href='" + basePath + "common/download.action?path=" + path + "'>" + a.substring(a.lastIndexOf('\\') + 1) + "</a>";
  116. } else {
  117. text += "&nbsp;&nbsp;<a class='mail-attach' href='" + basePath + "common/download.action?path=" + path + "'>" + a.substring(a.lastIndexOf('/') + 1) + "</a>";
  118. }
  119. });
  120. Ext.getCmp('in_attach').setValue(text);
  121. } else {
  122. Ext.getCmp('in_attach').hide();
  123. }
  124. }
  125. }
  126. });
  127. }
  128. });