Commit a3e70e12 by zhaochengxiang

规范

parent eb4e992d
...@@ -81,7 +81,7 @@ export function extractExcelContent(payload) { ...@@ -81,7 +81,7 @@ export function extractExcelContent(payload) {
//规则 //规则
export function constraints() { export function constraints() {
return GetJSON("/datamodeler/easyDataModelerConstraint/constraints"); return GetJSON("/shandatamodeler/easyDataModelerConstraint/constraints");
} }
//模版 //模版
...@@ -112,7 +112,7 @@ export function draftUsingDDL(payload) { ...@@ -112,7 +112,7 @@ export function draftUsingDDL(payload) {
//切换模版或者规范时调用 //切换模版或者规范时调用
export function consult(payload) { export function consult(payload) {
return PostJSON("/datamodeler/easyDataModelerDesign/consult", payload); return PostJSON("/shandatamodeler/easyDataModelerDesign/consult", payload);
} }
export function translatePhase(payload) { export function translatePhase(payload) {
...@@ -230,7 +230,7 @@ export function heartbeat() { ...@@ -230,7 +230,7 @@ export function heartbeat() {
} }
export function validateDataModel(payload) { export function validateDataModel(payload) {
return PostJSON("/datamodeler/easyDataModelerConstraint/validateDataModel", payload); return PostJSON("/shandatamodeler/easyDataModelerConstraint/validateDataModel", payload);
} }
export function autocomplete(payload) { export function autocomplete(payload) {
......
...@@ -280,25 +280,243 @@ const ImportAction = React.forwardRef((props, ref) => { ...@@ -280,25 +280,243 @@ const ImportAction = React.forwardRef((props, ref) => {
const onConstraintChange = (value) => { const onConstraintChange = (value) => {
let currentConstraint = null; let currentConstraint = null;
(constraints||[]).forEach((_constraint, index) => { const index = (constraints??[]).findIndex(item => item.id === value)
if (_constraint.name === value) { if (index !== -1) {
currentConstraint = _constraint; currentConstraint = constraints[index]
} form.setFieldsValue({
}); easyDataModelerModelingConstraint: currentConstraint
});
if (!currentConstraint) return; const newModelerData = {...modelerData, easyDataModelerModelingConstraint: currentConstraint };
setModelerData(newModelerData);
form.setFieldsValue({ modelerDataRef.current = newModelerData;
easyDataModelerModelingConstraint: currentConstraint
}); onChange && onChange(newModelerData);
const newModelerData = {...modelerData, easyDataModelerModelingConstraint: currentConstraint };
setModelerData(newModelerData); setConstraint(currentConstraint);
modelerDataRef.current = newModelerData; getConsult(newModelerData);
}
onChange && onChange(newModelerData); }
setConstraint(currentConstraint); {
getConsult(newModelerData); "easyDataModelerDataModelAttributes": [
{
"name": "id",
"remark": "1223",
"cnName": "id",
"modelingTemplateTag": null,
"datatype": {
"name": "Int",
"cnName": "整型",
"supportedDBTypes": [
"Greenplum",
"MySQL"
],
"parameterNames": [],
"parameterCnNames": [],
"parameterValues": [],
"jdbctype": 4
},
"recommendedStats": null,
"iid": "8838bdbe-af73-4b7b-9b2d-671ce68d366c",
"isPossibleNewTerm": null,
"isPossibleNewRecommendedDefinition": null,
"provided": false,
"notNull": false,
"inherited": false,
"partOfPrimaryKeyLogically": false,
"foreignKey": false,
"defaultValue": "21213",
"definition": "213",
"valueRange": "213",
"needAttention": true
},
{
"name": "load_time",
"remark": "作业加载的时间",
"cnName": "加载时间",
"modelingTemplateTag": {
"id": "64759a0b9e14e602c85c3209",
"name": "rtm1",
"cnName": "实时表",
"remark": "实时表1",
"createdTs": 1685428747160,
"modifiedTs": 1700116122949
},
"datatype": {
"name": "Timestamp",
"cnName": "时间日期",
"supportedDBTypes": [
"Greenplum",
"MySQL"
],
"parameterNames": [],
"parameterCnNames": [],
"parameterValues": [],
"jdbctype": 93
},
"recommendedStats": null,
"iid": "ae6f4377-a3ce-4a38-a875-a65fc3cadc41",
"isPossibleNewTerm": null,
"isPossibleNewRecommendedDefinition": null,
"provided": false,
"notNull": false,
"inherited": false,
"partOfPrimaryKeyLogically": false,
"foreignKey": false,
"defaultValue": null,
"definition": null,
"valueRange": null,
"needAttention": true
},
{
"name": "load_date",
"remark": "作业加载的日历日期",
"cnName": "加载日期",
"modelingTemplateTag": {
"id": "64759a0b9e14e602c85c3209",
"name": "rtm1",
"cnName": "实时表",
"remark": "实时表1",
"createdTs": 1685428747160,
"modifiedTs": 1700116122949
},
"datatype": {
"name": "Date",
"cnName": "日期",
"supportedDBTypes": [
"Greenplum",
"MySQL"
],
"parameterNames": [],
"parameterCnNames": [],
"parameterValues": [],
"jdbctype": 91
},
"recommendedStats": null,
"iid": "b8ec46ba-0acd-4683-b6c6-3657f066a8d0",
"isPossibleNewTerm": null,
"isPossibleNewRecommendedDefinition": null,
"provided": false,
"notNull": false,
"inherited": false,
"partOfPrimaryKeyLogically": false,
"foreignKey": false,
"defaultValue": null,
"definition": null,
"valueRange": null,
"needAttention": true
}
],
"easyDataModelerPrimaryKey": [],
"easyDataModelerDistributionKey": [],
"partition": null,
"easyDataModelerIndices": [],
"easyDataModelerSemiPrimaryKey": [],
"name": "t_99933",
"remark": "t_999",
"cnName": "t_9991",
"createdTs": 1700726828751,
"modifiedTs": 1700811824793,
"checkOutByWho": null,
"state": {
"phase": null,
"supportedActions": [
{
"cnName": "送审",
"name": "ask review",
"id": "1"
}
],
"subState": null,
"cnName": "草稿",
"phaseSupported": false,
"name": "draft",
"id": "1",
"type": "default"
},
"optionList": [
{
"name": "查看",
"enabled": true
},
{
"name": "新增",
"enabled": true
},
{
"name": "编辑",
"enabled": true
},
{
"name": "删除",
"enabled": true
},
{
"name": "建表",
"enabled": true
},
{
"name": "变更目录",
"enabled": true
},
{
"name": "历史版本",
"enabled": true
},
{
"name": "导出",
"enabled": true
},
{
"name": "送审",
"enabled": true
},
{
"name": "存量模型导入",
"enabled": true
}
],
"path": "/资管",
"namespace": "2",
"id": "655dc8739e14e658cfb5dada-1",
"easyDataModelerModelingTemplate": {
"id": null,
"name": "rtm1",
"cnName": "实时表",
"remark": "实时表1",
"createdTs": null,
"modifiedTs": null,
"constraintName": null,
"constraintCnName": null,
"easyDataModelerDataModelAttributes": []
},
"checkedOutId": null,
"editor": "测试用户",
"holder": null,
"inheritedEasyDataModelerDataModels": {},
"inheritedFromEasyDataModelerDataModel": null,
"otherEasyDataModelerDataModelsInheritedFromSameOrigin": {},
"deletable": true,
"easyDataModelerModelingConstraint": {
"name": "65572e7101464936971abbac",
"cnName": "name",
"description": "name1-name1",
"id": "65572e7101464936971abbac",
"allRules": null
},
"editable": true,
"deployable": false,
"supportRecatalog": true,
"dataResidence": "",
"dataUpdatingTiming": "",
"tableType": "实时表",
"dataLoadingStrategy": "",
"dataCircumstances": "",
"dataType": null,
"bindingLoadRange": null,
"inherited": false,
"alreadyCheckedOut": false,
"permitCheckOut": false
} }
const onTemplateChange = (value, isCustom = false) => { const onTemplateChange = (value, isCustom = false) => {
......
...@@ -600,14 +600,14 @@ const ConstraintSelect = ({ value = {}, constraints = [], onChange, ...restProps ...@@ -600,14 +600,14 @@ const ConstraintSelect = ({ value = {}, constraints = [], onChange, ...restProps
return ( return (
<Select <Select
onChange={onChange} onChange={onChange}
value={value?.name || ''} value={value?.id}
placeholder='请选择规范' placeholder='请选择规范'
{...restProps} {...restProps}
> >
{ {
(constraints||[]) && constraints.map((constraint, index) => { (constraints||[]) && constraints.map((constraint, index) => {
return ( return (
<Option key={index} value={constraint.name||''} >{constraint.cnName||''}</Option> <Option key={index} value={constraint.id} >{constraint.cnName||''}</Option>
); );
}) })
} }
......
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