AllHistoryGridPanel.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. Ext.define('erp.view.common.JProcess.AllHistoryGridPanel',{
  2. extend: 'Ext.grid.Panel',
  3. alias: 'widget.erpAllHistoryGridPanel',
  4. //layout : 'auto',
  5. id: 'allHistoryGrid',
  6. emptyText : '无数据',
  7. title: '<h1 style="color:black ! important;">审批历史</h1>',
  8. columnLines : true,
  9. autoScroll : true,
  10. //store: [],
  11. columns: [],
  12. BaseUtil: Ext.create('erp.util.BaseUtil'),
  13. nodeId: null,
  14. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  15. clicksToEdit: 1
  16. })],
  17. initComponent : function(){
  18. formCondition = this.BaseUtil.getUrlParam('formCondition');//从url解析参数
  19. formCondition = (formCondition == null) ? "" : formCondition.replace(/IS/g,"=");
  20. var strArr = formCondition.split("=");
  21. var acountmaster=getUrlParam('newMaster'),nodeId=this.nodeId || strArr[1];
  22. if(!this.deferLoadData){
  23. this.getOwnStore(nodeId,acountmaster);
  24. }
  25. this.callParent(arguments);
  26. },
  27. getOwnStore: function(nodeId){
  28. var me = this;
  29. Ext.Ajax.request({
  30. url : basePath + 'common/getAllHistoryNodesByNodeId.action',
  31. params: {
  32. nodeId:nodeId ,
  33. _noc:1
  34. },
  35. method : 'post',
  36. callback : function(options,success,response){
  37. var res = new Ext.decode(response.responseText);
  38. var store = Ext.create('Ext.data.Store', {
  39. storeId: 'gridStore',
  40. fields: [{name: 'jn_id', type: 'string'},
  41. {name: 'jn_name', type: 'string'},
  42. {name: 'jn_dealManId', type: 'string'},
  43. {name: 'jn_dealManName', type: 'string'},
  44. {name: 'jn_dealManName', type: 'string'},
  45. {name: 'jn_dealTime', type: 'string'},
  46. {name:'jn_holdtime',type:'int'},
  47. {name: 'jn_dealResult', type: 'string'},
  48. {name: 'jn_operatedDescription', type: 'string'},
  49. {name: 'jn_nodeDescription', type: 'string'},
  50. {name: 'jn_infoReceiver', type: 'string'},
  51. {name: 'jn_processInstanceId', type: 'string'},
  52. {name: 'jn_attachs', type: 'string'},
  53. {name: 'jn_attach', type: 'string'},//是否回退节点
  54. ],
  55. data: res.nodes
  56. });
  57. var columns = [{header: '节点名称', dataIndex: 'jn_name',width:100},
  58. {header: '处理人', dataIndex: 'jn_dealManId',width:80},
  59. {header: '处理人姓名', dataIndex: 'jn_dealManName',width:100},
  60. {header: '处理日期', dataIndex: 'jn_dealTime',width:150},
  61. {header: '处理结果', dataIndex: 'jn_dealResult',width:80},
  62. {header: '管理要点', dataIndex: 'jn_operatedDescription',width:150,editor:{xtype:'textareatrigger',hideTrigger:false,onTriggerClick:me.onTriggerClick},renderer:function (val, meta, record){
  63. return '<span style="color:green;padding-left:2px">' + val + '</span>';
  64. }},
  65. {header: '审批意见', dataIndex: 'jn_nodeDescription',width:140,editor:{xtype:'textareatrigger',hideTrigger:false}},
  66. {header: '备注信息', dataIndex: 'jn_infoReceiver',width:120},
  67. /* {header: '停留(s)', dataIndex: 'jn_holdtime',align:'right',width:50},*/
  68. {header: '附件', dataIndex: 'jn_attachs',align:'right',width:80,renderer:function(val){
  69. if(val){
  70. return '<a href="javascript:scanAttachs(\'' + val + '\');">查看附件</a>';
  71. }else return '无附件';
  72. }}
  73. ];
  74. me.reconfigure(store, columns);
  75. nodes = res.nodes;
  76. var toolbar=Ext.getCmp('nodeToolbar');
  77. if(toolbar){
  78. toolbar.add('->');
  79. for(var i=0;i<nodes.length;i++){//显示在页面左上角一排信息 2013-3-8 15:48:53
  80. var ti = Ext.create('Ext.toolbar.TextItem',{
  81. text: nodes[i]['jn_name']+nodes[i]['jn_dealManId'],
  82. });
  83. toolbar.add(ti);
  84. toolbar.add('-');
  85. }
  86. }
  87. }
  88. });
  89. },
  90. download:function(val,meta,record){
  91. var value=Ext.getCmp('wr_taskpercentdone').getValue();
  92. var unit=Ext.getCmp('wr_assignpercent').getValue();
  93. var percent=Ext.getCmp('wr_percentdone');
  94. percent.setReadOnly(true);
  95. value=value+(percent.value)*unit/100;
  96. Ext.getCmp('wr_progress').updateProgress(value/100,'当前任务进度:'+Math.round(value)+'%');
  97. Ext.getCmp('wr_redcord').setHeight(320);
  98. var form=me.getForm(btn);
  99. var attachs=Ext.getCmp("wr_attachs").getValue();
  100. if(attachs!=null){
  101. Ext.Ajax.request({//拿到grid的columns
  102. url : basePath + 'common/getFilePaths.action',
  103. async: false,
  104. params: {
  105. id:attachs
  106. },
  107. method : 'post',
  108. callback : function(options,success,response){
  109. var res = new Ext.decode(response.responseText);
  110. if(res.exception || res.exceptionInfo){
  111. showError(res.exceptionInfo);
  112. return;
  113. }
  114. attach = res.files != null ? res.files : [];
  115. }
  116. });
  117. form.add({
  118. title:'相关文件',
  119. id:'container',
  120. style: {borderColor:'green', borderStyle:'solid', borderWidth:'0px'},
  121. xtype:'container',
  122. columnWidth:1
  123. });
  124. var items = new Array();
  125. items.push({
  126. style: 'background:#CDBA96;',
  127. html: '<h1>相关文件:</h1>',
  128. });
  129. Ext.each(attach, function(){
  130. var path = this.fp_path;
  131. var name = '';
  132. if(contains(path, '\\', true)){
  133. name = path.substring(path.lastIndexOf('\\') + 1);
  134. } else {
  135. name = path.substring(path.lastIndexOf('/') + 1);
  136. }
  137. items.push({
  138. style: 'background:#C6E2FF;',
  139. html: '<img src="' + basePath + 'resource/images/mainpage/things.png" width=16 height=16/>' +
  140. '<span>文件:' + name + '<a href="' + basePath + "common/download.action?path=" + path + '">下载</a></span>',
  141. });
  142. });
  143. Ext.getCmp('container').add(items);
  144. }
  145. },
  146. onTriggerClick:function(){
  147. var trigger = this,
  148. value = this.value;
  149. var arr=value.split(";");
  150. var realValue="";
  151. for(var i=0;i<arr.length;i++){
  152. if(arr[i].indexOf('(否)')>0){
  153. realValue+='<font size=3 color="red">'+arr[i]+';<font></br>';
  154. }else realValue+=arr[i]+';</br>';
  155. }
  156. var win = new Ext.window.Window(
  157. {
  158. id : 'win',
  159. height : 200,
  160. width : 600,
  161. maximizable : false,
  162. buttonAlign : 'center',
  163. layout : 'anchor',
  164. title:'详细信息',
  165. items : [ {
  166. xtype: 'htmleditor',
  167. enableColors: false,
  168. enableAlignments: false,
  169. enableFont: false,
  170. enableFontSize: false,
  171. enableFormat: false,
  172. enableLinks: false,
  173. enableLists: false,
  174. enableSourceEdit: false,
  175. frame: false,
  176. height: 140,
  177. width: 600,
  178. fieldStyle: 'border-bottom: none;',
  179. value:realValue
  180. }],
  181. buttons:[{
  182. text:'关闭',
  183. handler:function(btn){
  184. win.close();
  185. }
  186. }]
  187. });
  188. win.show();
  189. }
  190. });