wps功能代码提交
This commit is contained in:
parent
2ffcd1f860
commit
6c21801238
@ -136,32 +136,15 @@ public class WordUtilXWPF {
|
|||||||
// String filePath =
|
// String filePath =
|
||||||
// "/Users/jiuyabai/Desktop/yili项目/制度样例1—伊利集团流程制度类文件管理规范1.docx";
|
// "/Users/jiuyabai/Desktop/yili项目/制度样例1—伊利集团流程制度类文件管理规范1.docx";
|
||||||
try {
|
try {
|
||||||
// file = new File(filePath);
|
|
||||||
elements.clear();
|
elements.clear();
|
||||||
String path = dcContextpdf.getPath();
|
if(fileName.contains(".xml") || !fileName.contains(".docx")) {
|
||||||
// String filePath = "D:/制度样例1—伊利集团流程制度类文件管理规范2.xml"; //创建实例,加载xml测试文档
|
String path = dcContextpdf.getPath();
|
||||||
Document docs = new Document();
|
// String filePath = "D:/制度样例1—伊利集团流程制度类文件管理规范2.xml"; //创建实例,加载xml测试文档
|
||||||
docs.loadFromFile(path + fileName);
|
Document docs = new Document();
|
||||||
|
docs.loadFromFile(path + fileName);
|
||||||
// 保存为Docx格式
|
// 保存为Docx格式
|
||||||
|
docs.saveToFile(path + name + ".docx", FileFormat.Docx);
|
||||||
docs.saveToFile(path + name + ".docx", FileFormat.Docx);
|
}
|
||||||
|
|
||||||
File f = new File(path + fileName);
|
|
||||||
|
|
||||||
InputStream in = new FileInputStream(f);
|
|
||||||
|
|
||||||
byte b[] = new byte[(int) f.length()]; // 创建合适文件大小的数组
|
|
||||||
|
|
||||||
in.read(b); // 读取文件中的内容到b[]数组
|
|
||||||
|
|
||||||
in.close();
|
|
||||||
|
|
||||||
// System.out.println(new String(b));
|
|
||||||
|
|
||||||
// 保存为Doc格式 //docs.saveToFile("toDoc.doc",FileFormat.Doc);
|
|
||||||
|
|
||||||
//
|
|
||||||
DCPluginProfile dcProfilepdfdoc = DCProfileManager.getDCProfile("com.actionsoft.apps.coe.pal.datamigration",
|
DCPluginProfile dcProfilepdfdoc = DCProfileManager.getDCProfile("com.actionsoft.apps.coe.pal.datamigration",
|
||||||
"migration");
|
"migration");
|
||||||
DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc,
|
DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc,
|
||||||
|
|||||||
@ -343,6 +343,7 @@
|
|||||||
|
|
||||||
var pid = "<#parentChartId>";
|
var pid = "<#parentChartId>";
|
||||||
var teamId = "<#teamId>";
|
var teamId = "<#teamId>";
|
||||||
|
var jssdk;
|
||||||
</script>
|
</script>
|
||||||
<!--工具js-->
|
<!--工具js-->
|
||||||
<script type='text/javascript' charset='UTF-8' src='../apps/com.actionsoft.apps.coe.pal/lib/designer/extend/js/util/map.js'></script>
|
<script type='text/javascript' charset='UTF-8' src='../apps/com.actionsoft.apps.coe.pal/lib/designer/extend/js/util/map.js'></script>
|
||||||
@ -411,7 +412,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<script src="../commons/js/web-office-sdk-v1.1.19.umd.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function initCustomHelpToolExtMenuUrl() {
|
function initCustomHelpToolExtMenuUrl() {
|
||||||
@ -491,9 +492,10 @@
|
|||||||
//执行切换显示按钮
|
//执行切换显示按钮
|
||||||
switchWpsDisplay(true);
|
switchWpsDisplay(true);
|
||||||
}else{
|
}else{
|
||||||
switchWpsDisplay(false);
|
$("#switchViews").css('display','none');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
isGetHidden();
|
isGetHidden();
|
||||||
if (!installBatch) {// 未安装批处理应用,删除功能入口
|
if (!installBatch) {// 未安装批处理应用,删除功能入口
|
||||||
$('li[ac=batchreplace]').remove();
|
$('li[ac=batchreplace]').remove();
|
||||||
@ -841,17 +843,20 @@
|
|||||||
$("#dock").css("right", 0);
|
$("#dock").css("right", 0);
|
||||||
openWpsUrl();
|
openWpsUrl();
|
||||||
}else{
|
}else{
|
||||||
debugger;
|
//先触发保存
|
||||||
$.ajax({
|
saveWps();
|
||||||
url: "./jd?sid=" + sid + "&cmd=com.awspaas.user.apps.yiliwps.getCoeDefinition&palId=" + ruuid,
|
setTimeout(function(){
|
||||||
type: 'GET',
|
//刷新画布区域
|
||||||
success: function(data) {
|
debugger;
|
||||||
definition = data;
|
$.ajax({
|
||||||
Designer.open(definition);
|
url: "./jd?sid=" + sid + "&cmd=com.awspaas.user.apps.yiliwps.getCoeDefinition&palId=" + ruuid,
|
||||||
}
|
type: 'GET',
|
||||||
});
|
success: function(data) {
|
||||||
|
definition = data;
|
||||||
|
Designer.open(definition);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 2000);
|
||||||
$("#wpsPage").css('display','none');
|
$("#wpsPage").css('display','none');
|
||||||
$("#shape_panel").css('display','block');
|
$("#shape_panel").css('display','block');
|
||||||
$("#shape_panel_more_shape").css('display','block');
|
$("#shape_panel_more_shape").css('display','block');
|
||||||
@ -873,14 +878,30 @@
|
|||||||
switchWpsDisplay(true);
|
switchWpsDisplay(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//保存wps内容
|
||||||
|
async function saveWps() {
|
||||||
|
debugger;
|
||||||
|
await jssdk.ready();
|
||||||
|
await jssdk.save();
|
||||||
|
}
|
||||||
|
|
||||||
function openWpsUrl(){
|
function openWpsUrl(){
|
||||||
|
debugger;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "./jd?sid=" + sid + "&cmd=com.awspaas.user.apps.yiliwps.previewUrl&palId=" + ruuid +"&fileName="+updatedPolicyFileList,
|
url: "./jd?sid=" + sid + "&cmd=com.awspaas.user.apps.yiliwps.previewUrl&palId=" + ruuid +"&fileName="+updatedPolicyFileList,
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if(data.code ===200){
|
if(data.code ===200){
|
||||||
//初始化建模导引
|
//换一种打开方式
|
||||||
$("#wpsUrl").attr("src", data.data.link);
|
console.log('引入后可以开始使用 JSSDK 了~');
|
||||||
|
jssdk = WebOfficeSDK.config({
|
||||||
|
url: data.data.link, // 该地址需要对接方服务端提供,形如 https://wwo.wps.cn/office/p/xxx
|
||||||
|
mount:document.querySelector('#wpsPage')
|
||||||
|
})
|
||||||
|
|
||||||
|
jssdk.on('fileOpen', (data) => {
|
||||||
|
console.log('打开文档成功: ', data)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1715,8 +1736,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="wpsPage" style="width: calc(100% - 36px);position: relative;background-color: #EEEEEE;">
|
<div id="wpsPage" style="display:none;width: calc(100% - 36px);position: relative;background-color: #EEEEEE;">
|
||||||
<iframe id="wpsUrl" style="width: 100%;height: 100%;"></iframe>>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -3520,7 +3520,7 @@ function openRelationDig(obj, value) {
|
|||||||
if (JSON.parse(ref).type == 'file') {
|
if (JSON.parse(ref).type == 'file') {
|
||||||
relationFileIds = shapeRelationValue;
|
relationFileIds = shapeRelationValue;
|
||||||
} else {
|
} else {
|
||||||
relationShapeIds = shapeRelationValue;
|
relationShapeIds = shapeRelationValue;methodId
|
||||||
}
|
}
|
||||||
var methodId = JSON.parse(ref).method;
|
var methodId = JSON.parse(ref).method;
|
||||||
var id = sid;
|
var id = sid;
|
||||||
@ -4209,60 +4209,80 @@ UI.doOutputProcess = function () {
|
|||||||
|
|
||||||
//导出流程手册
|
//导出流程手册
|
||||||
function outputReport() {
|
function outputReport() {
|
||||||
|
var setTime = 0;
|
||||||
var msg = '正在创建流程手册';
|
var msg = '正在创建流程手册';
|
||||||
if (methodId == 'data.form') {
|
if (methodId == 'data.form') {
|
||||||
msg = '正在创建表单手册';
|
msg = '正在创建表单手册';
|
||||||
} else if (methodId == 'control.policy') {
|
} else if (methodId == 'control.policy') {
|
||||||
msg = '正在创建制度手册';
|
msg = '正在创建制度手册';
|
||||||
|
if(ext3==='I/O_L4'){
|
||||||
|
//触发手动保存操作
|
||||||
|
saveWpsThis();
|
||||||
|
//设置等待时间
|
||||||
|
setTime = 2000;
|
||||||
|
}
|
||||||
|
} else if(methodId=="process.scheme"){
|
||||||
|
msg = '正在创建方案手册';
|
||||||
|
} else if(methodId=="engineering.standard"){
|
||||||
|
msg = '正在创建工程制度标准手册';
|
||||||
}
|
}
|
||||||
$.simpleAlert(msg, 'loading');
|
$.simpleAlert(msg, 'loading');
|
||||||
$.ajax({
|
setTimeout(function(){
|
||||||
type: "POST",
|
$.ajax({
|
||||||
url: "./jd?sid="
|
type: "POST",
|
||||||
+ CLB.sid
|
url: "./jd?sid="
|
||||||
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_create",
|
+ CLB.sid
|
||||||
data: {
|
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_create",
|
||||||
wsId: $('#wsId').val(),
|
data: {
|
||||||
teamId: $('#teamId').val(),
|
wsId: $('#wsId').val(),
|
||||||
fileId: ruuid
|
teamId: $('#teamId').val(),
|
||||||
},
|
fileId: ruuid
|
||||||
success: function (r) {
|
},
|
||||||
if (r.result == "ok") {
|
success: function (r) {
|
||||||
$.simpleAlert('正在打开', 'loading');
|
if (r.result == "ok") {
|
||||||
setTimeout(function () {
|
$.simpleAlert('正在打开', 'loading');
|
||||||
$.ajax({
|
setTimeout(function () {
|
||||||
type: "POST",
|
$.ajax({
|
||||||
url: "./jd?sid="
|
type: "POST",
|
||||||
+ CLB.sid
|
url: "./jd?sid="
|
||||||
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_previewByExceldown",
|
+ CLB.sid
|
||||||
data: {
|
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_previewByExceldown",
|
||||||
taskId: r.data.taskId
|
data: {
|
||||||
},
|
taskId: r.data.taskId
|
||||||
success: function (msg) {
|
},
|
||||||
if (msg.result == "ok") {
|
success: function (msg) {
|
||||||
$.simpleAlert("close");
|
if (msg.result == "ok") {
|
||||||
if (msg['data']) {
|
$.simpleAlert("close");
|
||||||
var url = msg['data']['url'];
|
if (msg['data']) {
|
||||||
window.open(url);
|
var url = msg['data']['url'];
|
||||||
|
window.open(url);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$.simpleAlert("close");
|
||||||
|
$.simpleAlert(msg['msg'], 'info');
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$.simpleAlert("close");
|
|
||||||
$.simpleAlert(msg['msg'], 'info');
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}, 2000);
|
||||||
}, 2000);
|
|
||||||
} else {
|
|
||||||
if (methodId == 'data.form') {
|
|
||||||
$.simpleAlert('表单手册创建失败', 'error');
|
|
||||||
} else if (methodId == 'control.policy') {
|
|
||||||
$.simpleAlert('制度手册创建失败,请检查正文文件格式是否正确!', 'error');
|
|
||||||
} else {
|
} else {
|
||||||
$.simpleAlert('流程手册创建失败', 'error');
|
if (methodId == 'data.form') {
|
||||||
|
$.simpleAlert('表单手册创建失败', 'error');
|
||||||
|
} else if (methodId == 'control.policy') {
|
||||||
|
$.simpleAlert('制度手册创建失败,请检查正文文件格式是否正确!', 'error');
|
||||||
|
} else {
|
||||||
|
$.simpleAlert('流程手册创建失败', 'error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}, setTime);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveWpsThis() {
|
||||||
|
debugger;
|
||||||
|
await jssdk.save();
|
||||||
|
console.log(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据附件创建节点-打开dialog
|
//根据附件创建节点-打开dialog
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user