56 lines
1.7 KiB
JavaScript
56 lines
1.7 KiB
JavaScript
/*
|
|
* Author: 黎永顺
|
|
* name: 设置项目
|
|
* Description:
|
|
* Date: 2023/3/6
|
|
*/
|
|
import React, { Component } from "react";
|
|
import { WeaCheckbox, WeaSearchGroup } from "ecCom";
|
|
|
|
class SelectItemsWrapper extends Component {
|
|
renderTitle = (item) => {
|
|
const { onSelectGroupAll } = this.props;
|
|
const { groupName, groupId } = item;
|
|
return <div className="setGroupWrapper">
|
|
<WeaCheckbox content={groupName} onChange={(val) => onSelectGroupAll(groupId, val)}/>
|
|
<span className="checkedtitle">已选择0个字段</span>
|
|
</div>;
|
|
};
|
|
|
|
render() {
|
|
const { dataSource, onSelectItem } = this.props;
|
|
return (
|
|
<React.Fragment>
|
|
{
|
|
_.map(dataSource, item => {
|
|
const { items } = item;
|
|
return <WeaSearchGroup title={this.renderTitle(item)} showGroup>
|
|
<div className="itemsWrapper">
|
|
{
|
|
_.isEmpty(items) ?
|
|
<span className="empty">暂无数据</span> :
|
|
<ul className="itemContUl">
|
|
{
|
|
_.map(items, child => {
|
|
const { name, checked, id } = child;
|
|
return <li title={name}>
|
|
<WeaCheckbox
|
|
content={name} value={checked ? "1" : "0"}
|
|
onChange={(val) => onSelectItem(id, val)}
|
|
/>
|
|
</li>;
|
|
})
|
|
}
|
|
</ul>
|
|
}
|
|
</div>
|
|
</WeaSearchGroup>;
|
|
})
|
|
}
|
|
</React.Fragment>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default SelectItemsWrapper;
|