|
|
@@ -89,7 +89,7 @@ class DataSourceBaseConfig extends React.Component {
|
|
|
help={validInfo.name.help}
|
|
|
>
|
|
|
<Input
|
|
|
- key={dataSourceDetail.name}
|
|
|
+ key={dataSourceDetail.code + '-name'}
|
|
|
defaultValue={dataSourceDetail.name}
|
|
|
onBlur={(e) => {
|
|
|
let value = e.target.value;
|
|
|
@@ -100,6 +100,7 @@ class DataSourceBaseConfig extends React.Component {
|
|
|
onChange={e => {
|
|
|
let val = e.target.value + '';
|
|
|
let status, help;
|
|
|
+
|
|
|
if(val.trim().length === 0) {
|
|
|
status = 'error';
|
|
|
help = '数据源名称不能为空';
|
|
|
@@ -110,6 +111,12 @@ class DataSourceBaseConfig extends React.Component {
|
|
|
status = 'success';
|
|
|
help = '';
|
|
|
}
|
|
|
+
|
|
|
+ // 如果status发生了改变,将数据同步到dataSourceDetail Model
|
|
|
+ if(validInfo.name.status !== status) {
|
|
|
+ dispatch({ type: 'dataSourceDetail/setField', name: 'name', value: val });
|
|
|
+ }
|
|
|
+
|
|
|
window.clearTimeout(this.nameTimeout);
|
|
|
this.nameTimeout = window.setTimeout(() => {
|
|
|
this.setState({
|
|
|
@@ -263,7 +270,7 @@ class DataSourceBaseConfig extends React.Component {
|
|
|
help={validInfo.description.help}
|
|
|
>
|
|
|
<Input.TextArea
|
|
|
- key={dataSourceDetail.description}
|
|
|
+ key={dataSourceDetail.code+'-description'}
|
|
|
autosize={{ minRows: 2, maxRows: 5 }}
|
|
|
defaultValue={dataSourceDetail.description}
|
|
|
onBlur={(e) => {
|
|
|
@@ -282,6 +289,12 @@ class DataSourceBaseConfig extends React.Component {
|
|
|
status = 'success';
|
|
|
help = '';
|
|
|
}
|
|
|
+
|
|
|
+ // 如果status发生了改变,将数据同步到dataSourceDetail Model
|
|
|
+ if(validInfo.name.status !== status) {
|
|
|
+ dispatch({ type: 'dataSourceDetail/setField', name: 'description', value: val });
|
|
|
+ }
|
|
|
+
|
|
|
window.clearTimeout(this.descriptionTimeout);
|
|
|
this.descriptionTimeout = window.setTimeout(() => {
|
|
|
this.setState({
|