From 3198995fa37b2daa16f4074d217bc2a9f6e1a804 Mon Sep 17 00:00:00 2001 From: HeHaonan <1822907900@qq.com> Date: Wed, 28 Aug 2024 14:38:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AARRRAnalysis.vue | 17 +- .../portraitModel/components/abcAnalysis.vue | 55 +- .../components/basketAnalysis.vue | 17 +- .../components/bostonAnalysis.vue | 480 +++++++++++------- .../components/funnelAnalysis.vue | 265 +++++----- .../components/portraitAnalysis.vue | 17 +- .../components/repurchaseAnalysis.vue | 17 +- .../components/retainAnalysis.vue | 17 +- .../portraitModel/components/rfmAnalysis.vue | 69 +-- .../components/viscosityAnalysis.vue | 17 +- 10 files changed, 566 insertions(+), 405 deletions(-) diff --git a/src/views/portraitModel/components/AARRRAnalysis.vue b/src/views/portraitModel/components/AARRRAnalysis.vue index c907cdb..2d948dd 100644 --- a/src/views/portraitModel/components/AARRRAnalysis.vue +++ b/src/views/portraitModel/components/AARRRAnalysis.vue @@ -1235,12 +1235,13 @@ const submitData = () => { .catch((error) => {}); }; const retrain = () => { - portraitModel - .retrain({ - userId: JSON.parse(getUserInfo()).userId, - module: "AARRR用户运营分析", - }) - .then((res) => { + showAnswerFlag.value = false; + // portraitModel + // .retrain({ + // userId: JSON.parse(getUserInfo()).userId, + // module: "AARRR用户运营分析", + // }) + // .then((res) => { proxy.$modal.msgSuccess("重新实训成功"); step1Params1.value = ""; step1Params2.value = ""; @@ -1253,8 +1254,8 @@ const retrain = () => { step4Params3.value = ""; step4Params4.value = ""; step5Params.value = ""; - }) - .catch((error) => {}); + // }) + // .catch((error) => {}); }; defineExpose({ submitData, diff --git a/src/views/portraitModel/components/abcAnalysis.vue b/src/views/portraitModel/components/abcAnalysis.vue index 7165e7a..17bc6c0 100644 --- a/src/views/portraitModel/components/abcAnalysis.vue +++ b/src/views/portraitModel/components/abcAnalysis.vue @@ -1024,7 +1024,7 @@ const getData = () => { step4Data.value[1].data3 = step3Data.value[1].params2; step4Data.value[2].data3 = step3Data.value[2].params2; step4Data.value[3].data3 = step3Data.value[3].params2; - step2AnswerFlag.value =true + step2AnswerFlag.value = true; step3AnswerFlag.value = true; initCharts(); } @@ -1164,30 +1164,35 @@ const submitData = () => { .catch((error) => {}); }; const retrain = () => { - portraitModel - .retrain({ - userId: JSON.parse(getUserInfo()).userId, - module: "帕累托/ABC分析", - }) - .then((res) => { - proxy.$modal.msgSuccess("重新实训成功"); - for (let i in step1Data.value) { - step1Data.value[i].params = ""; - } - for (let i in step3Data.value) { - step3Data.value[i].params1 = ""; - step3Data.value[i].params2 = ""; - } - for (let i in step4Data.value) { - step4Data.value[i].params = ""; - } - // for (let i in step5Data.value) { - // step5Data.value[i].params1 = ""; - // step5Data.value[i].params2 = ""; - // step5Data.value[i].params3 = ""; - // } - }) - .catch((error) => {}); + showAnswerFlag.value = false; + // portraitModel + // .retrain({ + // userId: JSON.parse(getUserInfo()).userId, + // module: "帕累托/ABC分析", + // }) + // .then((res) => { + proxy.$modal.msgSuccess("重新实训成功"); + for (let i in step1Data.value) { + step1Data.value[i].params = ""; + } + for (let i in step3Data.value) { + step3Data.value[i].params1 = ""; + step3Data.value[i].params2 = ""; + } + for (let i in step4Data.value) { + step4Data.value[i].params = ""; + } + // for (let i in step5Data.value) { + // step5Data.value[i].params1 = ""; + // step5Data.value[i].params2 = ""; + // step5Data.value[i].params3 = ""; + // } + chartParam1.value = ""; + chartParam2.value = ""; + chartParam3.value = ""; + chartParam4.value = ""; + // }) + // .catch((error) => {}); }; defineExpose({ submitData, diff --git a/src/views/portraitModel/components/basketAnalysis.vue b/src/views/portraitModel/components/basketAnalysis.vue index 5c540cd..8792758 100644 --- a/src/views/portraitModel/components/basketAnalysis.vue +++ b/src/views/portraitModel/components/basketAnalysis.vue @@ -1102,13 +1102,14 @@ const submitData = () => { .catch((error) => {}); }; const retrain = () => { + showAnswerFlag.value = false; // console.log(66); - portraitModel - .retrain({ - userId: JSON.parse(getUserInfo()).userId, - module: "购物篮分析", - }) - .then((res) => { + // portraitModel + // .retrain({ + // userId: JSON.parse(getUserInfo()).userId, + // module: "购物篮分析", + // }) + // .then((res) => { proxy.$modal.msgSuccess("重新实训成功"); list.value = ["-"]; for (let i in step2Data.value) { @@ -1129,8 +1130,8 @@ const retrain = () => { // step2Select5.value = ""; // step3Select1.value = ""; // step3Select2.value = ""; - }) - .catch((error) => {}); + // }) + // .catch((error) => {}); }; defineExpose({ submitData, diff --git a/src/views/portraitModel/components/bostonAnalysis.vue b/src/views/portraitModel/components/bostonAnalysis.vue index 5a28a2e..f7b53db 100644 --- a/src/views/portraitModel/components/bostonAnalysis.vue +++ b/src/views/portraitModel/components/bostonAnalysis.vue @@ -194,19 +194,20 @@
提交
-
绘制平均消费次数X,平均消费金额Y
- (5,1000) +
绘制平均消费次数X:5
+
X √
- +
@@ -363,6 +364,7 @@ const pointBError = ref(false); const pointCError = ref(false); const pointDError = ref(false); const centerPointError = ref(false); +const centerPointError2 = ref(false); const markArea1Error = ref(false); const markArea2Error = ref(false); const markArea3Error = ref(false); @@ -684,6 +686,7 @@ const drawPoint = (point, color) => { // option.value && myChart.setOption(option.value); }; const drawPointStep4 = (point, color) => { + // markCenterLineStep4.value.splice(0, 2); drawPointNameStep4.value = point; drawPointColorStep4.value = color; }; @@ -939,7 +942,10 @@ const step4EchartInit = () => { chart2OptionData.value.splice(i, 1); } } - markCenterLineStep4.value.splice(0, 2); + if (markCenterLineStep4.value.length >= 2) { + markCenterLineStep4.value.splice(0, 2); + } + const pointInPixel = [param.offsetX, param.offsetY]; console.log("pointInPixel4", pointInPixel); //将偏移值转化为坐标值 @@ -955,17 +961,31 @@ const step4EchartInit = () => { name: drawPointNameStep4.value, color: drawPointColorStep4.value, }); - markCenterLineStep4.value.push( - { - name: "y", - xAxis: pointInGridStep4.value[0], - }, - { - name: "x", - yAxis: pointInGridStep4.value[1], - } - ); - console.log(markCenterLineStep4.value); + if (drawPointNameStep4.value == "y") { + markCenterLineStep4.value.push( + // { + // name: "y", + // xAxis: pointInGridStep4.value[0], + // }, + { + name: "", + xAxis: pointInGridStep4.value[0], + } + ); + } else if (drawPointNameStep4.value == "x") { + markCenterLineStep4.value.push( + // { + // name: "y", + // xAxis: pointInGridStep4.value[0], + // }, + { + name: "", + yAxis: pointInGridStep4.value[1], + } + ); + } + + console.log(markCenterLineStep4.value, "-----"); // console.log(markCenterLineStep4.value); option2.value && myChart.setOption(option2.value); }); @@ -997,18 +1017,18 @@ const step5EchartInit = () => { // 中心线 const centerLine = [ { - name: "y", + name: "", xAxis: 5, }, { - name: "x", + name: "", yAxis: 1000, }, ]; // 中心点 const centerMark = [ { - value: "中心点", + value: "", coord: [5, 1000], }, ]; @@ -1411,18 +1431,37 @@ const step3Submit = () => { }; const step4Submit = () => { step4Error.value = 0; - for (let i in chart2OptionData.value) { - // console.log(option2.value.series[0].data[i]); + // for (let i in chart2OptionData.value) { + // // console.log(option2.value.series[0].data[i]); - if (chart2OptionData.value[i].name == "E") { - if (Math.round(chart2OptionData.value[i].value[0]) != 5 || Math.round(chart2OptionData.value[i].value[1]) != 1000) { - console.log(chart2OptionData.value[i]); - step4Error.value++; - centerPointError.value = true; - } else { - centerPointError.value = false; - } - } + // if (chart2OptionData.value[i].name == "E") { + // if (Math.round(chart2OptionData.value[i].value[0]) != 5 || Math.round(chart2OptionData.value[i].value[1]) != 1000) { + // console.log(chart2OptionData.value[i]); + // step4Error.value++; + // centerPointError.value = true; + // } else { + // centerPointError.value = false; + // } + // } + // } + // if (markCenterLineStep4.value[0].xAxis != 5 || markCenterLineStep4.value[1].yAxis != 1000) { + // step4Error.value++; + // centerPointError.value = true; + // } else { + // centerPointError.value = false; + // } + + if (markCenterLineStep4.value[0].xAxis != 5) { + step4Error.value++; + centerPointError.value = true; + } else { + centerPointError.value = false; + } + if (markCenterLineStep4.value[1].yAxis != 1000) { + step4Error.value++; + centerPointError2.value = true; + } else { + centerPointError2.value = false; } console.log(step4Error.value, "错误数"); proxy.$modal.msgSuccess("提交成功"); @@ -1637,177 +1676,248 @@ const getData = () => { quadrant2Color.value = res.data.stepNineB; quadrant3Color.value = res.data.stepNineC; quadrant4Color.value = res.data.stepNineD; - } - - // step2Data.value[14].params = res.data.stepTenA; - // step2Data.value[15].params = res.data.stepTenB; - // step2Data.value[16].params = res.data.stepTenC; - // step2Data.value[17].params = res.data.stepTenD; - // step2Data.value[18].params = res.data.stepElevenA; - // step2Data.value[19].params = res.data.stepOneA; - // step2Data.value[20].params = res.data.stepOneB; - // step2Data.value[21].params = res.data.stepOneC; - // step2Data.value[22].params = res.data.stepOneD; - // step2Data.value[23].params = res.data.stepTwoA; - // step2Data.value[24].params = res.data.stepTwoB; - // step2Data.value[25].params = res.data.stepTwoC; - // step2Data.value[26].params = res.data.stepThreeA; - // step2Data.value[27].params = res.data.stepThreeB; - // step2Data.value[28].params = res.data.stepThreeC; - // step2Data.value[29].params = res.data.stepThreeD; - // step2Data.value[30].params = res.data.stepFourA; - // step2Data.value[31].params = res.data.stepFourB; - // step2Data.value[32].params = res.data.stepFourC; - // step2Data.value[33].params = res.data.stepFourD; - // step2Data.value[34].params = res.data.stepNewOne; - // step2Data.value[35].params = res.data.stepNewTwo; - // step2Data.value[36].params = res.data.stepNewThree; - // step5DataTable3.value[3].params2 = res.data.stepNewFive; - // step5DataTable3.value[4].params1 = res.data.stepNewSix; - // step5DataTable3.value[4].params2 = res.data.stepNewEight; - // console.log(JSON.parse(res.data.stepSevenC)); - if (res.data.subState & (res.data.subState == 1)) { - showAnswerFlag.value = true; - if (step1Data.value[0].params1 && step1Data.value[0].params1 !== "3") { - step1Data.value[0].isError1 = true; - } else { - step1Data.value[0].isError1 = false; - } - if (step1Data.value[0].params2 && step1Data.value[0].params2 !== "800") { - step1Data.value[0].isError2 = true; - } else { - step1Data.value[0].isError2 = false; - } - if (step1Data.value[1].params1 && step1Data.value[1].params1 !== "4") { - step1Data.value[1].isError1 = true; - } else { - step1Data.value[1].isError1 = false; - } - if (step1Data.value[1].params2 && step1Data.value[1].params2 !== "1200") { - step1Data.value[1].isError2 = true; - } else { - step1Data.value[1].isError2 = false; - } - if (step1Data.value[2].params1 && step1Data.value[2].params1 !== "6") { - step1Data.value[2].isError1 = true; - } else { - step1Data.value[2].isError1 = false; - } - if (step1Data.value[2].params2 && step1Data.value[2].params2 !== "600") { - step1Data.value[2].isError2 = true; - } else { - step1Data.value[2].isError2 = false; - } - if (step1Data.value[3].params1 && step1Data.value[3].params1 !== "7") { - step1Data.value[3].isError1 = true; - } else { - step1Data.value[3].isError1 = false; - } - if (step1Data.value[3].params2 && step1Data.value[3].params2 !== "1400") { - step1Data.value[3].isError2 = true; - } else { - step1Data.value[3].isError2 = false; + // console.log(chart1OptionData.value,'666'); + for (let i in chart2OptionData.value) { + console.log(chart2OptionData.value[i], "asdas"); + if (chart2OptionData.value[i].name == "x") { + console.log(1); + markCenterLineStep4.value.push( + // { + // name: "y", + // xAxis: pointInGridStep4.value[0], + // }, + { + name: "", + yAxis: chart2OptionData.value[i].value[1], + } + ); + } else if (chart2OptionData.value[i].name == "y") { + console.log(2); + markCenterLineStep4.value.push( + // { + // name: "y", + // xAxis: pointInGridStep4.value[0], + // }, + { + name: "", + xAxis: chart2OptionData.value[i].value[0], + } + ); + } } + // else { + // console.log(789); + // chart1OptionData.value = JSON.parse('[]'); + // // console.log(JSON.parse(res.data.stepSevenC),'666'); + // chart2OptionData.value = JSON.parse('[]'); + // quadrant1.value = ""; + // quadrant2.value = ""; + // quadrant3.value = ""; + // quadrant4.value = ""; + // quadrant1Color.value = ""; + // quadrant2Color.value = ""; + // quadrant3Color.value = ""; + // quadrant4Color.value = ""; + // } - if (step2Data.value[4].params1 && step2Data.value[4].params1 !== "5") { - step2Data.value[4].isError1 = true; - } else { - step2Data.value[4].isError1 = false; - } - if (step2Data.value[4].params2 && step2Data.value[4].params2 !== "1000") { - step2Data.value[4].isError2 = true; - } else { - step2Data.value[4].isError2 = false; - } + // step2Data.value[14].params = res.data.stepTenA; + // step2Data.value[15].params = res.data.stepTenB; + // step2Data.value[16].params = res.data.stepTenC; + // step2Data.value[17].params = res.data.stepTenD; + // step2Data.value[18].params = res.data.stepElevenA; + // step2Data.value[19].params = res.data.stepOneA; + // step2Data.value[20].params = res.data.stepOneB; + // step2Data.value[21].params = res.data.stepOneC; + // step2Data.value[22].params = res.data.stepOneD; + // step2Data.value[23].params = res.data.stepTwoA; + // step2Data.value[24].params = res.data.stepTwoB; + // step2Data.value[25].params = res.data.stepTwoC; + // step2Data.value[26].params = res.data.stepThreeA; + // step2Data.value[27].params = res.data.stepThreeB; + // step2Data.value[28].params = res.data.stepThreeC; + // step2Data.value[29].params = res.data.stepThreeD; + // step2Data.value[30].params = res.data.stepFourA; + // step2Data.value[31].params = res.data.stepFourB; + // step2Data.value[32].params = res.data.stepFourC; + // step2Data.value[33].params = res.data.stepFourD; + // step2Data.value[34].params = res.data.stepNewOne; + // step2Data.value[35].params = res.data.stepNewTwo; + // step2Data.value[36].params = res.data.stepNewThree; + // step5DataTable3.value[3].params2 = res.data.stepNewFive; + // step5DataTable3.value[4].params1 = res.data.stepNewSix; + // step5DataTable3.value[4].params2 = res.data.stepNewEight; + // console.log(JSON.parse(res.data.stepSevenC)); - for (let i in chart1OptionData.value) { - // console.log(option.value.series[0].data[i]); - if (chart1OptionData.value[i].name == "A") { - if (Math.round(chart1OptionData.value[i].value[0]) != 3 || Math.round(chart1OptionData.value[i].value[1]) != 800) { - pointAError.value = true; - } else { - pointAError.value = false; - } + step3EchartInit(); + step4EchartInit(); + step5EchartInit(); + if (res.data.subState & (res.data.subState == 1)) { + showAnswerFlag.value = true; + if (step1Data.value[0].params1 && step1Data.value[0].params1 !== "3") { + step1Data.value[0].isError1 = true; + } else { + step1Data.value[0].isError1 = false; } - if (chart1OptionData.value[i].name == "B") { - if (Math.round(chart1OptionData.value[i].value[0]) != 4 || Math.round(chart1OptionData.value[i].value[1]) != 1200) { - pointBError.value = true; - } else { - pointBError.value = false; - } + if (step1Data.value[0].params2 && step1Data.value[0].params2 !== "800") { + step1Data.value[0].isError2 = true; + } else { + step1Data.value[0].isError2 = false; } - if (chart1OptionData.value[i].name == "C") { - if (Math.round(chart1OptionData.value[i].value[0]) != 6 || Math.round(chart1OptionData.value[i].value[1]) != 600) { - pointCError.value = true; - } else { - pointCError.value = false; - } + if (step1Data.value[1].params1 && step1Data.value[1].params1 !== "4") { + step1Data.value[1].isError1 = true; + } else { + step1Data.value[1].isError1 = false; } - if (chart1OptionData.value[i].name == "D") { - if (Math.round(chart1OptionData.value[i].value[0]) != 7 || Math.round(chart1OptionData.value[i].value[1]) != 1400) { - pointDError.value = true; - } else { - pointDError.value = false; - } + if (step1Data.value[1].params2 && step1Data.value[1].params2 !== "1200") { + step1Data.value[1].isError2 = true; + } else { + step1Data.value[1].isError2 = false; + } + if (step1Data.value[2].params1 && step1Data.value[2].params1 !== "6") { + step1Data.value[2].isError1 = true; + } else { + step1Data.value[2].isError1 = false; + } + if (step1Data.value[2].params2 && step1Data.value[2].params2 !== "600") { + step1Data.value[2].isError2 = true; + } else { + step1Data.value[2].isError2 = false; + } + if (step1Data.value[3].params1 && step1Data.value[3].params1 !== "7") { + step1Data.value[3].isError1 = true; + } else { + step1Data.value[3].isError1 = false; + } + if (step1Data.value[3].params2 && step1Data.value[3].params2 !== "1400") { + step1Data.value[3].isError2 = true; + } else { + step1Data.value[3].isError2 = false; } - } - for (let i in chart2OptionData.value) { - // console.log(option2.value.series[0].data[i]); + if (step2Data.value[4].params1 && step2Data.value[4].params1 !== "5") { + step2Data.value[4].isError1 = true; + } else { + step2Data.value[4].isError1 = false; + } + if (step2Data.value[4].params2 && step2Data.value[4].params2 !== "1000") { + step2Data.value[4].isError2 = true; + } else { + step2Data.value[4].isError2 = false; + } - if (chart2OptionData.value[i].name == "E") { - if (Math.round(chart2OptionData.value[i].value[0]) != 5 || Math.round(chart2OptionData.value[i].value[1]) != 1000) { - centerPointError.value = true; - } else { - centerPointError.value = false; + for (let i in chart1OptionData.value) { + // console.log(option.value.series[0].data[i]); + if (chart1OptionData.value[i].name == "A") { + if (Math.round(chart1OptionData.value[i].value[0]) != 3 || Math.round(chart1OptionData.value[i].value[1]) != 800) { + pointAError.value = true; + } else { + pointAError.value = false; + } + } + if (chart1OptionData.value[i].name == "B") { + if (Math.round(chart1OptionData.value[i].value[0]) != 4 || Math.round(chart1OptionData.value[i].value[1]) != 1200) { + pointBError.value = true; + } else { + pointBError.value = false; + } + } + if (chart1OptionData.value[i].name == "C") { + if (Math.round(chart1OptionData.value[i].value[0]) != 6 || Math.round(chart1OptionData.value[i].value[1]) != 600) { + pointCError.value = true; + } else { + pointCError.value = false; + } + } + if (chart1OptionData.value[i].name == "D") { + if (Math.round(chart1OptionData.value[i].value[0]) != 7 || Math.round(chart1OptionData.value[i].value[1]) != 1400) { + pointDError.value = true; + } else { + pointDError.value = false; + } } } - } - if (quadrant1.value != "明星客户") { - markArea1Error.value = true; - } else { - markArea1Error.value = false; - } - if (quadrant2.value != "问题客户") { - markArea2Error.value = true; - } else { - markArea2Error.value = false; - } - if (quadrant3.value != "瘦狗客户") { - markArea3Error.value = true; - } else { - markArea3Error.value = false; - } - if (quadrant4.value != "现金流客户") { - markArea4Error.value = true; - } else { - markArea4Error.value = false; + if (markCenterLineStep4.value[0].xAxis != 5) { + centerPointError.value = true; + } else { + centerPointError.value = false; + } + if (markCenterLineStep4.value[1].yAxis != 1000) { + centerPointError2.value = true; + } else { + centerPointError2.value = false; + } + // for (let i in chart2OptionData.value) { + // // console.log(option2.value.series[0].data[i]); + + // if (chart2OptionData.value[i].name == "E") { + // if (Math.round(chart2OptionData.value[i].value[0]) != 5 || Math.round(chart2OptionData.value[i].value[1]) != 1000) { + // centerPointError.value = true; + // } else { + // centerPointError.value = false; + // } + // } + // } + + if (quadrant1.value != "明星客户") { + markArea1Error.value = true; + } else { + markArea1Error.value = false; + } + if (quadrant2.value != "问题客户") { + markArea2Error.value = true; + } else { + markArea2Error.value = false; + } + if (quadrant3.value != "瘦狗客户") { + markArea3Error.value = true; + } else { + markArea3Error.value = false; + } + if (quadrant4.value != "现金流客户") { + markArea4Error.value = true; + } else { + markArea4Error.value = false; + } } } - step3EchartInit(); - step4EchartInit(); - step5EchartInit(); }) .catch((error) => {}); }; const retrain = () => { + showAnswerFlag.value = false; // console.log(666); - portraitModel - .retrain({ - userId: JSON.parse(getUserInfo()).userId, - module: "波士顿矩阵分析", - }) - .then((res) => { - proxy.$modal.msgSuccess("重新实训成功"); - for (let i in step1Data.value) { - step1Data.value[i].params1 = ""; - step1Data.value[i].params2 = ""; - } - step2Data.value[4].params1 = ""; - step2Data.value[4].params2 = ""; - }) - .catch((error) => {}); + // portraitModel + // .retrain({ + // userId: JSON.parse(getUserInfo()).userId, + // module: "波士顿矩阵分析", + // }) + // .then((res) => { + proxy.$modal.msgSuccess("重新实训成功"); + for (let i in step1Data.value) { + step1Data.value[i].params1 = ""; + step1Data.value[i].params2 = ""; + } + step2Data.value[4].params1 = ""; + step2Data.value[4].params2 = ""; + chart1OptionData.value = JSON.parse("[]"); + // console.log(JSON.parse(res.data.stepSevenC),'666'); + chart2OptionData.value = JSON.parse("[]"); + markCenterLineStep4.value.splice(0, 2); + quadrant1.value = ""; + quadrant2.value = ""; + quadrant3.value = ""; + quadrant4.value = ""; + quadrant1Color.value = ""; + quadrant2Color.value = ""; + quadrant3Color.value = ""; + quadrant4Color.value = ""; + // }) + // .catch((error) => {}); + + step3EchartInit(); + step4EchartInit(); + step5EchartInit(); }; defineExpose({ submitData, diff --git a/src/views/portraitModel/components/funnelAnalysis.vue b/src/views/portraitModel/components/funnelAnalysis.vue index 0750417..0e733bb 100644 --- a/src/views/portraitModel/components/funnelAnalysis.vue +++ b/src/views/portraitModel/components/funnelAnalysis.vue @@ -314,7 +314,9 @@ import * as echarts from "echarts"; import { downBlobFile } from "@/utils/index.js"; import { onMounted } from "vue"; const { proxy } = getCurrentInstance(); -const funnelData = ref([223, 235, 284, 622, 2071]); +// const funnelData = ref([223, 235, 284, 622, 2071]); +const funnelData = ref(["", "", "", "", ""]); +const funnelYAxis = ref(["", "", "", "", ""]); const dialogVisible = ref(false); const step2Select1 = ref(""); const step2Select2 = ref(""); @@ -586,81 +588,7 @@ const typeData = ref([ // }, // ], // }; -const option = ref({ - title: { - text: "漏斗图", - textStyle: { - color: "#fff", - }, - }, - tooltip: { - // trigger: 'axis', - // axisPointer: { - // type: 'shadow' - // } - }, - legend: { - data: [], - textStyle: { - color: "#fff", - }, - }, - grid: { - left: "3%", - right: "4%", - bottom: "3%", - containLabel: true, - }, - xAxis: { - show: false, - // type: 'value', - // boundaryGap: [0, 0.01] - }, - yAxis: { - type: "category", - data: ["", "", "", "", ""], - position: "center", - }, - series: [ - { - name: "", - stack: "one", - type: "bar", - barWidth: "60%", - data: [1120, 1113, 1090, 920, 220], - itemStyle: { - normal: { - //这里是重点 - color: function (params) { - // 颜色设置透明 - var colorList = ["rgba(0,0,0,0)", "rgba(0,0,0,0)", "rgba(0,0,0,0)", "rgba(0,0,0,0)", "rgba(0,0,0,0)", "rgba(0,0,0,0)"]; - return colorList[params.dataIndex]; - }, - }, - }, - }, - { - stack: "one", - name: "", - type: "bar", - barWidth: "60%", - data: funnelData.value, - // data: [223, 235, 284, 622, 2071], - itemStyle: { - normal: { - //这里是重点 - color: function (params) { - // 颜色设置透明 - var colorList = ["#009FF1", "#003DA3", "#00B869", "#FE8D2A", "#FB54A1"]; - return colorList[params.dataIndex]; - }, - }, - borderColor: "#fff", - borderWidth: 1, - }, - }, - ], -}); + const step1Error = ref(0); const step2Error = ref(0); const step3Error = ref(0); @@ -669,36 +597,126 @@ const step2AnswerFlag = ref(false); const step3AnswerFlag = ref(false); const showAnswerFlag = ref(false); const errorNum = ref(0); +const option = ref({}); const baseUrl = import.meta.env.VITE_APP_BASE_API; onBeforeUnmount(() => { saveData(); }); onMounted(() => { getData(); + initEchart() +}); +const initEchart = () => { + option.value = { + title: { + text: "漏斗图", + textStyle: { + color: "#fff", + }, + }, + tooltip: { + // trigger: 'axis', + // axisPointer: { + // type: 'shadow' + // } + }, + legend: { + data: [], + textStyle: { + color: "#fff", + }, + }, + grid: { + left: "3%", + right: "4%", + bottom: "3%", + containLabel: true, + }, + xAxis: { + show: false, + // type: 'value', + // boundaryGap: [0, 0.01] + }, + yAxis: { + type: "category", + // data: ["1", "2", "3", "4", "5"], + data: funnelYAxis.value, + position: "center", + }, + series: [ + { + name: "", + stack: "one", + type: "bar", + barWidth: "60%", + data: [1120, 1113, 1090, 920, 220], + itemStyle: { + normal: { + //这里是重点 + color: function (params) { + // 颜色设置透明 + var colorList = ["rgba(0,0,0,0)", "rgba(0,0,0,0)", "rgba(0,0,0,0)", "rgba(0,0,0,0)", "rgba(0,0,0,0)", "rgba(0,0,0,0)"]; + return colorList[params.dataIndex]; + }, + }, + }, + }, + { + label: { + show: true, // 显示数值 + // position: 'top' // 在柱状图上方显示 + }, + stack: "one", + name: "", + type: "bar", + barWidth: "60%", + data: funnelData.value, + // data: [223, 235, 284, 622, 2071], + itemStyle: { + normal: { + //这里是重点 + color: function (params) { + // 颜色设置透明 + var colorList = ["#009FF1", "#003DA3", "#00B869", "#FE8D2A", "#FB54A1"]; + return colorList[params.dataIndex]; + }, + }, + borderColor: "#fff", + borderWidth: 1, + }, + }, + ], + }; var chartDom = document.getElementById("funnel"); var myChart = echarts.init(chartDom); option.value && myChart.setOption(option.value); -}); +}; const selectData = (item, index) => { console.log(item, index); if (item == "浏览2071") { funnelData.value[index] = 2071; + funnelYAxis.value[index] = "浏览"; } if (item == "购物车622") { funnelData.value[index] = 622; + funnelYAxis.value[index] = "购物车"; } if (item == "订单284") { funnelData.value[index] = 284; + funnelYAxis.value[index] = "订单"; } if (item == "支付235") { funnelData.value[index] = 235; + funnelYAxis.value[index] = "支付"; } if (item == "完成交易223") { funnelData.value[index] = 223; + funnelYAxis.value[index] = "完成交易"; } - var chartDom = document.getElementById("funnel"); - var myChart = echarts.init(chartDom); - option.value && myChart.setOption(option.value); + // var chartDom = document.getElementById("funnel"); + // var myChart = echarts.init(chartDom); + // option.value && myChart.setOption(option.value); + initEchart(); }; const moveUp = (index, row) => { console.log("上移", index, row); @@ -902,11 +920,11 @@ const saveData = () => { stepNineD: step2Select5.value, stepTenA: step3Select1.value, stepTenB: step3Select2.value, - // stepTenC: step4Data.value[2].params1, - // stepTenD: step4Data.value[2].params2, - // stepElevenA: step4Data.value[2].params3, - // stepOneA: step5Data.value[0].params1, - // stepOneB: step5Data.value[0].params2, + stepTenC: funnelData.value[0], + stepTenD: funnelData.value[1], + stepElevenA: funnelData.value[2], + stepOneA: funnelData.value[3], + stepOneB: funnelData.value[4], // stepOneC: step5Data.value[0].params3, // stepOneD: step6Data.value[0].params1, // stepTwoA: step6Data.value[0].params2, @@ -959,11 +977,25 @@ const getData = () => { step2Select5.value = res.data.stepNineD; step3Select1.value = res.data.stepTenA; step3Select2.value = res.data.stepTenB; - // step4Data.value[2].params1 = res.data.stepTenC; - // step4Data.value[2].params2 = res.data.stepTenD; - // step4Data.value[2].params3 = res.data.stepElevenA; - // step5Data.value[0].params1 = res.data.stepOneA; - // step5Data.value[0].params2 = res.data.stepOneB; + + funnelYAxis.value[4] = step2Select1.value; + + funnelYAxis.value[3] = step2Select2.value; + + funnelYAxis.value[2] = step2Select3.value; + + funnelYAxis.value[1] = step2Select4.value; + + funnelYAxis.value[0] = step2Select5.value; + funnelData.value[0] = res.data.stepTenC; + funnelData.value[1] = res.data.stepTenD; + funnelData.value[2] = res.data.stepElevenA; + funnelData.value[3] = res.data.stepOneA; + funnelData.value[4] = res.data.stepOneB; + // var chartDom = document.getElementById("funnel"); + // var myChart = echarts.init(chartDom); + // option.value && myChart.setOption(option.value); + initEchart(); // step5Data.value[0].params3 = res.data.stepOneC; // step6Data.value[0].params1 = res.data.stepOneD; // step6Data.value[0].params2 = res.data.stepTwoA; @@ -1137,29 +1169,36 @@ const saveDataSubmit = () => { .catch((error) => {}); }; const retrain = () => { - portraitModel - .retrain({ - userId: JSON.parse(getUserInfo()).userId, - module: "转化分析-漏斗模型", - }) - .then((res) => { - proxy.$modal.msgSuccess("重新实训成功"); - for (let i in step1Data.value) { - step1Data.value[i].params1 = ""; - step1Data.value[i].params2 = ""; - step1Data.value[i].params3 = ""; - step1Data.value[i].params4 = ""; - step1Data.value[i].params5 = ""; - } - step2Select1.value = ""; - step2Select2.value = ""; - step2Select3.value = ""; - step2Select4.value = ""; - step2Select5.value = ""; - step3Select1.value = ""; - step3Select2.value = ""; - }) - .catch((error) => {}); + showAnswerFlag.value = false; + // portraitModel + // .retrain({ + // userId: JSON.parse(getUserInfo()).userId, + // module: "转化分析-漏斗模型", + // }) + // .then((res) => { + proxy.$modal.msgSuccess("重新实训成功"); + for (let i in step1Data.value) { + step1Data.value[i].params1 = ""; + step1Data.value[i].params2 = ""; + step1Data.value[i].params3 = ""; + step1Data.value[i].params4 = ""; + step1Data.value[i].params5 = ""; + } + step2Select1.value = ""; + step2Select2.value = ""; + step2Select3.value = ""; + step2Select4.value = ""; + step2Select5.value = ""; + step3Select1.value = ""; + step3Select2.value = ""; + funnelData.value = ["", "", "", "", ""]; + funnelYAxis.value = ["", "", "", "", ""]; + // var chartDom = document.getElementById("funnel"); + // var myChart = echarts.init(chartDom); + // option.value && myChart.setOption(option.value); + initEchart(); + // }) + // .catch((error) => {}); }; defineExpose({ submitData, diff --git a/src/views/portraitModel/components/portraitAnalysis.vue b/src/views/portraitModel/components/portraitAnalysis.vue index 6428930..c89175f 100644 --- a/src/views/portraitModel/components/portraitAnalysis.vue +++ b/src/views/portraitModel/components/portraitAnalysis.vue @@ -1200,13 +1200,14 @@ const submitData = () => { .catch((error) => {}); }; const retrain = () => { + showAnswerFlag.value = false; // console.log(66666); - portraitModel - .retrain({ - userId: JSON.parse(getUserInfo()).userId, - module: "用户画像分析", - }) - .then((res) => { + // portraitModel + // .retrain({ + // userId: JSON.parse(getUserInfo()).userId, + // module: "用户画像分析", + // }) + // .then((res) => { proxy.$modal.msgSuccess("重新实训成功"); step1SelectParams1.value = ""; step1SelectParams2.value = ""; @@ -1217,8 +1218,8 @@ const retrain = () => { for (let i in step2Data.value) { step2Data.value[i].params = ""; } - }) - .catch((error) => {}); + // }) + // .catch((error) => {}); }; defineExpose({ submitData, diff --git a/src/views/portraitModel/components/repurchaseAnalysis.vue b/src/views/portraitModel/components/repurchaseAnalysis.vue index 62bf0ed..058117f 100644 --- a/src/views/portraitModel/components/repurchaseAnalysis.vue +++ b/src/views/portraitModel/components/repurchaseAnalysis.vue @@ -2201,12 +2201,13 @@ const submitData = () => { // console.log(666); }; const retrain = () => { - portraitModel - .retrain({ - userId: JSON.parse(getUserInfo()).userId, - module: "复购分析", - }) - .then((res) => { + showAnswerFlag.value = false; + // portraitModel + // .retrain({ + // userId: JSON.parse(getUserInfo()).userId, + // module: "复购分析", + // }) + // .then((res) => { proxy.$modal.msgSuccess("重新实训成功"); for (let i in step1Data.value) { step1Data.value[i].params = ""; @@ -2227,8 +2228,8 @@ const retrain = () => { step5DataTable3.value[i].params1 = ""; step5DataTable3.value[i].params2 = ""; } - }) - .catch((error) => {}); + // }) + // .catch((error) => {}); }; defineExpose({ submitData, diff --git a/src/views/portraitModel/components/retainAnalysis.vue b/src/views/portraitModel/components/retainAnalysis.vue index 06de356..1c7e1a8 100644 --- a/src/views/portraitModel/components/retainAnalysis.vue +++ b/src/views/portraitModel/components/retainAnalysis.vue @@ -1727,12 +1727,13 @@ const submitData = () => { .catch((error) => {}); }; const retrain = () => { - portraitModel - .retrain({ - userId: JSON.parse(getUserInfo()).userId, - module: "留存分析", - }) - .then((res) => { + showAnswerFlag.value = false; + // portraitModel + // .retrain({ + // userId: JSON.parse(getUserInfo()).userId, + // module: "留存分析", + // }) + // .then((res) => { proxy.$modal.msgSuccess("重新实训成功"); for (let i in step1Data.value.slice(0, step1Data.value.length - 1)) { @@ -1745,8 +1746,8 @@ const retrain = () => { step2Data.value[i].params4 = ""; } dayValue.value = ""; - }) - .catch((error) => {}); + // }) + // .catch((error) => {}); }; defineExpose({ submitData, diff --git a/src/views/portraitModel/components/rfmAnalysis.vue b/src/views/portraitModel/components/rfmAnalysis.vue index fe9220a..52939e9 100644 --- a/src/views/portraitModel/components/rfmAnalysis.vue +++ b/src/views/portraitModel/components/rfmAnalysis.vue @@ -1233,7 +1233,7 @@ const saveDataSubmit = () => { }) .then((res) => {}) .catch((error) => {}); -} +}; const getData = () => { portraitModel .getData({ @@ -1458,39 +1458,40 @@ const getData = () => { .catch((error) => {}); }; const retrain = () => { - portraitModel - .retrain({ - userId: JSON.parse(getUserInfo()).userId, - module: "RFM分析", - }) - .then((res) => { - proxy.$modal.msgSuccess("重新实训成功"); - for (let i in fileTable1.value) { - fileTable1.value[i].params = ""; - } - for (let i in step2Data.value) { - step2Data.value[i].params1 = ""; - step2Data.value[i].params2 = ""; - step2Data.value[i].params3 = ""; - } - for (let i in step4Data.value) { - step4Data.value[i].params1 = ""; - step4Data.value[i].params2 = ""; - step4Data.value[i].params3 = ""; - } - step5Data.value[0].params1 = ""; - step5Data.value[0].params2 = ""; - step5Data.value[0].params3 = ""; - for (let i in step6Data.value) { - step6Data.value[i].params1 = ""; - step6Data.value[i].params2 = ""; - step6Data.value[i].params3 = ""; - } - for (let i in step7Data.value) { - step7Data.value[i].params = ""; - } - }) - .catch((error) => {}); + showAnswerFlag.value = false; + // portraitModel + // .retrain({ + // userId: JSON.parse(getUserInfo()).userId, + // module: "RFM分析", + // }) + // .then((res) => { + proxy.$modal.msgSuccess("重新实训成功"); + for (let i in fileTable1.value) { + fileTable1.value[i].params = ""; + } + for (let i in step2Data.value) { + step2Data.value[i].params1 = ""; + step2Data.value[i].params2 = ""; + step2Data.value[i].params3 = ""; + } + for (let i in step4Data.value) { + step4Data.value[i].params1 = ""; + step4Data.value[i].params2 = ""; + step4Data.value[i].params3 = ""; + } + step5Data.value[0].params1 = ""; + step5Data.value[0].params2 = ""; + step5Data.value[0].params3 = ""; + for (let i in step6Data.value) { + step6Data.value[i].params1 = ""; + step6Data.value[i].params2 = ""; + step6Data.value[i].params3 = ""; + } + for (let i in step7Data.value) { + step7Data.value[i].params = ""; + } + // }) + // .catch((error) => {}); }; defineExpose({ submitData, diff --git a/src/views/portraitModel/components/viscosityAnalysis.vue b/src/views/portraitModel/components/viscosityAnalysis.vue index 76894a7..227dc9c 100644 --- a/src/views/portraitModel/components/viscosityAnalysis.vue +++ b/src/views/portraitModel/components/viscosityAnalysis.vue @@ -1888,12 +1888,13 @@ const submitData = () => { .catch((error) => {}); }; const retrain = () => { - portraitModel - .retrain({ - userId: JSON.parse(getUserInfo()).userId, - module: "用户粘性分析", - }) - .then((res) => { + showAnswerFlag.value = false; + // portraitModel + // .retrain({ + // userId: JSON.parse(getUserInfo()).userId, + // module: "用户粘性分析", + // }) + // .then((res) => { proxy.$modal.msgSuccess("重新实训成功"); for (let i in step1Data.value) { @@ -1920,8 +1921,8 @@ const retrain = () => { analysisConclusionStep3.value = ""; analysisConclusionStep4.value = ""; // dayValue.value = ""; - }) - .catch((error) => {}); + // }) + // .catch((error) => {}); }; defineExpose({ submitData,