mirror of https://github.com/certd/certd
				
				
				
			
							parent
							
								
									f7fc06e657
								
							
						
					
					
						commit
						a2c43b50a6
					
				| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
import _ from "lodash-es";
 | 
			
		||||
import { compute } from "@fast-crud/fast-crud";
 | 
			
		||||
 | 
			
		||||
export function useReference(form: any) {
 | 
			
		||||
  if (!form.reference) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  for (const reference of form.reference) {
 | 
			
		||||
    debugger;
 | 
			
		||||
    _.set(
 | 
			
		||||
      form,
 | 
			
		||||
      reference.dest,
 | 
			
		||||
      compute<any>((scope) => {
 | 
			
		||||
        debugger;
 | 
			
		||||
        return _.get(scope, reference.src);
 | 
			
		||||
      })
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1,7 @@
 | 
			
		|||
import { compute, CreateCrudOptionsRet, dict } from "@fast-crud/fast-crud";
 | 
			
		||||
import { PluginGroup } from "@certd/pipeline";
 | 
			
		||||
import { useReference } from "/@/use/use-refrence";
 | 
			
		||||
import _ from "lodash-es";
 | 
			
		||||
 | 
			
		||||
export default function (certPluginGroup: PluginGroup, formWrapperRef: any): CreateCrudOptionsRet {
 | 
			
		||||
  const inputs: any = {};
 | 
			
		||||
| 
						 | 
				
			
			@ -10,10 +12,11 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre
 | 
			
		|||
        inputs[inputKey].form.show = true;
 | 
			
		||||
        continue;
 | 
			
		||||
      }
 | 
			
		||||
      const inputDefine = plugin.input[inputKey];
 | 
			
		||||
      const inputDefine = _.cloneDeep(plugin.input[inputKey]);
 | 
			
		||||
      if (!inputDefine.required && !inputDefine.maybeNeed) {
 | 
			
		||||
        continue;
 | 
			
		||||
      }
 | 
			
		||||
      useReference(inputDefine);
 | 
			
		||||
      inputs[inputKey] = {
 | 
			
		||||
        title: inputDefine.title,
 | 
			
		||||
        form: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,7 +59,7 @@ const development = {
 | 
			
		|||
        type: 'better-sqlite3',
 | 
			
		||||
        database: './data/db.sqlite',
 | 
			
		||||
        synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
 | 
			
		||||
        logging: true,
 | 
			
		||||
        logging: false,
 | 
			
		||||
 | 
			
		||||
        // 配置实体模型 或者 entities: '/entity',
 | 
			
		||||
        entities: ['**/modules/*/entity/*.ts', '**/entity/*.js', '**/entity/*.d.ts', PipelineEntity, FlywayHistory, UserEntity],
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,13 @@ const preview = {
 | 
			
		|||
  preview: {
 | 
			
		||||
    enabled: true,
 | 
			
		||||
  },
 | 
			
		||||
  typeorm: {
 | 
			
		||||
    dataSource: {
 | 
			
		||||
      default: {
 | 
			
		||||
        logging: false,
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
} as MidwayConfig;
 | 
			
		||||
 | 
			
		||||
mergeConfig(preview, 'preview');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,13 @@ const production = {
 | 
			
		|||
  preview: {
 | 
			
		||||
    enabled: false,
 | 
			
		||||
  },
 | 
			
		||||
  typeorm: {
 | 
			
		||||
    dataSource: {
 | 
			
		||||
      default: {
 | 
			
		||||
        logging: false,
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
} as MidwayConfig;
 | 
			
		||||
 | 
			
		||||
mergeConfig(production, 'production');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue