Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
biz-trina5-app
Project
Project
Details
Activity
Releases
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
贺双
biz-trina5-app
Commits
eba987bb
Commit
eba987bb
authored
Jun 09, 2025
by
贺世双
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整上传功能
parent
3a35d60d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
24 deletions
+70
-24
apiList.js
api/apiList.js
+4
-0
uploadFile.js
api/uploadFile.js
+5
-1
abnormalEvent.vue
subpkg/abnormalEvent/abnormalEvent.vue
+25
-18
abnormalEventDetail.vue
subpkg/abnormalEventDetail/abnormalEventDetail.vue
+36
-5
No files found.
api/apiList.js
View file @
eba987bb
...
@@ -58,6 +58,10 @@ export function uploadImg(data, fileType = "image") {
...
@@ -58,6 +58,10 @@ export function uploadImg(data, fileType = "image") {
export
function
downloadImg
(
data
)
{
export
function
downloadImg
(
data
)
{
return
downloadFile
(
"/api/doc/download"
,
data
);
return
downloadFile
(
"/api/doc/download"
,
data
);
}
}
// 获取文件名
export
function
findFileName
(
filePath
)
{
return
Request
(
`/api/doc/download/
${
filePath
}
`
,
{},
'GET'
,{},
false
)
}
//获取基础订单信息--订舱委托
//获取基础订单信息--订舱委托
export
function
getOrderBaseList
(
data
)
{
export
function
getOrderBaseList
(
data
)
{
...
...
api/uploadFile.js
View file @
eba987bb
...
@@ -3,6 +3,7 @@ import compress from '../utils/compress'
...
@@ -3,6 +3,7 @@ import compress from '../utils/compress'
let
uploadFile
=
async
(
api
,
filePath
,
fileType
,
header
=
{})
=>
{
let
uploadFile
=
async
(
api
,
filePath
,
fileType
,
header
=
{})
=>
{
header
=
{
header
=
{
"content-type"
:
"application/json"
,
'Cookie'
:
'XSRF-TOKEN='
+
uni
.
getStorageSync
(
`
${
TokenPrefix
}
_XSRFToken`
)
||
''
,
'Cookie'
:
'XSRF-TOKEN='
+
uni
.
getStorageSync
(
`
${
TokenPrefix
}
_XSRFToken`
)
||
''
,
"X-XSRF-TOKEN"
:
uni
.
getStorageSync
(
`
${
TokenPrefix
}
_XSRFToken`
)
||
''
,
"X-XSRF-TOKEN"
:
uni
.
getStorageSync
(
`
${
TokenPrefix
}
_XSRFToken`
)
||
''
,
"Authorization"
:
uni
.
getStorageSync
(
`
${
TokenPrefix
}
_token`
)
||
''
,
"Authorization"
:
uni
.
getStorageSync
(
`
${
TokenPrefix
}
_token`
)
||
''
,
...
@@ -11,10 +12,11 @@ let uploadFile = async (api, filePath, fileType, header = {}) => {
...
@@ -11,10 +12,11 @@ let uploadFile = async (api, filePath, fileType, header = {}) => {
title
:
'上传中'
,
title
:
'上传中'
,
})
})
// #ifdef H5
if
(
fileType
===
'image'
){
if
(
fileType
===
'image'
){
filePath
=
await
compress
(
filePath
)
//图片压缩
filePath
=
await
compress
(
filePath
)
//图片压缩
}
}
// #endif
return
new
Promise
((
reslove
,
reject
)
=>
{
return
new
Promise
((
reslove
,
reject
)
=>
{
api
=
APIPrefix
+
api
api
=
APIPrefix
+
api
uni
.
uploadFile
({
uni
.
uploadFile
({
...
@@ -31,6 +33,8 @@ let uploadFile = async (api, filePath, fileType, header = {}) => {
...
@@ -31,6 +33,8 @@ let uploadFile = async (api, filePath, fileType, header = {}) => {
header
,
header
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
uni
.
hideLoading
()
uni
.
hideLoading
()
console
.
log
(
'22==============='
)
console
.
log
(
res
.
header
)
if
(
res
.
data
.
reCode
==
401
||
res
.
data
.
reCode
==
-
1
)
{
if
(
res
.
data
.
reCode
==
401
||
res
.
data
.
reCode
==
-
1
)
{
let
app
=
getApp
()
let
app
=
getApp
()
uni
.
showToast
({
uni
.
showToast
({
...
...
subpkg/abnormalEvent/abnormalEvent.vue
View file @
eba987bb
...
@@ -279,27 +279,34 @@
...
@@ -279,27 +279,34 @@
})
})
return
;
return
;
}
}
this
.
formData
.
occur_time
=
this
.
formatDate
(
this
.
formData
.
occur_time
)
if
(
this
.
formData
.
occur_time
){
var
baseData
=
{
this
.
formData
.
occur_time
=
this
.
formatDate
(
this
.
formData
.
occur_time
)
"aux"
:
{
"rows"
:
rows
,
"addEvent"
:
this
.
formData
,
"costList"
:
this
.
tableData
,
},
}
}
const
imgInstance
=
this
.
$refs
.
myUploadImg
//获取图片上传实例
//新增异常操作
imgInstance
.
uploadImage
(
images
=>
{
saveAppAbnormalEvent
(
baseData
).
then
(
res
=>
{
this
.
formData
.
abnormal_file
=
images
;
if
(
res
.
data
.
data
.
messageType
===
'success'
)
{
var
baseData
=
{
uni
.
showToast
({
"aux"
:
{
title
:
'操作成功!'
,
"rows"
:
rows
,
duration
:
1000
"addEvent"
:
this
.
formData
,
})
"costList"
:
this
.
tableData
,
setTimeout
(()
=>
{
},
uni
.
navigateBack
()
},
1500
)
}
}
//新增异常操作
saveAppAbnormalEvent
(
baseData
).
then
(
res
=>
{
if
(
res
.
data
.
data
.
messageType
===
'success'
)
{
uni
.
showToast
({
title
:
'操作成功!'
,
duration
:
1000
})
setTimeout
(()
=>
{
uni
.
navigateBack
()
},
1500
)
}
})
})
})
},
},
...
...
subpkg/abnormalEventDetail/abnormalEventDetail.vue
View file @
eba987bb
...
@@ -91,7 +91,7 @@
...
@@ -91,7 +91,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getAbnormaCostBaseAll
,
import
{
getAbnormaCostBaseAll
,
downloadImg
,
findFileName
,
getCurrencyAll
}
from
'../../api/apiList.js'
getCurrencyAll
}
from
'../../api/apiList.js'
export
default
{
export
default
{
name
:
'abnormalEventDetail'
,
name
:
'abnormalEventDetail'
,
...
@@ -140,6 +140,7 @@
...
@@ -140,6 +140,7 @@
ficationViewEnums
:
{
'cost_classification'
:
""
},
ficationViewEnums
:
{
'cost_classification'
:
""
},
rateViewEnums
:
{
'rate_item'
:
""
},
rateViewEnums
:
{
'rate_item'
:
""
},
currencyViewEnums
:
{
'currency'
:
""
},
currencyViewEnums
:
{
'currency'
:
""
},
imgs
:[],
}
}
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
...
@@ -290,9 +291,7 @@
...
@@ -290,9 +291,7 @@
const
imgInstance
=
this
.
$refs
.
myUploadImg
//获取图片上传实例
const
imgInstance
=
this
.
$refs
.
myUploadImg
//获取图片上传实例
const
remarkInstance
=
this
.
$refs
.
myRemark
;
//备注
const
remarkInstance
=
this
.
$refs
.
myRemark
;
//备注
this
.
formData
.
remark
=
remarkInstance
.
value
;
this
.
formData
.
remark
=
remarkInstance
.
value
;
imgInstance
.
uploadImage
(
images
=>
{
})
const
allData
=
getApp
().
globalData
.
all
;
//所有的明细
const
allData
=
getApp
().
globalData
.
all
;
//所有的明细
var
totle
=
0
;
var
totle
=
0
;
if
(
allData
.
length
>
0
){
if
(
allData
.
length
>
0
){
...
@@ -347,7 +346,11 @@
...
@@ -347,7 +346,11 @@
}
else
if
(
cost
==
'difference'
){
}
else
if
(
cost
==
'difference'
){
this
.
formData
.
cost_classification_label
=
'补差费用'
this
.
formData
.
cost_classification_label
=
'补差费用'
}
}
getApp
().
globalData
.
tableData
=
this
.
formData
;
imgInstance
.
uploadImage
(
images
=>
{
this
.
formData
.
files
=
images
;
getApp
().
globalData
.
tableData
=
this
.
formData
;
})
setTimeout
(()
=>
{
setTimeout
(()
=>
{
uni
.
navigateBack
()
uni
.
navigateBack
()
},
1500
)
},
1500
)
...
@@ -410,6 +413,34 @@
...
@@ -410,6 +413,34 @@
}
}
this
.
showPopup
=
!
this
.
showPopup
this
.
showPopup
=
!
this
.
showPopup
},
},
//文件预览Demo
async
onPreviewFile
(
datas
){
const
_this
=
this
const
aa
=
[
'940507a5acc6ed1771b8f411d749d20586f96ac6.pdf'
,
]
console
.
log
(
'111================='
)
console
.
log
(
aa
)
console
.
log
(
datas
)
uni
.
showLoading
({
title
:
'下载中'
,
})
let
files
=
[]
//文件列表
console
.
log
(
'2333----------------'
)
for
(
let
file
of
datas
)
{
console
.
log
(
file
)
const
res
=
await
findFileName
(
file
)
//获取文件名,小程序可通过DownloadFile接口所返回res直接获取,无需额外调用
// const oldFileName = res.header["Content-Disposition"].split("=")[1]; //解析文件名, 注意["Content-Disposition"]大小写
// const fileName = decodeURIComponent(oldFileName.split("UTF-8''")[1])//解码&解码类型
const
fileType
=
file
.
split
(
'.'
)[
1
]
//截取文件名后缀,获取文件类型
files
.
push
({
fileId
:
file
,
filePath
,
fileName
:
'test'
,
fileType
})
}
uni
.
hideLoading
()
uni
.
navigateTo
({
url
:
`/subpkg/previewFile/previewFile?files=
${
JSON
.
stringify
(
files
)}
`
,
})
},
}
}
}
}
</
script
>
</
script
>
...
...
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