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
0a6f68f4
Commit
0a6f68f4
authored
Jan 24, 2024
by
何远江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加excel预览
parent
c833c3ad
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
119 additions
and
24 deletions
+119
-24
index.vue
src/components/PreviewExcel/index.vue
+83
-0
index.ts
src/router/index.ts
+8
-0
OrderChange.vue
src/views/order/orderChange/OrderChange.vue
+2
-2
OrderList.vue
src/views/order/orderList/OrderList.vue
+15
-22
index.vue
src/views/order/preview/index.vue
+11
-0
No files found.
src/components/PreviewExcel/index.vue
0 → 100644
View file @
0a6f68f4
<
template
>
<div
id=
"preview-excel"
></div>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
onMounted
,
onUnmounted
,
ref
,
watch
}
from
'vue'
import
LuckyExcel
from
'luckyexcel'
import
{
getOrderFileById
}
from
'@/api/order'
import
{
cellRightClickConfig
,
sheetRightClickConfig
,
showsheetbarConfig
,
showstatisticBarConfig
}
from
'@/constants/excelConfig'
import
{
useRoute
}
from
'vue-router'
;
import
{
isFunction
}
from
'@/utils/is'
;
const
props
=
defineProps
([
'fileId'
])
const
luckysheet
=
(
window
as
any
).
luckysheet
const
loading
=
ref
(
false
)
const
route
=
useRoute
()
/**生成excel */
const
generateExcel
=
(
path
:
string
)
=>
{
LuckyExcel
.
transformExcelToLuckyByUrl
(
'/api/sys/static/'
+
path
,
new
Date
().
getTime
()
+
'.xlsx'
,
async
(
exportJson
:
any
)
=>
{
luckysheet
.
create
({
container
:
'preview-excel'
,
//luckysheet is the container id
showinfobar
:
false
,
showtoolbar
:
false
,
showsheetbar
:
false
,
showsheetbarConfig
,
cellRightClickConfig
,
sheetRightClickConfig
,
showstatisticBarConfig
,
data
:
exportJson
.
sheets
,
title
:
exportJson
.
info
.
name
,
userInfo
:
exportJson
.
info
.
name
.
creator
})
}
)
}
/**获取文件路径 */
const
getFilePath
=
async
()
=>
{
try
{
loading
.
value
=
true
const
{
data
}
=
await
getOrderFileById
((
props
.
fileId
||
route
.
query
.
fileId
)
as
string
)
if
(
data
.
code
==
200
)
{
generateExcel
(
data
.
result
.
mergeFilePath
)
}
}
catch
{}
loading
.
value
=
false
}
watch
(
()
=>
props
.
fileId
,
(
val
)
=>
{
if
(
val
)
{
getFilePath
()
}
}
)
onMounted
(()
=>
{
// luckysheet.create({
// container: 'preview-excel'
// })
getFilePath
()
})
onUnmounted
(()
=>
{
isFunction
((
window
as
any
)?.
luckysheet
?.
destroy
)
&&
luckysheet
.
destroy
()
})
</
script
>
<
style
lang=
"scss"
scoped
>
#preview-excel
{
width
:
100%
;
height
:
100%
;
}
</
style
>
src/router/index.ts
View file @
0a6f68f4
...
@@ -183,6 +183,14 @@ export const routes = [
...
@@ -183,6 +183,14 @@ export const routes = [
title
:
'订单上传'
title
:
'订单上传'
},
},
component
:
()
=>
import
(
'@/views/comment-excel/CommentUpload.vue'
)
component
:
()
=>
import
(
'@/views/comment-excel/CommentUpload.vue'
)
},
{
path
:
'/preview-excel'
,
name
:
'PreviewExcel'
,
meta
:
{
title
:
'预览'
},
component
:
()
=>
import
(
'@/views/order/preview/index.vue'
)
}
}
]
]
...
...
src/views/order/orderChange/OrderChange.vue
View file @
0a6f68f4
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<vxe-column
type=
"checkbox"
width=
"50"
></vxe-column>
<vxe-column
type=
"checkbox"
width=
"50"
></vxe-column>
<vxe-column
field=
"fileId_dictText"
title=
"文件名称"
>
<vxe-column
field=
"fileId_dictText"
title=
"文件名称"
>
<
template
#
default=
"{ row }"
>
<
template
#
default=
"{ row }"
>
<el-link
target=
"_blank"
:href=
"'/
api/sys/static/' + row.fileId_dictText
"
>
{{
<el-link
target=
"_blank"
:href=
"'/
preview-excel?fileId=' + row.fileId
"
>
{{
row
.
fileId_dictText
row
.
fileId_dictText
}}
</el-link>
}}
</el-link>
</
template
>
</
template
>
...
@@ -472,7 +472,7 @@ const saveOrderField = async () => {
...
@@ -472,7 +472,7 @@ const saveOrderField = async () => {
})
})
}
}
await
saveConfExcelFileOrderPage
(
params
).
then
(({
data
})
=>
{
saveConfExcelFileOrderPage
(
params
).
then
(({
data
})
=>
{
if
(
data
.
code
==
200
)
{
if
(
data
.
code
==
200
)
{
ElMessage
.
success
(
data
.
message
||
'保存成功!'
)
ElMessage
.
success
(
data
.
message
||
'保存成功!'
)
}
else
{
}
else
{
...
...
src/views/order/orderList/OrderList.vue
View file @
0a6f68f4
...
@@ -33,19 +33,29 @@
...
@@ -33,19 +33,29 @@
<vxe-column
type=
"checkbox"
width=
"50"
></vxe-column>
<vxe-column
type=
"checkbox"
width=
"50"
></vxe-column>
<vxe-column
field=
"customerId_dictText"
title=
"客户名称"
width=
"120"
></vxe-column>
<vxe-column
field=
"customerId_dictText"
title=
"客户名称"
width=
"120"
></vxe-column>
<vxe-column
title=
"原始文件地址"
>
<vxe-column
title=
"原始文件地址"
>
<
template
#
default=
"{row}"
>
<
template
#
default=
"{ row }"
>
<el-link
target=
"_blank"
:href=
"'/api/sys/static/'+ row.filePath"
>
{{
row
.
filePath
}}
</el-link>
<el-link
target=
"_blank"
:href=
"'/api/sys/static/' + row.filePath"
>
{{
row
.
filePath
}}
</el-link>
</
template
>
</
template
>
</vxe-column>
</vxe-column>
<vxe-column
title=
"标注文件地址"
>
<vxe-column
title=
"标注文件地址"
>
<
template
#
default=
"{row}"
>
<
template
#
default=
"{ row }"
>
<el-link
target=
"_blank"
:href=
"'/api/sys/static/'+ row.mergeFilePath"
>
{{
row
.
mergeFilePath
}}
</el-link>
<el-link
target=
"_blank"
:href=
"'/preview-excel?fileId=' + row.orderFileId"
>
{{
row
.
mergeFilePath
}}
</el-link>
</
template
>
</
template
>
</vxe-column>
</vxe-column>
<vxe-column
field=
"createTime"
title=
"创建时间"
width=
"180"
></vxe-column>
<vxe-column
field=
"createTime"
title=
"创建时间"
width=
"180"
></vxe-column>
<vxe-column
field=
"action"
title=
"操作"
width=
"80"
>
<vxe-column
field=
"action"
title=
"操作"
width=
"80"
>
<
template
#
default=
"{ row }"
>
<
template
#
default=
"{ row }"
>
<el-link
type=
"primary"
style=
"font-size: 12px;"
:href=
"'/comment-excel?fileId=' + row.orderFileId"
target=
"_blank"
>
查看
</el-link>
<el-link
type=
"primary"
style=
"font-size: 12px"
:href=
"'/comment-excel?fileId=' + row.orderFileId"
target=
"_blank"
>
查看
</el-link
>
</
template
>
</
template
>
</vxe-column>
</vxe-column>
</vxe-table>
</vxe-table>
...
@@ -98,23 +108,6 @@ const removeRows = async () => {
...
@@ -98,23 +108,6 @@ const removeRows = async () => {
}
}
}
}
const
toDetail
=
(
row
:
any
)
=>
{
router
.
push
({
path
:
'/online-excel'
,
query
:
{
fileId
:
row
.
orderFileId
}
})
}
const
toDetail2
=
(
row
:
any
)
=>
{
router
.
push
({
path
:
'/comment-excel'
,
query
:
{
fileId
:
row
.
orderFileId
}
})
}
const
onReset
=
()
=>
{
const
onReset
=
()
=>
{
Object
.
assign
(
formState
,
{
Object
.
assign
(
formState
,
{
filePath
:
''
,
filePath
:
''
,
...
...
src/views/order/preview/index.vue
0 → 100644
View file @
0a6f68f4
<
template
>
<PreviewExcel
/>
</
template
>
<
script
lang=
'ts'
setup
>
import
PreviewExcel
from
'@/components/PreviewExcel/index.vue'
</
script
>
<
style
lang=
'scss'
scoped
>
</
style
>
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