| | |
| | | <Form {...formItemLayout} className="verify-form" id="verifycard1"> |
| | | <Row gutter={24}> |
| | | <Col span={6}> |
| | | <Form.Item label={'名称'}> |
| | | {getFieldDecorator('label', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '名称!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'字段'}> |
| | | {getFieldDecorator('field', { |
| | | initialValue: '', |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'名称'}> |
| | | {getFieldDecorator('label', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '名称!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label={'数据类型'}> |
| | | {getFieldDecorator('datatype', { |
| | | initialValue: '', |
| | |
| | | import SettingForm from '@/templates/modalconfig/settingform' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { SearchItems } from '@/templates/modalconfig/source' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const { Panel } = Collapse |
| | |
| | | originConfig: null, // 原始菜单 |
| | | sqlVerifing: false, // sql验证 |
| | | showField: false, // 显示表单字段值 |
| | | standardform: null |
| | | standardform: null, |
| | | saving: false |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | | /** |
| | |
| | | submitConfig = () => { |
| | | const { config } = this.state |
| | | |
| | | this.setState({originConfig: fromJS(config).toJS()}) |
| | | this.setState({originConfig: fromJS(config).toJS(), saving: true}) |
| | | this.props.handleSave(config) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功。', |
| | | duration: 2 |
| | | }) |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('triggerMenuSave') |
| | | }, 100) |
| | | } |
| | | |
| | | completeSave = () => { |
| | | this.setState({saving: false}) |
| | | } |
| | | |
| | | cancelConfig = () => { |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { config, dict } = this.state |
| | | const { config, dict, saving } = this.state |
| | | |
| | | return ( |
| | | <div className="modal-form-board"> |
| | |
| | | <Card title={dict['header.menu.form.configurable']} bordered={false} extra={ |
| | | <div> |
| | | <EditComponent dict={dict} options={['form']} config={this.state.config} refresh={(res) => this.updateConfig(res.config)}/> |
| | | <Button type="primary" onClick={this.submitConfig}>保存</Button> |
| | | <Button type="primary" loading={saving} onClick={this.submitConfig}>保存</Button> |
| | | <Button onClick={this.cancelConfig}>返回</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | |
| | | } |
| | | |
| | | tab.components = tab.components.map(cell => { |
| | | cell = this.resetconfig(cell, tab, copyBtns) |
| | | cell = this.resetconfig(cell, tab, false, copyBtns) |
| | | return cell |
| | | }) |
| | | }) |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('delButtons', this.delButtons) |
| | | MKEmitter.addListener('triggerMenuSave', this.submitConfig) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | | MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) |
| | | this.updateCustomComponent() |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('delButtons', this.delButtons) |
| | | MKEmitter.removeListener('triggerMenuSave', this.submitConfig) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) |
| | | } |
| | |
| | | config.open_edition = res.open_edition || '' |
| | | |
| | | this.setState({ |
| | | config, |
| | | oriConfig: fromJS(config).toJS() |
| | | }) |
| | | |
| | |
| | | if (!res) return |
| | | |
| | | if (res.status) { |
| | | this.setState({ |
| | | menuloading: false, |
| | | config: {...config, components: []} |
| | | }, () => { |
| | | this.setState({ |
| | | config: {...this.state.config, components: this.state.oriConfig.components} |
| | | }) |
| | | }) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 2 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | this.setState({ |
| | | menuloading: false |
| | | }) |
| | | MKEmitter.emit('completeSave') |
| | | }) |
| | | }, 300) |
| | | } |
| | |
| | | import SourceElement from '@/templates/modalconfig/dragelement/source' |
| | | import SettingForm from '@/templates/modalconfig/settingform' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { SearchItems } from './source' |
| | | import './index.scss' |
| | | |
| | |
| | | originConfig: null, // 原始菜单 |
| | | sqlVerifing: false, // sql验证 |
| | | showField: false, // 显示表单字段值 |
| | | standardform: null |
| | | standardform: null, |
| | | saving: false |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | | completeSave = () => { |
| | | this.setState({saving: false}) |
| | | } |
| | | |
| | | /** |
| | |
| | | submitConfig = () => { |
| | | const { config } = this.state |
| | | |
| | | this.setState({originConfig: fromJS(config).toJS()}) |
| | | this.setState({originConfig: fromJS(config).toJS(), saving: true}) |
| | | this.props.handleSave(config) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功。', |
| | | duration: 2 |
| | | }) |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('triggerMenuSave') |
| | | }, 100) |
| | | } |
| | | |
| | | cancelConfig = () => { |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { config, dict } = this.state |
| | | const { config, dict, saving } = this.state |
| | | |
| | | return ( |
| | | <div className="mob-form-board"> |
| | |
| | | </div> |
| | | <div className="modal-control"> |
| | | <Button icon="setting" onClick={this.changeSetting}>设置</Button> |
| | | <Button type="primary" onClick={this.submitConfig}>保存</Button> |
| | | <Button type="primary" loading={saving} onClick={this.submitConfig}>保存</Button> |
| | | <Button onClick={this.cancelConfig}>返回</Button> |
| | | <PasteComponent config={config} updateConfig={this.insert} /> |
| | | <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} /> |
| | |
| | | loading: false, |
| | | sync: false, |
| | | data: {}, |
| | | BData: null, |
| | | syncData: [], |
| | | show: true, |
| | | checked: false |
| | |
| | | this.setState({syncData: data, checked}) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config, syncConfig } = this.state |
| | | |
| | | if (syncConfig) { |
| | | if (!syncConfig.setting.supModule || syncConfig.setting.supModule !== MenuID) return |
| | | |
| | | if (id !== this.state.BID) { |
| | | this.setState({ BID: id }, () => { |
| | | this.setState({ BID: id, BData: data }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | if (id !== this.state.BID) { |
| | | this.setState({ BID: id }, () => { |
| | | this.setState({ BID: id, BData: data }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | |
| | | |
| | | async loadData () { |
| | | const { menuType } = this.props |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, arr_field, BID, BData } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | | data: {$$BID: BID || ''}, |
| | | data: {$$BID: BID || '', $$BData: BData}, |
| | | }) |
| | | return |
| | | } else if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: {$$BID: BID || ''}, |
| | | data: {$$BID: BID || '', $$BData: BData}, |
| | | }) |
| | | return |
| | | } |
| | |
| | | if (result.status) { |
| | | let _data = result.data && result.data[0] ? result.data[0] : {} |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData |
| | | |
| | | this.setState({ |
| | | data: _data, |
| | |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <NormalButton |
| | | BID={data.$$BID} |
| | | BData={data.$$BData || ''} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.style} |
| | |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <PopupButton |
| | | BID={data.$$BID} |
| | | BData={data.$$BData || ''} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.style} |
| | |
| | | <Col key={card.uuid} className="mk-cell-btn" span={card.width}> |
| | | <PrintButton |
| | | BID={data.$$BID} |
| | | BData={data.$$BData || ''} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.style} |
| | |
| | | |
| | | async loadData () { |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, pageIndex, search, BID } = this.state |
| | | const { config, arr_field, pageIndex, search, BID, BData } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + start + '' |
| | | return item |
| | | }), |
| | |
| | | */ |
| | | async loadLinedata (id) { |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, pageIndex, search, BID } = this.state |
| | | const { config, arr_field, pageIndex, search, BID, BData } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | _data.key = item.key |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | _data.$Index = item.$Index |
| | | return _data |
| | | } else { |
| | |
| | | activeKey: '', // 选中数据 |
| | | sync: false, // 是否统一请求数据 |
| | | data: {}, // 数据 |
| | | timer: null // 定时器时间间隔 |
| | | timer: null, // 定时器时间间隔 |
| | | BData: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | } |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static' || !config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID) { |
| | | this.setState({ BID: id }, () => { |
| | | this.setState({ BID: id, BData: data }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | |
| | | |
| | | async loadData (hastimer) { |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, arr_field, BID, BData } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | | data: {$$BID: BID || ''}, |
| | | data: {$$BID: BID || '', $$BData: BData}, |
| | | }) |
| | | return |
| | | } else if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: {$$BID: BID || ''}, |
| | | data: {$$BID: BID || '', $$BData: BData}, |
| | | }) |
| | | return |
| | | } |
| | |
| | | if (result.status) { |
| | | let _data = result.data && result.data[0] ? result.data[0] : {} |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData |
| | | |
| | | this.setState({ |
| | | activeKey: '', |
| | |
| | | total: 0, // 总数 |
| | | sync: false, // 是否统一请求数据 |
| | | data: null, // 数据 |
| | | BData: null |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config } = this.state |
| | | |
| | | if (!config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID) { |
| | | this.setState({ BID: id, pageIndex: 1 }, () => { |
| | | this.setState({ BID: id, BData: data, pageIndex: 1 }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | |
| | | |
| | | async loadData () { |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, pageIndex, search, BID } = this.state |
| | | const { config, arr_field, pageIndex, search, BID, BData } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + start + '' |
| | | return item |
| | | }), |
| | |
| | | sync: false, // 是否统一请求数据 |
| | | card: null, // 卡片设置 |
| | | data: null, // 数据 |
| | | BData: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | |
| | | if (!config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID) { |
| | | this.setState({ BID: id }, () => { |
| | | this.setState({ BID: id, BData: data }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | |
| | | |
| | | async loadData () { |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, arr_field, BID, BData } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | return item |
| | | }), |
| | | loading: false |
| | |
| | | config: null, // 图表配置信息 |
| | | loading: false, // 数据加载状态 |
| | | sync: false, // 是否统一请求数据 |
| | | data: {} // 数据 |
| | | data: {}, // 数据 |
| | | BData: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | } |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static' || !config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID) { |
| | | this.setState({ BID: id }, () => { |
| | | this.setState({ BID: id, BData: data }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | |
| | | |
| | | async loadData () { |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, arr_field, BID, BData } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | | data: {$$BID: BID || ''} |
| | | data: {$$BID: BID || '', $$BData: BData} |
| | | }) |
| | | return |
| | | } else if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: {$$BID: BID || ''} |
| | | data: {$$BID: BID || '', $$BData: BData} |
| | | }) |
| | | return |
| | | } |
| | |
| | | if (result.status) { |
| | | let _data = result.data && result.data[0] ? result.data[0] : {} |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | |
| | | this.setState({ |
| | | data: _data, |
| | |
| | | |
| | | chart.on('element:click', (ev) => { |
| | | let data = ev.data.data |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (data ? data.$$uuid : ''), null) |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (data ? data.$$uuid : ''), data) |
| | | }) |
| | | |
| | | if (plot.interaction && plot.interaction.length) { |
| | |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | this.loadData(null, 'refresh') |
| | | this.loadData('refresh') |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | if (config.wrap.datatype !== 'static' && config.setting) { |
| | | this.loadData(btn) |
| | | this.loadData() |
| | | } |
| | | |
| | | if (id) { |
| | |
| | | } |
| | | } |
| | | |
| | | async loadData (btn, type) { |
| | | async loadData (type) { |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, BID, group } = this.state |
| | | |
| | |
| | | this.setState({ |
| | | data: {} |
| | | }) |
| | | btn && this.execSuccess(btn) |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let requireFields = searches.filter(item => item.required && item.value === '') |
| | | if (requireFields.length > 0) { |
| | | btn && this.execSuccess(btn) |
| | | return |
| | | } |
| | | |
| | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let _data = result.data && result.data[0] ? result.data[0] : {} |
| | | let _group = group |
| | | |
| | | if (btn) { |
| | | this.setState({ |
| | | data: _data || {}, |
| | | loading: false |
| | | }) |
| | | this.execSuccess(btn) |
| | | } else { |
| | | let _group = group |
| | | |
| | | if (type === 'refresh') { |
| | | _group = config.subcards[0] |
| | | } |
| | | |
| | | if (config.wrap.statusControl && _data[config.wrap.statusControl]) { |
| | | let _status = _data[config.wrap.statusControl] |
| | | let _groups = config.subcards.filter(item => item.setting.status === _status)[0] |
| | | _group = _groups || _group |
| | | } |
| | | this.setState({ |
| | | group: null, |
| | | step: _group.sort - 1, |
| | | data: _data || {}, |
| | | loading: false |
| | | }, () => { |
| | | this.setState({group: _group}) |
| | | }) |
| | | if (type === 'refresh') { |
| | | _group = config.subcards[0] |
| | | } |
| | | |
| | | if (config.wrap.statusControl && _data[config.wrap.statusControl]) { |
| | | let _status = _data[config.wrap.statusControl] |
| | | let _groups = config.subcards.filter(item => item.setting.status === _status)[0] |
| | | _group = _groups || _group |
| | | } |
| | | this.setState({ |
| | | group: null, |
| | | step: _group.sort - 1, |
| | | data: _data || {}, |
| | | loading: false |
| | | }, () => { |
| | | this.setState({group: _group}) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | btn && this.execSuccess(btn) |
| | | } |
| | | } |
| | | |
| | |
| | | dict={dict} |
| | | data={data} |
| | | action={group} |
| | | inputSubmit={this.handleOk} |
| | | inputSubmit={() => this.mkFormSubmit(group.uuid)} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> : null} |
| | | {group && data ? <div className={'mk-form-action ' + (group.$button || '')}> |
| | |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | position: relative; |
| | | min-height: 200px; |
| | | min-height: 50px; |
| | | |
| | | .mk-normal-form-title { |
| | | display: flex; |
| | |
| | | return group |
| | | }) |
| | | |
| | | let _group = config.subcards[0] |
| | | |
| | | if (_data && config.wrap.statusControl && _data[config.wrap.statusControl]) { |
| | | let _status = _data[config.wrap.statusControl] |
| | | |
| | | let _groups = config.subcards.filter(item => item.setting.status === _status)[0] |
| | | _group = _groups || _group |
| | | } |
| | | |
| | | this.setState({ |
| | | sync: _sync, |
| | | data: _data, |
| | | group: _group, |
| | | group: config.subcards[0], |
| | | BID: BID || '', |
| | | config: config, |
| | | arr_field: config.columns.map(col => col.field).join(','), |
| | |
| | | _data = _data[0] || {} |
| | | } |
| | | } |
| | | if (config.wrap.statusControl && _data[config.wrap.statusControl]) { |
| | | let _status = _data[config.wrap.statusControl] |
| | | let _groups = config.subcards.filter(item => item.setting.status === _status)[0] |
| | | _group = _groups || _group |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data, group: _group}) |
| | | this.setState({sync: false, data: _data, group: null}, () => { |
| | | this.setState({group: _group}) |
| | | }) |
| | | } else if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | this.loadData(null, 'refresh') |
| | | this.loadData() |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | if (config.wrap.datatype !== 'static' && config.setting) { |
| | | this.loadData(btn) |
| | | this.loadData() |
| | | } |
| | | |
| | | this.execSuccess(btn, id) |
| | |
| | | } |
| | | } |
| | | |
| | | async loadData (btn, type) { |
| | | async loadData () { |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, BID, group } = this.state |
| | | |
| | |
| | | this.setState({ |
| | | data: {} |
| | | }) |
| | | btn && this.execSuccess(btn) |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let requireFields = searches.filter(item => item.required && item.value === '') |
| | | if (requireFields.length > 0) { |
| | | btn && this.execSuccess(btn) |
| | | return |
| | | } |
| | | |
| | |
| | | if (result.status) { |
| | | let _data = result.data && result.data[0] ? result.data[0] : {} |
| | | |
| | | if (btn) { |
| | | this.setState({ |
| | | data: _data || {}, |
| | | loading: false |
| | | }) |
| | | this.execSuccess(btn) |
| | | } else { |
| | | let _group = group |
| | | let _group = group |
| | | |
| | | if (type === 'refresh') { |
| | | _group = config.subcards[0] |
| | | } |
| | | |
| | | if (config.wrap.statusControl && _data[config.wrap.statusControl]) { |
| | | let _status = _data[config.wrap.statusControl] |
| | | let _groups = config.subcards.filter(item => item.setting.status === _status)[0] |
| | | _group = _groups || _group |
| | | } |
| | | this.setState({ |
| | | group: null, |
| | | data: _data || {}, |
| | | loading: false |
| | | }, () => { |
| | | this.setState({group: _group}) |
| | | }) |
| | | } |
| | | this.setState({ |
| | | group: null, |
| | | data: _data || {}, |
| | | loading: false |
| | | }, () => { |
| | | this.setState({group: _group}) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | btn && this.execSuccess(btn) |
| | | } |
| | | } |
| | | |
| | |
| | | dict={dict} |
| | | data={data} |
| | | action={group} |
| | | inputSubmit={this.handleOk} |
| | | inputSubmit={() => this.mkFormSubmit(group.uuid)} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> : null} |
| | | {group && data ? <div className={'mk-form-action ' + (group.$button || '')}> |
| | |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | position: relative; |
| | | min-height: 200px; |
| | | min-height: 50px; |
| | | |
| | | .mk-normal-form-title { |
| | | display: flex; |
| | |
| | | position: relative; |
| | | flex: 1; |
| | | text-align: center; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | .mk-normal-form-title.mkbtn { |
| | |
| | | const BraftEditor = asyncComponent(() => import('@/tabviews/custom/components/editor/braft-editor')) |
| | | const SandBox = asyncComponent(() => import('@/tabviews/custom/components/code/sand-box')) |
| | | const NormalForm = asyncComponent(() => import('@/tabviews/custom/components/form/normal-form')) |
| | | const TabForm = asyncComponent(() => import('@/tabviews/custom/components/form/tab-form')) |
| | | const NormalTree = asyncComponent(() => import('@/tabviews/custom/components/tree/antd-tree')) |
| | | const CarouselDataCard = asyncComponent(() => import('@/tabviews/custom/components/carousel/data-card')) |
| | | const CarouselPropCard = asyncComponent(() => import('@/tabviews/custom/components/carousel/prop-card')) |
| | |
| | | if (!config || !config.components || config.components.length === 0) return (<Empty description={false} />) |
| | | |
| | | return config.components.map(item => { |
| | | let _bid = '' |
| | | if (bids && item.setting && item.setting.supModule) { |
| | | _bid = bids[item.setting.supModule] || '' |
| | | } else if (!bids && BID && (!item.setting || !item.setting.supModule)) { |
| | | _bid = BID |
| | | let _bid = BID || '' |
| | | if (item.setting && item.setting.supModule) { |
| | | _bid = bids ? bids[item.setting.supModule] || '' : '' |
| | | } |
| | | |
| | | if (item.type === 'bar' || item.type === 'line') { |
| | |
| | | <AntvDashboard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'form') { |
| | | } else if (item.type === 'form' && item.subtype === 'stepform') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <NormalForm config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'form' && item.subtype === 'tabform') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <TabForm config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'scatter') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | |
| | | const BraftEditor = asyncComponent(() => import('@/tabviews/custom/components/editor/braft-editor')) |
| | | const SandBox = asyncComponent(() => import('@/tabviews/custom/components/code/sand-box')) |
| | | const NormalForm = asyncComponent(() => import('@/tabviews/custom/components/form/normal-form')) |
| | | const TabForm = asyncComponent(() => import('@/tabviews/custom/components/form/tab-form')) |
| | | const NormalTree = asyncComponent(() => import('@/tabviews/custom/components/tree/antd-tree')) |
| | | const CarouselDataCard = asyncComponent(() => import('@/tabviews/custom/components/carousel/data-card')) |
| | | const CarouselPropCard = asyncComponent(() => import('@/tabviews/custom/components/carousel/prop-card')) |
| | |
| | | if (!config || !config.components || config.components.length === 0) return (<Empty description={false} />) |
| | | |
| | | return config.components.map(item => { |
| | | let BID = '' |
| | | let BID = this.props.BID || '' |
| | | if (item.setting && item.setting.supModule) { |
| | | BID = bids[item.setting.supModule] || '' |
| | | } |
| | |
| | | } else if (item.type === 'search') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <MainSearch config={item} menuType={menuType} refreshdata={this.resetSearch} /> |
| | | <MainSearch config={item} BID={BID} menuType={menuType} refreshdata={this.resetSearch} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'tabs') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <AntvTabs config={item} bids={bids} mainSearch={mainSearch} menuType={menuType} /> |
| | | <AntvTabs config={item} BID={BID} bids={bids} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'card' && item.subtype === 'datacard') { |
| | |
| | | } else if (item.type === 'group' && item.subtype === 'normalgroup') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <NormalGroup config={item} bids={bids} mainSearch={mainSearch} menuType={menuType} /> |
| | | <NormalGroup config={item} BID={BID} bids={bids} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'form') { |
| | | } else if (item.type === 'form' && item.subtype === 'stepform') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <NormalForm config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'form' && item.subtype === 'tabform') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <TabForm config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'tree') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | |
| | | */ |
| | | async loadmaindata (reset, repage) { |
| | | const { mainSearch } = this.props |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize } = this.state |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | if (setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | item.key = index |
| | | item.$$uuid = item[setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = start + index + '' |
| | | return item |
| | | }), |
| | |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { mainSearch } = this.props |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize } = this.state |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | let _data = result.data[0] || {} |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | try { |
| | | data = data.map(item => { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | |
| | | |
| | | class antvTabs extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 页面BID |
| | | bids: PropTypes.any, // 父级Id集 |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { mainSearch } = this.props |
| | | const { mainSearch, BID } = this.props |
| | | const { tabs, bids } = this.state |
| | | |
| | | return ( |
| | |
| | | <Tabs defaultActiveKey="1" tabPosition={tabs.setting.position} type={tabs.setting.tabStyle}> |
| | | {tabs.subtabs.map(tab => ( |
| | | <TabPane tab={<span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span>} key={tab.uuid}> |
| | | <TabTransfer config={tab} bids={bids} mainSearch={mainSearch}/> |
| | | <TabTransfer BID={BID} config={tab} bids={bids} mainSearch={mainSearch}/> |
| | | </TabPane> |
| | | ))} |
| | | </Tabs> |
| | |
| | | const DataCard = asyncComponent(() => import('./components/card/data-card')) |
| | | const PropCard = asyncComponent(() => import('./components/card/prop-card')) |
| | | const NormalForm = asyncComponent(() => import('./components/form/normal-form')) |
| | | const TabForm = asyncComponent(() => import('./components/form/tab-form')) |
| | | const CarouselDataCard = asyncComponent(() => import('./components/carousel/data-card')) |
| | | const CarouselPropCard = asyncComponent(() => import('./components/carousel/prop-card')) |
| | | const TableCard = asyncComponent(() => import('./components/card/table-card')) |
| | |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | config: null, // 页面配置信息,包括组件等 |
| | | loading: false, // 列表数据加载中 |
| | | shortcuts: null |
| | | shortcuts: null, |
| | | data: '' |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | |
| | | <AntvDashboard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'form') { |
| | | } else if (item.type === 'form' && item.subtype === 'stepform') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <NormalForm config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'form' && item.subtype === 'tabform') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <TabForm config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'search') { |
| | |
| | | } else if (item.type === 'tabs') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <AntvTabs config={item} mainSearch={mainSearch} /> |
| | | <AntvTabs config={item} BID={BID} mainSearch={mainSearch} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'card' && item.subtype === 'datacard') { |
| | |
| | | |
| | | // 主菜单已有选择的表名,模态框没有表名时,复制主菜单表名 |
| | | _config.tables = _config.tables.length === 0 ? _menu.tables : _config.tables |
| | | |
| | | let _source = fromJS(SearchItems).toJS() |
| | | if (!!this.props.editTab) { |
| | | _source.push({ |
| | | type: 'form', |
| | | label: this.state.dict['header.form.linkMain'], |
| | | subType: 'linkMain', |
| | | url: '' |
| | | }) |
| | | } |
| | | |
| | | _config = updateForm(_config) |
| | | |
| | | this.setState({ |
| | | openEdition: editAction.open_edition || '', |
| | | menu: _menu, |
| | | source: _source, |
| | | config: _config, |
| | | originConfig: fromJS(_config).toJS(), |
| | | modalformlist: [ |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { config, source, dict } = this.state |
| | | const { config, dict } = this.state |
| | | |
| | | return ( |
| | | <div className="modal-form-board"> |
| | |
| | | </Panel> |
| | | <Panel header={dict['header.menu.form']} key="1"> |
| | | <div className="search-element"> |
| | | {source.map((item, index) => { |
| | | {SearchItems.map((item, index) => { |
| | | return (<SourceElement key={index} content={item}/>) |
| | | })} |
| | | </div> |
| | |
| | | type: 'form', |
| | | label: CommonDict['model.form.text'], |
| | | subType: 'text', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['model.form.number'], |
| | | subType: 'number', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['model.form.select'], |
| | | subType: 'select', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['model.form.multiselect'], |
| | | subType: 'multiselect', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['model.form.link'], |
| | | subType: 'link', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '开关', |
| | | subType: 'switch', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '多选框', |
| | | subType: 'checkbox', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '单选框', |
| | | subType: 'radio', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '选项卡', |
| | | subType: 'checkcard', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['header.form.fileupload'], |
| | | subType: 'fileupload', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['model.form.dateday'], |
| | | subType: 'date', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['model.form.datemonth'], |
| | | subType: 'datemonth', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['model.form.datetime'], |
| | | subType: 'datetime', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['model.form.textarea'], |
| | | subType: 'textarea', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['model.form.color'], |
| | | subType: 'color', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '富文本', |
| | | subType: 'brafteditor', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['header.form.funcvar'], |
| | | subType: 'funcvar', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '提示', |
| | | subType: 'hint', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '分割线', |
| | | subType: 'split', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['header.form.linkMain'], |
| | | subType: 'linkMain', |
| | | } |
| | | ] |
| | | |
| | |
| | | position: absolute; |
| | | z-index: 1; |
| | | right: 20px; |
| | | bottom: 10px; |
| | | bottom: 5px; |
| | | } |
| | | > .ant-row { |
| | | min-height: 65px; |
| | |
| | | }, { |
| | | value: 'split', |
| | | text: '分隔线' |
| | | }, { |
| | | value: 'linkMain', |
| | | text: Formdict['header.form.linkMain'] |
| | | }] |
| | | |
| | | let _fieldlength = 50 |
| | |
| | | value: 'split', |
| | | text: '分隔线' |
| | | }] |
| | | } else if (subtable) { |
| | | _openType.push({ |
| | | value: 'linkMain', |
| | | text: Formdict['header.form.linkMain'] |
| | | }) |
| | | } |
| | | |
| | | if (['fileupload', 'multiselect', 'checkbox'].includes(card.type)) { |
| | |
| | | MKEmitter.addListener('thawButtons', this.thawButtons) |
| | | MKEmitter.addListener('copyButtons', this.copyButtons) |
| | | MKEmitter.addListener('changePopview', this.initPopview) |
| | | MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | | MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) |
| | | setTimeout(() => { |
| | |
| | | MKEmitter.removeListener('thawButtons', this.thawButtons) |
| | | MKEmitter.removeListener('copyButtons', this.copyButtons) |
| | | MKEmitter.removeListener('changePopview', this.initPopview) |
| | | MKEmitter.removeListener('triggerMenuSave', this.triggerMenuSave) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) |
| | | } |
| | | |
| | | triggerMenuSave = () => { |
| | | if (this.state.visible) return |
| | | |
| | | this.submitConfig() |
| | | } |
| | | |
| | | getAppPictures = () => { |
| | |
| | | menuloading: false |
| | | }) |
| | | } |
| | | MKEmitter.emit('completeSave') |
| | | }) |
| | | }, 300) |
| | | } |
| | |
| | | return |
| | | } |
| | | MKEmitter.addListener('changeEditMenu', this.changeEditMenu) |
| | | MKEmitter.addListener('triggerMenuSave', this.submitConfig) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | | MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) |
| | | setTimeout(() => { |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('changeEditMenu', this.changeEditMenu) |
| | | MKEmitter.removeListener('triggerMenuSave', this.submitConfig) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) |
| | | } |
| | |
| | | menuloading: false |
| | | }) |
| | | } |
| | | MKEmitter.emit('completeSave') |
| | | }) |
| | | }, 300) |
| | | } |
| | |
| | | MKEmitter.addListener('copyButtons', this.copyButtons) |
| | | MKEmitter.addListener('changePopview', this.initPopview) |
| | | MKEmitter.addListener('changeEditMenu', this.changeEditMenu) |
| | | MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | | MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) |
| | | setTimeout(() => { |
| | |
| | | MKEmitter.removeListener('copyButtons', this.copyButtons) |
| | | MKEmitter.removeListener('changePopview', this.initPopview) |
| | | MKEmitter.removeListener('changeEditMenu', this.changeEditMenu) |
| | | MKEmitter.removeListener('triggerMenuSave', this.triggerMenuSave) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) |
| | | } |
| | | |
| | | triggerMenuSave = () => { |
| | | if (this.state.visible) return |
| | | |
| | | this.submitConfig() |
| | | } |
| | | |
| | | changeEditMenu = (menu) => { |
| | |
| | | menuloading: false |
| | | }) |
| | | } |
| | | MKEmitter.emit('completeSave') |
| | | }) |
| | | }, 300) |
| | | } |