From f0bf8c399c354c22227f8f1a76ed806098db59c0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 21 五月 2024 16:51:02 +0800 Subject: [PATCH] 2024-05-21 --- src/tabviews/zshare/actionList/normalbutton/index.jsx | 118 +++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 78 insertions(+), 40 deletions(-) diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index f58f2fe..d4f7524 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -28,6 +28,7 @@ columns: PropTypes.any, // 瀛楁鍒� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 disabled: PropTypes.any, // 琛屾寜閽鐢� + name: PropTypes.any } state = { @@ -203,8 +204,8 @@ /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (triggerId, record, type, callback) => { - const { btn, selectedData } = this.props + actionTrigger = (triggerId, record, type, lid, callback) => { + const { btn, selectedData, LID } = this.props const { loading, disabled } = this.state if (type === 'preButton') { @@ -218,7 +219,7 @@ if (loading || disabled) return if (triggerId && btn.uuid !== triggerId) return - if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) return + if (type === 'linkbtn' && !btn.$toolbtn && LID !== lid) return if (btn.OpenType === 'form' && btn.formType === 'count_line') return this.setState({autoMatic: type === 'autoMatic'}) @@ -755,6 +756,9 @@ param.username = sessionStorage.getItem('User_Name') || '' param.fullname = sessionStorage.getItem('Full_Name') || '' } + if (btn.dataM === 'true') { + param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' + } let primaryId = '' @@ -796,6 +800,9 @@ if (btn.recordUser === 'true') { param.username = sessionStorage.getItem('User_Name') || '' param.fullname = sessionStorage.getItem('Full_Name') || '' + } + if (btn.dataM === 'true') { + param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' } let primaryId = setting.primaryKey ? cell[setting.primaryKey] || '' : '' @@ -1086,7 +1093,7 @@ let node = document.getElementById('button' + btnId) if (node) { - MKEmitter.emit('triggerBtnId', btnId, null, 'preButton', (res) => { + MKEmitter.emit('triggerBtnId', btnId, null, 'preButton', null, (res) => { if (!res) { this.setState({loading: false}) resolve() @@ -1631,11 +1638,12 @@ }) keys = keys.join(',') + vals = vals.join(',') lines.push({ table: md5(tb + keys), - insert: `Insert into ${tbName} (${keys},[mk_level],[mk_id],[mk_bid])`, - select: `Select ${vals.join(',')},'${level}','${id}','${bid}'` + insert: `Insert into ${tbName} (${keys ? keys + ',' : ''}[mk_level],[mk_id],[mk_bid])`, + select: `Select ${keys ? vals + ',' : ''}'${level}','${id}','${bid}'` }) subObjs.forEach(item => { @@ -2344,9 +2352,9 @@ tabId = btn.refreshTab[btn.refreshTab.length - 1] } - if (btn.formCache === 'clear') { // 娓呴櫎琛ㄥ崟缂撳瓨 - window.GLOB.CacheMap = new Map() - } + // if (btn.formCache === 'clear') { // 娓呴櫎琛ㄥ崟缂撳瓨 + // window.GLOB.CacheMap = new Map() + // } if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 MKEmitter.emit('reloadMenuView', tabId, 'table') @@ -2428,6 +2436,24 @@ if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 MKEmitter.emit('refreshPopButton', btn.$tabId) } + + if (btn.verify && btn.verify.linkEnable === 'true') { + let url = '' + if (window.GLOB.systemType === 'production') { + url = btn.verify.linkProUrl + if (!url) { + notification.warning({ + top: 92, + message: '灏氭湭娣诲姞姝e紡绯荤粺閾炬帴鍦板潃锛�', + duration: 5 + }) + return + } + } else { + url = btn.verify.linkUrl + } + window.open(url) + } } triggerNote = (res, ID) => { @@ -2474,9 +2500,38 @@ if (!id) return - setTimeout(() => { - window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: id, tempId: btn.verify.printTempId, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') })))) - }, 500) + if (btn.verify.preHandle === 'true' && btn.verify.pre_func && /#position-print/.test(btn.verify.pre_func)) { + MKEmitter.emit('queryModuleParam', btn.$menuId, (res) => { + let searches = {} + res.search && res.search.forEach(item => { + searches[item.key] = item.value + }) + let _param = { id: id || '', tempId: btn.verify.printTempId, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM')} + + try { + // eslint-disable-next-line + let func = new Function('btn', 'searches', 'param', 'systemType', btn.verify.pre_func) + _param = func(btn, searches, _param, window.GLOB.systemType) + } catch (e) { + console.warn(e) + } + + if (!_param || _param.error) { + notification.warning({ + top: 92, + message: _param ? _param.error : '鏈幏鍙栧埌鎵撳嵃鍙傛暟锛岃嚜瀹氫箟鑴氭湰閿欒锛�', + duration: 5 + }) + return + } + + window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify(_param)))) + }) + } else { + setTimeout(() => { + window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: id, tempId: btn.verify.printTempId, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') })))) + }, 200) + } } sendWxMessage = (verify, id) => { @@ -3169,7 +3224,7 @@ } modelconfirm = () => { - const { btn, BID } = this.props + const { BID } = this.props const { btnconfig, selines } = this.state let _this = this @@ -3314,7 +3369,7 @@ this.execSubmit(selines, () => {}, result) } else { confirm({ - title: btn.tipTitle || '纭畾瑕佹墽琛屽悧?', + title: btnconfig.setting.tipTitle || '纭畾瑕佹墽琛屽悧?', onOk() { return new Promise(resolve => { _this.execSubmit(selines, resolve, result) @@ -3494,7 +3549,7 @@ } render() { - const { btn } = this.props + const { btn, name } = this.props const { loadingNumber, loadingTotal, loading, disabled, hidden, check, count } = this.state if (hidden) return null @@ -3513,42 +3568,25 @@ } 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 = '' + if (btn.show === 'link') { + label = <span>{name || btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon} /> : ''}</span> } else if (btn.show === 'icon') { - icon = btn.icon || '' - } else if (!btn.$toolbtn) { - icon = btn.icon || '' - label = btn.label - className = 'mk-btn mk-' + (btn.class || 'unset') + label = !loading ? <MkIcon type={btn.icon} /> : null + } else if (btn.$toolbtn) { + label = <span>{!loading && btn.icon ? <MkIcon style={{marginRight: '8px'}} type={btn.icon} /> : ''}{loadingNumber && !loadingTotal ? `(${loadingNumber})` : ''}{btn.label}</span> } else { - type = '' - icon = btn.icon || '' - label = btn.label - className = 'mk-btn mk-' + (btn.class || 'unset') - } - - if (loadingNumber && btn.progress !== 'progressbar' && btn.$toolbtn && (!btn.show || btn.show === 'button')) { - label = (loadingNumber ? `(${loadingNumber})` : '') + btn.label + label = <span>{!loading && btn.icon ? <MkIcon style={{marginRight: '8px'}} type={btn.icon} /> : ''}{name || btn.label}</span> } let BTN = <Button - type={type} - icon={icon} + type="link" id={'button' + btn.uuid} title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} loading={loading} disabled={disabled} style={btn.style} - className={className} + className={btn.hover || ''} onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} >{label}</Button> -- Gitblit v1.8.0