| | |
| | | } |
| | | } |
| | | |
| | | visitOuterSystem (param, _resolve) { |
| | | visitOuterSystem (param, _resolve, _reject) { |
| | | let token = param.$token |
| | | delete param.$token |
| | | |
| | |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | _resolve(res) |
| | | }, () => { |
| | | _reject() |
| | | }) |
| | | } else { |
| | | let _param = { |
| | |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | _resolve(res) |
| | | }, () => { |
| | | _reject() |
| | | }) |
| | | } else { |
| | | _resolve(result) |
| | | } |
| | | }, (e) => { |
| | | if (!e || !e.status) { |
| | | let msg = '网络连接不正常。' |
| | | |
| | | if (/^http:/.test(token.interface) && /https:/.test(window.location.protocol)) { |
| | | msg = '网络连接不正常,接口地址可能不支持https。' |
| | | } |
| | | _resolve({status: false, ErrCode: 'E', message: msg}) |
| | | } else { |
| | | _reject() |
| | | } |
| | | }) |
| | | } |
| | |
| | | if (param.$token === '') { |
| | | return Promise.resolve({status: false, ErrCode: 'token_error', message: '接口地址尚未设置!'}) |
| | | } else if (param.$token) { |
| | | return new Promise(resolve => this.visitOuterSystem(param, resolve)) |
| | | return new Promise((resolve, reject) => this.visitOuterSystem(param, resolve, reject)) |
| | | } |
| | | |
| | | if (['sPC_TableData_InUpDe', 'sPC_TableData_InUpDe_debug'].includes(param.func)) { |
| | |
| | | } else { |
| | | resolve(res) |
| | | } |
| | | }, (e) => { |
| | | if (!e || !e.status) { |
| | | let msg = '网络连接不正常。' |
| | | |
| | | if (/^http:/.test(rduri) && /https:/.test(window.location.protocol)) { |
| | | msg = '网络连接不正常,接口地址可能不支持https。' |
| | | } |
| | | resolve({status: false, ErrCode: 'E', message: msg}) |
| | | } else { |
| | | reject() |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | |
| | | getCallBackSql = (result, record) => { |
| | | const { btn } = this.props |
| | | let lines = [] |
| | | let pre = btn.callbackType === 'script' ? '@' : '' |
| | | let pre = '' |
| | | let tables = [] |
| | | |
| | | if (btn.callbackType === 'script') { // 使用自定义脚本 |
| | | pre = '@' |
| | | |
| | | btn.verify.cbScripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | |
| | | if (/\s#[a-z0-9_]+(\s|\()/ig.test(script.sql)) { |
| | | tables.push(...script.sql.match(/\s#[a-z0-9_]+(\s|\()/ig)) |
| | | } |
| | | }) |
| | | |
| | | tables = tables.map(tb => tb.replace(/\s|\(/g, '')) |
| | | } |
| | | |
| | | let errSql = '' |
| | | if (result.$ErrCode === 'E') { |
| | |
| | | let vals = [] |
| | | let subObjs = [] |
| | | let id = Utils.getuuid() |
| | | let tbName = pre + tb |
| | | |
| | | if (tables.includes('#' + tb)) { |
| | | tbName = '#' + tb |
| | | } |
| | | |
| | | delete obj.$$key |
| | | |
| | |
| | | |
| | | lines.push({ |
| | | table: md5(tb + keys), |
| | | insert: `Insert into ${pre}${tb} (${keys},[mk_level],[mk_id],[mk_bid])`, |
| | | insert: `Insert into ${tbName} (${keys},[mk_level],[mk_id],[mk_bid])`, |
| | | select: `Select ${vals.join(',')},'${level}','${id}','${bid}'` |
| | | }) |
| | | |
| | |
| | | result.rduri = btn.interface |
| | | } |
| | | |
| | | if (/function:/i.test(result.rduri)) { |
| | | let rduri = result.rduri |
| | | try { |
| | | rduri = rduri.replace(/function:/i, '') |
| | | // eslint-disable-next-line |
| | | let func = new Function(rduri) |
| | | result.rduri = func() |
| | | } catch (e) { |
| | | console.warn(e) |
| | | } |
| | | } |
| | | |
| | | let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') |
| | | if (result.rduri.indexOf(host) === -1 && /\/dostars/.test(result.rduri)) { |
| | | result.$login = true |