ecodeSDK.rewriteApiParamsQueueSet({
fn: (url, method, params) => {
if(window.location.href.indexOf('/spa/document/index.jsp') > -1){
if(window.location.href.indexOf('secid') > -1 || window.location.href.indexOf('isEdit=1') > -1){
if (url.indexOf('/api/doc/save/save') >= 0) { // 判断需要拦截的接口
if(window.draggabledata){
params.fileids = window.draggabledata
}
}
}
}
// 不是需要拦截的接口返回默认的参数
return {
url: url, // 接口路径
method: method, // 请求类型
params: params // 请求参数
}
},
desc: '复写PC端接口传参',
});
ecodeSDK.rewriteApiDataQueueSet({
fn: (url, params, datas) => {
if(window.location.href.indexOf('/spa/document/index.jsp') > -1){
if(window.location.href.indexOf('isEdit=1') > -1){
if (url.indexOf('/api/doc/save/save') >= 0) { // 判断需要拦截的接口
const { WeaTools } = ecCom;
if(window.draggabledata){
let draggabledata = window.draggabledata.split(',');
let filedata = []
draggabledata.map((item,index)=>{
filedata.push({fileid:item,px:index+1})
})
WeaTools.callApi('/api/doc/detail/web/updatecust', 'POST', { custpxs: JSON.stringify(filedata) }).then((result) => {
})
}
return datas;
}
}
}
return datas;
}
})
let enable = true;
const NewTable = (props)=>{ //此函数不允许写在复写方法内,会导致实例重复创建,也就是dimout不断执行
const acParams = {
appId:'${appId}', //appId会自动识别
name:'NewTableCom', //模块名称
isPage:false, //是否是路由页面
noCss:true, //是否禁止单独加载css,通常为了减少css数量,css默认前置加载
props
}
const NewCom = props.Com;
return window.comsMobx?ecodeSDK.getAsyncCom(acParams):(<NewCom {...props} />);
}
ecodeSDK.overwriteClassFnQueueMapSet('Table',{
fn:(Com,newProps)=>{
if(!enable) return ; //总开关
if(window.location.href.indexOf('/spa/document/index.jsp') > -1){
if(window.location.href.indexOf('secid') > -1 || window.location.href.indexOf('isEdit=1') > -1){
//并且判断组件是否允许不能复写,如果不能复写,直接返回空
if(newProps._noOverwrite) return ;
newProps.Com = Com; //如果需要原组件,可带上
return {
com:NewTable,
props:newProps
};
}
}
}
});
E9:知识文档页面多附件自由拖动排序(ECODE)
于 2022-11-21 15:09:59 首次发布