king
2021-12-22 bd1dfc9e6c9b9f8076ca2783ce598e0936b4c664
src/mob/components/search/single-search/index.jsx
@@ -1,7 +1,8 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Popover, Icon, Input } from 'antd'
import { Popover, Input, Button } from 'antd'
import { ToolOutlined, ScanOutlined, EditOutlined, FontColorsOutlined, DeleteOutlined } from '@ant-design/icons'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
@@ -10,8 +11,6 @@
import getWrapForm from './options'
import MKEmitter from '@/utils/events.js'
import './index.scss'
const { Search } = Input
const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
@@ -46,7 +45,7 @@
        width: 24,
        name: card.name,
        subtype: card.subtype,
        wrap: { name: card.name, width: 24, label: '搜索', field: '', show: 'button' },
        wrap: { name: card.name, width: 24, label: '搜索', field: '', show: 'text' },
        style: {
          marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px',
          paddingLeft: '10px', paddingRight: '10px', paddingTop: '10px', paddingBottom: '10px',
@@ -116,9 +115,9 @@
  }
  getWrapForms = () => {
    const { wrap, action } = this.state.card
    const { wrap } = this.state.card
    return getWrapForm(wrap, action)
    return getWrapForm(wrap)
  }
  updateWrap = (res) => {
@@ -138,18 +137,21 @@
    return (
      <div className="single-search-edit-list" onClick={this.clickComponent} id={card.uuid} style={_style}>
        <Search placeholder={card.wrap.label} value={card.initval} enterButton />
        <Input placeholder={card.labelShow === 'false' ? card.label : ''} value={card.initval} />
        <div className="search-wrap" style={{borderRadius: card.wrap.borderRadius || 0, height: card.wrap.height || 32}}>
          <Input placeholder={card.wrap.label} value={card.wrap.initval || ''} />
          {card.wrap.scan === 'show' ? <ScanOutlined style={{lineHeight: `${card.wrap.height || 32}px`}} /> : null}
          {card.wrap.show === 'text' ? <Button type="primary">搜索</Button> : <Button icon="search" type="primary"></Button>}
        </div>
        <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
          <div className="mk-popover-control">
            <NormalForm title="搜索设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}>
              <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/>
              <EditOutlined style={{color: '#1890ff'}} title="编辑"/>
            </NormalForm>
            <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" />
            <Icon className="close" title="delete" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} />
            <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/>
            <DeleteOutlined className="close" onClick={() => this.props.deletecomponent(card.uuid)} />
          </div>
        } trigger="hover">
          <Icon type="tool" />
          <ToolOutlined />
        </Popover>
      </div>
    )