| | |
| | | if (btn.OpenType === 'form') { |
| | | let data = selectedData && selectedData[0] ? selectedData[0] : null |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | } else if (btn.OpenType === 'formSubmit') { |
| | | this.setState({ |
| | | selines: selectedData || [] |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | if (btn.OpenType === 'form') { |
| | | let data = nextProps.selectedData && nextProps.selectedData[0] ? nextProps.selectedData[0] : null |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | } else if (btn.OpenType === 'formSubmit') { |
| | | this.setState({ |
| | | selines: nextProps.selectedData || [] |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | actionSubmit = (res) => { |
| | | const { btn } = this.props |
| | | const { btn, setting, BID } = this.props |
| | | const { selines } = this.state |
| | | |
| | | if (btn.uuid !== res.menuId) return |
| | | |
| | | let data = selines || [] |
| | | |
| | | if (setting.supModule && !BID) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '需要上级主键值!', |
| | | duration: 3 |
| | | }) |
| | | return |
| | | } else if (btn.Ot !== 'notRequired' && data.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择行!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.Ot === 'requiredSgl' && data.length !== 1) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择单行数据!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ loading: true }) |
| | | |
| | | this.execSubmit(this.state.selines, () => {}, res.form) |
| | | this.execSubmit(data, () => {}, res.form) |
| | | } |
| | | |
| | | resetModuleParam = (menuId, btnId, param) => { |
| | |
| | | }) |
| | | |
| | | if (btn.OpenType === 'formSubmit') { |
| | | MKEmitter.emit('mkFormSubmit', btn.uuid) |
| | | this.setState({}, () => { |
| | | MKEmitter.emit('mkFormSubmit', btn.uuid) |
| | | }) |
| | | return |
| | | } else if (btn.OpenType === 'prompt') { |
| | | this.setState({loading: true}) |
| | | confirm({ |
| | | title: this.state.dict['main.action.confirm.tip'], |
| | | title: btn.tipTitle || this.state.dict['main.action.confirm.tip'], |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(data, resolve) |
| | |
| | | _resolve() |
| | | }) |
| | | } |
| | | // xml调用方式 |
| | | // Api.directRequest('http://localhost:3001/test.xml', 'get', null, 'true').then(res => { |
| | | // let $x2js = new x2js() |
| | | // let jsonObj = $x2js.xml2js(res); |
| | | // console.info(jsonObj) |
| | | // }) |
| | | |
| | | /** |
| | | * @description 自定义请求循环执行 |
| | |
| | | const { btn } = this.props |
| | | const { btnconfig, autoMatic } = this.state |
| | | |
| | | if ((res && res.ErrCode === 'S') || autoMatic) { // 执行成功 |
| | | if ((res && (res.ErrCode === 'S' || !res.ErrCode)) || autoMatic) { // 执行成功 |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.ErrMesg || this.state.dict['main.action.confirm.success'], |
| | |
| | | if (btn.output) { |
| | | id = res.mk_b_id || res[btn.output] || '' |
| | | } |
| | | let tabId = '' |
| | | if (btn.refreshTab && btn.refreshTab.length > 0) { |
| | | tabId = btn.refreshTab[btn.refreshTab.length - 1] |
| | | } |
| | | |
| | | if (tabId && btn.$MenuID === tabId) { // 刷新当前菜单时,停止其他操作 |
| | | MKEmitter.emit('reloadMenuView', tabId, 'table') |
| | | return |
| | | } |
| | | |
| | | if (btn.execSuccess === 'closetab') { |
| | | MKEmitter.emit('closeTabView', btn.$MenuID) |
| | |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, id, this.state.selines) |
| | | } |
| | | |
| | | if (btn.refreshTab && btn.refreshTab.length > 0) { |
| | | MKEmitter.emit('reloadMenuView', btn.refreshTab[btn.refreshTab.length - 1], 'table') |
| | | if (tabId) { |
| | | MKEmitter.emit('reloadMenuView', tabId, 'table') |
| | | } |
| | | |
| | | if (btn.switchTab && btn.switchTab.length > 0) { |
| | | let id = btn.switchTab[btn.switchTab.length - 1] |
| | | let node = document.getElementById('tab' + id) |
| | |
| | | } |
| | | |
| | | modelconfirm = () => { |
| | | const { BData } = this.props |
| | | const { BData, btn } = this.props |
| | | const { btnconfig, selines } = this.state |
| | | let _this = this |
| | | |
| | |
| | | this.execSubmit(selines, () => {}, result) |
| | | } else { |
| | | confirm({ |
| | | title: this.state.dict['main.action.confirm.tip'], |
| | | title: btn.tipTitle || this.state.dict['main.action.confirm.tip'], |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(selines, resolve, result) |