泛微E9-附件支持拖拽上传

📅 2026/7/30 20:21:13
泛微E9-附件支持拖拽上传
采用Ecode开发复写组件方式实现index.jsconst{WeaUpload}ecCom;classNewWeaUploadextendsReact.Component{hash${newDate().getTime()}_${Math.ceil(Math.random()*100000)};render(){const{uploadId}this.props;constdrop_elementweaUploadDragDrop_${uploadId}_${this.hash};constnewProps{...this.props,customOptions:{...this.props.customOptions,drop_element,}};//复写组件的时候必须带上_noOverwrite参数避免被复写的组件又被复写导致死循环return(div id{drop_element}style{{width:100%}}WeaUpload{...newProps}_noOverwrite{true}//div)}}//发布模块ecodeSDK.setCom(${appId},NewWeaUpload,NewWeaUpload);register.jsconstNewWeaUpload(props,Com){//此函数不允许写在复写方法内会导致实例重复创建也就是dimout不断执行constacParams{appId:${appId},//appId会自动识别name:NewWeaUpload,//模块名称isPage:false,//是否是路由页面noCss:true,//是否禁止单独加载css通常为了减少css数量css默认前置加载props,}constNewComCom;returnwindow.ecCom?ecodeSDK.getAsyncCom(acParams):(NewCom{...props}/);}ecodeSDK.overwriteClassFnQueueMapSet(WeaUpload,{fn:(Com,newProps){if(!window.location.hash.startsWith(#/main/workflow/req))return;newProps.dragUploadtrueif(newProps._noOverwrite||!newProps.uploadId||!newProps.fieldid||!newProps.category||!newProps.showUpload||newProps.viewAttr1)return;return{com:NewWeaUpload.bind(this,newProps,Com),props:newProps};}});