king
2020-03-31 86aab033b5129b00651b716ee70ce871cf670008
src/templates/zshare/dragelement/card.jsx
@@ -1,14 +1,13 @@
import React from 'react'
import { useDrag, useDrop } from 'react-dnd'
import { Icon, Button, Select, DatePicker, Input } from 'antd'
import { Icon, Select, DatePicker, Input } from 'antd'
import moment from 'moment'
import ItemTypes from './itemtypes'
import './index.scss'
const { MonthPicker, WeekPicker, RangePicker } = DatePicker
// const { Paragraph } = Typography
const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, profileCard, hasDrop, showfield }) => {
const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, hasDrop, showfield }) => {
  const originalIndex = findCard(id).index
  const [{ isDragging }, drag] = useDrag({
    item: { type: ItemTypes[type], id, originalIndex },
@@ -42,14 +41,6 @@
    delCard(id)
  }
  const copy = () => {
    copyCard(id)
  }
  const profile = () => {
    profileCard(id)
  }
  let _defaultValue = '' // 下拉搜索、时间范围类型,初始值需要预处理
  if (type === 'search' && (card.type === 'multiselect' || card.type === 'select' || card.type === 'link')) {
@@ -72,17 +63,6 @@
      } catch {
        _defaultValue = [null, null]
      }
    }
  }
  let hasProfile = false
  if (type === 'action') {
    if (['pop', 'prompt', 'exec'].includes(card.OpenType)) {
      hasProfile = true
    } else if (card.OpenType === 'excelIn' || card.OpenType === 'excelOut') {
      hasProfile = true
    } else if (card.funcType === 'print') {
      hasProfile = true
    }
  }
@@ -122,15 +102,6 @@
            </div>
          </div> : null
        }
        {type === 'action' ?
          <Button
            className={'mk-btn mk-' + card.class}
            icon={card.icon}
            key={card.uuid}
          >
            {card.label}{card.position === 'grid' && <Icon type="table" />}
          </Button> : null
        }
        {type === 'columns' ?
          <span className="ant-table-header-column">
            <div className="ant-table-column-sorters" title={card.label} style={{textAlign: card.Align}}>
@@ -152,8 +123,6 @@
      </div>
      <Icon className="edit" title="编辑" type="edit" onClick={edit} />
      <Icon className="edit close" title="删除" type="close" onClick={del} />
      {type === 'action' ? <Icon className="edit copy" title="复制" type="copy" onClick={copy} /> : null}
      {hasProfile ? <Icon className="edit profile" title="校验规则" type="profile" onClick={profile} /> : null}
    </div>
  )
}