如何拼接跳转链接脚本

常用场景:通过拼接链接脚本进行跳转或获取表单数据传参到新表或者视图中。

常用场景:通过拼接链接脚本进行跳转或获取表单数据传参到新表或者视图中。

参数:appId(软件id)、actionContent(内容id,表单为formid,视图为viewid)、linkType(表单为00,视图为01)、docid(表单数据id,如跳转新表可不带该参数)、exparams(拼接参数)

//跳转到对应表单
(function(){
	var applicationId = getApplication(); 
	var formid = "__TTo88Mjs0nJvQRe8IyQ"; //formid
	var request = $WEB.getParamsTable().getHttpRequest();
	var url = "http://" + request.getServerName()+":" + request.getServerPort() + "/static";
	url += "/portal/vue/index.html#/open?appId="+applicationId+"&actionContent="+formid+"&docid="+newDocid+"&opentarget=detail&linkType=00";
	return url;
})();
//举例1:获取当前表单参数跳转至某表
(function(){
	var applicationId = getApplication(); 
	var doc = getCurrentDocument();
	var ProjectName = doc.getItemValueAsString("ProjectName");
	var ProjectCode = doc.getItemValueAsString("ProjectCode");
	var ProjectPhase = doc.getItemValueAsString("ProjectPhase");
	var request = $WEB.getParamsTable().getHttpRequest();
	var formid = "__kLtoxvTJD84OH2Njn6M";
	var exparams = "&ProjectName="+ProjectName+"&ProjectCode="+ProjectCode+"&ProjectPhase="+ProjectPhase+"";	//拼接参数
	var url = "http://" + request.getServerName()+":" + request.getServerPort() + "/static";
	url += "/portal/vue/index.html#/open?appId="+applicationId+"&actionContent="+formid+"&opentarget=detail&linkType=00"+exparams+"";
	return url;	
})();
//举例2:跳转目标表单后获取链接中参数
(function(){
	var doc	= getCurrentDocument();
	var ProjectName = getParameter("ProjectName");		//获取链接中ProjectName参数
	var ProjectCode = getParameter("ProjectCode");
	var ProjectPhase = getParameter("ProjectPhase");
	
	//判断当前表中ProjectName是否为空,为空则赋值,存在值时不赋值
	if(!isNotNull(doc.getItemValueAsString("ProjectName"))){
		doc.findItem("ProjectName").setValue(ProjectName);   
	}
	
	if(!isNotNull(doc.getItemValueAsString("ProjectCode"))){
		doc.findItem("ProjectCode").setValue(ProjectCode);   
	}
	
	if(!isNotNull(doc.getItemValueAsString("ProjectPhase"))){
		doc.findItem("ProjectPhase").setValue(ProjectPhase);   
	}
})();
//跳转到对应视图
(function(){
	var applicationId = getApplication(); 
	var viewid = "__yVlfD5U25zs84vaWxZK"; 	//viewid
	var request = $WEB.getParamsTable().getHttpRequest();
	var url = "http://" + request.getServerName()+":" + request.getServerPort() + "/static";
    url += "/portal/vue/index.html#/open?appId="+applicationId+"&actionContent="+viewid+"&opentarget=detail&linkType=01";
	return url;
})();

本文来自投稿,不代表chain立场,如若转载,请注明出处:https://chain996.top/?p=4113

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-20 00:01
下一篇 2022-04-20 23:22

相关推荐

发表回复

您的电子邮箱地址不会被公开。