Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-baoshen-excel
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
何远江
topsun-baoshen-excel
Commits
78cd7861
Commit
78cd7861
authored
May 30, 2024
by
何远江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化排除区和说明区域
parent
56ef9dd2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
41 deletions
+33
-41
excel.ts
src/utils/excel.ts
+2
-1
EditArea.vue
src/views/comment-excel/components/EditArea/EditArea.vue
+3
-3
SetDataArea.vue
...iews/comment-excel/components/SetDataArea/SetDataArea.vue
+28
-37
No files found.
src/utils/excel.ts
View file @
78cd7861
...
@@ -114,7 +114,7 @@ export function handleRangeTitle(range: any) {
...
@@ -114,7 +114,7 @@ export function handleRangeTitle(range: any) {
return
titles
return
titles
}
}
export
function
handleRangeCell
(
range
:
any
)
{
export
function
handleRangeCell
(
range
:
any
,
cb
?:
any
)
{
console
.
log
(
luckysheet
.
getRangeValue
(),
'range-----'
)
console
.
log
(
luckysheet
.
getRangeValue
(),
'range-----'
)
// return
// return
const
{
beginRow
,
beginColum
,
endRow
,
sheetNum
,
endColum
,
columnLen
,
rowLen
}
=
const
{
beginRow
,
beginColum
,
endRow
,
sheetNum
,
endColum
,
columnLen
,
rowLen
}
=
...
@@ -151,6 +151,7 @@ export function handleRangeCell(range: any) {
...
@@ -151,6 +151,7 @@ export function handleRangeCell(range: any) {
})
})
}
}
titles
.
push
(
t
)
titles
.
push
(
t
)
cb
&&
cb
(
t
)
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
r
,
c
,
t
,
e
,
cell
,
'error'
)
console
.
log
(
r
,
c
,
t
,
e
,
cell
,
'error'
)
}
}
...
...
src/views/comment-excel/components/EditArea/EditArea.vue
View file @
78cd7861
...
@@ -41,12 +41,12 @@
...
@@ -41,12 +41,12 @@
</el-form>
</el-form>
<el-row
:gutter=
"24"
style=
"margin-bottom: 12px"
>
<el-row
:gutter=
"24"
style=
"margin-bottom: 12px"
>
<el-col
:span=
"12"
style=
"margin-bottom: 12px"
>
<el-col
:span=
"12"
style=
"margin-bottom: 12px"
>
<!-- exclude
Area
-->
<!-- exclude
Titles
-->
<p
class=
"table-des"
>
排除区:
</p>
<p
class=
"table-des"
>
排除区:
</p>
<vxe-table
<vxe-table
:row-config=
"{ isCurrent: true }"
:row-config=
"{ isCurrent: true }"
border
border
:data=
"currentForm.exclude
Area
"
:data=
"currentForm.exclude
Titles
"
size=
"mini"
size=
"mini"
max-height=
"200"
max-height=
"200"
:edit-config=
"{ trigger: 'click', mode: 'cell' }"
:edit-config=
"{ trigger: 'click', mode: 'cell' }"
...
@@ -306,7 +306,7 @@ const delAreaTitle = (index: number) => {
...
@@ -306,7 +306,7 @@ const delAreaTitle = (index: number) => {
const
delCaptionAndExclude
=
(
row
:
any
,
index
:
number
,
type
:
number
)
=>
{
const
delCaptionAndExclude
=
(
row
:
any
,
index
:
number
,
type
:
number
)
=>
{
delCapAndExc
.
value
.
push
({
...
row
,
type
})
delCapAndExc
.
value
.
push
({
...
row
,
type
})
// 删除本行
// 删除本行
;(
type
==
1
?
currentForm
.
dataTitles
:
currentForm
.
exclude
Area
).
splice
(
index
,
1
)
;(
type
==
1
?
currentForm
.
dataTitles
:
currentForm
.
exclude
Titles
).
splice
(
index
,
1
)
}
}
const
delGroupAreaTitle
=
(
index
:
number
)
=>
{
const
delGroupAreaTitle
=
(
index
:
number
)
=>
{
attchInfo
.
areaTitles
.
splice
(
index
,
1
)
attchInfo
.
areaTitles
.
splice
(
index
,
1
)
...
...
src/views/comment-excel/components/SetDataArea/SetDataArea.vue
View file @
78cd7861
...
@@ -134,7 +134,7 @@
...
@@ -134,7 +134,7 @@
import
{
apiDictList
}
from
'@/api/common'
import
{
apiDictList
}
from
'@/api/common'
import
{
areaMarksColor
}
from
'@/constants/excelConfig'
import
{
areaMarksColor
}
from
'@/constants/excelConfig'
import
type
{
Recordable
}
from
'@/types/global'
import
type
{
Recordable
}
from
'@/types/global'
import
{
getRangePosition
,
getRangetxt
,
setRangeBackground
}
from
'@/utils/excel'
import
{
getRangePosition
,
getRangetxt
,
handleRangeCell
,
setRangeBackground
}
from
'@/utils/excel'
import
{
ElMessage
,
type
FormInstance
}
from
'element-plus'
import
{
ElMessage
,
type
FormInstance
}
from
'element-plus'
import
{
onMounted
,
reactive
,
ref
,
unref
,
watch
}
from
'vue'
import
{
onMounted
,
reactive
,
ref
,
unref
,
watch
}
from
'vue'
...
@@ -227,11 +227,25 @@ const captionArea = ref<Recordable[]>([])
...
@@ -227,11 +227,25 @@ const captionArea = ref<Recordable[]>([])
const
excludeArea
=
ref
<
Recordable
[]
>
([])
const
excludeArea
=
ref
<
Recordable
[]
>
([])
// 设置说明区
// 设置说明区
const
setCaptionArea
=
()
=>
{
const
setCaptionArea
=
()
=>
{
captionArea
.
value
=
getRangeCellValue
(
'caption'
)
const
cells
=
getRangeCellValue
(
'caption'
)
// 去除重复单元格
captionArea
.
value
.
push
(
...
cells
.
filter
(
(
cell
)
=>
captionArea
.
value
.
findIndex
((
v
)
=>
v
.
row
==
cell
.
row
&&
v
.
colum
==
cell
.
colum
)
==
-
1
)
)
}
}
// 设置排除区
// 设置排除区
const
setExcludeArea
=
()
=>
{
const
setExcludeArea
=
()
=>
{
excludeArea
.
value
=
getRangeCellValue
(
'exclude'
)
const
cells
=
getRangeCellValue
(
'exclude'
)
// 去除重复单元格
excludeArea
.
value
.
push
(
...
cells
.
filter
(
(
cell
)
=>
excludeArea
.
value
.
findIndex
((
v
)
=>
v
.
row
==
cell
.
row
&&
v
.
colum
==
cell
.
colum
)
==
-
1
)
)
}
}
const
delCaptionAndExclude
=
(
row
:
any
,
index
:
number
,
type
=
1
)
=>
{
const
delCaptionAndExclude
=
(
row
:
any
,
index
:
number
,
type
=
1
)
=>
{
...
@@ -240,41 +254,18 @@ const delCaptionAndExclude = (row: any, index: number, type = 1) => {
...
@@ -240,41 +254,18 @@ const delCaptionAndExclude = (row: any, index: number, type = 1) => {
}
}
// 获取有值的单元格
// 获取有值的单元格
const
getRangeCellValue
=
(
type
:
'caption'
|
'exclude'
)
=>
{
const
getRangeCellValue
=
(
type
:
'caption'
|
'exclude'
)
=>
{
const
position
=
getRangePosition
()
return
handleRangeCell
(
luckysheet
.
getRangeValue
(),
(
c
:
any
)
=>
{
const
sheet
=
luckysheet
.
getSheet
()
luckysheet
.
menuButton
.
customUpdateFormat
(
const
rangeValue
=
luckysheet
.
getRangeValue
()
null
,
const
cells
:
any
=
[]
'bg'
,
rangeValue
.
forEach
((
row
:
any
,
r
:
number
)
=>
{
areaMarksColor
[
type
],
row
.
forEach
((
cell
:
any
,
c
:
number
)
=>
{
c
.
row
,
const
p
=
{
c
.
row
,
r
:
position
?.
beginRow
+
r
,
c
.
colum
,
c
:
position
?.
beginColum
+
c
c
.
colum
,
}
false
let
v
=
''
)
try
{
v
=
cell
.
v
||
cell
?.
ct
?.
s
.
map
((
itm
)
=>
itm
.
v
).
join
(
''
)
if
(
v
)
{
cells
.
push
({
title
:
v
,
row
:
p
.
r
,
colum
:
p
.
c
,
sheet
:
sheet
.
order
})
luckysheet
.
menuButton
.
customUpdateFormat
(
null
,
'bg'
,
areaMarksColor
[
type
],
p
.
r
,
p
.
r
,
p
.
c
,
p
.
c
,
false
)
}
}
catch
{}
})
})
})
return
cells
}
}
const
queryDict
=
async
(
code
:
string
)
=>
{
const
queryDict
=
async
(
code
:
string
)
=>
{
...
...
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