mpattern.vue 3.0 KB

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