Ext.define('erp.view.oa.doc.DocTabPanel',{ extend: 'Ext.tab.Panel', alias: 'widget.erpDocTabPanel', id: 'doctab', collapsible :false, header :false, defaults: { autoScroll:true }, activeTab: 0, region: 'south', tabBar:{ cls:'bg_tabs', }, GridUtil: Ext.create('erp.util.GridUtil'), BaseUtil: Ext.create('erp.util.BaseUtil'), split: true, plain:true, flex:2, minHeight: 80, border: false, autoShow: true, currentDoc:null, currentType:-1, powers:{SEE:'dp_see',CONTROL:'dp_control',DOWNLOAD:'dp_download'}, defaultItems:[{ title:'目录信息', id:0, indexId:0, DocId:-1, groupType:-1, layout:'fit', items:[{ xtype:'form', id:'folderForm', layout:'column', autoScroll:true, bodyPadding: 5, bodyStyle:'background:#fafafa;', defaults: { anchor: '100%', readOnly:true, columnWidth:0.33, labelStyle:'font-weight: bold; ', fieldStyle : 'background:#fafafa;border-bottom:none;padding:2px 2px;vertical-align:middle;border-top:none;border-right:none;border-bottom-style:1px solid;border-left:none;', }, defaultType: 'textfield', items:[{ fieldLabel: '目录名称', name: 'dl_name', value:'目录名称' },{ fieldLabel: '目录', name: 'dl_virtualpath' },{ fieldLabel: '文档数', name: 'em_code' },{ fieldLabel:'创建时间', name:'dl_createtime', xtype:'datetimefield', format :'Y-m-d H:i:s' },{ fieldLabel:'目录描述', name:'dl_remark', },{ fieldLabel:'目录ID', name:'dl_id' }] }] },{ title:'目录订阅', id:1, indexId:1, DocId:-1, groupType:-1, bodyStyle:'background:#fafafa;', items:[{ xtype:'button', text:'订阅本目录', cls:'button1 pill', style:'margin-left:20px;margin-top:5px;', handler:function(btn){ if(btn.text=='订阅本目录'){ btn.setText('取消订阅本目录'); }else btn.setText('订阅本目录'); } },{ xtype:'button', text:'批量订阅', cls:'button1 pill', style:'margin-left:20px;margin-top:5px;' },{ xtype:'textfield', labelWidth:150, style:'margin-left:20px', labelStyle:'font-weight: bold;', fieldStyle : 'background:#fafafa;border-bottom:none;padding:2px 2px;vertical-align:middle;border-top:none;border-right:none;border-bottom-style:1px solid;border-left:none;', fieldLabel:'已订阅本目录的用户', value:'无' }] },{ title:'权限管理', id:2, indexId:2, DocId:-1, groupType:-1, layout:'fit', listeners:{ activate:function(tab){ tab.items.items[0].loadNewStore(); } }, items:[{ xtype:'gridpanel', columns:DOC.columns.PowerColumns, powerSet:['dp_control','dp_see','dp_save','dp_read','dp_delete','dp_print','dp_download','dp_upload'], tbar: [{ xtype:'button', text:'设置权限', cls:'button1 pill', id:'setpower', style:'margin-left:20px; margin-top:5px;', }], features : [Ext.create('Ext.grid.feature.GroupingSummary',{ groupHeaderTpl: '{name} (共:{rows.length}条)' })], autoScroll:true, region: 'south', layout : 'fit', plugins: [Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 })], store: Ext.create('Ext.data.Store', { groupField: 'dp_type', fields:DOC.fields.PowerFields }), loadNewStore:function(){ var docpanel=Ext.getCmp('doctab'); docpanel.loadPowerStore(this,{ caller:'DocumentListPower', condition:"dp_dclid="+CurrentFolderId }); } }] },{ title:'文档链接', id:3, indexId:3, DocId:-1, groupType:-1, items:[{ xtype:'gridpanel', columns:DOC.columns.LinkColumns }] },{ title:'文档信息', groupType:0, id:4, indexId:4, DocId:-1, hidden:true, layout:'fit', items:[{ xtype:'form', id:'docForm', layout:'column', autoScroll:true, bodyStyle:'background:#fafafa;', bodyPadding: 5, defaults: { anchor: '100%', readOnly:true, columnWidth:0.33, labelWidth:70, labelStyle:'font-weight: bold; ', fieldStyle : 'background:#fafafa;border-bottom:none;padding:2px 2px;vertical-align:middle;border-top:none;border-right:none;border-bottom-style:1px solid;border-left:none;', }, listeners :{ afterrender:function(form){ var docpanel=Ext.getCmp('doctab'); var data=docpanel.currentDoc!=null?docpanel.currentDoc:Ext.getCmp('docgrid').getSelectionModel(); form.getForm().setValues(docpanel.currentDoc); } }, defaultType: 'textfield', items:[{ fieldLabel: '编号', name: 'dl_code' },{ fieldLabel: '文档名称', name: 'dl_name' },{ fieldLabel: '目录', name: 'dl_virtualpath' },{ xtype: 'container', layout:'column', items:[{ name:'dl_version', xtype:'textfield', labelWidth:70, labelStyle:'font-weight: bold; ', fieldLabel:'版本号', fieldStyle : 'background:#fafafa;border-bottom:none;padding:2px 2px;vertical-align:middle;border-top:none;border-right:none;border-bottom-style:1px solid;border-left:none;', columnWidth:0.5 },{ xtype:'button', id:'updatedoc', text:'修改', cls:'button1 pill', style:'margin-left:5px;', columnWidth:0.2 },{ xtype:'button', text:'历史', cls:'button1 pill', style:'margin-left:5px;', columnWidth:0.2 }] },{ fieldLabel:'大小', name:'dl_size' },{ fieldLabel:'目录描述', name:'dl_remark', },{ fieldLabel:'创建人', name:'dl_creator' },{ fieldLabel:'创建时间', name:'dl_createtime', xtype:'datetimefield', format :'Y-m-d H:i:s' },{ fieldLabel:'当前状态', name:'dl_status' },{ xtype: 'container', layout:'column', items:[{ name:'dl_locked', xtype:'textfield', labelWidth:70, labelStyle:'font-weight: bold; ', fieldLabel:'锁定状态', fieldStyle : 'background:#fafafa;border-bottom:none;padding:2px 2px;vertical-align:middle;border-top:none;border-right:none;border-bottom-style:1px solid;border-left:none;', columnWidth:0.7, listeners:{ change:function(field,newvalue){ newvalue=(newvalue==0 || newvalue=='未锁定')?'未锁定':'已锁定'; field.setValue(newvalue); var lockbutton=Ext.getCmp('lockbutton'),buttontext=newvalue=='未锁定'?'锁定':'解锁'; lockbutton.setText(buttontext); } } },{ xtype:'button', text:'锁定', id:'lockbutton', cls:'button1 pill', style:'margin-left:5px;', columnWidth:0.2 }] },{ fieldLabel:'点击数', name:'dl_hits' },{ fieldLabel:'目录ID', name:'dl_id' }] }] },{ title:'修订版管理', groupType:0, id:5, indexId:5, DocId:-1, hidden:true, items:[{ xtype:'gridpanel', columns:DOC.columns.HistoryColumns, store:Ext.create('Ext.data.Store', { fields:DOC.fields.VersionFields, data:[] }) }], listeners:{ activate:function(tab){ var docpanel=Ext.getCmp('doctab'); var data=docpanel.currentDoc!=null?docpanel.currentDoc:Ext.getCmp('docgrid').getSelectionModel(); docpanel.loadNewStore(tab.items.items[0],{ caller:'DocumentVersion', condition:"dv_dlid="+data.dl_id }); } } },{ title:'文档评论', groupType:0, id:6, indexId:6, DocId:-1, hidden:true, autoScroll:true, listeners:{ activate:function(tab){ var docpanel=Ext.getCmp('doctab'); var data=docpanel.currentDoc!=null?docpanel.currentDoc:Ext.getCmp('docgrid').getSelectionModel(); docpanel.loadNewStore(tab.items.items[0],{ caller:'DocumentReview', condition:"dr_dlid="+data.dl_id }); } }, items:[{ xtype:'gridpanel', columns:DOC.columns.ReviewColumns, store:Ext.create('Ext.data.Store', { fields:DOC.fields.ReviewFields, data:[] }) },{ xtype:'form', style:'padding-top:15px;', autoScroll:true, border: false, height:150, layout:'column', defaults:{ columnWidth:0.33 }, bodyStyle:'background:#fafafa;', items:[{ xtype:'textfield', fieldStyle : 'background:#fafafa;border-bottom:none;padding:2px 2px;vertical-align:middle;border-top:none;border-right:none;border-bottom-style:1px solid;border-left:none;' },{ xtype: 'textareafield', fieldLabel: '