| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { getSysDefaultSql } from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import { updateForm } from '@/utils/utils-update.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | visible: false, |
| | | formdata: null, |
| | | selines: null, |
| | |
| | | // 需要选择行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.confirm.selectline'], |
| | | message: '请选择行!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | |
| | | // 需要选择单行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.confirm.selectSingleLine'], |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (!['requiredSgl', 'notRequired', 'requiredOnce', 'required'].includes(btn.Ot)) { |
| | | // 数据选择类型校验 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '按钮行设置错误!', |
| | | message: '请选择单行数据!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | |
| | | } else if (btn.OpenType === 'prompt') { |
| | | this.setState({loading: true}) |
| | | confirm({ |
| | | title: btn.tipTitle || this.state.dict['main.action.confirm.tip'], |
| | | title: btn.tipTitle || '确定要执行吗?', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(data, resolve) |
| | |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*') |
| | | param.LText = param.LText.replace(/@\$/ig, '*/') |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*') |
| | | param.LText = param.LText.replace(/@\$/ig, '*/') |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*') |
| | | param.LText = param.LText.replace(/@\$/ig, '*/') |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*') |
| | | param.LText = param.LText.replace(/@\$/ig, '*/') |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*') |
| | | param.LText = param.LText.replace(/@\$/ig, '*/') |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*') |
| | | param.LText = param.LText.replace(/@\$/ig, '*/') |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | |
| | | let district = sessionStorage.getItem('district') || '' |
| | | let address = sessionStorage.getItem('address') || '' |
| | | |
| | | if (sessionStorage.getItem('isEditState') === 'true') { |
| | | userName = sessionStorage.getItem('CloudUserName') || '' |
| | | fullName = sessionStorage.getItem('CloudFullName') || '' |
| | | } |
| | | |
| | | // 初始化凭证及用户信息字段 |
| | | _sql += ` |
| | | /* 凭证及用户信息初始化赋值 */ |
| | |
| | | _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | _sql = _sql.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | _sql = _sql.replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | _sql = _sql.replace(/@datam@/ig, '\'\'') |
| | | } |
| | | |
| | | return _sql |
| | | } |
| | |
| | | }, 600) |
| | | } |
| | | |
| | | this.triggerNote(res) // 消息 |
| | | this.triggerNote(res, _param.ID) // 消息 |
| | | this.execSuccess(res) |
| | | } else { |
| | | this.execError(res) |
| | |
| | | setTimeout(() => { |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.triggerNote(res) // 消息 |
| | | this.triggerNote(res, param.ID) // 消息 |
| | | } |
| | | resolve(res) |
| | | }, (error) => { |
| | |
| | | let record = { |
| | | BID: param.BID || '', |
| | | ID: param.ID || '', |
| | | callbacksql: param.$callbacksql || '' |
| | | callbacksql: param.$callbacksql || '', |
| | | mk_api_key: '' |
| | | } |
| | | |
| | | delete param.$callbacksql |
| | | |
| | | if (!param.func) { |
| | | if (param.$pice) { |
| | | record = param.$record |
| | | |
| | | delete param.$record |
| | | |
| | | this.customOuterRequest(params, param, record, _resolve) |
| | | return |
| | | } else if (!param.func) { |
| | | this.customOuterRequest(params, param, record, _resolve) |
| | | return |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | record.mk_api_key = res.mk_api_key || '' |
| | | |
| | | if (res.status) { |
| | | if ((res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) && params.length === 0) { |
| | | if (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) { |
| | | } else if (res.mk_ex_invoke + '' === 'false' && params.length > 0) { |
| | | this.customLoopRequest(params, _resolve) |
| | | } else { |
| | | this.customOuterRequest(params, res, record, _resolve) |
| | | if (res.mk_ex_data) { // 数据分批执行 |
| | | if (Array.isArray(res.mk_ex_data) && res.mk_ex_data.length > 0) { |
| | | let pices = res.mk_ex_data.map(item => { |
| | | item.$pice = true |
| | | item.$record = {...record} |
| | | |
| | | if (item.hasOwnProperty('mk_api_key')) { |
| | | item.$record.mk_api_key = item.mk_api_key || record.mk_api_key || '' |
| | | |
| | | delete item.mk_api_key |
| | | } |
| | | return item |
| | | }) |
| | | params = [...pices, ...params] |
| | | this.customLoopRequest(params, _resolve) |
| | | } else if (params.length === 0) { |
| | | this.execSuccess(res) |
| | | _resolve() |
| | | } else { |
| | | this.customLoopRequest(params, _resolve) |
| | | } |
| | | } else { |
| | | this.customOuterRequest(params, res, record, _resolve) |
| | | } |
| | | } |
| | | } else { |
| | | this.execError(res) |
| | |
| | | url = btn.interface |
| | | } |
| | | |
| | | let mkey = result.mk_api_key || '' |
| | | |
| | | delete result.mk_ex_invoke |
| | | delete result.status |
| | | delete result.message |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.mk_api_key |
| | | |
| | | |
| | | let param = {} |
| | | |
| | | Object.keys(result).forEach(key => { |
| | | key = key.replace(/^mk_/ig, '') |
| | | param[key] = result[key] |
| | | }) |
| | | if (result.$pice) { |
| | | delete result.$pice |
| | | |
| | | param = {...result} |
| | | } else { |
| | | delete result.mk_ex_invoke |
| | | delete result.status |
| | | delete result.message |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.mk_api_key |
| | | |
| | | Object.keys(result).forEach(key => { |
| | | key = key.replace(/^mk_/ig, '') |
| | | param[key] = result[key] |
| | | }) |
| | | } |
| | | |
| | | let _params = { |
| | | url: url, |
| | |
| | | } |
| | | |
| | | let result = { |
| | | mk_api_key: mkey, |
| | | mk_api_key: record.mk_api_key, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: error |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | res.mk_api_key = mkey |
| | | res.mk_api_key = record.mk_api_key |
| | | this.customCallbackRequest(params, res, record, _resolve) |
| | | } |
| | | }, (e) => { |
| | | let result = { |
| | | mk_api_key: mkey, |
| | | mk_api_key: record.mk_api_key, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: e && e.statusText ? e.statusText : '' |
| | | } |
| | |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.triggerNote(res, param.ID) // 消息 |
| | | |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | | _resolve() |
| | |
| | | if (typeof(val) === 'string') { |
| | | val = val.replace(/'/ig, '"') |
| | | } |
| | | keys.push(key) |
| | | keys.push('[' + key + ']') |
| | | vals.push(`'${val}'`) |
| | | } |
| | | }) |
| | | |
| | | lines.push({ |
| | | table: tb, |
| | | insert: `Insert into ${pre}${tb} (${keys.join(',')},mk_level,mk_id,mk_bid)`, |
| | | insert: `Insert into ${pre}${tb} (${keys.join(',')},[mk_level],[mk_id],[mk_bid])`, |
| | | select: `Select ${vals.join(',')},'${level}','${id}','${bid}'` |
| | | }) |
| | | |
| | |
| | | sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | sql = sql.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | if (window.GLOB.debugger === true) { |
| | | console.info(sql.replace(/\n\s{8}/ig, '\n')) |
| | | } |
| | | |
| | | param.LText = sql |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | param.LText = param.LText.replace(/\$@/ig, '/*') |
| | | param.LText = param.LText.replace(/@\$/ig, '*/') |
| | | param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | } |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | |
| | |
| | | Sort: index + 1 |
| | | })) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | if (window.GLOB.debugger === true) { |
| | | let sql = [...lineMap.values()].map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.triggerNote(res) // 消息 |
| | | this.triggerNote(res, param.ID) // 消息 |
| | | |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.triggerNote(res) // 消息 |
| | | this.triggerNote(res, param.ID) // 消息 |
| | | |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | |
| | | this.checkLoopRequest(params, _resolve) |
| | | } |
| | | } else if (res.ErrCode === 'C') { |
| | | let msg = res.message || '' |
| | | if (/\n|\r/.test(msg)) { |
| | | msg = msg.replace(/\n|\r/ig, '<br/>') |
| | | msg = <span dangerouslySetInnerHTML={{__html: msg}}></span> |
| | | } |
| | | const _this = this |
| | | confirm({ |
| | | title: '继续执行?', |
| | | content: res.message, |
| | | title: '请确认', |
| | | content: msg, |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(unCheckParam).then(result => { |
| | | if (result.status) { |
| | | _this.triggerNote(result) // 消息 |
| | | _this.triggerNote(result, param.ID) // 消息 |
| | | |
| | | if (params.length === 0) { |
| | | _this.execSuccess(result) |
| | |
| | | if (window.GLOB.mainSystemApi) { |
| | | result.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | } else if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | result.rduri = options.cloudServiceApi |
| | | } else if (btn.sysInterface === 'true' && window.GLOB.cloudServiceApi) { |
| | | result.rduri = window.GLOB.cloudServiceApi |
| | | result.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | result.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.triggerNote(res, param.ID) // 消息 |
| | | |
| | | // 一次请求成功,进行下一项请求 |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | |
| | | */ |
| | | execSuccess = (res = {}) => { |
| | | const { btn } = this.props |
| | | const { btnconfig, autoMatic } = this.state |
| | | const { autoMatic } = this.state |
| | | |
| | | if (autoMatic) { |
| | | this.setState({ |
| | | loading: false, |
| | | visible: false |
| | | }) |
| | | MKEmitter.emit('autoExecOver', btn.uuid, 'success') |
| | | return |
| | | } |
| | | |
| | | let sign = '' |
| | | if (/^@speak@/i.test(res.message)) { |
| | |
| | | if (!res.message) { |
| | | res.ErrCode = '-1' |
| | | } |
| | | } else if (/@close_tab@|@close_popup@|@goback@/i.test(res.message)) { |
| | | sign = res.message.match(/@close_tab@|@close_popup@|@goback@/i)[0].toLowerCase() |
| | | res.message = res.message.replace(/@close_tab@|@close_popup@|@goback@/i, '') |
| | | } |
| | | |
| | | if ((res.ErrCode === 'S' || !res.ErrCode) || autoMatic) { // 执行成功 |
| | | if (btn.formType !== 'counter' || res.message) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.message || '执行成功!', |
| | | duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 |
| | | }) |
| | | } |
| | | } else if (res.ErrCode === 'Y') { // 执行成功 |
| | | Modal.success({ |
| | | title: res.message || '执行成功!' |
| | | }) |
| | | } else if (res.ErrCode === '-1') { // 完成后不提示 |
| | | |
| | | } |
| | | |
| | | this.setState({ |
| | | loadingNumber: '', |
| | | loadingTotal: '', |
| | | }) |
| | | |
| | | if (autoMatic) { |
| | | this.setState({ |
| | | loading: false, |
| | | visible: false |
| | | }) |
| | | MKEmitter.emit('autoExecOver', btn.uuid, 'success') |
| | | return |
| | | } else if (btn.OpenType !== 'pop' || !btnconfig || btnconfig.setting.finish !== 'unclose') { |
| | | this.setState({ |
| | | loading: false, |
| | | visible: false |
| | | }) |
| | | } else if (/@close_tab@|@close_popup@|@goback@|@no_target_menu@/i.test(res.message)) { |
| | | sign = res.message.match(/@close_tab@|@close_popup@|@goback@|@no_target_menu@/i)[0].toLowerCase() |
| | | res.message = res.message.replace(/@close_tab@|@close_popup@|@goback@|@no_target_menu@/i, '') |
| | | } |
| | | |
| | | let id = '' |
| | |
| | | if (res.mk_icon) { |
| | | sessionStorage.setItem('avatar', res.mk_icon) |
| | | } |
| | | |
| | | res.ErrCode = res.ErrCode || 'S' |
| | | |
| | | if (res.ErrCode === 'S') { // 执行成功 |
| | | if (btn.formType !== 'counter' || res.message) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.message || '执行成功!', |
| | | duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 |
| | | }) |
| | | } |
| | | } else if (res.ErrCode === 'Y') { // 执行成功 |
| | | let msg = res.message || '执行成功!' |
| | | if (/\n|\r/.test(msg)) { |
| | | msg = msg.replace(/\n|\r/ig, '<br/>') |
| | | msg = <span dangerouslySetInnerHTML={{__html: msg}}></span> |
| | | } |
| | | Modal.success({ |
| | | title: msg, |
| | | onOk: () => { |
| | | this.successContinue(sign, id) |
| | | } |
| | | }) |
| | | return |
| | | } else if (res.ErrCode === '-1') { // 完成后不提示 |
| | | |
| | | } |
| | | |
| | | this.successContinue(sign, id) |
| | | } |
| | | |
| | | successContinue = (sign, id) => { |
| | | const { btn } = this.props |
| | | const { btnconfig } = this.state |
| | | |
| | | this.setState({ |
| | | loadingNumber: '', |
| | | loadingTotal: '', |
| | | }) |
| | | |
| | | if (btn.OpenType !== 'pop' || !btnconfig || btnconfig.setting.finish !== 'unclose') { |
| | | this.setState({ |
| | | loading: false, |
| | | visible: false |
| | | }) |
| | | } |
| | | |
| | | let tabId = '' |
| | | if (btn.refreshTab && btn.refreshTab.length > 0) { |
| | | tabId = btn.refreshTab[btn.refreshTab.length - 1] |
| | |
| | | node && node.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'}) |
| | | } |
| | | |
| | | if (btn.openmenu && Array.isArray(btn.openmenu) && btn.openmenu.length > 0) { |
| | | if (btn.openmenu && Array.isArray(btn.openmenu) && btn.openmenu.length > 0 && sign !== '@no_target_menu@') { |
| | | let menuId = btn.openmenu.slice(-1)[0] |
| | | let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | triggerNote = (res) => { |
| | | triggerNote = (res, ID) => { |
| | | const { btn } = this.props |
| | | |
| | | if (!btn.verify) return |
| | | if (btn.verify.noteEnable !== 'true' && btn.verify.wxNote !== 'true') return |
| | | if (btn.verify.noteEnable !== 'true' && btn.verify.wxNote !== 'true' && btn.verify.printEnable !== 'true') return |
| | | |
| | | let id = '' |
| | | if (btn.output) { |
| | | id = res.mk_b_id || res[btn.output] || '' |
| | | } |
| | | |
| | | if (btn.verify.printEnable === 'true') { |
| | | this.billPrint(id || ID) |
| | | } |
| | | |
| | | if (!id) return |
| | |
| | | } |
| | | } |
| | | |
| | | billPrint = (id) => { |
| | | const { btn } = this.props |
| | | |
| | | if (!id) return |
| | | |
| | | setTimeout(() => { |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: id, tempId: btn.verify.printTempId, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') })))) |
| | | }, 500) |
| | | } |
| | | |
| | | sendWxMessage = (verify, id) => { |
| | | if (!window.GLOB.nginx) { |
| | | notification.warning({ |
| | |
| | | |
| | | let domain1 = '' |
| | | let domain2 = '' |
| | | if (['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'].includes(verify.wxTemplateId) && options.sysType !== 'cloud') { |
| | | if (['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'].includes(verify.wxTemplateId) && window.GLOB.sysType !== 'cloud') { |
| | | domain1 = 'https://cloud.mk9h.cn/' |
| | | domain2 = 'https://cloud.mk9h.cn:8443/' |
| | | } |
| | |
| | | */ |
| | | execError = (res = {}) => { |
| | | const { btn } = this.props |
| | | const { btnconfig, autoMatic } = this.state |
| | | const { autoMatic } = this.state |
| | | |
| | | if (autoMatic) { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message || '执行失败!', |
| | | duration: 10 |
| | | }) |
| | | |
| | | this.setState({ |
| | | loading: false, |
| | | loadingNumber: '', |
| | | loadingTotal: '', |
| | | visible: false |
| | | }) |
| | | MKEmitter.emit('autoExecOver', btn.uuid, 'error') |
| | | return |
| | | } |
| | | |
| | | if (!['LoginError', 'C', '-2', 'E', 'N', 'F', 'NM'].includes(res.ErrCode)) { |
| | | res.ErrCode = 'E' |
| | | } |
| | | |
| | | let sign = '' |
| | | if (/^@speak@/i.test(res.message)) { |
| | | res.message = res.message.replace(/^@speak@/i, '') |
| | |
| | | res.message = res.message.replace(/@close_tab@|@close_popup@|@goback@/i, '') |
| | | } |
| | | |
| | | if (res.ErrCode === 'E' && !autoMatic) { |
| | | if (res.ErrCode === 'E') { |
| | | let msg = res.message || '执行失败!' |
| | | if (/\n|\r/.test(msg)) { |
| | | msg = msg.replace(/\n|\r/ig, '<br/>') |
| | | msg = <span dangerouslySetInnerHTML={{__html: msg}}></span> |
| | | } |
| | | Modal.error({ |
| | | title: res.message || '执行失败!', |
| | | title: msg, |
| | | onOk: () => { |
| | | this.errorContinue(sign) |
| | | } |
| | | }) |
| | | } else if (res.ErrCode === 'N' || autoMatic) { |
| | | return |
| | | } else if (res.ErrCode === 'N') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message || '执行失败!', |
| | |
| | | message.error(res.message || '执行失败!') |
| | | } |
| | | |
| | | if (autoMatic) { |
| | | this.setState({ |
| | | loading: false, |
| | | loadingNumber: '', |
| | | loadingTotal: '', |
| | | visible: false |
| | | }) |
| | | MKEmitter.emit('autoExecOver', btn.uuid, 'error') |
| | | return |
| | | } else if (btn.OpenType !== 'pop' || !btnconfig || btnconfig.setting.finish !== 'unclose') { |
| | | this.errorContinue(sign) |
| | | } |
| | | |
| | | errorContinue = (sign) => { |
| | | const { btn } = this.props |
| | | const { btnconfig } = this.state |
| | | |
| | | if (btn.OpenType !== 'pop' || !btnconfig || btnconfig.setting.finish !== 'unclose') { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | |
| | | _item.fieldlen = item.decimal || 0 |
| | | } else if (['text', 'textarea', 'linkMain'].includes(_item.type)) { |
| | | _item.value = _item.value + '' |
| | | _item.value = _item.value.replace(/\t*|\v*/g, '') // 去除制表符 |
| | | _item.value = _item.value.replace(/\t+|\v+/g, '') // 去除制表符 |
| | | |
| | | if (item.interception !== 'false') { // 去除首尾空格 |
| | | _item.value = _item.value.replace(/(^\s*|\s*$)/g, '') |
| | |
| | | this.execSubmit(selines, () => {}, result) |
| | | } else { |
| | | confirm({ |
| | | title: btn.tipTitle || this.state.dict['main.action.confirm.tip'], |
| | | title: btn.tipTitle || '确定要执行吗?', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(selines, resolve, result) |
| | |
| | | > |
| | | <MutilForm |
| | | BID={BID} |
| | | dict={this.state.dict} |
| | | action={btnconfig} |
| | | inputSubmit={this.handleOk} |
| | | data={this.state.selines[0]} |
| | |
| | | > |
| | | <MutilForm |
| | | BID={BID} |
| | | dict={this.state.dict} |
| | | action={btnconfig} |
| | | inputSubmit={this.handleOk} |
| | | data={this.state.selines[0]} |
| | |
| | | // 需要选择行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.confirm.selectline'], |
| | | message: '请选择行!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | |
| | | // 需要选择单行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.confirm.selectSingleLine'], |
| | | message: '请选择单行数据!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | |
| | | <Button |
| | | type={type} |
| | | icon={icon} |
| | | id={'button' + btn.uuid} |
| | | title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} |
| | | loading={loading} |
| | | disabled={disabled} |