| 9 | class Menu extends React.Component { |
| 10 | |
| 11 | addCell(type) { |
| 12 | const Widget = app.load_dict('dashboard_widgets')[type] |
| 13 | const { params: { editLayer } } = this.props |
| 14 | const params = { |
| 15 | key: (Math.random() * 100).toString(), |
| 16 | params: { |
| 17 | layer: editLayer, |
| 18 | type, |
| 19 | title: '未命名标题' |
| 20 | }, |
| 21 | layout: { x: 0, y: 0, w: 4, h: 4 } |
| 22 | } |
| 23 | this.props.addCell(params) |
| 24 | |
| 25 | if(this.props.onAddCell) { |
| 26 | this.props.onAddCell(params.key) |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | changeLayer(editLayer) { |
| 31 | const { params, saveParams } = this.props |