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
6b10d8fe
Commit
6b10d8fe
authored
Jun 28, 2021
by
水落(YangLei)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完善多按钮的情况
parent
09240bbb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
44 deletions
+100
-44
src/components/action_button/index.vue
src/components/action_button/index.vue
+36
-32
src/components/popconfirm_delete/index.vue
src/components/popconfirm_delete/index.vue
+6
-2
src/components/table/index.vue
src/components/table/index.vue
+4
-7
src/pages/frame/store/accountModule.js
src/pages/frame/store/accountModule.js
+1
-1
src/pages/system/view/task/index.vue
src/pages/system/view/task/index.vue
+51
-2
src/utils/index.js
src/utils/index.js
+2
-0
No files found.
src/components/action_button/index.vue
View file @
6b10d8fe
<
template
>
<
template
>
<a-table-column
:title=
"title"
>
<div>
<template
#default
="
row
"
>
<span
v-for=
"(btn, index) of basicBtns"
:key=
"btn.label"
>
<template
v-for=
"btn of basicBtns"
>
<PopconfirmDelete
<PopconfirmDelete
:url=
"getDelUrl(btn.url, row)"
:url=
"`/api/v1/roles/$
{row.roleId}`"
v-if=
"btn.type === 'del'"
:cb="refreshTable"
:cb=
"btn.after"
:key="btn.label"
:title=
"btn.title"
v-if="btn.type === 'del'"
/>
/>
<a
v-else
@
click=
"() => btn.click(row)"
>
{{
btn
.
label
}}
</a>
<a
@
click=
"() => btn?.click(row, btn)"
:key=
"btn.label"
>
{{
btn
.
label
}}
</a>
<a-divider
type=
"vertical"
v-if=
"moreBtns.length || index !== basicBtns.length - 1"
/>
<a-divider
type=
"vertical"
:key=
"btn.label + 'divider'"
/>
</span>
</
template
>
<
template
v-if=
"moreBtns.length"
>
<template
v-if=
"moreBtns.length"
>
<a-popover>
<a-popover>
<template
slot=
"content"
>
<template
slot=
"content"
>
<a
v-for=
"btn of moreBtns"
:key=
"btn.label"
@
click=
"() => btn?.click(row, btn)"
>
<a-space
direction=
"vertical"
>
<a
v-for=
"btn of moreBtns"
:key=
"btn.label"
@
click=
"() => btn.click(row)"
>
{{
btn
.
label
}}
{{
btn
.
label
}}
</a>
</a>
</
templat
e
>
</
a-spac
e>
<a>
...
</a
>
</
template
>
<
/a-popover
>
<
a>
...
</a
>
</
template
>
</
a-popover
>
</template>
</template>
</
a-table-column
>
</
div
>
</template>
</template>
<
script
>
<
script
>
import
{
isFunction
}
from
'
@/utils
'
;
import
PopconfirmDelete
from
'
@/components/popconfirm_delete/index.vue
'
;
export
default
{
export
default
{
components
:
{
PopconfirmDelete
},
props
:
{
props
:
{
title
:
{
type
:
String
,
default
:
'
操作
'
,
},
buttons
:
{
buttons
:
{
type
:
Array
,
type
:
Array
,
default
:
()
=>
[
default
:
()
=>
[],
{
label
:
'
查看
'
,
onClick
(
row
)
{},
type
:
'
del
'
,
},
],
},
},
row
:
Object
,
},
},
computed
:
{
computed
:
{
basicBtns
()
{
basicBtns
()
{
...
@@ -51,5 +48,12 @@ export default {
...
@@ -51,5 +48,12 @@ export default {
return
this
.
buttons
.
length
>
3
?
this
.
buttons
.
slice
(
3
)
:
[];
return
this
.
buttons
.
length
>
3
?
this
.
buttons
.
slice
(
3
)
:
[];
},
},
},
},
methods
:
{
getDelUrl
(
url
,
row
)
{
if
(
isFunction
(
url
))
return
url
(
row
);
return
url
;
},
},
};
};
</
script
>
</
script
>
src/components/popconfirm_delete/index.vue
View file @
6b10d8fe
<
template
>
<
template
>
<a-popconfirm
title=
"确认是否删除
"
ok-text=
"确认"
cancel-text=
"取消"
@
confirm=
"onOk"
>
<a-popconfirm
:title=
"title
"
ok-text=
"确认"
cancel-text=
"取消"
@
confirm=
"onOk"
>
<a>
删除
</a>
<a>
删除
</a>
</a-popconfirm>
</a-popconfirm>
</
template
>
</
template
>
...
@@ -15,11 +15,15 @@ export default {
...
@@ -15,11 +15,15 @@ export default {
type
:
Function
,
type
:
Function
,
default
:
EMPTY_FUN
,
default
:
EMPTY_FUN
,
},
},
title
:
{
type
:
String
,
default
:
'
确认是否删除
'
,
},
},
},
methods
:
{
methods
:
{
async
onOk
()
{
async
onOk
()
{
await
delReq
(
this
.
url
);
await
delReq
(
this
.
url
);
this
.
cb
();
this
?
.
cb
();
},
},
},
},
};
};
...
...
src/components/table/index.vue
View file @
6b10d8fe
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<div
class=
"tw-text-right tw-mt-2"
>
<div
class=
"tw-text-right tw-mt-2"
>
<a-space>
<a-space>
<a-button
@
click=
"queryForm =
{
...initQuery
}">重置
</a-button>
<a-button
@
click=
"queryForm =
{}">重置
</a-button>
<a-button
type=
"primary"
@
click=
"getData"
>
查询
</a-button>
<a-button
type=
"primary"
@
click=
"getData"
>
查询
</a-button>
</a-space>
</a-space>
</div>
</div>
...
@@ -79,9 +79,7 @@ export default {
...
@@ -79,9 +79,7 @@ export default {
};
};
return
{
return
{
data
:
[],
data
:
[],
queryForm
:
{
queryForm
:
{},
...
this
.
initQuery
,
},
loading
:
false
,
loading
:
false
,
addVisible
:
false
,
addVisible
:
false
,
submitLoading
:
false
,
submitLoading
:
false
,
...
@@ -104,7 +102,6 @@ export default {
...
@@ -104,7 +102,6 @@ export default {
},
},
},
},
mounted
()
{
mounted
()
{
console
.
log
(
this
.
addBtn
);
this
.
getData
();
this
.
getData
();
},
},
...
@@ -119,13 +116,13 @@ export default {
...
@@ -119,13 +116,13 @@ export default {
this
.
loading
=
false
;
this
.
loading
=
false
;
},
},
async
getDataNoPage
()
{
async
getDataNoPage
()
{
const
res
=
await
request
(
this
.
url
,
METHOD
.
GET
);
const
res
=
await
request
(
this
.
url
,
METHOD
.
GET
,
this
.
queryForm
);
if
(
this
.
formatData
)
this
.
data
=
this
.
formatData
(
res
);
if
(
this
.
formatData
)
this
.
data
=
this
.
formatData
(
res
);
else
this
.
data
=
res
;
else
this
.
data
=
res
;
},
},
async
getDataWithPage
()
{
async
getDataWithPage
()
{
const
res
=
await
request
(
this
.
url
,
METHOD
.
GET
,
this
.
queryForm
);
const
res
=
await
request
(
this
.
url
,
METHOD
.
GET
,
{
...
this
.
initQuery
,
...
this
.
queryForm
}
);
if
(
this
.
formatData
)
this
.
data
=
this
.
formatData
(
res
);
if
(
this
.
formatData
)
this
.
data
=
this
.
formatData
(
res
);
else
this
.
data
=
res
.
records
;
else
this
.
data
=
res
.
records
;
},
},
...
...
src/pages/frame/store/accountModule.js
View file @
6b10d8fe
...
@@ -11,7 +11,7 @@ export default {
...
@@ -11,7 +11,7 @@ export default {
user
:
state
=>
{
user
:
state
=>
{
if
(
!
state
.
user
)
{
if
(
!
state
.
user
)
{
try
{
try
{
const
user
=
localStorage
.
getItem
(
process
.
env
.
VUE_APP_USER_KEY
)
;
const
user
=
'
{}
'
;
state
.
user
=
JSON
.
parse
(
user
);
state
.
user
=
JSON
.
parse
(
user
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
e
);
console
.
error
(
e
);
...
...
src/pages/system/view/task/index.vue
View file @
6b10d8fe
...
@@ -4,10 +4,59 @@
...
@@ -4,10 +4,59 @@
<a-table-column
title=
"调度规则"
data-index=
"taskRule"
/>
<a-table-column
title=
"调度规则"
data-index=
"taskRule"
/>
<a-table-column
title=
"实现类"
data-index=
"implementClass"
/>
<a-table-column
title=
"实现类"
data-index=
"implementClass"
/>
<a-table-column
title=
"说明"
data-index=
"remark"
/>
<a-table-column
title=
"说明"
data-index=
"remark"
/>
<a-table-column
title=
"操作"
data-index=
"remark"
/>
<a-table-column
title=
"操作"
>
<template
#default
="
row
"
>
<ActionButton
:buttons=
"buttons"
:row=
"row"
/>
</
template
>
</a-table-column>
</my-table>
</my-table>
</template>
</template>
<
script
>
<
script
>
export
default
{};
import
ActionButton
from
'
@/components/action_button/index.vue
'
;
export
default
{
components
:
{
ActionButton
},
data
()
{
return
{
buttons
:
[
{
label
:
'
查看
'
,
onClick
(
row
)
{},
},
{
label
:
'
编辑
'
,
onClick
(
row
)
{},
},
{
type
:
'
del
'
,
url
:
row
=>
{
console
.
log
(
row
);
return
'
dassda
'
;
},
after
()
{
console
.
log
(
'
ddd
'
);
},
},
{
label
:
'
chakan
'
,
onClick
(
row
)
{},
},
{
label
:
'
查看1
'
,
onClick
(
row
)
{},
},
{
label
:
'
查看2
'
,
onClick
(
row
)
{},
},
{
label
:
'
查看3
'
,
onClick
(
row
)
{},
},
],
};
},
};
</
script
>
</
script
>
src/utils/index.js
View file @
6b10d8fe
...
@@ -29,3 +29,5 @@ export function convertListToTree(menuList, filterMenu = false) {
...
@@ -29,3 +29,5 @@ export function convertListToTree(menuList, filterMenu = false) {
}
}
export
function
EMPTY_FUN
()
{}
export
function
EMPTY_FUN
()
{}
export
const
isFunction
=
val
=>
typeof
val
===
'
function
'
;
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