From 1a11f7115e61c548f9ffc77d0a9e504307ca71b2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 24 八月 2021 18:37:20 +0800 Subject: [PATCH] 2021-08-24 --- src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 2 src/tabviews/custom/components/form/tab-form/index.scss | 3 src/tabviews/custom/components/form/normal-form/index.scss | 2 src/tabviews/custom/components/tabs/antv-tabs/index.jsx | 5 src/tabviews/custom/components/carousel/data-card/index.jsx | 6 src/templates/modalconfig/index.jsx | 16 - src/mob/modalconfig/index.jsx | 28 ++- src/views/mobdesign/index.jsx | 3 src/views/menudesign/index.jsx | 9 + src/menu/datasource/verifycard/columnform/index.jsx | 26 +- src/tabviews/custom/components/card/data-card/index.jsx | 6 src/tabviews/custom/components/form/tab-form/index.jsx | 64 ++------ src/tabviews/custom/components/card/table-card/index.jsx | 8 src/tabviews/custom/components/card/cardcellList/index.jsx | 3 src/tabviews/custom/components/card/prop-card/index.jsx | 14 + src/tabviews/custom/components/share/tabtransfer/index.jsx | 17 + src/views/pcdesign/index.jsx | 9 + src/templates/zshare/formconfig.jsx | 8 src/tabviews/custom/components/group/normal-group/index.jsx | 17 + src/tabviews/custom/components/table/normal-table/index.jsx | 6 src/menu/pastecontroller/index.jsx | 2 src/tabviews/custom/components/form/normal-form/index.jsx | 54 ++---- src/tabviews/custom/components/carousel/prop-card/index.jsx | 14 + src/tabviews/custom/index.jsx | 14 + src/templates/modalconfig/source.jsx | 24 -- src/menu/modalconfig/index.jsx | 28 ++- src/tabviews/custom/components/card/balcony/index.jsx | 14 + src/menu/popview/index.jsx | 18 - src/templates/sharecomponent/searchcomponent/index.scss | 2 29 files changed, 214 insertions(+), 208 deletions(-) diff --git a/src/menu/datasource/verifycard/columnform/index.jsx b/src/menu/datasource/verifycard/columnform/index.jsx index 3b054c7..4af4387 100644 --- a/src/menu/datasource/verifycard/columnform/index.jsx +++ b/src/menu/datasource/verifycard/columnform/index.jsx @@ -43,19 +43,6 @@ <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: '', @@ -69,6 +56,19 @@ </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: '', diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index cf6bab2..7aed763 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -16,6 +16,7 @@ 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 @@ -43,7 +44,8 @@ originConfig: null, // 鍘熷鑿滃崟 sqlVerifing: false, // sql楠岃瘉 showField: false, // 鏄剧ず琛ㄥ崟瀛楁鍊� - standardform: null + standardform: null, + saving: false } /** @@ -61,6 +63,10 @@ }) } + componentDidMount () { + MKEmitter.addListener('completeSave', this.completeSave) + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -68,6 +74,7 @@ this.setState = () => { return } + MKEmitter.removeListener('completeSave', this.completeSave) } /** @@ -288,13 +295,16 @@ 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 = () => { @@ -400,7 +410,7 @@ } render () { - const { config, dict } = this.state + const { config, dict, saving } = this.state return ( <div className="modal-form-board"> @@ -425,7 +435,7 @@ <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%' }}> diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx index d97527d..2a7aebe 100644 --- a/src/menu/pastecontroller/index.jsx +++ b/src/menu/pastecontroller/index.jsx @@ -51,7 +51,7 @@ } tab.components = tab.components.map(cell => { - cell = this.resetconfig(cell, tab, copyBtns) + cell = this.resetconfig(cell, tab, false, copyBtns) return cell }) }) diff --git a/src/menu/popview/index.jsx b/src/menu/popview/index.jsx index 55a0f13..bed4339 100644 --- a/src/menu/popview/index.jsx +++ b/src/menu/popview/index.jsx @@ -62,6 +62,7 @@ componentDidMount () { MKEmitter.addListener('delButtons', this.delButtons) + MKEmitter.addListener('triggerMenuSave', this.submitConfig) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) this.updateCustomComponent() @@ -79,6 +80,7 @@ return } MKEmitter.removeListener('delButtons', this.delButtons) + MKEmitter.removeListener('triggerMenuSave', this.submitConfig) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) } @@ -422,6 +424,7 @@ config.open_edition = res.open_edition || '' this.setState({ + config, oriConfig: fromJS(config).toJS() }) @@ -447,29 +450,22 @@ 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) } diff --git a/src/mob/modalconfig/index.jsx b/src/mob/modalconfig/index.jsx index fc634fd..6876fc5 100644 --- a/src/mob/modalconfig/index.jsx +++ b/src/mob/modalconfig/index.jsx @@ -15,6 +15,7 @@ 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' @@ -43,7 +44,8 @@ originConfig: null, // 鍘熷鑿滃崟 sqlVerifing: false, // sql楠岃瘉 showField: false, // 鏄剧ず琛ㄥ崟瀛楁鍊� - standardform: null + standardform: null, + saving: false } /** @@ -61,6 +63,10 @@ }) } + componentDidMount () { + MKEmitter.addListener('completeSave', this.completeSave) + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -68,6 +74,11 @@ this.setState = () => { return } + MKEmitter.removeListener('completeSave', this.completeSave) + } + + completeSave = () => { + this.setState({saving: false}) } /** @@ -288,13 +299,12 @@ 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 = () => { @@ -374,7 +384,7 @@ } render () { - const { config, dict } = this.state + const { config, dict, saving } = this.state return ( <div className="mob-form-board"> @@ -397,7 +407,7 @@ </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})} /> diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx index 0579a59..5026c93 100644 --- a/src/tabviews/custom/components/card/balcony/index.jsx +++ b/src/tabviews/custom/components/card/balcony/index.jsx @@ -26,6 +26,7 @@ loading: false, sync: false, data: {}, + BData: null, syncData: [], show: true, checked: false @@ -190,14 +191,14 @@ 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() }) } @@ -209,7 +210,7 @@ } if (id !== this.state.BID) { - this.setState({ BID: id }, () => { + this.setState({ BID: id, BData: data }, () => { this.loadData() }) } @@ -226,16 +227,16 @@ 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 } @@ -253,6 +254,7 @@ if (result.status) { let _data = result.data && result.data[0] ? result.data[0] : {} _data.$$BID = BID || '' + _data.$$BData = BData this.setState({ data: _data, diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 57921e0..5d1e62b 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -631,6 +631,7 @@ <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} @@ -670,6 +671,7 @@ <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} @@ -721,6 +723,7 @@ <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} diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index d2795df..23383a8 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -307,7 +307,7 @@ 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({ @@ -363,6 +363,7 @@ item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$$BID = BID || '' + item.$$BData = BData || '' item.$Index = index + start + '' return item }), @@ -390,7 +391,7 @@ */ 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) { // 涓昏〃鎼滅储鏉′欢 @@ -421,6 +422,7 @@ _data.key = item.key _data.$$uuid = _data[config.setting.primaryKey] || '' _data.$$BID = BID || '' + item.$$BData = BData || '' _data.$Index = item.$Index return _data } else { diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 0cfd2c5..d00a06d 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -32,7 +32,8 @@ activeKey: '', // 閫変腑鏁版嵁 sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 data: {}, // 鏁版嵁 - timer: null // 瀹氭椂鍣ㄦ椂闂撮棿闅� + timer: null, // 瀹氭椂鍣ㄦ椂闂撮棿闅� + BData: null } UNSAFE_componentWillMount () { @@ -240,12 +241,12 @@ } } - 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() }) } @@ -261,16 +262,16 @@ 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 } @@ -295,6 +296,7 @@ if (result.status) { let _data = result.data && result.data[0] ? result.data[0] : {} _data.$$BID = BID || '' + _data.$$BData = BData this.setState({ activeKey: '', diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index 609d46e..bf19684 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -31,6 +31,7 @@ total: 0, // 鎬绘暟 sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 data: null, // 鏁版嵁 + BData: null } /** @@ -175,12 +176,12 @@ } } - 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() }) } @@ -223,7 +224,7 @@ 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({ @@ -267,6 +268,7 @@ item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$$BID = BID || '' + item.$$BData = BData || '' item.$Index = index + start + '' return item }), diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index d2f87f7..8e744fc 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -29,6 +29,7 @@ sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 card: null, // 鍗$墖璁剧疆 data: null, // 鏁版嵁 + BData: null } UNSAFE_componentWillMount () { @@ -163,7 +164,7 @@ 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() }) } @@ -190,7 +191,7 @@ 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({ @@ -220,6 +221,7 @@ item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$$BID = BID || '' + item.$$BData = BData || '' return item }), loading: false diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index cdc2267..392ac7a 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -27,7 +27,8 @@ config: null, // 鍥捐〃閰嶇疆淇℃伅 loading: false, // 鏁版嵁鍔犺浇鐘舵�� sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 - data: {} // 鏁版嵁 + data: {}, // 鏁版嵁 + BData: null } UNSAFE_componentWillMount () { @@ -165,12 +166,12 @@ } } - 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() }) } @@ -186,16 +187,16 @@ 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 } @@ -218,6 +219,7 @@ if (result.status) { let _data = result.data && result.data[0] ? result.data[0] : {} _data.$$BID = BID || '' + _data.$$BData = BData || '' this.setState({ data: _data, diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index febdcc4..9f522fb 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -1674,7 +1674,7 @@ 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) { diff --git a/src/tabviews/custom/components/form/normal-form/index.jsx b/src/tabviews/custom/components/form/normal-form/index.jsx index dfc65f7..54a0d90 100644 --- a/src/tabviews/custom/components/form/normal-form/index.jsx +++ b/src/tabviews/custom/components/form/normal-form/index.jsx @@ -186,7 +186,7 @@ if (config.uuid !== menuId) return - this.loadData(null, 'refresh') + this.loadData('refresh') } /** @@ -205,7 +205,7 @@ } if (config.wrap.datatype !== 'static' && config.setting) { - this.loadData(btn) + this.loadData() } if (id) { @@ -266,7 +266,7 @@ } } - async loadData (btn, type) { + async loadData (type) { const { mainSearch, menuType } = this.props const { config, arr_field, BID, group } = this.state @@ -274,7 +274,6 @@ this.setState({ data: {} }) - btn && this.execSuccess(btn) return } @@ -282,7 +281,6 @@ let requireFields = searches.filter(item => item.required && item.value === '') if (requireFields.length > 0) { - btn && this.execSuccess(btn) return } @@ -296,34 +294,25 @@ 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, @@ -333,7 +322,6 @@ message: result.message, duration: 10 }) - btn && this.execSuccess(btn) } } @@ -393,7 +381,7 @@ 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 || '')}> diff --git a/src/tabviews/custom/components/form/normal-form/index.scss b/src/tabviews/custom/components/form/normal-form/index.scss index 03d58aa..77767fb 100644 --- a/src/tabviews/custom/components/form/normal-form/index.scss +++ b/src/tabviews/custom/components/form/normal-form/index.scss @@ -4,7 +4,7 @@ background-repeat: no-repeat; background-size: cover; position: relative; - min-height: 200px; + min-height: 50px; .mk-normal-form-title { display: flex; diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index 88d2b8d..4082856 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -103,19 +103,10 @@ 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(','), @@ -162,13 +153,10 @@ _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() @@ -181,7 +169,7 @@ if (config.uuid !== menuId) return - this.loadData(null, 'refresh') + this.loadData() } /** @@ -204,7 +192,7 @@ } if (config.wrap.datatype !== 'static' && config.setting) { - this.loadData(btn) + this.loadData() } this.execSuccess(btn, id) @@ -249,7 +237,7 @@ } } - async loadData (btn, type) { + async loadData () { const { mainSearch, menuType } = this.props const { config, arr_field, BID, group } = this.state @@ -257,7 +245,6 @@ this.setState({ data: {} }) - btn && this.execSuccess(btn) return } @@ -265,7 +252,6 @@ let requireFields = searches.filter(item => item.required && item.value === '') if (requireFields.length > 0) { - btn && this.execSuccess(btn) return } @@ -280,32 +266,15 @@ 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, @@ -315,7 +284,6 @@ message: result.message, duration: 10 }) - btn && this.execSuccess(btn) } } @@ -360,7 +328,7 @@ 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 || '')}> diff --git a/src/tabviews/custom/components/form/tab-form/index.scss b/src/tabviews/custom/components/form/tab-form/index.scss index 1b62b2e..f1fabf1 100644 --- a/src/tabviews/custom/components/form/tab-form/index.scss +++ b/src/tabviews/custom/components/form/tab-form/index.scss @@ -4,7 +4,7 @@ background-repeat: no-repeat; background-size: cover; position: relative; - min-height: 200px; + min-height: 50px; .mk-normal-form-title { display: flex; @@ -16,6 +16,7 @@ position: relative; flex: 1; text-align: center; + cursor: pointer; } } .mk-normal-form-title.mkbtn { diff --git a/src/tabviews/custom/components/group/normal-group/index.jsx b/src/tabviews/custom/components/group/normal-group/index.jsx index 879d07d..05c8ba6 100644 --- a/src/tabviews/custom/components/group/normal-group/index.jsx +++ b/src/tabviews/custom/components/group/normal-group/index.jsx @@ -25,6 +25,7 @@ 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')) @@ -133,11 +134,9 @@ 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') { @@ -158,12 +157,18 @@ <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}> diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx index 7ba74f9..0fad518 100644 --- a/src/tabviews/custom/components/share/tabtransfer/index.jsx +++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx @@ -28,6 +28,7 @@ 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')) @@ -155,7 +156,7 @@ 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] || '' } @@ -187,13 +188,13 @@ } 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') { @@ -235,15 +236,21 @@ } 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}> diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index b8e44a2..cd57cff 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -138,7 +138,7 @@ */ 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({ @@ -191,6 +191,7 @@ item.key = index item.$$uuid = item[setting.primaryKey] || '' item.$$BID = BID || '' + item.$$BData = BData || '' item.$Index = start + index + '' return item }), @@ -218,7 +219,7 @@ */ 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) { // 涓昏〃鎼滅储鏉′欢 @@ -245,6 +246,7 @@ 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) { diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx index 5cff8f8..bbad0d0 100644 --- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx @@ -12,6 +12,7 @@ class antvTabs extends Component { static propTpyes = { + BID: PropTypes.any, // 椤甸潰BID bids: PropTypes.any, // 鐖剁骇Id闆� config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -62,7 +63,7 @@ } render() { - const { mainSearch } = this.props + const { mainSearch, BID } = this.props const { tabs, bids } = this.state return ( @@ -70,7 +71,7 @@ <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> diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index da94766..b23c7a5 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -24,6 +24,7 @@ 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')) @@ -983,7 +984,8 @@ viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑 loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� - shortcuts: null + shortcuts: null, + data: '' }, () => { this.loadconfig() }) @@ -1031,10 +1033,16 @@ <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') { @@ -1046,7 +1054,7 @@ } 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') { diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 3ab3c92..97a26bb 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -97,22 +97,12 @@ // 涓昏彍鍗曞凡鏈夐�夋嫨鐨勮〃鍚嶏紝妯℃�佹娌℃湁琛ㄥ悕鏃讹紝澶嶅埗涓昏彍鍗曡〃鍚� _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: [ @@ -611,7 +601,7 @@ } render () { - const { config, source, dict } = this.state + const { config, dict } = this.state return ( <div className="modal-form-board"> @@ -632,7 +622,7 @@ </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> diff --git a/src/templates/modalconfig/source.jsx b/src/templates/modalconfig/source.jsx index 6e831de..4c57d66 100644 --- a/src/templates/modalconfig/source.jsx +++ b/src/templates/modalconfig/source.jsx @@ -81,115 +81,101 @@ 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', } ] diff --git a/src/templates/sharecomponent/searchcomponent/index.scss b/src/templates/sharecomponent/searchcomponent/index.scss index 2b8857c..8c171b4 100644 --- a/src/templates/sharecomponent/searchcomponent/index.scss +++ b/src/templates/sharecomponent/searchcomponent/index.scss @@ -14,7 +14,7 @@ position: absolute; z-index: 1; right: 20px; - bottom: 10px; + bottom: 5px; } > .ant-row { min-height: 65px; diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index ea86161..b9d30a0 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -2228,6 +2228,9 @@ }, { value: 'split', text: '鍒嗛殧绾�' + }, { + value: 'linkMain', + text: Formdict['header.form.linkMain'] }] let _fieldlength = 50 @@ -2282,11 +2285,6 @@ value: 'split', text: '鍒嗛殧绾�' }] - } else if (subtable) { - _openType.push({ - value: 'linkMain', - text: Formdict['header.form.linkMain'] - }) } if (['fileupload', 'multiselect', 'checkbox'].includes(card.type)) { diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index c9ef070..df22f0f 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -103,6 +103,7 @@ 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(() => { @@ -123,8 +124,15 @@ 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 = () => { @@ -783,6 +791,7 @@ menuloading: false }) } + MKEmitter.emit('completeSave') }) }, 300) } diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index a4a9fad..cbd2393 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -132,6 +132,7 @@ return } MKEmitter.addListener('changeEditMenu', this.changeEditMenu) + MKEmitter.addListener('triggerMenuSave', this.submitConfig) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) setTimeout(() => { @@ -150,6 +151,7 @@ return } MKEmitter.removeListener('changeEditMenu', this.changeEditMenu) + MKEmitter.removeListener('triggerMenuSave', this.submitConfig) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) } @@ -1063,6 +1065,7 @@ menuloading: false }) } + MKEmitter.emit('completeSave') }) }, 300) } diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 081cd67..f942e1c 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -127,6 +127,7 @@ 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(() => { @@ -149,8 +150,15 @@ 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) => { @@ -1313,6 +1321,7 @@ menuloading: false }) } + MKEmitter.emit('completeSave') }) }, 300) } -- Gitblit v1.8.0