basics.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view class="control">
  3. <view class="control-title">
  4. 基础控制
  5. </view>
  6. <view class="current">
  7. </view>
  8. <view class="show-list">
  9. <control-item v-for="item in itemList" :key="item.paramName" :item="item" @click.native="onClick(item)" />
  10. </view>
  11. <My_input ref="MyInput" />
  12. </view>
  13. </template>
  14. <script>
  15. import My_input from "../../../modules/My_input";
  16. let model = null;
  17. export default {
  18. name: "basics",
  19. components: { My_input },
  20. data() {
  21. /* , {
  22. name: "压力控制误差宽度",
  23. key: 'Ctrl'
  24. } */
  25. return {
  26. itemList: []
  27. }
  28. },
  29. methods: {
  30. loadData(funs, values, paramsList) {
  31. let list = ['Flow control', 'pressure control', 'Config', 'Sleep time', 'Pilot valve', 'Minimum', 'MOP'].map(v => funs[v])
  32. for (const key in list) {
  33. const name = Object.entries(list[key].params)[0][0]
  34. list[key].paramName = name;
  35. list[key].params = paramsList[name];
  36. if (list[key].params.datatype == "boolean") {
  37. list[key].inputType = 'switch';
  38. list[key].showValue = list[key].params.options.find(v => v.value == list[key].params.lastvalue).label
  39. console.log(list[key].params.options)
  40. } else {
  41. list[key].inputType = list[key].params.num_step ? 'step' : 'int';
  42. }
  43. list[key].paramValue = values[name]
  44. list[key].isfeedback = list[key].isfeedback && (list[key].paramValue != list[key].params.lastvalue)
  45. // if (name == "Config")
  46. }
  47. this.itemList = list;
  48. model = this.$refs.MyInput;
  49. },
  50. onClick(item) {
  51. if (!model) model = this.$refs.MyInput;
  52. model.openInput(item)
  53. }
  54. }
  55. }
  56. </script>
  57. <style lang="scss" scoped>
  58. .show-list {
  59. display: flex;
  60. flex-wrap: wrap;
  61. justify-content: space-between;
  62. margin-top: -5px;
  63. box-sizing: border-box;
  64. }
  65. </style>