Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
szse
Commits
07df24dc
Commit
07df24dc
authored
Jul 08, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型中文名称自动翻译
parent
973cd125
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
8 deletions
+44
-8
datamodel.js
src/model/datamodel.js
+4
-0
datamodeler.js
src/service/datamodeler.js
+4
-0
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+3
-3
ImportActionHeader.jsx
src/view/Manage/Model/Component/ImportActionHeader.jsx
+26
-3
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+7
-2
No files found.
src/model/datamodel.js
View file @
07df24dc
...
@@ -106,6 +106,10 @@ export function* getConsult(payload) {
...
@@ -106,6 +106,10 @@ export function* getConsult(payload) {
return
yield
call
(
datamodelerService
.
consult
,
payload
);
return
yield
call
(
datamodelerService
.
consult
,
payload
);
}
}
export
function
*
translatePhase
(
payload
)
{
return
yield
call
(
datamodelerService
.
translatePhase
,
payload
);
}
export
function
*
getSupportedDatatypes
()
{
export
function
*
getSupportedDatatypes
()
{
return
yield
call
(
datamodelerService
.
getSupportedDatatypes
);
return
yield
call
(
datamodelerService
.
getSupportedDatatypes
);
}
}
...
...
src/service/datamodeler.js
View file @
07df24dc
...
@@ -58,6 +58,10 @@ export function consult(payload) {
...
@@ -58,6 +58,10 @@ export function consult(payload) {
return
PostJSON
(
"/datamodeler/easyDataModelerDesign/consult"
,
payload
);
return
PostJSON
(
"/datamodeler/easyDataModelerDesign/consult"
,
payload
);
}
}
export
function
translatePhase
(
payload
)
{
return
PostJSON
(
"/datamodeler/easyDataModelerDesign/translatePhase"
,
payload
);
}
//获取支持的数据类型
//获取支持的数据类型
export
function
getSupportedDatatypes
()
{
export
function
getSupportedDatatypes
()
{
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/getSupportedDatatypes"
);
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/getSupportedDatatypes"
);
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
07df24dc
...
@@ -5,7 +5,7 @@ import ImportActionHeader from './ImportActionHeader';
...
@@ -5,7 +5,7 @@ import ImportActionHeader from './ImportActionHeader';
import
ImportActionTable
from
'./ImportActionTable'
;
import
ImportActionTable
from
'./ImportActionTable'
;
import
ImportActionIndex
from
'./ImportActionIndex'
;
import
ImportActionIndex
from
'./ImportActionIndex'
;
import
{
dispatch
Latest
,
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
const
ImportAction
=
(
props
)
=>
{
const
ImportAction
=
(
props
)
=>
{
const
{
action
,
hints
,
onChange
,
form
,
modelerId
,
terms
}
=
props
;
const
{
action
,
hints
,
onChange
,
form
,
modelerId
,
terms
}
=
props
;
...
@@ -102,7 +102,7 @@ const ImportAction = (props) => {
...
@@ -102,7 +102,7 @@ const ImportAction = (props) => {
}
}
const
getCurrentDataModel
=
()
=>
{
const
getCurrentDataModel
=
()
=>
{
dispatch
Latest
({
dispatch
({
type
:
'datamodel.getDataModel'
,
type
:
'datamodel.getDataModel'
,
payload
:
{
payload
:
{
id
:
modelerId
||
''
id
:
modelerId
||
''
...
@@ -189,7 +189,7 @@ const ImportAction = (props) => {
...
@@ -189,7 +189,7 @@ const ImportAction = (props) => {
}
}
const
onHeaderChange
=
(
changedValues
,
allValues
)
=>
{
const
onHeaderChange
=
(
changedValues
,
allValues
)
=>
{
if
(
changedValues
.
hasOwnProperty
(
'name'
))
{
if
(
changedValues
.
hasOwnProperty
(
'name'
)
||
changedValues
.
hasOwnProperty
(
'cnName'
)
)
{
validateDataModel
(
modelerData
);
validateDataModel
(
modelerData
);
}
}
}
}
...
...
src/view/Manage/Model/Component/ImportActionHeader.jsx
View file @
07df24dc
...
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
...
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
,
Select
,
AutoComplete
}
from
'antd'
;
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
,
Select
,
AutoComplete
}
from
'antd'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
Latest
}
from
'../../../../model'
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
...
@@ -52,6 +52,8 @@ const ImportActionHeader = (props) => {
...
@@ -52,6 +52,8 @@ const ImportActionHeader = (props) => {
const
[
causes
,
setCauses
]
=
useState
([]);
const
[
causes
,
setCauses
]
=
useState
([]);
const
[
options
,
setOptions
]
=
useState
([]);
const
[
options
,
setOptions
]
=
useState
([]);
const
[
autoTranslate
,
setAutoTranslate
]
=
useState
((
modelerData
.
name
||
''
)
===
''
);
useEffect
(()
=>
{
useEffect
(()
=>
{
const
causes
=
[];
const
causes
=
[];
...
@@ -88,7 +90,7 @@ const ImportActionHeader = (props) => {
...
@@ -88,7 +90,7 @@ const ImportActionHeader = (props) => {
const
_searchText
=
searchText
.
replace
(
/ /g
,
''
);
const
_searchText
=
searchText
.
replace
(
/ /g
,
''
);
if
(
_searchText
!==
''
)
{
if
(
_searchText
!==
''
)
{
dispatch
({
dispatch
Latest
({
type
:
'datamodel.autocomplete'
,
type
:
'datamodel.autocomplete'
,
payload
:
{
payload
:
{
params
:
{
params
:
{
...
@@ -106,7 +108,7 @@ const ImportActionHeader = (props) => {
...
@@ -106,7 +108,7 @@ const ImportActionHeader = (props) => {
}
}
})
})
}
else
{
}
else
{
dispatch
({
dispatch
Latest
({
type
:
'datamodel.recommandEnglishWords'
,
type
:
'datamodel.recommandEnglishWords'
,
payload
:
{
payload
:
{
params
:
{
params
:
{
...
@@ -126,7 +128,28 @@ const ImportActionHeader = (props) => {
...
@@ -126,7 +128,28 @@ const ImportActionHeader = (props) => {
}
}
const
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
const
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
onChange
&&
onChange
(
changedValues
,
allValues
);
onChange
&&
onChange
(
changedValues
,
allValues
);
//有手动编辑过英文名称并且有内容的情况下, 不能通过编辑中文名称自动翻译
if
(
changedValues
.
hasOwnProperty
(
'name'
))
{
setAutoTranslate
(
changedValues
.
name
===
''
);
}
else
if
(
changedValues
.
hasOwnProperty
(
'cnName'
))
{
if
(
autoTranslate
)
{
dispatchLatest
({
type
:
'datamodel.translatePhase'
,
payload
:
{
params
:
{
phaseInChinese
:
changedValues
.
cnName
,
}
},
callback
:
data
=>
{
form
.
setFieldsValue
({
name
:
data
?.
translated
||
''
});
onChange
&&
onChange
(
changedValues
,
allValues
);
}
})
}
}
}
}
return
(
return
(
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
07df24dc
...
@@ -809,9 +809,14 @@ const ImportActionTable = (props) => {
...
@@ -809,9 +809,14 @@ const ImportActionTable = (props) => {
suggests
&&
suggests
.
map
((
suggest
,
index
)
=>
{
suggests
&&
suggests
.
map
((
suggest
,
index
)
=>
{
return
(
return
(
<
Radio
key=
{
index
}
value=
{
index
}
className=
'mt-3'
style=
{
{
display
:
'block'
}
}
>
<
Radio
key=
{
index
}
value=
{
index
}
className=
'mt-3'
style=
{
{
display
:
'block'
}
}
>
{
`中文名称: ${suggest.cnName||''} 英文名称: ${suggest.name||''} 描述: ${suggest.remark||''} 匹配度: `
}
{
`中文名称: ${suggest.cnName||''}`
}
<
span
style=
{
{
color
:
'#f50'
}
}
>
{
`${suggest.score*100}%`
}
</
span
>
{
` 英文名称: ${suggest.name||''}`
}
{
` 描述: ${suggest.remark||''}`
}
{
' 匹配度: '
}
<
span
style=
{
{
color
:
'#f50'
}
}
>
{
`${suggest.recommendedStats?.score}%`
}
</
span
>
{
index
===
0
&&
<
span
style=
{
{
color
:
'#f50'
}
}
>
推荐
</
span
>
}
{
index
===
0
&&
<
span
style=
{
{
color
:
'#f50'
}
}
>
推荐
</
span
>
}
{
` 使用次数: ${suggest.recommendedStats?.referencesCount}`
}
{
` 来源: ${suggest.recommendedStats?.pathInSource||''}`
}
</
Radio
>
</
Radio
>
)
)
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment