Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hs-sky-ui
Project
Project
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
何虹
hs-sky-ui
Commits
75e5793a
Commit
75e5793a
authored
Mar 10, 2021
by
何虹
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表格合并项
parent
15968f71
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
71 deletions
+67
-71
child.vue
src/packages/hs-dync-form/src/child.vue
+6
-11
child.vue
src/packages/hs-table/src/child.vue
+61
-60
No files found.
src/packages/hs-dync-form/src/child.vue
View file @
75e5793a
...
@@ -108,7 +108,7 @@ export default {
...
@@ -108,7 +108,7 @@ export default {
const
list
=
[
const
list
=
[
{
{
label
:
'配置(用户)'
,
label
:
'配置(用户)'
,
isShow
:
tru
e
,
isShow
:
fals
e
,
onClick
:
()
=>
{
onClick
:
()
=>
{
this
.
userSysSet
(
'1'
)
this
.
userSysSet
(
'1'
)
}
}
...
@@ -177,13 +177,11 @@ export default {
...
@@ -177,13 +177,11 @@ export default {
if
(
if
(
top
===
self
&&
top
===
self
&&
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
)
)
{
return
true
}
return
true
if
(
if
(
top
!==
self
&&
top
!==
self
&&
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
)
)
{
return
false
}
return
false
}
}
},
},
getIsDev
()
{
getIsDev
()
{
...
@@ -195,21 +193,18 @@ export default {
...
@@ -195,21 +193,18 @@ export default {
systemSysDevDb
===
true
||
systemSysDevDb
===
true
||
systemSysDevDb
===
'1'
||
systemSysDevDb
===
'1'
||
systemSysDevDb
===
1
systemSysDevDb
===
1
)
)
{
return
true
}
return
true
}
else
{
}
else
{
// 这是在本地开发时使用没有user_info时
// 这是在本地开发时使用没有user_info时
const
hostname
=
location
.
hostname
const
hostname
=
location
.
hostname
if
(
if
(
top
===
self
&&
top
===
self
&&
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
)
)
{
return
true
}
return
true
if
(
if
(
top
!==
self
&&
top
!==
self
&&
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
)
)
{
return
false
}
return
false
}
}
},
},
onContextmenu
(
event
)
{
onContextmenu
(
event
)
{
...
...
src/packages/hs-table/src/child.vue
View file @
75e5793a
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
:row-style=
'setRowStyle'
:row-style=
'setRowStyle'
:cell-style=
"setCellStyle"
:cell-style=
"setCellStyle"
@
header-click=
"headerClick"
@
header-click=
"headerClick"
:span-method=
"
s
panMethod"
:span-method=
"
objectS
panMethod"
>
>
<template
v-for=
'(columnItem,index) in tableColumns'
>
<template
v-for=
'(columnItem,index) in tableColumns'
>
...
@@ -507,7 +507,7 @@ export default {
...
@@ -507,7 +507,7 @@ export default {
const
list
=
[
const
list
=
[
{
{
label
:
'配置(用户)'
,
label
:
'配置(用户)'
,
isShow
:
tru
e
,
isShow
:
fals
e
,
onClick
:
()
=>
{
onClick
:
()
=>
{
// this.userSysSet('1')
// this.userSysSet('1')
this
.
userSysTableColumnSet
(
'1'
)
this
.
userSysTableColumnSet
(
'1'
)
...
@@ -578,7 +578,7 @@ export default {
...
@@ -578,7 +578,7 @@ export default {
},
},
// 表格配置
// 表格配置
tableConfig
()
{
tableConfig
()
{
return
this
.
config
return
this
.
config
||
[]
},
},
// 表格列
// 表格列
tableColumns
()
{
tableColumns
()
{
...
@@ -597,8 +597,8 @@ export default {
...
@@ -597,8 +597,8 @@ export default {
const
sumKey
=
this
.
tableColumns
.
find
(
item
=>
item
.
summarizing
)
const
sumKey
=
this
.
tableColumns
.
find
(
item
=>
item
.
summarizing
)
return
!!
tkeys
.
length
||
!!
sumKey
return
!!
tkeys
.
length
||
!!
sumKey
},
},
span
List
:
function
()
{
span
ArrConfig
:
function
()
{
return
this
.
deal
WithSpanList
()
return
this
.
deal
withMergeCellsConfig
()
}
}
},
},
mounted
()
{
mounted
()
{
...
@@ -606,62 +606,66 @@ export default {
...
@@ -606,62 +606,66 @@ export default {
this
.
targetDom
=
this
.
$refs
.
boxtable
this
.
targetDom
=
this
.
$refs
.
boxtable
},
},
methods
:
{
methods
:
{
getSpanArr
(
data
,
key1
,
key2
)
{
getSpanArr
(
data
,
spanArrConfig
)
{
const
spanList
=
[]
spanArrConfig
.
forEach
(
item
=>
{
const
{
calculatedColumns
}
=
item
let
pos
=
0
let
pos
=
0
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
i
===
0
)
{
if
(
i
===
0
)
{
spanL
ist
.
push
(
1
)
item
.
l
ist
.
push
(
1
)
pos
=
0
pos
=
0
}
else
{
if
(
key2
)
{
if
(
data
[
i
][
key2
]
===
data
[
i
-
1
][
key2
]
&&
data
[
i
][
key1
]
===
data
[
i
-
1
][
key1
]
)
{
spanList
[
pos
]
+=
1
spanList
.
push
(
0
)
}
else
{
spanList
.
push
(
1
)
pos
=
i
}
}
else
{
}
else
{
// 判断当前元素与上一个元素是否相同
// 判断当前元素与上一个元素是否相同
if
(
data
[
i
][
key1
]
===
data
[
i
-
1
][
key1
])
{
const
dataI
=
data
[
i
]
spanList
[
pos
]
+=
1
const
dataIi
=
data
[
i
-
1
]
spanList
.
push
(
0
)
let
sumObjdataI
=
''
let
sumObjdataIi
=
''
calculatedColumns
.
forEach
(
k
=>
{
sumObjdataI
+=
dataI
[
k
]
sumObjdataIi
+=
dataIi
[
k
]
})
if
(
sumObjdataI
===
sumObjdataIi
)
{
item
.
list
[
pos
]
+=
1
item
.
list
.
push
(
0
)
}
else
{
}
else
{
spanL
ist
.
push
(
1
)
item
.
l
ist
.
push
(
1
)
pos
=
i
pos
=
i
}
}
}
}
}
}
}
return
spanList
},
dealWithSpanList
()
{
const
spanList
=
{}
const
tableData
=
_
.
cloneDeep
(
this
.
tableDat
||
[])
const
config
=
_
.
cloneDeep
(
this
.
tableConfig
||
{})
if
(
config
.
spanCol
)
{
let
spanCol
=
config
.
spanCol
spanCol
.
forEach
(
key
=>
{
if
(
key
.
indexOf
(
'^'
)
>
-
1
)
{
const
key1
=
key
.
split
(
'^'
)[
0
]
const
key2
=
key
.
split
(
'^'
)[
1
]
spanList
[
key1
]
=
this
.
getSpanArr
(
tableData
,
key1
,
key2
)
}
else
{
spanList
[
key
]
=
this
.
getSpanArr
(
tableData
,
key
)
}
})
})
}
return
spanArrConfig
return
spanList
},
dealwithMergeCellsConfig
()
{
const
SpanArrConfig
=
this
.
tableConfig
.
mergeCellsConfig
||
[]
const
list
=
this
.
transSpanArrConfig
(
SpanArrConfig
)
return
this
.
getSpanArr
(
this
.
tableData
,
list
)
},
transSpanArrConfig
(
SpanArrConfig
)
{
const
list
=
[]
SpanArrConfig
.
forEach
(
item
=>
{
const
[
item0
,
item1
]
=
item
.
split
(
'='
)
const
targetPropList
=
item0
.
split
(
','
)
targetPropList
.
forEach
(
targetProp
=>
{
const
item1_
=
item1
||
item0
const
targetcalculatedList
=
item1_
.
split
(
'+'
)
if
(
!
targetcalculatedList
.
includes
(
targetProp
))
{
targetcalculatedList
.
push
(
targetProp
)
}
list
.
push
({
list
:
[],
targetColumnProp
:
targetProp
,
// 目标列
calculatedColumns
:
targetcalculatedList
// 要计算的列
})
})
})
return
list
},
},
s
panMethod
({
row
,
column
,
rowIndex
,
columnIndex
})
{
objectS
panMethod
({
row
,
column
,
rowIndex
,
columnIndex
})
{
const
prop
=
column
.
property
const
prop
erty
=
column
.
property
const
target
=
this
.
span
List
[
prop
]
const
target
=
this
.
span
ArrConfig
.
find
(
x
=>
x
.
targetColumnProp
===
property
)
if
(
target
&&
target
.
length
)
{
if
(
target
)
{
const
_row
=
target
[
rowIndex
]
const
_row
=
target
.
list
[
rowIndex
]
const
_col
=
_row
>
0
?
1
:
0
const
_col
=
_row
>
0
?
1
:
0
return
{
return
{
rowspan
:
_row
,
rowspan
:
_row
,
...
@@ -669,6 +673,7 @@ export default {
...
@@ -669,6 +673,7 @@ export default {
}
}
}
}
},
},
getIsAdmin
()
{
getIsAdmin
()
{
const
user_info
=
sessionStorage
[
'user_info'
]
const
user_info
=
sessionStorage
[
'user_info'
]
if
(
user_info
)
{
if
(
user_info
)
{
...
@@ -681,13 +686,11 @@ export default {
...
@@ -681,13 +686,11 @@ export default {
if
(
if
(
top
===
self
&&
top
===
self
&&
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
)
)
{
return
true
}
return
true
if
(
if
(
top
!==
self
&&
top
!==
self
&&
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
)
)
{
return
false
}
return
false
}
}
},
},
getIsDev
()
{
getIsDev
()
{
...
@@ -710,13 +713,11 @@ export default {
...
@@ -710,13 +713,11 @@ export default {
if
(
if
(
top
===
self
&&
top
===
self
&&
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
)
)
{
return
true
}
return
true
if
(
if
(
top
!==
self
&&
top
!==
self
&&
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
)
)
{
return
false
}
return
false
}
}
},
},
onContextmenu
(
event
)
{
onContextmenu
(
event
)
{
...
...
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