From 37a134bd23ec4b227a0e010b08a1a89c2bbaaa0d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 03 十一月 2020 17:10:14 +0800 Subject: [PATCH] 2020-11-03 --- src/templates/zshare/editcomponent/index.jsx | 94 +++++++++++++++++++++++------------------------ 1 files changed, 46 insertions(+), 48 deletions(-) diff --git a/src/templates/zshare/editcomponent/index.jsx b/src/templates/zshare/editcomponent/index.jsx index adb6bd8..8d4083f 100644 --- a/src/templates/zshare/editcomponent/index.jsx +++ b/src/templates/zshare/editcomponent/index.jsx @@ -4,6 +4,7 @@ import { Menu, Dropdown, Icon, Modal, Spin, notification } from 'antd' import Api from '@/api' +import Utils from '@/utils/utils.js' import PasteForm from '@/templates/zshare/pasteform' import ReplaceForm from '@/templates/zshare/replaceform' import TransferForm from '@/templates/zshare/basetransferform' @@ -136,14 +137,8 @@ this.pasteFormRef.handleConfirm().then(res => { if (['maintable', 'subtable'].includes(type) && res.copyType === 'action') { - if (this.props.type === 'subtable' && !['pop', 'prompt', 'exec', 'excelIn', 'excelOut', 'popview'].includes(res.OpenType)) { - notification.warning({ - top: 92, - message: '涓嶆敮鎸佹鎵撳紑鏂瑰紡锛�', - duration: 5 - }) - return - } + res.uuid = Utils.getuuid() + this.setState({ pasteVisible: false }, () => { @@ -152,7 +147,24 @@ content: res }) }) - } else if (['maintable', 'subtable'].includes(type) && res.copyType === 'search') { + } else if (['maintable', 'subtable', 'calendar'].includes(type) && (res.copyType === 'search' || res.copyType === 'form')) { + res.uuid = Utils.getuuid() + + // search锛� text select multiselect link date dateweek datemonth daterange group + // form锛� text number select multiselect link switch checkbox radio checkcard + // fileupload date datemonth datetime textarea hint color funcvar + if (res.copyType === 'form') { + if (['number', 'switch', 'textarea', 'checkcard', 'fileupload', 'hint', 'color', 'funcvar'].includes(res.type)) { + res.type = 'text' + } else if (res.type === 'radio') { + res.type = 'select' + } else if (res.type === 'checkbox') { + res.type = 'multiselect' + } else if (res.type === 'datetime') { + res.type = 'date' + } + } + this.setState({ pasteVisible: false }, () => { @@ -180,68 +192,54 @@ content: res }) }) - } else if (['form'].includes(type) && res.copyType === 'form') { - if (res.type === 'linkMain') { - notification.warning({ - top: 92, - message: '涓嶆敮鎸佹琛ㄥ崟绫诲瀷锛�', - duration: 10 - }) - return - } - + } else if (['form'].includes(type) && (res.copyType === 'form' || res.copyType === 'search')) { let _config = fromJS(config).toJS() - let fieldrepet = false - let labelrepet = false + let fields = [] + let labels = [] + + res.uuid = Utils.getuuid() + + // search锛� text select multiselect link date dateweek datemonth daterange group + // form锛� text number select multiselect link switch checkbox radio checkcard + // fileupload date datemonth datetime textarea hint color funcvar + if (res.copyType === 'search') { + if (res.type === 'dateweek' || res.type === 'daterange' || res.type === 'group') { + res.type = 'date' + } + } if (_config.groups.length > 0) { _config.groups.forEach(group => { group.sublist.forEach(item => { - if (item.uuid === res.uuid) { - fieldrepet = true - } else if (item.field === res.field) { - fieldrepet = true - } else if (item.label === res.label) { - labelrepet = true - } + fields.push(item.field) + labels.push(item.label) }) + if (group.default) { + group.sublist.push(res) + } }) } else { _config.fields.forEach(item => { - if (item.uuid === res.uuid) { - fieldrepet = true - } else if (item.field === res.field) { - fieldrepet = true - } else if (item.label === res.label) { - labelrepet = true - } + fields.push(item.field) + labels.push(item.label) }) + _config.fields.push(res) } - if (fieldrepet) { + if (fields.includes(res.field)) { notification.warning({ top: 92, message: '瀛楁宸插瓨鍦紒', duration: 10 }) return - } else if (labelrepet) { + } else if (labels.includes(res.label)) { notification.warning({ top: 92, message: '鍚嶇О宸插瓨鍦紒', duration: 10 }) return - } - - if (_config.groups.length > 0) { - _config.groups.forEach(group => { - if (group.default) { - group.sublist.push(res) - } - }) - } else { - _config.fields.push(res) } this.setState({ @@ -280,7 +278,7 @@ const menu = ( <Menu onClick={this.handleMenuClick}> {['maintable', 'subtable'].includes(type) ? <Menu.Item key="thaw"><Icon type="unlock" />{dict['header.form.thawbutton']}</Menu.Item> : null} - {['maintable', 'subtable', 'form'].includes(type) ? <Menu.Item key="paste"><Icon type="snippets" />{dict['header.form.paste']}</Menu.Item> : null} + {['maintable', 'subtable', 'form', 'calendar'].includes(type) ? <Menu.Item key="paste"><Icon type="snippets" />{dict['header.form.paste']}</Menu.Item> : null} {/* <Menu.Item key="replace"><Icon type="retweet" />鏇挎崲</Menu.Item> */} </Menu> ) -- Gitblit v1.8.0