3ad84ff1 by lihua

fix: 修复新增定价切换模型问题

1 parent 2623ab08
...@@ -199,7 +199,7 @@ const getDiseaseData = () => { ...@@ -199,7 +199,7 @@ const getDiseaseData = () => {
199 item.options = typeMap.value['diseaseGuid']; 199 item.options = typeMap.value['diseaseGuid'];
200 if (guid) { 200 if (guid) {
201 const diseaseData = typeMap.value.diseaseGuid.find(m => m.guid == flowDetail.value.diseaseGuid); 201 const diseaseData = typeMap.value.diseaseGuid.find(m => m.guid == flowDetail.value.diseaseGuid);
202 if (!diseaseData) { 202 if (!diseaseData && flowDetail.value.diseaseGuid) {
203 item.options.unshift({ 203 item.options.unshift({
204 guid: flowDetail.value.diseaseGuid, 204 guid: flowDetail.value.diseaseGuid,
205 diseaseName: flowDetail.value.diseaseName 205 diseaseName: flowDetail.value.diseaseName
...@@ -501,7 +501,7 @@ const setTableData = (dataArr) => { ...@@ -501,7 +501,7 @@ const setTableData = (dataArr) => {
501 }, 0); 501 }, 0);
502 setTimeout(() => { 502 setTimeout(() => {
503 tableData.value.map(t => { 503 tableData.value.map(t => {
504 expendTableRef.value.toggleRowExpansion(t); 504 expendTableRef.value?.toggleRowExpansion(t);
505 }) 505 })
506 }, 200) 506 }, 200)
507 } 507 }
......
1 <route lang="yaml"> 1 <route lang="yaml">
2 name: calculateConfig 2 name: calculateConfigNew
3 </route> 3 </route>
4 <script lang="ts" setup name="calculateConfig"> 4 <script lang="ts" setup name="calculateConfigNew">
5 import { ref, onMounted } from "vue"; 5 import { ref, onMounted } from "vue";
6 import { useRouter, useRoute } from "vue-router"; 6 import { useRouter, useRoute } from "vue-router";
7 import { ElMessage, ElMessageBox } from "element-plus"; 7 import { ElMessage, ElMessageBox } from "element-plus";
...@@ -24,6 +24,7 @@ import { ...@@ -24,6 +24,7 @@ import {
24 } from '@/api/modules/dataPricing'; 24 } from '@/api/modules/dataPricing';
25 import { changeNum } from "@/utils/common"; 25 import { changeNum } from "@/utils/common";
26 import { useValidator } from '@/hooks/useValidator'; 26 import { useValidator } from '@/hooks/useValidator';
27 import { cloneDeep } from "lodash-es";
27 28
28 const { required } = useValidator(); 29 const { required } = useValidator();
29 const { proxy } = getCurrentInstance() as any; 30 const { proxy } = getCurrentInstance() as any;
...@@ -119,7 +120,7 @@ const productConfigFormRules = ref({ ...@@ -119,7 +120,7 @@ const productConfigFormRules = ref({
119 120
120 // 基础设置 121 // 基础设置
121 const baseConfigFormRef = ref(); 122 const baseConfigFormRef = ref();
122 const baseConfigFormItems: any = ref([ 123 const baseConfigInitFormItems: any = ref([
123 { 124 {
124 label: '模型名称', 125 label: '模型名称',
125 type: 'select', 126 type: 'select',
...@@ -189,6 +190,8 @@ const baseConfigFormItems: any = ref([ ...@@ -189,6 +190,8 @@ const baseConfigFormItems: any = ref([
189 // disabled: true 190 // disabled: true
190 // }, 191 // },
191 ]) 192 ])
193
194 const baseConfigFormItems = ref(cloneDeep(baseConfigInitFormItems.value));
192 const baseConfigFormRules: any = ref({ 195 const baseConfigFormRules: any = ref({
193 modelGuid: [ 196 modelGuid: [
194 { required: true, trigger: 'change', message: "请选择模型名称" } 197 { required: true, trigger: 'change', message: "请选择模型名称" }
...@@ -420,7 +423,7 @@ const setDiseaseFormItems = () => { ...@@ -420,7 +423,7 @@ const setDiseaseFormItems = () => {
420 if (item) { 423 if (item) {
421 item.options = typeMap.value['diseaseGuid']; 424 item.options = typeMap.value['diseaseGuid'];
422 const diseaseData = typeMap.value.diseaseGuid.find(m => m.guid == flowDetail.value.diseaseGuid); 425 const diseaseData = typeMap.value.diseaseGuid.find(m => m.guid == flowDetail.value.diseaseGuid);
423 if (!diseaseData) { 426 if (!diseaseData && flowDetail.value.diseaseGuid) {
424 item.options.unshift({ 427 item.options.unshift({
425 guid: flowDetail.value.diseaseGuid, 428 guid: flowDetail.value.diseaseGuid,
426 diseaseName: flowDetail.value.diseaseName 429 diseaseName: flowDetail.value.diseaseName
...@@ -558,7 +561,7 @@ const setTableData = (dataArr) => { ...@@ -558,7 +561,7 @@ const setTableData = (dataArr) => {
558 const rGuid = item.demandTableGuid || item.guid; 561 const rGuid = item.demandTableGuid || item.guid;
559 const rIndex = i; 562 const rIndex = i;
560 (() => { 563 (() => {
561 getDemandField(rGuid, rIndex); 564 // getDemandField(rGuid, rIndex);
562 })() 565 })()
563 } 566 }
564 }) 567 })
...@@ -567,7 +570,7 @@ const setTableData = (dataArr) => { ...@@ -567,7 +570,7 @@ const setTableData = (dataArr) => {
567 }, 0); 570 }, 0);
568 setTimeout(() => { 571 setTimeout(() => {
569 tableData.value.map(t => { 572 tableData.value.map(t => {
570 expendTableRef.value.toggleRowExpansion(t); 573 expendTableRef.value?.toggleRowExpansion(t);
571 }) 574 })
572 }, 200) 575 }, 200)
573 } 576 }
...@@ -612,7 +615,7 @@ const getQuilityModelScore = (sGuid) => { ...@@ -612,7 +615,7 @@ const getQuilityModelScore = (sGuid) => {
612 }) 615 })
613 } 616 }
614 // 獲取模型相关信息 617 // 獲取模型相关信息
615 const getModelInfo = (mGuid) => { 618 const getModelInfo = (mGuid, valueInfo = null) => {
616 const promises: any = [ 619 const promises: any = [
617 getModelConfig(mGuid), 620 getModelConfig(mGuid),
618 getModelDetail(mGuid) 621 getModelDetail(mGuid)
...@@ -626,7 +629,7 @@ const getModelInfo = (mGuid) => { ...@@ -626,7 +629,7 @@ const getModelInfo = (mGuid) => {
626 dataTransactionPrice.value = flowDetail.value.dataTransactionPrice; 629 dataTransactionPrice.value = flowDetail.value.dataTransactionPrice;
627 setTimeout(() => { 630 setTimeout(() => {
628 // getResourceDetail(flowDetail.value.dataResourceGuid, false); 631 // getResourceDetail(flowDetail.value.dataResourceGuid, false);
629 setFormItems(); 632 setFormItems(valueInfo);
630 setdemandTableData(mGuid); 633 setdemandTableData(mGuid);
631 }, 200); 634 }, 200);
632 } else { 635 } else {
...@@ -747,8 +750,15 @@ const selectChange = async (val, row, info) => { ...@@ -747,8 +750,15 @@ const selectChange = async (val, row, info) => {
747 demandTableFieldAllNum.value = 0; 750 demandTableFieldAllNum.value = 0;
748 resourceTableAllNum.value = 0; 751 resourceTableAllNum.value = 0;
749 resourceTableFieldAllNum.value = 0; 752 resourceTableFieldAllNum.value = 0;
750 await setFormItems(info); 753 baseConfigFormItems.value[0].default = val;
751 val && getModelInfo(val); 754 baseConfigFormItems.value = [baseConfigFormItems.value[0]];
755 if (val) {
756 getModelInfo(val, info);
757 } else {
758 setFormItems(info);
759 }
760 // await setFormItems(info);
761 // val && getModelInfo(val, info);
752 currModelGuid.value = val || ''; 762 currModelGuid.value = val || '';
753 qualityScoreData.value = {}; 763 qualityScoreData.value = {};
754 // baseConfigFormItems.value[1].default = ''; 764 // baseConfigFormItems.value[1].default = '';
...@@ -789,38 +799,38 @@ const selectChange = async (val, row, info) => { ...@@ -789,38 +799,38 @@ const selectChange = async (val, row, info) => {
789 } 799 }
790 } 800 }
791 // 获取需求表字段 801 // 获取需求表字段
792 const getDemandField = (rGuid, rIndex) => { 802 // const getDemandField = (rGuid, rIndex) => {
793 getDemandList({ 803 // getDemandList({
794 pageSize: -1, 804 // pageSize: -1,
795 pageIndex: 1, 805 // pageIndex: 1,
796 relationMenuGuid: rGuid, 806 // relationMenuGuid: rGuid,
797 bizState: 'Y' 807 // bizState: 'Y'
798 }).then((res: any) => { 808 // }).then((res: any) => {
799 tableLoading.value = false; 809 // tableLoading.value = false;
800 if (res.code == proxy.$passCode) { 810 // if (res.code == proxy.$passCode) {
801 const data = res.data || {}; 811 // const data = res.data || {};
802 const fData = data.records || []; 812 // const fData = data.records || [];
803 const tFields = tableData.value[rIndex].dataFields; 813 // const tFields = tableData.value[rIndex].dataFields;
804 const tData = fData.map(item => { 814 // const tData = fData.map(item => {
805 const iData = tFields.find(t => t.demandFieldGuid == item.guid) || {}; 815 // const iData = tFields.find(t => t.demandFieldGuid == item.guid) || {};
806 return { 816 // return {
807 ...item, 817 // ...item,
808 fieldName: item.fieldName, 818 // fieldName: item.fieldName,
809 isRequired: item.isRequired, 819 // isRequired: item.isRequired,
810 chName: item.chName || '', 820 // chName: item.chName || '',
811 enName: item.enName || '', 821 // enName: item.enName || '',
812 ...iData 822 // ...iData
813 } 823 // }
814 }); 824 // });
815 tableData.value[rIndex].dataFields = tData; 825 // tableData.value[rIndex].dataFields = tData;
816 826
817 } else { 827 // } else {
818 proxy.$ElMessage.error(res.msg); 828 // proxy.$ElMessage.error(res.msg);
819 } 829 // }
820 }).catch(() => { 830 // }).catch(() => {
821 tableLoading.value = false; 831 // tableLoading.value = false;
822 }) 832 // })
823 } 833 // }
824 const toPath = () => { 834 const toPath = () => {
825 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); 835 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
826 assetStore.set(true); 836 assetStore.set(true);
...@@ -890,27 +900,27 @@ const getCalculateParams = (baseConfigFormObj, baseConfigFormInfo) => { ...@@ -890,27 +900,27 @@ const getCalculateParams = (baseConfigFormObj, baseConfigFormInfo) => {
890 }) 900 })
891 params.dictionaryJson = Object.keys(dictionaryJson).length ? JSON.stringify(dictionaryJson) : ''; 901 params.dictionaryJson = Object.keys(dictionaryJson).length ? JSON.stringify(dictionaryJson) : '';
892 params.builtIndicators = builtInTarget; 902 params.builtIndicators = builtInTarget;
893 let demandMatchingData: any = []; 903 // let demandMatchingData: any = [];
894 tableData.value.map(item => { 904 // tableData.value.map(item => {
895 demandMatchingData.push({ 905 // demandMatchingData.push({
896 demandTableName: item.demandTableName, 906 // demandTableName: item.demandTableName,
897 demandTableGuid: item.demandTableGuid || item.guid, // 需求表guid 907 // demandTableGuid: item.demandTableGuid || item.guid, // 需求表guid
898 dataTableGuid: item.dataTableGuid || '', // 数据资源表guid 908 // dataTableGuid: item.dataTableGuid || '', // 数据资源表guid
899 weightDemandTable: item.weightDemandTable, 909 // weightDemandTable: item.weightDemandTable,
900 dataFieldsNum: item.dataFieldsNum, 910 // dataFieldsNum: item.dataFieldsNum,
901 pricingDemandFieldRQVOS: item.dataFields.map(d => { 911 // pricingDemandFieldRQVOS: item.dataFields.map(d => {
902 return { 912 // return {
903 demandFieldGuid: d.demandFieldGuid || d.guid, // 资源表字段guid 913 // demandFieldGuid: d.demandFieldGuid || d.guid, // 资源表字段guid
904 fieldName: d.fieldName, 914 // fieldName: d.fieldName,
905 enName: d.enName, 915 // enName: d.enName,
906 chName: d.chName, 916 // chName: d.chName,
907 isRequired: d.isRequired, 917 // isRequired: d.isRequired,
908 orderNum: d.orderNum 918 // orderNum: d.orderNum
909 } 919 // }
910 }) 920 // })
911 }) 921 // })
912 }); 922 // });
913 params.dataPricingDemandmatchingRQVOS = demandMatchingData; 923 params.dataPricingDemandmatchingRQVOS = [];
914 guid && (params.guid = guid); 924 guid && (params.guid = guid);
915 return params; 925 return params;
916 } 926 }
...@@ -939,8 +949,7 @@ const checkForm = (type) => { ...@@ -939,8 +949,7 @@ const checkForm = (type) => {
939 const baseConfigFormObj = baseConfigFormRef.value; 949 const baseConfigFormObj = baseConfigFormRef.value;
940 const baseConfigFormEl = baseConfigFormObj.ruleFormRef; 950 const baseConfigFormEl = baseConfigFormObj.ruleFormRef;
941 const baseConfigFormInfo = baseConfigFormObj.formInline; 951 const baseConfigFormInfo = baseConfigFormObj.formInline;
942 productConfigFormRef.value.ruleFormRef.validate((valid1, errorItem) => { 952 const validateModelConfig = () => {
943 if (valid1) {
944 baseConfigFormEl.validate(async (valid, errorItem) => { 953 baseConfigFormEl.validate(async (valid, errorItem) => {
945 if (valid) { 954 if (valid) {
946 const paramsInfo = getCalculateParams(baseConfigFormObj, baseConfigFormInfo); 955 const paramsInfo = getCalculateParams(baseConfigFormObj, baseConfigFormInfo);
...@@ -1001,6 +1010,13 @@ const checkForm = (type) => { ...@@ -1001,6 +1010,13 @@ const checkForm = (type) => {
1001 baseConfigFormEl.scrollToField(obj[0]); 1010 baseConfigFormEl.scrollToField(obj[0]);
1002 } 1011 }
1003 }) 1012 })
1013 }
1014 if (type == 'calculate') {
1015 validateModelConfig();
1016 } else {
1017 productConfigFormRef.value.ruleFormRef.validate((valid1, errorItem) => {
1018 if (valid1) {
1019 validateModelConfig();
1004 } else { 1020 } else {
1005 expandProduct.value = true; 1021 expandProduct.value = true;
1006 var obj = Object.keys(errorItem); 1022 var obj = Object.keys(errorItem);
...@@ -1012,6 +1028,7 @@ const checkForm = (type) => { ...@@ -1012,6 +1028,7 @@ const checkForm = (type) => {
1012 }) 1028 })
1013 } 1029 }
1014 }) 1030 })
1031 }
1015 } 1032 }
1016 const btnClick = async (btn, row: any = null) => { 1033 const btnClick = async (btn, row: any = null) => {
1017 const type = btn.value; 1034 const type = btn.value;
...@@ -1107,8 +1124,8 @@ onMounted(() => { ...@@ -1107,8 +1124,8 @@ onMounted(() => {
1107 </ContentWrap> 1124 </ContentWrap>
1108 <ContentWrap id="contract-content-wrap" title="输入参数" expandSwicth style="margin-top: 15px" :isExpand="expand1" 1125 <ContentWrap id="contract-content-wrap" title="输入参数" expandSwicth style="margin-top: 15px" :isExpand="expand1"
1109 @expand="(v) => expand1 = v"> 1126 @expand="(v) => expand1 = v">
1110 <Form ref="baseConfigFormRef" formId="contract-content-form" :itemList="baseConfigForm.items" 1127 <Form ref="baseConfigFormRef" formId="contract-content-form" :itemList="baseConfigFormItems"
1111 :rules="baseConfigForm.rules" col="col3" @selectChange="selectChange" @cascaderChange="cascaderChange" /> 1128 :rules="baseConfigFormRules" col="col3" @selectChange="selectChange" @cascaderChange="cascaderChange" />
1112 </ContentWrap> 1129 </ContentWrap>
1113 <!-- <ContentWrap id="contract-signatory-wrap" title="需求匹配" expandSwicth style="margin-top: 15px" :isExpand="expand2" 1130 <!-- <ContentWrap id="contract-signatory-wrap" title="需求匹配" expandSwicth style="margin-top: 15px" :isExpand="expand2"
1114 @expand="(v) => expand2 = v"> 1131 @expand="(v) => expand2 = v">
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!