Commit 985c0a48 by zhaochengxiang

模型基本信息修改

parent 39be76d3
...@@ -5,7 +5,6 @@ import LocalStorage from 'local-storage'; ...@@ -5,7 +5,6 @@ import LocalStorage from 'local-storage';
import ImportActionHeader from './ImportActionHeader'; import ImportActionHeader from './ImportActionHeader';
import ImportActionTable from './ImportActionTable'; import ImportActionTable from './ImportActionTable';
import ImportActionIndex from './ImportActionIndex'; import ImportActionIndex from './ImportActionIndex';
import ImportActionPartition from './ImportActionPartition';
import { getQueryParam } from '../../../../util'; import { getQueryParam } from '../../../../util';
import { Action } from '../../../../util/constant'; import { Action } from '../../../../util/constant';
...@@ -127,9 +126,7 @@ const ImportAction = (props) => { ...@@ -127,9 +126,7 @@ const ImportAction = (props) => {
}, },
callback: data => { callback: data => {
let newModelerData = {...(data||{})}; let newModelerData = {...(data||{})};
newModelerData = { ...newModelerData, ...{ easyDataModelerIndices: getIndicesAfterTableChange(newModelerData), partition: getPartitionAfterTableChange(newModelerData) } }; newModelerData = { ...newModelerData, ...getAllNewKeysAfterTableChange(newModelerData) };
newModelerData = {...onPartitionChangeByNewModelerData(newModelerData)};
setModelerData(newModelerData) setModelerData(newModelerData)
onChange && onChange(newModelerData); onChange && onChange(newModelerData);
...@@ -288,12 +285,27 @@ const ImportAction = (props) => { ...@@ -288,12 +285,27 @@ const ImportAction = (props) => {
} }
const onHeaderChange = (changedValues, allValues) => { const onHeaderChange = (changedValues, allValues) => {
let newModelerData = {...modelerData, ...allValues}; let newModelerData = {...modelerData, ...allValues};
if (newModelerData.easyDataModelerModelingTemplate==='' || newModelerData.easyDataModelerModelingTemplate==={}) { if (newModelerData.easyDataModelerModelingTemplate==='' || newModelerData.easyDataModelerModelingTemplate==={}) {
newModelerData.easyDataModelerModelingTemplate = null; newModelerData.easyDataModelerModelingTemplate = null;
} }
//主键不允许为空
if (changedValues.hasOwnProperty('easyDataModelerPrimaryKey')) {
(newModelerData.easyDataModelerDataModelAttributes||[]).forEach(attribute => {
let ownPrimaryKey = false;
if (newModelerData?.easyDataModelerPrimaryKey) {
ownPrimaryKey = (newModelerData.easyDataModelerPrimaryKey.filter(item => item.name===attribute.name).length>0);
}
if (ownPrimaryKey) {
attribute.nullable = false;
}
})
}
setModelerData(newModelerData); setModelerData(newModelerData);
onChange && onChange(newModelerData); onChange && onChange(newModelerData);
...@@ -307,9 +319,7 @@ const ImportAction = (props) => { ...@@ -307,9 +319,7 @@ const ImportAction = (props) => {
let newModelerData = {...modelerData, ...{easyDataModelerDataModelAttributes: data}}; let newModelerData = {...modelerData, ...{easyDataModelerDataModelAttributes: data}};
newModelerData = { ...newModelerData, ...{ easyDataModelerIndices: getIndicesAfterTableChange(newModelerData), partition: getPartitionAfterTableChange(newModelerData) } }; newModelerData = { ...newModelerData, ...getAllNewKeysAfterTableChange(newModelerData) };
newModelerData = {...onPartitionChangeByNewModelerData(newModelerData)};
setModelerData(newModelerData); setModelerData(newModelerData);
onChange && onChange(newModelerData); onChange && onChange(newModelerData);
...@@ -345,54 +355,59 @@ const ImportAction = (props) => { ...@@ -345,54 +355,59 @@ const ImportAction = (props) => {
} }
} }
const onPartitionChangeByNewModelerData = (newModelerData) => { const getAllNewKeysAfterTableChange = (newModelerData) => {
//数据表分区内容回填到基本信息分区键中 //分布键
let newPartitionDesc = ''; let newDistribution = {...newModelerData.easyDataModelerDistributionKey};
if ((newModelerData?.partition?.keys||[]).length>0) { (newDistribution||[]).forEach((item, index) => {
(newModelerData?.partition?.keys||[]).forEach((item, index) => { const _index = (newModelerData.easyDataModelerDataModelAttributes||[]).findIndex(_item => item.name === _item.name);
if (index > 0) {
newPartitionDesc += ','
}
newPartitionDesc += item.name||''; if (_index !== -1) {
newDistribution.push({...newModelerData.easyDataModelerDataModelAttributes[_index]});
}
}) })
newPartitionDesc += '/' + newModelerData?.partition?.partitionType?.name||''; if ((newDistribution||[]).length === 0) {
newDistribution = null;
} }
newModelerData.partitionsDescription = newPartitionDesc; //主键
let newPrimary = {...newModelerData.easyDataModelerPrimaryKey};
return newModelerData; (newPrimary||[]).forEach((item, index) => {
} const _index = (newModelerData.easyDataModelerDataModelAttributes||[]).findIndex(_item => item.name === _item.name);
const onPartitionChange = (data, validate=false) => { if (_index !== -1) {
const newModelerData = {...modelerData, partition: data}; newPrimary.push({...newModelerData.easyDataModelerDataModelAttributes[_index]});
}
})
//数据表分区内容回填到基本信息分区键中 if ((newPrimary||[]).length === 0) {
let newPartitionDesc = ''; newPrimary = null;
(data?.keys||[]).forEach((item, index) => {
if (index > 0) {
newPartitionDesc += ','
} }
newPartitionDesc += item.name||''; //分区
}) let newPartition = {...newModelerData.partition};
newPartitionDesc += '/' + data?.partitionType?.name||''; const newKeys = [];
newModelerData.partitionsDescription = newPartitionDesc; (newPartition.keys||[]).forEach((item, index) => {
setModelerData(newModelerData); const _index = (newModelerData.easyDataModelerDataModelAttributes||[]).findIndex(_item => item.name === _item.name);
onChange && onChange(newModelerData);
if (validate) { if (_index !== -1) {
validateDataModel(newModelerData); newKeys.push({...newModelerData.easyDataModelerDataModelAttributes[_index]});
} }
})
newPartition.keys = newKeys;
if ((newKeys||[]).length === 0) {
newPartition = null;
} }
const getIndicesAfterTableChange = (newModelerData) => { //索引
const newEasyDataModelerIndices = [...(newModelerData.easyDataModelerIndices||[])]; let newEasyDataModelerIndices = [...(newModelerData.easyDataModelerIndices||[])];
(newModelerData.easyDataModelerIndices||[]).forEach((easyDataModelerIndex, index) => { (newModelerData.easyDataModelerIndices||[]).forEach((easyDataModelerIndex, index) => {
const newIndexedEasyDataModelAttributes = [], newIndexedAttributeOrders = []; const newIndexedEasyDataModelAttributes = [], newIndexedAttributeOrders = [];
...@@ -410,29 +425,9 @@ const ImportAction = (props) => { ...@@ -410,29 +425,9 @@ const ImportAction = (props) => {
newEasyDataModelerIndices.splice(index, 1, {...item, ...{ indexedEasyDataModelAttributes: newIndexedEasyDataModelAttributes, indexedAttributeOrders: newIndexedAttributeOrders }} ) newEasyDataModelerIndices.splice(index, 1, {...item, ...{ indexedEasyDataModelAttributes: newIndexedEasyDataModelAttributes, indexedAttributeOrders: newIndexedAttributeOrders }} )
}) })
return newEasyDataModelerIndices.filter(item => (item.indexedEasyDataModelAttributes||[]).length > 0); newEasyDataModelerIndices = newEasyDataModelerIndices.filter(item => (item.indexedEasyDataModelAttributes||[]).length > 0);
}
const getPartitionAfterTableChange = (newModelerData) => {
const newPartition = {...newModelerData.partition};
const newKeys = [];
(newPartition.keys||[]).forEach((item, index) => {
const _index = (newModelerData.easyDataModelerDataModelAttributes||[]).findIndex(_item => item.iid === _item.iid);
if (_index !== -1) {
newKeys.push({...newModelerData.easyDataModelerDataModelAttributes[_index]});
}
})
newPartition.keys = newKeys;
if ((newKeys||[]).length === 0) return null;
return newPartition;
return { partition: newPartition, easyDataModelerDistributionKey: newDistribution, easyDataModelerPrimaryKey: newPrimary, easyDataModelerIndices: newEasyDataModelerIndices };
} }
return ( return (
...@@ -448,6 +443,7 @@ const ImportAction = (props) => { ...@@ -448,6 +443,7 @@ const ImportAction = (props) => {
onConstraintChange={onConstraintChange} onConstraintChange={onConstraintChange}
onChange={onHeaderChange} onChange={onHeaderChange}
terms={terms} terms={terms}
supportedPartitionTypes={supportedPartitionTypes}
/> />
<ImportActionTable <ImportActionTable
modelerData={modelerData||{}} modelerData={modelerData||{}}
...@@ -469,16 +465,6 @@ const ImportAction = (props) => { ...@@ -469,16 +465,6 @@ const ImportAction = (props) => {
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'} editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'}
terms={terms} terms={terms}
/> />
<ImportActionPartition
modelerData={modelerData||{}}
constraint={constraint}
template={template}
validateReports={validateReports}
supportedPartitionTypes={supportedPartitionTypes}
onChange={onPartitionChange}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'}
terms={terms}
/>
</Spin> </Spin>
); );
}; };
......
...@@ -9,6 +9,35 @@ import './ImportActionHeader.less'; ...@@ -9,6 +9,35 @@ import './ImportActionHeader.less';
const { TextArea } = Input; const { TextArea } = Input;
const { Option } = Select; const { Option } = Select;
const loadOptions = ['append', 'refresh', 'insert', 'update', 'full', 'chain', 'delete', '手工导入'];
const updateOptions = [
'每个交易日早间交易前加载上一交易日数据,历史资料入历史表',
'每个交易日早间交易前清空该表,交易期间实时加载,下午收市后入历史表',
'每个交易日7:30加载',
'每个交易日8:30加载',
'每个交易日15:00加载',
'每个交易日18:00加载',
'每个交易日19:00加载',
'每个交易日19:30加载',
'每个交易日20:00加载',
'每个交易日22:00加载',
'每个交易日23:00加载',
'每个交易日20:00加载T-2的数据',
'每日中午12:00加载T-3日数据',
'实时更新',
'收盘后加载',
'收市后加载',
'下午收市后加载',
'下午收市后入历史表',
'下午收市后入实时和历史表',
'晚间结算后加载',
'实时从mysql同步',
'手工维护',
'用户提交',
'作业提交',
'脚本加载',
];
const ConstraintSelect = ({ value = {}, constraints = [], onChange, ...restProps }) => { const ConstraintSelect = ({ value = {}, constraints = [], onChange, ...restProps }) => {
return ( return (
...@@ -50,8 +79,200 @@ const TemplateSelect = ({ value = {}, templates = [], onChange, ...restProps }) ...@@ -50,8 +79,200 @@ const TemplateSelect = ({ value = {}, templates = [], onChange, ...restProps })
) )
} }
const AttributesSelect = ({ value = [], modelerData, onChange, ...restProps }) => {
const onAttributeChange = (value) => {
const currentAttributes = (modelerData?.easyDataModelerDataModelAttributes||[]).filter(attribute => (value||[]).indexOf(attribute.name)!==-1);
triggerChange(currentAttributes);
}
const triggerChange = (changedValue) => {
onChange?.(changedValue);
};
//value有可能为空
value = value ? value: [];
let attributeNames = [];
value.forEach(attribute => {
attributeNames.push(attribute.name);
})
return (
<Select
onChange={(value) => { onAttributeChange && onAttributeChange(value) }}
value={attributeNames}
placeholder='请选择字段名称'
style={{ width: 300 }}
mode='multiple'
allowClear={true}
>
{
(modelerData?.easyDataModelerDataModelAttributes||[]).map((attribute, index) => {
return (
<Option key={index} value={attribute.name||''}>{attribute.name||''}</Option>
);
})
}
</Select>
);
}
const PartitionSelect = ({ value = {}, modelerData, partitionTypes = [], onChange, ...restProps }) => {
const onPartitionTypeChange = (value) => {
let currentPartitionType = {};
(partitionTypes||[]).forEach((partitionType, index) => {
if (value === partitionType.name) {
currentPartitionType = partitionType;
}
})
triggerChange({ partitionType: currentPartitionType });
}
const onAttributeChange = (value) => {
const currentAttributes = (modelerData?.easyDataModelerDataModelAttributes||[]).filter(attribute => (value||[]).indexOf(attribute.name)!==-1);
triggerChange({ keys: currentAttributes });
}
const triggerChange = (changedValue) => {
onChange?.({
...value,
...changedValue,
});
};
//value有可能为空
value = value ? value: {};
let attributeNames = [];
(value?.keys||[]).forEach(attribute => {
attributeNames.push(attribute.name);
})
return (
<span>
<Select
onChange={onPartitionTypeChange}
value={value?.partitionType?.name || ''}
placeholder='请选择分区类型'
style={{ width: 95 }}
allowClear={true}
>
{
(partitionTypes||[]).map((partitionType, index) => {
return (
<Option key={partitionType.name||''}>{partitionType.name||''}</Option>
);
})
}
</Select>
<Select
onChange={(value) => { onAttributeChange && onAttributeChange(value) }}
value={attributeNames}
placeholder='请选择字段名称'
style={{ width: 200, marginLeft: 5 }}
mode='multiple'
allowClear={true}
>
{
(modelerData?.easyDataModelerDataModelAttributes||[]).map((attribute, index) => {
return (
<Option key={index} value={attribute.name||''}>{attribute.name||''}</Option>
);
})
}
</Select>
</span>
);
}
const LoadSelect = ({ value = '', onChange, ...restProps }) => {
const onLoadChange = (value) => {
triggerChange(value.join('/'));
}
const triggerChange = (changedValue) => {
onChange?.(changedValue);
};
//value有可能为空
value = value ? value: '';
let loadNames = [];
value.split('/').forEach(item => {
loadNames.push(item);
})
return (
<Select
mode="tags"
style={{ width: 300 }}
tokenSeparators={['/', ' ']}
onChange={(value) => { onLoadChange && onLoadChange(value) }}
value={loadNames}
placeholder='请选择选择或者手动输入加载方式'
allowClear={true}
>
{
loadOptions.map((item, index) => {
return (
<Option key={index} value={item}>{item}</Option>
);
})
}
</Select>
);
}
const UpdateSelect = ({ value = '', onChange, ...restProps }) => {
const onUpdateChange = (value) => {
triggerChange(value.join('/'));
}
const triggerChange = (changedValue) => {
onChange?.(changedValue);
};
//value有可能为空
value = value ? value: '';
let updateNames = [];
value.split('/').forEach(item => {
updateNames.push(item);
})
return (
<Select
mode="tags"
style={{ width: 300 }}
tokenSeparators={['/', ' ']}
onChange={(value) => { onUpdateChange && onUpdateChange(value) }}
value={updateNames}
placeholder='请选择选择或者手动输入更新时间'
allowClear={true}
>
{
updateOptions.map((item, index) => {
return (
<Option key={index} value={item}>{item}</Option>
);
})
}
</Select>
);
}
const ImportActionHeader = (props) => { const ImportActionHeader = (props) => {
const { editable, form, modelerData, constraints, templates, onConstraintChange, onTemplateChange, validateReports, onChange, terms } = props; const { editable, form, modelerData, constraints, templates, onConstraintChange, onTemplateChange, validateReports, onChange, terms, supportedPartitionTypes } = props;
const [ causes, setCauses ] = useState([]); const [ causes, setCauses ] = useState([]);
const [ options, setOptions ] = useState([]); const [ options, setOptions ] = useState([]);
...@@ -173,6 +394,47 @@ const ImportActionHeader = (props) => { ...@@ -173,6 +394,47 @@ const ImportActionHeader = (props) => {
setOnlyShowRequireChange(e.target.checked); setOnlyShowRequireChange(e.target.checked);
} }
let distributionDescription = '', primaryDescription = '', partitionsDescription = '';
if (!editable && modelerData) {
//分布
if (modelerData?.easyDataModelerDistributionKey) {
(modelerData?.easyDataModelerDistributionKey||[]).forEach((item, index) => {
if (index > 0) {
distributionDescription += ',';
}
distributionDescription += item.name||'';
});
}
//主键
if (modelerData?.easyDataModelerPrimaryKey) {
(modelerData?.easyDataModelerPrimaryKey||[]).forEach((item, index) => {
if (index > 0) {
primaryDescription += ',';
}
primaryDescription += item.name||'';
})
}
//分区
if (modelerData?.partition?.keys) {
(modelerData?.partition?.keys||[]).forEach((item, index) => {
if (index > 0) {
partitionsDescription += ',';
}
partitionsDescription += item.name||'';
})
}
if (modelerData?.partition?.partitionType?.name) {
partitionsDescription += '/' + modelerData?.partition?.partitionType?.name||'';
}
}
return ( return (
<div className='model-import-action-header'> <div className='model-import-action-header'>
<div <div
...@@ -271,7 +533,7 @@ const ImportActionHeader = (props) => { ...@@ -271,7 +533,7 @@ const ImportActionHeader = (props) => {
name="dataResidence" name="dataResidence"
labelAlign="left" labelAlign="left"
> >
<Input style={{ width: 300 }} /> <Input style={{ width: 300 }} disabled={true} />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={8}> <Col span={8}>
...@@ -287,10 +549,10 @@ const ImportActionHeader = (props) => { ...@@ -287,10 +549,10 @@ const ImportActionHeader = (props) => {
<Col span={8}> <Col span={8}>
<Form.Item <Form.Item
label="分布键" label="分布键"
name="distributionKeysDescription" name="easyDataModelerDistributionKey"
labelAlign="left" labelAlign="left"
> >
<Input style={{ width: 300 }} /> <AttributesSelect modelerData={modelerData} />
</Form.Item> </Form.Item>
</Col> </Col>
</Row> </Row>
...@@ -298,19 +560,19 @@ const ImportActionHeader = (props) => { ...@@ -298,19 +560,19 @@ const ImportActionHeader = (props) => {
<Col span={8}> <Col span={8}>
<Form.Item <Form.Item
label="分区键" label="分区键"
name="partitionsDescription" name="partition"
labelAlign="left" labelAlign="left"
> >
<Input style={{ width: 300 }} /> <PartitionSelect modelerData={modelerData} partitionTypes={supportedPartitionTypes} />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={8}> <Col span={8}>
<Form.Item <Form.Item
label="主键" label="主键"
name="primaryKeysDescription" name="easyDataModelerPrimaryKey"
labelAlign="left" labelAlign="left"
> >
<Input style={{ width: 300 }} /> <AttributesSelect modelerData={modelerData} />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={8}> <Col span={8}>
...@@ -330,7 +592,7 @@ const ImportActionHeader = (props) => { ...@@ -330,7 +592,7 @@ const ImportActionHeader = (props) => {
name="dataLoadingStrategy" name="dataLoadingStrategy"
labelAlign="left" labelAlign="left"
> >
<Input style={{ width: 300 }} /> <LoadSelect />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={8}> <Col span={8}>
...@@ -339,7 +601,7 @@ const ImportActionHeader = (props) => { ...@@ -339,7 +601,7 @@ const ImportActionHeader = (props) => {
name="dataUpdatingTiming" name="dataUpdatingTiming"
labelAlign="left" labelAlign="left"
> >
<Input style={{ width: 300 }} /> <UpdateSelect />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={8}> <Col span={8}>
...@@ -348,7 +610,7 @@ const ImportActionHeader = (props) => { ...@@ -348,7 +610,7 @@ const ImportActionHeader = (props) => {
name="maintenanceRecords" name="maintenanceRecords"
labelAlign="left" labelAlign="left"
> >
<Input style={{ width: 300 }} /> <Input style={{ width: 300 }} disabled={true} />
</Form.Item> </Form.Item>
</Col> </Col>
</Row> </Row>
...@@ -380,9 +642,9 @@ const ImportActionHeader = (props) => { ...@@ -380,9 +642,9 @@ const ImportActionHeader = (props) => {
<Descriptions.Item label="数据表类型">{highlightSearchContentByTerms(modelerData.tableType||'', terms)}</Descriptions.Item> <Descriptions.Item label="数据表类型">{highlightSearchContentByTerms(modelerData.tableType||'', terms)}</Descriptions.Item>
<Descriptions.Item label="数据平台">{highlightSearchContentByTerms(modelerData.dataResidence||'', terms)}</Descriptions.Item> <Descriptions.Item label="数据平台">{highlightSearchContentByTerms(modelerData.dataResidence||'', terms)}</Descriptions.Item>
<Descriptions.Item label="数据情况">{highlightSearchContentByTerms(modelerData.dataCircumstances||'', terms)}</Descriptions.Item> <Descriptions.Item label="数据情况">{highlightSearchContentByTerms(modelerData.dataCircumstances||'', terms)}</Descriptions.Item>
<Descriptions.Item label="分布键">{highlightSearchContentByTerms(modelerData.distributionKeysDescription||'', terms)}</Descriptions.Item> <Descriptions.Item label="分布键">{highlightSearchContentByTerms(distributionDescription||'', terms)}</Descriptions.Item>
<Descriptions.Item label="分区键">{highlightSearchContentByTerms(modelerData.partitionsDescription||'', terms)}</Descriptions.Item> <Descriptions.Item label="分区键">{highlightSearchContentByTerms(partitionsDescription||'', terms)}</Descriptions.Item>
<Descriptions.Item label="主键">{highlightSearchContentByTerms(modelerData.primaryKeysDescription||'', terms)}</Descriptions.Item> <Descriptions.Item label="主键">{highlightSearchContentByTerms(primaryDescription||'', terms)}</Descriptions.Item>
<Descriptions.Item label="类主键">{highlightSearchContentByTerms(modelerData.semiPrimaryKeysDescription||'', terms)}</Descriptions.Item> <Descriptions.Item label="类主键">{highlightSearchContentByTerms(modelerData.semiPrimaryKeysDescription||'', terms)}</Descriptions.Item>
<Descriptions.Item label="加载方式">{highlightSearchContentByTerms(modelerData.dataLoadingStrategy||'', terms)}</Descriptions.Item> <Descriptions.Item label="加载方式">{highlightSearchContentByTerms(modelerData.dataLoadingStrategy||'', terms)}</Descriptions.Item>
<Descriptions.Item label="更新时间">{highlightSearchContentByTerms(modelerData.dataUpdatingTiming||'', terms)}</Descriptions.Item> <Descriptions.Item label="更新时间">{highlightSearchContentByTerms(modelerData.dataUpdatingTiming||'', terms)}</Descriptions.Item>
......
...@@ -349,7 +349,7 @@ const ImportActionTable = (props) => { ...@@ -349,7 +349,7 @@ const ImportActionTable = (props) => {
cnName: '', cnName: '',
datatype: null, datatype: null,
nullable: null, nullable: null,
partOfPrimaryKey: null, partOfPrimaryKeyLogically: null,
partOfDistributionKey: null, partOfDistributionKey: null,
needAttention: null, needAttention: null,
remark: '', remark: '',
...@@ -452,6 +452,11 @@ const ImportActionTable = (props) => { ...@@ -452,6 +452,11 @@ const ImportActionTable = (props) => {
// console.log('changed values', changedValues); // console.log('changed values', changedValues);
// console.log('all values', allValues); // console.log('all values', allValues);
let ownPrimaryKey = false;
if (modelerData?.easyDataModelerPrimaryKey) {
ownPrimaryKey = (modelerData.easyDataModelerPrimaryKey.filter(item => item.name===allValues.name).length>0);
}
if (changedValues.hasOwnProperty('cnName') || changedValues.hasOwnProperty('name')) { if (changedValues.hasOwnProperty('cnName') || changedValues.hasOwnProperty('name')) {
if (offset === 1) { if (offset === 1) {
...@@ -535,12 +540,12 @@ const ImportActionTable = (props) => { ...@@ -535,12 +540,12 @@ const ImportActionTable = (props) => {
} }
} else if(changedValues.hasOwnProperty('nullable') ) { } else if(changedValues.hasOwnProperty('nullable') ) {
if (changedValues.nullable && allValues.partOfPrimaryKey) { if (changedValues.nullable && ownPrimaryKey) {
showMessage('info', '主键不允许为空'); showMessage('info', '主键不允许为空');
} }
} }
if (allValues.partOfPrimaryKey) { if (ownPrimaryKey) {
form.setFieldsValue({ form.setFieldsValue({
nullable: false nullable: false
}); });
...@@ -667,14 +672,14 @@ const ImportActionTable = (props) => { ...@@ -667,14 +672,14 @@ const ImportActionTable = (props) => {
{ {
title: '主键', title: '主键',
width: 50, width: 50,
dataIndex: 'partOfPrimaryKey', dataIndex: 'partOfPrimaryKeyLogically',
editable: (type==='model'?true:false), editable: (type==='model'?true:false),
render: (partOfPrimaryKey, record, index) => { render: (partOfPrimaryKeyLogically, record, index) => {
if (!partOfPrimaryKey) { if (!partOfPrimaryKeyLogically) {
return ( return (
<CloseOutlined /> <CloseOutlined />
); );
} else if (partOfPrimaryKey === true) { } else if (partOfPrimaryKeyLogically === true) {
return ( return (
<CheckOutlined /> <CheckOutlined />
) )
...@@ -683,25 +688,25 @@ const ImportActionTable = (props) => { ...@@ -683,25 +688,25 @@ const ImportActionTable = (props) => {
return ''; return '';
} }
}, },
{ // {
title: '分布键', // title: '分布键',
width: 60, // width: 60,
dataIndex: 'partOfDistributionKey', // dataIndex: 'partOfDistributionKey',
editable: (type==='model'?true:false), // editable: (type==='model'?true:false),
render: (partOfDistributionKey, record, index) => { // render: (partOfDistributionKey, record, index) => {
if (!partOfDistributionKey) { // if (!partOfDistributionKey) {
return ( // return (
<CloseOutlined /> // <CloseOutlined />
); // );
} else if (partOfDistributionKey === true) { // } else if (partOfDistributionKey === true) {
return ( // return (
<CheckOutlined /> // <CheckOutlined />
) // )
} // }
return ''; // return '';
} // }
}, // },
{ {
title: '外键', title: '外键',
width: 50, width: 50,
...@@ -983,7 +988,7 @@ const ImportActionTable = (props) => { ...@@ -983,7 +988,7 @@ const ImportActionTable = (props) => {
onCell: (record) => ({ onCell: (record) => ({
record, record,
dataIndex: col.dataIndex, dataIndex: col.dataIndex,
inputType: (col.dataIndex==='nullable' || col.dataIndex==='partOfDistributionKey' || col.dataIndex==='partOfPrimaryKey' || col.dataIndex==='needAttention' || col.dataIndex==='foreignKey') ? 'check' : 'text', inputType: (col.dataIndex==='nullable' || col.dataIndex==='partOfDistributionKey' || col.dataIndex==='partOfPrimaryKeyLogically' || col.dataIndex==='needAttention' || col.dataIndex==='foreignKey') ? 'check' : 'text',
colTitle: col.title, colTitle: col.title,
editing: isEditing(record), editing: isEditing(record),
datatypes: supportedDatatypes, datatypes: supportedDatatypes,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment