Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
44bd4b50
提交
44bd4b50
authored
11月 03, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'zhengzhao_upload' into dev
上级
07bf4753
8ca54ead
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
47 行增加
和
4 行删除
+47
-4
index.vue
src/views/licenses/qualityIns/index.vue
+47
-4
没有找到文件。
src/views/licenses/qualityIns/index.vue
浏览文件 @
44bd4b50
...
@@ -114,12 +114,14 @@
...
@@ -114,12 +114,14 @@
<!-- 上传 PDF / 图片 -->
<!-- 上传 PDF / 图片 -->
<el-form-item
label=
"上传 PDF / 图片"
<el-form-item
label=
"上传 PDF / 图片"
prop=
"fileList"
>
prop=
"fileList"
>
<el-upload
v-model:file-list=
"formData.fileList"
<el-upload
:file-list=
"formData.fileList"
ref=
"uploadRef"
class=
"upload-demo"
class=
"upload-demo"
action=
"#"
action=
"#"
accept=
"application/pdf, image/*"
accept=
"application/pdf, image/*"
:http-request=
"httpRequestFn"
:http-request=
"httpRequestFn"
:limit=
"1"
>
:limit=
"1"
:on-exceed=
"handleExceed"
>
<el-button
size=
"small"
<el-button
size=
"small"
type=
"primary"
>
type=
"primary"
>
点击上传
点击上传
...
@@ -161,6 +163,8 @@ import { getQualityInsPageList, uploadFileToOSSAPI, postQualityIns, getProductNa
...
@@ -161,6 +163,8 @@ import { getQualityInsPageList, uploadFileToOSSAPI, postQualityIns, getProductNa
import
useUserStore
from
'@/store/modules/user'
import
useUserStore
from
'@/store/modules/user'
import
{
v4
as
uuidv4
}
from
'uuid'
import
{
v4
as
uuidv4
}
from
'uuid'
import
{
getFileTypeExt
,
parseTime
}
from
'@/utils'
import
{
getFileTypeExt
,
parseTime
}
from
'@/utils'
import
{
genFileId
}
from
'element-plus'
const
{
proxy
}
=
getCurrentInstance
()
const
{
proxy
}
=
getCurrentInstance
()
const
queryParams
=
reactive
({
const
queryParams
=
reactive
({
...
@@ -298,15 +302,27 @@ const submitForm = async () => {
...
@@ -298,15 +302,27 @@ const submitForm = async () => {
})
})
}
}
// 上传文件
const
httpRequestFn
=
async
(
file
)
=>
{
const
httpRequestFn
=
async
(
file
)
=>
{
console
.
log
(
'zoulema?'
)
const
date
=
new
Date
()
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
month
=
date
.
getMonth
()
+
1
const
url
=
await
uploadFileToOSSAPI
(
`licenses/qualityIns/
${
date
.
getFullYear
()}
-
${
month
}
/
${
useUserStore
().
empInfo
.
empNo
}
/
${
uuidv4
()}
.
${
getFileTypeExt
(
file
.
file
.
name
)}
`
,
file
.
file
)
const
url
=
await
uploadFileToOSSAPI
(
`licenses/qualityIns/
${
date
.
getFullYear
()}
-
${
month
}
/
${
useUserStore
().
empInfo
.
empNo
}
/
${
uuidv4
()}
.
${
getFileTypeExt
(
file
.
file
.
name
)}
`
,
file
.
file
)
formData
.
fileList
[
0
].
url
=
url
formData
.
fileList
[
0
]
=
{
name
:
file
.
file
.
name
,
url
,
}
// 重新校验表单
// 重新校验表单
proxy
.
$refs
.
formRef
.
validateField
(
'fileList'
)
proxy
.
$refs
.
formRef
.
validateField
(
'fileList'
)
}
}
// 替换文件
const
uploadRef
=
ref
(
null
)
const
handleExceed
=
async
(
files
)
=>
{
const
file
=
files
[
0
]
uploadRef
.
value
.
clearFiles
()
formData
.
fileList
=
[]
httpRequestFn
({
file
})
}
</
script
>
</
script
>
<
style
scoped
<
style
scoped
...
@@ -314,4 +330,30 @@ const httpRequestFn = async (file) => {
...
@@ -314,4 +330,30 @@ const httpRequestFn = async (file) => {
.el-table
{
.el-table
{
margin-top
:
20px
;
margin-top
:
20px
;
}
}
::v-deep
(
.el-upload-list__item-info
)
{
width
:
auto
!
important
;
/* 覆盖el-upload文件名称样式,让宽度由内容撑开 */
::v-deep
(
.el-upload-list__item-file-name
)
{
text-overflow
:
initial
!
important
;
overflow
:
visible
!
important
;
white-space
:
normal
!
important
;
white-space
:
nowrap
!
important
;
/* 关键:不换行 */
max-width
:
none
!
important
;
width
:
auto
!
important
;
display
:
inline-block
!
important
;
}
}
/* 完成提示按钮 */
::v-deep
(
.el-upload-list__item-status-label
)
{
right
:
auto
!
important
;
}
/* 清除按钮 */
::v-deep
(
.el-icon--close
)
{
right
:
auto
!
important
;
}
</
style
>
</
style
>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论