Camstar Page Redirect And Data Link

本文内容仅做参考并不完全通用,测试环境为OpcenterEXCR2410,其中数据均为演示所用无实际意义

通过CS和VP实现

VP

1.在主页面添加跳转按钮并设置触发自定义事件

2.在跳转页面加入接收传值的DataContractMembers

CS

1.点击按钮触发WebPartCustomAction执行页面跳转并传值

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public override void WebPartCustomAction(object sender, Personalization.CustomActionEventArgs e)
{
base.WebPartCustomAction(sender, e);
var action = e.Action as CustomAction;
if (action != null)
{
if (action.Parameters == "wzmMoveIn")
{
RedirectToNewPage("wzmMoveInVP_Mobile");
}
else if (action.Parameters == "wzmMoveStd")
{
RedirectToNewPage("wzmMoveStd_VP_Mobile");
}
}
}

2.示例RedirectToNewPage方法,PortalTabOptionType可以自定义CurrentTab/NewTab/SpecifiedTab

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
protected virtual void RedirectToNewPage(string PageName)
{
if (string.IsNullOrEmpty(_txtSelectedContainer.Data?.ToString())) return;

var redirectAction = new PageRedirectAction() { PageName = PageName };

redirectAction.PortapTabOption = PortalTabOptionType.CurrentTab;

redirectAction.DataContractMap = new UIComponentDataContractMap
{
Links = new[] {
new UIComponentDataContractLink
{
SourceMember = "ContainerDM",
TargetMember = "SelectedContainerNameDM"
}
}
};

Page.DataContract.SetValueByName("ContainerDM", _txtSelectedContainer.Data?.ToString());

Page.ActionDispatcher.ExecuteAction(redirectAction);
Page.PortalContext.LocalSession["DifferentVersionsWarning"] = null;
}

通过VP实现

施工中···