From 76427d51a079a5fd1f45bf7188249e7a4647ae05 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 14 九月 2020 10:37:25 +0800 Subject: [PATCH] 2020-09-14 --- src/tabviews/zshare/actionList/excelInbutton/index.jsx | 57 +++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 37 insertions(+), 20 deletions(-) diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 5238361..53fd47f 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -15,15 +15,12 @@ class ExcelInButton extends Component { static propTpyes = { + show: PropTypes.any, // 鏄剧ず鏍峰紡 BID: PropTypes.string, // 涓昏〃ID - BData: PropTypes.any, // 涓昏〃鏁版嵁 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� - MenuID: PropTypes.string, // 鑿滃崟ID btn: PropTypes.object, // 鎸夐挳 - columns: PropTypes.array, // 瀛楁鍒� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� triggerBtn: PropTypes.any, } @@ -189,26 +186,26 @@ /** * @description Excel 瀵煎叆 */ - getexceldata = (data, errors) => { + getexceldata = (data, errors, sheetName) => { const { btn } = this.props if (errors) { if (errors === 'notexit') { notification.warning({ top: 92, - message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬩笉瀛樺湪锛�', + message: '宸ヤ綔琛ㄣ��' + sheetName + '銆嬩笉瀛樺湪锛�', duration: 5 }) } else if (errors === 'empty') { notification.warning({ top: 92, - message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬩负绌猴紒', + message: '宸ヤ綔琛ㄣ��' + sheetName + '銆嬩负绌猴紒', duration: 5 }) } else if (errors === 'headerError') { notification.warning({ top: 92, - message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬭〃澶磋缃敊璇紒', + message: '宸ヤ綔琛ㄣ��' + sheetName + '銆嬭〃澶磋缃敊璇紝璇锋鏌ヨ〃澶翠腑鐨勫悕绉板強椤哄簭锛屼笌鎸夐挳Excel鍒椾俊鎭槸鍚︿竴鑷达紒', duration: 5 }) } @@ -220,14 +217,20 @@ if (!data || data.length === 0) { notification.warning({ top: 92, - message: '鏈幏鍙栧埌宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬫暟鎹紒', + message: '鏈幏鍙栧埌宸ヤ綔琛ㄣ��' + sheetName + '銆嬫暟鎹紒', duration: 5 }) this.updateStatus('over') return + } else if (data.length * btn.verify.columns.length > 30000) { + notification.warning({ + top: 92, + message: '褰撳墠瀵煎叆鏁版嵁閲忚繃澶э紝濡傞亣閿欒鎻愮ず锛岃鍒嗘壒瀵煎叆锛�', + duration: 5 + }) } - let result = Utils.getExcelInSql(btn, data, this.state.dict) + let result = Utils.getExcelInSql(btn, data, this.state.dict, (this.props.BID || '')) if (result.errors) { notification.warning({ @@ -248,7 +251,7 @@ param.BID = this.props.BID } - if (btn.intertype === 'inner' && !btn.innerFunc) { // 绯荤粺瀛樺偍杩囩▼ + if (btn.intertype === 'system') { // 绯荤粺瀛樺偍杩囩▼ param.func = 'sPC_TableData_InUpDe' if (this.props.dataManager) { // 鏁版嵁鏉冮檺 @@ -262,13 +265,13 @@ } param.excel_in_type = 'true' - param.LText_insert = Utils.formatOptions(result.insert) - param.LText_bottom = Utils.formatOptions(result.bottom) + param.LText1 = Utils.formatOptions(result.insert) + param.LText2 = Utils.formatOptions(result.bottom) param.LText = Utils.formatOptions(result.sql) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) if (this.props.menuType === 'HS' && param.timestamp) { // 浜戠楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } Api.genericInterface(param).then((res) => { @@ -326,7 +329,7 @@ }).then(res => { if (!res) return // 澶栭儴璇锋眰 - _outParam = JSON.parse(JSON.stringify(res)) + _outParam = fromJS(res).toJS() if (this.props.menuType === 'HS') { if (btn.sysInterface === 'true' && options.cloudServiceApi) { @@ -344,6 +347,13 @@ if (btn.outerFunc) { res.func = btn.outerFunc + } + + if (this.props.menuType === 'HS' && res.func === 's_sDataDictb_excelIn') { // s_sDataDictb_excelIn 浜戠楠岃瘉 + param.LText = Utils.formatOptions(result.sql) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } return Api.genericInterface(res) @@ -379,18 +389,25 @@ } render() { - const { btn } = this.props + const { btn, show } = this.props const { loading } = this.state return ( <div className="mk-btn-wrap"> - <Button + {!show ? <Button className={'mk-btn mk-' + btn.class} icon={btn.icon} onClick={() => {this.actionTrigger()}} loading={loading} - >{btn.label}</Button> - <ExcelIn MenuID={this.props.MenuID} btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" /> + >{btn.label}</Button> : null} + {show === 'icon' ? <Button + className="import-icon" + icon="upload" + onClick={() => {this.actionTrigger()}} + loading={loading} + title={btn.label} + ></Button> : null} + <ExcelIn btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" /> </div> ) } -- Gitblit v1.8.0