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
c888c64d
authored
2025-12-08 11:50:32 +0800
by
lihua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改查看数据的接口
1 parent
a3c5d001
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
6 deletions
src/api/modules/dataDelivery.ts
src/main.ts
src/store/modules/user.ts
src/utils/common.ts
src/utils/request.ts
src/views/data_asset/damTableDataView.vue
src/views/data_asset/dataUsage.vue
src/views/data_asset/registerCatalogDetail.vue
src/api/modules/dataDelivery.ts
View file @
c888c64
...
...
@@ -54,6 +54,12 @@ export const downloadTableData = (params) => request({
responseType
:
'blob'
});
/** 数据使用中查看资产表的数据 */
export
const
queryUseData
=
(
params
)
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_DIGITAL_CONTRACT_URL
}
/contract-use/read?userGuid=
${
params
.
userGuid
}
&subjectGuid=
${
params
.
subjectGuid
}
`
,
method
:
'get'
});
/** 分发连接器 */
export
const
distributeContract
=
(
params
)
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_DIGITAL_CONTRACT_URL
}
/contract-use/distribute`
,
...
...
src/main.ts
View file @
c888c64
...
...
@@ -7,7 +7,7 @@ import App from './App.vue'
import
router
from
'./router'
import
useSettingsStore
from
'./store/modules/settings'
;
import
{
ElMessage
}
from
"element-plus"
import
{
openMessageBox
}
from
"@/utils/common"
import
{
getPublicIP
,
openMessageBox
}
from
"@/utils/common"
// pinia设置
import
{
createPinia
}
from
'pinia'
...
...
@@ -40,3 +40,7 @@ app.config.globalProperties.$passCode = "00000";// 定义全局变量
app
.
config
.
globalProperties
.
$ElMessage
=
ElMessage
;
// 全局消息提示
app
.
config
.
globalProperties
.
$openMessageBox
=
openMessageBox
;
// 二次确认提示对话框。
app
.
mount
(
'#main-app'
)
getPublicIP
().
then
((
ip
)
=>
{
localStorage
.
setItem
(
'ipAddress'
,
ip
);
})
\ No newline at end of file
...
...
src/store/modules/user.ts
View file @
c888c64
...
...
@@ -36,7 +36,7 @@ const useUserStore = defineStore(
data
.
userType
=
2
;
// data.appKey = '691689d8e4b0f359c04d204a';
data
.
validateUri
=
location
.
origin
==
'http://localhost:9000'
?
'http://localhost:9000/'
:
location
.
origin
+
'/'
;
return
getTokenPromise
.
value
=
getTokenByCode
(
data
).
then
((
res
:
any
)
=>
{
return
getTokenPromise
.
value
=
getTokenByCode
(
data
).
then
(
async
(
res
:
any
)
=>
{
getTokenPromise
.
value
=
null
;
console
.
log
(
res
);
if
(
res
.
code
==
'00000'
)
{
...
...
src/utils/common.ts
View file @
c888c64
...
...
@@ -1207,3 +1207,22 @@ export const transferFlowLimit = (v, unit) => { //将时间统一转化为分钟
return
v
*
60
;
}
}
/** 获取当前用户的IP地址 */
export
const
getPublicIP
=
async
():
Promise
<
string
>
=>
{
try
{
// 方法1:使用 fetch
const
response
=
await
fetch
(
'https://api64.ipify.org?format=json'
)
const
data
=
await
response
.
json
()
return
data
.
ip
}
catch
(
error
)
{
try
{
// 方法2:备用 API
const
response
=
await
fetch
(
'https://api.ipify.org?format=json'
)
const
data
=
await
response
.
json
()
return
data
.
ip
}
catch
(
error2
)
{
throw
new
Error
(
'无法获取 IP 地址'
)
}
}
}
...
...
src/utils/request.ts
View file @
c888c64
...
...
@@ -39,6 +39,7 @@ service.interceptors.request.use(
"Content-Type"
:
"multipart/form-data"
,
});
config
.
headers
.
Authorization
=
localStorage
.
getItem
(
'token'
);
config
.
headers
[
'x-real-ip'
]
=
localStorage
.
getItem
(
'ipAddress'
);
return
config
;
}
if
(
config
.
method
==
"postjsond"
)
{
...
...
@@ -48,16 +49,19 @@ service.interceptors.request.use(
});
config
.
data
=
JSON
.
stringify
(
config
.
data
);
config
.
headers
.
Authorization
=
localStorage
.
getItem
(
'token'
);
config
.
headers
[
'x-real-ip'
]
=
localStorage
.
getItem
(
'ipAddress'
);
return
config
;
}
if
(
config
.
responseType
==
"blob"
)
{
// 文件流,文件名称相同时会判定同一个请求。
const
userStore
=
useUserStore
();
config
.
headers
.
Authorization
=
localStorage
.
getItem
(
'token'
);
config
.
headers
[
'x-real-ip'
]
=
localStorage
.
getItem
(
'ipAddress'
);
return
config
;
}
if
(
config
.
method
===
'obsuploadrequest'
)
{
config
.
method
=
'put'
;
config
.
headers
[
'x-real-ip'
]
=
localStorage
.
getItem
(
'ipAddress'
);
return
config
;
}
// /**
...
...
@@ -77,6 +81,7 @@ service.interceptors.request.use(
/** 若是门户的url,则不做重复请求处理,会出现不同标签页都需要查同一个字典参数列表的 */
if
(
config
.
url
.
indexOf
(
'/portal/portal'
))
{
config
.
headers
.
Authorization
=
localStorage
.
getItem
(
'token'
);
config
.
headers
[
'x-real-ip'
]
=
localStorage
.
getItem
(
'ipAddress'
);
return
config
;
}
/**
...
...
@@ -113,6 +118,7 @@ service.interceptors.request.use(
});
config
.
headers
.
Authorization
=
localStorage
.
getItem
(
'token'
);
config
.
headers
[
'x-real-ip'
]
=
localStorage
.
getItem
(
'ipAddress'
);
return
config
;
};
/** 若是刷新token的请求,则不需要等refreshToken完成。 */
...
...
src/views/data_asset/damTableDataView.vue
View file @
c888c64
...
...
@@ -11,6 +11,9 @@ import { calcColumnWidth } from "@/utils/index";
import
Moment
from
'moment'
;
import
{
TableColumnWidth
}
from
"@/utils/enum"
;
import
{
ElMessage
}
from
"element-plus"
;
import
{
queryUseData
}
from
"@/api/modules/dataDelivery"
;
const
{
proxy
}
=
getCurrentInstance
()
as
any
;
...
...
@@ -24,6 +27,20 @@ const tableFields: any = ref([]);
const
getData
=
()
=>
{
tableData
.
value
=
[];
tableDataLoading
.
value
=
true
;
if
(
route
.
query
.
useGuid
)
{
queryUseData
({
userGuid
:
route
.
query
.
useGuid
,
subjectGuid
:
route
.
query
.
guid
}).
then
((
res
:
any
)
=>
{
tableDataLoading
.
value
=
false
;
if
(
res
.
code
==
proxy
.
$passCode
)
{
tableData
.
value
=
res
.
data
.
datas
||
[];
tableFields
.
value
=
res
.
data
.
fields
||
[];
}
else
{
ElMessage
.
error
(
res
.
msg
);
}
});
}
else
{
queryData
(
route
.
query
.
guid
).
then
((
res
:
any
)
=>
{
tableDataLoading
.
value
=
false
;
if
(
res
.
code
==
proxy
.
$passCode
)
{
...
...
@@ -33,6 +50,7 @@ const getData = () => {
ElMessage
.
error
(
res
.
msg
);
}
});
}
}
const
getTextAlign
=
(
field
)
=>
{
...
...
src/views/data_asset/dataUsage.vue
View file @
c888c64
...
...
@@ -56,7 +56,13 @@ const tableFields = ref([
}
},
{
label
:
"合约名称"
,
field
:
"contractName"
,
width
:
170
,
type
:
"text_btn"
,
columClass
:
'text_btn'
,
value
:
"detail1"
,
click
:
(
scope
)
=>
{
label
:
"合约名称"
,
field
:
"contractName"
,
width
:
170
,
type
:
"text_btn"
,
columClass
:
'text_btn'
,
value
:
"detail1"
,
disabled
:
(
scope
)
=>
{
return
scope
.
row
.
isDistribute
==
'N'
;
},
click
:
(
scope
)
=>
{
let
isDistribute
=
scope
.
row
.
isDistribute
;
if
(
isDistribute
==
'N'
)
{
return
;
}
//履约中的合约状态
router
.
push
({
name
:
'smartContractDetail'
,
...
...
src/views/data_asset/registerCatalogDetail.vue
View file @
c888c64
...
...
@@ -443,7 +443,8 @@ const handleTableViewData = (scope) => {
query: {
guid: row.guid,
name: row.tableChName,
damName: detailInfo.value.damName
damName: detailInfo.value.damName,
useGuid: route.query.useGuid
}
});
}
...
...
@@ -1488,8 +1489,8 @@ const respParamsTableInfo = ref({
<el-table-column
label=
"操作"
v-if=
"!detailInfo.nodeId || foundMode == 'download'"
width=
"220px"
align=
"left"
fixed=
"right"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
<span
class=
"text_btn"
@
click=
"handleTableViewData(scope)"
>
查看样例数据
</span>
<el-divider
direction=
"vertical"
/>
<span
class=
"text_btn"
@
click=
"handleTableViewDataDown(scope)"
>
下载数据
</span>
<el-divider
v-show=
"foundMode == 'download'"
direction=
"vertical"
/>
<span
v-show=
"foundMode == 'download'"
class=
"text_btn"
@
click=
"handleTableViewDataDown(scope)"
>
下载数据
</span>
</
template
>
</el-table-column>
</el-table>
...
...
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