module
Version:
v1.0.0
Opens a new window with list of versions in this module.
Published: Aug 26, 2025
License: MIT
Opens a new window with license information.
README
¶
Config Core
配置中心
项目约束
数据库
table均以usc_*为前缀, 实现TableName函数
目标
实现table类表格的表头动态控制(header alias),
配置系统独立运行,业务系统通过sdk集成api,提供UI集成模板。
提高开发效率。
当前功能
- 以项目为组管理表格
- 配置表格字段的别名映射
部署
本地编译
- 安装数据库服务(推荐使用PostgreSQL)
- 运行镜像文件
- 通过
config.toml配置网络监听端口与数据库连接
web...
- 运行
./build_local.sh脚本编译成可执行文件,或运行./build.sh脚本编译成Docker镜像
使用
-
使用浏览器进入配置页面,配置项目、表格与表格的字段别名映射
-
项目中提供了sdk工具包,辅助调用api接口并内部实现了HTTP请求的缓存
client := sdk.New(
sdk.WithHost("http://localhost"),
)
mapping, err := client.GetAliasMap("{table_code}")
- table_code: 表格编号,在配置页面创建表格时自动生成
- 返回值 mapping:
map[string]string类型
-
也可以通过HTTP请求GET /api/flex_table/mappings/{table_code}直接加载JSON格式的字段别名映射
- table_code: 表格编号,在配置页面创建表格时自动生成
- 响应: JSON
{
"code": 200,
"message": "查询成功",
"data": {
"code": "序列号",
"createTime": "创建时间",
"description": "个性化描述",
"name": "名字的别名"
}
-
UI模板
- 定义表格信息
const tableCode = "table_61bf245ce20d4cae9bc60977aacec82b"; // 1. table编号
const tableFields = ["id", "code", "name", "description", "createTime", "UpdateTime"] // 2. 表格字段列表
const tableFieldMap = ref(new Map<string, string>()); // 3. 字段映射字典
- 在html标签中使用
<el-table-column prop="id" :label="tableFieldMap.get('id')" width="60"/>
- 页面加载时,通过api加载映射表,然后与字段列表合并
getTableFieldAPi({code: tableCode}).then((res: any) => {
if (res && res.data) {
const map = new Map<string, string>(Object.entries(res.data));
for (const field of state.tableFields) {
if (!map.has(field) || map.get(field) === '') {
map.set(field, field)
}
}
state.tableFieldMap = map
}
})
Directories
¶
cmd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.