Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
csbr-daop
/
fe-data-trusted-space
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
ed2390a1
authored
2026-03-18 13:58:15 +0800
by
lihua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
支持文件资源下载的使用控制
1 parent
f93ef1cd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
10 deletions
src/api/modules/dataDelivery.ts
src/views/data_asset/registerCatalogDetail.vue
src/api/modules/dataDelivery.ts
View file @
ed2390a
...
...
@@ -60,6 +60,12 @@ export const downloadTableData = (params) => request({
responseType
:
'blob'
});
/** 下载文件前的检查 */
export
const
downloadFileCheck
=
(
params
)
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_DIGITAL_CONTRACT_URL
}
/contract-use/download-file?userGuid=
${
params
.
userGuid
}
&fileName=
${
params
.
fileName
}
`
,
method
:
'get'
});
/** 下载数据前的检查 */
export
const
downloadTableDataCheck
=
(
params
)
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_DIGITAL_CONTRACT_URL
}
/contract-use/download-check?userGuid=
${
params
.
userGuid
}
&subjectGuid=
${
params
.
subjectGuid
}
`
,
...
...
src/views/data_asset/registerCatalogDetail.vue
View file @
ed2390a
...
...
@@ -32,7 +32,8 @@ import { TableColumnWidth } from '@/utils/enum';
import
{
downloadTableData
,
downloadTableDataCheck
,
getContractStrategy
getContractStrategy
,
downloadFileCheck
}
from
"@/api/modules/dataDelivery"
;
import
StrategyTable
from
'../data_smart_contract/components/strategyTable.vue'
;
import
{
getDownFileSignByUrl
,
obsDownloadRequest
,
parseAndDecodeUrl
}
from
'@/api/modules/obsService'
;
...
...
@@ -477,6 +478,24 @@ const handleTableViewData = (scope) => {
});
}
/** 下载文件资源 */
const
downloadFile
=
(
productDetailItem
)
=>
{
if
(
foundMode
.
value
==
'1'
)
{
onUploadFileDownload
(
productDetailItem
);
}
else
{
// 使用次数需要先调用
downloadFileCheck
({
userGuid
:
route
.
query
.
useGuid
,
fileName
:
productDetailItem
}).
then
((
res
:
any
)
=>
{
if
(
res
?.
code
==
proxy
.
$passCode
)
{
onUploadFileDownload
(
productDetailItem
);
}
else
{
ElMessage
.
error
(
res
?.
msg
||
'下载失败'
);
}
});
}
}
/** 下载数据 */
const
handleTableViewDataDown
=
async
(
scope
)
=>
{
if
(
foundMode
.
value
==
'download'
||
foundMode
.
value
==
'readAndDown'
)
{
...
...
@@ -1490,15 +1509,8 @@ const respParamsTableInfo = ref({
</
template
>
<div
class=
"file-name"
><ellipsis-tooltip
:content=
"productDetailItem.name ?? ''"
class-name=
"w100f"
refName=
"tooltipOver"
></ellipsis-tooltip></div>
<div
v-if=
"['pdf', 'png', 'jpg', 'jpeg'].includes(productDetailItem.name?.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase())"
:style=
"{ right: '36px' }"
class=
"file-preview"
@
click=
"onUploadFilePreview(productDetailItem)"
>
查看
</div>
<div
:style=
"{ right: '0px' }"
class=
"file-preview"
@
click=
"onUploadFileDownload(productDetailItem)"
>
下载
</div>
<div
:style=
"{ right: '0px' }"
class=
"file-preview"
v-if=
"foundMode == 'download' || foundMode == 'readAndDown' || (!detailInfo.nodeId && foundMode == '1')"
@
click=
"downloadFile"
>
下载
</div>
</div>
</span>
</span>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment