Fichiers
ziqim/Yangcai365_design/manage/zview/zhiqim_manager/attaFileMaterials.zml
T
2025-02-20 14:58:55 +08:00

407 lignes
13 KiB
Plaintext
Brut Annotations Historique

Ce fichier contient des caractères Unicode ambigus.
Ce fichier contient des caractères Unicode qui peuvent être confondus avec d'autres caractères. Si vous pensez que c'est intentionnel, vous pouvez ignorer cet avertissement. Utilisez le bouton Échappe pour les dévoiler.
${Styles.htmlOverflowYAuto()}
${Scripts.src(zhiqim_uploadlarge.js)}
<script>
<!--
var attaList = ${attaList};
Z.onload(function()
{
for(var i=0; i<attaList.length; i++)
{
var obj = attaList[i];
if ("file" == obj.type && obj.isAdd)
{
initUploader(obj.id, obj.savePath);
}
if ("file" == obj.type)
{
Z("#fileType_Text_"+obj.id).click();//默认选中
}
}
});
function initUploader(fileType, path)
{//文件上传
var designId = Z("#designId").val();
if (Z.Validates.isEmpty(designId))
return;
var upload = new Z.UploadLarge();
upload.elem = "upload_" + fileType;
upload.showResult = false;
upload.fileMd5Target = 1;
upload.fileCopy = true;
upload.maxSizeMiB = 500;
upload.contextPath = "${context.getContextPath()}";
upload.setFileDir(path);
upload.onSelected = function(fileName, fileLength)
{
var ajax = new Z.Ajax();
ajax.setSync();
ajax.setClassName("UploadFilePresenter");
ajax.setMethodName("doCheckFileName");
ajax.addParam(designId);
ajax.addParam(fileType);
if ("EndFile" != fileType)
ajax.addParam(designId + "-" + fileName);
else
ajax.addParam(fileName);
ajax.execute();
if (ajax.responseStatus != 0)
{
Z.alert(ajax.responseText);
return false;
}
if ("EndFile" != fileType)
this.setFileName(designId + "-" + fileName);
else
this.setFileName(fileName);
};
upload.onCompleted = function(fileId){
var ajax = new Z.Ajax();
ajax.setClassName("UploadFilePresenter");
ajax.setMethodName("doUplaodFile");
ajax.addParam(designId);
ajax.addParam(fileId);
ajax.addParam(fileType);
ajax.setFailureAlert();
ajax.setSuccess(function()
{
var dataMap = Z.J.toObject(this.responseText);
Z("#div_" + fileType).html("");//清除;
var html = "";
var data_color = "${zmr_color_class}";
var items = dataMap.attaList;
for(var i=0;i<items.length;i++)
{
/**/
var obj = items[i];
html += '<div id="div_checkbox_'+obj.attaId+'" class="z-text-ellipsis z-w300 z-pointer"';
if ('EndFile'== fileType)
html += 'onclick="showThumImg(\''+obj.attaId+'\',\''+obj.fileType+'\')"';
html += ' title="'+obj.fileName+'">';
html += "<input name='str_" + fileType +"' type='checkbox' value ='" + obj.attaId +"' class='z-checkbox' data-role='z-checkbox' data-class='"+data_color+"'/>";
html += '<span class="z-pd6" onclick="Z(this).parent().find(\'zcover>i.z-checkbox\').click()">'+obj.fileName+'</span><br>';
html += '</div>';
}
Z("#div_" + fileType).htmlc(html);
});
ajax.setLoading(document);
ajax.execute();
};
upload.execute();
}
function doDownFile(type)
{//文件下载
var designId = Z("#designId").val();
if (Z.V.isEmpty(designId))
{
parent.Z.alert("请选择一条订单");
return;
}
var attaIds = Z.FM.getCheckBoxValue("str_" + type, "");
if (Z.V.isEmpty(attaIds))
{
parent.Z.alert("请选择需要下载的文件");
return false;
}
if(${checkeds}){
parent.Z.alert("选中多条订单不支持下载,请重新选择");
return;
}
var delType_desabled = Z("#delete_"+type).attr("disabled");
var downloadType_desabled = Z("#download_"+type).attr("disabled");
Z("#delete_"+type).attr("disabled", true);
Z("#download_"+type).attr("disabled", true);
var ajax = new Z.Ajax();
ajax.setClassName("UploadFilePresenter");
ajax.setMethodName("doDownloadFile");
ajax.addParam("attaId", attaIds);
ajax.setFailure(function(){
Z("#delete_"+type).attr("disabled", delType_desabled);
Z("#download_"+type).attr("disabled", downloadType_desabled);
Z.alert(this.responseText,null, {width:320});
});
ajax.setSuccess(function(){
Z("#delete_"+type).attr("disabled", delType_desabled);
Z("#download_"+type).attr("disabled", downloadType_desabled);
var prefix = Z.l.protocol + "//" + Z.l.host ;
Z.L.href(prefix+"/downFile.htm?attaId=" + attaIds, zCallFrame);
var mainFrame = parent.parent.document.getElementById("mainFrame");
if (mainFrame)
console.log(mainFrame.src);
// window.open(prefix+"/downFile.htm?attaId=" + attaIds, 'downFile');mainFrame
});
ajax.setLoading(document);
ajax.execute();
}
function doDeleteFile(type)
{//删除文件
var designId = Z("#designId").val();
if (Z.V.isEmpty(designId))
{
parent.Z.alert("请选择一条订单");
return;
}
var attaIds = Z.FM.getCheckBoxValue("str_" + type, "");
if (Z.V.isEmpty(attaIds))
{
parent.Z.alert("请选择需要删除的文件");
return ;
}
if(${checkeds}){
parent.Z.alert("选中多条订单不支持删除,请重新选择");
return;
}
Z.confirm("确认删除此文件吗?", function()
{
var arr = Z.AR.toArray(attaIds, ",")
var ajax = new Z.Ajax();
ajax.setClassName("UploadFilePresenter");
ajax.setMethodName("doDeleteFile");
ajax.addParam(attaIds);
ajax.setFailure(function(){Z.alert(this.responseText,null, {width:320});});
ajax.setSuccess(function(){
Z.each(arr, function(id, i){
Z("#div_checkbox_"+id).remove();
});
});
ajax.execute();
}, {width:320});
}
function showThumImg(attaId, suffix)
{
doViewOssFile(attaId);//预览文件
Z("#thumImgs").html("");//清除;
if (suffix != "pdf")
{
var html = "<img class='z-pointer' onclick='showLargeImg(this)' class='z-mg-l10' src= '"+attaId+"-0-endFile'/>";
Z("#thumImgs").html(html);
}
else
{
var ajax = new Z.Ajax();
ajax.setClassName("UploadFilePresenter");
ajax.setMethodName("getPdfPages");
ajax.addParam("attaId", attaId);
ajax.setCallback(function()
{
var html = "";
var page = parseInt(this.responseText);
for (var i=1;i<=page;i++)
{
html += "<img class='z-pointer' width='162' onclick='showLargeImg(this)' class='z-mg-l6' src= '"+attaId+"-"+i+"-endFile'/>";
}
html += "<br>";
Z("#thumImgs").html(html);
});
ajax.execute();
}
}
function doViewOssFile(attaId)
{
var ajax = new Z.Ajax();
ajax.setClassName("UploadFilePresenter");
ajax.setMethodName("doGetOssFileUrl");
ajax.addParam("attaId", attaId);
ajax.setSuccess(function(){
var ossFileUrl = this.responseText;
if (Z.V.isNotEmptyBlank(ossFileUrl))
{
var elem = document.createElement("a");
elem.href = ossFileUrl;
elem.setAttribute("target", "_blank");
elem.click();
}
});
ajax.execute();
}
function showLargeImg(thisImg)
{
var dialog = new parent.Z.Dialog();
dialog.shadow = true;
dialog.title = "图片预览";
//dialog.hasTitle = false;
dialog.fixed = true;
dialog.url = "showLargeImg.htm?imgpath="+thisImg.src;
dialog.width = parent.Z.D.clientWidth()-200;
dialog.height = parent.Z.D.clientHeight()-200;
dialog.execute();
dialog.$background.remove();
}
function doCopyProductInfo(copyType)
{
if (copyType == 1)
{//复制文件名
var designId = "${order.getDesignId()}";
var buyerNick = "${order.getBuyerNick()}";
var reciverName = "${order.getUserContact()}";
var fileName = designId+ "-";
// if (buyerNick.indexOf("-") > 0)
// {
// fileName += reciverName;
// }
// else
// {
fileName += buyerNick;
// }
if (fileName == "-")
return;
Z.copy(fileName);
top.Z.tips("复制成功");
}
else
{//复制信息
if (Z("#copy_content").length == 0)
return;
Z.copy(Z("#copy_content").text());
top.Z.tips("复制成功");
}
}
//-->
</script>
${Htmls.toCallFrame()}
<input name="designId" id="designId" value="${order.getDesignId()}" type="hidden">
<table class="z-table z-bordered-line z-pd5 zi-bd z-bg-blue z-mg-t20">
<#for item : attaList>
<#if item.getId() == "copy">
<!--复制-->
<tr class="z-h40 z-bg-gray">
<td class="z-bold" colspan="2">产品信息:
<span style="margin-left:100px">
<button type="button" id="copy" class="z-button z-yellow" onclick="doCopyProductInfo(1);">复制文件名</button>
<button type="button" id="copy" class="z-button z-cyan" onclick="doCopyProductInfo();">复制信息</button>
</span>
</td>
</tr>
<tr class="z-h50">
<#if Validates.isNotEmpty(order)>
<td id="copy_content" colspan="2">${order.getDesignId()}-${order.getBuyerNick()}-${order.getOrderText()}</td>
<#else>
<td colspan="2"></td>
</#if>
</tr>
</#if>
<#if item.getId() == "userText">
<!--客户文本-->
<tr class="z-h40 z-bg-gray">
<td class="z-bold" colspan="2">客户文本:</td>
</tr>
<tr class="z-h100">
<td colspan="2">
<textarea class="z-textarea z-w100p z-h100 ${zmr_color_class}" id="userText" name="userText" class="">${order.getUserText()}</textarea>
</td>
</tr>
</#if>
<#if item.getType() == "file">
<!-- 文件资料-->
<tr class="z-h40 z-bg-gray">
<td>
<input type="checkbox" id="box_${item.getId()}" onclick="Z.FM.doSelectCheckBox('str_${item.getId()}', this.checked);" class="z-checkbox z-mg-l2" data-role="z-checkbox" data-class="${zmr_color_class}" > <b id="fileType_Text_${item.getId()}" class="z-pointer" onclick=" Z(this).parent().find('zcover>i.z-checkbox').click();">${item.getName()}</b>
</td>
<td class="z-text-right">
<#if item.getId() == "EndFile" && endFileLink != null>
<button id="copyLink_${item.getId()}" class="z-button z-cyan z-pd3" onclick="Z.copy('${endFileLink}');top.Z.tips('复制成功')">发送链接</span></button>
</#if>
<button id="upload_${item.getId()}" class="z-button z-pd3 ${zmr_color_class}" <#if !item.isAdd()>disabled=true</#if>>添加</button>
<button id="download_${item.getId()}" class="z-button z-orange z-pd3" onclick="doDownFile('${item.getId()}');">下载</button>
<button id="delete_${item.getId()}" class="z-button z-red z-pd3" onclick="doDeleteFile('${item.getId()}');" <#if !item.isDel()>disabled=true</#if>>删除</button>
</td>
</tr>
<tr class="z-h40">
<td colspan="2">
<div id="div_${item.getId()}" class="z-overflow-y-auto <#if item.getName()=="客户素材">z-h100<#elseif item.getName()=="印刷文件">z-h50<#else>z-h60</#if>">
<#for atta : fileList>
<#if Validates.isEqual(atta.getAttaModul(), item.getId())>
<div id="div_checkbox_${atta.getAttaId()}" class="z-text-ellipsis z-w300 z-pointer" onclick="<#if item.getId()=="EndFile"> showThumImg('${atta.getAttaId()}', '${atta.getFileType()}')</#if>" title="${atta.getFileName()}">
<input name="str_${item.getId()}" type="checkbox" data-attaId="${atta.getAttaId()}" data-attaUrl="${atta.getOssUrl()}" data-fileName="${atta.getFileName()}" class="z-checkbox" data-role="z-checkbox" data-class="${zmr_color_class}" value ="${atta.getAttaId()}"><span class="z-pd6" onclick="Z(this).parent().find('zcover>i.z-checkbox').click();">${atta.getFileName()}</span><br>
</div>
</#if>
</#for>
</div>
</td>
</tr>
</#if>
<#if item.getType() == "thumFile">
<!--缩略图-->
<tr class="z-h40 z-bg-gray">
<td class="z-bold" colspan="2">${item.getName()}</td>
</tr>
<tr height="200px" valign="top">
<td colspan="2">
<div id="thumImgs"><#if Validates.isNotEmpty(item.getSavePath())><img src="${item.getSavePath()}"></#if></div>
</td>
</tr>
</#if>
<#if item.getType() == "firstThumFile">
<!--初稿缩略图-->
<tr class="z-h40 z-bg-gray">
<td class="z-bold" colspan="2">${item.getName()}</td>
</tr>
<tr height="200px" valign="top">
<td colspan="2">
<#if order != null>
<div><img src="${order.getDesignId()}-FristThumFile.png"></div>
</#if>
</td>
</tr>
</#if>
<#if item.getId() == "userNotice">
<!--注意事项-->
<tr class="z-h40 z-bg-gray">
<td class="z-bold" colspan="2">注意事项:</td>
</tr>
<tr class="z-h80" >
<td colspan="2">
<textarea id="userNotice" name="userNotice" class="z-textarea z-w100p z-h80 ${zmr_color_class}">${order.getUserNotice()}</textarea>
</td>
</tr>
</#if>
</#for>
<!--客服留言-->
<tr class="z-h40 z-bg-gray">
<td class="z-bold" colspan="2">客服留言:</td>
</tr>
<tr class="z-h80">
<td colspan="2">
<textarea id="servicesMessage" name="servicesMessage" class="z-textarea z-w100p z-h80 ${zmr_color_class}">${order.getServicesMessage()}</textarea>
</td>
</tr>
</table>