horizontalDirection.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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', 'MT03'].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. const params = res.data.params,
  42. list = [];
  43. if (["FW01", '01'].includes(prodnum)) {
  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. } else if (["MT03"].includes(prodnum)) {
  50. this.list = ["阀前压力", "阀后压力", "累计流量", "阀前压力采集", "阀后压力采集", "流量采集", "瞬时流量", '阀门开度'].map(v => params[v])
  51. }
  52. } else {
  53. this.list = res.data;
  54. }
  55. resolve(this.list.length ? 49 : 0)
  56. })
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .scroll {
  64. width: 355px;
  65. background: #FFFFFF;
  66. border-radius: 4px;
  67. margin: 15px auto 0;
  68. height: 62px;
  69. box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px;
  70. .box {
  71. display: flex;
  72. flex-wrap: nowrap;
  73. align-items: center;
  74. padding: 12px;
  75. box-sizing: border-box;
  76. .item {
  77. flex-shrink: 0;
  78. padding-right: 15px;
  79. .label {
  80. line-height: 14px;
  81. font-size: 10px;
  82. color: #666666;
  83. }
  84. .value {
  85. margin-top: 5px;
  86. line-height: 20px;
  87. font-size: 14px;
  88. font-family: PingFang SC-Bold, PingFang SC;
  89. font-weight: bold;
  90. color: #333333;
  91. }
  92. }
  93. }
  94. }
  95. </style>