king
2025-04-23 c8dec113736cc78c47cd63377d756d364b42a94e
src/menu/components/share/pasteforms/index.jsx
@@ -10,7 +10,7 @@
const PasteForm = asyncComponent(() => import('@/templates/zshare/pasteform'))
class PasteController extends Component {
class PasteForms extends Component {
  static propTpyes = {
    config: PropTypes.object,        // 组件配置
    update: PropTypes.func
@@ -26,6 +26,10 @@
    const { config } = this.props
    this.pasteFormRef.handleConfirm().then(res => {
      if (res.copyType === 'search' && ['text', 'select', 'multiselect', 'link', 'checkcard', 'date', 'datemonth'].includes(res.type)) {
        res.copyType = 'form'
      }
      if (!['form', 'forms', 'formgroup', 'simpleform'].includes(res.copyType)) {
        notification.warning({ top: 92, message: '配置信息格式错误!', duration: 5 })
        return
@@ -34,6 +38,8 @@
      if (res.copyType === 'form') {
        delete res.copyType
        res = {fields: [res]}
      } else if (res.copyType === 'simpleform') {
        res = {fields: res.subcards[0].fields}
      }
      res.fields = res.fields || []
@@ -81,6 +87,7 @@
    let forms = fromJS(config.fields).toJS()
    let fields = fromJS(result.fields).toJS()
    let repeats = []
    let lastId = ''
    forms = forms.map(item => {
      if (!item.field) return item
@@ -88,11 +95,16 @@
      let cell = fields.filter(m => m.field && m.field.toLowerCase() === item.field.toLowerCase())[0]
      if (cell) {
        repeats.push(cell.field)
        lastId = cell.uuid
        return cell
      }
      return item
    })
    if (lastId) {
      window.GLOB.formId = lastId
    }
    
    fields = fields.filter(m => !m.field || !repeats.includes(m.field))
@@ -171,4 +183,4 @@
  }
}
export default PasteController
export default PasteForms