|
@@ -27,23 +27,24 @@ const ModelContext = (data) => {
|
|
// 处理字段
|
|
// 处理字段
|
|
for (const col of columns) {
|
|
for (const col of columns) {
|
|
const { type, title, def } = col;
|
|
const { type, title, def } = col;
|
|
- const prop = _.pick(col, ['required', 'index', 'zh', 'ref', 'remark']);
|
|
|
|
|
|
+ const prop = _.pick(col, ['required', 'index', 'zh', 'ref', 'remark', 'esType']);
|
|
if (def) prop.default = def;
|
|
if (def) prop.default = def;
|
|
const modelType = getModelType(type);
|
|
const modelType = getModelType(type);
|
|
switch (modelType) {
|
|
switch (modelType) {
|
|
case 'secret':
|
|
case 'secret':
|
|
prop.select = false;
|
|
prop.select = false;
|
|
|
|
+ // 手动删除引号.变成方法.这里处理不了
|
|
|
|
+ prop.set = `(val) => { if (isString(val)) { return { secret: val }; } return val; }`;
|
|
fc.push(` // 手动删除set前的大括号,处理太麻烦了.就手动删除吧`);
|
|
fc.push(` // 手动删除set前的大括号,处理太麻烦了.就手动删除吧`);
|
|
- fc.push(` @prop(${JSON.stringify(prop)}, set: (val) => { if (isString(val)) { return { secret: val }; } return val; } })`);
|
|
|
|
|
|
+ fc.push(` @prop(${JSON.stringify(prop)})`);
|
|
fc.push(` ${title}: object`);
|
|
fc.push(` ${title}: object`);
|
|
break;
|
|
break;
|
|
-
|
|
|
|
|
|
+
|
|
default:
|
|
default:
|
|
fc.push(` @prop(${JSON.stringify(prop)})`);
|
|
fc.push(` @prop(${JSON.stringify(prop)})`);
|
|
fc.push(` ${title}: ${modelType}`);
|
|
fc.push(` ${title}: ${modelType}`);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
fc.push(`}`);
|
|
fc.push(`}`);
|