index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view class="section" v-if="data">
  5. <view>
  6. <u--text class="title" text="名称"></u--text>
  7. <view class="title">{{data.itemReadName}}</view>
  8. </view>
  9. <view class="title">
  10. <u--text class="title" text="类型"></u--text>
  11. <view class="title">{{data.alarmType}}</view>
  12. </view>
  13. <view>
  14. <u--text class="title" text="时间"></u--text>
  15. <view class="title">{{data.alarmTime}}</view>
  16. </view>
  17. <view v-if="data.itemId>0">
  18. <u--text class="title" text="报警值"></u--text>
  19. <view class="title">{{data.alarmValue}}</view>
  20. </view>
  21. <view>
  22. <u--text class="title" text="报警描述"></u--text>
  23. <view class="title">{{data.alarmText}}</view>
  24. </view>
  25. <view>
  26. <u-button type="primary" size="small" class="cl" @click="queryChart" v-if="data.itemId>0 && showbtn" >查看点位实时曲线</u-button>
  27. </view>
  28. <view v-if="showChart">
  29. <web-view :src="src" style="top:300px;width:100%;height: 500px;"></web-view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. getToken
  38. } from "@/utils/auth.js"
  39. import {
  40. getDayTime,
  41. timeToDate,
  42. nowDate
  43. } from '@/utils/date.js'
  44. export default {
  45. data() {
  46. return {
  47. src:'',
  48. dataStr: null,
  49. showChart:false,
  50. showbtn:true,
  51. data:{
  52. }
  53. }
  54. },
  55. onLoad(options) {
  56. this.dataStr = options.data
  57. this.showData()
  58. },
  59. methods: {
  60. showData(){
  61. this.data = JSON.parse(this.dataStr);
  62. console.log(this.data)
  63. },
  64. queryChart(){
  65. let idList = []
  66. idList.push(this.data.itemId)
  67. let id_List = idList.map(temp=>temp).join(',');
  68. //当前时间一分钟的实时曲线
  69. let startTime = timeToDate(new Date().getTime()-60000);
  70. let endTime = nowDate()
  71. this.src =
  72. `/static/webview/datachart-wv.html?idList=${id_List}&startTime=${startTime}&endTime=${endTime}`
  73. this.showChart = true
  74. this.showbtn = false
  75. },
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .content {
  81. padding: 25rpx;
  82. .section {
  83. position: relative;
  84. text-align: left;
  85. .title {
  86. font-size: 28rpx;
  87. margin-bottom: 20rpx;
  88. word-wrap: break-word
  89. }
  90. .time {
  91. font-size: 28rpx;
  92. color: #9fa297;
  93. }
  94. .cont {
  95. font-size:28rpx;
  96. margin-top: 60rpx;
  97. text-align: left;
  98. word-wrap: break-word
  99. }
  100. .empty {
  101. position: absolute;
  102. top: 0;
  103. right: 0;
  104. left: 0;
  105. bottom: 0;
  106. }
  107. }
  108. }
  109. </style>