# enniot-serial-conf

> "fix: 修改样式显示"

Latest version **0.0.7** (published 2021-01-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install enniot-serial-conf
pnpm add enniot-serial-conf
yarn add enniot-serial-conf
bun add enniot-serial-conf
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2021-01-05 |
| First published | 2020-11-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | myy |
| Maintainers | npm-rookie |
| Keywords | interface_com |

## Links

- npm: https://www.npmjs.com/package/enniot-serial-conf
- npm.io page: https://npm.io/package/enniot-serial-conf

## Recent versions

- 0.0.7 (latest) — 2021-01-05
- 0.0.6 — 2020-12-28
- 0.0.5 — 2020-12-24
- 0.0.4 — 2020-12-03
- 0.0.3 — 2020-12-03
- 0.0.2 — 2020-12-01
- 0.0.1 — 2020-11-25

## README

## 目录结构

```
── 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        | 是否启用 | boolean | true/false                    | —      |
| type           | 类型     | string  | 485/232                       | —      |
| baud_rate      | 波特率   | string  | 1200B-230400B                 | 1200B  |
| factor_name    | 因子名称 | string  | —                             | —      |
| data_bit       | 数据位   | int     | 7-16                          | 8      |
| parity         | 校验位   | string  | None/Odd/Even                 | Even   |
| stop_bit       | 停止位   | int     | 1/2                           | 8      |
| data_type      | 数据类型 | string  | "int"/"float"/"byte"/"double" | "int"  |
| heart_interval | 帧间隔   | int     | 100-1000                      | —      |

> config 对象中的 dynamicComType，当 { dynamicComType ： true } 时，data 中可以设置 type，而当 { dynamicComType ： false } 时，data 中没有 type字段

## Model

### 用法示例

```vue
<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;
            },
    }
        
```

---
_Source: https://npm.io/package/enniot-serial-conf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
