Commit c287f5dc authored by KeYong's avatar KeYong

修改重点设备分类组件

parent 5d419e98
......@@ -391,14 +391,22 @@ class EquipmentModel extends Component {
queryDictionaryAction(type).then(data => {
const categoryDictionary = data[type];
if (categoryDictionary) {
const options = [];
categoryDictionary.forEach(dict => {
options.push({
label: dict.label,
value: dict.value
});
});
this.setState({ categories: options });
// const options = [];
// categoryDictionary.forEach(dict => {
// options.push({
// label: dict.label,
// value: dict.value
// });
// });
this.setState({ categories: recursive(categoryDictionary).map((e) => {
return {
key: e.key,
value: e.value,
title: e.title,
children: e.children && e.children.length > 0 ? e.children : undefined
};
})
})
}
});
}
......@@ -433,12 +441,19 @@ class EquipmentModel extends Component {
<Input className='risk_factor_input' required value={form.code} onChange={e => this.onInputChange('code', e.target.value)} />
</FormItem>
<FormItem label={<span>分类</span>} field="category" {...formItemLayout}>
<Select
<TreeSelect
className="risk_factor_select"
data={categories}
treeData={categories}
renderOption={item => <Option value={item.value}>{item.label}</Option>}
value={form.category}
onChange={e => this.onSelectChange('category', e)}
placeholder='请选择'
value={`${form.category ? form.category : ''}`}
style={{ width: '200px' }}
dropdownStyle={{ maxHeight: 200, overflow: 'auto' }}
treeDefaultExpandAll
// showSearch
// treeNodeFilterProp='title'
// filterTreeNode={(inputValue, treeNode) => treeNode.props.title.toLocaleLowerCase().includes(inputValue.toLocaleLowerCase())}
/>
</FormItem>
<FormItem label={<span>所属区域</span>} field="riskSourceId" {...formItemLayout}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment