Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
11d86ae8
提交
11d86ae8
authored
11月 17, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'zhijian_app'
上级
893f2d67
85b0723d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
129 行增加
和
14 行删除
+129
-14
index.vue
src/views/licenses/qualityIns/index.vue
+2
-1
index.vue
src/views/mobile/pages/licenses/report/index.vue
+127
-13
没有找到文件。
src/views/licenses/qualityIns/index.vue
浏览文件 @
11d86ae8
...
...
@@ -42,7 +42,8 @@
<el-button
type=
"primary"
plain
icon=
"Plus"
@
click=
"createClick"
>
@
click=
"createClick"
v-hasPermi=
"['licenses:qualityIns:create']"
>
新增
</el-button>
</el-col>
...
...
src/views/mobile/pages/licenses/report/index.vue
浏览文件 @
11d86ae8
...
...
@@ -17,26 +17,47 @@
finished-text=
"没有更多了"
@
load=
"onLoad"
>
<van-cell-group
inset
>
<van-swipe-cell
v-for=
"item in planList"
:key=
"item.id"
>
<van-cell
:title=
"item.prdName + '\n料号: ' + item.prdCode"
>
<template
#
label
>
<p>
批号:
{{
item
.
manufactureBatchNo
}}
</p>
<p>
厂家:
{{
item
.
manufactureDate
}}
</p>
</
template
>
<
template
#
value
>
</
template
>
</van-cell>
</van-swipe-cell>
<van-cell
:title=
"item.prdName + '\n料号: ' + item.prdCode"
v-for=
"item, index in planList"
:key=
"item.id"
:class=
"
{ 'zebra-row': index % 2 === 1 }">
<template
#
label
>
<p>
批号:
{{
item
.
manufactureBatchNo
}}
</p>
<p>
厂家:
{{
item
.
manufacturersName
}}
</p>
<p>
发货时间:
{{
parseTime
(
item
.
shipDate
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/p
>
<
/template
>
<
template
#
value
>
<
el
-
link
v
-
if
=
"item.qualityUrl"
type
=
"primary"
@
click
=
"handleReportClick(item.qualityUrl)"
>
{{
getReportLinkText
(
item
.
qualityUrl
)
}}
<
/el-link
>
<
span
v
-
else
>
无文件
<
/span
>
<
/template
>
<
/van-cell
>
<
/van-cell-group
>
<
/van-list
>
<
/van-pull-refresh
>
<!--
移动端特殊,覆盖一个
iframe
在当前页顶层显示
pdf
用
-->
<
div
class
=
"iframe-wrap"
v
-
if
=
"showPdfIframe"
>
<
iframe
:
src
=
"pdfUrl"
width
=
"100%"
height
=
"100%"
frameborder
=
"0"
allow
=
"fullscreen"
/>
<!--
覆盖一层
div
,透明的,用于接收点击交互关闭
-->
<
div
class
=
"click-cover"
@
click
=
"closeIframe"
><
/div
>
<
/div
>
<
/div
>
<
/template
>
<
script
setup
>
import
{
getQualityInsPageList
}
from
'@/api'
import
{
parseTime
}
from
'@/utils'
import
{
showImagePreview
}
from
'vant'
;
const
router
=
useRouter
()
/*************** 导航栏 ***************/
...
...
@@ -77,12 +98,104 @@ const getPlanListFn = async () => {
}
getPlanListFn
()
/*************** 附件类型/预览 ***************/
const
showPdfIframe
=
ref
(
false
)
const
pdfUrl
=
ref
(
''
)
// 判断文件类型
const
isImageFile
=
(
url
)
=>
{
if
(
!
url
)
return
false
const
imageExtensions
=
[
'.png'
,
'.jpg'
,
'.jpeg'
,
'.webp'
]
return
imageExtensions
.
some
(
ext
=>
url
.
toLowerCase
().
includes
(
ext
))
}
const
isPdfFile
=
(
url
)
=>
{
if
(
!
url
)
return
false
return
url
.
toLowerCase
().
includes
(
'.pdf'
)
}
const
isZipFile
=
(
url
)
=>
{
if
(
!
url
)
return
false
const
zipExtensions
=
[
'.zip'
,
'.rar'
,
'.7z'
]
return
zipExtensions
.
some
(
ext
=>
url
.
toLowerCase
().
includes
(
ext
))
}
const
getReportLinkText
=
(
url
)
=>
{
if
(
isImageFile
(
url
))
{
return
'预览图片'
}
else
if
(
isPdfFile
(
url
))
{
return
'查看报告'
}
else
if
(
isZipFile
(
url
))
{
return
'下载压缩包'
}
else
{
return
'查看文件'
}
}
// 处理报告点击事件
const
handleReportClick
=
(
url
)
=>
{
if
(
isImageFile
(
url
))
{
// 图片文件:预览
showImagePreview
([
url
])
}
else
if
(
isPdfFile
(
url
))
{
// PDF文件:打开新链接
// 把 url 的域名替换掉,改成自己的然后拼接原来的资源路径
const
originDomain
=
import
.
meta
.
env
.
VITE_APP_OSS_ORIGIN_DOMAIN
const
customDomain
=
import
.
meta
.
env
.
VITE_APP_OSS_CUSTOM_DOMAIN
url
=
url
.
replace
(
originDomain
,
customDomain
)
pdfUrl
.
value
=
url
showPdfIframe
.
value
=
true
}
else
{
// 其他文件类型:默认打开新链接
window
.
open
(
url
,
'_blank'
)
}
}
// 关闭 iframe
const
closeIframe
=
()
=>
{
showPdfIframe
.
value
=
false
}
<
/script
>
<
style
scoped
lang
=
"scss"
>
::v-deep
(
.van-cell__label
)
{
/* 添加斑马纹样式 */
.
van
-
cell
-
group
{
margin
:
0
;
.
van
-
cell
{
padding
-
right
:
40
px
!
important
;
padding
-
left
:
40
px
!
important
;
+
.
zebra
-
row
{
background
-
color
:
#
f9f9f9
;
}
.
van
-
cell__label
{
p
{
margin
:
0
;
}
}
}
}
/* iframe 样式 */
.
iframe
-
wrap
{
position
:
fixed
;
top
:
0
;
left
:
0
;
width
:
100
%
;
height
:
100
%
;
background
-
color
:
rgba
(
0
,
0
,
0
,
0.8
);
z
-
index
:
9998
;
display
:
flex
;
align
-
items
:
center
;
justify
-
content
:
center
;
}
.
click
-
cover
{
position
:
absolute
;
top
:
56
px
;
left
:
0
;
width
:
100
%
;
height
:
100
%
;
z
-
index
:
9999
;
}
<
/style>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论