division.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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)">更新</view>
  13. </view>
  14. </view>
  15. <view class="row" hover-class="navigator-hover" v-for="item in list" :key="item.key" @click="onClick(item)">
  16. <view class="box">
  17. <view class="label">第{{ item.index }}时段时间</view>
  18. <view class="content">
  19. <view class="value">{{ item.params["T" + item.index + "_T"] || '--' }}</view>
  20. </view>
  21. </view>
  22. <view class="box">
  23. <view class="label">第{{ item.index }}时段压力</view>
  24. <view class="content">
  25. <view class="value">{{ item.params["T" + item.index + "_P"] || '--' }}</view>
  26. <view class="unit">MPA</view>
  27. </view>
  28. </view>
  29. </view>
  30. <My_input ref="MyInput" />
  31. </view>
  32. </template>
  33. <script>
  34. let model = null;
  35. export default {
  36. name: "division",
  37. data() {
  38. return {
  39. list: [],
  40. timeControl: {}
  41. }
  42. },
  43. methods: {
  44. loadData(funs, values, paramsList) {
  45. model = this.$refs.MyInput;
  46. let reg = /^T\d{1,5}_P$/,
  47. count = 0,
  48. list = [];
  49. for (const key in values) {
  50. if (reg.test(key)) count++
  51. }
  52. for (let i = 1; i <= count; i++) {
  53. let obj = funs[`T${i}`];
  54. obj.params[`T${i}_T`] = obj.params[`T${i}_T`].split("_").join(":");
  55. list.push(Object.assign(obj, {
  56. key: `T${i}_`,
  57. index: i,
  58. inputType: "dayParting",
  59. toBeUpdated: {
  60. time: values[`T${i}_T`],
  61. value: values[`T${i}_P`]
  62. }
  63. }))
  64. }
  65. this.list = list;
  66. this.timeControl = this.__proto__.getControlItem(["TimeControl"], funs, values, paramsList)[0]
  67. },
  68. onClick(item) {
  69. if (!model) model = this.$refs.MyInput;
  70. model.openInput(item)
  71. }
  72. }
  73. }
  74. </script>
  75. <style lang="scss" scoped>
  76. .row {
  77. display: flex;
  78. padding: 4px 6px 0;
  79. height: 60px;
  80. box-sizing: border-box;
  81. background: #fff;
  82. border-radius: 4px;
  83. margin-bottom: 5px;
  84. .box {
  85. width: 49%;
  86. .content {
  87. display: flex;
  88. margin-top: 10px;
  89. align-items: flex-end;
  90. .value {
  91. width: 0;
  92. flex: 1;
  93. color: #333;
  94. font-size: 16px;
  95. flex-shrink: 0;
  96. font-weight: bold;
  97. }
  98. .unit {
  99. font-size: 10px;
  100. color: #666;
  101. flex-shrink: 0;
  102. max-width: 50px;
  103. }
  104. }
  105. }
  106. }
  107. </style>