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
9fbe3018
authored
2026-04-10 17:45:14 +0800
by
lihua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加数据产品下载源文件
1 parent
e8f7d2ee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
217 additions
and
60 deletions
src/api/modules/dataDelivery.ts
src/views/data_asset/registerCatalogCreate.vue
src/views/data_asset/registerCatalogDetail.vue
src/api/modules/dataDelivery.ts
View file @
9fbe301
...
...
@@ -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/registerCatalogCreate.vue
View file @
9fbe301
...
...
@@ -444,6 +444,34 @@ const baseInfoFormItems = ref([
filterable
:
true
,
required
:
false
,
//非必填,只能选择跟领域匹配的逻辑空间
clearable
:
true
,
},
{
label
:
'是否文件资源'
,
type
:
'radio-group'
,
placeholder
:
''
,
field
:
'isFileResource'
,
block
:
false
,
disabled
:
false
,
default
:
'N'
,
options
:
[{
value
:
'Y'
,
label
:
'是'
},
{
value
:
'N'
,
label
:
'否'
}],
required
:
true
,
},
{
label
:
'选择文件上传'
,
tip
:
''
,
type
:
'upload-file'
,
accept
:
''
,
required
:
true
,
default
:
[],
block
:
false
,
field
:
'attachments'
,
col
:
'col2'
,
visible
:
false
,
},
{
label
:
'资源描述'
,
...
...
@@ -516,7 +544,16 @@ const baseInfoFormRules = ref({
domain
:
[
required
(
'请选择领域'
)],
scenario
:
[
required
(
'请选择应用场景'
)],
medDepartmentCode
:
[
required
(
'请选择所属科室'
)],
updateFrequency
:
[
required
(
'请选择更新频率'
)]
updateFrequency
:
[
required
(
'请选择更新频率'
)],
attachments
:
[{
validator
:
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
if
(
!
value
?.
length
)
{
callback
(
new
Error
(
'请上传文件'
))
}
else
{
callback
();
}
},
trigger
:
'change'
}]
});
const
getTableFieldPromise
:
any
=
ref
({});
...
...
@@ -685,6 +722,9 @@ const setFormItems = (val) => {
item
.
visible
=
val
[
'domain'
]
==
'003'
}
else
if
(
item
.
field
==
'subjectDomain'
)
{
item
.
visible
=
val
[
'domain'
]
==
'004'
;
}
else
if
(
item
.
field
==
'attachments'
)
{
item
.
visible
=
val
[
'isFileResource'
]
==
'Y'
;
item
.
default
=
val
[
item
.
field
]
||
[];
}
});
}
...
...
@@ -716,6 +756,12 @@ const handleBaseInfoCheckboxChange = (val, info) => {
setFormItems
(
info
);
}
const
handleBaseInfoRadioChange
=
(
val
,
info
,
item
)
=>
{
if
(
item
.
field
==
'isFileResource'
)
{
setFormItems
(
info
);
}
}
/** ------------------- 添加选择数据服务API表格,多选 ---------------------------- */
const
productTableRef
=
ref
();
const
productData
:
any
=
ref
([]);
...
...
@@ -922,6 +968,11 @@ onBeforeMount(() => {
item
.
options
=
domainDictList
.
value
.
find
(
s
=>
s
.
value
==
detailInfo
.
value
[
'domain'
])?.
childDictList
||
[]
}
else
if
(
item
.
field
==
'medDepartmentCode'
)
{
item
.
visible
=
detailInfo
.
value
[
'domain'
]
==
'003'
}
else
if
(
item
.
field
==
'isFileResource'
)
{
item
.
default
=
detailInfo
.
value
.
attachments
?.
length
?
'Y'
:
'N'
;
}
else
if
(
item
.
field
==
'attachments'
)
{
item
.
default
=
detailInfo
.
value
.
attachments
||
[];
item
.
visible
=
item
.
default
.
length
>
0
;
}
if
(
item
.
field
==
'isCache'
||
item
.
field
==
'isEncrypField'
)
{
item
.
disabled
=
true
;
...
...
@@ -1081,40 +1132,48 @@ const save = () => {
baseInfoFormRef
.
value
?.
ruleFormRef
?.
validate
((
valid
,
errorItem
)
=>
{
if
(
valid
)
{
let
params
=
{
...
baseInfoFormRef
.
value
.
formInline
};
let
associationApiList
:
string
[]
=
[];
for
(
const
api
of
productData
.
value
)
{
if
(
!
api
.
apiGuid
)
{
proxy
.
$ElMessage
.
error
(
'服务包信息未填写完整'
);
expandServiceInfo
.
value
=
true
;
return
;
if
(
params
.
isFileResource
!=
'Y'
)
{
let
associationApiList
:
string
[]
=
[];
for
(
const
api
of
productData
.
value
)
{
if
(
!
api
.
apiGuid
)
{
proxy
.
$ElMessage
.
error
(
'服务包信息未填写完整'
);
expandServiceInfo
.
value
=
true
;
return
;
}
associationApiList
.
push
(
api
.
apiGuid
);
}
associationApiList
.
push
(
api
.
apiGuid
);
}
params
.
associationApi
=
associationApiList
;
/** 只有数据集和api类型时,目录表必填。 */
if
((
params
.
damType
==
'1'
)
&&
route
.
query
.
foundMode
!=
'2'
)
{
// if (!params.databaseType) {
// proxy.$ElMessage.error('资源类型为数据集时,数据库类型必填');
// baseInfoExpand.value = true;
// return;
// }
if
(
!
assetDataTableInfo
.
value
.
data
?.
length
)
{
proxy
.
$ElMessage
.
error
(
'资源类型为数据集时,必需添加资源表'
);
assetTableInfoExpand
.
value
=
true
;
nextTick
(()
=>
{
setTimeout
(()
=>
{
handleContentWrapView
(
'tableInfo'
);
},
500
)
});
return
;
params
.
associationApi
=
associationApiList
;
/** 只有数据集和api类型时,目录表必填。 */
if
((
params
.
damType
==
'1'
)
&&
route
.
query
.
foundMode
!=
'2'
)
{
// if (!params.databaseType) {
// proxy.$ElMessage.error('资源类型为数据集时,数据库类型必填');
// baseInfoExpand.value = true;
// return;
// }
if
(
!
assetDataTableInfo
.
value
.
data
?.
length
)
{
proxy
.
$ElMessage
.
error
(
'资源类型为数据集时,必需添加资源表'
);
assetTableInfoExpand
.
value
=
true
;
nextTick
(()
=>
{
setTimeout
(()
=>
{
handleContentWrapView
(
'tableInfo'
);
},
500
)
});
return
;
}
}
}
if
(
params
.
damType
==
'2'
&&
route
.
query
.
foundMode
!=
'2'
)
{
if
(
!
associationApiList
?.
length
)
{
proxy
.
$ElMessage
.
error
(
'资源类型为数据接口时,服务包不能为空'
)
;
return
;
if
(
params
.
damType
==
'2'
&&
route
.
query
.
foundMode
!=
'2'
)
{
if
(
!
associationApiList
?.
length
)
{
proxy
.
$ElMessage
.
error
(
'资源类型为数据接口时,服务包不能为空'
);
return
;
}
}
}
params
.
attachments
=
params
.
attachments
?.
map
(
item
=>
{
return
{
name
:
item
.
name
,
url
:
item
.
url
}
})
||
[];
if
(
params
.
coverageArea
==
'all'
)
{
params
.
coverageArea
=
[[
'all'
]];
}
else
if
(
!
params
.
coverageArea
)
{
...
...
@@ -1287,9 +1346,9 @@ const handleImportSave = (val) => {
<ContentWrap
id=
"id-baseInfo"
title=
"资源基本信息"
description=
""
:isExpand=
"baseInfoExpand"
:expand-swicth=
"true"
class=
"mb16"
@
expand=
"(v) => baseInfoExpand = v"
>
<Form
ref=
"baseInfoFormRef"
:itemList=
"baseInfoFormItems"
formId=
"base-info-form"
:rules=
"baseInfoFormRules"
@
selectChange=
"baseSelectChange"
@
checkboxChange=
"handleBaseInfoCheckboxChange"
col=
"col3"
/>
@
selectChange=
"baseSelectChange"
@
checkboxChange=
"handleBaseInfoCheckboxChange"
@
radio-group-change=
"handleBaseInfoRadioChange"
col=
"col3"
/>
</ContentWrap>
<ContentWrap
v-if=
"baseInfoFormRef?.formInline?.damType == '2'"
id=
"product-info"
title=
"服务包信息"
expandSwicth
<ContentWrap
v-if=
"baseInfoFormRef?.formInline?.damType == '2'
&& baseInfoFormRef?.formInline?.isFileResource != 'Y'
"
id=
"product-info"
title=
"服务包信息"
expandSwicth
style=
"margin-top: 15px"
:isExpand=
"expandServiceInfo"
@
expand=
"(v) => (expandServiceInfo = v)"
description=
""
class=
"mb16"
>
<Table
ref=
"productTableRef"
:tableInfo=
"productTableInfo"
class=
"fiveRow-table"
...
...
@@ -1299,7 +1358,7 @@ const handleImportSave = (val) => {
v-preReClick
>
添加服务
</el-button>
</div>
</ContentWrap>
<ContentWrap
v-if=
"baseInfoFormRef?.formInline?.damType != '2'"
id=
"id-tableInfo"
title=
"资源表"
description=
""
<ContentWrap
v-if=
"baseInfoFormRef?.formInline?.damType != '2'
&& baseInfoFormRef?.formInline?.isFileResource != 'Y'
"
id=
"id-tableInfo"
title=
"资源表"
description=
""
:expand-swicth=
"true"
:isExpand=
"assetTableInfoExpand"
@
expand=
"(v) => assetTableInfoExpand = v"
>
<div
v-show=
"assetDataTableInfo.data.length"
class=
"tools_btns"
>
<el-button
type=
"primary"
@
click=
"handleCreateTable"
v-preReClick
>
添加
</el-button>
...
...
src/views/data_asset/registerCatalogDetail.vue
View file @
9fbe301
...
...
@@ -32,9 +32,11 @@ 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'
;
const
router
=
useRouter
();
const
route
=
useRoute
();
...
...
@@ -476,27 +478,63 @@ const handleTableViewData = (scope) => {
});
}
/** 下载文件资源 */
const
downloadFile
=
(
productDetailItem
)
=>
{
if
(
foundMode
.
value
==
'1'
)
{
onUploadFileDownload
(
productDetailItem
);
}
else
{
// 使用次数需要先调用
downloadFileCheck
({
userGuid
:
route
.
query
.
useGuid
,
fileName
:
productDetailItem
.
name
}).
then
((
res
:
any
)
=>
{
if
(
res
?.
code
==
proxy
.
$passCode
)
{
onUploadFileDownload
(
productDetailItem
);
}
else
{
ElMessage
.
error
(
res
?.
msg
||
'下载失败'
);
}
});
}
}
/** 下载数据 */
const
handleTableViewDataDown
=
(
scope
)
=>
{
downloadTableDataCheck
({
userGuid
:
route
.
query
.
useGuid
,
subjectGuid
:
scope
.
row
.
guid
}).
then
((
res
:
any
)
=>
{
if
(
res
?.
code
==
proxy
.
$passCode
)
{
downloadTableData
({
userGuid
:
route
.
query
.
useGuid
,
subjectGuid
:
scope
.
row
.
guid
}).
then
((
res
:
any
)
=>
{
if
(
res
&&
!
res
.
msg
)
{
download
(
res
,
`
${
scope
.
row
.
tableChName
}
.xlsx`
,
'excel'
);
}
else
{
res
?.
msg
&&
ElMessage
.
error
(
res
?.
msg
);
}
})
}
else
{
ElMessage
.
error
(
res
?.
msg
||
'下载失败'
);
const
handleTableViewDataDown
=
async
(
scope
)
=>
{
if
(
foundMode
.
value
==
'download'
||
foundMode
.
value
==
'readAndDown'
)
{
downloadTableDataCheck
({
userGuid
:
route
.
query
.
useGuid
,
subjectGuid
:
scope
.
row
.
guid
}).
then
((
res
:
any
)
=>
{
if
(
res
?.
code
==
proxy
.
$passCode
)
{
downloadTableData
({
userGuid
:
route
.
query
.
useGuid
,
subjectGuid
:
scope
.
row
.
guid
}).
then
((
res
:
any
)
=>
{
if
(
res
&&
!
res
.
msg
)
{
download
(
res
,
`
${
scope
.
row
.
tableChName
}
.xlsx`
,
'excel'
);
}
else
{
res
?.
msg
&&
ElMessage
.
error
(
res
?.
msg
);
}
})
}
else
{
ElMessage
.
error
(
res
?.
msg
||
'下载失败'
);
}
})
}
else
if
(
foundMode
.
value
==
'1'
)
{
//下载源文件
let
fileUrl
=
scope
.
row
.
fileUrl
;
const
refSignInfo
:
any
=
await
getDownFileSignByUrl
(
parseAndDecodeUrl
(
fileUrl
).
fileName
);
if
(
!
refSignInfo
?.
data
)
{
refSignInfo
?.
msg
&&
ElMessage
.
error
(
refSignInfo
?.
msg
);
return
;
}
})
obsDownloadRequest
(
refSignInfo
?.
data
).
then
((
res
:
any
)
=>
{
if
(
res
&&
!
res
.
msg
)
{
let
name
=
scope
.
row
.
fileName
;
var
fileSuffix
=
name
?
name
.
substring
(
name
.
lastIndexOf
(
'.'
)
+
1
)
:
''
;
download
(
res
,
name
,
fileSuffix
);
}
else
{
res
?.
msg
&&
ElMessage
.
error
(
res
?.
msg
);
}
})
}
}
const
toolBtns
:
any
=
computed
(()
=>
{
...
...
@@ -1429,7 +1467,7 @@ const respParamsTableInfo = ref({
</div>
</div>
</ContentWrap>
<ContentWrap
v-if=
"productTableInfo.data?.length"
id=
"product-info"
title=
"服务包信息"
style=
"margin: 16px 16px 16px"
>
<ContentWrap
v-if=
"productTableInfo.data?.length
&& !detailInfo.attachments?.length
"
id=
"product-info"
title=
"服务包信息"
style=
"margin: 16px 16px 16px"
>
<Table
ref=
"productTableRef"
:tableInfo=
"productTableInfo"
/>
</ContentWrap>
<ContentWrap
v-if=
"isJSZQ"
id=
"id-paramsInfo"
title=
"入参出参信息"
description=
""
style=
"margin: 16px 16px 16px"
>
...
...
@@ -1442,7 +1480,57 @@ const respParamsTableInfo = ref({
</el-tab-pane>
</el-tabs>
</ContentWrap>
<ContentWrap
id=
"id-table"
title=
"资源表"
v-if=
"detailInfo.damCatalogTableInfo?.length"
description=
""
<ContentWrap
id=
"id-table"
title=
"文件资源"
v-if=
"detailInfo.attachments?.length"
description=
""
style=
"margin: 16px 16px 16px"
>
<div
class=
"list_panel"
>
<div
class=
"list_item is_block"
>
<div
class=
"file_item"
>
<span
class=
"item_label"
>
上传文件:
</span>
<span
class=
"item_value"
>
<span
v-for=
"productDetailItem in (detailInfo.attachments || [])"
:style=
"{ 'padding-left': '0px', height: '32px', display: 'block' }"
>
<div
class=
"file-operate"
>
<
template
v-if=
"productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'xls' || productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'xlsx' || productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'csv'"
>
<img
class=
"file-img"
src=
"../../assets/images/excel.png"
/>
</
template
>
<
template
v-else-if=
"productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'doc' || productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'docx'"
>
<img
class=
"file-img"
src=
"../../assets/images/word.png"
/>
</
template
>
<
template
v-else-if=
"productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'zip'"
>
<img
class=
"file-img"
src=
"../../assets/images/zip.png"
/>
</
template
>
<
template
v-else-if=
"productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'rar'"
>
<img
class=
"file-img"
src=
"../../assets/images/RAR.png"
/>
</
template
>
<
template
v-else-if=
"productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'pdf'"
>
<img
class=
"file-img"
src=
"../../assets/images/PDF.png"
/>
</
template
>
<
template
v-else-if=
"productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'png'"
>
<img
class=
"file-img"
src=
"../../assets/images/png.png"
/>
</
template
>
<
template
v-else-if=
"productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'jpg' || productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'jpeg'"
>
<img
class=
"file-img"
src=
"../../assets/images/jpg.png"
/>
</
template
>
<div
class=
"file-name"
><ellipsis-tooltip
:content=
"productDetailItem.name ?? ''"
class-name=
"w100f"
refName=
"tooltipOver"
></ellipsis-tooltip></div>
<!-- <div
v-if="foundMode != 'download' && ['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"
v-if=
"foundMode == 'download' || foundMode == 'readAndDown' || foundMode == '1'"
@
click=
"downloadFile(productDetailItem)"
>
下载
</div>
</div>
</span>
</span>
</div>
</div>
</div>
</ContentWrap>
<ContentWrap
id=
"id-table"
title=
"资源表"
v-if=
"detailInfo.damCatalogTableInfo?.length && !detailInfo.attachments?.length"
description=
""
style=
"margin: 16px 16px 16px"
>
<el-table
v-show=
"!fullscreenLoading"
ref=
"tableRef"
:data=
"detailInfo.damCatalogTableInfo"
:highlight-current-row=
"true"
stripe
border
@
expand-change=
"handleTableExpandChange"
max-height=
"350"
...
...
@@ -1528,13 +1616,14 @@ const respParamsTableInfo = ref({
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
v-if=
"!detailInfo.nodeId || foundMode == 'download' || foundMode == 'read' || foundMode == 'readAndDown'"
:width=
"
foundMode == 'readAndDown'
? '220px' : '140px'"
align=
"left"
fixed=
"right"
show-overflow-tooltip
>
:width=
"
(foundMode == 'readAndDown' || foundMode == '1')
? '220px' : '140px'"
align=
"left"
fixed=
"right"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
<!-- 如果是下载,就只显示下载,如果是查看和下载就都显示,就两个按钮都显示。仅查看,就仅查看 -->
<span
v-show=
"foundMode != 'download'"
class=
"text_btn"
@
click=
"handleTableViewData(scope)"
>
查看样例数据
</span>
<el-divider
v-show=
"foundMode == 'readAndDown'"
direction=
"vertical"
/>
<el-divider
v-show=
"foundMode == 'readAndDown'
|| foundMode == '1'
"
direction=
"vertical"
/>
<span
v-show=
"foundMode == 'download' || foundMode == 'readAndDown'"
class=
"text_btn"
@
click=
"handleTableViewDataDown(scope)"
>
下载数据
</span>
<span
v-show=
"foundMode == '1'"
class=
"text_btn"
@
click=
"handleTableViewDataDown(scope)"
>
下载
</span>
</
template
>
</el-table-column>
</el-table>
...
...
@@ -1579,8 +1668,7 @@ const respParamsTableInfo = ref({
<img
class=
"file-img"
src=
"../../assets/images/jpg.png"
/>
</
template
>
<div
class=
"file-name"
>
{{ item.name }}
</div>
<div
:style=
"{ right: '36px' }"
v-if=
"item.name.substring(item.name.lastIndexOf('.') + 1) == 'pdf' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'png' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'jpg' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'jpeg'"
<div
:style=
"{ right: '36px' }"
v-if=
"item.name.substring(item.name.lastIndexOf('.') + 1) == 'pdf' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'png' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'jpg' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'jpeg'"
class=
"file-preview"
@
click=
"onUploadFilePreview(item)"
>
查看
</div>
<div
:style=
"{ right: '0px' }"
class=
"file-preview"
@
click=
"onUploadFileDownload(item)"
>
下载
</div>
</div>
...
...
@@ -2135,6 +2223,10 @@ const respParamsTableInfo = ref({
}
}
.file_item
{
width
:
70%
;
}
.file-operate
{
display
:
flex
;
align-items
:
center
;
...
...
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