1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093 |
- //没找到model从哪里来的***************不知道如何调用form
- /**
- * 各种活动对应的属性面板
- */
- Ext.ns('App.form');
- /** 面向抽象编程***/
- App.form.AbstractForm = Ext.extend(Object, {
- eventNames: [
- ['start', '开始'],
- ['end', '结束']
- ],
- classNames:[],
- clearItem: function(p) {
- if (typeof p.items != 'undefined') {
- var item = null;
- while ((item = p.items.last())) {
- p.remove(item, true);
- }
- }
- },
- getParticipantData: function(model) {
- var data = [];
- var elements = model.dom.getElementsByTagName('participant');
- Gef.each(elements, function(elem) {
- data.push({
- name: elem.getAttribute('name'),
- type: elem.getAttribute('type'),
- id : elem.getAttribute('id')
- });
- });
-
- return data;
- },
- resetParticipant: function(tabPanel, model) {
- var data = this.getParticipantData(model);
- var Record = Ext.data.Record.create(['name', 'type','id']);
- var store = new Ext.data.JsonStore({
- fields: Record,
- data: data,
- listeners: {
- add: function(store, records, index) {
- var record = records[0];
- var participantName = record.get('name');
- var participantType = record.get('type');
- var participantId = record.get('id');
- if ((!participantName) || participantName == '' || (!participantType) || participantType == '') {
- return;
- }
- var onDom = new Gef.model.Dom('participant');
- onDom.setAttribute('name', participantName);
- onDom.setAttribute('type', participantType);
- onDom.setAttribute('id',participantId);
- model.dom.addElement(onDom);
- },
- remove: function(store, record, index) {
- var candidateElements = model.dom.getElementsByTagName('participant');
- var elements = candidateElements;
- var element = elements[index];
- model.dom.elements.remove(element);
- },
- update: function(store, record, operation) {
- var participantName = record.get('name');
- var participantType = record.get('type');
- var participantId = record.get('id');
- if ((!participantName) || participantName == '' || (!participantType) || participantType == '') {
- return;
- }
- var index = store.indexOf(record);
- var candidateElements = model.dom.getElementsByTagName('participant');
- var elements = candidateElements;
- var element = elements[index];
- if (!element) {
- var onDom = new Gef.model.Dom('participant');
- onDom.setAttribute('name', participantName);
- onDom.setAttribute('type', participantType);
- onDom.setAttribute('id' , participantId);
- model.dom.addElement(onDom);
- } else {
- element.setAttribute('name', participantName);
- element.setAttribute('type', participantType);
- element.setAttribute('id' , participantId);
- }
- this.commitChanges();
- }
- }
- });
- var grid = new Ext.grid.EditorGridPanel({
- title: '界面配置',
- store: store,
- viewConfig: {
- forceFit: true
- },
- id:'grid',
- listeners:{
- 'cellclick':function(grid,rowIndex){
- grid.lastSelectedRecord=grid.selModel.selection.record;
- }
- },
- columnLines:true,
- dbfinds:[{
- field:'name',
- dbGridField:'sn_displayname'
- },{
- field:'type',
- dbGridField:'sn_url'
- },{
- field:'id',
- dbGridField:'sn_id'
- }],
- columns: [{
- header: '页面名称',
- dataIndex: 'name',
- sortable: true,
- width:400,
- editor: new Ext.grid.GridEditor(new Gef.org.DbfindField({
- dbtype:'grid',
- name:'name',
- dbfind:'Sysnavigation|sn_displayname'
- }))
- },{
- header: '页面路径',
- dataIndex: 'type',
- sortable: true,
- width:400
- },{
- header:'页面ID',
- dataIndex:'id',
- sortable:true,
- width:0
- }],
- tbar: [{
- text: '添加',
- iconCls: 'tb-add',
- handler: function() {
- var p = new Record({
- name: '',
- type: ''
- });
- this.addRecord(grid, p);
- },
- scope: this
- }, {
- text: '删除',
- iconCls: 'tb-delete',
- handler: function() {
- this.removeRecord(grid);
- },
- scope: this
- }]
- });
- tabPanel.add(grid);
- },
- getEventData: function(model) {
- var data = [];
- var elements = model.dom.getElementsByTagName('on');
- Gef.each(elements, function(elem) {
- var timerElem = elem.getElementByTagName('timer');
- if (timerElem) {
- return true;
- }
- data.push({
- name: elem.getAttribute('event'),
- classname: elem.getElementAttribute('event-listener', 'class')
- });
- });
- return data;
- },
- resetEvent: function(tabPanel, model) {
- var data = this.getEventData(model);
- var Record = Ext.data.Record.create(['name', 'classname']);
- var store = new Ext.data.JsonStore({
- fields: Record,
- data: data,
- listeners: {
- add: function(store, records, index) {
- var record = records[0];
- var eventName = record.get('name');
- var eventClassName = record.get('classname');
- if ((!eventName) || eventName == '' || (!eventClassName) || eventClassName == '') {
- return;
- }
- var onDom = new Gef.model.Dom('on'); // 这才是 创建一个 新元素的正确方法!
- onDom.setAttribute('event', eventName);
- onDom.setElementAttribute('event-listener', 'class', eventClassName);
- model.dom.addElement(onDom);
- },
- remove: function(store, record, index) {
- var candidateElements = model.dom.getElementsByTagName('on');
- var elements = [];
- Gef.each(candidateElements, function(elem) {
- var timerElem = elem.getElementByTagName('timer');
- if (!timerElem) {
- elements.push(elem);
- }
- });
- var element = elements[index];
- model.dom.elements.remove(element);
- },
- update: function(store, record, operation) {
- var eventName = record.get('name');
- var eventClassName = record.get('classname');
- if ((!eventName) || eventName == '' || (!eventClassName) || eventClassName == '') {
- return;
- }
- var index = store.indexOf(record);
- var candidateElements = model.dom.getElementsByTagName('on');
- var elements = [];
- Gef.each(candidateElements, function(elem) {
- var timerElem = elem.getElementByTagName('timer');
- if (!timerElem) {
- elements.push(elem);
- }
- });
- var element = elements[index];
- if (!element) {
- var onDom = new Gef.model.Dom('on');
- onDom.setAttribute('event', eventName);
- onDom.setElementAttribute('event-listener', 'class', eventClassName);
- model.dom.addElement(onDom);
- } else {
- element.setAttribute('event', eventName);
- element.setElementAttribute('event-listener', 'class', eventClassName);
- }
- this.commitChanges();
- }
- }
- });
- var eventNameMap = {};
- Gef.each(this.eventNames, function(item) {
- eventNameMap[item[0]] = item[1];
- });
- var classNameMap = {};
- Gef.each(this.classNames, function(item) {
- classNameMap[item[0]] = item[1];
- });
- var grid = new Ext.grid.EditorGridPanel({
- title: '事件配置',
- store: store,
- viewConfig: {
- forceFit: true
- },
- columns: [{
- header: '事件类型',
- dataIndex: 'name',
- editor: new Ext.grid.GridEditor(new Ext.ux.TwoCombo({
- data: this.eventNames
- })),
- /* width:'15%',*/
- renderer: function(v) {
- return eventNameMap[v];
- }
- }, {
- header: '类名',
- dataIndex: 'classname',
- /* editor: new Ext.grid.GridEditor(new Ext.form.TextField())*/
- editor: new Ext.grid.GridEditor(new Ext.ux.TwoCombo({
- data: this.classNames
- })),
-
- renderer: function(v) {
- return classNameMap[v];
- }
- }],
- tbar: [{
- text: '添加',
- iconCls: 'tb-add',
- handler: function() {
- var p = new Record({
- name: this.eventNames[0][0],
- classname: ''
- });
- this.addRecord(grid, p);
- },
- scope: this
- }, {
- text: '删除',
- iconCls: 'tb-delete',
- handler: function() {
- this.removeRecord(grid);
- },
- scope: this
- }]
- });
- tabPanel.add(grid);
- },
- getSwimlaneData: function(model) {
- var data = [];
- var elements = model.dom.getElementsByTagName('swimlane');
- Gef.each(elements, function(item) {
- data.push({
- name: item.getAttribute('name'),
- assignee: item.getAttribute('assignee'),
- candidateUsers: item.getAttribute('candidate-users'),
- candidateGroups: item.getAttribute('candidate-groups'),
- description: item.getElementContent('description')
- });
- });
- return data;
- },
- resetSwimlane: function(tabPanel, model) {
- var data = this.getSwimlaneData(model);
- var Record = Ext.data.Record.create([
- 'name',
- 'assignee',
- 'candidateUsers',
- 'candidateGroups',
- 'description'
- ]);
- var store = new Ext.data.JsonStore({
- fields: Record,
- data: data,
- listeners: {
- add: function(store, records, index) {
- var record = records[0];
- var swimlaneDom = new Gef.model.Dom('swimlane');
- swimlaneDom.setAttribute('name', record.get('name'));
- swimlaneDom.setAttribute('assignee', record.get('assignee'));
- swimlaneDom.setAttribute('candidate-users', record.get('candidateUsers'));
- swimlaneDom.setAttribute('candidate-groups', record.get('candidateGroups'));
- swimlaneDom.setElementContent('description', record.get('description'));
- model.dom.addElement(swimlaneDom);
- },
- remove: function(store, record, index) {
- var elements = model.dom.getElementsByTagName('swimlane');
- var element = elements[index];
- model.dom.elements.remove(element);
- },
- update: function(store, record, operation) {
- var index = store.indexOf(record);
- var elements = model.dom.getElementsByTagName('swimlane');
- var element = elements[index];
- element.setAttribute('name', record.get('name'));
- element.setAttribute('assignee', record.get('assignee'));
- element.setAttribute('candidate-users', record.get('candidateUsers'));
- element.setAttribute('candidate-groups', record.get('candidateGroups'));
- element.setElementContent('description', record.get('description'));
- this.commitChanges();
- }
- }
- });
- var grid = new Ext.grid.EditorGridPanel({
- title: '泳道配置',
- store: store,
- viewConfig: {
- forceFit: true
- },
- columns: [{
- header: '泳道名',
- dataIndex: 'name',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }, {
- header: '分配人',
- dataIndex: 'assignee',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }, {
- header: '候选人',
- dataIndex: 'candidateUsers',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }, {
- header: '候选群组',
- dataIndex: 'candidateGroups',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }, {
- header: '备注',
- dataIndex: 'description',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }],
- tbar: [{
- text: '添加',
- iconCls: 'tb-add',
- handler: function() {
- var p = new Record({
- name: '',
- assignee: '',
- candidateUsers: '',
- candidateGroups: '',
- description: ''
- });
- this.addRecord(grid, p);
- },
- scope: this
- }, {
- text: '删除',
- iconCls: 'tb-delete',
- handler: function() {
- this.removeRecord(grid);
- },
- scope: this
- }]
- });
- tabPanel.add(grid);
- },
- getTimerData: function(model) {
- var data = [];
- var elements = model.dom.getElementsByTagName('on');
- Gef.each(elements, function(elem) {
- var timerElem = elem.getElementByTagName('timer');
- if (!timerElem) {
- return true;
- }
- data.push({
- name: elem.getAttribute('event'),
- duedate: timerElem.getAttribute('duedate'),
- repeat: timerElem.getAttribute('repeat'),
- //duedatetime: timerElem.getAttribute('duedatetime'),
- classname: elem.getElementAttribute('event-listener', 'class')
- });
- });
- return data;
- },
- resetTimer: function(tabPanel, model) {
- var data = this.getTimerData(model);
- var Record = Ext.data.Record.create([
- 'name',
- 'duedate',
- 'repeat',
- //'duedatetime',
- 'classname'
- ]);
- var store = new Ext.data.JsonStore({
- fields: Record,
- data: data,
- listeners: {
- add: function(store, records, index) {
- var record = records[0];
- var onDom = new Gef.model.Dom('on');
- onDom.setAttribute('event', record.get('name'));
- var timerDom = new Gef.model.Dom('timer');
- timerDom.setAttribute('duedate', record.get('duedate'));
- timerDom.setAttribute('repeat', record.get('repeat'));
- //timerDom.setAttribute('duedatetime', record.get('duedatetime'));
- onDom.addElement(timerDom);
- onDom.setElementAttribute('event-listener', 'class', record.get('classname'));
- model.dom.addElement(onDom);
- },
- remove: function(store, record, index) {
- var candidateElements = model.dom.getElementsByTagName('on');
- var elements = [];
- Gef.each(candidateElements, function(elem) {
- var timerElem = elem.getElementByTagName('timer');
- if (!timerElem) {
- return true;
- } else {
- elements.push(elem);
- }
- });
- var element = elements[index];
- model.dom.elements.remove(element);
- },
- update: function(store, record, operation) {
- var index = store.indexOf(record);
- var candidateElements = model.dom.getElementsByTagName('on');
- var elements = [];
- Gef.each(candidateElements, function(elem) {
- var timerElem = elem.getElementByTagName('timer');
- if (!timerElem) {
- return true;
- } else {
- elements.push(elem);
- }
- });
- var element = elements[index];
- element.setAttribute('event', record.get('name'));
- var timerElem = element.getElementByTagName('timer');
- timerElem.setAttribute('duedate', record.get('duedate'));
- timerElem.setAttribute('repeat', record.get('repeat'));
- //element.setAttribute('duedatetime', record.get('duedatetime'));
- element.setElementAttribute('event-listener', 'class', record.get('classname'));
- element.setElementContent('description', record.get('description'));
- this.commitChanges();
- }
- }
- });
- var grid = new Ext.grid.EditorGridPanel({
- title: '定时器配置',
- xtype: 'editorgrid',
- store: store,
- viewConfig: {
- forceFit: true
- },
- columns: [{
- header: '名称',
- dataIndex: 'name',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }, {
- header: '持续日期',
- dataIndex: 'duedate',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }, {
- header: '重复次数',
- dataIndex: 'repeat',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }, /*{
- header: '持续时间',
- dataIndex: 'duedatetime',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }, */{
- header: '监听器类名',
- dataIndex: 'classname',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }],
- tbar: [{
- text: '添加',
- iconCls: 'tb-add',
- handler: function() {
- var p = new Record({
- name: '',
- duedate: '',
- repeat: '',
- //duedatetime: '',
- classname: ''
- });
- this.addRecord(grid, p);
- },
- scope: this
- }, {
- text: '删除',
- iconCls: 'tb-delete',
- handler: function() {
- this.removeRecord(grid);
- },
- scope: this
- }]
- });
- tabPanel.add(grid);
- },
- getVariableData: function(model) {
- var data = [];
- var elements = model.dom.getElementsByTagName('variable');
- Gef.each(elements, function(item) {
- data.push({
- name: item.getAttribute('name'),
- type: item.getAttribute('type'),
- history: item.getAttribute('history'),
- init: item.getAttribute('init')
- });
- });
- return data;
- },
- resetVariable: function(tabPanel, model) {
- var data = this.getVariableData(model);
- var Record = Ext.data.Record.create([
- 'name',
- 'type',
- 'history',
- 'init'
- ]);
- var store = new Ext.data.JsonStore({
- fields: Record,
- data: data,
- listeners: {
- add: function(store, records, index) {
- var record = records[0];
- var variableDom = new Gef.model.Dom('variable');
- variableDom.setAttribute('name', record.get('duedate'));
- variableDom.setAttribute('type', record.get('type'));
- variableDom.setAttribute('history', record.get('history'));
- variableDom.setAttribute('init', record.get('init'));
- model.dom.addElement(variableDom);
- },
- remove: function(store, record, index) {
- var elements = model.dom.getElementsByTagName('variable');
- var element = elements[index];
- model.dom.elements.remove(element);
- },
- update: function(store, record, operation) {
- var index = store.indexOf(record);
- var elements = model.dom.getElementsByTagName('variable');
- var element = elements[index];
- element.setAttribute('name', record.get('name'));
- element.setAttribute('type', record.get('type'));
- element.setAttribute('init', record.get('history'));
- element.setAttribute('history', record.get('init'));
- this.commitChanges();
- }
- }
- });
- var grid = new Ext.grid.EditorGridPanel({
- title: '变量设置',
- store: store,
- viewConfig: {
- forceFit: true
- },
- columns: [{
- header: '变量名',
- dataIndex: 'name',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }, {
- header: '变量类型',
- dataIndex: 'type',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }, {
- header: '是否保存历史',
- dataIndex: 'history',
- editor: new Ext.grid.GridEditor(new Ext.ux.OneCombo({
- data: ['true', 'false']
- }))
- }, {
- header: '初始值',
- dataIndex: 'init',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }],
- tbar: [{
- text: '添加',
- iconCls: 'tb-add',
- handler: function() {
- var p = new Record({
- name: '',
- type: ''
- });
- grid.stopEditing();
- grid.getStore().insert(0, p);
- grid.startEditing(0, 0);
- }
- }, {
- text: '删除',
- iconCls: 'tb-delete',
- handler: function() {
- Ext.Msg.confirm('信息', '确定删除?', function(btn){
- if (btn == 'yes') {
- var sm = grid.getSelectionModel();
- var cell = sm.getSelectedCell();
- var record = grid.getStore().getAt(cell[0]);
- grid.getStore().remove(record);
- }
- });
- }
- }]
- });
- tabPanel.add(grid);
- },
- addRecord: function(grid, record) {
- grid.stopEditing();
- var index = grid.getStore().getCount();
- grid.getStore().insert(index, record);
- grid.startEditing(index, 0);
- },
- removeRecord: function(grid) {
- Ext.Msg.confirm('信息', '确定删除?', function(btn) {
- if (btn != 'yes') {
- return;
- }
- var sm = grid.getSelectionModel();
- var cell = sm.getSelectedCell();
- var record = grid.getStore().getAt(cell[0]);
- grid.getStore().remove(record);
- });
- }
- });
- Ext.ns('App.form');
- App.form.CustomForm = Ext.extend(App.form.AbstractForm, {
- decorate: function(tabPanel, model) {
- this.clearItem(tabPanel);
- this.resetBasic(tabPanel, model);
- this.resetParticipant(tabPanel, model);
- //this.resetEvent(tabPanel, model);
- },
- resetBasic: function(tabPanel, model) {
- var p = new Ext.form.FormPanel({
- title: '基本配置',
- labelWidth: 70,
- labelAlign: 'right',
- border: false,
- defaultType: 'textfield',
- defaults: {
- anchor: '90%'
- },
- bodyStyle: {
- padding: '6px 0 0'
- },
- items: [{
- name: 'name',
- fieldLabel: '名称',
- value: model.text ? model.text : '',
- listeners: {
- 'blur': function(field) {
- var newValue = field.getValue();
- // FIXME: use command
- model.text = newValue;
- model.editPart.figure.updateAndShowText(newValue);
- }
- }
- },{
- name: 'description',
- fieldLabel: '备注',
- xtype: 'textarea',
- value: model.dom.getElementContent('description'),
- listeners: {
- 'blur': function(field) {
- var newValue = field.getValue();
- model.dom.setElementContent('description', newValue);
- }
- }
- }]
- });
- tabPanel.add(p);
- tabPanel.activate(p);
- }
- });
- App.form.ProcessForm = Ext.extend(App.form.AbstractForm, {
- decorate: function(tabPanel, model) {
- this.clearItem(tabPanel);
- this.resetBasic(tabPanel, model);
- },
- resetBasic: function(tabPanel, model) {
- var cstore = new Ext.data.SimpleStore({
- fields : ["value"],
- data : [["是"],["否"]]
- });
- var k=model.dom.getAttribute("data");
- if(k.length==0){
- var combo = new Ext.form.ComboBox({
- name:'pr_enabled',
- fieldLabel:'启用',
- editable:false,
- allowBlanmodel: false,
- store:cstore,
- value:model.pr_enabled?model.pr_enabled:'',
- valueField : "value",
- displayField : "value",
- mode : "local",
- triggerAction : "all",
- listeners:{
- 'blur':function(field){
- var newValue=field.getValue();
- model.pr_enabled=newValue;
- }
- }
-
- });
- var p = new Ext.form.FormPanel({
- id:'FirstForm',
- title: '基本配置',
- labelWidth: 70,
- labelAlign: 'right',
- border: false,
- defaultType: 'textfield',
- defaults: {
- anchor: '90%'
- },
- bodyStyle: {
- padding: '6px 0 0'
- },
- items: [{
- name: 'pr_defname',
- fieldLabel: '流程名称',
- allowBlanmodel: false,
- value: model.pr_defname ? model.pr_defname : '',
- listeners: {
- 'blur': function(field) {
- var newValue = field.getValue();
- model.pr_defname = newValue;
- }}
- },{
- name: 'pr_caller',
- fieldLabel: '流程CALLER',
- allowBlanmodel: false,
- value: model.pr_caller?model.pr_caller:'',
- listeners: {
- 'blur': function(field) {
- var newValue = field.getValue();
- // console.log(model);
- model.pr_caller = newValue;
- },
- 'beforerender':function(field){
- var condition=getUrlParam('formCondition');
- if(condition){
- field.setValue(condition.split("IS")[1]);
- }
-
- }
- }
- },combo, {
- name: 'pr_descn',
- fieldLabel: '备注',
- xtype: 'textarea',
- //value: model.dom.getElementContent('description'),//设置。。
- value:model.pr_descn ? model.pr_descn:'',
- listeners: {
- 'blur': function(field) {
- var newValue = field.getValue();
- model.dom.setElementContent('description', newValue);
- var a=model;
- model.pr_descn=newValue;
- }
- }
- }]
- });
- }else{
- var combo = new Ext.form.ComboBox({
- name:'pr_enabled',
- fieldLabel:'启用',
- editable:false,
- allowBlanmodel: false,
- store:cstore,
- value:k.pr_enabled?k.pr_enabled:'',
- valueField : "value",
- displayField : "value",
- mode : "local",
- triggerAction : "all",
- listeners:{
- 'blur':function(field){
- var newValue=field.getValue();
- k.pr_enabled=newValue;
- }
- }
-
- });
- var p = new Ext.form.FormPanel({
- id:'FirstForm',
- title: '基本配置',
- labelWidth: 70,
- labelAlign: 'right',
- border: false,
- defaultType: 'textfield',
- defaults: {
- anchor: '90%'
- },
- bodyStyle: {
- padding: '6px 0 0'
- },
- items: [{
- name: 'pr_defname',
- fieldLabel: '流程名称',
- allowBlank: false,
- value: k.pr_defname ? k.pr_defname : '',
- listeners: {
- 'blur': function(field) {
- var newValue = field.getValue();
- k.pr_defname = newValue;
- }
- }
- },{
- name: 'pr_caller',
- fieldLabel: '流程对应表单(caller)',
- allowBlank: false,
- value: k.pr_caller?k.pr_caller:'',
- listeners: {
- 'blur': function(field) {
- var newValue = field.getValue();
- k.pr_caller = newValue;
- },
- 'afterrender':function(field){
- alert(getUrlParam('formCondition'));
-
- }
- }
- },combo,{
- name: 'pr_descn',
- fieldLabel: '备注',
- xtype: 'textarea',
- //value: model.dom.getElementContent('description'),//设置。。
- value: k.pr_descn ? k.pr_descn : '',
- listeners: {
- 'blur': function(field) {
- var newValue = field.getValue();
- model.dom.setElementContent('description', newValue);
- var a=model;
- k.pr_descn=newValue;
- }
- }
- }]
- });
- }
- tabPanel.add(p);
- tabPanel.activate(p);
- }
- });
- Ext.ns('App.form');
- App.form.TransitionForm = Ext.extend(App.form.AbstractForm, {
- id:'transitionform',
- eventNames: [
- ['take', '进入']
- ],
- decorate: function(tabPanel, model) {
- this.clearItem(tabPanel);
- this.resetBasic(tabPanel, model);
- this.resetEvent(tabPanel, model);
- this.resetTimer(tabPanel, model);
- },
- resetBasic: function(tabPanel, model) {
- var condition = model.dom.getElementAttribute('condition', 'expr');
- if (condition != '') {
- condition = condition.replace(/</g, '<')
- .replace(/&/g, '&');
- }
- var items = [];
- items.push({
- name: 'name',
- fieldLabel: '名称',
- value: model.text ? model.text : '',
- listeners: {
- 'blur': function(field) {
- var newValue = field.getValue();
- // FIXME: use command
- if(model.getSource().type == 'task'){
- if(newValue!="同意"&&newValue!="不同意"){
- alert("任务节点的流出连线名称必须为“同意”或“不同意!”");
- field.focus();
- }
- }
- model.text = newValue;
- model.editPart.figure.updateAndShowText(newValue);
- }
- }
- });
- if (model.getSource().type == 'decision') {
- items.push({
- name: 'condition',
- fieldLabel: '条件',
- // <condition expr="#{ACCOUNT>=10000}"/>
- value: condition,
- listeners: {
- 'blur': function(field) {
- var newValue = field.getValue();
- if (newValue != '') {
- model.dom.setElementAttribute('condition', 'expr', newValue);
- } else if (model.dom.elements.length > 0) {
- model.dom.removeElement(model.dom.elements[0]);
- }
- }
- }
- });
- }
- var p = new Ext.form.FormPanel({
- title: '基本配置',
- labelWidth: 70,
- labelAlign: 'right',
- border: false,
- defaultType: 'textfield',
- defaults: {
- anchor: '90%'
- },
- bodyStyle: {
- padding: '6px 0 0'
- },
- items: items
- });
- tabPanel.add(p);
- tabPanel.activate(p);
- },
- getTimerData: function(model) {
- var data = [];
- var elements = model.dom.getElementsByTagName('timer');
- Gef.each(elements, function(elem) {
- data.push({
- duedate: timerElem.getAttribute('duedate')
- });
- });
- return data;
- },
- resetTimer: function(tabPanel, model) {
- var data = this.getTimerData(model);
- var Record = Ext.data.Record.create([
- 'duedate'
- ]);
- var store = new Ext.data.JsonStore({
- fields: Record,
- data: data,
- listeners: {
- add: function(store, records, index) {
- var record = records[0];
- var timerDom = new Gef.model.Dom('timer');
- timerDom.setAttribute('duedate', record.get('duedate'));
- model.dom.addElement(timerDom);
- },
- remove: function(store, record, index) {
- var element = model.dom.getElementByTagName('timer');
- model.dom.elements.remove(element);
- },
- update: function(store, record, operation) {
- var index = store.indexOf(record);
- var element = model.dom.getElementByTagName('timer');
- element.setAttribute('duedate', record.get('duedate'));
- this.commitChanges();
- }
- }
- });
- var grid = new Ext.grid.EditorGridPanel({
- title: '定时器配置',
- xtype: 'editorgrid',
- store: store,
- viewConfig: {
- forceFit: true
- },
- columns: [{
- header: '持续日期',
- dataIndex: 'duedate',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }/*, {
- header: '持续时间',
- dataIndex: 'duedatetime',
- editor: new Ext.grid.GridEditor(new Ext.form.TextField())
- }*/],
- tbar: [{
- text: '添加',
- iconCls: 'tb-add',
- handler: function() {
- var count = grid.getStore().getCount();
- if (count > 0) {
- Ext.Msg.alert('info', '连线上只能设置一个定时器');
- return;
- }
- var p = new Record({
- name: '',
- duedate: '',
- repeat: '',
- //duedatetime: '',
- classname: ''
- });
- grid.stopEditing();
- var index = grid.getStore().getCount();
- grid.getStore().insert(index, p);
- grid.startEditing(index, 0);
- }
- }, {
- text: '删除',
- iconCls: 'tb-delete',
- handler: function() {
- Ext.Msg.confirm('信息', '确定删除?', function(btn){
- if (btn == 'yes') {
- var sm = grid.getSelectionModel();
- var cell = sm.getSelectedCell();
- var record = grid.getStore().getAt(cell[0]);
- grid.getStore().remove(record);
- }
- });
- }
- }]
- });
- tabPanel.add(grid);
- }
- });
|