From 9d01ea187a6be9cea174ce8f4d0cbf3ce6907203 Mon Sep 17 00:00:00 2001 From: "chengshuping@xforceplus.com" Date: Wed, 13 Nov 2019 19:09:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/preItem/modal/AddPreItem.jsx | 28 +++++++++++++------ .../component/preItem/modal/EditPreItem.jsx | 22 +++++++++++---- webapp/webpack.config.dev.js | 2 +- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/webapp/src/component/preItem/modal/AddPreItem.jsx b/webapp/src/component/preItem/modal/AddPreItem.jsx index 5df6ad7..c852eaf 100644 --- a/webapp/src/component/preItem/modal/AddPreItem.jsx +++ b/webapp/src/component/preItem/modal/AddPreItem.jsx @@ -22,15 +22,17 @@ export default class AddPreItem extends React.Component{ sourceLabel:'', plugin:'', status:1, - args:'' + args:'', + configJson:'' } } handleChange=(e)=>{ + console.log(e,'==') var name = e.target.name; var value = e.target.value; var state = this.state; - state[name] = trim(value); + state[name] = typeof value==='number'?value: trim(value); this.setState(state); } @@ -41,7 +43,9 @@ export default class AddPreItem extends React.Component{ if(name=='plugin'){ state['sourceField']=''; state['sourceLabel']=''; - state['args']=''; + state['args']=''; + state['status']=1; + state['configJson']=''; } state[name] = trim(value); @@ -77,11 +81,15 @@ export default class AddPreItem extends React.Component{ status:1, args:'', reqType:1, - visible:true + visible:true, + configJson:'' }) } handleSubmit=(validated)=>{ + if(typeof JSON.parse(this.state.configJson)!='object'){ + return message.error('多文本框json格式不对'); + } if(!validated){ Modal.error({ title: '提交失败', @@ -96,9 +104,10 @@ export default class AddPreItem extends React.Component{ param.sourceField=this.state.sourceField; param.sourceLabel=this.state.sourceLabel; param.plugin=this.state.plugin; - param.status=this.state.status; - param.args=this.state.args; - + param.status=this.state.status; + param.reqType=this.state.reqType; + param.args=this.state.args; + param.configJson=JSON.parse(this.state.configJson); FetchUtil('/preitem/','PUT', JSON.stringify(param), (data) => { if(data.success){ @@ -185,7 +194,8 @@ export default class AddPreItem extends React.Component{ } const plugin=this.state.plugin; - let fieldArr=this.state.sourceField==''?[]:this.state.sourceField.split(','); + let fieldArr=this.state.sourceField==''?[]:this.state.sourceField.split(','); + console.log( this.props.plugins) return ( @@ -304,7 +314,7 @@ export default class AddPreItem extends React.Component{ - + this.handleChange(e)} rows={4} placeholder="请输入响应结果字段描叙信息" /> diff --git a/webapp/src/component/preItem/modal/EditPreItem.jsx b/webapp/src/component/preItem/modal/EditPreItem.jsx index 763a293..aa63200 100644 --- a/webapp/src/component/preItem/modal/EditPreItem.jsx +++ b/webapp/src/component/preItem/modal/EditPreItem.jsx @@ -24,6 +24,7 @@ export default class EditPreItem extends React.Component{ status:1, args:'', reqType:1, + configJson:'', preItem:null } @@ -40,8 +41,11 @@ export default class EditPreItem extends React.Component{ sourceField:preItem.sourceField, sourceLabel:preItem.sourceLabel, plugin:preItem.plugin, - status:preItem.status, - args:preItem.args + status:preItem.status, + reqType:preItem.reqType, + args:preItem.args, + configJson:JSON.stringify(preItem.configJson) + }); }); } @@ -50,7 +54,7 @@ export default class EditPreItem extends React.Component{ var name = e.target.name; var value = e.target.value; var state = this.state; - state[name] = trim(value); + state[name] = typeof value==='number'?value: trim(value); this.setState(state); } @@ -59,7 +63,8 @@ export default class EditPreItem extends React.Component{ if(name=='plugin'){ state['sourceField']=''; state['sourceLabel']=''; - state['args']=''; + state['args']=''; + state['configJson']=''; } state[name] = trim(value); @@ -93,6 +98,9 @@ export default class EditPreItem extends React.Component{ } handleSubmit=(validated)=>{ + if(typeof JSON.parse(this.state.configJson)!='object'){ + return message.error('多文本框json格式不对'); + } if(!validated){ Modal.error({ title: '提交失败', @@ -109,7 +117,9 @@ export default class EditPreItem extends React.Component{ param.sourceLabel=this.state.sourceLabel; param.plugin=this.state.plugin; param.status=this.state.status; - param.args=this.state.args; + param.args=this.state.args; + param.reqType=this.state.reqType; + param.configJson=JSON.parse(this.state.configJson); FetchUtil('/preitem/','PUT',JSON.stringify(param), (data) => { @@ -300,7 +310,7 @@ export default class EditPreItem extends React.Component{ - + this.handleChange(e)} rows={4} placeholder="请输入响应结果字段描叙信息" /> diff --git a/webapp/webpack.config.dev.js b/webapp/webpack.config.dev.js index ecb7520..e81c6bb 100644 --- a/webapp/webpack.config.dev.js +++ b/webapp/webpack.config.dev.js @@ -26,7 +26,7 @@ const devWebpackConfig = merge(baseWebpackConfig, { disableHostCheck: true, // 新增该配置项 proxy: [{ context: ["/services/v1/"], - target: "http://104.128.89.231:8080", + target: "http://10.50.3.218:8080", changeOrigin: true, secure: false, onProxyRes: function (proxyRes, req, res) { //