MoreFlow.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.common.MoreFlow', {
  3. extend : 'Ext.app.Controller',
  4. requires : ['erp.util.BaseUtil', 'erp.util.FormUtil', 'erp.util.RenderUtil'],
  5. views : ['common.DeskTop.MoreFlow', 'common.datalist.GridPanel',
  6. 'common.datalist.Toolbar', 'core.button.VastAudit',
  7. 'core.button.VastDelete', 'core.button.VastPrint',
  8. 'core.button.VastReply', 'core.button.VastSubmit',
  9. 'core.button.ResAudit', 'core.form.FtField', 'core.grid.TfColumn',
  10. 'core.grid.YnColumn', 'core.trigger.DbfindTrigger',
  11. 'core.form.FtDateField', 'core.form.FtFindField',
  12. 'core.form.FtNumberField', 'core.form.MonthDateField',
  13. 'core.button.ProcessRemind','core.grid.HeaderFilter','common.DeskTop.DeskTabPanel'],
  14. init : function() {
  15. var me = this;
  16. this.BaseUtil = Ext.create('erp.util.BaseUtil');
  17. this.FormUtil = Ext.create('erp.util.FormUtil');
  18. this.GridUtil = Ext.create('erp.util.GridUtil');
  19. this.control({
  20. '#alreadyLaunch' : {
  21. cellclick : function(view, td, colIdx, record, tr, rowIdx, e) {
  22. var field = view.ownerCt.columns[colIdx].dataIndex;
  23. if (field == 'jp_codevalue') {
  24. this.onCellItemClick(record);
  25. };
  26. }
  27. },
  28. '#toDo' : {
  29. itemclick: this.onGridItemClick
  30. },
  31. '#alreadyDo':{
  32. itemclick: this.onAlreadyDoItemClick
  33. },
  34. 'checkbox[name=only_todo]':{
  35. change:function(field,newvalue){
  36. var grid=Ext.getCmp('alreadyLaunch');
  37. if(newvalue){
  38. grid.defaultCondition=' jp_launcherid=\''+ em_code + '\' and jp_status=\'待审批\'';
  39. page=1;
  40. grid.getCount();
  41. }else {
  42. grid.defaultCondition=' jp_launcherid=\''+ em_code + '\'';
  43. page=1;
  44. grid.getCount();
  45. }
  46. }
  47. },
  48. 'erpProcessRemindButton' : {
  49. click : function(btn) {
  50. var multiselected = [];
  51. var items = Ext.getCmp('alreadyLaunch').selModel.getSelection();
  52. Ext.each(items, function(item, index) {
  53. if (item.data['jp_status'] == '待审批')
  54. multiselected.push(item);
  55. });
  56. var records = Ext.Array.unique(multiselected);
  57. if (records.length > 0) {
  58. var params = new Object();
  59. params.caller = 'Process!Remind';
  60. var data = new Array();
  61. var bool = false;
  62. Ext.each(records, function(record, index) {
  63. var o = new Object();
  64. o['jp_nodeId'] = record.data['jp_nodeId'];
  65. o['dealpersoncode'] = record.data['jp_nodedealman'];
  66. data.push(o);
  67. bool = true;
  68. });
  69. if (bool && !me.dealing) {
  70. params.data = unescape(Ext.JSON.encode(data)
  71. .replace(/\\/g, "%"));
  72. me.dealing = true;
  73. Ext.getCmp('alreadyLaunch').setLoading(true);// loading...
  74. Ext.Ajax.request({
  75. url : basePath + 'common/remindProcess.action',
  76. params : params,
  77. method : 'post',
  78. callback : function(options, success, response) {
  79. Ext.getCmp('alreadyLaunch').setLoading(false);
  80. me.dealing = false;
  81. var localJson = new Ext.decode(response.responseText);
  82. if (localJson.exceptionInfo) {
  83. var str = localJson.exceptionInfo;
  84. if (str.trim().substr(0, 12) == 'AFTERSUCCESS') {
  85. str = str.replace('AFTERSUCCESS',
  86. '');
  87. multiselected = [];
  88. }
  89. showError(str);
  90. return;
  91. }
  92. if (localJson.success) {
  93. if (localJson.log) {
  94. showMessage("提示", localJson.log);
  95. }
  96. multiselected = [];
  97. }
  98. }
  99. });
  100. } else {
  101. showError("没有需要处理的数据!");
  102. }
  103. } else {
  104. showError("请勾选待审批的明细!");
  105. }
  106. }
  107. }
  108. });
  109. },
  110. onGridItemClick: function(selModel, record){//待办
  111. if(record.get('TYPECODE')=='procand'){
  112. Ext.getCmp('toDo').url='jsps/common/jtaketask.jsp';
  113. }else if(record.get('TYPECODE')=='unprocess'){
  114. Ext.getCmp('toDo').url='jsps/common/jprocessDeal.jsp?_do=1';
  115. }else if(record.get('TYPECODE')=='process'){
  116. Ext.getCmp('toDo').url='jsps/common/jprocessDeal.jsp';
  117. }
  118. Ext.getCmp('desktabpanel').onGridItemClick(selModel, record);
  119. },
  120. onAlreadyDoItemClick: function(selModel, record){//已处理
  121. Ext.getCmp('desktabpanel').onGridItemClick(selModel, record);
  122. },
  123. onCellItemClick : function(record) {// 已发起
  124. var id = record.data['jp_keyvalue'];
  125. Ext.Ajax.request({
  126. url : basePath + 'common/getJProcessByForm.action',
  127. async : false,
  128. params : {
  129. caller : record.data['jp_caller'],
  130. keyValue : id,
  131. _noc : 1
  132. },
  133. method : 'post',
  134. callback : function(options, success, response) {
  135. var localJson = new Ext.decode(response.responseText);
  136. if (localJson.exceptionInfo) {
  137. showError(localJson.exceptionInfo);
  138. return;
  139. }
  140. if (localJson.node && localJson.node != -1) {
  141. // 再根据nodeId调取流程信息
  142. if (Ext.getCmp('win-flow' + id)) {
  143. Ext.getCmp('win-flow' + id).show();
  144. } else {
  145. var grid = Ext.create(
  146. "erp.view.common.JProcess.GridPanel", {
  147. anchor : '100% 80%',
  148. nodeId : localJson.node
  149. });
  150. var form = Ext.create('Ext.form.Panel', {
  151. layout : 'column',
  152. defaultType : 'textfield',
  153. anchor : '100% 20%',
  154. bodyStyle : 'background:#f1f1f1;',
  155. fieldDefaults : {
  156. columnWidth : 0.33,
  157. readOnly : true,
  158. cls : "form-field-allowBlank",
  159. fieldStyle : 'background:#f0f0f0;border: 1px solid #8B8970;'
  160. },
  161. items : [{
  162. id : 'jp_name',
  163. name : 'jp_name',
  164. fieldLabel : '流程名称',
  165. columnWidth : 0.33
  166. }, {
  167. columnWidth : 0.33,
  168. xtype : 'textfield',
  169. fieldLabel : '发起时间',
  170. name : 'jp_launchTime',
  171. id : 'jp_launchTime',
  172. readOnly : true,
  173. fieldStyle : 'background:#f0f0f0;border: 1px solid #8B8970;'
  174. }, {
  175. fieldLabel : '发起人',
  176. columnWidth : 0.33,
  177. xtype : 'textfield',
  178. id : 'jp_launcherName',
  179. name : 'jp_launcherName',
  180. readOnly : true,
  181. fieldStyle : 'background:#f0f0f0;border: 1px solid #8B8970;'
  182. }, {
  183. fieldLabel : '节点名称',
  184. id : 'jp_nodeName',
  185. name : 'jp_nodeName',
  186. xtype : 'textfield',
  187. readOnly : true,
  188. fieldStyle : 'background:#f0f0f0;border: 1px solid #8B8970;'
  189. }, {
  190. fieldLabel : '处理人',
  191. id : 'jp_nodeDealMan',
  192. name : 'jp_nodeDealMan',
  193. xtype : 'textfield',
  194. fieldStyle : 'background:#f0f0f0;border: 1px solid #8B8970;',
  195. readOnly : true,
  196. listeners : {
  197. change : function(field) {
  198. var em = Ext
  199. .getCmp('jp_nodeDealMan')
  200. .getValue();
  201. var btn = Ext
  202. .getCmp('dealbutton');
  203. if (em != em_code)
  204. btn.setDisabled(true);
  205. }
  206. }
  207. }, {
  208. fieldLabel : '审批状态',
  209. id : 'jp_status',
  210. name : 'jp_status',
  211. xtype : 'textfield',
  212. fieldStyle : 'background:#f0f0f0;border: 1px solid #8B8970;',
  213. readOnly : true
  214. }],
  215. loader : {
  216. url : basePath + 'common/getCurrentNode.action',
  217. renderer : function(loader, response, active) {
  218. var res = Ext.decode(response.responseText);
  219. if (res.info.currentnode.jp_nodeDealMan) {
  220. res.info.currentnode.jp_nodeDealMan = res.info.dealmanname
  221. + "("
  222. + res.info.currentnode.jp_nodeDealMan
  223. + ")";
  224. } else
  225. res.info.currentnode.jp_nodeDealMan = res.info.dealmanname
  226. + "("
  227. + res.info.currentnode.jp_candidate
  228. + ")";
  229. res.info.currentnode.jp_launchTime = Ext.Date
  230. .format(
  231. new Date(res.info.currentnode.jp_launchTime),
  232. 'Y-m-d H:i:s');
  233. this.target.getForm()
  234. .setValues(res.info.currentnode);
  235. return true;
  236. },
  237. autoLoad : true,
  238. params : {
  239. jp_nodeId : localJson.node,
  240. _noc : 1
  241. }
  242. },
  243. buttonAlign : 'center',
  244. buttons : [{
  245. text : $I18N.common.button.erpFlowButton,
  246. iconCls : 'x-button-icon-scan',
  247. cls : 'x-btn-gray',
  248. id : 'dealbutton',
  249. handler : function(btn) {
  250. me.FormUtil.onAdd(caller + '_flow', '流程处理',
  251. 'jsps/common/jprocessDeal.jsp?formCondition=jp_nodeidIS'
  252. + localJson.node);
  253. }
  254. }, {
  255. text : '关 闭',
  256. iconCls : 'x-button-icon-close',
  257. cls : 'x-btn-gray',
  258. handler : function() {
  259. Ext.getCmp('win-flow' + id).close();
  260. }
  261. }]
  262. });
  263. Ext.create('Ext.window.Window', {
  264. id : 'win-flow' + id,
  265. title : '<span style="color:#CD6839;">流程处理情况</span>',
  266. iconCls : 'x-button-icon-set',
  267. closeAction : 'destroy',
  268. height : "100%",
  269. width : "90%",
  270. maximizable : true,
  271. buttonAlign : 'center',
  272. layout : 'fit',
  273. items : [{
  274. xtype : 'tabpanel',
  275. frame : true,
  276. layout : 'fit',
  277. items : [{
  278. title : '处理明细',
  279. layout : 'anchor',
  280. frame : true,
  281. items : [form, grid]
  282. }, {
  283. title : '节点信息',
  284. items : [{
  285. tag : 'iframe',
  286. style : {
  287. background : '#f0f0f0',
  288. border : 'none'
  289. },
  290. frame : true,
  291. border : false,
  292. layout : 'fit',
  293. height : window.innerHeight
  294. * 0.9,
  295. iconCls : 'x-tree-icon-tab-tab',
  296. html : '<iframe id="iframe_maindetail_" src="'
  297. + basePath
  298. + 'workfloweditor/workfloweditorscan.jsp?jdId='
  299. + localJson.jd
  300. + "&type="
  301. + localJson.type
  302. + "&nodeId="
  303. + localJson.node
  304. + '" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
  305. }]
  306. }, {
  307. title : '知会信息',
  308. frame : true,
  309. layout : 'anchor',
  310. items : [{
  311. xtype : 'gridpanel',
  312. anchor : '100% 100%',
  313. columnLines : true,
  314. store : Ext.create(
  315. 'Ext.data.Store', {
  316. fields : [
  317. 'jn_notify',
  318. 'jn_notifyname',
  319. 'jn_nodename',
  320. {
  321. name : 'jn_type',
  322. type : 'string'
  323. },
  324. 'jn_man', {
  325. name : 'jn_date',
  326. type : 'date'
  327. }]
  328. }),
  329. columns : [{
  330. text : '知会编号',
  331. dataIndex : 'jn_notify',
  332. width : 120
  333. }, {
  334. text : '知会个人/岗位',
  335. dataIndex : 'jn_notifyname',
  336. width : 120
  337. }, {
  338. text : '设置节点',
  339. dataIndex : 'jn_nodename',
  340. width : 120
  341. }, {
  342. text : '知会类型',
  343. dataIndex : 'jn_type',
  344. renderer : function(
  345. val) {
  346. var res = val;
  347. if (val == 'people')
  348. return '个人';
  349. else
  350. return '岗位';
  351. },
  352. width : 120
  353. }, {
  354. text : '设置人',
  355. dataIndex : 'jn_man',
  356. width : 120
  357. }, {
  358. text : '设置时间',
  359. dataIndex : 'jn_date',
  360. xtype : "datecolumn",
  361. format : "Y-m-d H:i:s",
  362. flex : 1
  363. }]
  364. }],
  365. listeners : {
  366. activate : function(tab) {
  367. var grid = tab.items.items[0];
  368. var gridUtil = Ext
  369. .create('erp.util.GridUtil');
  370. gridUtil.loadNewStore(grid,
  371. {
  372. caller : 'JProcessNotify',
  373. condition : "jn_processinstanceid='"
  374. + localJson.instanceId
  375. + "'"
  376. });
  377. }
  378. }
  379. },{
  380. title:'历史处理明细',
  381. layout:'anchor',
  382. frame:true,
  383. items:[Ext.create("erp.view.common.JProcess.AllHistoryGridPanel",{
  384. anchor: '100% 100%' ,
  385. nodeId: localJson.node
  386. })]
  387. }]
  388. }]
  389. }).show();
  390. }
  391. } else {
  392. showMessage("提示", "当前单据无流程处理!");
  393. }
  394. }
  395. });
  396. }
  397. });