| | |
| | | .mk-water-mark { |
| | | color: $color4; |
| | | } |
| | | .mk-form-split-line { |
| | | color: $color6; |
| | | } |
| | | } |
| | | |
| | | body.hidden-split-line #root { // 去除登录页分割线 |
| | |
| | | visible: false, |
| | | editform: null, |
| | | formlist: null, |
| | | sqlVerifing: false |
| | | sqlVerifing: false, |
| | | standardform: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | |
| | | group.fields.push(newcard) |
| | | |
| | | this.setState({group}) |
| | | this.handleForm(newcard) |
| | | this.setState({group}, () => { |
| | | this.handleForm(newcard) |
| | | }) |
| | | } |
| | | |
| | | editModalCancel = () => { |
| | |
| | | value: '', |
| | | text: '空' |
| | | }] |
| | | let standardform = null |
| | | |
| | | _inputfields = group.fields.filter(item => item.type === 'text' || item.type === 'number' || item.type === 'textarea' || item.type === 'color') |
| | | _tabfields = group.fields.filter(item => _form.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) |
| | |
| | | |
| | | let uniq = new Map() |
| | | uniq.set(_form.field, true) |
| | | group.fields.forEach(item => { |
| | | let index = null |
| | | group.fields.forEach((item, i) => { |
| | | if (_form.uuid === item.uuid) { |
| | | index = i |
| | | } |
| | | if (item.type !== 'select' && item.type !== 'link' && item.type !== 'radio') return |
| | | if (item.field && !uniq.has(item.field)) { |
| | | uniq.set(item.field, true) |
| | |
| | | }) |
| | | } |
| | | }) |
| | | if (index !== null) { |
| | | if (index === 0) { |
| | | standardform = group.fields[index + 1] || null |
| | | } else { |
| | | standardform = group.fields[index - 1] || null |
| | | } |
| | | } |
| | | |
| | | card.columns.forEach(col => { |
| | | if (col.field && !uniq.has(col.field)) { |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | standardform, |
| | | visible: true, |
| | | editform: _form, |
| | | formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields, false) |
| | |
| | | card={this.state.editform} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.handleSubmit} |
| | | standardform={this.state.standardform} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> |
| | | </Modal> |
| | |
| | | sources: null, // 表单类型 |
| | | sqlVerifing: false, // sql验证 |
| | | openEdition: '', // 编辑版本标记,防止多人操作 |
| | | showField: false // 显示表单字段值 |
| | | showField: false, // 显示表单字段值 |
| | | standardform: null |
| | | } |
| | | |
| | | /** |
| | |
| | | value: '', |
| | | text: '空' |
| | | }] |
| | | let standardform = null |
| | | |
| | | _inputfields = config.fields.filter(item => item.type === 'text' || item.type === 'number' || item.type === 'textarea' || item.type === 'color') |
| | | _tabfields = config.fields.filter(item => card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) |
| | |
| | | |
| | | let uniq = new Map() |
| | | uniq.set(card.field, true) |
| | | config.fields.forEach(item => { |
| | | let index = null |
| | | config.fields.forEach((item, i) => { |
| | | if (card.uuid === item.uuid) { |
| | | index = i |
| | | } |
| | | if (item.type !== 'select' && item.type !== 'link' && item.type !== 'radio') return |
| | | if (item.field && !uniq.has(item.field)) { |
| | | uniq.set(item.field, true) |
| | |
| | | }) |
| | | } |
| | | }) |
| | | if (index !== null) { |
| | | if (index === 0) { |
| | | standardform = config.fields[index + 1] || null |
| | | } else { |
| | | standardform = config.fields[index - 1] || null |
| | | } |
| | | } |
| | | |
| | | componentConfig.columns.forEach(col => { |
| | | if (col.field && !uniq.has(col.field)) { |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | standardform, |
| | | visible: true, |
| | | card: card, |
| | | formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, !!this.props.editTab) |
| | |
| | | card={this.state.card} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.handleSubmit} |
| | | standardform={this.state.standardform} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> |
| | | </Modal> |
| | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | if (result.data && result.data[0]) { |
| | | let _data = result.data[0] |
| | | let _data = result.data[0] || {} |
| | | |
| | | if (absFields.length) { |
| | | absFields.forEach(field => { |
| | |
| | | _data[field] = Math.abs(_data[field]) |
| | | }) |
| | | } |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | |
| | | try { |
| | | data = data.map(item => { |
| | | if (item[setting.primaryKey] === _data[setting.primaryKey]) { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | _data.key = item.key |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | |
| | | return _data |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | selectedData = selectedData.map(item => { |
| | | if (_data.$$uuid === item.$$uuid) { |
| | | return _data |
| | | } |
| | | return item |
| | | }) |
| | | } catch { |
| | | console.warn('数据查询错误') |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | data, |
| | | selectedData, |
| | | loading: false |
| | | }) |
| | | } else { |
| | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | if (result.data && result.data[0]) { |
| | | let _data = result.data[0] |
| | | |
| | | let _data = result.data[0] || {} |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | try { |
| | | data = data.map(item => { |
| | | if (item[setting.primaryKey] === _data[setting.primaryKey]) { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | _data.key = item.key |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | return _data |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | selectedData = selectedData.map(item => { |
| | | if (_data.$$uuid === item.$$uuid) { |
| | | return _data |
| | | } |
| | | return item |
| | | }) |
| | | } catch { |
| | | console.warn('数据查询错误') |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | data, |
| | | selectedData, |
| | | loading: false |
| | | }) |
| | | } else { |
| | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | if (result.data && result.data[0]) { |
| | | let _data = result.data[0] |
| | | let _data = result.data[0] || {} |
| | | |
| | | if (absFields.length) { |
| | | absFields.forEach(field => { |
| | |
| | | }) |
| | | } |
| | | |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | |
| | | try { |
| | | data = data.map(item => { |
| | | if (item[setting.primaryKey] === _data[setting.primaryKey]) { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | _data.key = item.key |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | |
| | | return _data |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | selectedData = selectedData.map(item => { |
| | | if (_data.$$uuid === item.$$uuid) { |
| | | return _data |
| | | } |
| | | return item |
| | | }) |
| | | } catch { |
| | | console.warn('数据查询错误') |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | data, |
| | | selectedData, |
| | | loading: false |
| | | }) |
| | | } else { |
| | |
| | | formlist |
| | | }, () => { |
| | | if (action.setting && action.setting.focus) { |
| | | this.selectInput(action.setting.focus, 'init') |
| | | this.selectInput(action.setting.focus) |
| | | } |
| | | // 用来更新state,防止受控表单初始时不显示 |
| | | this.setState({ |
| | |
| | | }) |
| | | } |
| | | |
| | | selectInput = (selectId, type) => { |
| | | selectInput = (selectId) => { |
| | | try { |
| | | let _form = document.getElementById('main-form-box') |
| | | let _inputs = _form.getElementsByTagName('input') |
| | |
| | | _inputs.forEach(input => { |
| | | if (!input || input.id !== selectId) return |
| | | |
| | | if (input.className === 'ant-select-search__field' && type !== 'init') { |
| | | if (input.className === 'ant-select-search__field') { |
| | | let div = input.parentNode |
| | | while (div && div.parentNode) { |
| | | div = div.parentNode |
| | |
| | | if (item.type === 'split') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <p>{item.label}</p> |
| | | <p className="mk-form-split-line">{item.label}</p> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'hint') { |
| | |
| | | display: inline-block; |
| | | float: none; |
| | | vertical-align: top; |
| | | padding-left: 1.2%!important; |
| | | padding-right: 1.2%!important; |
| | | } |
| | | .ant-form-item-label .anticon-question-circle { |
| | | color: #c49f47; |
| | |
| | | } |
| | | p { |
| | | color: #1890ff; |
| | | border-bottom: 1px solid #d9d9d9; |
| | | font-size: 15px; |
| | | padding-left: 10px; |
| | | border-bottom: 1px solid #e9e9e9; |
| | | } |
| | | .ant-input-disabled { |
| | | color: rgba(0, 0, 0, 0.65)!important; |
| | |
| | | selectval = card.emptyText || '空' |
| | | } |
| | | } |
| | | // let labelCol = 'ant-col-sm-8' |
| | | // let wrapCol = 'ant-col-sm-16' |
| | | // let isEntireLine = false |
| | | |
| | | // if (card.entireLine === 'true' || ['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type)) { |
| | | // isEntireLine = true |
| | | // } |
| | | |
| | | // if (isEntireLine) { |
| | | // if (cols === '2') { |
| | | // labelCol = 'ant-col-sm-4' |
| | | // wrapCol = 'ant-col-sm-20' |
| | | // } else if (cols === '3') { |
| | | // labelCol = 'ant-col-cuslabel' |
| | | // wrapCol = 'ant-col-cuswrap' |
| | | // } else if (cols === '4') { |
| | | // labelCol = 'ant-col-sm-2' |
| | | // wrapCol = 'ant-col-sm-22' |
| | | // } |
| | | // if (card.hidelabel === 'true') { |
| | | // wrapCol = 'ant-col-sm-24' |
| | | // } |
| | | // } |
| | | |
| | | let formItem = null |
| | | if (card.type === 'text') { |
| | |
| | | required={card.required === 'true'} |
| | | extra={card.extra || null} |
| | | labelCol={card.labelwidth ? {style: {width: card.labelwidth + '%'}} : null} |
| | | wrapperCol={card.labelwidth ? {style: {width: (100 - card.labelwidth) + '%'}} : null} |
| | | > |
| | | {formItem} |
| | | {showField ? <div className="field-name">{card.field}</div> : ''} |
| | | </Form.Item>} |
| | | {/* <div className="ant-row ant-form-item"> |
| | | {card.hidelabel !== 'true' ? <div className={'ant-col ant-form-item-label ant-col-xs-24 ' + labelCol}> |
| | | {card.label ? <label className={card.required === 'true' ? 'required' : ''}>{card.tooltip ? |
| | | <Icon type="question-circle" /> : null} |
| | | {card.label}</label> : null} |
| | | </div> : null} |
| | | <div className={'ant-col ant-form-item-control-wrapper ant-col-xs-24 ' + wrapCol}> |
| | | {formItem} |
| | | {showField ? card.field : ''} |
| | | </div> |
| | | </div> */} |
| | | </div> |
| | | </div> |
| | | </Popover> |
| | |
| | | } |
| | | .modal-fields-row { |
| | | padding-bottom: 35px; |
| | | .ant-col { |
| | | padding-left: 12px; |
| | | padding-right: 12px; |
| | | } |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | vertical-align: top; |
| | | padding-left: 1.2%; |
| | | padding-right: 1.2%; |
| | | } |
| | | .split-line { |
| | | color: #1890ff; |
| | | font-size: 15px; |
| | | padding-left: 10px; |
| | | border-bottom: 1px solid #e9e9e9; |
| | | } |
| | | .ant-form-item { |
| | | cursor: move; |
| | |
| | | value: '', |
| | | text: '空' |
| | | }] |
| | | let standardform = null |
| | | |
| | | _inputfields = config.fields.filter(item => item.type === 'text' || item.type === 'number' || item.type === 'textarea' || item.type === 'color') |
| | | _tabfields = config.fields.filter(item => card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) |
| | |
| | | |
| | | let uniq = new Map() |
| | | uniq.set(card.field, true) |
| | | config.fields.forEach(item => { |
| | | let index = null |
| | | config.fields.forEach((item, i) => { |
| | | if (card.uuid === item.uuid) { |
| | | index = i |
| | | } |
| | | if (item.type !== 'select' && item.type !== 'link' && item.type !== 'radio') return |
| | | if (item.field && !uniq.has(item.field)) { |
| | | uniq.set(item.field, true) |
| | |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (index !== null) { |
| | | if (index === 0) { |
| | | standardform = config.fields[index + 1] || null |
| | | } else { |
| | | standardform = config.fields[index - 1] || null |
| | | } |
| | | } |
| | | |
| | | if (subTabConfig) { |
| | | subTabConfig.columns.forEach(col => { |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | standardform, |
| | | visible: true, |
| | | card: card, |
| | | formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, !!this.props.editTab) |
| | |
| | | card={this.state.card} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.handleSubmit} |
| | | standardform={this.state.standardform} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> |
| | | </Modal> |
| | |
| | | > .ant-row { |
| | | min-height: 120px; |
| | | } |
| | | .ant-row .ant-col-6 { |
| | | padding: 0 12px!important; |
| | | } |
| | | .ant-row.ant-form-item .ant-col { |
| | | padding: 0; |
| | | } |
| | |
| | | precision: 1, |
| | | label: '名称宽度', |
| | | initVal: card.labelwidth || 33.3, |
| | | tooltip: '名称占据表单宽度的百分比。注:存在多列表单时,当前表单如果想要占据整行可参照以下比例,两列(16.3)、三列(10.5)、四列(8.3)', |
| | | tooltip: '名称占据表单宽度的百分比。注:存在多列表单时,当前表单如果想要占据整行可参照以下比例,两列(16.2)、三列(10.5)、四列(7.7)', |
| | | required: true |
| | | }, |
| | | { |
| | |
| | | hint: ['label', 'type', 'blacklist', 'message', 'span', 'labelwidth'], |
| | | split: ['label', 'type'], |
| | | brafteditor: ['required', 'hidelabel', 'hidden', 'readin', 'fieldlength', 'readonly', 'span', 'labelwidth', 'tooltip', 'extra', 'encryption'], |
| | | funcvar: [], |
| | | funcvar: ['span', 'labelwidth'], |
| | | linkMain: ['readonly', 'required', 'hidden', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra'] |
| | | } |
| | | |
| | |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, |
| | | standardform: PropTypes.any, |
| | | card: PropTypes.object, |
| | | inputSubmit: PropTypes.any |
| | | } |
| | |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let formlist = fromJS(this.props.formlist).toJS() |
| | | |
| | | let type = '' |
| | | let resourceType = '' |
| | | let supField = '' |
| | |
| | | }) |
| | | } |
| | | |
| | | changeVal = (val, type) => { |
| | | if (type !== 'span' || ![24, 12, 8, 6].includes(val)) return |
| | | |
| | | const { standardform } = this.props |
| | | |
| | | if (!standardform || ![24, 12, 8, 6].includes(standardform.span) || !standardform.labelwidth) return |
| | | |
| | | let labelwidth = null |
| | | |
| | | if (standardform.span === val) { |
| | | labelwidth = standardform.labelwidth |
| | | } else if (standardform.span > val) { |
| | | labelwidth = 33.3 |
| | | } else { |
| | | switch(standardform.span) { |
| | | case 12: |
| | | labelwidth = 16.2 |
| | | break; |
| | | case 8: |
| | | if (val === 12) { |
| | | labelwidth = 21.6 |
| | | } else { |
| | | labelwidth = 10.5 |
| | | } |
| | | break; |
| | | case 6: |
| | | if (val === 8) { |
| | | labelwidth = 24.3 |
| | | } else if (val === 12) { |
| | | labelwidth = 15.8 |
| | | } else { |
| | | labelwidth = 7.7 |
| | | } |
| | | break; |
| | | default: |
| | | } |
| | | } |
| | | |
| | | |
| | | if (labelwidth) { |
| | | this.props.form.setFieldsValue({labelwidth}) |
| | | } |
| | | } |
| | | |
| | | handleSubmit = (e) => { |
| | | e.preventDefault() |
| | | |
| | |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<InputNumber min={item.min} max={item.max} precision={item.precision} onPressEnter={this.handleSubmit}/>)} |
| | | })(<InputNumber onChange={(value) => this.changeVal(value, item.key)} min={item.min} max={item.max} precision={item.precision} onPressEnter={this.handleSubmit}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | .ant-form-item { |
| | | height: 50px; |
| | | .ant-form-explain { |
| | | font-size: 12px; |
| | | } |
| | | } |
| | | } |
| | |
| | | components: [], |
| | | viewType: 'menu', |
| | | style: { |
| | | backgroundColor: '#ffffff', backgroundImage: '', paddingLeft: '20px', paddingRight: '20px' |
| | | backgroundColor: '#ffffff', backgroundImage: '' |
| | | } |
| | | } |
| | | } |
| | |
| | | EasyCode: '', |
| | | Template: 'webPage', |
| | | TypeCharOne: sessionStorage.getItem('kei_no'), |
| | | Typename: 'pc', |
| | | Typename: 'mob', |
| | | MenuName: config.MenuName || '', |
| | | PageParam: JSON.stringify({Template: 'webPage'}), |
| | | open_edition: config.open_edition, |
| | |
| | | EasyCode: '', |
| | | Template: item.type, |
| | | TypeCharOne: sessionStorage.getItem('kei_no'), |
| | | Typename: 'pc', |
| | | Typename: 'mob', |
| | | MenuName: item.name || '', |
| | | PageParam: JSON.stringify({Template: item.type}), |
| | | open_edition: item.open_edition || '', |
| | |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | .ant-form-item { |
| | | height: 50px; |
| | | .ant-form-explain { |
| | | font-size: 12px; |
| | | } |
| | | } |
| | | } |
| | |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | .ant-form-item { |
| | | height: 50px; |
| | | .ant-form-explain { |
| | | font-size: 12px; |
| | | } |
| | | } |
| | | } |