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
ffe5da2f
authored
2025-07-31 16:46:05 +0800
by
lxs
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
数据定价对接计算接口
1 parent
8dd504ae
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
90 deletions
src/api/modules/dataPricing.ts
src/views/data_pricing/calculateConfig.vue
src/views/data_pricing/priceModel.vue
src/api/modules/dataPricing.ts
View file @
ffe5da2
...
...
@@ -242,6 +242,15 @@ export const getPriceResult = (params) => {
});
};
// 计算数据定价
export
const
calculatPrice
=
(
params
)
=>
{
return
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_API_NEW_PORTAL
}
/pricing-data/calculate-price`
,
method
:
"post"
,
data
:
params
,
});
};
// 删除数据定价
export
const
deletePrice
=
(
params
)
=>
{
return
request
({
...
...
src/views/data_pricing/calculateConfig.vue
View file @
ffe5da2
...
...
@@ -21,7 +21,8 @@ import {
savePrice
,
getModelDemand
,
getPriceResult
,
exportModelScore
exportModelScore
,
calculatPrice
}
from
'@/api/modules/dataPricing'
;
import
{
changeNum
}
from
"@/utils/common"
;
...
...
@@ -908,94 +909,8 @@ const calculatePrice = (pData) => {
}
};
// 计算结果和提交
const
checkForm
=
(
type
)
=>
{
const
baseConfigFormObj
=
baseConfigFormRef
.
value
;
const
baseConfigFormEl
=
baseConfigFormObj
.
ruleFormRef
;
const
baseConfigFormInfo
=
baseConfigFormObj
.
formInline
;
baseConfigFormEl
.
validate
((
valid
,
errorItem
)
=>
{
if
(
valid
)
{
if
(
type
==
'calculate'
)
{
const
{
signatoryData
,
resultInfo
}
=
reporting
(
baseConfigFormInfo
);
exportData
.
value
=
resultInfo
;
calculatePrice
(
signatoryData
);
}
else
if
(
type
==
'export'
)
{
const
{
signatoryData
,
resultInfo
}
=
reporting
(
baseConfigFormInfo
);
exportData
.
value
=
resultInfo
;
!
dataTransactionPrice
.
value
&&
calculatePrice
(
signatoryData
);
loading
.
value
=
true
;
let
exportOut
:
any
=
{};
// 估值对象信息
const
damName
=
typeMap
.
value
.
dataResourceGuid
.
find
(
f
=>
f
.
damGuid
==
baseConfigFormInfo
.
dataResourceGuid
)?.
damName
||
''
;
exportOut
.
one
=
`因
${
baseConfigFormInfo
.
belongingEntityGuid
}
拟了解其所持有的\"
${
damName
}
\"相关数据资源的价格,为此需对该行为涉及的数据资源在不同应用场景下,基于数据资源持有单位的性质、信息化程度、数据稀缺性、需求匹配等情况下,为上述经济行为提供定价参考依据。`
;
exportOut
.
two
=
`估值对象:
${
baseConfigFormInfo
.
belongingEntityGuid
}
持有的\"
${
damName
}
\"`
;
// 估值范围信息
const
damNames
=
demandTableList
.
value
.
map
(
item
=>
item
.
menuName
)
let
rangStr
=
`包含
${
damNames
.
join
(
'、'
)}
等
${
damNames
.
length
}
张表单,
${
damNames
.
length
}
张表共计
${
demandTableFieldAllNum
.
value
}
个字段`
;
const
dataTimeliness
=
pricingTargetList
.
value
.
find
(
p
=>
p
.
dictionaryName
==
'时效性'
);
const
dataTimelinessStr
=
dataTimeliness
?
typeMap
.
value
[
`dict_
${
dataTimeliness
.
guid
}
`
].
find
(
f
=>
f
.
value
==
baseConfigFormInfo
[
`dict_
${
dataTimeliness
.
guid
}
`
])?.
label
||
''
:
''
;
rangStr
+=
dataTimelinessStr
?
`,时间跨度为
${
dataTimelinessStr
}
的数据`
:
`的数据`
;
damNames
.
length
&&
(
exportOut
.
two
=
`
${
exportOut
.
two
}
\n估值范围:
${
rangStr
}
`
);
// 字典
let
dictList
:
any
=
[],
hasModelScore
=
false
;
const
dictStr
=
exportData
.
value
.
map
(
e
=>
{
// 检查是否有质量模型评分
hasModelScore
=
hasModelScore
||
e
.
pricingTargetRSVOS
.
some
(
t
=>
t
.
targetType
===
'2'
&&
t
.
functionName
===
'1'
);
// 只有当维度指标数大于1时才处理明细
if
(
e
.
pricingTargetRSVOS
.
length
>
1
)
{
const
targetStr
=
e
.
pricingTargetRSVOS
.
map
(
t
=>
`
${
t
.
targetName
}
为
${
changeNum
(
t
.
tNum
,
2
)}
`
)
.
join
(
'、'
);
dictList
.
push
(
`
${
e
.
dimensionalityName
}
为
${
changeNum
(
e
.
sNum
,
2
)}
,其中
${
targetStr
}
`
);
}
return
`
${
e
.
dimensionalityName
}
为
${
changeNum
(
e
.
sNum
,
2
)}
`
;
})
let
dictListStr
=
`
${
dictStr
.
join
(
','
)}
。\n
${
dictList
.
join
(
';\n'
)}
`
// 质量模型
if
(
hasModelScore
)
{
const
{
largeCategoryScoreList
=
[],
qualityScore
=
0
}
=
qualityScoreData
.
value
;
const
qualityParts
=
[
`数据的总体质量得分为
${
changeNum
(
qualityScore
,
2
)}
`
];
if
(
largeCategoryScoreList
.
length
)
{
const
categoryScores
=
largeCategoryScoreList
.
map
(
q
=>
`
${
q
.
largeCategoryName
}
方面得分为
${
changeNum
(
q
.
largeCategoryScore
||
0
,
2
)}
`
);
qualityParts
.
push
(
`其中
${
categoryScores
.
join
(
','
)}
`
);
}
dictListStr
+=
`;\n
${
qualityParts
.
join
(
'。'
)}
`
;
}
exportOut
.
three
=
`
${
baseConfigFormInfo
.
belongingEntityGuid
}
持有的"
${
damName
}
"的数据(患者人次)单价为
${
changeNum
(
dataTransactionPrice
.
value
,
2
)}
元
${
dictListStr
?
`;其中
${
dictListStr
}
`
:
'。'
}
`
;
exportModelScore
(
exportOut
).
then
((
res
:
any
)
=>
{
loading
.
value
=
false
;
if
(
res
&&
!
res
.
msg
)
{
ElMessage
({
type
:
"success"
,
message
:
'下载报告成功'
,
});
download
(
res
,
`数据定价报告.doc`
,
'word'
);
}
else
{
res
?.
msg
&&
ElMessage
.
error
(
res
?.
msg
);
}
}).
catch
(()
=>
{
loading
.
value
=
false
;
ElMessage
({
type
:
"error"
,
message
:
'下载报告请求失败'
,
});
})
}
else
{
const
{
signatoryData
,
resultInfo
}
=
reporting
(
baseConfigFormInfo
);
exportData
.
value
=
resultInfo
;
!
dataTransactionPrice
.
value
&&
calculatePrice
(
signatoryData
);
// 获取定价计算配置参数
const
getCalculateParams
=
(
baseConfigFormObj
,
baseConfigFormInfo
)
=>
{
const
modelName
=
typeMap
.
value
.
modelGuid
.
find
(
d
=>
d
.
guid
==
baseConfigFormInfo
.
modelGuid
)?.
modelName
||
''
;
const
dataResourceName
=
typeMap
.
value
.
dataResourceGuid
.
find
(
d
=>
d
.
damGuid
==
baseConfigFormInfo
.
dataResourceGuid
)?.
damName
||
''
;
const
diseaseGuid
=
baseConfigFormInfo
.
diseaseGuid
||
''
;
...
...
@@ -1028,7 +943,7 @@ const checkForm = (type) => {
demandMatchingData
.
push
({
demandTableName
:
item
.
demandTableName
,
demandTableGuid
:
item
.
demandTableGuid
||
item
.
guid
,
// 需求表guid
dataTableGuid
:
item
.
dataTableGuid
,
// 数据资源表guid
dataTableGuid
:
item
.
dataTableGuid
||
''
,
// 数据资源表guid
weightDemandTable
:
item
.
weightDemandTable
,
dataFieldsNum
:
item
.
dataFieldsNum
,
pricingDemandFieldRQVOS
:
item
.
dataFields
.
map
(
d
=>
{
...
...
@@ -1045,6 +960,131 @@ const checkForm = (type) => {
});
params
.
dataPricingDemandmatchingRQVOS
=
demandMatchingData
;
guid
&&
(
params
.
guid
=
guid
);
return
params
;
}
// 获取定价计算结构
const
getCalculatPrice
=
async
(
params
)
=>
{
try
{
const
res
:
any
=
await
calculatPrice
(
params
);
loading
.
value
=
false
;
if
(
res
.
code
===
proxy
.
$passCode
)
{
const
data
=
res
.
data
||
{};
console
.
log
(
'getCalculatPrice'
,
data
);
return
data
;
// 返回计算结果以便后续使用
}
else
{
proxy
.
$ElMessage
.
error
(
res
.
msg
);
throw
new
Error
(
res
.
msg
);
// 抛出错误以便 catch 捕获
}
}
catch
(
error
)
{
console
.
error
(
'计算价格失败:'
,
error
);
loading
.
value
=
false
;
throw
error
;
// 重新抛出错误
}
};
// 计算结果和提交
const
checkForm
=
(
type
)
=>
{
const
baseConfigFormObj
=
baseConfigFormRef
.
value
;
const
baseConfigFormEl
=
baseConfigFormObj
.
ruleFormRef
;
const
baseConfigFormInfo
=
baseConfigFormObj
.
formInline
;
baseConfigFormEl
.
validate
(
async
(
valid
,
errorItem
)
=>
{
if
(
valid
)
{
const
params
=
getCalculateParams
(
baseConfigFormObj
,
baseConfigFormInfo
);
loading
.
value
=
true
;
// 先获取计算结果
const
priceData
=
await
getCalculatPrice
(
params
);
// 显示结果
dataTransactionPrice
.
value
=
priceData
.
transactionPrice
;
if
(
type
==
'calculate'
)
{
// const { signatoryData, resultInfo } = reporting(baseConfigFormInfo);
// exportData.value = resultInfo;
// calculatePrice(signatoryData);
}
else
if
(
type
==
'export'
)
{
// const { signatoryData, resultInfo } = reporting(baseConfigFormInfo);
// exportData.value = resultInfo;
// !dataTransactionPrice.value && calculatePrice(signatoryData);
// loading.value = true;
// let exportOut: any = {};
// // 估值对象信息
// const damName = typeMap.value.dataResourceGuid.find(f => f.damGuid == baseConfigFormInfo.dataResourceGuid)?.damName || '';
// exportOut.one = `因${baseConfigFormInfo.belongingEntityGuid}拟了解其所持有的\"${damName}\"相关数据资源的价格,为此需对该行为涉及的数据资源在不同应用场景下,基于数据资源持有单位的性质、信息化程度、数据稀缺性、需求匹配等情况下,为上述经济行为提供定价参考依据。`;
// exportOut.two = `估值对象:${baseConfigFormInfo.belongingEntityGuid}持有的\"${damName}\"`;
// // 估值范围信息
// const damNames = demandTableList.value.map(item => item.menuName)
// let rangStr = `包含${damNames.join('、')}等${damNames.length}张表单,${damNames.length}张表共计${demandTableFieldAllNum.value}个字段`;
// const dataTimeliness = pricingTargetList.value.find(p => p.dictionaryName == '时效性');
// const dataTimelinessStr = dataTimeliness ? typeMap.value[`dict_${dataTimeliness.guid}`].find(f => f.value == baseConfigFormInfo[`dict_${dataTimeliness.guid}`])?.label || '' : '';
// rangStr += dataTimelinessStr ? `,时间跨度为${dataTimelinessStr}的数据` : `的数据`;
// damNames.length && (exportOut.two = `${exportOut.two}\n估值范围:${rangStr}`);
// // 字典
// let dictList: any = [], hasModelScore = false;
// const dictStr = exportData.value.map(e => {
// // 检查是否有质量模型评分
// hasModelScore = hasModelScore || e.pricingTargetRSVOS.some(
// t => t.targetType === '2' && t.functionName === '1'
// );
// // 只有当维度指标数大于1时才处理明细
// if (e.pricingTargetRSVOS.length > 1) {
// const targetStr = e.pricingTargetRSVOS
// .map(t => `${t.targetName}为${changeNum(t.tNum, 2)}`)
// .join('、');
// dictList.push(`${e.dimensionalityName}为${changeNum(e.sNum, 2)},其中${targetStr}`);
// }
// return `${e.dimensionalityName}为${changeNum(e.sNum, 2)}`;
// })
// let dictListStr = `${dictStr.join(',')}。\n${dictList.join(';\n')}`
// // 质量模型
// if (hasModelScore) {
// const { largeCategoryScoreList = [], qualityScore = 0 } = qualityScoreData.value;
// const qualityParts = [
// `数据的总体质量得分为${changeNum(qualityScore, 2)}`
// ];
// if (largeCategoryScoreList.length) {
// const categoryScores = largeCategoryScoreList.map(
// q => `${q.largeCategoryName}方面得分为${changeNum(q.largeCategoryScore || 0, 2)}`
// );
// qualityParts.push(`其中${categoryScores.join(',')}`);
// }
// dictListStr += `;\n${qualityParts.join('。')}`;
// }
// exportOut.three = `${baseConfigFormInfo.belongingEntityGuid}持有的"${damName}"的数据(患者人次)单价为${changeNum(dataTransactionPrice.value, 2)}元${dictListStr ? `;其中${dictListStr}` : '。'}`;
loading
.
value
=
true
;
const
exportOut
=
{
one
:
priceData
.
one
,
two
:
priceData
.
two
,
three
:
priceData
.
three
,
}
exportModelScore
(
exportOut
).
then
((
res
:
any
)
=>
{
loading
.
value
=
false
;
if
(
res
&&
!
res
.
msg
)
{
ElMessage
({
type
:
"success"
,
message
:
'下载报告成功'
,
});
download
(
res
,
`数据定价报告.doc`
,
'word'
);
}
else
{
res
?.
msg
&&
ElMessage
.
error
(
res
?.
msg
);
}
}).
catch
(()
=>
{
loading
.
value
=
false
;
ElMessage
({
type
:
"error"
,
message
:
'下载报告请求失败'
,
});
})
}
else
{
// const { signatoryData, resultInfo } = reporting(baseConfigFormInfo);
// exportData.value = resultInfo;
// !dataTransactionPrice.value && calculatePrice(signatoryData);
loading
.
value
=
true
;
savePrice
(
params
).
then
((
res
:
any
)
=>
{
loading
.
value
=
false
;
...
...
src/views/data_pricing/priceModel.vue
View file @
ffe5da2
...
...
@@ -1095,6 +1095,7 @@ const open = (msg, type, target) => {
}
});
};
const
drawerBtnClick
=
async
(
btn
,
info
)
=>
{
if
(
btn
.
value
==
"submit"
)
{
let
params
=
{
...
info
};
...
...
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