| | |
| | | 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' |
| | |
| | | |
| | | 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 |
| | | }, () => { |
| | |
| | | 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 |
| | | }, () => { |
| | |
| | | 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({ |
| | |
| | | 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> |
| | | ) |