| | |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | } |
| | | |
| | | handlecolumns = (columns, fields, config, pId) => { |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('completeSave', this.completeSave) |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | } |
| | | |
| | | /** |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('completeSave', this.completeSave) |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | } |
| | | |
| | | /** |
| | |
| | | visible: true, |
| | | card: card, |
| | | formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, columns) |
| | | }) |
| | | } |
| | | |
| | | getStyle = (comIds, style) => { |
| | | const { config } = this.state |
| | | |
| | | if (comIds[0] !== 'form') return |
| | | |
| | | let Index = config.fields.findIndex(n => n.uuid === comIds[1]) |
| | | |
| | | if (Index === -1) return |
| | | |
| | | let _config = fromJS(config).toJS() |
| | | |
| | | _config.fields[Index].style = style |
| | | |
| | | this.setState({ |
| | | config: _config |
| | | }) |
| | | } |
| | | |
| | |
| | | opacity: 0; |
| | | z-index: 1; |
| | | } |
| | | .ant-col-cuslabel { |
| | | width: 10.5%; |
| | | } |
| | | .ant-col-cuswrap { |
| | | width: 89.5%; |
| | | } |
| | | } |
| | | } |
| | | .ant-calendar-picker { |
| | |
| | | |
| | | componentDidMount () { |
| | | window.GLOB.formId = '' |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.addListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | MKEmitter.removeListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | | completeSave = () => { |
| | | this.setState({saving: false}) |
| | | } |
| | | |
| | | getStyle = (comIds, style) => { |
| | | const { config } = this.state |
| | | |
| | | if (comIds[0] !== 'form') return |
| | | |
| | | let Index = config.fields.findIndex(n => n.uuid === comIds[1]) |
| | | |
| | | if (Index === -1) return |
| | | |
| | | let _config = fromJS(config).toJS() |
| | | |
| | | _config.fields[Index].style = style |
| | | |
| | | this.setState({ |
| | | config: _config |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | opacity: 0; |
| | | z-index: 1; |
| | | } |
| | | .ant-col-cuslabel { |
| | | width: 10.5%; |
| | | } |
| | | .ant-col-cuswrap { |
| | | width: 89.5%; |
| | | } |
| | | } |
| | | } |
| | | .ant-calendar-picker { |
| | |
| | | opacity: 0; |
| | | z-index: 1; |
| | | } |
| | | .ant-col-cuslabel { |
| | | width: 10.5%; |
| | | } |
| | | .ant-col-cuswrap { |
| | | width: 89.5%; |
| | | } |
| | | } |
| | | } |
| | | .ant-calendar-picker { |
| | |
| | | opacity: 0; |
| | | z-index: 1; |
| | | } |
| | | .ant-col-cuslabel { |
| | | width: 10.5%; |
| | | } |
| | | .ant-col-cuswrap { |
| | | width: 89.5%; |
| | | } |
| | | } |
| | | .ant-form-item label > .anticon { |
| | | vertical-align: middle; |
| | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { BaseConfig, SearchItems } from './source' |
| | | import { updateForm } from '@/utils/utils-update.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const { Panel } = Collapse |
| | |
| | | |
| | | componentDidMount() { |
| | | window.GLOB.formId = '' |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | |
| | | document.onkeydown = (event) => { |
| | | let e = event || window.event |
| | | let keyCode = e.keyCode || e.which || e.charCode |
| | |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | this.setState = () => { |
| | | return |
| | | } |
| | |
| | | } |
| | | |
| | | this.props.handleView(param) |
| | | } |
| | | |
| | | getStyle = (comIds, style) => { |
| | | const { config } = this.state |
| | | |
| | | if (comIds[0] !== 'form') return |
| | | |
| | | let Index = config.fields.findIndex(n => n.uuid === comIds[1]) |
| | | |
| | | if (Index === -1) return |
| | | |
| | | let _config = fromJS(config).toJS() |
| | | |
| | | _config.fields[Index].style = style |
| | | |
| | | this.setState({ |
| | | config: _config |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | icon: this.props.config.setting.icon || '', |
| | | appType: sessionStorage.getItem('appType'), |
| | | viewType: sessionStorage.getItem('editMenuType') || '', |
| | | dialogInput: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | const { appType, display } = this.state |
| | | let fields = [] |
| | | let dialogInput = null |
| | | |
| | | config.fields.forEach(f => { |
| | | if (f.field && ['select', 'link', 'text', 'number', 'textarea'].includes(f.type) && f.hidden !== 'true' && f.readonly !== 'true') { |
| | | fields.push(f) |
| | | } |
| | | if (f.field && f.hidden !== 'true' && f.readonly !== 'true') { |
| | | if (dialogInput === null) { |
| | | dialogInput = ['text', 'number'].includes(f.type) |
| | | } else { |
| | | dialogInput = false |
| | | } |
| | | } |
| | | }) |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | fields: fields, |
| | | display: _display, |
| | | dialogInput |
| | | display: _display |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | } else if (typeof(val) === 'string') { |
| | | val = val.replace(/(^\s+$)|\t+|\v+/ig, '') |
| | | if (!val && col.required === 'true') { // 时间必填校验 |
| | | errors.push(_position + '内容不可为空') |
| | | } else if (val && !/^[1-9][0-9]{3}/.test(val)) { // 时间正则校验 |
| | | if (!val) { |
| | | if (col.required === 'true') { // 时间必填校验 |
| | | errors.push(_position + '内容不可为空') |
| | | } else if (col.type === 'date') { |
| | | val = '1949-10-01' |
| | | } else if (col.type === 'datetime') { |
| | | val = '1949-10-01 00:00:00' |
| | | } |
| | | } else if (!/^[1-9][0-9]{3}/.test(val)) { // 时间正则校验 |
| | | errors.push(_position + '时间格式错误') |
| | | } |
| | | } else { // 时间格式错误 |
| | | } else { // 时间格式错误 |
| | | errors.push(_position + '时间格式错误') |
| | | } |
| | | } |