@@ -7,6 +7,8 @@ import { getCardDevice, getDabDevice, getDevice } from '@/api/Device/index.js'
77import Instruct from '@/views/DeviceCloud/category/instruct_manage'
88import { queryView } from '@/api/View'
99import runningState from '@/views/DeviceCloud/manage/component/Device/runningState'
10+ import { getProduct } from '../../../../api/Product'
11+
1012const columns = [
1113 {
1214 title : '图片' ,
@@ -238,7 +240,7 @@ export default {
238240 number : 1 ,
239241 interval : 'h' ,
240242 datetimerange : '' ,
241- keys : '*' ,
243+ keys : [ ] ,
242244 limit : 100 ,
243245 endTime : new Date ( ) . getTime ( ) ,
244246 startTime : new Date ( ) . getTime ( ) - 3600 * 1000 * 24 * 7 ,
@@ -392,6 +394,7 @@ export default {
392394 dirlength : 20 ,
393395 selectproduct : '' ,
394396 watchNum : 0 ,
397+ wmxkeys : [ ] ,
395398 chartType : [
396399 { type : 'line' , name : '折线图' } ,
397400 { type : 'histogram' , name : '柱状图' } ,
@@ -431,6 +434,7 @@ export default {
431434 mounted ( ) {
432435 // this.deviceInfo.product.objectId = this.$route.query.productid
433436 this . getDeviceInfo ( this . $route . query . deviceid )
437+ this . getwmxkey ( )
434438 this . setTreeFlag ( false )
435439 this . params . style = this . chartType [ 0 ] . type
436440 console . log ( ' this.params.style' , this . params . style )
@@ -453,6 +457,28 @@ export default {
453457 this . Unbscribe ( )
454458 } ,
455459 methods : {
460+ async getwmxkey ( ) {
461+ const productdetail = await getProduct ( this . $route . query . productid )
462+ let wmxList = productdetail . thing ?. properties || [ ]
463+ let options = [ ]
464+ if ( wmxList . length > 0 ) {
465+ wmxList . forEach ( ( item ) => {
466+ if ( item . isshow == true ) {
467+ let o = {
468+ label : item . name ,
469+ value : item . identifier ,
470+ }
471+ options . push ( o )
472+ }
473+ } )
474+ this . params . keys = [ wmxList [ 0 ] . identifier ]
475+ }
476+ options . unshift ( {
477+ label : '全选' ,
478+ value : '*' ,
479+ } )
480+ this . wmxkeys = options
481+ } ,
456482 /**
457483 * @Author : dext7r
458484 * @Date : 2021-12-24 12:13:39
@@ -740,11 +766,19 @@ export default {
740766 startTime,
741767 endTime,
742768 } = this . params
769+ let newkeys = 'not'
770+ if ( keys . length > 0 ) {
771+ newkeys = keys . join ( ',' )
772+ }
773+ if ( newkeys . indexOf ( '*' ) != - 1 ) {
774+ newkeys = '*'
775+ }
776+ this . params . keys = [ '*' ]
743777 let params = {
744778 starttime : moment ( startTime ) . valueOf ( ) ,
745779 endtime : moment ( endTime ) . valueOf ( ) ,
746780 interval : number + interval ,
747- keys : keys ,
781+ keys : newkeys ,
748782 limit : limit ,
749783 function : _function ,
750784 style : style ,
0 commit comments