Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TF-MOM-WEB
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
TFMOM
TF-MOM-WEB
Commits
28e60feb
Commit
28e60feb
authored
Oct 18, 2023
by
jingnan
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
履历本附件修改
parent
94b7ef88
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
152 additions
and
46 deletions
+152
-46
file.js
applications/dee-mes/src/api/file.js
+39
-0
index.vue
...ivateComponents/components/BiographicDataUpload/index.vue
+113
-46
No files found.
applications/dee-mes/src/api/file.js
0 → 100644
View file @
28e60feb
import
{
get
,
post
,
del
,
downloadFile
}
from
'../utils/http'
// 文件下载
export
function
downPdf
(
params
)
{
return
get
(
'/dfs/fileManager/downloadCipher'
,
params
,
true
)
}
// 分片上传准备
export
function
uploadPartPrepare
(
params
)
{
return
post
(
`/dfs/fileManager/uploadPartPrepare`
,
params
,
true
)
}
// 获取存储库id
export
function
getBucketByAppID
(
params
)
{
return
get
(
'/RepoBucket/getBucketByAppID'
,
params
)
}
// 文件下载
export
function
downloadFileById
(
id
)
{
return
get
(
`/dfs/fileManager/download?fileId=
${
id
}
`
,
null
,
true
)
}
// 查询所有上传记录
export
function
getUploadRecord
(
params
)
{
// return post('/RepoFileUpload/find/recursion', params)
return
post
(
'/RepoFileUpload/findWithCondition'
,
params
)
}
// 删除上传文件
export
function
delUploadFileOrRecord
(
id
)
{
return
del
(
`/RepoFileUpload/
${
id
}
`
)
}
// 修改文件状态
export
function
changeFileStatusByUploadId
(
status
,
uploadId
)
{
return
post
(
`/dfs/fileManager/changeFileStatusByUploadId?status=
${
status
}
&uploadId=
${
uploadId
}
`
,
null
,
true
)
}
// 下载文件
export
function
downFileByFileId
(
objName
,
objId
,
linkId
)
{
return
downloadFile
(
`/dfs/fileManager/downloadio?objName=
${
objName
}
&objId=
${
objId
}
&linkId=
${
linkId
}
`
)
}
export
function
downFileUseFileId
(
fileId
)
{
return
downloadFile
(
`/dfs/fileManager/downloadio?fileId=
${
fileId
}
`
)
}
applications/dee-mes/src/privateComponents/components/BiographicDataUpload/index.vue
View file @
28e60feb
<
template
>
<div
v-dee-loading=
"loading"
class=
"BiographicDataUpload"
>
<div
class=
"BiographicDataUpload"
>
<dee-tools
slot=
"header"
:tools=
"tools"
mode=
"normal"
:collapse=
"false"
/>
<div
class=
"dee-table dee-table-dis-border"
>
<el-table
...
...
@@ -13,7 +13,7 @@
/>
<el-table-column
prop=
"contentType"
label=
"附件类型"
>
<template
slot-scope=
"scope"
>
<el-select
v-if=
"showBtns"
v-model=
"scope.row.contentType"
placeholder=
"请选择"
>
<el-select
v-if=
"
!scope.row.id&&
showBtns"
v-model=
"scope.row.contentType"
placeholder=
"请选择"
>
<el-option
v-for=
"i in contentTypeOptions"
:key=
"i.value"
...
...
@@ -24,10 +24,20 @@
<span
v-else
>
{{
scope
.
row
.
contentType
}}
</span>
</
template
>
</el-table-column>
<el-table-column
prop=
"fileName"
label=
"文件名"
/>
<el-table-column
prop=
"fileName"
label=
"上传附件"
>
<el-table-column
prop=
"fileName"
label=
"文件名"
>
<
template
slot-scope=
"scope"
>
<div
class=
"importTemp-com"
>
<span
class=
"link"
@
click=
"(val)=>
{
loadFile(scope.row)
}"
>
{{
scope
.
row
.
fileName
}}
</span>
</
template
>
</el-table-column>
<el-table-column
prop=
"uoloadfileName"
label=
"上传附件"
>
<
template
slot-scope=
"scope"
>
<div
v-if=
"!scope.row.id&&showBtns"
class=
"importTemp-com"
>
<el-upload
ref=
"upload"
class=
"upload-demo"
...
...
@@ -71,6 +81,7 @@
<
script
>
import
{
post
}
from
'@/utils/http'
import
{
downFileByFileId
}
from
'@/api/file'
export
default
{
name
:
'BiographicDataUpload'
,
componentName
:
'履历本上传附件'
,
...
...
@@ -85,7 +96,6 @@ export default {
loading
:
false
,
showBtns
:
false
,
tableData
:
[],
contentTypeOptions
:
[],
tools
:
[{
name
:
'新增'
,
icon
:
'/icons/c-add.png'
,
...
...
@@ -107,20 +117,28 @@ export default {
}
}],
extension
:
[],
options
:
[],
currentSelection
:
[]
}
},
computed
:
{
contentTypeOptions
()
{
if
(
this
.
basicData
.
subTypeName
===
'BiographicData'
)
{
return
this
.
options
.
filter
(
item
=>
item
.
value
!==
'AirworthinessLabelOrCertificate'
)
}
else
if
(
this
.
basicData
.
subTypeName
===
'ProductCertificate'
)
{
return
this
.
options
.
filter
(
item
=>
item
.
value
===
'briefTechnicalPerformance'
||
item
.
value
===
'acceptanceCertificate'
||
item
.
value
===
'match'
||
item
.
value
===
'lifeAndReliability'
)
}
else
{
return
this
.
options
.
filter
(
item
=>
item
.
value
===
'AirworthinessLabelOrCertificate'
)
}
}
},
watch
:
{
basicData
:
{
'basicData.id'
:
{
immediate
:
true
,
deep
:
true
,
handler
(
val
)
{
if
(
val
&&
val
.
subTypeName
)
{
this
.
getDicData
()
}
if
(
val
&&
val
.
objFileLinks
)
{
if
(
val
)
{
this
.
$nextTick
(()
=>
{
this
.
getTableData
()
})
...
...
@@ -129,36 +147,65 @@ export default {
}
},
created
()
{
this
.
getDicData
()
},
mounted
()
{
},
methods
:
{
getDicData
()
{
this
.
$utils
.
getDicListByCode
(
'resumeBookConentType'
).
then
(
res
=>
{
if
(
this
.
basicData
.
subTypeName
===
'BiographicData'
)
{
this
.
contentTypeOptions
=
res
.
filter
(
item
=>
item
.
value
!==
'AirworthinessLabelOrCertificate'
)
}
else
if
(
this
.
basicData
.
subTypeName
===
'ProductCertificate'
)
{
this
.
contentTypeOptions
=
res
.
filter
(
item
=>
item
.
value
===
'briefTechnicalPerformance'
||
item
.
value
===
'acceptanceCertificate'
||
item
.
value
===
'match'
||
item
.
value
===
'lifeAndReliability'
)
}
else
{
this
.
contentTypeOptions
=
res
.
filter
(
item
=>
item
.
value
===
'AirworthinessLabelOrCertificate'
)
}
this
.
options
=
res
})
},
getTableData
()
{
const
params
=
{
'pageFrom'
:
1
,
'pageSize'
:
1
,
'searchItems'
:
{
'items'
:
[
{
'fieldName'
:
'id'
,
'operator'
:
'EQ'
,
'value'
:
this
.
basicData
.
id
}
]
},
'sortItem'
:
[
{
'fieldName'
:
'modifyTime'
,
'sortOrder'
:
'asc'
}
],
'openProps'
:
[
{
'name'
:
'objFileLinks'
,
'openProps'
:
[
{
'name'
:
'target'
}
]
}
]
}
this
.
loading
=
true
this
.
$api
.
searchApi
(
'BiographicData'
,
params
).
then
(
res
=>
{
this
.
tableData
=
[]
if
(
this
.
basicData
.
objFileLinks
.
length
)
{
this
.
basicData
.
objFileLinks
.
map
(
item
=>
{
if
(
res
.
items
&&
res
.
items
.
content
&&
res
.
items
.
content
[
0
]
&&
res
.
items
.
content
[
0
].
objFileLinks
)
{
res
.
items
.
content
[
0
]
.
objFileLinks
.
map
(
item
=>
{
if
(
item
.
target
&&
item
.
target
.
originalFileName
)
{
this
.
tableData
.
push
({
id
:
item
.
id
,
...
item
,
fileName
:
item
.
target
.
originalFileName
,
fileListRaw
:
item
,
contentType
:
this
.
$utils
.
getParamsFromLists
(
this
.
contentTypeOptions
,
'value'
,
item
.
contentType
,
'label'
)
contentType
:
this
.
$utils
.
getParamsFromLists
(
this
.
options
,
'value'
,
item
.
contentType
,
'label'
)
})
}
})
}
this
.
loading
=
false
}).
catch
(()
=>
{
this
.
loading
=
false
})
},
handleAdd
()
{
this
.
tableData
.
push
({
...
...
@@ -178,27 +225,29 @@ export default {
}
},
fileChange
(
fileList
,
scope
)
{
// console.log('scope: ', scope)
// console.log('fileList: ', fileList)
this
.
showBtns
=
true
this
.
$set
(
scope
.
row
,
'fileName'
,
fileList
.
name
)
this
.
$set
(
scope
.
row
,
'fileListRaw'
,
fileList
.
raw
)
},
submitUpload
()
{
const
flag
=
this
.
tableData
.
find
(
item
=>
!
item
.
fileName
||
!
item
.
contentType
)
if
(
flag
)
return
this
.
$utils
.
showMessageWarning
(
'请完成列表内数据的填写!'
)
this
.
loading
=
true
const
fileExtVOS
=
[]
const
fileExtVOS
=
[]
// 新增文件的名称和附件类型
const
objFileLinkIds
=
[]
// 已有的文件
const
formData
=
new
FormData
()
this
.
tableData
.
forEach
(
row
=>
{
if
(
!
row
.
id
)
{
formData
.
append
(
'multipartFiles'
,
row
.
fileListRaw
)
// 新增文件
fileExtVOS
.
push
({
'fileName'
:
row
.
fileName
,
'contentType'
:
row
.
contentType
})
if
(
row
.
fileListRaw
.
id
)
{
formData
.
append
(
'multipartFiles'
,
new
Blob
([
JSON
.
stringify
(
row
.
fileListRaw
)],
{
type
:
'application/json'
}))
}
else
{
formData
.
append
(
'multipartFiles'
,
row
.
fileListRaw
)
objFileLinkIds
.
push
(
row
.
id
)
}
})
formData
.
append
(
'objFileLinkIds'
,
new
Blob
([
JSON
.
stringify
(
objFileLinkIds
)],
{
type
:
'application/json'
}))
formData
.
append
(
'fileExtVOS'
,
new
Blob
([
JSON
.
stringify
(
fileExtVOS
)],
{
type
:
'application/json'
}))
post
(
`/BiographicData/uploadMultiFile/
${
this
.
basicData
.
id
}
`
,
formData
)
.
then
((
res
)
=>
{
...
...
@@ -208,16 +257,34 @@ export default {
})
this
.
loading
=
false
this
.
handleClose
()
this
.
$emit
(
'getList'
)
this
.
$emit
(
'uploadSuccess'
,
res
)
})
.
catch
((
res
)
=>
{
this
.
loading
=
false
this
.
$message
({
message
:
res
.
message
,
type
:
'error'
})
},
loadFile
(
val
)
{
downFileByFileId
(
val
.
sourceIdType
,
val
.
sourceId
,
val
.
id
).
then
(
res
=>
{
this
.
downLoadFileUrl
(
res
)
})
},
downLoadFileUrl
(
res
)
{
if
(
res
.
headers
[
'content-disposition'
])
{
const
fileName
=
decodeURI
(
res
.
headers
[
'content-disposition'
].
substring
(
res
.
headers
[
'content-disposition'
].
indexOf
(
'='
)
+
1
,
res
.
headers
[
'content-disposition'
].
length
))
const
url
=
window
.
URL
.
createObjectURL
(
new
Blob
([
res
.
data
],
{
type
:
res
.
headers
[
'content-type'
]
}))
this
.
$utils
.
downLoadFileUrl
(
url
,
decodeURI
(
fileName
))
}
else
{
if
(
res
.
data
instanceof
Blob
)
{
var
reader
=
new
FileReader
()
reader
.
addEventListener
(
'loadend'
,
()
=>
{
const
message
=
reader
.
result
&&
JSON
.
parse
(
reader
.
result
)
this
.
$utils
.
showMessageWarning
(
message
?
message
.
message
:
'数据包下载出错:未找到数据包内容的下载链接,请联系管理员排查问题!'
)
})
reader
.
readAsText
(
res
.
data
,
'utf-8'
)
}
else
{
const
message
=
res
.
data
&&
res
.
data
.
message
this
.
$utils
.
showMessageWarning
(
message
||
'数据包下载出错:未找到数据包内容的下载链接,请联系管理员排查问题!'
)
}
}
},
handleClose
()
{
this
.
showBtns
=
false
...
...
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