king
2021-03-23 a8e94242166881639cecf3809e45ca527233ebd7
src/templates/modalconfig/dragelement/card.jsx
@@ -1,6 +1,6 @@
import React from 'react'
import { useDrag, useDrop } from 'react-dnd'
import { Icon, Select, DatePicker, Input, InputNumber, Button, Popover, Switch, Radio, Checkbox } from 'antd'
import { Icon, Select, DatePicker, Input, InputNumber, Button, Popover, Switch, Radio, Checkbox, Form } from 'antd'
import moment from 'moment'
import asyncComponent from '@/utils/asyncComponent'
@@ -62,29 +62,29 @@
      selectval = card.emptyText || '空'
    }
  }
  let labelCol = 'ant-col-sm-8'
  let wrapCol = 'ant-col-sm-16'
  let isEntireLine = false
  // let labelCol = 'ant-col-sm-8'
  // let wrapCol = 'ant-col-sm-16'
  // let isEntireLine = false
  if (card.entireLine === 'true' || ['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type)) {
    isEntireLine = true
  }
  // if (card.entireLine === 'true' || ['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type)) {
  //   isEntireLine = true
  // }
  if (isEntireLine) {
    if (cols === '2') {
      labelCol = 'ant-col-sm-4'
      wrapCol = 'ant-col-sm-20'
    } else if (cols === '3') {
      labelCol = 'ant-col-cuslabel'
      wrapCol = 'ant-col-cuswrap'
    } else if (cols === '4') {
      labelCol = 'ant-col-sm-2'
      wrapCol = 'ant-col-sm-22'
    }
    if (card.hidelabel === 'true') {
      wrapCol = 'ant-col-sm-24'
    }
  }
  // if (isEntireLine) {
  //   if (cols === '2') {
  //     labelCol = 'ant-col-sm-4'
  //     wrapCol = 'ant-col-sm-20'
  //   } else if (cols === '3') {
  //     labelCol = 'ant-col-cuslabel'
  //     wrapCol = 'ant-col-cuswrap'
  //   } else if (cols === '4') {
  //     labelCol = 'ant-col-sm-2'
  //     wrapCol = 'ant-col-sm-22'
  //   }
  //   if (card.hidelabel === 'true') {
  //     wrapCol = 'ant-col-sm-24'
  //   }
  // }
  let formItem = null
  if (card.type === 'text') {
@@ -134,6 +134,8 @@
    </Checkbox.Group>)
  } else if (card.type === 'hint') {
    formItem = <div style={{marginTop: '10px', color: 'rgba(0, 0, 0, 0.85)'}}>{card.message}</div>
  } else if (card.type === 'split') {
    formItem = <div className="split-line">{card.label}</div>
  } else if (card.type === 'checkcard') {
    formItem = <CheckCard width={card.width} ratio={card.ratio} display={card.display} fields={card.fields} options={card.options} />
  }
@@ -148,7 +150,18 @@
    } trigger="hover">
      <div className="page-card" style={{ opacity: opacity}}>
        <div ref={node => drag(drop(node))}>
          {<div className="ant-row ant-form-item">
          {card.type === 'split' ? formItem : <Form.Item
            className="ant-form-item"
            colon={!!card.label}
            label={card.tooltip ? <span><Icon type="question-circle" />{card.label}</span> : card.label}
            required={card.required === 'true'}
            extra={card.extra || null}
            labelCol={card.labelwidth ? {style: {width: card.labelwidth + '%'}} : null}
          >
            {formItem}
            {showField ? <div className="field-name">{card.field}</div> : ''}
          </Form.Item>}
          {/* <div className="ant-row ant-form-item">
            {card.hidelabel !== 'true' ? <div className={'ant-col ant-form-item-label ant-col-xs-24 ' + labelCol}>
              {card.label ? <label className={card.required === 'true' ? 'required' : ''}>{card.tooltip ? 
                <Icon type="question-circle" /> : null}
@@ -158,7 +171,7 @@
              {formItem}
              {showField ? card.field : ''}
            </div>
          </div>}
          </div> */}
        </div>
      </div>
    </Popover>