diff --git a/src/components/DesignForm/assembly/index.ts b/src/components/DesignForm/assembly/index.ts index 1b366821f..3df9c5c6c 100644 --- a/src/components/DesignForm/assembly/index.ts +++ b/src/components/DesignForm/assembly/index.ts @@ -438,10 +438,11 @@ const selectOption: any = [ component: '' // 根据template注入的组件*/ }, { + type: 'upload', label: '图片/文件', icon: 'image', - iconFont: 'fa-photo', + iconFont: 'fa-file-image-o', control: { modelValue: '' // 也可以是[{name:'',url:''}]形式 }, @@ -451,6 +452,7 @@ const selectOption: any = [ labelStyle:{}, inputStyle:{} } + }, { type: 'tinymce', @@ -522,13 +524,74 @@ const selectOption: any = [ interval:2000, } }, + config: {}, styles:{ divStyle:{}, labelStyle:{}, inputStyle:{} } - } + }, + { + type: 'lowcodeTransfer', + label: '穿梭框', + icon: '', + iconFont: 'fa-arrows-h', + control: { + modelValue: '', + fixedOptions: [{ + id: 'thefirstrootnode', + label: '根节点1', + disabled: false, + children: [] + }, + { + id: 'thesecondrootnode', + label: '根节点2', + disabled: false, + children: [] + }] + }, + config: { + transferName:'穿梭框', + transferDataSource:'固定选项', + apiUrl:'/javasys/lowCode/transfer/getOrgAndManTree', + method:'post', + } + }, + { + type: 'lowcodeImage', + label: '图片', + icon: '', + iconFont: 'fa-photo', + control: { + modelValue: '', + uploadFlag:false, + imgId:'', + imgUrl: '', + link: '', + fit:1, + radius:false, + radiusNum:5, + boderAndShadow:false, + showMode:'自定义像素值', + pxWidth:448, + pxHeight:252, + widthPercent:90, + heightPercent:90, + mt:0, + mb:0, + ml:0, + mr:0, + pt:0, + pb:0, + pl:0, + pr:0, + floatFlag:false, + floatValue:'left', + }, + config: {} + }, ] }, { diff --git a/src/components/DesignForm/formControlAttr.vue b/src/components/DesignForm/formControlAttr.vue index 4017f024a..1212eed6a 100644 --- a/src/components/DesignForm/formControlAttr.vue +++ b/src/components/DesignForm/formControlAttr.vue @@ -21,9 +21,11 @@ import { uploadUrl } from '@/api/DesignForm' import { UploadFilled } from '@element-plus/icons-vue' import { UploadFile, UploadFiles } from 'element-plus/es/components/upload/src/upload'; - + import type Node from 'element-plus/es/components/tree/src/model/node' //样式布局 import LayoutPage from '@/components/DesignForm/layoutPage/index.vue' + + import { Plus } from '@element-plus/icons-vue' const props = withDefaults( //接收父级参数 @@ -970,6 +972,7 @@ const newVal = obj.isNum ? formatNumber(val) : val // 类型为数字时转整数 obj.path && getPropByPath(controlData.value, obj.path, newVal) } + } /** * 获取非负整数随机数 @@ -1522,6 +1525,7 @@ { label: '每行三列', value: 'form-row-3' }, { label: '每行四列', value: 'form-row-4' } ] + const layouytStyle = reactive(controlData.value.styles) watch(()=>layouytStyle,(val : any)=>{ @@ -1547,6 +1551,35 @@ } return false; } +/** +@ 作者: 秦东 +@ 时间: 2024-03-18 11:42:52 +@ 功能: 上传图标相关 +*/ +const imgUploadApiUrl = import.meta.env.VITE_APP_BASE_API+"/api/upordown" //上传地址 +const handleAvatarSuccess: UploadProps['onSuccess'] = ( + response, + uploadFile +) => { +// imageUrl.value = URL.createObjectURL(uploadFile.raw!) +formConfig.value.imageUrl = response.data.url +} + +const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile) => { + console.log("beforeAvatarUpload",rawFile.type) + if (rawFile.type !== 'image/jpeg' && rawFile.type !== 'image/jpg' && rawFile.type !== 'image/png' && rawFile.type !== 'image/gif' && rawFile.type !== 'image/icon') { + ElMessage.error('请上传以下格式的图片(jpg、jpeg、png、gif、icon)!'+rawFile.type) + return false + } else if (rawFile.size / 1024 / 1024 > 2) { + ElMessage.error('图片大小不要大于 2MB!') + return false + } + return true +} + + + +