mpattern.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="control">
  3. <view class="update-line">
  4. <view class="label" :style="{ color: fColor }">
  5. {{ ctrlModel.funcname }}
  6. </view>
  7. <view class="content" :style="{ color: fColor }">
  8. <block v-if="ctrlModel.inputType == 'switch'">
  9. {{ switchRes(ctrlModel) }}
  10. </block>
  11. <block v-else>
  12. {{ ctrlModel.showValue || "暂未设置" }}
  13. </block>
  14. <view
  15. class="control-updata-but"
  16. hover-class="navigator-hover"
  17. @click="onClick(ctrlModel)"
  18. >{{ ctrlModel.isfeedback ? "待更新" : "更新" }}</view
  19. >
  20. </view>
  21. </view>
  22. <view class="update-line" v-for="item in list" :key="item.paramName">
  23. <view class="label" :style="{ color: fColor }">
  24. {{ item.funcname }}
  25. </view>
  26. <view class="content" :style="{ color: fColor }">
  27. <block v-if="item.inputType == 'switch'">
  28. {{ switchRes(item) }}
  29. </block>
  30. <block v-else>
  31. {{ item.paramValue || item.params.lastvalue || "暂未设置" }}
  32. </block>
  33. <view
  34. class="control-updata-but"
  35. hover-class="navigator-hover"
  36. @click="onClick(item)"
  37. >{{ item.isfeedback ? "待更新" : "更新" }}</view
  38. >
  39. </view>
  40. </view>
  41. <My_input ref="MyInput" />
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. name: "mpattern",
  47. props: {
  48. fColor: {
  49. type: String,
  50. value: "#FFF",
  51. },
  52. },
  53. data() {
  54. return {
  55. ctrlModel: {},
  56. list: [],
  57. };
  58. },
  59. computed: {
  60. switchRes: function () {
  61. return (item) => {
  62. try {
  63. if (item.showValue) return item.showValue;
  64. let value = item.paramValue || item.params.lastvalue,
  65. res = item.params.options.find((v) => v.value == value);
  66. return res ? res.label : "暂未设置";
  67. } catch (error) {}
  68. };
  69. },
  70. },
  71. methods: {
  72. onClick(item) {
  73. this.$refs.MyInput.openInput(item);
  74. },
  75. },
  76. };
  77. </script>
  78. <style lang="scss" scoped>
  79. .row {
  80. position: relative;
  81. display: flex;
  82. padding: 4px 6px 0;
  83. height: 60px;
  84. box-sizing: border-box;
  85. background: #fff;
  86. border-radius: 4px;
  87. margin-bottom: 5px;
  88. .box {
  89. width: 49%;
  90. .content {
  91. display: flex;
  92. margin-top: 10px;
  93. align-items: flex-end;
  94. .value {
  95. width: 0;
  96. flex: 1;
  97. color: #333;
  98. font-size: 16px;
  99. flex-shrink: 0;
  100. font-weight: bold;
  101. }
  102. .unit {
  103. font-size: 10px;
  104. color: #666;
  105. flex-shrink: 0;
  106. max-width: 50px;
  107. }
  108. }
  109. }
  110. .dot {
  111. position: absolute;
  112. right: 2px;
  113. top: 2px;
  114. width: 10px;
  115. height: 10px;
  116. background: #d9001b;
  117. border-radius: 50%;
  118. }
  119. }
  120. </style>