Browse Source

区分大行业和小行业,修改相关的功能

ying.rong 9 years ago
parent
commit
671f8c6940

+ 18 - 0
src/main/java/com/cloudcross/ssp/model/Industry.java

@@ -8,6 +8,8 @@ public class Industry implements ISelector{
 	
 	private String name;
 	
+	private Long fatherId;
+	
 	public Long getId() {
 		return id;
 	}
@@ -24,6 +26,22 @@ public class Industry implements ISelector{
 		this.name = name;
 	}
 
+	public Long getFatherId() {
+		return fatherId;
+	}
+
+	public void setFatherId(Long fatherId) {
+		this.fatherId = fatherId;
+	}
+
+	public String getFatherName() {
+		return fatherName;
+	}
+
+	public void setFatherName(String fatherName) {
+		this.fatherName = fatherName;
+	}
+
 	@Override
 	public String getLabel() {
 		// TODO Auto-generated method stub

+ 15 - 1
src/main/java/com/cloudcross/ssp/model/ZoneIndustry.java

@@ -7,6 +7,8 @@ public class ZoneIndustry {
 	private Long industryId;
 	private Long supdated;
 	private Integer status;
+	private String industryName;
+	private String industryFatherName;
 	
 	public Long getId() {
 		return id;
@@ -38,11 +40,23 @@ public class ZoneIndustry {
 	public void setStatus(Integer status) {
 		this.status = status;
 	}
+	public String getIndustryName() {
+		return industryName;
+	}
+	public void setIndustryName(String industryName) {
+		this.industryName = industryName;
+	}
+	public String getIndustryFatherName() {
+		return industryFatherName;
+	}
+	public void setIndustryFatherName(String industryFatherName) {
+		this.industryFatherName = industryFatherName;
+	}
 	@Override
 	public String toString() {
 		return "ZoneIndustry [id=" + id + ", zoneId=" + zoneId
 				+ ", industryId=" + industryId + ", supdated=" + supdated
-				+ ", status=" + status + "]";
+				+ ", status=" + status + ", industryName=" + industryName +", industryFatherName=" + industryFatherName +"]";
 	}
 	
 	

+ 43 - 8
src/main/java/com/cloudcross/ssp/model/mapper/industry.sql.xml

@@ -2,15 +2,50 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="industrySqlMapper">
 
-<sql id="base_column">
-	id,
-	name
-</sql>
-
-	<select id="findAllIndustry"  resultType="com.cloudcross.ssp.model.Industry">
-		    select
+	<sql id="base_column">
+		id,
+		name,
+		father_id as fatherId
+	</sql>
+	
+	<select id="findAllFatherIndustry" resultType="com.cloudcross.ssp.model.Industry" parameterType="java.util.Map">
+		select
+	    <include refid="base_column" />
+	    from t_industry where father_id = 0
+	    <if test="pager != null">
+	    	limit #{pager.offset}, #{pager.limit}
+	    </if>
+	</select>
+	
+	<select id="countAllFatherIndustry" resultType="java.lang.Integer" parameterType="java.util.Map">
+		select count(id) from t_industry where father_id = 0
+	</select>
+	
+	<select id="findIndustryByFatherId" parameterType="java.util.Map" resultType="com.cloudcross.ssp.model.Industry">
+		select
 	    <include refid="base_column" />
-	    from t_industry
+	    from t_industry where father_id = #{fatherId}
+	    limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+	<select id="countIndustryByFatherId" parameterType="java.util.Map" resultType="java.lang.Integer">
+		select count(id) from t_industry where father_id = #{fatherId}
+	</select>
+	
+	<select id="findAllIndustry" resultType="com.cloudcross.ssp.model.Industry">
+		select a.id,a.name,b.name as fatherName from t_industry a,t_industry b 
+		where a.father_id = b.id
+	</select>
+	
+	<select id="findAllUseIndustry" parameterType="java.lang.Long" resultType="com.cloudcross.ssp.model.Industry">
+		select tiy.id,tiy.name,tiy.father_id as fatherId
+		from t_advertiser tar 
+		LEFT JOIN t_industry tiy ON tar.industry_id = tiy.id 
+		where tar.status != -1
+		<if test="_parameter != null">	
+			and tar.agent_id = #{_parameter}
+		</if>
+		group by tar.industry_id
 	</select>
 	
 	<select id="findByIndustryId" parameterType="int" resultType="com.cloudcross.ssp.model.Industry">

+ 4 - 1
src/main/java/com/cloudcross/ssp/model/mapper/zone-industry.sql.xml

@@ -11,7 +11,10 @@
 	</insert>
 	
 	<select id="findAll" parameterType="long" resultType="com.cloudcross.ssp.model.ZoneIndustry">
-		select <include refid="base_column"/> from t_zone_industry where zone_id = #{zoneId} and t_zone_industry.status = 0
+		select t_zone_industry.zone_id as zoneId, t_zone_industry.industry_id as industryId, a.name as industryName, b.name as industryFatherName 
+		from t_zone_industry, t_industry a, t_industry b
+		where t_zone_industry.industry_id = a.id and a.father_id = b.id 
+		and t_zone_industry.zone_id = #{zoneId} and t_zone_industry.status = 0
 	</select>
 	
 	<update id="editZoneIndustry" parameterType="com.cloudcross.ssp.model.ZoneIndustry">

+ 5 - 0
src/main/java/com/cloudcross/ssp/service/IIndustryService.java

@@ -1,6 +1,7 @@
 package com.cloudcross.ssp.service;
 
 import java.util.List;
+import java.util.Map;
 
 import com.cloudcross.ssp.model.Industry;
 import com.cloudcross.ssp.base.service.IGenericService;
@@ -9,4 +10,8 @@ public interface IIndustryService extends IGenericService<Industry> {
 	public Industry findByIndustryId(Long industryId);
 	public List<Industry> findAll();
 	public List<Industry> findAllByZoneIdOperator(Long zoneId);
+	public List<Industry> findAllFatherIndustry(Map<String,Object> paramMap);
+	public Integer conutAllFatherIndustry(Map<String,Object> paramMap);
+	public List<Industry> findIndustryByFatherId(Map<String,Object> paramMap);
+	public Integer countIndustryByFatherId(Map<String,Object> paramMap);
 }

+ 27 - 3
src/main/java/com/cloudcross/ssp/service/impl/IndustryService.java

@@ -66,15 +66,19 @@ public class IndustryService implements IIndustryService,ISelectorProvider{
 		return false;
 	}
 	
-	public List<Industry> findAllIndustry(){
-	List<Industry> industryList = myBatisDao.getList("industrySqlMapper.findAllIndustry");
+	public List<Industry> findAllIndustry(String[] parentId){
+		Long agentId = null;
+		if(parentId != null){
+			agentId = Long.valueOf(parentId[0]);
+		}
+		List<Industry> industryList = myBatisDao.getList("industrySqlMapper.findAllUseIndustry",agentId);
 		return industryList;
 	}
 	//___________________________________________________________________________________________________________________
 	@Override
 	public Map<String, List<? extends ISelector>> provideData(String[] parentId) {
 		// TODO Auto-generated method stub//目前只有这一个是有用的!
-		List<Industry> industryList = findAllIndustry();
+		List<Industry> industryList = findAllIndustry(parentId);
 		return MapBuilder.create(HashMap.class).add("allIndustry",industryList).map();
 	}
 //---------------------------------------------------------------------------------------------------------------------------
@@ -84,5 +88,25 @@ public class IndustryService implements IIndustryService,ISelectorProvider{
 		// TODO Auto-generated method stub
 		return myBatisDao.getList("industrySqlMapper.findAllIndustryByZoneIdOperator",zoneId);
 	}
+	@Override
+	public List<Industry> findAllFatherIndustry(Map<String,Object> paramMap) {
+		// TODO Auto-generated method stub
+		return myBatisDao.getList("industrySqlMapper.findAllFatherIndustry",paramMap);
+	}
+	@Override
+	public Integer conutAllFatherIndustry(Map<String,Object> paramMap) {
+		// TODO Auto-generated method stub
+		return myBatisDao.get("industrySqlMapper.countAllFatherIndustry",paramMap);
+	}
+	@Override
+	public List<Industry> findIndustryByFatherId(Map<String,Object> paramMap) {
+		// TODO Auto-generated method stub
+		return myBatisDao.getList("industrySqlMapper.findIndustryByFatherId",paramMap);
+	}
+	@Override
+	public Integer countIndustryByFatherId(Map<String,Object> paramMap) {
+		// TODO Auto-generated method stub
+		return myBatisDao.get("industrySqlMapper.countIndustryByFatherId",paramMap);
+	}
 	
 }

+ 53 - 5
src/main/java/com/cloudcross/ssp/web/operator/main/ad/ZoneController.java

@@ -45,6 +45,7 @@ import com.cloudcross.ssp.common.consts.Status;
 import com.cloudcross.ssp.common.utils.Common;
 import com.cloudcross.ssp.common.utils.LangUtil;
 import com.cloudcross.ssp.common.utils.Pager;
+import com.cloudcross.ssp.common.utils.Pager1;
 import com.cloudcross.ssp.model.BannerTemplate;
 import com.cloudcross.ssp.model.Industry;
 import com.cloudcross.ssp.model.Log;
@@ -152,7 +153,8 @@ public  class ZoneController extends SimpleController {
 	
 	@RequestMapping("/create")
 	public String create(Model model,HttpServletRequest request)  {
-		List<Industry> industryList = industryService.findAll();
+		Map<String,Object> paramMap = new HashMap<String, Object>();
+		List<Industry> industryList = industryService.findAllFatherIndustry(paramMap);
 		List<Size> sizeList = sizeService.findAllSizeForZone();
 		System.out.println("abc"+sizeList.toString());
 		model.addAttribute("sizeList", sizeList);
@@ -180,7 +182,8 @@ public  class ZoneController extends SimpleController {
 		
 		
 		//查询所有的行业
-		List<Industry> industryList = industryService.findAll();
+		Map<String,Object> paramMap = new HashMap<String, Object>();
+		List<Industry> industryList = industryService.findAllFatherIndustry(paramMap);
 		//查询所有的尺寸
 		List<Size> SizeList = sizeService.findAllSizeForZone();
 		//根据广告位的宽高查询广告位的ID
@@ -198,8 +201,8 @@ public  class ZoneController extends SimpleController {
 		//设置广告位的sizeID
 		//查询开启状态广告位行业黑名单
 		List<ZoneIndustry> zoneIndustryList = zoneIndustryService.findAll(zone.getId());
-		//查询没有在黑名单里的行业
-		List<Industry> notzoneIndustryList = industryService.findAllByZoneIdOperator(zone.getId());
+		//查询没有在黑名单里的行业   改为显示所有的大行业
+		//List<Industry> notzoneIndustryList = industryService.findAllByZoneIdOperator(zone.getId());
 		String industryStr = "";
 		for(ZoneIndustry a : zoneIndustryList) {
 			industryStr += a.getIndustryId()+",";
@@ -213,7 +216,7 @@ public  class ZoneController extends SimpleController {
 		model.addAttribute("industryList",industryList);
 		model.addAttribute("zoneIndustryList",zoneIndustryList);
 		model.addAttribute("SizeList", SizeList);
-		model.addAttribute("notzoneIndustryList",notzoneIndustryList);
+		model.addAttribute("notzoneIndustryList",industryList);
 		model.addAttribute("zoneDomainStr", zoneDomainStr);
 		model.addAttribute("industryStr", industryStr);
 		model.addAttribute("sessionid", request.getSession().getId());
@@ -956,6 +959,51 @@ public  class ZoneController extends SimpleController {
 			zone.setHeight(_height[n]);
 			}	
 		}
+	
+	/**
+	 * 获取父层下的子行业
+	 * @return
+	 */
+	@RequestMapping("/getIndustry")
+	public String getIndustry(Model model, @RequestParam(defaultValue = "1") int page,
+			@RequestParam Map<String, Object> paramMap) {
+		Integer count = this.industryService.countIndustryByFatherId(paramMap);
+		Pager1 pager = new Pager1();
+		pager.setPage(page);
+		pager.setTotalRow(count);
+		paramMap.put("pager", pager);
+		List<Industry> industryList = this.industryService.findIndustryByFatherId(paramMap);
+		model.addAttribute("pager", pager);
+		model.addAttribute("fatherId", "");
+		model.addAttribute("industryId", paramMap.get("industry"));
+		model.addAttribute("industryList", industryList);
+		return page("industry");	
+	}
+	
+	/**
+	 * 获取父层下的子行业
+	 * @return
+	 */
+	@RequestMapping("/getAllIndustry")
+	@ResponseBody
+	public List<Industry> getAllIndustry(Model model,@RequestParam Map<String, Object> paramMap) {
+		List<Industry> industryList = this.industryService.findAll();
+		return 	industryList;
+	}
+	
+	/**
+	 * 判断是否有子行业
+	 * @return
+	 */
+	@RequestMapping("/isExistIndustry")
+	@ResponseBody
+	public Boolean isExistIndustry(Model model,@RequestParam Map<String, Object> paramMap) {
+		Integer count = this.industryService.countIndustryByFatherId(paramMap);
+		if(count == 0){
+			return true;
+		}
+		return 	false;
+	}
 }
 
 

+ 18 - 12
src/main/webapp/WEB-INF/pages/operator/main/ad/zone/create.ftl

@@ -8,6 +8,7 @@
 <script type="text/javascript" src="${ctx}/assets/js/lib/bootbox.js"></script>
 <script type="text/javascript" src="${ctx}/assets/js/common/validate.js"></script>
 <script type="text/javascript" src="${ctx}/assets/js/operator/zone.js"></script>
+<script type="text/javascript" src="${ctx}/assets/js/layer/layer.js"></script>
 </@override>
 <@override name="body">
 <div id=content_bg>
@@ -111,19 +112,24 @@
 					</div>
 				</div>
 				<div class="input-group" id="industryDiv">
-					<ul id="all_industry">
-					<span class="ul_title">全部行业</span>
-					<#if industryList ??>
-					<#list industryList as industry>
-						<input  autocomplete="off"   type="hidden" value="#{industry.id}">
-						<li value="#{industry.id}">${industry.name}</li>
-						</#list>
-						</#if>
-					</ul>
-					<ul id="blacklist">
+					<div class="industryDivClass" id="industryDivClass_one">
+						<span class="ul_title">全部行业</span>
+						<ul id="all_industry">
+							<#if industryList ??>
+							<#list industryList as industry>
+							<input autocomplete="off" type="hidden" value="#{industry.id}" title="${industry.name}">
+							<li value="#{industry.id}">${industry.name}</li>
+							</#list>
+							</#if>
+						</ul>
+					</div>
+					<div class="industryDivClass">
 						<span class="ul_title" id="ul_title">黑名单行业</span>
-						<input type="hidden" value="" id="industry_blacklist" name="industry" />
-					</ul>
+						<ul id="blacklist">
+							<input type="hidden" value="" id="industryFatherName"/>
+							<input type="hidden" value="" id="industry_blacklist" name="industry" />
+						</ul>
+					</div>
 				</div>
 				<div class="input-group" id="blackDiv">
 					<label class="input-label-other"><span class="lbl-no"></span>网站黑名单:</label>

+ 22 - 27
src/main/webapp/WEB-INF/pages/operator/main/ad/zone/edit.ftl

@@ -8,6 +8,7 @@
 <script type="text/javascript" src="${ctx}/assets/js/lib/bootbox.js"></script>
 <script type="text/javascript" src="${ctx}/assets/js/common/validate.js"></script>
 <script type="text/javascript" src="${ctx}/assets/js/operator/zone.js"></script>
+<script type="text/javascript" src="${ctx}/assets/js/layer/layer.js"></script>
 </@override>
 <@override name="body">
 <div id=content_bg>
@@ -105,35 +106,29 @@
 					</div>
 				</div>
 				<div class="input-group" id="industryDiv">
-					<ul id="all_industry">
-					<span class="ul_title">全部行业</span>
-					<#if notzoneIndustryList ??>
-						<#list notzoneIndustryList as z>
-							<input autocomplete="off" type="hidden" value="#{z.id}">
-							<li value="#{z.id}">${z.name}</li>
-						</#list>
-						<#else>
-						<#if industryList ??>
-						<#list industryList as industry>
-							<input autocomplete="off" type="hidden" value="#{industry.id}">
-							<li value="#{industry.id}">${industry.name}</li>
-						</#list>
-						</#if>
-					</#if>
-					</ul>
-					<ul id="blacklist">
-						<span class="ul_title" id="ul_title">黑名单行业</span>
-						<input type="hidden" value="${industryStr!}" id="industry_blacklist" name="industry" />
-						<#if industryList ??>
-						<#list industryList as industry>
-							<#list zoneIndustryList as z>
-							<#if industry.id == (z.industryId?number)>
-								<li value="#{industry.id}">${industry.name}<input type='button' class='movedel'/></li>
+					<div class="industryDivClass" id="industryDivClass_one">
+						<span class="ul_title">全部行业</span>
+						<ul id="all_industry">
+							<#if notzoneIndustryList ??>
+								<#list notzoneIndustryList as z>
+									<input autocomplete="off" type="hidden" value="#{z.id}" title="${z.name}">
+									<li value="#{z.id}">${z.name}</li>
+								</#list>
 							</#if>
+						</ul>
+					</div>
+					<div class="industryDivClass">
+						<span class="ul_title" id="ul_title">黑名单行业</span>	
+						<ul id="blacklist">
+							<input type="hidden" value="" id="industryFatherName"/>
+							<input type="hidden" value="${industryStr!}" id="industry_blacklist" name="industry" />
+							<#if zoneIndustryList ??>
+							<#list zoneIndustryList as z>
+								<li value="#{z.industryId}" title="${z.industryFatherName}-${z.industryName}"><span id="industryName">${z.industryName}</span><input type='button' class='movedel'/></li>
 							</#list>
-						</#list>
-						</#if>
-					</ul>
+							</#if>
+						</ul>
+					</div>
 				</div>
 				<div class="input-group" id="blackDiv">
 					<label class="input-label-other"><span class="lbl-no"></span>网站黑名单:</label>

+ 30 - 0
src/main/webapp/WEB-INF/pages/operator/main/ad/zone/industry.ftl

@@ -0,0 +1,30 @@
+<@override name="head">	
+<link rel="stylesheet" href="${ctx}/assets/css/dialog_adGroup.css"/>
+<script type="text/javascript" src="${ctx}/assets/js/operator/zone_dialog.js"></script>
+</@override>	
+<@override name="body">
+<div id="dialog_content">
+	<form id="selectZoneIndustryForm" action="${ctx}/operator/main/ad/zone/getIndustry" method="post">
+		<input type="hidden" id="page" name="page" value="${pager.page}"/>
+		<input type="hidden" id="fatherId" name="fatherId" value="${fatherId!}"/>
+		<input type="hidden" id="industryId" name="industryId" value="${industryId!}"/>
+		<div id="selectZoneIndustryDiv" class="input-radiosDiv">
+			<#if industryList ??>
+			<#list industryList as industry>
+			<div class="single_div">
+				<input class="single_div_radio" name="industry" type="checkbox" value="${industry.id!}" title="${industry.name!}">
+				<span class="single_div_span" title="${industry.name!}">${industry.name!}</span>
+			</div>
+			</#list>
+			</#if>
+		</div>
+		<div id="pageDiv_dialog">
+			<#include "/common/pagination/simple.ftl"/>
+		</div>
+		<div id="btnDiv_dialog">
+			<input id="btn_formSubmit" class="industry_save" type="submit" value="保存"/>
+		<div>
+	</form>
+</div>
+</@override>
+<@extends name="/common/simple.ftl"/>

+ 36 - 2
src/main/webapp/assets/css/dialog_adGroup.css

@@ -4,7 +4,7 @@
 
 .input-radiosDiv .single_div{
 	float:left;
-	margin-bottom: 20px;
+	margin-bottom: 16px;
 }
 
 .input-radiosDiv .single_div input.single_div_radio{
@@ -15,7 +15,7 @@
 	float: left;
     margin-left: 5px;
     width: 100px;
-    height: 16px;
+    height: 20px;
     margin-right: 10px;
     overflow: hidden;
 }
@@ -45,4 +45,38 @@ table.tableFig th,table.tableFigOther th{
 
 table.tableFig td,table.tableFigOther td{
 	height:40px;
+}
+
+#btnDiv_dialog .industry_save{
+	float: right;
+	margin-left:10px;
+}
+
+#btnDiv_dialog .industry_change{
+	display:none;
+}
+
+#selectIndustryDiv .single_div{
+	width: 100px;
+    height: 41px;
+    line-height: 41px;
+    text-align: center;
+	cursor: pointer;
+	margin-right:6px;
+}
+
+#selectIndustryDiv .single_div input[type="radio"]{
+	display: none;
+}
+
+#selectIndustryDiv .single_div input[type="radio"] + label{
+	cursor: pointer;
+	width: 100%;
+	border:thin solid #b9c5d9;
+	display: inline-block;
+}
+
+#selectIndustryDiv .single_div input[type="radio"]:checked + label{
+	background-color: #4C637B;
+	color: #fff;
 }

+ 38 - 14
src/main/webapp/assets/css/zone_operator.css

@@ -87,15 +87,39 @@
 	background-color: #ffffff;
 }
 
-#industryDiv ul{
-	width:530px;
-	border-top: solid #d5dee8 1px;
-	border-left: solid #d5dee8 1px;
+#industryDiv{
+	margin-left:122px;
+}
+
+.industryDivClass{
+	width:550px;
+	border: solid #d5dee8 1px;
 	float:left;		
-	display:inline-block;	
+	display:inline-block;
+}
+
+#industryDivClass_one{
+	margin-right:20px;
+}
+
+.industryDivClass span.ul_title{
+	float:left;
+	width: 100%;
+	height: 50px;
+	line-height: 50px;
+	text-align: center;
+	border-right:solid #d5dee8 1px;
+	border-bottom:solid #d5dee8 1px;
 }
 
-#all_industry span,#all_industry li,#blacklist span,#blacklist li{
+#industryDiv ul{
+	width: 100%;
+	height: 300px;
+    overflow-x: hidden;
+    overflow-y: auto;
+}
+
+#all_industry li,#blacklist li{
 	float:left;
 	width: 19.81%;
 	height: 35px;
@@ -106,6 +130,14 @@
 
 }
 
+#blacklist span#industryName{
+	width:80%;
+	overflow:hidden;
+	float:left;
+	height:35px;
+}
+
+
 #all_industry span.ul_title,#blacklist span.ul_title{
 	width: 530px;
 	height: 60px;
@@ -114,18 +146,10 @@
 	padding:0px;
 }
 
-#all_industry{
-	margin-left:122px;
-}
-
 #all_industry li{
 	cursor: pointer;
 }
 
-#blacklist{
-	margin-left:20px;	
-}
-
 #blacklist  input.movedel,#web_blacklist  input.movedel{
 	float: right;
 	border:none;

+ 45 - 32
src/main/webapp/assets/js/operator/zone.js

@@ -202,16 +202,32 @@ $(document).ready(function(){
 	
 	 //选中右移
 	$("#all_industry li").live("click",function() {
-		var mychoice = this.innerHTML;
-		$(this).remove();
-	    var ul = document.getElementById("blacklist");
-		$(ul).append("<li value='"+$(this).attr("value")+"'>" + mychoice + "<input type='button' class='movedel'/></li>");
-		//将黑名单数据传入后端,格式“***,***,***”	
-   	    if($("#industry_blacklist").val() == ""){
-			$("#industry_blacklist").val($(this).attr("value"));
-		}else{
-			$("#industry_blacklist").val($("#industry_blacklist").val()+","+$(this).attr("value"));
-		}
+		var obj = $(this);
+		$("#industryFatherName").val(this.innerHTML);
+		$.post(ctx+'/operator/main/ad/zone/isExistIndustry',{fatherId:$(this).attr("value")},function(data){
+			
+			if(data == false){
+				layer.open({
+				    type: 2,
+					title: '选择行业',
+					shadeClose: false,
+					shade: 0.6,
+					fix:false,
+					area: ['680px','430px'],
+					content: [ctx+'/operator/main/ad/zone/getIndustry?fatherId='+obj.attr("value"), 'no']
+				});
+				return false;
+			}else{
+				var industryId = obj.attr("value");
+				$("#blacklist").append("<li value='"+industryId+"' title='"+obj.text()+"-"+obj.text()+"'><span id='industryName'>" + obj.text() + "</span><input type='button' class='movedel'/></li>");
+				if($("#industry_blacklist").val() == ""){
+					$("#industry_blacklist").val(industryId);//父层的元素
+				}else {
+					$("#industry_blacklist").val($("#industry_blacklist").val()+","+industryId);//父层的元素
+				}
+				return false;
+			}
+		});
 	});
 	
 	  //选中左移
@@ -219,8 +235,6 @@ $(document).ready(function(){
 		var mychoice = $(this).parents("li").text();
 		var mychoicevalue = $(this).parents("li").attr("value");
 		$(this).parents("li").remove();
-	    var ul = document.getElementById("all_industry");
-		$(ul).append("<li value="+mychoicevalue+">" + mychoice + "</li>");
 		//左移黑名单删除传值
 		var industryArr = $("#industry_blacklist").val().split(",");
 		for(var i=0;i<industryArr.length;i++){
@@ -244,35 +258,34 @@ $(document).ready(function(){
 
 	//添加全部
 	$('#add_all').live("click",function() {
-		var lis = $('#all_industry li');
-		var industry_blackname = ""; 
-		var len = lis.length;		
-		var ul = document.getElementById("blacklist");		
-		for(var i=0; i<len;i++){			
-			var mychoice = lis[i].innerHTML;
-			var mychoicevalue = lis[i].value;
-			lis[i].remove();
-			$(ul).append("<li value="+mychoicevalue+">" + mychoice + "<input type='button' class='movedel'/></li>");  		 
-			if($("#industry_blacklist").val() == ""){
-				$("#industry_blacklist").val(mychoicevalue);
-			}else{
-				$("#industry_blacklist").val($("#industry_blacklist").val()+","+mychoicevalue);
+		var url = ctx+"/operator/main/ad/zone/getAllIndustry";
+		var ul = document.getElementById("blacklist");
+		var industryId = "";
+		var list = $("#industry_blacklist").val();
+		$.getJSON( url, function(data) {
+			$.each( data, function( key, val ) {
+				if(list.indexOf(val.id) == -1){
+					industryId += val.id+",";
+				}
+				$(ul).append("<li value='"+val.id+"' title='"+val.fatherName+"-"+val.name+"'><span id='industryName'>" + val.name + "</span><input type='button' class='movedel'/></li>");
+			});
+		});
+		if(industryId != ""){
+			industryId = industryId.substring(0, industryId.length-1);
+			if(list == ""){
+				$("#industry_blacklist").val(industryId);
+			}else {
+				$("#industry_blacklist").val(list+","+industryId);
 			}
-    	}	
-    	
-    	//传值同步添加全部
-   	   // document.getElementById("industry_blacklist").value = industry_blackname;		
+		}
 	});	
 	
 	//清空全部
 	$('#clear_all').live("click",function() {
 		var lis = $('#blacklist li');		
 		var len = lis.length;		
-		var ul = document.getElementById("all_industry");		
 		for(var i=0; i<len;i++){			
-			var mychoice = $(lis[i]).text();
 			lis[i].remove();
-			$(ul).append("<li>" + mychoice +"</li>");			
 		}
    	    $("#industry_blacklist").val("");
 		//传值同步清空

+ 48 - 0
src/main/webapp/assets/js/operator/zone_dialog.js

@@ -0,0 +1,48 @@
+$(document).ready(function(){
+	var ctx = $("#ctx").val();//获取服务器地址
+	var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
+	
+	/***************************    选择行业    ***************************/
+	
+	$(".industry_save").click(function(){
+		var checkboxs = $("#selectZoneIndustryDiv input[type='checkbox']:checked");
+		var ul = parent.$("#blacklist");
+		var list = parent.$("#industry_blacklist").val();
+		var industryId = "";
+		checkboxs.each(function(){
+			var id = parseInt($(this).val());
+			if(list.indexOf(id) == -1){
+				industryId += id+",";
+				$(ul).append("<li value='"+id+"' title='"+parent.$("#industryFatherName").val()+"-"+$(this).attr("title")+"'><span id='industryName'>" + $(this).attr("title") + "</span><input type='button' class='movedel'/></li>");
+			}
+		});
+		if(industryId != ""){
+			industryId = industryId.substring(0, industryId.length-1);
+			if(list == ""){
+				parent.$("#industry_blacklist").val(industryId);//父层的元素
+			}else {
+				parent.$("#industry_blacklist").val(list+","+industryId);//父层的元素
+			}
+		}
+		var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
+		parent.layer.close(index);//再执行关闭
+	});
+	
+	$("#selectZoneIndustryDiv input[type='checkbox']").each(function(){
+		var obj = $(this);
+		var ids = parent.$("#industry_blacklist").val().split(",");
+		for(var i = 0,l=ids.length;i<l;i++){
+			if(obj.val() == ids[i]){
+				obj.attr('checked',true);
+			}
+		}
+	});
+
+	// 分页中超链接跳转
+	$('#selectZoneIndustryDiv .pagination ul li a[href]').click(function(){
+		var _page = $(this).attr('href').substr(1);
+		$('#selectZoneIndustryForm').find('input:hidden[name="page"]').val(_page);
+		$('#selectZoneIndustryForm').submit();
+	});
+
+});