feat: 参数配置表单竖向形式/多语言

This commit is contained in:
TsMask
2023-11-14 17:14:52 +08:00
parent 28483a7a8b
commit a8854b4e71
5 changed files with 1774 additions and 2952 deletions

View File

@@ -260,33 +260,27 @@ export async function getParamConfigInfoTable(
}
/**
* 查询配置参数标签栏对应信息-结构处理
* 查询配置参数标签栏对应信息-表单结构处理
* @param neType 网元类型
* @param topTag
* @param neId
* @returns object
*/
export async function getParamConfigInfoTree(
export async function getParamConfigInfoForm(
neType: string,
topTag: string,
neId: string
) {
const { wrRule, dataArr } = await getParamConfigInfo(neType, topTag, neId);
type TreeNodeType = {
title: string;
key: string;
record: Record<string, any>[];
};
// 拼装数据
const result = {
code: RESULT_CODE_SUCCESS,
msg: RESULT_MSG_SUCCESS,
data: {
type: 'list' as 'list' | 'array',
data: [] as TreeNodeType[],
recordRule: {},
data: [] as Record<string, any>[],
dataRule: {},
},
};
@@ -298,7 +292,7 @@ export async function getParamConfigInfoTree(
// 列表项数据
const dataList = [];
for (const item of dataArr) {
for (const key of Object.keys(item)) {
for (const key in item) {
// 规则为准
for (const rule of ruleArr) {
if (rule['name'] === key) {
@@ -322,7 +316,7 @@ export async function getParamConfigInfoTree(
for (const item of dataArr) {
const index = item['index'];
let record: Record<string, any>[] = [];
for (const key of Object.keys(item)) {
for (const key in item) {
// 规则为准
for (const rule of ruleArr) {
if (rule['name'] === key) {
@@ -339,11 +333,7 @@ export async function getParamConfigInfoTree(
result.data.data = dataArray;
// 无数据时,用于新增
let dataRule: Record<string, any> = {};
for (const rule of ruleArr) {
dataRule[rule.name] = rule;
}
result.data.recordRule = dataRule;
result.data.dataRule = { title: `Index-0`, key: 0, record : [ruleArr]} ;
}
return result;
}