mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 00:45:55 +08:00
1 line
4.8 KiB
JavaScript
1 line
4.8 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-09798080"],{"01ca":function(t,e,i){"use strict";i.d(e,"f",(function(){return a})),i.d(e,"d",(function(){return r})),i.d(e,"a",(function(){return o})),i.d(e,"e",(function(){return s})),i.d(e,"g",(function(){return c})),i.d(e,"c",(function(){return d})),i.d(e,"b",(function(){return l}));var n=i("b775");function a(t){return Object(n["a"])({url:"/iot/model/list",method:"get",params:t})}function r(t){return Object(n["a"])({url:"/iot/model/"+t,method:"get"})}function o(t){return Object(n["a"])({url:"/iot/model",method:"post",data:t})}function s(t){return Object(n["a"])({url:"/iot/model/import",method:"post",data:t})}function c(t){return Object(n["a"])({url:"/iot/model",method:"put",data:t})}function d(t){return Object(n["a"])({url:"/iot/model/"+t,method:"delete"})}function l(t){return Object(n["a"])({url:"/iot/model/cache/"+t,method:"get"})}},a035:function(t,e,i){"use strict";i.d(e,"a",(function(){return a})),i.d(e,"b",(function(){return r}));var n=i("b775");function a(t){return Object(n["a"])({url:"/iot/deviceLog/list",method:"get",params:t})}function r(t){return Object(n["a"])({url:"/iot/deviceLog/monitor",method:"get",params:t})}},f14e:function(t,e,i){"use strict";i.r(e);var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticStyle:{"padding-left":"20px"}},[i("el-row",[i("el-col",{attrs:{span:24}},[i("el-form",{ref:"queryForm",attrs:{model:t.queryParams,inline:!0,"label-width":"75px"}},[i("el-form-item",{attrs:{label:"时间范围"}},[i("el-date-picker",{staticStyle:{width:"240px"},attrs:{size:"small","value-format":"yyyy-MM-dd",type:"daterange","range-separator":"-","start-placeholder":"开始日期","end-placeholder":"结束日期"},model:{value:t.daterangeTime,callback:function(e){t.daterangeTime=e},expression:"daterangeTime"}})],1),i("el-form-item",{attrs:{label:"最大数量"}},[i("el-input",{model:{value:t.queryParams.total,callback:function(e){t.$set(t.queryParams,"total",e)},expression:"queryParams.total"}})],1),i("el-form-item",[i("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:"mini"},on:{click:t.getStatisticData}},[t._v("查询")])],1)],1)],1),i("el-col",{attrs:{span:23}},t._l(t.monitorThings,(function(e,n){return i("div",{key:n,staticStyle:{"margin-bottom":"30px"}},[i("el-card",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],attrs:{shadow:"hover","body-style":{padding:"10px 0px",overflow:"auto"}}},[i("div",{ref:"statisticMap",refInFor:!0,staticStyle:{height:"300px",width:"1080px"}})])],1)})),0)],1)],1)},a=[],r=(i("4de4"),i("d3b7"),i("b0c0"),i("313e")),o=i("01ca"),s=i("a035"),c={name:"device-statistic",props:{device:{type:Object,default:null}},watch:{device:function(t,e){this.deviceInfo=t,this.deviceInfo&&0!=this.deviceInfo.deviceId&&this.getCacheThingsModdel(this.deviceInfo.productId)}},data:function(){return{loading:!1,deviceInfo:{},monitorThings:[],chart:[],daterangeTime:[],queryParams:{deviceId:0,identity:"",total:1e3}}},mounted:function(){},methods:{getCacheThingsModdel:function(t){var e=this;Object(o["b"])(t).then((function(t){var i=JSON.parse(t.data);e.monitorThings=i.properties.filter((function(t){return 1==t.isMonitor})),e.$nextTick((function(){this.getStatistic(),this.getStatisticData(this.monitorThings)}))}))},getStatisticData:function(){var t=this;this.loading=!0;for(var e=function(e){t.queryParams.deviceId=t.deviceInfo.deviceId,t.queryParams.identity=t.monitorThings[e].id,null!=t.daterangeTime&&""!=t.daterangeTime&&(t.queryParams.beginTime=t.daterangeTime[0],t.queryParams.endTime=t.daterangeTime[1]+" 23:59"),Object(s["b"])(t.queryParams).then((function(i){for(var n=i.rows,a=[],r=0;r<n.length;r++){var o=[];o[0]=n[r].time,o[1]=n[r].value,a.push(o)}t.chart[e].setOption({series:[{data:a}]}),t.loading=!1}))},i=0;i<this.monitorThings.length;i++)e(i)},getStatistic:function(){for(var t=["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],e=0;e<this.monitorThings.length;e++){var i;this.$refs.statisticMap[e].style.width=document.documentElement.clientWidth-510+"px",console.log(this.$refs.statisticMap[e]),this.chart[e]=r["init"](this.$refs.statisticMap[e]),i={animationDurationUpdate:3e3,tooltip:{trigger:"axis"},title:{left:"center",text:this.monitorThings[e].name+"统计 (单位 "+(void 0!=this.monitorThings[e].datatype.unit?this.monitorThings[e].datatype.unit:"无")+")"},grid:{top:"80px",left:"40px",right:"20px",bottom:"60px",containLabel:!0},toolbox:{feature:{dataZoom:{yAxisIndex:"none"},restore:{},saveAsImage:{}}},xAxis:{type:"time"},yAxis:{type:"value"},dataZoom:[{type:"inside",start:0,end:100},{start:0,end:100}],series:[{name:this.monitorThings[e].name,type:"line",symbol:"none",sampling:"lttb",itemStyle:{color:e>9?t[0]:t[e]},areaStyle:{},data:[]}]},i&&this.chart[e].setOption(i)}}}},d=c,l=i("2877"),u=Object(l["a"])(d,n,a,!1,null,null,null);e["default"]=u.exports}}]); |