From f1fb97544c9511accd28c0568cfa1ea894e4a488 Mon Sep 17 00:00:00 2001 From: suyanyan <1321717064@qq.com> Date: Thu, 5 Sep 2024 16:15:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/violation/portrait/detail.vue | 141 +++++------------- 1 file changed, 34 insertions(+), 107 deletions(-) diff --git a/SafeCampus.WEB/src/views/violation/portrait/detail.vue b/SafeCampus.WEB/src/views/violation/portrait/detail.vue index d410a25..ccff0ac 100644 --- a/SafeCampus.WEB/src/views/violation/portrait/detail.vue +++ b/SafeCampus.WEB/src/views/violation/portrait/detail.vue @@ -146,6 +146,7 @@ ({}); //班级人员列表 const chartEl = ref(null); @@ -254,7 +254,7 @@ const getDetail = () => { portraitSummaryApi.getStudentDetail({ id: route.query.personId }).then((res: any) => { state.laberAttrName = res.data.label; state.laberAttrValue = res.data.value; - getCharts(res.data.label, res.data.value); + getLaberAttrCharts(res.data.label, res.data.value); }); /* 出勤情况 */ getStuAttendance(); @@ -265,6 +265,17 @@ const getDetail = () => { /* 一卡通消费情况 */ getOneCardSolution(); }; +/* chart数据处理 */ +const handleDate = (label: any, value: any, key: any = "") => { + let data: any = []; + label.forEach((item: any, index: number) => { + data.push({ + value: value[index], + name: item + key + }); + }); + return data; +}; /* 出校情况--请求 */ const getStuLeave = () => { portraitSummaryApi.getStudentOutSchool({ id: route.query.personId, searchType: state.leavesSchTime }).then((resp: any) => { @@ -272,32 +283,31 @@ const getStuLeave = () => { state.outSchool = resp.data; }); }; -/* 图书馆使用情况 -- 请求 */ +/* 图书馆使用情况--请求 */ const getStuLibrary = () => { portraitSummaryApi.getStudentLibrary({ id: route.query.personId, searchType: state.libraryTime }).then((resp: any) => { - getCharts3(resp.data.label, resp.data.value); + getLibraryCharts(resp.data.label, resp.data.value); }); }; - -/* 一卡通消费情况 -- 请求 */ +/* 一卡通消费情况--请求 */ const getOneCardSolution = () => { portraitSummaryApi.getStudentCanteen({ id: route.query.personId, searchType: state.oneCardTime }).then((resp: any) => { console.log(resp, "..........."); state.oneCard = resp.data; - getCharts4(resp.data.label, resp.data.value); + getOneCardCharts(resp.data.label, resp.data.value); }); }; -const handleDate = (label: any, value: any, key: any = "") => { - let data: any = []; - label.forEach((item: any, index: number) => { - data.push({ - value: value[index], - name: item + key - }); + +/* 出勤情况分析--请求 */ +const getStuAttendance = () => { + portraitSummaryApi.getStudentAttendance({ id: route.query.personId, searchType: state.attendanceTime }).then((resp: any) => { + let value = handleDate(resp.data.label, resp.data.value, ""); + state.attendance = resp.data; + getAttendanceCharts(resp.data.label, value); }); - return data; }; -const getCharts = (nameArr: any, valueArr: any) => { +/* 标签属性--图表 */ +const getLaberAttrCharts = (nameArr: any, valueArr: any) => { let nameObj: any = []; nameArr.map((item: any) => { nameObj.push({ @@ -395,16 +405,8 @@ const getCharts = (nameArr: any, valueArr: any) => { chart.resize(); }); }; -/* 出勤情况分析-请求 */ -const getStuAttendance = () => { - portraitSummaryApi.getStudentAttendance({ id: route.query.personId, searchType: state.attendanceTime }).then((resp: any) => { - let value = handleDate(resp.data.label, resp.data.value, ""); - state.attendance = resp.data; - getCharts2(resp.data.label, value); - }); -}; /* 出勤情况分析-图表 */ -const getCharts2 = (label: any, value: any) => { +const getAttendanceCharts = (label: any, value: any) => { const chart2 = echarts.init(chartEl2.value); var giftImageUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAGJZJREFUeF7tXQuYHFWV/k/1kCyP8OFj2aAuK4oIiPISRQS+pKtJDCzIK4jIivGtCJJ0dXiIy+ADlunqhJco6PJaWEQQBVwxoatnFl1REVgJRKJ86rerJqKLKEFhMl1nc6u7Jz0zPdNVt25XV0+fypcvnalz/nPOf+qfW9V1qy5BNmFAGJiWARJuhAFhYHoGRCBydAgDMzAgApHDQxgQgcgxIAzoMSAjiB5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+PuLycAaMLW7a8KGIsLBdopJMk2S5zJ/EFO90MMOHCSp7UrYy2W2iBKKTsEC8iq6Pn7s97Du3UNuuYBnKBHpPA3nY/03PomrAlRBJIIJISH0Y+bt86pfhVYYOEtWv3jUJYnHZ2uYRGw3Z5yP5EGVDLZ5/pFeirUaJGFogCt4v8JgYuJcLRUYK1syXCGeU83dzOLu7+hS4fbAGJ3XOJm6/4x2OAGd9m4DPNs3TDImoJpAGeLfFS4mA12QVhA85gd4fnkFpLMJFNdyXXRJKTIKYYGGHCNXFW3o0lkHGhDPH7yAqEoj8XfxQv9y6g/zPFTBgcuVgPw1JP2jzEPq6prKQb42ZvRCDjQnF5ydbVWYO/BOwZMrl758zB0vvOJu3n4UPGaWmWdfmjhGA+lmy9zADhCTDu9gmV4Tx5pkoxKpDmpNR5PjGOJWA+LMwnxnxm7AbCfDAeZgtrLMYPyg51/Y72whLvbzGOISDLQMdvVJpqXh/ijIKxiQgbmbAJPjYxsGkAuLPdDT9drjomEN2ExE8YSBMDIpA0dUNySR0DIpDUtUQSShMDIpA0dUNySR0DIpDUtUQSShMDIpA0dUNySR0D/w9O0HmbNxG/pgAAAABJRU5ErkJggg=="; @@ -471,12 +473,13 @@ const getCharts2 = (label: any, value: any) => { chart2.resize(); }); }; -const getCharts3 = (label: any, value: any) => { +/* 图书馆使用情况-图表 */ +const getLibraryCharts = (label: any, value: any) => { const chart3 = echarts.init(chartEl3.value); let option = { + tooltip: {}, xAxis: { type: "category", - // data: state.weekDates data: label }, yAxis: { @@ -494,28 +497,9 @@ const getCharts3 = (label: any, value: any) => { chart3.resize(); }); }; -const getCharts4 = (label: any, value: any) => { +/* 一卡通消费情况--图表 */ +const getOneCardCharts = (label: any, value: any) => { const chart4 = echarts.init(chartEl4.value); - // let xAxisData = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]; - let data1 = []; - let data2 = []; - let data3 = []; - let data4 = []; - for (let i = 0; i < 10; i++) { - data1.push(+(Math.random() * 2).toFixed(2)); - data2.push(+(Math.random() * 5).toFixed(2)); - data3.push(+(Math.random() + 0.3).toFixed(2)); - data4.push(+Math.random().toFixed(2)); - } - var data5 = (function () { - var datas = []; - - for (var i = 0; i < data1.length; i++) { - datas.push((data1[i] + data2[i] + data3[i] + data4[i]).toFixed(2)); - } - - return datas; - })(); var emphasisStyle = { itemStyle: { shadowBlur: 10, @@ -525,7 +509,7 @@ const getCharts4 = (label: any, value: any) => { let option = { legend: { top: "5%", - data: ["食堂", "生活消费", "交通", "其他"] + data: ["食堂"] }, xAxis: { data: label, @@ -554,48 +538,9 @@ const getCharts4 = (label: any, value: any) => { show: true, position: "insideBottom", formatter: "{c}", - textStyle: { color: "#000" } + color: "#000" } } - // { - // name: "生活消费", - // barWidth: 20, - // type: "bar", - // stack: "one", - // emphasis: emphasisStyle, - // data: data2 - // }, - // { - // name: "交通", - // barWidth: 20, - // type: "bar", - // stack: "one", - // emphasis: emphasisStyle, - // data: data3 - // }, - // { - // name: "其他", - // barWidth: 20, - // type: "bar", - // stack: "one", - // emphasis: emphasisStyle, - // data: data4 - // }, - // { - // name: "总计", - // type: "bar", - // stack: "one", - // label: { - // show: true, - // position: "insideBottom", - // formatter: "{c}", - // textStyle: { color: "#000" } - // }, - // itemStyle: { - // color: "rgba(128, 128, 128, 0)" - // }, - // data: data5 - // } ] }; chart4.setOption(option); @@ -603,25 +548,7 @@ const getCharts4 = (label: any, value: any) => { chart4.resize(); }); }; -const getWeekDates = () => { - let date = new Date(); - state.weekDates = bz(date); // 获取本周一到本周日的日期 - state.weekDates.forEach((item: any, index: any) => { - state.weekDates[index] = dateFormat(item, "yyyy-MM-dd"); - }); - function bz(date: any) { - const weekDates = []; - const dayOfWeek = date.getDay(); - for (let i = 0; i <= 6; i++) { - const day = new Date(date); - day.setDate(date.getDate() - dayOfWeek + i + (dayOfWeek === 0 ? 0 : 1)); - weekDates.push(day); - } - return weekDates; - } -}; onMounted(() => { - getWeekDates(); getDetail(); });