| | |
| | | } else if (child.LinkUrl === 'DataManage') { |
| | | _tmenu.type = 'DataManage' |
| | | _tmenu.forbidden = true |
| | | // } else if (child.LinkUrl === 'bda/rdt?pageno=rolemenus&MenuNo=RoleMenuM') { |
| | | // _tmenu.type = 'RoleManage' |
| | | // _tmenu.forbidden = true |
| | | } else if (iframes.includes(child.LinkUrl.split('?')[0])) { |
| | | _tmenu.type = 'iframe' |
| | | _tmenu.forbidden = true |
| | |
| | | key={view.MenuID} |
| | | > |
| | | {this.selectcomponent(view)} |
| | | <Button className={'main-copy ' + (view.type === 'iframe' ? 'ifr-copy' : '')} icon="copy" data-menuno={view.MenuNo} onClick={this.copyMenuNo} shape="circle" /> |
| | | {view.type !== 'CommonTable' ? |
| | | <Button |
| | | icon="copy" |
| | | shape="circle" |
| | | className={'main-copy ' + (view.type === 'iframe' ? 'ifr-copy' : '')} |
| | | data-menuno={view.MenuNo} |
| | | onClick={this.copyMenuNo} |
| | | /> : null |
| | | } |
| | | <BackTop> |
| | | <div className="ant-back-top"> |
| | | <div className="ant-back-top-content"> |
| | |
| | | 'header.form.linkForm': '关联表单', |
| | | 'header.form.picture': '图片', |
| | | 'header.form.number': '数字', |
| | | 'header.form.letter': '字母', |
| | | 'header.form.letter&number': '字母+数字', |
| | | 'header.form.colspan': '合并列', |
| | | 'header.form.select': 'Select', |
| | | 'header.form.multiselect': '多选', |
| | |
| | | 'header.form.afterExecSuccess': '成功后', |
| | | 'header.form.afterExecError': '失败后', |
| | | 'header.form.pagination': '分页', |
| | | 'header.form.regular': '正则校验', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | 'main.excel.content.maxlimit': '内容超长', |
| | | 'main.excel.content.limitmin': '小于最小值', |
| | | 'main.excel.content.limitmax': '大于最大值', |
| | | 'main.form.link.error': '关联菜单设置错误!', |
| | | 'form.required.input': 'Please input ', |
| | | 'form.required.select': 'Please select ' |
| | | } |
| | |
| | | 'header.form.linkForm': '关联表单', |
| | | 'header.form.picture': '图片', |
| | | 'header.form.number': '数字', |
| | | 'header.form.letter': '字母', |
| | | 'header.form.letter&number': '字母+数字', |
| | | 'header.form.colspan': '合并列', |
| | | 'header.form.select': '下拉选择', |
| | | 'header.form.multiselect': '下拉多选', |
| | |
| | | 'header.form.afterExecSuccess': '成功后', |
| | | 'header.form.afterExecError': '失败后', |
| | | 'header.form.pagination': '分页', |
| | | 'header.form.regular': '正则校验', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | 'main.excel.content.maxlimit': '内容超长', |
| | | 'main.excel.content.limitmin': '小于最小值', |
| | | 'main.excel.content.limitmax': '大于最大值', |
| | | 'main.form.link.error': '关联菜单设置错误!', |
| | | 'form.required.input': '请输入', |
| | | 'form.required.select': '请选择' |
| | | } |
| | |
| | | parentId: this.props.MenuID, |
| | | btn: btn, |
| | | data: data[0] || null, |
| | | primaryId: _primaryId, |
| | | primaryId: btn.Ot !== 'notRequired' ? _primaryId : '', |
| | | arr_field: this.state.arr_field |
| | | } |
| | | } |
| | |
| | | tabParam: { |
| | | btn: btn, |
| | | data: data[0] || null, |
| | | primaryId: _primaryId, |
| | | primaryId: btn.Ot !== 'notRequired' ? _primaryId : '', |
| | | arr_field: this.state.arr_field |
| | | } |
| | | }) |
| | |
| | | ) |
| | | }) |
| | | } |
| | | <Button |
| | | icon="copy" |
| | | shape="circle" |
| | | className="common-table-copy" |
| | | onClick={this.copyMenuNo} |
| | | /> |
| | | <Modal |
| | | className="popview-modal" |
| | | title={this.state.popAction.label} |
| | |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | .common-table-copy { |
| | | position: fixed; |
| | | z-index: 2; |
| | | bottom: 65px; |
| | | right: 30px; |
| | | width: 40px; |
| | | height: 40px; |
| | | } |
| | | } |
| | | .commontable.pick-control { |
| | | >.button-list { |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(btn, res, _primaryId) |
| | | this.execSuccess(btn, res, _primaryId, formdata) |
| | | } else { |
| | | this.execError(res, btn) |
| | | } |
| | |
| | | return Api.genericInterface(_callbackparam) |
| | | } else { |
| | | if (response.status) { |
| | | this.execSuccess(btn, response, _primaryId) |
| | | this.execSuccess(btn, response, _primaryId, formdata) |
| | | _resolve() |
| | | } else { |
| | | this.execError(response, btn) |
| | |
| | | if (!res) return |
| | | |
| | | if (res.status) { |
| | | this.execSuccess(btn, res, _primaryId) |
| | | this.execSuccess(btn, res, _primaryId, formdata) |
| | | _resolve() |
| | | } else { |
| | | this.execError(res, btn) |
| | |
| | | * 4、模态框执行成功后是否关闭 |
| | | * 5、通知主列表刷新 |
| | | */ |
| | | execSuccess = (btn, res, primaryId) => { |
| | | execSuccess = (btn, res, primaryId, formdata) => { |
| | | if (res && res.ErrCode === 'S') { // 执行成功 |
| | | notification.success({ |
| | | top: 92, |
| | |
| | | |
| | | } |
| | | |
| | | this.props.refreshdata(btn, 'success', primaryId) |
| | | this.props.refreshdata(btn, 'success', primaryId, formdata) |
| | | } |
| | | |
| | | /** |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification, Collapse } from 'antd' |
| | | import moment from 'moment' |
| | | import { formRule } from '@/utils/option.js' |
| | |
| | | record: {} |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (nextProps.data && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | |
| | | let _fieldsvalue = {} |
| | | let _record = {} |
| | | Object.keys(nextProps.data).forEach(key => { |
| | | if (this.props.form.getFieldValue(key) !== undefined) { |
| | | _fieldsvalue[key] = nextProps.data[key] |
| | | } else { |
| | | _record[key] = nextProps.data[key] |
| | | } |
| | | }) |
| | | |
| | | if (Object.keys(_fieldsvalue).length > 0) { |
| | | this.props.form.setFieldsValue(_fieldsvalue) |
| | | } |
| | | |
| | | this.setState({ |
| | | record: _record |
| | | }) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, groups } = this.props |
| | | |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | async loadmaindata () { |
| | | const { setting } = this.state |
| | | const { setting, BIDs } = this.state |
| | | |
| | | if (setting.datatype !== 'query') return |
| | | if (setting.datatype !== 'query') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置数据查询配置!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let param = null |
| | | |
| | |
| | | data: _data, |
| | | primaryId: _primaryId, |
| | | BIDs: { |
| | | ...BIDs, |
| | | mainTable: _primaryId, |
| | | mainTabledata: _data |
| | | } |
| | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (btn, type, primaryId) => { |
| | | refreshbyaction = (btn, type, primaryId, formdata) => { |
| | | const { BIDs } = this.state |
| | | |
| | | if (type === 'success' && btn.afterExecSuccess === 'notclose') { |
| | | this.setState({ |
| | | primaryId: primaryId |
| | | }, () => { |
| | | if (btn.execSuccess === 'refresh') { |
| | | this.loadmaindata() |
| | | } else { |
| | | let data = {} |
| | | |
| | | if (formdata && formdata.length > 0) { |
| | | formdata.forEach(item => { |
| | | data[item.key] = item.value |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | BIDs: { |
| | | ...BIDs, |
| | | mainTable: primaryId, |
| | | mainTabledata: data |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } else if (type === 'success' && btn.afterExecSuccess === 'close') { |
| | |
| | | refreshdata={this.refreshbyaction} |
| | | /> : null |
| | | } |
| | | {setting && setting.onload !== 'false' && |
| | | config.tabgroups.map(group => { |
| | | {!loadingview && !viewlost && config.tabgroups.map(group => { |
| | | if (config[group].length === 0) return null |
| | | |
| | | return ( |
| | |
| | | triggerExcelout = (btn) => { |
| | | let viewParam = this.props.getexceloutparam() |
| | | let name = `${viewParam.menuName}${moment().format('YYYYMMDDHHmmss')}.xlsx` |
| | | let pageSize = 100 |
| | | let pageSize = 1000 |
| | | |
| | | this.setState({loadingUuid: btn.uuid}) |
| | | |
| | |
| | | } |
| | | |
| | | state = { |
| | | cols: 2, |
| | | datatype: null, |
| | | readtype: null, |
| | | readin: null, |
| | | fieldlen: null, |
| | | formlist: [], |
| | | record: {} |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let cols = 2 |
| | | if (this.props.action.setting && this.props.action.setting.cols) { |
| | | cols = parseInt(this.props.action.setting.cols) |
| | | if (cols > 3 || cols < 1) { |
| | | cols = 2 |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | cols: cols |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '关联菜单设置错误!', |
| | | message: this.props.dict['main.form.link.error'], |
| | | duration: 10 |
| | | }) |
| | | } |
| | |
| | | input.select() |
| | | }) |
| | | } catch { |
| | | console.warn('表单获取失败!') |
| | | console.warn('focus error!') |
| | | } |
| | | } |
| | | }) |
| | |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { cols } = this.state |
| | | |
| | | const fields = [] |
| | | let cols = 2 |
| | | if (this.props.action.setting && this.props.action.setting.cols) { |
| | | cols = parseInt(this.props.action.setting.cols) |
| | | if (cols > 3 || cols < 1) { |
| | | cols = 2 |
| | | } |
| | | } |
| | | |
| | | this.state.formlist.forEach((item, index) => { |
| | | if ((!item.field && item.type !== 'title') || item.hidden === 'true') return |
| | |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'text') { |
| | | let _max = item.fieldlength || 50 |
| | | let _rules = [] |
| | | if (item.regular) { |
| | | if (item.regular === 'number') { |
| | | _rules = [{ |
| | | pattern: /^[0-9]*$/ig, |
| | | message: formRule.input.numbermsg |
| | | }] |
| | | } else if (item.regular === 'letter') { |
| | | _rules = [{ |
| | | pattern: /^[a-zA-Z]*$/ig, |
| | | message: formRule.input.lettermsg |
| | | }] |
| | | } else if (item.regular === 'letter&number') { |
| | | _rules = [{ |
| | | pattern: /^[a-zA-Z0-9]*$/ig, |
| | | message: formRule.input.letternummsg |
| | | }] |
| | | } |
| | | } |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | max: _max, |
| | | message: formRule.input.formMessage.replace('@max', _max) |
| | | }, |
| | | ..._rules |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | |
| | | let _intertype = '' |
| | | let _position = '' |
| | | let _tabType = '' |
| | | let _linkTab = '' |
| | | let _options = null |
| | | |
| | | this.props.formlist.forEach(form => { |
| | |
| | | _position = form.initVal |
| | | } else if (form.key === 'tabType') { |
| | | _tabType = form.initVal |
| | | } else if (form.key === 'linkTab') { |
| | | _linkTab = form.initVal |
| | | } |
| | | }) |
| | | |
| | | let _tabs = this.props.tabs.filter(tab => tab.type === _tabType) |
| | | let initTab = _tabs.filter(tab => tab.uuid === _linkTab)[0] |
| | | |
| | | if (_opentype === 'innerpage') { // 新页面(内部),可选模板 |
| | | _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] |
| | |
| | | }, |
| | | ..._tabs |
| | | ] |
| | | if (!initTab) { |
| | | item.initVal = '' |
| | | } |
| | | } |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | |
| | | handleTab = (card) => { |
| | | const { config } = this.state |
| | | |
| | | let menus = [{value: 'mainTable', text: '主表'}] |
| | | let menus = [ |
| | | {value: '', text: '空'}, |
| | | {value: 'mainTable', text: '主表'} |
| | | ] |
| | | let equalTabs = [] |
| | | let supMenu = card.supMenu || '' |
| | | let equalTab = card.equalTab || [] |
| | |
| | | PageParam: JSON.stringify({Template: 'Modal'}), |
| | | LongParam: _LongParam |
| | | } |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (!response.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | copyActions: [...this.state.copyActions, res.uuid] |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } else if ( |
| | | (res.OpenType === 'tab' || res.OpenType === 'blank') && |
| | | card.originCard && |
| | | (card.originCard.OpenType === 'tab' || card.originCard.OpenType === 'blank') |
| | | ) { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: card.originCard.uuid |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | |
| | | // 解析配置,修改模态框标题名称 |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | _LongParam = JSON.parse(_LongParam) |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | let _temp = '' |
| | | if (_LongParam && _LongParam.type === 'FormTab') { |
| | | try { |
| | | _LongParam.action = _LongParam.action.map(_btn => { |
| | | _btn.uuid = Utils.getuuid() |
| | | |
| | | return _btn |
| | | }) |
| | | _LongParam.tabgroups.forEach(_groupId => { |
| | | _LongParam[_groupId] = _LongParam[_groupId].map(_tab => { |
| | | _tab.uuid = Utils.getuuid() |
| | | |
| | | return _tab |
| | | }) |
| | | }) |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam))) |
| | | _temp = 'FormTab' |
| | | } catch { |
| | | _LongParam = '' |
| | | } |
| | | } else { |
| | | _LongParam = '' |
| | | } |
| | | |
| | | if (!_temp) return |
| | | |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: menu.MenuID, |
| | | MenuID: res.uuid, |
| | | MenuNo: menu.MenuNo, |
| | | Template: _temp, |
| | | MenuName: res.label, |
| | | PageParam: JSON.stringify({Template: _temp}), |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (!response.status) { |
| | | notification.warning({ |
| | |
| | | }) |
| | | } |
| | | |
| | | _config.funcs = [] // 页面及子页面存储过程集 |
| | | |
| | | _config.funcs.push({ |
| | | type: 'view', |
| | | subtype: 'view', |
| | | uuid: menu.MenuID, |
| | | intertype: _config.setting.interType || 'inner', |
| | | interface: _config.setting.interface || '', |
| | | tableName: _config.setting.tableName || '', |
| | | innerFunc: _config.setting.innerFunc || '', |
| | | outerFunc: _config.setting.outerFunc || '' |
| | | }) |
| | | |
| | | _config.action.forEach(item => { |
| | | let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '') |
| | | |
| | | if (item.OpenType === 'excelOut' && item.intertype === 'inner' && !item.innerFunc) { |
| | | tablename = _config.setting.tableName || '' |
| | | } |
| | | |
| | | if (item.OpenType === 'tab' || item.OpenType === 'blank') { |
| | | _config.funcs.push({ |
| | | type: 'tab', |
| | | subtype: 'btn', |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | linkTab: item.uuid |
| | | }) |
| | | } else if (item.OpenType === 'popview') { |
| | | _config.funcs.push({ |
| | | type: 'tab', |
| | | subtype: 'btn', |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | linkTab: item.linkTab |
| | | }) |
| | | } else if (['pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(item.OpenType)) { |
| | | _config.funcs.push({ |
| | | type: 'button', |
| | | subtype: 'btn', |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | tablename: tablename, |
| | | intertype: item.intertype, |
| | | interface: item.interface || '', |
| | | innerFunc: item.innerFunc || '', |
| | | outerFunc: item.outerFunc || '', |
| | | callbackFunc: item.callbackFunc || '' |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | _config.tabgroups.forEach(groupId => { |
| | | if (_config[groupId].length === 0) return |
| | | |
| | | _config[groupId].forEach(tab => { |
| | | _config.funcs.push({ |
| | | type: 'tab', |
| | | subtype: 'tab', |
| | | uuid: tab.uuid, |
| | | label: tab.label, |
| | | linkTab: tab.linkTab |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | new Promise(resolve => { |
| | | let deffers = [] |
| | | _config.funcs.forEach(item => { |
| | | if (item.type === 'tab') { |
| | | let deffer = new Promise(resolve => { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: item.linkTab |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | _LongParam = JSON.parse(_LongParam) |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_LongParam) { |
| | | item.menuNo = _LongParam.tabNo || '' |
| | | item.subfuncs = _LongParam.funcs || [] |
| | | } |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | |
| | | deffers.push(deffer) |
| | | } |
| | | }) |
| | | |
| | | if (deffers.length === 0) { |
| | | resolve() |
| | | } else { |
| | | Promise.all(deffers).then(() => { |
| | | resolve() |
| | | }) |
| | | } |
| | | }).then(() => { |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | delete _config.isAdd |
| | |
| | | top: 92, |
| | | message: '编译错误', |
| | | duration: 10 |
| | | }) |
| | | this.setState({ |
| | | menucloseloading: false, |
| | | menuloading: false |
| | | }) |
| | | return |
| | | } |
| | |
| | | Sort: (this.props.supMenuList.length + 1) * 10, |
| | | PageParam: JSON.stringify(_pageParam), |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | // 有按钮或标签删除时,先进行删除操作 |
| | |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | }, () => { |
| | |
| | | title={this.state.dict['header.modal.search.edit']} |
| | | visible={modaltype === 'search'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | title={modaltype === 'actionEdit' ? this.state.dict['header.modal.action.edit'] : this.state.dict['header.modal.action.copy']} |
| | | visible={modaltype === 'actionEdit' || modaltype === 'actionCopy'} |
| | | width={800} |
| | | maskClosable={false} |
| | | onCancel={this.editModalCancel} |
| | | footer={[ |
| | | modaltype === 'actionEdit' ? <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button> : null, |
| | |
| | | title={this.state.dict['header.modal.column.edit']} |
| | | visible={modaltype === 'columns'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | title={this.state.dict['header.modal.colspan.edit']} |
| | | visible={modaltype === 'colspan'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | title={this.state.dict['header.modal.gridbtn.edit']} |
| | | visible={modaltype === 'gridbtn'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | title={this.state.dict['header.modal.tabs.edit']} |
| | | visible={modaltype === 'tabs'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.tableVisible} |
| | | width={'65vw'} |
| | | maskClosable={false} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | cancelText={this.state.dict['header.close']} |
| | | onOk={this.addFieldSubmit} |
| | |
| | | <Modal |
| | | wrapClassName="common-table-fields-modal" |
| | | title={'验证信息'} |
| | | maskClosable={false} |
| | | visible={this.state.profileVisible} |
| | | width={'75vw'} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.settingVisible} |
| | | width={700} |
| | | maskClosable={false} |
| | | // onOk={this.settingSave} |
| | | onCancel={() => { // 取消修改 |
| | | this.setState({ |
| | |
| | | <Modal |
| | | bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} |
| | | closable={false} |
| | | maskClosable={false} |
| | | visible={this.state.closeVisible} |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | |
| | | {card.type === 'textarea' ? |
| | | <TextArea defaultValue={card.initval} autosize={{ minRows: 2, maxRows: 6 }} /> : null |
| | | } |
| | | {card.type === 'funcvar' && |
| | | <Input style={{marginTop: '4px'}} defaultValue={card.linkfield} /> |
| | | } |
| | | {card.type === 'fileupload' ? |
| | | <Button> |
| | | <Icon type="upload" /> 点击上传 |
| | |
| | | if (!config) { |
| | | _config = JSON.parse(JSON.stringify(Source.baseConfig)) |
| | | _config.isAdd = true |
| | | if (menu && menu.LongParam && menu.LongParam.setting.dataresource) { |
| | | _config.setting.dataresource = menu.LongParam.setting.dataresource |
| | | } |
| | | } else { |
| | | _config = config |
| | | // _config.action = Source.baseConfig.action |
| | | } |
| | | |
| | | if (menu && menu.LongParam && menu.LongParam.columns) { |
| | |
| | | handleTab = (card) => { |
| | | const { config } = this.state |
| | | |
| | | let menus = [{value: 'mainTable', text: '主数据'}] |
| | | let menus = [ |
| | | {value: '', text: '空'}, |
| | | {value: 'mainTable', text: '主数据'} |
| | | ] |
| | | let equalTabs = [] |
| | | let supMenu = card.supMenu || '' |
| | | let equalTab = card.equalTab || [] |
| | |
| | | |
| | | // 标签不合法时,启用状态为false |
| | | if (_config.tabgroups.length > 1) { |
| | | _config.tabgroups.forEach(group => { |
| | | if (_config[group].length === 0) { |
| | | _config.tabgroups.forEach(groupId => { |
| | | if (_config[groupId].length === 0) { |
| | | _config.enabled = false |
| | | } |
| | | }) |
| | |
| | | }) |
| | | } |
| | | |
| | | _config.funcs = [] // 页面及子页面存储过程集 |
| | | |
| | | if (_config.setting.datatype === 'query') { |
| | | _config.funcs.push({ |
| | | type: 'view', |
| | | subtype: 'view', |
| | | uuid: btnTab.uuid, |
| | | intertype: _config.setting.interType || 'inner', |
| | | interface: _config.setting.interface || '', |
| | | tableName: _config.setting.tableName || '', |
| | | innerFunc: _config.setting.innerFunc || '', |
| | | outerFunc: _config.setting.outerFunc || '' |
| | | }) |
| | | } |
| | | |
| | | _config.action.forEach(item => { |
| | | if (item.btnType !== 'cancel') { |
| | | _config.funcs.push({ |
| | | type: 'button', |
| | | subtype: 'btn', |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | tablename: item.sql || '', |
| | | intertype: item.intertype, |
| | | interface: item.interface || '', |
| | | innerFunc: item.innerFunc || '', |
| | | outerFunc: item.outerFunc || '', |
| | | callbackFunc: item.callbackFunc || '' |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | _config.tabgroups.forEach(groupId => { |
| | | if (_config[groupId].length === 0) return |
| | | |
| | | _config[groupId].forEach(tab => { |
| | | _config.funcs.push({ |
| | | type: 'tab', |
| | | subtype: 'tab', |
| | | uuid: tab.uuid, |
| | | label: tab.label, |
| | | linkTab: tab.linkTab |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | new Promise(resolve => { |
| | | let deffers = [] |
| | | _config.funcs.forEach(item => { |
| | | if (item.type === 'tab') { |
| | | let deffer = new Promise(resolve => { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: item.linkTab |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | _LongParam = JSON.parse(_LongParam) |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_LongParam) { |
| | | item.menuNo = _LongParam.tabNo |
| | | item.subfuncs = _LongParam.funcs || [] |
| | | } |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | |
| | | deffers.push(deffer) |
| | | } |
| | | }) |
| | | |
| | | if (deffers.length === 0) { |
| | | resolve() |
| | | } else { |
| | | Promise.all(deffers).then(() => { |
| | | resolve() |
| | | }) |
| | | } |
| | | }).then(() => { |
| | | |
| | | // 删除添加标识 |
| | | delete _config.isAdd |
| | | |
| | | try { |
| | |
| | | top: 92, |
| | | message: '编译错误', |
| | | duration: 10 |
| | | }) |
| | | |
| | | this.setState({ |
| | | menucloseloading: false, |
| | | menuloading: false |
| | | }) |
| | | return |
| | | } |
| | |
| | | MenuName: btnTab.label, |
| | | PageParam: JSON.stringify({Template: 'FormTab'}), |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | // 有按钮或标签删除时,先进行删除操作 |
| | |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | }, () => { |
| | |
| | | title={this.state.dict['header.modal.form.edit']} |
| | | visible={modaltype === 'search'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | title={this.state.dict['header.modal.action.edit']} |
| | | visible={modaltype === 'actionEdit'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onCancel={this.editModalCancel} |
| | | footer={[ |
| | | this.state.card && this.state.card.btnType !== 'cancel' ? |
| | |
| | | title={this.state.dict['header.modal.tabs.edit']} |
| | | visible={modaltype === 'tabs'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.tableVisible} |
| | | width={'65vw'} |
| | | maskClosable={false} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | cancelText={this.state.dict['header.close']} |
| | | onOk={this.addFieldSubmit} |
| | |
| | | title={'验证信息'} |
| | | visible={this.state.profileVisible} |
| | | width={'75vw'} |
| | | maskClosable={false} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | onOk={this.verifySubmit} |
| | | onCancel={() => { this.setState({ profileVisible: false }) }} |
| | |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.settingVisible} |
| | | width={700} |
| | | // onOk={this.settingSave} |
| | | maskClosable={false} |
| | | onCancel={() => { // 取消修改 |
| | | this.setState({ |
| | | settingVisible: false |
| | |
| | | <Modal |
| | | bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} |
| | | closable={false} |
| | | maskClosable={false} |
| | | visible={this.state.closeVisible} |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | |
| | | title={this.state.dict['header.menu.group.manage']} |
| | | visible={this.state.groupVisible} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleGroupSave} |
| | | onCancel={() => { this.setState({ groupVisible: false }) }} |
| | | destroyOnClose |
| | |
| | | <Col span={12}> |
| | | <Form.Item label={dict['header.menu.datasource']}> |
| | | {getFieldDecorator('datatype', { |
| | | initialValue: setting.datatype || 'maintable' |
| | | initialValue: setting.datatype || 'query' |
| | | })( |
| | | <Radio.Group onChange={this.sourceChange}> |
| | | <Radio value="maintable">{dict['header.menu.maintable']}</Radio> |
| | |
| | | tableName: '', |
| | | primaryKey: '', |
| | | dataresource: '', |
| | | datatype: 'query', |
| | | interType: 'inner', |
| | | sysInterface: 'false', |
| | | innerFunc: '', |
| | |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.tableVisible} |
| | | width={'65vw'} |
| | | maskClosable={false} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | onOk={this.addFieldSubmit} |
| | | cancelText={this.state.dict['header.close']} |
| | |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.settingVisible} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.settingSave} |
| | | onCancel={() => { this.setState({ settingVisible: false }) }} |
| | | destroyOnClose |
| | |
| | | <Modal |
| | | bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} |
| | | closable={false} |
| | | maskClosable={false} |
| | | visible={this.state.closeVisible} |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | |
| | | title={this.state.dict['header.menu.group.manage']} |
| | | visible={this.state.groupVisible} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleGroupSave} |
| | | onCancel={() => { this.setState({ groupVisible: false }) }} |
| | | destroyOnClose |
| | |
| | | if (config.groups.length > 0) { |
| | | config.groups.forEach(group => { |
| | | group.sublist.forEach(item => { |
| | | if (item.field && (item.type === 'text' || item.type === 'number')) { |
| | | if (item.field && (item.type === 'text' || item.type === 'number') && item.hidden !== 'true' && item.readonly !== 'true') { |
| | | fields.push(item) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (config.fields.length > 0) { |
| | | config.fields.forEach(f => { |
| | | if (f.field && (f.type === 'text' || f.type === 'number')) { |
| | | if (f.field && (f.type === 'text' || f.type === 'number') && f.hidden !== 'true' && f.readonly !== 'true') { |
| | | fields.push(f) |
| | | } |
| | | }) |
| | |
| | | let _intertype = '' |
| | | let _position = '' |
| | | let _tabType = '' |
| | | let _linkTab = '' |
| | | let _options = null |
| | | |
| | | this.props.formlist.forEach(form => { |
| | |
| | | _position = form.initVal |
| | | } else if (form.key === 'tabType') { |
| | | _tabType = form.initVal |
| | | } else if (form.key === 'linkTab') { |
| | | _linkTab = form.initVal |
| | | } |
| | | }) |
| | | |
| | | let _tabs = this.props.tabs.filter(tab => tab.type === _tabType) |
| | | let initTab = _tabs.filter(tab => tab.uuid === _linkTab)[0] |
| | | |
| | | if (_opentype === 'popview') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] |
| | |
| | | }, |
| | | ..._tabs |
| | | ] |
| | | if (!initTab) { |
| | | item.initVal = '' |
| | | } |
| | | } else if (item.key === 'OpenType') { |
| | | item.options = [ |
| | | { |
| | |
| | | _config.enabled = false |
| | | } |
| | | |
| | | _config.funcs = [] |
| | | |
| | | _config.funcs.push({ |
| | | type: 'view', |
| | | subtype: 'view', |
| | | uuid: _config.uuid, |
| | | intertype: _config.setting.interType || 'inner', |
| | | interface: _config.setting.interface || '', |
| | | tableName: _config.setting.tableName || '', |
| | | innerFunc: _config.setting.innerFunc || '', |
| | | outerFunc: _config.setting.outerFunc || '' |
| | | }) |
| | | |
| | | _config.action.forEach(item => { |
| | | let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '') |
| | | |
| | | if (item.OpenType === 'excelOut' && item.intertype === 'inner' && !item.innerFunc) { |
| | | tablename = _config.setting.tableName || '' |
| | | } |
| | | |
| | | if (item.OpenType === 'popview') { |
| | | _config.funcs.push({ |
| | | type: 'tab', |
| | | subtype: 'btn', |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | linkTab: item.linkTab |
| | | }) |
| | | } else { |
| | | _config.funcs.push({ |
| | | type: 'button', |
| | | subtype: 'btn', |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | tablename: tablename, |
| | | intertype: item.intertype, |
| | | interface: item.interface || '', |
| | | innerFunc: item.innerFunc || '', |
| | | outerFunc: item.outerFunc || '', |
| | | callbackFunc: item.callbackFunc || '' |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | new Promise(resolve => { |
| | | let deffers = [] |
| | | _config.funcs.forEach(item => { |
| | | if (item.type === 'tab') { |
| | | let deffer = new Promise(resolve => { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: item.linkTab |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | _LongParam = JSON.parse(_LongParam) |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_LongParam) { |
| | | item.menuNo = _LongParam.tabNo |
| | | item.subfuncs = _LongParam.funcs || [] |
| | | } |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | |
| | | deffers.push(deffer) |
| | | } |
| | | }) |
| | | |
| | | if (deffers.length === 0) { |
| | | resolve() |
| | | } else { |
| | | Promise.all(deffers).then(() => { |
| | | resolve() |
| | | }) |
| | | } |
| | | }).then(() => { |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | delete _config.isAdd |
| | |
| | | top: 92, |
| | | message: '编译错误', |
| | | duration: 10 |
| | | }) |
| | | |
| | | this.setState({ |
| | | menucloseloading: false, |
| | | menuloading: false |
| | | }) |
| | | return |
| | | } |
| | |
| | | PageParam: JSON.stringify({Template: 'SubTable'}), |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | |
| | | // 有按钮或标签删除时,先进行删除操作 |
| | | // 删除成功后,保存页面配置 |
| | |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | }, () => { |
| | |
| | | title={this.state.dict['header.modal.search.edit']} |
| | | visible={modaltype === 'search'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | title={modaltype === 'actionEdit' ? this.state.dict['header.modal.action.edit'] : this.state.dict['header.modal.action.copy']} |
| | | visible={modaltype === 'actionEdit' || modaltype === 'actionCopy'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onCancel={this.editModalCancel} |
| | | footer={[ |
| | | modaltype === 'actionEdit' ? <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button> : null, |
| | |
| | | title={this.state.dict['header.modal.column.edit']} |
| | | visible={modaltype === 'columns'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | title={this.state.dict['header.modal.colspan.edit']} |
| | | visible={modaltype === 'colspan'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | title={this.state.dict['header.modal.gridbtn.edit']} |
| | | visible={modaltype === 'gridbtn'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.tableVisible} |
| | | width={'65vw'} |
| | | maskClosable={false} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | cancelText={this.state.dict['header.close']} |
| | | onOk={this.addFieldSubmit} |
| | |
| | | title={'验证信息'} |
| | | visible={this.state.profileVisible} |
| | | width={'75vw'} |
| | | maskClosable={false} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | onOk={this.verifySubmit} |
| | | onCancel={() => { this.setState({ profileVisible: false }) }} |
| | |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.settingVisible} |
| | | width={700} |
| | | // onOk={this.settingSave} |
| | | maskClosable={false} |
| | | onCancel={() => { // 取消修改 |
| | | this.setState({ |
| | | settingVisible: false |
| | |
| | | <Modal |
| | | bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} |
| | | closable={false} |
| | | maskClosable={false} |
| | | visible={this.state.closeVisible} |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'regular', |
| | | label: Formdict['header.form.regular'], |
| | | initVal: card.regular || '', |
| | | options: [{ |
| | | value: '', |
| | | text: Formdict['header.form.empty'] |
| | | }, { |
| | | value: 'number', |
| | | text: Formdict['header.form.number'] |
| | | }, { |
| | | value: 'letter', |
| | | text: Formdict['header.form.letter'] |
| | | }, { |
| | | value: 'letter&number', |
| | | text: Formdict['header.form.letter&number'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'readonly', |
| | | label: Formdict['header.form.readonly'], |
| | |
| | | type: 'number', |
| | | key: 'fieldlength', |
| | | label: Formdict['header.form.field.length'], |
| | | tooltip: '文本、下拉框、日期等字段默认长度为50,多行文本与文件上传字段默认长度为512', |
| | | initVal: card.fieldlength || _fieldlength, |
| | | required: false |
| | | }, |
| | |
| | | newcard.label = 'tab' |
| | | newcard.icon = '' |
| | | newcard.type = item.subType |
| | | newcard.linkTab = Utils.getuuid() |
| | | newcard.linkTab = '' |
| | | newcard.subtabs = [] |
| | | newcard.supMenu = '' |
| | | newcard.supMenu = 'mainTable' |
| | | newcard.groupId = groupId |
| | | newcard.focus = true |
| | | |
| | |
| | | |
| | | state = { |
| | | editItem: null, // 编辑元素 |
| | | type: 'Nvarchar(50)' |
| | | type: 'Nvarchar(50)', |
| | | locked: false |
| | | } |
| | | |
| | | edit = (record) => { |
| | |
| | | required: record.required, |
| | | type: record.type |
| | | }) |
| | | if (record.type === 'Int' || /^Decimal/ig.test(record.type)) { |
| | | this.setState({ |
| | | locked: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | locked: false |
| | | }) |
| | | } |
| | | } |
| | | |
| | | typeChange = (val) => { |
| | | this.setState({ |
| | | type: val |
| | | }, () => { |
| | | if (val === 'Int' || /^Decimal/ig.test(val)) { |
| | | this.props.form.setFieldsValue({ |
| | | required: 'true', |
| | | }) |
| | | this.setState({ |
| | | locked: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | locked: false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | if (!err) { |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | |
| | | if (/^Nvarchar/ig.test(values.type)) { |
| | | values.limit = values.type.match(/\d+/)[0] |
| | | } else if (/^Decimal/ig.test(values.type)) { |
| | | values.limit = values.type.match(/\d+/ig)[1] |
| | | } else { |
| | | values.limit = '' |
| | | } |
| | | |
| | | this.props.columnChange(values) |
| | | this.setState({ |
| | | editItem: null |
| | | editItem: null, |
| | | locked: false |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | Column: '', |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Form.Item label={'是否必填'}> |
| | | {getFieldDecorator('required', { |
| | | initialValue: 'true' |
| | | })( |
| | | <Select> |
| | | <Select.Option value="false"> 否 </Select.Option> |
| | | <Select.Option value="true"> 是 </Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={3} className="add"> |
| | | <Button onClick={this.handleConfirm} type="primary" className="add-row"> |
| | | 确定 |
| | | </Button> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Form.Item label={'类型'}> |
| | | {getFieldDecorator('type', { |
| | | initialValue: 'Nvarchar(50)' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={3} className="add"> |
| | | <Button onClick={this.handleConfirm} type="primary" className="add-row"> |
| | | 确定 |
| | | </Button> |
| | | </Col> |
| | | <Col span={7}> |
| | | <Form.Item label={'是否必填'}> |
| | | {getFieldDecorator('required', { |
| | | initialValue: 'true' |
| | | })( |
| | | <Select disabled={this.state.locked}> |
| | | <Select.Option value="false"> 否 </Select.Option> |
| | | <Select.Option value="true"> 是 </Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {haslimit ? <Col span={7}> |
| | | <Form.Item label={'最小值'}> |
| | | {getFieldDecorator('min', { |
| | |
| | | editable: true |
| | | }, |
| | | { |
| | | title: '类型', |
| | | dataIndex: 'type', |
| | | width: '12%', |
| | | editable: true |
| | | }, |
| | | { |
| | | title: '是否必填', |
| | | dataIndex: 'required', |
| | | width: '12%', |
| | | editable: true, |
| | | render: (text, record) => record.required === 'true' ? '是' : '否' |
| | | }, |
| | | { |
| | | title: '类型', |
| | | dataIndex: 'type', |
| | | width: '12%', |
| | | editable: true |
| | | }, |
| | | { |
| | | title: '最小值', |
| | |
| | | col.required = col.required || 'true' |
| | | col.type = col.type || 'Nvarchar(50)' |
| | | |
| | | if (/^Nvarchar/ig.test(col.type)) { |
| | | col.limit = col.type.match(/\d+/)[0] |
| | | } else if (/^Decimal/ig.test(col.type)) { |
| | | col.limit = col.type.match(/\d+/ig)[1] |
| | | } else { |
| | | col.limit = '' |
| | | } |
| | | |
| | | return col |
| | | }) |
| | | |
| | |
| | | _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin'] |
| | | } else if (type === 'fileupload') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength'] |
| | | } else if (type === 'text' || type === 'textarea') { |
| | | } else if (type === 'textarea') { |
| | | _options = [..._options, 'fieldlength'] |
| | | } else if (type === 'text') { |
| | | _options = [..._options, 'fieldlength', 'regular'] |
| | | } |
| | | |
| | | if (type === 'select') { |
| | |
| | | _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin'] |
| | | } else if (value === 'fileupload') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength'] |
| | | } else if (value === 'text' || value === 'textarea') { |
| | | } else if (value === 'textarea') { |
| | | _options = [..._options, 'fieldlength'] |
| | | } else if (value === 'text') { |
| | | _options = [..._options, 'fieldlength', 'regular'] |
| | | } |
| | | |
| | | if (value === 'select') { |
| | |
| | | } |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | rules: [ |
| | |
| | | export const formRule = { |
| | | input: { |
| | | max: 100, |
| | | message: '输入框最多100个字符。' |
| | | message: '输入框最多100个字符。', |
| | | formMessage: '最多@max个字符。', // 文本表单最大提示 |
| | | numbermsg: '请输入数字!', |
| | | lettermsg: '请输入字母!', |
| | | letternummsg: '请输入数字或字母!' |
| | | }, |
| | | field: { // 字段名 |
| | | max: 50, |
| | |
| | | |
| | | val = val.replace(/(^\s*$)|\t*|\v*/ig, '') |
| | | |
| | | let limitlen = col.type.match(/\d+/)[0] |
| | | |
| | | if (!val && col.required === 'true') { // 必填校验 |
| | | let _error = _position + dict['main.excel.content.emptyerror'] |
| | | errors.push(_error) |
| | | } else if (val.length > limitlen) { // 长度校验 |
| | | } else if (val.length > col.limit) { // 长度校验 |
| | | let _error = _position + dict['main.excel.content.maxlimit'] |
| | | errors.push(_error) |
| | | } else { // 关键字校验 |
| | |
| | | }) |
| | | } |
| | | } else if (/^int/ig.test(col.type)) { |
| | | if (typeof(val) !== 'number' || parseInt(val) < parseFloat(val)) { // 检验是否为整数 |
| | | if (!val) { |
| | | let _error = _position + dict['main.excel.content.emptyerror'] |
| | | errors.push(_error) |
| | | } else { |
| | | let _val = val + '' |
| | | |
| | | if (!/^(([^0][0-9]+|0)$)|^(([1-9]+)$)/.test(_val)) { // 检验是否为整数 |
| | | let _error = _position + dict['main.excel.content.interror'] |
| | | errors.push(_error) |
| | | } else if ((col.min || col.min === 0) && val < col.min) { // 最小值检验 |
| | |
| | | let _error = _position + dict['main.excel.content.limitmax'] |
| | | errors.push(_error) |
| | | } |
| | | } |
| | | } else if (/^Decimal/ig.test(col.type)) { |
| | | if (!val) { |
| | | let _error = _position + dict['main.excel.content.emptyerror'] |
| | | errors.push(_error) |
| | | } else { |
| | | let _val = val + '' |
| | | _val = _val.split('.') |
| | | let limitlen = col.type.match(/\d+/ig)[1] |
| | | let _vals = _val.split('.') |
| | | |
| | | if (typeof(val) !== 'number') { // 检验是否为浮点数 |
| | | if (!/^(([^0][0-9]+|0)\.([0-9]+)$)|^(([^0][0-9]+|0)$)|^(([1-9]+)\.([0-9]+)$)|^(([1-9]+)$)/.test(_val)) { // 检验是否为浮点数 |
| | | let _error = _position + dict['main.excel.content.floaterror'] |
| | | errors.push(_error) |
| | | } else if (_val[0].length > 18) { // 检验整数位 |
| | | } else if (_vals[0].length > 18) { // 检验整数位 |
| | | let _error = _position + dict['main.excel.content.floatIntover'] |
| | | errors.push(_error) |
| | | } else if (_val[1] && _val[1].length > limitlen) { // 最小值检验 |
| | | } else if (_vals[1] && _vals[1].length > col.limit) { // 最小值检验 |
| | | let _error = _position + dict['main.excel.content.floatPointover'] |
| | | errors.push(_error) |
| | | } else if ((col.min || col.min === 0) && val < col.min) { // 最小值检验 |
| | |
| | | errors.push(_error) |
| | | } |
| | | } |
| | | } |
| | | |
| | | return `'${val}' as ${col.Column}` |
| | | }) |