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 {
const
list
=
[
{
label
:
'配置(用户)'
,
isShow
:
tru
e
,
isShow
:
fals
e
,
onClick
:
()
=>
{
this
.
userSysSet
(
'1'
)
}
...
...
@@ -177,13 +177,11 @@ export default {
if
(
top
===
self
&&
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
)
return
true
)
{
return
true
}
if
(
top
!==
self
&&
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
)
return
false
)
{
return
false
}
}
},
getIsDev
()
{
...
...
@@ -195,21 +193,18 @@ export default {
systemSysDevDb
===
true
||
systemSysDevDb
===
'1'
||
systemSysDevDb
===
1
)
return
true
)
{
return
true
}
}
else
{
// 这是在本地开发时使用没有user_info时
const
hostname
=
location
.
hostname
if
(
top
===
self
&&
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
)
return
true
)
{
return
true
}
if
(
top
!==
self
&&
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
)
return
false
)
{
return
false
}
}
},
onContextmenu
(
event
)
{
...
...
src/packages/hs-table/src/child.vue
View file @
75e5793a
...
...
@@ -53,7 +53,7 @@
:row-style=
'setRowStyle'
:cell-style=
"setCellStyle"
@
header-click=
"headerClick"
:span-method=
"
s
panMethod"
:span-method=
"
objectS
panMethod"
>
<template
v-for=
'(columnItem,index) in tableColumns'
>
...
...
@@ -507,7 +507,7 @@ export default {
const
list
=
[
{
label
:
'配置(用户)'
,
isShow
:
tru
e
,
isShow
:
fals
e
,
onClick
:
()
=>
{
// this.userSysSet('1')
this
.
userSysTableColumnSet
(
'1'
)
...
...
@@ -578,7 +578,7 @@ export default {
},
// 表格配置
tableConfig
()
{
return
this
.
config
return
this
.
config
||
[]
},
// 表格列
tableColumns
()
{
...
...
@@ -597,8 +597,8 @@ export default {
const
sumKey
=
this
.
tableColumns
.
find
(
item
=>
item
.
summarizing
)
return
!!
tkeys
.
length
||
!!
sumKey
},
span
List
:
function
()
{
return
this
.
deal
WithSpanList
()
span
ArrConfig
:
function
()
{
return
this
.
deal
withMergeCellsConfig
()
}
},
mounted
()
{
...
...
@@ -606,62 +606,66 @@ export default {
this
.
targetDom
=
this
.
$refs
.
boxtable
},
methods
:
{
getSpanArr
(
data
,
key1
,
key2
)
{
const
spanList
=
[]
getSpanArr
(
data
,
spanArrConfig
)
{
spanArrConfig
.
forEach
(
item
=>
{
const
{
calculatedColumns
}
=
item
let
pos
=
0
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
i
===
0
)
{
spanL
ist
.
push
(
1
)
item
.
l
ist
.
push
(
1
)
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
{
// 判断当前元素与上一个元素是否相同
if
(
data
[
i
][
key1
]
===
data
[
i
-
1
][
key1
])
{
spanList
[
pos
]
+=
1
spanList
.
push
(
0
)
const
dataI
=
data
[
i
]
const
dataIi
=
data
[
i
-
1
]
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
{
spanL
ist
.
push
(
1
)
item
.
l
ist
.
push
(
1
)
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
spanList
return
spanArrConfig
},
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
})
{
const
prop
=
column
.
property
const
target
=
this
.
span
List
[
prop
]
if
(
target
&&
target
.
length
)
{
const
_row
=
target
[
rowIndex
]
objectS
panMethod
({
row
,
column
,
rowIndex
,
columnIndex
})
{
const
prop
erty
=
column
.
property
const
target
=
this
.
span
ArrConfig
.
find
(
x
=>
x
.
targetColumnProp
===
property
)
if
(
target
)
{
const
_row
=
target
.
list
[
rowIndex
]
const
_col
=
_row
>
0
?
1
:
0
return
{
rowspan
:
_row
,
...
...
@@ -669,6 +673,7 @@ export default {
}
}
},
getIsAdmin
()
{
const
user_info
=
sessionStorage
[
'user_info'
]
if
(
user_info
)
{
...
...
@@ -681,13 +686,11 @@ export default {
if
(
top
===
self
&&
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
)
return
true
)
{
return
true
}
if
(
top
!==
self
&&
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
)
return
false
)
{
return
false
}
}
},
getIsDev
()
{
...
...
@@ -710,13 +713,11 @@ export default {
if
(
top
===
self
&&
(
hostname
===
'0.0.0.0'
||
hostname
===
'localhost'
)
)
return
true
)
{
return
true
}
if
(
top
!==
self
&&
(
hostname
!==
'0.0.0.0'
||
hostname
!==
'localhost'
)
)
return
false
)
{
return
false
}
}
},
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