From 8e8f505f37ecc4e6945e7d0d6e9883e4e9352437 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 10 十一月 2022 23:59:47 +0800 Subject: [PATCH] 2022-11-10 --- src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 56 +++ src/components/keyInterface/index.jsx | 273 +++++++++++++++++++++ src/components/encrypts/index.jsx | 6 src/utils/utils-datamanage.js | 14 src/menu/components/share/actioncomponent/actionform/index.jsx | 61 +++- src/api/index.js | 119 +++++++++ src/components/keyInterface/index.scss | 48 +++ src/menu/components/share/actioncomponent/formconfig.jsx | 60 +++ src/menu/datasource/verifycard/settingform/index.jsx | 42 ++ src/tabviews/zshare/actionList/normalbutton/index.jsx | 14 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 14 src/tabviews/zshare/actionList/printbutton/index.jsx | 14 12 files changed, 661 insertions(+), 60 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 3270525..2623ef3 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -2,6 +2,7 @@ import qs from 'qs' import { notification } from 'antd' import md5 from 'md5' +import CryptoJS from 'crypto-js' import jsSHA from 'jssha' import moment from 'moment' import Utils from '@/utils/utils.js' @@ -10,6 +11,7 @@ window.GLOB.WebSql = null window.GLOB.IndexDB = null +window.GLOB.OuterToken = {} const systemMenuKeys = `1581067625930haged11ieaivpavv77k,1581734956310scks442ul2d955g9tu5,1583991994144ndddg0bhh0is6shi0v1,1583979633842550imkchl4qt4qppsiv,1578900109100np8aqd0a77q3na46oas, 1585192949946f3et2ts8tn82krmumdf,15855615451212m12ip23vpcm79kloro,1587005717541lov40vg61q7l1rbveon,1590458676585agbbr63t6ihighg2i1g,1602315375262ikd33ii0nii34pt861o,1582771068837vsv54a089lgp45migbg, 1582777675954ifu05upurs465omoth7,158294809668898cklbv6c5bou8e1fpu,1584676379094iktph45fb8imhg96bql,1584695125339vo5g7iqgfn01qmrd6s2,1584699661372vhmpp9dn9foo0eob722,15848421131551gg04ie8sitsd3f7467, @@ -827,6 +829,117 @@ } } + visitOuterSystem (param, _resolve) { + let token = param.$token + delete param.$token + + try { + token = JSON.parse(token) + token = token.message + + const key = CryptoJS.enc.Utf8.parse(window.GLOB.appkey.slice(-16)) + const iv = CryptoJS.enc.Utf8.parse('mksoft') + + let encryptedHexStr = CryptoJS.enc.Hex.parse(token) + let _srcs = CryptoJS.enc.Base64.stringify(encryptedHexStr) + let decrypt = CryptoJS.AES.decrypt(_srcs, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }) + let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8) + token = decryptedStr.toString() + + token = JSON.parse(window.decodeURIComponent(window.atob(token))) + } catch (e) { + token = null + _resolve({status: false, ErrCode: 'E', message: '鎺ュ彛淇℃伅瑙f瀽澶辫触锛�'}) + } + + if (!token) return + + let userid = '' + let loginUid = '' + let dataM = '' + + if (window.GLOB.OuterToken[token.interface]) { + let msg = window.GLOB.OuterToken[token.interface] + + let seconds = Math.floor((new Date().getTime() - msg.timestamp) / 1000) + if (seconds >= 3600) { + delete window.GLOB.OuterToken[token.interface] + } else { + userid = msg.userid + loginUid = msg.loginUid + dataM = msg.dataM || '' + } + } + + // param.appkey = token.appkey || '' + + if (userid && loginUid) { + param.dataM = dataM + param.userid = userid + param.LoginUID = loginUid + param = this.encryptParam(param) + + axios({ + url: token.interface, + method: 'post', + data: param + }).then(res => { + _resolve(res) + }) + } else { + let _param = { + UserName: token.username, + systemType: options.sysType, + login_city: sessionStorage.getItem('city') || '', + device_id: localStorage.getItem('SessionUid') + } + + _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + + _param.Type = token.publicKey + let shaObj = new jsSHA('SHA-1', 'TEXT') + shaObj.update(token.password) + _param.Password = shaObj.getHash('HEX').toUpperCase() + _param.Password = md5(token.privateKey + token.username + _param.Password + _param.timestamp) + _param.appkey = token.appkey || '' + let url = token.interface.replace(/\/webapi(.*)/, '/webapi/dologon') + + if (token.ssoInterface) { + _param.rduri = token.ssoInterface.replace(/\/webapi(.*)/, '/webapi/dologon') + } + + axios({ + url, + method: 'post', + data: _param + }).then(result => { + if (result.status) { + window.GLOB.OuterToken[token.interface] = { + userid: result.UserID, + loginUid: result.LoginUID, + timestamp: new Date().getTime(), + dataM: result.dataM ? 'Y' : '' + } + + param.dataM = result.dataM ? 'Y' : '' + param.userid = result.UserID + param.LoginUID = result.LoginUID + param = this.encryptParam(param) + + axios({ + url: token.interface, + method: 'post', + data: param + }).then(res => { + _resolve(res) + }) + } else { + _resolve(result) + } + }) + } + } + /** * @description 鑾峰彇涓氬姟閫氱敤鎺ュ彛 * 璁块棶 'https://sso.mk9h.cn/webapi/dostars'鎴栦簯绔椂锛屼紶鍏serid銆丩oginUID @@ -838,6 +951,12 @@ param.LoginUID = param.LoginUID || sessionStorage.getItem('LoginUID') || '' param.appkey = window.GLOB.appkey || '' + if (param.$token === '') { + return Promise.resolve({status: false, ErrCode: 'E', message: '鎺ュ彛鍦板潃灏氭湭璁剧疆锛�'}) + } else if (param.$token) { + return new Promise(resolve => this.visitOuterSystem(param, resolve)) + } + if (['sPC_Get_TableData', 'sPC_Get_TableData_debug', 'sPC_TableData_InUpDe', 'sPC_TableData_InUpDe_debug', 'sPC_Get_structured_data'].includes(param.func)) { if (sessionStorage.getItem('isEditState') === 'true') { param.username = sessionStorage.getItem('CloudUserName') || '' diff --git a/src/components/encrypts/index.jsx b/src/components/encrypts/index.jsx index 5a22673..7ed752e 100644 --- a/src/components/encrypts/index.jsx +++ b/src/components/encrypts/index.jsx @@ -13,6 +13,12 @@ eye: false } + UNSAFE_componentWillReceiveProps(nextProps) { + if (nextProps.value !== this.props.value) { + this.setState({eye: false}) + } + } + getValue = () => { const { value } = this.props diff --git a/src/components/keyInterface/index.jsx b/src/components/keyInterface/index.jsx new file mode 100644 index 0000000..80074b2 --- /dev/null +++ b/src/components/keyInterface/index.jsx @@ -0,0 +1,273 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import CryptoJS from 'crypto-js' +import { Input, Modal, Form, notification } from 'antd' +import { EditOutlined, DeleteOutlined } from '@ant-design/icons' + +import './index.scss' + +const { TextArea } = Input + +class KeyInterface extends Component { + static propTpyes = { + type: PropTypes.string, + onChange: PropTypes.func + } + + state = { + url: '', + key: '', + visible: false, + setting: null + } + + componentDidMount() { + const { value, type } = this.props + + if (value) { + let content = value + try { + content = JSON.parse(content) + } catch (e) { + content = {} + } + + this.setState({setting: content.message || null, url: content.url || ''}) + } + + if (type === 'develop') { + this.setState({key: window.GLOB.appkey.slice(-16)}) + } + } + + editKey = () => { + let _setting = this.state.setting + + if (this.state.key && _setting && typeof(_setting) === 'string') { + _setting = this.decrypt(this.state.key, _setting) + } + + this.setState({visible: true, setting: _setting || {}}) + } + + decrypt = (token, value) => { + let setting = null + try { + const key = CryptoJS.enc.Utf8.parse(token) + const iv = CryptoJS.enc.Utf8.parse('mksoft') + + let encryptedHexStr = CryptoJS.enc.Hex.parse(value) + let _srcs = CryptoJS.enc.Base64.stringify(encryptedHexStr) + let decrypt = CryptoJS.AES.decrypt(_srcs, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }) + let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8) + setting = decryptedStr.toString() + + setting = JSON.parse(window.decodeURIComponent(window.atob(setting))) + } catch (e) { + notification.warning({ + top: 92, + message: '淇℃伅瑙f瀽澶辫触!', + duration: 5 + }) + setting = {} + } + + return setting + } + + handleConfirm = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (err) return + + if (values.apptoken) { + let key = values.apptoken.slice(-16) + let _setting = this.state.setting + if (_setting && typeof(_setting) === 'string') { + _setting = this.decrypt(key, _setting) + } + this.setState({key: key, setting: _setting}) + return + } + + if (!/\/dostars$/.test(values.interface)) { + notification.warning({ + top: 92, + message: '鎺ュ彛鍦板潃璇峰~鍐檇ostars鎺ュ彛!', + duration: 5 + }) + return + } else if (values.ssoInterface && !/\/dostars$/.test(values.ssoInterface)) { + notification.warning({ + top: 92, + message: 'sso鍦板潃璇峰~鍐檇ostars鎺ュ彛!', + duration: 5 + }) + return + } + + let _values = window.btoa(window.encodeURIComponent(JSON.stringify(values))) + + const key = CryptoJS.enc.Utf8.parse(this.state.key) + const iv = CryptoJS.enc.Utf8.parse('mksoft') + + let srcs = CryptoJS.enc.Utf8.parse(_values) + let encrypted = CryptoJS.AES.encrypt(srcs, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }) + let message = encrypted.ciphertext.toString() + let content = JSON.stringify({message: message, url: values.interface}) + + this.props.onChange(content) + + this.setState({setting: message, url: values.interface, visible: false}) + }) + } + + delKey = () => { + const { type } = this.props + + if (type === 'develop') { + this.setState({setting: null, url: ''}) + } else { + this.setState({key: '', setting: null, url: ''}) + } + + this.props.onChange('') + } + + render() { + const { getFieldDecorator } = this.props.form + const { url, visible, setting, key } = this.state + + return ( + <div className="mk-key-wrap"> + <TextArea value={url} rows={2} readOnly={true}/> + <div className="mk-key-edit"><EditOutlined onClick={this.editKey}/><DeleteOutlined onClick={this.delKey}/></div> + <Modal + wrapClassName='mk-key-modal' + visible={visible} + closable={false} + maskClosable={false} + width={650} + onOk={this.handleConfirm} + onCancel={() => this.setState({visible: false})} + destroyOnClose + > + {key && setting ? + <Form> + <Form.Item label="鎺ュ彛鍦板潃"> + {getFieldDecorator('interface', { + initialValue: setting.interface, + rules: [ + { + required: true, + message: '璇疯緭鍏ユ帴鍙e湴鍧�!' + }, + { + pattern: /^[0-9a-zA-Z:_./]+$/, + message: '鍙彲浣跨敤鑻辨枃銆佹暟瀛椾互鍙�:_./' + } + ] + })(<TextArea rows={2}/>)} + </Form.Item> + <Form.Item label="sso鍦板潃"> + {getFieldDecorator('ssoInterface', { + initialValue: setting.ssoInterface || '', + rules: [ + { + pattern: /^[0-9a-zA-Z:_./]+$/, + message: '鍙彲浣跨敤鑻辨枃銆佹暟瀛椾互鍙�:_./' + } + ] + })(<TextArea rows={2}/>)} + </Form.Item> + <Form.Item label="appkey"> + {getFieldDecorator('appkey', { + initialValue: setting.appkey || '', + rules: [ + { + required: true, + message: '璇疯緭鍏ppkey!' + }, + { + pattern: /^[0-9a-zA-Z]+$/, + message: '鍙彲杈撳叆鑻辨枃鍙婃暟瀛椼��' + }, + { + min: 16, + message: '涓嶅彲灏忎簬16浣嶏紒' + } + ] + })(<Input placeholder="璇疯緭鍏ppkey" autoComplete="off" />)} + </Form.Item> + <Form.Item label="鐢ㄦ埛鍚�"> + {getFieldDecorator('username', { + initialValue: setting.username, + rules: [ + { + required: true, + message: '璇疯緭鍏ョ敤鎴峰悕!' + } + ] + })(<Input placeholder="璇疯緭鍏ョ敤鎴峰悕" autoComplete="off" />)} + </Form.Item> + <Form.Item label="瀵嗙爜"> + {getFieldDecorator('password', { + initialValue: setting.password, + rules: [ + { + required: true, + message: '璇疯緭鍏ュ瘑鐮�!' + } + ] + })(<Input.Password placeholder="璇疯緭鍏ュ瘑鐮�" />)} + </Form.Item> + <Form.Item label="鍏挜"> + {getFieldDecorator('publicKey', { + initialValue: setting.publicKey, + rules: [ + { + required: true, + message: '璇疯緭鍏ュ叕閽�!' + } + ] + })(<Input.Password placeholder={''} autoComplete="off" />)} + </Form.Item> + <Form.Item label="绉侀挜"> + {getFieldDecorator('privateKey', { + initialValue: setting.privateKey, + rules: [ + { + required: true, + message: '璇疯緭鍏ョ閽�!' + } + ] + })(<Input.Password placeholder={''} autoComplete="off" />)} + </Form.Item> + </Form> : null} + {!key ? <Form style={{marginTop: '20px', marginBottom: '50px'}}> + <Form.Item label="apptoken"> + {getFieldDecorator('apptoken', { + initialValue: '', + rules: [ + { + required: true, + message: '璇疯緭鍏ユ寮忕郴缁焌ppkey!' + }, + { + pattern: /^[0-9a-zA-Z]+$/, + message: '鍙彲杈撳叆鑻辨枃鍙婃暟瀛椼��' + }, + { + min: 16, + message: '涓嶅彲灏忎簬16浣嶏紒' + } + ] + })(<Input placeholder="璇疯緭鍏ユ寮忕郴缁焌ppkey" autoComplete="off" />)} + </Form.Item> + </Form> : null} + </Modal> + </div> + ) + } +} + +export default Form.create()(KeyInterface) \ No newline at end of file diff --git a/src/components/keyInterface/index.scss b/src/components/keyInterface/index.scss new file mode 100644 index 0000000..7753a5e --- /dev/null +++ b/src/components/keyInterface/index.scss @@ -0,0 +1,48 @@ +.mk-key-wrap { + position: relative; + margin-bottom: 5px; + + .mk-key-edit { + position: absolute; + right: 0px; + line-height: 1; + + .anticon { + margin-left: 10px; + cursor: pointer; + padding: 0px 5px; + } + .anticon-edit { + color: #1890ff; + } + .anticon-delete { + color: #f5222d; + } + } +} +.mk-key-modal { + .ant-modal { + top: 85px; + } + .ant-modal-body { + padding-top: 35px; + padding-bottom: 0px; + } + .ant-modal-footer { + border-top: none; + text-align: center; + padding-bottom: 30px; + button + button { + margin-left: 15px; + } + } + .ant-form-item { + display: flex; + .ant-form-item-label { + width: 20%; + } + .ant-form-item-control-wrapper { + width: 70%; + } + } +} diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 7ca57d9..b60226c 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -6,6 +6,7 @@ import { formRule } from '@/utils/option.js' import asyncComponent from '@/utils/asyncComponent' +import KeyInterface from '@/components/keyInterface' import './index.scss' const { TextArea } = Input @@ -177,7 +178,7 @@ reReadonly.interface = false reRequired.interface = true } else if (intertype === 'outer') { - shows.push('procMode', 'sysInterface', 'interface', 'outerFunc', 'callbackType', 'output') + shows.push('procMode', 'sysInterface', 'outerFunc', 'callbackType', 'output') if (this.record.procMode === 'system') { shows.push('sql', 'sqlType') } else if (this.record.procMode === 'inner') { @@ -194,10 +195,14 @@ reReadonly.interface = false reRequired.interface = true - shows.push('proInterface') - } else { + shows.push('interface', 'proInterface') + } else if (this.record.sysInterface === 'true') { reReadonly.interface = true reRequired.interface = false + + shows.push('interface') + } else if (this.record.sysInterface === 'external') { + shows.push('exInterface', 'exProInterface') } } else if (intertype === 'inner') { shows.push('innerFunc', 'output') @@ -244,7 +249,7 @@ reOptions.intertype = this.state.interTypeOptions.filter(item => item.value !== 'custom') if (intertype === 'outer') { - shows.push('procMode', 'sysInterface', 'interface', 'outerFunc', 'callbackType') + shows.push('procMode', 'sysInterface', 'outerFunc', 'callbackType') if (this.record.procMode === 'system') { shows.push('sql', 'sqlType') } else if (this.record.procMode === 'inner') { @@ -261,10 +266,14 @@ reReadonly.interface = false reRequired.interface = true - shows.push('proInterface') - } else { + shows.push('interface', 'proInterface') + } else if (this.record.sysInterface === 'true') { reReadonly.interface = true reRequired.interface = false + + shows.push('interface') + } else if (this.record.sysInterface === 'external') { + shows.push('exInterface', 'exProInterface') } } else if (intertype === 'inner') { shows.push('innerFunc') @@ -293,7 +302,7 @@ reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') + shows.push('innerFunc', 'sysInterface', 'outerFunc', 'callbackFunc') reRequired.innerFunc = false reRequired.callbackFunc = false @@ -301,10 +310,14 @@ reReadonly.interface = false reRequired.interface = true - shows.push('proInterface') - } else { + shows.push('interface', 'proInterface') + } else if (this.record.sysInterface === 'true') { reReadonly.interface = true reRequired.interface = false + + shows.push('interface') + } else if (this.record.sysInterface === 'external') { + shows.push('exInterface', 'exProInterface') } } else if (this.record.intertype === 'inner') { shows.push('innerFunc') @@ -317,17 +330,21 @@ reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom') if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc') + shows.push('innerFunc', 'sysInterface', 'outerFunc') reRequired.innerFunc = false if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true - shows.push('proInterface') - } else { + shows.push('interface', 'proInterface') + } else if (this.record.sysInterface === 'true') { reReadonly.interface = true reRequired.interface = false + + shows.push('interface') + } else if (this.record.sysInterface === 'external') { + shows.push('exInterface', 'exProInterface') } } else if (this.record.intertype === 'inner') { shows.push('innerFunc') @@ -379,18 +396,22 @@ if (_funcType === 'print') { shows.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError') if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') + shows.push('innerFunc', 'sysInterface', 'outerFunc', 'callbackFunc') reRequired.innerFunc = false reRequired.callbackFunc = false if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true - - shows.push('proInterface') - } else { + + shows.push('interface', 'proInterface') + } else if (this.record.sysInterface === 'true') { reReadonly.interface = true reRequired.interface = false + + shows.push('interface') + } else if (this.record.sysInterface === 'external') { + shows.push('exInterface', 'exProInterface') } } else if (this.record.intertype === 'inner') { shows.push('innerFunc') @@ -843,6 +864,14 @@ ] content = <TextArea rows={2} readOnly={item.readonly}/> + } else if (item.type === 'keyinterface') { + span = 24 + className = 'textarea' + rules = [ + { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } + ] + + content = <KeyInterface type={item.key === 'exInterface' ? 'develop' : 'product'}/> } fields.push( diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index cb8e4ee..e8a9f57 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -391,16 +391,19 @@ { type: 'radio', key: 'sysInterface', - label: '绯荤粺鎺ュ彛', + label: '绯荤粺绫诲瀷', initVal: card.sysInterface || 'false', - tooltip: '鍗曠偣鐧诲綍绯荤粺', + tooltip: '涓氬姟绯荤粺鎸囧悓涓�sso涓嬬殑鍏朵粬涓氬姟绯荤粺锛屽閮ㄧ郴缁熸寚涓嶅悓sso涓嬬殑鍏朵粬涓氬姟绯荤粺銆�', required: true, options: [{ - value: 'true', - text: '鏄�' - }, { value: 'false', - text: '鍚�' + text: '涓氬姟' + }, { + value: 'true', + text: '鍗曠偣' + }, { + value: 'external', + text: '澶栭儴' }] }, { @@ -423,6 +426,21 @@ key: 'proInterface', label: '姝e紡鍦板潃', initVal: card.proInterface || '', + tooltip: '姝e紡绯荤粺鎵�浣跨敤鐨勬帴鍙e湴鍧�銆�', + required: false + }, + { + type: 'keyinterface', + key: 'exInterface', + label: '娴嬭瘯鍦板潃', + initVal: card.exInterface || '', + required: true + }, + { + type: 'keyinterface', + key: 'exProInterface', + label: '姝e紡鍦板潃', + initVal: card.exProInterface || '', tooltip: '姝e紡绯荤粺鎵�浣跨敤鐨勬帴鍙e湴鍧�銆�', required: false }, @@ -1269,16 +1287,19 @@ { type: 'radio', key: 'sysInterface', - label: '绯荤粺鎺ュ彛', + label: '绯荤粺绫诲瀷', initVal: card.sysInterface || 'false', - tooltip: '鍗曠偣鐧诲綍绯荤粺', + tooltip: '涓氬姟绯荤粺鎸囧悓涓�sso涓嬬殑鍏朵粬涓氬姟绯荤粺锛屽閮ㄧ郴缁熸寚涓嶅悓sso涓嬬殑鍏朵粬涓氬姟绯荤粺銆�', required: true, options: [{ - value: 'true', - text: '鏄�' - }, { value: 'false', - text: '鍚�' + text: '涓氬姟' + }, { + value: 'true', + text: '鍗曠偣' + }, { + value: 'external', + text: '澶栭儴' }] }, { @@ -1305,6 +1326,21 @@ required: false }, { + type: 'keyinterface', + key: 'exInterface', + label: '娴嬭瘯鍦板潃', + initVal: card.exInterface || '', + required: true + }, + { + type: 'keyinterface', + key: 'exProInterface', + label: '姝e紡鍦板潃', + initVal: card.exProInterface || '', + tooltip: '姝e紡绯荤粺鎵�浣跨敤鐨勬帴鍙e湴鍧�銆�', + required: false + }, + { type: 'radio', key: 'method', label: '璇锋眰鏂瑰紡', diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index 7f8ddb1..9081182 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -8,6 +8,7 @@ import Utils from '@/utils/utils.js' import MenuUtils from '@/utils/utils-custom.js' import CodeMirror from '@/templates/zshare/codemirror' +import KeyInterface from '@/components/keyInterface' import './index.scss' const { TextArea } = Input @@ -232,9 +233,9 @@ </Col> {setting.interType === 'outer' ? <Col span={8}> <Form.Item label={ - <Tooltip placement="topLeft" title="鍗曠偣鐧诲綍绯荤粺"> + <Tooltip placement="topLeft" title="涓氬姟绯荤粺鎸囧悓涓�sso涓嬬殑鍏朵粬涓氬姟绯荤粺锛屽閮ㄧ郴缁熸寚涓嶅悓sso涓嬬殑鍏朵粬涓氬姟绯荤粺銆�"> <QuestionCircleOutlined className="mk-form-tip" /> - 绯荤粺鎺ュ彛 + 绯荤粺绫诲瀷 </Tooltip> }> {getFieldDecorator('sysInterface', { @@ -242,13 +243,14 @@ rules: [ { required: true, - message: '璇烽�夋嫨鏄惁浣跨敤绯荤粺鎺ュ彛!' + message: '璇烽�夋嫨绯荤粺绫诲瀷!' } ] })( <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'sysInterface')}}> - <Radio value="true">鏄�</Radio> - <Radio value="false">鍚�</Radio> + <Radio value="false">涓氬姟</Radio> + <Radio value="true">鍗曠偣</Radio> + <Radio value="external">澶栭儴</Radio> </Radio.Group>)} </Form.Item> </Col> : null} @@ -271,7 +273,7 @@ })(<Input placeholder={''} autoComplete="off" />)} </Form.Item> </Col> : null} - {setting.interType === 'outer' ? <Col className="outer-interface" span={24}> + {setting.interType === 'outer' && setting.sysInterface !== 'external' ? <Col className="outer-interface" span={24}> <Form.Item label="鎺ュ彛鍦板潃"> {getFieldDecorator('interface', { initialValue: setting.interface || (setting.sysInterface === 'true' ? window.GLOB.mainSystemApi : ''), @@ -284,8 +286,21 @@ })(<TextArea rows={2} readOnly={setting.sysInterface === 'true'}/>)} </Form.Item> </Col> : null} - {setting.interType === 'outer' && setting.sysInterface !== 'true' ? <Col className="outer-interface" span={24}> - <Form.Item label={<Tooltip placement="topLeft" title="姝e紡绯荤粺鎺ュ彛鍦板潃锛屼负绌烘椂浣跨敤鎺ュ彛鍦板潃"> + {setting.interType === 'outer' && setting.sysInterface === 'external' ? <Col className="outer-interface" span={24}> + <Form.Item label="鎺ュ彛鍦板潃"> + {getFieldDecorator('exInterface', { + initialValue: setting.exInterface, + rules: [ + { + required: true, + message: '璇风紪杈戞帴鍙e湴鍧�!' + } + ] + })(<KeyInterface type="develop"/>)} + </Form.Item> + </Col> : null} + {setting.interType === 'outer' && setting.sysInterface === 'false' ? <Col className="outer-interface" span={24}> + <Form.Item label={<Tooltip placement="topLeft" title="姝e紡绯荤粺鎺ュ彛鍦板潃锛屼负绌烘椂浣跨敤鎺ュ彛鍦板潃銆�"> <QuestionCircleOutlined className="mk-form-tip" /> 姝e紡鍦板潃 </Tooltip> @@ -295,6 +310,17 @@ })(<TextArea rows={2}/>)} </Form.Item> </Col> : null} + {setting.interType === 'outer' && setting.sysInterface === 'external' ? <Col className="outer-interface" span={24}> + <Form.Item label={<Tooltip placement="topLeft" title="姝e紡绯荤粺鎺ュ彛鍦板潃銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 姝e紡鍦板潃 + </Tooltip> + }> + {getFieldDecorator('exProInterface', { + initialValue: setting.exProInterface || '' + })(<KeyInterface type="product"/>)} + </Form.Item> + </Col> : null} {setting.interType === 'outer' ? <Col span={8}> <Form.Item label="澶栭儴鍑芥暟"> {getFieldDecorator('outerFunc', { diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 0c497ea..97a19f4 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -421,9 +421,17 @@ } } } else { - if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { - param.rduri = window.GLOB.mainSystemApi - } else if (btn.sysInterface !== 'true') { + if (btn.sysInterface === 'true') { + if (window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } + } else if (btn.sysInterface === 'external') { + if (window.GLOB.systemType === 'production') { + param.$token = btn.exProInterface || '' + } else { + param.$token = btn.exInterface || '' + } + } else { if (window.GLOB.systemType === 'production' && btn.proInterface) { param.rduri = btn.proInterface } else { diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 80a9e9d..f658b86 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -251,9 +251,17 @@ } } } else { - if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { - param.rduri = window.GLOB.mainSystemApi - } else if (btn.sysInterface !== 'true') { + if (btn.sysInterface === 'true') { + if (window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } + } else if (btn.sysInterface === 'external') { + if (window.GLOB.systemType === 'production') { + param.$token = btn.exProInterface || '' + } else { + param.$token = btn.exInterface || '' + } + } else { if (window.GLOB.systemType === 'production' && btn.proInterface) { param.rduri = btn.proInterface } else { @@ -303,9 +311,17 @@ } } } else { - if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { - res.rduri = window.GLOB.mainSystemApi - } else if (btn.sysInterface !== 'true') { + if (btn.sysInterface === 'true') { + if (window.GLOB.mainSystemApi) { + res.rduri = window.GLOB.mainSystemApi + } + } else if (btn.sysInterface === 'external') { + if (window.GLOB.systemType === 'production') { + res.$token = btn.exProInterface || '' + } else { + res.$token = btn.exInterface || '' + } + } else { if (window.GLOB.systemType === 'production' && btn.proInterface) { res.rduri = btn.proInterface } else { @@ -378,9 +394,17 @@ } } } else { - if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { - res.rduri = window.GLOB.mainSystemApi - } else if (btn.sysInterface !== 'true') { + if (btn.sysInterface === 'true') { + if (window.GLOB.mainSystemApi) { + res.rduri = window.GLOB.mainSystemApi + } + } else if (btn.sysInterface === 'external') { + if (window.GLOB.systemType === 'production') { + res.$token = btn.exProInterface || '' + } else { + res.$token = btn.exInterface || '' + } + } else { if (window.GLOB.systemType === 'production' && btn.proInterface) { res.rduri = btn.proInterface } else { @@ -456,9 +480,17 @@ } } } else { - if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { - param.rduri = window.GLOB.mainSystemApi - } else if (btn.sysInterface !== 'true') { + if (btn.sysInterface === 'true') { + if (window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } + } else if (btn.sysInterface === 'external') { + if (window.GLOB.systemType === 'production') { + param.$token = btn.exProInterface || '' + } else { + param.$token = btn.exInterface || '' + } + } else { if (window.GLOB.systemType === 'production' && btn.proInterface) { param.rduri = btn.proInterface } else { diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index f95e1ef..3e58939 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -1632,9 +1632,17 @@ result.open_key = Utils.encryptOpenKey(result.secretkey, result.timestamp) } } else { - if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { - result.rduri = window.GLOB.mainSystemApi - } else if (btn.sysInterface !== 'true') { + if (btn.sysInterface === 'true') { + if (window.GLOB.mainSystemApi) { + result.rduri = window.GLOB.mainSystemApi + } + } else if (btn.sysInterface === 'external') { + if (window.GLOB.systemType === 'production') { + result.$token = btn.exProInterface || '' + } else { + result.$token = btn.exInterface || '' + } + } else { if (window.GLOB.systemType === 'production' && btn.proInterface) { result.rduri = btn.proInterface } else { diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 26eb140..9caedab 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -834,9 +834,17 @@ } } } else { - if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { - res.rduri = window.GLOB.mainSystemApi - } else if (btn.sysInterface !== 'true') { + if (btn.sysInterface === 'true') { + if (window.GLOB.mainSystemApi) { + res.rduri = window.GLOB.mainSystemApi + } + } else if (btn.sysInterface === 'external') { + if (window.GLOB.systemType === 'production') { + res.$token = btn.exProInterface || '' + } else { + res.$token = btn.exInterface || '' + } + } else { if (window.GLOB.systemType === 'production' && btn.proInterface) { res.rduri = btn.proInterface } else { diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index eaff3d9..b085f16 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -64,9 +64,17 @@ param.rduri = setting.interface } } else { - if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) { - param.rduri = window.GLOB.mainSystemApi - } else if (setting.sysInterface !== 'true') { + if (setting.sysInterface === 'true') { + if (window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } + } else if (setting.sysInterface === 'external') { + if (window.GLOB.systemType === 'production') { + param.$token = setting.exProInterface || '' + } else { + param.$token = setting.exInterface || '' + } + } else { if (window.GLOB.systemType === 'production' && setting.proInterface) { param.rduri = setting.proInterface } else { -- Gitblit v1.8.0