Commit 1feb887a authored by 李纪文's avatar 李纪文

Merge branch 'updateTsx' into 'dev'

fix: 台账解析文档编写 See merge request !14
parents a16386d0 9a95c61b
Pipeline #25083 passed with stages
in 6 minutes 0 seconds
......@@ -75,7 +75,7 @@ export default {
},
{
title: '数据录入',
children: ['Empty'],
children: ['ParseForm'],
},
{
title: '数据展示',
......@@ -83,5 +83,4 @@ export default {
},
],
},
webpack5: {},
};
......@@ -141,9 +141,11 @@
"@wisdom-components/timerangepicker": "^1.2.0",
"classnames": "^2.2.6",
"cross-spawn": "^7.0.3",
"form-render": "^0.9.12",
"highcharts": "^9.0.1",
"highcharts-react-official": "^3.0.0",
"mqtt-client": "^1.0.11"
"mqtt-client": "^1.0.11",
"parseForm": "0.0.6"
},
"size-limit": [
{
......
# `ParseForm`
> TODO: description
## Usage
```
const parseForm = require('ParseForm');
// TODO: DEMONSTRATE API
```
{
"name": "parseform",
"version": "1.0.0",
"description": "> TODO: description",
"author": "lijiwen <961370825@qq.com>",
"homepage": "",
"license": "ISC",
"main": "lib/ParseForm.js",
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib"
],
"publishConfig": {
"registry": "https://g.civnet.cn:4873/"
},
"repository": {
"type": "git",
"url": "https://g.civnet.cn:8443/ReactWeb5/wisdom-components.git"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"form-render": "^0.9.12",
"parseForm": "^0.0.6"
}
}
---
title: ParseForm - 台账解析
nav:
title: 组件
path: /components
group:
path: /
---
# ParseForm 台账解析
基础业务组件
- 允许台账解析,根据台账对 JSON 进行解析
## 何时使用
- 在实现台账解析时。
## 代码演示
<code src="./demos/Base.tsx">
## API
| 参数 | 说明 | 类型 | 默认值 |
| ------------ | ------------------------------- | ------------------ | ------------- |
| tablesSchema | 台账数据集合,台账数据格式 JSON | object | { } |
| onSubmit | 台账解析数据提交 | function(value){ } | function(){ } |
| onBack | 台账解析数据退出 | function(){ } | function(){ } |
## 台账字段形态
| 形态 | 说明 |
| -------------- | ------------------------------------------------------------------ |
| 文本 | 文本展示 |
| 数值 | 只允许数值展示 |
| 唯一值文本 | -- |
| 多行文本 | 多行文本编辑 |
| 编码 | -- |
| 地址 | -- |
| 本人部门 | 自动获取本人部门 |
| 本人姓名 | 自动获取本人姓名 |
| 本人 ID | -- |
| 选择器 | ConfigInfo 对'.'进行拆分,不存在为搜索选择器,存在为多级联动选择器 |
| 搜索选择器 | 根据 ConfigInfo 查询数据字典 |
| 值选择器 | 根据 ConfigInfo 内容','进行拆分展示 |
| 业务选择器 | 根据 ConfigInfo 内容'.'进行拆分,第一个表示表名,第二个表字段 |
| 可编辑值选择器 | 根据 ConfigInfo 内容','进行拆分展示,可新增其它 |
| 平铺值选择器 | 根据 ConfigInfo 内容','进行拆分平铺展示 |
| 站点选择器 | 根据 ConfigInfo 内容'.'进行拆分,取第 1 个进行站点查询 |
| 人员选择器 | 获取所有人员进行选择 |
| 城市选择器 | 进行城市选择 |
| 台账选择器 | 根据 ConfigInfo 内容'.'进行拆分,第一个表示台账名,第二个表字段 |
| 附件 | 附件上传 |
| 可预览附件 | -- |
| 图片 | 图片上传 |
| 可预览图片 | -- |
| 录音 | -- |
| 视频 | -- |
| 日期时间 | 日期时间 YYYY-MM-DD HH:mm:ss |
| 日期 | 日期 YYYY-MM-DD |
| 日期年份 | 日期年份 YYYY |
| 日期月份 | 日期月份 YYYY-MM |
| 日期周 | 日期周 YYYY-MM-DD |
| 设备选择 | -- |
| 坐标控件 | -- |
| 区域控件 | -- |
| 智能抄表 | -- |
| 二维码识别 | -- |
| 设备二维码 | -- |
| 位置坐标 | -- |
// @ts-ignore
import React from 'react';
import ParseForm from 'parseForm';
import './main.less';
window._config = {
userInfo: {
fullName: 'admin',
depart: {
name: '平台管理员',
},
},
};
const options =
'{"Groups":[{"GroupName":"基本信息","Schema":[{"Alias":"数值","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"数值","IsSync":0,"Order":1,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"数值","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"数值","UIGroup":"基本信息","Unit":"m","ValidateRule":"number","Visible":1},{"Alias":"日期时间","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"不可选择","FieldName":"日期时间","IsSync":0,"Order":3,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"日期时间","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:25","Visible":1},{"Alias":"日期","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"不可选择","FieldName":"日期","IsSync":0,"Order":3,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"日期","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:25","Visible":1},{"Alias":"日期年份","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"不可选择","FieldName":"日期年份","IsSync":0,"Order":3,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"日期年份","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:25","Visible":1},{"Alias":"日期月份","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"不可选择","FieldName":"日期月份","IsSync":0,"Order":3,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"日期月份","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:25","Visible":1},{"Alias":"日期周","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"不可选择","FieldName":"日期周","IsSync":0,"Order":3,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"日期周","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:25","Visible":1},{"Alias":"城市选择器","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"城市选择器","IsSync":0,"Order":4,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"城市选择器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:50","Visible":1},{"Alias":"值选择器","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"坐标位置,坐标地点","FieldName":"值选择器","IsSync":0,"Order":2,"PresetValue":"123","ReadOnly":0,"RowSpan":1,"Shape":"值选择器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"数值","UIGroup":"基本信息","Unit":"","ValidateRule":"number","Visible":1},{"Alias":"值复选器","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"坐标位置,坐标地点","FieldName":"值复选器","IsSync":0,"Order":2,"PresetValue":"123","ReadOnly":0,"RowSpan":1,"Shape":"值复选器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"数值","UIGroup":"基本信息","Unit":"","ValidateRule":"number","Visible":1},{"Alias":"可编辑值选择器","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"坐标位置,坐标地点","FieldName":"可编辑值选择器","IsSync":0,"Order":2,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"可编辑值选择器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"数值","UIGroup":"基本信息","Unit":"","ValidateRule":"number","Visible":1},{"Alias":"搜索选择器","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"选项内容.选项","FieldName":"搜索选择器","IsSync":0,"Order":4,"PresetValue":"选项2_2","ReadOnly":0,"RowSpan":1,"Shape":"搜索选择器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:50","Visible":1},{"Alias":"选择器","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"选项","FieldName":"选择器","IsSync":0,"Order":4,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"选择器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:50","Visible":1},{"Alias":"多级联动选择器","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"选项.选项","FieldName":"多级联动选择器","IsSync":0,"Order":4,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"选择器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:50","Visible":1},{"Alias":"台账选择器","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"二供泵房.设备名称","FieldName":"台账选择器","IsSync":0,"Order":4,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"台账选择器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:50","Visible":1},{"Alias":"人员选择器","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"选项.选项","FieldName":"人员选择器","IsSync":0,"Order":4,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"人员选择器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:50","Visible":1},{"Alias":"供水方式","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"供水方式","IsSync":0,"Order":5,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"多行文本","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:10","Visible":1},{"Alias":"站点选择器","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"选项.选项","FieldName":"站点选择器","IsSync":0,"Order":4,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"站点选择器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:50","Visible":1},{"Alias":"平铺值选择器","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"1,2,3","FieldName":"平铺值选择器","IsSync":0,"Order":5,"PresetValue":"1","ReadOnly":0,"RowSpan":1,"Shape":"平铺值选择器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:10","Visible":1},{"Alias":"画板名称","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"画板名称","IsSync":0,"Order":6,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"位置坐标","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:50","Visible":1},{"Alias":"设备简称","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"坐标位置","FieldName":"设备简称","IsSync":0,"Order":7,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"位置坐标","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:50","Visible":1},{"Alias":"图片","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"图片","IsSync":0,"Order":8,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"图片","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:25","Visible":1},{"Alias":"附件","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"附件","IsSync":0,"Order":8,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"附件","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"基本信息","Unit":"","ValidateRule":"maxlength:25","Visible":1},{"Alias":"本人姓名","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"本人姓名","IsSync":0,"Order":9,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"本人姓名","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"","TriggerEventFields":"","TriggerProblemValue":"","Type":"数值","UIGroup":"基本信息","Unit":"","ValidateRule":"number","Visible":1},{"Alias":"本人部门","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"本人部门","IsSync":0,"Order":9,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"本人部门","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"","TriggerEventFields":"","TriggerProblemValue":"","Type":"数值","UIGroup":"基本信息","Unit":"","ValidateRule":"number","Visible":1},{"Alias":"顺序","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"顺序","IsSync":0,"Order":10,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"文本","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"","TriggerEventFields":"","TriggerProblemValue":"","Type":"数值","UIGroup":"基本信息","Unit":"","ValidateRule":"number","Visible":1}],"Visible":1},{"GroupName":"坐标信息","Schema":[{"Alias":"所属分区","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"所属分区","IsSync":0,"Order":11,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"文本","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"坐标信息","Unit":"","ValidateRule":"maxlength:25","Visible":1},{"Alias":"详细地址","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"详细地址","IsSync":0,"Order":12,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"文本","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"坐标信息","Unit":"","ValidateRule":"maxlength:127","Visible":1},{"Alias":"GIS编码","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"GIS编码","IsSync":0,"Order":13,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"城市选择器","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"坐标信息","Unit":"","ValidateRule":"maxlength:25","Visible":1},{"Alias":"坐标位置","AllowCorrect":0,"ColSpan":1,"ConfigInfo":"","FieldName":"坐标位置","IsSync":0,"Order":14,"PresetValue":"","ReadOnly":0,"RowSpan":1,"Shape":"坐标控件","ShowCss":"","TableGroup":null,"TableName":"设备_台账_二供泵房2","TriggerEvent":"(无)","TriggerEventFields":"","TriggerProblemValue":"","Type":"文本","UIGroup":"坐标信息","Unit":"","ValidateRule":"maxlength:100","Visible":1}],"Visible":1}],"Modules":[],"Values":[{"FieldName":"采集频率","FieldValue":""},{"FieldName":"存储频率","FieldValue":""},{"FieldName":"地址方案版本","FieldValue":""},{"FieldName":"地址方案名","FieldValue":""},{"FieldName":"供水方式","FieldValue":""},{"FieldName":"画板名称","FieldValue":""},{"FieldName":"设备简称","FieldValue":"武汉市第一医院门诊楼"},{"FieldName":"设备类型","FieldValue":""},{"FieldName":"水箱个数","FieldValue":""},{"FieldName":"顺序","FieldValue":""},{"FieldName":"所属分区","FieldValue":""},{"FieldName":"详细地址","FieldValue":""},{"FieldName":"GIS编码","FieldValue":"北京市/市辖区/东城区"},{"FieldName":"坐标位置","FieldValue":"12720649.754511954,3577341.9326459174"}]}';
const Demo = (props) => {
return (
<div style={{ width: '100%' }}>
<ParseForm
tablesSchema={JSON.parse(options)}
onSubmit={(formData) => {
console.log(formData);
}}
onBack={() => {
console.log('返回');
}}
/>
</div>
);
};
export default Demo;
::-webkit-scrollbar,
*::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
background-color: #ffffff;
border-radius: 10px;
}
::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.1);
border-radius: 10px;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment