From 2af3829f6276675ebe120cda94d628c49c429536 Mon Sep 17 00:00:00 2001 From: whycq <you@example.com> Date: 星期六, 19 十一月 2022 23:02:49 +0800 Subject: [PATCH] # --- Monitor-APP/pages/home/home.vue | 247 +++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 215 insertions(+), 32 deletions(-) diff --git a/Monitor-APP/pages/home/home.vue b/Monitor-APP/pages/home/home.vue index a81bb72..e8041d0 100644 --- a/Monitor-APP/pages/home/home.vue +++ b/Monitor-APP/pages/home/home.vue @@ -1,6 +1,6 @@ <template> <view class="container"> - <!-- 涓昏鍥� --> + <uni-transition :duration="duration" :mode-class="homeMode" :show="homeViewShow"> <view class="home-view"> <view class="head"> @@ -10,7 +10,7 @@ <view class="time-tools">{{calendar}}</view> <view class="button-left" @click="ejected()"></view> <view class="button-right" @click="ejected()"></view> - <!-- 涓讳綋 --> + <!-- 涓昏鍥� --> <view class="main"> <view class="mian-item"> <view class="mian-item-box"> @@ -195,22 +195,23 @@ </view> </view> </view> + </view> </uni-transition> <!-- 鍏ㄦ澘/鎷f枡淇℃伅 --> <uni-transition :duration="duration" :mode-class="infoMode" :show="infoViewShow"> - <view class="info-view"> + <view class="home-view"> <view class="head"> - <text>鎷� 鏂�</text> + <text>鍏ㄦ澘 / 鎷f枡</text> </view> <!-- 鏃ュ巻 --> <view class="time-tools">{{calendar}}</view> - <view class="button-left"></view> - <view class="button-right"></view> + <view class="button-left" @click="ejected()"></view> + <view class="button-right" @click="ejected()"></view> <!-- 涓讳綋 --> - <view class="info-main" > + <view class="info-main"> <view class="info-box"> - <y-box></y-box> + <y-box>{{text}}</y-box> </view> </view> </view> @@ -228,7 +229,7 @@ <!-- 涓讳綋 --> <view class="info-main" > <view class="info-box"> - <y-box></y-box> + <y-box>{{text1}}</y-box> </view> </view> </view> @@ -278,6 +279,7 @@ <script> import demodata from '@/mockdata/demodata.json'; + import ycqdata from '@/pages/index/data.json'; export default { data() { return { @@ -320,6 +322,14 @@ basePort: '', baseLedId: '', baseCrnId: '', + info: null, + error: null, + infoType: 0, + text: '', + text1: '', + + + } }, @@ -334,11 +344,13 @@ this.getDate() setInterval(()=>{ this.getDate() - + this.getInfo() + this.getError() + this.controller() },1000) setInterval(()=>{ // this.controller() - },5000) + },2000) }, methods: { getUrl() { @@ -348,30 +360,131 @@ this.chartsDataLine1=JSON.parse(JSON.stringify(demodata.Line)) this.chartsDataPie2=JSON.parse(JSON.stringify(demodata.PieA)) }, + getInfo() { + let that = this + uni.request({ + url: "http://192.168.1.111:8088/sxjzwms/system/error", + method:"GET", + success(result) { + var res = result.data + if (res.data && res.data !== "") { + if (that.infoType == 2 || that.infoType == 3) { + return; + } + that.infoType = 1 + that.text = res + } else { + if (that.infoType == 2 || that.infoType == 3) { + return; + } + that.infoType = 0 + } + } + }) + + }, + getError() { + let that = this + uni.request({ + url:"http://192.168.1.111:8088/sxjzwms/mat/info", + method:"GET", + success(result) { + var res = result.data + if (res.data && res.data !== "") { + if (that.infoType == 1) { + that.infoType = 3 + that.text1 = res + return + } + that.infoType = 2 + that.text1 = res + } else { + if (that.infoType == 1) { + return + } + that.infoType = 0 + } + } + }) + + }, // 鎺у埗鍣� controller() { - if (this.homeViewShow) { - this.homeViewShow = !this.homeViewShow - this.homeMode = ['fade', 'slide-bottom'] - setTimeout(()=>{ - this.infoViewShow = !this.infoViewShow - this.infoMode = ['fade', 'slide-bottom'] - },1100) - } else if(this.infoViewShow) { - this.infoViewShow = !this.infoViewShow - this.infoMode = ['fade', 'slide-bottom'] - setTimeout(()=>{ - this.errorInfoViewShow = !this.errorInfoViewShow - this.errorInfoMode = ['fade', 'slide-bottom'] - },1100) - } else { - this.errorInfoViewShow = !this.errorInfoViewShow - this.errorInfoMode = ['fade', 'slide-bottom'] - setTimeout(()=>{ - this.homeViewShow = !this.homeViewShow - this.homeMode = ['fade', 'slide-bottom'] - },1100) + switch(this.infoType) { + // 鏈変俊鎭� 浣� 娌℃湁閿欒淇℃伅 + case 1: + if (this.homeViewShow) { + this.homeViewShow = false + this.homeMode = ['fade', 'slide-bottom'] + setTimeout(()=>{ + this.infoViewShow = true + this.infoMode = ['fade', 'slide-bottom'] + },1000) + } else if (this.errorInfoViewShow) { + this.errorInfoViewShow = false + this.errorInfoMode = ['fade', 'slide-bottom'] + setTimeout(()=>{ + this.infoViewShow = true + this.infoMode = ['fade', 'slide-bottom'] + },1000) + } + + return; + // 鏈変俊鎭� 涓� 鏈夐敊璇俊鎭� + case 2: + if (this.homeViewShow) { + this.homeViewShow = false + this.homeMode = ['fade', 'slide-bottom'] + setTimeout(()=>{ + this.errorInfoViewShow = true + this.errorInfoMode = ['fade', 'slide-bottom'] + },1000) + } else if (this.infoViewShow) { + this.infoViewShow = false + this.infoMode = ['fade', 'slide-bottom'] + setTimeout(()=>{ + this.errorInfoViewShow = true + this.errorInfoMode = ['fade', 'slide-bottom'] + },1000) + } + return; + // 鏈変俊鎭� 涓� 鏈夐敊璇俊鎭� + case 3: + if (this.homeViewShow) { + this.homeViewShow = false + this.homeMode = ['fade', 'slide-bottom'] + setTimeout(()=>{ + this.errorInfoViewShow = true + this.errorInfoMode = ['fade', 'slide-bottom'] + },1000) + } else if (this.infoViewShow) { + this.infoViewShow = false + this.infoMode = ['fade', 'slide-bottom'] + setTimeout(()=>{ + this.errorInfoViewShow = true + this.errorInfoMode = ['fade', 'slide-bottom'] + },1000) + } + return; + default : + if (this.errorInfoViewShow) { + this.errorInfoViewShow = false + this.errorInfoMode = ['fade', 'slide-bottom'] + setTimeout(()=>{ + this.homeViewShow = true + this.homeMode = ['fade', 'slide-bottom'] + },1000) + } else if (this.infoViewShow) { + this.infoViewShow = false + this.infoMode = ['fade', 'slide-bottom'] + setTimeout(()=>{ + this.homeViewShow = true + this.homeMode = ['fade', 'slide-bottom'] + },1000) + } + return; } + }, // 涓诲睆骞� handle(type) { @@ -427,6 +540,76 @@ } this.calendar = year + "骞�" + month + "鏈�" + day + "鏃� " + hours + ":" + minutes + ":" + seconds + " " + weeks }, + getDateFormat(value) { + var date = new Date();// 鑾峰彇褰撳墠鏃堕棿 + date.setDate(date.getDate() + value);// 璁剧疆澶╂暟 -1 澶� + var m = date.getMonth() + 1 + var d = date.getDate() + var newDate = m + '-' + d + return newDate + }, + /*************** 鎶樼嚎鍥� *****************************************************************************************************/ + initlineChart() { + let that = this + uni.request({ + url: that.commonUrl + "/monitor/line/charts", + method:'GET', + success(result) { + var res = result.data + if (res.code === 200) { + that.chartsData.Line.categories = [ + that.getDateFormat(-11),that.getDateFormat(-10),that.getDateFormat(-9),that.getDateFormat(-8), + that.getDateFormat(-7),that.getDateFormat(-6),that.getDateFormat(-5),that.getDateFormat(-4), + that.getDateFormat(-3),that.getDateFormat(-2),that.getDateFormat(-1),that.getDateFormat(0),] + that.chartsData.Line.series = res.data.rows + } + } + }) + }, + /*************** 楗煎浘 *****************************************************************************************************/ + initPieChart() { + let that = this + uni.request({ + url: that.commonUrl + "/monitor/loc/rep", + method:'GET', + success(result) { + var res = result.data + if (res.code === 200) { + that.chartsData.Pie.series[0].data = res.data.pie + that.stockCount = res.data.stockCunt + that.emptyCount = res.data.emptyCount + that.noneCount = res.data.noneCount + that.used = res.data.used + that.usedPr = res.data.usedPr + } + } + }) + }, + getOther() { + let that = this + uni.request({ + // http://10.10.0.222:9090/jkwcs/monitor/led?ledId=186 + url: that.commonUrl + "/monitor/other", + data: { + crnId: that.baseCrnId, + ledId: 1, + }, + success(result) { + console.log(result); + var res = result.data + if (res.code === 200) { + that.xDistance = res.data.xDistance + that.yDistance = res.data.yDistance + that.xDuration = res.data.xDuration + that.yDuration = res.data.yDuration + } else if (res.code === 403) { + + } else { + + } + } + }) + }, } } -- Gitblit v1.9.1