| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <script>
- //所有子行业 map 根据 行业 分组
- var subIndustryMap = new Z.HashMap();
- <#for key : subIndustryMap.keySet()>
- subIndustryMap.put('${key}',${Jsons.toString(subIndustryMap.get(key))});
- </#for>
- //所有属性分类 map 根据 行业 分组
- var attributeCatMap = new Z.HashMap();
- <#for key : attributeCatMap.keySet()>
- attributeCatMap.put('${key}',${Jsons.toString(attributeCatMap.get(key))});
- </#for>
- //所有属性分类 map 根据 分类 分组
- var attributeMap = new Z.HashMap();
- <#for key : attributeMap.keySet()>
- attributeMap.put('${key}',${Jsons.toString(attributeMap.get(key))});
- </#for>
- var indIdarr = Z.AR.toArray("${indIdarr}", ",");
- var attrIdarr = Z.AR.toArray("${attrIdarr}", ",");
- function doLabelIdSet(type, attaid, btn)
- {
- if(type == "industry")
- {
- if(Z.AR.contains(indIdarr, attaid))
- {
- Z.AR.remove(indIdarr, attaid);
- Z(btn).removeClass("z-active");
- }
- else
- {
- indIdarr.push(attaid);
- Z(btn).addClass("z-active");
- }
- }
- else if (type == "attribute")
- {
- if (Z.AR.contains(attrIdarr, attaid))
- {
- Z.AR.remove(attrIdarr, attaid);
- Z(btn).removeClass("z-active");
- }
- else
- {
- attrIdarr.push(attaid);
- Z(btn).addClass("z-active");
- }
- }
- }
- function doIndustrySelect()
- {//选择行业
- var dialog = new Z.Dialog();
- dialog.title = "选择行业";
- dialog.url = "industrySelect.htm" ;
- dialog.width = 360;
- dialog.height = 400;
- dialog.fixed = true;
- dialog.scroll = true;
- dialog.execute();
- }
- var nativeIndustryId = '${works.getIndustryId()}';
- var nativeindIdarr = Z.AR.toArray("${indIdarr}", ",");
- var nativeattrIdarr = Z.AR.toArray("${attrIdarr}", ",");
- var selectIndustryId = nativeIndustryId;
- function doShowSubIndustry(industryId, industryName)
- {//显示子行业 industryId 父行业ID ,industryName父行业名
- Z("#industryId").val(industryName);
- selectIndustryId = industryId;
- //清空选中信息
- indIdarr = [];
- var subArr = subIndustryMap.get(""+industryId);
- var subListHtml = "";
- if(subArr != null && typeof(subArr) != "undefined" && subArr.length > 0)
- {
- Z.each(subArr, function(sub, i){
- var active = "";
- if(industryId == nativeIndustryId && Z.AR.contains(nativeindIdarr, ""+sub.industrySubId))
- {//如果切换回来 保存原来的选择
- active = "z-active";
- indIdarr.push(""+sub.industrySubId);
- }
- subListHtml += '<button name="subName" id="sub_'+sub.industrySubId+'" type="button" class="z-button z-large z-bordered z-blue-bd z-mg-r6 z-mg-t6 z-hover '+active+'" onclick="doLabelIdSet(\'industry\', \''+sub.industrySubId+'\',this)">'+sub.industrySubName+'</button>';
- });
- }
- Z("#subList").html(subListHtml);
-
-
- }
- function doShowSubAttribute(industryId, industryName)
- {//显示 行业 关联标签属性
-
- var attributeInfoHtml = "";
- //获取行业对应的所有分类
- var catList = attributeCatMap.get(""+industryId);
-
- //清空属性选中信息
- attrIdarr = [];
- if(typeof(catList) != "undefined" && catList.hasOwnProperty("length") && catList.length > 0)
- {
- attributeInfoHtml += '<table class="z-table z-bordered z-pd6">';
- Z.each(catList, function(cat, i){
- var trColor = (i%2 == 0) ? "#f3fdfc" : "";
- attributeInfoHtml += '<tr class="z-h40" bgcolor="'+trColor+'">';
- attributeInfoHtml += '<td width="10%">'+cat.attributeCatName+':</td>';
- attributeInfoHtml += '<td width="*">';
-
- //获取 行业下分类 下的 属性
- var attributeList = attributeMap.get(""+cat.attributeCatId);
- if(typeof(attributeList) != "undefined" && attributeList.hasOwnProperty("length") && attributeList.length > 0)
- {
- Z.each(attributeList, function(attr, j){
- var active = "";
- if(industryId == nativeIndustryId && Z.AR.contains(nativeattrIdarr, ""+attr.attributeId))
- {//如果切换回来 保存原来的选择
- active = "z-active";
- attrIdarr.push(""+attr.attributeId);
- }
-
- attributeInfoHtml += '<button name="attrId" id="sub_'+attr.attributeId+'" type="button" class="z-button z-large z-bordered z-blue-bd z-mg-r6 z-mg-t6 z-hover '+active+'" onclick="doLabelIdSet(\'attribute\', \''+attr.attributeId+'\',this)">'+attr.attributeName+'</button>';
- });
- }
- attributeInfoHtml += '</td>';
- attributeInfoHtml += '</tr>';
- });
- attributeInfoHtml += '</table>';
- }
-
- Z("#attributeInfo").html(attributeInfoHtml);
- }
- function doLabelRelation()
- {//提交关联操作
-
- if(indIdarr.length == 0)
- {
- Z.alert("请选择一个或多个子行业");
- return;
- }
-
- if(attrIdarr.length == 0)
- {
- Z.alert("请选择 一个或多个属性");
- return;
- }
-
- var ajax = new Z.Ajax();
- ajax.setClassName("WorksPresenter");
- ajax.setMethodName("doWorksLabelExec");
- ajax.addParam('${works.getWorksId()}');
- ajax.addParam('${works.getPrdTypeId()}');
- ajax.addParam(selectIndustryId);
- ajax.addParam(Z.AR.toString(indIdarr, ","));
- ajax.addParam(Z.AR.toString(attrIdarr, ","));
- ajax.setFailureAlert();
- ajax.setSuccess(function(){
- Z.success("关联成功", function(){parent.location.reload();})
- });
-
- ajax.execute();
- }
- </script>
- <div class="z-w100p z-overflow-x-hidden z-overflow-y-scroll" style="height:516px" >
- ${zhiqim_manager_title("关联标签行业")}
- <table class="z-table z-bordered z-pd6">
- <tr class="z-h40" bgcolor="${oddColor}">
- <td width="10%" >产品类型:</td>
- <td width="*"> ${Global.get(ProductTypeCache.class).getName(works.getPrdTypeId())}</td>
- </tr>
- <tr class="z-h40" bgcolor="#FFFFFF">
- <td>标签行业:</td>
- <td><input id="industryId" name="industryId" class="z-input fi-bd-none fi-shadow-none z-blue z-w120 " type="text" value="${Global.get(DesignIndustryCache.class).getIndustryName(works.getIndustryId())}" readonly> <button class="z-button z-blue" onclick="doIndustrySelect();">修改行业</button></td>
- </tr>
- <tr class="z-h40" bgcolor="${oddColor}">
- <td>标签子行业:</td>
- <td id="subList">
- <#for item : inSubList>
- <button name="subName" id="sub_${item.getIndustrySubId()}" type="button" class="z-button z-large z-bordered z-mg-r6 z-mg-t6 z-blue-bd z-hover <#if subsList.contains(item.getIndustrySubId()+"")>z-active</#if>" onclick="doLabelIdSet('industry', '${item.getIndustrySubId()}',this)">${item.getIndustrySubName()}</button>
- </#for>
- </td>
- </tr>
- </table><br>
- ${zhiqim_manager_title("关联标签属性")}
- <div id ="attributeInfo">
- <table class="z-table z-bordered z-pd6">
- <#for item : attrCatList>
- <tr class="z-h40" bgcolor="<#if (item_index%2)==0>${oddColor}</#if>">
- <td width="10%">${item.getAttributeCatName()}:</td>
- <td width="*">
- <#for aitem : map.get(item.getAttributeCatId())>
- <button name="attrId" id="sub_${aitem.getAttributeId()}" type="button" class="z-button z-large z-mg-r6 z-mg-t6 z-bordered z-blue-bd z-hover <#if attrList.contains(aitem.getAttributeId()+"")>z-active</#if>" onclick="Z.EL.toggleClass(this, 'z-active');doLabelIdSet('attribute', '${aitem.getAttributeId()}')">${aitem.getAttributeName()}</button>
- </#for>
- </td>
- </tr>
- </#for>
- </table>
- </div>
- <div class="z-absolute z-w100p z-h80 z-text-center z-bg-gray" style="bottom:0;left:0">
- <button class="z-button ${styleColor} z-w150 z-h50 z-mg-t15 z-mg-l5 z-mg-l20 fi-px22" type="button" onclick="doLabelRelation();">提交</button>
- <button class="z-button z-w150 z-h50 z-mg-t15 z-mg-l5 z-mg-l20 fi-px22" type="button" onclick="parent.location.reload();">关闭</button>
- </div>
- </div>
|