|
@@ -4,7 +4,8 @@ const { columnType } = require('./options');
|
|
|
|
|
|
module.exports = (data) => {
|
|
module.exports = (data) => {
|
|
let { name, name_zh, columns } = data;
|
|
let { name, name_zh, columns } = data;
|
|
-
|
|
|
|
|
|
+ const configArr = [];
|
|
|
|
+ const updateArr = [];
|
|
// 将插件和正常字段分开
|
|
// 将插件和正常字段分开
|
|
let pluginColumns = columns.filter((f) => {
|
|
let pluginColumns = columns.filter((f) => {
|
|
const r = columnType.find((cf) => cf.value === f.type && cf.plugins);
|
|
const r = columnType.find((cf) => cf.value === f.type && cf.plugins);
|
|
@@ -20,8 +21,10 @@ module.exports = (data) => {
|
|
if (!r) continue;
|
|
if (!r) continue;
|
|
const { path } = r;
|
|
const { path } = r;
|
|
if (path) {
|
|
if (path) {
|
|
- pluginHead += `const ${type}Plugin = require('${path}');\n`;
|
|
|
|
|
|
+ const pluginStr = `const ${type}Plugin = require('${path}');\n`;
|
|
|
|
+ if (pluginHead.indexOf(pluginStr) <= -1) pluginHead += pluginStr;
|
|
pluginArea += `schema.plugin(${type}Plugin(${JSON.stringify(params)}));\n`;
|
|
pluginArea += `schema.plugin(${type}Plugin(${JSON.stringify(params)}));\n`;
|
|
|
|
+ conigArr.push(title);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -34,8 +37,6 @@ module.exports = (data) => {
|
|
let indexStr = '';
|
|
let indexStr = '';
|
|
let has_ObjectId = false;
|
|
let has_ObjectId = false;
|
|
let has_Secret = false;
|
|
let has_Secret = false;
|
|
- const configArr = [];
|
|
|
|
- const updateArr = [];
|
|
|
|
let configSearchStr = '';
|
|
let configSearchStr = '';
|
|
for (let i = 0; i < columns.length; i++) {
|
|
for (let i = 0; i < columns.length; i++) {
|
|
const { title, type, required = false, remark, index, def, zh, ref, getProp } = columns[i];
|
|
const { title, type, required = false, remark, index, def, zh, ref, getProp } = columns[i];
|