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
c223e890
Commit
c223e890
authored
Jul 17, 2025
by
何远江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化关联
parent
234b9841
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
181 additions
and
109 deletions
+181
-109
ExcelOperate.vue
...ws/comment-excel/components/ExcelOperate/ExcelOperate.vue
+63
-56
ExcelOperate.vue
...ews/var/varExcel/components/ExcelOperate/ExcelOperate.vue
+118
-53
No files found.
src/views/comment-excel/components/ExcelOperate/ExcelOperate.vue
View file @
c223e890
...
@@ -571,8 +571,10 @@ const confirmConnect = () => {
...
@@ -571,8 +571,10 @@ const confirmConnect = () => {
addConnect
(
list
)
addConnect
(
list
)
}
}
const
addConnect
=
async
(
list
:
any
)
=>
{
const
addConnect
=
async
(
list
:
any
)
=>
{
const
connectFiled
=
[]
const
beConnectFiled
=
[]
list
.
forEach
((
item
:
any
)
=>
{
list
.
forEach
((
item
:
any
)
=>
{
c
urrentConnectInfo
.
c
onnectFiled
.
push
({
connectFiled
.
push
({
title
:
item
.
title
,
title
:
item
.
title
,
sheet
:
item
.
sheet
,
sheet
:
item
.
sheet
,
row
:
item
.
row
,
row
:
item
.
row
,
...
@@ -584,7 +586,7 @@ const addConnect = async (list: any) => {
...
@@ -584,7 +586,7 @@ const addConnect = async (list: any) => {
script
:
item
.
script
script
:
item
.
script
})
})
currentConnectInfo
.
beConnectFiled
.
push
({
beConnectFiled
.
push
({
title
:
item
.
betitle
,
title
:
item
.
betitle
,
sheet
:
item
.
besheet
,
sheet
:
item
.
besheet
,
row
:
item
.
berow
,
row
:
item
.
berow
,
...
@@ -596,6 +598,8 @@ const addConnect = async (list: any) => {
...
@@ -596,6 +598,8 @@ const addConnect = async (list: any) => {
script
:
item
.
bescript
script
:
item
.
bescript
})
})
})
})
currentConnectInfo
.
beConnectFiled
=
beConnectFiled
currentConnectInfo
.
connectFiled
=
connectFiled
currentConnectInfo
.
fileId
=
getFileInfo
.
value
.
orderFileId
currentConnectInfo
.
fileId
=
getFileInfo
.
value
.
orderFileId
const
{
data
}
=
await
addExcelAreaConnect
(
currentConnectInfo
)
const
{
data
}
=
await
addExcelAreaConnect
(
currentConnectInfo
)
...
@@ -606,8 +610,10 @@ const addConnect = async (list: any) => {
...
@@ -606,8 +610,10 @@ const addConnect = async (list: any) => {
}
}
ElMessage
.
success
(
'添加成功!'
)
ElMessage
.
success
(
'添加成功!'
)
connectVisible
.
value
=
false
connectVisible
.
value
=
false
// 添加成功,重新获取数据
queryConnectList
()
// 添加成功 手动更新页面数据
// 添加成功 手动更新页面数据
connectList
.
value
.
push
(
data
.
result
)
//
connectList.value.push(data.result)
}
}
const
chooseConnect
=
(
row
:
any
)
=>
{
const
chooseConnect
=
(
row
:
any
)
=>
{
currentConnectInfo
.
excelAreaId
=
row
.
excelAreaId
currentConnectInfo
.
excelAreaId
=
row
.
excelAreaId
...
@@ -628,60 +634,61 @@ const beConnectSelectOptions = computed(
...
@@ -628,60 +634,61 @@ const beConnectSelectOptions = computed(
)
)
watch
(
connectVisible
,
(
val
)
=>
{
watch
(
connectVisible
,
(
val
)
=>
{
if
(
val
)
{
if
(
val
)
{
// 编辑重新复制
const
titles
=
areaList
.
value
.
find
((
v
:
any
)
=>
v
.
excelAreaId
==
currentConnectInfo
.
excelAreaId
)
if
(
currentConnectInfo
.
excelAreaConnectId
)
{
?.
excelAreaTitle
// 按照顺序来赋值connectFiled -> beConnectFiled
const
connectFiled
=
cachConnectEditInfo
.
value
?.
connectFiled
||
[]
connectConfigData
.
value
=
titles
.
map
((
item
:
any
)
=>
{
const
beConnectFiled
=
cachConnectEditInfo
.
value
?.
beConnectFiled
// 全部列,并且匹配已经绑定的列
connectConfigData
.
value
=
connectFiled
.
map
((
item
,
i
)
=>
{
if
(
currentConnectInfo
.
excelAreaConnectId
)
{
const
beConnectFiledItem
=
beConnectFiled
[
i
]
// 按照顺序来赋值connectFiled -> beConnectFiled
console
.
log
(
beConnectFiledItem
,
'----'
)
const
connectFiled
=
cachConnectEditInfo
.
value
?.
connectFiled
||
[]
return
{
const
beConnectFiled
=
cachConnectEditInfo
.
value
?.
beConnectFiled
title
:
item
.
title
,
sheet
:
item
.
sheet
,
const
index
=
connectFiled
.
findIndex
(
row
:
item
.
row
,
(
v
)
=>
v
.
row
==
item
.
row
&&
v
.
colum
==
item
.
colum
&&
v
.
title
==
item
.
title
colum
:
item
.
colum
,
)
numFlag
:
item
.
numFlag
,
if
(
index
>
-
1
)
{
numTitle
:
item
.
numTitle
,
const
beConnectFiledItem
=
beConnectFiled
[
index
]
only
:
item
.
only
,
return
{
script
:
item
.
script
,
title
:
item
.
title
,
scriptName
:
item
.
scriptName
,
sheet
:
item
.
sheet
,
bescriptName
:
beConnectFiledItem
.
scriptName
,
row
:
item
.
row
,
bescript
:
beConnectFiledItem
.
script
,
colum
:
item
.
colum
,
betitle
:
beConnectFiledItem
.
title
,
numFlag
:
item
.
numFlag
,
berow
:
beConnectFiledItem
.
row
,
numTitle
:
item
.
numTitle
,
becolum
:
beConnectFiledItem
.
colum
,
only
:
item
.
only
,
besheet
:
beConnectFiledItem
.
sheet
,
script
:
item
.
script
,
benumFlag
:
beConnectFiledItem
.
numFlag
,
scriptName
:
item
.
scriptName
,
benumTitle
:
beConnectFiledItem
.
numTitle
,
bescriptName
:
beConnectFiledItem
.
scriptName
,
beonly
:
beConnectFiledItem
.
only
bescript
:
beConnectFiledItem
.
script
,
}
betitle
:
beConnectFiledItem
.
title
,
})
berow
:
beConnectFiledItem
.
row
,
}
else
{
becolum
:
beConnectFiledItem
.
colum
,
const
titles
=
areaList
.
value
.
find
(
besheet
:
beConnectFiledItem
.
sheet
,
(
v
:
any
)
=>
v
.
excelAreaId
==
currentConnectInfo
.
excelAreaId
benumFlag
:
beConnectFiledItem
.
numFlag
,
)?.
excelAreaTitle
benumTitle
:
beConnectFiledItem
.
numTitle
,
beonly
:
beConnectFiledItem
.
only
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
:
''
}
}
})
}
}
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
:
''
}
})
}
}
})
})
...
...
src/views/var/varExcel/components/ExcelOperate/ExcelOperate.vue
View file @
c223e890
...
@@ -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=
"varAreaId_dictText"
min-width=
"100"
></vxe-column>
<vxe-column
title=
"关联名称"
field=
"varAreaId_dictText"
min-width=
"100"
></vxe-column>
<vxe-column
title=
"别关联名称"
field=
"varAreaBeId_dictText"
min-width=
"100"
></vxe-column>
<vxe-column
<vxe-column
title=
"关联字段"
min-width=
"100"
>
title=
"别关联名称"
field=
"varAreaBeId_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
>
...
@@ -70,6 +74,10 @@
...
@@ -70,6 +74,10 @@
</vxe-column>
</vxe-column>
<vxe-column
title=
"操作"
field=
"action"
width=
"80"
>
<vxe-column
title=
"操作"
field=
"action"
width=
"80"
>
<
template
#
default=
"{ row, $rowIndex }"
>
<
template
#
default=
"{ row, $rowIndex }"
>
<el-link
style=
"font-size: 12px"
type=
"primary"
@
click=
"editConnect(row, $rowIndex)"
>
修改
</el-link
>
<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
>
>
...
@@ -105,11 +113,7 @@
...
@@ -105,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>
...
@@ -154,6 +158,7 @@
...
@@ -154,6 +158,7 @@
class=
"mt-2"
class=
"mt-2"
size=
"mini"
size=
"mini"
:data=
"connectConfigData"
:data=
"connectConfigData"
@
hide=
"onHideSettingConnect"
border
border
height=
"400"
height=
"400"
ref=
"xTableConnect"
ref=
"xTableConnect"
...
@@ -161,16 +166,16 @@
...
@@ -161,16 +166,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"
...
@@ -179,7 +184,7 @@
...
@@ -179,7 +184,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>
...
@@ -196,16 +201,16 @@
...
@@ -196,16 +201,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"
...
@@ -214,7 +219,7 @@
...
@@ -214,7 +219,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.bescript"
v-model=
"row.bescript"
></el-input>
></el-input>
...
@@ -273,9 +278,13 @@
...
@@ -273,9 +278,13 @@
<
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
show-overflow
:title=
"item"
width=
"150"
></vxe-column>
:field=
"item"
cell-type=
"string"
show-overflow
width=
"150"
></vxe-column>
</
template
>
</
template
>
</vxe-table>
</vxe-table>
</vxe-modal>
</vxe-modal>
...
@@ -311,12 +320,10 @@ import {
...
@@ -311,12 +320,10 @@ import {
removeExcelArea
,
removeExcelArea
,
removeExcelAreaConnect
,
removeExcelAreaConnect
,
addExcelArea
,
addExcelArea
,
batchAddVarExcelArea
batchAddVarExcelArea
}
from
'@/api/varExcel'
}
from
'@/api/varExcel'
import
{
import
{
apiGetScript
}
from
'@/api/excel'
apiGetScript
}
from
'@/api/excel'
import
type
{
Recordable
}
from
'@/types/global'
import
type
{
Recordable
}
from
'@/types/global'
import
{
filterRunData2
,
getRangetxt
,
setRangeBackground
}
from
'@/utils/excel'
import
{
filterRunData2
,
getRangetxt
,
setRangeBackground
}
from
'@/utils/excel'
...
@@ -324,7 +331,7 @@ import type { VxeTableInstance } from 'vxe-table'
...
@@ -324,7 +331,7 @@ import type { VxeTableInstance } from 'vxe-table'
import
EditArea
from
'../EditArea/EditArea.vue'
import
EditArea
from
'../EditArea/EditArea.vue'
import
{
deleteExcelProdFileConfByIds
,
getExcelProdFileConfPage
}
from
'@/api/product'
import
{
deleteExcelProdFileConfByIds
,
getExcelProdFileConfPage
}
from
'@/api/product'
const
pasteLoading
=
ref
(
false
)
;
const
pasteLoading
=
ref
(
false
)
const
connectVisible
=
ref
(
false
)
const
connectVisible
=
ref
(
false
)
const
showProdCompare
=
ref
(
false
)
const
showProdCompare
=
ref
(
false
)
const
xTableConnect
=
ref
<
VxeTableInstance
>
()
const
xTableConnect
=
ref
<
VxeTableInstance
>
()
...
@@ -351,6 +358,7 @@ const currentConnectInfo = reactive<Recordable>({
...
@@ -351,6 +358,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
>
({})
...
@@ -401,7 +409,7 @@ const areaTypeLen = computed(() => {
...
@@ -401,7 +409,7 @@ const areaTypeLen = computed(() => {
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
=
''
}
}
...
@@ -409,13 +417,12 @@ const scriptChange = (item, e) => {
...
@@ -409,13 +417,12 @@ 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
{
item
.
bescript
=
''
item
.
bescript
=
''
}
}
item
.
beshow
=
true
item
.
beshow
=
true
}
}
const
deletePic
=
()
=>
{
const
deletePic
=
()
=>
{
...
@@ -428,7 +435,7 @@ const initExcelAreaMarksKey = (len: number) => {
...
@@ -428,7 +435,7 @@ const initExcelAreaMarksKey = (len: number) => {
}
}
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
onSaveSuccess
=
(
data
:
any
)
=>
{
const
onSaveSuccess
=
(
data
:
any
)
=>
{
...
@@ -480,9 +487,7 @@ const cellClick = ({ row }) => {
...
@@ -480,9 +487,7 @@ const cellClick = ({ row }) => {
const
delAreaMark
=
async
(
row
:
any
)
=>
{
const
delAreaMark
=
async
(
row
:
any
)
=>
{
// 判断当前区域是否关联了其他区域
// 判断当前区域是否关联了其他区域
if
(
if
(
connectList
.
value
.
find
(
connectList
.
value
.
find
((
v
)
=>
row
.
varAreaId
==
v
.
varAreaId
||
row
.
varAreaId
==
v
.
varAreaBeId
)
(
v
)
=>
row
.
varAreaId
==
v
.
varAreaId
||
row
.
varAreaId
==
v
.
varAreaBeId
)
)
{
)
{
return
ElMessage
.
warning
(
'当前区域绑定与其他区域绑定了关联信息,请先删除关联信息之后再做修改!'
)
return
ElMessage
.
warning
(
'当前区域绑定与其他区域绑定了关联信息,请先删除关联信息之后再做修改!'
)
}
}
...
@@ -517,9 +522,7 @@ const currentAreaMark = reactive({})
...
@@ -517,9 +522,7 @@ const currentAreaMark = reactive({})
const
toModify
=
(
row
)
=>
{
const
toModify
=
(
row
)
=>
{
// 判断当前区域是否关联了其他区域
// 判断当前区域是否关联了其他区域
if
(
if
(
connectList
.
value
.
find
(
connectList
.
value
.
find
((
v
)
=>
row
.
varAreaId
==
v
.
varAreaId
||
row
.
varAreaId
==
v
.
varAreaBeId
)
(
v
)
=>
row
.
varAreaId
==
v
.
varAreaId
||
row
.
varAreaId
==
v
.
varAreaBeId
)
)
{
)
{
return
ElMessage
.
warning
(
'当前区域绑定与其他区域绑定了关联信息,请先删除关联信息之后再做修改!'
)
return
ElMessage
.
warning
(
'当前区域绑定与其他区域绑定了关联信息,请先删除关联信息之后再做修改!'
)
}
}
...
@@ -586,8 +589,10 @@ const confirmConnect = () => {
...
@@ -586,8 +589,10 @@ const confirmConnect = () => {
addConnect
(
list
)
addConnect
(
list
)
}
}
const
addConnect
=
async
(
list
:
any
)
=>
{
const
addConnect
=
async
(
list
:
any
)
=>
{
const
connectFiled
=
[]
const
beConnectFiled
=
[]
list
.
forEach
((
item
:
any
)
=>
{
list
.
forEach
((
item
:
any
)
=>
{
c
urrentConnectInfo
.
c
onnectFiled
.
push
({
connectFiled
.
push
({
title
:
item
.
title
,
title
:
item
.
title
,
sheet
:
item
.
sheet
,
sheet
:
item
.
sheet
,
row
:
item
.
row
,
row
:
item
.
row
,
...
@@ -599,7 +604,7 @@ const addConnect = async (list: any) => {
...
@@ -599,7 +604,7 @@ const addConnect = async (list: any) => {
script
:
item
.
script
script
:
item
.
script
})
})
currentConnectInfo
.
beConnectFiled
.
push
({
beConnectFiled
.
push
({
title
:
item
.
betitle
,
title
:
item
.
betitle
,
sheet
:
item
.
besheet
,
sheet
:
item
.
besheet
,
row
:
item
.
berow
,
row
:
item
.
berow
,
...
@@ -611,6 +616,8 @@ const addConnect = async (list: any) => {
...
@@ -611,6 +616,8 @@ const addConnect = async (list: any) => {
script
:
item
.
bescript
script
:
item
.
bescript
})
})
})
})
currentConnectInfo
.
beConnectFiled
=
beConnectFiled
currentConnectInfo
.
connectFiled
=
connectFiled
currentConnectInfo
.
fileId
=
getFileInfo
.
value
.
varFileId
currentConnectInfo
.
fileId
=
getFileInfo
.
value
.
varFileId
const
{
data
}
=
await
addExcelAreaConnect
(
currentConnectInfo
)
const
{
data
}
=
await
addExcelAreaConnect
(
currentConnectInfo
)
...
@@ -621,8 +628,8 @@ const addConnect = async (list: any) => {
...
@@ -621,8 +628,8 @@ const addConnect = async (list: any) => {
}
}
ElMessage
.
success
(
'添加成功!'
)
ElMessage
.
success
(
'添加成功!'
)
connectVisible
.
value
=
false
connectVisible
.
value
=
false
// 添加成功 手动更新页面数据
connectList
.
value
.
push
(
data
.
result
)
queryConnectList
(
)
}
}
const
chooseConnect
=
(
row
:
any
)
=>
{
const
chooseConnect
=
(
row
:
any
)
=>
{
currentConnectInfo
.
varAreaId
=
row
.
varAreaId
currentConnectInfo
.
varAreaId
=
row
.
varAreaId
...
@@ -641,6 +648,39 @@ watch(connectVisible, (val) => {
...
@@ -641,6 +648,39 @@ watch(connectVisible, (val) => {
?.
excelAreaTitle
?.
excelAreaTitle
connectConfigData
.
value
=
titles
.
map
((
item
:
any
)
=>
{
connectConfigData
.
value
=
titles
.
map
((
item
:
any
)
=>
{
// 全部列,并且匹配已经绑定的列
if
(
currentConnectInfo
.
excelAreaConnectId
)
{
// 按照顺序来赋值connectFiled -> beConnectFiled
const
connectFiled
=
cachConnectEditInfo
.
value
?.
connectFiled
||
[]
const
beConnectFiled
=
cachConnectEditInfo
.
value
?.
beConnectFiled
const
index
=
connectFiled
.
findIndex
(
(
v
)
=>
v
.
row
==
item
.
row
&&
v
.
colum
==
item
.
colum
&&
v
.
title
==
item
.
title
)
if
(
index
>
-
1
)
{
const
beConnectFiledItem
=
beConnectFiled
[
index
]
return
{
title
:
item
.
title
,
sheet
:
item
.
sheet
,
row
:
item
.
row
,
colum
:
item
.
colum
,
numFlag
:
item
.
numFlag
,
numTitle
:
item
.
numTitle
,
only
:
item
.
only
,
script
:
item
.
script
,
scriptName
:
item
.
scriptName
,
bescriptName
:
beConnectFiledItem
.
scriptName
,
bescript
:
beConnectFiledItem
.
script
,
betitle
:
beConnectFiledItem
.
title
,
berow
:
beConnectFiledItem
.
row
,
becolum
:
beConnectFiledItem
.
colum
,
besheet
:
beConnectFiledItem
.
sheet
,
benumFlag
:
beConnectFiledItem
.
numFlag
,
benumTitle
:
beConnectFiledItem
.
numTitle
,
beonly
:
beConnectFiledItem
.
only
}
}
}
return
{
return
{
title
:
item
.
title
,
title
:
item
.
title
,
sheet
:
item
.
sheet
,
sheet
:
item
.
sheet
,
...
@@ -648,19 +688,23 @@ watch(connectVisible, (val) => {
...
@@ -648,19 +688,23 @@ watch(connectVisible, (val) => {
colum
:
item
.
colum
,
colum
:
item
.
colum
,
numFlag
:
item
.
numFlag
,
numFlag
:
item
.
numFlag
,
numTitle
:
item
.
numTitle
,
numTitle
:
item
.
numTitle
,
only
:
item
.
only
,
only
:
item
.
only
,
betitle
:
''
,
betitle
:
''
,
berow
:
''
,
berow
:
''
,
becolum
:
''
,
becolum
:
''
,
besheet
:
''
,
besheet
:
''
,
benumFlag
:
''
,
benumFlag
:
''
,
benumTitle
:
''
,
benumTitle
:
''
,
beonly
:
''
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
...
@@ -703,6 +747,28 @@ const chooseConnectOnHide = () => {
...
@@ -703,6 +747,28 @@ const chooseConnectOnHide = () => {
// fileId: ''
// fileId: ''
})
})
}
}
// 初始化修改关联信息
const
editConnect
=
async
(
row
:
any
,
index
:
number
)
=>
{
console
.
log
(
row
)
currentConnectInfo
.
excelAreaConnectId
=
row
.
excelAreaConnectId
currentConnectInfo
.
excelAreaBeId
=
row
.
excelAreaBeId
currentConnectInfo
.
varAreaId
=
row
.
varAreaId
Object
.
assign
(
cachConnectEditInfo
.
value
,
unref
(
row
))
// cachCurrentConnectInfo 保存关联数据
Object
.
assign
(
cachCurrentConnectInfo
,
unref
(
areaList
.
value
?.
find
((
item
)
=>
item
.
varAreaId
==
row
.
varAreaId
))
)
// cachCurrentBeConnectInfo 保存被关联数据
Object
.
assign
(
cachCurrentBeConnectInfo
,
unref
(
areaList
.
value
?.
find
((
item
)
=>
item
.
varAreaId
==
row
.
excelAreaBeId
))
)
connectVisible
.
value
=
true
}
const
delConnect
=
async
(
row
:
any
,
index
:
number
)
=>
{
const
delConnect
=
async
(
row
:
any
,
index
:
number
)
=>
{
const
{
data
}
=
await
removeExcelAreaConnect
(
row
.
varAreaConnectId
)
const
{
data
}
=
await
removeExcelAreaConnect
(
row
.
varAreaConnectId
)
if
(
data
?.
success
)
{
if
(
data
?.
success
)
{
...
@@ -876,7 +942,7 @@ const toDelete = async (row) => {
...
@@ -876,7 +942,7 @@ const toDelete = async (row) => {
/**
/**
* 复制
* 复制
*/
*/
const
copy
=
()
=>
{
const
copy
=
()
=>
{
if
(
areaList
.
value
?.
length
)
{
if
(
areaList
.
value
?.
length
)
{
return
localStorage
.
setItem
(
'copyVarID'
,
getFileInfo
.
value
.
varFileId
)
return
localStorage
.
setItem
(
'copyVarID'
,
getFileInfo
.
value
.
varFileId
)
}
}
...
@@ -909,15 +975,14 @@ const pasteConfig = async () => {
...
@@ -909,15 +975,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
(
'引入失败!'
)
}
}
...
...
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