UNPKG

yanzhen-design-vue

Version:

30 lines (29 loc) 759 B
import { contactsDataTypes, Contacts } from "../constants/contacts.mjs"; function handleDataType(item, defaultValue = "") { switch (true) { case item.isUser: return Contacts.USER; case item.isDept: return Contacts.ORGANIZATION; case item.isGroup: return Contacts.GROUP; case item.isRole: return Contacts.ROLE; case item.isOutorg: return Contacts.OUTORG; case contactsDataTypes.includes(item.type): return item.type; } return defaultValue ?? ""; } function handleDataTypeKey(activeKey) { let key = activeKey === Contacts.USUALLY ? Contacts.USER : activeKey; if (key.startsWith(Contacts.USER)) { key = Contacts.USER; } return key; } export { handleDataType, handleDataTypeKey };