From d1dbe184ea1026e20a202ac9f8f7c8c049665ae3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 10 一月 2024 17:04:26 +0800 Subject: [PATCH] 2024-01-10 --- src/menu/components/form/formaction/formconfig.jsx | 15 ++ src/tabviews/custom/components/card/cardcellList/index.jsx | 7 + src/menu/components/share/actioncomponent/actionform/index.jsx | 10 src/tabviews/zshare/actionList/index.jsx | 10 + src/tabviews/zshare/actionList/shareLink/index.jsx | 193 +++++++++++++++++++++++++++ src/tabviews/zshare/actionList/shareLink/index.scss | 0 src/menu/components/share/actioncomponent/formconfig.jsx | 125 ++++++++++++++++- src/menu/components/form/formaction/actionform/index.jsx | 2 src/tabviews/zshare/actionList/normalbutton/index.jsx | 4 9 files changed, 352 insertions(+), 14 deletions(-) diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx index 69ca082..d618233 100644 --- a/src/menu/components/form/formaction/actionform/index.jsx +++ b/src/menu/components/form/formaction/actionform/index.jsx @@ -57,7 +57,7 @@ } else if (this.record.type === 'close' || this.record.type === 'reset') { shows = ['typeName', 'label'] } else { - shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton'] // 閫夐」鍒楄〃 + shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton', 'formCache'] // 閫夐」鍒楄〃 if (this.record.execSuccess === 'never') { shows.push('resetForms') diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx index f6800ae..dbec712 100644 --- a/src/menu/components/form/formaction/formconfig.jsx +++ b/src/menu/components/form/formaction/formconfig.jsx @@ -510,5 +510,20 @@ text: '鍒锋柊' }] }, + { + type: 'radio', + key: 'formCache', + label: '琛ㄥ崟缂撳瓨', + initVal: card.formCache || 'false', + tooltip: '涓昏鐢ㄤ簬鏁版嵁淇敼鍚庯紝鏇存柊鐩稿叧琛ㄥ崟鐨勯�夐」锛屾竻绌虹紦瀛樺悗琛ㄥ崟鍐嶆鎵撳紑鏃舵暟鎹細閲嶆柊鍔犺浇銆�', + required: false, + options: [{ + value: 'false', + text: '涓嶆竻绌�' + }, { + value: 'clear', + text: '娓呯┖' + }] + }, ] } diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 0c97afe..2239c41 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -14,9 +14,9 @@ const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable')) const acTyOptions = { - pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'], - prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'], - exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden', 'preButton'], + pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton', 'formCache'], + prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton', 'formCache'], + exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden', 'preButton', 'formCache'], excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'width', 'hidden'], excelOut: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'pagination', 'search', 'width', 'hidden'], popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'popClose', 'width', 'display', 'ratio', 'syncComponent', 'clickouter', 'maskStyle', 'closeButton', 'hidden'], @@ -505,6 +505,8 @@ } else if (_funcType === 'refund') { shows.push('Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu') reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value)) + } else if (_funcType === 'shareLink') { + shows.push('shortUrl', 'shareUrl', 'shareProUrl', 'shareTip') // } else if (_funcType === 'expPdf') { // shows.push('exportType') } @@ -525,7 +527,7 @@ shows.push('reason') } } - } else if (!(openType === 'funcbutton' && this.record.funcType === 'expPdf')) { + } else if (openType !== 'funcbutton' || !['expPdf', 'shareLink'].includes(this.record.funcType)) { if (openType !== 'excelOut') { reOptions.control = [ { value: '', text: '鏃�' }, diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index be2b2cd..a8c04dd 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -162,6 +162,7 @@ { value: 'refund', text: '閫�娆�' }, { value: 'closetab', text: '鏍囩鍏抽棴' }, { value: 'expPdf', text: '瀵煎嚭PDF' }, + { value: 'shareLink', text: '鍒嗕韩閾炬帴' }, { value: 'megvii', text: '鏃疯闈㈡澘鏈�' }, { value: 'filezip', text: '鏂囦欢鍘嬬缉鍖�' }, ] @@ -205,6 +206,7 @@ { value: 'clearCache', text: '娓呯┖鏈湴閰嶇疆' }, { value: 'copyurl', text: '澶嶅埗閾炬帴鍦板潃' }, { value: 'expPdf', text: '瀵煎嚭PDF' }, + { value: 'shareLink', text: '鍒嗕韩閾炬帴' }, { value: 'logout', text: '閫�鍑�' }, { value: 'goBack', text: '杩斿洖' }, ] @@ -766,6 +768,43 @@ }] }, { + type: 'radio', + key: 'shortUrl', + label: '鐭摼鎺�', + initVal: card.shortUrl || 'false', + options: [{ + value: 'false', + text: '绂佺敤' + }, { + value: 'true', + text: '鍚敤' + }] + }, + { + type: 'textarea', + key: 'shareUrl', + label: '閾炬帴鍦板潃', + initVal: card.shareUrl || '', + tooltip: '閾炬帴涓鏋滃瓨鍦ˊBID@鎴朄ID@灏嗚嚜鍔ㄦ浛鎹€��', + required: true + }, + { + type: 'textarea', + key: 'shareProUrl', + label: '姝e紡閾炬帴', + initVal: card.shareProUrl || '', + tooltip: '閾炬帴涓鏋滃瓨鍦ˊBID@鎴朄ID@灏嗚嚜鍔ㄦ浛鎹€��', + required: false + }, + { + type: 'text', + key: 'shareTip', + label: '鍒嗕韩鎻愮ず', + initVal: card.shareTip || '', + tooltip: '鍒嗕韩鏃跺鐢ㄦ埛鐨勬彁绀轰俊鎭��', + required: false + }, + { type: 'number', key: 'width', min: 0, @@ -1236,6 +1275,21 @@ }, { type: 'radio', + key: 'formCache', + label: '琛ㄥ崟缂撳瓨', + initVal: card.formCache || 'false', + tooltip: '涓昏鐢ㄤ簬鏁版嵁淇敼鍚庯紝鏇存柊鐩稿叧琛ㄥ崟鐨勯�夐」锛屾竻绌虹紦瀛樺悗琛ㄥ崟鍐嶆鎵撳紑鏃舵暟鎹細閲嶆柊鍔犺浇銆�', + required: false, + options: [{ + value: 'false', + text: '涓嶆竻绌�' + }, { + value: 'clear', + text: '娓呯┖' + }] + }, + { + type: 'radio', key: 'hidden', label: '闅愯棌', initVal: card.hidden || 'false', @@ -1461,6 +1515,7 @@ { value: 'refund', text: '閫�娆�' }, { value: 'closetab', text: '鏍囩鍏抽棴' }, { value: 'expPdf', text: '瀵煎嚭PDF' }, + { value: 'shareLink', text: '鍒嗕韩閾炬帴' }, { value: 'megvii', text: '鏃疯闈㈡澘鏈�' }, { value: 'filezip', text: '鏂囦欢鍘嬬缉鍖�' }, ] @@ -1932,17 +1987,54 @@ // }] // }, { - type: 'number', - key: 'width', - min: 1, - max: 24, - precision: 0, - label: '瀹藉害', - initVal: card.width || 12, - tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', - forbid: card.eleType !== 'button', + type: 'radio', + key: 'shortUrl', + label: '鐭摼鎺�', + initVal: card.shortUrl || 'false', + options: [{ + value: 'false', + text: '绂佺敤' + }, { + value: 'true', + text: '鍚敤' + }] + }, + { + type: 'textarea', + key: 'shareUrl', + label: '閾炬帴鍦板潃', + initVal: card.shareUrl || '', + tooltip: '閾炬帴涓鏋滃瓨鍦ˊBID@鎴朄ID@灏嗚嚜鍔ㄦ浛鎹€��', required: true }, + { + type: 'textarea', + key: 'shareProUrl', + label: '姝e紡閾炬帴', + initVal: card.shareProUrl || '', + tooltip: '閾炬帴涓鏋滃瓨鍦ˊBID@鎴朄ID@灏嗚嚜鍔ㄦ浛鎹€��', + required: false + }, + { + type: 'text', + key: 'shareTip', + label: '鍒嗕韩鎻愮ず', + initVal: card.shareTip || '', + tooltip: '鍒嗕韩鏃跺鐢ㄦ埛鐨勬彁绀轰俊鎭��', + required: false + }, + // { + // type: 'number', + // key: 'width', + // min: 1, + // max: 24, + // precision: 0, + // label: '瀹藉害', + // initVal: card.width || 12, + // tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + // forbid: card.eleType !== 'button', + // required: true + // }, { type: 'radio', key: 'show', @@ -2232,6 +2324,21 @@ }, { type: 'radio', + key: 'formCache', + label: '琛ㄥ崟缂撳瓨', + initVal: card.formCache || 'false', + tooltip: '涓昏鐢ㄤ簬鏁版嵁淇敼鍚庯紝鏇存柊鐩稿叧琛ㄥ崟鐨勯�夐」锛屾竻绌虹紦瀛樺悗琛ㄥ崟鍐嶆鎵撳紑鏃舵暟鎹細閲嶆柊鍔犺浇銆�', + required: false, + options: [{ + value: 'false', + text: '涓嶆竻绌�' + }, { + value: 'clear', + text: '娓呯┖' + }] + }, + { + type: 'radio', key: 'hidden', label: '闅愯棌', initVal: card.hidden || 'false', diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index cd0962e..84fb9b8 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -24,6 +24,7 @@ const FuncMegvii = asyncComponent(() => import('@/tabviews/zshare/actionList/funcMegvii')) const FuncZip = asyncComponent(() => import('@/tabviews/zshare/actionList/funczip')) const ExportPdf = asyncComponent(() => import('@/tabviews/zshare/actionList/exportPdf')) +const ShareLink = asyncComponent(() => import('@/tabviews/zshare/actionList/shareLink')) const EditLine = asyncComponent(() => import('@/tabviews/zshare/actionList/editLine')) const BarCode = asyncComponent(() => import('@/components/barcode')) const QrCode = asyncComponent(() => import('@/components/qrcode')) @@ -1107,6 +1108,12 @@ MkButton = <ExportPdf btn={card} /> + } else if (card.funcType === 'shareLink') { + MkButton = <ShareLink + BID={data.$$BID} + btn={card} + selectedData={_data} + /> } else if (card.funcType === 'addline' || card.funcType === 'delline') { MkButton = <EditLine btn={card} diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 7d59c20..3993d7e 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -19,6 +19,7 @@ const FuncZip = asyncComponent(() => import('./funczip')) const EditLine = asyncComponent(() => import('./editLine')) const ExportPdf = asyncComponent(() => import('./exportPdf')) +const ShareLink = asyncComponent(() => import('./shareLink')) class ActionList extends Component { static propTpyes = { @@ -196,6 +197,15 @@ btn={item} /> ) + } else if (item.funcType === 'shareLink') { + return ( + <ShareLink + key={item.uuid} + BID={BID} + btn={item} + selectedData={selectedData} + /> + ) } else if (item.funcType === 'addline' || item.funcType === 'delline') { return ( <EditLine diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 2a624a8..720f6be 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -2326,6 +2326,10 @@ tabId = btn.refreshTab[btn.refreshTab.length - 1] } + if (btn.formCache === 'clear') { // 娓呴櫎琛ㄥ崟缂撳瓨 + window.GLOB.CacheMap = new Map() + } + if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 MKEmitter.emit('reloadMenuView', tabId, 'table') return diff --git a/src/tabviews/zshare/actionList/shareLink/index.jsx b/src/tabviews/zshare/actionList/shareLink/index.jsx new file mode 100644 index 0000000..e4bd407 --- /dev/null +++ b/src/tabviews/zshare/actionList/shareLink/index.jsx @@ -0,0 +1,193 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Button, notification, message, Modal } from 'antd' +import md5 from 'md5' + +import Api from '@/api' +import MKEmitter from '@/utils/events.js' +import MkIcon from '@/components/mk-icon' + +// import './index.scss' + +class ShareLink extends Component { + static propTpyes = { + BID: PropTypes.string, + btn: PropTypes.object, + selectedData: PropTypes.any + } + + state = { + loading: false + } + + componentDidMount () { + MKEmitter.addListener('triggerBtnId', this.actionTrigger) + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('triggerBtnId', this.actionTrigger) + } + + /** + * @description 瑙﹀彂鎸夐挳鎿嶄綔 + */ + actionTrigger = (triggerId) => { + const { btn, BID, selectedData } = this.props + const { loading } = this.state + + if (loading) return + if (triggerId && btn.uuid !== triggerId) return + + if (window.GLOB.systemType === 'production' && !btn.shareProUrl) { + notification.warning({ + top: 92, + message: '灏氭湭璁剧疆姝e紡绯荤粺閾炬帴鍦板潃锛�', + duration: 5 + }) + return + } + + let bid = BID || '' + let id = '' + if (selectedData && selectedData[0]) { + id = selectedData[0].$$uuid || '' + } + + let url = btn.shareUrl + if (window.GLOB.systemType === 'production') { + url = btn.shareProUrl + } + + url = url.replace(/@BID@/ig, bid).replace(/@ID@/ig, id) + + if (btn.shortUrl === 'true') { + this.setState({ + loading: true + }, () => { + this.getShortUrl(url) + }) + } else { + this.copyUrl(url) + } + } + + getShortUrl = (url) => { + let _rduri = window.atob('aHR0cHM6Ly9lcGMubWs5aC5$mkjbi93ZWJhcGkvZG9zdGFycw=='.replace(/\$mk/ig, '')) + let _id = window.atob('YmgwYmFwYWJ0ZDQ1ZXBz$mkZ3JhNzlzZWdiY2g2YzFpYms='.replace(/\$mk/ig, '')) + + let param = { + func: 's_url_db_adduptdel', + appkey: window.GLOB.appkey, + userid: _id, + LoginUID: _id, + type: 'add_only', + validity: 15, + linkurl: url, + nonc: '' + new Date().getTime(), + id: md5(url + window.GLOB.appkey) + } + + let keys = Object.keys(param).sort() + let values = '' + keys.forEach(key => { + values += key + param[key] + }) + param.sign = md5(values) + param.t = new Date().getTime() + + Api.directRequest({ + url: _rduri + '/s_url_db_adduptdel', + method: 'post', + data: JSON.stringify(param) + }).then(res => { + this.setState({ + loading: false + }) + + if (res.status && res.id) { + this.copyUrl('https://mk9h.cn/m.asp?m=' + res.id) + } else { + notification.warning({ + top: 92, + message: res.message || '閾炬帴鐢熸垚澶辫触锛�', + duration: 5 + }) + } + }, () => { + this.setState({ + loading: false + }) + }) + } + + copyUrl = (url) => { + const { btn } = this.props + + let oInput = document.createElement('input') + oInput.value = url + document.body.appendChild(oInput) + oInput.select() + document.execCommand('Copy') + document.body.removeChild(oInput) + + if (btn.shareTip) { + Modal.success({ + title: btn.shareTip + }) + } else { + message.success('宸插鍒跺埌鍓垏鏉裤��') + } + } + + render() { + const { btn } = this.props + const { loading } = this.state + + let label = '' + let icon = '' + let type = 'link' + let className = '' + let style = {...btn.style} + + 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={btn.show === 'icon' ? btn.label : ''} + style={style} + loading={loading} + icon={icon} + className={className} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{label}</Button> + ) + } +} + +export default ShareLink \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/shareLink/index.scss b/src/tabviews/zshare/actionList/shareLink/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/tabviews/zshare/actionList/shareLink/index.scss -- Gitblit v1.8.0