迟钝还不懂

activiti-modeler在线流程设计器无法显示TypeError: Cannot read property 'split' of undefined

左边的工具栏是在stencil-controller.js中获取的,右侧和顶部是在oryx.debug.js里获取的两个地方,不知道是什么原因造成了这个错误

TypeError: Cannot read property 'split' of undefined
    at Object.ORYX.Core.StencilSet.stencilSet (oryx.debug.js:8640)
    at oryx.debug.js:8619
    at prototype-1.5.1.js:446
    at Array.Object.extend._each (prototype-1.5.1.js:672)
    at Array.Enumerable.each (prototype-1.5.1.js:445)
    at Object.ORYX.Core.StencilSet.stencilSets (oryx.debug.js:8618)
    at ORYX.Editor.getStencilSets (oryx.debug.js:11705)
    at ORYX.Editor._createCanvas (oryx.debug.js:11192)
    at ORYX.Editor.construct (oryx.debug.js:10921)
    at classDef (oryx.debug.js:1747)(anonymous function) @ angular.min.js:85a.$get @ angular.min.js:63l.promise.then.B @ angular.min.js:94l.promise.then.B @ angular.min.js:94(anonymous function) @ angular.min.js:95a.$get.h.$eval @ angular.min.js:103a.$get.h.$digest @ angular.min.js:101a.$get.h.$apply @ angular.min.js:104g @ angular.min.js:68I @ angular.min.js:72y.onreadystatechange @ angular.min.js:73
本来应该传回到JS页面的直接是json字符串,然后他调用eval("this._jsonObject =" + response.responseText);直接转换成json对象,但是我获取到的却是带转义字符的json字符串
所以程序中默认使用的eval("this._jsonObject =" + response.responseText)没给转换成json对象,给转成了json字符串,造成了里面的任何属性都获取不到是undefined,需要再转换一次才能变成json对象,造成里面所有的属性都取不到,困扰了2天了终于解决了(估计可能是少了哪个包也不知道是哪个环节出错了,但是后台不报错,网上也看到一些朋友遇到这问题也是使用了shiro,但是应该不是shiro的问题,我估计可能是activiti-json-converter-5.19.0.jar包有什么依赖包,我没有导入,导致在读取stencilset.json时,里面的转义字符也被返回成字符串到前台没有做处理,内部应该有处理的
 
具体修改如下:
左边的工具栏是在stencil-controller.js中获取的
在72行左右添加,data就是后台返回的带有转义字符的json字符串,由于这里的是带有转义字符的完全没有转换的,因此需要转换两次,第一次转换为json字符串,第二次转换为json对象
 
 
右侧和顶部是在oryx.debug.js中获取的
在8495行左右
添加转换为json对象

 

 

暂时只能这样处理,如果有更好的方式找到在返回页面json字符串时内部是如何处理的,希望能告知一下~

posted on 2016-10-25 17:52  迟钝还不懂  阅读(18711)  评论(3编辑  收藏  举报

导航