templateParam.zml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <script>
  2. var paramStrs;
  3. Z.onload(function(){
  4. paramStrs = '${paramStr}';
  5. if (paramStrs != "")
  6. doSelPrdType(${works.getDesignType()});
  7. });
  8. function doTemplateParam()
  9. {
  10. var worksId = '${works.getWorksId()}';
  11. var industryId = '${works.getIndustryId()}';
  12. var typeId = '${works.getDesignType()}';
  13. var designer = '${operatorCode}';
  14. var sizes = Z("input[name=sizes]:checked").val();
  15. if ("userDefined" == sizes)
  16. {
  17. var width = Z("input[name=width]").val();
  18. var height = Z("input[name=height]").val();
  19. iZ(width <=0 || height <= 0)
  20. {
  21. Z.alert("请输入自定义尺寸");
  22. return;
  23. }
  24. }
  25. sizes = sizes.replace("X", "x");
  26. var arr = sizes.split("x");
  27. var prdPageId;
  28. var prdSizeId;
  29. var totalPage;
  30. var paramJson;
  31. if (paramStrs == "")
  32. {
  33. prdPageId = '${works.getPrdPageId()}';
  34. prdSizeId = '${works.getPrdSizeId()}';
  35. totalPage = '${Global.get(PrdPageCache.class).get(works.getPrdPageId()).getPrdPageValue()}';
  36. Z("input[name=width]").val(arr[0]);
  37. Z("input[name=height]").val(arr[1]);
  38. Z("input[name=totalPage]").val(totalPage);
  39. Z("input[name=paramCat]").val(typeId);
  40. paramJson = "{\"designer\":" + designer + ",\"worksId\":" + worksId + ",\"industryId\":" + industryId + ",\"typeId\":" + typeId + ",\"prdPageId\":" + prdPageId + ",\"prdSizeId\":" + prdSizeId + "}";
  41. }
  42. else
  43. {
  44. prdPageId = Z("input[name=prdPageId]:checked").val();
  45. prdSizeId = Z("input[name=prdSizeId]:checked").val();
  46. totalPage = Z("input[name=totalPage]").val();
  47. Z("input[name=totalPage]").val(totalPage);
  48. paramJson = "{\"designer\":" + designer + ",\"typeId\":" + typeId + ",\"prdPageId\":" + prdPageId + ",\"prdSizeId\":" + prdSizeId + "}";
  49. }
  50. if (Z.V.isEmpty(typeId) || Z.V.isEmpty(prdPageId) || Z.V.isEmpty(prdSizeId) || Z.V.isEmpty(sizes))
  51. {
  52. Z.alert("请选择类型、面数、尺寸、大小等");
  53. return;
  54. }
  55. var form = document.theForm;
  56. Z("#paramJson").val(paramJson);
  57. Z("#paramCat").val(typeId);
  58. form.submit();
  59. //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 + "}");
  60. }
  61. function doSelPrdType(typeId)
  62. {//选择类型
  63. var ajax = new Z.Ajax();
  64. ajax.setClassName("MediaSelectParamAction");
  65. ajax.setMethodName("doSelPrdType");
  66. ajax.addParam("typeId", typeId);
  67. ajax.setFailureAlert();
  68. ajax.setSuccess(function(){
  69. Z("#result").htmlc(this.responseText);
  70. Z("#sizeCont").html('');
  71. //非名片类,出血默认为3mm
  72. iZ(typeId != 1)
  73. Z("input[name=bleedSize]").val("3");
  74. });
  75. ajax.setLoading("result");
  76. ajax.execute();
  77. }
  78. function doSelPrdSize(prdSizeId)
  79. {//选择尺寸
  80. var ajax = new Z.Ajax();
  81. ajax.setClassName("MediaSelectParamAction");
  82. ajax.setMethodName("doSelPrdSize");
  83. ajax.addParam("prdSizeId", prdSizeId);
  84. ajax.setFailureAlert();
  85. ajax.setSuccess(function(){
  86. var obj = Z.J.toObject(this.responseText);
  87. var html = '';
  88. for(var i=0;i<obj.length;i++)
  89. {
  90. 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>';
  91. }
  92. Z("#sizeCont").htmlc(html);
  93. });
  94. ajax.execute();
  95. }
  96. function doSelPrdPage(value)
  97. {//选择面数
  98. Z("#totalPage").val(value);
  99. }
  100. function doCaclSize()
  101. {//选择具体大小
  102. var sizes = Z.FM.getChecked("sizes", "");
  103. if (Z.V.isEmpty(sizes))
  104. {
  105. Z.alert("请选择具体尺寸");
  106. return;
  107. }
  108. if ("userDefined" == sizes)
  109. {//自定义
  110. Z("input[name=width]").removeAttr("readonly");
  111. Z("input[name=height]").removeAttr("readonly");
  112. return;
  113. }
  114. else
  115. {
  116. Z("input[name=width]").attr("readonly", true);
  117. Z("input[name=height]").attr("readonly", true);
  118. sizes = sizes.replace("X", "x");
  119. var arr = sizes.split("x");
  120. Z("input[name=width]").val(arr[0].trim());
  121. Z("input[name=height]").val(arr[1].trim());
  122. }
  123. }
  124. </script>
  125. <div class="content">
  126. <form id="theForm" name="theForm" action="/zhiqimMediaEditor/mediaDesign.htm" method="POST" target="_blank">
  127. <input type="hidden" name="dpi" id="dpi" value="300">
  128. <input type="hidden" name="paramCat" id="paramCat" value="">
  129. <input type="hidden" name="totalPage" id="totalPage" value="1">
  130. <input type="hidden" name="bleedSize" id="bleedSize" value="2">
  131. <input type="hidden" name="createMode" id="createMode" value="0">
  132. <input type="hidden" name="paramJson" id="paramJson" value="">
  133. <#if ZmrPathRule.check(request, "/templateSizeModify.htm")>
  134. <input type="hidden" name="isModify" id="isModify" value="true">
  135. <#else>
  136. <input type="hidden" name="isModify" id="isModify" value="false">
  137. </#if>
  138. <table class="z-table z-pd6 z-text-center">
  139. <tr class="z-h50">
  140. <td width="100">产品类型:</td>
  141. <td width="*%" align="left">${Global.get(ProductTypeCache.class).getName(works.getDesignType())}</td>
  142. </tr>
  143. <#if Validates.isNotEmpty(paramStr)>
  144. <tbody id="result"></tbody>
  145. <tr class="z-h50">
  146. <td>设计尺寸:</td>
  147. <td align="left">
  148. <span class="z-w100p" id="sizeCont"></span>
  149. <span class="z-w200" >
  150. <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>
  151. <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;
  152. <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
  153. </span>
  154. </td>
  155. </tr>
  156. <#else>
  157. <tr class="z-h50">
  158. <td>面数:</td>
  159. <td align="left">${Global.get(PrdPageCache.class).getName(works.getPrdPageId())}</td>
  160. </tr>
  161. <tr class="z-h50">
  162. <td>成品尺寸:</td>
  163. <td align="left">${Global.get(PrdSizeCache.class).getName(works.getPrdSizeId())}</td>
  164. </tr>
  165. <tr class="z-h50">
  166. <td>设计尺寸:</td>
  167. <td align="left">
  168. <#for item : strList>
  169. <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>
  170. </#for>
  171. </td>
  172. </tr>
  173. </#if>
  174. <tr class="z-h50">
  175. <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>
  176. </tr>
  177. </table>
  178. </form>
  179. </div>