king
2025-01-18 f9f60bb0dd17a764ba03faa8041f5b6e9e071553
src/menu/components/form/simple-form/index.jsx
@@ -2,12 +2,12 @@
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Popover, Modal, Button, Switch, message } from 'antd'
import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, SwapOutlined, FontColorsOutlined } from '@ant-design/icons'
import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, SwapOutlined, FontColorsOutlined, VerticalRightOutlined } from '@ant-design/icons'
import asyncComponent from '@/utils/asyncComponent'
import asyncIconComponent from '@/utils/asyncIconComponent'
import { getModalForm } from '@/templates/zshare/formconfig'
import { resetStyle, getTables, checkComponent } from '@/utils/utils-custom.js'
import { resetStyle, getTables, checkComponent, getInterfaces } from '@/utils/utils-custom.js'
import MKEmitter from '@/utils/events.js'
import Utils from '@/utils/utils.js'
import getWrapForm from './options'
@@ -19,7 +19,7 @@
const CardComponent = asyncComponent(() => import('@/templates/modalconfig/dragelement'))
const MobCardComponent = asyncComponent(() => import('@/mob/components/formdragelement'))
const FormAction = asyncComponent(() => import('../formaction'))
// const FormFork = asyncComponent(() => import('@/menu/modalconfig/formfork'))
const FormFork = asyncComponent(() => import('@/menu/modalconfig/formfork'))
const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
const PasteForms = asyncIconComponent(() => import('@/menu/components/share/pasteforms'))
@@ -241,7 +241,7 @@
  
  changecols = (type) => {
    let card = fromJS(this.state.card).toJS()
    let _this = this
    let that = this
    card.subcards[0].fields = card.subcards[0].fields.map(item => {
      item.labelwidth = 33.3
@@ -267,7 +267,7 @@
    confirm({
      content: `确定切换为${type}列吗?`,
      onOk() {
        _this.updateComponent(card)
        that.updateComponent(card)
      },
      onCancel() {}
    })
@@ -288,14 +288,14 @@
  closeForm = (cell) => {
    let card = fromJS(this.state.card).toJS()
    let _this = this
    let that = this
    card.subcards[0].fields = card.subcards[0].fields.filter(item => item.uuid !== cell.uuid)
    confirm({
      content: `确定删除<<${cell.label}>>吗?`,
      onOk() {
        _this.updateComponent(card)
        that.updateComponent(card)
      },
      onCancel() {}
    })
@@ -340,6 +340,8 @@
    card.subcards[0].fields = card.subcards[0].fields.filter(item => !item.focus)
    this.setState({card, visible: false, editform: null})
    this.updateComponent(card)
  }
  /**
@@ -466,9 +468,9 @@
        _card.setting.supModule = ''
      }
    } else if (res.datatype === 'public') {
      let interfaces = window.GLOB.customMenu.interfaces || []
      let interfaces = getInterfaces()
      let d = interfaces.filter(m => m.uuid === res.publicId && m.status === 'true')[0]
      let d = interfaces.filter(m => m.value === res.publicId)[0]
      if (d) {
        _card.columns = fromJS(d.columns).toJS()
@@ -501,14 +503,34 @@
  clearGroup = () => {
    let card = fromJS(this.state.card).toJS()
    let _this = this
    let that = this
    card.subcards[0].fields = []
    confirm({
      content: `确定清空表单吗?`,
      onOk() {
        _this.updateComponent(card)
        that.updateComponent(card)
      },
      onCancel() {}
    })
  }
  toLower = () => {
    let card = fromJS(this.state.card).toJS()
    let that = this
    card.subcards[0].fields = card.subcards[0].fields.map(item => {
      if (item.field) {
        item.field = item.field.toLowerCase()
      }
      return item
    })
    confirm({
      content: `确定将字段转为小写吗?`,
      onOk() {
        that.updateComponent(card)
      },
      onCancel() {}
    })
@@ -562,7 +584,8 @@
            } trigger="hover">
              <SwapOutlined />
            </Popover> : null}
            {/* <FormFork forms={card.subcards[0].fields}/> */}
            <VerticalRightOutlined style={{color: 'orange', transform: 'rotate(270deg)'}} title="字段转小写" onClick={this.toLower}/>
            <FormFork forms={card.subcards[0].fields}/>
            {/* <CopyOutlined title="复制" onClick={this.triggerCopy} /> */}
            <Switch checkedChildren="开" unCheckedChildren="关" defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} />
          </div>