| | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import { getSearchForm } from '@/templates/zshare/formconfig' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import SearchForm from './searchform' |
| | | import DragElement from './dragsearch' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | |
| | | const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) |
| | | |
| | | class SearchComponent extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) || this.props.config.setting.show !== nextProps.config.setting.show |
| | | if (!is(fromJS(this.state), fromJS(nextState))) { |
| | | return true |
| | | } else if (this.props.config.wrap) { |
| | | return this.props.config.wrap.show !== nextProps.config.wrap.show |
| | | } else { |
| | | return this.props.config.setting.show !== nextProps.config.setting.show |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | | const { dict, searchlist, visible, sqlVerifing, card, showField } = this.state |
| | | |
| | | let show = config.setting.show |
| | | if (config.wrap) { |
| | | show = config.wrap.show |
| | | } |
| | | |
| | | return ( |
| | | <div className={'model-table-search-list length' + searchlist.length}> |
| | | <Tooltip placement="bottomLeft" overlayClassName="middle" title={dict['model.tooltip.search.guide']}> |
| | | <Icon type="question-circle" /> |
| | | </Tooltip> |
| | | <FieldsComponent config={config} type="search" /> |
| | | <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={showField} onChange={this.onFieldChange} /> |
| | | <DragElement |
| | | list={searchlist} |
| | | show={config.setting.show} |
| | | show={show} |
| | | showField={showField} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleSearch} |