Viewport.js 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987
  1. Ext.define('erp.view.common.JProcess.Viewport', {
  2. extend: 'Ext.Viewport',
  3. layout: 'fit',
  4. id: 'viewPort',
  5. hideBorders: true,
  6. autoScroll: false,
  7. style: {
  8. background: '#D3D3D3'
  9. },
  10. BaseUtil: Ext.create('erp.util.BaseUtil'),
  11. initComponent: function() {
  12. var me = this;
  13. formCondition = this.BaseUtil.getUrlParam('formCondition'); //从url解析参数
  14. formCondition = (formCondition == null) ? "": formCondition.replace(/IS/g, "=");
  15. nodeId = nodeId != null ? nodeId: this.BaseUtil.getUrlParam('nodeId');
  16. if (formCondition != "") {
  17. nodeId = formCondition.split("=")[1];
  18. }
  19. var condition = formCondition == "" ? "jp_nodeId='" + nodeId + "'": formCondition;
  20. var panel = new Ext.panel.Panel({
  21. html: '<div style="background-color:#f0f0f0;font-size:15px"><h2>待审批单据信息</h2></div>'
  22. });
  23. var param = {
  24. caller: caller,
  25. condition: condition,
  26. _noc: 1
  27. };
  28. if (master) {
  29. param.master = master;
  30. }
  31. var nodesgrid = Ext.create('erp.view.common.JProcess.GridPanel', {
  32. anchor: '100%',
  33. deferLoadData:true
  34. });
  35. Ext.apply(me, {
  36. items: [{
  37. id: 'JProcessViewport',
  38. layout: 'auto',
  39. autoScroll: true,
  40. xtype: 'panel',
  41. style: {
  42. background: '#FFFFFF'
  43. },
  44. items: [{
  45. xtype: 'form',
  46. anchor: '100%',
  47. bodyStyle: {
  48. background: '#E3E3E3'
  49. },
  50. id: 'mainForm',
  51. items: [{
  52. id: 'app-header',
  53. xtype: 'box',
  54. height: 5,
  55. style: 'color: #596F8F;font-size: 16px;font-weight: 200;padding: 5px 5px;text-shadow: 0 1px 0 #fff'
  56. },{
  57. xtype: 'toolbar',
  58. id: 'currentNodeToolbar',
  59. layout: {
  60. type: 'hbox',
  61. align: 'right'
  62. },
  63. style: {
  64. background: 'transparent',
  65. border: 'none'
  66. },
  67. items: [{
  68. xtype: 'tbtext',
  69. id: 'processname'
  70. },
  71. '->', {
  72. xtype: 'tbtext',
  73. id: 'label1',
  74. text: ''
  75. },
  76. '->', {
  77. xtype: 'tbtext',
  78. id: 'label2',
  79. text: ''
  80. },
  81. {
  82. xtype: 'tbtext',
  83. id: 'label3',
  84. text: ''
  85. }]
  86. },
  87. {
  88. xtype: 'fieldcontainer',
  89. labelWidth: 250,
  90. layout: 'column',
  91. id: 'container',
  92. items: [{
  93. xtype: 'checkboxfield',
  94. boxLabel: '<span style="font-weight: bold !important;">变更办理人</span>',
  95. columnWidth: 0.4,
  96. readOnly:ISexecuted,
  97. disabled:ISexecuted,
  98. checked: false,
  99. id: 'alterAssignee',
  100. handler: function(checkBox, checked) {
  101. this.ownerCt.ownerCt.ownerCt.ownerCt.getAssigneeCombox(checkBox, checked);
  102. }
  103. },
  104. {
  105. xtype: 'toolbar',
  106. width: '78%',
  107. columnWidth: 0.6,
  108. layout: {
  109. type: 'hbox',
  110. align: 'right'
  111. },
  112. style: {
  113. background: 'transparent',
  114. border: 'none'
  115. },
  116. items: ['->', {
  117. xtype: 'tbtext',
  118. id: 'currentnode'
  119. },
  120. '-', {
  121. xtype: 'tbtext',
  122. id: 'launchername'
  123. },
  124. '-', {
  125. xtype: 'tbtext',
  126. id: 'launchtime'
  127. }]
  128. },
  129. {
  130. xtype: 'fieldcontainer',
  131. columnWidth: 1,
  132. id: 'container2',
  133. labelWidth: 100,
  134. layout: 'hbox'
  135. }]
  136. },
  137. {
  138. xtype: 'fieldcontainer',
  139. id: 'container3',
  140. labelWidth: 100,
  141. layout: 'column',
  142. labelSeparator: '',
  143. margin: '0 0 0 5',
  144. fieldLabel: '<h2>审批意见</h2>',
  145. items: [{
  146. xtype: 'textfield',
  147. name: 'dealMessage',
  148. id: 'dealMessage',
  149. hideLabel: true,
  150. columnWidth: 0.65,
  151. labelAlign: 'right',
  152. fieldStyle: 'background:#FFFAFA;color:#515151;'
  153. }]
  154. },{
  155. xtype: 'fieldcontainer',
  156. id: 'customSetup',
  157. labelWidth: 100,
  158. labelSeparator: '',
  159. fieldLabel: '<h2>审批要点</h2>',
  160. layout: 'column',
  161. hidden: true,
  162. margin: '0 72 0 5'
  163. },
  164. {
  165. xtype: 'fieldcontainer',
  166. id: 'container4',
  167. labelWidth: 100,
  168. layout: 'anchor'
  169. },
  170. {
  171. xtype:'mfilefield',
  172. id:'attachs',
  173. name:'attachs',
  174. collapsed: true,
  175. collapsible: true,
  176. frame:true,
  177. style: '',
  178. title: '<img src="' + basePath + 'resource/images/icon/attach.png" width=20/>&nbsp;&nbsp;<span style="font-weight:bold;font-size:13px;">附件</span>',
  179. listeners : {
  180. afterrender: function(f){
  181. if(f.value != null && f.value.toString().trim() != ''){
  182. f.download(f.value);
  183. }
  184. }
  185. }
  186. },{
  187. xtype: 'fieldset',
  188. margin: '2 2 2 2',
  189. collapsible: true,
  190. collapsed: true,
  191. layout:'column',
  192. title: '<img src="' + basePath + 'resource/images/mainpage/info.png" width=20/>&nbsp;&nbsp;<span style="font-weight:bold;font-size:13px;">知会</span>',
  193. items: [Ext.create('erp.view.core.trigger.AddDbfindTrigger',{
  194. anchor:'100% 30%',
  195. emptyText:'选择知会人',
  196. fieldStyle: 'background:#FAFAFA;color:#515151;',
  197. hideLabel:true,
  198. name:'notifyPeople',
  199. id:'notifyPeople',
  200. group:0,
  201. columnWidth:0.4
  202. }),{
  203. name:'notifyPeopleid',
  204. id:'notifyPeopleid',
  205. xtype:'textfield',
  206. hidden:true
  207. },Ext.create('erp.view.core.trigger.AddDbfindTrigger',{
  208. anchor:'100% 30%',
  209. emptyText:'选择知会岗位',
  210. name:'notifyGroupName',
  211. id:'notifyGroupName',
  212. group:0,
  213. fieldStyle: 'background:#FAFAFA;color:#515151;padding-left:5px',
  214. hideLabel:true,
  215. columnWidth:0.4
  216. }),{
  217. name:'notifyGroup',
  218. id:'notifyGroup',
  219. xtype:'textfield',
  220. hidden:true
  221. },{
  222. text : '清空',
  223. xtype:'button',
  224. handler : function(b) {
  225. Ext.Array.each(b.ownerCt.items.items,function(item){
  226. item.reset();
  227. });
  228. }
  229. },{
  230. text : '确定',
  231. xtype:'button',
  232. handler : function(b) {
  233. var peoples=Ext.getCmp('notifyPeopleid').value;
  234. var groups=Ext.getCmp('notifyGroup').value;
  235. var peoplesname=Ext.getCmp('notifyPeople').value;
  236. var groupsname=Ext.getCmp('notifyGroupName').value;
  237. if((peoples==null || peoples=='' )&& (groups==null || groups=='')) showMessage('提示','先选择需要知会的岗位或人员!',1000);
  238. else me.saveNotify(peoples,groups,peoplesname,groupsname,me,b);
  239. }
  240. }]
  241. },{
  242. xtype: 'fieldset',
  243. margin: '2 2 2 2',
  244. collapsible: true,
  245. collapsed: true,
  246. layout:'column',
  247. title: '<img src="' + basePath + 'resource/images/icon/communicate.png" width=20/>&nbsp;&nbsp;<span style="font-weight:bold;font-size:13px;text-align:top;height:30px;">沟通</span>',
  248. items: [{
  249. name : 'com_record',
  250. id :'com_record',
  251. hideLabel : true,
  252. autoHeight : true,
  253. height:250,
  254. columnWidth:0.6,
  255. readOnly:true,
  256. xtype: 'htmleditor',
  257. enableColors: false,
  258. enableAlignments: false,
  259. enableFont: false,
  260. enableFontSize: false,
  261. enableFormat: false,
  262. enableLinks: false,
  263. enableLists: false,
  264. enableSourceEdit: false,
  265. frame: false,
  266. fieldStyle: 'border-bottom: none;'
  267. },{
  268. xtype:'form',
  269. columnWidth:0.4,
  270. height :250,
  271. layout:'anchor',
  272. frame:true,
  273. items:[{
  274. xtype:'textareafield',
  275. name :'communicaterecord',
  276. id:'communicaterecord',
  277. hideLabel:true,
  278. allowBlank:false,
  279. anchor:'100% 70%',
  280. fieldStyle: 'background:#FAFAFA;color:#515151;'
  281. },Ext.create('erp.view.core.trigger.MultiDbfindTrigger',{
  282. anchor:'100% 30%',
  283. emptyText:'选择沟通人',
  284. fieldStyle: 'background:#FAFAFA;color:#515151;',
  285. id:'communicator',
  286. name:'communicator',
  287. allowBlank:false,
  288. labelWidth : 50
  289. }),{
  290. id:'communicatorid',
  291. name:'communicatorid',
  292. xtype:'textfield',
  293. hidden:true
  294. }],
  295. buttonAlign : 'center',
  296. buttons : [{
  297. text : '重置',
  298. handler : function(b) {
  299. b.ownerCt.ownerCt.getForm().reset();
  300. }
  301. },{
  302. text : '确定',
  303. formBind: true,
  304. handler : function(b) {
  305. me.CommunicateWithOther(b.ownerCt.ownerCt,me);
  306. }
  307. }]
  308. }]
  309. },{
  310. xtype: 'toolbar',
  311. style: {
  312. background: 'transparent',
  313. border: 'none'
  314. },
  315. id: 'container5',
  316. anchor: '100%',
  317. layout: 'hbox',
  318. readOnly: ISexecuted,
  319. disabled: ISexecuted,
  320. items: [{
  321. xtype: 'splitter',
  322. width: 20
  323. },
  324. {
  325. xtype: 'button',
  326. text: '同&nbsp;&nbsp;&nbsp;&nbsp;意',
  327. iconCls: 'x-button-icon-agree',
  328. cls: 'x-btn-gray',
  329. width: 90,
  330. handler: function() {
  331. this.ownerCt.ownerCt.ownerCt.ownerCt.executeTask(1);
  332. }
  333. },
  334. {
  335. xtype: 'splitter',
  336. width: 10
  337. },
  338. {
  339. xtype: 'button',
  340. id:'disagree',
  341. text: '不 &nbsp;同 &nbsp;意',
  342. iconCls: 'x-button-icon-unagree',
  343. cls: 'x-btn-gray',
  344. width: 90,
  345. handler: function() {
  346. this.ownerCt.ownerCt.ownerCt.ownerCt.executeTask(2);
  347. }
  348. },
  349. {
  350. xtype: 'splitter',
  351. width: 10
  352. },{
  353. xtype: 'button',
  354. iconCls: 'x-button-icon-turn',
  355. text: '结束沟通',
  356. cls: 'x-btn-gray',
  357. iconCls:'x-button-icon-talk',
  358. width: 90,
  359. handler: function() {
  360. this.ownerCt.ownerCt.ownerCt.ownerCt.endcommunicateTask(me);
  361. }
  362. },{
  363. xtype: 'splitter',
  364. width: 10
  365. },{
  366. xtype: 'button',
  367. text: '结束流程',
  368. width: 90,
  369. iconCls: 'x-button-icon-end',
  370. cls: 'x-btn-gray',
  371. handler: function() {
  372. this.ownerCt.ownerCt.ownerCt.ownerCt.endProcess();
  373. }
  374. },{
  375. xtype: 'splitter',
  376. width: 10
  377. },{
  378. xtype: 'button',
  379. iconCls: 'x-button-icon-turn',
  380. text: '下一条',
  381. cls: 'x-btn-gray',
  382. width: 90,
  383. handler: function() {
  384. this.ownerCt.ownerCt.ownerCt.ownerCt.skipTask();
  385. }
  386. },
  387. {
  388. xtype: 'splitter',
  389. width: 10
  390. },
  391. /*{
  392. xtype: 'button',
  393. text: '结束流程',
  394. width: 90,
  395. iconCls: 'x-button-icon-end',
  396. cls: 'x-btn-gray',
  397. handler: function() {
  398. this.ownerCt.ownerCt.ownerCt.ownerCt.endProcess();
  399. }
  400. },
  401. {
  402. xtype: 'splitter',
  403. width: 10
  404. },
  405. {
  406. xtype: 'button',
  407. text: '删除流程',
  408. iconCls: 'tree-delete',
  409. disabled: true,
  410. width: 90,
  411. cls: 'x-btn-gray',
  412. handler: function() {
  413. this.ownerCt.ownerCt.ownerCt.ownerCt.deleteProcess();
  414. }
  415. },
  416. {
  417. xtype: 'splitter',
  418. width: 10
  419. },
  420. {
  421. xtype: 'button',
  422. text: '重置流程',
  423. iconCls: 'x-button-icon-reset',
  424. width: 90,
  425. cls: 'x-btn-gray',
  426. handler: function() {
  427. this.ownerCt.ownerCt.ownerCt.ownerCt.backProcess();
  428. }
  429. },
  430. {
  431. xtype: 'splitter',
  432. width: 10
  433. },*/
  434. {
  435. xtype: 'button',
  436. text: '关&nbsp;&nbsp;&nbsp;&nbsp;闭',
  437. iconCls: 'x-button-icon-close',
  438. cls: 'x-btn-gray',
  439. width: 90,
  440. handler: function() {
  441. if(parent.Ext.getCmp('modalwindow')){
  442. Ext.Ajax.request({
  443. url: basePath + 'common/changeMaster.action',
  444. params: {
  445. to: parent.Ext.getCmp('modalwindow').historyMaster
  446. },
  447. callback: function(opt, s, r) {
  448. if (s) {
  449. parent.Ext.getCmp('modalwindow').close();
  450. } else {
  451. alert('切换到原账套失败!');
  452. }
  453. }
  454. });
  455. }
  456. else parent.Ext.getCmp('content-panel').getActiveTab().close();
  457. }
  458. }
  459. ]
  460. }]
  461. },
  462. panel, nodesgrid]
  463. }]
  464. });
  465. me.callParent(arguments);
  466. },
  467. getProcessData: function(params) {
  468. Ext.Ajax.request({
  469. url: basePath + form.saveUrl,
  470. params: params,
  471. method: 'post',
  472. async: false,
  473. callback: function(options, success, response) {
  474. var localJson = new Ext.decode(response.responseText);
  475. ProcessData = localJson.data;
  476. }
  477. });
  478. },
  479. getAssigneeCombox: function(checkBox, checked) {
  480. var processInstanceId = ProcessData.jp_processInstanceId,me=this;
  481. var button = Ext.create('Ext.Button', {
  482. text: '确定',
  483. cls: 'x-btn-gray',
  484. iconCls: 'x-button-icon-save',
  485. margin: '0 0 0 10',
  486. handler: function() {
  487. var value = Ext.getCmp('AssigneeComboxcode').getValue();
  488. /* var customs = Ext.getCmp('customSetup').items.items;
  489. var flag = 0;
  490. Ext.each(customs,
  491. function(cu) {
  492. if (!cu.items.items[1].allowBlank && (cu.items.items[1].getValue() == null || cu.items.items[1].getValue() == '')) {
  493. Ext.Msg.alert('提示', "<b>" + cu.items.items[0].value.fontcolor("Red") + "</b>为必填项!");
  494. flag++;
  495. return;
  496. }
  497. });
  498. if (flag > 0) {
  499. return;
  500. }
  501. var cValues = [];
  502. Ext.each(customs,
  503. function(cu) {
  504. if (cu.items.items[1].getValue() != null && cu.items.items[1].getValue() != '') {
  505. var value = cu.items.items[1].getValue() instanceof Date ? me.getStringByDate(cu.items.items[1].getValue()) : cu.items.items[1].getValue();
  506. var labelValue = cu.items.items[0].getFieldLabel() + "(" + value + ")";
  507. if(cu.items.items[1].logic!='') labelValue+='@'+cu.items.items[1].logic+'@';
  508. cValues.push(labelValue);
  509. }
  510. });
  511. var opd = cValues.join(";");*/
  512. if (!value) {
  513. Ext.Msg.alert('提示', '请先选择变更办理人!');
  514. return;
  515. } else {
  516. Ext.Ajax.request({
  517. url: basePath + 'common/setAssignee.action',
  518. params: {
  519. taskId: ProcessData.jp_nodeId,
  520. assigneeId: value,
  521. processInstanceId: processInstanceId,
  522. //customDes: opd,
  523. description: Ext.getCmp('changedescription').getValue(),
  524. _noc: 1
  525. },
  526. success: function(response) {
  527. var jsonData = Ext.decode(response.responseText);
  528. if (jsonData.result) {
  529. Ext.Msg.alert('提示', "变更成功!");
  530. } else {
  531. Ext.Msg.alert('提示', "该任务不存在,无法变更!");
  532. }
  533. }
  534. });
  535. }
  536. }
  537. });
  538. var container = Ext.getCmp('container2');
  539. if (checked) {
  540. if(!ISexecuted){
  541. container.add([{
  542. fieldLabel: '变更办理人',
  543. xtype: 'multifield',
  544. name: 'AssigneeComboxcode',
  545. editable: false,
  546. width: 350,
  547. fieldStyle: 'background:#fffac0;color:#515151;',
  548. id: 'AssigneeComboxcode',
  549. secondname: 'em_name'
  550. },
  551. {
  552. xtype: 'textareatrigger',
  553. name: 'changedescription',
  554. id: 'changedescription',
  555. fieldStyle: 'background:#FFFAFA;color:#515151;',
  556. width: 350,
  557. labelAlign: 'right',
  558. fieldLabel: '变更描述'
  559. },
  560. button]);
  561. }
  562. } else {
  563. container.removeAll(true);
  564. }
  565. },
  566. deleteProcess: function() {
  567. Ext.Ajax.request({
  568. url: basePath + 'common/deleteProcess.action',
  569. params: {
  570. processInstanceId: ProcessData.jp_processInstanceId
  571. },
  572. success: function(response) {
  573. var text = response.responseText;
  574. jsonData = Ext.decode(text);
  575. if (jsonData.success) {
  576. Ext.Msg.alert('提示', "流程已删除!");
  577. }
  578. if (jsonData.exceptionInfo) {
  579. showError("该流程实例不存在");
  580. }
  581. }
  582. });
  583. },
  584. backProcess: function() {
  585. var mb = new Ext.window.MessageBox();
  586. mb.wait('系统正在处理', '请稍后');
  587. Ext.Ajax.request({
  588. url: basePath + 'common/backToLastNode.action',
  589. params: {
  590. processInstanceId: ProcessData.jp_processInstanceId,
  591. jnodeId: ProcessData.jp_nodeId
  592. },
  593. success: function(response) {
  594. mb.close();
  595. var text = response.responseText;
  596. jsonData = Ext.decode(text);
  597. if (jsonData.success) {
  598. Ext.Msg.alert('提示', '流程重置成功!');
  599. }
  600. if (jsonData.exceptionInfo) {
  601. showError(jsonData.exceptionInfo);
  602. }
  603. }
  604. });
  605. },
  606. endProcess: function() {
  607. var me=this,startdealtime = new Date(),taskId = ProcessData.jp_nodeId;
  608. Ext.Ajax.request({
  609. url: basePath + 'common/endProcessInstance.action',
  610. params: {
  611. processInstanceId: ProcessData.jp_processInstanceId,
  612. holdtime: ((startdealtime - basestarttime) / 1000).toFixed(0),
  613. nodeId: taskId,
  614. },
  615. callback: function(options, success, response) {
  616. var text = response.responseText;
  617. jsonData = Ext.decode(text);
  618. if (jsonData.success) {
  619. Ext.Msg.alert('提示', "流程已结束!");
  620. }
  621. if (jsonData.exceptionInfo) {
  622. showError(jsonData.exceptionInfo);
  623. Ext.Msg.alert('提示', "该流程实例不存在!");
  624. }
  625. }
  626. });
  627. },
  628. dealNextStep: function(nextnode,toMaster) {
  629. var nextNodeId = null,tab=null,me=this;
  630. if(parent.Ext.getCmp('content-panel')) tab=parent.Ext.getCmp('content-panel').getActiveTab();
  631. function processResult() {
  632. var btn = arguments[0];
  633. if (btn == 'yes') {
  634. var confirm = new Ext.button.Button({
  635. text: '确定',
  636. handler: function(btn) {
  637. var items = Ext.ComponentQuery.query('window >tabpanel>panel>radio');
  638. var params = new Array();
  639. Ext.each(items,function(item){
  640. if(item.getValue()){
  641. var param = new Object();
  642. var label = item.boxLabel;//em_name(em_code) 2013-3-8 10:18:11
  643. var em_code = label.substring(label.lastIndexOf('(')+1,label.length-1);
  644. param.em_code = em_code;
  645. param.nodeId=item.name;
  646. params.push(JSON.stringify(param));
  647. }
  648. });
  649. Ext.Ajax.request({
  650. url: basePath + 'common/takeOverTask.action',
  651. async: false,
  652. params: {
  653. params:unescape(params),
  654. _noc: 1
  655. },
  656. callback: function(options, success, response) {
  657. var text = response.responseText;
  658. jsonData = Ext.decode(text);
  659. if (jsonData.success) {
  660. Ext.Msg.alert('提示', "指派成功!");
  661. Ext.getCmp('assignwin').close();
  662. if (nextnode && nextnode != '-1') {
  663. //loadnext
  664. me.loadNextTask(nextnode,toMaster);
  665. } else {
  666. if (tab!=null )tab.close();
  667. }
  668. } else {
  669. Ext.Msg.alert('提示', "指派失败!");
  670. Ext.getCmp('assignwin').close();
  671. }
  672. }
  673. });
  674. }
  675. });
  676. var cancel = new Ext.button.Button({
  677. text: '取消',
  678. handler: function() {
  679. //发送寻呼
  680. var params = new Array();
  681. for (var i = 0; i < jsonData.actorUsers.length; i++){
  682. var param = new Object();
  683. param.em_code = jsonData.actorUsers[i].JP_CANDIDATES;
  684. param.nodeId=jsonData.actorUsers[i].JP_NODEID;
  685. params.push(JSON.stringify(param));
  686. }
  687. Ext.Ajax.request({
  688. url: basePath + 'common/processpaging.action',
  689. params: {
  690. params:unescape(params),
  691. _noc: 1
  692. },
  693. callback: function(options, success, response) {
  694. if (nextnode && nextnode != '-1') {
  695. me.loadNextTask(nextnode,toMaster);
  696. } else {
  697. if (tab!=null )tab.close();
  698. }
  699. }
  700. });
  701. }
  702. });
  703. var searchKey = new Object();
  704. var win = Ext.create('Ext.window.Window', {
  705. title: '指定下一步任务审批人',
  706. height: 450,
  707. width: 650,
  708. id: 'assignwin',
  709. modal:true,
  710. layout:'border',
  711. closable:false,
  712. buttons: [confirm, cancel],
  713. buttonAlign: 'center',
  714. items: []
  715. });
  716. win.add([{
  717. xtype:'textfield',
  718. margin:'10 20 10 20',
  719. fieldLabel:'快速搜索',
  720. labelStyle:'font-weight:bold;',
  721. id:'searchtextfield',
  722. region:'north',
  723. enableKeyEvents:true,
  724. listeners:{
  725. keydown:function(field,e){
  726. if(e.getKey()==Ext.EventObject.ENTER){
  727. searchKey[Ext.getCmp('assignTab').getActiveTab().id]=field.value;
  728. var results=Ext.Array.filter(jsonData.actorUsers[Ext.getCmp('assignTab').getActiveTab().id].JP_CANDIDATES,function(JP_CANDIDATE){
  729. if(field.value==undefined || JP_CANDIDATE.indexOf(field.value)!=-1) return JP_CANDIDATE;
  730. });
  731. Ext.Array.each(Ext.getCmp('assignTab').getActiveTab().personUsers,function(item){
  732. Ext.getCmp('assignTab').getActiveTab().remove(item);
  733. });
  734. addUserItems(Ext.getCmp('assignTab').getActiveTab(),jsonData.actorUsers[Ext.getCmp('assignTab').getActiveTab().id].JP_NODEID,results);
  735. }
  736. }
  737. }
  738. }]);
  739. var assignTab = new Ext.TabPanel({
  740. id : 'assignTab',
  741. enableTabScroll : true,
  742. closeAll : true,
  743. region:'center',
  744. minTabWidth :80,
  745. autoHeight:true,
  746. resizeTabs : true,
  747. listeners:{
  748. 'tabchange':function(tabPanel,newCard,oldCard,eOpts){
  749. Ext.getCmp('searchtextfield').setValue(searchKey[newCard.id]);
  750. }
  751. }
  752. });
  753. win.add(assignTab);
  754. for (var i = 0; i < jsonData.actorUsers.length; i++) {
  755. var panel=new Ext.Panel({
  756. id:i.toString(),
  757. width: 480,
  758. autoHeight:true,
  759. autoScroll:true,
  760. layout:'column',
  761. bodyStyle: 'background:#e0e0e0',
  762. title:jsonData.actorUsers[i].JP_NODENAME,
  763. });
  764. assignTab.add(panel);
  765. addUserItems(panel,jsonData.actorUsers[i].JP_NODEID,jsonData.actorUsers[i].JP_CANDIDATES);
  766. }
  767. assignTab.setActiveTab(0);
  768. win.show();
  769. } else {
  770. if (tab!=null )tab.close();
  771. }
  772. }
  773. function addUserItems(panel,jp_nodeid,jp_candidates){
  774. var me=this;
  775. var maxSize=jp_candidates.length>24?24:jp_candidates.length,personUsers=new Array(),user=null,more=Ext.getCmp('more'+panel.id);
  776. if(more)more.destroy();
  777. for(var j=0;j<maxSize;j++){
  778. user=Ext.create('Ext.form.field.Radio',{
  779. name:jp_nodeid,
  780. boxLabel:jp_candidates[j],
  781. columnWidth: 0.33,
  782. fieldCls:'x-myradio',
  783. checked: j==0?true:false
  784. });
  785. personUsers.push(user);
  786. }
  787. panel.add(personUsers);
  788. panel.personUsers=personUsers;
  789. if(jp_candidates.length>maxSize){
  790. panel.add({ xtype: 'textfield',
  791. readOnly:true,
  792. labelSeparator:'',
  793. columnWidth:1,
  794. id:'more'+panel.id,
  795. fieldStyle : 'background:#e0e0e0;border-bottom:none;vertical-align:middle;border-top:none;border-right:none;border-bottom:none;border-left:none;',
  796. fieldLabel: '『<a href="#" class="terms">全部</a>』',
  797. listeners: {
  798. click: {
  799. element: 'labelEl',
  800. fn: function(e,el) {
  801. var target = e.getTarget('.terms');
  802. Ext.getCmp('more'+panel.id).destroy();
  803. if (target) {
  804. Ext.Array.each(panel.personUsers,function(item){
  805. panel.remove(item);
  806. });
  807. var personUsers=new Array();
  808. for(var i=0;i<jp_candidates.length;i++){
  809. user=Ext.create('Ext.form.field.Radio',{
  810. name:jp_nodeid,
  811. boxLabel:jp_candidates[i],
  812. columnWidth: 0.33,
  813. fieldCls:'x-myradio',
  814. checked: i==0?true:false
  815. });
  816. personUsers.push(user);
  817. }
  818. panel.add(personUsers);
  819. panel.personUsers=personUsers;
  820. e.preventDefault();
  821. }
  822. }
  823. }
  824. }
  825. });
  826. }
  827. }
  828. Ext.Ajax.request({
  829. url: basePath + 'common/dealNextStepOfPInstance.action',
  830. params: {
  831. processInstanceId: ProcessData.jp_processInstanceId,
  832. _noc: 1
  833. },
  834. callback: function(options, success, response) {
  835. var text = response.responseText;
  836. jsonData = Ext.decode(text);
  837. if (jsonData.hasNext) {
  838. if (jsonData.actorUsers.length > 0) {
  839. Ext.Msg.show({
  840. title: '提示',
  841. msg: '下一步审批节点有多位处理人,现在指定>>>',
  842. buttons: Ext.Msg.YESNO,
  843. icon: Ext.window.MessageBox.QUESTION,
  844. closable: false,
  845. fn: processResult
  846. });
  847. //nextNodeId = jsonData.nodeId;
  848. } else {
  849. if (nextnode && nextnode != '-1') {
  850. me.loadNextTask(nextnode,toMaster);
  851. } else {
  852. if (tab!=null )tab.close();
  853. }
  854. return;
  855. }
  856. } else {
  857. tab.close();
  858. }
  859. }
  860. });
  861. },
  862. loadNextTask:function(nextnode,toMaster){
  863. var url="jsps/common/jprocessDeal.jsp?whoami=JProcess!Me&formCondition=jp_nodeId=" + nextnode;
  864. if(toMaster!=null){
  865. //changemaster
  866. url+='&_center=1';
  867. var modalwin=parent.Ext.getCmp('modalwindow');
  868. if(modalwin && modalwin.relateMaster!=toMaster){
  869. Ext.Ajax.request({
  870. url: basePath + 'common/changeMaster.action',
  871. params: {
  872. to: toMaster
  873. },
  874. async:false,
  875. callback: function(opt, s, r) {
  876. var modalwin=parent.Ext.getCmp('modalwindow');
  877. modalwin.relateMaster=toMaster;
  878. modalwin.setTitle('创建到账套' + toMaster + '的临时会话');
  879. }
  880. });
  881. }
  882. }
  883. window.location.href = basePath + url;
  884. },
  885. executeTask: function(value) {
  886. var me = this;
  887. var dealMessage = Ext.getCmp('dealMessage').getValue(); //处理信息 2013-3-6 20:58:14
  888. var customs = Ext.getCmp('customSetup').items.items;
  889. var attachs = Ext.getCmp('attachs').items.items[0].value;
  890. var flag = 0;
  891. Ext.each(customs,
  892. function(cu) {
  893. if (!cu.items.items[1].allowBlank && (cu.items.items[1].getValue() == null || cu.items.items[1].getValue() == '')) {
  894. Ext.Msg.alert('提示', "<b>" + cu.items.items[0].value.fontcolor("Red") + "</b>为必填项!");
  895. flag++;
  896. return;
  897. }
  898. });
  899. if (flag > 0) {
  900. return;
  901. }
  902. var cValues = [];
  903. Ext.each(customs,
  904. function(cu) {
  905. if (cu.items.items[1].getValue() != null && cu.items.items[1].getValue() != '') {
  906. var value =cu.items.items[1].getValue() instanceof Date ? me.getStringByDate(cu.items.items[1].getValue()) : cu.items.items[1].getValue();
  907. var labelValue = cu.items.items[0].value + "(" + value + ")";
  908. if(cu.items.items[1].logic!='') labelValue+='@'+cu.items.items[1].logic+'@';
  909. cValues.push(labelValue);
  910. }
  911. });
  912. var opd = cValues.join(";");
  913. switch (value) {
  914. case 1:
  915. {
  916. var taskId = ProcessData.jp_nodeId;
  917. var nodeName = ProcessData.jp_nodeName;
  918. var mb = new Ext.window.MessageBox();
  919. mb.wait('系统正在处理', '请稍后');
  920. var startdealtime = new Date();
  921. var form = iframe_maindetail.window.Ext.getCmp('form'),values=form.getValues();
  922. var bool = true;
  923. if (requiredFields != null) {
  924. if (!canexecute) {
  925. bool = false;
  926. mb.close();
  927. showError('请在同意之前先保存必填信息!');
  928. return
  929. }
  930. var fields = requiredFields.split(",");
  931. Ext.Array.each(fields,function(field) {
  932. if (form.down('#'+field) && (values[field] == null || values[field] == "")) {
  933. bool = false;
  934. mb.close();
  935. showError('请在同意之前先保存必填信息!');
  936. return
  937. }
  938. });
  939. }
  940. if (bool) {
  941. Ext.Ajax.request({
  942. url: basePath + 'common/review.action',
  943. params: {
  944. taskId: taskId,
  945. nodeName: nodeName,
  946. nodeLog: dealMessage,
  947. holdtime: ((startdealtime - basestarttime) / 1000).toFixed(0),
  948. customDes: opd,
  949. result: true,
  950. master: master,
  951. attachs:attachs,
  952. _center:_center,
  953. _noc: 1
  954. },
  955. callback: function(options, success, response) {
  956. try {
  957. var text = response.responseText;
  958. var jsonData = Ext.decode(text);
  959. if (jsonData.exceptionInfo != null) {
  960. mb.close();
  961. showError("<div style='color:red;font-size:15px;'>无法审批</div>" + jsonData.exceptionInfo);
  962. return;
  963. }
  964. else if (jsonData.success) {
  965. var nextnode = jsonData.nextnode;
  966. if (nextnode == '0') {
  967. mb.close();
  968. Ext.Msg.alert('提示', nodeName + '节点已审批!');
  969. return;
  970. } else {
  971. mb.close();
  972. function showResult(btn){
  973. if (jsonData.after != null && jsonData.after != "") {
  974. var str = jsonData.after;
  975. if (str.trim().substr(0, 12) == 'AFTERSUCCESS') { //特殊情况:操作成功,但是出现警告,允许刷新页面
  976. str = str.replace('AFTERSUCCESS', '');
  977. me.dealNextStep(nextnode,jsonData._tomaster);
  978. showError(jsonData.after);
  979. } else showError(str);
  980. } else me.dealNextStep(nextnode,jsonData._tomaster);
  981. }
  982. Ext.Msg.show({
  983. title:'提示',
  984. msg: '审批成功!',
  985. buttons: Ext.Msg.OK,
  986. closable: false,
  987. fn: showResult
  988. });
  989. if (parent && parent.Ext.getCmp('content-panel')) {
  990. var firstGrid = parent.Ext.getCmp('content-panel').items.items[0].firstGrid;
  991. if (firstGrid && firstGrid != null) {
  992. firstGrid.loadNewStore();
  993. }
  994. }
  995. return;
  996. }
  997. } else {
  998. mb.close();
  999. Ext.Msg.alert('提示', "该任务已提交,不能重复操作!");
  1000. parent.Ext.getCmp('content-panel').getActiveTab().close();
  1001. }
  1002. } catch(e) {
  1003. showError(Ext.decode(response.responseText).exceptionInfo);
  1004. }
  1005. }
  1006. });
  1007. }
  1008. };
  1009. break;
  1010. case 2:
  1011. {
  1012. //不同意 去选择退回节点
  1013. //取处理历史记录
  1014. var grid = Ext.getCmp('historyGrid');
  1015. var nodegriddata = grid.store.data;
  1016. var combodata = new Array();
  1017. combodata.push({
  1018. display: '制单人',
  1019. value: 'RECORDER'
  1020. });
  1021. Ext.Array.each(nodegriddata.items,
  1022. function(item) {
  1023. if (item.data.jn_dealResult == '同意' && item.data.jn_attach == 'T') {
  1024. combodata.push({
  1025. display: item.data.jn_name,
  1026. value: item.data.jn_name
  1027. });
  1028. }
  1029. });
  1030. Ext.create('Ext.window.Window', {
  1031. title: '指定回退节点',
  1032. height: 200,
  1033. width: 400,
  1034. layout: 'column',
  1035. id: 'win',
  1036. buttonAlign: 'center',
  1037. defaults: {
  1038. fieldStyle: 'background:#FFFAFA;color:#515151;',
  1039. columnWidth: 0.9
  1040. },
  1041. allowDrag: false,
  1042. items: [{
  1043. xtype: 'combo',
  1044. fieldLabel: '回退节点',
  1045. name: 'backtask',
  1046. id: 'backtask',
  1047. isFormField : true,
  1048. listConfig: {
  1049. maxHeight: 180
  1050. },
  1051. fieldStyle: 'background:#fffac0;color:#515151;',
  1052. store: {
  1053. fields: ['display', 'value'],
  1054. data: [{
  1055. display: '制单人',
  1056. value: 'RECORDER'
  1057. }]
  1058. },
  1059. displayField: 'display',
  1060. valueField: 'value',
  1061. queryMode: 'local',
  1062. allowBlank: false,
  1063. value: 'RECORDER',
  1064. onTriggerClick: function(trigger) {
  1065. var me = this;
  1066. this.getStore().loadData(combodata);
  1067. if (!me.readOnly && !me.disabled) {
  1068. if (me.isExpanded) {
  1069. me.collapse();
  1070. } else {
  1071. me.expand();
  1072. }
  1073. me.inputEl.focus();
  1074. }
  1075. }
  1076. },
  1077. {
  1078. xtype: 'textarea',
  1079. fieldLabel: '回退原因',
  1080. name: 'unagreedescription',
  1081. id: 'unagreedescription',
  1082. fieldStyle: 'background:#fffac0;color:#515151;',
  1083. allowBlank: false,
  1084. isFormField : true
  1085. }],
  1086. buttons: [{
  1087. text: $I18N.common.button.erpConfirmButton,
  1088. xtype: 'button',
  1089. formBind: true,
  1090. handler: function() {
  1091. var taskId = ProcessData.jp_nodeId;
  1092. var nodeName = ProcessData.jp_nodeName;
  1093. var mb = new Ext.window.MessageBox();
  1094. var startdealtime = new Date();
  1095. var backTaskName = Ext.getCmp('backtask').value;
  1096. var dealMessage = Ext.getCmp('unagreedescription').value;
  1097. if(dealMessage==null || dealMessage==''){
  1098. showMessage('提示', '请先填写回退原因!', 1000);
  1099. return;
  1100. }
  1101. mb.wait('系统正在处理', '请稍后');
  1102. Ext.Ajax.request({
  1103. url: basePath + 'common/review.action',
  1104. params: {
  1105. taskId: taskId,
  1106. nodeName: nodeName,
  1107. backTaskName: backTaskName,
  1108. nodeLog: dealMessage,
  1109. holdtime: ((startdealtime - basestarttime) / 1000).toFixed(0),
  1110. result: false,
  1111. master: master,
  1112. attachs:attachs,
  1113. _noc: 1
  1114. },
  1115. callback: function(options, success, response) {
  1116. try{
  1117. var text = response.responseText;
  1118. var jsonData = Ext.decode(text);
  1119. mb.close();
  1120. if (jsonData.exceptionInfo != null) {
  1121. showError("<div style='color:red;font-size:15px;'>无法审批</div>" + jsonData.exceptionInfo);
  1122. return;
  1123. }
  1124. if (jsonData.success) {
  1125. var nextnode = jsonData.nextnode;
  1126. showMessage('提示', '你已不同意!', 1000);
  1127. Ext.getCmp('win').close();
  1128. if (jsonData.after != null && jsonData.after != "") {
  1129. showError(jsonData.after);
  1130. } else me.dealNextStep(nextnode,jsonData._tomaster);
  1131. if (parent && parent.Ext.getCmp('content-panel')) {
  1132. var firstGrid = parent.Ext.getCmp('content-panel').items.items[0].firstGrid;
  1133. if (firstGrid && firstGrid != null) {
  1134. firstGrid.loadNewStore();
  1135. }
  1136. }
  1137. return;
  1138. } else {
  1139. Ext.Msg.alert('提示', "该任务已处理,不能重复操作!");
  1140. parent.Ext.getCmp('content-panel').getActiveTab().close();
  1141. }
  1142. }catch(e) {
  1143. showError(Ext.decode(response.responseText).exceptionInfo);
  1144. }}
  1145. });
  1146. }
  1147. },
  1148. {
  1149. text: $I18N.common.button.erpCancelButton,
  1150. handler: function() {
  1151. Ext.getCmp('win').close();
  1152. }
  1153. }]
  1154. }).show();
  1155. return;
  1156. };
  1157. break;
  1158. default:
  1159. break;
  1160. }
  1161. },
  1162. nextTask: function() {
  1163. window.location.href = basePath + "jsps/common/jprocessDeal.jsp?whoami=JProcess!Me&formCondition=jp_nodeId=" + nextnodeId;
  1164. },
  1165. skipTask: function() {
  1166. var taskId = ProcessData.jp_nodeId;
  1167. var mb = new Ext.window.MessageBox();
  1168. mb.wait('系统正在跳过', '请稍后');
  1169. Ext.Ajax.request({
  1170. url: basePath + 'common/getNextProcess.action',
  1171. params: {
  1172. taskId: taskId,
  1173. _noc: 1
  1174. },
  1175. callback: function(options, success, response) {
  1176. mb.close();
  1177. var data = response.responseText;
  1178. var jsonData = Ext.decode(data);
  1179. if (jsonData.success && jsonData.nodeId!=-1) {
  1180. window.location.href = basePath + "jsps/common/jprocessDeal.jsp?whoami=JProcess!Me&formCondition=jp_nodeId=" + jsonData.nodeId;
  1181. } else {
  1182. showMessage('提示','已无待审批的单据',0);
  1183. parent.Ext.getCmp('content-panel').getActiveTab().close();
  1184. }
  1185. }
  1186. });
  1187. },
  1188. saveNotify:function(notifyPeople,notifyGroup,peoplesname,groupnames,me,b){
  1189. var data={
  1190. processInstanceId:ProcessData.jp_processInstanceId,
  1191. nodeId:ProcessData.jp_nodeId,
  1192. nodeName:ProcessData.jp_nodeName
  1193. };
  1194. if (notifyPeople!=null && notifyPeople!='')data.notifyPeopleid=notifyPeople;
  1195. if (notifyGroup !=null && notifyGroup!='')data.notifyGroup=notifyGroup;
  1196. if (peoplesname !=null && peoplesname!='')data.notifyPeople=peoplesname;
  1197. if (groupnames !=null && groupnames!='')data.notifyGroupName=groupnames;
  1198. me.setLoading(true);
  1199. Ext.Ajax.request({
  1200. url: basePath + 'common/saveProcessNotify.action',
  1201. params: {
  1202. data:unescape(Ext.JSON.encode(data).replace(/\\/g, "%")),
  1203. _noc: 1
  1204. },
  1205. callback: function(options, success, response) {
  1206. me.setLoading(false);
  1207. var data = response.responseText;
  1208. var jsonData = Ext.decode(data);
  1209. if (jsonData.success) {
  1210. showMessage('提示', '设置知会人员成功!', 1000);
  1211. Ext.Array.each(b.ownerCt.items.items,function(item){
  1212. item.reset();
  1213. });
  1214. } else {
  1215. showError(data.exceptionInfo);
  1216. }
  1217. }
  1218. });
  1219. },
  1220. endcommunicateTask:function (me){
  1221. var taskId = ProcessData.jp_nodeId;
  1222. me.setLoading(true);
  1223. Ext.Ajax.request({
  1224. url: basePath + 'common/endCommunicateTask.action',
  1225. params: {
  1226. taskId: taskId,
  1227. processInstanceId:ProcessData.jp_processInstanceId,
  1228. _noc: 1
  1229. },
  1230. callback: function(options, success, response) {
  1231. me.setLoading(false);
  1232. var data = response.responseText;
  1233. var jsonData = Ext.decode(data);
  1234. if (jsonData.success) {
  1235. /*me.getCommunicates(taskId,ProcessData.jp_processInstanceId);
  1236. form.reset();*/
  1237. showMessage('提示', '已成功结束沟通!', 1000);
  1238. } else {
  1239. showError(data.exceptionInfo);
  1240. }
  1241. }
  1242. });
  1243. },
  1244. CommunicateWithOther: function(owner,me){
  1245. var form=owner.getForm();
  1246. var data=form.getValues();
  1247. var taskId = ProcessData.jp_nodeId;
  1248. me.setLoading(true);
  1249. Ext.Ajax.request({
  1250. url: basePath + 'common/communicateWithOther.action',
  1251. params: {
  1252. taskId: taskId,
  1253. processInstanceId:ProcessData.jp_processInstanceId,
  1254. data:unescape(Ext.JSON.encode(data).replace(/\\/g, "%")),
  1255. _noc: 1
  1256. },
  1257. callback: function(options, success, response) {
  1258. me.setLoading(false);
  1259. var data = response.responseText;
  1260. var jsonData = Ext.decode(data);
  1261. if (jsonData.success) {
  1262. me.getCommunicates(taskId,ProcessData.jp_processInstanceId);
  1263. form.reset();
  1264. showMessage('提示', '已成功发起沟通!', 1000);
  1265. } else {
  1266. showError(data.exceptionInfo);
  1267. }
  1268. }
  1269. });
  1270. },
  1271. getCommunicates:function(nodeId,processInstanceId){
  1272. Ext.Ajax.request({
  1273. url: basePath + 'common/communicateTask.action',
  1274. params: {
  1275. taskId: nodeId,
  1276. processInstanceId:processInstanceId,
  1277. _noc: 1
  1278. },
  1279. callback: function(options, success, response) {
  1280. var data = response.responseText;
  1281. var jsonData = Ext.decode(data);
  1282. if (jsonData.success) {
  1283. Ext.getCmp('com_record').setValue('<ul style="font-size:90%;color:#3B3B3B;list-style-type:none;margin:0;padding:0;margin-left:10px;overflow:hidden;">'+jsonData.msg+'</ul>');
  1284. } else {
  1285. showError(data.exceptionInfo);
  1286. }
  1287. }
  1288. });
  1289. },
  1290. getFieldByType: function(type, i,cs,label,necessary) {
  1291. var logic='';
  1292. var bool=necessary=='Y';
  1293. var fieldStyle=bool?"background:#F5FFFA;":"background:#FFFAFA;";
  1294. if(cs.indexOf("@")>0)
  1295. logic=cs.substring(cs.indexOf("@")+1);
  1296. switch (type) {
  1297. case "S":
  1298. return Ext.create('Ext.form.FieldContainer',{
  1299. defaults: {
  1300. hideLabel: true
  1301. },
  1302. hideLabel:true,
  1303. columnWidth:0.8,
  1304. layout: {
  1305. type: 'table',
  1306. columns:2,
  1307. defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
  1308. },
  1309. items: [{
  1310. xtype: 'displayfield',
  1311. maxWidth :window.innerWidth * 0.5,
  1312. value: (i+1)+'.'+label
  1313. },{
  1314. id:i,
  1315. labelSeparator:'',
  1316. padding:'0 0 0 10',
  1317. xtype:'textfield',
  1318. allowBlank:!bool,
  1319. logic:logic}]
  1320. });
  1321. break;
  1322. case "D":
  1323. return Ext.create('Ext.form.FieldContainer',{
  1324. defaults: {
  1325. hideLabel: true
  1326. },
  1327. hideLabel:true,
  1328. columnWidth:0.8,
  1329. layout: {
  1330. type: 'table',
  1331. columns:2,
  1332. defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
  1333. },
  1334. items: [{
  1335. xtype: 'displayfield',
  1336. maxWidth :window.innerWidth * 0.5,
  1337. value: (i+1)+'.'+label
  1338. },{
  1339. id:i,
  1340. format: 'Y-m-d',
  1341. labelSeparator:'',
  1342. padding:'0 0 0 10',
  1343. logic:logic,
  1344. allowBlank:!bool,
  1345. xtype:'datefield'
  1346. }]
  1347. });
  1348. break;
  1349. case "N":
  1350. return Ext.create('Ext.form.FieldContainer',{
  1351. defaults: {
  1352. hideLabel: true
  1353. },
  1354. hideLabel:true,
  1355. columnWidth:0.8,
  1356. layout: {
  1357. type: 'hbox',
  1358. defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
  1359. },
  1360. items: [{
  1361. xtype: 'displayfield',
  1362. maxWidth :window.innerWidth * 0.5,
  1363. value: (i+1)+'.'+label
  1364. },{
  1365. id: i,
  1366. labelSeparator:'',
  1367. padding:'0 0 0 10',
  1368. logic:logic,
  1369. allowBlank:!bool,
  1370. hideTrigger:true,
  1371. fieldStyle:fieldStyle,
  1372. xtype:'numberfield'
  1373. }]
  1374. });
  1375. break;
  1376. case "C":
  1377. if(cs.indexOf('[')>0){
  1378. var comstr=cs.substring(cs.indexOf('[')+1,cs.indexOf(']'));
  1379. var str=comstr.split(";");
  1380. var arr=new Array();
  1381. Ext.Array.each(str,function(s){
  1382. arr.push({"value":s});
  1383. });
  1384. var comStore = Ext.create('Ext.data.Store', {
  1385. fields: ['value'],
  1386. data: arr
  1387. });
  1388. return Ext.create('Ext.form.FieldContainer',{
  1389. defaults: {
  1390. hideLabel: true
  1391. },
  1392. hideLabel:true,
  1393. columnWidth:0.8,
  1394. layout: {
  1395. type: 'table',
  1396. columns:2,
  1397. defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
  1398. },
  1399. items: [{
  1400. xtype: 'displayfield',
  1401. maxWidth :window.innerWidth * 0.5,
  1402. value: (i+1)+'.'+label
  1403. },{
  1404. store: comStore,
  1405. queryMode: 'local',
  1406. editable: false,
  1407. displayField: 'value',
  1408. padding:'0 0 0 10',
  1409. valueField: 'value',
  1410. logic:logic,
  1411. labelSeparator:'',
  1412. fieldStyle:fieldStyle,
  1413. xtype:'combo',
  1414. allowBlank:!bool
  1415. }]
  1416. });
  1417. }
  1418. break;
  1419. case "B":
  1420. var comStore = Ext.create('Ext.data.Store', {
  1421. fields: ['value'],
  1422. data: [{
  1423. "value": "是"
  1424. },{
  1425. "value": "否"
  1426. },{
  1427. "value": "不执行"
  1428. }]
  1429. });
  1430. return Ext.create('Ext.form.FieldContainer',{
  1431. defaults: {
  1432. hideLabel: true
  1433. },
  1434. hideLabel:true,
  1435. columnWidth:0.8,
  1436. layout: {
  1437. type: 'table',
  1438. columns:2,
  1439. defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
  1440. },
  1441. items: [{
  1442. xtype: 'displayfield',
  1443. maxWidth :window.innerWidth * 0.3,
  1444. value: (i+1)+'.'+label
  1445. },{
  1446. store: comStore,
  1447. queryMode: 'local',
  1448. editable: false,
  1449. displayField: 'value',
  1450. valueField: 'value',
  1451. columnWidth: 0.3,
  1452. padding:'0 0 0 10',
  1453. logic:logic,
  1454. fieldStyle:fieldStyle ,
  1455. blankText: "不允许为空",
  1456. allowBlank:!bool,
  1457. hideLabel:true,
  1458. xtype:'combo',
  1459. labelSeparator:''
  1460. }
  1461. ]
  1462. });
  1463. }
  1464. },
  1465. getStringByDate: function() {
  1466. var date = arguments[0];
  1467. var m = date.getMonth();
  1468. var month = m + 1;
  1469. return date.getFullYear() + "-" + month + "-" + date.getDate();
  1470. },
  1471. listeners: {
  1472. beforerender: function() {
  1473. var me = this;
  1474. formCondition = this.BaseUtil.getUrlParam('formCondition'); //从url解析参数
  1475. formCondition = (formCondition == null) ? "": formCondition.replace(/IS/g, "=");
  1476. var strArr = formCondition.split("=");
  1477. Ext.Ajax.request({
  1478. url: basePath + 'common/getCustomSetupOfTask.action',
  1479. params: {
  1480. nodeId: strArr[1],
  1481. master: master,
  1482. _noc: 1
  1483. },
  1484. success: function(response, options) {
  1485. var localJson = Ext.decode(response.responseText);
  1486. cs = localJson.cs;
  1487. var arr = null;
  1488. if (localJson.data != null) {
  1489. arr = localJson.data.split(";");
  1490. }
  1491. if(localJson.isApprove==1){
  1492. Ext.getCmp('disagree').setDisabled(true);
  1493. }
  1494. var customSetup = Ext.getCmp('customSetup');
  1495. if (cs != null && cs.length > 0) {
  1496. customSetup.show();
  1497. var csstr='';
  1498. for (var i = 0; i < cs.length; i++) {
  1499. csstr=cs[i].toString();
  1500. var i1 = csstr.indexOf('^');
  1501. var i2 = csstr.indexOf('$');
  1502. var value = csstr.substring(0, i1);
  1503. var type = csstr.substring(i1 + 1, i2);
  1504. var neccesary = csstr.substring(i2 +1,i2+2);
  1505. var field = me.getFieldByType(type, i,csstr,value,neccesary);
  1506. if (arr != null) {
  1507. field.items.items[1].setValue(arr[i].substring(arr[i].indexOf("(") + 1, arr[i].indexOf(")")));
  1508. }
  1509. customSetup.add(field);
  1510. }
  1511. }
  1512. }
  1513. });
  1514. },
  1515. afterrender: function() {
  1516. var me = this;
  1517. formCondition = this.BaseUtil.getUrlParam('formCondition'); //从url解析参数
  1518. formCondition = (formCondition == null) ? "": formCondition.replace(/IS/g, "=");
  1519. var strArr = formCondition.split("=");
  1520. nodeId = nodeId != null ? nodeId: this.BaseUtil.getUrlParam('nodeId');
  1521. nodeId =nodeId !=null?nodeId :strArr[1];
  1522. Ext.Ajax.request({
  1523. url: basePath + 'common/getProcessInstanceId.action',
  1524. params: {
  1525. jp_nodeId: nodeId,
  1526. master: master,
  1527. _noc: 1
  1528. },
  1529. success: function(response) {
  1530. var res = response.responseText;
  1531. processInstanceId = Ext.decode(res).processInstanceId;
  1532. me.getCommunicates(nodeId,processInstanceId);
  1533. Ext.getCmp('historyGrid').getOwnStore(processInstanceId);
  1534. Ext.Ajax.request({ //获取当前节点对应的JProcess对象
  1535. url: basePath + 'common/getCurrentNode.action',
  1536. params: {
  1537. jp_nodeId: nodeId,
  1538. master: master,
  1539. _noc: 1
  1540. },
  1541. success: function(response) {
  1542. var res = new Ext.decode(response.responseText);
  1543. ProcessData = res.info.currentnode;
  1544. if(ProcessData.jp_pagingid && parent.Ext){
  1545. var win=parent.Ext.getCmp('msg-win-'+ProcessData.jp_pagingid);
  1546. if(win){
  1547. win.close();
  1548. }
  1549. }
  1550. Ext.getCmp('currentnode').setText('当前节点:<font size=2 color="red">' + ProcessData.jp_nodeName + '</font>');
  1551. Ext.getCmp('launchername').setText('发起人:<font size=2 color="red">' + ProcessData.jp_launcherName + '</font>');
  1552. Ext.getCmp('launchtime').setText('发起时间:<font size=2 color="red">' + Ext.Date.format(new Date(ProcessData.jp_launchTime), "Y-m-d H:i:s") + '</font>');
  1553. Ext.getCmp('label1').setText('<span style="font-weight: bold !important;font-size:18px">' + ProcessData.jp_name + '</span>');
  1554. var formCondition = ProcessData.jp_keyName + "IS" + ProcessData.jp_keyValue;
  1555. var gridCondition = '';
  1556. if (ProcessData.jp_keyName) {
  1557. gridCondition = ProcessData.jp_formDetailKey + 'IS' + ProcessData.jp_keyValue;
  1558. }
  1559. var caller = ProcessData.jp_caller;
  1560. var url = basePath + ProcessData.jp_url;
  1561. var queryType='form';
  1562. var myurl;
  1563. if (me.BaseUtil.contains(url, '?', true)) {
  1564. myurl = url + '&formCondition=' + formCondition + '&gridCondition=' + gridCondition;
  1565. } else {
  1566. myurl = url + '?formCondition=' + formCondition + '&gridCondition=' + gridCondition;
  1567. }
  1568. myurl += '&_noc=1&datalistId=NaN'; // 不限制权限
  1569. if (master) {
  1570. myurl += '&newMaster=' + master;
  1571. }
  1572. if(myurl.indexOf('jsps/ma/jprocess/AutoJprocess.jsp?type=1')>0){
  1573. myurl+='&caller='+caller;
  1574. queryType='tabpanel';
  1575. }
  1576. panel = new Ext.panel.Panel({
  1577. tag: 'iframe',
  1578. id: 'mm',
  1579. style: {
  1580. background: '#f0f0f0',
  1581. border: 'none'
  1582. },
  1583. frame: true,
  1584. border: false,
  1585. layout: 'fit',
  1586. height: window.innerHeight,
  1587. iconCls: 'x-tree-icon-tab-tab',
  1588. html: '<iframe id="iframe_maindetail" name = "iframe_maindetail" src="' + myurl + '" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>'
  1589. });
  1590. var viewport = Ext.getCmp("JProcessViewport");
  1591. viewport.insert(2, panel);
  1592. var w = iframe_maindetail.window;
  1593. var doc = iframe_maindetail.window.document;
  1594. var id;
  1595. id = window.setInterval(findToolbar, 1000);
  1596. var childpanel,childtoolbar;
  1597. function findToolbar() {
  1598. if (w.Ext) {
  1599. if(!childpanel) {childpanel = w.Ext.ComponentQuery.query(queryType)[0];}
  1600. childtoolbar = w.Ext.ComponentQuery.query(queryType+'>toolbar')[0];
  1601. if (!childpanel || !childpanel.dockedItems) return;
  1602. Ext.Array.each(childpanel.dockedItems.items,
  1603. function(item) {
  1604. if (item.dock == 'bottom') {
  1605. item.removeAll();
  1606. toolbar = item;
  1607. }
  1608. });
  1609. if (childtoolbar != null) {
  1610. window.clearInterval(id);
  1611. var button = res.info.button;
  1612. if (button != null && !ISexecuted) {
  1613. //带XTYPE的BUTTON
  1614. var buttontype = button.jb_fields;
  1615. var neccessaryField = button.jt_neccessaryfield;
  1616. if(buttontype=='updatedetail'){
  1617. var grid=w.Ext.ComponentQuery.query('grid')[0];
  1618. if (neccessaryField != null) {
  1619. grid.readOnly=false;
  1620. grid.NoAdd=true;
  1621. var fields = neccessaryField.split(","),addItems=new Array(),fieldtype=null,editable=false;
  1622. Ext.Array.each(grid.columns,function(column){
  1623. editable=false;
  1624. Ext.Array.each(fields,function(field) {
  1625. var f =column.xtype;
  1626. if(column.dataIndex==field){
  1627. column.getEl().applyStyles('color:#FF0000');
  1628. column.neccessaryField=true;
  1629. editable=true;
  1630. if (f=="numbercolumn") {
  1631. column.editor={
  1632. xtype:'numberfield',
  1633. format:'0',
  1634. hideTrigger:true
  1635. };
  1636. } else if (f=="floatcolumn") {
  1637. column.editor={
  1638. xtype:'numberfield',
  1639. format:'0.00',
  1640. hideTrigger:true
  1641. };
  1642. } else if (f.indexOf("floatcolumn")>-1) {
  1643. var format = "0.";
  1644. var length =parseInt(f.substring(11));
  1645. for (var i = 0; i < length; i++) {
  1646. format += "0";
  1647. }
  1648. column.editor={
  1649. xtype:'numberfield',
  1650. format:format,
  1651. hideTrigger:true
  1652. };
  1653. } else if (f =="datecolumn") {
  1654. column.editor={
  1655. xtype:'datefield',
  1656. format:"Y-m-d",
  1657. hideTrigger:false
  1658. };
  1659. } else if (f =="datetimecolumn") {
  1660. column.editor={
  1661. xtype:'datetimefield',
  1662. format:"Y-m-d H:i:s",
  1663. hideTrigger:false
  1664. };
  1665. } else if (f =="timecolumn") {
  1666. column.editor={
  1667. xtype:'timefield',
  1668. format:"H:i",
  1669. hideTrigger:false
  1670. };
  1671. } else if (f =="monthcolumn") {
  1672. column.editor={
  1673. xtype:'monthdatefield',
  1674. hideTrigger:false
  1675. };
  1676. } else if (f =="textcolumn" || f=="textfield" || f=="text") {
  1677. column.editor={
  1678. xtype:'textfield'
  1679. };
  1680. } else if (f =="textareafield") {
  1681. column.editor={
  1682. xtype:'textareafield'
  1683. };
  1684. } else if (f=="textareatrigger") {
  1685. column.editor={
  1686. xtype:'textareatrigger',
  1687. hideTrigger:false
  1688. };
  1689. } else if (f=="dbfindtrigger") {
  1690. column.editor={
  1691. xtype:'dbfindtrigger',
  1692. hideTrigger:false
  1693. };
  1694. } else if (f =="multidbfindtrigger") {
  1695. column.editor={
  1696. xtype:'multidbfindtrigger',
  1697. hideTrigger:false
  1698. };
  1699. } else if (f=="datehourminutefield") {
  1700. column.editor={
  1701. xtype:'datehourminutefield',
  1702. hideTrigger:false
  1703. };
  1704. } else if (f=="checkbox") {
  1705. column.editor={
  1706. xtype:'checkbox',
  1707. cls:'x-grid-checkheader-editor',
  1708. hideTrigger:false
  1709. };
  1710. }
  1711. return false;
  1712. }
  1713. });
  1714. if(!editable) {
  1715. column.editor=null;
  1716. }
  1717. });
  1718. toolbar.add(['->', {
  1719. xtype: 'button',
  1720. text:'修改明细',
  1721. iconCls: 'x-button-icon-save',
  1722. cls: 'x-btn-gray',
  1723. handler:function(btn){
  1724. var values = {};
  1725. var jsonGridData = new Array();
  1726. var s = grid.getStore().data.items;//获取store里面的数据
  1727. var dd;
  1728. for(var i=0;i<s.length;i++){//将grid里面各行的数据获取并拼成jsonGridData
  1729. var data = s[i].data;
  1730. dd = new Object();
  1731. if(s[i].dirty && !grid.GridUtil.isBlank(grid, data)){
  1732. Ext.each(grid.columns, function(c){
  1733. if((c.neccessaryField && c.logic!='ignore')|| c.logic=='keyField'){
  1734. if(c.xtype == 'datecolumn'){
  1735. c.format = c.format || 'Y-m-d';
  1736. if(Ext.isDate(data[c.dataIndex])){
  1737. dd[c.dataIndex] = Ext.Date.format(data[c.dataIndex], c.format);
  1738. }
  1739. } else if(c.xtype == 'datetimecolumn'){
  1740. if(Ext.isDate(data[c.dataIndex])){
  1741. dd[c.dataIndex] = Ext.Date.format(data[c.dataIndex], 'Y-m-d H:i:s');
  1742. }
  1743. } else if(c.xtype == 'numbercolumn'){
  1744. dd[c.dataIndex] = "" + s[i].data[c.dataIndex];
  1745. } else {
  1746. dd[c.dataIndex] = s[i].data[c.dataIndex];
  1747. }
  1748. }
  1749. });
  1750. jsonGridData.push(Ext.JSON.encode(dd));
  1751. }
  1752. }
  1753. childpanel.getForm().getFields().each(function(field) {
  1754. if (field.isDirty() && field.logic!='ignore' ) {
  1755. var data = field['getSubmitData'](true);
  1756. if (Ext.isObject(data)) {
  1757. Ext.iterate(data,
  1758. function(name, val) {
  1759. if (true && val === '') {
  1760. val = field.emptyText || '';
  1761. }
  1762. if (name in values) {
  1763. var bucket = values[name],
  1764. isArray = Ext.isArray;
  1765. if (!isArray(bucket)) {
  1766. bucket = values[name] = [bucket];
  1767. }
  1768. if (isArray(val)) {
  1769. values[name] = bucket.concat(val);
  1770. } else {
  1771. bucket.push(val);
  1772. }
  1773. } else {
  1774. values[name] = val;
  1775. }
  1776. });
  1777. }
  1778. }
  1779. });
  1780. values[ProcessData.jp_keyName] = ProcessData.jp_keyValue;
  1781. Ext.Ajax.request({
  1782. url: basePath + '/common/processUpdate.action',
  1783. method: 'post',
  1784. params: {
  1785. caller: caller,
  1786. processInstanceId:ProcessData.jp_processInstanceId,
  1787. formStore: unescape(Ext.JSON.encode(values).replace(/\\/g, "%")),
  1788. param: unescape(jsonGridData.toString()),
  1789. _noc: 1
  1790. },
  1791. callback: function(options, success, response) {
  1792. var localJson = new Ext.decode(response.responseText);
  1793. canexecute = true;
  1794. if (localJson.success) {
  1795. updateSuccess();
  1796. grid.GridUtil.loadNewStore(grid,{
  1797. caller:caller,
  1798. condition:ProcessData.jp_formDetailKey + '=' + ProcessData.jp_keyValue
  1799. });
  1800. } else if (localJson.exceptionInfo) {
  1801. var str = localJson.exceptionInfo;
  1802. if (str.trim().substr(0, 12) == 'AFTERSUCCESS') { //特殊情况:操作成功,但是出现警告,允许刷新页面
  1803. str = str.replace('AFTERSUCCESS', '');
  1804. updateSuccess();
  1805. }
  1806. showError(str);
  1807. return;
  1808. } else {
  1809. updateFailure();
  1810. }
  1811. }
  1812. });
  1813. }
  1814. },
  1815. '->']);
  1816. }
  1817. }else if (buttontype.indexOf('#') > 0) {
  1818. toolbar.add(['->', {
  1819. xtype: buttontype.split('#')[1],
  1820. text: button.jb_buttonname,
  1821. handler:function(){
  1822. canexecute=true;
  1823. }
  1824. },
  1825. '->']);
  1826. } else {
  1827. childtoolbar.add(['->', {
  1828. xtype: 'button',
  1829. text: button.jb_buttonname,
  1830. id: button.jb_id,
  1831. group: button.jb_fields,
  1832. iconCls: 'x-button-icon-save',
  1833. cls: 'x-btn-gray',
  1834. formBind: true,
  1835. handler: function() {
  1836. var values = {};
  1837. var necessaryValues = iframe_maindetail.window.Ext.getCmp('form').getValues();
  1838. var bool = true;
  1839. if (requiredFields != null) {
  1840. var fields = requiredFields.split(",");
  1841. Ext.Array.each(fields,
  1842. function(field) {
  1843. if (necessaryValues[field] == null || necessaryValues[field] == "") {
  1844. bool = false;
  1845. showError('保存之前请先填写必填的信息!');
  1846. return;
  1847. }
  1848. });
  1849. }
  1850. if (bool) {
  1851. childpanel.getForm().getFields().each(function(field) {
  1852. //&& field.groupName==button.jb_fields 有些组件写的有问题
  1853. if (field.isDirty() && field.logic!='ignore' ) {
  1854. var data = field['getSubmitData'](true);
  1855. if (Ext.isObject(data)) {
  1856. Ext.iterate(data,
  1857. function(name, val) {
  1858. if (true && val === '') {
  1859. val = field.emptyText || '';
  1860. }
  1861. if (name in values) {
  1862. var bucket = values[name],
  1863. isArray = Ext.isArray;
  1864. if (!isArray(bucket)) {
  1865. bucket = values[name] = [bucket];
  1866. }
  1867. if (isArray(val)) {
  1868. values[name] = bucket.concat(val);
  1869. } else {
  1870. bucket.push(val);
  1871. }
  1872. } else {
  1873. values[name] = val;
  1874. }
  1875. });
  1876. }
  1877. }
  1878. });
  1879. values[ProcessData.jp_keyName] = ProcessData.jp_keyValue;
  1880. Ext.Ajax.request({
  1881. url: basePath + '/common/processUpdate.action',
  1882. method: 'post',
  1883. params: {
  1884. caller: caller,
  1885. processInstanceId:ProcessData.jp_processInstanceId,
  1886. formStore: unescape(Ext.JSON.encode(values).replace(/\\/g, "%")),
  1887. _noc: 1
  1888. },
  1889. callback: function(options, success, response) {
  1890. var localJson = new Ext.decode(response.responseText);
  1891. canexecute = true;
  1892. if (localJson.success) {
  1893. updateSuccess();
  1894. } else if (localJson.exceptionInfo) {
  1895. var str = localJson.exceptionInfo;
  1896. if (str.trim().substr(0, 12) == 'AFTERSUCCESS') { //特殊情况:操作成功,但是出现警告,允许刷新页面
  1897. str = str.replace('AFTERSUCCESS', '');
  1898. updateSuccess();
  1899. }
  1900. showError(str);
  1901. return;
  1902. } else {
  1903. updateFailure();
  1904. }
  1905. }
  1906. });
  1907. }
  1908. }
  1909. },
  1910. '->']);
  1911. }
  1912. var items = w.Ext.ComponentQuery.query('form')[0].items.items;
  1913. //var nameArray=button.jb_buttonname.split(";");
  1914. var fieldsArray=button.jb_fields.split(";");
  1915. requiredFields = neccessaryField;
  1916. var necFields=neccessaryField!=null?neccessaryField.split(","):[];
  1917. Ext.each(items,function(item) {
  1918. if (item.groupName == button.jb_buttonname && button.jb_fields.indexOf("#") > 0) {
  1919. item.setReadOnly(false);
  1920. }
  1921. if (Ext.Array.contains(fieldsArray,item.groupName)) {
  1922. item.setReadOnly(false);
  1923. if (item.xtype!='checkbox' && !Ext.Array.contains(necFields,item.name)) {
  1924. item.setFieldStyle("background:#FFFAFA;color:#515151;");
  1925. }
  1926. }
  1927. if(Ext.Array.contains(necFields,item.name)){
  1928. item.setReadOnly(false);
  1929. if(item.xtype!='checkbox')
  1930. item.setFieldStyle("background:#fffac0;color:#515151;");
  1931. }
  1932. });
  1933. }
  1934. }
  1935. }
  1936. };
  1937. }
  1938. });
  1939. }
  1940. });
  1941. }
  1942. },
  1943. setLoading : function(b) {// 原this.getActiveTab().setLoading()换成此方法,解决Window模式下无loading问题
  1944. var mask = this.mask;
  1945. if (!mask) {
  1946. this.mask = mask = new Ext.LoadMask(Ext.getBody(), {
  1947. msg : "处理中,请稍后...",
  1948. msgCls : 'z-index:10000;'
  1949. });
  1950. }
  1951. if (b)
  1952. mask.show();
  1953. else
  1954. mask.hide();
  1955. }
  1956. });