0.0.7 • Published 3 years ago

enniot-serial-conf v0.0.7

Weekly downloads
3
License
ISC
Repository
-
Last release
3 years ago

目录结构

── enniot-serial-conf
    ├── interface_com.vue
    ├── README.md
    ├── com-model.json
    └── package.json

Props

参数说明类型可选值默认值
schema规定 form 格式的 json 文件json
data用于将后台读取的数据填入 form 组件;以及获取 form 中数据,并将这些数据打包作为参数提交。object
config用于根据传入参数控制 form 中组件的显示与隐藏object{ dynamicComType: false/true }{ dynamicComType: false }

Fields

参数说明类型可选值默认值
enabled是否启用booleantrue/false
type类型string485/232
baud_rate波特率string1200B-230400B1200B
factor_name因子名称string
data_bit数据位int7-168
parity校验位stringNone/Odd/EvenEven
stop_bit停止位int1/28
data_type数据类型string"int"/"float"/"byte"/"double""int"
heart_interval帧间隔int100-1000

config 对象中的 dynamicComType,当 { dynamicComType : true } 时,data 中可以设置 type,而当 { dynamicComType : false } 时,data 中没有 type字段

Model

用法示例

<template>
	<el-row>
        <el-tabs
              v-model="comActiveName"
              :tab-position="apiTabPosition"
              @tab-click="handleComClick"
            >
              <el-tab-pane
                v-for="index in serial.length"
                :key="index"
                :label="'COM'+ index + '(' + serial[index-1].type + ')'"
                :name="String(index-1)"
              >
                <COM
                  v-if="comType==='fourth'"
                  ref="COMData"
                  :data="comForm"
                  :config="{is_dynamic: serial[index-1].is_dynamic}"
                  style="width: 60%"
                />
                <el-button
                  type="primary"
                  style="margin-left: 585px"
                  @click="onInterfaceSubmit(index-1)"
                >
                  保存
                </el-button>
              </el-tab-pane>
            </el-tabs>
    </el-row>
</template>

<script>
	import COM from 'enniot-serial-conf';
    import deviceConf from '../../../../device-conf.js';
    import axios from "axios";
    export default {
        data() {
            const {lan, serial} = deviceConf;
            return {
      			comForm: {},
            }
        },
        methods: {
            // 接口设置查询
            async onGetCOMForm(id) {
              const api = `${baseUrl}/api/serial/${id}`;
              const res = await this.$api.get(api);
              res.is_dynamic = res.is_dynamic || false;
              res.type = this.serial[id].type;
              this.comForm = res;
            },
            //  接口设置修改
            async onInterfaceSubmit(id) {
              const api = `${baseUrl}/api/serial/${id}`;
              const res = await this.$api.post(api, this.$refs.COMData[id].data);
              this.comForm = res;
            },
    }
        
0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago