| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Popover, Modal, Button, Switch, notification } from 'antd' |
| | | import { Popover, Modal, Button, Switch, notification, message } from 'antd' |
| | | import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | |
| | | card.width = card.wrap.width |
| | | card.name = card.wrap.name |
| | | card.errors = [] |
| | | let idCtrl = false |
| | | |
| | | if (card.wrap.datatype !== 'static') { |
| | | let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' |
| | |
| | | |
| | | card.subcards.forEach(item => { |
| | | item.fields.forEach(m => { |
| | | if (m.dataSource && /@ID@/ig.test(m.dataSource)) { |
| | | idCtrl = true |
| | | } |
| | | if (m.type === 'linkMain' && !supModule) { |
| | | card.errors.push({ level: 1, detail: `请检查关联主表“${m.label}”是否有效`}) |
| | | } |
| | |
| | | |
| | | card.subcards.forEach(item => { |
| | | item.fields.forEach(m => { |
| | | if (m.dataSource && /@ID@/ig.test(m.dataSource)) { |
| | | idCtrl = true |
| | | } |
| | | if (m.type === 'linkMain' && !supModule) { |
| | | card.errors.push({ level: 1, detail: `请检查关联主表“${m.label}”是否有效`}) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | card.idCtrl = idCtrl |
| | | |
| | | this.setState({ |
| | | card: card |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | let index = null |
| | | uniq.set(_form.field, true) |
| | | |
| | | let _inputIndex = 1 |
| | | let _tabIndex = 1 |
| | | let _linkIndex = 1 |
| | | card.subcards[0].fields.forEach((item, i) => { |
| | | if (_form.uuid === item.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | let label = `${item.field || ''}(${item.label})` |
| | | |
| | | if (['text', 'number', 'textarea', 'color'].includes(item.type) && _item.field !== item.field) { |
| | | _inputfields.push({ |
| | | field: item.field, |
| | | label: _inputIndex + '、' + label |
| | | label: item.label |
| | | }) |
| | | _inputIndex++ |
| | | } |
| | | if (_form.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) { |
| | | _tabfields.push({ |
| | | field: item.field, |
| | | label: _tabIndex + '、' + label |
| | | label: item.label |
| | | }) |
| | | _tabIndex++ |
| | | } |
| | | |
| | | if (item.type === 'switch') { |
| | | _linksupFields.push({ |
| | | field: item.field, |
| | | label: _linkIndex + '、' + label |
| | | label: item.label |
| | | }) |
| | | } |
| | | |
| | |
| | | uniq.set(item.field, true) |
| | | |
| | | _linkableFields.push({ |
| | | value: item.field, |
| | | text: _linkIndex + '、' + item.label + ' (表单)' |
| | | field: item.field, |
| | | label: item.label + '-表单' |
| | | }) |
| | | _linksupFields.push({ |
| | | value: item.field, |
| | | text: _linkIndex + '、' + label |
| | | field: item.field, |
| | | label: item.label |
| | | }) |
| | | |
| | | _linkIndex++ |
| | | } |
| | | }) |
| | | |
| | | _tabfields.unshift({field: '', label: '原表单'}) |
| | | |
| | | if (index !== null) { |
| | | if (index === 0) { |
| | |
| | | |
| | | _linkableFields.push({ |
| | | field: col.field, |
| | | label: _linkIndex + '、' + col.label + ' (显示列)' |
| | | label: col.label + '-显示列' |
| | | }) |
| | | _linkIndex++ |
| | | } |
| | | }) |
| | | |
| | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: `declare @mk_organization nvarchar(512) |
| | | LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${res.dataSource}` |
| | | } |
| | | |
| | |
| | | let _config = fromJS(this.state.card).toJS() |
| | | |
| | | if (res.subButton) { |
| | | let _this = this |
| | | let that = this |
| | | |
| | | _config.subcards[0].setting.focus = res.focus |
| | | _config.subcards[0].setting.cache = res.cache |
| | |
| | | }) |
| | | |
| | | confirm({ |
| | | content: `替换表单及按钮配置?`, |
| | | content: '替换表单及按钮配置?', |
| | | onOk() { |
| | | _this.updateComponent(_config) |
| | | that.updateComponent(_config) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | return |
| | | } else if (res.fields) { |
| | | if (_config.subcards[0].fields.length > 0) { |
| | | let that = this |
| | | _config.subcards[0].fields = res.fields.map(item => { |
| | | item.uuid = Utils.getuuid() |
| | | return item |
| | | }) |
| | | |
| | | confirm({ |
| | | title: '确定替换表单吗?', |
| | | content: '原表单将删除。', |
| | | onOk() { |
| | | that.updateComponent(_config) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | _config.subcards[0].fields = res.fields.map(item => { |
| | | item.uuid = Utils.getuuid() |
| | | return item |
| | | }) |
| | | |
| | | this.updateComponent(_config) |
| | | } |
| | | |
| | | return |
| | | } |
| | | |
| | |
| | | <EditOutlined style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="simpleform" card={card}/> |
| | | <PasteComponent config={card} options={['form', 'formgroup']} updateConfig={this.pasteForm} /> |
| | | <PasteComponent config={card} options={['form', 'forms', 'formgroup']} updateConfig={this.pasteForm} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | |
| | | } trigger="hover"> |
| | | <ToolOutlined /> |
| | | </Popover> |
| | | <div className="form-area"> |
| | | <div className={`form-area mk-${card.wrap.formStyle || ''}`}> |
| | | <PlusOutlined className="plus" title="添加表单" onClick={this.addForm}/> |
| | | <FieldsComponent config={card.subcards[0]} type="form" plusFields={this.plusFields} /> |
| | | <span style={{color: 'red', marginLeft: '30px', cursor: 'pointer'}} onClick={this.clearGroup}>清空</span> |
| | |
| | | </div> |
| | | <div className="component-name"> |
| | | <div className="center"> |
| | | <div className="title">{card.name}</div> |
| | | <div className="title" onDoubleClick={() => { |
| | | let oInput = document.createElement('input') |
| | | oInput.value = card.uuid |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | document.body.removeChild(oInput) |
| | | message.success('复制成功。') |
| | | }}>{card.name}</div> |
| | | <div className="content"> |
| | | {card.errors && card.errors.map((err, index) => { |
| | | if (err.level === 0) { |