From 6f1e7a63fa6afc261ba2247bf1d56f59dbb9f4c9 Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期四, 07 八月 2025 17:29:46 +0800 Subject: [PATCH] 测试完成 --- src/views/index.vue | 860 ++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 520 insertions(+), 340 deletions(-) diff --git a/src/views/index.vue b/src/views/index.vue index 17f699a..d76be1a 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -7,49 +7,48 @@ <!-- 灏辫瘖缁熻鐩掑瓙 --> <div class="grid-content bg-purple headerBox bgc1"> <div class="title"> - 鎮h�呯粺璁�<span + 闂ㄨ瘖鏈嶅姟<span style=" font-size: 25px; font-weight: 600; text-shadow: 2px 4px 7px rgb(85 132 255 / 50%); color: black; " - >12322 (浜�)</span - > + ></span> <span>{{ endatd }} ~ {{ statd }}</span> </div> <el-row :gutter="20"> - <el-col :span="8"> + <el-col :span="10"> <div class="home-user-task-stats"> - <p>{{ 11231 }}</p> + <p>{{ OutpatientData.rs }}</p> <div class="text-color2"> - <p>闂ㄨ瘖鎬绘暟锛堜汉锛�</p> + <p>闂ㄨ瘖灏辫瘖閲忥紙浜烘锛�</p> </div> </div> </el-col> - <el-col :span="7"> + <el-col :span="10"> <div class="home-user-task-stats"> - <p>{{ 9207 }}</p> + <p>{{ OutpatientData.rc }}</p> <div class="text-color2"> - <p>浣忛櫌鎬绘暟锛堜汉锛�</p> + <p>闂ㄨ瘖鏈嶅姟閲忥紙浜烘锛�</p> </div> </div> </el-col> - <el-col :span="7"> + <!-- <el-col :span="7"> <div class="home-user-task-stats"> <p>{{ 1209 }}</p> <div class="text-color2"> <p>浣撴鎬绘暟锛堜汉锛�</p> </div> </div> - </el-col> + </el-col> --> </el-row> </div> </el-col> <el-col :span="9"> <div class="grid-content bg-purple headerBox bgc2"> <div class="title"> - 闂ㄨ瘖鏈嶅姟鎬绘暟 + 鍑洪櫌鏈嶅姟 <span style=" font-size: 25px; @@ -57,24 +56,23 @@ font-weight: 600; color: red; " - >12322 (浜�)</span - > + ></span> <span>{{ endatd }} ~ {{ statd }}</span> </div> <el-row :gutter="20"> - <el-col :span="12"> + <el-col :span="10"> <div class="home-user-task-stats"> - <p style="color: red">{{ 3453 }}</p> + <p style="color: red">{{ DischargeData.rs }}</p> </div> <div class="text-color2"> - <p>浣忛櫌鏈嶅姟浜烘暟</p> + <p>鍑洪櫌灏辫瘖閲忥紙浜烘锛�</p> </div> </el-col> - <el-col :span="12"> + <el-col :span="10"> <div class="home-user-task-stats"> - <p style="color: red">{{ 4213 }}</p> + <p style="color: red">{{ DischargeData.rc }}</p> <div class="text-color2"> - <p>浣撴鏈嶅姟浜烘暟</p> + <p>鍑洪櫌鏈嶅姟閲忥紙浜烘锛�</p> </div> </div> </el-col> @@ -88,7 +86,7 @@ <!-- echars鏁版嵁鍙鍖� --> <div class="grid-content bg-purple" style="min-height: 365px"> <div class="title"> - 灏辫瘖缁熻 + 鏈嶅姟缁熻 <span>{{ endatd }} ~ {{ statd }}</span> <el-radio-group v-model="radio1" @@ -107,18 +105,17 @@ ></el-radio-button> </el-radio-group> </div> - <!-- 涓棿echars --> + <!-- 涓儴绾挎�ф煴鐘跺浘 --> <div class="boxEchars"> <div class="echars1" id="echars"></div> - <div class="echars2" id="echars2"></div> </div> </div> </el-col> - <!-- 涓棿鍜屽彸杈� --> + <!-- 鍙宠竟鍒楄〃 --> <el-col :span="4" class="aside"> <div class="grid-content bg-purple" style="margin-top: -180px"> <div class="title"> - 鍋ュ悍瀹f暀 + 绉戝鏈嶅姟閲� <span>{{ endatd }} ~ {{ statd }}</span> </div> <div style="max-height: 690px; width: 100%; overflow: auto"> @@ -131,14 +128,13 @@ type="index" ></el-table-column> <el-table-column - prop="skuName" + prop="deptname" width="88" class-name="name" ></el-table-column> - <el-table-column prop="count" class-name="count"> - <template slot-scope="scope"> - {{ scope.row.count }}娆� - </template> + + <el-table-column prop="rc" class-name="rc"> + <template slot-scope="scope"> {{ scope.row.rc }}娆� </template> </el-table-column> </el-table> </div> @@ -147,27 +143,19 @@ </el-row> <!-- 搴曢儴涓�涓� --> <el-row :gutter="20" style="margin-bottom: 20px"> - <el-col :span="13"> + <el-col :span="24"> <div class="grid-content bg-purple" style="min-height: 300px"> <div class="title"> - 璇婂悗缁熻 + 瀹f暀缁熻 <span class="el-icon-s-unfold moreIcon"></span> </div> <div class="cooperate"> <!-- 鍚堜綔鍖哄煙 --> <div class="pieChart" id="pieCharts"></div> - <div class="Points"> - <p>{{ 122 }}</p> - <span>鍏朵腑闅忚骞查浜烘</span> - <p>{{ 122 }}</p> - <span>闂ㄨ瘖闅忚</span> - <p>{{ 122 }}</p> - <span>鍑洪櫌闅忚</span> - </div> </div> </div> </el-col> - <el-col :span="10"> + <!-- <el-col :span="9"> <div class="grid-content bg-purple" style="min-height: 300px"> <div class="title"> 鍚勯」鏈嶅姟缁熻 @@ -175,99 +163,136 @@ </div> <div class="empenty"> <el-row> - <el-col :span="4" - ><div class="grid-content bg-purple">璇婄枟棰勭害</div></el-col + <el-col :span="3" + ><div class="grid-contents bg-purples">鍑洪櫌锛�</div></el-col > - <el-col :span="4" - ><div class="grid-content bg-purple-light">123娆�</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple">杞瘖鏈嶅姟</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple-light">231娆�</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple">淇℃伅鎺ㄩ��</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple-light">900娆�</div></el-col - > </el-row - ><el-row> - <el-col :span="4" - ><div class="grid-content bg-purple">鏍囪瘑涓庡鑸�</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple-light">23娆�</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple"> - 鎮h�呬究鍒╀繚闅滄湇鍔� - </div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple-light">13娆�</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple">杩滅▼鍖荤枟</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple-light">31娆�</div></el-col - > </el-row - ><el-row> - <el-col :span="4" - ><div class="grid-content bg-purple">鎮h�呭弽棣�</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple-light">150浜�</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple">鎮h�呯鐞�</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple-light">231浜�</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple">鍋ュ悍瀹f暀</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple-light">400</div></el-col - > + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">鍑洪櫌闅忚</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">鍑洪櫌瀹f暀</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">澶嶈瘖閫氱煡</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> </el-row> <el-row> - <el-col :span="4" - ><div class="grid-content bg-purple">鍙嶉鍗犳瘮</div></el-col + <el-col :span="3" + ><div class="grid-contents bg-purples"></div + ></el-col> + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">鍑洪櫌璇勪及</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">婊℃剰搴﹁皟鏌�</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">鍏朵粬閫氱煡</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + </el-row> + + <el-row> + <el-col :span="3" + ><div class="grid-contents bg-purples">闂ㄨ瘖锛�</div></el-col > - <el-col :span="4" - ><div class="grid-content bg-purple-light">23%</div></el-col + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">褰卞儚闅忚</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">闂ㄨ瘖瀹f暀</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">澶嶈瘖閫氱煡</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + </el-row> + <el-row> + <el-col :span="3" + ><div class="grid-contents bg-purples"></div + ></el-col> + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">婊℃剰搴﹁皟鏌�</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">鍏朵粬閫氱煡</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + </el-row> + <el-row> + <el-col :span="3" + ><div class="grid-contents bg-purples">鍦ㄩ櫌锛�</div></el-col > - <el-col :span="4" - ><div class="grid-content bg-purple">绠$悊鍗犳瘮</div></el-col - > - <el-col :span="4" - ><div class="grid-content bg-purple-light">32%</div></el-col - > + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">鍦ㄩ櫌瀹f暀</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">鍦ㄩ櫌璇勪及</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> + + <el-col :span="7"> + <div style="display: flex"> + <div class="subtitle">鍏朵粬閫氱煡</div> + <div class="grid-contents bg-purple-light">0娆�</div> + </div> + </el-col> </el-row> </div> </div> - </el-col> + </el-col> --> </el-row> </div> </div> </template> <script> -// import { -// getUserWork, -// getregionCollect, -// getregionOrderCount, -// getregionAmountCollect, -// getNodeCount, -// getPrtnerCount, -// getnodeCollect, -// getSkuTop, -// getOrderAmount, -// } from "@/api/home"; +import { + getEChartsPatMedOuthospCount, + getechartsListCountdata, + getechartsMedOuthospList, + getechartsMedInhospList, + getServiceStatistics, + getDeptRanking, +} from "@/api/AiCentre/index"; import dayjs from "dayjs"; export default { @@ -277,8 +302,25 @@ NodeCount: "", PrtnerCount: "", NodeCount: "", - radio1: "鍛�", + myChart2: null, + mypPieCharts: null, + lastWidth: window.innerWidth, + lastHeight: window.innerHeight, + radio1: "鏈�", ticketStatistics: {}, + timeTypeMap: { + 鍛�: "day", + 鏈�: "month", + 骞�: "year", + }, + DischargeData: { + rs: "", + rc: "", + }, + OutpatientData: { + rs: "", + rc: "", + }, order: "", Count: "", datatni: [], @@ -289,6 +331,7 @@ cylinderSeries: [], cylinderXAxis: [], dyat: 30, + intervalId: null, }; }, @@ -308,19 +351,24 @@ }, }, created() { + this.getTopdata(); + this.getgraphdata(); + this.getranking(); this.$nextTick(function () { - this.getregionAmountCollect(); - this.getUserWorks(); - this.getregionCollect(); - this.getregionOrderCount(); - this.getNodeCount(); - this.getPrtnerCount(); + this.myEcharts2(); this.getnodeCollect(); this.getSkuTop(); - this.getOrderAmount(); }); }, - mounted() {}, + mounted() { + this.setInterval(); + // window.addEventListener("resize", this.handleResize()); + }, + beforeDestroy() { + if (this.intervalId) { + clearInterval(this.intervalId); // 娓呴櫎瀹氭椂鍣� + } + }, methods: { // 鏀瑰彉鏃堕棿浜嬩欢 changes() { @@ -331,117 +379,242 @@ } else { this.dyat = 360; } - this.getregionAmountCollect(); - this.getUserWorks(); - this.getregionCollect(); - this.getregionOrderCount(); - this.getNodeCount(); - this.getPrtnerCount(); + this.getgraphdata(); + this.getranking(); + this.getTopdata(); + this.myEcharts2(); this.getnodeCollect(); this.getSkuTop(); - this.getOrderAmount(); }, - // 鏌辩姸鍥� - async getOrderAmount() { - // const res = await getOrderAmount(this.endatd, this.statd); - // this.cylinderXAxis = res.data.xAxis; - // this.cylinderSeries = res.data.series; - this.cylinderXAxis = [ - "1鏈�", - "2鏈�", - "3鏈�", - "4鏈�", - "5鏈�", - "6鏈�", - "7鏈�", - "8鏈�", - ]; - this.cylinderSeries = [123, 123, 223, 212, 432, 123, 442, 234]; - this.myEcharts(); - }, - // 鑾峰彇鐐逛綅鎬绘暟 - async getNodeCount() { - // const res = await getNodeCount(); - // this.NodeCount = res.data; - }, - // 鑾峰彇鍚堜綔鍟嗘�绘暟 - async getPrtnerCount() { - // const res = await getPrtnerCount(); - // this.PrtnerCount = res.data; - }, + // 鍚堜綔鍟嗙偣浣嶆眹鎬荤粺璁¢ゼ鐘跺浘 async getnodeCollect() { // const res = await getnodeCollect(); // this.nodeCollect = res.data; this.nodeCollect = [ - { name: "闂ㄨ瘖闅忚", value: 1232 }, + { name: "褰卞儚闅忚", value: 1232 }, { name: "鍑洪櫌闅忚", value: 342 }, ]; this.myPieChart(); }, // top鎺掕 async getSkuTop() { - // const res = await getSkuTop(10, this.endatd, this.statd); - // this.SkuTop = res.data; - this.SkuTop = [ - { amount: 0, count: 123, skuId: "0", skuName: "蹇冭偤绉�" }, - { amount: 0, count: 122, skuId: "0", skuName: "鑲捐剰绉�" }, - { amount: 0, count: 112, skuId: "0", skuName: "娉屽翱绉�" }, - { amount: 0, count: 111, skuId: "0", skuName: "鐢风" }, - { amount: 0, count: 102, skuId: "0", skuName: "濡囦骇绉�" }, - { amount: 0, count: 98, skuId: "0", skuName: "澶栫" }, - { amount: 0, count: 89, skuId: "0", skuName: "鎬ヨ瘖" }, - { amount: 0, count: 88, skuId: "0", skuName: "鍣ㄦ绉�" }, - { amount: 0, count: 87, skuId: "0", skuName: "楠ㄧ" }, - { amount: 0, count: 67, skuId: "0", skuName: "鏀惧皠绉�" }, - { amount: 0, count: 89, skuId: "0", skuName: "鎬ヨ瘖" }, - { amount: 0, count: 88, skuId: "0", skuName: "鍣ㄦ绉�" }, - { amount: 0, count: 87, skuId: "0", skuName: "楠ㄧ" }, - { amount: 0, count: 67, skuId: "0", skuName: "鏀惧皠绉�" }, + let Rankingdata = { + startDate: this.endatd, + endDate: this.statd, + cy: 1, + }; + await getDeptRanking(Rankingdata).then((res) => { + if (res.code == 200) { + this.SkuTop = res.rows.sort((a, b) => b.rc - a.rc); + console.log(this.SkuTop, "this.SkuTop"); + } + }); - ]; + // this.SkuTop = [ + // { amount: 0, count: 123, skuId: "0", skuName: "蹇冭偤绉�" }, + // { amount: 0, count: 122, skuId: "0", skuName: "鑲捐剰绉�" }, + // { amount: 0, count: 112, skuId: "0", skuName: "娉屽翱绉�" }, + // { amount: 0, count: 111, skuId: "0", skuName: "鐢风" }, + // { amount: 0, count: 102, skuId: "0", skuName: "濡囦骇绉�" }, + // { amount: 0, count: 98, skuId: "0", skuName: "澶栫" }, + // { amount: 0, count: 89, skuId: "0", skuName: "鎬ヨ瘖" }, + // { amount: 0, count: 88, skuId: "0", skuName: "鍣ㄦ绉�" }, + // { amount: 0, count: 87, skuId: "0", skuName: "楠ㄧ" }, + // { amount: 0, count: 67, skuId: "0", skuName: "鏀惧皠绉�" }, + // { amount: 0, count: 89, skuId: "0", skuName: "鎬ヨ瘖" }, + // { amount: 0, count: 88, skuId: "0", skuName: "鍣ㄦ绉�" }, + // { amount: 0, count: 87, skuId: "0", skuName: "楠ㄧ" }, + // { amount: 0, count: 67, skuId: "0", skuName: "鏀惧皠绉�1" }, + // { amount: 0, count: 67, skuId: "0", skuName: "鏀惧皠绉�2" }, + // ]; }, - // 鑾峰彇宸ュ崟鏁伴噺 - async getUserWorks() { - // const res = await getUserWork(this.atd, this.td); - // this.ticketStatistics = res.data[0]; + // 鑾峰彇澶撮儴鏁版嵁 + getTopdata() { + let hospCountdata = { + startDate: this.endatd, + endDate: this.statd, + cy: 1, + }; + let Countdata = { + startDate: this.endatd, + endDate: this.statd, + cy: 1, + }; + // 鏌ヨ闂ㄨ瘖鐪嬬梾浜烘鍜屼汉鏁� + getEChartsPatMedOuthospCount(hospCountdata).then((res) => { + if (res.code == 200) { + this.OutpatientData = res.data; + } + }); + // 鏌ヨ鍑恒�佸叆闄㈢湅鐥呬汉娆″拰浜烘暟 + getechartsListCountdata(Countdata).then((res) => { + if (res.code == 200) { + this.DischargeData = res.data; + } + }); }, - // 鑾峰彇灏辫瘖鏁伴噺 - async getregionOrderCount() { - // const res = await getregionOrderCount({ - // start: this.atd, - // end: this.td, - // }); - // this.order = res.data; - }, - // 鑾峰彇鎬婚噺鏁伴噺 - async getregionCollect() { - // const res = await getregionCollect({ - // start: this.atd, - // end: this.td, - // }); - // this.Count = (res.data / 1000000).toFixed(2); - }, + // 鑾峰彇涓儴绾挎煴鍥炬暟鎹� + getranking() {}, - // 鏌辩姸鍥� - myEcharts() { - // 鍩轰簬鍑嗗濂界殑dom锛屽垵濮嬪寲echarts瀹炰緥 - var echarts = require("echarts"); - var myChart = echarts.init(document.getElementById("echars2")); + async getgraphdata() { + let params = { + startDate: this.endatd, + endDate: this.statd, + timeType: + this.radio1 === "鍛�" + ? "day" + : this.radio1 === "鏈�" + ? "month" + : "year", + }; - // 鎸囧畾鍥捐〃鐨勯厤缃」鍜屾暟鎹� - var option = { - title: { - text: "璇婁腑缁熻", + try { + const res = await getServiceStatistics(params); + if (res.code === 200) { + this.processChartData(res.data); + } + } catch (error) { + console.error("鑾峰彇鍥捐〃鏁版嵁澶辫触:", error); + } + }, + processChartData(data) { + // 鎸夋椂闂存帓搴忕‘淇濇暟鎹『搴忔纭� + const sortedData = [...data].sort( + (a, b) => new Date(a.timePeriod) - new Date(b.timePeriod) + ); + + const xAxisData = []; + const dischargeFollowData = []; + const outpatientFollowData = []; + const pmiData = []; + const pmoData = []; + + sortedData.forEach((item) => { + // 鏍规嵁鏃堕棿绫诲瀷鏍煎紡鍖栨樉绀� + let timeLabel = item.timePeriod; + if (this.radio1 === "鍛�") { + timeLabel = dayjs(item.timePeriod).format("MM-DD"); + } else if (this.radio1 === "鏈�") { + timeLabel = item.timePeriod.split("-")[1] + "鏈�"; + } else { + timeLabel = item.timePeriod.split("-")[0] + "骞�"; + } + + xAxisData.push(timeLabel); + dischargeFollowData.push(item.dischargeFollowCount); + outpatientFollowData.push(item.outpatientFollowCount); + pmiData.push(item.pmiCount); + pmoData.push(item.pmoCount); + }); + + // 鏇存柊鍥捐〃 + this.updateChart( + xAxisData, + dischargeFollowData, + outpatientFollowData, + pmiData, + pmoData + ); + }, + updateChart( + xAxisData, + dischargeFollowData, + outpatientFollowData, + pmiData, + pmoData + ) { + if (!this.myChart2) { + this.myEcharts2(); + return; + } + + // 璁$畻闅忚閲忕殑鏈�澶у�� + const maxFollow = Math.max( + ...dischargeFollowData, + ...outpatientFollowData + ); + // 璁$畻鏈嶅姟浜烘鐨勬渶澶у�� + const maxService = Math.max(...pmiData, ...pmoData); + + // 鍔ㄦ�佽绠梚nterval鍊� + const followInterval = this.calculateOptimalInterval(maxFollow); + const serviceInterval = this.calculateOptimalInterval(maxService); + + const option = { + xAxis: { + data: xAxisData, }, + yAxis: [ + { + interval: followInterval, + max: Math.ceil(maxFollow / followInterval) * followInterval, + }, + { + interval: serviceInterval, + max: Math.ceil(maxService / serviceInterval) * serviceInterval, + }, + ], + series: [ + { data: dischargeFollowData }, + { data: outpatientFollowData }, + { data: pmiData }, + { data: pmoData }, + ], + }; + + this.myChart2.setOption(option); + }, + + // 璁$畻鏈�浼樼殑interval鍊� + calculateOptimalInterval(maxValue) { + if (maxValue <= 0) return 50; // 榛樿鍊� + + // 鏍规嵁鏈�澶у�艰绠楀悎閫傜殑闂撮殧 + const magnitude = Math.pow(10, Math.floor(Math.log10(maxValue))); + const stepRatio = maxValue / magnitude; + + let interval; + if (stepRatio > 5) { + interval = magnitude; + } else if (stepRatio > 2) { + interval = magnitude / 2; + } else { + interval = magnitude / 5; + } + + // 纭繚interval鏄暣鏁� + interval = Math.round(interval); + + // 闄愬埗鏈�灏忛棿闅� + return Math.max(interval, 50); + }, + // 鑾峰彇绾跨姸鍥炬椂闂� + async getregionAmountCollect() { + //getregionAmountCollect(1, this.endatd, this.statd); + // this.xAxis = res.data.xAxis; + // this.series = res.data.series; + this.xAxis = ["1鏈�", "2鏈�", "3鏈�", "4鏈�", "5鏈�", "6鏈�", "7鏈�", "8鏈�"]; + this.series = [123, 123, 223, 212, 432, 123, 442, 234]; + this.myEcharts2(); + }, + // 绾挎�у浘鍙婃煴鐘跺浘 + myEcharts2() { + var echarts = require("echarts"); + var myChart2 = echarts.init(document.getElementById("echars")); + this.myChart2 = myChart2; + + var option2 = { tooltip: { trigger: "axis", - }, - legend: { - data: ["闄㈠唴鎺ㄩ��", "瀹f暀瀹屾垚"], + axisPointer: { + type: "cross", + crossStyle: { + color: "#999", + }, + }, }, toolbox: { - show: true, feature: { dataView: { show: true, readOnly: false }, magicType: { show: true, type: ["line", "bar"] }, @@ -449,106 +622,131 @@ saveAsImage: { show: true }, }, }, - calculable: true, + legend: { + data: ["鍑洪櫌闅忚閲�", "闂ㄨ瘖闅忚閲�", "鍑洪櫌鏈嶅姟浜烘", "闂ㄨ瘖鏈嶅姟浜烘"], + }, xAxis: [ { type: "category", - // prettier-ignore - data: ["涓�鏈�","浜屾湀","涓夋湀","鍥涙湀","浜旀湀","鍏湀","涓冩湀","鍏湀","涔濇湀","鍗佹湀"], + data: [], // 鍒濆涓虹┖锛屽皢閫氳繃API鏁版嵁濉厖 + axisPointer: { + type: "shadow", + }, }, ], yAxis: [ { type: "value", + name: "闅忚閲�", + min: 0, + axisLabel: { + formatter: "{value} 浜�", + }, + }, + { + type: "value", + name: "鏈嶅姟浜烘", + min: 0, + axisLabel: { + formatter: "{value} 娆�", + }, }, ], + grid: { top: "35%" }, series: [ { - name: "闄㈠唴鎺ㄩ��", + name: "鍑洪櫌闅忚閲�", type: "bar", - data: [20, 49, 70, 32, 56, 76, 56, 122, 26, 20, 64, 33], - markPoint: { - data: [ - { type: "max", name: "Max" }, - { type: "min", name: "Min" }, - ], + tooltip: { + valueFormatter: function (value) { + return value + " 浜�"; + }, }, - markLine: { - data: [{ type: "average", name: "Avg" }], - }, + data: [], // 鍒濆涓虹┖锛屽皢閫氳繃API鏁版嵁濉厖 }, { - name: "瀹f暀瀹屾垚", + name: "闂ㄨ瘖闅忚閲�", type: "bar", - data: [26, 59, 90, 64, 87, 70, 75, 182, 87, 82, 60, 23], - markPoint: { - data: [ - { name: "Max", value: 182, xAxis: 7, yAxis: 183 }, - { name: "Min", value: 2.3, xAxis: 11, yAxis: 3 }, - ], + tooltip: { + valueFormatter: function (value) { + return value + " 浜�"; + }, }, - markLine: { - data: [{ type: "average", name: "Avg" }], + data: [], // 鍒濆涓虹┖锛屽皢閫氳繃API鏁版嵁濉厖 + }, + { + name: "鍑洪櫌鏈嶅姟浜烘", + type: "line", + smooth: 0.3, + yAxisIndex: 1, + tooltip: { + valueFormatter: function (value) { + return value + " 娆�"; + }, }, + data: [], // 鍒濆涓虹┖锛屽皢閫氳繃API鏁版嵁濉厖 + }, + { + name: "闂ㄨ瘖鏈嶅姟浜烘", + type: "line", + smooth: 0.3, + yAxisIndex: 1, + tooltip: { + valueFormatter: function (value) { + return value + " 娆�"; + }, + }, + data: [], // 鍒濆涓虹┖锛屽皢閫氳繃API鏁版嵁濉厖 }, ], }; - // 浣跨敤鍒氭寚瀹氱殑閰嶇疆椤瑰拰鏁版嵁鏄剧ず鍥捐〃銆� - myChart.setOption(option); + myChart2.setOption(option2); + + // 鍒濆鍔犺浇鏁版嵁 + this.getgraphdata(); }, - // 鑾峰彇绾跨姸鍥炬椂闂� - async getregionAmountCollect() { - // const res = await getregionAmountCollect(1, this.endatd, this.statd); - // this.xAxis = res.data.xAxis; - // this.series = res.data.series; - this.xAxis = ["1鏈�", "2鏈�", "3鏈�", "4鏈�", "5鏈�", "6鏈�", "7鏈�", "8鏈�"]; - this.series = [123, 123, 223, 212, 432, 123, 442, 234]; - this.myEcharts2(); - }, - // 绾挎�у浘 - myEcharts2() { + // 楗肩姸鍥� + myPieChart() { + // 鍩轰簬鍑嗗濂界殑dom锛屽垵濮嬪寲echarts瀹炰緥 var echarts = require("echarts"); - var myChart2 = echarts.init(document.getElementById("echars")); - var option2 = { - title: { - text: "璇婂墠鏁版嵁", - }, + var mypPieCharts = echarts.init(document.getElementById("pieCharts")); + this.mypPieCharts = mypPieCharts; + // 鎸囧畾鍥捐〃鐨勯厤缃」鍜屾暟鎹� + var optionPie = { + legend: {}, tooltip: { trigger: "axis", + showContent: true, }, dataset: { source: [ - ["product", "2018", "2019", "2020", "2021", "2022", "2023"], - ["澶嶈瘖", 256, 182, 388, 270, 253, 385], - ["浣忛櫌", 351, 451, 355, 353, 373, 468], - ["鎵嬫湳", 440, 362, 569, 436, 445, 332], - ["杞瘖", 525, 237, 541, 518, 433, 249], + ["product", "2012", "2013", "2014", "2015", "2016", "2017"], + ["鍑洪櫌瀹f暀", 56, 82, 88, 70, 53, 85], + ["鍦ㄩ櫌瀹f暀", 51, 51, 55, 53, 73, 68], + ["闂ㄨ瘖瀹f暀", 40, 62, 69, 36, 45, 32], ], }, xAxis: { type: "category" }, yAxis: { gridIndex: 0 }, - grid: { top: "55%" }, + grid: { top: "25%", left: "10%", right: "40%", bottom: "10%" }, series: [ { + name: "鍑洪櫌瀹f暀", type: "line", smooth: true, seriesLayoutBy: "row", emphasis: { focus: "series" }, }, { + name: "鍦ㄩ櫌瀹f暀", type: "line", smooth: true, seriesLayoutBy: "row", emphasis: { focus: "series" }, }, { - type: "line", - smooth: true, - seriesLayoutBy: "row", - emphasis: { focus: "series" }, - }, - { + name: "闂ㄨ瘖瀹f暀", type: "line", smooth: true, seriesLayoutBy: "row", @@ -557,31 +755,36 @@ { type: "pie", id: "pie", - radius: "30%", - center: ["50%", "25%"], + radius: ["40%", "70%"], + center: ["80%", "50%"], emphasis: { focus: "self", }, + itemStyle: { + borderRadius: 10, + borderColor: "#fff", + borderWidth: 2, + }, label: { - formatter: "{b}: {@2018} ({d}%)", + formatter: "{b}: {@2012}", }, encode: { itemName: "product", - value: "2018", - tooltip: "2018", + value: "2012", + tooltip: "2012", }, }, ], }; - myChart2.on("updateAxisPointer", function (event) { + mypPieCharts.on("updateAxisPointer", function (event) { const xAxisInfo = event.axesInfo[0]; if (xAxisInfo) { const dimension = xAxisInfo.value + 1; - myChart2.setOption({ + mypPieCharts.setOption({ series: { id: "pie", label: { - formatter: "{b}: {@[" + dimension + "]} ({d}%)", + formatter: "{b}: {@[" + dimension + "]} ", }, encode: { value: dimension, @@ -591,66 +794,29 @@ }); } }); - myChart2.setOption(option2); - }, - // 楗肩姸鍥� - myPieChart() { - // 鍩轰簬鍑嗗濂界殑dom锛屽垵濮嬪寲echarts瀹炰緥 - var echarts = require("echarts"); - var mypPieCharts = echarts.init(document.getElementById("pieCharts")); - - // 鎸囧畾鍥捐〃鐨勯厤缃」鍜屾暟鎹� - var optionPie = { - // title: { - // left: "left", - // }, - - tooltip: { - trigger: "item", - formatter: "{b}<br/>鎬诲崰姣� : {d}% ", - }, - toolbox: { - show: true, - feature: { - mark: { show: true }, - }, - }, - legend: { - top: "5%", - left: "center", - }, - series: [ - { - name: "Access From", - type: "pie", - radius: ["40%", "70%"], - avoidLabelOverlap: false, - itemStyle: { - borderRadius: 10, - borderColor: "#fff", - borderWidth: 2, - }, - - emphasis: { - label: { - show: true, - fontSize: 40, - fontWeight: "bold", - }, - }, - labelLine: { - show: false, - }, - data: [ - { value: 580, name: "闂ㄨ瘖闅忚" }, - { value: 484, name: "鍑洪櫌闅忚" }, - ], - }, - ], - }; // 浣跨敤鍒氭寚瀹氱殑閰嶇疆椤瑰拰鏁版嵁鏄剧ず鍥捐〃銆� mypPieCharts.setOption(optionPie); + }, + // 椤甸潰鍙樺寲璋冩暣澶у皬 + handleResize() { + console.log(111); + // 璋冩暣 ECharts 鍥捐〃澶у皬 + if (this.myChart2) { + this.myChart2.resize(); + } + if (this.mypPieCharts) { + this.mypPieCharts.resize(); + } + }, + setInterval() { + this.intervalId = setInterval(() => { + if (window.innerWidth != this.lastWidth) { + this.lastWidth = window.innerWidth; + console.log("绐楀彛澶у皬鍙兘琚墜鍔ㄨ皟鏁翠簡"); + this.handleResize(); + } + }, 1000); }, }, }; @@ -664,13 +830,10 @@ .boxEchars { width: 100%; - height: 480px; + height: 40vh; margin-top: 45px; display: flex; .echars1 { - flex: 1; - } - .echars2 { flex: 1; } } @@ -757,7 +920,7 @@ .empenty { width: 100%; padding: 20px 0; - height: 280px; + min-height: 280px; } .cooperate { width: 100%; @@ -765,7 +928,7 @@ margin-top: 25px; display: flex; .pieChart { - flex: 3; + flex: 1; } .Points { width: 154px; @@ -910,16 +1073,33 @@ .bg-purple { background: #fff; } +.bg-purples { + color: #206abe; + font-size: 18px; +} .bg-purple-light { background: #e5e9f2; text-align: center; align-items: center; line-height: 36px; + width: 6vw; +} +.subtitle { + text-align: center; + align-items: center; } .grid-content { min-height: 36px; border-radius: 20px; - padding: 0 20px; + padding: 0 10px; + text-align: center; +} + +.grid-contents { + min-height: 36px; + border-radius: 20px; + padding: 0 10px; + padding-right: 0; } .row-bg { padding: 10px 0; -- Gitblit v1.9.3