Файли
2025-02-20 14:59:35 +08:00

207 рядки
7.9 KiB
Plaintext
Неформатований Постійне посилання Анотація Історія

Цей файл містить неоднозначні символи Юнікоду
Цей файл містить символи Юнікоду, які можна сплутати з іншими символами. Якщо ви вважаєте, що це зроблено навмисно, можете сміливо ігнорувати це попередження. Щоб показати їх, скористайтеся кнопкою Escape.
<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 = '${template.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 != null && 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 doTemplateLabelExec()
{//提交关联操作
if (indIdarr.length == 0)
{
Z.alert("请选择一个或多个子行业");
return;
}
if (attrIdarr.length == 0)
{
Z.alert("请选择 一个或多个属性");
return;
}
var ajax = new Z.Ajax();
ajax.setClassName("LabelPresenter");
ajax.setMethodName("doTemplateLabelRelation");
ajax.addParam("mediaId", '${template.getMediaId()}');
ajax.addParam("industryId", selectIndustryId);
ajax.addParam("industrySubIds", Z.AR.toString(indIdarr, ","));
ajax.addParam("attributeIds", 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" >
<table class="z-table z-bordered z-pd6">
<tr class="z-h40" bgcolor="${oddColor}">
<td width="10%" >产品类型:</td>
<td width="*"> ${DesignTypeDao.name(template.getTypeId())}</td>
</tr>
<tr class="z-h40" bgcolor="#FFFFFF">
<td>行业:</td>
<td><input name="industryId" id="industryId" class="z-input zi-bd-none zi-shadow-none z-blue z-w120 " type="text" value="${Global.get(DesignIndustryCache.class).getIndustryName(template.getIndustryId())}" readonly>&nbsp;&nbsp;<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 ${zmr_color_class} z-w150 z-h50 z-mg-t15 z-mg-l5 z-mg-l20 zi-px22" type="button" onclick="doTemplateLabelExec();">提交</button>
<button class="z-button z-w150 z-h50 z-mg-t15 z-mg-l5 z-mg-l20 zi-px22" type="button" onclick="parent.location.reload();">关闭</button>
</div>
</div>