You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.6 KiB
JavaScript
61 lines
2.6 KiB
JavaScript
import { Component } from 'react';
|
|
import { Select } from 'antd';
|
|
// import { groups, leafGroup } from '../../libs/ht';
|
|
|
|
/**
|
|
* 小组
|
|
*/
|
|
export const groups = [
|
|
{ value: '1,2,28,7,33', key: '1,2,28,7,33', label: 'GH事业部', code: 'GH', children: [1, 2, 28, 7, 33] },
|
|
{ value: '8,9,11,12,20,21', key: '8,9,11,12,20,21', label: '国际事业部', code: 'INT', children: [8, 9, 11, 12, 20, 21] },
|
|
{ value: '10,18,16,30', key: '10,18,16,30', label: '孵化学院', code: '', children: [10, 18, 16, 30] },
|
|
{ value: '1', key: '1', label: 'CH直销', code: '', children: [] },
|
|
{ value: '2', key: '2', label: 'CH大客户', code: '', children: [] },
|
|
{ value: '28', key: '28', label: 'AH亚洲项目组', code: 'AH', children: [] },
|
|
{ value: '33', key: '33', label: 'GH项目组', code: '', children: [] },
|
|
{ value: '7', key: '7', label: '市场推广', code: '', children: [] },
|
|
{ value: '8', key: '8', label: '德语', code: '', children: [] },
|
|
{ value: '9', key: '9', label: '日语', code: '', children: [] },
|
|
{ value: '11', key: '11', label: '法语', code: '', children: [] },
|
|
{ value: '12', key: '12', label: '西语', code: '', children: [] },
|
|
{ value: '20', key: '20', label: '俄语', code: '', children: [] },
|
|
{ value: '21', key: '21', label: '意语', code: '', children: [] },
|
|
{ value: '10', key: '10', label: '商旅', code: '', children: [] },
|
|
{ value: '18', key: '18', label: 'CT', code: 'CT', children: [] },
|
|
{ value: '16', key: '16', label: 'APP', code: 'APP', children: [] },
|
|
{ value: '30', key: '30', label: 'Trippest', code: 'TP', children: [] },
|
|
{ value: '31', key: '31', label: '花梨鹰', code: '', children: [] },
|
|
];
|
|
export const groupsMappedByCode = groups.reduce((a, c) => ({ ...a, [String(c.code || c.key)]: c }), {});
|
|
export const groupsMappedByKey = groups.reduce((a, c) => ({ ...a, [String(c.key)]: c }), {});
|
|
export const leafGroup = groups.slice(3);
|
|
export const overviewGroup = groups.slice(0, 3); // todo: 花梨鹰 APP Trippest
|
|
|
|
export const DeptSelector = ({show_all, isLeaf,...props}) => {
|
|
const _show_all = ['tags', 'multiple'].includes(props.mode) ? false : show_all;
|
|
const options = isLeaf===true ? leafGroup : groups;
|
|
|
|
return (
|
|
<div>
|
|
<Select
|
|
mode={props.mode}
|
|
placeholder="选择小组"
|
|
labelInValue
|
|
maxTagCount={1}
|
|
allowClear={props.mode != null}
|
|
{...props}
|
|
options={options}
|
|
/>
|
|
{/* {_show_all ? (
|
|
<Select.Option key="ALL" value="ALL">
|
|
所有小组
|
|
</Select.Option>
|
|
) : (
|
|
''
|
|
)} */}
|
|
</div>
|
|
);
|
|
|
|
};
|
|
export default DeptSelector;
|