#引入clr运行库
import clr
#添加对cloud插件开发的常用组件的引用
clr.AddReference('System')
clr.AddReference('System.Data')
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.App')
clr.AddReference('Kingdee.BOS.ServiceHelper')
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
from System import *
from System.Data import *
from Kingdee.BOS.App.Data import *
from System.Collections.Generic import List
from Kingdee.BOS.ServiceHelper import *
global dic,rowIndexs;#定义全局变量,用来记录父页面传过来的参数
def OnInitialize(e):
global dic;
#获取父页面传入的参数:这里是通过字典的方式传入多个字段值
dic=this.View.OpenParameter.GetCustomParameter("DIC");
def AfterBindData(e):
#获取父页面的FormId
parentFormId=this.View.ParentFormView.BillBusinessInfo.GetForm().Id;
#this.View.ShowMessage(parentFormId);
def AfterCreateNewData(e):
global rowIndexs;
#将父页面获取到的参数逐个赋值到动态表单的字段上
rowIndexs=dic["rowIndexs"];
def BarItemClick(e):
key=e.BarItemKey;
if(str(key)=="PEAJ_tbButton"):
global dic;
selectedDate = this.Model.GetValue("F_PEAJ_Base_83g_re5")#子页面控件字段
if (selectedDate==None):
return;
Fname = Convert.ToString(selectedDate["Name"]);
ID=Fname = Convert.ToString(selectedDate["ID"]);
dic["Fname"]=Fname;
dic["ID"]=ID;
dic["rowIndexs"]=rowIndexs;
#this.View.ShowMessage(str(Fname));
this.View.ReturnToParentWindow(dic);#构建字典,将界面录入的数据返回父页面
this.View.Close();
else:
this.View.Close();
参考:https://vip.kingdee.com/article/291170608069603584?productLineId=1&lang=zh-CN
推荐阅读