From c1eeb38a93a8ec768bc1e42db8c710a359663da2 Mon Sep 17 00:00:00 2001 From: "453530270@qq.com" Date: Sat, 29 Jul 2023 13:24:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=96=E6=95=B0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/home.js | 11 ++++ src/views/cultrue/index.vue | 109 ++++++++++++++++++------------------ 2 files changed, 64 insertions(+), 56 deletions(-) diff --git a/src/api/home.js b/src/api/home.js index 4e5e0d4..67063e1 100644 --- a/src/api/home.js +++ b/src/api/home.js @@ -12,6 +12,8 @@ const api={ zonglan_data:'/pass.passcc/allGroupNum', // 借阅办证的信息 librurl:'/library.pass/getLibraryService', + // 图书馆客流趋势 + libtrends:'/library.pass/allFlowTrends', getID:'/pass.passcc/getGroupData' } @@ -106,6 +108,15 @@ export function libbrow(params) { }) } +//图书馆客流 +export function libflow(params) { + return request({ + url: api.libtrends, + method: 'get', + params, + }) +} + export function getID(param) { return request({ url: api.getID, diff --git a/src/views/cultrue/index.vue b/src/views/cultrue/index.vue index 65f34e6..b65cbc3 100644 --- a/src/views/cultrue/index.vue +++ b/src/views/cultrue/index.vue @@ -94,12 +94,14 @@ export default { todayNum: 0, monthNum: 0, yearNum: 0, + //24h data + whdata:[], // 博物馆 - bwg_num:1000, - // - whg_num:5160, - // - tsg_num:8662, + bwg_num:0, + // 文化馆 + whg_num:0, + // 图书馆 + tsg_num:0, data24h: [], data24hX: [], // 趋势图 @@ -120,20 +122,20 @@ export default { } }, 200); // 博物馆人数 - this.bwugrs(); + // this.bwugrs(); this.gethomeBarData();//24小时服务人次 this.getData24h();//24小时总服务 this.getGcgNumDatas();//人次趋势 this.cultrue_bar3(); - this.addNumber(0, this.todayNum, 'insv') - this.addNumber(0, this.monthNum, 'insv2') - this.addNumber(0, this.yearNum, 'insv3') + // this.addNumber(0, this.todayNum, 'insv') + // this.addNumber(0, this.monthNum, 'insv2') + // this.addNumber(0, this.yearNum, 'insv3') // // this.addNumber(0, this.bwg_num, 'cmdval1') // this.addNumber(0, this.whg_num, 'cmdval2') // this.addNumber(0, this.tsg_num, 'cmdval3') - this.getTsgInfoDatas() + // this.getTsgInfoDatas() // var name = ['图书馆', '文化馆', '博物馆'] setTimeout(() => { this.cultrue_bar1();//24小时总服务 @@ -825,38 +827,50 @@ export default { } }, + // 三馆信息统计 + // sgstat(){ + // homeApi.libflow().then(res=>{ + // // + // const bwgdata = res.data.data + // this.todayNum = bwgdata.today.incount + // console.log(res) + // }); + // }, + // 博物馆 - bwugrs(){ - homeApi.allTygGroupTimeNum({granularity:"daily",groupsId:"510"}).then(res=>{ - let bwgrs = res.data.data.groupsData - // this.bwg_num = bwgrs[0].noRepeatInNum - }); - }, + // bwugrs(){ + // homeApi.allTygGroupTimeNum({granularity:"daily",groupsId:"510"}).then(res=>{ + // let bwgrs = res.data.data.groupsData + // // this.bwg_num = bwgrs[0].noRepeatInNum + // }); + // }, // 24小时服务人次 gethomeBarData(){ let that = this; - homeApi.getID().then(res=>{ - // console.log(res, '====='); - let idArr = ""; - res.data.data.map(item=>{ - if(item.type==2){ - idArr += "|"+item.groupId; - } + homeApi.libflow().then(res=>{ + const rtdata = res.data.data + // + that.todayNum = rtdata.today.incount + that.monthNum = rtdata.month.incount + that.yearNum = rtdata.year.incount + // 24小时的数据 + const hour24 = rtdata.hour24 + hour24.forEach(function(item){ + that.whdata.push({ + gname: item.groupName, + gval: item.incount + }) }) - homeApi.homeBarData({groupsId:idArr}).then(res=>{ - let groupsData = []; - res.data.data.groupsData.forEach(item=>{ - groupsData.push(item); - }); - // todayNum: 0, - // monthNum: 0, - // yearNum: 0, - that.bwg_num = groupsData[0].noRepeatInNum; - that.whg_num = groupsData[1].noRepeatInNum; - that.tsg_num = groupsData[2]?that.groupsData[2].noRepeatInNum:''; - }); - }); + // bind data + that.tsg_num = that.whdata[0].gval + that.bwg_num = that.whdata[1].gval + that.whg_num = that.whdata[2].gval + // + // that.todayNum = + + }) + }, // 图书馆 getTsgInfoDatas() { @@ -866,9 +880,9 @@ export default { const tmpdata = res.data.data // console.log(tmpdata); // console.log(typeof(tmpdata.today.incount)); - this.todayNum = this.toLocaleString(tmpdata.today.incount) - this.monthNum = this.toLocaleString(tmpdata.month.incount) - this.yearNum = this.toLocaleString(tmpdata.year.incount) + // this.todayNum = this.toLocaleString(tmpdata.today.incount) + // this.monthNum = this.toLocaleString(tmpdata.month.incount) + // this.yearNum = this.toLocaleString(tmpdata.year.incount) // console.log(this.todayNum, this.monthNum, this.yearNum); // this.day_num = tmpdata.day.noRepeatInNum @@ -901,24 +915,7 @@ export default { // 返回这个字符串 return str }, - // 不知道是什么 - getAAAA(){ - let that = this; - homeApi.getID().then(res=>{ - // console.log(res, '====='); - let id = res.data.data[1].groupId; - homeApi.homeBarData({groupsId:id}).then(res=>{ - // console.log(res.data.data, '=====') - const tmpdata = res.data.data.allTimeData; - let datas = [] - Object.values(tmpdata).forEach((value) => { - datas.push(value.num) - }); - }); - }); - - }, // 24小时趋势 getData24h(){ let that = this;