wps功能代码提交
This commit is contained in:
parent
2ffcd1f860
commit
6c21801238
@ -136,32 +136,15 @@ public class WordUtilXWPF {
|
||||
// String filePath =
|
||||
// "/Users/jiuyabai/Desktop/yili项目/制度样例1—伊利集团流程制度类文件管理规范1.docx";
|
||||
try {
|
||||
// file = new File(filePath);
|
||||
elements.clear();
|
||||
String path = dcContextpdf.getPath();
|
||||
// String filePath = "D:/制度样例1—伊利集团流程制度类文件管理规范2.xml"; //创建实例,加载xml测试文档
|
||||
Document docs = new Document();
|
||||
docs.loadFromFile(path + fileName);
|
||||
|
||||
// 保存为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);
|
||||
|
||||
//
|
||||
if(fileName.contains(".xml") || !fileName.contains(".docx")) {
|
||||
String path = dcContextpdf.getPath();
|
||||
// String filePath = "D:/制度样例1—伊利集团流程制度类文件管理规范2.xml"; //创建实例,加载xml测试文档
|
||||
Document docs = new Document();
|
||||
docs.loadFromFile(path + fileName);
|
||||
// 保存为Docx格式
|
||||
docs.saveToFile(path + name + ".docx", FileFormat.Docx);
|
||||
}
|
||||
DCPluginProfile dcProfilepdfdoc = DCProfileManager.getDCProfile("com.actionsoft.apps.coe.pal.datamigration",
|
||||
"migration");
|
||||
DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc,
|
||||
|
||||
@ -343,6 +343,7 @@
|
||||
|
||||
var pid = "<#parentChartId>";
|
||||
var teamId = "<#teamId>";
|
||||
var jssdk;
|
||||
</script>
|
||||
<!--工具js-->
|
||||
<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 src="../commons/js/web-office-sdk-v1.1.19.umd.js"></script>
|
||||
<script>
|
||||
|
||||
function initCustomHelpToolExtMenuUrl() {
|
||||
@ -491,9 +492,10 @@
|
||||
//执行切换显示按钮
|
||||
switchWpsDisplay(true);
|
||||
}else{
|
||||
switchWpsDisplay(false);
|
||||
$("#switchViews").css('display','none');
|
||||
}
|
||||
|
||||
|
||||
isGetHidden();
|
||||
if (!installBatch) {// 未安装批处理应用,删除功能入口
|
||||
$('li[ac=batchreplace]').remove();
|
||||
@ -841,17 +843,20 @@
|
||||
$("#dock").css("right", 0);
|
||||
openWpsUrl();
|
||||
}else{
|
||||
debugger;
|
||||
$.ajax({
|
||||
url: "./jd?sid=" + sid + "&cmd=com.awspaas.user.apps.yiliwps.getCoeDefinition&palId=" + ruuid,
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
definition = data;
|
||||
Designer.open(definition);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//先触发保存
|
||||
saveWps();
|
||||
setTimeout(function(){
|
||||
//刷新画布区域
|
||||
debugger;
|
||||
$.ajax({
|
||||
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');
|
||||
$("#shape_panel").css('display','block');
|
||||
$("#shape_panel_more_shape").css('display','block');
|
||||
@ -873,14 +878,30 @@
|
||||
switchWpsDisplay(true);
|
||||
}
|
||||
}
|
||||
//保存wps内容
|
||||
async function saveWps() {
|
||||
debugger;
|
||||
await jssdk.ready();
|
||||
await jssdk.save();
|
||||
}
|
||||
|
||||
function openWpsUrl(){
|
||||
debugger;
|
||||
$.ajax({
|
||||
url: "./jd?sid=" + sid + "&cmd=com.awspaas.user.apps.yiliwps.previewUrl&palId=" + ruuid +"&fileName="+updatedPolicyFileList,
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
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 id="wpsPage" style="width: calc(100% - 36px);position: relative;background-color: #EEEEEE;">
|
||||
<iframe id="wpsUrl" style="width: 100%;height: 100%;"></iframe>>
|
||||
<div id="wpsPage" style="display:none;width: calc(100% - 36px);position: relative;background-color: #EEEEEE;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -3520,7 +3520,7 @@ function openRelationDig(obj, value) {
|
||||
if (JSON.parse(ref).type == 'file') {
|
||||
relationFileIds = shapeRelationValue;
|
||||
} else {
|
||||
relationShapeIds = shapeRelationValue;
|
||||
relationShapeIds = shapeRelationValue;methodId
|
||||
}
|
||||
var methodId = JSON.parse(ref).method;
|
||||
var id = sid;
|
||||
@ -4209,60 +4209,80 @@ UI.doOutputProcess = function () {
|
||||
|
||||
//导出流程手册
|
||||
function outputReport() {
|
||||
var setTime = 0;
|
||||
var msg = '正在创建流程手册';
|
||||
if (methodId == 'data.form') {
|
||||
msg = '正在创建表单手册';
|
||||
} else if (methodId == 'control.policy') {
|
||||
msg = '正在创建制度手册';
|
||||
if(ext3==='I/O_L4'){
|
||||
//触发手动保存操作
|
||||
saveWpsThis();
|
||||
//设置等待时间
|
||||
setTime = 2000;
|
||||
}
|
||||
} else if(methodId=="process.scheme"){
|
||||
msg = '正在创建方案手册';
|
||||
} else if(methodId=="engineering.standard"){
|
||||
msg = '正在创建工程制度标准手册';
|
||||
}
|
||||
$.simpleAlert(msg, 'loading');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "./jd?sid="
|
||||
+ CLB.sid
|
||||
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_create",
|
||||
data: {
|
||||
wsId: $('#wsId').val(),
|
||||
teamId: $('#teamId').val(),
|
||||
fileId: ruuid
|
||||
},
|
||||
success: function (r) {
|
||||
if (r.result == "ok") {
|
||||
$.simpleAlert('正在打开', 'loading');
|
||||
setTimeout(function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "./jd?sid="
|
||||
+ CLB.sid
|
||||
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_previewByExceldown",
|
||||
data: {
|
||||
taskId: r.data.taskId
|
||||
},
|
||||
success: function (msg) {
|
||||
if (msg.result == "ok") {
|
||||
$.simpleAlert("close");
|
||||
if (msg['data']) {
|
||||
var url = msg['data']['url'];
|
||||
window.open(url);
|
||||
setTimeout(function(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "./jd?sid="
|
||||
+ CLB.sid
|
||||
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_create",
|
||||
data: {
|
||||
wsId: $('#wsId').val(),
|
||||
teamId: $('#teamId').val(),
|
||||
fileId: ruuid
|
||||
},
|
||||
success: function (r) {
|
||||
if (r.result == "ok") {
|
||||
$.simpleAlert('正在打开', 'loading');
|
||||
setTimeout(function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "./jd?sid="
|
||||
+ CLB.sid
|
||||
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_process_previewByExceldown",
|
||||
data: {
|
||||
taskId: r.data.taskId
|
||||
},
|
||||
success: function (msg) {
|
||||
if (msg.result == "ok") {
|
||||
$.simpleAlert("close");
|
||||
if (msg['data']) {
|
||||
var url = msg['data']['url'];
|
||||
window.open(url);
|
||||
}
|
||||
} else {
|
||||
$.simpleAlert("close");
|
||||
$.simpleAlert(msg['msg'], 'info');
|
||||
}
|
||||
} else {
|
||||
$.simpleAlert("close");
|
||||
$.simpleAlert(msg['msg'], 'info');
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 2000);
|
||||
} else {
|
||||
if (methodId == 'data.form') {
|
||||
$.simpleAlert('表单手册创建失败', 'error');
|
||||
} else if (methodId == 'control.policy') {
|
||||
$.simpleAlert('制度手册创建失败,请检查正文文件格式是否正确!', 'error');
|
||||
});
|
||||
}, 2000);
|
||||
} 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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user