`
huang5787826
  • 浏览: 46686 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
文章分类
社区版块
存档分类
最新评论

公司EXT 复习

阅读更多
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
<title>tmStore.title</title>
<%@ include file="/common/headext.jsp" %>
<script type="text/javascript" src="<c:url value='/scripts/ext-dwr-proxy.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/ext-dwr-tree.js'/>"></script>
<script type="text/javascript" src="<c:url value='/dwr-tlcom/interface/tmStoreManager.js'/>"></script>
<script type="text/javascript" src="<c:url value='/dwr-tlcom/interface/cmOrgManager.js'/>"></script>
<script type="text/javascript" src="<c:url value='/dwr-tlcom/interface/cmOrgExManager.js'/>"></script>

<script type="text/javascript" src="<c:url value='/scripts/common/cmOrgCommon.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/common/cmExOrgCommon.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/DWRSubmitAndLoad.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/condition.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/ext-ex.js'/>"></script>
</head>
<body>

<jsp:include page="/common/header.jsp"/>

<jsp:include page="/common/footer.jsp"/>

</body>
</html>
<script  type="text/javascript">
tmStore =  function(){
	
}
var loginExOrgUuid = '<c:out value="${requestScope.loginExOrgUuid}"/>';//行政组织树的根节点Id---uuid
var loginOrgCd = '<c:out value="${requestScope.loginOrgCd}"/>';//获取登入时候的OrgCd
var orgPName= '<c:out value="${requestScope.orgPName}"/>';//获取登入时候的OrgCd的名称
var loginOrgUuid= '<c:out value="${requestScope.loginOrgUuid}"/>';//组织树的根节点Id---uuid
tmStore.addOrEditOrDel=1;// cmLeafPosition.addOrEditOrDel为1时代表执行添加事件为2时代表执行编辑事件为3时代表执行删除事件
tmStore.doInit = function(){
	Ext.QuickTips.init();
	tmStore.initToolbar();
	tmStore.initListTree();
	tmStore.initDetailForm();
	//tmStore.initSearchForm();
	tmStore.start();
	var viewport = new Ext.Viewport({
		layout:'border',
		items:[
			{region:'north',layout:'fit',margins: '5 5 5 5',border:true,height:tmStore.toolbar.height,items:tmStore.toolbar},
			tmStore.tmStoreTree,
			{region:'center',title: '仓库信息维护明细',bodyStyle:"padding:10px", width: 200,border:true,margins:'0 5 5 0',layout:'fit',items:tmStore.detailForm }
		]
	});
	tmStore.detailForm.selectFirstItem();
}
tmStore.initToolbar = function(){
    var toolbar = tmStore.toolbar=new Ext.HsToolbar({
    	toolbarType:"smallIco",
    	title:'仓库信息维护'
    });
  //查询
 //   var searchBtn = tmStore.searchBtn = new Ext.Toolbar.Button({
 //     id:'searchBtn',
 //   text: '<fmt:message key="button.search"/>',
 // iconCls: 'icon-search-big',
 //scale: 'large',
 //  iconAlign: 'top',
 // handler:tmStore.onSearch
 // });
 //toolbar.add(searchBtn);
 //toolbar.addSeparator();

    //添加
    var addBtn = tmStore.addBtn = new Ext.Toolbar.Button({
    	id:'addBtn',
        text: '<fmt:message key="button.add"/>',
        iconCls: 'icon-add-big',
        scale: 'large',
        iconAlign: 'top',
        handler:function(){
        	tmStore.addBtn.setDisabled(true);
        	Ext.getCmp('editBtn').setDisabled(true);
        	Ext.getCmp('delBtn').setDisabled(true);
        	Ext.getCmp('cancelBtn').setDisabled(false);
        	  tmStore.onNew();
            }  
    })
    toolbar.add(addBtn);
	toolbar.addSeparator();
    var editBtn=tmStore.editBtn=new Ext.Toolbar.Button({
        id:'editBtn',
        text: '编辑',
        iconCls: 'icon-edit-big',
        scale: 'large',
        iconAlign: 'top',
        handler:function(){
    	tmStore.addOrEditOrDel=2;// cmLeafPosition.addOrEdit为2时代表执行编辑事件
    	Ext.getCmp('editBtn').setDisabled(true);
    	Ext.getCmp('detailForm').setDisabled(false);
    	Ext.getCmp('saveBtn').setDisabled(false);
    	Ext.getCmp('addBtn').setDisabled(true);
    	Ext.getCmp('delBtn').setDisabled(true);
    	Ext.getCmp('cancelBtn').setDisabled(false);
        }
    })
    toolbar.add(editBtn);
	toolbar.addSeparator();
    var saveBtn = tmStore.saveBtn = new Ext.Toolbar.Button({
    	id:'saveBtn',
        text: '<fmt:message key="button.save"/>',
        iconCls: 'icon-save-big',
        scale: 'large',
        iconAlign: 'top',
        handler:tmStore.onSave
    });
    toolbar.add(saveBtn);
    toolbar.addSeparator();
    
	var delBtn = tmStore.delBtn = new Ext.Toolbar.Button({
        text: '<fmt:message key="button.delete"/>',
        iconCls: 'icon-delete-big',
        id:'delBtn',
        scale: 'large',
        iconAlign: 'top',
        handler:tmStore.onDelete
    })
	toolbar.add(delBtn);
	
	toolbar.addSeparator();
    var cancelBtn = tmStore.cancelBtn = new Ext.Toolbar.Button({
        id:'cancelBtn',
        text: '<fmt:message key="button.cancel"/>',
        iconCls: 'icon-cancel-big',
         scale: 'large',
        iconAlign: 'top',
        handler:function(){ 
        	tmStore.start();    
        	tmStore.addBtn.setDisabled(false);
        	
          } 
    });
	toolbar.add(cancelBtn);
	toolbar.addSeparator();
    toolbar.add(
    	tmStore.reloadBtn =new Ext.Toolbar.Button({
            text: '<fmt:message key="button.reload"/>',
            iconCls: 'icon-reload-big',
            scale: 'large',
        	iconAlign: 'top',
            handler: function() {
				window.location = '<c:url value="tmStores.do"/>';
            }
        })
	);
}
tmStore.initListTree = function(){	
//左边的树
 var tmStoreTree =tmStore.tmStoreTree =new Ext.tree.TreePanel({
        id:'tmStoreTree',
        region:'west',
        title:'仓库信息维护',
        width: 300,
        margins:'0 5 5 5',
        layout:'fit',
        border:true,
        autoScroll: true,
        animate: false,
        enableDD: false,
        containerScroll: false,
        rootVisible: true,
        root: {
            nodeType: 'async',
            id: loginOrgUuid,
            text: orgPName,
            href: '',
            hrefTarget: ''
        },
        tbar: [{
            text: '<fmt:message key="tree.btn.expandAll"/>',
            iconCls: 'icon-expand-all',
            scope: this,
            handler: function(){
                tmStoreTree.expandAll();
            }
        }, {
            text: '<fmt:message key="tree.btn.collapseAll"/>',
            iconCls: 'icon-collapse-all',
            scope: this,
            handler: function(){
                tmStoreTree.collapseAll();
            }
        }]
        ,
        loader: new Ext.tree.DWRTreeLoader({
            dwrCall: tmStoreManager.getTreeNodes
        })  
    });
    tmStoreTree.root.expand();
    tmStore.tmStoreTree.on('click',function(node,e){
        var quip="";
          //判断点击的节点是不是根节点,是根节点没有quip
    	  if(node.text!=tmStore.rootText){
    	  quip=node.attributes.qtip;
    	  }
	      var record=tmStore.id= node.id;
	      var text=tmStore.nodeText=node.text;
		  var params = [];
		  var exOrgName;
    	 //当点击不是仓库节点的时候 form 和一些按钮设置不可以用
        if(node.attributes.orgLevel!=null){
        	tmStore.start();
	    }
	    else{
	           //根据点击节点的id 来显示 父级节点的名字
			   var parentNode = node.parentNode;
               //根据点击节点的id 来显示行政树的名字
              DWREngine.setAsync(false);
			   tmStoreManager.getExOrgName(record,function(value){
				   exOrgName=value;
				   });
			   params.push(record);
			   DWREngine.setAsync(true);
			   tmStore.loadForm(params,parentNode.text,exOrgName);
			   Ext.getCmp('detailForm').setDisabled(true);
				Ext.getCmp('delBtn').setDisabled(false);
				Ext.getCmp('editBtn').setDisabled(false);
				Ext.getCmp('saveBtn').setDisabled(true);
				Ext.getCmp('addBtn').setDisabled(false);
		 }
    });
   tmStore.rootText=tmStoreTree.getRootNode().text;
}
//树的刷新
tmStore.reloadNavNode = function() {  
  var tree=Ext.getCmp("tmStoreTree");
  
  if(tmStore.addOrEditOrDel==3)
  {
	  var node= tree.getNodeById(tmStore.id);
	  var parentNode = node.parentNode;
	  parentNode.reload();
	  parentNode.expand();
	  }else if(tmStore.addOrEditOrDel==1){
		  var node= tree.getNodeById(tmStore.nodeId);
		  node.reload();
		  node.expand();
		  }else if(tmStore.addOrEditOrDel==2){
			  //如果是编辑时候判断是否有变动所属组织单位有变动了就要刷新两点,如果没有变动只要刷新编辑节点的父节点
			  if(tmStore.id!=tmStore.nodeId&&tmStore.nodeId!=null){
				  //变动后的组织树的节点
			   var node1= tree.getNodeById(tmStore.nodeId);
				  node1.reload();
				  node1.expand();
				  tmStore.nodeId=null;
			  }
			  var node= tree.getNodeById(tmStore.id);
			  var parentNode = node.parentNode;
			  parentNode.reload();
			  parentNode.expand();
		 }
 }
tmStore.initDetailForm = function(){
	 var  data=[["0", "自有"], ["1", "租凭"]];
	 var store=tmStore.store=new Ext.data.SimpleStore({
	       fields: ['storeVest', 'displayText'],
	       data: data 
	   });
	var formPanel  = tmStore.detailForm = new Ext.form.HsFormPanel({
        id:'detailForm',
		labelAlign: 'top',
		height:600,
		autoScroll:true,
		collapsible: false, 
        split: true,
        layout:'tableform',
        layoutConfig : {  
            columns :2
       },  
		items:[
		  		    		 		  	{xtype:'textfield',id:'storeCd',name: 'storeCd',fieldLabel: '仓库编码',allowBlank:false,maxLength:32,anchor:'60%'},
		  		    		 		  	{xtype:'textfield',id:'storeName',name: 'storeName',fieldLabel: '仓库名称',allowBlank:false,maxLength:64,anchor:'60%'},
		  		    		 		  	{xtype:'textfield',id:'storeArea',name: 'storeArea',fieldLabel: '仓库面积',regex:/^[0-9]\d*|0$/, regexText:'用正数组成',maxLength:24,anchor:'60%'},
		  		    		 		  	{xtype:'textfield',id:'storeAddr',name: 'storeAddr',fieldLabel: '地址',maxLength:255,anchor:'60%'},
		  		    		 		  	{xtype:'combo',id:'storeVest',name:'storeVest',store:tmStore.store,fieldLabel: '仓库归属',valueField: 'storeVest', displayField: 'displayText', emptyText: '请选择',
			  		    		 		triggerAction: 'all',mode: 'local',allowBlank:false,editable: false,anchor:'60%'},
			  		    		 		{xtype:'hstextfield',id:'f_orgCd',name: 'f_orgCd',fieldLabel: '所属组织单位',onTriggerClick:showOrgCdWinTree,allowBlank:false,editable: false,anchor:'60%'},
		  		    		 			{xtype:'hstextfield',id:'f_exOrgCd',name: 'f_exOrgCd',fieldLabel: '所属行政单位',onTriggerClick:showExOrgCdTree,editable: false,anchor:'60%'},
		  		    		 		    {xtype:'hidden',id:'orgCd',name: 'orgCd',anchor:'60%'},//用来当中间转换
		  		    		 			{xtype:'textarea',colspan:2,id:'remark',name: 'remark',fieldLabel: '备注信息',maxLength:255,anchor:'60%'},
		  		    		 			{xtype:'hidden',id:'exOrgCd',name: 'exOrgCd',anchor:'60%'},//用来当中间转换
		  		    		 			{xtype:'hidden',id:'storeId',name: 'storeId',anchor:'60%'}
		  	    		]
	 });
}

function showOrgCdWinTree(){
    if(!tmStore.orgCdWin){
    	tmStore.orgCdWin = new Ext.Window({
    // title:'业务树',
     layout:'fit',
	 width:350,
	 height:400,
	 closeAction: 'hide',
	 plain: true,
	 animate:true,
	 modal: true,
	 //业务树
	 items:getCmOrgTreePanel(function(node){
		 var quip=tmStore.nodeQuip=node.attributes.qtip;
		 var id=tmStore.nodeId=node.id;
     	tmStore.nodeText=node.text;
     	tmStore.orgCd=node.attributes.qtip;
		 }),
	 buttons:[{
	 text:'确定',
     handler:function(){
       if(tmStore.nodeQuip!=null){
    	   Ext.getCmp('orgCd').setValue(tmStore.nodeQuip);
    	   Ext.getCmp('f_orgCd').setValue(tmStore.nodeText);
    	   tmStore.orgCdWin.hide();
           }else{
        	   Ext.msgext.msg("", $('msgDiv').innerHTML, "messageWarning", '请选择你添加的仓库所在的组织单位');
               }
	 }
	 },{
	 text:'取消',
	 handler:function(){
		 tmStore.nodeId=null;
		 tmStore.orgCdWin.hide();
		 }
	 }
	 ]
    })
    }
    tmStore.orgCdWin.show();
};
function showExOrgCdTree(){
    if(!tmStore.exOrgCdWin){
    	tmStore.exOrgCdWin = new Ext.Window({
    // title:'行政树',
     layout:'fit',
	 width:350,
	 height:400,
	 closeAction: 'hide',
	 plain: true,
	 animate:true,
	 modal: true,
	 //行政树
	 items:cmExOrgTreePanel(loginExOrgUuid,orgPName,function(node){
		 var quip=tmStore.cmExOrgTreeNodeQuip=node.attributes.qtip;
		 var text=tmStore.cmExOrgTreeNodeText=node.text;
		 var id=node.id;
		 }),
	 buttons:[{
	 text:'确定',
     handler:function(){
       if(tmStore.cmExOrgTreeNodeQuip!=null){
    	   Ext.getCmp('exOrgCd').setValue(tmStore.cmExOrgTreeNodeQuip);
    	   Ext.getCmp('f_exOrgCd').setValue(tmStore.cmExOrgTreeNodeText);
    	   tmStore.exOrgCdWin.hide();
           }else{
        	   Ext.msgext.msg("", $('msgDiv').innerHTML, "messageWarning", '请选择你添加的仓库所在的行政单位');
               }
	 }
	 },{
	 text:'取消',
	 handler:function(){
		 
		 tmStore.exOrgCdWin.hide();
		 }
	 }
	 ]
    })
    }
    tmStore.exOrgCdWin.show();
};
tmStore.conditions = [];
tmStore.onSearch = function(){
	if(!tmStore.listGridSearchWin){
		tmStore.listGridSearchWin = new Ext.Window({
			title: '<fmt:message key="search.info"/>',
			width: 600,
			animate:true,
			modal:true,
			closeAction:'hide',
			autoHeight:true,
			plain:true,
			buttonAlign:'left',
			items:[tmStore.searchForm],
			buttons: ['->',{
				text: '<fmt:message key="button.search"/>',
				handler:function(){
					tmStore.conditions.length = 0;
					buildCondition(tmStore.searchForm,tmStore.conditions);
					tmStore.listGrid.onSearch(tmStore.conditions);
					tmStore.listGridSearchWin.hide();
				}
			},{
				text: '<fmt:message key="button.reset"/>',
				handler: function(){
					tmStore.searchForm.reset();
				}	
			},{
				text: '<fmt:message key="button.cancel"/>',
				handler: function(){
					tmStore.listGridSearchWin.hide();
				}	
			}]
		});
	}
	tmStore.listGridSearchWin.show();
}
tmStore.initSearchForm=function() {
	var sf =tmStore.searchForm= new Ext.form.HsFormPanel({
		layout:'tableform',
		labelAlign: 'top',
		monitorResize:true,
		layoutConfig : {  
            columns :2
       },  
		items:[		    		     		  	{xtype:'textfield',fieldLabel: '仓库编码',id: 's_storeCd',name: 's_storeCd',condition:{col:'storeCd',operator:'like',type:'String'},anchor:'90%'},
		  			    		     		  	{xtype:'textfield',fieldLabel: '仓库名称',id: 's_storeName',name: 's_storeName',condition:{col:'storeName',operator:'like',type:'String'},anchor:'90%'},
		  			    		     		 {xtype:'textfield',fieldLabel: 'storeVest',id: 's_storeVest',name: 's_storeVest',condition:{col:'storeVest',operator:'like',type:'String'},anchor:'90%'},
		  			    		     		    {xtype:'hstextfield',id:'s_orgCd',name: 's_orgCd',fieldLabel: '所属组织单位',onTriggerClick:showtmStoreTree,anchor:'90%'},
		  			    		     			{xtype:'textfield',fieldLabel: 'exOrgCd',id: 's_exOrgCd',name: 's_exOrgCd',condition:{col:'exOrgCd',operator:'like',type:'String'},anchor:'90%'}
		  		    		]
	});
}
tmStore.start = function(){
	tmStore.detailForm.getForm().reset();
	Ext.getCmp('addBtn').setDisabled(false);
	Ext.getCmp('detailForm').setDisabled(true);
	Ext.getCmp('editBtn').setDisabled(true);
	Ext.getCmp('saveBtn').setDisabled(true);
	Ext.getCmp('delBtn').setDisabled(true);
	Ext.getCmp('cancelBtn').setDisabled(true);
	Ext.getCmp('f_orgCd').setDisabled(true);
};
tmStore.onNew = function(){
	tmStore.addOrEditOrDel=1;// tmStore.addOrEditOrDel为1时代表执行添加事件
	Ext.getCmp('saveBtn').setDisabled(false);
	tmStore.detailForm.getForm().reset();
	tmStore.detailForm.setDisabled(false);
};
tmStore.onSave = function(){
	
	Ext.MessageBox.wait('<fmt:message key="button.save.waitmsg"/>');
	if(!tmStore.detailForm.getForm().isValid()){
		Ext.MessageBox.hide();	
		Ext.msgext.msg("", $('msgDiv').innerHTML, "messageWarning", '<fmt:message key="form.validate.false"/>');
		return '';
	}
	var tmStoreDetail = tmStore.detailForm.getForm().getValues();
	dwr.engine.beginBatch();
	tmStoreManager.saveTmStoreByDwr(tmStoreDetail,function(value){
		Ext.MessageBox.hide();	
		tmStore.detailForm.getForm().setValues(value);
		tmStore.reloadNavNode();//树的刷新
		Ext.msgext.msg("", $('msgDiv').innerHTML, "messageSuccess", '<fmt:message key="save.succeed"/>');
		tmStore.start();
	});
	dwr.engine.endBatch({errorHandler:function(errorString, exception) {
		Ext.MessageBox.hide();
		Ext.msgext.msg("", $('msgDiv').innerHTML, "messageError", '<fmt:message key="save.error"/>');	
		}
	});
};

tmStore.onDelete = function(){
	tmStore.addOrEditOrDel=3;// cmLeafPosition.addOrEdit为3时代表执行删除事件
	var tmStoreId=tmStore.id;//点击时候节点的id
	if(!tmStoreId.length>0){
		Ext.msgext.msg("", $('msgDiv').innerHTML, "messageWarning", '<fmt:message key="button.delete.confirm.msg3"/>');
		return false;
	}
	Ext.MessageBox.confirm('', '你确定要删除'+tmStore.nodeText+'这条记录吗?',
	function(btn, text) {
		if (btn == 'yes'){
			Ext.MessageBox.wait('<fmt:message key="button.save.waitmsg"/>');
			dwr.engine.beginBatch();
			tmStoreManager.removeTmStore(tmStoreId,function(){
				Ext.MessageBox.hide();	
				tmStore.detailForm.getForm().reset();	
				tmStore.reloadNavNode();//树的刷新
				Ext.msgext.msg("", $('msgDiv').innerHTML, "messageSuccess", '<fmt:message key="delete.succeed"/>');
				tmStore.start();
				
			});
			dwr.engine.endBatch({errorHandler:function(errorString, exception) {
				Ext.MessageBox.hide();	
				Ext.msgext.msg("", $('msgDiv').innerHTML, "messageError", '<fmt:message key="delete.error"/>');
			}});
		}
	}
	);
}
tmStore.loadForm = function (params,value,exOrgName){
	tmStore.detailForm.getForm().doAction("dwrload", {
		dwrFunction:tmStoreManager.getTmStore,
		dwrArgs:params, 
		waitMsg : '<fmt:message key="loadData.waitmsg"/>',
        success : function(){	   
			   Ext.getCmp('f_orgCd').setValue(value);   
			   Ext.getCmp('f_exOrgCd').setValue(exOrgName); 
	},
		failure : function(form, action) {
			Ext.msgext.msg("", $('msgDiv').innerHTML, "messageError", '<fmt:message key="loadData.error"/>');
		}
	});
}
Ext.onReady(function(){
	tmStore.doInit();
});
</script>
分享到:
评论

相关推荐

    (复习)计算机应用基础选择题.zip

    【计算机应用基础选择题】...通过复习和解答计算机应用基础的选择题,我们可以深化对这些知识的理解,提升实际操作能力,为今后的学习和工作打下坚实基础。在日常学习中,可以结合实例进行练习,以达到学以致用的效果。

    操作系统复习题

    - macOS (苹果公司的操作系统) - Linux (开源操作系统) - Android (移动设备操作系统) - iOS (苹果公司为移动设备设计的操作系统) #### 2. Windows XP是流行的操作系统,它有哪两个版本? - **Windows XP版本*...

    小米公司安全工程师岗位面试经历.docx

    小米公司的安全工程师面试是一个深入考察候选人技术能力与专业知识的严谨过程。...准备这样的面试,候选人需要全面复习相关技术,同时具备实际操作经验和项目经验,以展现自己对安全领域的深入理解和专业素养。

    无线传感网络技术 Z-Stack Monitor and Test API.pdf

    《Z-Stack Monitor and Test API》是Texas Instruments公司发布的一份技术文档,主要涉及无线传感网络技术。该文档编号为SWRA198,适用于计算机领域的专业人士,用于学习、复习和教学。文档经过多次修订,增加了多项...

    系统平台练习题

    - MacOS:苹果公司开发的专为Macintosh电脑设计的操作系统。 2. 硬件架构:不同的系统平台可能基于不同的硬件架构,如Intel x86架构、AMD x86-64、ARM架构等。理解这些架构对编写跨平台的软件至关重要。 3. 网络...

    2410嵌入式实验文档

    这份学校课程设计的实验文档,不仅适用于课堂学习,也是自学和复习的宝贵资料。 首先,我们要了解2410芯片。S3C2410是一款由Samsung公司推出的基于ARM920T内核的高性能、低功耗微处理器。它具有丰富的外围接口,如...

    北阳电子笔试题_嵌入式-常用知识&面试题库_大厂面试真题.rar

    北阳电子是一家在IT行业中颇具影响力的公司,尤其在嵌入式系统领域有着深厚的积累。这份“北阳电子笔试题_嵌入式-常用知识&面试题库_大厂面试真题.rar”压缩包文件,显然是为准备北阳电子或其他大型企业嵌入式职位...

    Ubuntu Certified Professional Study Guide (Exam LPI 199)

    本书由迈克尔·詹格(Michael Jang)撰写,由麦格劳希尔出版公司(McGraw-Hill)出版。作为一本权威性的学习资料,本书旨在帮助读者全面掌握考试所需的知识和技术,以便能够顺利通过认证考试。 #### 书籍内容与结构...

    Foundation_Framework

    Foundation框架是苹果公司为开发者提供的核心框架之一,主要应用于macOS、iOS、watchOS以及tvOS等操作系统上。该框架包含了处理基本类型数据(如字符串、数字和日期)、集合管理、事件处理、错误处理等一系列功能,...

Global site tag (gtag.js) - Google Analytics