king
2022-10-17 e8edfdadb561cd83bf6e1c3e00d55b8cc2aee6d5
src/templates/sharecomponent/fieldscomponent/index.jsx
@@ -4,8 +4,6 @@
import { Button, Modal, Empty, notification } from 'antd'
import Utils from '@/utils/utils.js'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import EditCard from './editcard'
import MKEmitter from '@/utils/events.js'
@@ -19,7 +17,6 @@
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    appType: sessionStorage.getItem('appType'),
    fields: [],             // 字段集
    visible: false,         // 模态框控制
@@ -126,7 +123,6 @@
          initval: initval,
          type: item.type,
          resourceType: '0',
          setAll: 'false',
          options: [],
          orderType: 'asc',
          match: _match,
@@ -146,7 +142,7 @@
          Hide: 'false',
          IsSort: item.type === 'picture' ? 'false' : 'true',
          type: item.type,
          Width: 120
          Width: item.type === 'number' ? 80 : 120
        }
        if (item.type === 'number') {
@@ -189,7 +185,6 @@
          initval: item.type === 'number' ? 0 : '',
          type: item.type,
          resourceType: '0',
          setAll: 'false',
          span: span,
          labelwidth: 33.3,
          options: [],
@@ -198,6 +193,27 @@
          orderType: 'asc',
          readonly: 'false',
          required: 'true'
        }
        if (item.type === 'text' && item.length >= 256) {
          newcard.type = 'textarea'
          newcard.fieldlength = item.length
          if (lastItem && lastItem.type === newcard.type) {
            newcard.span = lastItem.span
            newcard.labelwidth = lastItem.labelwidth
          } else if (lastItem) {
            newcard.span = 24
            if (lastItem.span === 12) {
              newcard.labelwidth = 16.2
            } else if (lastItem.span === 8) {
              newcard.labelwidth = 10.5
            } else if (lastItem.span === 8) {
              newcard.labelwidth = 7.7
            }
          } else {
            newcard.span = 24
            newcard.labelwidth = 16.2
          }
        }
        items.push(newcard)
@@ -243,19 +259,19 @@
  render() {
    const { type } = this.props
    const { dict, fields } = this.state
    const { fields } = this.state
    return (
      <div className="quickly-add">
        <Button type="primary" block onClick={this.queryField}>{dict['model.batchAdd']}</Button>
        <Button type="primary" block onClick={this.queryField}>批量添加</Button>
        {/* 根据字段名添加显示列及搜索条件 */}
        <Modal
          wrapClassName="model-table-fieldmanage-modal"
          title={dict['model.edit']}
          title="编辑"
          visible={this.state.visible}
          width={'65vw'}
          maskClosable={false}
          cancelText={dict['model.close']}
          cancelText="关闭"
          onOk={this.addFieldSubmit}
          onCancel={() => this.setState({ visible: false })}
          destroyOnClose