优化流程接口调用时机
Showing
2 changed files
with
182 additions
and
167 deletions
| ... | @@ -45,13 +45,6 @@ const tableFields = ref([ | ... | @@ -45,13 +45,6 @@ const tableFields = ref([ |
| 45 | const deploymentId = ref(''); | 45 | const deploymentId = ref(''); |
| 46 | 46 | ||
| 47 | onMounted(() => { | 47 | onMounted(() => { |
| 48 | getCamundaDeploymentId('10018', userData.tenantGuid, userData.staffGuid).then((res: any) => { | ||
| 49 | if (res.code == proxy.$passCode) { | ||
| 50 | deploymentId.value = res.data; | ||
| 51 | } else { | ||
| 52 | proxy.$ElMessage.error(res.msg); | ||
| 53 | } | ||
| 54 | }) | ||
| 55 | }); | 48 | }); |
| 56 | 49 | ||
| 57 | onActivated(() => { | 50 | onActivated(() => { |
| ... | @@ -412,74 +405,89 @@ const dialogInfo = ref({ | ... | @@ -412,74 +405,89 @@ const dialogInfo = ref({ |
| 412 | const dialogBtnClick = (btn, info) => { | 405 | const dialogBtnClick = (btn, info) => { |
| 413 | if (btn.value == 'submit') { | 406 | if (btn.value == 'submit') { |
| 414 | dialogInfo.value.footer.btns[1].loading = true; | 407 | dialogInfo.value.footer.btns[1].loading = true; |
| 415 | getProcessNodesPromise({ | 408 | let submitFunc = () => { |
| 416 | deploymentId: deploymentId.value, | 409 | getProcessNodesPromise({ |
| 417 | processInstanceId: null, | 410 | deploymentId: deploymentId.value, |
| 418 | }).then((res: any) => { | 411 | processInstanceId: null, |
| 419 | if (res?.code == proxy.$passCode) { | 412 | }).then((res: any) => { |
| 420 | getStaffDetailInfo(res.data?.[1]?.candidateUsers?.[0]?.staffGuid).then((resUser: any) => { | 413 | if (res?.code == proxy.$passCode) { |
| 421 | if (resUser?.code == proxy.$passCode) { | 414 | getStaffDetailInfo(res.data?.[1]?.candidateUsers?.[0]?.staffGuid).then((resUser: any) => { |
| 422 | if (dialogInfo.value.type == 'reSubmit') { | 415 | if (resUser?.code == proxy.$passCode) { |
| 423 | updatQuality({ | 416 | if (dialogInfo.value.type == 'reSubmit') { |
| 424 | guid: currTableData.value.guid, | 417 | updatQuality({ |
| 425 | tenantGuid: userData.tenantGuid, | 418 | guid: currTableData.value.guid, |
| 426 | damGuid: currTableData.value.damGuid, | 419 | tenantGuid: userData.tenantGuid, |
| 427 | daName: currTableData.value.daName, | 420 | damGuid: currTableData.value.damGuid, |
| 428 | immediateApprove: true, | 421 | daName: currTableData.value.daName, |
| 429 | evaluationAgencyGuid: resUser.data?.tenantGuid, | 422 | immediateApprove: true, |
| 430 | qualityEvaluationFile: info.qualityEvaluationFile?.map(file => { | 423 | evaluationAgencyGuid: resUser.data?.tenantGuid, |
| 431 | return { | 424 | qualityEvaluationFile: info.qualityEvaluationFile?.map(file => { |
| 432 | name: file.name, | 425 | return { |
| 433 | url: file.url | 426 | name: file.name, |
| 427 | url: file.url | ||
| 428 | } | ||
| 429 | }) || [] | ||
| 430 | }).then((res: any) => { | ||
| 431 | dialogInfo.value.footer.btns[1].loading = false; | ||
| 432 | if (res?.code == proxy.$passCode) { | ||
| 433 | ElMessage.success('该资产质量评价重新提交成功'); | ||
| 434 | dialogInfo.value.visible = false; | ||
| 435 | page.value.curr = 1; | ||
| 436 | getTableData(); | ||
| 437 | } else { | ||
| 438 | ElMessage.error(res.msg); | ||
| 434 | } | 439 | } |
| 435 | }) || [] | 440 | }) |
| 436 | }).then((res: any) => { | 441 | } else { |
| 437 | dialogInfo.value.footer.btns[1].loading = false; | 442 | let daInfo = assetListData.value.find(a => a.guid == info.damGuid); |
| 438 | if (res?.code == proxy.$passCode) { | 443 | saveQuality({ |
| 439 | ElMessage.success('该资产质量评价重新提交成功'); | 444 | tenantGuid: userData.tenantGuid, |
| 440 | dialogInfo.value.visible = false; | 445 | damGuid: info.damGuid, |
| 441 | page.value.curr = 1; | 446 | daName: daInfo.damName, |
| 442 | getTableData(); | 447 | immediateApprove: true, |
| 443 | } else { | 448 | evaluationAgencyGuid: resUser.data?.tenantGuid, |
| 444 | ElMessage.error(res.msg); | 449 | qualityEvaluationFile: info.qualityEvaluationFile?.map(file => { |
| 445 | } | 450 | return { |
| 446 | }) | 451 | name: file.name, |
| 447 | } else { | 452 | url: file.url |
| 448 | let daInfo = assetListData.value.find(a => a.guid == info.damGuid); | 453 | } |
| 449 | saveQuality({ | 454 | }) || [] |
| 450 | tenantGuid: userData.tenantGuid, | 455 | }).then((res: any) => { |
| 451 | damGuid: info.damGuid, | 456 | dialogInfo.value.footer.btns[1].loading = false; |
| 452 | daName: daInfo.damName, | 457 | if (res?.code == proxy.$passCode) { |
| 453 | immediateApprove: true, | 458 | ElMessage.success('质量评价发起成功'); |
| 454 | evaluationAgencyGuid: resUser.data?.tenantGuid, | 459 | dialogInfo.value.visible = false; |
| 455 | qualityEvaluationFile: info.qualityEvaluationFile?.map(file => { | 460 | page.value.curr = 1; |
| 456 | return { | 461 | getTableData(); |
| 457 | name: file.name, | 462 | } else { |
| 458 | url: file.url | 463 | ElMessage.error(res.msg); |
| 459 | } | 464 | } |
| 460 | }) || [] | 465 | }) |
| 461 | }).then((res: any) => { | 466 | } |
| 462 | dialogInfo.value.footer.btns[1].loading = false; | 467 | } else { |
| 463 | if (res?.code == proxy.$passCode) { | 468 | dialogInfo.value.footer.btns[1].loading = false; |
| 464 | ElMessage.success('质量评价发起成功'); | 469 | ElMessage.error(res.msg); |
| 465 | dialogInfo.value.visible = false; | ||
| 466 | page.value.curr = 1; | ||
| 467 | getTableData(); | ||
| 468 | } else { | ||
| 469 | ElMessage.error(res.msg); | ||
| 470 | } | ||
| 471 | }) | ||
| 472 | } | 470 | } |
| 473 | } else { | 471 | }) |
| 474 | dialogInfo.value.footer.btns[1].loading = false; | 472 | } else { |
| 475 | ElMessage.error(res.msg); | 473 | dialogInfo.value.footer.btns[1].loading = false; |
| 476 | } | 474 | ElMessage.error(res.msg); |
| 477 | }) | 475 | } |
| 478 | } else { | 476 | }) |
| 479 | dialogInfo.value.footer.btns[1].loading = false; | 477 | } |
| 480 | ElMessage.error(res.msg); | 478 | if (deploymentId.value) { |
| 481 | } | 479 | submitFunc(); |
| 482 | }) | 480 | } else { |
| 481 | getCamundaDeploymentId('10018', userData.tenantGuid, userData.staffGuid).then((res: any) => { | ||
| 482 | if (res.code == proxy.$passCode) { | ||
| 483 | deploymentId.value = res.data; | ||
| 484 | submitFunc(); | ||
| 485 | } else { | ||
| 486 | dialogInfo.value.footer.btns[1].loading = false; | ||
| 487 | proxy.$ElMessage.error(res.msg); | ||
| 488 | } | ||
| 489 | }) | ||
| 490 | } | ||
| 483 | } else if (btn.value == 'cancel') { | 491 | } else if (btn.value == 'cancel') { |
| 484 | dialogInfo.value.visible = false; | 492 | dialogInfo.value.visible = false; |
| 485 | } | 493 | } | ... | ... |
| ... | @@ -96,13 +96,6 @@ onBeforeMount(() => { | ... | @@ -96,13 +96,6 @@ onBeforeMount(() => { |
| 96 | // ElMessage.error(res.msg); | 96 | // ElMessage.error(res.msg); |
| 97 | // } | 97 | // } |
| 98 | // }) | 98 | // }) |
| 99 | getCamundaDeploymentId('10019', userData.tenantGuid, userData.staffGuid).then((res: any) => { | ||
| 100 | if (res.code == proxy.$passCode) { | ||
| 101 | deploymentId.value = res.data; | ||
| 102 | } else { | ||
| 103 | proxy.$ElMessage.error(res.msg); | ||
| 104 | } | ||
| 105 | }) | ||
| 106 | }); | 99 | }); |
| 107 | 100 | ||
| 108 | onActivated(() => { | 101 | onActivated(() => { |
| ... | @@ -680,7 +673,7 @@ const dialogInfo = ref({ | ... | @@ -680,7 +673,7 @@ const dialogInfo = ref({ |
| 680 | footer: { | 673 | footer: { |
| 681 | btns: [ | 674 | btns: [ |
| 682 | { type: "default", label: "取消", value: "cancel" }, | 675 | { type: "default", label: "取消", value: "cancel" }, |
| 683 | { type: "primary", label: "确定", value: "submit" }, | 676 | { type: "primary", label: "确定", value: "submit", loading: false }, |
| 684 | ], | 677 | ], |
| 685 | }, | 678 | }, |
| 686 | }); | 679 | }); |
| ... | @@ -738,79 +731,23 @@ const reSubmitPromise: any = ref(null); | ... | @@ -738,79 +731,23 @@ const reSubmitPromise: any = ref(null); |
| 738 | const dialogBtnClick = (btn, info) => { | 731 | const dialogBtnClick = (btn, info) => { |
| 739 | console.log('btn', btn, info); | 732 | console.log('btn', btn, info); |
| 740 | if (btn.value == 'submit') { | 733 | if (btn.value == 'submit') { |
| 741 | getProcessNodesPromise({ | 734 | let submitFunc = () => { |
| 742 | deploymentId: deploymentId.value, | 735 | getProcessNodesPromise({ |
| 743 | processInstanceId: null, | 736 | deploymentId: deploymentId.value, |
| 744 | }).then((res: any) => { | 737 | processInstanceId: null, |
| 745 | getStaffDetailInfo(res.data?.[1]?.candidateUsers?.[0]?.staffGuid).then((resUser: any) => { | 738 | }).then((res: any) => { |
| 746 | if (resUser?.code == proxy.$passCode) { | 739 | getStaffDetailInfo(res.data?.[1]?.candidateUsers?.[0]?.staffGuid).then((resUser: any) => { |
| 747 | if (dialogInfo.value.type == 'reSubmit') { | 740 | if (resUser?.code == proxy.$passCode) { |
| 748 | if (reSubmitPromise.value) { | 741 | if (dialogInfo.value.type == 'reSubmit') { |
| 749 | return; | 742 | if (reSubmitPromise.value) { |
| 750 | } | 743 | return; |
| 751 | reSubmitPromise.value = updateCostAssess({ | ||
| 752 | guid: currTableData.value.guid, | ||
| 753 | immediateApprove: true, | ||
| 754 | tenantGuid: userData.tenantGuid, | ||
| 755 | daName: currTableData.value.daName, | ||
| 756 | damGuid: currTableData.value.damGuid, | ||
| 757 | costAssessmentFile: info.costAssessmentFile?.map(file => { | ||
| 758 | return { | ||
| 759 | name: file.name, | ||
| 760 | url: file.url | ||
| 761 | } | ||
| 762 | }) || [], | ||
| 763 | evaluationFile: info.evaluationFile?.map(file => { | ||
| 764 | return { | ||
| 765 | name: file.name, | ||
| 766 | url: file.url | ||
| 767 | } | ||
| 768 | }) || [], | ||
| 769 | qualityScore: info.qualityScore || null, | ||
| 770 | evaluationRangeStart: info.evaluationRange ? info.evaluationRange[0] : null, | ||
| 771 | evaluationRangeEnd: info.evaluationRange ? info.evaluationRange[1] : null, | ||
| 772 | evaluationNote: info.evaluationNote || null, | ||
| 773 | evaluationAgencyGuid: resUser.data?.tenantGuid, | ||
| 774 | }).then((res: any) => { | ||
| 775 | reSubmitPromise.value = null; | ||
| 776 | if (res?.code == proxy.$passCode) { | ||
| 777 | ElMessage.success('该资产价值评估重新提交成功'); | ||
| 778 | dialogInfo.value.visible = false; | ||
| 779 | page.value.curr = 1; | ||
| 780 | getTableData(); | ||
| 781 | formItems.value[4].placeholder = `本次评估数据资产总体质量得分为**分\n准确性:\n一致性:\n可访问性:\n规范性:\n完整性:`; | ||
| 782 | } else { | ||
| 783 | ElMessage.error(res.msg); | ||
| 784 | } | ||
| 785 | }) | ||
| 786 | } else { | ||
| 787 | if (savePromise.value) { | ||
| 788 | return; | ||
| 789 | } | ||
| 790 | let params: any = {}; | ||
| 791 | let daInfo = assetListData.value.find(a => a.guid == info.registerGuid); | ||
| 792 | if (daInfo.qualityEvaluationGuid) { | ||
| 793 | //通过质量评估发起资产申请 | ||
| 794 | params = { | ||
| 795 | immediateApprove: true, | ||
| 796 | tenantGuid: userData.tenantGuid, | ||
| 797 | daName: daInfo.damName, | ||
| 798 | damGuid: daInfo.guid, | ||
| 799 | costAssessmentFile: info.costAssessmentFile?.map(file => { | ||
| 800 | return { | ||
| 801 | name: file.name, | ||
| 802 | url: file.url | ||
| 803 | } | ||
| 804 | }) || [], | ||
| 805 | evaluationAgencyGuid: resUser.data?.tenantGuid, | ||
| 806 | } | 744 | } |
| 807 | } else { | 745 | reSubmitPromise.value = updateCostAssess({ |
| 808 | //未通过质量评估发起资产申请 | 746 | guid: currTableData.value.guid, |
| 809 | params = { | ||
| 810 | immediateApprove: true, | 747 | immediateApprove: true, |
| 811 | tenantGuid: userData.tenantGuid, | 748 | tenantGuid: userData.tenantGuid, |
| 812 | daName: daInfo.damName, | 749 | daName: currTableData.value.daName, |
| 813 | damGuid: daInfo.guid, | 750 | damGuid: currTableData.value.damGuid, |
| 814 | costAssessmentFile: info.costAssessmentFile?.map(file => { | 751 | costAssessmentFile: info.costAssessmentFile?.map(file => { |
| 815 | return { | 752 | return { |
| 816 | name: file.name, | 753 | name: file.name, |
| ... | @@ -823,31 +760,101 @@ const dialogBtnClick = (btn, info) => { | ... | @@ -823,31 +760,101 @@ const dialogBtnClick = (btn, info) => { |
| 823 | url: file.url | 760 | url: file.url |
| 824 | } | 761 | } |
| 825 | }) || [], | 762 | }) || [], |
| 826 | qualityScore: info.qualityScore, | 763 | qualityScore: info.qualityScore || null, |
| 827 | evaluationRangeStart: info.evaluationRange ? info.evaluationRange[0] : null, | 764 | evaluationRangeStart: info.evaluationRange ? info.evaluationRange[0] : null, |
| 828 | evaluationRangeEnd: info.evaluationRange ? info.evaluationRange[1] : null, | 765 | evaluationRangeEnd: info.evaluationRange ? info.evaluationRange[1] : null, |
| 829 | evaluationNote: info.evaluationNote, | 766 | evaluationNote: info.evaluationNote || null, |
| 830 | evaluationAgencyGuid: res.data?.[1]?.candidateUsers?.[0]?.staffGuid, | 767 | evaluationAgencyGuid: resUser.data?.tenantGuid, |
| 768 | }).then((res: any) => { | ||
| 769 | reSubmitPromise.value = null; | ||
| 770 | if (res?.code == proxy.$passCode) { | ||
| 771 | ElMessage.success('该资产价值评估重新提交成功'); | ||
| 772 | dialogInfo.value.visible = false; | ||
| 773 | page.value.curr = 1; | ||
| 774 | getTableData(); | ||
| 775 | formItems.value[4].placeholder = `本次评估数据资产总体质量得分为**分\n准确性:\n一致性:\n可访问性:\n规范性:\n完整性:`; | ||
| 776 | } else { | ||
| 777 | ElMessage.error(res.msg); | ||
| 778 | } | ||
| 779 | }) | ||
| 780 | } else { | ||
| 781 | if (savePromise.value) { | ||
| 782 | return; | ||
| 831 | } | 783 | } |
| 832 | } | 784 | let params: any = {}; |
| 833 | console.log('daInfo', daInfo, info); | 785 | let daInfo = assetListData.value.find(a => a.guid == info.registerGuid); |
| 834 | savePromise.value = saveCostAssess(params).then((res: any) => { | 786 | if (daInfo.qualityEvaluationGuid) { |
| 835 | savePromise.value = null; | 787 | //通过质量评估发起资产申请 |
| 836 | if (res?.code == proxy.$passCode) { | 788 | params = { |
| 837 | ElMessage.success('价值评估发起成功'); | 789 | immediateApprove: true, |
| 838 | dialogInfo.value.visible = false; | 790 | tenantGuid: userData.tenantGuid, |
| 839 | page.value.curr = 1; | 791 | daName: daInfo.damName, |
| 840 | getTableData(); | 792 | damGuid: daInfo.guid, |
| 793 | costAssessmentFile: info.costAssessmentFile?.map(file => { | ||
| 794 | return { | ||
| 795 | name: file.name, | ||
| 796 | url: file.url | ||
| 797 | } | ||
| 798 | }) || [], | ||
| 799 | evaluationAgencyGuid: resUser.data?.tenantGuid, | ||
| 800 | } | ||
| 841 | } else { | 801 | } else { |
| 842 | ElMessage.error(res.msg); | 802 | //未通过质量评估发起资产申请 |
| 803 | params = { | ||
| 804 | immediateApprove: true, | ||
| 805 | tenantGuid: userData.tenantGuid, | ||
| 806 | daName: daInfo.damName, | ||
| 807 | damGuid: daInfo.guid, | ||
| 808 | costAssessmentFile: info.costAssessmentFile?.map(file => { | ||
| 809 | return { | ||
| 810 | name: file.name, | ||
| 811 | url: file.url | ||
| 812 | } | ||
| 813 | }) || [], | ||
| 814 | evaluationFile: info.evaluationFile?.map(file => { | ||
| 815 | return { | ||
| 816 | name: file.name, | ||
| 817 | url: file.url | ||
| 818 | } | ||
| 819 | }) || [], | ||
| 820 | qualityScore: info.qualityScore, | ||
| 821 | evaluationRangeStart: info.evaluationRange ? info.evaluationRange[0] : null, | ||
| 822 | evaluationRangeEnd: info.evaluationRange ? info.evaluationRange[1] : null, | ||
| 823 | evaluationNote: info.evaluationNote, | ||
| 824 | evaluationAgencyGuid: res.data?.[1]?.candidateUsers?.[0]?.staffGuid, | ||
| 825 | } | ||
| 843 | } | 826 | } |
| 844 | }) | 827 | console.log('daInfo', daInfo, info); |
| 828 | savePromise.value = saveCostAssess(params).then((res: any) => { | ||
| 829 | savePromise.value = null; | ||
| 830 | if (res?.code == proxy.$passCode) { | ||
| 831 | ElMessage.success('价值评估发起成功'); | ||
| 832 | dialogInfo.value.visible = false; | ||
| 833 | page.value.curr = 1; | ||
| 834 | getTableData(); | ||
| 835 | } else { | ||
| 836 | ElMessage.error(res.msg); | ||
| 837 | } | ||
| 838 | }) | ||
| 839 | } | ||
| 840 | } else { | ||
| 841 | ElMessage.error(res.msg); | ||
| 845 | } | 842 | } |
| 843 | }); | ||
| 844 | }) | ||
| 845 | } | ||
| 846 | if (deploymentId.value) { | ||
| 847 | submitFunc(); | ||
| 848 | } else { | ||
| 849 | getCamundaDeploymentId('10019', userData.tenantGuid, userData.staffGuid).then((res: any) => { | ||
| 850 | if (res.code == proxy.$passCode) { | ||
| 851 | deploymentId.value = res.data; | ||
| 852 | submitFunc(); | ||
| 846 | } else { | 853 | } else { |
| 847 | ElMessage.error(res.msg); | 854 | proxy.$ElMessage.error(res.msg); |
| 848 | } | 855 | } |
| 849 | }); | 856 | }) |
| 850 | }) | 857 | } |
| 851 | } else if (btn.value == 'cancel') { | 858 | } else if (btn.value == 'cancel') { |
| 852 | dialogInfo.value.visible = false; | 859 | dialogInfo.value.visible = false; |
| 853 | } | 860 | } | ... | ... |
-
Please register or sign in to post a comment