| | |
| | | } |
| | | |
| | | editColumn = (column) => { |
| | | let formlist = getColumnForm(column, this.props.fields, this.props.columns) |
| | | let fields = fromJS(this.props.fields).toJS().map(item => { |
| | | if (item.label.toLowerCase() !== item.field.toLowerCase()) { |
| | | item.text = item.label + '(' + item.field + ')' |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | let formlist = getColumnForm(column, fields, this.props.columns) |
| | | |
| | | this.column = fromJS(column).toJS() |
| | | this.column.editType = this.column.editType || 'text' |
| | |
| | | } |
| | | }) |
| | | } else if (key === 'field') { |
| | | let values = {label: option.props.children} |
| | | let values = {label: option.props.label || option.props.children} |
| | | if (/Decimal|int/ig.test(option.props.datatype)) { |
| | | let decimal = 0 |
| | | if (/Decimal/ig.test(option.props.datatype)) { |
| | |
| | | getPopupContainer={() => document.getElementById('edit-table-column-winter')} |
| | | > |
| | | {item.options.map((option, i) => |
| | | <Select.Option key={i} datatype={option.datatype || ''} value={(option.value || option.field || option.MenuID)}> |
| | | <Select.Option key={i} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}> |
| | | {(option.text || option.label || option.MenuName)} |
| | | </Select.Option> |
| | | )} |
| | |
| | | } |
| | | |
| | | editColumn = (column) => { |
| | | let formlist = getColumnForm(column, this.props.fields) |
| | | let fields = fromJS(this.props.fields).toJS().map(item => { |
| | | if (item.label.toLowerCase() !== item.field.toLowerCase()) { |
| | | item.text = item.label + '(' + item.field + ')' |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | let formlist = getColumnForm(column, fields) |
| | | let _options = fromJS(columnTypeOptions[column.type]).toJS() |
| | | if (column.type === 'text' || column.type === 'number') { |
| | | if (column.perspective === 'linkmenu') { |
| | |
| | | } |
| | | }) |
| | | } else if (key === 'field') { |
| | | let values = {label: option.props.children} |
| | | let values = {label: option.props.label || option.props.children} |
| | | if (/Decimal|int/ig.test(option.props.datatype)) { |
| | | let decimal = 0 |
| | | if (/Decimal/ig.test(option.props.datatype)) { |
| | |
| | | getPopupContainer={() => document.getElementById('columnwinter')} |
| | | > |
| | | {item.options.map((option, index) => |
| | | <Select.Option key={index} datatype={option.datatype || ''} value={(option.value || option.field || option.MenuID)}> |
| | | <Select.Option key={index} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}> |
| | | {(option.text || option.label || option.MenuName)} |
| | | </Select.Option> |
| | | )} |
| | |
| | | }) |
| | | }) |
| | | |
| | | let columns = null |
| | | if (this.props.config.type === 'table') { |
| | | columns = this.props.config.columns.map(item => { |
| | | return {key: item.uuid, text: item.field, value: item.field, label: item.label} |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getSearchForm(card, linkableFields) |
| | | formlist: getSearchForm(card, linkableFields, columns) |
| | | }) |
| | | } |
| | | |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, Radio, notification, Tooltip, InputNumber, Checkbox, Cascader } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Radio, notification, Tooltip, InputNumber, Checkbox, Cascader, AutoComplete } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import { dateOptions, matchReg, formRule } from '@/utils/option.js' |
| | |
| | | this.props.form.setFieldsValue({dataSource: resource}) |
| | | } |
| | | |
| | | complete = (key, option) => { |
| | | let label = option.props.label |
| | | |
| | | this.props.form.setFieldsValue({label: label}) |
| | | } |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { dict } = this.props |
| | |
| | | }) |
| | | } |
| | | |
| | | if (item.key === 'field' && item.options && item.options.length > 0) { |
| | | content = <AutoComplete |
| | | dataSource={item.options.map((cell) => <AutoComplete.Option label={cell.label} key={cell.key}> |
| | | {cell.text} |
| | | </AutoComplete.Option>)} |
| | | filterOption={(input, option) => option.props.children.indexOf(input) > -1} |
| | | onSelect={this.complete} |
| | | placeholder="" |
| | | > |
| | | <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} /> |
| | | </AutoComplete> |
| | | } else { |
| | | content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} /> |
| | | } |
| | | } else if (item.type === 'number') { |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.input'] + item.label + '!' } |
| | |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} linkableFields // 可关联字段 |
| | | */ |
| | | export function getSearchForm (card, linkableFields) { |
| | | export function getSearchForm (card, linkableFields, columns) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | let appType = sessionStorage.getItem('appType') |
| | | if (roleList) { |
| | |
| | | key: 'field', |
| | | label: Formdict['model.form.field'], |
| | | initVal: card.field || '', |
| | | required: true |
| | | required: true, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'select', |