mpattern.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="control">
  3. <view class="control-title">
  4. 控制模式
  5. </view>
  6. <view class="update-line">
  7. <view class="label">
  8. {{ ctrlModel.funcname }}
  9. </view>
  10. <view class="content">
  11. {{ ctrlModel.showValue }}
  12. <view class="control-updata-but" hover-class="navigator-hover" @click="onClick(ctrlModel)">{{
  13. ctrlModel.isfeedback ? '待更新' : '更新' }}</view>
  14. </view>
  15. </view>
  16. <view class="row" v-for="item in list" :key="item.now.paramname" :style="{ 'opacity': item.current ? 1 : .8 }"
  17. hover-class="navigator-hover" @click="onClick(item.tar)">
  18. <view class="box">
  19. <view class="label">{{ item.now.paramname || '' }}</view>
  20. <view class="content">
  21. <view class="value">{{ item.now.lastvalue || '--' }}</view>
  22. </view>
  23. </view>
  24. <view class="box">
  25. <view class="label">{{ item.tar.funcname }}</view>
  26. <view class="content">
  27. <view class="value">{{ item.tar.params.lastvalue || '--' }}</view>
  28. <view class="unit">{{ item.tar.params.unit || '' }}</view>
  29. </view>
  30. </view>
  31. <view class="dot" v-if="item.tar.isfeedback" />
  32. </view>
  33. <My_input ref="MyInput" />
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. name: "mpattern",
  39. data() {
  40. return {
  41. ctrlModel: {},
  42. list: []
  43. }
  44. },
  45. methods: {
  46. onClick(item) {
  47. let MyInput = this.$refs.MyInput;
  48. console.log(item)
  49. if (item.paramName == 'ConMode') {
  50. MyInput.checkBeforeSending = (w_functionid, params) => {
  51. let tar = this.list[params.ConMode - 1].tar;
  52. let lastvalue = tar.params.lastvalue - 0;
  53. if (lastvalue == 0) {
  54. uni.showModal({
  55. title: '提示',
  56. content: `"${tar.funcname}"值为"0",不可修改为"${this.ctrlModel.params.options.find(v => v.value == params.ConMode).label}"模式`,
  57. showCancel: false,
  58. })
  59. } else {
  60. MyInput.checkBeforeSending = null;
  61. MyInput.submit(w_functionid, params)
  62. }
  63. }
  64. }
  65. MyInput.openInput(item)
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .row {
  72. position: relative;
  73. display: flex;
  74. padding: 4px 6px 0;
  75. height: 60px;
  76. box-sizing: border-box;
  77. background: #fff;
  78. border-radius: 4px;
  79. margin-bottom: 5px;
  80. .box {
  81. width: 49%;
  82. .content {
  83. display: flex;
  84. margin-top: 10px;
  85. align-items: flex-end;
  86. .value {
  87. width: 0;
  88. flex: 1;
  89. color: #333;
  90. font-size: 16px;
  91. flex-shrink: 0;
  92. font-weight: bold;
  93. }
  94. .unit {
  95. font-size: 10px;
  96. color: #666;
  97. flex-shrink: 0;
  98. max-width: 50px;
  99. }
  100. }
  101. }
  102. .dot {
  103. position: absolute;
  104. right: 2px;
  105. top: 2px;
  106. width: 10px;
  107. height: 10px;
  108. background: #D9001B;
  109. border-radius: 50%;
  110. }
  111. }
  112. </style>