Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ant-design-pro-vue
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
tianzhuanghu
ant-design-pro-vue
Commits
45dd3c63
Commit
45dd3c63
authored
Jan 28, 2019
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: table :rowSelection, Tree.jsx
parent
192fe98b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
154 additions
and
137 deletions
+154
-137
CountDown.vue
src/components/CountDown/CountDown.vue
+1
-2
Tree.jsx
src/components/Tree/Tree.jsx
+11
-3
PageLayout.vue
src/components/page/PageLayout.vue
+124
-123
index.js
src/components/table/index.js
+12
-5
filter.js
src/utils/filter.js
+2
-0
TableInnerEditList.vue
src/views/list/TableInnerEditList.vue
+0
-0
TableList.vue
src/views/list/TableList.vue
+1
-1
TreeList.vue
src/views/list/TreeList.vue
+3
-3
No files found.
src/components/CountDown/CountDown.vue
View file @
45dd3c63
...
...
@@ -23,8 +23,7 @@
},
onEnd
:
{
type
:
Function
,
default
:
()
=>
{
}
default
:
()
=>
({})
}
},
data
()
{
...
...
src/components/Tree/Tree.jsx
View file @
45dd3c63
...
...
@@ -10,14 +10,21 @@ export default {
type
:
Array
,
required
:
true
},
openKeys
:
{
type
:
Array
,
default
:
()
=>
[]
},
search
:
{
type
:
Boolean
,
default
:
false
}
},
created
()
{
this
.
localOpenKeys
=
this
.
openKeys
.
slice
(
0
)
},
data
()
{
return
{
o
penKeys
:
[]
localO
penKeys
:
[]
}
},
methods
:
{
...
...
@@ -99,7 +106,8 @@ export default {
},
render
()
{
const
{
dataSource
,
search
}
=
this
.
$props
// this.localOpenKeys = openKeys.slice(0)
const
list
=
dataSource
.
map
(
item
=>
{
return
this
.
renderItem
(
item
)
})
...
...
@@ -107,7 +115,7 @@ export default {
return
(
<
div
class=
"tree-wrapper"
>
{
search
?
this
.
renderSearch
()
:
null
}
<
Menu
mode=
"inline"
class=
"custom-tree"
{
...
{
on
:
{
click
:
item
=
>
this.$emit('click', item)
} }
}
>
<
Menu
mode=
"inline"
class=
"custom-tree"
{
...
{
on
:
{
click
:
item
=
>
this.$emit('click', item)
, 'update:openKeys': val =
>
{
this
.
localOpenKeys
=
val
}
}}} openKeys=
{
this
.
localOpenKeys
}
>
{
list
}
</
Menu
>
</
div
>
...
...
src/components/page/PageLayout.vue
View file @
45dd3c63
<
template
>
<div
:style=
"!$route.meta.pageHeader ? 'margin: -24px -24px 0px;' : null"
>
<!-- pageHeader , route meta hideHeader:true on hide -->
<page-header
v-if=
"!$route.meta.pageHeader"
:title=
"title"
:logo=
"logo"
:avatar=
"avatar"
>
<slot
slot=
"action"
name=
"action"
></slot>
<slot
slot=
"content"
name=
"headerContent"
></slot>
<div
slot=
"content"
v-if=
"!this.$slots.headerContent && desc"
>
<p
style=
"font-size: 14px;color: rgba(0,0,0,.65)"
>
{{
desc
}}
</p>
<div
class=
"link"
>
<template
v-for=
"(link, index) in linkList"
>
<a
:key=
"index"
:href=
"link.href"
>
<a-icon
:type=
"link.icon"
/>
<span>
{{
link
.
title
}}
</span>
</a>
</
template
>
</div>
</div>
<slot
slot=
"extra"
name=
"extra"
></slot>
<div
slot=
"pageMenu"
>
<div
class=
"page-menu-search"
v-if=
"search"
>
<a-input-search
style=
"width: 80%; max-width: 522px;"
placeholder=
"请输入..."
size=
"large"
enterButton=
"搜索"
/>
</div>
<div
class=
"page-menu-tabs"
v-if=
"tabs && tabs.items"
>
<!-- @change="callback" :activeKey="activeKey" -->
<a-tabs
:tabBarStyle=
"{margin: 0}"
@
change=
"tabs.callback"
:activeKey=
"tabs.active()"
>
<a-tab-pane
v-for=
"item in tabs.items"
:tab=
"item.title"
:key=
"item.key"
></a-tab-pane>
</a-tabs>
</div>
</div>
</page-header>
<div
class=
"content"
>
<div
:class=
"['page-header-index-wide']"
>
<slot></slot>
</div>
</div>
</div>
</template>
<
script
>
import
PageHeader
from
'./PageHeader'
export
default
{
name
:
'LayoutContent'
,
components
:
{
PageHeader
},
// ['desc', 'logo', 'title', 'avatar', 'linkList', 'extraImage']
props
:
{
desc
:
{
type
:
String
,
default
:
null
},
logo
:
{
type
:
String
,
default
:
null
},
title
:
{
type
:
String
,
default
:
null
},
avatar
:
{
type
:
String
,
default
:
null
},
linkList
:
{
type
:
Array
,
default
:
null
},
extraImage
:
{
type
:
String
,
default
:
null
},
search
:
{
type
:
Boolean
,
default
:
false
},
tabs
:
{
type
:
Object
,
default
:
()
=>
{}
}
},
methods
:
{
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.content
{
margin
:
24px
24px
0
;
.link
{
margin-top
:
16px
;
&:not(:empty)
{
margin-bottom
:
16px
;
}
a
{
margin-right
:
32px
;
height
:
24px
;
line-height
:
24px
;
display
:
inline-block
;
i
{
font-size
:
24px
;
margin-right
:
8px
;
vertical-align
:
middle
;
}
span
{
height
:
24px
;
line-height
:
24px
;
display
:
inline-block
;
vertical-align
:
middle
;
}
}
}
}
.page-menu-search
{
text-align
:
center
;
margin-bottom
:
16px
;
}
.page-menu-tabs
{
margin-top
:
48px
;
}
<
template
>
<div
:style=
"!$route.meta.pageHeader ? 'margin: -24px -24px 0px;' : null"
>
<!-- pageHeader , route meta hideHeader:true on hide -->
<page-header
v-if=
"!$route.meta.pageHeader"
:title=
"title"
:logo=
"logo"
:avatar=
"avatar"
>
<slot
slot=
"action"
name=
"action"
></slot>
<slot
slot=
"content"
name=
"headerContent"
></slot>
<div
slot=
"content"
v-if=
"!this.$slots.headerContent && desc"
>
<p
style=
"font-size: 14px;color: rgba(0,0,0,.65)"
>
{{
desc
}}
</p>
<div
class=
"link"
>
<template
v-for=
"(link, index) in linkList"
>
<a
:key=
"index"
:href=
"link.href"
>
<a-icon
:type=
"link.icon"
/>
<span>
{{
link
.
title
}}
</span>
</a>
</
template
>
</div>
</div>
<slot
slot=
"extra"
name=
"extra"
></slot>
<div
slot=
"pageMenu"
>
<div
class=
"page-menu-search"
v-if=
"search"
>
<a-input-search
style=
"width: 80%; max-width: 522px;"
placeholder=
"请输入..."
size=
"large"
enterButton=
"搜索"
/>
</div>
<div
class=
"page-menu-tabs"
v-if=
"tabs && tabs.items"
>
<!-- @change="callback" :activeKey="activeKey" -->
<a-tabs
:tabBarStyle=
"{margin: 0}"
@
change=
"tabs.callback"
:activeKey=
"tabs.active()"
>
<a-tab-pane
v-for=
"item in tabs.items"
:tab=
"item.title"
:key=
"item.key"
></a-tab-pane>
</a-tabs>
</div>
</div>
</page-header>
<div
class=
"content"
>
<div
:class=
"['page-header-index-wide']"
>
<slot></slot>
</div>
</div>
</div>
</template>
<
script
>
import
PageHeader
from
'./PageHeader'
export
default
{
name
:
'LayoutContent'
,
components
:
{
PageHeader
},
// ['desc', 'logo', 'title', 'avatar', 'linkList', 'extraImage']
props
:
{
desc
:
{
type
:
String
,
default
:
null
},
logo
:
{
type
:
String
,
default
:
null
},
title
:
{
type
:
String
,
default
:
null
},
avatar
:
{
type
:
String
,
default
:
null
},
linkList
:
{
type
:
Array
,
default
:
null
},
extraImage
:
{
type
:
String
,
default
:
null
},
search
:
{
type
:
Boolean
,
default
:
false
},
tabs
:
{
type
:
Object
,
default
:
()
=>
({})
}
},
methods
:
{
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.content
{
margin
:
24px
24px
0
;
.link
{
margin-top
:
16px
;
&:not(:empty)
{
margin-bottom
:
16px
;
}
a
{
margin-right
:
32px
;
height
:
24px
;
line-height
:
24px
;
display
:
inline-block
;
i
{
font-size
:
24px
;
margin-right
:
8px
;
vertical-align
:
middle
;
}
span
{
height
:
24px
;
line-height
:
24px
;
display
:
inline-block
;
vertical-align
:
middle
;
}
}
}
}
.page-menu-search
{
text-align
:
center
;
margin-bottom
:
16px
;
}
.page-menu-tabs
{
margin-top
:
48px
;
}
</
style
>
\ No newline at end of file
src/components/table/index.js
View file @
45dd3c63
...
...
@@ -49,6 +49,10 @@ export default {
type
:
[
Object
,
Boolean
],
default
:
null
},
rowSelection
:
{
type
:
Object
,
default
:
()
=>
({})
},
/** @Deprecated */
showAlertInfo
:
{
type
:
Boolean
,
...
...
@@ -97,7 +101,7 @@ export default {
/**
* 表格重新加载方法
* 如果参数为 true, 则强制刷新到第一页
* @param Boolean bool
* @param Boolean bool
*/
refresh
(
bool
=
false
)
{
this
.
loadData
(
bool
?
{
current
:
1
}:
{})
...
...
@@ -172,12 +176,13 @@ export default {
*/
updateSelect
(
selectedRowKeys
,
selectedRows
)
{
this
.
selectedRows
=
selectedRows
this
.
selectedRowKeys
=
selectedRowKeys
const
list
=
this
.
needTotalList
this
.
needTotalList
=
list
.
map
(
item
=>
{
return
{
...
item
,
total
:
selectedRows
.
reduce
((
sum
,
val
)
=>
{
const
total
=
sum
+
get
(
val
,
item
.
dataIndex
)
const
total
=
sum
+
parseInt
(
get
(
val
,
item
.
dataIndex
)
)
return
isNaN
(
total
)
?
0
:
total
},
0
)
}
...
...
@@ -198,6 +203,7 @@ export default {
* @returns {*}
*/
renderClear
(
callback
)
{
if
(
this
.
selectedRowKeys
.
length
<=
0
)
return
null
return
(
<
a
style
=
"margin-left: 24px"
onClick
=
{()
=>
{
callback
()
...
...
@@ -236,7 +242,7 @@ export default {
render
()
{
const
props
=
{}
const
localKeys
=
Object
.
keys
(
this
.
$data
)
const
showAlert
=
(
typeof
this
.
alert
===
'object'
&&
this
.
alert
!==
null
&&
this
.
alert
.
show
)
||
this
.
alert
const
showAlert
=
(
typeof
this
.
alert
===
'object'
&&
this
.
alert
!==
null
&&
this
.
alert
.
show
)
&&
typeof
this
.
rowSelection
.
selectedRowKeys
!==
'undefined'
||
this
.
alert
Object
.
keys
(
T
.
props
).
forEach
(
k
=>
{
const
localKey
=
`local
${
k
.
substring
(
0
,
1
).
toUpperCase
()}${
k
.
substring
(
1
)}
`
...
...
@@ -246,10 +252,11 @@ export default {
if
(
showAlert
&&
k
===
'rowSelection'
)
{
// 重新绑定 rowSelection 事件
return
props
[
k
]
=
{
selectedRowKeys
:
this
[
k
].
selectedRowKeys
,
selectedRows
:
this
.
selectedRows
,
selectedRowKeys
:
this
.
selectedRowKeys
,
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
this
.
updateSelect
(
selectedRowKeys
,
selectedRows
)
this
[
k
].
onChange
(
selectedRowKeys
,
selectedRows
)
t
ypeof
this
[
k
].
onChange
!==
'undefined'
&&
t
his
[
k
].
onChange
(
selectedRowKeys
,
selectedRows
)
}
}
}
...
...
src/utils/filter.js
View file @
45dd3c63
import
Vue
from
'vue'
import
moment
from
'moment'
import
'moment/locale/zh-cn'
moment
.
locale
(
'zh-cn'
)
Vue
.
filter
(
'NumberFormat'
,
function
(
value
)
{
if
(
!
value
)
{
...
...
src/views/list/TableInnerEditList.vue
View file @
45dd3c63
This diff is collapsed.
Click to expand it.
src/views/list/TableList.vue
View file @
45dd3c63
...
...
@@ -210,7 +210,7 @@
mdl
:
{},
// 高级搜索 展开/关闭
advanced
:
tru
e
,
advanced
:
fals
e
,
// 查询参数
queryParam
:
{},
// 表头
...
...
src/views/list/TreeList.vue
View file @
45dd3c63
...
...
@@ -2,7 +2,7 @@
<a-card
:bordered=
"false"
>
<a-row
:gutter=
"8"
>
<a-col
:span=
"5"
>
<s-tree
:dataSource=
"orgTree"
:search=
"true"
@
click=
"handleClick"
@
add=
"handleAdd"
@
titleClick=
"handleTitleClick"
></s-tree>
<s-tree
:dataSource=
"orgTree"
:
openKeys
.
sync=
"openKeys"
:
search=
"true"
@
click=
"handleClick"
@
add=
"handleAdd"
@
titleClick=
"handleTitleClick"
></s-tree>
</a-col>
<a-col
:span=
"19"
>
<s-table
...
...
@@ -58,7 +58,7 @@ export default {
},
data
()
{
return
{
openKeys
:
[
'
sub
1'
],
openKeys
:
[
'
key-0
1'
],
// 查询参数
queryParam
:
{},
...
...
@@ -102,7 +102,7 @@ export default {
.
then
(
res
=>
{
return
res
.
result
})
},
orgTree
:
[],
selectedRowKeys
:
[],
...
...
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