修复页面展示bug
This commit is contained in:
@@ -59,6 +59,10 @@ export default class ProjectInterfaceSync extends Component {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.getSyncData();
|
this.getSyncData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
|
this.getSyncData(nextProps);
|
||||||
|
}
|
||||||
handleSubmit = async () => {
|
handleSubmit = async () => {
|
||||||
const { form, projectId, groupId } = this.props;
|
const { form, projectId, groupId } = this.props;
|
||||||
let params = {
|
let params = {
|
||||||
@@ -103,14 +107,16 @@ export default class ProjectInterfaceSync extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSyncData() {
|
async getSyncData(newProps) {
|
||||||
let result = await axios.get('/api/plugin/mdConfig/get' + (this.props.projectId ? `?project_id=${this.props.projectId}` : `?groupId=${this.props.groupId}`));
|
const {projectId, groupId} = newProps || this.props;
|
||||||
if (result.data.errcode === 0) {
|
if (newProps && (projectId === this.props.projectId && groupId === this.props.groupId)){
|
||||||
if (result.data.data) {
|
return
|
||||||
this.setState({
|
|
||||||
config_data: result.data.data
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
let result = await axios.get('/api/plugin/mdConfig/get' + (this.props.projectId ? `?project_id=${projectId}` : `?groupId=${groupId}`));
|
||||||
|
if (result.data.errcode === 0) {
|
||||||
|
this.setState({
|
||||||
|
config_data: (result.data && result.data.data) || {}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,10 +89,13 @@ export default class CodeGenTemplate extends Component {
|
|||||||
form.validateFields(async (err, values) => {
|
form.validateFields(async (err, values) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
let assignValue = Object.assign(params, values);
|
let assignValue = Object.assign(params, values);
|
||||||
await axios.post('/api/plugin/template/save', assignValue).then(res => {
|
await axios.post('/api/plugin/template/save', assignValue).then(async (res) => {
|
||||||
if (res.data.errcode === 0) {
|
if (res.data.errcode === 0) {
|
||||||
message.success('保存成功');
|
message.success('保存成功');
|
||||||
this.getSyncData();
|
await this.getSyncData();
|
||||||
|
this.setState({
|
||||||
|
activeKey: params.tag
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
message.error(res.data.errmsg);
|
message.error(res.data.errmsg);
|
||||||
}
|
}
|
||||||
@@ -101,6 +104,7 @@ export default class CodeGenTemplate extends Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.getSyncData();
|
this.getSyncData();
|
||||||
}
|
}
|
||||||
@@ -113,8 +117,11 @@ export default class CodeGenTemplate extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSyncData() {
|
async getSyncData(newProps) {
|
||||||
const {projectId, groupId} = this.props;
|
const {projectId, groupId} = newProps || this.props;
|
||||||
|
if (newProps && (projectId === this.props.projectId && groupId === this.props.groupId)){
|
||||||
|
return
|
||||||
|
}
|
||||||
let result = await axios.get('/api/plugin/template/get?' + (projectId ? `projectId=${projectId}` : `groupId=${groupId}`));
|
let result = await axios.get('/api/plugin/template/get?' + (projectId ? `projectId=${projectId}` : `groupId=${groupId}`));
|
||||||
if (result.data.errcode === 0) {
|
if (result.data.errcode === 0) {
|
||||||
if (result.data.data && result.data.data.length) {
|
if (result.data.data && result.data.data.length) {
|
||||||
@@ -181,6 +188,10 @@ export default class CodeGenTemplate extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
|
this.getSyncData(nextProps);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {getFieldDecorator} = this.props.form;
|
const {getFieldDecorator} = this.props.form;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user