king
2019-12-01 cf8e332b14ca79859fcd89f2ac097ed7c6aa66c5
src/components/sidemenu/editthdmenu/index.jsx
@@ -3,7 +3,7 @@
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'
@@ -19,6 +19,7 @@
const ModalConfig = asyncLoadComponent(() => import('@/templates/modalconfig'))
const { confirm } = Modal
const { TabPane } = Tabs
const { Search } = Input
const illust = {
  CommonTable: nortable
}
@@ -48,6 +49,7 @@
    selectTemp: '', // 选择模板
    usedTemplates: null,
    menuConfig: '',
    tempSearchKey: '',
    baseTemplates: [{
      title: '基础表格',
      type: 'CommonTable',
@@ -146,8 +148,24 @@
  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
      })
@@ -403,9 +421,9 @@
                      <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>
@@ -416,19 +434,28 @@
              </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>