上传修改代码

This commit is contained in:
chengshuping@xforceplus.com 2019-11-13 19:09:36 +08:00
parent 8e0df53b1a
commit 9d01ea187a
3 changed files with 36 additions and 16 deletions

View File

@ -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 (
<span>
<Button onClick={this.showModal} type="primary">新增</Button>
@ -304,7 +314,7 @@ export default class AddPreItem extends React.Component{
</Row>
<Row>
<Col span={20}>
<Input.TextArea rows={4} placeholder="请输入响应结果字段描叙信息" />
<Input.TextArea name="configJson" value={this.state.configJson} onChange={(e)=>this.handleChange(e)} rows={4} placeholder="请输入响应结果字段描叙信息" />
</Col>
<Col span={2} offset={1}>
<Tooltip placement="right" title={'响应字段元信息'}>

View File

@ -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{
</Row>
<Row>
<Col span={20}>
<Input.TextArea rows={4} placeholder="请输入响应结果字段描叙信息" />
<Input.TextArea name="configJson" value={this.state.configJson} onChange={(e)=>this.handleChange(e)} rows={4} placeholder="请输入响应结果字段描叙信息" />
</Col>
<Col span={2} offset={1}>
<Tooltip placement="right" title={'响应字段元信息'}>

View File

@ -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) { //