diff --git a/yudao-admin-ui/src/utils/generator/README.md b/yudao-admin-ui/src/utils/generator/README.md
deleted file mode 100644
index 46a4c15ec..000000000
--- a/yudao-admin-ui/src/utils/generator/README.md
+++ /dev/null
@@ -1 +0,0 @@
-【add by 芋道源码】来自 https://github.com/JakHuang/form-generator/tree/dev/src/components/generator 目录
\ No newline at end of file
diff --git a/yudao-admin-ui/src/utils/generator/config.js b/yudao-admin-ui/src/utils/generator/config.js
deleted file mode 100644
index 872b02374..000000000
--- a/yudao-admin-ui/src/utils/generator/config.js
+++ /dev/null
@@ -1,629 +0,0 @@
-// 表单属性【右面板】
-export const formConf = {
- formRef: 'elForm',
- formModel: 'formData',
- size: 'medium',
- labelPosition: 'right',
- labelWidth: 100,
- formRules: 'rules',
- gutter: 15,
- disabled: false,
- span: 24,
- formBtns: true
-}
-
-// 输入型组件 【左面板】
-export const inputComponents = [
- {
- // 组件的自定义配置
- __config__: {
- label: '单行文本',
- labelWidth: null,
- showLabel: true,
- changeTag: true,
- tag: 'el-input',
- tagIcon: 'input',
- defaultValue: undefined,
- required: true,
- layout: 'colFormItem',
- span: 24,
- document: 'https://element.eleme.cn/#/zh-CN/component/input',
- // 正则校验规则
- regList: []
- },
- // 组件的插槽属性
- __slot__: {
- prepend: '',
- append: ''
- },
- // 其余的为可直接写在组件标签上的属性
- placeholder: '请输入',
- style: {width: '100%'},
- clearable: true,
- 'prefix-icon': '',
- 'suffix-icon': '',
- maxlength: null,
- 'show-word-limit': false,
- readonly: false,
- disabled: false
- },
- {
- __config__: {
- label: '多行文本',
- labelWidth: null,
- showLabel: true,
- tag: 'el-input',
- tagIcon: 'textarea',
- defaultValue: undefined,
- required: true,
- layout: 'colFormItem',
- span: 24,
- regList: [],
- changeTag: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/input'
- },
- type: 'textarea',
- placeholder: '请输入',
- autosize: {
- minRows: 4,
- maxRows: 4
- },
- style: {width: '100%'},
- maxlength: null,
- 'show-word-limit': false,
- readonly: false,
- disabled: false
- },
- {
- __config__: {
- label: '密码',
- showLabel: true,
- labelWidth: null,
- changeTag: true,
- tag: 'el-input',
- tagIcon: 'password',
- defaultValue: undefined,
- layout: 'colFormItem',
- span: 24,
- required: true,
- regList: [],
- document: 'https://element.eleme.cn/#/zh-CN/component/input'
- },
- __slot__: {
- prepend: '',
- append: ''
- },
- placeholder: '请输入',
- 'show-password': true,
- style: {width: '100%'},
- clearable: true,
- 'prefix-icon': '',
- 'suffix-icon': '',
- maxlength: null,
- 'show-word-limit': false,
- readonly: false,
- disabled: false
- },
- {
- __config__: {
- label: '计数器',
- showLabel: true,
- changeTag: true,
- labelWidth: null,
- tag: 'el-input-number',
- tagIcon: 'number',
- defaultValue: undefined,
- span: 24,
- layout: 'colFormItem',
- required: true,
- regList: [],
- document: 'https://element.eleme.cn/#/zh-CN/component/input-number'
- },
- placeholder: '',
- min: undefined,
- max: undefined,
- step: 1,
- 'step-strictly': false,
- precision: undefined,
- 'controls-position': '',
- disabled: false
- },
- {
- __config__: {
- label: '编辑器',
- showLabel: true,
- changeTag: true,
- labelWidth: null,
- tag: 'tinymce',
- tagIcon: 'rich-text',
- defaultValue: null,
- span: 24,
- layout: 'colFormItem',
- required: true,
- regList: [],
- document: 'http://tinymce.ax-z.cn'
- },
- placeholder: '请输入',
- height: 300, // 编辑器高度
- branding: false // 隐藏右下角品牌烙印
- }
-]
-
-// 选择型组件 【左面板】
-export const selectComponents = [
- {
- __config__: {
- label: '下拉选择',
- showLabel: true,
- labelWidth: null,
- tag: 'el-select',
- tagIcon: 'select',
- layout: 'colFormItem',
- span: 24,
- required: true,
- regList: [],
- changeTag: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/select'
- },
- __slot__: {
- options: [{
- label: '选项一',
- value: 1
- }, {
- label: '选项二',
- value: 2
- }]
- },
- placeholder: '请选择',
- style: {width: '100%'},
- clearable: true,
- disabled: false,
- filterable: false,
- multiple: false
- },
- {
- __config__: {
- label: '级联选择',
- url: 'https://www.fastmock.site/mock/f8d7a54fb1e60561e2f720d5a810009d/fg/cascaderList',
- method: 'get',
- dataPath: 'list',
- dataConsumer: 'options',
- showLabel: true,
- labelWidth: null,
- tag: 'el-cascader',
- tagIcon: 'cascader',
- layout: 'colFormItem',
- defaultValue: [],
- dataType: 'dynamic',
- span: 24,
- required: true,
- regList: [],
- changeTag: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/cascader'
- },
- options: [{
- id: 1,
- value: 1,
- label: '选项1',
- children: [{
- id: 2,
- value: 2,
- label: '选项1-1'
- }]
- }],
- placeholder: '请选择',
- style: {width: '100%'},
- props: {
- props: {
- multiple: false,
- label: 'label',
- value: 'value',
- children: 'children'
- }
- },
- 'show-all-levels': true,
- disabled: false,
- clearable: true,
- filterable: false,
- separator: '/'
- },
- {
- __config__: {
- label: '单选框组',
- labelWidth: null,
- showLabel: true,
- tag: 'el-radio-group',
- tagIcon: 'radio',
- changeTag: true,
- defaultValue: undefined,
- layout: 'colFormItem',
- span: 24,
- optionType: 'default',
- regList: [],
- required: true,
- border: false,
- document: 'https://element.eleme.cn/#/zh-CN/component/radio'
- },
- __slot__: {
- options: [{
- label: '选项一',
- value: 1
- }, {
- label: '选项二',
- value: 2
- }]
- },
- style: {},
- size: 'medium',
- disabled: false
- },
- {
- __config__: {
- label: '多选框组',
- tag: 'el-checkbox-group',
- tagIcon: 'checkbox',
- defaultValue: [],
- span: 24,
- showLabel: true,
- labelWidth: null,
- layout: 'colFormItem',
- optionType: 'default',
- required: true,
- regList: [],
- changeTag: true,
- border: false,
- document: 'https://element.eleme.cn/#/zh-CN/component/checkbox'
- },
- __slot__: {
- options: [{
- label: '选项一',
- value: 1
- }, {
- label: '选项二',
- value: 2
- }]
- },
- style: {},
- size: 'medium',
- min: null,
- max: null,
- disabled: false
- },
- {
- __config__: {
- label: '开关',
- tag: 'el-switch',
- tagIcon: 'switch',
- defaultValue: false,
- span: 24,
- showLabel: true,
- labelWidth: null,
- layout: 'colFormItem',
- required: true,
- regList: [],
- changeTag: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/switch'
- },
- style: {},
- disabled: false,
- 'active-text': '',
- 'inactive-text': '',
- 'active-color': null,
- 'inactive-color': null,
- 'active-value': true,
- 'inactive-value': false
- },
- {
- __config__: {
- label: '滑块',
- tag: 'el-slider',
- tagIcon: 'slider',
- defaultValue: null,
- span: 24,
- showLabel: true,
- layout: 'colFormItem',
- labelWidth: null,
- required: true,
- regList: [],
- changeTag: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/slider'
- },
- disabled: false,
- min: 0,
- max: 100,
- step: 1,
- 'show-stops': false,
- range: false
- },
- {
- __config__: {
- label: '时间选择',
- tag: 'el-time-picker',
- tagIcon: 'time',
- defaultValue: null,
- span: 24,
- showLabel: true,
- layout: 'colFormItem',
- labelWidth: null,
- required: true,
- regList: [],
- changeTag: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/time-picker'
- },
- placeholder: '请选择',
- style: {width: '100%'},
- disabled: false,
- clearable: true,
- 'picker-options': {
- selectableRange: '00:00:00-23:59:59'
- },
- format: 'HH:mm:ss',
- 'value-format': 'HH:mm:ss'
- },
- {
- __config__: {
- label: '时间范围',
- tag: 'el-time-picker',
- tagIcon: 'time-range',
- span: 24,
- showLabel: true,
- labelWidth: null,
- layout: 'colFormItem',
- defaultValue: null,
- required: true,
- regList: [],
- changeTag: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/time-picker'
- },
- style: {width: '100%'},
- disabled: false,
- clearable: true,
- 'is-range': true,
- 'range-separator': '至',
- 'start-placeholder': '开始时间',
- 'end-placeholder': '结束时间',
- format: 'HH:mm:ss',
- 'value-format': 'HH:mm:ss'
- },
- {
- __config__: {
- label: '日期选择',
- tag: 'el-date-picker',
- tagIcon: 'date',
- defaultValue: null,
- showLabel: true,
- labelWidth: null,
- span: 24,
- layout: 'colFormItem',
- required: true,
- regList: [],
- changeTag: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/date-picker'
- },
- placeholder: '请选择',
- type: 'date',
- style: {width: '100%'},
- disabled: false,
- clearable: true,
- format: 'yyyy-MM-dd',
- 'value-format': 'yyyy-MM-dd',
- readonly: false
- },
- {
- __config__: {
- label: '日期范围',
- tag: 'el-date-picker',
- tagIcon: 'date-range',
- defaultValue: null,
- span: 24,
- showLabel: true,
- labelWidth: null,
- required: true,
- layout: 'colFormItem',
- regList: [],
- changeTag: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/date-picker'
- },
- style: {width: '100%'},
- type: 'daterange',
- 'range-separator': '至',
- 'start-placeholder': '开始日期',
- 'end-placeholder': '结束日期',
- disabled: false,
- clearable: true,
- format: 'yyyy-MM-dd',
- 'value-format': 'yyyy-MM-dd',
- readonly: false
- },
- {
- __config__: {
- label: '评分',
- tag: 'el-rate',
- tagIcon: 'rate',
- defaultValue: 0,
- span: 24,
- showLabel: true,
- labelWidth: null,
- layout: 'colFormItem',
- required: true,
- regList: [],
- changeTag: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/rate'
- },
- style: {},
- max: 5,
- 'allow-half': false,
- 'show-text': false,
- 'show-score': false,
- disabled: false
- },
- {
- __config__: {
- label: '颜色选择',
- tag: 'el-color-picker',
- tagIcon: 'color',
- span: 24,
- defaultValue: null,
- showLabel: true,
- labelWidth: null,
- layout: 'colFormItem',
- required: true,
- regList: [],
- changeTag: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/color-picker'
- },
- 'show-alpha': false,
- 'color-format': '',
- disabled: false,
- size: 'medium'
- },
- {
- __config__: {
- label: '上传',
- tag: 'el-upload',
- tagIcon: 'upload',
- layout: 'colFormItem',
- defaultValue: null,
- showLabel: true,
- labelWidth: null,
- required: true,
- span: 24,
- showTip: false,
- buttonText: '点击上传',
- regList: [],
- changeTag: true,
- fileSize: 2,
- sizeUnit: 'MB',
- document: 'https://element.eleme.cn/#/zh-CN/component/upload'
- },
- __slot__: {
- 'list-type': true
- },
- action: 'https://jsonplaceholder.typicode.com/posts/',
- disabled: false,
- accept: '',
- name: 'file',
- 'auto-upload': true,
- 'list-type': 'text',
- multiple: false
- }
-]
-
-// 布局型组件 【左面板】
-export const layoutComponents = [
- {
- __config__: {
- layout: 'rowFormItem',
- tagIcon: 'row',
- label: '行容器',
- layoutTree: true,
- document: 'https://element.eleme.cn/#/zh-CN/component/layout#row-attributes'
- },
- type: 'default',
- justify: 'start',
- align: 'top'
- },
- {
- __config__: {
- label: '按钮',
- showLabel: true,
- changeTag: true,
- labelWidth: null,
- tag: 'el-button',
- tagIcon: 'button',
- span: 24,
- layout: 'colFormItem',
- document: 'https://element.eleme.cn/#/zh-CN/component/button'
- },
- __slot__: {
- default: '主要按钮'
- },
- type: 'primary',
- icon: 'el-icon-search',
- round: false,
- size: 'medium',
- plain: false,
- circle: false,
- disabled: false
- },
- {
- __config__: {
- layout: 'colFormItem',
- tagIcon: 'table',
- tag: 'el-table',
- document: 'https://element.eleme.cn/#/zh-CN/component/table',
- span: 24,
- formId: 101,
- renderKey: 1595761764203,
- componentName: 'row101',
- showLabel: true,
- changeTag: true,
- labelWidth: null,
- label: '表格[开发中]',
- dataType: 'dynamic',
- method: 'get',
- dataPath: 'list',
- dataConsumer: 'data',
- url: 'https://www.fastmock.site/mock/f8d7a54fb1e60561e2f720d5a810009d/fg/tableData',
- children: [{
- __config__: {
- layout: 'raw',
- tag: 'el-table-column',
- renderKey: 15957617660153
- },
- prop: 'date',
- label: '日期'
- }, {
- __config__: {
- layout: 'raw',
- tag: 'el-table-column',
- renderKey: 15957617660152
- },
- prop: 'address',
- label: '地址'
- }, {
- __config__: {
- layout: 'raw',
- tag: 'el-table-column',
- renderKey: 15957617660151
- },
- prop: 'name',
- label: '名称'
- }, {
- __config__: {
- layout: 'raw',
- tag: 'el-table-column',
- renderKey: 1595774496335,
- children: [
- {
- __config__: {
- label: '按钮',
- tag: 'el-button',
- tagIcon: 'button',
- layout: 'raw',
- renderKey: 1595779809901
- },
- __slot__: {
- default: '主要按钮'
- },
- type: 'primary',
- icon: 'el-icon-search',
- round: false,
- size: 'medium'
- }
- ]
- },
- label: '操作'
- }]
- },
- data: [],
- directives: [{
- name: 'loading',
- value: true
- }],
- border: true,
- type: 'default',
- justify: 'start',
- align: 'top'
- }
-]
diff --git a/yudao-admin-ui/src/utils/generator/css.js b/yudao-admin-ui/src/utils/generator/css.js
deleted file mode 100644
index c1c62e607..000000000
--- a/yudao-admin-ui/src/utils/generator/css.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const styles = {
- 'el-rate': '.el-rate{display: inline-block; vertical-align: text-top;}',
- 'el-upload': '.el-upload__tip{line-height: 1.2;}'
-}
-
-function addCss(cssList, el) {
- const css = styles[el.tag]
- css && cssList.indexOf(css) === -1 && cssList.push(css)
- if (el.children) {
- el.children.forEach(el2 => addCss(cssList, el2))
- }
-}
-
-export function makeUpCss(conf) {
- const cssList = []
- conf.fields.forEach(el => addCss(cssList, el))
- return cssList.join('\n')
-}
diff --git a/yudao-admin-ui/src/utils/generator/drawingDefalut.js b/yudao-admin-ui/src/utils/generator/drawingDefalut.js
deleted file mode 100644
index dbc1daf27..000000000
--- a/yudao-admin-ui/src/utils/generator/drawingDefalut.js
+++ /dev/null
@@ -1,37 +0,0 @@
-export default [
- {
- __config__: {
- label: '单行文本',
- labelWidth: null,
- showLabel: true,
- changeTag: true,
- tag: 'el-input',
- tagIcon: 'input',
- defaultValue: undefined,
- required: true,
- layout: 'colFormItem',
- span: 24,
- document: 'https://element.eleme.cn/#/zh-CN/component/input',
- // 正则校验规则
- regList: [{
- pattern: '/^1(3|4|5|7|8|9)\\d{9}$/',
- message: '手机号格式错误'
- }]
- },
- // 组件的插槽属性
- __slot__: {
- prepend: '',
- append: ''
- },
- __vModel__: 'mobile',
- placeholder: '请输入手机号',
- style: { width: '100%' },
- clearable: true,
- 'prefix-icon': 'el-icon-mobile',
- 'suffix-icon': '',
- maxlength: 11,
- 'show-word-limit': true,
- readonly: false,
- disabled: false
- }
-]
diff --git a/yudao-admin-ui/src/utils/generator/html.js b/yudao-admin-ui/src/utils/generator/html.js
deleted file mode 100644
index 6e9a32e6f..000000000
--- a/yudao-admin-ui/src/utils/generator/html.js
+++ /dev/null
@@ -1,399 +0,0 @@
-/* eslint-disable max-len */
-import ruleTrigger from './ruleTrigger'
-
-let confGlobal
-let someSpanIsNot24
-
-export function dialogWrapper(str) {
- return `
- ${str}
-
- 取消
- 确定
-
- `
-}
-
-export function vueTemplate(str) {
- return `
-
- ${str}
-
- `
-}
-
-export function vueScript(str) {
- return ``
-}
-
-export function cssStyle(cssStr) {
- return ``
-}
-
-function buildFormTemplate(scheme, child, type) {
- let labelPosition = ''
- if (scheme.labelPosition !== 'right') {
- labelPosition = `label-position="${scheme.labelPosition}"`
- }
- const disabled = scheme.disabled ? `:disabled="${scheme.disabled}"` : ''
- let str = `
- ${child}
- ${buildFromBtns(scheme, type)}
- `
- if (someSpanIsNot24) {
- str = `
- ${str}
- `
- }
- return str
-}
-
-function buildFromBtns(scheme, type) {
- let str = ''
- if (scheme.formBtns && type === 'file') {
- str = `
- 提交
- 重置
- `
- if (someSpanIsNot24) {
- str = `
- ${str}
- `
- }
- }
- return str
-}
-
-// span不为24的用el-col包裹
-function colWrapper(scheme, str) {
- if (someSpanIsNot24 || scheme.__config__.span !== 24) {
- return `
- ${str}
- `
- }
- return str
-}
-
-const layouts = {
- colFormItem(scheme) {
- const config = scheme.__config__
- let labelWidth = ''
- let label = `label="${config.label}"`
- if (config.labelWidth && config.labelWidth !== confGlobal.labelWidth) {
- labelWidth = `label-width="${config.labelWidth}px"`
- }
- if (config.showLabel === false) {
- labelWidth = 'label-width="0"'
- label = ''
- }
- const required = !ruleTrigger[config.tag] && config.required ? 'required' : ''
- const tagDom = tags[config.tag] ? tags[config.tag](scheme) : null
- let str = `
- ${tagDom}
- `
- str = colWrapper(scheme, str)
- return str
- },
- rowFormItem(scheme) {
- const config = scheme.__config__
- const type = scheme.type === 'default' ? '' : `type="${scheme.type}"`
- const justify = scheme.type === 'default' ? '' : `justify="${scheme.justify}"`
- const align = scheme.type === 'default' ? '' : `align="${scheme.align}"`
- const gutter = scheme.gutter ? `:gutter="${scheme.gutter}"` : ''
- const children = config.children.map(el => layouts[el.__config__.layout](el))
- let str = `
- ${children.join('\n')}
- `
- str = colWrapper(scheme, str)
- return str
- }
-}
-
-const tags = {
- 'el-button': el => {
- const {
- tag, disabled
- } = attrBuilder(el)
- const type = el.type ? `type="${el.type}"` : ''
- const icon = el.icon ? `icon="${el.icon}"` : ''
- const round = el.round ? 'round' : ''
- const size = el.size ? `size="${el.size}"` : ''
- const plain = el.plain ? 'plain' : ''
- const circle = el.circle ? 'circle' : ''
- let child = buildElButtonChild(el)
-
- if (child) child = `\n${child}\n` // 换行
- return `<${tag} ${type} ${icon} ${round} ${size} ${plain} ${disabled} ${circle}>${child}${tag}>`
- },
- 'el-input': el => {
- const {
- tag, disabled, vModel, clearable, placeholder, width
- } = attrBuilder(el)
- const maxlength = el.maxlength ? `:maxlength="${el.maxlength}"` : ''
- const showWordLimit = el['show-word-limit'] ? 'show-word-limit' : ''
- const readonly = el.readonly ? 'readonly' : ''
- const prefixIcon = el['prefix-icon'] ? `prefix-icon='${el['prefix-icon']}'` : ''
- const suffixIcon = el['suffix-icon'] ? `suffix-icon='${el['suffix-icon']}'` : ''
- const showPassword = el['show-password'] ? 'show-password' : ''
- const type = el.type ? `type="${el.type}"` : ''
- const autosize = el.autosize && el.autosize.minRows
- ? `:autosize="{minRows: ${el.autosize.minRows}, maxRows: ${el.autosize.maxRows}}"`
- : ''
- let child = buildElInputChild(el)
-
- if (child) child = `\n${child}\n` // 换行
- return `<${tag} ${vModel} ${type} ${placeholder} ${maxlength} ${showWordLimit} ${readonly} ${disabled} ${clearable} ${prefixIcon} ${suffixIcon} ${showPassword} ${autosize} ${width}>${child}${tag}>`
- },
- 'el-input-number': el => {
- const {
- tag, disabled, vModel, placeholder
- } = attrBuilder(el)
- const controlsPosition = el['controls-position'] ? `controls-position=${el['controls-position']}` : ''
- const min = el.min ? `:min='${el.min}'` : ''
- const max = el.max ? `:max='${el.max}'` : ''
- const step = el.step ? `:step='${el.step}'` : ''
- const stepStrictly = el['step-strictly'] ? 'step-strictly' : ''
- const precision = el.precision ? `:precision='${el.precision}'` : ''
-
- return `<${tag} ${vModel} ${placeholder} ${step} ${stepStrictly} ${precision} ${controlsPosition} ${min} ${max} ${disabled}>${tag}>`
- },
- 'el-select': el => {
- const {
- tag, disabled, vModel, clearable, placeholder, width
- } = attrBuilder(el)
- const filterable = el.filterable ? 'filterable' : ''
- const multiple = el.multiple ? 'multiple' : ''
- let child = buildElSelectChild(el)
-
- if (child) child = `\n${child}\n` // 换行
- return `<${tag} ${vModel} ${placeholder} ${disabled} ${multiple} ${filterable} ${clearable} ${width}>${child}${tag}>`
- },
- 'el-radio-group': el => {
- const { tag, disabled, vModel } = attrBuilder(el)
- const size = `size="${el.size}"`
- let child = buildElRadioGroupChild(el)
-
- if (child) child = `\n${child}\n` // 换行
- return `<${tag} ${vModel} ${size} ${disabled}>${child}${tag}>`
- },
- 'el-checkbox-group': el => {
- const { tag, disabled, vModel } = attrBuilder(el)
- const size = `size="${el.size}"`
- const min = el.min ? `:min="${el.min}"` : ''
- const max = el.max ? `:max="${el.max}"` : ''
- let child = buildElCheckboxGroupChild(el)
-
- if (child) child = `\n${child}\n` // 换行
- return `<${tag} ${vModel} ${min} ${max} ${size} ${disabled}>${child}${tag}>`
- },
- 'el-switch': el => {
- const { tag, disabled, vModel } = attrBuilder(el)
- const activeText = el['active-text'] ? `active-text="${el['active-text']}"` : ''
- const inactiveText = el['inactive-text'] ? `inactive-text="${el['inactive-text']}"` : ''
- const activeColor = el['active-color'] ? `active-color="${el['active-color']}"` : ''
- const inactiveColor = el['inactive-color'] ? `inactive-color="${el['inactive-color']}"` : ''
- const activeValue = el['active-value'] !== true ? `:active-value='${JSON.stringify(el['active-value'])}'` : ''
- const inactiveValue = el['inactive-value'] !== false ? `:inactive-value='${JSON.stringify(el['inactive-value'])}'` : ''
-
- return `<${tag} ${vModel} ${activeText} ${inactiveText} ${activeColor} ${inactiveColor} ${activeValue} ${inactiveValue} ${disabled}>${tag}>`
- },
- 'el-cascader': el => {
- const {
- tag, disabled, vModel, clearable, placeholder, width
- } = attrBuilder(el)
- const options = el.options ? `:options="${el.__vModel__}Options"` : ''
- const props = el.props ? `:props="${el.__vModel__}Props"` : ''
- const showAllLevels = el['show-all-levels'] ? '' : ':show-all-levels="false"'
- const filterable = el.filterable ? 'filterable' : ''
- const separator = el.separator === '/' ? '' : `separator="${el.separator}"`
-
- return `<${tag} ${vModel} ${options} ${props} ${width} ${showAllLevels} ${placeholder} ${separator} ${filterable} ${clearable} ${disabled}>${tag}>`
- },
- 'el-slider': el => {
- const { tag, disabled, vModel } = attrBuilder(el)
- const min = el.min ? `:min='${el.min}'` : ''
- const max = el.max ? `:max='${el.max}'` : ''
- const step = el.step ? `:step='${el.step}'` : ''
- const range = el.range ? 'range' : ''
- const showStops = el['show-stops'] ? `:show-stops="${el['show-stops']}"` : ''
-
- return `<${tag} ${min} ${max} ${step} ${vModel} ${range} ${showStops} ${disabled}>${tag}>`
- },
- 'el-time-picker': el => {
- const {
- tag, disabled, vModel, clearable, placeholder, width
- } = attrBuilder(el)
- const startPlaceholder = el['start-placeholder'] ? `start-placeholder="${el['start-placeholder']}"` : ''
- const endPlaceholder = el['end-placeholder'] ? `end-placeholder="${el['end-placeholder']}"` : ''
- const rangeSeparator = el['range-separator'] ? `range-separator="${el['range-separator']}"` : ''
- const isRange = el['is-range'] ? 'is-range' : ''
- const format = el.format ? `format="${el.format}"` : ''
- const valueFormat = el['value-format'] ? `value-format="${el['value-format']}"` : ''
- const pickerOptions = el['picker-options'] ? `:picker-options='${JSON.stringify(el['picker-options'])}'` : ''
-
- return `<${tag} ${vModel} ${isRange} ${format} ${valueFormat} ${pickerOptions} ${width} ${placeholder} ${startPlaceholder} ${endPlaceholder} ${rangeSeparator} ${clearable} ${disabled}>${tag}>`
- },
- 'el-date-picker': el => {
- const {
- tag, disabled, vModel, clearable, placeholder, width
- } = attrBuilder(el)
- const startPlaceholder = el['start-placeholder'] ? `start-placeholder="${el['start-placeholder']}"` : ''
- const endPlaceholder = el['end-placeholder'] ? `end-placeholder="${el['end-placeholder']}"` : ''
- const rangeSeparator = el['range-separator'] ? `range-separator="${el['range-separator']}"` : ''
- const format = el.format ? `format="${el.format}"` : ''
- const valueFormat = el['value-format'] ? `value-format="${el['value-format']}"` : ''
- const type = el.type === 'date' ? '' : `type="${el.type}"`
- const readonly = el.readonly ? 'readonly' : ''
-
- return `<${tag} ${type} ${vModel} ${format} ${valueFormat} ${width} ${placeholder} ${startPlaceholder} ${endPlaceholder} ${rangeSeparator} ${clearable} ${readonly} ${disabled}>${tag}>`
- },
- 'el-rate': el => {
- const { tag, disabled, vModel } = attrBuilder(el)
- const max = el.max ? `:max='${el.max}'` : ''
- const allowHalf = el['allow-half'] ? 'allow-half' : ''
- const showText = el['show-text'] ? 'show-text' : ''
- const showScore = el['show-score'] ? 'show-score' : ''
-
- return `<${tag} ${vModel} ${max} ${allowHalf} ${showText} ${showScore} ${disabled}>${tag}>`
- },
- 'el-color-picker': el => {
- const { tag, disabled, vModel } = attrBuilder(el)
- const size = `size="${el.size}"`
- const showAlpha = el['show-alpha'] ? 'show-alpha' : ''
- const colorFormat = el['color-format'] ? `color-format="${el['color-format']}"` : ''
-
- return `<${tag} ${vModel} ${size} ${showAlpha} ${colorFormat} ${disabled}>${tag}>`
- },
- 'el-upload': el => {
- const { tag } = el.__config__
- const disabled = el.disabled ? ':disabled=\'true\'' : ''
- const action = el.action ? `:action="${el.__vModel__}Action"` : ''
- const multiple = el.multiple ? 'multiple' : ''
- const listType = el['list-type'] !== 'text' ? `list-type="${el['list-type']}"` : ''
- const accept = el.accept ? `accept="${el.accept}"` : ''
- const name = el.name !== 'file' ? `name="${el.name}"` : ''
- const autoUpload = el['auto-upload'] === false ? ':auto-upload="false"' : ''
- const beforeUpload = `:before-upload="${el.__vModel__}BeforeUpload"`
- const fileList = `:file-list="${el.__vModel__}fileList"`
- const ref = `ref="${el.__vModel__}"`
- let child = buildElUploadChild(el)
-
- if (child) child = `\n${child}\n` // 换行
- return `<${tag} ${ref} ${fileList} ${action} ${autoUpload} ${multiple} ${beforeUpload} ${listType} ${accept} ${name} ${disabled}>${child}${tag}>`
- },
- tinymce: el => {
- const { tag, vModel, placeholder } = attrBuilder(el)
- const height = el.height ? `:height="${el.height}"` : ''
- const branding = el.branding ? `:branding="${el.branding}"` : ''
- return `<${tag} ${vModel} ${placeholder} ${height} ${branding}>${tag}>`
- }
-}
-
-function attrBuilder(el) {
- return {
- tag: el.__config__.tag,
- vModel: `v-model="${confGlobal.formModel}.${el.__vModel__}"`,
- clearable: el.clearable ? 'clearable' : '',
- placeholder: el.placeholder ? `placeholder="${el.placeholder}"` : '',
- width: el.style && el.style.width ? ':style="{width: \'100%\'}"' : '',
- disabled: el.disabled ? ':disabled=\'true\'' : ''
- }
-}
-
-// el-buttin 子级
-function buildElButtonChild(scheme) {
- const children = []
- const slot = scheme.__slot__ || {}
- if (slot.default) {
- children.push(slot.default)
- }
- return children.join('\n')
-}
-
-// el-input 子级
-function buildElInputChild(scheme) {
- const children = []
- const slot = scheme.__slot__
- if (slot && slot.prepend) {
- children.push(`${slot.prepend}`)
- }
- if (slot && slot.append) {
- children.push(`${slot.append}`)
- }
- return children.join('\n')
-}
-
-// el-select 子级
-function buildElSelectChild(scheme) {
- const children = []
- const slot = scheme.__slot__
- if (slot && slot.options && slot.options.length) {
- children.push(``)
- }
- return children.join('\n')
-}
-
-// el-radio-group 子级
-function buildElRadioGroupChild(scheme) {
- const children = []
- const slot = scheme.__slot__
- const config = scheme.__config__
- if (slot && slot.options && slot.options.length) {
- const tag = config.optionType === 'button' ? 'el-radio-button' : 'el-radio'
- const border = config.border ? 'border' : ''
- children.push(`<${tag} v-for="(item, index) in ${scheme.__vModel__}Options" :key="index" :label="item.value" :disabled="item.disabled" ${border}>{{item.label}}${tag}>`)
- }
- return children.join('\n')
-}
-
-// el-checkbox-group 子级
-function buildElCheckboxGroupChild(scheme) {
- const children = []
- const slot = scheme.__slot__
- const config = scheme.__config__
- if (slot && slot.options && slot.options.length) {
- const tag = config.optionType === 'button' ? 'el-checkbox-button' : 'el-checkbox'
- const border = config.border ? 'border' : ''
- children.push(`<${tag} v-for="(item, index) in ${scheme.__vModel__}Options" :key="index" :label="item.value" :disabled="item.disabled" ${border}>{{item.label}}${tag}>`)
- }
- return children.join('\n')
-}
-
-// el-upload 子级
-function buildElUploadChild(scheme) {
- const list = []
- const config = scheme.__config__
- if (scheme['list-type'] === 'picture-card') list.push('')
- else list.push(`${config.buttonText}`)
- if (config.showTip) list.push(`
只能上传不超过 ${config.fileSize}${config.sizeUnit} 的${scheme.accept}文件
`)
- return list.join('\n')
-}
-
-/**
- * 组装html代码。【入口函数】
- * @param {Object} formConfig 整个表单配置
- * @param {String} type 生成类型,文件或弹窗等
- */
-export function makeUpHtml(formConfig, type) {
- const htmlList = []
- confGlobal = formConfig
- // 判断布局是否都沾满了24个栅格,以备后续简化代码结构
- someSpanIsNot24 = formConfig.fields.some(item => item.__config__.span !== 24)
- // 遍历渲染每个组件成html
- formConfig.fields.forEach(el => {
- htmlList.push(layouts[el.__config__.layout](el))
- })
- const htmlStr = htmlList.join('\n')
- // 将组件代码放进form标签
- let temp = buildFormTemplate(formConfig, htmlStr, type)
- // dialog标签包裹代码
- if (type === 'dialog') {
- temp = dialogWrapper(temp)
- }
- confGlobal = null
- return temp
-}
diff --git a/yudao-admin-ui/src/utils/generator/js.js b/yudao-admin-ui/src/utils/generator/js.js
deleted file mode 100644
index 6f3c18681..000000000
--- a/yudao-admin-ui/src/utils/generator/js.js
+++ /dev/null
@@ -1,271 +0,0 @@
-import { isArray } from 'util'
-import { exportDefault, titleCase, deepClone } from '@/utils/index'
-import ruleTrigger from './ruleTrigger'
-
-const units = {
- KB: '1024',
- MB: '1024 / 1024',
- GB: '1024 / 1024 / 1024'
-}
-let confGlobal
-const inheritAttrs = {
- file: '',
- dialog: 'inheritAttrs: false,'
-}
-
-/**
- * 组装js 【入口函数】
- * @param {Object} formConfig 整个表单配置
- * @param {String} type 生成类型,文件或弹窗等
- */
-export function makeUpJs(formConfig, type) {
- confGlobal = formConfig = deepClone(formConfig)
- const dataList = []
- const ruleList = []
- const optionsList = []
- const propsList = []
- const methodList = mixinMethod(type)
- const uploadVarList = []
- const created = []
-
- formConfig.fields.forEach(el => {
- buildAttributes(el, dataList, ruleList, optionsList, methodList, propsList, uploadVarList, created)
- })
-
- const script = buildexport(
- formConfig,
- type,
- dataList.join('\n'),
- ruleList.join('\n'),
- optionsList.join('\n'),
- uploadVarList.join('\n'),
- propsList.join('\n'),
- methodList.join('\n'),
- created.join('\n')
- )
- confGlobal = null
- return script
-}
-
-// 构建组件属性
-function buildAttributes(scheme, dataList, ruleList, optionsList, methodList, propsList, uploadVarList, created) {
- const config = scheme.__config__
- const slot = scheme.__slot__
- buildData(scheme, dataList)
- buildRules(scheme, ruleList)
-
- // 特殊处理options属性
- if (scheme.options || (slot && slot.options && slot.options.length)) {
- buildOptions(scheme, optionsList)
- if (config.dataType === 'dynamic') {
- const model = `${scheme.__vModel__}Options`
- const options = titleCase(model)
- const methodName = `get${options}`
- buildOptionMethod(methodName, model, methodList, scheme)
- callInCreated(methodName, created)
- }
- }
-
- // 处理props
- if (scheme.props && scheme.props.props) {
- buildProps(scheme, propsList)
- }
-
- // 处理el-upload的action
- if (scheme.action && config.tag === 'el-upload') {
- uploadVarList.push(
- `${scheme.__vModel__}Action: '${scheme.action}',
- ${scheme.__vModel__}fileList: [],`
- )
- methodList.push(buildBeforeUpload(scheme))
- // 非自动上传时,生成手动上传的函数
- if (!scheme['auto-upload']) {
- methodList.push(buildSubmitUpload(scheme))
- }
- }
-
- // 构建子级组件属性
- if (config.children) {
- config.children.forEach(item => {
- buildAttributes(item, dataList, ruleList, optionsList, methodList, propsList, uploadVarList, created)
- })
- }
-}
-
-// 在Created调用函数
-function callInCreated(methodName, created) {
- created.push(`this.${methodName}()`)
-}
-
-// 混入处理函数
-function mixinMethod(type) {
- const list = []; const
- minxins = {
- file: confGlobal.formBtns ? {
- submitForm: `submitForm() {
- this.$refs['${confGlobal.formRef}'].validate(valid => {
- if(!valid) return
- // TODO 提交表单
- })
- },`,
- resetForm: `resetForm() {
- this.$refs['${confGlobal.formRef}'].resetFields()
- },`
- } : null,
- dialog: {
- onOpen: 'onOpen() {},',
- onClose: `onClose() {
- this.$refs['${confGlobal.formRef}'].resetFields()
- },`,
- close: `close() {
- this.$emit('update:visible', false)
- },`,
- handelConfirm: `handelConfirm() {
- this.$refs['${confGlobal.formRef}'].validate(valid => {
- if(!valid) return
- this.close()
- })
- },`
- }
- }
-
- const methods = minxins[type]
- if (methods) {
- Object.keys(methods).forEach(key => {
- list.push(methods[key])
- })
- }
-
- return list
-}
-
-// 构建data
-function buildData(scheme, dataList) {
- const config = scheme.__config__
- if (scheme.__vModel__ === undefined) return
- const defaultValue = JSON.stringify(config.defaultValue)
- dataList.push(`${scheme.__vModel__}: ${defaultValue},`)
-}
-
-// 构建校验规则
-function buildRules(scheme, ruleList) {
- const config = scheme.__config__
- if (scheme.__vModel__ === undefined) return
- const rules = []
- if (ruleTrigger[config.tag]) {
- if (config.required) {
- const type = isArray(config.defaultValue) ? 'type: \'array\',' : ''
- let message = isArray(config.defaultValue) ? `请至少选择一个${config.label}` : scheme.placeholder
- if (message === undefined) message = `${config.label}不能为空`
- rules.push(`{ required: true, ${type} message: '${message}', trigger: '${ruleTrigger[config.tag]}' }`)
- }
- if (config.regList && isArray(config.regList)) {
- config.regList.forEach(item => {
- if (item.pattern) {
- rules.push(
- `{ pattern: ${eval(item.pattern)}, message: '${item.message}', trigger: '${ruleTrigger[config.tag]}' }`
- )
- }
- })
- }
- ruleList.push(`${scheme.__vModel__}: [${rules.join(',')}],`)
- }
-}
-
-// 构建options
-function buildOptions(scheme, optionsList) {
- if (scheme.__vModel__ === undefined) return
- // el-cascader直接有options属性,其他组件都是定义在slot中,所以有两处判断
- let { options } = scheme
- if (!options) options = scheme.__slot__.options
- if (scheme.__config__.dataType === 'dynamic') { options = [] }
- const str = `${scheme.__vModel__}Options: ${JSON.stringify(options)},`
- optionsList.push(str)
-}
-
-function buildProps(scheme, propsList) {
- const str = `${scheme.__vModel__}Props: ${JSON.stringify(scheme.props.props)},`
- propsList.push(str)
-}
-
-// el-upload的BeforeUpload
-function buildBeforeUpload(scheme) {
- const config = scheme.__config__
- const unitNum = units[config.sizeUnit]; let rightSizeCode = ''; let acceptCode = ''; const
- returnList = []
- if (config.fileSize) {
- rightSizeCode = `let isRightSize = file.size / ${unitNum} < ${config.fileSize}
- if(!isRightSize){
- this.$message.error('文件大小超过 ${config.fileSize}${config.sizeUnit}')
- }`
- returnList.push('isRightSize')
- }
- if (scheme.accept) {
- acceptCode = `let isAccept = new RegExp('${scheme.accept}').test(file.type)
- if(!isAccept){
- this.$message.error('应该选择${scheme.accept}类型的文件')
- }`
- returnList.push('isAccept')
- }
- const str = `${scheme.__vModel__}BeforeUpload(file) {
- ${rightSizeCode}
- ${acceptCode}
- return ${returnList.join('&&')}
- },`
- return returnList.length ? str : ''
-}
-
-// el-upload的submit
-function buildSubmitUpload(scheme) {
- const str = `submitUpload() {
- this.$refs['${scheme.__vModel__}'].submit()
- },`
- return str
-}
-
-function buildOptionMethod(methodName, model, methodList, scheme) {
- const config = scheme.__config__
- const str = `${methodName}() {
- // 注意:this.$axios是通过Vue.prototype.$axios = axios挂载产生的
- this.$axios({
- method: '${config.method}',
- url: '${config.url}'
- }).then(resp => {
- var { data } = resp
- this.${model} = data.${config.dataPath}
- })
- },`
- methodList.push(str)
-}
-
-// js整体拼接
-function buildexport(conf, type, data, rules, selectOptions, uploadVar, props, methods, created) {
- const str = `${exportDefault}{
- ${inheritAttrs[type]}
- components: {},
- props: [],
- data () {
- return {
- ${conf.formModel}: {
- ${data}
- },
- ${conf.formRules}: {
- ${rules}
- },
- ${uploadVar}
- ${selectOptions}
- ${props}
- }
- },
- computed: {},
- watch: {},
- created () {
- ${created}
- },
- mounted () {},
- methods: {
- ${methods}
- }
-}`
- return str
-}
diff --git a/yudao-admin-ui/src/utils/generator/render.js b/yudao-admin-ui/src/utils/generator/render.js
deleted file mode 100644
index e8640f0a2..000000000
--- a/yudao-admin-ui/src/utils/generator/render.js
+++ /dev/null
@@ -1,126 +0,0 @@
-import { makeMap } from '@/utils/index'
-
-// 参考https://github.com/vuejs/vue/blob/v2.6.10/src/platforms/web/server/util.js
-const isAttr = makeMap(
- 'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,'
- + 'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,'
- + 'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,'
- + 'name,contenteditable,contextmenu,controls,coords,data,datetime,default,'
- + 'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,'
- + 'form,formaction,headers,height,hidden,high,href,hreflang,http-equiv,'
- + 'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,'
- + 'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,'
- + 'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,'
- + 'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,'
- + 'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,'
- + 'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,'
- + 'target,title,type,usemap,value,width,wrap'
-)
-
-function vModel(self, dataObject, defaultValue) {
- dataObject.props.value = defaultValue
-
- dataObject.on.input = val => {
- self.$emit('input', val)
- }
-}
-
-const componentChild = {
- 'el-button': {
- default(h, conf, key) {
- return conf[key]
- },
- },
- 'el-input': {
- prepend(h, conf, key) {
- return {conf[key]}
- },
- append(h, conf, key) {
- return {conf[key]}
- }
- },
- 'el-select': {
- options(h, conf, key) {
- const list = []
- conf.options.forEach(item => {
- list.push()
- })
- return list
- }
- },
- 'el-radio-group': {
- options(h, conf, key) {
- const list = []
- conf.options.forEach(item => {
- if (conf.optionType === 'button') list.push({item.label})
- else list.push({item.label})
- })
- return list
- }
- },
- 'el-checkbox-group': {
- options(h, conf, key) {
- const list = []
- conf.options.forEach(item => {
- if (conf.optionType === 'button') {
- list.push({item.label})
- } else {
- list.push({item.label})
- }
- })
- return list
- }
- },
- 'el-upload': {
- 'list-type': (h, conf, key) => {
- const list = []
- if (conf['list-type'] === 'picture-card') {
- list.push()
- } else {
- list.push({conf.buttonText})
- }
- if (conf.showTip) {
- list.push(只能上传不超过 {conf.fileSize}{conf.sizeUnit} 的{conf.accept}文件
)
- }
- return list
- }
- }
-}
-
-export default {
- render(h) {
- const dataObject = {
- attrs: {},
- props: {},
- on: {},
- style: {}
- }
- const confClone = JSON.parse(JSON.stringify(this.conf))
- const children = []
-
- const childObjs = componentChild[confClone.tag]
- if (childObjs) {
- Object.keys(childObjs).forEach(key => {
- const childFunc = childObjs[key]
- if (confClone[key]) {
- children.push(childFunc(h, confClone, key))
- }
- })
- }
-
- Object.keys(confClone).forEach(key => {
- const val = confClone[key]
- if (key === 'vModel') {
- vModel(this, dataObject, confClone.defaultValue)
- } else if (dataObject[key]) {
- dataObject[key] = val
- } else if (!isAttr(key)) {
- dataObject.props[key] = val
- } else {
- dataObject.attrs[key] = val
- }
- })
- return h(this.conf.tag, dataObject, children)
- },
- props: ['conf']
-}
diff --git a/yudao-admin-ui/src/utils/generator/ruleTrigger.js b/yudao-admin-ui/src/utils/generator/ruleTrigger.js
deleted file mode 100644
index 3c161b5d0..000000000
--- a/yudao-admin-ui/src/utils/generator/ruleTrigger.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * 用于生成表单校验,指定正则规则的触发方式。
- * 未在此处声明无触发方式的组件将不生成rule!!
- */
-export default {
- 'el-input': 'blur',
- 'el-input-number': 'blur',
- 'el-select': 'change',
- 'el-radio-group': 'change',
- 'el-checkbox-group': 'change',
- 'el-cascader': 'change',
- 'el-time-picker': 'change',
- 'el-date-picker': 'change',
- 'el-rate': 'change',
- tinymce: 'blur'
-}
diff --git a/yudao-admin-ui/src/utils/generator/icon.json b/yudao-admin-ui/src/utils/icon.json
similarity index 100%
rename from yudao-admin-ui/src/utils/generator/icon.json
rename to yudao-admin-ui/src/utils/icon.json
diff --git a/yudao-admin-ui/src/utils/parser/Parser.vue b/yudao-admin-ui/src/utils/parser/Parser.vue
deleted file mode 100644
index 632371a66..000000000
--- a/yudao-admin-ui/src/utils/parser/Parser.vue
+++ /dev/null
@@ -1,188 +0,0 @@
-
diff --git a/yudao-admin-ui/src/utils/parser/README.md b/yudao-admin-ui/src/utils/parser/README.md
deleted file mode 100644
index 6239e7c3e..000000000
--- a/yudao-admin-ui/src/utils/parser/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-## form-generator JSON 解析器
->用于将form-generator导出的JSON解析成一个表单。
-
-### 安装组件
-```
-npm i form-gen-parser
-```
-或者
-```
-yarn add form-gen-parser
-```
-
-### 使用示例
-> [查看在线示例](https://mrhj.gitee.io/form-generator/#/parser)
-
-示例代码:
-> [src\components\parser\example\Index.vue](https://github.com/JakHuang/form-generator/blob/dev/src/components/parser/example/Index.vue)
-
-【add by 芋道源码】https://github.com/JakHuang/form-generator/blob/dev/src/components/parser/
\ No newline at end of file
diff --git a/yudao-admin-ui/src/utils/parser/example/Index.vue b/yudao-admin-ui/src/utils/parser/example/Index.vue
deleted file mode 100644
index d218509c2..000000000
--- a/yudao-admin-ui/src/utils/parser/example/Index.vue
+++ /dev/null
@@ -1,324 +0,0 @@
-
-
-
-
-
-
-
diff --git a/yudao-admin-ui/src/utils/parser/index.js b/yudao-admin-ui/src/utils/parser/index.js
deleted file mode 100644
index 0a44b2ccc..000000000
--- a/yudao-admin-ui/src/utils/parser/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import Parser from './Parser'
-
-export default Parser
diff --git a/yudao-admin-ui/src/utils/parser/package.json b/yudao-admin-ui/src/utils/parser/package.json
deleted file mode 100644
index ffeaba32f..000000000
--- a/yudao-admin-ui/src/utils/parser/package.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name": "form-gen-parser",
- "version": "1.0.3",
- "description": "表单json解析器",
- "main": "lib/form-gen-parser.umd.js",
- "directories": {
- "example": "example"
- },
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/JakHuang/form-generator.git"
- },
- "dependencies": {
- "form-gen-render": "^1.0.0"
- },
- "author": "jakHuang",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/JakHuang/form-generator/issues"
- },
- "homepage": "https://github.com/JakHuang/form-generator/blob/dev/src/components/parser"
-}
diff --git a/yudao-admin-ui/src/utils/render/README.md b/yudao-admin-ui/src/utils/render/README.md
deleted file mode 100644
index 14fd3aee7..000000000
--- a/yudao-admin-ui/src/utils/render/README.md
+++ /dev/null
@@ -1 +0,0 @@
-【add by 芋道源码】https://github.com/JakHuang/form-generator/blob/dev/src/components/render/
\ No newline at end of file
diff --git a/yudao-admin-ui/src/utils/render/package.json b/yudao-admin-ui/src/utils/render/package.json
deleted file mode 100644
index 96bffcfec..000000000
--- a/yudao-admin-ui/src/utils/render/package.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "form-gen-render",
- "version": "1.0.4",
- "description": "表单核心render",
- "main": "lib/form-gen-render.umd.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/JakHuang/form-generator.git"
- },
- "author": "jakhuang",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/JakHuang/form-generator/issues"
- },
- "homepage": "https://github.com/JakHuang/form-generator#readme"
-}
diff --git a/yudao-admin-ui/src/utils/render/render.js b/yudao-admin-ui/src/utils/render/render.js
deleted file mode 100644
index f3325dcdf..000000000
--- a/yudao-admin-ui/src/utils/render/render.js
+++ /dev/null
@@ -1,122 +0,0 @@
-import { deepClone } from '@/utils/index'
-
-const componentChild = {}
-/**
- * 将./slots中的文件挂载到对象componentChild上
- * 文件名为key,对应JSON配置中的__config__.tag
- * 文件内容为value,解析JSON配置中的__slot__
- */
-const slotsFiles = require.context('./slots', false, /\.js$/)
-const keys = slotsFiles.keys() || []
-keys.forEach(key => {
- const tag = key.replace(/^\.\/(.*)\.\w+$/, '$1')
- const value = slotsFiles(key).default
- componentChild[tag] = value
-})
-
-function vModel(dataObject, defaultValue) {
- dataObject.props.value = defaultValue
-
- dataObject.on.input = val => {
- this.$emit('input', val)
- }
-}
-
-function mountSlotFiles(h, confClone, children) {
- const childObjs = componentChild[confClone.__config__.tag]
- if (childObjs) {
- Object.keys(childObjs).forEach(key => {
- const childFunc = childObjs[key]
- if (confClone.__slot__ && confClone.__slot__[key]) {
- children.push(childFunc(h, confClone, key))
- }
- })
- }
-}
-
-function emitEvents(confClone) {
- ['on', 'nativeOn'].forEach(attr => {
- const eventKeyList = Object.keys(confClone[attr] || {})
- eventKeyList.forEach(key => {
- const val = confClone[attr][key]
- if (typeof val === 'string') {
- confClone[attr][key] = event => this.$emit(val, event)
- }
- })
- })
-}
-
-function buildDataObject(confClone, dataObject) {
- Object.keys(confClone).forEach(key => {
- const val = confClone[key]
- if (key === '__vModel__') {
- vModel.call(this, dataObject, confClone.__config__.defaultValue)
- } else if (dataObject[key] !== undefined) {
- if (dataObject[key] === null
- || dataObject[key] instanceof RegExp
- || ['boolean', 'string', 'number', 'function'].includes(typeof dataObject[key])) {
- dataObject[key] = val
- } else if (Array.isArray(dataObject[key])) {
- dataObject[key] = [...dataObject[key], ...val]
- } else {
- dataObject[key] = { ...dataObject[key], ...val }
- }
- } else {
- dataObject.attrs[key] = val
- }
- })
-
- // 清理属性
- clearAttrs(dataObject)
-}
-
-function clearAttrs(dataObject) {
- delete dataObject.attrs.__config__
- delete dataObject.attrs.__slot__
- delete dataObject.attrs.__methods__
-}
-
-function makeDataObject() {
- // 深入数据对象:
- // https://cn.vuejs.org/v2/guide/render-function.html#%E6%B7%B1%E5%85%A5%E6%95%B0%E6%8D%AE%E5%AF%B9%E8%B1%A1
- return {
- class: {},
- attrs: {},
- props: {},
- domProps: {},
- nativeOn: {},
- on: {},
- style: {},
- directives: [],
- scopedSlots: {},
- slot: null,
- key: null,
- ref: null,
- refInFor: true
- }
-}
-
-export default {
- props: {
- conf: {
- type: Object,
- required: true
- }
- },
- render(h) {
- const dataObject = makeDataObject()
- const confClone = deepClone(this.conf)
- const children = this.$slots.default || []
-
- // 如果slots文件夹存在与当前tag同名的文件,则执行文件中的代码
- mountSlotFiles.call(this, h, confClone, children)
-
- // 将字符串类型的事件,发送为消息
- emitEvents.call(this, confClone)
-
- // 将json表单配置转化为vue render可以识别的 “数据对象(dataObject)”
- buildDataObject.call(this, confClone, dataObject)
-
- return h(this.conf.__config__.tag, dataObject, children)
- }
-}
diff --git a/yudao-admin-ui/src/utils/render/slots/el-button.js b/yudao-admin-ui/src/utils/render/slots/el-button.js
deleted file mode 100644
index a2d9684eb..000000000
--- a/yudao-admin-ui/src/utils/render/slots/el-button.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export default {
- default(h, conf, key) {
- return conf.__slot__[key]
- }
-}
diff --git a/yudao-admin-ui/src/utils/render/slots/el-checkbox-group.js b/yudao-admin-ui/src/utils/render/slots/el-checkbox-group.js
deleted file mode 100644
index 0a85c8e75..000000000
--- a/yudao-admin-ui/src/utils/render/slots/el-checkbox-group.js
+++ /dev/null
@@ -1,13 +0,0 @@
-export default {
- options(h, conf, key) {
- const list = []
- conf.__slot__.options.forEach(item => {
- if (conf.__config__.optionType === 'button') {
- list.push({item.label})
- } else {
- list.push({item.label})
- }
- })
- return list
- }
-}
diff --git a/yudao-admin-ui/src/utils/render/slots/el-input.js b/yudao-admin-ui/src/utils/render/slots/el-input.js
deleted file mode 100644
index 8bd02db2a..000000000
--- a/yudao-admin-ui/src/utils/render/slots/el-input.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export default {
- prepend(h, conf, key) {
- return {conf.__slot__[key]}
- },
- append(h, conf, key) {
- return {conf.__slot__[key]}
- }
-}
diff --git a/yudao-admin-ui/src/utils/render/slots/el-radio-group.js b/yudao-admin-ui/src/utils/render/slots/el-radio-group.js
deleted file mode 100644
index c78506f9a..000000000
--- a/yudao-admin-ui/src/utils/render/slots/el-radio-group.js
+++ /dev/null
@@ -1,13 +0,0 @@
-export default {
- options(h, conf, key) {
- const list = []
- conf.__slot__.options.forEach(item => {
- if (conf.__config__.optionType === 'button') {
- list.push({item.label})
- } else {
- list.push({item.label})
- }
- })
- return list
- }
-}
diff --git a/yudao-admin-ui/src/utils/render/slots/el-select.js b/yudao-admin-ui/src/utils/render/slots/el-select.js
deleted file mode 100644
index cbf4a2030..000000000
--- a/yudao-admin-ui/src/utils/render/slots/el-select.js
+++ /dev/null
@@ -1,9 +0,0 @@
-export default {
- options(h, conf, key) {
- const list = []
- conf.__slot__.options.forEach(item => {
- list.push()
- })
- return list
- }
-}
diff --git a/yudao-admin-ui/src/utils/render/slots/el-upload.js b/yudao-admin-ui/src/utils/render/slots/el-upload.js
deleted file mode 100644
index 8ce3c351c..000000000
--- a/yudao-admin-ui/src/utils/render/slots/el-upload.js
+++ /dev/null
@@ -1,17 +0,0 @@
-export default {
- 'list-type': (h, conf, key) => {
- const list = []
- const config = conf.__config__
- if (conf['list-type'] === 'picture-card') {
- list.push()
- } else {
- list.push({config.buttonText})
- }
- if (config.showTip) {
- list.push(
- 只能上传不超过 {config.fileSize}{config.sizeUnit} 的{conf.accept}文件
- )
- }
- return list
- }
-}
diff --git a/yudao-admin-ui/src/views/bpm/form/formEditor.vue b/yudao-admin-ui/src/views/bpm/form/formEditor.vue
index d5bca71c3..d59d0069d 100644
--- a/yudao-admin-ui/src/views/bpm/form/formEditor.vue
+++ b/yudao-admin-ui/src/views/bpm/form/formEditor.vue
@@ -150,7 +150,7 @@ import JsonDrawer from '@/views/tool/build/JsonDrawer'
import RightPanel from '@/views/tool/build/RightPanel'
import {
inputComponents, selectComponents, layoutComponents, formConf
-} from '@/utils/generator/config'
+} from '@/components/generator/config'
import {
exportDefault, beautifierConf, isNumberStr, titleCase, deepClone, isObjectObject
} from '@/utils/index'
diff --git a/yudao-admin-ui/src/views/bpm/form/index.vue b/yudao-admin-ui/src/views/bpm/form/index.vue
index 28ac09e15..ba4a8ecce 100644
--- a/yudao-admin-ui/src/views/bpm/form/index.vue
+++ b/yudao-admin-ui/src/views/bpm/form/index.vue
@@ -62,7 +62,7 @@