|
|
|
@ -17,6 +17,7 @@ var PreviewPathOfAth = getConfigByKey("PreviewPathOfAth", "");
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
function AthTable_Init(athchment, athDivID, refPKVal) {
|
|
|
|
|
debugger;
|
|
|
|
|
if (typeof athchment != "object" && typeof athchment == "string")
|
|
|
|
|
athchment = new Entity("BP.Sys.FrmAttachment", athchment);
|
|
|
|
|
if (refPKVal == null || refPKVal == undefined || refPKVal == 0)
|
|
|
|
@ -199,6 +200,8 @@ function InitAthPage(athDivID, uploadUrl) {
|
|
|
|
|
}
|
|
|
|
|
$("#" + athDivID).show();
|
|
|
|
|
layui.form.render("select");
|
|
|
|
|
layui.form.render('checkbox');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -233,6 +236,7 @@ function FileShowWayTable(athDesc, dbs, uploadUrl) {
|
|
|
|
|
|
|
|
|
|
var colstyle = "line-height:30px;border: 1px solid #ddd;background-color:white;";
|
|
|
|
|
colstyle = "background-color:#FAFAFA !important; ";
|
|
|
|
|
_html += "<th align='center' width='12%' style='height: 42px;' ><input lay-filter='allChecks' type='checkbox' id='allChecks' onclick='ckAll();' /></th>";
|
|
|
|
|
_html += "<th style='" + colstyle + "width:50px;'>序号</th>";
|
|
|
|
|
if (isHaveSort == true)
|
|
|
|
|
_html += "<th style='" + colstyle + "width:120px' nowrap=true >" + sortColoum + "</th>";
|
|
|
|
@ -317,7 +321,9 @@ function FileShowWayTable(athDesc, dbs, uploadUrl) {
|
|
|
|
|
athIdx++;
|
|
|
|
|
_html += "<tr class='athInfo'>";
|
|
|
|
|
|
|
|
|
|
//①序号
|
|
|
|
|
//①复选框
|
|
|
|
|
_html += "<td align='center' width='12%'> <input type='checkbox' name='child' class='fileId' lay-filter='clickChild' value='" + db.MyPK + "' /></td>";
|
|
|
|
|
//序号
|
|
|
|
|
_html += "<td class='Idx' nowrap>" + athIdx + "</td>";
|
|
|
|
|
|
|
|
|
|
//增加类别列,有可能跨多行
|
|
|
|
@ -395,6 +401,12 @@ function FileShowWayTable(athDesc, dbs, uploadUrl) {
|
|
|
|
|
if (IsExistFile == false || (athDesc.IsExpCol == 1 && athDesc.IsUpload == true && pageData.IsReadonly != "1")) {
|
|
|
|
|
athIdx++;
|
|
|
|
|
|
|
|
|
|
//复选框
|
|
|
|
|
if (db != undefined && db != "") {
|
|
|
|
|
_html += "<td align='center' width='12%'> <input type='checkbox' name='child' class='fileId' lay-filter='clickChild' value='" + db.MyPK + "' /></td>";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//①序号
|
|
|
|
|
_html += "<td class='Idx'>" + athIdx + "</td>";
|
|
|
|
|
|
|
|
|
@ -493,6 +505,66 @@ function GFDoDown(mypk, fk_framAttachment) {
|
|
|
|
|
AthTable_Init(fk_framAttachment, "Div_" + fk_framAttachment, pageData.WorkID);
|
|
|
|
|
//Reload();
|
|
|
|
|
}
|
|
|
|
|
layui.use(['form', 'layer', 'laydate'], function () {
|
|
|
|
|
var form = layui.form, $ = layui.jquery, laydate = layui.laydate;
|
|
|
|
|
|
|
|
|
|
form.on('checkbox(allChecks)', function (data) {
|
|
|
|
|
var child = $("input[type='checkbox']");
|
|
|
|
|
child.each(function (index, item){
|
|
|
|
|
item.checked = data.elem.checked;
|
|
|
|
|
});
|
|
|
|
|
form.render('checkbox');
|
|
|
|
|
});
|
|
|
|
|
//选中子项
|
|
|
|
|
form.on('checkbox(clickChild)', function (data) {
|
|
|
|
|
var childs = $(".fileId");
|
|
|
|
|
for (var i = 0; i < childs.length; i++) {
|
|
|
|
|
if (childs[i].checked == false) {
|
|
|
|
|
$("#allChecks").prop("checked", false);
|
|
|
|
|
form.render('checkbox');
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
var all = childs.length;
|
|
|
|
|
for (var i = 0; i < childs.length;i++) {
|
|
|
|
|
if (childs[i].checked == true) {
|
|
|
|
|
all--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (all == 0) {
|
|
|
|
|
$("#allChecks").prop("checked", true);
|
|
|
|
|
form.render('checkbox');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//全选
|
|
|
|
|
function ckAll() {
|
|
|
|
|
var status = document.getElementById('allChecks').checked;
|
|
|
|
|
var childs = document.getElementById('child');
|
|
|
|
|
for (var i = 0; i < childs.length; i++) {
|
|
|
|
|
childs[i].checked = status;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function clickChild() {
|
|
|
|
|
var childs = document.getElementByName('child');
|
|
|
|
|
var count = childs.length;
|
|
|
|
|
var CheckedCount = 0;
|
|
|
|
|
for (var i = 0; i < childs.length; i++) {
|
|
|
|
|
if (childs[i].checked == true) {
|
|
|
|
|
CheckedCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//若子选项全选,则全选也选中
|
|
|
|
|
if (count == CheckedCount) {
|
|
|
|
|
document.getElementById('allChecks').checked == true;
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementById('allChecks').checked == false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 修改文件名.
|
|
|
|
|
function ChangeFileName(mypk) {
|
|
|
|
@ -624,16 +696,75 @@ function Down2018(mypk) {
|
|
|
|
|
link.click();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//打包下载
|
|
|
|
|
function DownZipBatch(fk_frmattachment, PKVal) {
|
|
|
|
|
var ids = new Array();//选中的附件
|
|
|
|
|
//获取选中的附件复选框
|
|
|
|
|
var childs = $(".fileId");
|
|
|
|
|
for (var i = 0; i < childs.length; i++) {
|
|
|
|
|
if (childs[i].checked == true) {
|
|
|
|
|
var id = childs[i].value;
|
|
|
|
|
ids.push(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (ids.length == 0) {
|
|
|
|
|
alert("请先选中要下载的文件。");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var httpHandler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
|
|
|
|
|
httpHandler.AddUrlData();
|
|
|
|
|
httpHandler.AddPara("Ids", ids);
|
|
|
|
|
httpHandler.AddPara("FK_FrmAttachment", fk_frmattachment);
|
|
|
|
|
httpHandler.AddPara("PKVal", PKVal)
|
|
|
|
|
var data = httpHandler.DoMethodReturnString("AttachmentUpload_DownZip");
|
|
|
|
|
|
|
|
|
|
if (data.indexOf('err@') == 0) {
|
|
|
|
|
alert(data); //如果是异常,就提提示.
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.indexOf('url@') == 0) {
|
|
|
|
|
|
|
|
|
|
data = data.replace('url@', ''); //如果返回url,就直接转向.
|
|
|
|
|
|
|
|
|
|
var i = data.indexOf('\DataUser');
|
|
|
|
|
var str = '/' + data.substring(i);
|
|
|
|
|
str = str.replace('\\\\', '\\');
|
|
|
|
|
if (plant != 'CCFlow') {
|
|
|
|
|
var currentPath = GetHrefUrl();
|
|
|
|
|
var path = currentPath.substring(0, currentPath.indexOf('/WF') + 1);
|
|
|
|
|
str = path + str;
|
|
|
|
|
} else {
|
|
|
|
|
str = basePath + str;
|
|
|
|
|
}
|
|
|
|
|
SetHref(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 打包下载
|
|
|
|
|
* @param fk_frmattachment 附件属性MyPK
|
|
|
|
|
* @param PKVal 附件控制权限的ID
|
|
|
|
|
*/
|
|
|
|
|
function DownZip(fk_frmattachment, PKVal) {
|
|
|
|
|
var ids = new Array();//选中的附件
|
|
|
|
|
//获取选中的附件复选框
|
|
|
|
|
var childs = $(".fileId");
|
|
|
|
|
for (var i = 0; i < childs.length; i++) {
|
|
|
|
|
if (childs[i].checked == true) {
|
|
|
|
|
var id = childs[i].value;
|
|
|
|
|
ids.push(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (ids.length == 0) {
|
|
|
|
|
alert("请先选中要下载的文件。");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var httpHandler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
|
|
|
|
|
httpHandler.AddUrlData();
|
|
|
|
|
httpHandler.AddPara("Ids", ids);
|
|
|
|
|
httpHandler.AddPara("FK_FrmAttachment", fk_frmattachment);
|
|
|
|
|
httpHandler.AddPara("PKVal", PKVal)
|
|
|
|
|
var data = httpHandler.DoMethodReturnString("AttachmentUpload_DownZip");
|
|
|
|
|