| | |
| | | func: 'sPC_TableData_InUpDe', |
| | | BID: this.props.BID |
| | | } |
| | | |
| | | if (setting.primaryKey) { // 主键值预设,从表格数据第一项选取 |
| | | param[setting.primaryKey] = (data[0] && data[0][setting.primaryKey]) || '' |
| | | } |
| | | let primaryId = setting.primaryKey && data[0] ? data[0][setting.primaryKey] : '' |
| | | |
| | | if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 是否弹框或直接执行 |
| | | let ID = '' |
| | |
| | | ID = ids.join(',') |
| | | } |
| | | |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = ID |
| | | } |
| | | |
| | | if (btn.innerFunc) { // 使用自定义函数 |
| | | param.func = btn.innerFunc |
| | | if (setting.primaryKey) { // 主键存在时,设置主键参数 |
| | | param[setting.primaryKey] = ID |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, data[0])) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | |
| | | if (setting.primaryKey) { // 主键存在时,设置主键参数 |
| | | param[setting.primaryKey] = primaryId |
| | | } |
| | | |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | |
| | | } else if (btn.sql && btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = Utils.getguid() |
| | | } |
| | | |
| | | param.ID = Utils.getguid() |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0])) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0])) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | func: 'sPC_TableData_InUpDe', |
| | | BID: this.props.BID |
| | | } |
| | | |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = cell[setting.primaryKey] || '' |
| | | } |
| | | let primaryId = setting.primaryKey ? cell[setting.primaryKey] : '' |
| | | |
| | | if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 是否弹框或直接执行 |
| | | |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = primaryId |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, cell)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | } else if (btn.OpenType === 'pop') { // 表单 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | |
| | | |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = primaryId |
| | | } |
| | | |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | |
| | | } else if (btn.sql) { |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = cell[setting.primaryKey] |
| | | } |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | if (execAction.groups.length > 0) { |
| | | execAction.groups.forEach(group => { |
| | | group.sublist.forEach(field => { |
| | | if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1' && field.dataSource) { |
| | | if ((field.type === 'select' || field.type === 'link' || field.type === 'multiselect') && field.resourceType === '1' && field.dataSource) { |
| | | subfields.push(field) |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | execAction.fields.forEach(field => { |
| | | if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1' && field.dataSource) { |
| | | if ((field.type === 'select' || field.type === 'link' || field.type === 'multiselect') && field.resourceType === '1' && field.dataSource) { |
| | | subfields.push(field) |
| | | } |
| | | }) |
| | |
| | | |
| | | if (item.type === 'link') { |
| | | arrfield = arrfield + ',' + item.linkField |
| | | } else if (item.type === 'select' && item.linkSubField && item.linkSubField.length > 0) { |
| | | arrfield = arrfield + ',' + item.linkSubField.join(',') |
| | | } |
| | | |
| | | let _sql = Utils.getSelectQuerySql(item) |
| | |
| | | |
| | | if (res.search.type === 'link') { |
| | | item.parentId = cell[res.search.linkField] |
| | | } else if (res.search.type === 'select' && res.search.linkSubField && res.search.linkSubField.length > 0) { |
| | | res.search.linkSubField.forEach(_field => { |
| | | item[_field] = (cell[_field] || cell[_field] === 0) ? cell[_field] : '' |
| | | }) |
| | | } |
| | | |
| | | return item |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification } from 'antd' |
| | | import moment from 'moment' |
| | | import { formRule } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import FileUpload from '../fileupload' |
| | | import './index.scss' |
| | |
| | | }) |
| | | } |
| | | |
| | | let _inputfields = formlist.filter(item => item.type === 'text' || item.type === 'number') // 用于过滤下拉菜单关联表单 |
| | | |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'select' || item.type === 'link') { |
| | | if (item.setAll === 'true') { |
| | |
| | | } |
| | | |
| | | item.oriOptions = JSON.parse(JSON.stringify(item.options)) |
| | | |
| | | if (item.linkSubField && item.linkSubField.length > 0) { |
| | | let _fields = _inputfields.map(_item => _item.field) |
| | | item.linkSubField = item.linkSubField.filter(_item => _fields.includes(_item)) |
| | | } |
| | | } |
| | | |
| | | if (!/^date/.test(item.type) && this.props.data && this.props.data.hasOwnProperty(item.field)) { |
| | |
| | | } |
| | | } |
| | | |
| | | selectChange = (_field, value) => { |
| | | selectChange = (_field, value, option) => { |
| | | let formlist = JSON.parse(JSON.stringify(this.state.formlist)) |
| | | |
| | | let subfields = [] |
| | |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | // 表单切换时,更新关联字段 |
| | | if (_field.type === 'select' && _field.linkSubField && _field.linkSubField.length > 0 && option.props.data) { |
| | | let _data = option.props.data |
| | | let fieldVal = {} |
| | | _field.linkSubField.forEach(subfield => { |
| | | fieldVal[subfield] = _data[subfield] |
| | | }) |
| | | this.props.form.setFieldsValue(fieldVal) |
| | | } |
| | | |
| | | if (subfields.length === 0) return |
| | | |
| | |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} />)} |
| | |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select' || item.type === 'link') { // 下拉搜索 |
| | | let hasSubField = false |
| | | if (item.linkSubField && item.linkSubField.length > 0) { // 存在关联字段,数据存储 |
| | | hasSubField = true |
| | | } |
| | | |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => {this.selectChange(item, value)}} |
| | | // getPopupContainer={() => document.getElementById('form-box')} |
| | | onChange={(value, option) => {this.selectChange(item, value, option)}} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.key} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option> |
| | | <Select.Option id={option.key} data={hasSubField ? option : ''} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd' |
| | | import { btnIcons, btnClasses } from '@/utils/option.js' |
| | | import { btnIcons, btnClasses, formRule } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | |
| | | let _rules = [] |
| | | if (item.key === 'innerFunc') { |
| | | let str = '^(' + item.fields.join('|') + ')' |
| | | let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | _rules = [{ |
| | | pattern: _patten, |
| | | message: '名称只允许包含数字、字母和下划线,且以指定字符开始。' |
| | | message: formRule.func.innerMessage |
| | | }, { |
| | | max: 50, |
| | | message: '内部函数名称不超过50个字符。' |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | } else if (item.key === 'outerFunc' || item.key === 'callbackFunc') { |
| | | _rules = [{ |
| | | pattern: formRule.func.pattern, |
| | | message: formRule.func.message |
| | | }, { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | } else { |
| | | _rules = [{ |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | }] |
| | | } |
| | | fields.push( |
| | |
| | | tooltip: '字段名可以使用逗号分隔,进行多字段综合搜索,注:综合搜索仅在文本类型时有效', |
| | | tooltipClass: 'middle', |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_-' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'callbackFunc', |
| | | label: this.state.dict['header.form.callbackFunc'], |
| | | initVal: card.callbackFunc, |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'position', |
| | | label: this.state.dict['header.form.position'], |
| | |
| | | value: 'grid', |
| | | text: this.state.dict['header.form.grid'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'callbackFunc', |
| | | label: this.state.dict['header.form.callbackFunc'], |
| | | initVal: card.callbackFunc, |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | label: this.state.dict['header.form.field'], |
| | | initVal: card.field, |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_-' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon, notification } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | } |
| | | |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | | let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form commontable-setting-form" id="commontable-setting-form"> |
| | |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '表名!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + dict['header.form.interface'] + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.outerFunc']}> |
| | | {getFieldDecorator('outerFunc', { |
| | | initialValue: data.outerFunc || '' |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | rules: [ |
| | | { |
| | | pattern: _patten, |
| | | message: '名称只允许包含数字、字母和下划线,且以指定字符开始。' |
| | | message: formRule.func.innerMessage |
| | | }, { |
| | | max: 50, |
| | | message: '内部函数名称不超过50个字符。' |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.outerFunc']}> |
| | | {getFieldDecorator('outerFunc', { |
| | | initialValue: data.outerFunc || '', |
| | | rules: [ |
| | | { |
| | | pattern: formRule.func.pattern, |
| | | message: formRule.func.message |
| | | }, { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={12}> |
| | | <Form.Item label="固定列"> |
| | | {getFieldDecorator('columnfixed', { |
| | |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '默认排序字段!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="ID asc, UID desc" autoComplete="off" />)} |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Tooltip } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | // this.setState({ |
| | | // formlist: this.state.formlist.map(form => { |
| | | // return form |
| | | // }) |
| | | // }, () => { |
| | | // this.setState({ |
| | | // formlist: this.state.formlist.map(form => { |
| | | // return form |
| | | // }) |
| | | // }) |
| | | // }) |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, InputNumber } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import TransferForm from '../transferform' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '分组名称!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off"/>)} |
| | |
| | | * 3、设置编辑参数项-formlist |
| | | */ |
| | | handleForm = (card) => { |
| | | const { config } = this.state |
| | | let _inputfields = [] |
| | | |
| | | // 设置下拉菜单可关联字段 |
| | | if (config.groups.length > 0) { |
| | | config.groups.forEach(group => { |
| | | let sublist = group.sublist.filter(item => item.type === 'text' || item.type === 'number') |
| | | _inputfields = [..._inputfields, ...sublist] |
| | | }) |
| | | } else { |
| | | _inputfields = config.fields.filter(item => item.type === 'text' || item.type === 'number') |
| | | } |
| | | if (card.linkSubField && card.linkSubField.length > 0) { |
| | | let fields = _inputfields.map(item => item.field) |
| | | card.linkSubField = card.linkSubField.filter(item => fields.includes(item)) |
| | | } |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkSubField', |
| | | label: '关联表单', |
| | | initVal: card.linkSubField || [], |
| | | options: _inputfields |
| | | } |
| | | ] |
| | | }) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, InputNumber } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import { dateOptions } from '@/utils/option.js' |
| | | import EditTable from '../editable' |
| | | import './index.scss' |
| | |
| | | _options = ['label', 'field', 'type', 'readonly', 'required'] |
| | | } |
| | | |
| | | if (type === 'select' || type === 'link') { |
| | | _options.push('setAll') |
| | | } |
| | | |
| | | if (type === 'link') { // 关联类型、增加关联字段 |
| | | _options = [..._options, 'linkField'] |
| | | } |
| | | |
| | | if (type === 'funcvar') { // 设置为函数变量时,不需要其他信息 |
| | | if (type === 'select') { |
| | | _options = [..._options, 'setAll', 'linkSubField'] |
| | | } else if (type === 'link') { // 关联类型、增加关联字段 |
| | | _options = [..._options, 'setAll', 'linkField'] |
| | | } else if (type === 'funcvar') { // 设置为函数变量时,不需要其他信息 |
| | | _options = ['label', 'field', 'type'] |
| | | } |
| | | |
| | |
| | | _options = ['label', 'field', 'type', 'readonly', 'required'] |
| | | } |
| | | |
| | | if (value === 'select' || value === 'link') { |
| | | _options.push('setAll') |
| | | } |
| | | |
| | | if (value === 'link') { |
| | | _options = [..._options, 'linkField'] |
| | | } |
| | | |
| | | if (value === 'funcvar') { |
| | | if (value === 'select') { |
| | | _options = [..._options, 'setAll', 'linkSubField'] |
| | | } else if (value === 'link') { |
| | | _options = [..._options, 'setAll', 'linkField'] |
| | | } else if (value === 'funcvar') { |
| | | _options = ['label', 'field', 'type'] |
| | | } |
| | | |
| | |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | } |
| | | |
| | | if (openType === 'select' || openType === 'link') { |
| | | _options.push('setAll') |
| | | } |
| | | |
| | | if (openType === 'link') { |
| | | _options = [..._options, 'linkField'] |
| | | if (openType === 'select') { |
| | | _options = [..._options, 'setAll', 'linkSubField'] |
| | | } else if (openType === 'link') { |
| | | _options = [..._options, 'setAll', 'linkField'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | let rules = [] |
| | | if (item.key === 'field') { |
| | | rules = [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_-' |
| | | pattern: formRule.field.pattern, |
| | | message: formRule.field.message |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | max: formRule.field.max, |
| | | message: formRule.field.maxMessage |
| | | }] |
| | | } else { |
| | | rules = [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | } |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'multiselect') { // 多选 |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal |
| | | })( |
| | | <Select |
| | | showSearch |
| | | mode="multiple" |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.uuid} key={option.uuid} value={option.field}>{option.label}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'radio') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Radio, InputNumber, Select } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | class SettingForm extends Component { |
| | |
| | | <Col span={12}> |
| | | <Form.Item label="标题"> |
| | | {getFieldDecorator('title', { |
| | | initialValue: config.setting.title |
| | | initialValue: config.setting.title, |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off"/>)} |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd' |
| | | import { btnIcons, btnClasses } from '@/utils/option.js' |
| | | import { btnIcons, btnClasses, formRule } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | |
| | | let _rules = [] |
| | | if (item.key === 'innerFunc') { |
| | | let str = '^(' + item.fields.join('|') + ')' |
| | | let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | _rules = [{ |
| | | pattern: _patten, |
| | | message: '名称只允许包含数字、字母和下划线,且以指定字符开始。' |
| | | message: formRule.func.innerMessage |
| | | }, { |
| | | max: 50, |
| | | message: '内部函数名称不超过50个字符。' |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | } else if (item.key === 'outerFunc' || item.key === 'callbackFunc') { |
| | | _rules = [{ |
| | | pattern: formRule.func.pattern, |
| | | message: formRule.func.message |
| | | }, { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | } else { |
| | | _rules = [{ |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | }] |
| | | } |
| | | fields.push( |
| | |
| | | tooltip: '字段名可以使用逗号分隔,进行多字段综合搜索,注:综合搜索仅在文本类型时有效', |
| | | tooltipClass: 'middle', |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_-' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | label: this.state.dict['header.form.field'], |
| | | initVal: card.field, |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_-' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon, notification } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | } |
| | | |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | | let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form commontable-setting-form" id="commontable-setting-form"> |
| | |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '表名!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + dict['header.form.interface'] + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.outerFunc']}> |
| | | {getFieldDecorator('outerFunc', { |
| | | initialValue: data.outerFunc || '' |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | rules: [ |
| | | { |
| | | pattern: _patten, |
| | | message: '名称只允许包含数字、字母和下划线,且以指定字符开始。' |
| | | message: formRule.func.innerMessage |
| | | }, { |
| | | max: 50, |
| | | message: '内部函数名称不超过50个字符。' |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.outerFunc']}> |
| | | {getFieldDecorator('outerFunc', { |
| | | initialValue: data.outerFunc || '', |
| | | rules: [ |
| | | { |
| | | pattern: formRule.func.pattern, |
| | | message: formRule.func.message |
| | | }, { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={12}> |
| | | <Form.Item label="固定列"> |
| | | {getFieldDecorator('columnfixed', { |
| | |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '默认排序字段!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="ID asc, UID desc" autoComplete="off" />)} |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Tooltip } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | // this.setState({ |
| | | // formlist: this.state.formlist.map(form => { |
| | | // return form |
| | | // }) |
| | | // }, () => { |
| | | // this.setState({ |
| | | // formlist: this.state.formlist.map(form => { |
| | | // return form |
| | | // }) |
| | | // }) |
| | | // }) |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd' |
| | | import { btnIcons, btnClasses } from '@/utils/option.js' |
| | | import { btnIcons, btnClasses, formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | let _rules = [] |
| | | if (item.key === 'innerFunc') { |
| | | let str = '^(' + item.fields.join('|') + ')' |
| | | let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | _rules = [{ |
| | | pattern: _patten, |
| | | message: '名称只允许包含数字、字母和下划线,且以指定字符开始。' |
| | | message: formRule.func.innerMessage |
| | | }, { |
| | | max: 50, |
| | | message: '内部函数名称不超过50个字符。' |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | } else if (item.key === 'outerFunc' || item.key === 'callbackFunc') { |
| | | _rules = [{ |
| | | pattern: formRule.func.pattern, |
| | | message: formRule.func.message |
| | | }, { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | } else { |
| | | _rules = [{ |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | }] |
| | | } |
| | | fields.push( |
| | |
| | | tooltip: '字段名可以使用逗号分隔,进行多字段综合搜索,注:综合搜索仅在文本类型时有效', |
| | | tooltipClass: 'middle', |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_-' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | label: this.state.dict['header.form.field'], |
| | | initVal: card.field, |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_-' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon, notification } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | } |
| | | |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | | let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form subtable-setting-form" id="subtable-setting-form"> |
| | |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '表名!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + dict['header.form.interface'] + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.outerFunc']}> |
| | | {getFieldDecorator('outerFunc', { |
| | | initialValue: data.outerFunc || '' |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | rules: [ |
| | | { |
| | | pattern: _patten, |
| | | message: '名称只允许包含数字、字母和下划线,且以指定字符开始。' |
| | | message: formRule.func.innerMessage |
| | | }, { |
| | | max: 50, |
| | | message: '内部函数名称不超过50个字符。' |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.outerFunc']}> |
| | | {getFieldDecorator('outerFunc', { |
| | | initialValue: data.outerFunc || '', |
| | | rules: [ |
| | | { |
| | | pattern: formRule.func.pattern, |
| | | message: formRule.func.message |
| | | }, { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={12}> |
| | | <Form.Item label="默认排序"> |
| | | {getFieldDecorator('order', { |
| | |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '默认排序字段!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="ID asc, UID desc" autoComplete="off" />)} |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, InputNumber, Select, Radio } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import TransferForm from '../transferform' |
| | | import './index.scss' |
| | | |
| | |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + this.props.dict['header.form.name'] + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | |
| | | .ant-advanced-search-form.commontable-column-form { |
| | | min-height: 190px; |
| | | .ant-form-item { |
| | | margin-bottom: 15px; |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | class MainSearch extends Component { |
| | |
| | | if (item.hidden) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | let rules = item.rules || [] |
| | | let rules = [] |
| | | if (item.key === 'field') { |
| | | rules = [{ |
| | | pattern: formRule.field.pattern, |
| | | message: formRule.field.message |
| | | }, { |
| | | max: formRule.field.max, |
| | | message: formRule.field.maxMessage |
| | | }] |
| | | } else { |
| | | rules = [{ |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | }] |
| | | } |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | |
| | | .ant-advanced-search-form.commontable-column-form { |
| | | min-height: 190px; |
| | | .ant-form-item { |
| | | margin-bottom: 15px; |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | class MainSearch extends Component { |
| | |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} |
| | |
| | | .ant-advanced-search-form.commontable-column-form { |
| | | min-height: 190px; |
| | | .ant-form-item { |
| | | margin-bottom: 15px; |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | class MainSearch extends Component { |
| | |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip } from 'antd' |
| | | import { dateOptions, matchReg } from '@/utils/option.js' |
| | | import { dateOptions, matchReg, formRule } from '@/utils/option.js' |
| | | import EditTable from '../editable' |
| | | import './index.scss' |
| | | |
| | |
| | | if (item.hidden) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | let rules = item.rules || [] |
| | | let rules = [] |
| | | if (item.key === 'field') { |
| | | rules = [{ |
| | | pattern: formRule.field.pattern, |
| | | message: formRule.field.message |
| | | }, { |
| | | max: formRule.field.max, |
| | | message: formRule.field.maxMessage |
| | | }] |
| | | } else { |
| | | rules = [{ |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | }] |
| | | } |
| | | |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | |
| | | |
| | | const _dict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | export const formRule = { |
| | | input: { |
| | | max: 100, |
| | | message: '输入框最多100个字符。' |
| | | }, |
| | | field: { // 字段名 |
| | | max: 50, |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_-', |
| | | maxMessage: '字段名最多50个字符。' |
| | | }, |
| | | func: { // 函数名 |
| | | max: 50, |
| | | pattern: /^[0-9a-zA-Z_]*$/, |
| | | message: '函数名称只允许包含数字、字母和下划线。', |
| | | maxMessage: '函数名称不超过50个字符。', |
| | | innerPattern: '[0-9a-zA-Z_]*', |
| | | innerMessage: '内部函数名称只允许包含数字、字母和下划线,且以指定字符开始。' |
| | | }, |
| | | textarea: { |
| | | max: 1024 |
| | | } |
| | | } |
| | | |
| | | export const sysTemps = [ |
| | | { |
| | | title: '基础表格', |
| | |
| | | if (item.type === 'link') { |
| | | sql = 'select ' + item.valueField + ',' + item.valueText + ',' + item.linkField + ' from ' + _datasource |
| | | } else { |
| | | sql = 'select ' + item.valueField + ',' + item.valueText + ' from ' + _datasource |
| | | let _linkSubField = '' // 下拉菜单关联表单 |
| | | if (item.linkSubField && item.linkSubField.length > 0) { |
| | | _linkSubField = ',' + item.linkSubField.join(',') |
| | | } |
| | | sql = 'select ' + item.valueField + ',' + item.valueText + _linkSubField + ' from ' + _datasource |
| | | } |
| | | |
| | | if (item.orderBy) { |
| | |
| | | * @return {String} table 表名 |
| | | */ |
| | | static getSysDefaultSql (btn, setting, formdata, param, data) { |
| | | let primaryId = param[setting.primaryKey] |
| | | let primaryId = param.ID |
| | | let BID = param.BID |
| | | let verify = btn.verify |
| | | let _formFieldValue = {} |
| | |
| | | verify.uniques.forEach(item => { |
| | | let _fieldValue = [] // 表单键值对field=value |
| | | let _value = [] // 表单值,用于错误提示 |
| | | let _labels = item.fieldlabel.split(',') |
| | | |
| | | item.field.split(',').forEach(_field => { |
| | | item.field.split(',').forEach((_field, index) => { |
| | | _fieldValue.push(`${_field}='${_formFieldValue[_field]}'`) |
| | | _value.push(_formFieldValue[_field]) |
| | | _value.push(`${_labels[index] || ''}:${_formFieldValue[_field] || ''}`) |
| | | }) |
| | | |
| | | _sql += `Select @tbid='', @ErrorCode='',@retmsg='' |
| | | Select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')} and ${primaryKey} !='${_primaryId}' |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${item.errorCode}',@retmsg='${item.fieldlabel || ''}:${_value.join(' ')} 已存在' |
| | | select @ErrorCode='${item.errorCode}',@retmsg='${_value.join(', ')} 已存在' |
| | | goto aaa |
| | | end |
| | | ` |