diff --git a/src/api/portraitModel.js b/src/api/portraitModel.js index 8e6f7ef..3ae91ef 100644 --- a/src/api/portraitModel.js +++ b/src/api/portraitModel.js @@ -33,7 +33,14 @@ export function downloadDataByBoston(data) { params: data, }); } -//数据下载-帕累托/ABC分析 +//数据下载-漏斗分析 +export function downloadDataByFunnel(data) { + return request({ + url: "/api/downDataByUserPortrait/analysisByFunnelModel", + method: "get", + params: data, + }); + } //筛选出统计样本 export function filterOutStatisSample(data) { return request({ diff --git a/src/views/portraitModel/components/abcAnalysis.vue b/src/views/portraitModel/components/abcAnalysis.vue index db7833d..4b853d2 100644 --- a/src/views/portraitModel/components/abcAnalysis.vue +++ b/src/views/portraitModel/components/abcAnalysis.vue @@ -356,9 +356,11 @@ const errorNum = ref(0); const step1Error = ref(0); const step2Error = ref(0); const step3Error = ref(0); +const step4Error = ref(0); const step1AnswerFlag = ref(false); const step2AnswerFlag = ref(false); const step3AnswerFlag = ref(false); +const step4AnswerFlag = ref(false); const step1Data = ref([ { name: "男士配饰", @@ -575,6 +577,12 @@ const typeData = ref([ data2: "占总销售额的10%,给予一般关注", }, ]); +onBeforeUnmount(() => { + saveData(); +}); +onMounted(() => { + getData(); +}); const moveUp = (index, row) => { console.log("上移", index, row); if (index > 0) { @@ -629,6 +637,7 @@ const step1Submit = () => { } console.log(step1Error.value, "错误数"); proxy.$modal.msgSuccess("提交成功"); + step1AnswerFlag.value = true; //将所填值同步到第二步表格 step2Data.value[0].amount = step1Data.value[0].params; step2Data.value[1].amount = step1Data.value[1].params; @@ -700,8 +709,162 @@ const step3Submit = () => { step3AnswerFlag.value = true; }; const step4Submit = () => { - console.log('asd'); + step4Error.value = 0; + // console.log('asd1112'); + for (let i in step4Data.value) { + // console.log(fileTable1.value[i]); + if (!step4Data.value[i].params || !step4Data.value[i].params) { + proxy.$modal.msgError("请先完成所有填空"); + return; + } + } + if (step4Data.value[0].params && step4Data.value[0].params !== "A类商品") { + step4Error.value++; + } + if (step4Data.value[1].params && step4Data.value[1].params !== "B类商品") { + step4Error.value++; + } + if (step4Data.value[2].params && step4Data.value[2].params !== "C类商品") { + step4Error.value++; + } + if (step4Data.value[3].params && step4Data.value[3].params !== "C类商品") { + step4Error.value++; + } + console.log("错误数", step4Error.value); + proxy.$modal.msgSuccess("提交成功"); + step4AnswerFlag.value = true; +}; +const saveData = () => { + const params = { + stepFiveA: step1Data.value[0].params, + stepFiveB: step1Data.value[1].params, + stepFiveC: step1Data.value[2].params, + stepFiveD: step1Data.value[3].params, + stepSixA: step3Data.value[0].params1, + stepSixB: step3Data.value[0].params2, + stepSixC: step3Data.value[1].params1, + stepSixD: step3Data.value[1].params2, + stepSevenA: step3Data.value[2].params1, + stepSevenB: step3Data.value[2].params2, + stepSevenC: step3Data.value[3].params1, + stepSevenD: step3Data.value[3].params2, + stepEightA: step4Data.value[0].params, + stepEightB: step4Data.value[1].params, + stepEightC: step4Data.value[2].params, + stepEightD: step4Data.value[3].params, + // stepNineA: step4Data.value[0].params1, + // stepNineB: step4Data.value[0].params2, + // stepNineC: step4Data.value[0].params3, + // stepNineD: step4Data.value[1].params1, + // stepTenA: step4Data.value[1].params2, + // stepTenB: step4Data.value[1].params3, + // 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, + // stepOneC: step5Data.value[0].params3, + // stepOneD: step6Data.value[0].params1, + // stepTwoA: step6Data.value[0].params2, + // stepTwoB: step6Data.value[0].params3, + // stepTwoC: step6Data.value[1].params1, + // stepThreeA: step6Data.value[1].params2, + // stepThreeB: step6Data.value[1].params3, + // stepThreeC: step6Data.value[2].params1, + // stepThreeD: step6Data.value[2].params2, + // stepFourA: step6Data.value[2].params3, + // stepFourB: step7Data.value[0].params, + // stepFourC: step7Data.value[1].params, + // stepFourD: step7Data.value[2].params, + }; + portraitModel + .saveData({ + userId: 492, + module: "帕累托/ABC分析", + ...params, + }) + .then((res) => {}) + .catch((error) => {}); +}; +const getData = () => { + portraitModel + .getData({ + userId: 492, + module: "帕累托/ABC分析", + }) + .then((res) => { + step1Data.value[0].params = res.data.stepFiveA; + step1Data.value[1].params = res.data.stepFiveB; + step1Data.value[2].params = res.data.stepFiveC; + step1Data.value[3].params = res.data.stepFiveD; + step3Data.value[0].params1 = res.data.stepSixA; + step3Data.value[0].params2 = res.data.stepSixB; + step3Data.value[1].params1 = res.data.stepSixC; + step3Data.value[1].params2 = res.data.stepSixD; + step3Data.value[2].params1 = res.data.stepSevenA; + step3Data.value[2].params2 = res.data.stepSevenB; + step3Data.value[3].params1 = res.data.stepSevenC; + step3Data.value[3].params2 = res.data.stepSevenD; + step4Data.value[0].params = res.data.stepEightA; + step4Data.value[1].params = res.data.stepEightB; + step4Data.value[2].params = res.data.stepEightC; + step4Data.value[3].params = res.data.stepEightD; + // step4Data.value[0].params1 = res.data.stepNineA; + // step4Data.value[0].params2 = res.data.stepNineB; + // step4Data.value[0].params3 = res.data.stepNineC; + // step4Data.value[1].params1 = res.data.stepNineD; + // step4Data.value[1].params2 = res.data.stepTenA; + // step4Data.value[1].params3 = 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; + // step5Data.value[0].params3 = res.data.stepOneC; + // step6Data.value[0].params1 = res.data.stepOneD; + // step6Data.value[0].params2 = res.data.stepTwoA; + // step6Data.value[0].params3 = res.data.stepTwoB; + // step6Data.value[1].params1 = res.data.stepTwoC; + // step6Data.value[1].params2 = res.data.stepThreeA; + // step6Data.value[1].params3 = res.data.stepThreeB; + // step6Data.value[2].params1 = res.data.stepThreeC; + // step6Data.value[2].params2 = res.data.stepThreeD; + // step6Data.value[2].params3 = res.data.stepFourA; + // step7Data.value[0].params = res.data.stepFourB; + // step7Data.value[1].params = res.data.stepFourC; + // step7Data.value[2].params = res.data.stepFourD; + }) + .catch((error) => {}); +}; +const submitData = () => { + console.log("tj"); + if ( + !step1AnswerFlag.value || + !step2AnswerFlag.value || + !step3AnswerFlag.value || + !step4AnswerFlag.value + ) { + proxy.$modal.msgError("请先完成所有步骤!"); + return; + } + errorNum.value = + step1Error.value + step2Error.value + step3Error.value + step4Error.value; + console.log(errorNum.value, "总错误次数"); + portraitModel + .submit({ + userId: 492, + taskName: "帕累托/ABC分析", + numberOfErrors: errorNum.value, + }) + .then((res) => { + proxy.$modal.msgSuccess("提交成功"); + }) + .catch((error) => {}); }; +defineExpose({ + submitData, + // practicalTraining, +});