From cf8e332b14ca79859fcd89f2ac097ed7c6aa66c5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 01 十二月 2019 18:15:45 +0800 Subject: [PATCH] 2019-12-01 --- src/components/sidemenu/editthdmenu/index.jsx | 57 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/components/sidemenu/editthdmenu/index.jsx b/src/components/sidemenu/editthdmenu/index.jsx index 2e9a742..3e5a4d9 100644 --- a/src/components/sidemenu/editthdmenu/index.jsx +++ b/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) => { - return ( - <Col key={template.type + index} span={8}> - <Card - title={template.title}> - <img src={template.url} alt=""/> - <div className="card-operation"> - <Button type="primary" onClick={() => {this.previewPicture(template.url)}}>棰勮</Button> - <Button type="primary" onClick={() => {this.useTemplate(template)}}>浣跨敤妯℃澘</Button> - </div> - </Card> - </Col> - ) + if (template.title.toLowerCase().indexOf(this.state.tempSearchKey.toLowerCase()) >= 0) { + return ( + <Col key={template.type + index} span={8}> + <Card + title={template.title}> + <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.useTemplate(template)}}>浣跨敤妯℃澘</Button> + </div> + </Card> + </Col> + ) + } else { + return '' + } })} </Row> </TabPane> -- Gitblit v1.8.0