| | |
| | | return |
| | | } else if (!['requiredSgl', 'notRequired', 'requiredOnce', 'required'].includes(btn.Ot)) { |
| | | // 数据选择类型校验 |
| | | this.actionSettingError() |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '按钮行设置错误!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.intertype === 'system') { |
| | | // 使用内部接口时,操作类型和数据源不可为空 |
| | | if (!btn.sql || !btn.sqlType) { |
| | | this.actionSettingError() |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '按钮操作类型错误!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (data.length === 0 && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { |
| | | notification.warning({ |
| | |
| | | } else if (btn.intertype === 'inner') { |
| | | // 使用内部接口时,内部函数不可为空 |
| | | if (!btn.innerFunc) { |
| | | this.actionSettingError() |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '按钮内部函数不可为空!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } else if (btn.intertype === 'custom') { |
| | | } else if (btn.intertype === 'custom' || btn.intertype === 'outer') { |
| | | if (btn.callbackType === 'script' && (!btn.verify || !btn.verify.cbScripts || !btn.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) { |
| | | this.actionSettingError() |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用自定义脚本回调时,回调脚本不可为空!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.procMode === 'system' && data.length === 0 && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { |
| | | notification.warning({ |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (window.GLOB.systemType === 'production' && !btn.proInterface) { |
| | | } else if (btn.intertype === 'custom' && window.GLOB.systemType === 'production' && !btn.proInterface) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '尚未设置正式系统接口地址!', |
| | |
| | | }) |
| | | return |
| | | } |
| | | } else if (btn.intertype === 'outer') { |
| | | // 接口地址不存在时报错 |
| | | if (!btn.interface && btn.sysInterface !== 'true') { |
| | | this.actionSettingError() |
| | | return |
| | | } |
| | | } else if (!['inner', 'outer', 'system', 'custom'].includes(btn.intertype)) { |
| | | // 接口类型错误 |
| | | this.actionSettingError() |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '按钮接口类型错误!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | |
| | | return _params |
| | | } |
| | | |
| | | getInnerParam = (data, formdata) => { |
| | | const { setting, btn } = this.props |
| | | getInnerParam = (data, formdata, retmsg) => { |
| | | const { setting, btn, columns } = this.props |
| | | let _params = [] |
| | | |
| | | if ( btn.Ot === 'notRequired' || btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce' ) { |
| | | let param = { |
| | | func: btn.innerFunc |
| | | func: btn.innerFunc || '' |
| | | } |
| | | |
| | | if (this.props.BID) { |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (retmsg) { |
| | | param.$callbacksql = this.getSysDeclareSql(btn, formdata, data[0], columns) |
| | | } |
| | | |
| | | _params.push(param) |
| | |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (retmsg) { |
| | | param.$callbacksql = this.getSysDeclareSql(btn, formdata, cell, columns) |
| | | } |
| | | |
| | | return param |
| | | }) |
| | | } |
| | | |
| | | return _params |
| | | } |
| | | |
| | | /** |
| | | * @description 获取回调脚本的字段定义 |
| | | */ |
| | | getSysDeclareSql = (btn, formdata, data, columns) => { |
| | | let datavars = {} // 声明的变量,表单及显示列 |
| | | // 需要声明的变量集 |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'bid'] |
| | | |
| | | // sql语句 |
| | | let _sql = '' |
| | | |
| | | let _initvars = [] // 已赋值字段集 |
| | | let _initFormfields = [] |
| | | let _initColfields = [] |
| | | let _declarefields = [] |
| | | |
| | | // 获取字段键值对 |
| | | formdata && formdata.forEach(form => { |
| | | let _key = form.key.toLowerCase() |
| | | datavars[_key] = form.value |
| | | |
| | | if (!_initvars.includes(_key)) { |
| | | _initvars.push(_key) |
| | | |
| | | if (form.type === 'number' || form.type === 'rate') { |
| | | let val = form.value |
| | | if (typeof(val) !== 'number') { |
| | | val = parseFloat(val) |
| | | if (isNaN(val)) { |
| | | val = 0 |
| | | } |
| | | } |
| | | _initFormfields.push(`@${_key}=${val}`) |
| | | } else if (['date', 'datemonth', 'datetime'].includes(form.type)) { |
| | | _initFormfields.push(`@${_key}='${form.value || '1949-10-01'}'`) |
| | | } else { |
| | | _initFormfields.push(`@${_key}='${form.value}'`) |
| | | } |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _vars.push(_key) |
| | | |
| | | if (form.fieldlen && form.fieldlen > 2048) { |
| | | form.fieldlen = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${form.fieldlen})` |
| | | |
| | | if (form.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | } else if (form.type === 'number') { |
| | | _type = `decimal(18,${form.fieldlen})` |
| | | } else if (form.type === 'rate') { |
| | | _type = `decimal(18,2)` |
| | | } |
| | | |
| | | _declarefields.push(`@${_key} ${_type}`) |
| | | } |
| | | }) |
| | | |
| | | if (data) { |
| | | Object.keys(data).forEach(key => { |
| | | data[key.toLowerCase()] = data[key] |
| | | }) |
| | | } |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (data && btn.Ot !== 'notRequired' && btn.Ot !== 'requiredOnce') { |
| | | datavars = {...data, ...datavars} |
| | | |
| | | const setField = (col) => { |
| | | if (!col.field) return |
| | | let _key = col.field.toLowerCase() |
| | | |
| | | if (!_initvars.includes(_key)) { |
| | | let _val = datavars.hasOwnProperty(_key) ? datavars[_key] : '' |
| | | |
| | | if (col.datatype && /^date/ig.test(col.datatype) && !_val) { |
| | | _val = '1949-10-01' |
| | | } |
| | | |
| | | _initvars.push(_key) |
| | | _initColfields.push(`@${_key}='${_val}'`) |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _vars.push(_key) |
| | | |
| | | if (col.datatype) { |
| | | _declarefields.push(`@${_key} ${col.datatype}`) |
| | | } else { |
| | | if (col.fieldlength && col.fieldlength > 2048) { |
| | | col.fieldlength = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${col.fieldlength || 50})` |
| | | |
| | | if (col.type === 'number') { |
| | | let _length = col.decimal ? col.decimal : 0 |
| | | _type = `decimal(18,${_length})` |
| | | } else if (col.type === 'picture' || col.type === 'textarea') { |
| | | _type = `nvarchar(${col.fieldlength || 512})` |
| | | } |
| | | |
| | | _declarefields.push(`@${_key} ${_type}`) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (columns && columns.length > 0) { |
| | | columns.forEach(col => { |
| | | if (col.type === 'colspan' || col.type === 'old_colspan') { |
| | | col.subcols.forEach(cell => { |
| | | setField(cell) |
| | | }) |
| | | } else { |
| | | setField(col) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // 变量声明 |
| | | _declarefields = _declarefields.join(',') |
| | | if (_declarefields) { |
| | | _declarefields = ',' + _declarefields |
| | | } |
| | | _sql = `/* 系统生成 */ |
| | | Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@bid nvarchar(50)${_declarefields} |
| | | ` |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | let RoleID = sessionStorage.getItem('role_id') || '' |
| | | let departmentcode = sessionStorage.getItem('departmentcode') || '' |
| | | let organization = sessionStorage.getItem('organization') || '' |
| | | let mk_user_type = sessionStorage.getItem('mk_user_type') || '' |
| | | let nation = sessionStorage.getItem('nation') || '' |
| | | let province = sessionStorage.getItem('province') || '' |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let district = sessionStorage.getItem('district') || '' |
| | | let address = sessionStorage.getItem('address') || '' |
| | | |
| | | if (sessionStorage.getItem('isEditState') === 'true') { |
| | | userName = sessionStorage.getItem('CloudUserName') || '' |
| | | fullName = sessionStorage.getItem('CloudFullName') || '' |
| | | } |
| | | |
| | | // 初始化凭证及用户信息字段 |
| | | _sql += ` |
| | | /* 凭证及用户信息初始化赋值 */ |
| | | select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}', @BillCode='', @ModularDetailCode='' |
| | | ` |
| | | |
| | | // 表单变量赋值 |
| | | if (_initFormfields.length > 0) { |
| | | _sql += ` |
| | | /* 表单变量赋值 */ |
| | | select ${_initFormfields.join(',')} |
| | | ` |
| | | } |
| | | // 显示列变量赋值 |
| | | if (_initColfields.length > 0) { |
| | | _sql += ` |
| | | /* 显示列变量赋值 */ |
| | | select ${_initColfields.join(',')} |
| | | ` |
| | | } |
| | | |
| | | return _sql |
| | | } |
| | | |
| | | /** |
| | |
| | | /** *********************调用外部接口************************* */ |
| | | let _params = [] // 请求参数数组 |
| | | |
| | | if (btn.Ot === 'notRequired' || btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') { |
| | | let param = {} |
| | | |
| | | if (this.props.BID) { |
| | | param.BID = this.props.BID |
| | | } |
| | | |
| | | if ((btn.OpenType === 'pop' || btn.OpenType === 'formSubmit' || btn.OpenType === 'form') && formdata) { // 表单 |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | } |
| | | |
| | | // 获取id |
| | | if (btn.Ot === 'notRequired') { |
| | | |
| | | } else if (btn.Ot === 'requiredSgl' && setting.primaryKey) { |
| | | param[setting.primaryKey] = data[0][setting.primaryKey] |
| | | } else if (btn.Ot === 'requiredOnce' && setting.primaryKey) { |
| | | let ids = data.map(d => { return d[setting.primaryKey]}) |
| | | param[setting.primaryKey] = ids.join(',') |
| | | } |
| | | |
| | | _params.push(param) |
| | | } else if (btn.Ot === 'required') { |
| | | // 选择多行,循环调用 |
| | | _params = data.map((cell, index) => { |
| | | let _cell = {} |
| | | |
| | | if (this.props.BID) { |
| | | _cell.BID = this.props.BID |
| | | } |
| | | |
| | | let _formparam = {} |
| | | if (btn.OpenType === 'pop' && formdata) { // 表单 |
| | | formdata.forEach(_data => { |
| | | if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { |
| | | _formparam[_data.key] = cell[_data.key] |
| | | if (btn.procMode === 'system') { |
| | | _params = this.getSystemParam(data, formdata, btn.callbackType === 'script') |
| | | } else { |
| | | _formparam[_data.key] = _data.value |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (setting.primaryKey) { |
| | | _cell[setting.primaryKey] = cell[setting.primaryKey] |
| | | } |
| | | |
| | | _cell = {..._formparam, ..._cell} |
| | | |
| | | return _cell |
| | | }) |
| | | _params = this.getInnerParam(data, formdata, btn.callbackType === 'script') |
| | | } |
| | | |
| | | if (_params.length > 1 && btn.progress === 'progressbar' && btn.$toolbtn) { |
| | |
| | | } |
| | | |
| | | // 循环调用外部接口(包括内部及回调函数) |
| | | this.outerLoopRequest(_params, btn, _resolve) |
| | | this.outerLoopRequest(_params, _resolve) |
| | | } else if (btn.intertype === 'custom') { // 系统接口 |
| | | let params = [] |
| | | |
| | | if (btn.procMode === 'system') { |
| | | params = this.getSystemParam(data, formdata, true) |
| | | params = this.getSystemParam(data, formdata, btn.callbackType === 'script') |
| | | params = params.map(item => { |
| | | item.script_type = 'Y' |
| | | return item |
| | | }) |
| | | } else { |
| | | params = this.getInnerParam(data, formdata) |
| | | params = this.getInnerParam(data, formdata, btn.callbackType === 'script') |
| | | } |
| | | |
| | | if (params.length > 1 && btn.progress === 'progressbar' && btn.$toolbtn) { |
| | |
| | | |
| | | delete param.$callbacksql |
| | | |
| | | if (!param.func) { |
| | | this.customOuterRequest(params, param, record, _resolve) |
| | | return |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if ((res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) && params.length === 0) { |
| | |
| | | } else { |
| | | this.customOuterRequest(params, res, record, _resolve) |
| | | } |
| | | } else if (res.ErrCode === 'C' && this.state.checkParam) { |
| | | const _this = this |
| | | confirm({ |
| | | title: res.message || res.ErrMesg, |
| | | content: '继续执行?', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(_this.state.checkParam).then((result) => { |
| | | if (result.status) { |
| | | if ((result.mk_ex_invoke === 'false' || result.mk_ex_invoke === false) && params.length === 0) { |
| | | _this.execSuccess(result) |
| | | _resolve() |
| | | } else if ((result.mk_ex_invoke === 'false' || result.mk_ex_invoke === false) && params.length > 0) { |
| | | _this.customLoopRequest(params, _resolve) |
| | | } else { |
| | | _this.customOuterRequest(params, result, record, _resolve) |
| | | } |
| | | } else { |
| | | _this.execError(result) |
| | | _resolve() |
| | | } |
| | | resolve() |
| | | }, () => { |
| | | _this.updateStatus() |
| | | resolve() |
| | | _resolve() |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | _this.execError({...res, ErrCode: 'P'}) |
| | | _resolve() |
| | | } |
| | | }) |
| | | this.setState({checkParam: null}) |
| | | } else { |
| | | this.execError(res) |
| | | _resolve() |
| | |
| | | * @description 回调请求循环执行 |
| | | */ |
| | | customCallbackRequest = (params, result, record, _resolve) => { |
| | | const { btn } = this.props |
| | | |
| | | let param = null |
| | | |
| | | if (btn.callbackType === 'script' || btn.callbackType === 'default') { |
| | | param = this.getCallBackSql(result, record) |
| | | } else if (btn.callbackType === 'func') { |
| | | param = { |
| | | func: btn.callbackFunc, |
| | | ...result |
| | | } |
| | | if (result.$ErrCode === 'E') { |
| | | delete param.$ErrCode |
| | | delete param.$ErrMesg |
| | | |
| | | param.ErrCode = 'E' |
| | | } |
| | | } else { |
| | | if (result.$ErrCode === 'E') { |
| | | result.status = false |
| | | result.message = result.$ErrMesg |
| | | result.ErrCode = 'E' |
| | | result.ErrMesg = result.$ErrMesg |
| | | } else { |
| | | result.status = result.status !== false |
| | | result.ErrCode = result.ErrCode || '-1' |
| | | } |
| | | |
| | | if (result.status) { |
| | | if (params.length === 0) { |
| | | this.execSuccess(result) |
| | | _resolve() |
| | | } else { |
| | | this.customLoopRequest(params, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(result) |
| | | _resolve() |
| | | } |
| | | |
| | | return |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | | _resolve() |
| | | } else { |
| | | this.customLoopRequest(params, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(res) |
| | | _resolve() |
| | | } |
| | | }, () => { |
| | | this.updateStatus() |
| | | _resolve() |
| | | }) |
| | | } |
| | | |
| | | getCallBackSql = (result, record) => { |
| | | const { btn } = this.props |
| | | let lines = [] |
| | | let pre = btn.callbackType === 'script' ? '@' : '' |
| | |
| | | } |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | | _resolve() |
| | | } else { |
| | | this.customLoopRequest(params, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(res) |
| | | _resolve() |
| | | } |
| | | }, () => { |
| | | this.updateStatus() |
| | | _resolve() |
| | | }) |
| | | return param |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * @description 外部请求循环执行 |
| | | */ |
| | | outerLoopRequest = (params, btn, _resolve) => { |
| | | outerLoopRequest = (params, _resolve) => { |
| | | if (!params && params.length === 0) return |
| | | |
| | | let param = params.shift() |
| | | let _outParam = null |
| | | |
| | | this.setState({ |
| | | loadingNumber: params.length |
| | | }) |
| | | |
| | | new Promise(resolve => { |
| | | // 内部请求 |
| | | if (btn.innerFunc) { |
| | | param.func = btn.innerFunc |
| | | |
| | | // 函数 s_sDataDictb_TBBack 云端验证 |
| | | if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | let record = { |
| | | BID: param.BID || '', |
| | | ID: param.ID || '', |
| | | callbacksql: param.$callbacksql || '' |
| | | } |
| | | |
| | | // 存在内部函数时,数据预处理 |
| | | delete param.$callbacksql |
| | | |
| | | if (!param.func) { |
| | | this.outerOuterRequest(params, param, record, _resolve) |
| | | return |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if ((res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) && params.length === 0) { |
| | | this.execSuccess(res) |
| | | _resolve() |
| | | } else if ((res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) && params.length > 0) { |
| | | this.outerLoopRequest(params, _resolve) |
| | | } else { |
| | | delete res.mk_ex_invoke |
| | | delete res.ErrCode |
| | | delete res.ErrMesg |
| | | delete res.message |
| | |
| | | res.BID = this.props.BID |
| | | } |
| | | |
| | | resolve(res) |
| | | this.outerOuterRequest(params, res, record, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(res, btn) |
| | | resolve(false) |
| | | this.execError(res) |
| | | _resolve() |
| | | } |
| | | }, () => { |
| | | this.updateStatus() |
| | | _resolve() |
| | | }) |
| | | } else { |
| | | resolve(param) |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | // 外部请求 |
| | | _outParam = JSON.parse(JSON.stringify(res)) |
| | | |
| | | outerOuterRequest = (params, result, record, _resolve) => { |
| | | const { btn } = this.props |
| | | let outParam = JSON.parse(JSON.stringify(result)) |
| | | |
| | | if (btn.outerFunc) { |
| | | res.func = btn.outerFunc |
| | | result.func = btn.outerFunc |
| | | } |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | res.rduri = options.cloudServiceApi |
| | | result.rduri = options.cloudServiceApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | | result.rduri = btn.proInterface |
| | | } else { |
| | | res.rduri = btn.interface |
| | | result.rduri = btn.interface |
| | | } |
| | | } |
| | | |
| | | // 函数 s_sDataDictb_TBBack 云端验证 |
| | | if (res.func === 's_sDataDictb_TBBack' && res.LTextOut) { |
| | | res.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | res.secretkey = Utils.encrypt(res.LTextOut, res.timestamp) |
| | | res.open_key = Utils.encryptOpenKey(res.secretkey, res.timestamp) |
| | | if (result.func === 's_sDataDictb_TBBack' && result.LTextOut) { |
| | | result.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | result.secretkey = Utils.encrypt(result.LTextOut, result.timestamp) |
| | | result.open_key = Utils.encryptOpenKey(result.secretkey, result.timestamp) |
| | | } |
| | | } else { |
| | | if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { |
| | | res.rduri = window.GLOB.mainSystemApi |
| | | result.rduri = window.GLOB.mainSystemApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | | result.rduri = btn.proInterface |
| | | } else { |
| | | res.rduri = btn.interface |
| | | result.rduri = btn.interface |
| | | } |
| | | } |
| | | } |
| | | |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | if (!response) return |
| | | // 回调请求 |
| | | if (btn.callbackFunc) { |
| | | // 存在回调函数时,调用 |
| | | delete response.message |
| | | delete response.status |
| | | Api.genericInterface(result).then(res => { |
| | | this.outerCallbackRequest(params, res, record, outParam, _resolve) |
| | | }, () => { |
| | | this.outerCallbackRequest(params, {status: false, message: 500, ErrCode: 'E', ErrMesg: 500}, record, outParam, _resolve) |
| | | }) |
| | | } |
| | | |
| | | response.func = btn.callbackFunc |
| | | /** |
| | | * @description 回调请求循环执行 |
| | | */ |
| | | outerCallbackRequest = (params, result, record, outParam, _resolve) => { |
| | | const { btn } = this.props |
| | | |
| | | let _callbackparam = {..._outParam, ...response} |
| | | let param = null |
| | | |
| | | if (btn.callbackType === 'script' || btn.callbackType === 'default') { |
| | | param = this.getCallBackSql(result, record) |
| | | } else if (btn.callbackType === 'func' || btn.callbackFunc) { |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | param = { |
| | | func: btn.callbackFunc, |
| | | ...outParam, |
| | | ...result |
| | | } |
| | | |
| | | // 函数 s_sDataDictb_TBBack 云端验证 |
| | | if (window.GLOB.mkHS && _callbackparam.func === 's_sDataDictb_TBBack' && _callbackparam.LTextOut) { |
| | | _callbackparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | _callbackparam.secretkey = Utils.encrypt(_callbackparam.LTextOut, _callbackparam.timestamp) |
| | | _callbackparam.open_key = Utils.encryptOpenKey(_callbackparam.secretkey, _callbackparam.timestamp) |
| | | if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | return Api.genericInterface(_callbackparam) |
| | | } else { |
| | | if (response.status) { |
| | | // 一次请求成功,进行下一项请求 |
| | | |
| | | if (result.status) { |
| | | if (params.length === 0) { |
| | | this.execSuccess(response) |
| | | this.execSuccess(result) |
| | | _resolve() |
| | | } else { |
| | | this.outerLoopRequest(params, btn, _resolve) |
| | | this.outerLoopRequest(params, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(response) |
| | | this.execError(result) |
| | | _resolve() |
| | | } |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | |
| | | return |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | // 一次请求成功,进行下一项请求 |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | | _resolve() |
| | | } else { |
| | | this.outerLoopRequest(params, btn, _resolve) |
| | | this.outerLoopRequest(params, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(res) |
| | |
| | | let data = this.props.selectedData && this.props.selectedData[0] ? this.props.selectedData[0] : null |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮配置信息错误提示 |
| | | */ |
| | | actionSettingError = () => { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.settingerror'], |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | handleModelConfig = (config) => { |