';
return _Html;
}
//删除从表数据
function DeleteDtl(dtlNo, oid, obj) {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
handler.AddPara("FK_MapDtl", dtlNo);
handler.AddPara("OID", oid);
handler.DoMethodReturnString("Dtl_DeleteRow");
//删除成功后,移除数据
$(obj).parent().parent().remove();
}
//打开明细表
function Dtl_ShowPage(dtlNo, dtlName) {
$("#frmDtlTitle").html(dtlName);
$("#HD_CurDtl_No").val(dtlNo)
Load_DtlInit();
viewApi.go("#frmDtl");
}
//填充默认数据
function ConvertDefVal(mainTable, defVal, keyOfEn) {
//计算URL传过来的表单参数@TXB_Title=事件测试
var pageParams = getQueryString();
var pageParamObj = {};
$.each(pageParams, function (i, pageParam) {
if (pageParam.indexOf('@') == 0) {
var pageParamArr = pageParam.split('=');
pageParamObj[pageParamArr[0].substring(1, pageParamArr[0].length)] = pageParamArr[1];
}
});
var result = defVal;
//通过MAINTABLE返回的参数
for (var ele in mainTable) {
if (keyOfEn == ele) {
result = mainTable[ele];
if (result == null) {
result = "";
}
break;
}
}
if (result != undefined && typeof (result) == 'string') {
//result = result.replace(/{/g, "{").replace(/}/g, "}").replace(/:/g, ":").replace(/,/g, ",").replace(/【/g, "[").replace(/】/g, "]").replace(/;/g, ";").replace(/~/g, "'").replace(/‘/g, "'").replace(/‘/g, "'");
}
//console.info(defVal+"=="+keyOfEn+"=="+result);
var result = unescape(result);
if (result == "null")
result = "";
return result;
}
//将#FF000000 转换成 #FF0000
function TranColorToHtmlColor(color) {
if (color != undefined && color.indexOf('#') == 0 && color.length == 9) {
color = color.substring(0, 7);
}
return color;
}
//FontStyle, FontWeight, IsBold, IsItalic
//fontStyle font-size:19;font-family:"Portable User Interface";font-weight:bolder;color:#FF0051; 为H5设计的,不用解析后面3个
function analysisFontStyle(ele, fontStyle, isBold, isItalic) {
if (fontStyle != undefined && fontStyle.indexOf(':') > 0) {
var fontStyleArr = fontStyle.split(';');
$.each(fontStyleArr, function (i, fontStyleObj) {
ele.css(fontStyleObj.split(':')[0], TranColorToHtmlColor(fontStyleObj.split(':')[1]));
});
}
else {
if (isBold == 1) {
ele.css('font-weight', 'bold');
}
if (isItalic == 1) {
ele.css('font-style', 'italic')
}
}
}
function ImgAth(url, athMyPK) {
var v = window.showModalDialog(url, 'ddf', 'dialogHeight: 650px; dialogWidth: 950px;center: yes; help: no');
if (v == null)
return;
document.getElementById('Img' + athMyPK).setAttribute('src', v);
}
//初始化 IMAGE附件
function figure_Template_ImageAth(frmImageAth) {
var isEdit = frmImageAth.IsEdit;
var eleHtml = $("");
var img = $("");
var imgSrc = basePath + "/WF/Data/Img/LogH.PNG";
//获取数据
if (frmData.Sys_FrmImgAthDB) {
$.each(frmData.Sys_FrmImgAthDB, function (i, obj) {
if (obj.FK_FrmImgAth == frmImageAth.MyPK) {
imgSrc = obj.FileFullName;
}
});
}
//设计属性
img.attr('id', 'Img' + frmImageAth.MyPK).attr('name', 'Img' + frmImageAth.MyPK);
img.attr("src", imgSrc).attr('onerror', "this.src='../../../Data/Img/LogH.PNG'");
img.css('width', frmImageAth.W).css('height', frmImageAth.H).css('padding', "0px").css('margin', "0px").css('border-width', "0px");
//不可编辑
if (isEdit == "1") {
var fieldSet = $("");
var length = $("");
var a = $("");
var url = basePath + "/WF/CCForm/ImgAth.aspx?W=" + frmImageAth.W + "&H=" + frmImageAth.H + "&FK_MapData=ND" + pageData.FK_Node + "&MyPK=" + pageData.WorkID + "&ImgAth=" + frmImageAth.MyPK;
a.attr('href', "javascript:ImgAth('" + url + "','" + frmImageAth.MyPK + "');").html("编辑");
length.css('font-style', 'inherit').css('font-weight', 'bold').css('font-size', '12px');
fieldSet.append(length);
length.append(a);
fieldSet.append(img);
eleHtml.append(fieldSet);
} else {
eleHtml.append(img);
}
eleHtml.css('position', 'absolute').css('top', frmImageAth.Y).css('left', frmImageAth.X);
return eleHtml;
}
//初始化 附件.
function figure_Template_Attachment(frmAttachment) {
var eleHtml = '';
var ath = frmAttachment;
if (ath.UploadType == 0) {//单附件上传 L4204
return $('');
}
var src = "";
if (pageData.IsReadonly)
src = "./CCForm/AttachmentUpload.htm?PKVal=" + pageData.WorkID + "&Ath=" + ath.NoOfObj + "&FK_MapData=" + ath.FK_MapData + "&FK_FrmAttachment=" + ath.MyPK + "&IsReadonly=1";
else
src = "./CCForm/AttachmentUpload.htm?PKVal=" + pageData.WorkID + "&Ath=" + ath.NoOfObj + "&FK_MapData=" + ath.FK_MapData + "&FK_FrmAttachment=" + ath.MyPK;
eleHtml += '
' + "" + '
';
eleHtml = $(eleHtml);
eleHtml.css('position', 'absolute').css('top', ath.Y).css('left', ath.X).css('width', ath.W).css('height', ath.H);
return eleHtml;
}
function addLoadFunction(id, eventName, method) {
var js = "";
js = "";
return $(js);
}
var appPath = "../../";
var DtlsCount = " + dtlsCount + "; //应该加载的明细表数量
//初始化从表
function figure_Template_Dtl(frmDtl) {
var eleHtml = $("
");
var paras = this.pageData;
var strs = "";
for (var str in paras) {
if (str == "EnsName" || str == "RefPKVal" || str == "IsReadonly")
continue
else
strs += "&" + str + "=" + paras[str];
}
var src = "";
var href = GetHrefUrl();
var urlParam = href.substring(href.indexOf('?') + 1, href.length);
urlParam = urlParam.replace('&DoType=', '&DoTypeDel=xx');
if (frmDtl.DtlShowModel == "0") {
if (pageData.IsReadOnly) {
src = "./CCForm/Dtl.htm?EnsName=" + frmDtl.No + "&RefPKVal=" + this.pageData.WorkID + "&IsReadonly=1&" + urlParam + "&Version=" + load.Version;
} else {
src = "./CCForm/Dtl.htm?EnsName=" + frmDtl.No + "&RefPKVal=" + this.pageData.WorkID + "&IsReadonly=0&" + urlParam + "&Version=" + load.Version;
}
}
else if (frmDtl.DtlShowModel == "1") {
if (pageData.IsReadOnly)
src = appPath + "WF/CCForm/DtlCard.htm?EnsName=" + frmDtl.No + "&RefPKVal=" + this.pageData.WorkID + "&IsReadonly=1" + strs;
else
src = appPath + "WF/CCForm/DtlCard.htm?EnsName=" + frmDtl.No + "&RefPKVal=" + this.pageData.WorkID + "&IsReadonly=0" + strs;
}
var eleIframe = '';
eleIframe = $("");
if (pageData.IsReadOnly) {
} else {
if (frmDtl.DtlSaveModel == 0) {
eleHtml.append(addLoadFunction(frmDtl.No, "blur", "SaveDtl"));
eleIframe.attr('onload', frmDtl.No + "load()");
}
}
eleHtml.append(eleIframe);
//added by liuxc,2017-1-10,此处前台JS中增加变量DtlsLoadedCount记录明细表的数量,用于加载完全部明细表的判断
var js = "";
if (!pageData.IsReadonly) {
js = "";
eleHtml.append($(js));
}
return eleHtml;
}
//初始化轨迹图
function figure_Template_FigureFlowChart(wf_node) {
//轨迹图
var sta = wf_node.FrmTrackSta;
var x = wf_node.FrmTrack_X;
var y = wf_node.FrmTrack_Y;
var h = wf_node.FrmTrack_H;
var w = wf_node.FrmTrack_W;
if (sta == 0) {
return $('');
}
if (sta == undefined) {
return;
}
var src = "./WorkOpt/OneWork/OneWork.htm?CurrTab=Track";
src += '&FK_Flow=' + pageData.FK_Flow;
src += '&FK_Node=' + pageData.FK_Node;
src += '&WorkID=' + pageData.WorkID;
src += '&FID=' + pageData.FID;
var eleHtml = '
' + "" + '
';
eleHtml = $(eleHtml);
eleHtml.css('position', 'absolute').css('top', y).css('left', x).css('width', w).css('height', h);
return eleHtml;
}
//审核组件
function figure_Template_FigureFrmCheck(wf_node) {
//审核组键FWCSta Sta,FWC_X X,FWC_Y Y,FWC_H H, FWC_W W from WF_Node
var sta = wf_node.FWCSta;
var x = wf_node.FWC_X;
var y = wf_node.FWC_Y;
// var h = wf_node.FWC_H;
// var w = wf_node.FWC_W;
if (sta == 0)
return $('');
var src = "./WorkOpt/WorkCheck.htm?s=2";
var fwcOnload = "";
var paras = '';
paras += "&FID=" + pageData["FID"];
paras += "&OID=" + pageData["WorkID"];
paras += '&FK_Flow=' + pageData.FK_Flow;
paras += '&FK_Node=' + pageData.FK_Node;
paras += '&WorkID=' + pageData.WorkID;
paras += '&IsReadonly=1';
paras += '&csc=1' + Math.random();
src += "&DoType=View";
src += "&IsMobile=1";
src += "&r1=" + Math.random() + paras;
//暂时修改高度为500px.
var eleHtml = '
' + "
" + '
';
eleHtml = $(eleHtml);
return eleHtml;
}
//子流程
function figure_Template_FigureSubFlowDtl(wf_node) {
var sta = wf_node.SFSta;
var h = wf_node.SF_H;
if (sta == 0)
return $('');
var src = "./WorkOpt/SubFlow.htm?s=2";
var fwcOnload = "";
var paras = '';
paras += "&FID=" + pageData["FID"];
paras += "&OID=" + pageData["WorkID"];
paras += '&FK_Flow=' + pageData.FK_Flow;
paras += '&FK_Node=' + pageData.FK_Node;
paras += '&WorkID=' + pageData.WorkID;
if (sta == 2)//只读
{
src += "&DoType=View";
}
else {
fwcOnload = "onload= 'WC" + wf_node.NodeID + "load();'";
$('body').append(addLoadFunction("WC" + wf_node.NodeID, "blur", "SaveDtl"));
}
src += "&r=q" + paras;
var eleHtml = '
' + "" + '
';
eleHtml = $(eleHtml);
eleHtml.css('position', 'absolute').css('top', y).css('left', x).css('width', w).css('height', h);
return eleHtml;
}
//初始化框架
function figure_Template_IFrame(fram) {
var eleHtml = '';
var src = dealWithUrl(fram.src) + "IsReadOnly=0";
eleHtml = $('
' + '
');
var iframe = $(+"");
eleHtml.css('position', 'absolute').css('top', fram.Y).css('left', fram.X).css('width', fram.W).css('height', fram.H);
return frameHtml;
}
//处理URL,MainTable URL 参数 替换问题
function dealWithUrl(src) {
var src = fram.URL.replace(new RegExp(/(:)/g), ':');
var params = '&FID=' + pageData.FID;
params += '&WorkID=' + pageData.WorkID;
if (src.indexOf("?") > 0) {
var params = getQueryStringFromUrl(src);
if (params != null && params.length > 0) {
$.each(params, function (i, param) {
if (param.indexOf('@') == 0) {//是需要替换的参数
paramArr = param.split('=');
if (paramArr.length == 2 && paramArr[1].indexOf('@') == 0) {
if (paramArr[1].indexOf('@WebUser.') == 0) {
params[i] = paramArr[0].substring(1) + "=" + frmData.MainTable[0][paramArr[1].substr('@WebUser.'.length)];
}
if (frmData.MainTable[0][paramArr[1].substr(1)] != undefined) {
params[i] = paramArr[0].substring(1) + "=" + frmData.MainTable[0][paramArr[1].substr(1)];
}
//使用URL中的参数
var pageParams = getQueryString();
var pageParamObj = {};
$.each(pageParams, function (i, pageParam) {
if (pageParam.indexOf('@') == 0) {
var pageParamArr = pageParam.split('=');
pageParamObj[pageParamArr[0].substring(1, pageParamArr[0].length)] = pageParamArr[1];
}
});
var result = "";
//通过MAINTABLE返回的参数
for (var ele in frmData.MainTable[0]) {
if (paramArr[0].substring(1) == ele) {
result = frmData.MainTable[0][ele];
break;
}
}
//通过URL参数传过来的参数
for (var pageParam in pageParamObj) {
if (pageParam == paramArr[0].substring(1)) {
result = pageParamObj[pageParam];
break;
}
}
if (result != '') {
params[i] = paramArr[0].substring(1) + "=" + unescape(result);
}
}
}
});
src = src.substr(0, src.indexOf('?')) + "?" + params.join('&');
}
}
else {
src += "?q=1";
}
return src;
}
var colVisibleJsonStr = ''
var jsonStr = '';
var frmData = {};
//从MyFlowFree2017.htm 中拿过过的.
$(function () {
initPageParam(); //初始化参数
GenerFrm(); //表单数据.ajax
});