/** * 获取 * @description * @author nanshen * @creat 2021-09-15 17:28:37 */ import { CascaderProps } from "antd"; import { TreeData } from "../array/ArrayUtil"; import React, { ReactNode } from "react"; import "antd/es/cascader/style/index.css"; import "antd/es/input/style/index.css"; type OrgValueType = string | number; type FieldNames = { label?: string; value?: string; parent?: string; children?: string; rootPid?: any; }; export type OrgData = Omit; /** * 获取所有组织数据 * @param {type 窗口缓存/永久缓存,itemName 缓存全名,优先级高于全局} opts 缓存配置 */ export declare function queryByCache(opts?: { type?: "session" | "local"; itemName?: string; }): (T & OrgData)[]; /** * 传入oid获取组织详情 * @param oid 组织id * @param {type 窗口缓存/永久缓存,itemName 缓存全名,优先级高于全局} opts */ export declare function getOrgInfoByOid(oid: number | string, opts?: { type?: "session" | "local"; itemName?: string; }): (T & OrgData) | Record; /** * 组织树转列表 * @param list 不传默认取缓存 * @param children 树子项字段 * @param {type 窗口缓存/永久缓存,itemName 缓存全名,优先级高于全局} opts 若取传list,则忽略此项。 */ export declare function getOrgListByTree(list?: T[], children?: string, opts?: { type?: "session" | "local"; itemName?: string; }): (T & OrgData)[]; /** * 组织列表转组织树 * @param list 组织列表,不传则取缓存 * @param { label = "name", value = "oid", parent = "poid", children = "children", rootPid = null } fieldNames * @param {type 窗口缓存/永久缓存,itemName 缓存全名,优先级高于全局} opts 缓存配置,若传list,则忽略此项 */ export declare function getOrgTreeByList(list?: T[], fieldNames?: FieldNames, opts?: { type?: "session" | "local"; itemName?: string; }): (T & TreeData & OrgData)[]; /** * @name 获取oidPath * @param oid 组织id * @param rootOid 根节点的oid 默认为用户的oid * @param {type 窗口缓存/永久缓存,itemName 缓存全名,优先级高于全局} opts 缓存配置 */ export declare function getOidPathByOid(oid: number | string, rootOid?: any, opts?: { type?: "session" | "local"; itemName?: string; }): (number | string)[]; type OrgSelectProps = { options?: T[]; fieldNames?: FieldNames; opts?: { type?: "session" | "local"; itemName?: string; }; /** @name 最大层级options为undefined时有效 <= maxLevel */ maxLevel?: number; } & Omit, "options" | "fieldNames">; /** * 获取组织树选择 * @description 为了兼容之前的系统没有在此方法上改,推荐使用getOrgSelectAuto */ export declare function getOrgSelect(props?: OrgSelectProps): ReactNode; type OrgSelectAutoProps = { options?: T[]; fieldNames?: FieldNames; /** 是否缓存options(默认true) */ isCache?: boolean; opts?: { type?: "session" | "local"; itemName?: string; }; value?: OrgValueType | OrgValueType[]; onChange?: (oid: OrgValueType, selectedOptions?: T[]) => void; onSelect?: (oid: OrgValueType, selectedOptions?: T[]) => void; /** @name 最大层级options为undefined时有效 <= maxLevel */ maxLevel?: number; } & Omit, "options" | "fieldNames" | "onChange" | "value">; /** * (🌟推荐使用🌟)获取组织树选择 * 传入传出自动做处理 * @example * const App =()=>{ * const [form] = Form.useForm() * const handleOk = ({oid})=>{ * console.log(oid) // 1 * } * const {OrgSelectAuto} = TOOLS.org.get * return ( *
* * * * * {((Item) => )(TOOLS.org.get.OrgSelectAuto)} * *
* ) * } */ export declare const OrgSelectAuto: React.MemoExoticComponent<(props?: OrgSelectAutoProps) => JSX.Element>; type DownOrgListOpts = { /** 1.获取下level级组织(不包含本级)2.获取下level级(包含本级)3.获取所有下级部门(不包含本级)4.获取所有下级部门(包含本级) (默认4) */ type?: number; /** type为1,2生效,level=n就是下n级 (默认为1) */ level?: number; /** 默认取用户缓存的oid */ oid?: number; /** * @deprecated 之后的版本将会删除此字段请改用options字段 */ list?: (T & { oid?: number; })[]; /** 组织列表 */ options?: (T & { oid?: number; })[]; /** 是否输出成树,仅type为2、4时生效 (默认为false) */ isTree?: boolean; /** 缓存配置,若传list,则忽略此项,{type 窗口缓存/永久缓存,itemName 缓存全名,优先级高于全局} */ opts?: { type?: "session" | "local"; itemName?: string; }; }; /** * 获取下级组织 * @param elements */ export declare function getDownOrgList(elements?: DownOrgListOpts): T[]; export {};