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.
dashboard/src/components/search/BusinessUnitSelect.jsx

37 lines
1.2 KiB
JavaScript

import React, {Component} from 'react';
import {Select} from 'antd';
import {observer} from "mobx-react";
import { biz, bu } from '../../libs/ht';
const Business_unit = (props) => {
const { store, mode, value, onChange, show_all, ...extProps } = props;
const _show_all = ['tags', 'multiple'].includes(mode) ? false : show_all;
return (
<div>
<Select
mode={mode || null}
allowClear
style={{width: '100%',}}
placeholder="选择事业部"
value={value || undefined } // { key: '-1', label: 'ALL 事业部' }
onChange={(value) => {
if (typeof onChange === 'function') {
onChange(value);
}
// store?.bu_handleChange(value);
}}
labelInValue={true}
{...extProps}
>
{_show_all ? <Select.Option key="-1" value="ALL">ALL 事业部</Select.Option> : ''}
{bu.map(ele => <Select.Option key={ele.key} value={ele.label}>{ele.label}</Select.Option>)}
</Select>
</div>
);
};
/**
* HT的事业部
*/
export default observer(Business_unit);