horizontalDirection.vue 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <scroll-view class="scroll" v-if="list.length" :scroll-x="true">
  3. <view class="box">
  4. <view class="item" v-for="item in list" :key="item.w_dataparamid">
  5. <view class="label">
  6. {{ item.paramname }}
  7. <text v-if="item.unit">
  8. ({{ item.unit }})
  9. </text>
  10. </view>
  11. <view class="value">
  12. {{ item.lastvalue || '--' }}
  13. </view>
  14. </view>
  15. </view>
  16. </scroll-view>
  17. </template>
  18. <script>
  19. export default {
  20. props: {},
  21. name: "horizontalDirection",
  22. data() {
  23. return {
  24. list: []
  25. }
  26. },
  27. methods: {
  28. getList(w_deviceid, prodnum) {
  29. return new Promise((resolve, reject) => {
  30. let special = ["FW01", '01'].includes(prodnum)
  31. console.log("special", special)
  32. this.$Http.basic({
  33. "id": special ? 20230628084901 : 20230711165702,
  34. "content": {
  35. w_deviceid
  36. }
  37. }).then(res => {
  38. console.log("设备实时数据查询", res)
  39. if (this.cutoff(res.msg)) return resolve(0)
  40. if (special) {
  41. if (["FW01", '01'].includes(prodnum)) {
  42. const params = res.data.params,
  43. list = [];
  44. params.OpenDeg && list.push(params.OpenDeg)
  45. params.Voltage && list.push(params.Voltage)
  46. params.Longitude && list.push(params.Longitude)
  47. params.Latitude && list.push(params.Latitude)
  48. this.list = list;
  49. }
  50. } else {
  51. this.list = res.data;
  52. }
  53. resolve(this.list.length ? 49 : 0)
  54. })
  55. })
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .scroll {
  62. width: 355px;
  63. background: #FFFFFF;
  64. border-radius: 4px;
  65. margin: 15px auto 0;
  66. height: 62px;
  67. box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px;
  68. .box {
  69. display: flex;
  70. flex-wrap: nowrap;
  71. align-items: center;
  72. padding: 12px;
  73. box-sizing: border-box;
  74. .item {
  75. flex-shrink: 0;
  76. padding-right: 15px;
  77. .label {
  78. line-height: 14px;
  79. font-size: 10px;
  80. color: #666666;
  81. }
  82. .value {
  83. margin-top: 5px;
  84. line-height: 20px;
  85. font-size: 14px;
  86. font-family: PingFang SC-Bold, PingFang SC;
  87. font-weight: bold;
  88. color: #333333;
  89. }
  90. }
  91. }
  92. }
  93. </style>