资产库代码优化
This commit is contained in:
parent
0326526591
commit
2861e578af
@ -792,7 +792,6 @@ public class PublisherController {
|
||||
return publishWeb.getLevelByData(me, wsId, type, datas, processInstId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据矩阵信息查询审批信息
|
||||
*
|
||||
@ -945,4 +944,10 @@ public class PublisherController {
|
||||
ProcessPublishWeb web = new ProcessPublishWeb(me);
|
||||
return web.createProcessTermination(palUUID,processDefId);
|
||||
}
|
||||
|
||||
@Mapping("com.actionsoft.apps.coe.pal.publisher.getEditPalByUserId")
|
||||
public String getEditPalByUserId(UserContext me,String type){
|
||||
ProcessPublishWeb web = new ProcessPublishWeb(me);
|
||||
return web.getEditPalByUserId(type);
|
||||
}
|
||||
}
|
||||
@ -5013,11 +5013,24 @@ public class ProcessPublishWeb extends ActionWeb {
|
||||
* @return
|
||||
*/
|
||||
public String createProcessTermination(String palUUID,String processDefId) {
|
||||
//需要先判断是否有发布状态的版本,有则允许发布,否则提醒
|
||||
ResponseObject responseObject = ResponseObject.newOkResponse();
|
||||
PALRepositoryModel thisModel = PALRepositoryCache.getCache().get(palUUID);
|
||||
if (!thisModel.isPublish()) {//如果不是发布状态的
|
||||
List<PALRepositoryModel> list = PALRepositoryCache.getByPlRid(thisModel.getPlRid());
|
||||
List<PALRepositoryModel> publishList = list.stream()
|
||||
.filter(PALRepositoryModel::isPublish)
|
||||
.collect(Collectors.toList());
|
||||
if(publishList.isEmpty()){//整个pal组都是未发布的
|
||||
responseObject.err("本文件暂未发布,无需废止");
|
||||
return responseObject.toString();
|
||||
}else{
|
||||
thisModel = publishList.get(0);//换成这个发布的
|
||||
}
|
||||
}
|
||||
String optionType = "流程制度废止";
|
||||
String subBoName = "BO_ACT_COE_PUBLISH_S";
|
||||
//获取文件属性
|
||||
PALRepositoryModel thisModel = PALRepositoryCache.getCache().get(palUUID);
|
||||
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance(processDefId, _uc.getUID(), _uc.getUserName()+"发起流程发布流程");
|
||||
BO bo =new BO();
|
||||
BO subBO =new BO();
|
||||
@ -5054,4 +5067,65 @@ public class ProcessPublishWeb extends ActionWeb {
|
||||
bo.set("LEVEL_4_PROCESS_NAME",l4_name);
|
||||
|
||||
}
|
||||
/**
|
||||
* 获取当前人最近编辑的前十条记录
|
||||
* @return
|
||||
*/
|
||||
public String getEditPalByUserId(String type){
|
||||
boolean oracle = SDK.getConfAPI().isOracle();
|
||||
String uid = _uc.getUID();
|
||||
String querySql ="";
|
||||
if(type.equals("new")){
|
||||
//查询个人编辑的前十条记录 (mysql 语法)
|
||||
querySql = "SELECT \n" +
|
||||
" * \n" +
|
||||
"FROM \n" +
|
||||
" APP_ACT_COE_PAL_REPOSITORY A \n" +
|
||||
"WHERE \n" +
|
||||
" MODIFYUSER = ? \n" +
|
||||
" AND isPublish = 0 \n" +
|
||||
" AND PLMETHODID != 'default' \n" +
|
||||
" AND NOT EXISTS ( \n" +
|
||||
" SELECT \n" +
|
||||
" 1 \n" +
|
||||
" FROM \n" +
|
||||
" APP_ACT_COE_PAL_REPOSITORY B \n" +
|
||||
" WHERE \n" +
|
||||
" B.PLRID = A.PLRID \n" +
|
||||
" AND B.isPublish = 1 \n" +
|
||||
" ) \n" +
|
||||
"ORDER BY \n" +
|
||||
" MODIFYDATE DESC \n";
|
||||
}else if(type.equals("change")){
|
||||
querySql = "SELECT a.* " +
|
||||
"FROM APP_ACT_COE_PAL_REPOSITORY a " +
|
||||
"WHERE a.isPublish = 1 " +
|
||||
" AND EXISTS ( " +
|
||||
" SELECT 1 " +
|
||||
" FROM APP_ACT_COE_PAL_REPOSITORY b " +
|
||||
" WHERE b.PLRID = a.PLRID " +
|
||||
" AND b.isPublish = 0 " +
|
||||
" )" +
|
||||
" AND a.MODIFYUSER = ?" +
|
||||
" AND a.PLMETHODID !='default'" +
|
||||
" ORDER BY MODIFYDATE DESC";
|
||||
}else if(type.equals("change")){
|
||||
querySql = "SELECT a.* " +
|
||||
"FROM APP_ACT_COE_PAL_REPOSITORY a " +
|
||||
"WHERE a.isPublish = 1 " +
|
||||
" AND a.MODIFYUSER = ?" +
|
||||
" AND a.PLMETHODID !='default'" +
|
||||
" ORDER BY MODIFYDATE DESC";
|
||||
}
|
||||
if(oracle){
|
||||
querySql += " FETCH FIRST 10 ROWS ONLY";
|
||||
}else{
|
||||
querySql += " LIMIT 10 ";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps(querySql, new Object[]{uid});
|
||||
JSONArray list = (JSONArray) JSONArray.toJSON(maps);
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
ro.put("list",list);
|
||||
return ro.toString();
|
||||
}
|
||||
}
|
||||
@ -184,6 +184,81 @@ function initOptButton() {
|
||||
}
|
||||
}
|
||||
|
||||
function initHistoryInfo(type){
|
||||
var param = {
|
||||
sid : sid,
|
||||
type: type,
|
||||
cmd : "com.actionsoft.apps.coe.pal.publisher.getEditPalByUserId"
|
||||
}
|
||||
$.ajax({
|
||||
url : "./jd",
|
||||
type : "POST",
|
||||
dataType : "JSON",
|
||||
data : param,
|
||||
async: false,
|
||||
success : function(r) {
|
||||
debugger;
|
||||
if (r.result == 'ok') {
|
||||
debugger;
|
||||
//需要先删除缓存
|
||||
$('[data-id="historyInfo"]').remove();
|
||||
$("#historyInfo").removeData('plugin_awsuiPopBox');
|
||||
$.data( $("#historyInfo"), 'plugin_awsuiPopBox',undefined);
|
||||
$("#historyInfo").popBox({
|
||||
cache:false,
|
||||
title:'我编辑的文件',
|
||||
content: initContentHtml(r.data.list),
|
||||
position:'bottom-left',
|
||||
callback:function(item){
|
||||
debugger;
|
||||
$("input[name='historyCheckBox']")
|
||||
$("input[name='historyCheckBox']").check();
|
||||
$("input[name='historyCheckBox']").on("ifChanged",function(){
|
||||
debugger;
|
||||
var historyCheckBoxArr = $('input[name="historyCheckBox"]:checked');
|
||||
var names = '';
|
||||
var nodes = [];
|
||||
for (var i = 0; i < historyCheckBoxArr.size(); i++) {
|
||||
var node = {};
|
||||
node.category = $(historyCheckBoxArr[i]).attr("pcategory");
|
||||
node.method = $(historyCheckBoxArr[i]).attr("pmethod");
|
||||
node.tempName = $(historyCheckBoxArr[i]).attr("ptempName");
|
||||
node.id = $(historyCheckBoxArr[i]).attr("pid");
|
||||
node.version = $(historyCheckBoxArr[i]).attr("pversion");
|
||||
nodes.push(node)
|
||||
names += $(historyCheckBoxArr[i]).attr("plname");
|
||||
if (i < historyCheckBoxArr.size() - 1) {
|
||||
names += ',';
|
||||
}
|
||||
}
|
||||
$('#publisher_dialog_name').val(names);
|
||||
if(searchType === "new"){
|
||||
getNewPublishBatchResult(searchType,nodes);
|
||||
}else if(searchType === "change"){
|
||||
getChangeBatchResult(searchType,nodes);
|
||||
}else if(searchType === "stop"){
|
||||
getStopBatchResult(searchType,nodes);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function initContentHtml(obj){
|
||||
var checkHtml = '';
|
||||
obj.forEach(function(model, index) {
|
||||
checkHtml += '<p>';
|
||||
checkHtml += '<input class="awsui-checkbox" plname="'+model.PLNAME+'" name="historyCheckBox" pcategory="'+model.PLCATEGORY+'" pmethod="'+model.PLMETHODID+'" ptempName="'+model.PLNAME+'" pid="'+model.ID+'" pversion="'+model.PLVER+'" type="checkbox"/>';
|
||||
checkHtml += '<label class="awsui-checkbox-label">'+model.PLNAME+'</label>';
|
||||
});
|
||||
return checkHtml;
|
||||
}
|
||||
|
||||
// 初始化自定义内容,不能写到html 文件中,表单会被平台自动调整的不成样子
|
||||
function initHtml() {
|
||||
var dialogHtml = '';
|
||||
@ -200,6 +275,7 @@ function initHtml() {
|
||||
dialogHtml += '<i class="awsui-iconfont awsui-cursor"></i>';
|
||||
dialogHtml += '</span>';
|
||||
dialogHtml += '</span>';
|
||||
dialogHtml += '<span><button type="button" id="historyInfo" class="awsui-btn awsui-btn-blue">我编辑的文件</button></span>';
|
||||
dialogHtml += '</div>';
|
||||
dialogHtml += '</div>';
|
||||
dialogHtml += '<div class="awsui-row">';
|
||||
@ -239,7 +315,19 @@ function initHtml() {
|
||||
dialogHtml += '<div id="treeDialog" border="0" style="width: 700px; display: none;" title="流程资产库">';
|
||||
dialogHtml += '<div id="searchData" class="awsui-form-input">';
|
||||
dialogHtml += '</div>';
|
||||
dialogHtml += '<div id="autoSearchProcessDiv" style="z-index: 999;position:absolute; background-color:white;min-width: 208px; max-height: 340px; overflow: auto; top: 80px; left: 16px; border: 1px solid #c5c5c5; display: none;">';
|
||||
//dialogHtml += '<div id="autoSearchProcessDiv" style="z-index: 999;position:absolute; background-color:white;min-width: 208px; max-height: 340px; overflow: auto; top: 80px; left: 16px; border: 1px solid #c5c5c5; display: none;">';
|
||||
dialogHtml += '<div id="autoSearchProcessDiv" style="z-index: 999; display: none;position: absolute; \n' +
|
||||
' left: 0; \n' +
|
||||
' width: 90%; /* 与输入框同宽 */ \n' +
|
||||
' padding: 5px 10px; \n' +
|
||||
' background-color: #f9f9f9; \n' +
|
||||
' border: 1px solid #ddd; \n' +
|
||||
' border-radius: 4px; \n' +
|
||||
' box-shadow: 0 2px 4px rgba(0,0,0,0.1); \n' +
|
||||
' color: #333; \n' +
|
||||
' font-size: 14px; \n' +
|
||||
' white-space: nowrap; /* 防止内容换行 */ \n' +
|
||||
' margin-left: 15px; ">';
|
||||
dialogHtml += '</div>';
|
||||
dialogHtml += '<div id="treeDataDiv" border="0" style="margin: 8px; height: 350px;">';
|
||||
dialogHtml += '</div>';
|
||||
@ -370,6 +458,8 @@ function initParam() {
|
||||
teamId = $("#TEAMID").val();
|
||||
sid = $("#sid").val();
|
||||
wsId = $("#WSID").val();
|
||||
//本地测试环境使用
|
||||
wsId = "11dd43d0-a3c7-4ba7-860f-6eac3383e0b0";
|
||||
processInstId = $("#processInstId").val();
|
||||
var param = {
|
||||
sid : sid,
|
||||
@ -1037,6 +1127,7 @@ function addProcess(type) {
|
||||
}
|
||||
}
|
||||
});
|
||||
initHistoryInfo(type);
|
||||
}
|
||||
|
||||
// 打开流程树选择窗口
|
||||
@ -1181,6 +1272,15 @@ function refreshManuals(processInstId,type) {
|
||||
function openQueryDataDialog(type) {
|
||||
$('#treeDataDiv').html('<div id="loadImg" style="width:100%;height:100%;text-align:center;vertical-align: middle;margin: auto;"></div>');
|
||||
$('#searchData').html('<input id="processName" style="width:700px;" type="text" class="awsui-txt" placeholder="快速查询">');
|
||||
//增加一个监听
|
||||
$(document).on('click', function(e) {
|
||||
debugger;
|
||||
//if (!e.target.closest('#autoSearchProcessDiv')) {
|
||||
if (!$(e.target).closest('#autoSearchProcessDiv').length) {
|
||||
// 如果点击的目标不是.input-container或其子元素,则隐藏tooltip
|
||||
$("#autoSearchProcessDiv").hide();
|
||||
}
|
||||
});
|
||||
$("#loadImg").loading({
|
||||
description:"加载中",
|
||||
size:'large',
|
||||
@ -1346,8 +1446,10 @@ function loadNewData(treeNode) {
|
||||
}
|
||||
|
||||
// 发布类型批量结果数据回填主dialog
|
||||
function getNewPublishBatchResult(type) {
|
||||
function getNewPublishBatchResult(type,nodes) {
|
||||
if(nodes == undefined){
|
||||
var nodes = initTree.getCheckedNodes();
|
||||
}
|
||||
treeCheckedNewArr = [];
|
||||
var param = {
|
||||
cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs',
|
||||
@ -1406,6 +1508,7 @@ function getNewPublishBatchResult(type) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//获取已发布文件数据结构
|
||||
function getPublishedTreeData(type) {
|
||||
var param = {
|
||||
@ -1460,8 +1563,10 @@ function getPublishedTreeData(type) {
|
||||
}
|
||||
|
||||
//变更类型批量结果数据回填主dialog
|
||||
function getChangeBatchResult(type) {
|
||||
function getChangeBatchResult(type,nodes) {
|
||||
if(nodes == undefined){
|
||||
var nodes = initTree.getCheckedNodes();
|
||||
}
|
||||
treeCheckedChangeArr = [];
|
||||
var param = {
|
||||
cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs',
|
||||
@ -1522,8 +1627,11 @@ function getChangeBatchResult(type) {
|
||||
}
|
||||
|
||||
// 停用类型批量结果数据回填主dialog
|
||||
function getStopBatchResult(type) {
|
||||
var nodes = initTree.getCheckedNodes();
|
||||
function getStopBatchResult(type,nodes) {
|
||||
if(nodes == undefined){
|
||||
nodes = initTree.getCheckedNodes();
|
||||
}
|
||||
|
||||
treeCheckedStopArr = [];
|
||||
var param = {
|
||||
cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs',
|
||||
@ -2387,11 +2495,11 @@ function initPublishSearch(type) {
|
||||
searchProcess(type);
|
||||
}
|
||||
});
|
||||
$("#autoSearchProcessDiv").off("mouseenter").on("mouseenter", function () {
|
||||
/*$("#autoSearchProcessDiv").off("mouseenter").on("mouseenter", function () {
|
||||
$('#autoSearchProcessDiv').show();
|
||||
}).off("autoSearchProcessDiv").on("mouseleave", function () {
|
||||
$('#autoSearchProcessDiv').hide();
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
// 搜索
|
||||
@ -2545,8 +2653,10 @@ function auto_click(obj, type) {
|
||||
// 偏移至可见区域
|
||||
var ele = document.getElementById('tree_span_' + plId);
|
||||
$('#tree').scrollTop(ele.offsetTop);
|
||||
initTree.cancelSelectNode()
|
||||
initTree.selectNode(plId);
|
||||
//initTree.cancelSelectNode();
|
||||
var plIdArr = [];
|
||||
plIdArr.push(plId);
|
||||
initTree.setCheckNodes(plIdArr,true);
|
||||
$("#autoSearchProcessDiv").empty().hide();
|
||||
}
|
||||
/********************************快速搜索end***************************************/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user