1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <view class="control">
- <view class="control-title">
- 基础控制
- </view>
- <view class="current">
- </view>
- <view class="show-list">
- <control-item v-for="item in itemList" :key="item.paramName" :item="item" @click.native="onClick(item)" />
- </view>
- <My_input ref="MyInput" />
- </view>
- </template>
- <script>
- import My_input from "../../../modules/My_input";
- let model = null;
- export default {
- name: "basics",
- components: { My_input },
- data() {
- /* , {
- name: "压力控制误差宽度",
- key: 'Ctrl'
- } */
- return {
- itemList: []
- }
- },
- methods: {
- loadData(funs, values, paramsList) {
- let list = ['Flow control', 'pressure control', 'Config', 'Sleep time', 'Pilot valve', 'Minimum', 'MOP'].map(v => funs[v])
- for (const key in list) {
- const name = Object.entries(list[key].params)[0][0]
- list[key].paramName = name;
- list[key].params = paramsList[name];
- if (list[key].params.datatype == "boolean") {
- list[key].inputType = 'switch';
- list[key].showValue = list[key].params.options.find(v => v.value == list[key].params.lastvalue).label
- console.log(list[key].params.options)
- } else {
- list[key].inputType = list[key].params.num_step ? 'step' : 'int';
- }
- list[key].paramValue = values[name]
- list[key].isfeedback = list[key].isfeedback && (list[key].paramValue != list[key].params.lastvalue)
- // if (name == "Config")
- }
- this.itemList = list;
- model = this.$refs.MyInput;
- },
- onClick(item) {
- if (!model) model = this.$refs.MyInput;
- model.openInput(item)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .show-list {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- margin-top: -5px;
- box-sizing: border-box;
- }
- </style>
|