Some code blocks developed by JS

1. Load the current tab page content when the tab page is switched

EeasyUI Tabs load page code example when switching


<!-- tab grouping-->
<div id="tabs" class="easyui-tabs" fit="true" style="border:0;">
	<div title="基本信息" id="baseInfoPage" style="width: 99%; height: 99%; border: 0;" >
<iframe    scrolling=no style="width: 100%; height: 100%; border: 0;" frameborder="0" src=""></iframe>
</div>
</div>

<script type="text/javascript">
//<![CDATA[
$(function() {
     $('#tabs').tabs({   
         onSelect: function () {  
           openTab();                                    
         }  
     });  
});

//tab url
var urls = {		
baseInfoPage:"${ctx}/grid/ physicalgrid!showBaseInfo?id=${pgridId}&rd="+Math.random(),	netSrcPage:"${ctx}/grid /physicalgrid!showNetRes?id=${pgridId}&rd="+Math.random(),	
	cooperatePage:"${ctx}/grid/physicalgrid!showCooperates?id=${pgridId}&rd="+Math.random(),	
	competitorPage:"${ctx}/grid/physicalgrid!showCompetitorList?pgridId=${pgridId}&rd="+Math.random(),	
	buildingPage:"${ctx}/grid/physicalgrid!showBuildingList?pgridId=${pgridId}&rd="+Math.random()	
}
function  openTab(){
	var tab = $('#tabs').tabs('getSelected');  
    var tbId = tab.attr("id");  
    //Get the iframe object of the tab  
    var iframe = $("#"+tbId+" iframe:first-child");  
    if(!$(iframe).attr("src")){
    	$(iframe).attr("src",urls[tbId]);
    }
}
//]]>
</script>
 
 

2. Secondary linkage

Take the marketing unit brushing the drop-down box of the sales resource library as an example
<!-- Upper: query form -->
    <div data-options="region:'north'" class="search">
        <fieldset>
            <legend>Query conditions</legend>
            <form id="serachForm">
                <table class="search-table">
                    <tr>
                        <th>Marketing Unit:</th>
                        <td>
<!--                         <input type="text" maxlength="" name="areaId" id = "area"/> -->
                        <tags:area-common
                        city_id="cityId"
                        orgId="${orgId}"
                        staffid="${staffid}"
                        min_id="miId"
                        grid_name="gridName"
                        grid_id="gridId"
                        required=""
                        eparchy_id="eId"
                        eparchy_name="eName"
                        city_name="cName"
                        areaview_id="area"
                        min_name="miName"
                        eparchy_value=""
                        city_value=""
                        grid_value=""
                        min_value=""
                        >
                        </tags:area-common>
                        </td>
                        <th>Sales Repository:</th>
                        <td>
							<input id="cc" name="sellResourStoreId" class="easyui-combobox" />
                        </td>



js code
$("#miId").bind("propertychange", function () {
	var url = '${ctx}/marketing/store/invetorystore!sellResourStore';
	$('#cc').combobox({
    		url: '${ctx}/marketing/store/invetorystore!sellResourStore',
    		valueField:'sellResourStoreId',   
    		textField:'sellResourStoreName'});
});	


The miId corresponds to the min_id="miId" in the marketing unit, and the specific use of the marketing unit attribute refers to the public component document
A function is registered in the Js code for the attribute change event of the marketing unit. When the attribute value in the marketing unit changes, for example, when the second area becomes the third area, it will automatically go to the background request through the url defined in the combobox, and get a list to initialize The drop-down box of the sales resource library is brushed.


Background brush code:
public String sellResourStore() throws SysException {
		String quju = request.getParameter("quju");
		String fenju = request.getParameter("fenju");
		String wangge = request.getParameter("wangge");
		if (quju == null || quju.equals("")) {
			quju = "s";
		}
		if (fenju == null || fenju.equals("")) {
			fenju = "s";
		}
		if (wangge == null || wangge.equals("")) {
			wangge = "s";
		}

		String areaStr = quju + "," + fenju + "," + wangge + ",";
		List<SellResourStoreMVO> sellResoursStroeList = new ArrayList<SellResourStoreMVO>();
		try {
			sellResoursStroeList = invetoryStoreDelegate
					.getSellReStroeList(areaStr);
		} catch (AppException e) {
			appInfo.put("message", e.getMessage());
		}
		this.handleJsonResult(sellResoursStroeList);
		return "success";
	}



The handleJsonResult function will automatically convert the list you checked into a json object and initialize the drop-down box you need



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324502893&siteId=291194637