表单代码块如下:
<script>
var kpbm = getUrlParam("kpbm"); //获取URL中的kpbm参数
var zcbm = getUrlParam("zcbm"); //获取URL中的zcbm参数
var sjid = getUrlParam("id");
console.log(kpbm);
console.log(zcbm);
console.log(sjid);
WfForm.changeFieldValue("field12973", {
value: sjid,
specialobj:[
{id:sjid,name:kpbm}
]
});
function getUrlParam(key){
var url = decodeURI(window.location.href);
var paramMap = {};
var paramStr = url.split("?")[2];
if (paramStr && paramStr != "") {
var paramStrArr = paramStr.split("&");
for (var i = 0; i < paramStrArr.length; i++) {
var temp = paramStrArr[i];
var indexE = temp.indexOf("=");
var pKey = temp.substring(0, indexE);
var pVal = temp.substring(indexE + 1);
paramMap[pKey] = pVal;
}
}
return paramMap[key];
}
WfForm.afterFieldComp("field12973",
React.createElement("a", {
href: "/mobilemode/appHomepageView.jsp?appHomepageId=120&billid=" + WfForm.getFieldValue("field12944"),
target: "_blank",
children: "资产卡片详情"
}));
WfForm.forceRenderField("field12973");
WfForm.bindFieldChangeEvent("field12944", function(obj,id,value){
WfForm.afterFieldComp("field12973",
React.createElement("a",{
href:"/mobilemode/appHomepageView.jsp?appHomepageId=120&billid="+WfForm.getFieldValue("field12944"),
target:"_blank",
children:"资产卡片详情"}));
});
</script>
说明:
因为该流程新建方式有两种:
- 直接打开流程新建
- 移动应用通过按钮跳转至发起该流程页面
为了确保追加的字段【资产卡片详情】在这两种新建方式下都起作用,WfForm.afterFieldComp
故写两遍。