From 75009b9bb017e17d4cc20f4df57c0aeef7e494d8 Mon Sep 17 00:00:00 2001 From: liuning <807852472@qq.com> Date: Thu, 12 Mar 2026 19:48:10 +0800 Subject: [PATCH] =?UTF-8?q?=C2=96=E9=A6=96=E9=A1=B5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=A2=84=E8=AD=A6=E4=BF=A1=E6=81=AF=E3=80=81=E6=AF=8F=E6=97=A5?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=8D=A0=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/basics/home.vue | 223 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 218 insertions(+), 5 deletions(-) diff --git a/pages/basics/home.vue b/pages/basics/home.vue index 6dd344d..fc9bef9 100644 --- a/pages/basics/home.vue +++ b/pages/basics/home.vue @@ -64,6 +64,40 @@ + + + + ⚠️ + 预警信息 + + + + 🔔 + {{warningInfo.today_warning || 0}} + 今日预警数 + + + 📋 + {{warningInfo.history_warning || 0}} + 历史预警数 + + + + {{warningInfo.handled_warning || 0}} + 已处理预警数 + + + + + + 📊 + 每日类型占比 + + + + + + @@ -76,6 +110,7 @@ var _self; var canvaLineA=null; var canvaColumn=null; + var canvaPie=null; export default { data() { return { @@ -93,8 +128,10 @@ phone: '', hospitalBasisInfo: [], stockBasisInfo: [], + warningInfo: [], imgSrc: '', - imgSrc2: '' + imgSrc2: '', + imgSrc3: '' } }, mounted() { @@ -128,12 +165,14 @@ this.getHospitalBasisInfo(); this.getStockBasisInfo(); this.getDepartmentRankList(); + this.getWarningInfo(); + this.getDailyTypeRatio(); }, methods: { getServerData(){ let that = this; uni.request({ - url: 'https://lekapi.opmonitor.com/?c=app_api&a=getMedicalData7Days', + url: 'https://mtx.mini.opmonitor.com/?c=app_api&a=getMedicalData7Days', data:{ hospital: that.hospital, sortHospital: that.sortHospital, @@ -232,7 +271,7 @@ getHospitalBasisInfo(){ let that = this; uni.request({ - url: 'https://lekapi.opmonitor.com/?c=app_api&a=getHospitalBasisInfo', + url: 'https://mtx.mini.opmonitor.com/?c=app_api&a=getHospitalBasisInfo', data: {hospital: that.hospital,sortHospital: that.sortHospital,department: that.department,duty: that.duty}, header: { 'Content-type': 'application/json' @@ -249,7 +288,7 @@ getStockBasisInfo(){ let that = this; uni.request({ - url: 'https://lekapi.opmonitor.com/?c=app_api&a=getStockBasisInfo', + url: 'https://mtx.mini.opmonitor.com/?c=app_api&a=getStockBasisInfo', data: {hospital: that.hospital, sortHospital: that.sortHospital, department: that.department, duty: that.duty}, header: { 'Content-type': 'application/json' @@ -266,7 +305,7 @@ getDepartmentRankList(){ let that = this; uni.request({ - url: "https://lekapi.opmonitor.com/?c=app_api&a=getDepartmentRankList", + url: "https://mtx.mini.opmonitor.com/?c=app_api&a=getDepartmentRankList", data:{ hospital: that.hospital, sortHospital: that.sortHospital, @@ -368,6 +407,104 @@ uni.navigateTo({ url: "/pages/main/inventory_month" }) + }, + // 获取预警信息 + getWarningInfo(){ + let that = this; + uni.request({ + url: 'https://mtx.mini.opmonitor.com/?c=app_api&a=getWarningInfo', + data: {hospital: that.hospital, sortHospital: that.sortHospital, department: that.department, duty: that.duty}, + header: { + 'Content-type': 'application/json' + }, + success: function(res){ + that.warningInfo = res.data.data || {} + }, + fail: () => { + console.info('获取预警信息失败') + } + }) + }, + // 获取每日类型占比 + getDailyTypeRatio(){ + let that = this; + uni.request({ + url: 'https://mtx.mini.opmonitor.com/?c=app_api&a=getDailyTypeRatio', + data: {hospital: that.hospital, sortHospital: that.sortHospital, department: that.department, duty: that.duty}, + header: { + 'Content-type': 'application/json' + }, + success: function(res) { + let Pie={series:[]}; + Pie.series=res.data.data.series; + _self.showPie("canvasPie",Pie); + }, + fail: () => { + _self.tips="网络错误,小程序端请检查合法域名"; + } + }) + }, + showPie(canvasId,chartData){ + canvaPie=new uCharts({ + $this:_self, + canvasId: canvasId, + type: 'pie', + colors:['#4a90e2', '#1abc9c', '#e67e22', '#9b59b6', '#e74c3c'], + fontSize:11, + padding:[15,15,0,15], + legend:{ + show:true, + padding:5, + lineHeight:11, + margin:0, + position:'bottom', + float:'center' + }, + dataLabel:true, + background:'#FFFFFF', + pixelRatio:_self.pixelRatio, + series: chartData.series, + animation: true, + width: _self.cWidth*_self.pixelRatio, + height: _self.cHeight*_self.pixelRatio, + extra: { + pie:{ + activeOpacity: 0.5, + activeRadius: 10, + offsetAngle: 0, + labelWidth: 15, + ringWidth: 0, + border: true, + borderWidth: 2, + borderColor: '#FFFFFF' + } + } + }); + canvaPie.addEventListener('renderComplete', () => { + setTimeout(function(){ + uni.canvasToTempFilePath({ + x: 0, + y: 0, + width: _self.cWidth*_self.pixelRatio, + height: _self.cHeight*_self.pixelRatio, + fileType: 'png', + canvasId: 'canvasPie', + success: function(res) { + _self.imgSrc3=res.tempFilePath; + }, + fail:function(res){ + console.info(res) + } + },_self); + },50); + }) + }, + touchPie(e) { + canvaPie.showToolTip(e, { + format: function (item, category) { + return item.name + ':' + item.data + 'kg' + } + }); } } } @@ -559,4 +696,80 @@ background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); box-shadow: 0 6rpx 24rpx rgba(231, 76, 60, 0.35); } + + /* 预警统计容器 */ + .warning-stats { + display: flex; + justify-content: space-around; + padding: 30rpx 20rpx; + margin: 20rpx; + background: rgba(255, 255, 255, 0.95); + border-radius: 24rpx; + box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.12); + backdrop-filter: blur(10rpx); + border: 1px solid rgba(255, 255, 255, 0.6); + } + + /* 预警卡片 */ + .warning-card { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 20rpx 16rpx; + border-radius: 20rpx; + width: 180rpx; + position: relative; + overflow: hidden; + transition: all 0.3s ease; + } + + .warning-card::before { + content: ''; + position: absolute; + top: -50%; + right: -50%; + width: 100%; + height: 100%; + background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%); + border-radius: 50%; + } + + .warning-icon { + font-size: 40rpx; + margin-bottom: 8rpx; + filter: drop-shadow(0 2rpx 8rpx rgba(0, 0, 0, 0.15)); + } + + .warning-value { + font-size: 44rpx; + font-weight: 800; + color: #fff; + margin-bottom: 4rpx; + text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2); + } + + .warning-label { + font-size: 22rpx; + color: rgba(255, 255, 255, 0.85); + font-weight: 500; + } + + /* 今日预警 - 黄色 */ + .warning-today { + background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%); + box-shadow: 0 6rpx 24rpx rgba(243, 156, 18, 0.35); + } + + /* 历史预警 - 橙色 */ + .warning-history { + background: linear-gradient(135deg, #e67e22 0%, #d35400 100%); + box-shadow: 0 6rpx 24rpx rgba(230, 126, 34, 0.35); + } + + /* 已处理预警 - 绿色 */ + .warning-handled { + background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%); + box-shadow: 0 6rpx 24rpx rgba(39, 174, 96, 0.35); + }