index.js 1.7 KB
Newer Older
王绍森's avatar
王绍森 committed
1 2 3 4 5 6
import ButtonDiy from '@/baseComponent/ButtonDiy';
import React, { Component, Fragment } from 'react';
import ModalBatch from './ModalBatch';
import ModalForm from './ModalForm';

export default class ButtonListDom extends Component {
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
	render() {
		const { config, getPage, selectRows, formValues, children, search, listData } = this.props;
		return (
			<div style={{ height: '50px', padding: '12px 0 12px 12px', positon: 'relative' }}>
				{config.map((item, i) => {
					switch (item.component) {
						case 'ModalForm': // 新增按钮 + 弹窗
							return (
								<ModalForm {...item} key={item.type} getPage={getPage} selectRows={selectRows} />
							);
						case 'ModalBatch': // 一般按钮 点击后弹出 填写一些类似 审核理由 意见之类的信息
							return (
								<ModalBatch
									key={item.type}
									{...item}
									handleSelectRows={this.props.handleSelectRows}
									getPage={getPage}
									selectRows={selectRows}
								/>
							);
						case 'OpenUrl': // 点击按钮 打开一个新窗口
							return window.open(item.url);
						case 'Normal':
							return (
								<ButtonDiy
									name={item.name}
									key={item.type}
									className={item.className || 'defaultBule'}
									handleClick={() => {
										item.handleClick(selectRows, formValues, getPage, search);
									}}
								/>
							);
						case 'RenderComponent':
							return item.render({
								name: item.name,
								selectRows,
								formValues,
								getPage,
								search,
								listData,
							});
						default:
							break;
						//  return <ButtonDiy></ButtonDiy>;
					}
				})}
				<span style={{ display: 'inline-block' }}>{children}</span>
			</div>
		);
	}
王绍森's avatar
王绍森 committed
58
}