二开案例.python.简单账表过滤页面,下拉多选列表加载组织信息原创
金蝶云社区-zfyadd
zfyadd
8人赞赏了该文章 220次浏览 未经作者许可,禁止转载编辑于2024年04月18日 10:03:51

参考链接:https://vip.kingdee.com/article/70449670790532864?lang=zh-CN&productLineId=1

不说废话,直接上代码:

import clr

clr.AddReference('System')
clr.AddReference('System.Data')
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.BusinessEntity')
clr.AddReference('Kingdee.BOS.DataEntity')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.App')
clr.AddReference('Kingdee.BOS.App.Core')
clr.AddReference('Kingdee.BOS.ServiceHelper')
clr.AddReference('Kingdee.BOS.Contracts')
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.DependencyRules 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 *
from Kingdee.BOS.Core.DynamicForm import *
from Kingdee.BOS.Core.Metadata.EntityElement import *
from Kingdee.BOS.Core.Metadata.FieldElement import *
from Kingdee.BOS.Orm.DataEntity import *
from System.Linq import *
from System.Text import *
from System.Threading.Tasks import *
from System.ComponentModel import *
from Kingdee.BOS.Core.CommonFilter.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
from Kingdee.BOS.Core.Metadata import *
from Kingdee.BOS.Core.Permission import *
from Kingdee.BOS.Core.SqlBuilder import *


def AfterBindData(e):
    SetDefaultValue("F_PYIV_MulCombo")


lstOrgList = List[int]();


def SetDefaultValue(sOrgFieldKey):
    if (this.View.ParentFormView is not None):
        # raise Exception("12312312")
        lstOrgList = GetPermissionOrg(this.View.ParentFormView.BillBusinessInfo.GetForm().Id)
        organization = GetOrganization(sOrgFieldKey)
        fieldEditor = this.View.GetFieldEditor[ComboFieldEditor](sOrgFieldKey, 0)
        fieldEditor.SetComboItems(organization)


def GetOrganization(sOrgFieldKey):
    list = List[EnumItem]()
    list2 = List[SelectorItemInfo]()
    list2.Add(SelectorItemInfo("FORGID"))
    list2.Add(SelectorItemInfo("FNUMBER"))
    list2.Add(SelectorItemInfo("FNAME"))
    para = QueryBuilderParemeter()
    para.FormId = "ORG_Organizations"
    para.SelectItems = list2
    dynamicObjectCollection = QueryServiceHelper.GetDynamicObjectCollection(this.Context, para, None)
    for current in dynamicObjectCollection:
        dytemp = DynamicObject(EnumItem.EnumItemType)
        dytemp.EnumId = str(current["FORGID"])
        dytemp.Value = str(current["FORGID"])
        dytemp.Caption = LocaleValue(Convert.ToString(current["FName"]), this.Context.UserLocale.LCID)
        list.Add(EnumItem(dytemp))
    return list


def GetPermissionOrg(formId):
    bizObject = BusinessObject()
    bizObject.Id = formId
    bizObject.PermissionControl = this.View.ParentFormView.BillBusinessInfo.GetForm().SupportPermissionControl
    bizObject.SubSystemId = this.View.ParentFormView.Model.SubSytemId
    return PermissionServiceHelper.GetPermissionOrg(this.Context, bizObject, PermissionConst.New)

报表过滤页面的新建参考:https://vip.kingdee.com/article/70421948034792960?lang=zh-CN&productLineId=1

image.png

image.png

效果:

image.png

图标赞 8
8人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!

您的鼓励与嘉奖将成为创作者们前进的动力,如果觉得本文还不错,可以给予作者创作打赏哦!

请选择打赏金币数 *

10金币20金币30金币40金币50金币60金币
可用金币: 0