1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140 |
- Ext.define('erp.view.common.JProcess.Viewport', {
- extend: 'Ext.Viewport',
- layout: 'fit',
- id: 'viewPort',
- hideBorders: true,
- autoScroll: false,
- style: {
- background: '#D3D3D3'
- },
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- initComponent: function() {
- var me = this;
- formCondition = this.BaseUtil.getUrlParam('formCondition'); //从url解析参数
- formCondition = (formCondition == null) ? "": formCondition.replace(/IS/g, "=");
- nodeId = nodeId != null ? nodeId: this.BaseUtil.getUrlParam('nodeId');
- if (formCondition != "") {
- nodeId = formCondition.split("=")[1];
- }
- var condition = formCondition == "" ? "jp_nodeId='" + nodeId + "'": formCondition;
- var panel = new Ext.panel.Panel({
- html: '<div style="background-color:#f0f0f0;font-size:15px"><h2>待审批单据信息</h2></div>'
- });
- var param = {
- caller: caller,
- condition: condition,
- _noc: 1
- };
- if (master) {
- param.master = master;
- }
- var nodesgrid = Ext.create('erp.view.common.JProcess.GridPanel', {
- anchor: '100%',
- deferLoadData:true
- });
- Ext.apply(me, {
- items: [{
- id: 'JProcessViewport',
- layout: 'auto',
- autoScroll: true,
- xtype: 'panel',
- style: {
- background: '#FFFFFF'
- },
- items: [{
- xtype: 'form',
- anchor: '100%',
- bodyStyle: {
- background: '#E3E3E3'
- },
- id: 'mainForm',
- items: [{
- id: 'app-header',
- xtype: 'box',
- height: 5,
- style: 'color: #596F8F;font-size: 16px;font-weight: 200;padding: 5px 5px;text-shadow: 0 1px 0 #fff'
- },{
- xtype: 'toolbar',
- id: 'currentNodeToolbar',
- layout: {
- type: 'hbox',
- align: 'right'
- },
- style: {
- background: 'transparent',
- border: 'none'
- },
- items: [{
- xtype: 'tbtext',
- id: 'processname'
- },
- '->', {
- xtype: 'tbtext',
- id: 'label1',
- text: ''
- },
- '->', {
- xtype: 'tbtext',
- id: 'label2',
- text: ''
- },
- {
- xtype: 'tbtext',
- id: 'label3',
- text: ''
- }]
- },
- {
- xtype: 'fieldcontainer',
- labelWidth: 250,
- layout: 'column',
- id: 'container',
- items: [{
- xtype: 'checkboxfield',
- boxLabel: '<span style="font-weight: bold !important;">变更办理人</span>',
- columnWidth: 0.4,
- readOnly:ISexecuted,
- disabled:ISexecuted,
- checked: false,
- id: 'alterAssignee',
- handler: function(checkBox, checked) {
- this.ownerCt.ownerCt.ownerCt.ownerCt.getAssigneeCombox(checkBox, checked);
- }
- },
- {
- xtype: 'toolbar',
- width: '78%',
- columnWidth: 0.6,
- layout: {
- type: 'hbox',
- align: 'right'
- },
- style: {
- background: 'transparent',
- border: 'none'
- },
- items: ['->', {
- xtype: 'tbtext',
- id: 'currentnode'
- },
- '-', {
- xtype: 'tbtext',
- id: 'launchername'
- },
- '-', {
- xtype: 'tbtext',
- id: 'launchtime'
- }]
- },
- {
- xtype: 'fieldcontainer',
- columnWidth: 1,
- id: 'container2',
- labelWidth: 100,
- layout: 'hbox'
- }]
- },
- {
- xtype: 'fieldcontainer',
- id: 'container3',
- labelWidth: 100,
- layout: 'column',
- labelSeparator: '',
- margin: '0 0 0 5',
- fieldLabel: '<h2>审批意见</h2>',
- items: [{
- xtype: 'textfield',
- name: 'dealMessage',
- id: 'dealMessage',
- hideLabel: true,
- columnWidth: 0.65,
- labelAlign: 'right',
- fieldStyle: 'background:#FFFAFA;color:#515151;'
- }]
- },{
- xtype: 'fieldcontainer',
- id: 'customSetup',
- labelWidth: 100,
- labelSeparator: '',
- fieldLabel: '<h2>审批要点</h2>',
- layout: 'column',
- hidden: true,
- margin: '0 72 0 5'
- },
- {
- xtype: 'fieldcontainer',
- id: 'container4',
- labelWidth: 100,
- layout: 'anchor'
- },
- {
- xtype:'mfilefield',
- id:'attachs',
- name:'attachs',
- collapsed: true,
- collapsible: true,
- frame:true,
- modify:true,
- style: '',
- title: '<img src="' + basePath + 'resource/images/icon/attach.png" width=20/> <span style="font-weight:bold;font-size:13px;">附件</span>',
- listeners : {
- afterrender: function(f){
- if(f.value != null && f.value.toString().trim() != ''){
- f.download(f.value);
- }
- }
- }
- },{
- xtype: 'fieldset',
- margin: '2 2 2 2',
- collapsible: true,
- collapsed: true,
- layout:'column',
- title: '<img src="' + basePath + 'resource/images/mainpage/info.png" width=20/> <span style="font-weight:bold;font-size:13px;">知会</span>',
- items: [Ext.create('erp.view.core.trigger.AddDbfindTrigger',{
- anchor:'100% 30%',
- emptyText:'选择知会人',
- fieldStyle: 'background:#FAFAFA;color:#515151;',
- hideLabel:true,
- name:'notifyPeople',
- id:'notifyPeople',
- group:0,
- columnWidth:0.4
- }),{
- name:'notifyPeopleid',
- id:'notifyPeopleid',
- xtype:'textfield',
- hidden:true
- },Ext.create('erp.view.core.trigger.AddDbfindTrigger',{
- anchor:'100% 30%',
- emptyText:'选择知会岗位',
- name:'notifyGroupName',
- id:'notifyGroupName',
- group:0,
- fieldStyle: 'background:#FAFAFA;color:#515151;padding-left:5px',
- hideLabel:true,
- columnWidth:0.4
- }),{
- name:'notifyGroup',
- id:'notifyGroup',
- xtype:'textfield',
- hidden:true
- },{
- text : '清空',
- xtype:'button',
- handler : function(b) {
- Ext.Array.each(b.ownerCt.items.items,function(item){
- item.reset();
- });
- }
- },{
- text : '确定',
- xtype:'button',
- handler : function(b) {
- var peoples=Ext.getCmp('notifyPeopleid').value;
- var groups=Ext.getCmp('notifyGroup').value;
- var peoplesname=Ext.getCmp('notifyPeople').value;
- var groupsname=Ext.getCmp('notifyGroupName').value;
- if((peoples==null || peoples=='' )&& (groups==null || groups=='')) showMessage('提示','先选择需要知会的岗位或人员!',1000);
- else me.saveNotify(peoples,groups,peoplesname,groupsname,me,b);
- }
- }]
- },{
- xtype: 'fieldset',
- margin: '2 2 2 2',
- collapsible: true,
- collapsed: true,
- layout:'column',
- title: '<img src="' + basePath + 'resource/images/icon/communicate.png" width=20/> <span style="font-weight:bold;font-size:13px;text-align:top;height:30px;">沟通</span>',
- items: [{
- name : 'com_record',
- id :'com_record',
- hideLabel : true,
- autoHeight : true,
- height:250,
- columnWidth:0.6,
- readOnly:true,
- xtype: 'htmleditor',
- enableColors: false,
- enableAlignments: false,
- enableFont: false,
- enableFontSize: false,
- enableFormat: false,
- enableLinks: false,
- enableLists: false,
- enableSourceEdit: false,
- frame: false,
- fieldStyle: 'border-bottom: none;'
- },{
- xtype:'form',
- columnWidth:0.4,
- height :250,
- layout:'anchor',
- frame:true,
- items:[{
- xtype:'textareafield',
- name :'communicaterecord',
- id:'communicaterecord',
- hideLabel:true,
- allowBlank:false,
- anchor:'100% 70%',
- fieldStyle: 'background:#FAFAFA;color:#515151;'
- },Ext.create('erp.view.core.trigger.MultiDbfindTrigger',{
- anchor:'100% 30%',
- emptyText:'选择沟通人',
- fieldStyle: 'background:#FAFAFA;color:#515151;',
- id:'communicator',
- name:'communicator',
- allowBlank:false,
- labelWidth : 50
- }),{
- id:'communicatorid',
- name:'communicatorid',
- xtype:'textfield',
- hidden:true
- }],
- buttonAlign : 'center',
- buttons : [{
- text : '重置',
- handler : function(b) {
- b.ownerCt.ownerCt.getForm().reset();
- }
- },{
- text : '确定',
- formBind: true,
- handler : function(b) {
- me.CommunicateWithOther(b.ownerCt.ownerCt,me);
- }
- }]
- }]
- },{
- xtype: 'toolbar',
- style: {
- background: 'transparent',
- border: 'none'
- },
- id: 'container5',
- anchor: '100%',
- layout: 'hbox',
- readOnly: ISexecuted,
- disabled: ISexecuted,
- items: [{
- xtype: 'splitter',
- width: 20
- },
- {
- xtype: 'button',
- text: '同 意',
- iconCls: 'x-button-icon-agree',
- cls: 'x-btn-gray',
- width: 90,
- handler: function() {
- this.ownerCt.ownerCt.ownerCt.ownerCt.executeTask(1);
- }
- },
- {
- xtype: 'splitter',
- width: 10
- },
- {
- xtype: 'button',
- id:'disagree',
- text: '不 同 意',
- iconCls: 'x-button-icon-unagree',
- cls: 'x-btn-gray',
- width: 90,
- handler: function() {
- this.ownerCt.ownerCt.ownerCt.ownerCt.executeTask(2);
- }
- },
- {
- xtype: 'splitter',
- width: 10
- },{
- xtype: 'button',
- iconCls: 'x-button-icon-turn',
- text: '结束沟通',
- cls: 'x-btn-gray',
- iconCls:'x-button-icon-talk',
- width: 90,
- handler: function() {
- this.ownerCt.ownerCt.ownerCt.ownerCt.endcommunicateTask(me);
- }
- },{
- xtype: 'splitter',
- width: 10
- },{
- xtype: 'button',
- text: '结束流程',
- width: 90,
- iconCls: 'x-button-icon-end',
- cls: 'x-btn-gray',
- handler: function() {
- this.ownerCt.ownerCt.ownerCt.ownerCt.endProcess();
- }
- },{
- xtype: 'splitter',
- width: 10
- },{
- xtype: 'button',
- iconCls: 'x-button-icon-turn',
- text: '下一条',
- cls: 'x-btn-gray',
- width: 90,
- handler: function() {
- this.ownerCt.ownerCt.ownerCt.ownerCt.skipTask();
- }
- },
- {
- xtype: 'splitter',
- width: 10
- },
- /*{
- xtype: 'button',
- text: '结束流程',
- width: 90,
- iconCls: 'x-button-icon-end',
- cls: 'x-btn-gray',
- handler: function() {
- this.ownerCt.ownerCt.ownerCt.ownerCt.endProcess();
- }
- },
- {
- xtype: 'splitter',
- width: 10
- },
- {
- xtype: 'button',
- text: '删除流程',
- iconCls: 'tree-delete',
- disabled: true,
- width: 90,
- cls: 'x-btn-gray',
- handler: function() {
- this.ownerCt.ownerCt.ownerCt.ownerCt.deleteProcess();
- }
- },
- {
- xtype: 'splitter',
- width: 10
- },
- {
- xtype: 'button',
- text: '重置流程',
- iconCls: 'x-button-icon-reset',
- width: 90,
- cls: 'x-btn-gray',
- handler: function() {
- this.ownerCt.ownerCt.ownerCt.ownerCt.backProcess();
- }
- },
- {
- xtype: 'splitter',
- width: 10
- },*/
- {
- xtype: 'button',
- text: '关 闭',
- iconCls: 'x-button-icon-close',
- cls: 'x-btn-gray',
- id:'closeProcess',
- width: 90,
- handler: function() {
- if(parent.Ext.getCmp('modalwindow')){
- Ext.Ajax.request({
- url: basePath + 'common/changeMaster.action',
- params: {
- to: parent.Ext.getCmp('modalwindow').historyMaster
- },
- callback: function(opt, s, r) {
- if (s) {
- var formUtil = Ext.create('erp.util.FormUtil');
- var tab = formUtil.getActiveTab();
- if(tab){
- tab.fireEvent('activate',tab);
- }
- parent.Ext.getCmp('modalwindow').close();
- } else {
- alert('切换到原账套失败!');
- }
- }
- });
- }
- else parent.Ext.getCmp('content-panel').getActiveTab().close();
- }
- }
- ]
- }]
- },
- panel, nodesgrid]
- }]
- });
- me.callParent(arguments);
- },
- getProcessData: function(params) {
- Ext.Ajax.request({
- url: basePath + form.saveUrl,
- params: params,
- method: 'post',
- async: false,
- callback: function(options, success, response) {
- var localJson = new Ext.decode(response.responseText);
- ProcessData = localJson.data;
- }
- });
- },
- getAssigneeCombox: function(checkBox, checked) {
- var processInstanceId = ProcessData.jp_processInstanceId,me=this;
- var button = Ext.create('Ext.Button', {
- text: '确定',
- cls: 'x-btn-gray',
- iconCls: 'x-button-icon-save',
- margin: '0 0 0 10',
- handler: function() {
- var value = Ext.getCmp('AssigneeComboxcode').getValue();
- /* var customs = Ext.getCmp('customSetup').items.items;
- var flag = 0;
- Ext.each(customs,
- function(cu) {
- if (!cu.items.items[1].allowBlank && (cu.items.items[1].getValue() == null || cu.items.items[1].getValue() == '')) {
- Ext.Msg.alert('提示', "<b>" + cu.items.items[0].value.fontcolor("Red") + "</b>为必填项!");
- flag++;
- return;
- }
- });
- if (flag > 0) {
- return;
- }
- var cValues = [];
- Ext.each(customs,
- function(cu) {
- if (cu.items.items[1].getValue() != null && cu.items.items[1].getValue() != '') {
- var value = cu.items.items[1].getValue() instanceof Date ? me.getStringByDate(cu.items.items[1].getValue()) : cu.items.items[1].getValue();
- var labelValue = cu.items.items[0].getFieldLabel() + "(" + value + ")";
- if(cu.items.items[1].logic!='') labelValue+='@'+cu.items.items[1].logic+'@';
- cValues.push(labelValue);
- }
- });
- var opd = cValues.join(";");*/
- if (!value) {
- Ext.Msg.alert('提示', '请先选择变更办理人!');
- return;
- } else {
- Ext.Ajax.request({
- url: basePath + 'common/setAssignee.action',
- params: {
- taskId: ProcessData.jp_nodeId,
- assigneeId: value,
- processInstanceId: processInstanceId,
- //customDes: opd,
- description: Ext.getCmp('changedescription').getValue(),
- _noc: 1,
- },
- success: function(response) {
- var jsonData = Ext.decode(response.responseText);
- if (jsonData.result) {
- var nextnode = jsonData.nextnode;
- function showResult(btn){
- me.dealNextStep(nextnode,jsonData._tomaster);
- }
- Ext.Msg.show({
- title:'提示',
- msg: '变更成功',
- buttons: Ext.Msg.OK,
- closable: false,
- fn: showResult
- });
-
- if (parent && parent.Ext.getCmp('content-panel')) {
- var firstGrid = parent.Ext.getCmp('content-panel').items.items[0].firstGrid;
- if (firstGrid && firstGrid != null) {
- firstGrid.loadNewStore();
- }
- }
- return;
-
- } else {
- Ext.Msg.alert('提示', "该任务不存在,无法变更!");
- }
- }
- });
- }
- }
- });
- var container = Ext.getCmp('container2');
- if (checked) {
- if(!ISexecuted){
- container.add([{
- fieldLabel: '变更办理人',
- xtype: 'multifield',
- name: 'AssigneeComboxcode',
- editable: false,
- width: 350,
- fieldStyle: 'background:#fffac0;color:#515151;',
- id: 'AssigneeComboxcode',
- secondname: 'em_name'
- },
- {
- xtype: 'textareatrigger',
- name: 'changedescription',
- id: 'changedescription',
- fieldStyle: 'background:#FFFAFA;color:#515151;',
- width: 350,
- labelAlign: 'right',
- fieldLabel: '变更描述'
- },
- button]);
- }
- } else {
- container.removeAll(true);
- }
- },
- deleteProcess: function() {
- Ext.Ajax.request({
- url: basePath + 'common/deleteProcess.action',
- params: {
- processInstanceId: ProcessData.jp_processInstanceId
- },
- success: function(response) {
- var text = response.responseText;
- jsonData = Ext.decode(text);
- if (jsonData.success) {
- Ext.Msg.alert('提示', "流程已删除!");
- }
- if (jsonData.exceptionInfo) {
- showError("该流程实例不存在");
- }
- }
- });
- },
- backProcess: function() {
- var mb = new Ext.window.MessageBox();
- mb.wait('系统正在处理', '请稍后');
- Ext.Ajax.request({
- url: basePath + 'common/backToLastNode.action',
- params: {
- processInstanceId: ProcessData.jp_processInstanceId,
- jnodeId: ProcessData.jp_nodeId
- },
- success: function(response) {
- mb.close();
- var text = response.responseText;
- jsonData = Ext.decode(text);
- if (jsonData.success) {
- Ext.Msg.alert('提示', '流程重置成功!');
- }
- if (jsonData.exceptionInfo) {
- showError(jsonData.exceptionInfo);
- }
- }
- });
- },
- endProcess: function() {
- var me=this,startdealtime = new Date(),taskId = ProcessData.jp_nodeId;
- Ext.Ajax.request({
- url: basePath + 'common/endProcessInstance.action',
- params: {
- processInstanceId: ProcessData.jp_processInstanceId,
- holdtime: ((startdealtime - basestarttime) / 1000).toFixed(0),
- nodeId: taskId
- },
- callback: function(options, success, response) {
- var text = response.responseText;
- jsonData = Ext.decode(text);
- if (jsonData.success) {
- Ext.Msg.alert('提示', "流程已结束!");
- }
- if (jsonData.exceptionInfo) {
- showError(jsonData.exceptionInfo);
- Ext.Msg.alert('提示', "该流程实例不存在!");
- }
- }
- });
- },
- dealNextStep: function(nextnode,toMaster) {
- var nextNodeId = null,tab=null,me=this;
- if(parent.Ext.getCmp('content-panel')) tab=parent.Ext.getCmp('content-panel').getActiveTab();
- function processResult() {
- var btn = arguments[0];
- if (btn == 'yes') {
- var confirm = new Ext.button.Button({
- text: '确定',
- handler: function(btn) {
- var items = Ext.ComponentQuery.query('window >tabpanel>panel>radio');
- var params = new Array();
- Ext.each(items,function(item){
- if(item.getValue()){
- var param = new Object();
- var label = item.boxLabel;//em_name(em_code) 2013-3-8 10:18:11
- var em_code = label.substring(label.lastIndexOf('(')+1,label.length-1);
- param.em_code = em_code;
- param.nodeId=item.name;
- params.push(JSON.stringify(param));
- }
- });
- Ext.Ajax.request({
- url: basePath + 'common/takeOverTask.action',
- async: false,
- params: {
- params:unescape(params),
- _noc: 1
- },
- callback: function(options, success, response) {
- var text = response.responseText;
- jsonData = Ext.decode(text);
- if (jsonData.success) {
- Ext.Msg.alert('提示', "指派成功!");
- me.dealNextStep(nextnode,toMaster);
- Ext.getCmp('assignwin').close();
-
- } else {
- Ext.Msg.alert('提示', "指派失败!");
- Ext.getCmp('assignwin').close();
- }
-
- }
- });
- }
- });
- var cancel = new Ext.button.Button({
- text: '取消',
- handler: function() {
- if (nextnode && nextnode != '-1') {
- me.loadNextTask(nextnode,toMaster);
- } else {
- //if (tab!=null )tab.close();
- var closeBtn = Ext.getCmp('closeProcess');
- closeBtn.handler();
- }
- }
- });
- var searchKey = new Object();
- var win = Ext.create('Ext.window.Window', {
- title: '指定下一步任务审批人',
- height: 450,
- width: 650,
- id: 'assignwin',
- modal:true,
- layout:'border',
- closable:false,
- buttons: [confirm, cancel],
- buttonAlign: 'center',
- items: []
- });
- win.add([{
- xtype:'textfield',
- margin:'10 20 10 20',
- fieldLabel:'快速搜索',
- labelStyle:'font-weight:bold;',
- id:'searchtextfield',
- region:'north',
- enableKeyEvents:true,
- listeners:{
- keydown:function(field,e){
- if(e.getKey()==Ext.EventObject.ENTER){
- searchKey[Ext.getCmp('assignTab').getActiveTab().id]=field.value;
- var results=Ext.Array.filter(jsonData.actorUsers[Ext.getCmp('assignTab').getActiveTab().id].JP_CANDIDATES,function(JP_CANDIDATE){
- if(field.value==undefined || JP_CANDIDATE.indexOf(field.value)!=-1) return JP_CANDIDATE;
- });
- Ext.Array.each(Ext.getCmp('assignTab').getActiveTab().personUsers,function(item){
- Ext.getCmp('assignTab').getActiveTab().remove(item);
- });
- addUserItems(Ext.getCmp('assignTab').getActiveTab(),jsonData.actorUsers[Ext.getCmp('assignTab').getActiveTab().id].JP_NODEID,results);
- }
- }
- }
- }]);
- var assignTab = new Ext.TabPanel({
- id : 'assignTab',
- enableTabScroll : true,
- closeAll : true,
- region:'center',
- minTabWidth :80,
- autoHeight:true,
- resizeTabs : true,
- listeners:{
- 'tabchange':function(tabPanel,newCard,oldCard,eOpts){
- Ext.getCmp('searchtextfield').setValue(searchKey[newCard.id]);
- }
- }
- });
- win.add(assignTab);
- for (var i = 0; i < jsonData.actorUsers.length; i++) {
- var panel=new Ext.Panel({
- id:i.toString(),
- width: 480,
- autoHeight:true,
- autoScroll:true,
- layout:'column',
- bodyStyle: 'background:#e0e0e0',
- title:jsonData.actorUsers[i].JP_NODENAME
- });
- assignTab.add(panel);
- addUserItems(panel,jsonData.actorUsers[i].JP_NODEID,jsonData.actorUsers[i].JP_CANDIDATES);
- }
- assignTab.setActiveTab(0);
- win.show();
- } else {
- //if (tab!=null )tab.close();
- var closeBtn = Ext.getCmp('closeProcess');
- closeBtn.handler();
- }
- }
- function addUserItems(panel,jp_nodeid,jp_candidates){
- var me=this;
- var maxSize=jp_candidates.length>24?24:jp_candidates.length,personUsers=new Array(),user=null,more=Ext.getCmp('more'+panel.id);
- if(more)more.destroy();
- for(var j=0;j<maxSize;j++){
- user=Ext.create('Ext.form.field.Radio',{
- name:jp_nodeid,
- boxLabel:jp_candidates[j],
- columnWidth: 0.33,
- fieldCls:'x-myradio',
- checked: j==0?true:false
- });
- personUsers.push(user);
- }
- panel.add(personUsers);
- panel.personUsers=personUsers;
- if(jp_candidates.length>maxSize){
- panel.add({ xtype: 'textfield',
- readOnly:true,
- labelSeparator:'',
- columnWidth:1,
- id:'more'+panel.id,
- fieldStyle : 'background:#e0e0e0;border-bottom:none;vertical-align:middle;border-top:none;border-right:none;border-bottom:none;border-left:none;',
- fieldLabel: '『<a href="#" class="terms">全部</a>』',
- listeners: {
- click: {
- element: 'labelEl',
- fn: function(e,el) {
- var target = e.getTarget('.terms');
- Ext.getCmp('more'+panel.id).destroy();
- if (target) {
- Ext.Array.each(panel.personUsers,function(item){
- panel.remove(item);
- });
- var personUsers=new Array();
- for(var i=0;i<jp_candidates.length;i++){
- user=Ext.create('Ext.form.field.Radio',{
- name:jp_nodeid,
- boxLabel:jp_candidates[i],
- columnWidth: 0.33,
- fieldCls:'x-myradio',
- checked: i==0?true:false
- });
- personUsers.push(user);
- }
- panel.add(personUsers);
- panel.personUsers=personUsers;
- e.preventDefault();
- }
- }
- }
- }
- });
- }
- }
- Ext.Ajax.request({
- url: basePath + 'common/dealNextStepOfPInstance.action',
- params: {
- processInstanceId: ProcessData.jp_processInstanceId,
- _noc: 1
- },
- callback: function(options, success, response) {
- var text = response.responseText;
- jsonData = Ext.decode(text);
- if (jsonData.hasNext) {
- if (jsonData.actorUsers.length > 0) {
- Ext.Msg.show({
- title: '提示',
- msg: '下一步审批节点有多位处理人,现在指定>>>',
- buttons: Ext.Msg.YESNO,
- icon: Ext.window.MessageBox.QUESTION,
- closable: false,
- fn: processResult
- });
- //nextNodeId = jsonData.nodeId;
- } else {
- if (nextnode && nextnode != '-1') {
- me.loadNextTask(nextnode,toMaster);
- } else {
- //if (tab!=null )tab.close();
- var closeBtn = Ext.getCmp('closeProcess');
- if(closeBtn){
- closeBtn.handler();
- }
- }
- return;
- }
- } else {
- tab.close();
- }
- }
- });
- },
- loadNextTask:function(nextnode,toMaster){
- var url="jsps/common/jprocessDeal.jsp?whoami=JProcess!Me&formCondition=jp_nodeId=" + nextnode;
- if(toMaster!=null){
- //changemaster
- url+='&_center=1';
- var modalwin=parent.Ext.getCmp('modalwindow');
- if(modalwin && modalwin.relateMaster!=toMaster){
- Ext.Ajax.request({
- url: basePath + 'common/changeMaster.action',
- params: {
- to: toMaster
- },
- async:false,
- callback: function(opt, s, r) {
- var localJson = new Ext.decode(r.responseText);
- var modalwin=parent.Ext.getCmp('modalwindow');
- modalwin.relateMaster=toMaster;
- modalwin.setTitle('创建到账套' + localJson.currentMaster + '的临时会话');
- }
- });
- }
- }
- window.location.href = basePath + url;
- },
- executeTask: function(value) {
- var me = this;
- var dealMessage = Ext.getCmp('dealMessage').getValue(); //处理信息 2013-3-6 20:58:14
- var customs = Ext.getCmp('customSetup').items.items;
- var attachs = Ext.getCmp('attachs').items.items[0].value;
- var flag = 0;
- Ext.each(customs,
- function(cu) {
- if (!cu.items.items[1].allowBlank && (cu.items.items[1].getValue() == null || cu.items.items[1].getValue() == '')) {
- Ext.Msg.alert('提示', "<b>" + cu.items.items[0].value.fontcolor("Red") + "</b>为必填项!");
- flag++;
- return;
- }
- });
- if (flag > 0) {
- return;
- }
- var cValues = [];
- Ext.each(customs,
- function(cu) {
- if (cu.items.items[1].getValue() != null && cu.items.items[1].getValue() != '') {
- var value =cu.items.items[1].getValue() instanceof Date ? me.getStringByDate(cu.items.items[1].getValue()) : cu.items.items[1].getValue();
- var labelValue = cu.items.items[0].value + "(" + value + ")";
- if(cu.items.items[1].logic!='') labelValue+='@'+cu.items.items[1].logic+'@';
- cValues.push(labelValue);
- }
- });
- var opd = cValues.join(";");
- switch (value) {
- case 1:
- {
- var taskId = ProcessData.jp_nodeId;
- var nodeName = ProcessData.jp_nodeName;
- var mb = new Ext.window.MessageBox();
- mb.wait('系统正在处理', '请稍后');
- var startdealtime = new Date();
- var form = (iframe_maindetail.contentWindow||iframe_maindetail.window).Ext.getCmp('form'),values=form.getValues();
- var bool = true;
- if (requiredFields != null) {
- if (!canexecute) {
- bool = false;
- mb.close();
- showError('请在同意之前先保存必填信息!');
- return false;
- }
- var fields = requiredFields.split(",");
- Ext.Array.each(fields,function(field) {
- if (form.down('#'+field) && (values[field] == null || values[field] == "" || conditionValidation==1)) {
- bool = false;
- mb.close();
- showError('请在同意之前先保存必填信息!');
- return false;
- }
- });
- }
- if (bool) {
- Ext.Ajax.request({
- url: basePath + 'common/review.action',
- params: {
- taskId: taskId,
- nodeName: nodeName,
- nodeLog: dealMessage,
- holdtime: ((startdealtime - basestarttime) / 1000).toFixed(0),
- customDes: opd,
- result: true,
- master: master,
- attachs:attachs,
- _noc: 1
- },
- callback: function(options, success, response) {
- try {
- var text = response.responseText;
- var jsonData = Ext.decode(text);
- if (jsonData.exceptionInfo != null) {
- mb.close();
- showError("<div style='color:red;font-size:15px;'>无法审批</div>" + jsonData.exceptionInfo);
- return;
- }
- else if (jsonData.success) {
- var nextnode = jsonData.nextnode;
- if (nextnode == '0') {
- mb.close();
- Ext.Msg.alert('提示', nodeName + '节点已审批!');
- return;
- } else {
- mb.close();
- function showResult(btn){
-
- if (jsonData.after != null && jsonData.after != "") {
- var str = jsonData.after;
- if (str.trim().substr(0, 12) == 'AFTERSUCCESS') { //特殊情况:操作成功,但是出现警告,允许刷新页面
- str = str.replace('AFTERSUCCESS', '');
- me.dealNextStep(nextnode,jsonData._tomaster);
- showError(jsonData.after);
- } else showError(str);
- } else me.dealNextStep(nextnode,jsonData._tomaster);
- }
- Ext.Msg.show({
- title:'提示',
- msg: '审批成功!',
- buttons: Ext.Msg.OK,
- closable: false,
- fn: showResult
- });
-
- if (parent && parent.Ext.getCmp('content-panel')) {
- var firstGrid = parent.Ext.getCmp('content-panel').items.items[0].firstGrid;
- if (firstGrid && firstGrid != null) {
- firstGrid.loadNewStore();
- }
- }
- return;
- }
- } else {
- mb.close();
- Ext.Msg.alert('提示', "该任务已提交,不能重复操作!");
- parent.Ext.getCmp('content-panel').getActiveTab().close();
- }
- } catch(e) {
- showError(Ext.decode(response.responseText).exceptionInfo);
- }
- }
- });
- }
- };
- break;
- case 2:
- {
- //不同意 去选择退回节点
- //取处理历史记录
- var grid = Ext.getCmp('historyGrid');
- var nodegriddata = grid.store.data;
- var combodata = new Array();
- combodata.push({
- display: '制单人',
- value: 'RECORDER'
- });
- if(forknode==0){//并行节点只能回退至制单人
- Ext.Array.each(nodegriddata.items,
- function(item) {
- if (item.data.jn_dealResult == '同意' && item.data.jn_attach == 'T') {
- combodata.push({
- display: item.data.jn_name,
- value: item.data.jn_name
- });
- }
- });
- }
- Ext.create('Ext.window.Window', {
- title: '指定回退节点',
- height: 200,
- width: 400,
- layout: 'column',
- id: 'win',
- buttonAlign: 'center',
- defaults: {
- fieldStyle: 'background:#FFFAFA;color:#515151;',
- columnWidth: 0.9
- },
- allowDrag: false,
- items: [{
- xtype: 'combo',
- fieldLabel: '回退节点',
- name: 'backtask',
- id: 'backtask',
- isFormField : true,
- listConfig: {
- maxHeight: 180
- },
- fieldStyle: 'background:#fffac0;color:#515151;',
- store: {
- fields: ['display', 'value'],
- data: [{
- display: '制单人',
- value: 'RECORDER'
- }]
- },
- displayField: 'display',
- valueField: 'value',
- queryMode: 'local',
- allowBlank: false,
- value: 'RECORDER',
- onTriggerClick: function(trigger) {
- var me = this;
- this.getStore().loadData(combodata);
- if (!me.readOnly && !me.disabled) {
- if (me.isExpanded) {
- me.collapse();
- } else {
- me.expand();
- }
- me.inputEl.focus();
- }
- }
- },
- {
- xtype: 'textarea',
- fieldLabel: '回退原因',
- name: 'unagreedescription',
- id: 'unagreedescription',
- fieldStyle: 'background:#fffac0;color:#515151;',
- allowBlank: false,
- isFormField : true
- }],
- buttons: [{
- text: $I18N.common.button.erpConfirmButton,
- xtype: 'button',
- formBind: true,
- handler: function() {
- var taskId = ProcessData.jp_nodeId;
- var nodeName = ProcessData.jp_nodeName;
- var mb = new Ext.window.MessageBox();
- var startdealtime = new Date();
- var backTaskName = Ext.getCmp('backtask').value;
- var dealMessage = Ext.getCmp('unagreedescription').value;
- if(dealMessage==null || dealMessage==''){
- showMessage('提示', '请先填写回退原因!', 1000);
- return;
- }
- mb.wait('系统正在处理', '请稍后');
- Ext.Ajax.request({
- url: basePath + 'common/review.action',
- params: {
- taskId: taskId,
- nodeName: nodeName,
- backTaskName: backTaskName,
- nodeLog: dealMessage,
- holdtime: ((startdealtime - basestarttime) / 1000).toFixed(0),
- result: false,
- master: master,
- attachs:attachs,
- _noc: 1
- },
- callback: function(options, success, response) {
- try{
- var text = response.responseText;
- var jsonData = Ext.decode(text);
- mb.close();
- if (jsonData.exceptionInfo != null) {
- showError("<div style='color:red;font-size:15px;'>无法审批</div>" + jsonData.exceptionInfo);
- return;
- }
- if (jsonData.success) {
- var nextnode = jsonData.nextnode;
- showMessage('提示', '你已不同意!', 1000);
- Ext.getCmp('win').close();
- if (jsonData.after != null && jsonData.after != "") {
- showError(jsonData.after);
- } else me.dealNextStep(nextnode,jsonData._tomaster);
- if (parent && parent.Ext.getCmp('content-panel')) {
- var firstGrid = parent.Ext.getCmp('content-panel').items.items[0].firstGrid;
- if (firstGrid && firstGrid != null) {
- firstGrid.loadNewStore();
- }
- }
- return;
- } else {
- Ext.Msg.alert('提示', "该任务已处理,不能重复操作!");
- parent.Ext.getCmp('content-panel').getActiveTab().close();
- }
- }catch(e) {
- showError(Ext.decode(response.responseText).exceptionInfo);
- }}
- });
- }
- },
- {
- text: $I18N.common.button.erpCancelButton,
- handler: function() {
- Ext.getCmp('win').close();
- }
- }]
- }).show();
- return;
- };
- break;
- default:
- break;
- }
- },
- nextTask: function() {
- window.location.href = basePath + "jsps/common/jprocessDeal.jsp?whoami=JProcess!Me&formCondition=jp_nodeId=" + nextnodeId;
- },
- skipTask: function() {
- var taskId = ProcessData.jp_nodeId;
- var mb = new Ext.window.MessageBox();
- mb.wait('系统正在跳过', '请稍后');
- Ext.Ajax.request({
- url: basePath + 'common/getNextProcess.action',
- params: {
- taskId: taskId,
- _noc: 1
- },
- callback: function(options, success, response) {
- mb.close();
- var data = response.responseText;
- var jsonData = Ext.decode(data);
- if (jsonData.success && jsonData.nodeId!=-1) {
- window.location.href = basePath + "jsps/common/jprocessDeal.jsp?whoami=JProcess!Me&formCondition=jp_nodeId=" + jsonData.nodeId;
- } else {
- showMessage('提示','已无待审批的单据',0);
- parent.Ext.getCmp('content-panel').getActiveTab().close();
- }
- }
- });
- },
- saveNotify:function(notifyPeople,notifyGroup,peoplesname,groupnames,me,b){
- var data={
- processInstanceId:ProcessData.jp_processInstanceId,
- nodeId:ProcessData.jp_nodeId,
- nodeName:ProcessData.jp_nodeName
- };
- if (notifyPeople!=null && notifyPeople!='')data.notifyPeopleid=notifyPeople;
- if (notifyGroup !=null && notifyGroup!='')data.notifyGroup=notifyGroup;
- if (peoplesname !=null && peoplesname!='')data.notifyPeople=peoplesname;
- if (groupnames !=null && groupnames!='')data.notifyGroupName=groupnames;
- me.setLoading(true);
- Ext.Ajax.request({
- url: basePath + 'common/saveProcessNotify.action',
- params: {
- data:unescape(Ext.JSON.encode(data).replace(/\\/g, "%")),
- _noc: 1
- },
- callback: function(options, success, response) {
- me.setLoading(false);
- var data = response.responseText;
- var jsonData = Ext.decode(data);
- if (jsonData.success) {
- showMessage('提示', '设置知会人员成功!', 1000);
- Ext.Array.each(b.ownerCt.items.items,function(item){
- item.reset();
- });
- } else {
- showError(data.exceptionInfo);
- }
- }
- });
- },
- endcommunicateTask:function (me){
- var taskId = ProcessData.jp_nodeId;
- me.setLoading(true);
- Ext.Ajax.request({
- url: basePath + 'common/endCommunicateTask.action',
- params: {
- taskId: taskId,
- processInstanceId:ProcessData.jp_processInstanceId,
- _noc: 1
- },
- callback: function(options, success, response) {
- me.setLoading(false);
- var data = response.responseText;
- var jsonData = Ext.decode(data);
- if (jsonData.success) {
- /*me.getCommunicates(taskId,ProcessData.jp_processInstanceId);
- form.reset();*/
- showMessage('提示', '已成功结束沟通!', 1000);
- } else {
- showError(data.exceptionInfo);
- }
- }
- });
- },
- CommunicateWithOther: function(owner,me){
- var form=owner.getForm();
- var data=form.getValues();
- var taskId = ProcessData.jp_nodeId;
- me.setLoading(true);
- Ext.Ajax.request({
- url: basePath + 'common/communicateWithOther.action',
- params: {
- taskId: taskId,
- processInstanceId:ProcessData.jp_processInstanceId,
- data:unescape(Ext.JSON.encode(data).replace(/\\/g, "%")),
- _noc: 1
- },
- callback: function(options, success, response) {
- me.setLoading(false);
- var data = response.responseText;
- var jsonData = Ext.decode(data);
- if (jsonData.success) {
- me.getCommunicates(taskId,ProcessData.jp_processInstanceId);
- form.reset();
- showMessage('提示', '已成功发起沟通!', 1000);
- } else {
- showError(data.exceptionInfo);
- }
- }
- });
- },
- getCommunicates:function(nodeId,processInstanceId){
- Ext.Ajax.request({
- url: basePath + 'common/communicateTask.action',
- params: {
- taskId: nodeId,
- processInstanceId:processInstanceId,
- _noc: 1
- },
- callback: function(options, success, response) {
- var data = response.responseText;
- var jsonData = Ext.decode(data);
- if (jsonData.success) {
- 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>');
- } else {
- showError(data.exceptionInfo);
- }
- }
- });
- },
- getFieldByType: function(type, i,cs,label,necessary) {
- var logic='';
- var bool=necessary=='Y';
- var fieldStyle=bool?"background:#F5FFFA;":"background:#FFFAFA;";
- if(cs.indexOf("@")>0)
- logic=cs.substring(cs.indexOf("@")+1);
- switch (type) {
- case "S":
- return Ext.create('Ext.form.FieldContainer',{
- defaults: {
- hideLabel: true
- },
- hideLabel:true,
- columnWidth:0.8,
- layout: {
- type: 'table',
- columns:2,
- defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
- },
- items: [{
- xtype: 'displayfield',
- maxWidth :window.innerWidth * 0.5,
- value: (i+1)+'.'+label
- },{
- id:i,
- labelSeparator:'',
- padding:'0 0 0 10',
- xtype:'textfield',
- allowBlank:!bool,
- logic:logic}]
- });
- break;
- case "D":
- return Ext.create('Ext.form.FieldContainer',{
- defaults: {
- hideLabel: true
- },
- hideLabel:true,
- columnWidth:0.8,
- layout: {
- type: 'table',
- columns:2,
- defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
- },
- items: [{
- xtype: 'displayfield',
- maxWidth :window.innerWidth * 0.5,
- value: (i+1)+'.'+label
- },{
- id:i,
- format: 'Y-m-d',
- labelSeparator:'',
- padding:'0 0 0 10',
- logic:logic,
- allowBlank:!bool,
- xtype:'datefield'
- }]
- });
- break;
- case "N":
- return Ext.create('Ext.form.FieldContainer',{
- defaults: {
- hideLabel: true
- },
- hideLabel:true,
- columnWidth:0.8,
- layout: {
- type: 'hbox',
- defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
- },
- items: [{
- xtype: 'displayfield',
- maxWidth :window.innerWidth * 0.5,
- value: (i+1)+'.'+label
- },{
- id: i,
- labelSeparator:'',
- padding:'0 0 0 10',
- logic:logic,
- allowBlank:!bool,
- hideTrigger:true,
- fieldStyle:fieldStyle,
- xtype:'numberfield'
- }]
- });
- break;
- case "C":
- if(cs.indexOf('[')>0){
- var comstr=cs.substring(cs.indexOf('[')+1,cs.indexOf(']'));
- var str=comstr.split(";");
- var arr=new Array();
- Ext.Array.each(str,function(s){
- arr.push({"value":s});
- });
- var comStore = Ext.create('Ext.data.Store', {
- fields: ['value'],
- data: arr
- });
- return Ext.create('Ext.form.FieldContainer',{
- defaults: {
- hideLabel: true
- },
- hideLabel:true,
- columnWidth:0.8,
- layout: {
- type: 'table',
- columns:2,
- defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
- },
- items: [{
- xtype: 'displayfield',
- maxWidth :window.innerWidth * 0.5,
- value: (i+1)+'.'+label
- },{
- store: comStore,
- queryMode: 'local',
- editable: false,
- displayField: 'value',
- padding:'0 0 0 10',
- valueField: 'value',
- logic:logic,
- labelSeparator:'',
- fieldStyle:fieldStyle,
- xtype:'combo',
- allowBlank:!bool
- }]
- });
- }
- break;
- case "B":
- var comStore = Ext.create('Ext.data.Store', {
- fields: ['value'],
- data: [{
- "value": "是"
- },{
- "value": "否"
- },{
- "value": "不执行"
- }]
- });
- return Ext.create('Ext.form.FieldContainer',{
- defaults: {
- hideLabel: true
- },
- hideLabel:true,
- columnWidth:0.8,
- layout: {
- type: 'table',
- columns:2,
- defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
- },
- items: [{
- xtype: 'displayfield',
- maxWidth :window.innerWidth * 0.3,
- value: (i+1)+'.'+label
- },{
- store: comStore,
- queryMode: 'local',
- editable: false,
- displayField: 'value',
- valueField: 'value',
- columnWidth: 0.3,
- padding:'0 0 0 10',
- logic:logic,
- fieldStyle:fieldStyle ,
- blankText: "不允许为空",
- allowBlank:!bool,
- hideLabel:true,
- xtype:'combo',
- labelSeparator:''
- }
- ]
- });
- }
- },
- getStringByDate: function() {
- var date = arguments[0];
- var m = date.getMonth();
- var month = m + 1;
- return date.getFullYear() + "-" + month + "-" + date.getDate();
- },
- listeners: {
- beforerender: function() {
- var me = this;
- formCondition = this.BaseUtil.getUrlParam('formCondition'); //从url解析参数
- formCondition = (formCondition == null) ? "": formCondition.replace(/IS/g, "=");
- var strArr = formCondition.split("=");
- Ext.Ajax.request({
- url: basePath + 'common/getCustomSetupOfTask.action',
- params: {
- nodeId: strArr[1],
- master: master,
- _noc: 1
- },
- success: function(response, options) {
- var localJson = Ext.decode(response.responseText);
- cs = localJson.cs;
- var arr = null;
- if (localJson.data != null) {
- arr = localJson.data.split(";");
- }
- if(localJson.isApprove==1){
- Ext.getCmp('disagree').setDisabled(true);
- }
- var customSetup = Ext.getCmp('customSetup');
- if (cs != null && cs.length > 0) {
- customSetup.show();
- var csstr='';
- for (var i = 0; i < cs.length; i++) {
- csstr=cs[i].toString();
- var i1 = csstr.indexOf('^');
- var i2 = csstr.indexOf('$');
- var value = csstr.substring(0, i1);
- var type = csstr.substring(i1 + 1, i2);
- var neccesary = csstr.substring(i2 +1,i2+2);
- var field = me.getFieldByType(type, i,csstr,value,neccesary);
- if (arr != null) {
- field.items.items[1].setValue(arr[i].substring(arr[i].indexOf("(") + 1, arr[i].indexOf(")")));
- }
- customSetup.add(field);
- }
- }
- }
- });
- },
- afterrender: function() {
- var me = this;
- formCondition = this.BaseUtil.getUrlParam('formCondition'); //从url解析参数
- formCondition = (formCondition == null) ? "": formCondition.replace(/IS/g, "=");
- var strArr = formCondition.split("=");
- nodeId = nodeId != null ? nodeId: this.BaseUtil.getUrlParam('nodeId');
- nodeId =nodeId !=null?nodeId :strArr[1];
- Ext.Ajax.request({
- url: basePath + 'common/getProcessInstanceId.action',
- params: {
- jp_nodeId: nodeId,
- master: master,
- _noc: 1
- },
- success: function(response) {
- var res = response.responseText;
- processInstanceId = Ext.decode(res).processInstanceId;
- me.getCommunicates(nodeId,processInstanceId);
- Ext.getCmp('historyGrid').getOwnStore(processInstanceId);
- Ext.Ajax.request({ //获取当前节点对应的JProcess对象
- url: basePath + 'common/getCurrentNode.action',
- params: {
- jp_nodeId: nodeId,
- master: master,
- _noc: 1
- },
- success: function(response) {
- var res = new Ext.decode(response.responseText);
- ProcessData = res.info.currentnode;
- forknode=res.info.forknode;
- if(ProcessData.jp_pagingid && parent.Ext){
- var win=parent.Ext.getCmp('msg-win-'+ProcessData.jp_pagingid);
- if(win){
- win.close();
- }
- }
- Ext.getCmp('currentnode').setText('当前节点:<font size=2 color="red">' + ProcessData.jp_nodeName + '</font>');
- Ext.getCmp('launchername').setText('发起人:<font size=2 color="red">' + ProcessData.jp_launcherName + '</font>');
- Ext.getCmp('launchtime').setText('发起时间:<font size=2 color="red">' + Ext.Date.format(new Date(ProcessData.jp_launchTime), "Y-m-d H:i:s") + '</font>');
- Ext.getCmp('label1').setText('<span style="font-weight: bold !important;font-size:18px">' + ProcessData.jp_name + '</span>');
- var formCondition = ProcessData.jp_keyName + "IS" + ProcessData.jp_keyValue;
- var gridCondition = '';
- if (ProcessData.jp_keyName) {
- gridCondition = ProcessData.jp_formDetailKey + 'IS' + ProcessData.jp_keyValue;
- }
- var caller = ProcessData.jp_caller;
- var url = basePath + ProcessData.jp_url;
- var queryType='form';
- var myurl;
- if (me.BaseUtil.contains(url, '?', true)) {
- myurl = url + '&formCondition=' + formCondition + '&gridCondition=' + gridCondition;
- } else {
- myurl = url + '?formCondition=' + formCondition + '&gridCondition=' + gridCondition;
- }
- myurl += '&_noc=1&datalistId=NaN'; // 不限制权限
- if (master) {
- myurl += '&newMaster=' + master;
- }
- if(myurl.indexOf('jsps/ma/jprocess/AutoJprocess.jsp?type=1')>0){
- myurl+='&caller='+caller;
- queryType='tabpanel';
- }
- panel = new Ext.panel.Panel({
- id: 'mm',
- style: {
- background: '#f0f0f0',
- border: 'none'
- },
- frame: true,
- border: false,
- layout: 'fit',
- height: window.innerHeight,
- iconCls: 'x-tree-icon-tab-tab',
- //html: '<iframe id="iframe_maindetail" name = "iframe_maindetail" src="' + myurl + '" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>',
- items: {xtype: 'component',
- id:'iframe_maindetail',
- autoEl: {
- tag: 'iframe',
- style: 'height: 100%; width: 100%; border: none;',
- src: myurl},
- listeners: {
- load: {
- element: 'el',
- fn: function (e) {
- TaskId= window.setInterval(findToolbar, 1000);
- }}
- }}
- });
-
- var viewport = Ext.getCmp("JProcessViewport");
- viewport.insert(2, panel);
- //TaskId= window.setInterval(findToolbar, 1000);
- function findToolbar() {
- var childpanel,childtoolbar;
- var w = iframe_maindetail.contentWindow||iframe_maindetail.window;
- if (w.Ext) {
- //childpanel = w.Ext.ComponentQuery.query(queryType)[0];
- childpanels = w.Ext.ComponentQuery.query(queryType);
- Ext.Array.each(childpanels,function(item,index){
- if(item.dockedItems){
- if(item.dockedItems.items.length>0){
- childpanel = item;
- return false;
- }
- }
- });
- childtoolbar = w.Ext.ComponentQuery.query(queryType+'>toolbar')[0];
- var grid=w.Ext.ComponentQuery.query('grid')[0];
- if (!childpanel || !childpanel.dockedItems) return;
- Ext.Array.each(childpanel.dockedItems.items,
- function(item) {
- if (item.dock == 'bottom') {
- item.removeAll();
- toolbar = item;
- }
- });
- if (childtoolbar != null && (grid==null || (grid!=null && grid.columns && grid.columns.length>0))) {
- window.clearInterval(TaskId);
- var button = res.info.button;
- if (button != null && !ISexecuted) {
- //带XTYPE的BUTTON
- var buttontype = button.jb_fields;
- var neccessaryField = button.jt_neccessaryfield;
- if(buttontype=='updatedetail'){
- grid=w.Ext.ComponentQuery.query('grid')[0];
- if (neccessaryField != null) {
- grid.readOnly=false;
- grid.NoAdd=true;
- var fields = neccessaryField.split(","),addItems=new Array(),fieldtype=null,editable=false;
- Ext.Array.each(grid.columns,function(column){
- editable=false;
- Ext.Array.each(fields,function(field) {
- var f =column.xtype;
- if(column.dataIndex==field){
- column.getEl().applyStyles('color:#FF0000');
- column.neccessaryField=true;
- editable=true;
- if (f=="numbercolumn") {
- column.editor={
- xtype:'numberfield',
- format:'0',
- hideTrigger:true
- };
- } else if (f=="floatcolumn") {
- column.editor={
- xtype:'numberfield',
- format:'0.00',
- hideTrigger:true
- };
- } else if (f.indexOf("floatcolumn")>-1) {
- var format = "0.";
- var length =parseInt(f.substring(11));
- for (var i = 0; i < length; i++) {
- format += "0";
- }
- column.editor={
- xtype:'numberfield',
- format:format,
- hideTrigger:true
- };
- } else if (f =="datecolumn") {
- column.editor={
- xtype:'datefield',
- format:"Y-m-d",
- hideTrigger:false
- };
- } else if (f =="datetimecolumn") {
- column.editor={
- xtype:'datetimefield',
- format:"Y-m-d H:i:s",
- hideTrigger:false
- };
- } else if (f =="timecolumn") {
- column.editor={
- xtype:'timefield',
- format:"H:i",
- hideTrigger:false
- };
- } else if (f =="monthcolumn") {
- column.editor={
- xtype:'monthdatefield',
- hideTrigger:false
- };
- } else if (f =="textcolumn" || f=="textfield" || f=="text") {
- column.editor={
- xtype:'textfield'
- };
- } else if (f =="textareafield") {
- column.editor={
- xtype:'textareafield'
- };
- } else if (f=="textareatrigger") {
- column.editor={
- xtype:'textareatrigger',
- hideTrigger:false
- };
- } else if (f=="dbfindtrigger") {
- column.editor={
- xtype:'dbfindtrigger',
- hideTrigger:false
- };
- } else if (f =="multidbfindtrigger") {
- column.editor={
- xtype:'multidbfindtrigger',
- hideTrigger:false
- };
- } else if (f=="datehourminutefield") {
- column.editor={
- xtype:'datehourminutefield',
- hideTrigger:false
- };
- } else if (f=="checkbox") {
- column.editor={
- xtype:'checkbox',
- cls:'x-grid-checkheader-editor',
- hideTrigger:false
- };
- }
- return false;
- }
- });
- if(!editable) {
- column.editor=null;
- }
- });
- toolbar.add(['->', {
- xtype: 'button',
- text:'修改明细',
- iconCls: 'x-button-icon-save',
- cls: 'x-btn-gray',
- handler:function(btn){
- var values = {};
- var jsonGridData = new Array();
- var s = grid.getStore().data.items;//获取store里面的数据
- var dd;
- for(var i=0;i<s.length;i++){//将grid里面各行的数据获取并拼成jsonGridData
- var data = s[i].data;
- dd = new Object();
- if(s[i].dirty && !grid.GridUtil.isBlank(grid, data)){
- Ext.each(grid.columns, function(c){
- if((c.neccessaryField && c.logic!='ignore')|| c.logic=='keyField'){
- if(c.xtype == 'datecolumn'){
- c.format = c.format || 'Y-m-d';
- if(Ext.isDate(data[c.dataIndex])){
- dd[c.dataIndex] = Ext.Date.format(data[c.dataIndex], c.format);
- }
- } else if(c.xtype == 'datetimecolumn'){
- if(Ext.isDate(data[c.dataIndex])){
- dd[c.dataIndex] = Ext.Date.format(data[c.dataIndex], 'Y-m-d H:i:s');
- }
- } else if(c.xtype == 'numbercolumn'){
- dd[c.dataIndex] = "" + s[i].data[c.dataIndex];
- } else {
- dd[c.dataIndex] = s[i].data[c.dataIndex];
- }
- }
- });
- jsonGridData.push(Ext.JSON.encode(dd));
- }
- }
- childpanel.getForm().getFields().each(function(field) {
- if (field.isDirty() && field.logic!='ignore' ) {
- var data = field['getSubmitData'](true);
- if (Ext.isObject(data)) {
- Ext.iterate(data,
- function(name, val) {
- if (true && val === '') {
- val = field.emptyText || '';
- }
- if (name in values) {
- var bucket = values[name],
- isArray = Ext.isArray;
- if (!isArray(bucket)) {
- bucket = values[name] = [bucket];
- }
- if (isArray(val)) {
- values[name] = bucket.concat(val);
- } else {
- bucket.push(val);
- }
- } else {
- values[name] = val;
- }
- });
- }
- }
- });
- values[ProcessData.jp_keyName] = ProcessData.jp_keyValue;
- Ext.Ajax.request({
- url: basePath + '/common/processUpdate.action',
- method: 'post',
- params: {
- caller: caller,
- processInstanceId:ProcessData.jp_processInstanceId,
- formStore: unescape(Ext.JSON.encode(values).replace(/\\/g, "%")),
- param: unescape(jsonGridData.toString()),
- _noc: 1
- },
- callback: function(options, success, response) {
- var localJson = new Ext.decode(response.responseText);
- canexecute = true;
- if (localJson.success) {
- conditionValidation=0;
- updateSuccess();
- grid.GridUtil.loadNewStore(grid,{
- caller:caller,
- condition:ProcessData.jp_formDetailKey + '=' + ProcessData.jp_keyValue
- });
- } else if (localJson.exceptionInfo) {
- var str = localJson.exceptionInfo;
- if (str.trim().substr(0, 12) == 'AFTERSUCCESS') { //特殊情况:操作成功,但是出现警告,允许刷新页面
- str = str.replace('AFTERSUCCESS', '');
- conditionValidation=0;
- updateSuccess();
- }else conditionValidation=1;
- showError(str);
- return;
- } else {
- updateFailure();
- }
- }
- });
- }
- },
- '->']);
- }
- }else if (buttontype.indexOf('#') > 0) {
- if(buttontype.indexOf(',') > 0){
- var btns = buttontype.replace(/xtype#/,'').split(',');
- toolbar.add(['->']);
- Ext.Array.each(btns,function(btn){
- toolbar.add({
- xtype: btn,
- fireHandler: function(e){
- var me = this,
- handler = me.handler;
- canexecute=true;
-
- if(btn!='erpEditDetailButton'){
- var updateStatus = function(from,to){
- var form = me.ownerCt.ownerCt;
- var statusCodeField = form.statuscodeField;
- var tablename = form.tablename;
- var keyField = form.keyField;
- if(statusCodeField&&tablename&&keyField){
- var w = window.frames['iframe_maindetail'].contentWindow;
- tablename = tablename.toUpperCase();
- if(tablename.indexOf('LEFT JOIN')>-1){
- tablename = tablename.substring(0,tablename.indexOf('LEFT JOIN'));
- }else if(tablename.indexOf('RIGHT JOIN')>-1){
- tablename = tablename.substring(0,tablename.indexOf('RIGHT JOIN'));
- }
- if(w.Ext&&tablename){
- var key = w.Ext.getCmp(keyField);
- if(key&&key.value){
- Ext.Ajax.request({
- url:basePath + 'common/updateByCondition.action',
- method:'post',
- async:false,
- params:{
- table:tablename,
- update:statusCodeField + "='"+to+"'",
- condition:statusCodeField + "='"+from+"' and " +keyField + "='"+key.value+"'"
- },
- callback:function(options,success,response){
- var res = Ext.decode(response.responseText);
- if(res.exceptionInfo){
- showError(res.exceptionInfo);
- }
- }
- });
- }
- }
- }
- };
- updateStatus('COMMITED','ENTERING');
- me.fireEvent('click', me, e);
- Ext.defer(function(){
- updateStatus('ENTERING','COMMITED');
- },500);
- }else{
- me.fireEvent('click', me, e,true);
- }
- if (handler) {
- handler.call(me.scope || me, me, e,w.Ext.ComponentQuery.query('grid'),button.jt_neccessaryfield);
- }
- me.onBlur();
-
- },
- listeners:{
- afterrender:function(btn){
- Ext.defer(function(){
- if(btn.hidden){
- btn.show();
- }
- },500);
- }
- }
- });
- });
- toolbar.add(['->']);
- }else{
- toolbar.add(['->', {
- xtype: buttontype.split('#')[1],
- text: button.jb_buttonname,
- fireHandler: function(e){
- var me = this,
- handler = me.handler;
- canexecute=true;
- me.fireEvent('click', me, e);
- if (handler) {
- handler.call(me.scope || me, me, e);
- }
- me.onBlur();
- }
- },
- '->']);
- }
- } else {
- childtoolbar.add(['->', {
- xtype: 'button',
- text: button.jb_buttonname,
- id: button.jb_id,
- group: button.jb_fields,
- iconCls: 'x-button-icon-save',
- cls: 'x-btn-gray',
- formBind: true,
- handler: function() {
- var values = {};
- var necessaryValues = (iframe_maindetail.contentWindow||iframe_maindetail.window).Ext.getCmp('form').getValues();
- var bool = true;
- if (requiredFields != null) {
- var fields = requiredFields.split(",");
- Ext.Array.each(fields,
- function(field) {
- if (necessaryValues[field] == null || necessaryValues[field] == "") {
- bool = false;
- showError('保存之前请先填写必填的信息!');
- return false;
- }
- });
- }
- if (bool) {
- childpanel.getForm().getFields().each(function(field) {
- //&& field.groupName==button.jb_fields 有些组件写的有问题
- if (field.isDirty() && field.logic!='ignore' ) {
- var data = field['getSubmitData'](true);
- if (Ext.isObject(data)) {
- Ext.iterate(data,
- function(name, val) {
- if (true && val === '') {
- val = field.emptyText || '';
- }
- if (name in values) {
- var bucket = values[name],
- isArray = Ext.isArray;
- if (!isArray(bucket)) {
- bucket = values[name] = [bucket];
- }
- if (isArray(val)) {
- values[name] = bucket.concat(val);
- } else {
- bucket.push(val);
- }
- } else {
- values[name] = val;
- }
- });
- }
- }
- });
- var grids = w.Ext.ComponentQuery.query('itemgrid');
- Ext.each(grids,function(g,index){
- if(g.xtype=='itemgrid' && !g.readOnly){
- g.saveValue();
- }
- });
- values[ProcessData.jp_keyName] = ProcessData.jp_keyValue;
- Ext.Ajax.request({
- url: basePath + '/common/processUpdate.action',
- method: 'post',
- params: {
- caller: caller,
- processInstanceId:ProcessData.jp_processInstanceId,
- formStore: unescape(Ext.JSON.encode(values).replace(/\\/g, "%")),
- _noc: 1
- },
- callback: function(options, success, response) {
- var localJson = new Ext.decode(response.responseText);
- canexecute = true;
- if (localJson.success) {
- conditionValidation=0;
- updateSuccess();
- } else if (localJson.exceptionInfo) {
- var str = localJson.exceptionInfo;
- if (str.trim().substr(0, 12) == 'AFTERSUCCESS') { //特殊情况:操作成功,但是出现警告,允许刷新页面
- str = str.replace('AFTERSUCCESS', '');
- conditionValidation=0;
- updateSuccess();
- }else conditionValidation=1;
- showError(str);
- return;
- } else {
- updateFailure();
- }
- }
- });
- }
- }
- },
- '->']);
- }
- var items = w.Ext.ComponentQuery.query('form')[0].items.items;
- var forms = w.Ext.ComponentQuery.query('form');
- Ext.Array.each(forms,function(form){
- if(form.dockedItems){
- if(form.dockedItems.items.length>0){
- items = form.items.items;
- return false;
- }
- }
- });
- //var nameArray=button.jb_buttonname.split(";");
- var fieldsArray=button.jb_fields.split(";");
- requiredFields = neccessaryField;
- var necFields=neccessaryField!=null?neccessaryField.split(","):[];
- Ext.each(items,function(item) {
- if (item.groupName == button.jb_buttonname && button.jb_fields.indexOf("#") > 0) {
- if(item.xtype =='itemgrid'){
- item.readOnly=false;
- }else{
- item.setReadOnly(false);
- }
- }
- if (Ext.Array.contains(fieldsArray,item.groupName)) {
- if(item.xtype =='itemgrid'){
- item.readOnly=false;
- }else{
- item.setReadOnly(false);
- }
- if (item.xtype!='checkbox' && item.xtype!='itemgrid' && !Ext.Array.contains(necFields,item.name)) {
- item.setFieldStyle("background:#FFFAFA;color:#515151;");
- }
- }
- if(Ext.Array.contains(necFields,item.name)){
- if(item.xtype =='itemgrid'){
- item.readOnly=false;
- }else{
- item.setReadOnly(false);
- }
- if(item.xtype!='checkbox')
- item.setFieldStyle("background:#fffac0;color:#515151;");
- }
- });
- }
- }
- }
- };
- }
- });
- }
- });
- }
- },
- setLoading : function(b) {// 原this.getActiveTab().setLoading()换成此方法,解决Window模式下无loading问题
- var mask = this.mask;
- if (!mask) {
- this.mask = mask = new Ext.LoadMask(Ext.getBody(), {
- msg : "处理中,请稍后...",
- msgCls : 'z-index:10000;'
- });
- }
- if (b)
- mask.show();
- else
- mask.hide();
- }
- });
|