导入附件制度
This commit is contained in:
parent
4d526a3cd2
commit
eef12a84aa
@ -4,6 +4,9 @@ import com.actionsoft.apps.coe.pal.datamigration.aris.web.ArisXmlImportWeb;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.readtable.ReadTable;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.readword.ReadWordUtil;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.web.DataMigrationWeb;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.server.bind.annotation.Controller;
|
||||
@ -130,4 +133,23 @@ public class DataMigrationController {
|
||||
DataMigrationWeb web = new DataMigrationWeb(me);
|
||||
return web.getRichText(me, pluuid, shapId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 制度表单等工具栏中上传附件保存并生成相应活动节点
|
||||
* @param ruuid
|
||||
* @param fileNames
|
||||
* @return
|
||||
*/
|
||||
// @Mapping(value="COE_PAL_PROCESSLEVEL_SHAPE_UPFILE_SAVE")
|
||||
@Mapping("com.actionsoft.apps.coe.pal.policy_file_upfile_save")
|
||||
public String COEPALPROCESSLEVELShapeUpfileSave(UserContext me, String appId, String repositoryName, String groupValue, String ruuid, String fileNames, String type) {
|
||||
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(ruuid);
|
||||
if (plModel == null) {
|
||||
return ResponseObject.newErrResponse("找不到该流程").toString();
|
||||
}
|
||||
String wsId = plModel.getWsId();
|
||||
new ReadWordUtil().translateDocTDocx(me,wsId,groupValue,ruuid,fileNames);
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
return ro.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import com.actionsoft.apps.coe.pal.datamigration.model.po.AwsOrgInfo;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.model.po.WordField;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.*;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.readword.CreateMaps;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.readword.ReadWordUtil;
|
||||
import com.actionsoft.apps.coe.pal.log.CoEOpLogAPI;
|
||||
import com.actionsoft.apps.coe.pal.log.CoEOpLogConst;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodCache;
|
||||
@ -35,6 +36,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeRepositoryImportUtil;
|
||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
|
||||
@ -820,4 +822,37 @@ public class DataMigrationWeb extends ActionWeb {
|
||||
macroLibraries.put("content",s);
|
||||
return HtmlPageTemplate.merge("com.actionsoft.apps.coe.pal.datamigration", "pal.pl.richtext.htm", macroLibraries);
|
||||
}
|
||||
|
||||
/**
|
||||
* by bzp
|
||||
* 制度表单等工具栏中上传附件保存并生成相应活动节点
|
||||
* @param uuid
|
||||
* @param fileNames
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public String savePolicyUpfile(UserContext me,String appId, String repositoryName, String groupValue, String uuid, String fileNames, String type) {
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(uuid);
|
||||
if (plModel == null) {
|
||||
return ResponseObject.newErrResponse("找不到该流程").toString();
|
||||
}
|
||||
|
||||
CoeRepositoryImportUtil util = new CoeRepositoryImportUtil();
|
||||
try {
|
||||
// 复制临时目录到附件目录
|
||||
DCPluginProfile sourceDcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, "tmp");
|
||||
DCContext sourceDcContext = new DCContext(super.getContext(), sourceDcProfile, CoEConstant.APP_ID, "policyFile", uuid, fileNames);
|
||||
InputStream in = SDK.getDCAPI().read(sourceDcContext);
|
||||
/*new ReadWordUtil().translateDocTDocx(me,wsId,groupValue,fileValue,fileName);
|
||||
if (result) {
|
||||
//删除上传的临时文件目录
|
||||
sourceDcContext.delete();
|
||||
}*/
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ro.put("name", plModel.getName());
|
||||
return ro.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,4 +50,13 @@
|
||||
<param name="pluuid"/>
|
||||
<param name="shapId"/>
|
||||
</cmd-bean>
|
||||
<!--by bzp 导入制度-->
|
||||
<cmd-bean name="com.actionsoft.apps.coe.pal_processlevel_shape_upfile_save">
|
||||
<param name="appId"/>
|
||||
<param name="repositoryName"/>
|
||||
<param name="groupValue"/>
|
||||
<param name="ruuid"/>
|
||||
<param name="fileNames"/>
|
||||
<param name="type"/>
|
||||
</cmd-bean>
|
||||
</aws-actions>
|
||||
@ -772,6 +772,9 @@
|
||||
<div id="QualityInspection" awsui-qtip='质量检测' class="toolbar_button">
|
||||
<div class="ico QualityInspection"></div>
|
||||
</div>
|
||||
<div id="bar_importPolicyFile" awsui-qtip='上传附件并创建制度' class="toolbar_button" style="<#importShapeStyle>">
|
||||
<div class="ico ico_importShape"></div>
|
||||
</div>
|
||||
<!-- <div id="bar_import" awsui-qtip='导入' class="toolbar_button" style="<#importStyle>">
|
||||
<div class="ico ico_import"></div>
|
||||
</div> -->
|
||||
@ -2957,7 +2960,7 @@
|
||||
<div style="width: 550px;height: 280px;vertical-align: top;">
|
||||
<button id="pupShapeFile" onclick="return false;" type="button" class="awsui-btn awsui-btn-green" style="margin-left: 20px;margin-top:10px">新增</button>
|
||||
<div style="margin-left: 20px;padding: 5px; font-size: 12px; color: rgb(120, 120, 120);">
|
||||
<span>附件格式支持:jpg, jpeg, gif, png, bmp, pdf, doc, docx, ppt, pptx, xls, xlsx, txt</span>
|
||||
<span>附件格式支持:doc, docx</span>
|
||||
</div>
|
||||
<div style="height:210px;overflow-x: hidden;overflow-y:auto;">
|
||||
<table class="awsui-ux">
|
||||
|
||||
@ -31,6 +31,8 @@ $(document).ready(function() {
|
||||
initMoreAttrRight();
|
||||
//初始化节点附件上传事件
|
||||
addShapeFile();
|
||||
//by bzp
|
||||
addPolicyFile();
|
||||
});
|
||||
|
||||
function initMoreAttrRight() {
|
||||
@ -4277,4 +4279,168 @@ function addShapeFile() {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//by bzp 导入制度附件
|
||||
UI.showImportPolicyFileDlg = function() {
|
||||
// 判断是否保存
|
||||
if ($("#saving_tip").text() != "已保存成功" && $("#saving_tip").text() != "保存成功" && $("#saving_tip").text() != "您的文件已经成功保存" && $("#saving_tip").text() != "") {
|
||||
$.simpleAlert('页面中有未保存的内容,请先保存');
|
||||
return;
|
||||
}
|
||||
$("#policyfile_import_dlg").dialog({
|
||||
width: 570,
|
||||
height: 380,
|
||||
buttons:[
|
||||
{text:'确定',cls:"blue",handler:function(){
|
||||
importPolicyFile();
|
||||
}},
|
||||
{text:'取消',handler:function(){$("#policyfile_import_dlg").dialog("close");}}
|
||||
],
|
||||
onClose:delPolicyFiles
|
||||
});
|
||||
}
|
||||
|
||||
var updatedPolicyFileList = "";// 已上传的附件列表名称
|
||||
|
||||
// 保存附件
|
||||
function importPolicyFile() {
|
||||
if(updatedPolicyFileList.length == 0) {
|
||||
$.simpleAlert('没有上传的附件,请点击取消或直接关闭');
|
||||
return;
|
||||
}
|
||||
|
||||
$.simpleAlert('正在保存', 'loading');
|
||||
type = "regulation";
|
||||
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "./jd?sid="
|
||||
+ CLB.sid
|
||||
+ "&cmd=com.actionsoft.apps.coe.pal.policy_file_upfile_save",
|
||||
data : {
|
||||
sid: sid,
|
||||
appId: "com.actionsoft.apps.coe.pal.datamigration",
|
||||
repositoryName: "migration",
|
||||
groupValue:"policyFile",
|
||||
ruuid:ruuid,
|
||||
fileNames:updatedPolicyFileList,
|
||||
type:type
|
||||
},
|
||||
success : function(r) {
|
||||
if(r.result == "ok") {
|
||||
delPolicyFiles();//清空界面数据
|
||||
$.simpleAlert("close");
|
||||
$.simpleAlert("保存成功", 'ok');
|
||||
// 刷新页面
|
||||
location.reload();
|
||||
} else {
|
||||
$.simpleAlert("close");
|
||||
console.log(r);
|
||||
$.simpleAlert('保存失败', 'error');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function delPolicyFiles() {
|
||||
$('#shapeFileTbody').empty();
|
||||
updatedPolicyFileList = "";
|
||||
$.simpleAlert("close")
|
||||
}
|
||||
|
||||
// 删除附件
|
||||
function delPolicyFile(obj) {
|
||||
var $tr = $(obj).closest('tr');
|
||||
var name = $tr.find('div[name="shapeFileName"]').text();
|
||||
var options = {
|
||||
title: "提示",
|
||||
content: "删除 [" + name + "] ?",
|
||||
onConfirm: function() {
|
||||
$.simpleAlert('正在删除', 'loading');
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "./jd?sid="
|
||||
+ CLB.sid
|
||||
+ "&cmd=com.actionsoft.apps.coe.pal_processlevel_shape_upfile_del",
|
||||
data : {
|
||||
sid: sid,
|
||||
appId: "com.actionsoft.apps.coe.pal.datamigration",
|
||||
repositoryName: "migration",
|
||||
groupValue:"policyFile",
|
||||
ruuid:ruuid,
|
||||
fileName:name
|
||||
},
|
||||
success : function(r) {
|
||||
if(r.result == "ok") {
|
||||
// 列表中删除
|
||||
$tr.remove();
|
||||
// 记录数组删除
|
||||
updatedPolicyFileList = "";
|
||||
|
||||
$.simpleAlert("close");
|
||||
$.simpleAlert("删除成功", 'ok');
|
||||
} else {
|
||||
$.simpleAlert("close");
|
||||
$.simpleAlert('删除失败', 'error');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$.confirm(options);
|
||||
}
|
||||
|
||||
// 新增上传附件
|
||||
function addPolicyFile() {
|
||||
//初始化上传button
|
||||
$("#pupShapeFile").upfile({
|
||||
sid: sid,
|
||||
appId: "com.actionsoft.apps.coe.pal.datamigration",
|
||||
groupValue:"policyFile",
|
||||
fileValue:ruuid,
|
||||
filesToFilter: [[" *.doc; *.docx"]],
|
||||
repositoryName: "migration",
|
||||
numLimit : 1,
|
||||
sizeLimit : 10 * 1024 * 1024,
|
||||
complete:function(){
|
||||
//事件回调函数
|
||||
$.simpleAlert('close');
|
||||
$.mask();
|
||||
},
|
||||
add: function(e, data) { //附件被添加到上传列表时触发,当返回false时,可阻止上传
|
||||
if (data.files.length == 0) {
|
||||
return false;
|
||||
} else if (data.files[0].size > 10 * 1024 * 1024) {
|
||||
$.simpleAlert("文件过大");
|
||||
return false;
|
||||
}
|
||||
// 不能添加名称相同的附件
|
||||
var fileName = data.files[0].name;
|
||||
updatedPolicyFileList = fileName;
|
||||
return true;
|
||||
},
|
||||
done: function(e, data) { //单个附件上传完毕后触发
|
||||
var output = data;
|
||||
if (output.textStatus == "warning") {
|
||||
$.simpleAlert(output.message, output.type, 2000);
|
||||
return false;
|
||||
} else if (output.result.data.result == "error") {
|
||||
$.simpleAlert(data.files[0].name + "上传错误", "error", 2000);
|
||||
return false;
|
||||
} else if (output.result.data.result == "ok") {
|
||||
// 加载到列表
|
||||
var html = '';
|
||||
html += '<tr>';
|
||||
html += '<td>';
|
||||
html += '<div name="shapeFileName" class="text_overflow" widthpercent="60" style="width: 302.4px;">' + data.files[0].name + '</div>';
|
||||
html += '</td>';
|
||||
html += '<td style="text-align: center;">';
|
||||
html += '<img src="../apps/com.actionsoft.apps.coe.pal/img/icon/pal_delete.png" onclick="delPolicyFile(this)" awsui-qtip="删除">';
|
||||
html += '</td>';
|
||||
html += '</tr>';
|
||||
$('#pshapeFileTbody').append(html);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user