c9f12146 by lxs

数据定价更新

1 parent 5b9b1b70
...@@ -78,7 +78,6 @@ const routes: RouteRecordRaw[] = [ ...@@ -78,7 +78,6 @@ const routes: RouteRecordRaw[] = [
78 sidebar: false, 78 sidebar: false,
79 breadcrumb: false, 79 breadcrumb: false,
80 cache: true, 80 cache: true,
81 reuse: true,
82 editPage: true, 81 editPage: true,
83 activeMenu: '/data-pricing/pricing-manage/price-config' 82 activeMenu: '/data-pricing/pricing-manage/price-config'
84 }, 83 },
...@@ -109,7 +108,6 @@ const routes: RouteRecordRaw[] = [ ...@@ -109,7 +108,6 @@ const routes: RouteRecordRaw[] = [
109 sidebar: false, 108 sidebar: false,
110 breadcrumb: false, 109 breadcrumb: false,
111 cache: true, 110 cache: true,
112 reuse: true,
113 editPage: true, 111 editPage: true,
114 activeMenu: '/data-pricing/pricing-manage/price-calculate' 112 activeMenu: '/data-pricing/pricing-manage/price-calculate'
115 }, 113 },
......
...@@ -77,7 +77,7 @@ const costForm = ref({ ...@@ -77,7 +77,7 @@ const costForm = ref({
77 placeholder: "请选择", 77 placeholder: "请选择",
78 clearable: true, 78 clearable: true,
79 required: true, 79 required: true,
80 visible: false, 80 visible: true,
81 popperClass: 'date-year-popper', 81 popperClass: 'date-year-popper',
82 disabledDate: (date) => { 82 disabledDate: (date) => {
83 const curr = new Date(); 83 const curr = new Date();
...@@ -92,7 +92,7 @@ const costForm = ref({ ...@@ -92,7 +92,7 @@ const costForm = ref({
92 placeholder: "请选择", 92 placeholder: "请选择",
93 clearable: true, 93 clearable: true,
94 required: true, 94 required: true,
95 visible: false, 95 visible: true,
96 style: { width: 'calc(33.33% - 70px)', 'margin-right': '8px' }, 96 style: { width: 'calc(33.33% - 70px)', 'margin-right': '8px' },
97 popperClass: 'date-month-popper', 97 popperClass: 'date-month-popper',
98 disabledDate: (date) => { 98 disabledDate: (date) => {
...@@ -321,6 +321,7 @@ const getCostData = () => { ...@@ -321,6 +321,7 @@ const getCostData = () => {
321 }) 321 })
322 levelList.level1.map(l => allMapList.value.push(l)); 322 levelList.level1.map(l => allMapList.value.push(l));
323 setAllMapList(levelList, allMapList.value, 2); 323 setAllMapList(levelList, allMapList.value, 2);
324
324 }).catch((res) => { 325 }).catch((res) => {
325 loading.value = false; 326 loading.value = false;
326 }); 327 });
...@@ -339,10 +340,10 @@ const setAllMapList = (mapObj, arr, level) => { ...@@ -339,10 +340,10 @@ const setAllMapList = (mapObj, arr, level) => {
339 const setStep = async () => { 340 const setStep = async () => {
340 const info = costFormInfo.value; 341 const info = costFormInfo.value;
341 await setFormItems(info, 'cost'); 342 await setFormItems(info, 'cost');
342 costForm.value.items[0].disabled = step.value > 0; 343 // costForm.value.items[0].disabled = step.value > 0;
343 costForm.value.items[1].visible = step.value == 1; 344 // costForm.value.items[1].visible = step.value == 1;
344 costForm.value.items[2].visible = step.value == 1; 345 // costForm.value.items[2].visible = step.value == 1;
345 costForm.value.items[3].visible = step.value == 1; 346 // costForm.value.items[3].visible = step.value == 1;
346 if (step.value == 1) { 347 if (step.value == 1) {
347 setSumRow(); 348 setSumRow();
348 } 349 }
...@@ -793,6 +794,61 @@ const btnClick = async (btn, bType = null) => { ...@@ -793,6 +794,61 @@ const btnClick = async (btn, bType = null) => {
793 } 794 }
794 }; 795 };
795 796
797 const initTableFileds = () => {
798 let fields = [
799 {
800 label: "累计投入", field: "total", width: 120, align: 'right', getName: (scope) => {
801 return changeNum(scope.row.total, 2, true);
802 }
803 },
804 ]
805 const hasLevel1 = checkedList.value.find(c => c.level == 1);
806 if (hasLevel1) {
807 fields.splice(-1, 0, { label: "指标", field: "level1", width: 120 });
808 }
809 const hasLevel2 = checkedList.value.find(c => c.level == 2);
810 if (hasLevel2) {
811 fields.splice(-1, 0, { label: "一级分类", field: "level2", width: 120 });
812 }
813 const hasLevel3 = checkedList.value.find(c => c.level == 3);
814 if (hasLevel3) {
815 fields.splice(-1, 0, { label: "二级分类", field: "level3", width: 120 });
816 }
817 const hasLevel4 = checkedList.value.find(c => c.level == 4);
818 if (hasLevel4) {
819 fields.splice(-1, 0, { label: "三级分类", field: "level4", width: 120 });
820 }
821 tableField.value.splice(0);
822 tableField.value.push(...fields);
823 initField.value = JSON.parse(JSON.stringify(tableField.value));
824 const datas = JSON.parse(JSON.stringify(checkedData.value));
825 datas.sort((a, b) => a.code.localeCompare(b.code));
826 const dGuid = datas.map(d => d.guid);
827 let tDatas = tableData.value.filter(t => dGuid.indexOf(t.guid) > -1);
828 datas.forEach((td, t) => {
829 if (tGuids.indexOf(td.guid) == -1) {
830 tDatas.splice(t, 0, td)
831 } else {
832 tDatas.map(d => {
833 if (d.guid == td.guid) {
834 d.name = td.name;
835 d.level1 = td.level1;
836 d.level2 = td.level2;
837 d.level3 = td.level3;
838 d.level4 = td.level4;
839 }
840 })
841 }
842 })
843 tableData.value.splice(0);
844 tableData.value = tDatas;
845 // if (tGuids.length > 0 && costFormInfo.value.baseDate && costFormInfo.value.investYear) {
846 // setTableFields(costFormInfo.value);
847 // besure.value = true;
848 // }
849 getMergeRow();
850 };
851
796 const setShowLevel4 = () => { 852 const setShowLevel4 = () => {
797 nextTick(() => { 853 nextTick(() => {
798 const box4 = document.querySelectorAll('.grid-panel-box.box3 .grid-items'); 854 const box4 = document.querySelectorAll('.grid-panel-box.box3 .grid-items');
...@@ -1368,33 +1424,27 @@ watch(showLevel4, (newVal, oldVal) => { ...@@ -1368,33 +1424,27 @@ watch(showLevel4, (newVal, oldVal) => {
1368 <template> 1424 <template>
1369 <div class="container_wrap"> 1425 <div class="container_wrap">
1370 <div class="content_main"> 1426 <div class="content_main">
1371 <div class="top_tool_wrap"> 1427 <!-- <div class="top_tool_wrap">
1372 <StepBar :steps-info="stepsInfo" /> 1428 <StepBar :steps-info="stepsInfo" />
1373 </div> 1429 </div> -->
1374 <div class="operator_panel_wrap" :style="{ 'min-height': step == 0 ? 'calc(100% - 112px)' : 'unset' }" 1430 <div class="operator_panel_wrap" :style="{ 'min-height': 'unset' }" v-loading="loading">
1375 v-loading="loading">
1376 <ContentWrap title="入表类型" description="" :expandSwicth="false" v-show="step == 1">
1377 <Form ref="entryFormRef" :itemList="entryForm.items" formId="dam-base-form" :rules="entryForm.rules"
1378 col="col3" @selectChange="selectChange" />
1379 </ContentWrap>
1380 <div class="v-tip" v-show="step == 0"> 1431 <div class="v-tip" v-show="step == 0">
1381 <div class="tip-icon"></div> 1432 <div class="tip-icon"></div>
1382 <div class="tip-des"> 1433 <div class="tip-des">
1383 本工具提供的入表评估结果仅为初步测算参考,基于用户输入参数生成,不代表最终入表金额。实际入表需遵循《企业数据资源相关会计处理暂行规定》及会计准则要求,经专业审计机构确认后方可生效。 1434 本工具提供的入表评估结果仅为初步测算参考,基于用户输入参数生成,不代表最终入表金额。实际入表需遵循《企业数据资源相关会计处理暂行规定》及会计准则要求,经专业审计机构确认后方可生效。
1384 </div> 1435 </div>
1385 </div> 1436 </div>
1386 <ContentWrap :title="step == 0 ? '设置成本项' : step == 1 ? '填写成本明细' : '文件预览'" 1437 <ContentWrap :title="step == 0 ? '设置成本项' : '文件预览'" description="" :expandSwicth="false"
1387 description="" 1438 :style="step == 1 ? { 'margin-top': '16px' } : {}">
1388 :expandSwicth="false" :style="step == 1 ? { 'margin-top': '16px' } : {}">
1389 <div class="table_tool_wrap"> 1439 <div class="table_tool_wrap">
1390 <Form ref="costFormRef" :itemList="costForm.items" formId="dam-base-form" :rules="costForm.rules" col="col3" 1440 <Form ref="costFormRef" :itemList="costForm.items" formId="dam-base-form" :rules="costForm.rules" col="col3"
1391 @btnClick="btnClick" @selectChange="selectChange" /> 1441 @btnClick="btnClick" @selectChange="selectChange" />
1392 <div class="tool_btn" v-if="step == 2"> 1442 <div class="tool_btn" v-if="step == 1">
1393 <el-button type="primary" @click="exportClick">下载文件</el-button> 1443 <el-button type="primary" @click="exportClick">下载文件</el-button>
1394 <!-- <el-button type="primary" plain @click="senMessage">入表咨询</el-button> --> 1444 <!-- <el-button type="primary" plain @click="senMessage">入表咨询</el-button> -->
1395 </div> 1445 </div>
1396 </div> 1446 </div>
1397 <div class="grid-box-wrap" v-show="step == 0"> 1447 <div class="grid-box-wrap" v-show="step == 3">
1398 <!-- 头部标题 --> 1448 <!-- 头部标题 -->
1399 <div class="grid-panel-wrap header" :class="{ col4: showLevel4 }"> 1449 <div class="grid-panel-wrap header" :class="{ col4: showLevel4 }">
1400 <template v-for="(list, l) in gridList" :key="'panel'+l"> 1450 <template v-for="(list, l) in gridList" :key="'panel'+l">
...@@ -1497,14 +1547,14 @@ watch(showLevel4, (newVal, oldVal) => { ...@@ -1497,14 +1547,14 @@ watch(showLevel4, (newVal, oldVal) => {
1497 </div> 1547 </div>
1498 </div> 1548 </div>
1499 </div> 1549 </div>
1500 <div class="table_panel_wrap" v-show="step > 0"> 1550 <div class="table_panel_wrap">
1501 <div class="amount_tool" v-if="step == 1"> 1551 <div class="amount_tool">
1502 <span class="amount_text">累计投入:</span> 1552 <span class="amount_text">累计投入:</span>
1503 <span class="amount_num">{{ changeNum(amount, 2, true) }}</span> 1553 <span class="amount_num">{{ changeNum(amount, 2, true) }}</span>
1504 <span></span> 1554 <span></span>
1505 </div> 1555 </div>
1506 <div class="table_panel"> 1556 <div class="table_panel">
1507 <el-table id="cost-table" v-show="step == 1" ref="costTableRef" :data="tableData" 1557 <el-table id="cost-table" v-show="step == 0" ref="costTableRef" :data="tableData"
1508 :span-method="tableSpanMethod" :summary-method="tableSummaryMethod" show-summary border 1558 :span-method="tableSpanMethod" :summary-method="tableSummaryMethod" show-summary border
1509 :cell-class-name="isMergedCell"> 1559 :cell-class-name="isMergedCell">
1510 <el-table-column v-for="(item, i) in tableField" :label="item.label" :width="item.width" 1560 <el-table-column v-for="(item, i) in tableField" :label="item.label" :width="item.width"
...@@ -1525,7 +1575,7 @@ watch(showLevel4, (newVal, oldVal) => { ...@@ -1525,7 +1575,7 @@ watch(showLevel4, (newVal, oldVal) => {
1525 </template> 1575 </template>
1526 </el-table-column> 1576 </el-table-column>
1527 </el-table> 1577 </el-table>
1528 <el-table id="entry-table" ref="entryTableRef" :data="transposedData" stripe border v-show="step == 2"> 1578 <el-table id="entry-table" ref="entryTableRef" :data="transposedData" stripe border v-show="step == 1">
1529 <el-table-column prop="title" label="项目" :width="140"> 1579 <el-table-column prop="title" label="项目" :width="140">
1530 <template v-slot="{ row }"> 1580 <template v-slot="{ row }">
1531 <span>{{ setLabel(row.title) }}</span> 1581 <span>{{ setLabel(row.title) }}</span>
...@@ -1545,14 +1595,19 @@ watch(showLevel4, (newVal, oldVal) => { ...@@ -1545,14 +1595,19 @@ watch(showLevel4, (newVal, oldVal) => {
1545 </div> 1595 </div>
1546 </div> 1596 </div>
1547 </ContentWrap> 1597 </ContentWrap>
1598 <ContentWrap title="入表类型" description="" :expandSwicth="false" v-show="step == 0">
1599 <Form ref="entryFormRef" :itemList="entryForm.items" formId="dam-base-form" :rules="entryForm.rules"
1600 col="col3" @selectChange="selectChange" />
1601 </ContentWrap>
1548 </div> 1602 </div>
1549 </div> 1603 </div>
1550 <div class="tool_btns"> 1604 <div class="tool_btns">
1551 <div class="btns"> 1605 <div class="btns">
1552 <el-button @click="btnClick({ value: 'refresh' })">重置</el-button> 1606 <el-button @click="btnClick({ value: 'refresh' })">重置</el-button>
1553 <el-button @click="btnClick({ value: 'prev' })" v-if="step == 1">上一步</el-button> 1607 <el-button @click="btnClick({ value: 'next' })" v-if="step == 0">入表</el-button>
1608 <!-- <el-button @click="btnClick({ value: 'prev' })" v-if="step == 1">上一步</el-button>
1554 <el-button type="primary" @click="btnClick({ value: 'prev' })" v-if="step == 2">上一步</el-button> 1609 <el-button type="primary" @click="btnClick({ value: 'prev' })" v-if="step == 2">上一步</el-button>
1555 <el-button type="primary" @click="btnClick({ value: 'next' })" v-if="step < 2">下一步</el-button> 1610 <el-button type="primary" @click="btnClick({ value: 'next' })" v-if="step < 2">下一步</el-button> -->
1556 </div> 1611 </div>
1557 </div> 1612 </div>
1558 </div> 1613 </div>
...@@ -1848,7 +1903,7 @@ watch(showLevel4, (newVal, oldVal) => { ...@@ -1848,7 +1903,7 @@ watch(showLevel4, (newVal, oldVal) => {
1848 background: #FFFBF2; 1903 background: #FFFBF2;
1849 border: 1px solid rgba(255, 241, 212, 1); 1904 border: 1px solid rgba(255, 241, 212, 1);
1850 border-radius: 4px; 1905 border-radius: 4px;
1851 margin: 5px 0px 8px; 1906 margin: 16px 0px 8px;
1852 padding: 2px 0px; 1907 padding: 2px 0px;
1853 1908
1854 .tip-icon { 1909 .tip-icon {
......
...@@ -52,11 +52,13 @@ const dictionaryData: any = ref([]); ...@@ -52,11 +52,13 @@ const dictionaryData: any = ref([]);
52 const diseaseData: any = ref([]); 52 const diseaseData: any = ref([]);
53 const qualityScoreData: any = ref({}); 53 const qualityScoreData: any = ref({});
54 const disScore: any = ref([]); 54 const disScore: any = ref([]);
55 const exportData: any = ref([]); 55 const buildInData: any = ref([]);
56 const dataUsage = ref({ 56 const dataUsage = ref({
57 field: '', 57 field: '',
58 dictValue: '' 58 dictValue: ''
59 }); 59 });
60
61
60 // 基础设置 62 // 基础设置
61 const baseConfigFormRef = ref(); 63 const baseConfigFormRef = ref();
62 const baseConfigFormItems: any = ref([ 64 const baseConfigFormItems: any = ref([
...@@ -143,8 +145,13 @@ const tableLoading = ref(false); ...@@ -143,8 +145,13 @@ const tableLoading = ref(false);
143 const dataTransactionPrice: any = ref(''); 145 const dataTransactionPrice: any = ref('');
144 const setFormItems = (info = null) => { 146 const setFormItems = (info = null) => {
145 let datas: any = info || flowDetail.value || {}; 147 let datas: any = info || flowDetail.value || {};
146 const dData = datas.dictionaryJson ? JSON.parse(datas.dictionaryJson) : {}; 148 const dictData = datas.dictionaryJson ? JSON.parse(datas.dictionaryJson) : {};
147 datas = { ...datas, ...dData }; 149 const builtIndicators = datas.builtIndicators || [];
150 let buildData = {};
151 builtIndicators.map(item => {
152 buildData[`build_${item.guid}`] = item.targetValue;
153 });
154 datas = { ...datas, ...dictData, ...buildData };
148 baseConfigFormItems.value.map(item => { 155 baseConfigFormItems.value.map(item => {
149 item.default = datas[item.field] || ''; 156 item.default = datas[item.field] || '';
150 item.label == '数据用途' && (dataUsage.value.dictValue = datas[item.field] || ''); 157 item.label == '数据用途' && (dataUsage.value.dictValue = datas[item.field] || '');
...@@ -266,8 +273,10 @@ const getDetail = () => { ...@@ -266,8 +273,10 @@ const getDetail = () => {
266 typeMap.value.modelGuid.unshift(mtem); 273 typeMap.value.modelGuid.unshift(mtem);
267 baseConfigFormItems.value[0].options.unshift(mtem); 274 baseConfigFormItems.value[0].options.unshift(mtem);
268 }; 275 };
276 setTimeout(() => {
269 getModelInfo(flowDetail.value.modelGuid); 277 getModelInfo(flowDetail.value.modelGuid);
270 getDataTypeList() 278 getDataTypeList()
279 }, 200)
271 } 280 }
272 }).catch(() => { 281 }).catch(() => {
273 loading.value = false; 282 loading.value = false;
...@@ -304,7 +313,7 @@ const setDictFormItems = (dictList) => { ...@@ -304,7 +313,7 @@ const setDictFormItems = (dictList) => {
304 filterable: true, 313 filterable: true,
305 required: true, 314 required: true,
306 }); 315 });
307 baseConfigFormRules.value[dictField] = { required: true, trigger: 'change', message: `请选择${dictName}` }; 316 baseConfigFormRules.value[dictField] = [{ required: true, trigger: 'change', message: `请选择${dictName}` }];
308 dictName == '数据用途' && (dataUsage.value.field = dictField); 317 dictName == '数据用途' && (dataUsage.value.field = dictField);
309 (() => { 318 (() => {
310 if (typeMap.value[dictField] == undefined) { 319 if (typeMap.value[dictField] == undefined) {
...@@ -338,7 +347,7 @@ const setDiseaseFormItems = () => { ...@@ -338,7 +347,7 @@ const setDiseaseFormItems = () => {
338 clearable: true, 347 clearable: true,
339 required: true, 348 required: true,
340 }); 349 });
341 baseConfigFormRules.value.diseaseGuid = { required: true, trigger: 'change', message: "请选择所属疾病" }; 350 baseConfigFormRules.value.diseaseGuid = [{ required: true, trigger: 'change', message: "请选择所属疾病" }];
342 if (typeMap.value['diseaseGuid'] == undefined) { 351 if (typeMap.value['diseaseGuid'] == undefined) {
343 getDiseaseData(); 352 getDiseaseData();
344 } else { 353 } else {
...@@ -361,16 +370,44 @@ const setBuildInFormItems = (buildList) => { ...@@ -361,16 +370,44 @@ const setBuildInFormItems = (buildList) => {
361 buildList.map(b => { 370 buildList.map(b => {
362 const buildName = b.targetName; 371 const buildName = b.targetName;
363 const buildField = `build_${b.guid}`; 372 const buildField = `build_${b.guid}`;
373 buildInData.value.push({
374 guid: b.guid,
375 targetName: buildName,
376 })
364 baseConfigFormItems.value.push({ 377 baseConfigFormItems.value.push({
365 label: buildName, 378 label: buildName,
366 type: 'input', 379 type: 'input',
367 placeholder: '', 380 placeholder: '',
368 field: buildField, 381 field: buildField,
369 default: b.defaultValue || '', 382 default: changeNum(b.defaultValue, 2),
383 inputType: 'moneyNumber',
384 maxlength: 18,
370 clearable: true, 385 clearable: true,
371 disabled: b.isInputParameter == 'Y' 386 disabled: b.isInputParameter != 'Y'
372 }); 387 });
373 baseConfigFormRules.value[buildField] = { required: true, trigger: 'blur', message: `请填写${buildName}` }; 388 baseConfigFormRules.value[buildField] = [
389 { required: true, message: `请填写${buildName}`, trigger: 'blur' },
390 {
391 validator: (rule, value, callback) => {
392 if (value === '') {
393 callback(new Error(`请填写${buildName}`));
394 return;
395 }
396 const num = parseFloat(value);
397 if (isNaN(num)) {
398 callback(new Error('请输入有效的数字'));
399 return;
400 }
401
402 // 已自动保留两位小数,不需再验证小数位数
403 if (num < 0 || num > b.defaultValue) {
404 callback(new Error(`输入值必须在0到${b.defaultValue}之间`));
405 } else {
406 callback();
407 }
408 }, trigger: "blur",
409 },
410 ]
374 }) 411 })
375 }; 412 };
376 413
...@@ -413,7 +450,7 @@ const setFormItemData = async () => { ...@@ -413,7 +450,7 @@ const setFormItemData = async () => {
413 // 添加数据字典 450 // 添加数据字典
414 dictionaryList.length > 0 && await setDictFormItems(dictionaryList); 451 dictionaryList.length > 0 && await setDictFormItems(dictionaryList);
415 // 添加内置指标 452 // 添加内置指标
416 // buildInList.length > 0 && await setBuildInFormItems(buildInList); 453 buildInList.length > 0 && await setBuildInFormItems(buildInList);
417 454
418 setTimeout(() => { 455 setTimeout(() => {
419 baseConfigFormRef.value.ruleFormRef?.clearValidate(); 456 baseConfigFormRef.value.ruleFormRef?.clearValidate();
...@@ -476,6 +513,7 @@ const getModelConfig = (mGuid) => { ...@@ -476,6 +513,7 @@ const getModelConfig = (mGuid) => {
476 demandTableList.value = data.pricingDemandMenuRSVOS || []; 513 demandTableList.value = data.pricingDemandMenuRSVOS || [];
477 pricingTargetList.value = data.pricingTargetRSVOS || []; 514 pricingTargetList.value = data.pricingTargetRSVOS || [];
478 demandTableFieldAllNum.value = data.fieldCount || 0; 515 demandTableFieldAllNum.value = data.fieldCount || 0;
516 buildInData.value = [];
479 } 517 }
480 }) 518 })
481 } 519 }
...@@ -773,34 +811,7 @@ const toPath = () => { ...@@ -773,34 +811,7 @@ const toPath = () => {
773 }) 811 })
774 } 812 }
775 813
776 // 获取维度公式计算结果 814 // 获取疾病得分
777 const getSignatory = (row) => {
778 let formulaVal = 0;
779 const pricingTargetData = row.pricingTargetRSVOS || [];
780 if (!row.computationalFormula || row.computationalFormula == 'custom') {
781 let formula = row.customize;
782 // 遍历数组,检查 customize 是否包含对应的 targetName,若包含则替换为 tNum
783 pricingTargetData.forEach((item) => {
784 if (formula.includes(item.targetName)) {
785 formula = formula.replace(new RegExp(item.targetName, 'g'), item.tNum);
786 }
787 });
788 // 使用 eval 计算公式结果(注意:eval 存在安全风险,仅适用于受控环境)
789 try {
790 formulaVal = eval(formula);
791 } catch (error) {
792 console.error('公式计算错误:', error);
793 }
794 } else {
795 const formula = pricingTargetData.map(item => item.tNum);
796 if (row.computationalFormula == '3') {
797 formulaVal = formula.reduce((accumulator, currentValue) => parseFloat(accumulator) * parseFloat(currentValue), 1); // 初始值为1
798 } else {
799 formulaVal = formula.reduce((accumulator, currentValue) => parseFloat(accumulator) + parseFloat(currentValue), 0); // 初始值为0
800 }
801 }
802 return (Math.round(formulaVal * 100) / 100).toFixed(2);
803 };
804 const getTargetNum = (params) => { 815 const getTargetNum = (params) => {
805 // loading.value = true; 816 // loading.value = true;
806 getPriceResult(params).then((res: any) => { 817 getPriceResult(params).then((res: any) => {
...@@ -816,151 +827,6 @@ const getTargetNum = (params) => { ...@@ -816,151 +827,6 @@ const getTargetNum = (params) => {
816 }); 827 });
817 } 828 }
818 829
819 // 生成报告内容
820 const reporting = (formInfo) => {
821 let resultInfo: any = [];
822 const signatoryData = JSON.parse(JSON.stringify(modelData.value.pricingDimensionalityRSVOS || '[]'));
823 signatoryData.map((sign, s) => {
824 resultInfo.push({
825 dimensionalityName: sign.dimensionalityName,
826 computationalFormula: sign.computationalFormula,
827 customize: sign.customize,
828 pricingTargetRSVOS: []
829 });
830 const targets = sign.pricingTargetRSVOS || [];
831 const signTargets = targets.map(t => {
832 let tNum: any = 0, tCustomize = '';
833 if (t.targetType == '3') { // 指标类型-数据字典
834 const tName = dictionaryData.value.find(d => d.guid == t.guid) ? `dict_${t.guid}` : '';
835 if (tName) {
836 const pVal = typeMap.value[tName].find(t => t.value == formInfo[tName]);
837 const dictionary = t.dictionaryJson.find(d => d.name == pVal.label);
838 if (sign.computationalFormula == '1') {// 加权平均
839 tNum = parseFloat(t.weight) / 100 * parseFloat(dictionary?.value || t.defaultValue || 0);
840 tCustomize = `权重${parseFloat(t.weight) / 100} * 因子/默认值${parseFloat(dictionary?.value || t.defaultValue || 0)}`;
841 } else { // 其他
842 tNum = parseFloat(dictionary?.value || t.defaultValue || 0);
843 tCustomize = `默认值${parseFloat(dictionary?.value || t.defaultValue || 0)}`;
844 }
845 t.dictionaryName == '数据用途' && (dataUsage.value.dictValue = pVal.value || '');
846 }
847 } else if (t.targetType == '2') {// 指标类型-系统功能
848 if (t.functionName == '1') { // 功能名称-质量评价模型
849 const score = parseFloat(qualityScoreData.value.qualityScore || 0);
850 tNum = parseFloat(t.weight || 1) / 100 * score / 100;
851 tCustomize = `权重${parseFloat(t.weight || 1) / 100} * 模型评分${score}/100`;
852 } else if (t.functionName == '2') { // 功能名称-疾病管理
853 if (sign.computationalFormula == '1') {// 加权平均
854 const score = parseFloat(disScore.value.find(d => d.guid == t.guid)?.factor || 0);
855 tNum = parseFloat(t.weight) / 100 * score;
856 tCustomize = `权重${parseFloat(t.weight) / 100} * 疾病得分${score}`;
857 } else { //其他
858 tNum = parseFloat(disScore.value.find(d => d.guid == t.guid)?.factor || 0);
859 tCustomize = `疾病得分${tNum}`;
860 }
861 } else if (t.functionName == '3') {// 功能名称-需求表管理
862 const tData = tableData.value.find(f => f.demandTableGuid == t.demandTableGuid || f.guid == t.demandTableGuid);
863 if (tData) {
864 if (sign.computationalFormula == '1') {// 加权平均
865 tNum = parseFloat(t.weight) / 100 * (parseFloat(tData.dataFieldsNum) / tData.dataFields.length || parseFloat(t.defaultValue || 0));
866 tCustomize = `权重${parseFloat(t.weight) / 100} * 匹配率/默认值${parseFloat(tData.dataFieldsNum) / tData.dataFields.length || parseFloat(t.defaultValue || 0)}`;
867 } else { //其他
868 tNum = parseFloat(tData.dataFieldsNum) / tData.dataFields.length || parseFloat(t.defaultValue || 0);
869 tCustomize = `匹配率/默认值${parseFloat(tData.dataFieldsNum) / tData.dataFields.length || parseFloat(t.defaultValue || 0)}`;
870 }
871 }
872 }
873 } else { // 指标类型-系统内置
874 if (sign.computationalFormula == '1') {// 加权平均
875 tNum = parseFloat(t.weight) / 100 * parseFloat(t.defaultValue || 0);
876 tCustomize = `权重${parseFloat(t.weight) / 100} * 默认值${parseFloat(t.defaultValue || 0)}`;
877 } else { //其他
878 tNum = parseFloat(t.defaultValue || 0);
879 tCustomize = `默认值${parseFloat(t.defaultValue || 0)}`;
880 }
881 }
882 t.tNum = (Math.round(parseFloat(tNum) * 100) / 100).toFixed(2);
883 resultInfo[s].pricingTargetRSVOS.push({
884 targetName: t.targetName,
885 targetType: t.targetType,
886 functionName: t.functionName,
887 customize: tCustomize,
888 tNum: t.tNum,
889 })
890 return t;
891 })
892 sign.pricingTargetRSVOS = signTargets;
893 sign.sNum = getSignatory(sign);
894 resultInfo[s].sNum = sign.sNum;
895 })
896 // exportData.value = resultInfo;
897 return { signatoryData, resultInfo };
898 }
899
900 // 计算价格
901 const calculatePrice = (pData) => {
902 let modelFormula = modelData.value.modelFormula;
903 // 1. 移除所有干扰的引号(确保是数学表达式)
904 modelFormula = modelFormula.replace(/["']/g, "").trim();
905
906 // 2. 定义允许的数学运算符和函数
907 const allowedOperators = /[+\-*/%^() .\d]/;
908 const mathFunctions = ['sin', 'cos', 'tan', 'log', 'sqrt', 'abs', 'pow'];
909
910 // 3. 提取变量名
911 const variableRegex = /[\u4e00-\u9fa5a-zA-Z_][\u4e00-\u9fa5a-zA-Z0-9_]*/g;
912 const variableNames = [...new Set(modelFormula.match(variableRegex) || [])];
913
914 // 4. 构建变量映射
915 const variables = {};
916 variableNames.forEach(name => {
917 const dim = pData.find(d => d.dimensionalityName === name);
918 variables[name] = dim ? parseFloat(dim.sNum) || 0 : 0;
919 });
920
921 // 5. 替换变量为数值(考虑边界情况)
922 let expression = modelFormula;
923 Object.keys(variables).forEach(name => {
924 expression = expression.replace(new RegExp(name, 'g'), variables[name]);
925 });
926
927 // 6. 表达式规范化(不丢失括号)
928 expression = expression
929 .replace(/\s+/g, '') // 去空格
930 .replace(/\^/g, '**') // 幂运算转换
931 .replace(/"|'/g, '') // 去引号(不破坏括号)
932 .replace(/(\d)\(/g, '$1*(') // 处理隐式乘法
933 .replace(/\)\(/g, ')*('); // 括号间乘法
934
935 // 7. 验证括号配对
936 const balance = expression.split('').reduce((acc, char) => {
937 if (char === '(') acc++;
938 if (char === ')') acc--;
939 return acc;
940 }, 0);
941
942 if (balance !== 0) {
943 console.error('括号不匹配');
944 return NaN;
945 }
946
947 // 8. 安全计算
948 try {
949 const result = new Function('return ' + expression)();
950 const roundedResult = Math.round(parseFloat(result) * 100) / 100;
951
952 dataTransactionPrice.value = roundedResult.toFixed(2);
953 return roundedResult;
954 } catch (error) {
955 console.error('计算错误:', {
956 error,
957 original: modelFormula,
958 processed: expression
959 });
960 return NaN;
961 }
962 };
963
964 // 获取定价计算配置参数 830 // 获取定价计算配置参数
965 const getCalculateParams = (baseConfigFormObj, baseConfigFormInfo) => { 831 const getCalculateParams = (baseConfigFormObj, baseConfigFormInfo) => {
966 const modelName = typeMap.value.modelGuid.find(d => d.guid == baseConfigFormInfo.modelGuid)?.modelName || ''; 832 const modelName = typeMap.value.modelGuid.find(d => d.guid == baseConfigFormInfo.modelGuid)?.modelName || '';
...@@ -983,13 +849,20 @@ const getCalculateParams = (baseConfigFormObj, baseConfigFormInfo) => { ...@@ -983,13 +849,20 @@ const getCalculateParams = (baseConfigFormObj, baseConfigFormInfo) => {
983 const parentsData = baseConfigFormObj.getCascaderCheckedData(); 849 const parentsData = baseConfigFormObj.getCascaderCheckedData();
984 params.diseaseName = parentsData[0]?.label || ''; 850 params.diseaseName = parentsData[0]?.label || '';
985 } 851 }
986 let dictionaryJson = {}; 852 let dictionaryJson = {}, builtInTarget: any = [];
987 for (var b in baseConfigFormInfo) { 853 for (var b in baseConfigFormInfo) {
988 if (b.indexOf('dict_') > -1) { 854 if (b.indexOf('dict_') > -1) {
989 dictionaryJson[b] = baseConfigFormInfo[b]; 855 dictionaryJson[b] = baseConfigFormInfo[b];
990 } 856 }
991 } 857 }
858 buildInData.value.map(item => {
859 builtInTarget.push({
860 ...item,
861 targetValue: baseConfigFormInfo[`build_${item.guid}`],
862 })
863 })
992 params.dictionaryJson = Object.keys(dictionaryJson).length ? JSON.stringify(dictionaryJson) : ''; 864 params.dictionaryJson = Object.keys(dictionaryJson).length ? JSON.stringify(dictionaryJson) : '';
865 params.builtIndicators = builtInTarget;
993 let demandMatchingData: any = []; 866 let demandMatchingData: any = [];
994 tableData.value.map(item => { 867 tableData.value.map(item => {
995 demandMatchingData.push({ 868 demandMatchingData.push({
...@@ -1048,65 +921,7 @@ const checkForm = (type) => { ...@@ -1048,65 +921,7 @@ const checkForm = (type) => {
1048 // 显示结果 921 // 显示结果
1049 dataTransactionPrice.value = priceData.transactionPrice.toFixed(2); 922 dataTransactionPrice.value = priceData.transactionPrice.toFixed(2);
1050 923
1051 if (type == 'calculate') { 924 if (type == 'export') {
1052 // const { signatoryData, resultInfo } = reporting(baseConfigFormInfo);
1053 // exportData.value = resultInfo;
1054 // calculatePrice(signatoryData);
1055 } else if (type == 'export') {
1056 // const { signatoryData, resultInfo } = reporting(baseConfigFormInfo);
1057 // exportData.value = resultInfo;
1058 // !dataTransactionPrice.value && calculatePrice(signatoryData);
1059 // loading.value = true;
1060 // let exportOut: any = {};
1061 // // 估值对象信息
1062 // const damName = typeMap.value.dataResourceGuid.find(f => f.damGuid == baseConfigFormInfo.dataResourceGuid)?.damName || '';
1063 // exportOut.one = `因${baseConfigFormInfo.belongingEntityGuid}拟了解其所持有的\"${damName}\"相关数据资源的价格,为此需对该行为涉及的数据资源在不同应用场景下,基于数据资源持有单位的性质、信息化程度、数据稀缺性、需求匹配等情况下,为上述经济行为提供定价参考依据。`;
1064 // exportOut.two = `估值对象:${baseConfigFormInfo.belongingEntityGuid}持有的\"${damName}\"`;
1065 // // 估值范围信息
1066 // const damNames = demandTableList.value.map(item => item.menuName)
1067 // let rangStr = `包含${damNames.join('、')}等${damNames.length}张表单,${damNames.length}张表共计${demandTableFieldAllNum.value}个字段`;
1068 // const dataTimeliness = pricingTargetList.value.find(p => p.dictionaryName == '时效性');
1069 // const dataTimelinessStr = dataTimeliness ? typeMap.value[`dict_${dataTimeliness.guid}`].find(f => f.value == baseConfigFormInfo[`dict_${dataTimeliness.guid}`])?.label || '' : '';
1070 // rangStr += dataTimelinessStr ? `,时间跨度为${dataTimelinessStr}的数据` : `的数据`;
1071 // damNames.length && (exportOut.two = `${exportOut.two}\n估值范围:${rangStr}`);
1072 // // 字典
1073 // let dictList: any = [], hasModelScore = false;
1074 // const dictStr = exportData.value.map(e => {
1075 // // 检查是否有质量模型评分
1076 // hasModelScore = hasModelScore || e.pricingTargetRSVOS.some(
1077 // t => t.targetType === '2' && t.functionName === '1'
1078 // );
1079
1080 // // 只有当维度指标数大于1时才处理明细
1081 // if (e.pricingTargetRSVOS.length > 1) {
1082 // const targetStr = e.pricingTargetRSVOS
1083 // .map(t => `${t.targetName}为${changeNum(t.tNum, 2)}`)
1084 // .join('、');
1085
1086 // dictList.push(`${e.dimensionalityName}为${changeNum(e.sNum, 2)},其中${targetStr}`);
1087 // }
1088
1089 // return `${e.dimensionalityName}为${changeNum(e.sNum, 2)}`;
1090 // })
1091 // let dictListStr = `${dictStr.join(',')}。\n${dictList.join(';\n')}`
1092 // // 质量模型
1093 // if (hasModelScore) {
1094 // const { largeCategoryScoreList = [], qualityScore = 0 } = qualityScoreData.value;
1095 // const qualityParts = [
1096 // `数据的总体质量得分为${changeNum(qualityScore, 2)}`
1097 // ];
1098
1099 // if (largeCategoryScoreList.length) {
1100 // const categoryScores = largeCategoryScoreList.map(
1101 // q => `${q.largeCategoryName}方面得分为${changeNum(q.largeCategoryScore || 0, 2)}`
1102 // );
1103 // qualityParts.push(`其中${categoryScores.join(',')}`);
1104 // }
1105
1106 // dictListStr += `;\n${qualityParts.join('。')}`;
1107 // }
1108 // exportOut.three = `${baseConfigFormInfo.belongingEntityGuid}持有的"${damName}"的数据(患者人次)单价为${changeNum(dataTransactionPrice.value, 2)}元${dictListStr ? `;其中${dictListStr}` : '。'}`;
1109
1110 loading.value = true; 925 loading.value = true;
1111 const exportOut = { 926 const exportOut = {
1112 one: priceData.one, 927 one: priceData.one,
...@@ -1132,9 +947,6 @@ const checkForm = (type) => { ...@@ -1132,9 +947,6 @@ const checkForm = (type) => {
1132 }); 947 });
1133 }) 948 })
1134 } else { 949 } else {
1135 // const { signatoryData, resultInfo } = reporting(baseConfigFormInfo);
1136 // exportData.value = resultInfo;
1137 // !dataTransactionPrice.value && calculatePrice(signatoryData);
1138 let params = { 950 let params = {
1139 ...paramsInfo, 951 ...paramsInfo,
1140 dataTransactionPrice: dataTransactionPrice.value, 952 dataTransactionPrice: dataTransactionPrice.value,
...@@ -1239,6 +1051,7 @@ onBeforeMount(() => { ...@@ -1239,6 +1051,7 @@ onBeforeMount(() => {
1239 } 1051 }
1240 }) 1052 })
1241 onMounted(() => { 1053 onMounted(() => {
1054 getModel()
1242 }) 1055 })
1243 </script> 1056 </script>
1244 <template> 1057 <template>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!