Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
datax-cloud
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
黄营
datax-cloud
Commits
7674e0c5
Commit
7674e0c5
authored
Jun 17, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.0.0项目初始化
parent
1b5e6523
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
33 deletions
+40
-33
index.vue
datax-ui/src/components/SqlEditor/index.vue
+22
-23
DataSetAdd.vue
datax-ui/src/views/factory/dataset/DataSetAdd.vue
+11
-8
DataSetDetail.vue
datax-ui/src/views/factory/dataset/DataSetDetail.vue
+2
-1
DataSetEdit.vue
datax-ui/src/views/factory/dataset/DataSetEdit.vue
+5
-1
No files found.
datax-ui/src/components/SqlEditor/index.vue
View file @
7674e0c5
...
@@ -10,19 +10,19 @@
...
@@ -10,19 +10,19 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
"codemirror/lib/codemirror.css"
import
'codemirror/lib/codemirror.css'
import
"codemirror/theme/ambiance.css"
import
'codemirror/theme/blackboard.css'
import
"codemirror/addon/hint/show-hint.css"
import
'codemirror/addon/hint/show-hint.css'
let
CodeMirror
=
require
(
"codemirror/lib/codemirror"
)
let
CodeMirror
=
require
(
'codemirror/lib/codemirror'
)
require
(
"codemirror/addon/edit/matchbrackets"
)
require
(
'codemirror/addon/edit/matchbrackets'
)
require
(
"codemirror/addon/selection/active-line"
)
require
(
'codemirror/addon/selection/active-line'
)
require
(
"codemirror/mode/sql/sql"
)
require
(
'codemirror/mode/sql/sql'
)
require
(
"codemirror/addon/hint/show-hint"
)
require
(
'codemirror/addon/hint/show-hint'
)
require
(
"codemirror/addon/hint/sql-hint"
)
require
(
'codemirror/addon/hint/sql-hint'
)
export
default
{
export
default
{
name
:
'SqlEditor'
,
name
:
'SqlEditor'
,
data
()
{
data
()
{
return
{
return
{
editor
:
null
editor
:
null
}
}
...
@@ -55,12 +55,12 @@ export default {
...
@@ -55,12 +55,12 @@ export default {
}
}
},
},
mounted
()
{
mounted
()
{
let
mime
=
'text/x-mariadb'
let
mime
=
'text/x-mariadb'
//let theme = 'ambiance'//
设置主题,不设置的会使用默认主题
let
theme
=
'blackboard'
//
设置主题,不设置的会使用默认主题
this
.
editor
=
CodeMirror
.
fromTextArea
(
this
.
$refs
.
mycode
,
{
this
.
editor
=
CodeMirror
.
fromTextArea
(
this
.
$refs
.
mycode
,
{
value
:
this
.
value
,
value
:
this
.
value
,
mode
:
mime
,
//
选择对应代码编辑器的语言,我这边选的是数据库,根据个人情况自行设置即可
mode
:
mime
,
//
选择对应代码编辑器的语言,我这边选的是数据库,根据个人情况自行设置即可
indentWithTabs
:
true
,
indentWithTabs
:
true
,
smartIndent
:
true
,
smartIndent
:
true
,
lineNumbers
:
true
,
lineNumbers
:
true
,
...
@@ -68,19 +68,19 @@ export default {
...
@@ -68,19 +68,19 @@ export default {
cursorHeight
:
1
,
cursorHeight
:
1
,
lineWrapping
:
true
,
lineWrapping
:
true
,
readOnly
:
this
.
readOnly
,
readOnly
:
this
.
readOnly
,
//
theme: theme,
theme
:
theme
,
//
autofocus: true,
autofocus
:
true
,
extraKeys
:
{
'Ctrl'
:
'autocomplete'
},
//
自定义快捷键
extraKeys
:
{
'Ctrl'
:
'autocomplete'
},
//
自定义快捷键
hintOptions
:
{
//自定义提示选项
hintOptions
:
{
//
自定义提示选项
// 当匹配只有一项的时候是否自动补全
// 当匹配只有一项的时候是否自动补全
completeSingle
:
false
,
completeSingle
:
false
// tables: {
// tables: {
// users: ['name', 'score', 'birthDate'],
// users: ['name', 'score', 'birthDate'],
// countries: ['name', 'population', 'size']
// countries: ['name', 'population', 'size']
// }
// }
}
}
})
})
//代码自动提示功能,记住使用cursorActivity事件不要使用change事件,这是一个坑,那样页面直接会卡死
//
代码自动提示功能,记住使用cursorActivity事件不要使用change事件,这是一个坑,那样页面直接会卡死
this
.
editor
.
on
(
'inputRead'
,
()
=>
{
this
.
editor
.
on
(
'inputRead'
,
()
=>
{
this
.
editor
.
showHint
()
this
.
editor
.
showHint
()
})
})
...
@@ -93,7 +93,6 @@ export default {
...
@@ -93,7 +93,6 @@ export default {
}
else
{
}
else
{
this
.
editor
.
setValue
(
this
.
value
)
this
.
editor
.
setValue
(
this
.
value
)
}
}
}
}
}
}
}
}
...
@@ -102,10 +101,10 @@ export default {
...
@@ -102,10 +101,10 @@ export default {
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.CodeMirror
{
.CodeMirror
{
color
:
black
;
border
:
1px
solid
black
;
direction
:
ltr
;
font-size
:
13px
;
line-height
:
22px
;
}
}
//
这句为了解决匹配框显示有问题而加
//
这句为了解决匹配框显示有问题而加
.CodeMirror-hints
{
.CodeMirror-hints
{
z-index
:
9999
!important
;
z-index
:
9999
!important
;
...
...
datax-ui/src/views/factory/dataset/DataSetAdd.vue
View file @
7674e0c5
...
@@ -24,12 +24,15 @@
...
@@ -24,12 +24,15 @@
<el-input
v-model=
"form.setName"
placeholder=
"请输入数据集名称"
/>
<el-input
v-model=
"form.setName"
placeholder=
"请输入数据集名称"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"数据集sql"
prop=
"setSql"
>
<el-form-item
label=
"数据集sql"
prop=
"setSql"
>
<sql-editor
<sql-editor
ref=
"sqleditor"
ref=
"sqleditor"
:value=
"form.setSql"
:value=
"form.setSql"
@
changeTextarea=
"changeTextarea($event)"
@
changeTextarea=
"changeTextarea($event)"
style=
"height: 300px;"
style=
"height: 300px;"
></sql-editor>
></sql-editor>
</el-form-item>
<el-form-item>
<el-button
size=
"mini"
type=
"primary"
@
click=
"formaterSql"
>
Sql格式化
</el-button>
</el-form-item>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-radio-group
v-model=
"form.status"
>
<el-radio-group
v-model=
"form.status"
>
...
@@ -120,10 +123,10 @@ export default {
...
@@ -120,10 +123,10 @@ export default {
})
})
},
},
// 绑定编辑器value值的变化
// 绑定编辑器value值的变化
change
ModalTextarea
(
val
)
{
change
Textarea
(
val
)
{
this
.
$set
(
this
.
form
,
'setSql'
,
val
)
this
.
$set
(
this
.
form
,
'setSql'
,
val
)
},
},
formaterSql
(
val
)
{
formaterSql
()
{
let
sqleditor
=
this
.
$refs
.
sqleditor
let
sqleditor
=
this
.
$refs
.
sqleditor
sqleditor
.
editor
.
setValue
(
sqlFormatter
.
format
(
sqleditor
.
editor
.
getValue
()))
sqleditor
.
editor
.
setValue
(
sqlFormatter
.
format
(
sqleditor
.
editor
.
getValue
()))
},
},
...
...
datax-ui/src/views/factory/dataset/DataSetDetail.vue
View file @
7674e0c5
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
<sql-editor
<sql-editor
ref=
"sqleditor"
ref=
"sqleditor"
:value=
"form.setSql"
:value=
"form.setSql"
:readOnly=
"
nocursor
"
:readOnly=
"
true
"
style=
"height: 300px;"
style=
"height: 300px;"
></sql-editor>
></sql-editor>
</el-form-item>
</el-form-item>
...
@@ -110,6 +110,7 @@ export default {
...
@@ -110,6 +110,7 @@ export default {
getDataSet
(
id
).
then
(
response
=>
{
getDataSet
(
id
).
then
(
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
form
=
response
.
data
this
.
form
=
response
.
data
this
.
$refs
.
sqleditor
.
editor
.
setValue
(
this
.
form
.
setSql
)
}
}
})
})
}
}
...
...
datax-ui/src/views/factory/dataset/DataSetEdit.vue
View file @
7674e0c5
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
style=
"height: 300px;"
style=
"height: 300px;"
></sql-editor>
></sql-editor>
</el-form-item>
</el-form-item>
<el-form-item>
<el-button
size=
"mini"
type=
"primary"
@
click=
"formaterSql"
>
Sql格式化
</el-button>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-radio-group
v-model=
"form.status"
>
<el-radio-group
v-model=
"form.status"
>
<el-radio
<el-radio
...
@@ -124,11 +127,12 @@ export default {
...
@@ -124,11 +127,12 @@ export default {
getDataSet
(
id
).
then
(
response
=>
{
getDataSet
(
id
).
then
(
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
form
=
response
.
data
this
.
form
=
response
.
data
this
.
$refs
.
sqleditor
.
editor
.
setValue
(
this
.
form
.
setSql
)
}
}
})
})
},
},
// 绑定编辑器value值的变化
// 绑定编辑器value值的变化
change
ModalTextarea
(
val
)
{
change
Textarea
(
val
)
{
this
.
$set
(
this
.
form
,
'setSql'
,
val
)
this
.
$set
(
this
.
form
,
'setSql'
,
val
)
},
},
formaterSql
(
val
)
{
formaterSql
(
val
)
{
...
...
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