Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Starter Web Vue
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
product
kim3-web-vue
Starter Web Vue
Commits
fc8aea41
Commit
fc8aea41
authored
Jul 17, 2021
by
shuiluo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 代码优化, 部分国际化完善
parent
ca9a6587
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
149 additions
and
129 deletions
+149
-129
src/components/table/table.vue
src/components/table/table.vue
+12
-11
src/components/tool/Drawer.vue
src/components/tool/Drawer.vue
+100
-96
src/local/index.js
src/local/index.js
+2
-0
src/local/table.js
src/local/table.js
+7
-0
src/pages/frame/components/setting/Setting.vue
src/pages/frame/components/setting/Setting.vue
+9
-8
src/pages/frame/layouts/AdminLayout.vue
src/pages/frame/layouts/AdminLayout.vue
+2
-2
src/pages/ranger/task_managment/center/index.vue
src/pages/ranger/task_managment/center/index.vue
+17
-12
No files found.
src/components/table/table.vue
View file @
fc8aea41
...
@@ -13,10 +13,10 @@
...
@@ -13,10 +13,10 @@
<slot
name=
"moreSearch"
:query=
"queryForm"
/>
<slot
name=
"moreSearch"
:query=
"queryForm"
/>
</div>
</div>
</
template
>
</
template
>
<a-button>
更多查询
</a-button>
<a-button>
{{ $t('table.moreSearch') }}
</a-button>
</a-popover>
</a-popover>
<a-button
@
click=
"reset"
>
重置
</a-button>
<a-button
@
click=
"reset"
>
{{ $t('table.reset') }}
</a-button>
<a-button
type=
"primary"
@
click=
"getData"
>
查询
</a-button>
<a-button
type=
"primary"
@
click=
"getData"
>
{{ $t('table.search') }}
</a-button>
</a-space>
</a-space>
</div>
</div>
</my-card>
</my-card>
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
<my-card
:class=
"noPadding ? 'tw-p-0' : ''"
:style=
"tableCardStyle"
>
<my-card
:class=
"noPadding ? 'tw-p-0' : ''"
:style=
"tableCardStyle"
>
<a-space
class=
"tw-mb-2"
>
<a-space
class=
"tw-mb-2"
>
<a-button
type=
"primary"
v-if=
"newBtn"
@
click=
"addBtnClick"
>
<a-button
type=
"primary"
v-if=
"newBtn"
@
click=
"addBtnClick"
>
{{ newBtn.text ||
'新增'
}}
{{ newBtn.text ||
$t('table.add')
}}
</a-button>
</a-button>
<slot
name=
"operation"
/>
<slot
name=
"operation"
/>
</a-space>
</a-space>
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
>
>
<slot
/>
<slot
/>
<a-table-column
<a-table-column
:title=
"newButtons.title"
:title=
"newButtons.title
|| $t('table.operation')
"
v-if=
"this.newButtons"
v-if=
"this.newButtons"
v-bind=
"this.newButtons.options"
v-bind=
"this.newButtons.options"
>
>
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
:width=
"dWidth"
:width=
"dWidth"
@
close=
"hidden"
@
close=
"hidden"
:maskClosable=
"false"
:maskClosable=
"false"
:title=
"
t
itle"
:title=
"
drawerT
itle"
:afterVisibleChange=
"afterVisibleChange"
:afterVisibleChange=
"afterVisibleChange"
>
>
<slot
name=
"drawer"
:hidden=
"hidden"
:refresh=
"getData"
:type=
"type"
:row=
"row"
/>
<slot
name=
"drawer"
:hidden=
"hidden"
:refresh=
"getData"
:type=
"type"
:row=
"row"
/>
...
@@ -83,8 +83,6 @@ const initQuery = {
...
@@ -83,8 +83,6 @@ const initQuery = {
pageNum
:
1
,
pageNum
:
1
,
};
};
const
defaultTitle
=
'
新增
'
;
export
default
{
export
default
{
props
:
{
props
:
{
url
:
String
,
url
:
String
,
...
@@ -123,7 +121,7 @@ export default {
...
@@ -123,7 +121,7 @@ export default {
loading
:
false
,
loading
:
false
,
total
:
0
,
total
:
0
,
visible
:
false
,
visible
:
false
,
title
:
n
ewBtn
.
title
??
defaultTitle
,
title
:
n
ull
,
drawerStyle
:
{
drawerStyle
:
{
display
:
'
flex
'
,
display
:
'
flex
'
,
flexDirection
:
'
column
'
,
flexDirection
:
'
column
'
,
...
@@ -160,7 +158,7 @@ export default {
...
@@ -160,7 +158,7 @@ export default {
newButtons
()
{
newButtons
()
{
return
this
.
buttons
return
this
.
buttons
?
Array
.
isArray
(
this
.
buttons
)
?
Array
.
isArray
(
this
.
buttons
)
?
{
data
:
this
.
buttons
,
title
:
'
操作
'
}
?
{
data
:
this
.
buttons
}
:
this
.
buttons
:
this
.
buttons
:
null
;
:
null
;
},
},
...
@@ -188,6 +186,9 @@ export default {
...
@@ -188,6 +186,9 @@ export default {
}
}
:
{};
:
{};
},
},
drawerTitle
()
{
return
this
.
title
??
this
.
addBtn
?.
title
??
this
.
$t
(
'
table.add
'
);
},
},
},
methods
:
{
methods
:
{
...
@@ -228,7 +229,7 @@ export default {
...
@@ -228,7 +229,7 @@ export default {
},
},
afterVisibleChange
(
visible
)
{
afterVisibleChange
(
visible
)
{
if
(
!
visible
)
{
if
(
!
visible
)
{
this
.
title
=
this
.
addBtn
?.
title
??
defaultTitle
;
this
.
title
=
null
;
this
.
type
=
null
;
this
.
type
=
null
;
this
.
row
=
null
;
this
.
row
=
null
;
this
.
dWidth
=
this
.
drawerWidth
;
this
.
dWidth
=
this
.
drawerWidth
;
...
...
src/components/tool/Drawer.vue
View file @
fc8aea41
<
template
>
<
template
>
<div
>
<div>
<div
:class=
"['mask', visible ? 'open' : 'close']"
@
click=
"close"
></div>
<div
:class=
"['mask', visible ? 'open' : 'close']"
@
click=
"close"
></div>
<div
:class=
"['drawer', placement, visible ? 'open' : 'close']"
>
<div
:class=
"['drawer', placement, visible ? 'open' : 'close']"
>
<div
ref=
"drawer"
class=
"content beauty-scroll"
>
<div
ref=
"drawer"
class=
"content beauty-scroll"
>
<slot></slot>
<slot
/>
</div>
</div>
<div
v-if=
"showHandler"
:class=
"['handler-container', placement, visible ? 'open' : 'close']"
ref=
"handler"
@
click=
"toggle"
>
<div
<slot
v-if=
"$slots.handler"
name=
"handler"
></slot>
v-if=
"showHandler"
<div
v-else
class=
"handler"
>
:class=
"['handler-container', placement, visible ? 'open' : 'close']"
<a-icon
:type=
"visible ? 'close' : 'bars'"
/>
ref=
"handler"
</div>
@
click=
"toggle"
</div>
>
<slot
v-if=
"$slots.handler"
name=
"handler"
/>
<div
v-else
class=
"handler"
>
<a-icon
:type=
"visible ? 'close' : 'bars'"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
name
:
'
Drawer
'
,
name
:
'
Drawer
'
,
data
()
{
data
()
{
return
{
return
{};
}
},
model
:
{
prop
:
'
visible
'
,
event
:
'
change
'
},
props
:
{
visible
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
},
},
placement
:
{
model
:
{
type
:
String
,
prop
:
'
visible
'
,
required
:
false
,
event
:
'
change
'
,
default
:
'
left
'
},
},
showHandler
:
{
props
:
{
type
:
Boolean
,
visible
:
{
required
:
false
,
type
:
Boolean
,
default
:
true
required
:
false
,
}
default
:
false
,
},
},
methods
:
{
placement
:
{
open
()
{
type
:
String
,
this
.
$emit
(
'
change
'
,
true
)
required
:
false
,
default
:
'
left
'
,
},
showHandler
:
{
type
:
Boolean
,
required
:
false
,
default
:
true
,
},
},
},
close
()
{
methods
:
{
this
.
$emit
(
'
change
'
,
false
)
open
()
{
this
.
$emit
(
'
change
'
,
true
);
},
close
()
{
this
.
$emit
(
'
change
'
,
false
);
},
toggle
()
{
this
.
$emit
(
'
change
'
,
!
this
.
visible
);
},
},
},
toggle
()
{
};
this
.
$emit
(
'
change
'
,
!
this
.
visible
)
}
}
}
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
.mask
{
.mask
{
position: fixed;
position: fixed;
left: 0;
left: 0;
right: 0;
right: 0;
...
@@ -67,50 +71,50 @@ export default {
...
@@ -67,50 +71,50 @@ export default {
background-color: @shadow-color;
background-color: @shadow-color;
transition: all 0.5s;
transition: all 0.5s;
z-index: 100;
z-index: 100;
&.open{
&.open
{
display: inline-block;
display: inline-block;
}
}
&.close{
&.close
{
display: none;
display: none;
}
}
}
}
.drawer
{
.drawer
{
position: fixed;
position: fixed;
transition: all 0.5s;
transition: all 0.5s;
height: 100vh;
height: 100vh;
z-index: 100;
z-index: 100;
&.left{
&.left {
left: 0px;
left: 0px;
&.open{
&.open {
.content{
.content {
box-shadow: 2px 0 8px @shadow-color;
box-shadow: 2px 0 8px @shadow-color;
}
}
&.close {
transform: translateX(-100%);
}
}
}
&.close{
transform: translateX(-100%);
}
}
}
&.right{
&.right {
right: 0px;
right: 0px;
.content{
.content {
float: right;
float: right;
}
}
&.open{
&.open {
.content{
.content {
box-shadow: -2px 0 8px @shadow-color;
box-shadow: -2px 0 8px @shadow-color;
}
}
&.close {
transform: translateX(100%);
}
}
}
&.close{
transform: translateX(100%);
}
}
}
}
}
.content
{
.content
{
display: inline-block;
display: inline-block;
height: 100vh;
height: 100vh;
overflow-y: auto;
overflow-y: auto;
}
}
.handler-container
{
.handler-container
{
position: absolute;
position: absolute;
display: inline-block;
display: inline-block;
text-align: center;
text-align: center;
...
@@ -119,24 +123,24 @@ export default {
...
@@ -119,24 +123,24 @@ export default {
top: 200px;
top: 200px;
z-index: 100;
z-index: 100;
.handler {
.handler {
height: 40px;
height: 40px;
width: 40px;
width: 40px;
background-color: @base-bg-color;
background-color: @base-bg-color;
font-size: 26px;
font-size: 26px;
box-shadow: 0 2px 8px @shadow-color;
box-shadow: 0 2px 8px @shadow-color;
line-height: 40px;
line-height: 40px;
}
}
&.left{
&.left
{
right: -40px;
right: -40px;
.handler
{
.handler
{
border-radius: 0 5px 5px 0;
border-radius: 0 5px 5px 0;
}
}
}
}
&.right{
&.right
{
left: -40px;
left: -40px;
.handler
{
.handler
{
border-radius: 5px 0 0 5px;
border-radius: 5px 0 0 5px;
}
}
}
}
}
}
</
style
>
</
style
>
src/local/index.js
View file @
fc8aea41
import
selectLang
from
'
./select
'
;
import
selectLang
from
'
./select
'
;
import
TableLang
from
'
./table
'
;
const
zh_CN
=
{};
const
zh_CN
=
{};
const
en_US
=
{};
const
en_US
=
{};
...
@@ -12,5 +13,6 @@ function formatLang(langObject) {
...
@@ -12,5 +13,6 @@ function formatLang(langObject) {
}
}
formatLang
(
selectLang
);
formatLang
(
selectLang
);
formatLang
(
TableLang
);
export
{
en_US
,
zh_CN
};
export
{
en_US
,
zh_CN
};
src/local/table.js
0 → 100644
View file @
fc8aea41
export
default
{
'
table.operation
'
:
[
'
操作
'
,
'
Operation
'
],
'
table.moreSearch
'
:
[
'
更多查询
'
,
'
More Search
'
],
'
table.reset
'
:
[
'
重置
'
,
'
Reset
'
],
'
table.add
'
:
[
'
新增
'
,
'
Add
'
],
'
table.search
'
:
[
'
查询
'
,
'
Search
'
],
};
src/pages/frame/components/setting/Setting.vue
View file @
fc8aea41
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
</setting-item>
</setting-item>
<setting-item
:title=
"$t('theme.title')"
>
<setting-item
:title=
"$t('theme.title')"
>
<img-checkbox-group
<img-checkbox-group
@
change=
"
values
=> setTheme(
{ ...theme, mode: values[0] })"
@
change=
"
(values)
=> setTheme(
{ ...theme, mode: values[0] })"
:default-values="[theme.mode]"
:default-values="[theme.mode]"
>
>
<img-checkbox
<img-checkbox
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
</setting-item>
</setting-item>
<a-divider
/>
<a-divider
/>
<setting-item
:title=
"$t('navigate.title')"
>
<setting-item
:title=
"$t('navigate.title')"
>
<img-checkbox-group
@
change=
"
values
=> setLayout(values[0])"
:default-values=
"[layout]"
>
<img-checkbox-group
@
change=
"
(values)
=> setLayout(values[0])"
:default-values=
"[layout]"
>
<img-checkbox
<img-checkbox
:title=
"$t('navigate.side')"
:title=
"$t('navigate.side')"
img=
"https://gw.alipayobjects.com/zos/rmsportal/JopDzEhOqwOjeNTXkoje.svg"
img=
"https://gw.alipayobjects.com/zos/rmsportal/JopDzEhOqwOjeNTXkoje.svg"
...
@@ -105,7 +105,7 @@
...
@@ -105,7 +105,7 @@
:checked=
"animate.disabled"
:checked=
"animate.disabled"
slot=
"actions"
slot=
"actions"
size=
"small"
size=
"small"
@
change=
"
val
=> setAnimate(
{ ...animate, disabled: val })"
@
change=
"
(val)
=> setAnimate(
{ ...animate, disabled: val })"
/>
/>
</a-list-item>
</a-list-item>
<a-list-item>
<a-list-item>
...
@@ -113,7 +113,7 @@
...
@@ -113,7 +113,7 @@
<a-select
<a-select
:value=
"animate.name"
:value=
"animate.name"
:getPopupContainer=
"getPopupContainer"
:getPopupContainer=
"getPopupContainer"
@
change=
"
val
=> setAnimate(
{ ...animate, name: val })"
@
change=
"
(val)
=> setAnimate(
{ ...animate, name: val })"
class="select-item"
class="select-item"
size="small"
size="small"
slot="actions"
slot="actions"
...
@@ -128,7 +128,7 @@
...
@@ -128,7 +128,7 @@
<a-select
<a-select
:value=
"animate.direction"
:value=
"animate.direction"
:getPopupContainer=
"getPopupContainer"
:getPopupContainer=
"getPopupContainer"
@
change=
"
val
=> setAnimate(
{ ...animate, direction: val })"
@
change=
"
(val)
=> setAnimate(
{ ...animate, direction: val })"
class="select-item"
class="select-item"
size="small"
size="small"
slot="actions"
slot="actions"
...
@@ -238,7 +238,7 @@ export default {
...
@@ -238,7 +238,7 @@ export default {
},
},
computed
:
{
computed
:
{
directions
()
{
directions
()
{
return
this
.
animates
.
find
(
item
=>
item
.
name
==
this
.
animate
.
name
).
directions
;
return
this
.
animates
.
find
(
(
item
)
=>
item
.
name
==
this
.
animate
.
name
).
directions
;
},
},
...
mapState
(
'
settingModule
'
,
[
...
mapState
(
'
settingModule
'
,
[
'
theme
'
,
'
theme
'
,
...
@@ -254,7 +254,7 @@ export default {
...
@@ -254,7 +254,7 @@ export default {
]),
]),
},
},
watch
:
{
watch
:
{
'
animate.name
'
:
function
(
val
)
{
'
animate.name
'
:
function
(
val
)
{
this
.
setAnimate
({
name
:
val
,
direction
:
this
.
directions
[
0
]
});
this
.
setAnimate
({
name
:
val
,
direction
:
this
.
directions
[
0
]
});
},
},
},
},
...
@@ -282,7 +282,7 @@ export default {
...
@@ -282,7 +282,7 @@ export default {
let
config
=
{};
let
config
=
{};
let
mySetting
=
this
.
$store
.
state
.
settingModule
;
let
mySetting
=
this
.
$store
.
state
.
settingModule
;
let
dftSetting
=
local
?
settingConfig
:
settingConfig
;
let
dftSetting
=
local
?
settingConfig
:
settingConfig
;
Object
.
keys
(
mySetting
).
forEach
(
key
=>
{
Object
.
keys
(
mySetting
).
forEach
(
(
key
)
=>
{
const
dftValue
=
dftSetting
[
key
],
const
dftValue
=
dftSetting
[
key
],
myValue
=
mySetting
[
key
];
myValue
=
mySetting
[
key
];
if
(
dftValue
!=
undefined
&&
!
fastEqual
(
dftValue
,
myValue
))
{
if
(
dftValue
!=
undefined
&&
!
fastEqual
(
dftValue
,
myValue
))
{
...
@@ -309,6 +309,7 @@ export default {
...
@@ -309,6 +309,7 @@ export default {
<
style
lang=
"less"
module
>
<
style
lang=
"less"
module
>
.side-setting {
.side-setting {
min-height: 100%;
min-height: 100%;
width: 280px;
background-color: @base-bg-color;
background-color: @base-bg-color;
padding: 24px;
padding: 24px;
font-size: 14px;
font-size: 14px;
...
...
src/pages/frame/layouts/AdminLayout.vue
View file @
fc8aea41
...
@@ -47,9 +47,9 @@
...
@@ -47,9 +47,9 @@
<
script
>
<
script
>
import
LayoutTopHeader
from
'
../components/header/LayoutTopHeader.vue
'
;
import
LayoutTopHeader
from
'
../components/header/LayoutTopHeader.vue
'
;
import
Drawer
from
'
@/components/tool/Drawer
'
;
import
Drawer
from
'
@/components/tool/Drawer
.vue
'
;
import
SideMenu
from
'
@/components/menu/SideMenu.vue
'
;
import
SideMenu
from
'
@/components/menu/SideMenu.vue
'
;
import
Setting
from
'
../components/setting/Setting
'
;
import
Setting
from
'
../components/setting/Setting
.vue
'
;
import
{
mapState
,
mapMutations
,
mapGetters
}
from
'
vuex
'
;
import
{
mapState
,
mapMutations
,
mapGetters
}
from
'
vuex
'
;
import
{
convertListToTree
,
getUserInfo
}
from
'
@/utils
'
;
import
{
convertListToTree
,
getUserInfo
}
from
'
@/utils
'
;
...
...
src/pages/ranger/task_managment/center/index.vue
View file @
fc8aea41
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
:selected.sync=
"selected"
:selected.sync=
"selected"
ref=
"table"
ref=
"table"
:drawerWidth=
"800"
:drawerWidth=
"800"
:scroll=
"scroll"
>
>
<template
#search
="
{ query }">
<template
#search
="
{ query }">
<MoreItem
label=
"开始时间"
>
<MoreItem
label=
"开始时间"
>
...
@@ -175,19 +176,23 @@ export default {
...
@@ -175,19 +176,23 @@ export default {
addBtn
:
{
addBtn
:
{
title
:
'
新建临时任务
'
,
title
:
'
新建临时任务
'
,
},
},
buttons
:
[
buttons
:
{
{
options
:
{
fixed
:
'
right
'
,
width
:
200
},
label
:
'
详情
'
,
data
:
[
click
:
this
.
viewDetail
,
{
},
label
:
'
详情
'
,
{
label
:
'
进度
'
,
click
:
this
.
viewProgress
},
click
:
this
.
viewDetail
,
{
},
type
:
'
confirm
'
,
{
label
:
'
进度
'
,
click
:
this
.
viewProgress
},
url
:
(
row
)
=>
`/ranger/inspection/api/v1/jobs/
${
row
.
jobId
}
`
,
{
after
:
this
.
refresh
,
type
:
'
confirm
'
,
},
url
:
(
row
)
=>
`/ranger/inspection/api/v1/jobs/
${
row
.
jobId
}
`
,
],
after
:
this
.
refresh
,
},
],
},
selected
:
{},
selected
:
{},
scroll
:
{
x
:
1500
},
};
};
},
},
methods
:
{
methods
:
{
...
...
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