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
4eed1e4d
Commit
4eed1e4d
authored
Aug 07, 2024
by
何远江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加结束标识
parent
e24fd8ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
4 deletions
+52
-4
excelConfig.ts
src/constants/excelConfig.ts
+2
-1
SetDataArea.vue
...iews/comment-excel/components/SetDataArea/SetDataArea.vue
+50
-3
No files found.
src/constants/excelConfig.ts
View file @
4eed1e4d
...
...
@@ -84,5 +84,6 @@ export const areaMarksColor = {
attch_title
:
'#e58e26'
,
// 附加区标题
attch_head
:
'#b08968'
,
// 附加区别称
caption
:
'#bc5090'
,
// 说明
exclude
:
'#ff6361'
// 排除
exclude
:
'#ff6361'
,
// 排除
end
:
'#666'
// 结束
}
src/views/comment-excel/components/SetDataArea/SetDataArea.vue
View file @
4eed1e4d
...
...
@@ -115,6 +115,38 @@
</
template
>
</vxe-column>
</vxe-table>
<p
class=
"table-title mt-2"
>
结束标识
</p>
<vxe-table
border
size=
"mini"
max-height=
"200"
:data=
"endArea"
:edit-config=
"{ trigger: 'click', mode: 'cell' }"
:row-config=
"{ isCurrent: true }"
>
<vxe-column
title=
"单元格值"
field=
"title"
:edit-render=
"{}"
>
<
template
#
default=
"{ row }"
>
{{
row
.
title
}}
</
template
>
<
template
#
edit=
"{ row }"
>
<el-input
size=
"small"
v-model=
"row.title"
></el-input>
</
template
>
</vxe-column>
<vxe-column
title=
"单元格"
width=
"90"
>
<
template
#
default=
"{ row }"
>
{{
getRangetxt
(
row
.
row
,
row
.
row
,
row
.
colum
,
row
.
colum
)
}}
</
template
>
</vxe-column>
<vxe-column
title=
"操作"
width=
"50"
>
<
template
#
default=
"{ row, $rowIndex }"
>
<el-link
type=
"danger"
style=
"font-size: 12px"
@
click=
"delCaptionAndExclude(row, $rowIndex, 3)"
>
删除
</el-link
>
</
template
>
</vxe-column>
</vxe-table>
</el-col>
<el-col
style=
"margin-top: 10px"
>
<el-form-item
label-width=
"0"
>
...
...
@@ -122,6 +154,7 @@
<el-button
type=
"primary"
@
click=
"setAreaMark('data')"
>
标记数据区
</el-button>
<el-button
type=
"primary"
@
click=
"setCaptionArea"
>
标记说明区
</el-button>
<el-button
type=
"primary"
@
click=
"setExcludeArea"
>
标记排除区
</el-button>
<el-button
type=
"primary"
@
click=
"setEndArea"
>
标记结束区
</el-button>
<el-button
type=
"success"
@
click=
"nextStep"
>
下一步
</el-button>
</el-button-group>
</el-form-item>
...
...
@@ -199,6 +232,7 @@ const resetFormState = () => {
excludeArea
.
value
=
[]
captionArea
.
value
=
[]
endArea
.
value
=
[]
}
const
setAreaMark
=
(
type
:
'data'
)
=>
{
...
...
@@ -225,6 +259,7 @@ const setAreaMark = (type: 'data') => {
const
captionArea
=
ref
<
Recordable
[]
>
([])
const
excludeArea
=
ref
<
Recordable
[]
>
([])
const
endArea
=
ref
<
Recordable
[]
>
([])
// 设置说明区
const
setCaptionArea
=
()
=>
{
const
cells
=
getRangeCellValue
(
'caption'
)
...
...
@@ -248,12 +283,23 @@ const setExcludeArea = () => {
)
}
const
setEndArea
=
()
=>
{
const
cells
=
getRangeCellValue
(
'end'
)
// 去除重复单元格
endArea
.
value
.
push
(
...
cells
.
filter
(
(
cell
)
=>
endArea
.
value
.
findIndex
((
v
)
=>
v
.
row
==
cell
.
row
&&
v
.
colum
==
cell
.
colum
)
==
-
1
)
)
}
const
delCaptionAndExclude
=
(
row
:
any
,
index
:
number
,
type
=
1
)
=>
{
;(
type
==
1
?
captionArea
:
exclude
Area
).
value
.
splice
(
index
,
1
)
;(
type
==
1
?
captionArea
:
type
==
2
?
excludeArea
:
end
Area
).
value
.
splice
(
index
,
1
)
setRangeBackground
(
row
,
areaMarksColor
[
type
==
1
?
'default'
:
'data'
])
}
// 获取有值的单元格
const
getRangeCellValue
=
(
type
:
'caption'
|
'exclude'
)
=>
{
const
getRangeCellValue
=
(
type
:
'caption'
|
'exclude'
|
'end'
)
=>
{
return
handleRangeCell
(
luckysheet
.
getRangeValue
(),
(
c
:
any
)
=>
{
luckysheet
.
menuButton
.
customUpdateFormat
(
null
,
...
...
@@ -287,7 +333,8 @@ const nextStep = async () => {
emits
(
'next'
,
1
,
{
...
formState
,
excludeTitles
:
unref
(
excludeArea
),
dataTitles
:
unref
(
captionArea
)
dataTitles
:
unref
(
captionArea
),
endTitles
:
unref
(
endArea
)
})
}
...
...
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