mpattern.vue 3.2 KB

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