From f38b3321250222b81a797a538d9c3efa9f8a0ecb Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 29 五月 2022 03:54:05 +0800 Subject: [PATCH] 2022-05-29 --- src/tabviews/custom/components/form/tab-form/index.jsx | 1 src/tabviews/custom/components/card/cardcellList/index.jsx | 36 - src/tabviews/zshare/actionList/tabbutton/index.jsx | 72 ++-- src/tabviews/verupmanage/actionList/index.jsx | 35 + src/tabviews/zshare/actionList/popupbutton/index.jsx | 37 +- src/tabviews/verupmanage/subtabtable/index.jsx | 1 src/templates/zshare/formconfig.jsx | 14 src/menu/components/share/actioncomponent/formconfig.jsx | 15 src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 6 src/templates/sharecomponent/cardcomponent/index.scss | 1 src/tabviews/verupmanage/config.jsx | 4 src/tabviews/zshare/actionList/funcMegvii/index.jsx | 103 +++--- src/tabviews/custom/components/form/normal-form/index.jsx | 1 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 78 ++-- src/tabviews/zshare/actionList/printbutton/index.jsx | 81 ++-- src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 75 ++-- src/menu/components/share/actioncomponent/actionform/index.jsx | 6 src/tabviews/zshare/actionList/newpagebutton/index.jsx | 72 ++-- src/tabviews/zshare/actionList/normalbutton/index.jsx | 154 +++++---- src/tabviews/verupmanage/index.jsx | 2 src/tabviews/zshare/cardcomponent/index.jsx | 37 + src/tabviews/zshare/actionList/changeuserbutton/index.jsx | 75 ++-- src/assets/css/main.scss | 17 + 23 files changed, 482 insertions(+), 441 deletions(-) diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index f7c2e2b..a6d7923 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -469,4 +469,21 @@ display: none; } } +} +.mk-button-progress { + position: fixed!important; + top: 0px; + left: 0px; + z-index: 1100; + width: 100vw!important; + .ant-progress-outer { + .ant-progress-inner { + vertical-align: top; + background-color: transparent; + .ant-progress-bg { + height: 4px!important; + background-color: var(--antd-wave-shadow-color); + } + } + } } \ No newline at end of file diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index dc8f3c3..6f0cfbc 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -189,6 +189,10 @@ shows.push('sql', 'sqlType', 'output') } + if (Ot === 'required') { + shows.push('progress') + } + if (this.record.sqlType === 'insert') { reOptions.Ot = requireOptions.filter(op => op.value === 'notRequired') } else { @@ -347,7 +351,7 @@ } else if (_funcType === 'goBack') { shows.push('reload') } else if (_funcType === 'megvii') { - shows.push('subFunc') + shows.push('subFunc', 'progress') } } diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 24fc03c..ef17d57 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -914,6 +914,21 @@ value: 'true', text: '鏄�' }] + }, + { + type: 'radio', + key: 'progress', + label: '杩涘害鎻愮ず', + initVal: card.progress || 'number', + required: false, + forbid: appType === 'mob', + options: [{ + value: 'number', + text: '鍓╀綑鏁�' + }, { + value: 'progressbar', + text: '杩涘害鏉�' + }] } ] diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index fc8c2b3..560d562 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -759,12 +759,10 @@ return ( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <NormalButton + btn={card} BID={data.$$BID} BData={data.$$BData || ''} disabled={_disabled} - btn={card} - show={card.show} - style={card.style} setting={cards.setting} columns={cards.columns} selectedData={_data} @@ -775,12 +773,10 @@ return ( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <ExcelInButton + btn={card} BID={data.$$BID} BData={data.$$BData || ''} disabled={_disabled} - btn={card} - show={card.show} - style={card.style} setting={cards.setting} selectedData={_data} /> @@ -790,12 +786,10 @@ return ( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <ExcelOutButton + btn={card} BID={data.$$BID} BData={data.$$BData || ''} disabled={_disabled} - btn={card} - show={card.show} - style={card.style} setting={cards.setting} selectedData={_data} /> @@ -805,12 +799,10 @@ return ( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <PopupButton + btn={card} BID={data.$$BID} BData={data.$$BData || ''} disabled={_disabled} - btn={card} - show={card.show} - style={card.style} setting={cards.setting} selectedData={_data} /> @@ -820,11 +812,9 @@ return ( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <TabButton + btn={card} BData={data.$$BData || ''} disabled={_disabled} - btn={card} - show={card.show} - style={card.style} setting={cards.setting} selectedData={_data} /> @@ -834,11 +824,9 @@ return ( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <NewPageButton + btn={card} BData={data.$$BData || ''} disabled={_disabled} - btn={card} - show={card.show} - style={card.style} setting={cards.setting} selectedData={_data} /> @@ -849,12 +837,10 @@ return ( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <ChangeUserButton + btn={card} BID={data.$$BID} BData={data.$$BData || ''} disabled={_disabled} - btn={card} - show={card.show} - style={card.style} setting={cards.setting} selectedData={_data} /> @@ -864,12 +850,10 @@ return ( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <PrintButton + btn={card} BID={data.$$BID} BData={data.$$BData || ''} disabled={_disabled} - btn={card} - show={card.show} - style={card.style} setting={cards.setting} selectedData={_data} /> @@ -879,11 +863,9 @@ return ( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <FuncMegvii + btn={card} BID={data.$$BID} disabled={_disabled} - btn={card} - show={card.show} - style={card.style} setting={cards.setting} selectedData={_data} /> diff --git a/src/tabviews/custom/components/form/normal-form/index.jsx b/src/tabviews/custom/components/form/normal-form/index.jsx index a8ad272..9f935b5 100644 --- a/src/tabviews/custom/components/form/normal-form/index.jsx +++ b/src/tabviews/custom/components/form/normal-form/index.jsx @@ -388,7 +388,6 @@ {group.sort !== 1 && group.prevButton.enable !== 'false' ? <Button type="link" className="prev" onClick={this.prevStep} style={group.prevButton.style}>{group.prevButton.label}</Button> : null} <NormalButton BID={BID} - position="form" btn={group.subButton} setting={config.setting} columns={config.columns} diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index de65619..8856ad9 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -332,7 +332,6 @@ {group && data ? <div className={'mk-form-action ' + (group.$button || '')}> <NormalButton BID={BID} - position="form" btn={group.subButton} setting={config.setting} columns={config.columns} diff --git a/src/tabviews/verupmanage/actionList/index.jsx b/src/tabviews/verupmanage/actionList/index.jsx index 23dd7ef..bc8e863 100644 --- a/src/tabviews/verupmanage/actionList/index.jsx +++ b/src/tabviews/verupmanage/actionList/index.jsx @@ -37,7 +37,7 @@ execAction: null, loadingUuid: '', configMap: {}, - loadingNumber: '' + loadingNumber: '', } refreshdata = (item, type) => { @@ -341,6 +341,11 @@ _resolve() }) } else { // 瓒呭嚭20涓姹傛椂寰幆鎵ц + if (btn.progress === 'progressbar') { + this.setState({ + loadingTotal: _params.length + }) + } this.innerLoopRequest(_params, btn, _resolve) } } @@ -399,8 +404,14 @@ }) } + if (_params.length > 1 && btn.progress === 'progressbar') { + this.setState({ + loadingTotal: _params.length + }) + } + // 寰幆璋冪敤澶栭儴鎺ュ彛锛堝寘鎷唴閮ㄥ強鍥炶皟鍑芥暟锛� - this.outerLoopRequest(_params, btn, _resolve, _params.length > 20) + this.outerLoopRequest(_params, btn, _resolve) } } @@ -413,7 +424,7 @@ let param = params.shift() this.setState({ - loadingNumber: params.length || '' + loadingNumber: params.length }) Api.genericInterface(param).then(res => { @@ -434,7 +445,7 @@ /** * @description 澶栭儴璇锋眰寰幆鎵ц */ - outerLoopRequest = (params, btn, _resolve, widthNumber) => { + outerLoopRequest = (params, btn, _resolve) => { if (!params && params.length === 0) return let param = params.shift() @@ -442,11 +453,9 @@ let _localParam = null let errRes = null - if (widthNumber) { - this.setState({ - loadingNumber: params.length || '' - }) - } + this.setState({ + loadingNumber: params.length + }) new Promise(resolve => { // 鍐呴儴璇锋眰 @@ -535,7 +544,7 @@ this.execSuccess(btn, response) _resolve() } else { - this.outerLoopRequest(params, btn, _resolve, widthNumber) + this.outerLoopRequest(params, btn, _resolve) } } else { this.execError(response, btn) @@ -555,7 +564,7 @@ this.execSuccess(btn, res) _resolve() } else { - this.outerLoopRequest(params, btn, _resolve, widthNumber) + this.outerLoopRequest(params, btn, _resolve) } } else { this.execError(res, btn) @@ -569,7 +578,7 @@ this.execSuccess(btn, res) _resolve() } else { - this.outerLoopRequest(params, btn, _resolve, widthNumber) + this.outerLoopRequest(params, btn, _resolve) } } else { this.execError(errRes || res, btn) @@ -795,7 +804,7 @@ <div className="verup-button-list verup-toolbar-button"> {this.props.actions.map((item, index) => { let label = item.label - if (loadingUuid === item.uuid && loadingNumber !== '') { + if (loadingUuid === item.uuid && loadingNumber) { label = label + '(' + loadingNumber + ')' } return ( diff --git a/src/tabviews/verupmanage/config.jsx b/src/tabviews/verupmanage/config.jsx index 01817ef..527dcec 100644 --- a/src/tabviews/verupmanage/config.jsx +++ b/src/tabviews/verupmanage/config.jsx @@ -102,8 +102,8 @@ {label:'缁煎悎鏌ヨ',field:'Remark,KeyWords,TypeName',type:'text',initval:'', oriInitval: '', required: false,match:'like','ratio':6,uuid:'1583983588787acl55md59fu9kpb52db'} ], action:[ - {label:'鎵ц',OpenType:'pop',intertype:'outer',innerFunc:'',sysInterface:'true',outerFunc:'s_get_sVersionDetail_Ltext',interface:'http://cloud.mk9h.cn/webapi/dostars',callbackFunc:'s_sDataDictb_TBBack',position:'toolbar',$toolbtn: true,execSuccess:'grid',execError:'never',icon:'',class:'primary',Ot:'required',uuid:'1583983849299g1qfd28g3c9n9e0e57a',verify:null}, - {label:'鍏抽棴',OpenType:'prompt',intertype:'inner',innerFunc:'',position:'toolbar',$toolbtn: true,Ot:'required',execSuccess:'grid',execError:'never',icon:'',class:'border-danger',sql:'sVersionDetail_Local',sqlType:'LogicDelete',uuid:'1583984089282i4i140hacimbki9s5gh', + {label:'鎵ц',OpenType:'pop',intertype:'outer',innerFunc:'',sysInterface:'true',outerFunc:'s_get_sVersionDetail_Ltext',interface:'http://cloud.mk9h.cn/webapi/dostars',callbackFunc:'s_sDataDictb_TBBack',position:'toolbar',$toolbtn: true,execSuccess:'grid',execError:'never',icon:'',class:'primary',Ot:'required',progress: 'progressbar',uuid:'1583983849299g1qfd28g3c9n9e0e57a',verify:null}, + {label:'鍏抽棴',OpenType:'prompt',intertype:'inner',innerFunc:'',position:'toolbar',$toolbtn: true,Ot:'required',progress: 'progressbar',execSuccess:'grid',execError:'never',icon:'',class:'border-danger',sql:'sVersionDetail_Local',sqlType:'LogicDelete',uuid:'1583984089282i4i140hacimbki9s5gh', verify:{ default: 'true', invalid: 'true', diff --git a/src/tabviews/verupmanage/index.jsx b/src/tabviews/verupmanage/index.jsx index fe65a69..22e5b42 100644 --- a/src/tabviews/verupmanage/index.jsx +++ b/src/tabviews/verupmanage/index.jsx @@ -110,6 +110,8 @@ if (buttonConfig[item.uuid]) { item = {...buttonConfig[item.uuid], ...item} } + item.$toolbtn = true + return item }), columns: _columns, diff --git a/src/tabviews/verupmanage/subtabtable/index.jsx b/src/tabviews/verupmanage/subtabtable/index.jsx index a64b977..ae15cff 100644 --- a/src/tabviews/verupmanage/subtabtable/index.jsx +++ b/src/tabviews/verupmanage/subtabtable/index.jsx @@ -128,6 +128,7 @@ if (buttonConfig[item.uuid]) { item = {...buttonConfig[item.uuid], ...item} } + item.$toolbtn = true return item }), columns: _columns, diff --git a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx index 3a4b948..2bddb9a 100644 --- a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx +++ b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx @@ -14,7 +14,6 @@ class NewPageButton extends Component { static propTpyes = { - show: PropTypes.any, // 鎸夐挳鏄剧ず鏍峰紡鎺у埗 MenuID: PropTypes.any, // 鑿滃崟ID BData: PropTypes.any, // 涓昏〃鏁版嵁 BID: PropTypes.string, // 涓昏〃ID @@ -227,51 +226,47 @@ } render() { - const { btn, show } = this.props + const { btn } = this.props const { loading, disabled, hidden } = this.state if (hidden) return null - if (show === 'actionList') { - return ( - <Button - icon={btn.icon} - loading={loading} - disabled={disabled} - title={disabled ? (btn.reason || '') : ''} - className={'mk-btn mk-' + btn.class} - onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} - >{btn.label}</Button> - ) - } else { // icon銆乼ext銆� all 鍗$墖 - let label = '' - let icon = '' + let label = '' + let icon = '' + let type = 'link' + let className = '' - if (show === 'button') { - label = btn.label - icon = btn.icon || '' - } else if (show === 'link') { - label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> - icon = '' - } else if (show === 'icon') { - icon = btn.icon || '' - // } else if (show === 'text') { - } else { - label = btn.label - } - - return ( - <Button - type="link" - title={disabled ? (btn.reason || '') : (show === 'icon' ? btn.label : '')} - loading={loading} - disabled={disabled} - style={btn.style} - icon={icon} - onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} - >{label}</Button> - ) + if (btn.show === 'button') { + label = btn.label + icon = btn.icon || '' + } else if (btn.show === 'link') { + label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> + icon = '' + } else if (btn.show === 'icon') { + icon = btn.icon || '' + } else if (!btn.$toolbtn) { + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } else { + type = '' + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class } + + return ( + <Button + type={type} + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} + loading={loading} + disabled={disabled} + style={btn.style} + icon={icon} + className={className} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{label}</Button> + ) } } diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index a662de9..d6b1ab0 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -17,7 +17,6 @@ class ExcelInButton extends Component { static propTpyes = { - show: PropTypes.any, // 鏄剧ず鏍峰紡 BID: PropTypes.string, // 涓昏〃ID BData: PropTypes.any, // 涓昏〃鏁版嵁 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 @@ -477,53 +476,48 @@ } render() { - const { btn, show } = this.props + const { btn } = this.props const { loading, disabled, hidden } = this.state if (hidden) return null - if (show === 'actionList') { - return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> - <Button - icon={btn.icon} - loading={loading} - disabled={disabled} - title={disabled ? (btn.reason || '') : ''} - className={'mk-btn mk-' + btn.class} - onClick={() => {this.actionTrigger()}} - >{btn.label}</Button> - <ExcelIn btn={btn} triggerExcelIn={() => this.setState({ loading: true })} returndata={this.getexceldata} ref="excelIn" /> - </div> - } else { // icon銆乼ext銆� all 鍗$墖 - let label = '' - let icon = '' + let label = '' + let icon = '' + let type = 'link' + let className = '' - if (show === 'button') { - label = btn.label - icon = btn.icon || '' - } else if (show === 'link') { - label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> - icon = '' - } else if (show === 'icon') { - icon = btn.icon || 'upload' - // } else if (show === 'text') { - } else { - label = btn.label - } - - return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> - <Button - type="link" - title={disabled ? (btn.reason || '') : (show === 'icon' ? btn.label : '')} - loading={loading} - disabled={disabled} - style={btn.style} - icon={icon} - onClick={() => {this.actionTrigger()}} - >{label}</Button> - <ExcelIn btn={btn} triggerExcelIn={() => this.setState({ loading: true })} returndata={this.getexceldata} ref="excelIn" /> - </div> + if (btn.show === 'button') { + label = btn.label + icon = btn.icon || '' + } else if (btn.show === 'link') { + label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> + icon = '' + } else if (btn.show === 'icon') { + icon = btn.icon || 'upload' + } else if (!btn.$toolbtn) { + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } else { + type = '' + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class } + + return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> + <Button + type={type} + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} + loading={loading} + disabled={disabled} + style={btn.style} + icon={icon} + className={className} + onClick={() => {this.actionTrigger()}} + >{label}</Button> + <ExcelIn btn={btn} triggerExcelIn={() => this.setState({ loading: true })} returndata={this.getexceldata} ref="excelIn" /> + </div> } } diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 8d81265..c9dca42 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -19,7 +19,6 @@ static propTpyes = { BID: PropTypes.string, // 涓昏〃ID BData: PropTypes.any, // 涓昏〃鏁版嵁 - show: PropTypes.any, // 鏄剧ず鏍峰紡 Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 @@ -977,51 +976,47 @@ } render() { - const { btn, show } = this.props + const { btn } = this.props const { loading, hidden, disabled } = this.state if (hidden) return null - if (show === 'actionList') { - return ( - <Button - className={'mk-btn mk-' + btn.class} - icon={btn.icon} - disabled={disabled} - title={disabled ? (btn.reason || '') : ''} - onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} - loading={loading} - >{btn.label}</Button> - ) - } else { // icon銆乼ext銆� all 鍗$墖 - let label = '' - let icon = '' + let label = '' + let icon = '' + let type = 'link' + let className = '' - if (show === 'button') { - label = btn.label - icon = btn.icon || '' - } else if (show === 'link') { - label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> - icon = '' - } else if (show === 'icon') { - icon = btn.icon || 'download' - // } else if (show === 'text') { - } else { - label = btn.label - } - - return ( - <Button - type="link" - title={disabled ? (btn.reason || '') : (show === 'icon' ? btn.label : '')} - loading={loading} - disabled={disabled} - style={btn.style} - icon={icon} - onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} - >{label}</Button> - ) + if (btn.show === 'button') { + label = btn.label + icon = btn.icon || '' + } else if (btn.show === 'link') { + label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> + icon = '' + } else if (btn.show === 'icon') { + icon = btn.icon || 'download' + } else if (!btn.$toolbtn) { + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } else { + type = '' + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class } + + return ( + <Button + type={type} + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} + loading={loading} + disabled={disabled} + style={btn.style || null} + icon={icon} + className={className} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{label}</Button> + ) } } diff --git a/src/tabviews/zshare/actionList/funcMegvii/index.jsx b/src/tabviews/zshare/actionList/funcMegvii/index.jsx index 943ab8a..887a625 100644 --- a/src/tabviews/zshare/actionList/funcMegvii/index.jsx +++ b/src/tabviews/zshare/actionList/funcMegvii/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { withRouter } from 'react-router' import { is, fromJS } from 'immutable' -import { Button, Modal, notification, message } from 'antd' +import { Button, Modal, notification, message, Progress } from 'antd' import CryptoJS from 'crypto-js' import moment from 'moment' @@ -26,6 +26,7 @@ loading: false, disabled: false, loadingNumber: '', + loadingTotal: '', hidden: false, IpList: [], lines: [], @@ -188,6 +189,7 @@ } loginDevice = () => { + const { btn } = this.props const { lines, selectIp } = this.state // 涓婃姤鎺ュ彛璁剧疆锛氬伐绋嬫ā寮�-鍦烘櫙妯″紡-寮�鏀炬帴鍙h缃�-鏁版嵁涓婃姤璁剧疆-鏁版嵁涓婃姤鏈嶅姟鍣ㄥ湴鍧�锛堝紑鍚湇鍔″櫒浜屾閴存潈锛� @@ -237,6 +239,12 @@ } }) + if (data.length > 1 && btn.progress === 'progressbar') { + this.setState({ + loadingTotal: data.length + }) + } + this.addUser(ip, data, result.session_id) }) }, err => { @@ -248,7 +256,7 @@ let data = datas.shift() this.setState({ - loadingNumber: datas.length || '' + loadingNumber: datas.length }) let error = '' @@ -325,7 +333,8 @@ this.setState({ loading: false, - loadingNumber: '' + loadingNumber: '', + loadingTotal: '' }) // if (btn.execSuccess !== 'never') { @@ -408,7 +417,8 @@ this.setState({ loading: false, - loadingNumber: '' + loadingNumber: '', + loadingTotal: '' }) // if (btn.execError !== 'never') { @@ -483,56 +493,51 @@ } render() { - const { btn, show } = this.props - const { loading, disabled, hidden, loadingNumber } = this.state + const { btn } = this.props + const { loading, disabled, hidden, loadingNumber, loadingTotal } = this.state if (hidden) return null - if (show === 'actionList') { - return ( - <> - <Button - icon={btn.icon} - loading={loading} - disabled={disabled} - title={disabled ? (btn.reason || '') : ''} - className={'mk-btn mk-' + btn.class} - onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} - >{(loadingNumber ? `(${loadingNumber})` : '') + btn.label}</Button> - {this.getModels()} - </> - ) - } else { // icon銆乼ext銆� all 鍗$墖 - let label = '' - let icon = '' + let label = '' + let icon = '' + let type = 'link' + let className = '' - if (show === 'button') { - label = btn.label - icon = btn.icon || '' - } else if (show === 'link') { - label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> - icon = '' - } else if (show === 'icon') { - icon = btn.icon || '' - } else { - label = btn.label - } - - return ( - <> - <Button - type="link" - title={disabled ? (btn.reason || '') : (show === 'icon' ? btn.label : '')} - loading={loading} - disabled={disabled} - style={btn.style} - icon={icon} - onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} - >{label}</Button> - {this.getModels()} - </> - ) + if (btn.show === 'button') { + label = btn.label + icon = btn.icon || '' + } else if (btn.show === 'link') { + label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> + icon = '' + } else if (btn.show === 'icon') { + icon = btn.icon || '' + } else if (!btn.$toolbtn) { + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } else { + type = '' + icon = btn.icon || '' + label = (loadingNumber && !loadingTotal ? `(${loadingNumber})` : '') + btn.label + className = 'mk-btn mk-' + btn.class } + + return ( + <> + <Button + type={type} + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} + loading={loading} + disabled={disabled} + style={btn.style} + icon={icon} + className={className} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{label}</Button> + {this.getModels()} + {loadingTotal ? <Progress className="mk-button-progress" percent={(loadingTotal - loadingNumber) / loadingTotal * 100} size="small" showInfo={false} /> : null} + </> + ) } } diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx index f42a614..1237a91 100644 --- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx +++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx @@ -13,7 +13,6 @@ class NewPageButton extends Component { static propTpyes = { - show: PropTypes.any, // 鎸夐挳鏄剧ず鏍峰紡鎺у埗 BData: PropTypes.any, // 涓昏〃鏁版嵁 btn: PropTypes.object, // 鎸夐挳 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 @@ -225,49 +224,46 @@ } render() { - const { btn, show } = this.props + const { btn } = this.props const { disabled, hidden } = this.state if (hidden) return null - if (show === 'actionList') { - return ( - <Button - className={'mk-btn mk-' + btn.class} - icon={btn.icon} - disabled={disabled} - title={disabled ? (btn.reason || '') : ''} - onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} - >{btn.label}</Button> - ) - } else { // icon銆乼ext銆� all 鍗$墖 - let label = '' - let icon = '' + let label = '' + let icon = '' + let type = 'link' + let className = '' - if (show === 'button') { - label = btn.label - icon = btn.icon || '' - } else if (show === 'link') { - label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> - icon = '' - } else if (show === 'icon') { - icon = btn.icon || '' - // } else if (show === 'text') { - } else { - label = btn.label - } - - return ( - <Button - type="link" - title={disabled ? (btn.reason || '') : (show === 'icon' ? btn.label : '')} - style={btn.style} - disabled={disabled} - icon={icon} - onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} - >{label}</Button> - ) + if (btn.show === 'button') { + label = btn.label + icon = btn.icon || '' + } else if (btn.show === 'link') { + label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> + icon = '' + } else if (btn.show === 'icon') { + icon = btn.icon || '' + } else if (!btn.$toolbtn) { + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } else { + type = '' + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class } + + return ( + <Button + type={type} + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} + style={btn.style || null} + disabled={disabled} + icon={icon} + className={className} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{label}</Button> + ) } } diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 89fe92d..c5efa4a 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -3,7 +3,7 @@ import moment from 'moment' import {connect} from 'react-redux' import { is, fromJS } from 'immutable' -import { Button, Modal, notification, message, Drawer, Switch, Checkbox } from 'antd' +import { Button, Modal, notification, message, Drawer, Switch, Checkbox, Progress } from 'antd' import Api from '@/api' import Utils, { getSysDefaultSql } from '@/utils/utils.js' @@ -21,8 +21,6 @@ class NormalButton extends Component { static propTpyes = { - show: PropTypes.any, // 鎸夐挳鏄剧ず鏍峰紡鎺у埗 - position: PropTypes.any, // 鎸夐挳浣嶇疆锛屽伐鍏锋爮涓簍oolbar BID: PropTypes.string, // 涓昏〃ID BData: PropTypes.any, // 涓昏〃鏁版嵁 style: PropTypes.any, // 鎸夐挳鏍峰紡 @@ -44,6 +42,7 @@ btnconfig: null, loading: false, loadingNumber: '', + loadingTotal: '', disabled: false, hidden: false, checkParam: null, @@ -96,10 +95,10 @@ } componentDidMount () { - const { position, btn } = this.props + const { btn } = this.props MKEmitter.addListener('triggerBtnId', this.actionTrigger) - if (position === 'form') { + if (btn.OpenType === 'formSubmit') { MKEmitter.addListener('triggerFormSubmit', this.actionSubmit) } MKEmitter.addListener('returnModuleParam', this.resetModuleParam) @@ -862,6 +861,11 @@ _resolve() }) } else { // 瓒呭嚭20涓姹傛椂寰幆鎵ц + if (btn.progress === 'progressbar') { + this.setState({ + loadingTotal: params.length + }) + } this.innerLoopRequest(params, btn, _resolve) } } else if (btn.intertype === 'outer') { @@ -922,8 +926,14 @@ }) } + if (_params.length > 1 && btn.progress === 'progressbar') { + this.setState({ + loadingTotal: _params.length + }) + } + // 寰幆璋冪敤澶栭儴鎺ュ彛锛堝寘鎷唴閮ㄥ強鍥炶皟鍑芥暟锛� - this.outerLoopRequest(_params, btn, _resolve, _params.length > 20) + this.outerLoopRequest(_params, btn, _resolve) } else if (btn.intertype === 'custom') { // 绯荤粺鎺ュ彛 let params = [] @@ -937,6 +947,12 @@ params = this.getInnerParam(data, formdata) } + if (params.length > 1 && btn.progress === 'progressbar') { + this.setState({ + loadingTotal: params.length + }) + } + this.customLoopRequest(params, _resolve) } } @@ -948,7 +964,7 @@ let param = params.shift() this.setState({ - loadingNumber: params.length || '' + loadingNumber: params.length }) let record = { @@ -1279,7 +1295,7 @@ let param = params.shift() this.setState({ - loadingNumber: params.length || '' + loadingNumber: params.length }) let _param = null @@ -1330,17 +1346,15 @@ /** * @description 澶栭儴璇锋眰寰幆鎵ц */ - outerLoopRequest = (params, btn, _resolve, widthNumber) => { + outerLoopRequest = (params, btn, _resolve) => { if (!params && params.length === 0) return let param = params.shift() let _outParam = null - if (widthNumber) { - this.setState({ - loadingNumber: params.length || '' - }) - } + this.setState({ + loadingNumber: params.length + }) new Promise(resolve => { // 鍐呴儴璇锋眰 @@ -1447,7 +1461,7 @@ this.execSuccess(response) _resolve() } else { - this.outerLoopRequest(params, btn, _resolve, widthNumber) + this.outerLoopRequest(params, btn, _resolve) } } else { this.execError(response) @@ -1462,7 +1476,7 @@ this.execSuccess(res) _resolve() } else { - this.outerLoopRequest(params, btn, _resolve, widthNumber) + this.outerLoopRequest(params, btn, _resolve) } } else { this.execError(res) @@ -1496,6 +1510,11 @@ } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず } + + this.setState({ + loadingNumber: '', + loadingTotal: '', + }) if (autoMatic) { this.setState({ @@ -1716,6 +1735,7 @@ this.setState({ loading: false, loadingNumber: '', + loadingTotal: '', visible: false }) MKEmitter.emit('autoExecOver', btn.uuid, 'error') @@ -1724,7 +1744,8 @@ this.setState({ loading: false, - loadingNumber: '' + loadingNumber: '', + loadingTotal: '', }) if (res.ErrCode === 'C') { @@ -2086,70 +2107,57 @@ } render() { - const { btn, show, style } = this.props - const { loadingNumber, loading, disabled, hidden, check } = this.state + const { btn } = this.props + const { loadingNumber, loadingTotal, loading, disabled, hidden, check } = this.state if (hidden) return null if (btn.OpenType === 'form') { if (btn.formType === 'switch') { - return <Switch loading={loading} checked={check} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} onChange={(val,e) => {e.stopPropagation();this.actionTrigger()}} style={style} className={btn.size === 'large' ? 'ant-switch-large' : ''} size={btn.size} checkedChildren={btn.openText || ''} unCheckedChildren={btn.closeText || ''}/> + return <Switch loading={loading} checked={check} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} onChange={(val,e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style} className={btn.size === 'large' ? 'ant-switch-large' : ''} size={btn.size} checkedChildren={btn.openText || ''} unCheckedChildren={btn.closeText || ''}/> } else { - return <Checkbox disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} checked={check} onChange={(e) => {e.stopPropagation();this.actionTrigger()}} style={style}></Checkbox> + return <Checkbox disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} checked={check} onChange={(e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style}></Checkbox> } - } else if (show === 'actionList') { - return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> - <Button - style={style} - icon={btn.icon} - loading={loading} - disabled={disabled} - title={disabled ? (btn.reason || '') : ''} - 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 style={{display: 'inline-block'}}> - <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 鍗$墖 - let label = '' - let icon = '' - - if (show === 'button') { - label = btn.label - icon = btn.icon || '' - } else if (show === 'link') { - label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> - icon = '' - } else if (show === 'icon') { - icon = btn.icon || '' - } else { - label = btn.label - } - - return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> - <Button - type="link" - title={disabled ? (btn.reason || '') : (show === 'icon' ? btn.label : '')} - loading={loading} - disabled={disabled} - style={btn.style || style} - icon={icon} - onClick={() => {this.actionTrigger()}} - >{label}</Button> - {this.getModels()} - </div> } + + let label = '' + let icon = '' + let type = 'link' + let className = '' + + if (btn.show === 'button') { + label = btn.label + icon = btn.icon || '' + } else if (btn.show === 'link') { + label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> + icon = '' + } else if (btn.show === 'icon') { + icon = btn.icon || '' + } else if (!btn.$toolbtn) { + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } else { + type = '' + icon = btn.icon || '' + label = (loadingNumber && !loadingTotal ? `(${loadingNumber})` : '') + btn.label + className = 'mk-btn mk-' + btn.class + } + + return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> + <Button + type={type} + icon={icon} + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} + loading={loading} + disabled={disabled} + style={btn.style || null} + className={className} + onClick={() => {this.actionTrigger()}} + >{label}</Button> + {this.getModels()} + {loadingTotal ? <Progress className="mk-button-progress" percent={(loadingTotal - loadingNumber) / loadingTotal * 100} size="small" showInfo={false} /> : null} + </div> } } diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index 9eb203b..5cbcba9 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -15,7 +15,6 @@ class PopupButton extends Component { static propTpyes = { - show: PropTypes.any, // 鎸夐挳鏄剧ず鏍峰紡鎺у埗 BID: PropTypes.string, // 涓昏〃ID BData: PropTypes.any, // 涓昏〃鏁版嵁 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 @@ -316,45 +315,47 @@ } render() { - const { btn, show } = this.props + const { btn } = this.props const { loading, disabled, hidden } = this.state if (hidden) return null let label = '' let icon = '' + let type = 'link' + let className = '' - if (show === 'button') { + if (btn.show === 'button') { label = btn.label icon = btn.icon || '' - } else if (show === 'link') { + } else if (btn.show === 'link') { label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> icon = '' - } else if (show === 'icon') { + } else if (btn.show === 'icon') { icon = btn.icon || '' - } else { + } else if (!btn.$toolbtn) { + icon = btn.icon || '' label = btn.label + className = 'mk-btn mk-' + btn.class + } else { + type = '' + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class } return ( <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> - {show === 'actionList' ? <Button - className={'mk-btn mk-' + btn.class} - icon={btn.icon} - disabled={disabled} - title={disabled ? (btn.reason || '') : ''} - onClick={() => {this.actionTrigger()}} - loading={loading} - >{btn.label}</Button> : null} - {show !== 'actionList' ? <Button - type="link" - title={disabled ? (btn.reason || '') : (show === 'icon' ? btn.label : '')} + <Button + type={type} + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} loading={loading} disabled={disabled} style={btn.style} icon={icon} + className={className} onClick={() => {this.actionTrigger()}} - >{label}</Button> : null} + >{label}</Button> {this.getPop()} </div> ) diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index ba4d49f..0ecdef0 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -22,7 +22,6 @@ class PrintButton extends Component { static propTpyes = { - show: PropTypes.any, // 鎸夐挳鏄剧ず鏍峰紡鎺у埗 BID: PropTypes.string, // 涓昏〃ID BData: PropTypes.any, // 涓昏〃鏁版嵁 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 @@ -43,7 +42,6 @@ loading: false, disabled: false, hidden: false, - loadingNumber: '', autoMatic: false } @@ -1599,53 +1597,48 @@ } render() { - const { btn, show } = this.props - const { loadingNumber, loading, disabled, hidden } = this.state + const { btn } = this.props + const { loading, disabled, hidden } = this.state if (hidden) return null - if (show === 'actionList') { - return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> - <Button - icon={btn.icon} - loading={loading} - disabled={disabled} - title={disabled ? (btn.reason || '') : ''} - className={'mk-btn mk-' + btn.class} - onClick={() => {this.actionTrigger()}} - >{loadingNumber ? `(${loadingNumber})` : '' + btn.label}</Button> - {this.getModels()} - </div> - } else { // icon銆乼ext銆� all 鍗$墖 - let label = '' - let icon = '' + let label = '' + let icon = '' + let type = 'link' + let className = '' - if (show === 'button') { - label = btn.label - icon = btn.icon || '' - } else if (show === 'link') { - label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> - icon = '' - } else if (show === 'icon') { - icon = btn.icon || '' - // } else if (show === 'text') { - } else { - label = btn.label - } - - return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> - <Button - type="link" - title={disabled ? (btn.reason || '') : (show === 'icon' ? btn.label : '')} - loading={loading} - disabled={disabled} - style={btn.style} - icon={icon} - onClick={() => {this.actionTrigger()}} - >{label}</Button> - {this.getModels()} - </div> + if (btn.show === 'button') { + label = btn.label + icon = btn.icon || '' + } else if (btn.show === 'link') { + label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> + icon = '' + } else if (btn.show === 'icon') { + icon = btn.icon || '' + } else if (!btn.$toolbtn) { + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } else { + type = '' + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class } + + return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> + <Button + type={type} + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} + loading={loading} + disabled={disabled} + style={btn.style || null} + icon={icon} + className={className} + onClick={() => {this.actionTrigger()}} + >{label}</Button> + {this.getModels()} + </div> } } diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx index 5ce51e9..f3cd9cf 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.jsx +++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx @@ -12,7 +12,6 @@ class TabButton extends Component { static propTpyes = { - show: PropTypes.any, // 鎸夐挳鏄剧ず鏍峰紡鎺у埗 BData: PropTypes.any, // 涓昏〃鏁版嵁 MenuID: PropTypes.string, // 鑿滃崟ID btn: PropTypes.object, // 鎸夐挳 @@ -199,49 +198,46 @@ } render() { - const { btn, show } = this.props + const { btn } = this.props const { disabled, hidden } = this.state if (hidden) return null - if (show === 'actionList') { - return ( - <Button - className={'mk-btn mk-' + btn.class} - icon={btn.icon} - disabled={disabled} - title={disabled ? (btn.reason || '') : ''} - onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} - >{btn.label}</Button> - ) - } else { // icon銆乼ext銆� all 鍗$墖 - let label = '' - let icon = '' + let label = '' + let icon = '' + let type = 'link' + let className = '' - if (show === 'button') { - label = btn.label - icon = btn.icon || '' - } else if (show === 'link') { - label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> - icon = '' - } else if (show === 'icon') { - icon = btn.icon || '' - // } else if (show === 'text') { - } else { - label = btn.label - } - - return ( - <Button - type="link" - title={disabled ? (btn.reason || '') : (show === 'icon' ? btn.label : '')} - style={btn.style} - disabled={disabled} - icon={icon} - onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} - >{label}</Button> - ) + if (btn.show === 'button') { + label = btn.label + icon = btn.icon || '' + } else if (btn.show === 'link') { + label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> + icon = '' + } else if (btn.show === 'icon') { + icon = btn.icon || '' + } else if (!btn.$toolbtn) { + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } else { + type = '' + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class } + + return ( + <Button + type={type} + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} + style={btn.style || null} + disabled={disabled} + icon={icon} + className={className} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{label}</Button> + ) } } diff --git a/src/tabviews/zshare/cardcomponent/index.jsx b/src/tabviews/zshare/cardcomponent/index.jsx index 0480ba8..0c21b02 100644 --- a/src/tabviews/zshare/cardcomponent/index.jsx +++ b/src/tabviews/zshare/cardcomponent/index.jsx @@ -111,13 +111,30 @@ let extra = null if (card.header && card.header.actions) { - let actions = this.getActionList(card.header.actions, card.header.show) + let actions = card.header.actions.map(item => { + if (card.header.show === 'icon') { + item.show = 'icon' + } else { + item.show = 'button' + } + return item + }) + + actions = this.getActionList(actions) extra = actions[0] } let _actions = null if (card.bottom && card.bottom.actions) { - _actions = this.getActionList(card.bottom.actions, card.bottom.show) + _actions = card.bottom.actions.map(item => { + if (card.bottom.show === 'icon') { + item.show = 'icon' + } else { + item.show = 'button' + } + return item + }) + _actions = this.getActionList(_actions) } this.setState({ @@ -129,7 +146,7 @@ /** * @description 鑾峰彇鎸夐挳鍏冪礌 */ - getActionList = (actions, show) => { + getActionList = (actions) => { const { BData, Tab, setting, columns, ContainerId, data, MenuID } = this.props return actions.map(item => { @@ -140,7 +157,6 @@ BID={data.$$BID} Tab={Tab} btn={item} - show={show} BData={BData} setting={setting} columns={columns} @@ -155,7 +171,6 @@ BID={data.$$BID} Tab={Tab} btn={item} - show={show} BData={BData} setting={setting} selectedData={[data]} @@ -166,7 +181,6 @@ <TabButton key={item.uuid} btn={item} - show={show} MenuID={MenuID} setting={setting} selectedData={[data]} @@ -177,7 +191,6 @@ <NewPageButton key={item.uuid} btn={item} - show={show} setting={setting} selectedData={[data]} /> @@ -189,7 +202,6 @@ key={item.uuid} BID={data.$$BID} btn={item} - show={show} setting={setting} selectedData={[data]} /> @@ -201,7 +213,6 @@ BID={data.$$BID} Tab={Tab} btn={item} - show={show} BData={BData} setting={setting} selectedData={[data]} @@ -440,6 +451,7 @@ title = card.header.content } } + let style = {fontSize: plusSize + 'px'} return ( <div className={'chart-card-box ' + card.outclass}> @@ -487,8 +499,7 @@ <NormalButton BID={this.props.BID} Tab={this.props.Tab} - btn={card.insertAction} - show={'plus' + plusSize} + btn={{...card.insertAction, style}} BData={this.props.BData} setting={this.props.setting} columns={this.props.columns} @@ -555,8 +566,10 @@ if ((item.Ot && item.Ot !== 'notRequired' && !['excelIn', 'excelOut'].includes(item.OpenType)) || item.funcType === 'changeuser') { actionMap.set(item.uuid, item) } else if (plot.extraAction && plot.extraAction === item.uuid && ['pop', 'prompt', 'exec'].includes(item.OpenType) && item.Ot === 'notRequired') { + item.show = 'icon' insertAction = item } else if (plot.actions && plot.actions.length > 0 && plot.actions.includes(item.uuid) && (item.OpenType === 'excelOut' || (item.OpenType === 'excelIn' && item.Ot === 'notRequired'))) { + item.show = 'icon' actionList.push(item) } }) @@ -761,7 +774,6 @@ key={action.uuid} BID={BID} Tab={Tab} - show="icon" btn={action} setting={config.setting} /> @@ -772,7 +784,6 @@ key={action.uuid} BID={BID} Tab={Tab} - show="icon" btn={action} setting={config.setting} /> diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index e197357..201684b 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -175,6 +175,10 @@ shows.push('sql', 'sqlType', 'output') } + if (Ot === 'required') { + shows.push('progress') + } + if (this.record.sqlType === 'insert') { reOptions.Ot = requireOptions.filter(op => op.value === 'notRequired') } else { @@ -270,7 +274,7 @@ } else if (_funcType === 'closetab') { shows.push('refreshTab') } else if (_funcType === 'megvii') { - shows.push('subFunc') + shows.push('subFunc', 'progress') } } diff --git a/src/templates/sharecomponent/cardcomponent/index.scss b/src/templates/sharecomponent/cardcomponent/index.scss index 4971023..497936c 100644 --- a/src/templates/sharecomponent/cardcomponent/index.scss +++ b/src/templates/sharecomponent/cardcomponent/index.scss @@ -184,6 +184,7 @@ width: unset; margin-right: 3px; color: rgba(0, 0, 0, 0.45); + vertical-align: middle; } } li:hover { diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 1aef42a..abcc74d 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1508,6 +1508,20 @@ value: 'true', text: '鏄�' }] + }, + { + type: 'radio', + key: 'progress', + label: '杩涘害鎻愮ず', + initVal: card.progress || 'number', + required: false, + options: [{ + value: 'number', + text: '鍓╀綑鏁�' + }, { + value: 'progressbar', + text: '杩涘害鏉�' + }] } ] } -- Gitblit v1.8.0