4.1 同步发版内容到天梯
This commit is contained in:
104
public/ntko.js
104
public/ntko.js
@ -3,32 +3,43 @@
|
||||
//初始化去打开文档
|
||||
function init(readonly, DocfileCode) {
|
||||
ntko = document.getElementById("TANGER_OCX");
|
||||
ntko.Menubar = false;//隐藏窗体左上侧文件菜单
|
||||
ntko.TitleBar=false;//隐藏窗体左上图标
|
||||
ntko.Menubar = false;//隐藏窗体左上侧文件菜单
|
||||
ntko.TitleBar = false;//隐藏窗体左上图标
|
||||
$.ajax({
|
||||
url: "/api/core-service-ebtp-updownload/v1/attachment/find/bid/" + DocfileCode,
|
||||
type: "get",
|
||||
dataType: 'json',
|
||||
traditional: true,
|
||||
url: "/api/doc/v1.0/files/queryReturn",
|
||||
type: "POST",
|
||||
contentType: "application/json;charset=UTF-8",
|
||||
data: JSON.stringify([DocfileCode]),
|
||||
success: function (result) {
|
||||
if (window.navigator.platform == "Win64") {
|
||||
ntko.AddDocTypePlugin(".pdf", "PDF.NtkoDocument", "4.0.2.0", "officecontrol/ntkooledocallx64.cab", 51, true);
|
||||
} else {
|
||||
ntko.AddDocTypePlugin(".pdf", "PDF.NtkoDocument", "4.0.2.0", "officecontrol/ntkooledocall.cab", 51, true);//版增加对于PDF文件的支持
|
||||
}
|
||||
if (result.length > 0) {
|
||||
ntko.BeginOpenFromURL("/api/core-service-ebtp-updownload/v1/attachment/download/bid/" + DocfileCode);
|
||||
if (result.success) {
|
||||
if (result.data.length > 0) {
|
||||
$.ajax({
|
||||
url: "/api/doc/api/data-service-document-center/outer/v1.0/files/getSecretKey?fileId=" + result.data[0].fileId,//获取密钥
|
||||
type: "GET",
|
||||
contentType: "application/json;charset=UTF-8",
|
||||
success: function (response) {
|
||||
ntko.BeginOpenFromURL("/api/doc/api/data-service-document-center/outer/v1.0/files/getDownload?fileId=" + result.data[0].fileId + "&documentSecretKey=" + response.data);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ntko.CreateNew("Word.Document");
|
||||
}
|
||||
} else {
|
||||
ntko.CreateNew("Word.Document");
|
||||
alert(JSON.stringify(result));
|
||||
}
|
||||
/*展示保存按钮*/
|
||||
if (readonly == "false") {
|
||||
$("#saveBTN").show();
|
||||
}
|
||||
ntko.Menubar = true;//展示窗体左上侧文件菜单
|
||||
ntko.Menubar = true;//展示窗体左上侧文件菜单
|
||||
ntko.IsUseOfficeConvertDocToPDF = true;
|
||||
ntko.CustomToolBar=false;
|
||||
ntko.FileSave=false;
|
||||
ntko.CustomToolBar = false;
|
||||
ntko.FileSave = false;
|
||||
},
|
||||
error: function () {
|
||||
alert("请求文档中心失败,请您关闭当前编辑器,重新打开。")
|
||||
@ -36,6 +47,75 @@ function init(readonly, DocfileCode) {
|
||||
});
|
||||
|
||||
}
|
||||
//通用上传
|
||||
function ntkoUpload(type, objectId, fileName) {
|
||||
if (objectId !== null && objectId !== void 0 && objectId !== "") {
|
||||
var path = "/api/doc/v1.0/files/upload";
|
||||
var fileUploadName = "multipartFiles";
|
||||
var params = "appCode=ebtp-cloud-frontend&objectId=" + objectId;
|
||||
var msg
|
||||
$.ajax({
|
||||
url: "/api/doc/v1.0/files/queryReturn",
|
||||
type: "POST",
|
||||
async: false,
|
||||
contentType: "application/json;charset=UTF-8",
|
||||
data: JSON.stringify([objectId]),
|
||||
success: function (result) {
|
||||
if (result.success) {
|
||||
if (result.data.length > 0) {
|
||||
for (let i = 0; i < result.data.length; i++) {
|
||||
const ele = result.data[i];
|
||||
$.ajax({
|
||||
url: "/api/doc/v1.0/files/disk" + "?fileId=" + ele.fileId,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
}
|
||||
}
|
||||
if (type == "Doc") {
|
||||
msg = ntko.SaveToURL(path, fileUploadName, params, fileName, "");
|
||||
} else if (type == "HTML") {
|
||||
msg = ntko.PublishAsHTMLToURL(path, fileUploadName, params, fileName, "");
|
||||
} else if (type == "PDF") {
|
||||
msg = ntko.PublishAsPDFToURL(path, fileUploadName, params, fileName, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
//修改文件名
|
||||
function ntkoUpdateFile(objectId, fileName) {
|
||||
if (objectId !== null && objectId !== void 0 && objectId !== "") {
|
||||
var msg;
|
||||
$.ajax({
|
||||
url: "/api/doc/v1.0/files/queryReturn",
|
||||
type: "POST",
|
||||
async: false,
|
||||
contentType: "application/json;charset=UTF-8",
|
||||
data: JSON.stringify([objectId]),
|
||||
success: function (result) {
|
||||
if (result.success) {
|
||||
if (result.data.length > 0) {
|
||||
$.ajax({
|
||||
url: "/api/doc/v1.0/files/update",
|
||||
type: "POST",
|
||||
async: false,
|
||||
contentType: "application/json;charset=UTF-8",
|
||||
dataType: "json",
|
||||
data: JSON.stringify([{ fileId: result.data[result.data.length - 1].fileId, originalName: fileName }]),
|
||||
success: function (response) {
|
||||
msg = response.success;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user