Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
supply-web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ea7c4daa
authored
Sep 09, 2020
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v0.0.1' of 192.168.3.233:glsx-business/supply-web into v0.0.1
2 parents
a4b775df
277b4b19
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
39 deletions
src/components/d2-drop-table/index.vue
src/views/consumerManage/index.vue
src/components/d2-drop-table/index.vue
View file @
ea7c4da
<!-- 拖拽表格 -->
<!-- 拖拽表格 -->
<
template
>
<
template
>
<div>
<div>
<!--
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSave"
>
保存
</el-button>
-->
<!--
<el-button
size=
"small"
@
click=
"handleReset"
>
恢复
</el-button>
-->
<div
class=
"table"
>
<div
class=
"table"
>
<el-table
<el-table
v-loading=
"tableLoading"
v-loading=
"tableLoading"
...
@@ -22,27 +13,28 @@
...
@@ -22,27 +13,28 @@
border
border
v-if=
"tableParams.dropCol.length"
v-if=
"tableParams.dropCol.length"
>
>
<
!--
<
el-table-column
<el-table-column
v-if=
"hasNum"
v-if=
"hasNum"
key=
"col_0"
type=
"index"
type=
"index"
:index=
"index => index+(page.page
Size - 1) * page.pageNum
+ 1"
:index=
"index => index+(page.page
Num - 1) * page.pageSize
+ 1"
label=
"序号"
label=
"序号"
width=
"80"
width=
"80"
class-name=
"noDrop"
class-name=
"noDrop"
/>
-->
/>
<el-table-column
<el-table-column
v-for=
"(item, index) in tableParams.tableColumns"
v-for=
"(item, index) in tableParams.tableColumns"
:key=
"`col_` + index"
:key=
"`col_` + index"
:prop=
"tableParams.dropCol[index].prop"
:prop=
"tableParams.dropCol[index].prop"
:label=
"tableParams.tableHead[index]"
:label=
"tableParams.tableHead[index]"
:class-name=
"
item
.className"
:class-name=
"
tableParams.dropCol[index]
.className"
>
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<template
v-if=
"tableParams.dropCol[index].formatter"
>
<template
v-if=
"tableParams.dropCol[index].formatter"
>
<span
v-text=
"tableParams.dropCol[index].formatter(scope.row)"
></span>
<span
v-text=
"tableParams.dropCol[index].formatter(scope.row)"
></span>
</
template
>
</
template
>
<
template
v-else
>
<
template
v-else
>
<
p>
{{
data
[
scope
.
$index
][
tableParams
.
dropCol
[
index
].
prop
]
}}
</p
>
<
span>
{{
data
[
scope
.
$index
][
tableParams
.
dropCol
[
index
].
prop
]
}}
</span
>
</
template
>
</
template
>
</template>
</template>
</el-table-column>
</el-table-column>
...
@@ -58,7 +50,7 @@
...
@@ -58,7 +50,7 @@
<el-button
<el-button
v-for=
"(item, index) in tableParams.tableOption.option"
v-for=
"(item, index) in tableParams.tableOption.option"
:key=
"index"
:key=
"index"
type=
"text
"
size=
"mini
"
@
click=
"item.handleClick(scope.row)"
@
click=
"item.handleClick(scope.row)"
>
{{
item
.
label
}}
</el-button>
>
{{
item
.
label
}}
</el-button>
</
template
>
</
template
>
...
@@ -66,19 +58,31 @@
...
@@ -66,19 +58,31 @@
</transition>
</transition>
</el-table>
</el-table>
<div>
<div>
<el-button
<el-tooltip
class=
"refresh-btn"
effect=
"dark"
size=
"mini"
content=
"重置表头顺序"
icon=
"el-icon-refresh-left"
placement=
"right"
></el-button>
>
<el-button
class=
"refresh-btn"
type=
"text"
size=
"medium"
icon=
"el-icon-refresh-left"
@
click=
"handleReset"
></el-button>
</el-tooltip>
<el-button
<el-button
type=
"primary"
type=
"primary"
class=
"opt-btn"
class=
"opt-btn"
size=
"mini"
size=
"mini"
style=
"margin-left: 0;"
@
click=
"handleOptShow"
@
click=
"handleOptShow"
>
{{isShowOption ? '收起' : '展开'}}
</el-button>
>
{{isShowOption ? '收起' : '展开'}}
</el-button>
</div>
</div>
</div>
</div>
<!-- <pre>
{{tableParams.dropCol}}
</pre> -->
<el-pagination
<el-pagination
v-if=
"hasPage"
v-if=
"hasPage"
small
small
...
@@ -187,11 +191,6 @@ export default {
...
@@ -187,11 +191,6 @@ export default {
},
},
mounted
()
{
mounted
()
{
// if (this.hasNum) {
// this.tableParams.tableColumns.unshift({
// label: '序号'
// })
// }
document
.
body
.
ondrop
=
function
(
event
)
{
document
.
body
.
ondrop
=
function
(
event
)
{
event
.
preventDefault
()
event
.
preventDefault
()
event
.
stopPropagation
()
event
.
stopPropagation
()
...
@@ -215,7 +214,6 @@ export default {
...
@@ -215,7 +214,6 @@ export default {
handleSave
()
{
handleSave
()
{
console
.
log
(
'保存--'
)
console
.
log
(
'保存--'
)
// console.log(this.tableParams.dropCol)
// console.log(this.tableParams.dropCol)
clearTimeout
(
this
.
timer
)
this
.
saveTableCol
({
this
.
saveTableCol
({
tableName
:
'database'
,
tableName
:
'database'
,
path
:
'tableCol.'
+
this
.
tableParams
.
tableId
,
path
:
'tableCol.'
+
this
.
tableParams
.
tableId
,
...
@@ -226,11 +224,12 @@ export default {
...
@@ -226,11 +224,12 @@ export default {
// 列拖拽
// 列拖拽
columnDrop
()
{
columnDrop
()
{
const
wrapperTr
=
document
.
querySelector
(
'.el-table__header-wrapper tr'
)
const
wrapperTr
=
document
.
querySelector
(
'.el-table__header-wrapper tr'
)
console
.
log
(
wrapperTr
)
// this.hasNum && (wrapperTr.shift())
// console.log(wrapperTr)
this
.
sortable
=
Sortable
.
create
(
wrapperTr
,
{
this
.
sortable
=
Sortable
.
create
(
wrapperTr
,
{
animation
:
180
,
animation
:
180
,
delay
:
0
,
delay
:
0
,
//
filter: '.noDrop',
filter
:
'.noDrop'
,
dragClass
:
'drop-col'
,
dragClass
:
'drop-col'
,
chosenClass
:
'drop-col'
,
chosenClass
:
'drop-col'
,
onStart
:
evt
=>
{
onStart
:
evt
=>
{
...
@@ -238,14 +237,19 @@ export default {
...
@@ -238,14 +237,19 @@ export default {
clearTimeout
(
this
.
timer
)
clearTimeout
(
this
.
timer
)
},
},
onEnd
:
evt
=>
{
onEnd
:
evt
=>
{
// console.log(evt)
if
(
this
.
hasNum
&&
evt
.
newIndex
===
0
)
{
const
oldItem
=
this
.
tableParams
.
dropCol
[
evt
.
oldIndex
]
this
.
handleGet
()
this
.
tableParams
.
dropCol
.
splice
(
evt
.
oldIndex
,
1
)
}
else
{
this
.
tableParams
.
dropCol
.
splice
(
evt
.
newIndex
,
0
,
oldItem
)
var
oldIndex
=
this
.
hasNum
?
(
evt
.
oldIndex
-
1
)
:
evt
.
oldIndex
this
.
isMove
=
false
var
newIndex
=
this
.
hasNum
?
(
evt
.
newIndex
-
1
)
:
evt
.
newIndex
this
.
timer
=
setTimeout
(()
=>
{
const
oldItem
=
this
.
tableParams
.
dropCol
[
oldIndex
]
(
!
this
.
isMove
)
&&
this
.
handleSave
()
this
.
tableParams
.
dropCol
.
splice
(
oldIndex
,
1
)
},
1000
)
this
.
tableParams
.
dropCol
.
splice
(
newIndex
,
0
,
oldItem
)
this
.
isMove
=
false
this
.
timer
=
setTimeout
(()
=>
{
(
!
this
.
isMove
)
&&
this
.
handleSave
()
},
400
)
}
}
}
})
})
},
},
...
@@ -258,7 +262,7 @@ export default {
...
@@ -258,7 +262,7 @@ export default {
}).
then
(
res
=>
{
}).
then
(
res
=>
{
console
.
log
(
res
)
console
.
log
(
res
)
this
.
tableParams
.
tableHead
=
[]
this
.
tableParams
.
tableHead
=
[]
if
(
res
&&
!
isReset
)
{
if
(
res
&&
(
res
.
length
===
this
.
tableParams
.
tableColumns
.
length
)
&&
!
isReset
)
{
res
.
forEach
((
item
,
index
)
=>
{
res
.
forEach
((
item
,
index
)
=>
{
var
currItem
=
this
.
tableParams
.
tableColumns
.
find
(
i
=>
i
.
prop
===
item
)
var
currItem
=
this
.
tableParams
.
tableColumns
.
find
(
i
=>
i
.
prop
===
item
)
this
.
tableParams
.
dropCol
.
push
(
currItem
)
this
.
tableParams
.
dropCol
.
push
(
currItem
)
...
@@ -329,6 +333,8 @@ export default {
...
@@ -329,6 +333,8 @@ export default {
align-items
:
center
;
align-items
:
center
;
}
}
.refresh-btn
{
.refresh-btn
{
display
:
block
;
padding
:
0
0
;
}
}
.opt-btn
{
.opt-btn
{
width
:
20px
;
width
:
20px
;
...
...
src/views/consumerManage/index.vue
View file @
ea7c4da
...
@@ -176,8 +176,8 @@ export default {
...
@@ -176,8 +176,8 @@ export default {
dropCol
:
[],
dropCol
:
[],
tableColumns
:
[{
tableColumns
:
[{
label
:
'用户名'
,
label
:
'用户名'
,
prop
:
'userName'
,
prop
:
'userName'
className
:
'noDrop'
//
className: 'noDrop'
},
{
},
{
label
:
'角色'
,
label
:
'角色'
,
prop
:
'role'
,
prop
:
'role'
,
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment