Files
ziqim/Yangcai365_web/manage/zview/template/templateParam.zml
T
2025-02-20 14:59:35 +08:00

200 rivejä
7.1 KiB
Plaintext

<script>
var paramStrs;
Z.onload(function(){
paramStrs = '${paramStr}';
if (paramStrs != "")
doSelPrdType(${works.getDesignType()});
});
function doTemplateParam()
{
var worksId = '${works.getWorksId()}';
var industryId = '${works.getIndustryId()}';
var typeId = '${works.getDesignType()}';
var designer = '${operatorCode}';
var sizes = Z("input[name=sizes]:checked").val();
if ("userDefined" == sizes)
{
var width = Z("input[name=width]").val();
var height = Z("input[name=height]").val();
iZ(width <=0 || height <= 0)
{
Z.alert("请输入自定义尺寸");
return;
}
}
sizes = sizes.replace("X", "x");
var arr = sizes.split("x");
var prdPageId;
var prdSizeId;
var totalPage;
var paramJson;
if (paramStrs == "")
{
prdPageId = '${works.getPrdPageId()}';
prdSizeId = '${works.getPrdSizeId()}';
totalPage = '${Global.get(PrdPageCache.class).get(works.getPrdPageId()).getPrdPageValue()}';
Z("input[name=width]").val(arr[0]);
Z("input[name=height]").val(arr[1]);
Z("input[name=totalPage]").val(totalPage);
Z("input[name=paramCat]").val(typeId);
paramJson = "{\"designer\":" + designer + ",\"worksId\":" + worksId + ",\"industryId\":" + industryId + ",\"typeId\":" + typeId + ",\"prdPageId\":" + prdPageId + ",\"prdSizeId\":" + prdSizeId + "}";
}
else
{
prdPageId = Z("input[name=prdPageId]:checked").val();
prdSizeId = Z("input[name=prdSizeId]:checked").val();
totalPage = Z("input[name=totalPage]").val();
Z("input[name=totalPage]").val(totalPage);
paramJson = "{\"designer\":" + designer + ",\"typeId\":" + typeId + ",\"prdPageId\":" + prdPageId + ",\"prdSizeId\":" + prdSizeId + "}";
}
if (Z.V.isEmpty(typeId) || Z.V.isEmpty(prdPageId) || Z.V.isEmpty(prdSizeId) || Z.V.isEmpty(sizes))
{
Z.alert("请选择类型、面数、尺寸、大小等");
return;
}
var form = document.theForm;
Z("#paramJson").val(paramJson);
Z("#paramCat").val(typeId);
form.submit();
//window.open("/mediaDesign.htm?dpi=300"+"&width="+arr[0] + "&height=" +arr[1] + "&totalPage=" + totalPage + "&paramCat=" + typeId + "&paramJson={\"designer\":" + designer + ",\"worksId\":" + worksId + ",\"industryId\":" + industryId + ",\"typeId\":" + typeId + ",\"prdPageId\":" + prdPageId + ",\"prdSizeId\":" + prdSizeId + "}");
}
function doSelPrdType(typeId)
{//选择类型
var ajax = new Z.Ajax();
ajax.setClassName("MediaSelectParamAction");
ajax.setMethodName("doSelPrdType");
ajax.addParam("typeId", typeId);
ajax.setFailureAlert();
ajax.setSuccess(function(){
Z("#result").htmlc(this.responseText);
Z("#sizeCont").html('');
//非名片类,出血默认为3mm
iZ(typeId != 1)
Z("input[name=bleedSize]").val("3");
});
ajax.setLoading("result");
ajax.execute();
}
function doSelPrdSize(prdSizeId)
{//选择尺寸
var ajax = new Z.Ajax();
ajax.setClassName("MediaSelectParamAction");
ajax.setMethodName("doSelPrdSize");
ajax.addParam("prdSizeId", prdSizeId);
ajax.setFailureAlert();
ajax.setSuccess(function(){
var obj = Z.J.toObject(this.responseText);
var html = '';
for(var i=0;i<obj.length;i++)
{
html += '<input type="radio" name="sizes" data-role="z-radio" data-class="z-blue z-large" value="' + obj[i] + '" class="z-mg-r3" <#if item_index == 0>checked</#if> onclick="javascript:doCaclSize();"><span class="z-mg-r3">' + obj[i] + '</span>';
}
Z("#sizeCont").htmlc(html);
});
ajax.execute();
}
function doSelPrdPage(value)
{//选择面数
Z("#totalPage").val(value);
}
function doCaclSize()
{//选择具体大小
var sizes = Z.FM.getChecked("sizes", "");
if (Z.V.isEmpty(sizes))
{
Z.alert("请选择具体尺寸");
return;
}
if ("userDefined" == sizes)
{//自定义
Z("input[name=width]").removeAttr("readonly");
Z("input[name=height]").removeAttr("readonly");
return;
}
else
{
Z("input[name=width]").attr("readonly", true);
Z("input[name=height]").attr("readonly", true);
sizes = sizes.replace("X", "x");
var arr = sizes.split("x");
Z("input[name=width]").val(arr[0].trim());
Z("input[name=height]").val(arr[1].trim());
}
}
</script>
<div class="content">
<form id="theForm" name="theForm" action="/zhiqimMediaEditor/mediaDesign.htm" method="POST" target="_blank">
<input type="hidden" name="dpi" id="dpi" value="300">
<input type="hidden" name="paramCat" id="paramCat" value="">
<input type="hidden" name="totalPage" id="totalPage" value="1">
<input type="hidden" name="bleedSize" id="bleedSize" value="2">
<input type="hidden" name="createMode" id="createMode" value="0">
<input type="hidden" name="paramJson" id="paramJson" value="">
<#if ZmrPathRule.check(request, "/templateSizeModify.htm")>
<input type="hidden" name="isModify" id="isModify" value="true">
<#else>
<input type="hidden" name="isModify" id="isModify" value="false">
</#if>
<table class="z-table z-pd6 z-text-center">
<tr class="z-h50">
<td width="100">产品类型:</td>
<td width="*%" align="left">${Global.get(ProductTypeCache.class).getName(works.getDesignType())}</td>
</tr>
<#if Validates.isNotEmpty(paramStr)>
<tbody id="result"></tbody>
<tr class="z-h50">
<td>设计尺寸:</td>
<td align="left">
<span class="z-w100p" id="sizeCont"></span>
<span class="z-w200" >
<input type="radio" name="sizes" data-role="z-radio" data-class="z-blue z-large" value="userDefined" class="z-mg-r3" onclick="doCaclSize();"><span>自定义&nbsp;&nbsp;</span>
<input type="text" name="width" class="z-input z-w70 ${zmr_color_class}" value="" class="z-mg-r3" maxlength="6" placeholder="长" data-options="type:Integer;">&nbsp;X&nbsp;
<input type="text" name="height" class="z-input z-w70 ${zmr_color_class}" value="" class="z-mg-r3" maxlength="6" placeholder="宽" data-options="type:Integer;">&nbsp;mm
</span>
</td>
</tr>
<#else>
<tr class="z-h50">
<td>面数:</td>
<td align="left">${Global.get(PrdPageCache.class).getName(works.getPrdPageId())}</td>
</tr>
<tr class="z-h50">
<td>成品尺寸:</td>
<td align="left">${Global.get(PrdSizeCache.class).getName(works.getPrdSizeId())}</td>
</tr>
<tr class="z-h50">
<td>设计尺寸:</td>
<td align="left">
<#for item : strList>
<input type="radio" name="sizes" data-role="z-radio" data-class="z-blue" value="${item}" class="z-mg-r3" <#if item_index == 0>checked</#if>><span>${item}</span>
</#for>
</td>
</tr>
</#if>
<tr class="z-h50">
<td colspan="2"><button type="button" class="z-button z-large z-w100 z-blue" onclick="doTemplateParam();">前往设计</button><button type="button" class="z-button z-large z-w100 z-mg-l10" onclick="parent.Z.Dialog.close();">关闭</button></td>
</tr>
</table>
</form>
</div>