|
楼主 |
发表于 2017-10-19 17:36:20
|
显示全部楼层
前台的错误,没找到具体错误信息。我再看看,这个前台取值出现undefined了,我跟踪看看,代码和组件id基本我都按这个做的
var data = this.comp("mainData");
var jsfa=data.val('JSFA');
var jsonList = eval("(" + jsfa + ")");// 获取附件组件的json值
var url = "";
var type = "";
if (jsonList.length > 0) {// 遍历json获取相关的信息
for (var i = 0; i < jsonList.length; i++) {
var docPath = jsonList[0]["docPath"];
var fileID = jsonList[0]["fileID"];
var docName = jsonList[0]["docName"];
url = DocUtils.InnerUtils.getdocServerAction({
"docPath" : docPath,
urlPattern : "/repository/file/view/" + fileID + "/last/content",
isFormAction : false,
context : this.getContext(),
useCookie : false
});// 调用API获取url
url = url.indexOf(window.location.protocol) < 1 ? url : window.location.protocol + "//" + window.location.host + url var fileType = docName.substring(docName.indexOf(".")); if (fileType == ".doc" || fileType == ".docx") type = "Word.Application"; else if (fileType == ".xls" || fileType == ".xlsx") type = "Excel.Application" } } var divID = this.getIDByXID("officeViewer"); var ocxID = divID + "_ocx"; if (!$(".officeViewr").length > 0) {
$("#" + divID).append('<div class="officeViewr" style="overflow:hidden;width:100%;height:100%;"><div style="overflow:auto;width:100%;height:100%;" id="' + ocxID + '"></div></div>');
}
$('#' + ocxID).attr('showToolbar', false);// 隐藏工具栏
$OV(ocxID).CreateOfficeViewer('100%', '100%');
var officeObj = $OV(ocxID);
officeObj.ShowMenubar(false);// 隐藏菜单栏
if (type && !officeObj.isOpened()) {
officeObj.Open(url, type);
}
|
|