From 54d01e6ef9ac31f10de4a0e92824eba50b77eda6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 27 九月 2021 18:40:51 +0800 Subject: [PATCH] 2021-09-27 --- src/tabviews/zshare/topSearch/index.jsx | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index defee38..c2a3416 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { fromJS } from 'immutable' -import { Form, Row, Col, Input, Button, notification, Modal, Icon } from 'antd' +import { is, fromJS } from 'immutable' +import { Form, Row, Col, Button, notification, Modal, Icon } from 'antd' import moment from 'moment' import Api from '@/api' @@ -11,9 +11,8 @@ import Utils from '@/utils/utils.js' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' +import MKInput from './mkInput' import './index.scss' - -const { Search } = Input const MutilForm = asyncSpinComponent(() => import('./advanceform')) const MKCheckCard = asyncComponent(() => import('@/tabviews/zshare/mutilform/checkCard')) @@ -201,6 +200,10 @@ this.improveSearch(mainItems, localItems) } }) + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) } // 鏌ヨ涓嬫媺鑿滃崟 @@ -446,15 +449,12 @@ ] let content = null + let className = '' let field = item.field lastRadio = item.ratio || 6 if (item.type === 'text') { - if (item.inputType === 'search') { - content = <Search allowClear placeholder={item.labelShow === 'false' ? item.label : ''} autoComplete="off" onSearch={this.handleSubmit} enterButton/> - } else { - content = <Input allowClear placeholder={item.labelShow === 'false' ? item.label : ''} autoComplete="off" onPressEnter={this.handleSubmit} /> - } + content = (<MKInput config={item} onInputSubmit={this.handleSubmit} />) } else if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect') { content = (<MKSelect config={item} onChange={(val, defer) => this.recordChange(val, defer, item)} />) } else if (item.type === 'date' || item.type === 'datemonth' || item.type === 'dateweek' || item.type === 'daterange') { @@ -463,13 +463,14 @@ field = item.datefield content = <DateGroup position={index} config={item} onChange={(val, type) => this.dateGroupChange(val, type, item)} /> } else if (item.type === 'checkcard') { + className = 'checkcard' content = <MKCheckCard card={item} onChange={this.handleSubmit} /> } if (content) { fields.push( <Col span={item.ratio || 6} key={index}> - <Form.Item label={item.labelShow !== 'false' ? item.label : ''}> + <Form.Item className={className} label={item.labelShow !== 'false' ? item.label : ''}> {getFieldDecorator(field, { initialValue: item.initval, rules: _rules -- Gitblit v1.8.0