From 28d65cf7ebfe0dd30ade6973e0634e1c8f663b63 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 28 十月 2020 16:12:20 +0800 Subject: [PATCH] 2020-10-28 --- src/tabviews/treepage/index.jsx | 64 - src/tabviews/zshare/actionList/changeuserbutton/index.scss | 11 src/tabviews/zshare/actionList/popupbutton/index.jsx | 51 + src/tabviews/zshare/actionList/normalbutton/index.scss | 9 src/tabviews/zshare/actionList/tabbutton/index.scss | 11 src/tabviews/zshare/normalTable/index.jsx | 126 +++- src/tabviews/subtabtable/index.scss | 6 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 68 +- src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 63 +- src/tabviews/zshare/actionList/index.jsx | 50 - src/tabviews/zshare/actionList/excelInbutton/index.scss | 8 src/tabviews/zshare/actionList/newpagebutton/index.scss | 11 src/tabviews/zshare/actionList/exceloutbutton/index.scss | 8 src/tabviews/zshare/actionList/newpagebutton/index.jsx | 60 +- src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx | 2 src/tabviews/subtable/index.jsx | 56 - src/templates/sharecomponent/settingcomponent/settingform/index.jsx | 2 src/tabviews/subtabtable/index.jsx | 47 - src/tabviews/zshare/actionList/printbutton/index.scss | 11 src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx | 26 src/tabviews/commontable/index.jsx | 123 +--- src/templates/sharecomponent/cardcomponent/index.jsx | 38 src/tabviews/zshare/actionList/normalbutton/index.jsx | 97 ++- src/tabviews/zshare/actionList/changeuserbutton/index.jsx | 81 +- src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx | 68 -- src/tabviews/zshare/actionList/tabbutton/index.jsx | 60 +- src/templates/modalconfig/index.scss | 2 src/tabviews/subtable/index.scss | 6 src/utils/utils-update.js | 10 src/menu/components/card/cardcellcomponent/index.jsx | 10 src/templates/zshare/formconfig.jsx | 70 -- src/tabviews/zshare/actionList/printbutton/index.jsx | 66 +- src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx | 2 src/tabviews/commontable/index.scss | 6 src/templates/sharecomponent/columncomponent/gridbtnform/index.jsx | 56 +- src/menu/modalconfig/index.scss | 2 src/tabviews/zshare/actionList/popupbutton/index.scss | 11 src/tabviews/zshare/cardcomponent/index.jsx | 85 -- src/tabviews/zshare/normalTable/index.scss | 18 src/templates/sharecomponent/chartgroupcomponent/index.jsx | 2 40 files changed, 619 insertions(+), 884 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 7853bdf..0c8d9f2 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -405,11 +405,13 @@ handleActionSubmit = () => { const { elements } = this.state - this.actionFormRef.handleConfirm().then(ele => { + this.actionFormRef.handleConfirm().then(res => { let _elements = elements.map(cell => { - if (cell.uuid === ele.uuid) { - ele = {...cell, ...ele} - return ele + if (cell.uuid === res.uuid) { + res = {...cell, ...res} + delete res.focus + + return res } return cell diff --git a/src/menu/modalconfig/index.scss b/src/menu/modalconfig/index.scss index b997e5f..1c65bbf 100644 --- a/src/menu/modalconfig/index.scss +++ b/src/menu/modalconfig/index.scss @@ -249,7 +249,7 @@ } } } - .setting:hover { + .setting { overflow-y: auto; } .setting::-webkit-scrollbar { diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 64a04a3..52c0e90 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -14,6 +14,7 @@ import asyncComponent from '@/utils/asyncComponent' import asyncSpinComponent from '@/utils/asyncSpinComponent' import { refreshTabView } from '@/store/action' +import MKEmitter from '@/utils/events.js' import MainSearch from '@/tabviews/zshare/topSearch' import NotFount from '@/components/404' @@ -59,7 +60,6 @@ setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� - resetTable: false, // 琛ㄦ牸閲嶇疆锛屽�煎湪true涓巉alse涔嬮棿鍒囨崲锛屽垏鎹㈡椂琛ㄦ牸閲嶇疆 total: 0, // 鎬绘暟 loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� pageIndex: 1, // 椤电爜 @@ -70,7 +70,6 @@ pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 treevisible: false, // 鑿滃崟缁撴瀯鏍戝脊妗嗘樉绀洪殣钘忔帶鍒� refreshtabs: null, // 闇�瑕佸埛鏂扮殑鏍囩闆� - triggerBtn: null, // 鐐瑰嚮琛ㄦ牸涓垨蹇嵎閿Е鍙戠殑鎸夐挳 tabActive: null, // 鏍囩椤靛睍寮�鎺у埗 chartId: '', // 灞曞紑鍥捐〃ID statFields: [], // 鍚堣瀛楁 @@ -442,79 +441,58 @@ if (!preKey) return - let istrigger = false + let triggerId = '' - actions.forEach(item => { - if (!item.shortcut || typeof(item.shortcut) !== 'object' || item.shortcut.length === 0 || istrigger) return - - if (preKey === item.shortcut[0] && keyCode === item.shortcut[1]) { + actions.some(item => { + if (Array.isArray(item.shortcut) && preKey === item.shortcut[0] && keyCode === item.shortcut[1]) { e.preventDefault() - istrigger = true - - this.setState({ - triggerBtn: { - uuid: new Date().getTime(), - parentId: this.props.MenuID, - button: item, - data: null - } - }) + triggerId = item.uuid + return true } + return false }) - if (istrigger) return + if (triggerId) { + MKEmitter.emit('triggerBtnId', triggerId) + return + } - Object.keys(userConfig).forEach(key => { - if (key === this.props.MenuID || !userConfig[key].action || istrigger) return + Object.keys(userConfig).some(key => { + if (key === this.props.MenuID || !userConfig[key].action) return false let _actions = userConfig[key].action - Object.keys(_actions).forEach(btnkey => { + Object.keys(_actions).some(btnkey => { let item = _actions[btnkey] - if (!item.shortcut || typeof(item.shortcut) !== 'object' || item.shortcut.length === 0 || istrigger) return - - if (preKey === item.shortcut[0] && keyCode === item.shortcut[1]) { + if (Array.isArray(item.shortcut) && preKey === item.shortcut[0] && keyCode === item.shortcut[1]) { e.preventDefault() - istrigger = true + triggerId = btnkey let _groupId = '' let _ActiveTabId = '' config.tabgroups.forEach(group => { - if (group.sublist.length === 0) return - let _tab = group.sublist.filter(tab => tab.uuid === key)[0] - if (_tab) { - _groupId = group.uuid - _ActiveTabId = _tab.uuid - } + + if (!_tab) return + + _groupId = group.uuid + _ActiveTabId = _tab.uuid }) - if (this.state.tabActive[_groupId] === _ActiveTabId) { - this.setState({ - triggerBtn: { - uuid: new Date().getTime(), - parentId: key, - button: {...item, uuid: btnkey}, - data: null - } - }) - } else { - this.setState({ - tabActive: {...this.state.tabActive, [_groupId]: _ActiveTabId} - }, () => { - this.setState({ - triggerBtn: { - uuid: new Date().getTime(), - parentId: key, - button: {...item, uuid: btnkey}, - data: null - } - }) - }) - } + this.setState({ + tabActive: {...this.state.tabActive, [_groupId]: _ActiveTabId} + }, () => { + MKEmitter.emit('triggerBtnId', triggerId) + }) + + return true } + return false }) + + if (triggerId) return true + return false }) } } @@ -553,6 +531,7 @@ return item }), total: result.total, + selectedData: [], loading: false, pickup: false, BIDs: { @@ -639,9 +618,8 @@ this.getStatFieldsValue() }) } else { + MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 鍒楄〃閲嶇疆 this.setState({ - resetTable: !this.state.resetTable, - selectedData: [], pageIndex: 1, search: searches }, () => { @@ -664,7 +642,6 @@ } this.setState({ - selectedData: [], pageIndex: pagination.current, pageSize: pagination.pageSize, orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' @@ -677,9 +654,8 @@ * @description 琛ㄦ牸鍒锋柊 */ reloadtable = () => { + MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 鍒楄〃閲嶇疆 this.setState({ - resetTable: !this.state.resetTable, - selectedData: [], pageIndex: 1 }, () => { this.loadmaindata() @@ -757,20 +733,6 @@ */ changeSelectedData = (selectedData) => { this.setState({selectedData}) - } - - /** - * @description 琛ㄦ牸涓紝鎸夐挳瑙﹀彂浜嬩欢浼犻�� - */ - buttonTrigger = (btn, record) => { - this.setState({ - triggerBtn: { - uuid: new Date().getTime(), - parentId: this.props.MenuID, - button: btn, - data: record - } - }) } /** @@ -909,7 +871,7 @@ render() { const { menuType } = this.props - const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, triggerBtn, userConfig, tabActive, chartId, search, selectedData } = this.state + const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state return ( <div className="commontable" id={this.state.ContainerId}> @@ -944,12 +906,10 @@ setting={setting} actions={actions} dict={this.state.dict} - triggerBtn={triggerBtn} MenuID={this.props.MenuID} selectedData={selectedData} logcolumns={this.state.logcolumns} ContainerId={this.state.ContainerId} - operations={config.gridBtn.operations || []} refreshdata={this.refreshbyaction} getexceloutparam={this.getexceloutparam} /> @@ -971,6 +931,7 @@ } <MainTable tableId="mainTable" + BID={BID} pickup={pickup} config={config} setting={setting} @@ -981,11 +942,12 @@ total={this.state.total} MenuID={this.props.MenuID} loading={this.state.loading} - statFValue={this.state.statFValue} refreshdata={this.refreshbytable} - buttonTrigger={this.buttonTrigger} + logcolumns={this.state.logcolumns} + statFValue={this.state.statFValue} handleTableId={this.handleTableId} - resetTable={this.state.resetTable} + ContainerId={this.state.ContainerId} + refreshbyaction={this.refreshbyaction} chgSelectData={this.changeSelectedData} /> </div> @@ -993,7 +955,7 @@ ) } else if (item.chartType === 'card') { return ( - <Col span={item.width} key={item.uuid}> + <Col className="card-view" span={item.width} key={item.uuid}> <CardComponent BID={BID} plot={item} @@ -1043,7 +1005,6 @@ MenuID={_tab.linkTab} mainSearch={_tab.searchPass === 'true' ? search : null} userConfig={userConfig ? userConfig[_tab.uuid] : null} - triggerBtn={triggerBtn} SupMenuID={this.props.MenuID} refreshtabs={this.state.refreshtabs} ContainerId={this.state.ContainerId} diff --git a/src/tabviews/commontable/index.scss b/src/tabviews/commontable/index.scss index a7ceb70..3d3f54b 100644 --- a/src/tabviews/commontable/index.scss +++ b/src/tabviews/commontable/index.scss @@ -123,6 +123,12 @@ >.ant-col { min-height: 100px; } + >.card-view.ant-col-24 { + padding: 0!important; + .card-row-box { + padding: 0; + } + } .chart-title { position: relative; color: rgba(0, 0, 0, 0.65); diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index f7108a0..6ff99f1 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -16,6 +16,7 @@ import asyncComponent from '@/utils/asyncComponent' import asyncSpinComponent from '@/utils/asyncSpinComponent' import NotFount from '@/components/404' +import MKEmitter from '@/utils/events.js' import './index.scss' @@ -38,7 +39,6 @@ handleMainTable: PropTypes.func, // 鍒锋柊涓昏〃 refreshtabs: PropTypes.any, // 鏍囩鍒锋柊鎺у埗 userConfig: PropTypes.any, // 鐢ㄦ埛鑷畾涔夎缃� - triggerBtn: PropTypes.any // 蹇嵎閿垨鐐瑰嚮琛屾寜閽Е鍙戜簨浠� } state = { @@ -55,7 +55,6 @@ setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� - resetTable: false, // 琛ㄦ牸閲嶇疆锛屽�煎湪true涓巉alse涔嬮棿鍒囨崲锛屽垏鎹㈡椂琛ㄦ牸閲嶇疆 total: 0, // 鎬绘暟 loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� pageIndex: 1, // 椤电爜 @@ -63,7 +62,6 @@ orderBy: '', // 鎺掑簭 search: [], // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� pickup: false, // 瀛愯〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 - triggerBtn: null, // 鎸夐挳瑙﹀彂 chartId: '', // 灞曞紑鍥捐〃ID statFields: [], // 鍚堣瀛楁 statFValue: [] // 鍚堣鍊� @@ -74,10 +72,9 @@ */ UNSAFE_componentWillReceiveProps(nextProps) { if (this.state.config && this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { + MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆 this.setState({ - pageIndex: 1, - selectedData: [], - resetTable: !this.state.resetTable, + pageIndex: 1 }, () => { if (this.state.setting) { this.loadmaindata(nextProps.BID, 'refresh') @@ -86,14 +83,6 @@ }) } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { this.reloadtable() - } else if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.parentId === this.props.Tab.uuid) { - let trigger = nextProps.triggerBtn - - trigger.parentId = this.props.MenuID - - this.setState({ - triggerBtn: trigger - }) } else if (!this.props.Tab.supMenu && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { if (this.state.setting) { this.setState({}, () => { @@ -453,6 +442,7 @@ return item }), total: result.total, + selectedData: [], pickup: false, loading: false }) @@ -541,11 +531,10 @@ * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� */ refreshbysearch = (searches) => { + MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆 this.setState({ pageIndex: 1, search: searches, - resetTable: !this.state.resetTable, - selectedData: [], }, () => { this.loadmaindata() this.getStatFieldsValue() @@ -565,7 +554,6 @@ } this.setState({ - selectedData: [], pageIndex: pagination.current, pageSize: pagination.pageSize, orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' @@ -578,10 +566,9 @@ * @description 琛ㄦ牸鍒锋柊 */ reloadtable = () => { + MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆 this.setState({ - pageIndex: 1, - selectedData: [], - resetTable: !this.state.resetTable + pageIndex: 1 }, () => { this.loadmaindata() this.getStatFieldsValue() @@ -594,7 +581,7 @@ reloadview = () => { this.setState({ loadingview: true, viewlost: false, lostmsg: '', config: null, searchlist: null, actions: null, columns: null, arr_field: '', setting: null, data: null, total: 0, loading: false, pageIndex: 1, pageSize: 10, - orderBy: '', search: [], triggerBtn: null + orderBy: '', search: [] }, () => { this.loadconfig() }) @@ -652,20 +639,6 @@ } /** - * @description 琛ㄦ牸涓紝鎸夐挳瑙﹀彂浜嬩欢浼犻�� - */ - buttonTrigger = (btn, record) => { - this.setState({ - triggerBtn: { - uuid: new Date().getTime(), - parentId: this.props.MenuID, - button: btn, - data: record - } - }) - } - - /** * @description 琛ㄦ牸Id鍙樺寲 */ handleTableId = (type = this.props.Tab.uuid, id = '', data = '') => { @@ -709,7 +682,7 @@ } render() { - const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, triggerBtn, chartId, selectedData } = this.state + const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, chartId, selectedData } = this.state return ( <div className="subtable" id={'subtable' + this.props.MenuID}> @@ -743,14 +716,12 @@ actions={actions} Tab={this.props.Tab} BID={this.props.BID} - triggerBtn={triggerBtn} BData={this.props.BData} MenuID={this.props.MenuID} selectedData={selectedData} logcolumns={this.state.logcolumns} refreshdata={this.refreshbyaction} ContainerId={this.props.ContainerId} - operations={config.gridBtn.operations || []} getexceloutparam={this.getexceloutparam} /> </div> @@ -765,16 +736,19 @@ setting={setting} columns={columns} pageSize={pageSize} + BID={this.props.BID} dict={this.state.dict} data={this.state.data} + BData={this.props.BData} total={this.state.total} MenuID={this.props.MenuID} loading={this.state.loading} - statFValue={this.state.statFValue} refreshdata={this.refreshbytable} - buttonTrigger={this.buttonTrigger} + logcolumns={this.state.logcolumns} + statFValue={this.state.statFValue} handleTableId={this.handleTableId} - resetTable={this.state.resetTable} + ContainerId={this.props.ContainerId} + refreshbyaction={this.refreshbyaction} chgSelectData={this.changeSelectedData} /> </div> diff --git a/src/tabviews/subtable/index.scss b/src/tabviews/subtable/index.scss index 911db01..92ab7cf 100644 --- a/src/tabviews/subtable/index.scss +++ b/src/tabviews/subtable/index.scss @@ -33,6 +33,12 @@ >.ant-col { min-height: 100px; } + >.card-view.ant-col-24 { + padding: 0!important; + .card-row-box { + padding: 0; + } + } .chart-title { position: relative; color: rgba(0, 0, 0, 0.65); diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index fddcf6d..094e150 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -15,6 +15,7 @@ import asyncSpinComponent from '@/utils/asyncSpinComponent' import SubSearch from '@/tabviews/zshare/topSearch' import NotFount from '@/components/404' +import MKEmitter from '@/utils/events.js' import './index.scss' @@ -51,14 +52,12 @@ setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� - resetTable: false, // 琛ㄦ牸閲嶇疆锛屽�煎湪true涓巉alse涔嬮棿鍒囨崲锛屽垏鎹㈡椂琛ㄦ牸閲嶇疆 total: 0, // 鎬绘暟 loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� pageIndex: 1, // 椤电爜 pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 orderBy: '', // 鎺掑簭 search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - triggerBtn: null, // 鎸夐挳瑙﹀彂 chartId: '', // 灞曞紑鍥捐〃ID statFields: [], // 鍚堣瀛楁 statFValue: [] // 鍚堣鍊� @@ -357,6 +356,7 @@ return item }), total: result.total, + selectedData: [], loading: false }) } else { @@ -431,11 +431,10 @@ * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� */ refreshbysearch = (searches) => { + MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆 this.setState({ pageIndex: 1, - search: searches, - selectedData: [], - resetTable: !this.state.resetTable + search: searches }, () => { this.loadmaindata() this.getStatFieldsValue() @@ -455,7 +454,6 @@ } this.setState({ - selectedData: [], pageIndex: pagination.current, pageSize: pagination.pageSize, orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' @@ -468,10 +466,9 @@ * @description 琛ㄦ牸鍒锋柊 */ reloadtable = () => { + MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆 this.setState({ - pageIndex: 1, - selectedData: [], - resetTable: !this.state.resetTable + pageIndex: 1 }, () => { this.loadmaindata() this.getStatFieldsValue() @@ -490,8 +487,7 @@ */ reloadview = () => { this.setState({ loadingview: true, viewlost: false, lostmsg: '', config: null, searchlist: null, actions: null, columns: null, - arr_field: '', setting: null, data: null, total: 0, loading: false, pageIndex: 1, pageSize: 10, orderBy: '', search: '', - triggerBtn: null + arr_field: '', setting: null, data: null, total: 0, loading: false, pageIndex: 1, pageSize: 10, orderBy: '', search: '' }, () => { this.loadconfig() }) @@ -510,20 +506,6 @@ } else if (position === 'trigger') { // 鏃ュ巻瀛愯〃瑙﹀彂鏍囩鐐瑰嚮浜嬩欢 this.props.closeModalView && this.props.closeModalView() } - } - - /** - * @description 琛ㄦ牸涓紝鎸夐挳瑙﹀彂浜嬩欢浼犻�� - */ - buttonTrigger = (btn, record) => { - this.setState({ - triggerBtn: { - uuid: new Date().getTime(), - parentId: this.props.SupMenuID, - button: btn, - data: record - } - }) } /** @@ -572,7 +554,7 @@ } render() { - const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, triggerBtn, chartId, selectedData } = this.state + const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, chartId, selectedData } = this.state return ( <div className="subtabtable" id={'subtabtable' + this.props.MenuID}> @@ -603,7 +585,6 @@ {config.charts.length > 1 ? <p className="chart-table chart-title">{item.title}</p> : null} <div style={{minHeight: '25px'}}> <SubAction - triggerBtn={triggerBtn} setting={setting} actions={actions} BID={this.props.BID} @@ -612,26 +593,27 @@ selectedData={selectedData} MenuID={this.props.SupMenuID} logcolumns={this.state.logcolumns} - operations={config.gridBtn.operations || []} refreshdata={this.refreshbyaction} getexceloutparam={this.getexceloutparam} /> </div> <SubTable - tableId="" + tableId={this.props.Tab.uuid} config={config} setting={setting} columns={columns} pageSize={pageSize} + BID={this.props.BID} data={this.state.data} dict={this.state.dict} + BData={this.props.BData} total={this.state.total} MenuID={this.props.MenuID} loading={this.state.loading} - statFValue={this.state.statFValue} refreshdata={this.refreshbytable} - buttonTrigger={this.buttonTrigger} - resetTable={this.state.resetTable} + logcolumns={this.state.logcolumns} + statFValue={this.state.statFValue} + refreshbyaction={this.refreshbyaction} chgSelectData={this.changeSelectedData} handleTableId={() => {}} /> @@ -649,7 +631,6 @@ data={this.state.data} loading={this.state.loading} logcolumns={this.state.logcolumns} - buttonTrigger={this.buttonTrigger} refreshdata={this.refreshbyaction} handleTableId={() => {}} /> diff --git a/src/tabviews/subtabtable/index.scss b/src/tabviews/subtabtable/index.scss index 19a1a4e..bf3cc04 100644 --- a/src/tabviews/subtabtable/index.scss +++ b/src/tabviews/subtabtable/index.scss @@ -51,6 +51,12 @@ >.ant-col { min-height: 100px; } + >.card-view.ant-col-24 { + padding: 0!important; + .card-row-box { + padding: 0; + } + } .chart-title { position: relative; color: rgba(0, 0, 0, 0.65); diff --git a/src/tabviews/treepage/index.jsx b/src/tabviews/treepage/index.jsx index 9e91b82..5bfd81f 100644 --- a/src/tabviews/treepage/index.jsx +++ b/src/tabviews/treepage/index.jsx @@ -10,6 +10,7 @@ import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' import UtilsDM from '@/utils/utils-datamanage.js' +import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' import asyncSpinComponent from '@/utils/asyncSpinComponent' import {refreshTabView, modifyTabview} from '@/store/action' @@ -54,7 +55,6 @@ confirmLoading: false,// 鑷畾涔夎缃ā鎬佹鍔犺浇涓� revertLoading: false, // 鎭㈠榛樿璁剧疆 settingVisible: false,// 鑷畾涔夎缃ā鎬佹 - triggerBtn: null, // 鐐瑰嚮琛ㄦ牸涓垨蹇嵎閿Е鍙戠殑鎸夐挳 tabActive: null, // 鏍囩椤靛睍寮�鎺у埗 expandedKeys: [], // 灞曞紑鐨勬爲鑺傜偣 selectedKeys: [] // 閫変腑鐨勬爲鑺傜偣 @@ -227,59 +227,44 @@ if (!preKey) return - let istrigger = false + let triggerId = '' - Object.keys(userConfig).forEach(key => { - if (key === this.props.MenuID || !userConfig[key].action || istrigger) return + Object.keys(userConfig).some(key => { + if (key === this.props.MenuID || !userConfig[key].action) return false let _actions = userConfig[key].action - Object.keys(_actions).forEach(btnkey => { + Object.keys(_actions).some(btnkey => { let item = _actions[btnkey] - if (!item.shortcut || typeof(item.shortcut) !== 'object' || item.shortcut.length === 0 || istrigger) return - - if (preKey === item.shortcut[0] && keyCode === item.shortcut[1]) { + if (Array.isArray(item.shortcut) && preKey === item.shortcut[0] && keyCode === item.shortcut[1]) { e.preventDefault() - istrigger = true + triggerId = btnkey let _groupId = '' let _ActiveTabId = '' config.tabgroups.forEach(group => { - if (group.sublist.length === 0) return - let _tab = group.sublist.filter(tab => tab.uuid === key)[0] - if (_tab) { - _groupId = group.uuid - _ActiveTabId = _tab.uuid - } + + if (!_tab) return + + _groupId = group.uuid + _ActiveTabId = _tab.uuid }) - if (this.state.tabActive[_groupId] === _ActiveTabId) { - this.setState({ - triggerBtn: { - uuid: new Date().getTime(), - parentId: key, - button: {...item, uuid: btnkey}, - data: null - } - }) - } else { - this.setState({ - tabActive: {...this.state.tabActive, [_groupId]: _ActiveTabId} - }, () => { - this.setState({ - triggerBtn: { - uuid: new Date().getTime(), - parentId: key, - button: {...item, uuid: btnkey}, - data: null - } - }) - }) - } + this.setState({ + tabActive: {...this.state.tabActive, [_groupId]: _ActiveTabId} + }, () => { + MKEmitter.emit('triggerBtnId', triggerId) + }) + + return true } + return false }) + + if (triggerId) return true + return false }) } } @@ -755,7 +740,7 @@ render() { const { menuType } = this.props - const { setting, loadingview, viewlost, config, triggerBtn, userConfig, tabActive, tabgroups, treeNodes, treedata, expandedKeys, selectedKeys } = this.state + const { setting, loadingview, viewlost, config, userConfig, tabActive, tabgroups, treeNodes, treedata, expandedKeys, selectedKeys } = this.state return ( <div className="tree-page" id={this.state.ContainerId}> @@ -807,7 +792,6 @@ MenuID={_tab.linkTab} mainSearch={null} userConfig={userConfig ? userConfig[_tab.uuid] : null} - triggerBtn={triggerBtn} SupMenuID={this.props.MenuID} refreshtabs={this.state.refreshtabs} ContainerId={this.state.ContainerId} diff --git a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx index 67abd43..7ddb52c 100644 --- a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx +++ b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx @@ -6,6 +6,7 @@ import Api from '@/api' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' +import MKEmitter from '@/utils/events.js' import './index.scss' const { confirm } = Modal @@ -18,38 +19,42 @@ selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� - triggerBtn: PropTypes.any } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS - } - - /** - * @description 澶栭儴瑙﹀彂鎸夐挳鐐瑰嚮 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.button.uuid === this.props.btn.uuid) { - this.actionTrigger(nextProps.triggerBtn.data) - } + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + loading: false } shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) } + + componentDidMount () { + const { show } = this.props + + if (show === 'actionList') { + MKEmitter.addListener('triggerBtnId', this.actionTrigger) + } + } + + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('triggerBtnId', this.actionTrigger) + } /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (record) => { - const { setting, selectedData } = this.props - let data = [] - - if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� - data = [record] - } else { - data = selectedData || [] - } + actionTrigger = (triggerId) => { + const { setting, selectedData, btn } = this.props + const { loading } = this.state + + if ((triggerId && btn.uuid !== triggerId) || loading) return + + let data = selectedData || [] if (data.length !== 1) { // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 @@ -71,7 +76,7 @@ let primaryId = data[0][setting.primaryKey] || '' - this.props.updateStatus('start') + this.setState({loading: true}) this.changeUser(primaryId) } @@ -116,35 +121,43 @@ message: res.message || res.ErrMesg, duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10 }) - _this.props.updateStatus('over') + _this.setState({loading: false}) } }, () => { resolve() - _this.props.updateStatus('over') + _this.setState({loading: false}) }) }) }, onCancel() { - _this.props.updateStatus('over') + _this.setState({loading: false}) } }) } render() { const { btn, show } = this.props + const { loading } = this.state - return ( - <div className="mk-btn-wrap"> - {!show ? <Button - className={'mk-btn mk-' + btn.class} + if (show === 'actionList') { + return ( + <Button icon={btn.icon} + loading={loading} + className={'mk-btn mk-' + btn.class} onClick={() => {this.actionTrigger()}} - >{btn.label}</Button> : null} - {show === 'icon' ? <Button className="action-cell" icon={btn.icon || 'dash'} onClick={() => {this.actionTrigger()}}></Button> : null} - {show === 'text' ? <Button className="action-cell" onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} - {show === 'all' ? <Button className="action-cell" icon={btn.icon || ''} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} - </div> - ) + >{btn.label}</Button> + ) + } else { // icon銆乼ext銆� all 鍗$墖 + return ( + <Button + type="link" + loading={loading} + icon={show === 'text' ? '' : (btn.icon || '')} + onClick={() => {this.actionTrigger()}} + >{show === 'icon' && btn.icon ? '' : btn.label}</Button> + ) + } } } diff --git a/src/tabviews/zshare/actionList/changeuserbutton/index.scss b/src/tabviews/zshare/actionList/changeuserbutton/index.scss index e9a2a7d..8b13789 100644 --- a/src/tabviews/zshare/actionList/changeuserbutton/index.scss +++ b/src/tabviews/zshare/actionList/changeuserbutton/index.scss @@ -1,10 +1 @@ -.mk-btn-wrap { - display: inline-block; - .action-cell { - border: 0; - background: transparent !important; - } - .action-cell[ant-click-animating-without-extra-node="true"]::after { - display: none!important; - } -} + diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 53fd47f..9080770 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -11,6 +11,7 @@ import Api from '@/api' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' +import MKEmitter from '@/utils/events.js' import './index.scss' class ExcelInButton extends Component { @@ -22,7 +23,6 @@ btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� - triggerBtn: PropTypes.any, } state = { @@ -31,17 +31,23 @@ primaryId: '', } - /** - * @description 澶栭儴瑙﹀彂鎸夐挳鐐瑰嚮 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.button.uuid === this.props.btn.uuid) { - this.actionTrigger(nextProps.triggerBtn.data) + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount () { + const { show } = this.props + + if (show === 'actionList') { + MKEmitter.addListener('triggerBtnId', this.actionTrigger) } } - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('triggerBtnId', this.actionTrigger) } /** @@ -52,20 +58,21 @@ this.setState({ loading: true }) - this.props.updateStatus('start') } else if (type === 'over') { this.setState({ loading: false }) - this.props.updateStatus('over') } } /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (record) => { + actionTrigger = (triggerId) => { const { setting, Tab, BID, btn, selectedData } = this.props + const { loading } = this.state + + if ((triggerId && btn.uuid !== triggerId) || loading) return if (Tab && Tab.supMenu && !BID) { notification.warning({ @@ -76,13 +83,7 @@ return } - let data = [] - - if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� - data = [record] - } else { - data = selectedData || [] - } + let data = selectedData || [] if (btn.Ot === 'requiredSgl' && data.length !== 1) { // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 @@ -392,24 +393,27 @@ const { btn, show } = this.props const { loading } = this.state - return ( - <div className="mk-btn-wrap"> - {!show ? <Button - className={'mk-btn mk-' + btn.class} + if (show === 'actionList') { + return <div style={{display: 'inline-block'}}> + <Button icon={btn.icon} - onClick={() => {this.actionTrigger()}} loading={loading} - >{btn.label}</Button> : null} - {show === 'icon' ? <Button - className="import-icon" - icon="upload" + className={'mk-btn mk-' + btn.class} onClick={() => {this.actionTrigger()}} - loading={loading} - title={btn.label} - ></Button> : null} + >{btn.label}</Button> <ExcelIn btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" /> </div> - ) + } else { // icon銆乼ext銆� all 鍗$墖 + return <div style={{display: 'inline-block'}}> + <Button + type="link" + loading={loading} + icon={show === 'text' ? '' : (show === 'icon' ? (btn.icon || 'upload') : (btn.icon || ''))} + onClick={() => {this.actionTrigger()}} + >{show === 'icon' ? '' : btn.label}</Button> + <ExcelIn btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" /> + </div> + } } } diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.scss b/src/tabviews/zshare/actionList/excelInbutton/index.scss index fe79b6e..e69de29 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.scss +++ b/src/tabviews/zshare/actionList/excelInbutton/index.scss @@ -1,8 +0,0 @@ -.mk-btn-wrap { - display: inline-block; - - .import-icon { - border: 0; - box-shadow: unset; - } -} diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 8e5aaad..2485148 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -11,6 +11,7 @@ import Api from '@/api' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' +import MKEmitter from '@/utils/events.js' import './index.scss' class ExcelOutButton extends Component { @@ -22,27 +23,32 @@ setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� getexceloutparam: PropTypes.func, // 鑾峰彇琛ㄦ牸涓弬鏁� - triggerBtn: PropTypes.any, } state = { dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - excelName: '', + excelName: '', // 鏂囦欢鍚� search: '', // 鎼滅储鏉′欢 - loading: false - } - - /** - * @description 澶栭儴瑙﹀彂鎸夐挳鐐瑰嚮 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.button.uuid === this.props.btn.uuid) { - this.actionTrigger() - } + loading: false // 瀵煎嚭涓� } shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount () { + const { show } = this.props + + if (show === 'actionList') { + MKEmitter.addListener('triggerBtnId', this.actionTrigger) + } + } + + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('triggerBtnId', this.actionTrigger) } /** @@ -54,20 +60,21 @@ loading: true, excelName: name }) - this.props.updateStatus('start') } else if (type === 'over') { this.setState({ loading: false }) - this.props.updateStatus('over') } } /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = () => { + actionTrigger = (triggerId) => { const { setting, Tab, BID, btn } = this.props + const { loading } = this.state + + if ((triggerId && btn.uuid !== triggerId) || loading) return if (Tab && Tab.supMenu && !BID) { notification.warning({ @@ -695,23 +702,25 @@ const { btn, show } = this.props const { loading } = this.state - return ( - <div className="mk-btn-wrap"> - {!show ? <Button + if (show === 'actionList') { + return ( + <Button className={'mk-btn mk-' + btn.class} icon={btn.icon} onClick={() => {this.actionTrigger()}} loading={loading} - >{btn.label}</Button> : null} - {show === 'icon' ? <Button - className="export-icon" - icon="download" - onClick={() => {this.actionTrigger()}} + >{btn.label}</Button> + ) + } else { // icon銆乼ext銆� all 鍗$墖 + return ( + <Button + type="link" loading={loading} - title={btn.label} - ></Button> : null} - </div> - ) + icon={show === 'text' ? '' : (show === 'icon' ? (btn.icon || 'download') : (btn.icon || ''))} + onClick={() => {this.actionTrigger()}} + >{show === 'icon' ? '' : btn.label}</Button> + ) + } } } diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.scss b/src/tabviews/zshare/actionList/exceloutbutton/index.scss index cb6cb8d..e69de29 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.scss +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.scss @@ -1,8 +0,0 @@ -.mk-btn-wrap { - display: inline-block; - - .export-icon { - border: 0; - box-shadow: unset; - } -} diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 47cdba2..67f6200 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -25,48 +25,24 @@ Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� MenuID: PropTypes.string, // 鑿滃崟ID actions: PropTypes.array, // 鎸夐挳缁� - operations: PropTypes.array, // 琛ㄦ牸涓寜閽粍 logcolumns: PropTypes.array, // 鏄剧ず鍒� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� refreshdata: PropTypes.func, // 鎵ц瀹屾垚鍚庢暟鎹埛鏂� getexceloutparam: PropTypes.func, // 鑾峰彇excel瀵煎嚭鏁版嵁 - triggerBtn: PropTypes.any, // 蹇嵎閿Е鍙戠殑鎸夐挳 } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - running: false, - triggerBtn: null - } - - /** - * @description 涓婄骇鑿滃崟id鍙樺寲鏃讹紝鍒锋柊鏁版嵁 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.parentId === this.props.MenuID) { - if (!this.state.running) { - this.setState({ - triggerBtn: nextProps.triggerBtn - }) - } - } + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS } shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) } - updateStatus = (type, positon, unclose) => { - if (type === 'start') { - this.setState({running: true}) - } else if (type === 'over') { - this.setState({running: false}) - } else if (type === 'refresh') { + updateStatus = (type, positon) => { + if (type === 'refresh') { this.props.refreshdata(positon) - if (!unclose) { - this.setState({running: false}) - } } else if (type === 'trigger') { // 鏃ュ巻涓殑鏂版爣绛鹃〉瑙﹀彂浜嬩欢 this.props.refreshdata('trigger') } @@ -80,6 +56,7 @@ return ( <NormalButton key={item.uuid} + show="actionList" BID={BID} Tab={Tab} btn={item} @@ -88,7 +65,6 @@ columns={logcolumns} ContainerId={ContainerId} selectedData={selectedData} - triggerBtn={this.state.triggerBtn} updateStatus={this.updateStatus} /> ) @@ -96,12 +72,12 @@ return ( <ExcelInButton key={item.uuid} + show="actionList" BID={BID} Tab={Tab} btn={item} setting={setting} selectedData={selectedData} - triggerBtn={this.state.triggerBtn} updateStatus={this.updateStatus} /> ) @@ -109,11 +85,11 @@ return ( <ExcelOutButton key={item.uuid} + show="actionList" BID={BID} Tab={Tab} btn={item} setting={setting} - triggerBtn={this.state.triggerBtn} getexceloutparam={getexceloutparam} updateStatus={this.updateStatus} /> @@ -122,13 +98,13 @@ return ( <PopupButton key={item.uuid} + show="actionList" BID={BID} Tab={Tab} btn={item} BData={BData} setting={setting} selectedData={selectedData} - triggerBtn={this.state.triggerBtn} updateStatus={this.updateStatus} /> ) @@ -136,11 +112,11 @@ return ( <TabButton key={item.uuid} + show="actionList" btn={item} MenuID={MenuID} setting={setting} selectedData={selectedData} - triggerBtn={this.state.triggerBtn} updateStatus={this.updateStatus} /> ) @@ -148,11 +124,11 @@ return ( <NewPageButton key={item.uuid} + show="actionList" btn={item} setting={setting} selectedData={selectedData} updateStatus={this.updateStatus} - triggerBtn={this.state.triggerBtn} /> ) } else if (item.OpenType === 'funcbutton') { @@ -160,11 +136,11 @@ return ( <ChangeUserButton key={item.uuid} + show="actionList" BID={BID} btn={item} setting={setting} selectedData={selectedData} - triggerBtn={this.state.triggerBtn} updateStatus={this.updateStatus} /> ) @@ -172,6 +148,7 @@ return ( <PrintButton key={item.uuid} + show="actionList" BID={BID} Tab={Tab} btn={item} @@ -179,7 +156,6 @@ setting={setting} ContainerId={ContainerId} selectedData={selectedData} - triggerBtn={this.state.triggerBtn} updateStatus={this.updateStatus} /> ) @@ -190,7 +166,7 @@ } render() { - const { setting, MenuID, actions, operations } = this.props + const { setting, MenuID, actions } = this.props let fixed = setting.actionfixed && setting.tabType === 'main' // 鎸夐挳鏄惁鍥哄畾鍦ㄥご閮� if (fixed) { @@ -198,7 +174,6 @@ <Affix offsetTop={48}> <div className="button-list toolbar-button" id={fixed ? MenuID + 'mainaction' : ''}> {this.getButtonList(actions)} - {operations && operations.length > 0 ? <div className="grid-button-list">{this.getButtonList(operations)}</div> : null} </div> </Affix> ) @@ -206,7 +181,6 @@ return ( <div className="button-list toolbar-button" id={fixed ? MenuID + 'mainaction' : ''}> {this.getButtonList(actions)} - {operations && operations.length > 0 ? <div className="grid-button-list">{this.getButtonList(operations)}</div> : null} </div> ) } diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx index c506d7b..45f5a18 100644 --- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx +++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx @@ -5,6 +5,7 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' +import MKEmitter from '@/utils/events.js' import './index.scss' const { confirm } = Modal @@ -16,7 +17,6 @@ selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� - triggerBtn: PropTypes.any, } state = { @@ -24,32 +24,35 @@ visible: false } - /** - * @description 澶栭儴瑙﹀彂鎸夐挳鐐瑰嚮 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.button.uuid === this.props.btn.uuid) { - this.actionTrigger(nextProps.triggerBtn.data) + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount () { + const { show } = this.props + + if (show === 'actionList') { + MKEmitter.addListener('triggerBtnId', this.actionTrigger) } } - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('triggerBtnId', this.actionTrigger) } /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (record) => { + actionTrigger = (triggerId) => { const { setting, btn, selectedData } = this.props const _this = this - let data = [] - if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� - data = [record] - } else { - data = selectedData || [] - } + if (triggerId && btn.uuid !== triggerId) return + + let data = selectedData || [] if (btn.Ot === 'requiredSgl' && data.length !== 1) { // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 @@ -128,18 +131,23 @@ render() { const { btn, show } = this.props - return ( - <div className="mk-btn-wrap"> - {!show ? <Button + if (show === 'actionList') { + return ( + <Button className={'mk-btn mk-' + btn.class} icon={btn.icon} - onClick={() => {this.actionTrigger()}} - >{btn.label}</Button> : null} - {show === 'icon' ? <Button className="action-cell" icon={btn.icon || 'dash'} onClick={() => {this.actionTrigger()}}></Button> : null} - {show === 'text' ? <Button className="action-cell" onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} - {show === 'all' ? <Button className="action-cell" icon={btn.icon || ''} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} - </div> - ) + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{btn.label}</Button> + ) + } else { // icon銆乼ext銆� all 鍗$墖 + return ( + <Button + type="link" + icon={show === 'text' ? '' : (btn.icon || '')} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{show === 'icon' && btn.icon ? '' : btn.label}</Button> + ) + } } } diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.scss b/src/tabviews/zshare/actionList/newpagebutton/index.scss index 94c3ba6..42af7b4 100644 --- a/src/tabviews/zshare/actionList/newpagebutton/index.scss +++ b/src/tabviews/zshare/actionList/newpagebutton/index.scss @@ -1,14 +1,3 @@ -.mk-btn-wrap { - display: inline-block; - .action-cell { - border: 0; - background: transparent !important; - } - .action-cell[ant-click-animating-without-extra-node="true"]::after { - display: none!important; - } -} - .pay-query { .ant-modal-confirm-btns { width: 100%; diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 21966a1..bae524d 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -11,6 +11,7 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import asyncSpinComponent from '@/utils/asyncSpinComponent' +import MKEmitter from '@/utils/events.js' import './index.scss' const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) @@ -29,7 +30,6 @@ setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� - triggerBtn: PropTypes.any, } state = { @@ -43,17 +43,23 @@ loadingNumber: '' } - /** - * @description 澶栭儴瑙﹀彂鎸夐挳鐐瑰嚮 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.button.uuid === this.props.btn.uuid) { - this.actionTrigger(nextProps.triggerBtn.data) + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount () { + const { show } = this.props + + if (show === 'actionList') { + MKEmitter.addListener('triggerBtnId', this.actionTrigger) } } - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('triggerBtnId', this.actionTrigger) } /** @@ -64,21 +70,22 @@ this.setState({ loading: true }) - this.props.updateStatus('start') } else if (type === 'over') { this.setState({ loading: false, visible: false }) - this.props.updateStatus('over') } } /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (record) => { + actionTrigger = (triggerId) => { const { setting, Tab, BID, btn, selectedData } = this.props + const { loading } = this.state + + if ((triggerId && btn.uuid !== triggerId) || loading) return if (Tab && Tab.supMenu && !BID) { notification.warning({ @@ -90,13 +97,7 @@ } let _this = this - let data = [] - - if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� - data = [record] - } else { - data = selectedData || [] - } + let data = selectedData || [] if (btn.Ot !== 'notRequired' && data.length === 0) { // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� @@ -725,21 +726,18 @@ } - let _unclose = false if (btn.OpenType !== 'pop' || !btnconfig || btnconfig.setting.finish !== 'unclose') { this.setState({ loading: false, visible: false }) - } else { - _unclose = true } if (btn.verify && btn.verify.noteEnable === 'true') { this.sendMessage() } - this.props.updateStatus('refresh', btn.execSuccess, _unclose) + this.props.updateStatus('refresh', btn.execSuccess) } sendMessage = () => { @@ -855,7 +853,6 @@ */ execError = (res) => { const { btn } = this.props - const { btnconfig } = this.state if (res.ErrCode === 'E') { Modal.error({ @@ -878,16 +875,11 @@ message.error(res.message || res.ErrMesg) } - let _unclose = false - if (btn.OpenType === 'pop' && btnconfig && btnconfig.setting.display !== 'prompt') { - _unclose = true - } else { - this.setState({ - loading: false - }) - } + this.setState({ + loading: false + }) - this.props.updateStatus('refresh', btn.execError, _unclose) + this.props.updateStatus('refresh', btn.execError) } /** @@ -1175,21 +1167,38 @@ const { btn, show } = this.props const { loadingNumber, loading } = this.state - return ( - <div className="mk-btn-wrap"> - {!show ? <Button - className={'mk-btn mk-' + btn.class} + if (show === 'actionList') { + return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> + <Button icon={btn.icon} - onClick={() => {this.actionTrigger()}} loading={loading} - >{loadingNumber ? `(${loadingNumber})` : '' + btn.label}</Button> : null} - {show === 'icon' ? <Button className="action-cell" icon={btn.icon || 'dash'} loading={loading} onClick={() => {this.actionTrigger()}}></Button> : null} - {show === 'text' ? <Button className="action-cell" loading={loading} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} - {show === 'all' ? <Button className="action-cell" icon={btn.icon || ''} loading={loading} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} - {show && show.indexOf('plus') > -1 ? <Button className="action-cell" style={{fontSize: show.substring(4) + 'px'}} icon={btn.icon || 'plus'} loading={loading} onClick={() => {this.actionTrigger()}}></Button> : null} + className={'mk-btn mk-' + btn.class} + onClick={() => {this.actionTrigger()}} + >{loadingNumber ? `(${loadingNumber})` : '' + btn.label}</Button> {this.getModels()} </div> - ) + } else if (show && show.indexOf('plus') > -1) { + return <div className="mk-btn-wrap"> + <Button + type="link" + loading={loading} + icon={btn.icon || 'plus'} + style={{fontSize: show.substring(4) + 'px'}} + onClick={() => {this.actionTrigger()}} + ></Button> + {this.getModels()} + </div> + } else { // icon銆乼ext銆� all 鍗$墖 + return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> + <Button + type="link" + loading={loading} + icon={show === 'text' ? '' : (btn.icon || '')} + onClick={() => {this.actionTrigger()}} + >{show === 'icon' && btn.icon ? '' : btn.label}</Button> + {this.getModels()} + </div> + } } } diff --git a/src/tabviews/zshare/actionList/normalbutton/index.scss b/src/tabviews/zshare/actionList/normalbutton/index.scss index e9a2a7d..c96ba33 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.scss +++ b/src/tabviews/zshare/actionList/normalbutton/index.scss @@ -1,10 +1,3 @@ .mk-btn-wrap { display: inline-block; - .action-cell { - border: 0; - background: transparent !important; - } - .action-cell[ant-click-animating-without-extra-node="true"]::after { - display: none!important; - } -} +} \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index f089b72..4c8143f 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -7,6 +7,7 @@ import asyncSpinComponent from '@/utils/asyncSpinComponent' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' +import MKEmitter from '@/utils/events.js' import './index.scss' const SubTabTable = asyncSpinComponent(() => import('@/tabviews/subtabtable')) @@ -22,7 +23,6 @@ btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� - triggerBtn: PropTypes.any, } state = { @@ -33,24 +33,33 @@ loading: false, } - /** - * @description 澶栭儴瑙﹀彂鎸夐挳鐐瑰嚮 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.button.uuid === this.props.btn.uuid) { - this.actionTrigger(nextProps.triggerBtn.data) + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount () { + const { show } = this.props + + if (show === 'actionList') { + MKEmitter.addListener('triggerBtnId', this.actionTrigger) } } - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('triggerBtnId', this.actionTrigger) } /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (record) => { + actionTrigger = (triggerId) => { const { setting, Tab, BID, btn, selectedData } = this.props + const { loading } = this.state + + if ((triggerId && btn.uuid !== triggerId) || loading) return if (Tab && Tab.supMenu && !BID) { notification.warning({ @@ -61,13 +70,7 @@ return } - let data = [] - - if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� - data = [record] - } else { - data = selectedData || [] - } + let data = selectedData || [] if (btn.Ot === 'requiredSgl' && data.length !== 1) { // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 @@ -108,7 +111,6 @@ primaryId: primaryId, visible: true }) - this.props.updateStatus('start') } // 鎿嶄綔鍚庡埛鏂颁富琛� @@ -135,16 +137,19 @@ const { loading, popData, primaryId } = this.state return ( - <div className="mk-btn-wrap"> - {!show ? <Button + <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> + {show === 'actionList' ? <Button className={'mk-btn mk-' + btn.class} icon={btn.icon} onClick={() => {this.actionTrigger()}} loading={loading} >{btn.label}</Button> : null} - {show === 'icon' ? <Button className="action-cell" icon={btn.icon || 'dash'} loading={loading} onClick={() => {this.actionTrigger()}}></Button> : null} - {show === 'text' ? <Button className="action-cell" loading={loading} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} - {show === 'all' ? <Button className="action-cell" icon={btn.icon || ''} loading={loading} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} + {['icon', 'text', 'all'].includes(show) ? <Button + type="link" + loading={loading} + icon={show === 'text' ? '' : (btn.icon || '')} + onClick={() => {this.actionTrigger()}} + >{show === 'icon' && btn.icon ? '' : btn.label}</Button> : null} <Modal className="popview-modal" title={btn.label} diff --git a/src/tabviews/zshare/actionList/popupbutton/index.scss b/src/tabviews/zshare/actionList/popupbutton/index.scss index e9a2a7d..8b13789 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.scss +++ b/src/tabviews/zshare/actionList/popupbutton/index.scss @@ -1,10 +1 @@ -.mk-btn-wrap { - display: inline-block; - .action-cell { - border: 0; - background: transparent !important; - } - .action-cell[ant-click-animating-without-extra-node="true"]::after { - display: none!important; - } -} + diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 7e01db0..d7c2078 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -11,6 +11,7 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import asyncSpinComponent from '@/utils/asyncSpinComponent' +import MKEmitter from '@/utils/events.js' import './index.scss' const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) @@ -29,7 +30,6 @@ setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� - triggerBtn: PropTypes.any, } state = { @@ -42,17 +42,23 @@ loadingNumber: '' } - /** - * @description 澶栭儴瑙﹀彂鎸夐挳鐐瑰嚮 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.button.uuid === this.props.btn.uuid) { - this.actionTrigger(nextProps.triggerBtn.data) + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount () { + const { show } = this.props + + if (show === 'actionList') { + MKEmitter.addListener('triggerBtnId', this.actionTrigger) } } - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('triggerBtnId', this.actionTrigger) } /** @@ -63,20 +69,21 @@ this.setState({ loading: true }) - this.props.updateStatus('start') } else if (type === 'over') { this.setState({ loading: false }) - this.props.updateStatus('over') } } /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (record) => { + actionTrigger = (triggerId) => { const { setting, Tab, BID, btn, selectedData } = this.props + const { loading } = this.state + + if ((triggerId && btn.uuid !== triggerId) || loading) return if (Tab && Tab.supMenu && !BID) { notification.warning({ @@ -88,13 +95,7 @@ } let _this = this - let data = [] - - if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� - data = [record] - } else { - data = selectedData || [] - } + let data = selectedData || [] if (btn.Ot !== 'notRequired' && data.length === 0) { // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� @@ -1269,20 +1270,27 @@ const { btn, show } = this.props const { loadingNumber, loading } = this.state - return ( - <div className="mk-btn-wrap"> - {!show ? <Button - className={'mk-btn mk-' + btn.class} + if (show === 'actionList') { + return <div style={{display: 'inline-block'}}> + <Button icon={btn.icon} - onClick={() => {this.actionTrigger()}} loading={loading} - >{loadingNumber ? `(${loadingNumber})` : '' + btn.label}</Button> : null} - {show === 'icon' ? <Button className="action-cell" icon={btn.icon || 'dash'} loading={loading} onClick={() => {this.actionTrigger()}}></Button> : null} - {show === 'text' ? <Button className="action-cell" loading={loading} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} - {show === 'all' ? <Button className="action-cell" icon={btn.icon || ''} loading={loading} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} + className={'mk-btn mk-' + btn.class} + onClick={() => {this.actionTrigger()}} + >{loadingNumber ? `(${loadingNumber})` : '' + btn.label}</Button> {this.getModels()} </div> - ) + } else { // icon銆乼ext銆� all 鍗$墖 + return <div style={{display: 'inline-block'}}> + <Button + type="link" + loading={loading} + icon={show === 'text' ? '' : (btn.icon || '')} + onClick={() => {this.actionTrigger()}} + >{show === 'icon' && btn.icon ? '' : btn.label}</Button> + {this.getModels()} + </div> + } } } diff --git a/src/tabviews/zshare/actionList/printbutton/index.scss b/src/tabviews/zshare/actionList/printbutton/index.scss index e9a2a7d..8b13789 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.scss +++ b/src/tabviews/zshare/actionList/printbutton/index.scss @@ -1,10 +1 @@ -.mk-btn-wrap { - display: inline-block; - .action-cell { - border: 0; - background: transparent !important; - } - .action-cell[ant-click-animating-without-extra-node="true"]::after { - display: none!important; - } -} + diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx index 33964c5..9e82dce 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.jsx +++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx @@ -7,6 +7,7 @@ import { modifyTabview } from '@/store/action' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' +import MKEmitter from '@/utils/events.js' import './index.scss' class TabButton extends Component { @@ -16,7 +17,6 @@ btn: PropTypes.object, // 鎸夐挳 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - triggerBtn: PropTypes.any, updateStatus: PropTypes.any } @@ -25,31 +25,34 @@ primaryId: '' } - /** - * @description 澶栭儴瑙﹀彂鎸夐挳鐐瑰嚮 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.button.uuid === this.props.btn.uuid) { - this.actionTrigger(nextProps.triggerBtn.data) + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount () { + const { show } = this.props + + if (show === 'actionList') { + MKEmitter.addListener('triggerBtnId', this.actionTrigger) } } - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('triggerBtnId', this.actionTrigger) } /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (record) => { + actionTrigger = (triggerId) => { const { setting, btn, tabviews, MenuID, selectedData } = this.props - let data = [] - if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� - data = [record] - } else { - data = selectedData || [] - } + if (triggerId && btn.uuid !== triggerId) return + + let data = selectedData || [] if (btn.Ot === 'requiredSgl' && data.length !== 1) { // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 @@ -144,18 +147,23 @@ render() { const { btn, show } = this.props - return ( - <div className="mk-btn-wrap"> - {!show ? <Button + if (show === 'actionList') { + return ( + <Button className={'mk-btn mk-' + btn.class} icon={btn.icon} - onClick={() => {this.actionTrigger()}} - >{btn.label}</Button> : null} - {show === 'icon' ? <Button className="action-cell" icon={btn.icon || 'dash'} onClick={() => {this.actionTrigger()}}></Button> : null} - {show === 'text' ? <Button className="action-cell" onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} - {show === 'all' ? <Button className="action-cell" icon={btn.icon || ''} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} - </div> - ) + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{btn.label}</Button> + ) + } else { // icon銆乼ext銆� all 鍗$墖 + return ( + <Button + type="link" + icon={show === 'text' ? '' : (btn.icon || '')} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{show === 'icon' && btn.icon ? '' : btn.label}</Button> + ) + } } } diff --git a/src/tabviews/zshare/actionList/tabbutton/index.scss b/src/tabviews/zshare/actionList/tabbutton/index.scss index e9a2a7d..8b13789 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.scss +++ b/src/tabviews/zshare/actionList/tabbutton/index.scss @@ -1,10 +1 @@ -.mk-btn-wrap { - display: inline-block; - .action-cell { - border: 0; - background: transparent !important; - } - .action-cell[ant-click-animating-without-extra-node="true"]::after { - display: none!important; - } -} + diff --git a/src/tabviews/zshare/cardcomponent/index.jsx b/src/tabviews/zshare/cardcomponent/index.jsx index 229ce3c..a5ca725 100644 --- a/src/tabviews/zshare/cardcomponent/index.jsx +++ b/src/tabviews/zshare/cardcomponent/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Icon, Card, Spin, Empty, Tabs } from 'antd' +import { Icon, Card, Spin, Empty } from 'antd' import asyncComponent from '@/utils/asyncComponent' import asyncExcelComponent from './asyncButtonComponent' @@ -16,8 +16,6 @@ const NewPageButton = asyncComponent(() => import('@/tabviews/zshare/actionList/newpagebutton')) const ChangeUserButton = asyncComponent(() => import('@/tabviews/zshare/actionList/changeuserbutton')) const PrintButton = asyncComponent(() => import('@/tabviews/zshare/actionList/printbutton')) - -const { TabPane } = Tabs class CardCell extends Component { static propTpyes = { @@ -458,7 +456,7 @@ } return ( - <div className={'chart-card-box ' + card.outclass} style={card.outstyle || null} > + <div className={'chart-card-box ' + card.outclass}> {type !== 'insert' ? <Card size="small" className={'chart-card ' + (selectKey === data.key ? 'chart-card-selected' : '')} @@ -564,6 +562,13 @@ } }) + if (plot.widthType === 'absolute') { + plot.cardWidth = 6 + } + if (plot.avatar && plot.avatar.widthType === 'absolute') { + card.avatar.width = 32 + } + actions.forEach(item => { if ((item.Ot && item.Ot !== 'notRequired' && !['excelIn', 'excelOut'].includes(item.OpenType)) || item.funcType === 'changeuser') { actionMap.set(item.uuid, item) @@ -617,13 +622,9 @@ } else if (card.avatar.type === 'picture' && colMap.get(plot.avatar.field)) { card.avatar.field = plot.avatar.field card.avatar.width = plot.avatar.width - card.avatar.widthType = plot.avatar.widthType card.avatar.radius = plot.avatar.radius !== 'false' - let _width = card.avatar.width - if (plot.avatar.widthType === 'ratio') { - _width = _width + '%' - } + let _width = card.avatar.width + '%' card.avatar.class = {width: _width, paddingTop: _width} } @@ -681,18 +682,8 @@ } } - let outclass = '' - - if (plot.widthType === 'ratio' && plot.over !== 'roll') { - outclass += ' ant-col ant-col-' + plot.cardWidth - } - - card.outclass = outclass + card.outclass = ' ant-col ant-col-' + plot.cardWidth card.bordered = plot.border !== 'hidden' - - if (plot.widthType === 'absolute') { - card.outstyle = { width: plot.cardWidth } - } if (plot.bgfield && colMap.get(plot.bgfield)) { let col = fromJS(colMap.get(plot.bgfield)).toJS() @@ -733,17 +724,13 @@ let _flex = false let _cardWidth = 300 - if (plot.widthType === 'absolute') { - _cardWidth = plot.cardWidth - } else { - let _outWidth = document.body.offsetWidth - 260 - if (this.cardRef.offsetWidth) { - _outWidth = this.cardRef.offsetWidth - } - _cardWidth = Math.floor(_outWidth * plot.cardWidth / 24 - 20) + let _outWidth = document.body.offsetWidth - 260 + if (this.cardRef.offsetWidth) { + _outWidth = this.cardRef.offsetWidth } + _cardWidth = Math.floor(_outWidth * plot.cardWidth / 24 - 20) - if (card.avatar.widthType === 'ratio' && card.avatar.display !== 'block') { + if (card.avatar.display !== 'block') { if (card.avatar.width < 90) { _flex = true } @@ -816,7 +803,7 @@ </div> <div style={{clear: 'both'}}></div> </div> - {plot.over !== 'roll' && data && data.length > 0 && + {data && data.length > 0 && data.map((item, i) => ( <CardCell key={i} @@ -836,7 +823,7 @@ /> )) } - {!loading && card.insertAction && plot.over !== 'roll' ? + {!loading && card.insertAction ? <CardCell key="insert" type="insert" @@ -851,42 +838,6 @@ switchCard={() => {}} refreshdata={this.props.refreshdata} /> : null - } - {plot.over === 'roll' && data && data.length > 0 ? - <Tabs activeKey=""> - {data.map((item, i) => ( - <TabPane tab={<CardCell - BID={BID} - Tab={Tab} - card={card} - data={item} - BData={BData} - MenuID={MenuID} - colMap={colMap} - selectKey={selectKey} - logcolumns={logcolumns} - setting={config.setting} - ContainerId={ContainerId} - switchCard={this.switchCard} - refreshdata={this.props.refreshdata} - />} key={i}></TabPane> - ))} - {!loading && card.insertAction ? - <TabPane tab={<CardCell - type="insert" - BID={BID} - Tab={Tab} - card={card} - data={{key: 'insert'}} - BData={BData} - MenuID={MenuID} - setting={config.setting} - ContainerId={ContainerId} - switchCard={() => {}} - refreshdata={this.props.refreshdata} - />} key="insert"></TabPane> : null - } - </Tabs> : null } {(loading || !card.insertAction) && (!data || data.length === 0) ? <Empty description={false}/> : null} <div className="clear"></div> diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index da89069..6ef7187 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -3,14 +3,21 @@ import md5 from 'md5' import { is, fromJS } from 'immutable' import {connect} from 'react-redux' -import { Table, message, Affix, Button, Typography, Modal, Icon } from 'antd' +import { Table, message, Affix, Typography, Modal, Icon } from 'antd' import Utils from '@/utils/utils.js' import { modifyTabview } from '@/store/action' +import asyncComponent from '@/utils/asyncComponent' +import MKEmitter from '@/utils/events.js' import '@/assets/css/table.scss' import './index.scss' const { Paragraph } = Typography + +const NormalButton = asyncComponent(() => import('@/tabviews/zshare/actionList/normalbutton')) +const PopupButton = asyncComponent(() => import('@/tabviews/zshare/actionList/popupbutton')) +const TabButton = asyncComponent(() => import('@/tabviews/zshare/actionList/tabbutton')) +const NewPageButton = asyncComponent(() => import('@/tabviews/zshare/actionList/newpagebutton')) class NormalTable extends Component { static defaultProps = { @@ -18,23 +25,26 @@ } static propTpyes = { - tableId: PropTypes.string, // 鍒楄〃Id - resetTable: PropTypes.bool, // 琛ㄦ牸閲嶇疆 - statFValue: PropTypes.any, // 鍚堣瀛楁鏁版嵁 - pageSize: PropTypes.any, // 姣忛〉鏁版嵁 - dict: PropTypes.object, // 瀛楀吀椤� - config: PropTypes.object, // 椤甸潰閰嶇疆 - MenuID: PropTypes.string, // 鑿滃崟Id - setting: PropTypes.object, // 琛ㄦ牸鍏ㄥ眬璁剧疆锛歵ableType锛堣〃鏍兼槸鍚﹀彲閫夈�佸崟閫夈�佸閫夛級銆乧olumnfixed锛堝垪鍥哄畾锛夈�乤ctionfixed锛堟寜閽浐瀹氾級 - pickup: PropTypes.any, // 鏁版嵁鏀惰捣 - columns: PropTypes.array, // 琛ㄦ牸鍒� - data: PropTypes.any, // 琛ㄦ牸鏁版嵁 - total: PropTypes.any, // 鎬绘暟 - loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� - refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� - buttonTrigger: PropTypes.func, // 琛ㄦ牸涓寜閽Е鍙戞搷浣� - handleTableId: PropTypes.func, // 鏁版嵁鍒囨崲 - chgSelectData: PropTypes.func, // 鏁版嵁鍒囨崲 + tableId: PropTypes.string, // 鍒楄〃Id + statFValue: PropTypes.any, // 鍚堣瀛楁鏁版嵁 + pageSize: PropTypes.any, // 姣忛〉鏁版嵁 + dict: PropTypes.object, // 瀛楀吀椤� + config: PropTypes.object, // 椤甸潰閰嶇疆 + MenuID: PropTypes.string, // 鑿滃崟Id + setting: PropTypes.object, // 琛ㄦ牸鍏ㄥ眬璁剧疆锛歵ableType锛堣〃鏍兼槸鍚﹀彲閫夈�佸崟閫夈�佸閫夛級銆乧olumnfixed锛堝垪鍥哄畾锛夈�乤ctionfixed锛堟寜閽浐瀹氾級 + pickup: PropTypes.any, // 鏁版嵁鏀惰捣 + columns: PropTypes.array, // 琛ㄦ牸鍒� + logcolumns: PropTypes.array, // 瀛楁鍒� + BID: PropTypes.any, // 涓昏〃Id + ContainerId: PropTypes.any, // 鏍囩椤靛灞侷d + BData: PropTypes.any, // 涓昏〃鏁版嵁 + data: PropTypes.any, // 琛ㄦ牸鏁版嵁 + total: PropTypes.any, // 鎬绘暟 + loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� + refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� + handleTableId: PropTypes.func, // 鏁版嵁鍒囨崲 + chgSelectData: PropTypes.func, // 鏁版嵁鍒囨崲 + refreshbyaction: PropTypes.func, // 鏁版嵁鍒囨崲 } state = { @@ -177,13 +187,8 @@ return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) } - /** - * @description 涓婄骇鑿滃崟id鍙樺寲鏃讹紝鍒锋柊鏁版嵁 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (this.props.resetTable !== nextProps.resetTable) { - this.resetTable() - } + componentDidMount () { + MKEmitter.addListener('resetTable', this.resetTable) } /** @@ -193,6 +198,7 @@ this.setState = () => { return } + MKEmitter.removeListener('resetTable', this.resetTable) } // 瀛楁閫忚 @@ -558,14 +564,57 @@ ) } else if (item.type === 'action') { return ( - <div className={item.style} style={{ minWidth: (item.Width || 120) + 'px' }}> + <div className="action-col" style={{ minWidth: (item.Width || 120) + 'px' }}> {item.operations.map(btn => { - return <Button - className={'mk-btn mk-' + btn.class} - icon={btn.icon} - key={btn.uuid} - onClick={(e) => {this.actionTrigger(e, btn, record)}} - >{btn.label}</Button> + if (['exec', 'prompt', 'pop'].includes(btn.OpenType)) { + return ( + <NormalButton + key={btn.uuid} + btn={btn} + BID={this.props.BID} + selectedData={[record]} + BData={this.props.BData} + setting={this.props.setting} + columns={this.props.logcolumns} + ContainerId={this.props.ContainerId} + updateStatus={this.props.refreshbyaction} + /> + ) + } else if (btn.OpenType === 'popview') { + return ( + <PopupButton + key={btn.uuid} + btn={btn} + BID={this.props.BID} + selectedData={[record]} + BData={this.props.BData} + setting={this.props.setting} + updateStatus={this.props.refreshbyaction} + /> + ) + } else if (btn.OpenType === 'tab' || btn.OpenType === 'blank') { + return ( + <TabButton + key={btn.uuid} + btn={btn} + selectedData={[record]} + MenuID={this.props.MenuID} + setting={this.props.setting} + updateStatus={this.props.refreshbyaction} + /> + ) + } else if (btn.OpenType === 'innerpage' || btn.OpenType === 'outerpage') { + return ( + <NewPageButton + key={btn.uuid} + btn={btn} + selectedData={[record]} + setting={this.props.setting} + updateStatus={this.props.refreshbyaction} + /> + ) + } + return null })} </div> ) @@ -816,11 +865,6 @@ } } - actionTrigger = (e, btn, record) => { - e.stopPropagation() - this.props.buttonTrigger(btn, record) - } - copycontent = (e, content) => { // 琛ㄦ牸涓唴瀹瑰鍒� e.stopPropagation() @@ -906,8 +950,6 @@ changedata = (index) => { const { data, setting } = this.props - if (!this.props.tableId) return - let _id = '' let _data = '' @@ -919,7 +961,11 @@ this.props.handleTableId(this.props.tableId, _id, _data) } - resetTable = () => { + resetTable = (id) => { + const { MenuID, tableId } = this.props + + if (id !== (MenuID + tableId)) return + this.setState({ pageIndex: 1, selectedRowKeys: [], diff --git a/src/tabviews/zshare/normalTable/index.scss b/src/tabviews/zshare/normalTable/index.scss index df773ab..7c068cf 100644 --- a/src/tabviews/zshare/normalTable/index.scss +++ b/src/tabviews/zshare/normalTable/index.scss @@ -129,7 +129,7 @@ cursor: zoom-in; } } - .text { + .action-col { .ant-btn > .anticon + span { margin-left: 3px; } @@ -139,12 +139,18 @@ color: #1890ff; box-shadow: none; padding: 0 5px; - margin: 0px 5px; + .anticon-loading { + display: none; + } } - } - .button { - button { - margin: 0px 5px; + > div { + margin: 0 3px; + } + > button { + margin: 0 3px; + } + .ant-btn.ant-btn-loading:not(.ant-btn-circle):not(.ant-btn-circle-outline):not(.ant-btn-icon-only) { + padding-left: 0px; } } } diff --git a/src/templates/modalconfig/index.scss b/src/templates/modalconfig/index.scss index 6e91986..b7f0633 100644 --- a/src/templates/modalconfig/index.scss +++ b/src/templates/modalconfig/index.scss @@ -277,7 +277,7 @@ } } } - .setting:hover { + .setting { overflow-y: auto; } .setting::-webkit-scrollbar { diff --git a/src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx b/src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx index 1f6fb2b..2601a4b 100644 --- a/src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx +++ b/src/templates/sharecomponent/cardcomponent/carddetailform/index.jsx @@ -46,8 +46,6 @@ item.hidden = true } else if (item.key === 'field' && card.elemType === 'avatar') { item.options = columns.filter(option => option.type === card.type) - } else if (item.key === 'widthType' && card.elemType === 'avatar' && card.type === 'picture') { - item.hidden = false } else if (item.key === 'size' && card.elemType === 'avatar' && card.type === 'icon') { item.hidden = false } else if (item.key === 'width' && card.elemType === 'avatar' && card.type === 'picture') { @@ -61,7 +59,6 @@ } typeChange = (key, value) => { - const { card } = this.props const { columns, oriformlist } = this.state if (key === 'datatype') { @@ -82,11 +79,8 @@ formlist: oriformlist.map(item => { if (item.key === 'field') { item.options = columns.filter(option => option.type === value) - } else if (item.key === 'widthType') { - item.hidden = value !== 'picture' } else if (item.key === 'width') { item.hidden = value !== 'picture' - item.max = card.widthType === 'ratio' ? 100 : 500 } else if (item.key === 'size') { item.hidden = value !== 'icon' } else if (item.key === 'radius') { @@ -98,20 +92,6 @@ }, () => { if (this.props.form.getFieldValue('field') !== undefined) { this.props.form.setFieldsValue({field: ''}) - } - }) - } else if (key === 'widthType') { - this.setState({ - formlist: oriformlist.map(item => { - if (item.key === 'width') { - item.max = value === 'ratio' ? 100 : 500 - } - - return item - }) - }, () => { - if (this.props.form.getFieldValue('width') !== undefined) { - this.props.form.setFieldsValue({width: 32}) } }) } @@ -287,11 +267,7 @@ values.icon = column.icon values.color = column.color - values.avatarWidth = values.size - } else if (values.widthType === 'absolute') { - values.avatarWidth = values.width - } else { - values.avatarWidth = values.width + '%' + values.width = values.size } } diff --git a/src/templates/sharecomponent/cardcomponent/index.jsx b/src/templates/sharecomponent/cardcomponent/index.jsx index eb6002a..4e4dd82 100644 --- a/src/templates/sharecomponent/cardcomponent/index.jsx +++ b/src/templates/sharecomponent/cardcomponent/index.jsx @@ -211,7 +211,7 @@ this.setState({ cardcell: _cell, modaltype: 'avatar', - formlist: getCardDetailForm(_cell, _columns, 'avatar', [], card.widthType === 'ratio') + formlist: getCardDetailForm(_cell, _columns, 'avatar', []) }) } @@ -335,7 +335,16 @@ if (card.bottom && card.bottom.actions.length > 0) { _width = Math.floor((100 / card.bottom.actions.length) * 10000) / 10000 + '%' } - let outclass = card.widthType === 'ratio' ? ' ant-col ant-col-' + card.cardWidth : '' + + if (card.widthType === 'absolute') { + card.cardWidth = 6 + } + if (card.avatar && card.avatar.widthType === 'absolute') { + card.avatar.width = 32 + } + + let outclass = 'ant-col-' + card.cardWidth + if (card.background) { outclass += ' background ' + card.background } @@ -347,23 +356,13 @@ let metastyle = {} if (card.subelement.includes('avatar')) { - let _cardWidth = card.cardWidth - // 璁$畻鍗$墖瀹藉害 - if (card.widthType === 'ratio' && card.over !== 'roll') { - let _outWidth = document.body.offsetWidth - 260 - _cardWidth = Math.floor(_outWidth * card.cardWidth / 24 - 20) - } + let _outWidth = document.body.offsetWidth - 260 + let _cardWidth = Math.floor(_outWidth * card.cardWidth / 24 - 20) if (card.avatar.type === 'picture') { - if (card.avatar.widthType === 'ratio') { - if (card.avatar.width < 90 && card.avatar.display !== 'block') { - metastyle.display = 'flex' - } - } else { - if (card.avatar.width < _cardWidth * 0.9 && card.avatar.display !== 'block') { - metastyle.display = 'flex' - } + if (card.avatar.width < 90 && card.avatar.display !== 'block') { + metastyle.display = 'flex' } } else { if (card.avatar.size < _cardWidth * 0.9 && card.avatar.display !== 'block') { @@ -377,8 +376,7 @@ {card.title ? <p className="chart-title">{card.title}</p> : null} <div ref={(ref) => this.cardRef = ref} - className={'ant-card chart-card ' + outclass} - style={card.widthType === 'absolute' ? { width: card.cardWidth } : null} + className={'ant-card chart-card ant-col ' + outclass} > {card.subelement.includes('header') ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ @@ -412,7 +410,7 @@ <Icon className="close" title="close" type="close" onClick={() => this.deleteElem('avatar')} /> </div> } trigger="hover"> - <div className="ant-card-meta-avatar" style={{width: card.avatar.avatarWidth || 32, paddingTop: card.avatar.avatarWidth || 32}}> + <div className="ant-card-meta-avatar" style={card.avatar.type === 'icon' ? {width: card.avatar.width, paddingTop: card.avatar.width} : {width: card.avatar.width + '%', paddingTop: card.avatar.width + '%'}}> <span className="ant-avatar ant-avatar-circle ant-avatar-image" style={{borderRadius: card.avatar.radius === 'true' ? '50%' : 0}}> {card.avatar.type === 'picture' ? <img src={avatar} alt=""/> : null} {card.avatar.type === 'icon' ? <Icon className={'font ' + card.avatar.color} style={{fontSize: card.avatar.size + 'px'}} type={card.avatar.icon} /> : null} @@ -449,7 +447,7 @@ } </div> {card.extraAction ? - <div className={'ant-card chart-card chart-card-insert' + outclass} style={{ width: cardwidth, height: cardheight }} > + <div className={'ant-card chart-card chart-card-insert ' + outclass} style={{ width: cardwidth, height: cardheight }} > <Icon type="plus" style={cardwidth > cardheight ? {fontSize: cardheight / 2 + 'px', lineHeight: cardheight + 'px'} : {fontSize: cardwidth / 2 + 'px', lineHeight: cardheight + 'px'}} /> </div> : null } diff --git a/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx b/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx index 86be460..35b8a6a 100644 --- a/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx +++ b/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx @@ -214,11 +214,7 @@ item.hidden = true } else if (item.key === 'height' && ['table', 'card'].includes(_type)) { item.hidden = true - } else if (item.key === 'widthType' && _type === 'card') { - item.hidden = false } else if (item.key === 'cardWidth' && _type === 'card') { - item.hidden = false - } else if (item.key === 'over' && _type === 'card') { item.hidden = false } else if (item.key === 'border' && _type === 'card') { item.hidden = false @@ -256,7 +252,6 @@ } typeChange = (key, value) => { - const { card } = this.props let formlist = JSON.parse(JSON.stringify(this.props.formlist)) if (key === 'chartType') { @@ -268,13 +263,7 @@ item.hidden = true } else if (item.key === 'height' && ['table', 'card'].includes(value)) { item.hidden = true - } else if (item.key === 'widthType' && value === 'card') { - item.hidden = false } else if (item.key === 'cardWidth' && value === 'card') { - item.min = card.widthType === 'absolute' ? 50 : 1 - item.max = card.widthType === 'absolute' ? 1000 : 24 - item.hidden = false - } else if (item.key === 'over' && value === 'card') { item.hidden = false } else if (item.key === 'border' && value === 'card') { item.hidden = false @@ -285,54 +274,6 @@ } else if (item.key === 'bgfield') { item.hidden = value !== 'card' } - return item - }) - }) - } - } - - radioChange = (val, key) => { - const { formlist } = this.state - - if (key === 'widthType') { - this.setState({ - formlist: formlist.map(item => { - if (item.key === 'cardWidth') { - item.min = val === 'absolute' ? 50 : 1 - item.max = val === 'absolute' ? 1000 : 24 - } - - return item - }) - }) - if (val === 'absolute') { - this.props.form.setFieldsValue({cardWidth: 250}) - } else { - this.props.form.setFieldsValue({cardWidth: 6}) - } - } else if (key === 'over' && val === 'roll') { - this.setState({ - formlist: formlist.map(item => { - if (item.key === 'cardWidth') { - item.min = 50 - item.max = 1000 - } else if (item.key === 'widthType') { - item.readonly = true - } - - return item - }) - }) - if (this.props.form.getFieldValue('widthType') !== undefined) { - this.props.form.setFieldsValue({widthType: 'absolute', cardWidth: 250}) - } - } else if (key === 'over' && val === 'whole') { - this.setState({ - formlist: formlist.map(item => { - if (item.key === 'widthType') { - item.readonly = false - } - return item }) }) @@ -451,7 +392,7 @@ } ] })( - <Radio.Group onChange={(e) => this.radioChange(e.target.value, item.key)} disabled={item.readonly}> + <Radio.Group disabled={item.readonly}> { item.options.map(option => { return ( @@ -529,11 +470,6 @@ result.subelement = selectlegend.subelement } - if (result.widthType === 'ratio' && result.avatar && result.avatar.widthType !== 'ratio') { - result.avatar.widthType = 'ratio' - result.avatar.width = 32 - } - if (!result.details) { result.details = [ {elemType: 'detail', fontWeight: 'normal', fontSize: 14, width: 100, height: 1, uuid: 'cardtitle', content: 'Card content', datatype: 'static', align: 'left'}, @@ -557,9 +493,7 @@ type: 'picture', field: '', size: 14, - widthType: 'ratio', width: 32, - avatarWidth: 32, radius: 'true', display: 'inline' } diff --git a/src/templates/sharecomponent/chartgroupcomponent/index.jsx b/src/templates/sharecomponent/chartgroupcomponent/index.jsx index 647e706..6b25913 100644 --- a/src/templates/sharecomponent/chartgroupcomponent/index.jsx +++ b/src/templates/sharecomponent/chartgroupcomponent/index.jsx @@ -141,7 +141,7 @@ let extraActions = config.action.filter(item => ['pop', 'prompt', 'exec'].includes(item.OpenType) && item.Ot === 'notRequired') extraActions = extraActions.map(cell => ({value: cell.uuid, text: cell.label})) - if (item.extraAction && extraActions.filter(cell => cell.uuid === item.extraAction).length === 0) { + if (item.extraAction && extraActions.filter(cell => cell.value === item.extraAction).length === 0) { item.extraAction = '' } diff --git a/src/templates/sharecomponent/columncomponent/gridbtnform/index.jsx b/src/templates/sharecomponent/columncomponent/gridbtnform/index.jsx index 33eaeb7..ccbb363 100644 --- a/src/templates/sharecomponent/columncomponent/gridbtnform/index.jsx +++ b/src/templates/sharecomponent/columncomponent/gridbtnform/index.jsx @@ -45,34 +45,34 @@ initVal: this.props.card.Width, required: true }, - { - type: 'select', - key: 'style', - label: this.props.dict['model.form.style'], - initVal: this.props.card.style, - required: true, - options: [{ - MenuID: 'button', - text: this.props.dict['header.form.button'] - }, { - MenuID: 'text', - text: this.props.dict['model.form.href'] - }] - }, - { - type: 'select', - key: 'show', - label: this.props.dict['header.form.order'], - initVal: this.props.card.show, - required: true, - options: [{ - MenuID: 'horizontal', - text: this.props.dict['header.form.horizontal'] - }, { - MenuID: 'vertical', - text: this.props.dict['header.form.vertical'] - }] - } + // { + // type: 'select', + // key: 'style', + // label: this.props.dict['model.form.style'], + // initVal: this.props.card.style, + // required: true, + // options: [{ + // MenuID: 'button', + // text: this.props.dict['header.form.button'] + // }, { + // MenuID: 'text', + // text: this.props.dict['model.form.href'] + // }] + // }, + // { + // type: 'select', + // key: 'show', + // label: this.props.dict['header.form.order'], + // initVal: this.props.card.show, + // required: true, + // options: [{ + // MenuID: 'horizontal', + // text: this.props.dict['header.form.horizontal'] + // }, { + // MenuID: 'vertical', + // text: this.props.dict['header.form.vertical'] + // }] + // } ] } diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx index ae982f5..03249cb 100644 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx @@ -149,6 +149,7 @@ }) }, () => { // 楠岃瘉澶辫触 this.setState({ + activeKey: val, loading: false }) }, activeKey) @@ -197,6 +198,7 @@ }) }, () => { // 楠岃瘉澶辫触 this.setState({ + activeKey: val, loading: false }) }, activeKey) diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx index 3012249..73fff8f 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx @@ -325,6 +325,7 @@ }) }, () => { // 楠岃瘉澶辫触 this.setState({ + activeKey: val, loading: false }) }, activeKey) @@ -355,6 +356,7 @@ }) }, () => { // 楠岃瘉澶辫触 this.setState({ + activeKey: val, loading: false }) }, activeKey) diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx index b95ee0c..0de743e 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx @@ -181,6 +181,7 @@ }) }, () => { // 楠岃瘉澶辫触 this.setState({ + activeKey: val, loading: false }) }, activeKey) @@ -210,6 +211,7 @@ }) }, () => { // 楠岃瘉澶辫触 this.setState({ + activeKey: val, loading: false }) }, activeKey) diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 911b47b..8ec08e5 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1361,44 +1361,13 @@ required: true }, { - type: 'radio', - key: 'over', - label: '瓒呭嚭鏃�', - initVal: card.over || 'whole', - required: true, - hidden: true, - options: [{ - value: 'whole', - text: '灞曠ず鍏ㄩ儴' - }, { - value: 'roll', - text: '婊氬姩' - }] - }, - { - type: 'radio', - key: 'widthType', - label: '瀹藉害璁剧疆', - initVal: card.over === 'roll' ? 'absolute' : card.widthType || 'ratio', - required: true, - hidden: true, - readonly: card.over === 'roll', - options: [{ - value: 'ratio', - text: '姣斾緥' - }, { - value: 'absolute', - text: '缁濆鍊�' - }] - }, - { type: 'number', key: 'cardWidth', - min: card.widthType === 'absolute' ? 50 : 1, - max: card.widthType === 'absolute' ? 1000 : 24, + min: 1, + max: 24, decimal: 0, label: '鍗$墖瀹藉害', - tooltip: '绫诲瀷涓烘瘮渚嬫椂锛屾爡鏍煎竷灞�锛屾瘡琛岀瓑鍒嗕负24鍒楋紱绫诲瀷涓虹粷瀵瑰�硷紝鑼冨洿50-1000銆�', + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', initVal: card.cardWidth || 6, hidden: true, required: true @@ -2421,9 +2390,8 @@ * @param {array} _columns // 鏄剧ず鍒� * @param {string} _type // 绫诲瀷锛屽崱鐗囩殑閮ㄤ綅 * @param {array} _actions // 鎸夐挳鍒楄〃 - * @param {boolean} isRatioCard // 琛ㄦ牸瀹藉害绫诲瀷锛屾槸鍚︿负姣斾緥 */ -export function getCardDetailForm (card, _columns, _type, _actions = [], isRatioCard) { +export function getCardDetailForm (card, _columns, _type, _actions = []) { let actions = '' if (_type === 'bottom') { actions = card.actions ? card.actions.map(cell => cell.value) : [] @@ -2549,7 +2517,7 @@ label: '瀹藉害(%)', initVal: card.width || 100, required: true, - forbid: !['detail'].includes(_type) + forbid: !['detail', 'avatar'].includes(_type) }, { type: 'number', @@ -2560,34 +2528,6 @@ initVal: card.height || 1, required: true, forbid: !['detail'].includes(_type) - }, - { - type: 'radio', - key: 'widthType', - label: '瀹藉害璁剧疆', - initVal: card.widthType || 'ratio', - required: false, - forbid: !['avatar'].includes(_type), - hidden: true, - readonly: !!isRatioCard, - options: [{ - value: 'ratio', - text: '姣斾緥' - }, { - value: 'absolute', - text: '缁濆鍊�' - }] - }, - { - type: 'number', - key: 'width', - label: '瀹藉害鍊�', - initVal: card.width || 32, - min: 1, - max: card.widthType === 'ratio' ? 100 : 500, - required: false, - hidden: true, - forbid: !['avatar'].includes(_type) }, { type: 'radio', diff --git a/src/utils/utils-update.js b/src/utils/utils-update.js index 7f91eab..eb738e5 100644 --- a/src/utils/utils-update.js +++ b/src/utils/utils-update.js @@ -52,11 +52,6 @@ return _cell }) - - if (card.widthType === 'ratio' && card.avatar && card.avatar.widthType !== 'ratio') { - card.avatar.widthType = 'ratio' - card.avatar.width = 32 - } } }) } @@ -126,11 +121,6 @@ return _cell }) - - if (card.widthType === 'ratio' && card.avatar && card.avatar.widthType !== 'ratio') { - card.avatar.widthType = 'ratio' - card.avatar.width = 32 - } } }) } -- Gitblit v1.8.0