Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
2b7c7842
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
9 个月 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2b7c7842
编写于
5月 27, 2022
作者:
Z
zhaoke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* Fix add Interpreter error
上级
0eebfd7a
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
98 addition
and
209 deletion
+98
-209
ui/src/layouts/MainLayout/components/FormInterpreter.vue
ui/src/layouts/MainLayout/components/FormInterpreter.vue
+71
-83
ui/src/layouts/MainLayout/components/FormNode.vue
ui/src/layouts/MainLayout/components/FormNode.vue
+1
-0
ui/src/layouts/MainLayout/components/FormWorkspace.vue
ui/src/layouts/MainLayout/components/FormWorkspace.vue
+1
-0
ui/src/layouts/MainLayout/components/Modal.vue
ui/src/layouts/MainLayout/components/Modal.vue
+2
-21
ui/src/layouts/MainLayout/components/TabPageSettings.vue
ui/src/layouts/MainLayout/components/TabPageSettings.vue
+23
-71
ui/src/layouts/MainLayout/style/main.css
ui/src/layouts/MainLayout/style/main.css
+0
-34
未找到文件。
ui/src/layouts/MainLayout/components/FormInterpreter.vue
浏览文件 @
2b7c7842
...
...
@@ -3,7 +3,8 @@
:showModal=
"showModalRef"
@
onCancel=
"cancel"
@
onOk=
"submit"
:title=
"info == undefined ? t('create_interpreter') : t('edit_interpreter')"
:title=
"info == undefined ? t('create_interpreter') : t('edit_interpreter')"
:contentStyle=
"
{width: '500px'}"
>
<Form
class=
"form-interpreter"
labelCol=
"6"
wrapperCol=
"16"
>
<FormItem
...
...
@@ -57,49 +58,14 @@
{{
t
(
"
find_to_select
"
,
{
num
:
interpreterInfos
.
length
}
)
}}
<
/option
>
<
option
v
-
for
=
"
item in
language
s
"
:
key
=
"
item.
value
"
:
value
=
"
item.
value
"
v
-
for
=
"
item in
interpreterInfo
s
"
:
key
=
"
item.
path
"
:
value
=
"
item.
path
"
>
{{
languageMap
[
item
.
value
].
name
}}
{{
item
.
info
}}
<
/option
>
<
/select
>
<
/FormItem
>
<
a
-
form
-
item
:
wrapper
-
col
=
"
{ span: wrapperCol.span, offset: labelCol.span
}
"
>
<
a
-
select
v
-
if
=
"
interpreterInfos.length > 0
"
v
-
model
:
value
=
"
selectedInterpreter
"
@
change
=
"
selectInterpreter
"
>
<
a
-
select
-
option
value
=
""
>
{{
t
(
'
find_to_select
'
,
{
num
:
interpreterInfos
.
length
}
)
}}
<
/a-select-option
>
<
a
-
select
-
option
v
-
for
=
"
item in interpreterInfos
"
:
key
=
"
item.path
"
:
value
=
"
item.path
"
>
{{
item
.
info
}}
<
/a-select-option
>
<
/a-select
>
<
/a-form-item
>
<
a
-
form
-
item
:
wrapper
-
col
=
"
{ span: wrapperCol.span, offset: labelCol.span
}
"
:
class
=
"
{'t-dir-right': !isWin
}
"
class
=
"
t-right
"
>
<
a
-
button
type
=
"
primary
"
@
click
.
prevent
=
"
save
"
class
=
"
t-btn-gap
"
>
{{
t
(
'
save
'
)
}}
<
/a-button>  
;
<
a
-
button
@
click
=
"
reset
"
class
=
"
t-btn-gap
"
>
{{
t
(
'
reset
'
)
}}
<
/a-button
>
<
/a-form-item
>
<
FormItem
name
=
"
name
"
:
label
=
"
t('name')
"
:
info
=
"
validateInfos.name
"
>
<
input
v
-
model
=
"
modelRef.name
"
class
=
"
form-control
"
/>
<
/FormItem
>
<
FormItem
name
=
"
url
"
:
label
=
"
t('zentao_url')
"
:
info
=
"
validateInfos.url
"
>
<
input
v
-
model
=
"
modelRef.url
"
class
=
"
form-control
"
/>
<
/FormItem
>
<
FormItem
name
=
"
username
"
:
label
=
"
t('username')
"
:
info
=
"
validateInfos.username
"
>
<
input
v
-
model
=
"
modelRef.username
"
class
=
"
form-control
"
/>
<
/FormItem
>
<
FormItem
name
=
"
password
"
:
label
=
"
t('password')
"
:
info
=
"
validateInfos.password
"
>
<
input
v
-
model
=
"
modelRef.password
"
class
=
"
form-control
"
/>
<
/FormItem
>
<
/Form
>
<
/ZModal
>
<
/template
>
...
...
@@ -107,13 +73,9 @@
<
script
setup
lang
=
"
ts
"
>
import
{
useI18n
}
from
"
vue-i18n
"
;
import
{
useStore
}
from
"
vuex
"
;
import
{
ZentaoData
}
from
"
@/store/zentao
"
;
import
{
ScriptData
}
from
"
@/views/script/store
"
;
import
{
unitTestTypesDef
,
ztfTestTypesDef
}
from
"
@/utils/const
"
;
import
{
computed
,
defineExpose
,
onMounted
,
withDefaults
,
ref
,
defineProps
,
...
...
@@ -124,60 +86,88 @@ import { useForm } from "@/utils/form";
import
Form
from
"
./Form.vue
"
;
import
FormItem
from
"
./FormItem.vue
"
;
import
{
StateType
}
from
"
@/views/site/store
"
;
import
{
getLangSettings
}
from
"
@/views/interpreter/service
"
;
import
{
getLangSettings
}
from
"
@/views/interpreter/service
"
;
import
{
getLangInterpreter
}
from
"
@/views/interpreter/service
"
;
import
{
getElectron
}
from
"
@/utils/comm
"
;
export
interface
FormSiteProps
{
show
?:
boolean
;
i
d
?:
number
;
i
nfo
?:
any
;
}
const
{
t
}
=
useI18n
();
const
languages
=
ref
<
any
>
({
}
)
const
languageMap
=
ref
<
any
>
({
}
)
const
getInterpretersA
=
async
()
=>
{
const
data
=
await
getLangSettings
()
languages
.
value
=
data
.
languages
languageMap
.
value
=
data
.
languageMap
}
const
isElectron
=
ref
(
getElectron
());
const
props
=
withDefaults
(
defineProps
<
FormSiteProps
>
(),
{
show
:
false
,
i
d
:
0
i
nfo
:
{
}
,
}
);
const
showModalRef
=
computed
(()
=>
{
return
props
.
show
;
}
);
const
languages
=
ref
<
any
>
({
}
)
const
languageMap
=
ref
<
any
>
({
}
)
const
interpreterInfos
=
ref
([]);
const
getInterpretersA
=
async
()
=>
{
const
data
=
await
getLangSettings
();
languages
.
value
=
data
.
languages
;
languageMap
.
value
=
data
.
languageMap
;
}
;
getInterpretersA
();
const
store
=
useStore
<
{
Site
:
StateType
}
>
();
const
get
=
async
(
id
:
number
):
Promise
<
void
>
=>
{
await
store
.
dispatch
(
"
Site/get
"
,
id
);
const
selectedInterpreter
=
ref
(
""
);
const
selectInterpreter
=
async
()
=>
{
console
.
log
(
"
selectInterpreter
"
,
selectedInterpreter
.
value
);
modelRef
.
value
.
path
=
selectedInterpreter
.
value
;
}
;
const
selectLang
=
async
(
item
)
=>
{
console
.
log
(
"
selectLang
"
,
modelRef
.
value
.
lang
);
modelRef
.
value
.
path
=
""
;
selectedInterpreter
.
value
=
""
;
if
(
modelRef
.
value
.
lang
===
""
)
{
interpreterInfos
.
value
=
[];
return
;
}
interpreterInfos
.
value
=
await
getLangInterpreter
(
modelRef
.
value
.
lang
);
if
(
interpreterInfos
.
value
==
null
)
interpreterInfos
.
value
=
[];
console
.
log
(
interpreterInfos
.
value
);
}
;
watch
(
props
,
()
=>
{
get
(
props
.
id
);
}
)
get
(
props
.
id
);
console
.
log
(
"
watch formInterpreter
"
,
props
);
if
(
props
.
info
.
value
==
undefined
)
{
modelRef
.
value
=
{
id
:
0
,
lang
:
""
,
path
:
""
,
}
;
}
else
{
modelRef
.
value
.
id
=
props
.
info
.
value
.
id
;
modelRef
.
value
.
path
=
props
.
info
.
value
.
path
;
modelRef
.
value
.
lang
=
props
.
info
.
value
.
lang
;
}
}
);
const
cancel
=
()
=>
{
emit
(
"
cancel
"
,
{
}
);
}
;
const
modelRef
=
computed
(()
=>
store
.
state
.
Site
.
detailResult
);
const
modelRef
=
ref
<
any
>
({
id
:
0
,
lang
:
""
,
path
:
""
,
}
);
const
rulesRef
=
ref
({
name
:
[{
required
:
true
,
msg
:
t
(
"
pls_name
"
)
}
],
url
:
[
{
required
:
true
,
msg
:
t
(
"
pls_zentao_url
"
),
}
,
{
regex
:
/
(
http
?
|https
)
:
\/\/[
-A-Za-z0-9+&@#
/
%?=~_|!:,.;
]
+
[
-A-Za-z0-9+&@#
/
%=~_|
]
/i
,
msg
:
t
(
"
pls_zentao_url
"
),
}
,
],
username
:
[{
required
:
true
,
msg
:
t
(
"
pls_username
"
)
}
],
password
:
[{
required
:
true
,
msg
:
t
(
"
pls_password
"
)
}
],
lang
:
[{
required
:
true
,
msg
:
t
(
"
pls_lang
"
)
}
],
path
:
[{
required
:
true
,
msg
:
t
(
"
pls_input_interpreter_path
"
)
}
],
}
);
const
{
validate
,
reset
,
validateInfos
}
=
useForm
(
modelRef
,
rulesRef
);
...
...
@@ -194,16 +184,14 @@ const submit = () => {
}
;
const
clearFormData
=
()
=>
{
modelRef
.
value
=
{
}
;
console
.
log
(
"
clear
"
);
modelRef
.
value
.
path
=
""
;
modelRef
.
value
.
lang
=
""
;
selectedInterpreter
.
value
=
""
;
interpreterInfos
.
value
=
[];
}
;
defineExpose
({
clearFormData
,
}
);
<
/script
>
<
style
lang
=
"
less
"
scoped
>
.
form
-
interpreter
{
min
-
width
:
500
px
;
}
<
/style
>
ui/src/layouts/MainLayout/components/FormNode.vue
浏览文件 @
2b7c7842
...
...
@@ -4,6 +4,7 @@
@
onCancel=
"cancel"
@
onOk=
"submit"
:title=
"t('create')"
:contentStyle=
"
{width: '300px'}"
>
<Form
labelCol=
"6"
wrapperCol=
"16"
>
<FormItem
name=
"name"
:label=
"t('name')"
:info=
"validateInfos.name"
>
...
...
ui/src/layouts/MainLayout/components/FormWorkspace.vue
浏览文件 @
2b7c7842
...
...
@@ -4,6 +4,7 @@
@
onCancel=
"cancel"
@
onOk=
"submit"
:title=
"t('create_workspace')"
:contentStyle=
"
{width: '500px'}"
>
<Form
labelCol=
"6"
wrapperCol=
"16"
>
<FormItem
name=
"name"
:label=
"t('name')"
:info=
"validateInfos.name"
>
...
...
ui/src/layouts/MainLayout/components/Modal.vue
浏览文件 @
2b7c7842
...
...
@@ -120,19 +120,12 @@ defineExpose({
:deep
(
.modal-content
)
{
position
:
relative
;
display
:
flex
;
flex-direction
:
column
;
margin
:
0
1rem
;
padding
:
1rem
;
border-radius
:
0.25rem
;
background
:
#fff
;
justify-content
:
space-between
;
}
.modal-title
{
margin
:
0
2rem
0
0
;
min-width
:
300px
;
justify-content
:
space-between
;
font-size
:
1.1rem
;
font-weight
:
700
;
}
...
...
@@ -141,8 +134,7 @@ defineExpose({
position
:
absolute
;
top
:
0.5rem
;
right
:
0.5rem
;
border
:
0
solid
#e2e8f0
;
margin-left
:
10px
;
border-width
:
0
;
background-color
:
transparent
;
font-size
:
1rem
;
cursor
:
pointer
;
...
...
@@ -152,24 +144,13 @@ defineExpose({
.modal-action
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
flex-shrink
:
0
;
padding
:
0
0
0
;
}
.dark-mode
div
::v-deep
.modal-content
{
border-color
:
#2d3748
;
background-color
:
#1a202c
;
}
.btn-modal
{
border
:
0
solid
#e2e8f
0
;
border
-width
:
0
;
margin-left
:
10px
;
text-transform
:
none
;
font-size
:
100%
;
cursor
:
pointer
;
padding
:
0.25rem
0.5rem
;
border-width
:
1px
;
border-radius
:
0.25rem
;
}
</
style
>
ui/src/layouts/MainLayout/components/TabPageSettings.vue
浏览文件 @
2b7c7842
...
...
@@ -32,10 +32,10 @@
</
template
>
</Table>
<Form
Site
<Form
Interpreter
:show=
"showCreateInterpreterModal"
:i
d=
"editId
"
@
submit=
"create
Site
"
:i
nfo=
"editInfo
"
@
submit=
"create
Interpreter
"
@
cancel=
"modalClose"
ref=
"formInterpreter"
/>
...
...
@@ -61,18 +61,18 @@ import {
import
{
useStore
}
from
"
vuex
"
;
import
{
StateType
}
from
"
@/views/site/store
"
;
import
{
momentUtcDef
}
from
"
@/utils/datetime
"
;
import
{
ZentaoData
}
from
"
@/store/zentao
"
;
import
Table
from
"
./Table.vue
"
;
import
notification
from
"
@/utils/notification
"
;
import
Modal
from
"
@/utils/modal
"
;
import
Button
from
"
./Button.vue
"
;
import
FormSite
from
"
./FormSite.vue
"
;
import
LanguageSettings
from
"
./LanguageSettings.vue
"
;
import
{
getLangSettings
}
from
"
@/views/interpreter/service
"
;
import
{
getLangInterpreter
,
saveInterpreter
}
from
"
@/views/interpreter/service
"
;
import
{
listInterpreter
,
removeInterpreter
,
}
from
"
@/views/interpreter/service
"
;
import
FormInterpreter
from
"
./FormInterpreter.vue
"
;
import
{
getLangSettings
}
from
"
@/views/interpreter/service
"
;
const
props
=
defineProps
<
{
tab
:
PageTab
;
...
...
@@ -84,7 +84,7 @@ const momentUtc = momentUtcDef;
let
interpreters
=
ref
<
any
>
([]);
let
interpreter
=
reactive
<
any
>
({});
const
editI
d
=
ref
(
0
);
const
editI
nfo
=
ref
(
0
);
onMounted
(()
=>
{
console
.
log
(
"
onMounted
"
);
...
...
@@ -132,7 +132,6 @@ const setColumns = () => {
};
setColumns
();
const
zentaoStore
=
useStore
<
{
zentao
:
ZentaoData
}
>
();
const
store
=
useStore
<
{
Site
:
StateType
}
>
();
const
showCreateInterpreterModal
=
ref
(
false
);
...
...
@@ -160,12 +159,12 @@ list();
const
create
=
()
=>
{
console
.
log
(
"
create
"
);
editI
d
.
value
=
0
;
editI
nfo
.
value
=
{}
;
showCreateInterpreterModal
.
value
=
true
;
};
const
edit
=
(
i
d
)
=>
{
console
.
log
(
"
edit
"
,
id
);
editI
d
.
value
=
id
;
const
edit
=
(
i
tem
)
=>
{
console
.
log
(
"
edit
"
,
i
tem
.
value
.
i
d
);
editI
nfo
.
value
=
item
;
showCreateInterpreterModal
.
value
=
true
;
};
...
...
@@ -173,8 +172,8 @@ const remove = (item) => {
Modal
.
confirm
({
title
:
""
,
content
:
t
(
"
confirm_delete
"
,
{
name
:
item
.
value
.
name
,
typ
:
t
(
"
zentao_site
"
),
name
:
languageMap
.
value
[
item
.
value
.
lang
]
.
name
,
typ
:
t
(
"
script_lang
"
),
}),
okText
:
t
(
"
confirm
"
),
cancelText
:
t
(
"
cancel
"
),
...
...
@@ -189,65 +188,18 @@ const modalClose = () => {
showCreateInterpreterModal
.
value
=
false
;
};
const
formInterpreter
=
ref
(
null
);
const
createSite
=
(
formData
)
=>
{
store
.
dispatch
(
"
Site/save
"
,
formData
).
then
((
response
)
=>
{
if
(
response
)
{
formInterpreter
.
value
.
clearFormData
();
notification
.
success
({
message
:
t
(
"
save_success
"
)
});
showCreateInterpreterModal
.
value
=
false
;
}
});
const
createInterpreter
=
(
formData
)
=>
{
saveInterpreter
(
formData
).
then
((
json
)
=>
{
if
(
json
.
code
===
0
)
{
formInterpreter
.
value
.
clearFormData
();
notification
.
success
({
message
:
t
(
"
save_success
"
)
});
showCreateInterpreterModal
.
value
=
false
;
list
();
}
})
};
</
script
>
<
style
>
.site-search
{
display
:
flex
;
justify-content
:
flex-end
;
}
.form-control
{
width
:
100%
;
color
:
#495057
;
background-color
:
#fff
;
border
:
1px
solid
#ced4da
;
border-radius
:
0.25rem
;
transition
:
border-color
0.15s
ease-in-out
,
box-shadow
0.15s
ease-in-out
;
}
.z-form-item-label
{
font-weight
:
400
;
color
:
#212529
;
text-align
:
left
;
box-sizing
:
border-box
;
display
:
inline-block
;
position
:
relative
;
width
:
100%
;
padding-right
:
15px
;
padding-left
:
15px
;
padding-top
:
calc
(
0.375rem
+
1px
);
padding-bottom
:
calc
(
0.375rem
+
1px
);
margin-bottom
:
0
;
line-height
:
1.5
;
}
.z-form-item
{
display
:
flex
;
align-items
:
center
;
word-break
:
keep-all
;
}
.form-control
:focus
{
color
:
#495057
;
background-color
:
#fff
;
border-color
:
#80bdff
;
outline
:
0
;
box-shadow
:
0
0
0
0.2rem
rgb
(
0
123
255
/
23%
);
}
.tab-setting-btn
{
border
:
none
;
background
:
none
;
color
:
#1890ff
;
border-style
:
hidden
!important
;
}
.t-card-toolbar
{
display
:
flex
;
justify-content
:
space-between
;
}
</
style
>
\ No newline at end of file
ui/src/layouts/MainLayout/style/main.css
浏览文件 @
2b7c7842
...
...
@@ -60,37 +60,3 @@ button {
.z-border
{
font-weight
:
bolder
;
}
.z-form-control
{
width
:
100%
;
color
:
#495057
;
background-color
:
#fff
;
border
:
1px
solid
#ced4da
;
border-radius
:
0.25rem
;
transition
:
border-color
0.15s
ease-in-out
,
box-shadow
0.15s
ease-in-out
;
}
.z-form-item-label
{
font-weight
:
400
;
color
:
#212529
;
text-align
:
left
;
box-sizing
:
border-box
;
display
:
inline-block
;
position
:
relative
;
width
:
100%
;
padding-right
:
15px
;
padding-left
:
15px
;
padding-top
:
calc
(
0.375rem
+
1px
);
padding-bottom
:
calc
(
0.375rem
+
1px
);
margin-bottom
:
0
;
line-height
:
1.5
;
}
.z-form-item
{
display
:
flex
;
align-items
:
center
;
}
.z-form-control
:focus
{
color
:
#495057
;
background-color
:
#fff
;
border-color
:
#80bdff
;
outline
:
0
;
box-shadow
:
0
0
0
0.2rem
rgb
(
0
123
255
/
25%
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录