diff --git a/src/components/generator/config.js b/src/components/generator/config.js index 5b92aa1..1d1898a 100644 --- a/src/components/generator/config.js +++ b/src/components/generator/config.js @@ -22,6 +22,8 @@ export const inputComponents = [ // 组件的自定义配置 typeId: 'INPUT', __config__: { + name: 'input', + moduleType: 'input', label: '单行文本', labelWidth: null, showLabel: true, @@ -55,6 +57,8 @@ export const inputComponents = [ { typeId: 'TEXTAREA', __config__: { + name: 'textarea', + moduleType: 'input', label: '多行文本', labelWidth: null, showLabel: true, @@ -83,6 +87,8 @@ export const inputComponents = [ { typeId: 'NUMBER_INPUT', __config__: { + name: 'number', + moduleType: 'input', label: '计数器', showLabel: true, changeTag: true, @@ -112,6 +118,8 @@ export const selectComponents = [ { typeId: 'SELECT', __config__: { + name: 'select', + moduleType: 'choose', label: '下拉选择', showLabel: true, labelWidth: null, @@ -143,6 +151,8 @@ export const selectComponents = [ { typeId: 'CASCADER', __config__: { + name: 'cascader', + moduleType: 'choose', label: '级联选择', url: 'https://www.fastmock.site/mock/f8d7a54fb1e60561e2f720d5a810009d/fg/cascaderList', method: 'get', @@ -189,6 +199,8 @@ export const selectComponents = [ { typeId: 'RADIO', __config__: { + name: 'radio', + moduleType: 'choose', label: '单选框组', labelWidth: null, showLabel: true, @@ -221,6 +233,8 @@ export const selectComponents = [ { typeId: 'CHECKBOX', __config__: { + name: 'checkbox', + moduleType: 'choose', label: '多选框组', tag: 'el-checkbox-group', tagIcon: 'checkbox', @@ -255,6 +269,8 @@ export const selectComponents = [ { typeId: 'SWITCH', __config__: { + name: 'switch', + moduleType: 'choose', label: '开关', tag: 'el-switch', tagIcon: 'switch', @@ -284,6 +300,8 @@ export const selectComponents = [ { typeId: 'SLIDER', __config__: { + name: 'slider', + moduleType: 'choose', label: '滑块', tag: 'el-slider', tagIcon: 'slider', @@ -308,6 +326,8 @@ export const selectComponents = [ { typeId: 'TIME', __config__: { + name: 'time', + moduleType: 'choose', label: '时间选择', tag: 'el-time-picker', tagIcon: 'time', @@ -335,6 +355,8 @@ export const selectComponents = [ { typeId: 'TIME_RANGE', __config__: { + name: 'timeRange', + moduleType: 'choose', label: '时间范围', tag: 'el-time-picker', tagIcon: 'time-range', @@ -361,6 +383,8 @@ export const selectComponents = [ { typeId: 'DATE', __config__: { + name: 'date', + moduleType: 'choose', label: '日期选择', tag: 'el-date-picker', tagIcon: 'date', @@ -386,6 +410,8 @@ export const selectComponents = [ { typeId: 'DATE_RANGE', __config__: { + name: 'dateRange', + moduleType: 'choose', label: '日期范围', tag: 'el-date-picker', tagIcon: 'date-range', @@ -414,6 +440,8 @@ export const selectComponents = [ { typeId: 'RATE', __config__: { + name: 'rate', + moduleType: 'choose', label: '评分', tag: 'el-rate', tagIcon: 'rate', @@ -439,6 +467,8 @@ export const selectComponents = [ { typeId: 'COLOR', __config__: { + name: 'color', + moduleType: 'choose', label: '颜色选择', tag: 'el-color-picker', tagIcon: 'color', @@ -461,6 +491,8 @@ export const selectComponents = [ { typeId: 'UPLOAD', __config__: { + name: 'upload', + moduleType: 'choose', label: '上传', tag: 'el-upload', tagIcon: 'upload', @@ -498,6 +530,8 @@ export const imageComponents = [ { typeId: 'IMAGE', __config__: { + name: 'image', + moduleType: 'image', label: '图片展示', showLabel: false, displayType: true, @@ -525,6 +559,8 @@ export const imageComponents = [ { typeId: 'IMAGE_CAROUSEL', __config__: { + name: 'imageCarousel', + moduleType: 'image', label: '图片轮播', showLabel: false, displayType: true, @@ -553,6 +589,8 @@ export const imageComponents = [ { typeId: 'IMAGE_SELECT', __config__: { + name: 'imageSelect', + moduleType: 'image', label: '图片选择', showLabel: true, labelWidth: null, @@ -583,6 +621,8 @@ export const assistComponents = [ { typeId: 'DESC_TEXT', __config__: { + name: 'descText', + moduleType: 'assist', label: '文字描述', defaultValue: '描述文字', displayType: true, @@ -605,6 +645,8 @@ export const assistComponents = [ { typeId: 'DIVIDER', __config__: { + name: 'divider', + moduleType: 'assist', label: '分割线', defaultValue: '', displayType: true, @@ -628,6 +670,8 @@ export const assistComponents = [ { typeId: 'SIGN_PAD', __config__: { + name: 'signPad', + moduleType: 'assist', label: '手写签名', defaultValue: '', showLabel: true, @@ -650,6 +694,8 @@ export const assistComponents = [ { typeId: 'PAGINATION', __config__: { + name: 'page', + moduleType: 'assist', label: '分页', defaultValue: '分页', displayType: true, @@ -680,6 +726,8 @@ export const personalInfoComponents = [ { typeId: 'INPUT', __config__: { + name: 'phone', + moduleType: 'concat', label: '手机号', labelWidth: null, showLabel: true, @@ -716,6 +764,8 @@ export const personalInfoComponents = [ { typeId: 'INPUT', __config__: { + name: 'email', + moduleType: 'concat', label: '邮箱', labelWidth: null, showLabel: true, @@ -752,6 +802,8 @@ export const personalInfoComponents = [ { typeId: 'INPUT', __config__: { + name: 'idCard', + moduleType: 'concat', label: '身份证', labelWidth: null, showLabel: true, @@ -788,6 +840,8 @@ export const personalInfoComponents = [ { typeId: 'PROVINCE_CITY', __config__: { + name: 'provinceCity', + moduleType: 'concat', label: '省市联动', labelWidth: null, showLabel: true, @@ -808,6 +862,8 @@ export const personalInfoComponents = [ { typeId: 'INPUT_MAP', __config__: { + name: 'location', + moduleType: 'concat', label: '地理位置', labelWidth: null, showLabel: true, diff --git a/src/utils/convert.js b/src/utils/convert.js index 4973d88..4c36c6c 100644 --- a/src/utils/convert.js +++ b/src/utils/convert.js @@ -17,6 +17,8 @@ import { */ export function formItemConvertData(item, projectKey) { let data = { + 'itemKey': item.__config__.name, + 'moduleType': item.__config__.moduleType, 'type': item.typeId, 'formItemId': item.__config__.formId, 'label': item.__config__.label, @@ -72,6 +74,8 @@ export function dbDataConvertForItemJson(data) { jsonItem.sort = data.sort jsonItem.typeId = data.type jsonItem.displayType = data.displayType + jsonItem.__config__.name = data.itemKey + jsonItem.__config__.moduleType = data.moduleType jsonItem.__config__.span = data.span jsonItem.__config__.formId = data.formItemId jsonItem.__config__.label = data.label