Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
Project
Project
Details
Activity
Releases
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
周远喜
mes-ui
Commits
2a0cb85a
Commit
2a0cb85a
authored
Nov 06, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.mes123.com:zhouyx/mes-ui into product-rjt
parents
0d7f708f
c3771843
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
384 additions
and
159 deletions
+384
-159
EditGrid.vue
components/page/treeGrid/EditGrid.vue
+381
-158
index.vue
pages/project/plan/index.vue
+3
-1
No files found.
components/page/treeGrid/EditGrid.vue
View file @
2a0cb85a
<
template
>
<
template
>
<div
class=
"t
reeTbale
"
>
<div
class=
"t
able-content
"
>
<div
class=
"table-tools"
>
<div
class=
"table-tools"
>
<div
class=
"table-search"
>
<div
class=
"table-search"
>
<slot
name=
"easySearch"
></slot>
<slot
name=
"easySearch"
></slot>
...
@@ -11,7 +11,9 @@
...
@@ -11,7 +11,9 @@
</Button>
-->
</Button>
-->
</div>
</div>
</div>
</div>
<table>
<div
class=
"table-main"
ref=
"main"
>
<div>
<table
class=
"table-head"
>
<thead>
<thead>
<tr>
<tr>
<th
<th
...
@@ -44,6 +46,11 @@
...
@@ -44,6 +46,11 @@
</th>
</th>
</tr>
</tr>
</thead>
</thead>
</table>
</div>
<div
class=
"table-body"
>
<table>
<tbody>
<tbody>
<tr
<tr
v-for=
"(item, index) in trs"
v-for=
"(item, index) in trs"
...
@@ -75,8 +82,15 @@
...
@@ -75,8 +82,15 @@
></Checkbox>
></Checkbox>
</label>
</label>
<Icon
v-if=
"column.type === 'drag'"
type=
"md-more"
class=
"drag"
/>
<Icon
<DTSpan
v-if=
"column.type == 'date'"
:value=
"item[column.key]"
/>
v-if=
"column.type === 'drag'"
type=
"md-more"
class=
"drag"
/>
<DTSpan
v-if=
"column.type == 'date'"
:value=
"item[column.key]"
/>
<div
v-if=
"column.type == 'user'"
>
<div
v-if=
"column.type == 'user'"
>
<User
:value=
"item[column.key]"
/>
<User
:value=
"item[column.key]"
/>
</div>
</div>
...
@@ -103,13 +117,18 @@
...
@@ -103,13 +117,18 @@
<span
@
click=
"toggle(index, item)"
v-if=
"snum == treeColumn()"
>
<span
@
click=
"toggle(index, item)"
v-if=
"snum == treeColumn()"
>
<span
class=
"ib"
v-width=
"spaceWidth * item._level"
></span>
<span
class=
"ib"
v-width=
"spaceWidth * item._level"
></span>
<a
v-if=
"item._count > 0"
class=
"expand"
<a
v-if=
"item._count > 0"
class=
"expand"
><Icon
:type=
"!item._expanded ? 'ios-add' : 'ios-remove'"
/>
</a
><Icon
:type=
"!item._expanded ? 'ios-add' : 'ios-remove'"
/>
</a
><i
v-else
class=
"ms-tree-space"
></i>
><i
v-else
class=
"ms-tree-space"
></i>
</span>
</span>
<!-- 菜单名称、排序、请求地址 -->
<!-- 菜单名称、排序、请求地址 -->
<label
<label
v-if=
"
v-if=
"
!column.type && !column.code && !column.render && !column.slot
!column.type &&
!column.code &&
!column.render &&
!column.slot
"
"
>
>
{{
renderBody
(
item
,
column
)
}}
{{
renderBody
(
item
,
column
)
}}
...
@@ -132,6 +151,77 @@
...
@@ -132,6 +151,77 @@
</tbody>
</tbody>
</table>
</table>
</div>
</div>
</div>
<div
class=
"table-footer"
>
<slot
name=
"footer"
></slot>
<Page
v-if=
"page"
:total=
"search.total"
:current=
"search.page"
class=
"fr"
show-total
size=
"small"
show-elevator
show-sizer
:page-size=
"search.pageSize"
:page-size-opts=
"pageSizeOpts"
@
on-change=
"pageChange"
@
on-page-size-change=
"pageSizeChange"
/>
</div>
<Modal
v-if=
"high"
v-model=
"modalSearch"
title=
"高级搜索"
draggable
width=
"800"
ref=
"search"
>
<slot
name=
"searchForm"
></slot>
<div
slot=
"footer"
>
<Button
@
click=
"modalSearch = false"
class=
"mr20"
>
取消
</Button>
<Button
@
click=
"complexSearch"
type=
"primary"
class=
"mr20"
>
查询
</Button>
</div>
</Modal>
<Drawer
title=
"列设置"
v-if=
"set"
v-model=
"config"
:scrollable=
"true"
placement=
"left"
:mask=
"false"
>
<div
slot=
"header"
>
列设置
<a
@
click=
"undoConfig"
class=
"ml50"
>
<Icon
type=
"md-refresh"
title=
"恢复初始设置"
/>
</a>
</div>
<ul
class=
"table-columns"
>
<li
v-for=
"(li, index) in columnsCur"
:key=
"index"
v-dragging=
"
{ item: li, list: columnsCur, group: 'li' }"
>
<label
@
click=
"columnChange(li, index)"
:class=
"
{ dis: li.hide }">
<Icon
:type=
"li.hide ? 'md-eye-off' : 'md-eye'"
size=
"16"
class=
"mr10"
/>
<span>
{{
li
.
title
}}
</span>
</label>
<Icon
type=
"ios-move"
class=
"move"
size=
"18"
/>
</li>
</ul>
</Drawer>
<FooterToolbar
v-if=
"batch"
v-show=
"footerToolbar"
class=
"ftball"
>
<div
class=
"tip"
>
已选
{{
selectItems
.
length
}}
项
</div>
<slot
name=
"batch"
></slot>
<Button
@
click=
"cancelBatch"
>
取消
</Button>
</FooterToolbar>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
TableExpand
from
"./expand"
;
import
TableExpand
from
"./expand"
;
...
@@ -151,23 +241,66 @@ export default {
...
@@ -151,23 +241,66 @@ export default {
return
modes
.
indexOf
(
v
)
>
-
1
;
return
modes
.
indexOf
(
v
)
>
-
1
;
},
},
},
},
action
:
{
border
:
{
//接口地址
//是否显示边框
type
:
String
,
type
:
Boolean
,
default
:
true
,
},
batch
:
{
//是否批量操作
type
:
Boolean
,
default
:
true
,
},
format
:
{
type
:
Function
,
default
:
null
,
default
:
null
,
},
},
level
:
{
initsearch
:
{
//展开层级
type
:
Function
,
default
:
null
,
},
lazy
:
{
//懒加载设置,设置为真时候,默认不加载数据。
type
:
Boolean
,
default
:
false
,
},
placeholder
:
{
type
:
String
,
default
:
"请输入关键字"
,
},
height
:
{
type
:
Number
,
type
:
Number
,
default
:
1
,
default
:
0
,
},
},
query
:
{
tool
:
{
//参数
//是否显示工具栏
type
:
Object
,
type
:
Boolean
,
default
:
true
,
},
},
dataFormater
:
{
easy
:
{
//数据处理函数
//是否显示简单搜索
type
:
Function
,
type
:
Boolean
,
default
:
true
,
},
high
:
{
//是否显示高级搜索
type
:
Boolean
,
default
:
true
,
},
draggable
:
{
//是否可以拖拽
type
:
Boolean
,
default
:
false
,
},
set
:
{
//是否显示列设置
type
:
Boolean
,
default
:
true
,
},
page
:
{
//是否分页
type
:
Boolean
,
default
:
false
,
},
},
columns
:
Array
,
columns
:
Array
,
items
:
{
items
:
{
...
@@ -199,7 +332,24 @@ export default {
...
@@ -199,7 +332,24 @@ export default {
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
default
:
0
,
default
:
0
,
},
},
action
:
{
//接口地址
type
:
String
,
default
:
""
,
},
conditions
:
{
//查询条件
type
:
Object
,
default
:
function
()
{
return
{
keys
:
{
op
:
"name"
,
value
:
""
,
default
:
true
,
},
};
},
},
iconName
:
false
,
iconName
:
false
,
drag
:
{
drag
:
{
//拖拽
//拖拽
...
@@ -211,6 +361,10 @@ export default {
...
@@ -211,6 +361,10 @@ export default {
type
:
Number
,
type
:
Number
,
default
:
20
,
default
:
20
,
},
},
exportTitle
:
{
type
:
String
,
default
:
""
,
},
},
},
provide
()
{
provide
()
{
return
{
return
{
...
@@ -221,9 +375,25 @@ export default {
...
@@ -221,9 +375,25 @@ export default {
return
{
return
{
color
:
"#19be6b"
,
color
:
"#19be6b"
,
checkAll
:
false
,
checkAll
:
false
,
keys
:
""
,
selectItems
:
[],
modalSearch
:
false
,
footerToolbar
:
false
,
search
:
{
pageIndex
:
1
,
pageSize
:
20
,
sortBy
:
"id"
,
isDesc
:
true
,
conditions
:
[],
},
searchConditions
:
this
.
search
,
pageSizeOpts
:
[
20
,
50
,
100
],
tableHeight
:
0
,
firstY
:
0
,
config
:
false
,
logs
:
[],
logs
:
[],
trs
:
[],
// 处理后数据数组
trs
:
[],
// 处理后数据数组
c
loneColumns
:
[],
// 处理后的表头数据
c
olumnsCur
:
[],
// 处理后的表头数据
checkGroup
:
[],
// 复选框数组
checkGroup
:
[],
// 复选框数组
checks
:
false
,
// 全选
checks
:
false
,
// 全选
tdsWidth
:
0
,
// td总宽
tdsWidth
:
0
,
// td总宽
...
@@ -234,10 +404,10 @@ export default {
...
@@ -234,10 +404,10 @@ export default {
},
},
computed
:
{
computed
:
{
indeterminate
()
{
indeterminate
()
{
var
checkeds
=
this
.
trs
.
filter
(
u
=>
{
var
checkeds
=
this
.
trs
.
filter
((
u
)
=>
{
return
u
.
_checked
;
return
u
.
_checked
;
}).
length
;
}).
length
;
return
0
<
checkeds
&&
checkeds
<
this
.
trs
.
length
;
return
0
<
checkeds
&&
checkeds
<
this
.
trs
.
length
;
},
},
},
},
watch
:
{
watch
:
{
...
@@ -255,7 +425,7 @@ export default {
...
@@ -255,7 +425,7 @@ export default {
data
(
v
)
{},
data
(
v
)
{},
columns
:
{
columns
:
{
handler
()
{
handler
()
{
this
.
c
loneColumns
=
this
.
makeColumns
();
this
.
c
olumnsCur
=
this
.
makeColumns
();
},
},
deep
:
true
,
deep
:
true
,
},
},
...
@@ -266,7 +436,7 @@ export default {
...
@@ -266,7 +436,7 @@ export default {
mounted
()
{
mounted
()
{
if
(
this
.
items
&&
this
.
items
.
length
>
0
)
{
if
(
this
.
items
&&
this
.
items
.
length
>
0
)
{
this
.
trs
=
this
.
treeToList
(
this
.
items
);
this
.
trs
=
this
.
treeToList
(
this
.
items
);
this
.
c
loneColumns
=
this
.
makeColumns
();
this
.
c
olumnsCur
=
this
.
makeColumns
();
this
.
checkGroup
=
this
.
renderCheck
(
this
.
items
);
this
.
checkGroup
=
this
.
renderCheck
(
this
.
items
);
if
(
this
.
checkGroup
.
length
==
this
.
dataLength
)
{
if
(
this
.
checkGroup
.
length
==
this
.
dataLength
)
{
this
.
checks
=
true
;
this
.
checks
=
true
;
...
@@ -276,6 +446,16 @@ export default {
...
@@ -276,6 +446,16 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
load
()
{},
complexSearch
()
{
var
search
=
this
.
$refs
.
search
.
$children
.
filter
((
u
)
=>
{
return
u
.
condition
;
});
if
(
search
)
{
var
conditions
=
search
[
0
].
condition
;
this
.
reload
(
conditions
);
}
},
slots
()
{
slots
()
{
return
this
.
$scopedSlots
;
return
this
.
$scopedSlots
;
},
},
...
@@ -349,16 +529,16 @@ export default {
...
@@ -349,16 +529,16 @@ export default {
},
},
// 排序事件
// 排序事件
handleSort
(
index
,
type
)
{
handleSort
(
index
,
type
)
{
this
.
c
loneColumns
.
forEach
((
col
)
=>
(
col
.
_sortType
=
"normal"
));
this
.
c
olumnsCur
.
forEach
((
col
)
=>
(
col
.
_sortType
=
"normal"
));
if
(
this
.
c
loneColumns
[
index
].
_sortType
===
type
)
{
if
(
this
.
c
olumnsCur
[
index
].
_sortType
===
type
)
{
this
.
c
loneColumns
[
index
].
_sortType
=
"normal"
;
this
.
c
olumnsCur
[
index
].
_sortType
=
"normal"
;
}
else
{
}
else
{
this
.
c
loneColumns
[
index
].
_sortType
=
type
;
this
.
c
olumnsCur
[
index
].
_sortType
=
type
;
}
}
this
.
$emit
(
this
.
$emit
(
"on-sort-change"
,
"on-sort-change"
,
this
.
c
loneColumns
[
index
].
key
,
this
.
c
olumnsCur
[
index
].
key
,
this
.
c
loneColumns
[
index
].
_sortType
this
.
c
olumnsCur
[
index
].
_sortType
);
);
},
},
// 点击某一行事件
// 点击某一行事件
...
@@ -448,21 +628,23 @@ export default {
...
@@ -448,21 +628,23 @@ export default {
this
.
$set
(
this
.
trs
[
i
],
"_checked"
,
!
data
.
_checked
);
this
.
$set
(
this
.
trs
[
i
],
"_checked"
,
!
data
.
_checked
);
}
}
});
});
this
.
checkAll
=
this
.
trs
.
length
>
this
.
trs
.
filter
(
u
=>
{
this
.
checkAll
=
this
.
trs
.
length
>
this
.
trs
.
filter
((
u
)
=>
{
return
!
u
.
_checked
;
return
!
u
.
_checked
;
}).
length
}).
length
;
},
},
getChildrens
(
data
)
{
getChildrens
(
data
)
{
var
childrens
=
[];
var
childrens
=
[];
var
that
=
this
;
var
that
=
this
;
getChildren
(
data
);
getChildren
(
data
);
function
getChildren
(
f
)
{
function
getChildren
(
f
)
{
that
.
trs
.
forEach
(
u
=>
{
that
.
trs
.
forEach
(
(
u
)
=>
{
if
(
u
[
that
.
upname
]
==
f
[
that
.
keyname
])
{
if
(
u
[
that
.
upname
]
==
f
[
that
.
keyname
])
{
childrens
.
push
(
u
);
childrens
.
push
(
u
);
getChildren
(
u
);
getChildren
(
u
);
}
}
})
})
;
}
}
return
childrens
;
return
childrens
;
},
},
...
@@ -520,7 +702,7 @@ export default {
...
@@ -520,7 +702,7 @@ export default {
let
copy
=
that
.
$u
.
clone
(
u
);
let
copy
=
that
.
$u
.
clone
(
u
);
copy
.
_count
=
0
;
copy
.
_count
=
0
;
copy
.
_level
=
level
;
copy
.
_level
=
level
;
copy
.
_expanded
=
copy
.
_expanded
||
that
.
level
>
level
;
copy
.
_expanded
=
copy
.
_expanded
||
that
.
level
>
level
;
copy
.
_show
=
true
;
copy
.
_show
=
true
;
copy
.
_indeterminate
=
false
;
copy
.
_indeterminate
=
false
;
copy
.
_checked
=
copy
.
_checked
||
false
;
copy
.
_checked
=
copy
.
_checked
||
false
;
...
@@ -554,6 +736,44 @@ export default {
...
@@ -554,6 +736,44 @@ export default {
});
});
return
arr
;
return
arr
;
},
},
//分页选择
pageChange
(
page
)
{
this
.
search
.
page
=
page
;
this
.
search
.
pageIndex
=
page
;
this
.
load
();
},
pageSizeChange
(
size
)
{
this
.
search
.
pageSize
=
size
;
this
.
search
.
pageIndex
=
1
;
this
.
load
();
},
columnChange
(
item
,
i
)
{
item
.
hide
=
!
item
.
hide
;
this
.
$set
(
this
.
columnsCur
,
item
,
i
);
this
.
saveUserconfig
();
},
selectionChange
(
items
)
{
this
.
$emit
(
"on-selection-change"
,
items
);
this
.
selectItems
=
items
;
this
.
footerToolbar
=
items
.
length
>
0
;
},
onSelect
(
rows
,
row
)
{
this
.
$emit
(
"on-change"
,
rows
,
row
);
},
allChange
(
items
)
{
this
.
$emit
(
"all-change"
,
items
);
},
undoConfig
()
{
//列设置恢复初始化
this
.
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
// this.saveUserconfig();
},
//批量取消
cancelBatch
()
{
this
.
footerToolbar
=
false
;
this
.
$refs
.
table
.
selectAll
(
false
);
},
},
},
};
};
</
script
>
</
script
>
...
@@ -564,9 +784,12 @@ export default {
...
@@ -564,9 +784,12 @@ export default {
@table_line_height: 50px;
@table_line_height: 50px;
@table_hover: #f2f8fe;
@table_hover: #f2f8fe;
@table_border: #accef7;
@table_border: #accef7;
.treeTbale {
.table-content {
overflow: 0 auto;
position: relative;
width: 100% !important;
height: 100%;
display: flex;
flex-direction: column;
.table-tools {
.table-tools {
line-height: 40px;
line-height: 40px;
background: @right-header-bg;
background: @right-header-bg;
...
...
pages/project/plan/index.vue
View file @
2a0cb85a
...
@@ -31,13 +31,15 @@
...
@@ -31,13 +31,15 @@
<DropdownMenu
slot=
"list"
>
<DropdownMenu
slot=
"list"
>
<DropdownItem
name=
"saveTemplate"
>
存为模版
</DropdownItem>
<DropdownItem
name=
"saveTemplate"
>
存为模版
</DropdownItem>
<DropdownItem
name=
"useTemplate"
>
导入模版
</DropdownItem>
<DropdownItem
name=
"useTemplate"
>
导入模版
</DropdownItem>
<DropdownItem
name=
"down"
>
<DropdownItem
name=
"down"
disabled
>
<Icon
<Icon
type=
"md-cloud-download"
type=
"md-cloud-download"
class=
"mr10"
class=
"mr10"
/>
导出Excel
</DropdownItem
/>
导出Excel
</DropdownItem
>
>
<DropdownItem
name=
"importExcel"
<DropdownItem
name=
"importExcel"
disabled
><Icon
><Icon
type=
"md-cloud-upload"
type=
"md-cloud-upload"
class=
"mr10"
class=
"mr10"
...
...
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