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
e27ac904
Commit
e27ac904
authored
Jul 04, 2025
by
何远江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
8536692f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
88 deletions
+102
-88
ExcelOperate.vue
...ws/comment-excel/components/ExcelOperate/ExcelOperate.vue
+102
-88
No files found.
src/views/comment-excel/components/ExcelOperate/ExcelOperate.vue
View file @
e27ac904
...
@@ -57,8 +57,12 @@
...
@@ -57,8 +57,12 @@
<p
class=
"font-bold"
>
区域关联信息
</p>
<p
class=
"font-bold"
>
区域关联信息
</p>
<vxe-table
border
:data=
"connectList"
size=
"mini"
height=
"200"
>
<vxe-table
border
:data=
"connectList"
size=
"mini"
height=
"200"
>
<vxe-column
title=
"关联名称"
field=
"excelAreaId_dictText"
min-width=
"100"
></vxe-column>
<vxe-column
title=
"关联名称"
field=
"excelAreaId_dictText"
min-width=
"100"
></vxe-column>
<vxe-column
title=
"别关联名称"
field=
"excelAreaBeId_dictText"
min-width=
"100"
></vxe-column>
<vxe-column
<vxe-column
title=
"关联字段"
min-width=
"100"
>
title=
"别关联名称"
field=
"excelAreaBeId_dictText"
min-width=
"100"
></vxe-column>
<vxe-column
title=
"关联字段"
min-width=
"100"
>
<
template
#
default=
"{ row, $rowIndex }"
>
<
template
#
default=
"{ row, $rowIndex }"
>
{{
connectFiledStr
(
row
.
connectFiled
)
}}
{{
connectFiledStr
(
row
.
connectFiled
)
}}
</
template
>
</
template
>
...
@@ -73,7 +77,7 @@
...
@@ -73,7 +77,7 @@
<el-link
style=
"font-size: 12px"
type=
"primary"
@
click=
"editConnect(row, $rowIndex)"
<el-link
style=
"font-size: 12px"
type=
"primary"
@
click=
"editConnect(row, $rowIndex)"
>
修改
</el-link
>
修改
</el-link
>
>
<el-divider
direction=
"vertical"
></el-divider>
<el-divider
direction=
"vertical"
></el-divider>
<el-link
style=
"font-size: 12px"
type=
"danger"
@
click=
"delConnect(row, $rowIndex)"
<el-link
style=
"font-size: 12px"
type=
"danger"
@
click=
"delConnect(row, $rowIndex)"
>
删除
</el-link
>
删除
</el-link
>
>
...
@@ -109,11 +113,7 @@
...
@@ -109,11 +113,7 @@
<el-button
type=
"primary"
size=
"small"
@
click=
"toRun"
>
执行解析
</el-button>
<el-button
type=
"primary"
size=
"small"
@
click=
"toRun"
>
执行解析
</el-button>
<el-button
type=
"primary"
size=
"small"
@
click=
"copy"
>
复制
</el-button>
<el-button
type=
"primary"
size=
"small"
@
click=
"copy"
>
复制
</el-button>
<el-button
<el-button
:loading=
"pasteLoading"
type=
"primary"
size=
"small"
@
click=
"pasteConfig"
:loading=
"pasteLoading"
type=
"primary"
size=
"small"
@
click=
"pasteConfig"
>
引入
</el-button
>
引入
</el-button
>
>
</div>
</div>
...
@@ -150,7 +150,13 @@
...
@@ -150,7 +150,13 @@
</
template
>
</
template
>
</vxe-modal>
</vxe-modal>
<vxe-modal
v-model=
"connectVisible"
width=
"1000"
title=
"关联信息配置"
show-footer
>
<vxe-modal
v-model=
"connectVisible"
width=
"1000"
@
hide=
"onHideSettingConnect"
title=
"关联信息配置"
show-footer
>
<p>
关联区域信息:{{ currentConnectInfo.excelAreaNicname }}
</p>
<p>
关联区域信息:{{ currentConnectInfo.excelAreaNicname }}
</p>
<p>
被关联信息:{{ cachCurrentBeConnectInfo.excelAreaNicname }}
</p>
<p>
被关联信息:{{ cachCurrentBeConnectInfo.excelAreaNicname }}
</p>
...
@@ -164,16 +170,16 @@
...
@@ -164,16 +170,16 @@
>
>
<vxe-column
type=
"checkbox"
width=
"40"
></vxe-column>
<vxe-column
type=
"checkbox"
width=
"40"
></vxe-column>
<vxe-column
title=
"关联title"
field=
"title"
></vxe-column>
<vxe-column
title=
"关联title"
field=
"title"
></vxe-column>
<vxe-column
title=
"关联脚本"
width
=
"300px"
>
<vxe-column
title=
"关联脚本"
width
=
"300px"
>
<
template
#
default=
"{ row }"
>
<
template
#
default=
"{ row }"
>
<el-select
<el-select
size=
"small"
size=
"small"
style=
"width: 100%
;
"
style=
"width: 100%"
v-model=
"row.scriptName"
v-model=
"row.scriptName"
@
change=
"(e) => scriptChange(row, e)"
@
change=
"(e) => scriptChange(row, e)"
clearable
clearable
>
>
<el-option
<el-option
v-for=
"item in scriptList"
v-for=
"item in scriptList"
:key=
"item.srciptName"
:key=
"item.srciptName"
:value=
"item.srciptName"
:value=
"item.srciptName"
...
@@ -182,7 +188,7 @@
...
@@ -182,7 +188,7 @@
</el-select>
</el-select>
<el-input
<el-input
type=
"textarea"
type=
"textarea"
style=
"width: 100%;
margin-top: 2px;
"
style=
"width: 100%;
margin-top: 2px
"
rows=
"5"
rows=
"5"
v-model=
"row.script"
v-model=
"row.script"
></el-input>
></el-input>
...
@@ -199,16 +205,16 @@
...
@@ -199,16 +205,16 @@
</template>
</template>
</vxe-column>
</vxe-column>
<vxe-column
title=
"被关联脚本"
width
=
"300px"
>
<vxe-column
title=
"被关联脚本"
width
=
"300px"
>
<
template
#
default=
"{ row }"
>
<
template
#
default=
"{ row }"
>
<el-select
<el-select
size=
"small"
size=
"small"
style=
"width: 100%
;
"
style=
"width: 100%"
v-model=
"row.bescriptName"
v-model=
"row.bescriptName"
@
change=
"(e) => scriptBeChange(row, e)"
@
change=
"(e) => scriptBeChange(row, e)"
clearable
clearable
>
>
<el-option
<el-option
v-for=
"item in scriptList"
v-for=
"item in scriptList"
:key=
"item.srciptName"
:key=
"item.srciptName"
:value=
"item.srciptName"
:value=
"item.srciptName"
...
@@ -217,13 +223,12 @@
...
@@ -217,13 +223,12 @@
</el-select>
</el-select>
<el-input
<el-input
type=
"textarea"
type=
"textarea"
style=
"width: 100%;
margin-top: 2px;
"
style=
"width: 100%;
margin-top: 2px
"
rows=
"5"
rows=
"5"
v-model=
"row.bescript"
v-model=
"row.bescript"
></el-input>
></el-input>
</
template
>
</
template
>
</vxe-column>
</vxe-column>
</vxe-table>
</vxe-table>
<
template
#
footer
>
<
template
#
footer
>
<el-button
type=
"primary"
@
click=
"confirmConnect"
>
确认
</el-button>
<el-button
type=
"primary"
@
click=
"confirmConnect"
>
确认
</el-button>
...
@@ -251,11 +256,8 @@
...
@@ -251,11 +256,8 @@
<
template
#
default=
"{ row }"
>
{{
row
[
'数据区'
]
}}
</
template
>
<
template
#
default=
"{ row }"
>
{{
row
[
'数据区'
]
}}
</
template
>
</vxe-column>
</vxe-column>
<
template
v-for=
"item in runResultTitle"
:key=
"item"
>
<
template
v-for=
"item in runResultTitle"
:key=
"item"
>
<vxe-column
:title=
"item"
:field=
"item"
cell-type=
"string"
<vxe-column
:title=
"item"
:field=
"item"
cell-type=
"string"
show-overflow
width=
"150"
>
show-overflow
</vxe-column>
width=
"150"
>
</vxe-column>
</
template
>
</
template
>
</vxe-table>
</vxe-table>
</vxe-modal>
</vxe-modal>
...
@@ -278,11 +280,7 @@ import {
...
@@ -278,11 +280,7 @@ import {
showstatisticBarConfig
showstatisticBarConfig
}
from
'@/constants/excelConfig'
}
from
'@/constants/excelConfig'
import
{
apiGetScript
}
from
'@/api/excel'
import
{
apiGetScript
}
from
'@/api/excel'
import
{
flatten
,
cloneDeep
}
from
'lodash-es'
import
{
flatten
,
cloneDeep
}
from
'lodash-es'
import
{
useCommentExcel
}
from
'@/stores/commentExcel'
import
{
useCommentExcel
}
from
'@/stores/commentExcel'
...
@@ -299,7 +297,7 @@ import {
...
@@ -299,7 +297,7 @@ import {
removeExcelArea
,
removeExcelArea
,
removeExcelAreaConnect
,
removeExcelAreaConnect
,
addExcelArea
,
addExcelArea
,
batchAddExcelArea
batchAddExcelArea
}
from
'@/api/excel'
}
from
'@/api/excel'
import
type
{
Recordable
}
from
'@/types/global'
import
type
{
Recordable
}
from
'@/types/global'
import
{
filterRunData
,
getRangetxt
,
setRangeBackground
}
from
'@/utils/excel'
import
{
filterRunData
,
getRangetxt
,
setRangeBackground
}
from
'@/utils/excel'
...
@@ -338,6 +336,7 @@ const currentConnectInfo = reactive<Recordable>({
...
@@ -338,6 +336,7 @@ const currentConnectInfo = reactive<Recordable>({
beConnectFiled
:
[],
beConnectFiled
:
[],
fileId
:
''
fileId
:
''
})
})
const
cachConnectEditInfo
=
ref
({})
const
runDataTable
=
ref
<
VxeTableInstance
>
()
const
runDataTable
=
ref
<
VxeTableInstance
>
()
const
cachCurrentConnectInfo
=
reactive
<
Recordable
>
({})
const
cachCurrentConnectInfo
=
reactive
<
Recordable
>
({})
const
cachCurrentBeConnectInfo
=
reactive
<
Recordable
>
({})
const
cachCurrentBeConnectInfo
=
reactive
<
Recordable
>
({})
...
@@ -363,9 +362,6 @@ const initIsSetSheetMark = (length: number) => {
...
@@ -363,9 +362,6 @@ const initIsSetSheetMark = (length: number) => {
isSetSheetMark
.
value
=
Array
.
from
({
length
}).
fill
(
false
)
isSetSheetMark
.
value
=
Array
.
from
({
length
}).
fill
(
false
)
}
}
const
getScriptList
=
async
()
=>
{
const
getScriptList
=
async
()
=>
{
const
{
data
}
=
await
apiGetScript
()
const
{
data
}
=
await
apiGetScript
()
scriptList
.
value
=
data
.
result
scriptList
.
value
=
data
.
result
...
@@ -374,7 +370,7 @@ const getScriptList = async () => {
...
@@ -374,7 +370,7 @@ const getScriptList = async () => {
const
scriptChange
=
(
item
,
e
)
=>
{
const
scriptChange
=
(
item
,
e
)
=>
{
if
(
e
)
{
if
(
e
)
{
// console.log(e)
// console.log(e)
item
.
script
=
scriptList
.
value
.
find
((
item1
)
=>
item1
.
srciptName
==
e
)?.
scriptContent
item
.
script
=
scriptList
.
value
.
find
((
item1
)
=>
item1
.
srciptName
==
e
)?.
scriptContent
}
else
{
}
else
{
item
.
script
=
''
item
.
script
=
''
}
}
...
@@ -382,7 +378,6 @@ const scriptChange = (item, e) => {
...
@@ -382,7 +378,6 @@ const scriptChange = (item, e) => {
}
}
const
scriptBeChange
=
(
item
,
e
)
=>
{
const
scriptBeChange
=
(
item
,
e
)
=>
{
if
(
e
)
{
if
(
e
)
{
item
.
bescript
=
scriptList
.
value
.
find
((
item1
)
=>
item1
.
srciptName
==
e
)?.
scriptContent
item
.
bescript
=
scriptList
.
value
.
find
((
item1
)
=>
item1
.
srciptName
==
e
)?.
scriptContent
}
else
{
}
else
{
...
@@ -391,8 +386,6 @@ const scriptBeChange = (item, e) => {
...
@@ -391,8 +386,6 @@ const scriptBeChange = (item, e) => {
item
.
beshow
=
true
item
.
beshow
=
true
}
}
/**
/**
* 存储在本地的区域标记
* 存储在本地的区域标记
* locaExcelAreaMarks = {
* locaExcelAreaMarks = {
...
@@ -423,10 +416,6 @@ const initExcelAreaMarksKey = (len: number) => {
...
@@ -423,10 +416,6 @@ const initExcelAreaMarksKey = (len: number) => {
})
})
}
}
const
onSaveSuccess
=
(
data
:
any
)
=>
{
const
onSaveSuccess
=
(
data
:
any
)
=>
{
locaExcelAreaMarks
[
data
.
result
[
'sheetNum'
]].
push
(
data
.
result
)
locaExcelAreaMarks
[
data
.
result
[
'sheetNum'
]].
push
(
data
.
result
)
}
}
...
@@ -609,7 +598,10 @@ const addConnect = async (list: any) => {
...
@@ -609,7 +598,10 @@ const addConnect = async (list: any) => {
})
})
currentConnectInfo
.
fileId
=
getFileInfo
.
value
.
orderFileId
currentConnectInfo
.
fileId
=
getFileInfo
.
value
.
orderFileId
const
{
data
}
=
await
addExcelAreaConnect
(
currentConnectInfo
)
// 需要添加修改接口
const
{
data
}
=
cachConnectEditInfo
.
value
?.
excelAreaConnectId
?
await
addExcelAreaConnect
(
currentConnectInfo
)
:
await
addExcelAreaConnect
(
currentConnectInfo
)
if
(
!
data
?.
success
)
{
if
(
!
data
?.
success
)
{
ElMessage
.
error
(
data
?.
message
||
'操作失败!'
)
ElMessage
.
error
(
data
?.
message
||
'操作失败!'
)
...
@@ -628,10 +620,9 @@ const chooseConnect = (row: any) => {
...
@@ -628,10 +620,9 @@ const chooseConnect = (row: any) => {
const
connectFiledStr
=
(
row
:
any
)
=>
{
const
connectFiledStr
=
(
row
:
any
)
=>
{
// console.log(row)
// console.log(row)
return
row
.
map
(
item
=>
item
.
title
).
join
(
', '
);
return
row
.
map
(
(
item
)
=>
item
.
title
).
join
(
', '
)
}
}
const
connectConfigData
=
ref
([])
const
connectConfigData
=
ref
([])
const
beConnectSelectOptions
=
computed
(
const
beConnectSelectOptions
=
computed
(
()
=>
()
=>
...
@@ -640,30 +631,60 @@ const beConnectSelectOptions = computed(
...
@@ -640,30 +631,60 @@ const beConnectSelectOptions = computed(
)
)
watch
(
connectVisible
,
(
val
)
=>
{
watch
(
connectVisible
,
(
val
)
=>
{
if
(
val
)
{
if
(
val
)
{
const
titles
=
areaList
.
value
.
find
((
v
:
any
)
=>
v
.
excelAreaId
==
currentConnectInfo
.
excelAreaId
)
// 编辑重新复制
?.
excelAreaTitle
if
(
currentConnectInfo
.
excelAreaConnectId
)
{
// 按照顺序来赋值connectFiled -> beConnectFiled
connectConfigData
.
value
=
titles
.
map
((
item
:
any
)
=>
{
connectConfigData
.
value
=
cachConnectEditInfo
.
value
?.
connectFiled
.
map
((
item
,
i
)
=>
{
return
{
const
beConnectFiled
=
cachConnectEditInfo
.
value
?.
beConnectFiled
[
i
]
title
:
item
.
title
,
return
{
sheet
:
item
.
sheet
,
title
:
item
.
title
,
row
:
item
.
row
,
sheet
:
item
.
sheet
,
colum
:
item
.
colum
,
row
:
item
.
row
,
numFlag
:
item
.
numFlag
,
colum
:
item
.
colum
,
numTitle
:
item
.
numTitle
,
numFlag
:
item
.
numFlag
,
only
:
item
.
only
,
numTitle
:
item
.
numTitle
,
only
:
item
.
only
,
betitle
:
''
,
betitle
:
beConnectFiled
.
title
,
berow
:
''
,
berow
:
beConnectFiled
.
row
,
becolum
:
''
,
becolum
:
beConnectFiled
.
colum
,
besheet
:
''
,
besheet
:
beConnectFiled
.
sheet
,
benumFlag
:
''
,
benumFlag
:
beConnectFiled
.
numFlag
,
benumTitle
:
''
,
benumTitle
:
beConnectFiled
.
numTitle
,
beonly
:
''
,
beonly
:
beConnectFiled
.
only
}
}
})
})
}
else
{
const
titles
=
areaList
.
value
.
find
(
(
v
:
any
)
=>
v
.
excelAreaId
==
currentConnectInfo
.
excelAreaId
)?.
excelAreaTitle
connectConfigData
.
value
=
titles
.
map
((
item
:
any
)
=>
{
return
{
title
:
item
.
title
,
sheet
:
item
.
sheet
,
row
:
item
.
row
,
colum
:
item
.
colum
,
numFlag
:
item
.
numFlag
,
numTitle
:
item
.
numTitle
,
only
:
item
.
only
,
betitle
:
''
,
berow
:
''
,
becolum
:
''
,
besheet
:
''
,
benumFlag
:
''
,
benumTitle
:
''
,
beonly
:
''
}
})
}
}
}
})
})
const
onHideSettingConnect
=
()
=>
{
// 清空
cachConnectEditInfo
.
value
=
{}
}
const
changeBeConnect
=
(
v
:
string
,
row
:
any
)
=>
{
const
changeBeConnect
=
(
v
:
string
,
row
:
any
)
=>
{
const
option
=
beConnectSelectOptions
.
value
.
find
((
item
:
any
)
=>
item
.
title
==
v
)
const
option
=
beConnectSelectOptions
.
value
.
find
((
item
:
any
)
=>
item
.
title
==
v
)
row
.
becolum
=
option
.
colum
row
.
becolum
=
option
.
colum
...
@@ -697,12 +718,6 @@ const confirmBeConnect = () => {
...
@@ -697,12 +718,6 @@ const confirmBeConnect = () => {
connectVisible
.
value
=
true
connectVisible
.
value
=
true
}
}
const
chooseConnectOnHide
=
()
=>
{
const
chooseConnectOnHide
=
()
=>
{
Object
.
assign
(
currentConnectInfo
,
{
Object
.
assign
(
currentConnectInfo
,
{
// excelAreaConnectId: '',
// excelAreaConnectId: '',
...
@@ -726,22 +741,25 @@ const delConnect = async (row: any, index: number) => {
...
@@ -726,22 +741,25 @@ const delConnect = async (row: any, index: number) => {
const
editConnect
=
async
(
row
:
any
,
index
:
number
)
=>
{
const
editConnect
=
async
(
row
:
any
,
index
:
number
)
=>
{
console
.
log
(
row
)
console
.
log
(
row
)
currentConnectInfo
.
excelAreaConnectId
=
row
.
excelAreaConnectId
currentConnectInfo
.
excelAreaBeId
=
row
.
excelAreaBeId
currentConnectInfo
.
excelAreaBeId
=
row
.
excelAreaBeId
currentConnectInfo
.
excelAreaId
=
row
.
excelAreaId
currentConnectInfo
.
excelAreaId
=
row
.
excelAreaId
Object
.
assign
(
cachConnectEditInfo
.
value
,
unref
(
row
))
// cachCurrentConnectInfo 保存关联数据
// cachCurrentConnectInfo 保存关联数据
Object
.
assign
(
cachCurrentConnectInfo
,
unref
(
areaList
.
value
?.
find
(
item
=>
item
.
excelAreaId
==
row
.
excelAreaId
)))
Object
.
assign
(
cachCurrentConnectInfo
,
unref
(
areaList
.
value
?.
find
((
item
)
=>
item
.
excelAreaId
==
row
.
excelAreaId
))
)
// cachCurrentBeConnectInfo 保存被关联数据
// cachCurrentBeConnectInfo 保存被关联数据
Object
.
assign
(
cachCurrentBeConnectInfo
,
unref
(
areaList
.
value
?.
find
(
item
=>
item
.
excelAreaId
==
row
.
excelAreaBeId
)))
Object
.
assign
(
cachCurrentBeConnectInfo
,
unref
(
areaList
.
value
?.
find
((
item
)
=>
item
.
excelAreaId
==
row
.
excelAreaBeId
))
)
connectVisible
.
value
=
true
connectVisible
.
value
=
true
}
}
const
queryConnectList
=
async
()
=>
{
const
queryConnectList
=
async
()
=>
{
const
{
data
}
=
await
getExcelConnectByFileId
(
getFileInfo
.
value
.
orderFileId
)
const
{
data
}
=
await
getExcelConnectByFileId
(
getFileInfo
.
value
.
orderFileId
)
connectList
.
value
=
data
.
result
connectList
.
value
=
data
.
result
...
@@ -935,15 +953,14 @@ const pasteConfig = async () => {
...
@@ -935,15 +953,14 @@ const pasteConfig = async () => {
// 4、刷新
// 4、刷新
ElMessage
({
ElMessage
({
type
:
'success'
,
type
:
'success'
,
message
:
'引入成功!重新加载...'
,
message
:
'引入成功!重新加载...'
})
})
// 5、刷新当前页 or 刷新当前excel
// 5、刷新当前页 or 刷新当前excel
setTimeout
(()
=>
{
setTimeout
(()
=>
{
window
.
location
.
reload
();
window
.
location
.
reload
()
},
1500
);
},
1500
)
}
catch
{
}
catch
{
ElMessage
.
error
(
'引入失败!'
)
ElMessage
.
error
(
'引入失败!'
)
}
}
...
@@ -959,9 +976,6 @@ onMounted(() => {
...
@@ -959,9 +976,6 @@ onMounted(() => {
onUnmounted
(()
=>
{
onUnmounted
(()
=>
{
isFunction
((
window
as
any
)?.
luckysheet
?.
destroy
)
&&
luckysheet
.
destroy
()
isFunction
((
window
as
any
)?.
luckysheet
?.
destroy
)
&&
luckysheet
.
destroy
()
})
})
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.comment-form
{
.comment-form
{
...
...
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