diff --git a/dev_tools/formprops.js b/dev_tools/formprops.js deleted file mode 100644 index 3231f9f..0000000 --- a/dev_tools/formprops.js +++ /dev/null @@ -1,391 +0,0 @@ -module.exports = { - labelCol: { span: 3, offset: 0 }, - labelAlign: 'right', - layout: 'horizontal', - size: 'default', - schemas: [ - { - key: '95b6f464a9604b238ef8722db5d4878c', - field: 'ziDuan16563', - label: '字段1', - type: 'input', - component: 'Input', - colProps: { span: 24 }, - defaultValue: '', - componentProps: { - width: '100%', - span: '', - defaultValue: '', - labelWidthMode: 'fix', - labelFixWidth: 120, - responsive: true, - respNewRow: false, - placeholder: '请输入字段1', - maxlength: null, - prefix: '', - suffix: '', - addonBefore: '', - addonAfter: '', - disabled: false, - allowClear: false, - showLabel: true, - required: false, - rules: [], - events: {}, - isSave: false, - isShow: true, - scan: false, - style: { width: '100%' }, - }, - }, - { - key: 'd7f295f12d2a4ec7863099d875b95515', - field: 'ziDuan28273', - label: '字段2', - type: 'input', - component: 'Input', - colProps: { span: 24 }, - defaultValue: '', - componentProps: { - width: '100%', - span: '', - defaultValue: '', - labelWidthMode: 'fix', - labelFixWidth: 120, - responsive: true, - respNewRow: false, - placeholder: '请输入字段2', - maxlength: null, - prefix: '', - suffix: '', - addonBefore: '', - addonAfter: '', - disabled: false, - allowClear: false, - showLabel: true, - required: false, - rules: [], - events: {}, - isSave: false, - isShow: true, - scan: false, - style: { width: '100%' }, - }, - }, - { - key: '37d86747f1e64aae874f13f29a5697f3', - field: 'ziDuan35193', - label: '字段3', - type: 'input', - component: 'Input', - colProps: { span: 24 }, - defaultValue: '', - componentProps: { - width: '100%', - span: '', - defaultValue: '', - labelWidthMode: 'fix', - labelFixWidth: 120, - responsive: true, - respNewRow: false, - placeholder: '请输入字段3', - maxlength: null, - prefix: '', - suffix: '', - addonBefore: '', - addonAfter: '', - disabled: false, - allowClear: false, - showLabel: true, - required: false, - rules: [], - events: {}, - isSave: false, - isShow: true, - scan: false, - respBreakLine: true, - style: { width: '100%' }, - }, - }, - { - key: 'fa04ee3d955a4659be18331be1819601', - field: 'ziDuan45516', - label: '字段4', - type: 'input', - component: 'Input', - colProps: { span: 24 }, - defaultValue: '', - componentProps: { - width: '100%', - span: '', - defaultValue: '', - labelWidthMode: 'fix', - labelFixWidth: 120, - responsive: true, - respNewRow: false, - placeholder: '请输入字段4', - maxlength: null, - prefix: '', - suffix: '', - addonBefore: '', - addonAfter: '', - disabled: false, - allowClear: false, - showLabel: true, - required: false, - rules: [], - events: {}, - isSave: false, - isShow: true, - scan: false, - style: { width: '100%' }, - }, - }, - { - key: '9dcd8c7ac1e54acd8cee285274b82b0d', - field: 'ziDuan55031', - label: '字段5', - type: 'input', - component: 'Input', - colProps: { span: 24 }, - defaultValue: '', - componentProps: { - width: '100%', - span: '', - defaultValue: '', - labelWidthMode: 'fix', - labelFixWidth: 120, - responsive: false, - respNewRow: false, - placeholder: '请输入字段5', - maxlength: null, - prefix: '', - suffix: '', - addonBefore: '', - addonAfter: '', - disabled: false, - allowClear: false, - showLabel: true, - required: false, - rules: [], - events: {}, - isSave: false, - isShow: true, - scan: false, - style: { width: '100%' }, - }, - }, - { - key: 'a4b8975a9b2f4fda84dbc88cdd2bcfb7', - field: 'jiLianBenTi7352', - label: '级联本体', - type: 'input', - component: 'Input', - colProps: { span: 24 }, - defaultValue: '', - componentProps: { - width: '100%', - span: '', - defaultValue: '', - labelWidthMode: 'fix', - labelFixWidth: 120, - responsive: true, - respNewRow: false, - placeholder: '请输入级联本体', - maxlength: null, - prefix: '', - suffix: '', - addonBefore: '', - addonAfter: '', - disabled: false, - allowClear: false, - showLabel: true, - required: false, - rules: [], - events: {}, - isSave: false, - isShow: true, - scan: false, - style: { width: '100%' }, - }, - }, - { - key: 'a2e8519113f844c3a0ae489b2c8a09d0', - field: 'jiLianWenZi5194', - label: '级联文字', - type: 'input', - component: 'Input', - colProps: { span: 24 }, - defaultValue: '', - componentProps: { - width: '100%', - span: '', - defaultValue: '', - labelWidthMode: 'fix', - labelFixWidth: 120, - responsive: false, - respNewRow: false, - placeholder: '请输入级联文字', - maxlength: null, - prefix: '', - suffix: '', - addonBefore: '', - addonAfter: '', - disabled: false, - allowClear: false, - showLabel: true, - required: false, - rules: [], - events: {}, - isSave: false, - isShow: true, - scan: false, - style: { width: '100%' }, - }, - }, - { - key: '506f9008790c4e72843910da7c36b2d8', - field: '', - label: '标题', - type: 'title', - component: 'Title', - colProps: { span: 24 }, - defaultValue: '明细表', - componentProps: { - defaultValue: '明细表', - color: '', - align: 'left', - fontSize: 18, - isShow: true, - style: {}, - }, - }, - { - key: '25a93adbfba647b2a5398221d2a35952', - label: '表格组件', - field: 'cascadeDemoChild5561List', - type: 'form', - component: 'SubForm', - required: true, - colProps: { span: 24 }, - componentProps: { - mainKey: 'cascadeDemoChild5561List', - columns: [ - { - key: 'af2057f5fa774ec29f91b2114c4af4f7', - title: '列1', - dataIndex: 'lie19747', - componentType: 'Input', - defaultValue: '', - componentProps: { - width: '100%', - span: '', - defaultValue: '', - labelWidthMode: 'fix', - labelFixWidth: 120, - responsive: false, - respNewRow: false, - placeholder: '请输入列1', - maxlength: null, - prefix: '', - suffix: '', - addonBefore: '', - addonAfter: '', - disabled: false, - allowClear: false, - showLabel: true, - required: false, - rules: [], - events: {}, - isSave: false, - isShow: true, - scan: false, - }, - }, - { - key: 'd02e0e1df55249e6a42964143f2d2b48', - title: '级联本体', - dataIndex: 'jiLianBenTi9627', - componentType: 'Input', - defaultValue: '', - componentProps: { - width: '100%', - span: '', - defaultValue: '', - labelWidthMode: 'fix', - labelFixWidth: 120, - responsive: false, - respNewRow: false, - placeholder: '请输入级联本体', - maxlength: null, - prefix: '', - suffix: '', - addonBefore: '', - addonAfter: '', - disabled: false, - allowClear: false, - showLabel: true, - required: false, - rules: [], - events: {}, - isSave: false, - isShow: true, - scan: false, - }, - }, - { - key: '07ea250f2eb84680a01692b078e1d1cc', - title: '级联文字', - dataIndex: 'jiLianWenZi9294', - componentType: 'Input', - defaultValue: '', - componentProps: { - width: '100%', - span: '', - defaultValue: '', - labelWidthMode: 'fix', - labelFixWidth: 120, - responsive: false, - respNewRow: false, - placeholder: '请输入级联文字', - maxlength: null, - prefix: '', - suffix: '', - addonBefore: '', - addonAfter: '', - disabled: false, - allowClear: false, - showLabel: true, - required: false, - rules: [], - events: {}, - isSave: false, - isShow: true, - scan: false, - }, - }, - { title: '操作', key: 'action', fixed: 'right', width: '50px' }, - ], - span: '24', - preloadType: 'api', - apiConfig: {}, - itemId: '', - dicOptions: [], - useSelectButton: false, - buttonName: '选择数据', - showLabel: false, - showComponentBorder: true, - showFormBorder: true, - showIndex: false, - isShow: true, - multipleHeads: [], - }, - }, - ], - showActionButtonGroup: false, - buttonLocation: 'center', - actionColOptions: { span: 24 }, - showResetButton: false, - showSubmitButton: false, - hiddenComponent: [], - }; \ No newline at end of file diff --git a/dev_tools/template_extend.js b/dev_tools/template_extend.js index d46841a..89ac59a 100644 --- a/dev_tools/template_extend.js +++ b/dev_tools/template_extend.js @@ -1,6 +1,10 @@ const fs = require('fs'); const path = require('path'); const filePath = path.join(process.cwd(), 'config.ts'); +const argv = process.argv; +const fixResponsive = argv.indexOf('fix-responsive') > 0; +const templates = require('./templates'); + if (fs.existsSync(filePath)) { console.log('Reading ' + filePath); const file = fs.readFileSync(filePath, 'utf-8'); @@ -31,7 +35,10 @@ if (fs.existsSync(filePath)) { let tmpl = ''; let tabCount = 0; +let tableCount = 0; const refList = []; +const importList = []; +const components = []; // 用于将config的表单格式展开成字段,以便二开 formProps.schemas.forEach((prop) => { @@ -41,6 +48,7 @@ formProps.schemas.forEach((prop) => { function appendTmpl(prop) { let schema = `schemaMap['${prop.key}']`; // 栅格布局 + tmpl += `\n`; if (prop.component == 'Grid') { prop.children.forEach((child) => { child.list.forEach((listChild) => { @@ -54,9 +62,10 @@ function appendTmpl(prop) { appendTableLayoutTmpl(prop); } else if (prop.component == 'Card') { appendCardTmpl(prop); + } else if (prop.component == 'SubForm') { + return appendSubFormTmpl(prop); } tmpl += ` -