| | |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | import { resetStyle, getTables } from '@/utils/utils-custom.js' |
| | | import { resetStyle, getTables, checkComponent } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import getWrapForm from './options' |
| | |
| | | return |
| | | } |
| | | |
| | | card.errors = [] |
| | | let columns = card.columns.map(c => c.field) |
| | | card.$c_ds = true |
| | | card.$c_ac = true |
| | | card.$c_sc = true |
| | | |
| | | if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { |
| | | card.errors.push({ level: 0, detail: '未设置数据源!'}) |
| | | } else if (card.setting.interType === 'system' && card.setting.execute === 'false' && card.scripts.filter(script => script.status !== 'false').length === 0) { |
| | | card.errors.push({ level: 0, detail: '数据源中无可用脚本!'}) |
| | | } else if (!card.setting.primaryKey) { |
| | | card.errors.push({ level: 0, detail: '未设置主键!'}) |
| | | } else if (!card.setting.subKey) { |
| | | card.errors.push({ level: 0, detail: '未设置子表主键!'}) |
| | | } else if (!card.setting.subBID) { |
| | | card.errors.push({ level: 0, detail: '未设置子表BID!'}) |
| | | } else if (!columns.includes(card.setting.primaryKey)) { |
| | | card.errors.push({ level: 0, detail: '主键已失效!'}) |
| | | } else if (!card.setting.supModule) { |
| | | card.errors.push({ level: 0, detail: '未设置上级组件!'}) |
| | | } |
| | | card.errors = checkComponent(card) |
| | | |
| | | if (card.errors.length === 0) { |
| | | card.$tables = getTables(card) |
| | | } |
| | | |
| | | card.action.forEach(cell => { |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | | card.errors.push({ level: 1, detail: `按钮“${cell.label}”中表单尚未添加`}) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | card.subcards.forEach((item, i) => { |
| | | let linkbtn = item.setting.linkbtn || '' |
| | | item.elements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | | card.errors.push({ level: 1, detail: `按钮“${cell.label}”中表单尚未添加`}) |
| | | } |
| | | } |
| | | if (linkbtn && linkbtn === cell.uuid) { |
| | | linkbtn = '' |
| | | } |
| | | } else if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) { |
| | | card.errors.push({ level: 1, detail: `卡片中动态字段“${cell.field}”无效`}) |
| | | } |
| | | }) |
| | | |
| | | item.backElements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | | card.errors.push({ level: 1, detail: `按钮“${cell.label}”中表单尚未添加`}) |
| | | } |
| | | } |
| | | if (linkbtn && linkbtn === cell.uuid) { |
| | | linkbtn = '' |
| | | } |
| | | } else if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) { |
| | | card.errors.push({ level: 1, detail: `卡片中动态字段“${cell.field}”无效`}) |
| | | } |
| | | }) |
| | | |
| | | if (linkbtn) { |
| | | card.errors.push({ level: 1, detail: `第${i + 1}张卡片中绑定按钮已删除`}) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | card: card |
| | |
| | | |
| | | if (btn) { |
| | | card.action = card.action.filter(item => item.uuid !== btn.uuid) |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('revertBtn', card.uuid) |
| | | }, 200) |
| | | } |
| | | |
| | | this.updateComponent(card) |
| | |
| | | res.$cardType = 'extendCard' |
| | | res.setting.width = res.setting.width || 6 |
| | | |
| | | let mobtypes = ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'] |
| | | let mobtypes = ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton', 'form'] |
| | | |
| | | let elements = [] |
| | | res.elements && res.elements.forEach(cell => { |
| | |
| | | <PlusOutlined className="plus" title="添加卡片" onClick={() => this.addCard()}/> |
| | | {appType !== 'mob' ? <PlusCircleOutlined className="plus" title="添加搜索" onClick={() => this.addSearch()}/> : null} |
| | | <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.addButton()}/> |
| | | <NormalForm title="数据卡设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <NormalForm title="双重数据卡设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <EditOutlined style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="datacard" card={card}/> |
| | |
| | | <ToolOutlined /> |
| | | </Popover> |
| | | <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> |
| | | <div className={'select-' + card.wrap.selStyle + extraName}> |
| | | <div className={`select-${card.wrap.selStyle || ''} ${extraName}`}> |
| | | {card.subcards.map(subcard => { |
| | | if (subcard.$cardType === 'extendCard') { |
| | | return (<CardComponent key={subcard.uuid} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>) |
| | |
| | | })} |
| | | </div> |
| | | <div style={{clear: 'both'}}></div> |
| | | {card.wrap.pagestyle === 'page' && card.setting.laypage === 'true' && appType !== 'mob' ? <Pagination total={85} size="small" showTotal={total => `共 ${total} 条`} pageSize={20} defaultCurrent={1}/> : null} |
| | | {card.wrap.pagestyle === 'page' && card.setting.laypage === 'true' && appType !== 'mob' ? <Pagination total={45} size="small" showTotal={total => `1-10 共 ${total} 条`} showSizeChanger={true} pageSize={10} defaultCurrent={1}/> : null} |
| | | {card.wrap.pagestyle === 'page' && card.setting.laypage === 'true' && appType === 'mob' ? <MobPagination /> : null} |
| | | {card.wrap.pagestyle === 'more' && card.setting.laypage === 'true' ? <div className="mk-more">查看更多<DownOutlined/></div> : null} |
| | | <div className="component-name"> |
| | | <div className="center"> |
| | | <div className="title" onDoubleClick={() => { |
| | | let oInput = document.createElement('input') |
| | | oInput.value = card.uuid |
| | | oInput.value = 'anchor' + card.uuid |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |