//多附件显示
function ShowMultiFile(AttrFiles, FileManagers, isExitMyNum) {
var html = "";
//如果多附件没有分类
if (AttrFiles.length == 0) {
html += "
";
html += "
";
html += "
";
html += "
";
return html;
}
//多附件分类
for (var i = 0; i < AttrFiles.length; i++) {
var attrFile = AttrFiles[i];
html += "";
html += "
";
html += "
";
html += "
";
}
return html;
}
var fileNo = "";
var fileName = "";
function ActiveUploadFile(upfileNo, upfileName) {
if (pkVal == null) {
var flag = Update(false);
if (flag == false)
return;
}
fileNo = upfileNo;
fileName = upfileName;
$("#File_Upload").val("");
//激活上传文件
$("#File_Upload").click();
}
function downLoadFileM(OID) {
if (plant == "CCFlow")
SetHref(basePath + '/WF/Comm/ProcessRequest?DoType=HttpHandler&HttpHandlerName=BP.WF.HttpHandler.WF_CommEntity&DoMethod=EntityMutliFile_Load&OID=' + OID);
else {
SetHref(basePath + '/WF/Ath/EntityMutliFile_Load.do?OID=' + OID);
}
}
function deleteFile(OID, td) {
if (window.confirm('您确定要删除吗?') == false)
return;
//需要删除文件
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CommEntity");
handler.AddPara("OID", OID);
var data = handler.DoMethodReturnString("EntityMultiFile_Delete");
if (data.indexOf("err@") != -1) {
alert(data);
return;
}
//处理显示问题,删除一行
$(td).parent().parent().remove();
window.location.reload();
}
//新增一行
function tableAddTr(fileManager) {
var tb;
if (fileManager.AttrFileNo == "")
tb = $("#TableFile");
else
tb = $("#Table_" + fileManager.AttrFileNo);
var html = "";
html += "";
html += "";
html += "" + fileManager.MyFileName + fileManager.MyFileExt;
html += " | ";
html += "" + fileManager.RDT + " | ";
html += "";
html += "下载 ";
if (mapData.GetPara("IsDelete") == 1 || mapData.GetPara("IsUpdate") == 1 || mapData.GetPara("IsInsert") == 1)
html += "删除";
html += " | ";
html += "
";
tb.append(html);
}
//多文件上传
function MultiUploadFile() {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CommEntity");
handler.AddFileData();
handler.AddPara("FileNo", fileNo);
handler.AddPara("FileName", fileName);
handler.AddPara("EnName", GetQueryString("EnName"));
handler.AddPara("PKVal", pkVal);
var data = handler.DoMethodReturnString("EntityMultiAth_Upload");
if (data.indexOf("err@") != -1) {
alert(data);
return;
}
data = JSON.parse(data);
tableAddTr(data);
}
//树形结构
function findChildren(jsonArray, parentNo) {
var appendToTree = function (treeToAppend, o) {
$.each(treeToAppend, function (i, child) {
if (o.id == child.ParentNo)
o.children.push({
"id": child.No,
"text": child.Name,
"children": []
});
});
$.each(o.children, function (i, o) {
appendToTree(jsonArray, o);
});
};
var jsonTree = [];
var jsonchildTree = [];
if (jsonArray.length > 0 && typeof parentNo !== "undefined") {
$.each(jsonArray, function (i, o) {
if (o.ParentNo == parentNo) {
jsonchildTree.push(o);
jsonTree.push({
"id": o.No,
"text": o.Name,
"children": []
});
}
});
$.each(jsonTree, function (i, o) {
appendToTree(jsonArray, o);
});
}
function _(treeArray) {
$.each(treeArray, function (i, o) {
if ($.isArray(o.children)) {
if (o.children.length == 0) {
o.children = undefined;
} else {
_(o.children);
}
}
});
}
_(jsonTree);
return jsonTree;
}