lrf hace 2 años
padre
commit
a692b04330
Se han modificado 1 ficheros con 5 adiciones y 4 borrados
  1. 5 4
      app/public/table-template.js

+ 5 - 4
app/public/table-template.js

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