| | |
| | | top: 18px; |
| | | } |
| | | .page-card.active { |
| | | color: #1890ff; |
| | | .form-sort { |
| | | background: #1890ff; |
| | | } |
| | |
| | | margin-right: 15px; |
| | | } |
| | | .submit { |
| | | min-width: 70px; |
| | | border: none; |
| | | } |
| | | .skip { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Radio, Select } from 'antd' |
| | | import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="用于表单加载时的状态控制。"> |
| | | <Icon type="question-circle" /> |
| | | 状态值 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('status', { |
| | | initialValue: group.setting.status || '', |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label="焦点"> |
| | | {getFieldDecorator('focus', { |
| | | initialValue: group.setting.focus || '' |
| | |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | .anticon-question-circle { |
| | | color: #c49f47; |
| | | position: relative; |
| | | left: -3px; |
| | | } |
| | | } |
| | |
| | | name: card.name, |
| | | subtype: card.subtype, |
| | | setting: { }, |
| | | wrap: { name: card.name, width: card.width || 24, datatype: 'static' }, |
| | | wrap: { name: card.name, width: card.width || 24, datatype: 'static', color: '#1890ff' }, |
| | | style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' }, |
| | | columns: [], |
| | | scripts: [], |
| | |
| | | style: {}, |
| | | fields: [], |
| | | prevButton: {label: '上一步', type: 'prev'}, |
| | | subButton: {label: '提交', type: 'submit'}, |
| | | subButton: {label: '提交', type: 'submit', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px'}}, |
| | | nextButton: {label: '跳过', type: 'next', enable: 'false'} |
| | | }] |
| | | } |
| | |
| | | style: {}, |
| | | fields: [], |
| | | prevButton: {label: '上一步', type: 'prev'}, |
| | | subButton: {label: '提交', type: 'submit'}, |
| | | subButton: {label: '提交', type: 'submit', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px'}}, |
| | | nextButton: {label: '跳过', type: 'next', enable: 'false'} |
| | | } |
| | | |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Radio, Tooltip, Icon, InputNumber, Select } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) |
| | | |
| | | class SettingForm extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { wrap } = this.props |
| | | const { wrap, config } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { roleList } = this.state |
| | | |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="表单加载时的状态,当字段值与表单组的状态值一致时,启用对应的表单组。"> |
| | | <Icon type="question-circle" /> |
| | | 状态控制 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('statusControl', { |
| | | initialValue: wrap.statusControl || '' |
| | | })( |
| | | <Select> |
| | | <Select.Option key='' value={''}>无</Select.Option> |
| | | {config.columns.map(option => |
| | | <Select.Option key={option.uuid} value={option.field}>{option.label}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="完成后的颜色"> |
| | | <Icon type="question-circle" /> |
| | | 颜色控制 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('color', { |
| | | initialValue: wrap.color || '#1890ff' |
| | | })( |
| | | <ColorSketch /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label="黑名单"> |
| | | {getFieldDecorator('blacklist', { |
| | | initialValue: wrap.blacklist || [] |
| | |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | .color-sketch-block { |
| | | margin-top: 6px; |
| | | } |
| | | } |
| | |
| | | { type: 'menu', url: Mainsearch, component: 'search', subtype: 'mainsearch', title: '搜索条件', width: 24, forbid: ['billPrint'] }, |
| | | { type: 'menu', url: card1, component: 'card', subtype: 'datacard', title: '数据卡', width: 24 }, |
| | | { type: 'menu', url: card2, component: 'card', subtype: 'propcard', title: '属性卡', width: 24 }, |
| | | { type: 'menu', url: form, component: 'form', subtype: 'form', title: '表单', width: 24 }, |
| | | { type: 'menu', url: form, component: 'form', subtype: 'stepform', title: '表单', width: 24 }, |
| | | { type: 'menu', url: Carousel, component: 'carousel', subtype: 'datacard', title: '轮播-动态数据', width: 24, forbid: ['billPrint'] }, |
| | | { type: 'menu', url: Carousel1, component: 'carousel', subtype: 'propcard', title: '轮播-静态数据', width: 24, forbid: ['billPrint'] }, |
| | | { type: 'menu', url: NormalTable, component: 'table', subtype: 'normaltable', title: '常用表', width: 24 }, |
| | |
| | | { type: 'menu', url: Mainsearch, component: 'search', subtype: 'mainsearch', title: '搜索条件', width: 24 }, |
| | | { type: 'menu', url: card1, component: 'card', subtype: 'datacard', title: '数据卡', width: 24 }, |
| | | { type: 'menu', url: card2, component: 'card', subtype: 'propcard', title: '属性卡', width: 24 }, |
| | | { type: 'menu', url: form, component: 'form', subtype: 'form', title: '表单', width: 24 }, |
| | | { type: 'menu', url: form, component: 'form', subtype: 'stepform', title: '表单', width: 24 }, |
| | | { type: 'menu', url: Carousel, component: 'carousel', subtype: 'datacard', title: '轮播-动态数据', width: 24 }, |
| | | { type: 'menu', url: Carousel1, component: 'carousel', subtype: 'propcard', title: '轮播-静态数据', width: 24 }, |
| | | { type: 'menu', url: NormalTable, component: 'table', subtype: 'normaltable', title: '常用表', width: 24 }, |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { connect } from 'react-redux' |
| | | import { Spin, notification } from 'antd' |
| | | import { Spin, notification, Button } from 'antd' |
| | | // import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | // import Utils from '@/utils/utils.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | // import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | |
| | | import './index.scss' |
| | | |
| | | const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) |
| | | const NormalButton = asyncComponent(() => import('@/tabviews/zshare/actionList/normalbutton')) |
| | | |
| | | class NormalForm extends Component { |
| | | static propTpyes = { |
| | |
| | | loading: false, // 数据加载状态 |
| | | activeKey: '', // 选中数据 |
| | | sync: false, // 是否统一请求数据 |
| | | data: {}, // 数据 |
| | | group: null |
| | | data: null, // 数据 |
| | | group: null, |
| | | step: 0 |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, BID, config } = this.props |
| | | |
| | | let _data = {} |
| | | let _data = null |
| | | let _sync = false |
| | | |
| | | if (config.setting && config.wrap.datatype !== 'static') { |
| | | _sync = config.setting.sync === 'true' |
| | | |
| | | if (_sync && data) { |
| | | _data = data[config.dataName] || {} |
| | | if (_data && Array.isArray(_data)) { |
| | | if (_sync && data && data[config.dataName]) { |
| | | _data = data[config.dataName] |
| | | if (Array.isArray(_data)) { |
| | | _data = _data[0] || {} |
| | | } |
| | | _sync = false |
| | |
| | | _data = {} |
| | | } |
| | | |
| | | config.subcards = config.subcards.map(group => { |
| | | group.subButton.uuid = group.uuid |
| | | group.subButton.Ot = 'requiredSgl' |
| | | group.subButton.btnstyle = group.subButton.style |
| | | group.subButton.OpenType = 'formSubmit' |
| | | |
| | | return group |
| | | }) |
| | | |
| | | this.setState({ |
| | | sync: _sync, |
| | | data: _data, |
| | | group: config.subcards[0], |
| | | step: 0, |
| | | BID: BID || '', |
| | | config: config, |
| | | arr_field: config.columns.map(col => col.field).join(','), |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('mkFormSubmit', this.mkFormSubmit) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('mkFormSubmit', this.mkFormSubmit) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | |
| | | let _data = {} |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] |
| | | if (_data && Array.isArray(_data)) { |
| | | _data = _data[0] |
| | | if (Array.isArray(_data)) { |
| | | _data = _data[0] || {} |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | activeKey: '', |
| | | data: _data, |
| | | data: _data || {}, |
| | | loading: false |
| | | }) |
| | | } else { |
| | |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | changeCard = (index, item) => { |
| | | const { config, data, activeKey } = this.state |
| | | |
| | | this.openView(item) |
| | | |
| | | if (!config.wrap.cardType || activeKey === index) return |
| | | |
| | | this.setState({ |
| | | activeKey: index |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (item.setting.primaryId || ''), data) |
| | | } |
| | | |
| | | openView = (item) => { |
| | |
| | | } |
| | | } |
| | | |
| | | mkFormSubmit = (btnId) => { |
| | | const { group } = this.state |
| | | |
| | | if (group.uuid !== btnId) return |
| | | |
| | | this.formRef.handleConfirm().then(res => { |
| | | MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res}) |
| | | }) |
| | | } |
| | | |
| | | prevStep = () => { |
| | | const { config, group } = this.state |
| | | |
| | | let _group = config.subcards.filter(item => item.sort === (group.sort - 1))[0] |
| | | |
| | | this.setState({group: null, step: group.sort - 2}, () => { |
| | | this.setState({group: _group}) |
| | | }) |
| | | } |
| | | |
| | | nextStep = () => { |
| | | const { config, group } = this.state |
| | | |
| | | let _group = config.subcards.filter(item => item.sort === (group.sort + 1))[0] |
| | | |
| | | this.setState({group: null, step: group.sort}, () => { |
| | | this.setState({group: _group}) |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { config, loading, BID, data, group } = this.state |
| | | const { config, loading, BID, data, group, dict, step } = this.state |
| | | |
| | | return ( |
| | | <div className="custom-normal-form-box" style={{...config.style}}> |
| | |
| | | } |
| | | {config.subcards.length > 1 ? <div className="mk-normal-form-title"> |
| | | {config.subcards.map(card => ( |
| | | <div key={card.uuid} className="form-title"> |
| | | <span className="form-sort">{card.sort}</span> |
| | | <div key={card.uuid} className={'form-title' + (card.sort <= step ? ' active' : '')}> |
| | | <span className="form-sort" style={{background: config.wrap.color}}>{card.sort}</span> |
| | | <span className="before-line" style={{background: config.wrap.color}}></span> |
| | | <span className="after-line" style={{background: config.wrap.color}}></span> |
| | | {card.setting.title} |
| | | </div>)) |
| | | } |
| | | </div> : null} |
| | | <MutilForm |
| | | {group && data ? <MutilForm |
| | | BID={BID} |
| | | dict={dict} |
| | | data={data} |
| | | dict={this.state.dict} |
| | | action={group} |
| | | inputSubmit={this.handleOk} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> |
| | | /> : null} |
| | | {group && data ? <div className="mk-form-action"> |
| | | {group.sort !== 1 ? <Button type="link" className="prev" onClick={this.prevStep} style={group.prevButton.style}>{group.prevButton.label}</Button> : null} |
| | | <NormalButton |
| | | BID={BID} |
| | | position="form" |
| | | btn={group.subButton} |
| | | setting={config.setting} |
| | | columns={config.columns} |
| | | selectedData={[data]} |
| | | /> |
| | | {group.nextButton.enable === 'true' && group.sort !== config.subcards.length ? <Button type="link" className="skip" onClick={this.nextStep} style={group.nextButton.style}>{group.nextButton.label}</Button> : null} |
| | | </div> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | position: relative; |
| | | min-height: 200px; |
| | | |
| | | .mk-normal-form-title { |
| | | display: flex; |
| | |
| | | z-index: 1; |
| | | } |
| | | } |
| | | .form-title:not(:first-child)::before { |
| | | .before-line, .after-line { |
| | | display: none; |
| | | } |
| | | .form-title:not(:first-child) .before-line { |
| | | position: absolute; |
| | | display: inline-block; |
| | | width: 50%; |
| | | height: 2px; |
| | | background: #d8d8d8; |
| | | left: 0%; |
| | | top: 18px; |
| | | } |
| | | .form-title:not(:last-child) .after-line { |
| | | position: absolute; |
| | | content: ' '; |
| | | display: inline-block; |
| | | width: 100%; |
| | | width: 50%; |
| | | height: 2px; |
| | | background: #d8d8d8; |
| | | left: -50%; |
| | | left: 50%; |
| | | top: 18px; |
| | | } |
| | | .form-title:not(.active) { |
| | | .form-sort { |
| | | background: #d8d8d8!important; |
| | | } |
| | | .before-line, .after-line { |
| | | background: #d8d8d8!important; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .mk-form-action { |
| | | position: relative; |
| | | text-align: center; |
| | | padding-bottom: 10px; |
| | | |
| | | .prev { |
| | | margin-right: 15px; |
| | | } |
| | | .submit { |
| | | min-width: 70px; |
| | | border: none; |
| | | } |
| | | .skip { |
| | | position: absolute; |
| | | right: 5px; |
| | | } |
| | | } |
| | | |
| | | .loading-mask { |
| | |
| | | return component |
| | | } |
| | | |
| | | if (['propcard', 'brafteditor', 'sandbox'].includes(component.subtype) && component.wrap.datatype === 'static') { |
| | | if (['propcard', 'brafteditor', 'sandbox', 'stepform'].includes(component.subtype) && component.wrap.datatype === 'static') { |
| | | component.format = '' |
| | | } |
| | | |
| | |
| | | |
| | | if (position === 'toolbar') { |
| | | MKEmitter.addListener('triggerBtnId', this.actionTrigger) |
| | | } else if (position === 'form') { |
| | | MKEmitter.addListener('triggerFormSubmit', this.actionSubmit) |
| | | } |
| | | } |
| | | |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('triggerBtnId', this.actionTrigger) |
| | | MKEmitter.removeListener('triggerFormSubmit', this.actionSubmit) |
| | | } |
| | | |
| | | actionSubmit = (res) => { |
| | | const { btn } = this.props |
| | | |
| | | if (btn.uuid !== res.menuId) return |
| | | |
| | | this.setState({ |
| | | confirmLoading: true |
| | | }) |
| | | |
| | | this.execSubmit(this.state.tabledata, () => { |
| | | this.setState({ |
| | | confirmLoading: false |
| | | }) |
| | | }, res.form) |
| | | } |
| | | |
| | | /** |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (!setting.primaryKey) { |
| | | } else if (btn.OpenType !== 'formSubmit' && !setting.primaryKey) { |
| | | // 需要选择行时,校验是否设置主键 |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | return |
| | | } |
| | | |
| | | if (btn.OpenType === 'prompt') { |
| | | if (btn.OpenType === 'formSubmit') { |
| | | this.setState({ |
| | | tabledata: data |
| | | }) |
| | | MKEmitter.emit('mkFormSubmit', btn.uuid) |
| | | return |
| | | } else if (btn.OpenType === 'prompt') { |
| | | this.updateStatus('start') |
| | | confirm({ |
| | | title: this.state.dict['main.action.confirm.tip'], |
| | |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } else if (btn.OpenType === 'pop') { // 表单 |
| | | } else if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { // 表单 |
| | | if (btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | primaryId = '' |
| | | |
| | |
| | | |
| | | param[setting.primaryKey] = primaryId // 设置主键参数 |
| | | |
| | | if (btn.OpenType === 'pop') { // 表单 |
| | | if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { // 表单 |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | |
| | | param.BID = this.props.BID |
| | | } |
| | | |
| | | if (btn.OpenType === 'pop' && formdata) { // 表单 |
| | | if ((btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') && formdata) { // 表单 |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | |
| | | let supItemVal = {} // 上级菜单初始值 |
| | | let deForms = [] // 需要动态获取下拉菜单的表单 |
| | | |
| | | action.fields.forEach(item => { |
| | | let formlist = fromJS(action.fields).toJS() |
| | | |
| | | formlist.forEach(item => { |
| | | if (item.type === 'text' || item.type === 'number') { // 用于过滤下拉菜单关联表单 |
| | | _inputfields.push(item.field) |
| | | } else if (item.type === 'textarea') { |
| | |
| | | } |
| | | }) |
| | | |
| | | let formlist = action.fields.map(item => { |
| | | formlist = formlist.map(item => { |
| | | if (item.labelwidth) { |
| | | item.labelCol = {style: {width: item.labelwidth + '%'}} |
| | | } |
| | |
| | | const { editAction } = this.props |
| | | const { config, menu, openEdition } = this.state |
| | | |
| | | if ((!config.groups[0] && !config.fields[0]) || (config.fields[0] && config.fields[0].origin)) { |
| | | if (config.fields[0] && config.fields[0].origin) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请添加表单', |
| | |
| | | } |
| | | |
| | | let refresh = [] |
| | | |
| | | if (type === 'subtable') { // 子表页面,可设置刷新主表及同级标签 |
| | | if (card.focus) { |
| | | card.popClose = 'maingrid' |
| | | } |
| | | refresh.push({ |
| | | value: 'maingrid', |
| | | text: Formdict['header.form.refresh.maingrid'] |