123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604 |
- 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: '<div align="center" class="WindowTitle">发表评论</div>',
- labelCls:'x-form-item-label x-form-item-label-top',
- name:'talk',
- id:'talk',
- labelSeparator:'',
- style:'padding-left:50px',
- allowBlank: false,
- width:300
- }],
- buttonAlign:'center',
- buttons:[{
- text:'保存',
- cls:'button1 pill',
- style:'margin-top:5px;',
- xtype:'button',
- handler:function(btn){
- var doctab=btn.ownerCt.ownerCt.ownerCt;
- var o={
- dr_remark:Ext.getCmp('talk').value,
- dr_dlid:doctab.ownerCt.currentDoc.dl_id
- };
- Ext.Ajax.request({
- url : basePath + 'oa/Doc/review.action',
- params : {
- formStore:unescape(Ext.JSON.encode(o).replace(/\\/g,"%"))
- },
- method : 'post',
- callback : function(options,success,response){
- var localJson = new Ext.decode(response.responseText);
- if(localJson.exceptionInfo){
- var str = localJson.exceptionInfo;
- showError(str);
- }else {
- showResult('提示','评论成功!',btn);
- var grid=doctab.items.items[0];
- Ext.getCmp('talk').reset();
- doctab.ownerCt.loadNewStore(grid,{
- caller:'DocumentReview',
- condition:"dr_dlid="+doctab.ownerCt.currentDoc.dl_id
- })
- }
- }
- });
- }
- }]
- }]
- },{
- title:'文档审计',
- groupType:0,
- id:7,
- indexId:7,
- DocId:-1,
- hidden:true,
- items:[{
- xtype:'gridpanel',
- columns:DOC.columns.LogColumns
- }]
- },{
- title:'摘要及省略图',
- groupType:0,
- id:8,
- indexId:8,
- DocId:-1,
- hidden:true,
- items:[{
- xtype:'button',
- text:'增加文档摘要',
- cls:'button1 pill',
- style:'margin-left:20px;margin-top:10px;',
- handler:function(btn){
- }
- },{
- xtype:'button',
- text:'打印图片',
- cls:'button1 pill',
- style:'margin-left:20px;margin-top:10px;'
- }]
- },{
- title:'关联文档',
- groupType:0,
- id:9,
- indexId:9,
- DocId:-1,
- hidden:true,
- items:[{
- xtype: 'container',
- layout:'column',
- style:'margin-top:5px;background:transparent;',
- bodyStyle:'background:transparent;',
- items:[{
- xtype:'textfield',
- fieldStyle : 'background:transparent;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.33
- },{
- name:'code',
- xtype:'textfield',
- labelWidth:70,
- labelStyle:'font-weight: bold; ',
- fieldLabel:'文档编号',
- columnWidth:0.2
- },{
- xtype:'button',
- id:'addrelatedoc',
- text:'增加关联文档',
- cls:'button1 pill',
- style:'margin-left:5px;',
- columnWidth:0.1
- }]
- },{
- xtype:'gridpanel',
- columns:DOC.columns.RelateColumns
- }]
- },{
- title:'借阅情况',
- groupType:0,
- id:10,
- indexId:10,
- DocId:-1,
- hidden:true,
- items:[{
- xtype:'gridpanel',
- columns:DOC.columns.BorrowColumns
- }]
- }],
- defaults:{
- active:function(tab){
- var dlid=tab.ownerCt.currentDoc.data.dl_id;
- if(tab.DocId !=tab.ownerCt.currentDoc.data.dl_id){
- //说明切换了
- tab.ownerCt.changeTab();
- tab.DocId=dlid;
- }
- }
- },
- initComponent : function(){
- this.items=this.defaultItems;
- this.addEvents({
- tabItemChange: true
- });
- this.callParent(arguments);
- },
- listeners:{
- tabItemChange:function(tabpanel,record){
- if(record && record.data !=this.currentDoc){
- this.currentDoc=record.data;
- var kind=record.data.dl_kind ==0?0:-1;
- if(record.data.dl_kind!=this.currentType){
- this.changeItems(record,kind);
- }else this.changeItems(record);
- }
-
- }
- },
- changeItems:function(record,type){
- if(type!=null){
- Ext.Array.each(this.items.items,function(item){
- if(item.groupType!=type){
- item.tab.hide();
- }else {
- if(item.title=='权限管理'){
- var doctab=Ext.getCmp('doctab');
- var bool=doctab.checkPowerByFolderId(CurrentFolderId,doctab.powers.CONTROL);
- if(bool) item.tab.show(); else item.tab.hide();
- }else item.tab.show();
- }
- });
- if(this.currentType!=type && this.activeTab.indexId>3)
- this.setActiveTab(this.activeTab.indexId-4);
- else if(this.currentType!=type && this.activeTab.indexId<4)
- this.setActiveTab(this.activeTab.indexId+4);
- else {
- var tab=this.getActiveTab();
- tab.fireEvent('activate', tab);
- }
- this.currentType=type;
- }else {
- if(this.currentType==-1){
- Ext.getCmp('folderForm').getForm().setValues(record.data);
- }else {
- Ext.getCmp('docForm').getForm().setValues(record.data);
- }
- }
- },
- loadNewStore: function(grid, param){
- var me = this;
- Ext.Ajax.request({//拿到grid的columns
- url : basePath + "common/loadNewGridStore.action",
- params: param,
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo){
- showError(res.exceptionInfo);return;
- }
- var data = res.data;
- if(!data || data.length == 0){
- grid.store.removeAll();
- } else {
- grid.store.loadData(data);
- }
- //自定义event
- grid.addEvents({
- storeloaded: true
- });
- grid.fireEvent('storeloaded', grid, data);
- }
- });
- },
- loadPowerStore: function(grid, param){
- var me = this;
- Ext.Ajax.request({//拿到grid的columns
- url : basePath + "common/loadNewGridStore.action",
- params: param,
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo){
- showError(res.exceptionInfo);return;
- }
- var data = res.data;
- Ext.each(res.data, function(item){
- Ext.each(grid.powerSet, function(pp){
- item[pp] = item[pp] == 1;
- });
- });
- if(!data || data.length == 0){
- grid.store.removeAll();
- } else {
- grid.store.loadData(data);
- }
- //自定义event
- grid.addEvents({
- storeloaded: true
- });
- grid.fireEvent('storeloaded', grid, data);
- }
- });
- },
- checkPowerByFolderId:function(folderId,type){
- var me = this,bool=false;
- Ext.Ajax.request({//拿到grid的columns
- url : basePath + "doc/CheckPowerByFolderId.action",
- params: {
- folderId:folderId,
- type:type
- },
- async:false,
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- bool=res.bool;
-
- }
- });
- return bool;
- }
-
- });
|