[前端][fmui] 工作流控件多出历史记录条数

问题现象

在三方app中,fmui页面流程处理页面操作完成后不能正常返回页面

示例知识库1open in new window

示例知识库2open in new window

知识库地址3open in new window

问题原因

原因一:页面初始化时动态加载iframe会新增一条历史记录

原因二:工作流控件初始化加载会往插入历史记录,由于APP每次朓转页面返回到工作流页面都会触发页面刷新,所以历史记录条数会多于正常条数

解决方案

原因一:

处理方案一:使用 iframe.contentWindow.location.replace 进行iframe页面加载

var iframe = document.getElementById("iframeId");

iframe.contentWindow.location.replace(iframeUrl)

处理方案二:个性化handlecontrols.js中getDataFromWorkflow方法。

getDataFromWorkflow: function (result) {
    var self = this;

    var cb = function () {
        window.history.go(-1);
        setTimeout(function () {
            if (location.hash == '#workflow') {
                cb();
            } else {
                if (result && result.resultData.message) {
                    self.ShowTdOperate(false);
                    self.DefaultOperateHd(result.resultData.message);
                } else {
                    self.ShowTdOperate(true);
                }
            }
        }, 100);
    };

    cb();
},

原因二:

处理方案:个性化handlecontrols.js中_init方法。在初始化加载时添加判断防止重复插入历史记录

if (
    self.notWorkflow == '0' &&
    (!window.history.state || (window.history.state && window.history.state.title !== 'lockhash'))
) {
    self.insertHistory('lockhash', '#lockhash');
}
最后更新时间::
贡献者: wyanqd