| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- ${Scripts.src(zhiqim_uploadlarge.js)}
- <script>
- //产品类型
- var prdTypeMap = new Z.HashMap();
- <#for key : prdMap.keySet()>
- prdTypeMap.put('${key}', '${prdMap.get(key)}');
- </#for>
- //所有子行业 map 根据 行业 分组
- var subIndustryMap = new Z.HashMap();
- <#for key : subIndustryMap.keySet()>
- subIndustryMap.put('${key}',${Jsons.toString(subIndustryMap.get(key))});
- </#for>
- var cdrUpload,endUpload;
- var prdTypeId = 2;
- var industryId = -1;
- var industryName = "";
- var indIdarr = Z.AR.toArray("", ",");
- var destDir = "/作品库/彩页/";
- var cdrPath = destDir + "设计文件" + "/" + '${dateDir}';
- var pdfPath = destDir + "印刷文件" + "/" + '${dateDir}';
- var thumPath = destDir + "缩略图" + "/" + '${dateDir}';
- var keywordName;
- var worksName;
- Z.onload(function()
- {//初始化上传组件
- initHTML5Uploader();
- initHTML5Uploader1();
- });
- var items;
- function initHTML5Uploader()
- {
- cdrUpload = new Z.UploadLarge();
- cdrUpload.elem = "FUpload_DESIGN";
- cdrUpload.fileMd5Target = 1;
- cdrUpload.fileCopy = true;
- cdrUpload.maxSizeMiB = 50;
- cdrUpload.contextPath = "${context.getContextPath()}";
- cdrUpload.onSelected = function(fileName, fileLength)
- {
- if (prdTypeId == -1)
- {
- Z.alert("请选择文件上传类型");
- return false;
- }
-
- if (industryId == -1)
- {
- Z.alert("请选择文件上传行业");
- return false;
- }
-
- if(indIdarr.length == 0)
- {
- Z.alert("请选择一个或多个子行业");
- return false;
- }
-
- var ind = fileName.lastIndexOf(".");
- if(ind < 0)
- {
- Z.alert("不合法的文件名格式");
- return false;
- }
-
- worksName = Z("#worksName").val();
- if (Z.V.isEmpty(worksName))
- {
- Z.alert("请输入作品名称");
- return false;
- }
-
- keywordName = Z("#keywordName").val();
- if (Z.V.isEmpty(keywordName))
- {
- Z.alert("请输入作品关键字");
- return false;
- }
-
- var ext = fileName.substring(fileName.lastIndexOf(".")+1);
- if (ext != "cdr" && ext != "CDR")
- {
- Z.alert("设计文件文件必须是cdr文件");
- return false;
- }
-
- //设置上传路径
- cdrUpload.setFileDir(cdrPath);
- };
- cdrUpload.onCompleted = function(fileId){
- var ajax = new Z.Ajax();
- ajax.setClassName("WorksPresenter");
- ajax.setMethodName("doWorksDesignLoad");
- ajax.addParam(fileId);
- ajax.addParam(prdTypeId);
- ajax.addParam(industryId);
- ajax.addParam(keywordName + " " + industryName);
- ajax.addParam(worksName);
- ajax.addParam(Z.AR.toString(indIdarr, ","));
- ajax.setFailure(function(){
- cdrUpload.$delete.click();
- Z.failure(this.responseText);
- });
- ajax.setSuccess(function(){
- items = this.responseText;
- });
- ajax.setLoading(document)
- ajax.execute();
- };
-
- cdrUpload.execute();
- }
- function initHTML5Uploader1()
- {
- endUpload = new Z.UploadLarge();
- endUpload.elem = "FUpload_END";
- endUpload.fileMd5Target = 1;
- endUpload.maxSizeMiB = 10;
- endUpload.contextPath = "${context.getContextPath()}";
- endUpload.onSelected = function(fileName, fileLength)
- {
- if(prdTypeId == -1)
- {
- Z.alert("请选择文件上传类型");
- return false;
- }
-
- if(industryId == -1)
- {
- Z.alert("请选择文件上传行业");
- return false;
- }
-
- if(indIdarr.length == 0)
- {
- Z.alert("请选择一个或多个子行业");
- return false;
- }
-
- if(items == -1 || items == null || items == "")
- {
- Z.alert("请先上传设计文件");
- return false;
- }
- var ind = fileName.lastIndexOf(".");
- if(ind < 0)
- {
- Z.alert("不合法的文件名格式");
- return false;
- }
-
- var worksName = Z("#worksName").val();
- if (Z.V.isEmpty(worksName))
- {
- Z.alert("请输入作品名称");
- return false;
- }
-
- var keywordName = Z("#keywordName").val();
- if (Z.V.isEmpty(keywordName))
- {
- Z.alert("请输入作品关键字");
- return false;
- }
-
- var ext = fileName.substring(fileName.lastIndexOf(".")+1);
- if(ext != "pdf" && ext != "PDF")
- {
- Z.alert("印刷文件必须是pdf文件");
- return false;
- }
-
- //设置上传路径
- endUpload.setFileDir(pdfPath);
- };
- endUpload.onCompleted = function(fileId){
- var ajax = new Z.Ajax();
- ajax.setClassName("WorksPresenter");
- ajax.setMethodName("doWorksEndLoad");
- ajax.addParam(fileId);
- ajax.addParam(items);
- ajax.addParam(thumPath);
- ajax.setFailure(function(){
- endUpload.$delete.click();
- Z.failure(this.responseText);
- });
- ajax.setSuccess(function(){
- Z.success("作品添加成功", function(){parent.location.reload();Z.Dialog.close();});
- });
- ajax.setLoading(document);
- ajax.execute();
- };
-
- endUpload.execute();
- }
- //显示子行业 industryId 父行业ID
- function doSelectorInd(value)
- {
- industryId = value;
- industryName = Z("#ind_"+value).text();
- var subArr = subIndustryMap.get(""+value);
- var subListHtml = "";
- if(subArr != null && typeof(subArr) != "undefined" && subArr.length > 0)
- {
- Z.each(subArr, function(sub, i){
- subListHtml += '<button name="subName" id="subid_'+sub.industrySubId+'" type="button" class="z-button z-large z-bordered z-mg-r6 z-mg-t6 z-blue-bd z-hover" onclick="doLabelIdSet(\''+sub.industrySubId+'\',this)">'+sub.industrySubName+'</button>';
- });
- }
- Z("#subList").html(subListHtml);
- }
- //子行业选择
- function doLabelIdSet(attaid, btn)
- {
- 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");
- }
- }
- </script>
- <table class="z-table z-bordered z-pd10 z-bg-white">
- <tr height="20">
- <td width="30%">作品类型选择:</td>
- <td width="70%">
- <button id="nav_2" name="prdType" data-options="group:prdType" class="z-button z-large z-bordered-bg z-blue-bd z-blue-bg fi-mg3 z-active" >彩页</button>
- </td>
- </tr>
- <tr height="80">
- <td width="30%">作品行业选择:</td>
- <td width="70%">
- <#for item : indList>
- <button id="ind_${item.getIndustryId()}" type="button" name="ind_${item.getIndustryId()}" data-options="group:industry" class="z-button z-large z-bordered-bg z-blue-bd z-blue-bg fi-mg3" onclick="doSelectorInd('${item.getIndustryId()}')">${item.getIndustryName()}</button>
- </#for>
- </td>
- </tr>
- <tr height="80">
- <td width="30%">子行业选择:</td>
- <td width="70%" 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" onclick="doLabelIdSet('${item.getIndustrySubId()}',this)">${item.getIndustrySubName()}</button>
- </#for>
- </td>
- </tr>
- <tr height="20">
- <td width="30%">作品名称:</td>
- <td width="70%">
- <input id="worksName" name="worksName" class="z-input z-w300 ${zmr_color_class}" value="" maxlength="20">
- </td>
- </tr>
- <tr height="20">
- <td width="30%">作品关键字:</td>
- <td width="70%">
- <input id="keywordName" name="keywordName" class="z-input z-w300 ${zmr_color_class}" value="" maxlength="20"> <font color="red">用于作品搜索,多组关键字用<b>空格</b>隔开</font>
- </td>
- </tr>
- <tr height="80">
- <td width="30%">设计文件上传(默认不断点续传):</td>
- <td width="70%"><button id="FUpload_DESIGN" type="button" class="z-button z-w200 z-blue">HTML5上传</button> <font color="red">必须是cdr文件</font></td>
- </tr>
- <tr height="80">
- <td width="30%">印刷文件上传(默认不断点续传):</td>
- <td width="70%"><button id="FUpload_END" class="z-button z-w200 z-blue">HTML5上传</button> <font color="red">必须是pdf文件</font></td>
- </tr>
- </table>
|