division.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="control">
  3. <view class="control-title">
  4. 分时控制
  5. </view>
  6. <view class="update-line">
  7. <view class="label">
  8. {{ timeControl.funcname }}
  9. </view>
  10. <view class="content">
  11. {{ timeControl.showValue }}
  12. <view class="control-updata-but" hover-class="navigator-hover" @click="onClick(timeControl)">{{
  13. timeControl.isfeedback ? '待更新' : '更新' }}</view>
  14. </view>
  15. </view>
  16. <view class="row" hover-class="navigator-hover" v-for="item in list" :key="item.key" @click="onClick(item)">
  17. <view class="box">
  18. <view class="label">第{{ item.index }}时段时间</view>
  19. <view class="content">
  20. <view class="value">{{ item.params["T" + item.index + "_T"].lastvalue || '--' }}</view>
  21. </view>
  22. </view>
  23. <view class="box">
  24. <view class="label">第{{ item.index }}时段压力</view>
  25. <view class="content">
  26. <view class="value">{{ item.params["T" + item.index + "_P"].lastvalue || '--' }}</view>
  27. <view class="unit">{{ item.params["T" + item.index + "_P"].unit || '' }}</view>
  28. </view>
  29. </view>
  30. <view v-if="item.isfeedback" class="dot" />
  31. </view>
  32. <My_input ref="MyInput" />
  33. </view>
  34. </template>
  35. <script>
  36. let model = null;
  37. export default {
  38. name: "division",
  39. data() {
  40. return {
  41. list: [],
  42. timeControl: {}
  43. }
  44. },
  45. methods: {
  46. loadData(funs, values, paramsList, isfeedback) {
  47. model = this.$refs.MyInput;
  48. let reg = /^T\d{1,5}_P$/,
  49. count = 0,
  50. list = [];
  51. for (const key in values) {
  52. if (reg.test(key)) count++
  53. }
  54. for (let i = 1; i <= count; i++) {
  55. let obj = funs[`T${i}`];
  56. let item = {
  57. key: `T${i}_`,
  58. index: i,
  59. inputType: "dayParting",
  60. paramValue: {
  61. time: values[`T${i}_T`],
  62. value: values[`T${i}_P`]
  63. },
  64. params: {
  65. [`T${i}_T`]: paramsList[`T${i}_T`],
  66. [`T${i}_P`]: paramsList[`T${i}_P`],
  67. }
  68. };
  69. item.isfeedback = (isfeedback && (values[`T${i}_T`] || values[`T${i}_P`])) ? true : false;
  70. list.push(Object.assign(obj, item))
  71. }
  72. this.list = list;
  73. },
  74. onClick(item) {
  75. if (!model) model = this.$refs.MyInput;
  76. model.openInput(item)
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .row {
  83. position: relative;
  84. display: flex;
  85. padding: 4px 6px 0;
  86. height: 60px;
  87. box-sizing: border-box;
  88. background: #fff;
  89. border-radius: 4px;
  90. margin-bottom: 5px;
  91. .box {
  92. width: 49%;
  93. .content {
  94. display: flex;
  95. margin-top: 10px;
  96. align-items: flex-end;
  97. .value {
  98. width: 0;
  99. flex: 1;
  100. color: #333;
  101. font-size: 16px;
  102. flex-shrink: 0;
  103. font-weight: bold;
  104. }
  105. .unit {
  106. font-size: 10px;
  107. color: #666;
  108. flex-shrink: 0;
  109. max-width: 50px;
  110. }
  111. }
  112. }
  113. .dot {
  114. position: absolute;
  115. right: 2px;
  116. top: 2px;
  117. width: 10px;
  118. height: 10px;
  119. background: #D9001B;
  120. border-radius: 50%;
  121. }
  122. }
  123. </style>