| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { notification, Modal, Button, Spin, Icon, Col, Card, Tabs, Row } from 'antd' |
| | | import { notification, Modal, Button, Spin, Icon, Col, Card, Tabs, Row, Input } from 'antd' |
| | | import Preview from '@/components/preview' |
| | | import TransferForm from '@/components/transferform' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | const ModalConfig = asyncLoadComponent(() => import('@/templates/modalconfig')) |
| | | const { confirm } = Modal |
| | | const { TabPane } = Tabs |
| | | const { Search } = Input |
| | | const illust = { |
| | | CommonTable: nortable |
| | | } |
| | |
| | | selectTemp: '', // 选择模板 |
| | | usedTemplates: null, |
| | | menuConfig: '', |
| | | tempSearchKey: '', |
| | | baseTemplates: [{ |
| | | title: '基础表格', |
| | | type: 'CommonTable', |
| | |
| | | handleSubBtn = (type) => { |
| | | // 操作按钮:添加、解除冻结、确认及关闭 |
| | | if (type === 'add') { // 点击添加时,展开模板 |
| | | if (previewList && !is(fromJS(previewList), fromJS(this.state.subMenulist))) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['header.menu.presave'], |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | this.setState({tabview: 'template', type: 'add'}) |
| | | } else if (type === 'thaw') { |
| | | if (previewList && !is(fromJS(previewList), fromJS(this.state.subMenulist))) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['header.menu.presave'], |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | this.setState({ |
| | | thawMvisible: true |
| | | }) |
| | |
| | | <Col key={template.type} span={8}> |
| | | <Card |
| | | title={template.title}> |
| | | <img src={template.url} alt=""/> |
| | | <img onClick={() => {this.previewPicture(template.url)}} src={template.url} alt=""/> |
| | | <div className="card-operation"> |
| | | <Button type="primary" onClick={() => {this.previewPicture(template.url)}}>预览</Button> |
| | | {/* <Button type="primary" onClick={() => {this.previewPicture(template.url)}}>预览</Button> */} |
| | | <Button type="primary" onClick={() => {this.useTemplate(template)}}>使用模板</Button> |
| | | </div> |
| | | </Card> |
| | |
| | | </TabPane> |
| | | <TabPane tab="已使用模板" key="2"> |
| | | <Row> |
| | | <Col span={8}> |
| | | <Search placeholder="请输入菜单名称" defaultValue={this.state.tempSearchKey} onSearch={value => {this.setState({tempSearchKey: value})}} enterButton /> |
| | | </Col> |
| | | </Row> |
| | | <Row> |
| | | {this.state.usedTemplates && this.state.usedTemplates.map((template, index) => { |
| | | if (template.title.toLowerCase().indexOf(this.state.tempSearchKey.toLowerCase()) >= 0) { |
| | | return ( |
| | | <Col key={template.type + index} span={8}> |
| | | <Card |
| | | title={template.title}> |
| | | <img src={template.url} alt=""/> |
| | | <img onClick={() => {this.previewPicture(template.url)}} src={template.url} alt=""/> |
| | | <div className="card-operation"> |
| | | <Button type="primary" onClick={() => {this.previewPicture(template.url)}}>预览</Button> |
| | | {/* <Button type="primary" onClick={() => {this.previewPicture(template.url)}}>预览</Button> */} |
| | | <Button type="primary" onClick={() => {this.useTemplate(template)}}>使用模板</Button> |
| | | </div> |
| | | </Card> |
| | | </Col> |
| | | ) |
| | | } else { |
| | | return '' |
| | | } |
| | | })} |
| | | </Row> |
| | | </TabPane> |