calculateConfig.vue
49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
<route lang="yaml">
name: calculateConfig
</route>
<script lang="ts" setup name="calculateConfig">
import { ref, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
import { ElMessage, ElMessageBox } from "element-plus";
import useUserStore from "@/store/modules/user";
import useDataAssetStore from "@/store/modules/dataAsset";
import { getAllFlowData } from '@/api/modules/queryService';
import { getDamCatalogList } from "@/api/modules/dataPricing";
import { getRegisterCatalogDetail, getRegisterCatalogTableDetail } from "@/api/modules/dataAsset";
import { download } from '@/utils/common'
import {
getConfigureList,
getConfigureDetail,
getDiseaseAll,
getPriceDetail,
getDemandList,
getModelScore,
savePrice,
getModelDemand,
getPriceResult,
exportModelScore
} from '@/api/modules/dataPricing';
import { changeNum } from "@/utils/common";
const { proxy } = getCurrentInstance() as any;
const router = useRouter();
const route = useRoute();
const userStore = useUserStore();
const assetStore = useDataAssetStore();
const fullPath = route.fullPath;
const userData = JSON.parse(localStorage.userData);
const guid = route.query.guid;
const priceName = route.query.name;
const loading = ref(false);
const flowDetail: any = ref({});
const typeMap: any = ref({});
const expand1 = ref(true)
const expand2 = ref(true)
const expand3 = ref(true)
const demandTableList: any = ref([]);
const pricingTargetList: any = ref([]);
const demandTableFieldAllNum = ref(0);
const resourceTableAllNum = ref(0);
const resourceTableFieldAllNum = ref(0);
const modelData: any = ref({});
const pricingDimensionalityData: any = ref([]);
const dictionaryData: any = ref([]);
const diseaseData: any = ref([]);
const qualityScoreData: any = ref({});
const disScore: any = ref([]);
const exportData: any = ref([]);
const dataUsage = ref('');
// 基础设置
const baseConfigFormRef = ref();
const baseConfigFormItems: any = ref([
{
label: '模型名称',
type: 'select',
placeholder: '请选择',
field: 'modelGuid',
default: '',
options: [],
props: {
label: "modelName",
value: "guid",
},
clearable: true,
filterable: true,
required: true
},
{
label: '数据资源',
type: 'select',
placeholder: '请选择',
field: 'dataResourceGuid',
default: '',
options: [],
props: {
label: "damName",
value: "guid",
},
clearable: true,
filterable: true,
required: true,
},
{
label: '所属主体',
type: 'input',
placeholder: '',
field: 'belongingEntityGuid',
default: '',
options: [],
clearable: true,
disabled: true
},
{
label: '所属主题',
type: 'tree-select',
placeholder: '请选择',
field: 'belongingTheme',
default: '',
options: [],
showAllLevels: false,
checkStrictly: false,//只能选择叶子节点。
lazy: false,
props: {
label: "label",
value: "value",
children: 'childDictList'
},
filterable: true,
clearable: true,
disabled: true
},
])
const baseConfigFormRules: any = ref({
modelGuid: [
{ required: true, trigger: 'change', message: "请选择模型名称" }
],
dataResourceGuid: [
{ required: true, trigger: 'change', message: "请选择数据资源" }
],
});
const baseConfigForm = ref({
items: baseConfigFormItems.value,
rules: baseConfigFormRules.value,
})
const tableFields: any = ref([
{ label: '需求表', field: 'demandTableName', type: 'input', width: 200, disabled: true },
{ label: '数据资源表', field: 'dataTableGuid', type: 'select', width: 200 },
{ label: '表描述', field: 'tableDescription', type: 'input', width: 200, disabled: true },
{ label: '需求表权重(%)', field: 'weightDemandTable', type: 'input', width: 140, disabled: true },
])
const expendTableRef = ref();
const tableData: any = ref([]);
const tableLoading = ref(false);
const dataTransactionPrice: any = ref('');
const setFormItems = (info = null) => {
let datas: any = info || flowDetail.value || {};
const dData = datas.dictionaryJson ? JSON.parse(datas.dictionaryJson) : {};
datas = { ...datas, ...dData };
baseConfigFormItems.value.map(item => {
item.default = datas[item.field] || '';
})
nextTick(() => {
baseConfigFormRef.value.ruleFormRef?.clearValidate();
})
}
/**
* 传入多个promise对象,当全部结束时取消Loading
* @param promises 传入多个promise对象,当全部结束时取消Loading
*/
const promiseList = (...promises: Promise<void>[]) => {
// loading方法全局封装成一个组件
!guid && (loading.value = true);
try {
Promise.all(promises).then(res => {
loading.value = false;
});
} catch (e) {
loading.value = false;
} finally {
!guid && (loading.value = false);
}
};
// 获取模型
const getModel = () => {
getConfigureList({ pageSize: -1, pageIndex: 1, bizState: 'Y' }).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data.records || [];
typeMap.value.modelGuid = JSON.parse(JSON.stringify(data));
let item = baseConfigFormItems.value.find(item => item.field == 'modelGuid');
item && (item.options = data);
}
})
}
// 获取所有疾病数据
const getDiseaseData = () => {
getDiseaseAll().then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || [];
typeMap.value.diseaseGuid = JSON.parse(JSON.stringify(data));
let item = baseConfigFormItems.value.find(item => item.field == 'diseaseGuid');
if (item) {
item.options = typeMap.value['diseaseGuid'];
if (guid) {
const diseaseData = typeMap.value.diseaseGuid.find(m => m.guid == flowDetail.value.diseaseGuid);
if (!diseaseData) {
item.options.unshift({
guid: flowDetail.value.diseaseGuid,
diseaseName: flowDetail.value.diseaseName
});
}
}
}
}
})
}
// 获取数据资源
const getDataCatalog = () => {
return getDamCatalogList({ dataType: userData.superTubeFlag == 'Y' ? "P" : "D", sceneType: "D" }).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data.records || [];
typeMap.value.dataResourceGuid = JSON.parse(JSON.stringify(data));
let item = baseConfigFormItems.value.find(item => item.field == 'dataResourceGuid');
if (item) {
item.options = data;
if (guid) {
const rItem = typeMap.value.dataResourceGuid.find(m => m.damGuid == flowDetail.value.dataResourceGuid);
if (!rItem) {
const rtem = { damGuid: flowDetail.value.dataResourceGuid, damName: flowDetail.value.dataResourceName };
item.options.unshift(rtem);
typeMap.value.dataResourceGuid.unshift(rtem);
}
}
}
}
})
}
// 获取数据资源主题
const getSourceThem = (dictType, fieldName) => {
return getAllFlowData({ dictType }).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || [];
typeMap.value[fieldName] = JSON.parse(JSON.stringify(data));
let item = baseConfigFormItems.value.find(item => item.field == fieldName);
item && (item.options = data);
} else {
proxy.$ElMessage.error(res.msg);
}
})
}
// 获取数据字典
const getDataType = (dictType, fieldName) => {
getAllFlowData({ dictType }).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || [];
typeMap.value[fieldName] = JSON.parse(JSON.stringify(data));
let item = baseConfigFormItems.value.find(item => item.field == fieldName);
item && (item.options = data);
} else {
proxy.$ElMessage.error(res.msg);
}
})
}
// 获取详情
const getDetail = () => {
loading.value = true;
getPriceDetail({ guid }).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || {};
flowDetail.value = data;
dataTransactionPrice.value = flowDetail.value.dataTransactionPrice;
dataUsage.value = data.dataUsage || '';
const mItem = typeMap.value.modelGuid.find(m => m.guid == flowDetail.value.modelGuid);
if (!mItem) {
const mtem = { guid: flowDetail.value.modelGuid, modelName: flowDetail.value.modelName };
typeMap.value.modelGuid.unshift(mtem);
baseConfigFormItems.value[0].options.unshift(mtem);
};
getModelInfo(flowDetail.value.modelGuid);
getDataTypeList()
}
}).catch(() => {
loading.value = false;
})
}
const getDataTypeList = () => {
if (guid) {
promiseList(
getDataCatalog(),
getSourceThem('数据资产目录主题名称', 'belongingTheme'),
getQuilityModelScore(flowDetail.value.dataResourceGuid)
)
} else {
promiseList(
getDataCatalog(),
getSourceThem('数据资产目录主题名称', 'belongingTheme'),
)
}
}
const setFormItemData = () => {
let dictionaryList: any = [], diseaseList: any = [];
pricingTargetList.value.map(item => {
switch (item.targetType) {
case '2':
item.functionName == '2' && diseaseList.push(item);
break;
case '3':
dictionaryList.push(item);
break;
default:
break;
}
})
dictionaryData.value = dictionaryList;
diseaseData.value = diseaseList;
if (diseaseList.length) {
const diseaseName = flowDetail.value.diseaseName || '';
const modelGuid = flowDetail.value.modelGuid || '';
// 获取疾病得分
if (diseaseName && modelGuid) {
getTargetNum({ diseaseName, guid: modelGuid });
}
}
baseConfigFormItems.value.splice(4);
for (var r in baseConfigFormRules.value) {
if (r != 'modelGuid' && r != 'dataResourceGuid') {
delete baseConfigFormRules.value[r];
}
}
// 添加所属疾病
if (diseaseList.length > 0) {
baseConfigFormItems.value.push({
label: '所属疾病',
type: 'cascader',
placeholder: '请选择',
field: 'diseaseGuid',
default: '',
options: [],
showAllLevels: false,
props: {
checkStrictly: true,
label: "diseaseName",
value: "guid",
children: 'childList',
emitPath: false
},
filterable: true,
clearable: true,
required: true,
});
baseConfigFormRules.value.diseaseGuid = { required: true, trigger: 'change', message: "请选择所属疾病" };
if (typeMap.value['diseaseGuid'] == undefined) {
getDiseaseData();
} else {
let item = baseConfigFormItems.value.find(item => item.field == 'diseaseGuid');
if (item) {
item.options = typeMap.value['diseaseGuid'];
const diseaseData = typeMap.value.diseaseGuid.find(m => m.guid == flowDetail.value.diseaseGuid);
if (!diseaseData) {
item.options.unshift({
guid: flowDetail.value.diseaseGuid,
diseaseName: flowDetail.value.diseaseName
});
}
}
}
}
// 添加数据字典
dictionaryList.map(d => {
const dictName = d.dictionaryName;
const dictField = `dict_${d.guid}`;
baseConfigFormItems.value.push({
label: dictName,
type: 'select',
placeholder: '请输入',
field: dictField,
default: '',
options: [],
clearable: true,
filterable: true,
required: true,
});
baseConfigFormRules.value[dictField] = { required: true, trigger: 'change', message: `请选择${dictName}` };
(() => {
if (typeMap.value[dictField] == undefined) {
getDataType(dictName, dictField)
} else {
let item = baseConfigFormItems.value.find(item => item.field == dictField);
item && (item.options = typeMap.value[dictField]);
}
})()
})
setTimeout(() => {
baseConfigFormRef.value.ruleFormRef?.clearValidate();
}, 100)
}
const setdemandTableData = (mGuid = '') => {
const tList = flowDetail.value.dataPricingDemandmatchingRQVOS || demandTableList.value || [];
let tDatas: any = [];
if (guid) {
if (mGuid) {
tDatas = mGuid == flowDetail.value.modelGuid ? tList : demandTableList.value || [];
} else {
tDatas = tList;
}
} else {
tDatas = tList;
}
setTableData(JSON.parse(JSON.stringify(tDatas)))
}
const setTableData = (dataArr) => {
tableData.value.splice(0);
dataArr.map((item, i) => {
const demInfo = pricingTargetList.value.find(t => t.demandTableGuid == (item.demandTableGuid || item.guid));
const demWeight = demInfo?.weight || '';
tableData.value.push({
...item,
demandTableName: item.demandTableName || item.menuName,
dataTableGuid: item.dataTableGuid || '',
tableDescription: item.tableDescription || '',
weightDemandTable: item.weightDemandTable ? parseFloat(item.weightDemandTable).toFixed(2) : (demWeight ? parseFloat(demWeight).toFixed(2) : ''),
dataFields: item.pricingDemandFieldRQVOS || [],
dataFieldsNum: item.dataFieldsNum || 0,
})
if ((item.demandTableGuid || item.guid)) {
const rGuid = item.demandTableGuid || item.guid;
const rIndex = i;
if (!guid || (guid && rGuid != (demInfo?.demandTableGuid || ''))) {
(() => {
getDemandField(rGuid, rIndex);
})()
}
}
})
resourceTableFieldAllNum.value = tableData.value.reduce((accumulator, currentValue) => {
return accumulator + Number(currentValue.dataFieldsNum);
}, 0);
setTimeout(() => {
tableData.value.map(t => {
expendTableRef.value.toggleRowExpansion(t);
})
}, 200)
}
// 获取模型配置信息
const getModelConfig = (mGuid) => {
return getModelDemand({ guid: mGuid }).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || [];
demandTableList.value = data.pricingDemandMenuRSVOS || [];
pricingTargetList.value = data.pricingTargetRSVOS || [];
demandTableFieldAllNum.value = data.fieldCount || 0;
}
})
}
// 获取模型详情
const getModelDetail = (mGuid) => {
return getConfigureDetail({ guid: mGuid }).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || [];
modelData.value = data;
const pricingDimensionality = data.pricingDimensionalityRSVOS || [];
let tData: any = [];
pricingDimensionality.map(p => {
p.pricingTargetRSVOS.map(t => {
tData.push({ ...p, ...t })
})
})
pricingDimensionalityData.value = tData;
}
})
}
// 获取资源详情
const getResourceDetail = (sGuid, toPromise = true) => {
const detailData = getRegisterCatalogDetail(sGuid).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || {};
baseConfigFormItems.value.map(item => {
if (item.field == 'belongingEntityGuid') {
item.default = data.tenantName || '';
} else if (item.field == 'belongingTheme') {
item.default = data.subjectDomain || '';
}
})
const damCatalogTableInfo = data.damCatalogTableInfo || [];
const damOptions = damCatalogTableInfo.map(item => {
return {
...item,
label: item.tableName,
value: item.guid
}
})
tableData.value.map((item, i) => {
item.damDataTable = JSON.parse(JSON.stringify(damOptions));
if (guid && sGuid == flowDetail.value.dataResourceGuid) {
const sData = flowDetail.value.dataPricingDemandmatchingRQVOS?.find(s => s.demandTableGuid == item.demandTableGuid);
if (sData) {
item.dataTableGuid = sData.dataTableGuid;
item.dataFields.map(f => {
const fData = sData.pricingDemandFieldRQVOS.find(t => t.guid == f.guid);
f.enName = fData?.enName || '';
f.chName = fData?.chName || '';
});
item.tableDescription = sData.tableDescription || damOptions.find(t => t.guid == sData.dataTableGuid)?.tableDescription || '';
item.dataFieldsNum = item.dataFields.filter(item => item.chName != '' && item.chName != null).length;
resourceTableFieldAllNum.value = tableData.value.reduce((accumulator, currentValue) => {
return accumulator + Number(currentValue.dataFieldsNum);
}, 0);
}
} else {
item.dataTableGuid = '';
item.dataFields.map(f => { f.enName = ''; f.chName = '' });
item.dataFieldsNum = 0;
item.tableDescription = '';
resourceTableFieldAllNum.value = 0;
}
const dGuid = item.dataTableGuid;
const rIndex = i;
(() => {
!toPromise && dGuid && setTableRowData(dGuid, rIndex)
})()
})
resourceTableAllNum.value = tableData.value.filter(item => item.dataTableGuid != '' && item.dataTableGuid != null).length;
}
});
if (toPromise) {
return detailData;
} else {
(() => detailData)()
}
}
// 获取质量模型评分
const getQuilityModelScore = (sGuid) => {
return getModelScore({ damGuid: sGuid }).then((res: any) => {
if (res.code === proxy.$passCode) {
const data = res.data || {};
qualityScoreData.value = data;
} else {
proxy.$ElMessage.error(res.msg);
}
})
}
// 獲取模型相关信息
const getModelInfo = (mGuid) => {
const promises: any = [
getModelConfig(mGuid),
getModelDetail(mGuid)
];
try {
loading.value = true;
Promise.all(promises).then(res => {
loading.value = false;
setFormItemData();
if (guid && mGuid == flowDetail.value.modelGuid) {
dataTransactionPrice.value = flowDetail.value.dataTransactionPrice;
setTimeout(() => {
getResourceDetail(flowDetail.value.dataResourceGuid, false);
setFormItems();
setdemandTableData(mGuid);
}, 200);
} else {
setdemandTableData(mGuid);
}
});
} catch (e) {
loading.value = false;
}
}
// 获取数据资源管理信息
const getResourceInfo = (sGuid) => {
const promises: any = [getResourceDetail(sGuid), getQuilityModelScore(sGuid)];
try {
loading.value = true;
Promise.all(promises).then(res => {
loading.value = false;
});
} catch (e) {
loading.value = false;
}
}
const setTableRowData = (dGuid, rIndex) => {
let rowData = tableData.value[rIndex];
if (guid && dGuid == rowData.dataTableGuid) {
const sourceTableField = flowDetail.value.dataPricingDemandmatchingRQVOS?.find(s => dGuid == s.dataTableGuid);
const pricingDemandField = sourceTableField?.pricingDemandFieldRQVOS || [];
rowData.dataFields.map(f => {
f.chName = pricingDemandField.find(s => f.guid == s.guid)?.chName || ''
})
} else {
rowData.dataFields.map(f => f.chName = '')
}
const damData = rowData.damDataTable.find(item => item.guid == dGuid);
rowData.tableDescription = damData?.tableDescription || '';
rowData.dataFieldsNum = rowData.dataFields.filter(item => item.chName != '' && item.chName != null).length;
resourceTableFieldAllNum.value = tableData.value.reduce((accumulator, currentValue) => {
return accumulator + Number(currentValue.dataFieldsNum);
}, 0);
resourceTableAllNum.value = tableData.value.filter(item => item.dataTableGuid != '' && item.dataTableGuid != null).length;
if (dGuid) {
tableLoading.value = true;
getRegisterCatalogTableDetail(dGuid).then((res: any) => {
tableLoading.value = false;
if (res.code == proxy.$passCode) {
const data = res.data || {};
const damTableField = data.damCatalogTableField || [];
const damFieldOptions = damTableField.map(d => {
return {
...d,
label: d.chName || '',
value: d.chName || ''
}
})
rowData.dataFields.map(t => {
t.damFieldTable = JSON.parse(JSON.stringify(damFieldOptions));
})
// console.log('rowData', rowData)
} else {
proxy.$ElMessage.error(res.msg);
}
}).catch(() => {
tableLoading.value = false;
})
}
}
const changeDatasource = () => {
baseConfigFormItems.value.map(item => {
if (item.field == 'belongingEntityGuid') {
item.default = '';
} else if (item.field == 'belongingTheme') {
item.default = '';
}
})
}
const cascaderChange = (val) => {
disScore.value = [];
if (val) {
const baseConfigFormObj = baseConfigFormRef.value;
const baseConfigFormInfo = baseConfigFormObj.formInline;
const parentsData = baseConfigFormObj.getCascaderCheckedData();
const diseaseName = parentsData[0]?.label || '';
const modelGuid = baseConfigFormInfo.modelGuid;
// 获取疾病得分
getTargetNum({ diseaseName, guid: modelGuid });
}
}
const selectChange = async (val, row, info) => {
dataTransactionPrice.value = '';
if (row.field == 'modelGuid') {
tableData.value = [];
demandTableFieldAllNum.value = 0;
resourceTableAllNum.value = 0;
resourceTableFieldAllNum.value = 0;
await setFormItems(info);
val && getModelInfo(val);
qualityScoreData.value = {};
baseConfigFormItems.value[1].default = '';
changeDatasource();
} else if (row.field == 'dataResourceGuid') {
await setFormItems(info);
qualityScoreData.value = {};
resourceTableAllNum.value = 0;
resourceTableFieldAllNum.value = 0;
if (val) {
getResourceInfo(val);
} else {
changeDatasource();
}
} else if (row.field == 'dataTableGuid') {
setTableRowData(val, info.$index)
} else if (row.field == 'chName') {
let tData = info.row;
if (val) {
const damData = tData.dataFields[row.index].damFieldTable.find(item => item.chName == val);
tData.dataFields[row.index].enName = damData?.enName || '';
} else {
tData.dataFields[row.index].enName = '';
}
tData.dataFieldsNum = tData.dataFields.filter(item => item.chName != '' && item.chName != null).length;
resourceTableFieldAllNum.value = tableData.value.reduce((accumulator, currentValue) => {
return accumulator + Number(currentValue.dataFieldsNum);
}, 0);
} else {
setFormItems(info);
}
}
// 获取需求表字段
const getDemandField = (rGuid, rIndex) => {
getDemandList({
pageSize: -1,
pageIndex: 1,
relationMenuGuid: rGuid,
bizState: 'Y'
}).then((res: any) => {
tableLoading.value = false;
if (res.code == proxy.$passCode) {
const data = res.data || {};
const fData = data.records || [];
const tFields = tableData.value[rIndex].dataFields;
const tData = fData.map(item => {
const iData = tFields.find(t => t.demandFieldGuid == item.guid) || {};
return {
...item,
fieldName: item.fieldName,
isRequired: item.isRequired,
chName: item.chName || '',
enName: item.enName || '',
...iData
}
});
tableData.value[rIndex].dataFields = tData;
} else {
proxy.$ElMessage.error(res.msg);
}
}).catch(() => {
tableLoading.value = false;
})
}
const toPath = () => {
userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
assetStore.set(true);
router.push({
name: 'priceCalculate',
})
}
// 获取维度公式计算结果
const getSignatory = (row) => {
let formulaVal = 0;
const pricingTargetData = row.pricingTargetRSVOS || [];
if (!row.computationalFormula || row.computationalFormula == 'custom') {
let formula = row.customize;
// 遍历数组,检查 customize 是否包含对应的 targetName,若包含则替换为 tNum
pricingTargetData.forEach((item) => {
if (formula.includes(item.targetName)) {
formula = formula.replace(new RegExp(item.targetName, 'g'), item.tNum);
}
});
// 使用 eval 计算公式结果(注意:eval 存在安全风险,仅适用于受控环境)
try {
formulaVal = eval(formula);
} catch (error) {
console.error('公式计算错误:', error);
}
} else {
const formula = pricingTargetData.map(item => item.tNum);
if (row.computationalFormula == '3') {
formulaVal = formula.reduce((accumulator, currentValue) => parseFloat(accumulator) * parseFloat(currentValue), 1); // 初始值为1
} else {
formulaVal = formula.reduce((accumulator, currentValue) => parseFloat(accumulator) + parseFloat(currentValue), 0); // 初始值为0
}
}
return (Math.round(formulaVal * 100) / 100).toFixed(2);
};
const getTargetNum = (params) => {
// loading.value = true;
getPriceResult(params).then((res: any) => {
// loading.value = false;
if (res.code === proxy.$passCode) {
const data = res.data || [];
disScore.value = data;
} else {
proxy.$ElMessage.error(res.msg);
}
}).catch(() => {
// loading.value = false;
});
}
// 生成报告内容
const reporting = (formInfo) => {
let resultInfo: any = [];
const signatoryData = JSON.parse(JSON.stringify(modelData.value.pricingDimensionalityRSVOS || '[]'));
signatoryData.map((sign, s) => {
resultInfo.push({
dimensionalityName: sign.dimensionalityName,
computationalFormula: sign.computationalFormula,
customize: sign.customize,
pricingTargetRSVOS: []
});
const targets = sign.pricingTargetRSVOS || [];
const signTargets = targets.map(t => {
let tNum: any = 0, tCustomize = '';
if (t.targetType == '3') { // 指标类型-数据字典
const tName = dictionaryData.value.find(d => d.guid == t.guid) ? `dict_${t.guid}` : '';
if (tName) {
const pVal = typeMap.value[tName].find(t => t.value == formInfo[tName]);
const dictionary = t.dictionaryJson.find(d => d.name == pVal.label);
if (sign.computationalFormula == '1') {// 加权平均
tNum = parseFloat(t.weight) / 100 * parseFloat(dictionary?.value || t.defaultValue || 0);
tCustomize = `权重${parseFloat(t.weight) / 100} * 因子/默认值${parseFloat(dictionary?.value || t.defaultValue || 0)}`;
} else { // 其他
tNum = parseFloat(dictionary?.value || t.defaultValue || 0);
tCustomize = `默认值${parseFloat(dictionary?.value || t.defaultValue || 0)}`;
}
t.dictionaryName == '数据用途' && (dataUsage.value = pVal.value || '');
}
} else if (t.targetType == '2') {// 指标类型-系统功能
if (t.functionName == '1') { // 功能名称-质量评价模型
const score = parseFloat(qualityScoreData.value.qualityScore || 0);
tNum = parseFloat(t.weight || 1) / 100 * score;
tCustomize = `权重${parseFloat(t.weight) / 100} * 模型评分${score}`;
} else if (t.functionName == '2') { // 功能名称-疾病管理
if (sign.computationalFormula == '1') {// 加权平均
const score = parseFloat(disScore.value.find(d => d.guid == t.guid)?.factor || 0);
tNum = parseFloat(t.weight) / 100 * score;
tCustomize = `权重${parseFloat(t.weight) / 100} * 疾病得分${score}`;
} else { //其他
tNum = parseFloat(disScore.value.find(d => d.guid == t.guid)?.factor || 0);
tCustomize = `疾病得分${tNum}`;
}
} else if (t.functionName == '3') {// 功能名称-需求表管理
const tData = tableData.value.find(f => f.demandTableGuid == t.demandTableGuid || f.guid == t.demandTableGuid);
if (tData) {
if (sign.computationalFormula == '1') {// 加权平均
tNum = parseFloat(t.weight) / 100 * (parseFloat(tData.dataFieldsNum) / tData.dataFields.length || parseFloat(t.defaultValue || 0));
tCustomize = `权重${parseFloat(t.weight) / 100} * 匹配率/默认值${parseFloat(tData.dataFieldsNum) / tData.dataFields.length || parseFloat(t.defaultValue || 0)}`;
} else { //其他
tNum = parseFloat(tData.dataFieldsNum) / tData.dataFields.length || parseFloat(t.defaultValue || 0);
tCustomize = `匹配率/默认值${parseFloat(tData.dataFieldsNum) / tData.dataFields.length || parseFloat(t.defaultValue || 0)}`;
}
}
}
} else { // 指标类型-系统内置
if (sign.computationalFormula == '1') {// 加权平均
tNum = parseFloat(t.weight) / 100 * parseFloat(t.defaultValue || 0);
tCustomize = `权重${parseFloat(t.weight) / 100} * 默认值${parseFloat(t.defaultValue || 0)}`;
} else { //其他
tNum = parseFloat(t.defaultValue || 0);
tCustomize = `默认值${parseFloat(t.defaultValue || 0)}`;
}
}
t.tNum = (Math.round(parseFloat(tNum) * 100) / 100).toFixed(2);
resultInfo[s].pricingTargetRSVOS.push({
targetName: t.targetName,
targetType: t.targetType,
functionName: t.functionName,
customize: tCustomize,
tNum: t.tNum,
})
return t;
})
sign.pricingTargetRSVOS = signTargets;
sign.sNum = getSignatory(sign);
resultInfo[s].sNum = sign.sNum;
})
// exportData.value = resultInfo;
return { signatoryData, resultInfo };
}
// 计算价格
const calculatePrice = (pData) => {
let modelFormula = modelData.value.modelFormula;
// 1. 移除所有干扰的引号(确保是数学表达式)
modelFormula = modelFormula.replace(/["']/g, "");
// 1. 提取变量名(中文、英文、数字、下划线)
const variableRegex = /[\u4e00-\u9fa5a-zA-Z_][\u4e00-\u9fa5a-zA-Z0-9_]*/g;
const variableNames = modelFormula.match(variableRegex) || [];
// 2. 去重
const uniqueVariables = [...new Set(variableNames)];
// 3. 构建变量映射 { 销售额: 2000, 成本: 500.5, ... }
const variables = {};
uniqueVariables.forEach(name => {
const dim = pData.find(d => d.dimensionalityName === name);
variables[name] = dim ? parseFloat(dim.sNum) : 0; // 找不到则默认为 0
});
// 4. 替换变量为数值(不加引号,确保是数字运算)
let expression = modelFormula;
uniqueVariables.forEach(name => {
expression = expression.replace(new RegExp(name, 'g'), variables[name]);
});
// 5. 安全计算(推荐 math.js,或 new Function)
try {
//如果用 eval,确保表达式格式正确
const resultNum = eval(expression);
dataTransactionPrice.value = (Math.round(parseFloat(resultNum) * 100) / 100).toFixed(2);
} catch (error) {
console.error('公式计算错误:', error);
return NaN;
}
};
// 计算结果和提交
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 => {
const targetList: any = [];
e.pricingTargetRSVOS.map(t => {
if (t.targetType == '2' && t.functionName == '1') {
hasModelScore = true;
} else {
targetList.push({
targetName: t.targetName,
tNum: t.tNum,
})
}
})
const targetStr = targetList.length ? targetList.map(t => `${t.targetName}为${changeNum(t.tNum, 2)}`).join('、') : '';
targetStr && 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 = qualityScoreData.value.largeCategoryScoreList || [];
const largeCategoryScore = largeCategoryScoreList.map(q => `${q.largeCategoryName}方面得分为${changeNum(q.largeCategoryScore || 0, 2)}`);
dictListStr += largeCategoryScore.length ? `;\n数据的总体质量得分为${changeNum(qualityScoreData.value.qualityScore || 0, 2)}。其中${largeCategoryScore.join(',')}` : `;\n数据的总体质量得分为${changeNum(qualityScoreData.value.qualityScore || 0, 2)}。`
}
exportOut.three = `${baseConfigFormInfo.belongingEntityGuid}持有的\"${damName}\"的数据(患者人次)单价为${changeNum(dataTransactionPrice.value, 2)}元`;
exportOut.three = dictListStr ? `${exportOut.three};其中${dictListStr}` : `${exportOut.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);
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 || '';
let params: any = {
tenantGuid: userData.tenantGuid,
dataTransactionPrice: dataTransactionPrice.value,
modelGuid: baseConfigFormInfo.modelGuid,
modelName,
dataResourceGuid: baseConfigFormInfo.dataResourceGuid,
dataResourceName,
belongingEntityGuid: baseConfigFormInfo.belongingEntityGuid,
belongingTheme: baseConfigFormInfo.belongingTheme,
diseaseGuid,
diseaseName: '',
dataUsage: dataUsage.value
};
if (diseaseGuid) {
const parentsData = baseConfigFormObj.getCascaderCheckedData();
params.diseaseName = parentsData[0]?.label || '';
}
let dictionaryJson = {};
for (var b in baseConfigFormInfo) {
if (b.indexOf('dict_') > -1) {
dictionaryJson[b] = baseConfigFormInfo[b];
}
}
params.dictionaryJson = Object.keys(dictionaryJson).length ? JSON.stringify(dictionaryJson) : '';
let demandMatchingData: any = [];
tableData.value.map(item => {
demandMatchingData.push({
demandTableName: item.demandTableName,
demandTableGuid: item.demandTableGuid || item.guid, // 需求表guid
dataTableGuid: item.dataTableGuid, // 数据资源表guid
weightDemandTable: item.weightDemandTable,
dataFieldsNum: item.dataFieldsNum,
pricingDemandFieldRQVOS: item.dataFields.map(d => {
return {
demandFieldGuid: d.demandFieldGuid || d.guid, // 资源表字段guid
fieldName: d.fieldName,
enName: d.enName,
chName: d.chName,
isRequired: d.isRequired
}
})
})
});
params.dataPricingDemandmatchingRQVOS = demandMatchingData;
guid && (params.guid = guid);
loading.value = true;
savePrice(params).then((res: any) => {
loading.value = false;
if (res.code == proxy.$passCode) {
ElMessage({
type: "success",
message: guid ? '编辑数据定价成功' : '新增数据定价成功',
});
toPath()
} else {
proxy.$ElMessage.error(res.msg);
}
}).catch(() => {
loading.value = false;
});
}
} else {
expand1.value = true;
var obj = Object.keys(errorItem);
baseConfigFormEl.scrollToField(obj[0]);
}
})
}
const btnClick = async (btn, row: any = null) => {
const type = btn.value;
if (type == 'dim') {
baseConfigFormItems.value.at(-1).default += btn.name;
} else if (type == 'del-signatory') {
open('确定要删除该条维度数据吗?', 'warning');
} else if (type == 'expend') {
expendTableRef.value.toggleRowExpansion(row);
} else if (type == 'calculate' || type == 'submit') {
if (type == 'submit') {
ElMessageBox.confirm(dataTransactionPrice.value === '' ? '是否直接计算价格并提交' : '请确认当前数据交易价格是否为最新计算结果', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
checkForm(type);
}).catch(() => {
ElMessage.info('已取消提交操作');
});
} else {
checkForm(type);
}
} else if (type == 'export') {
ElMessageBox.confirm(dataTransactionPrice.value === '' ? '是否直接计算价格并下载' : '请确认当前数据交易价格是否为最新计算结果', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
checkForm(type);
}).catch(() => {
ElMessage.info('已取消下载操作');
});
} else if (type == 'cancel') {
ElMessageBox.confirm(
"当前页面尚未保存,确定关闭吗?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
).then(() => {
toPath()
}).catch(() => {
ElMessage({
type: "info",
message: "已取消",
});
});
}
}
onActivated(() => {
let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === router.currentRoute.value.fullPath);
if (tab) {
switch (route.query.type) {
case 'create':
tab.meta.title = `新增数据定价`;
break;
case 'edit':
tab.meta.title = `编辑-${priceName}`;
break;
case 'detail':
tab.meta.title = `详情-${priceName}`;
break;
}
}
getModel()
})
onBeforeMount(() => {
if (guid) {
getDetail();
} else {
getDataTypeList();
getModel()
}
})
onMounted(() => {
})
</script>
<template>
<div class="container_wrap full" v-loading="loading">
<div class="content_main panel">
<ContentWrap id="contract-content-wrap" title="输入参数" expandSwicth style="margin-top: 15px" :isExpand="expand1"
@expand="(v) => expand1 = v">
<Form ref="baseConfigFormRef" formId="contract-content-form" :itemList="baseConfigForm.items"
:rules="baseConfigForm.rules" col="col3" @selectChange="selectChange" @cascaderChange="cascaderChange" />
</ContentWrap>
<ContentWrap id="contract-signatory-wrap" title="需求匹配" expandSwicth style="margin-top: 15px" :isExpand="expand2"
@expand="(v) => expand2 = v">
<div class="table_panel_wrap">
<div class="table_tool">
<div class="tool_title">
<div class="title_desc">
<span>需求表数量:</span>
<span class="text-num">{{ demandTableList.length }}</span>
<span>张,字段数:</span>
<span class="text-num">{{ demandTableFieldAllNum }}</span>
<span>匹配表数量:</span>
<span class="text-num">{{ resourceTableAllNum }}</span>
<span>张,字段数:</span>
<span class="text-num">{{ resourceTableFieldAllNum }}</span>
</div>
</div>
</div>
<div class="table_panel" v-loading="tableLoading">
<el-table ref="expendTableRef" border :data="tableData" row-key="demandTableName" tooltip-effect="light"
style="height: 100%;">
<el-table-column type="expand">
<template #default="props">
<div class="expand_panel">
<div class="table_tool">
<div class="tool_title">
<div class="title_desc">
<span>需求字段数:</span>
<span class="text-num">{{ props.row.dataFields.length }}</span>
<span>个,匹配字段数:</span>
<span class="text-num">{{ props.row.dataFieldsNum }}</span>
</div>
</div>
</div>
<el-table :data="props.row.dataFields" border>
<el-table-column label="序号" type="index" width="56" align="center" />
<el-table-column label="需求字段中文" prop="fieldName" class-name="edit-col">
<template #default="scope">
<el-input v-model.trim="scope.row.fieldName" placeholder="请输入" disabled />
</template>
</el-table-column>
<el-table-column label="匹配字段中文" prop="chName" class-name="edit-col">
<template #default="scope">
<el-select v-model="scope.row.chName" clearable filterable
@change="val => selectChange(val, { field: 'chName', index: scope.$index }, props)">
<el-option v-for="(opt, o) in scope.row.damFieldTable" :label="opt.label" :value="opt.value"
:key="o" />
</el-select>
</template>
</el-table-column>
<el-table-column label="匹配字段英文" prop="enName" class-name="edit-col">
<template #default="scope">
<el-input v-model.trim="scope.row.enName" placeholder="请输入" disabled />
</template>
</el-table-column>
<el-table-column label="是否必需字段" prop="isRequired" class-name="edit-col">
<template #default="scope">
<el-select v-model="scope.row.isRequired" disabled>
<el-option label="是" value="Y" />
<el-option label="否" value="N" />
</el-select>
</template>
</el-table-column>
</el-table>
</div>
</template>
</el-table-column>
<el-table-column label="序号" type="index" width="56" align="center" />
<el-table-column v-for="item in tableFields" :key="item.field" :label="item.label" :prop="item.field"
:width="item.width" :align="item.align" class-name="edit-col">
<template #default="scope">
<el-select v-if="item.type == 'select'" v-model="scope.row[item.field]" clearable filterable
@change="val => selectChange(val, item, scope)">
<el-option v-for="(opt, o) in scope.row.damDataTable" :label="opt.label" :value="opt.value"
:key="o" />
</el-select>
<el-input v-else v-model.trim="scope.row[item.field]" :disabled="item.disabled" placeholder="请输入"
clearable />
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="100">
<template #default="scope">
<el-button type="primary" link @click="btnClick({ value: 'expend' }, scope.row)">字段映射</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</ContentWrap>
<ContentWrap id="contract-content-wrap" title="输出结构" expandSwicth style="margin-top: 15px" :isExpand="expand3"
@expand="(v) => expand3 = v">
<el-form class="result-form">
<el-form-item class="flex-column" label="数据交易价格(元)">
<el-input v-model="dataTransactionPrice" placeholder="" disabled style="display: none;" />
<div class="result-price">{{ changeNum(dataTransactionPrice, 2) }}</div>
</el-form-item>
<el-form-item class="align-end" style="margin-bottom: 14px;">
<el-button type="primary" @click="btnClick({ value: 'calculate' })">开始计算</el-button>
<el-button @click="btnClick({ value: 'export' })">下载报告</el-button>
<span style="margin-left: 8px">输出结果报告查看</span>
</el-form-item>
</el-form>
</ContentWrap>
</div>
<div class="tool_btns">
<div class="btns">
<el-button @click="btnClick({ value: 'cancel' })">取消</el-button>
<el-button type="primary" @click="btnClick({ value: 'submit' })">提交</el-button>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.container_wrap {
overflow: hidden;
.content_main {
height: calc(100% - 45px);
overflow: hidden auto;
&.panel {
padding: 0 16px 16px;
}
:deep(.el-card) {
&#contract-signatory-wrap {
.card-body-content {
padding: 8px 16px;
}
}
}
.signatory-tags {
margin-bottom: 11px;
}
.table_panel_wrap {
margin-bottom: 4px;
.table_tool {
height: 36px;
display: flex;
justify-content: space-between;
align-items: center;
.tool_title {
width: 100%;
display: flex;
justify-content: start;
}
.title_desc {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
.text-num {
color: var(--el-color-primary);
margin: 0 8px;
}
}
}
.table_panel {
margin-bottom: 4px;
height: 392px;
:deep(.el-table) {
.el-table__cell {
&.edit-col {
padding: 4px 0;
.cell {
padding: 0 4px;
.el-cascader {
width: 100%;
height: 28px;
}
.el-input {
height: 28px;
}
}
}
.expand-icon {
color: #888;
margin-right: 8px;
vertical-align: text-bottom;
cursor: pointer;
}
}
.el-input.is-disabled .el-input__wrapper {
background-color: var(--el-disabled-bg-color);
}
.el-select__wrapper.is-disabled {
background-color: var(--el-disabled-bg-color);
}
}
.expand_panel {
padding: 6px;
margin: -6px 0;
background: #fff;
}
}
}
}
.btn-block {
width: 100%;
margin: 16px 0 8px;
}
.tool_btns {
height: 44px;
margin: 0 -8px;
display: flex;
justify-content: center;
align-items: center;
border-top: 1px solid #d9d9d9;
}
}
:deep(.el-form) {
&.result-form {
display: flex;
.el-form-item {
&.flex-column {
width: calc(33.33% - 6px);
margin-right: 8px;
display: flex;
flex-direction: column;
align-items: self-start;
.el-form-item__content {
width: 100%;
}
.result-price {
width: 100%;
height: 32px;
line-height: 32px;
padding: 1px 11px;
border-radius: 4px;
cursor: not-allowed;
color: var(--el-disabled-text-color);
background-color: var(--el-disabled-bg-color);
box-shadow: 0 0 0 1px var(--el-disabled-border-color) inset;
}
}
&.align-end {
align-self: flex-end;
}
}
}
.el-select__wrapper.is-disabled {
background-color: var(--el-disabled-bg-color);
}
}
</style>