Commit 8fc9cc8a by 宋祥

1.目录结构增加搜索功能

parent 7c2e49ab
......@@ -6,28 +6,11 @@ package com.baosight.hggp.core.constant;
*/
public class CodesetConstant {
/**
* 动态表
*
* @author:songx
* @date:2024/3/1,17:36
*/
public static class HgPz {
// 项目来源
public static final String PROJECT_SOURCE = "app.sc.projectSource";
// 动态表
public static final String DYNAMIC_TABLE = "app.pz.dynamicTable";
}
/**
* 组织机构
*
* @author:songx
* @date:2024/3/1,17:36
*/
public static class XsOg {
// 组织机构类型
public static final String ORG_TYPE = "xs.og.orgType";
}
}
......@@ -132,6 +132,11 @@ public class CommonConstant {
public static final String ENAME = "ename";
// 动态列
public static final String DYNAMIC_COLUMN = "dynamicColumn";
// VALUE_FIELD
public static final String VALUE_FIELD = "valueField";
// TEXT_FIELD
public static final String TEXT_FIELD = "textField";
}
/**
......
package com.baosight.hggp.core.tools;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiInfo;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 2021-04-27 迁移到此处
*
* @author:songx
* @date:2021/4/27,15:21
*/
public class CodeOptionTools {
/**
* 下拉框
*
* @param inInfo
* @param codeName
* @param blockId
* @param isSymbol
*/
public static void buildOption(EiInfo inInfo, String codeName, String blockId, boolean isSymbol) {
EiBlock newBlock = new EiBlock(blockId);
newBlock.addBlockMeta(initCodeMeta());
List<Map> results = CodeValueTools.getCodeValues(codeName);
for (Map result : results) {
Map<String, String> row = new HashMap<>();
String id = MapUtils.getString(result, "value");
String text = MapUtils.getString(result, "label");
row.put(CommonConstant.Field.VALUE_FIELD, id);
row.put(CommonConstant.Field.TEXT_FIELD, isSymbol ? id + "-" + text : text);
newBlock.addRow(row);
}
inInfo.addBlock(newBlock);
}
/**
* 构造下拉框的数据项.
*
* @return
*/
private static EiBlockMeta initCodeMeta() {
EiColumn eiColumn;
EiBlockMeta eiMetadata = new EiBlockMeta();
eiColumn = new EiColumn(CommonConstant.Field.TEXT_FIELD);
eiColumn.setFieldLength(150);
eiColumn.setDescName("描述");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(CommonConstant.Field.VALUE_FIELD);
eiColumn.setFieldLength(30);
eiColumn.setDescName("值");
eiMetadata.addMeta(eiColumn);
return eiMetadata;
}
}
......@@ -110,7 +110,7 @@ public class ServiceHGPZ021 extends ServiceBase {
*/
private void checkImportData(List<HGPZ021> fPz021s) {
// 表名称小代码
List<Map> dynamicTables = CodeValueTools.getCodeValues(CodesetConstant.HgPz.DYNAMIC_TABLE);
List<Map> dynamicTables = CodeValueTools.getCodeValues(CodesetConstant.DYNAMIC_TABLE);
for (HGPZ021 fPz021 : fPz021s) {
AssertUtils.isEmpty(fPz021.getTableCode(), String.format("序号[%s]表英文名不能为空", fPz021.getId()));
for (Map dynamicTableMap : dynamicTables) {
......
package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.core.constant.CodesetConstant;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.security.UserSessionUtils;
......@@ -31,6 +32,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
......@@ -246,7 +248,7 @@ public class ServiceHGWD001D extends TreeService {
boolean isManager = HgWdUtils.HgWd009.isManager();
List<String> projectSources = isManager ? null : listTopNode();
// 项目来源小代码
List<Map> codesetMaps = CodeValueTools.getCodeValues("app.sc.projectSource");
List<Map> codesetMaps = CodeValueTools.getCodeValues(CodesetConstant.PROJECT_SOURCE);
for (Map codesetMap : codesetMaps) {
String id = MapUtils.getString(codesetMap, "value");
String text = MapUtils.getString(codesetMap, "label");
......@@ -400,8 +402,23 @@ public class ServiceHGWD001D extends TreeService {
if (!HgWdUtils.HgWd009.isManager()) {
queryMap.put("userId", UserSessionUtils.getLoginName());
}
queryMap.put(HGSC001.FIELD_approval_status, HGConstant.ApprovalStatus.YS);
List<HGWD001> nodeWds = dao.query(HGWD001.QUERY, queryMap);
// 查询父级结构
if (CollectionUtils.isEmpty(nodeWds)) {
return inInfo;
}
List<List<String>> allPath = new ArrayList<>();
for (HGWD001 nodeWd : nodeWds) {
String fileIdPath = nodeWd.getFileIdPath();
if (StringUtils.isBlank(fileIdPath)) {
continue;
}
List<String> fileIds = Arrays.stream(fileIdPath.split("/"))
.filter(StringUtils::isNotBlank).collect(Collectors.toList());
fileIds.add(nodeWd.getFileId());
allPath.add(fileIds);
}
inInfo.set("allPath", allPath);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "搜索节点失败");
}
......
......@@ -96,7 +96,7 @@ public class ServiceHGWD001E extends ServiceEPBase {
hgwd001.setFileIdPath(setFileIdPath(hgsc001));
} else {
hgwd001.setFilePath(wd001.getFilePath() + "/" + hgwd001.getFileName());
hgwd001.setFileIdPath(wd001.getFilePath() + "/" + hgwd001.getFileId());
hgwd001.setFileIdPath(wd001.getFileIdPath() + "/" + wd001.getFileId());
}
if (hgwd001.getId() == null || hgwd001.getId() == 0) {
this.add(hgwd001);
......
......@@ -85,7 +85,7 @@ public class ServiceHGWD001F extends ServiceEPBase {
hgwd001.setFileIdPath(setFileIdPath(hgsc001));
} else {
hgwd001.setFilePath(wd001.getFilePath() + "/" + hgwd001.getFileName());
hgwd001.setFileIdPath(wd001.getFilePath() + "/" + hgwd001.getFileId());
hgwd001.setFileIdPath(wd001.getFileIdPath() + "/" + hgwd001.getFileId());
}
if (hgwd001.getId() == null || hgwd001.getId() == 0) {
this.add(hgwd001);
......
......@@ -2,7 +2,9 @@ package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CodesetConstant;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.core.tools.CodeOptionTools;
import com.baosight.hggp.hg.sc.enums.ProjectSourceEnum;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
......@@ -37,6 +39,7 @@ public class ServiceHGWD002 extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID));
CodeOptionTools.buildOption(inInfo, CodesetConstant.PROJECT_SOURCE, "project_source", false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGWD002().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......
......@@ -67,7 +67,7 @@ public class ServiceXSOG0801A extends ServiceEPBase {
condition = " ITEM_CODE = 'NOT CODE'";
}
}
List<Map> orgTypes = CodeValueTools.getCodeValues(CodesetConstant.XsOg.ORG_TYPE, condition);
List<Map> orgTypes = CodeValueTools.getCodeValues(CodesetConstant.ORG_TYPE, condition);
inInfo.addBlock("orgTypeBlock").addRows(orgTypes);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new XSOG01().eiMetadata);
} catch (Exception e) {
......
......@@ -58,7 +58,7 @@ public class ServiceXSOG0801B extends ServiceEPBase {
}else {
condition = " ITEM_CODE = 'NOT CODE'";
}
List<Map> orgTypes = CodeValueTools.getCodeValues(CodesetConstant.XsOg.ORG_TYPE, condition);
List<Map> orgTypes = CodeValueTools.getCodeValues(CodesetConstant.ORG_TYPE, condition);
inInfo.addBlock("orgTypeBlock").addRows(orgTypes);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new XSOG01().eiMetadata);
} catch (Exception e) {
......
......@@ -94,8 +94,9 @@ $(function () {
IPLATUI.EFTree = {
"categoryTree": {
ROOT: {label: 'root', text: '目录结构'},
query: function (inInfo, model) {
if (model == null) {
if (model == null || model.id === "root") {
return inInfo;
}
let label = model.label;
......@@ -324,11 +325,12 @@ $(function () {
})
$("#categoryTree").mousedown(function (e) {
if (e.button !== 2) {
let title = e.target.title;
if (e.button !== 2 || CommonUtils.isBlank(title)) {
return
}
if ("engineering" === e.target.title || "foreign" === e.target.title
|| "spare" === e.target.title || "other" === e.target.title) {
if ("root" === title || "engineering" === title || "foreign" === title
|| "spare" === title || "other" === title) {
$("#isAdd").css('display', 'none');
$("#isDel").css('display', 'none');
$("#isEdit").css('display', 'none');
......
......@@ -86,15 +86,50 @@ $(function () {
}
init();
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 500,
pageSizes: [20, 50, 100, 200, 500],
},
columns: [{
field: "operator",
title: "操作",
template: function (model) {
let template = '';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showPreview(\'' + model.docId + '\')" >预览</a>';
return template;
}
}, {
field: "docVersion",
template: function (model) {
return "v" + model.docVersion;
}
}, {
field: "docType",
template: function (row) {
if (!isBlank(row.docType) && row.docType.startsWith(".")) {
return row.docType.substring(1);
}
return row.docType == null ? "" : row.docType;
}
}],
loadComplete: function (grid) {
}
}
}
IPLATUI.EFTree = {
"docTree": {
ROOT: {label: 'root', text: '目录结构'},
query: function (inInfo, model) {
if (model == null) {
if (model == null || model.id === "root") {
return inInfo;
}
let label = model.label;
// 选中树节点
selectTreeId(label);
selectTreeId(model.id);
// 设置选中节点
treeSelectClick(model);
inInfo.set("inqu_status-0-projCode", $("#inqu_status-0-projCode").val());
......@@ -106,10 +141,8 @@ $(function () {
// 设置选中节点
treeSelectClick(nodeData);
},
/*ROOT:{label: 'root',text: '组织机构'},*/
template: function (node) {
let item = node.item;
let title = item.text;
let icon = 'fa fa-globe'
if (item.label !== 'root') {
switch (item.leafType) {
......@@ -121,14 +154,15 @@ $(function () {
break;
}
}
return ' <span class="' + icon + '" style="padding-right: 8px"> </span> <span class="titleClass" title="' + item.label + '">' + title + '</span>'
return ' <span class="' + icon + '" style="padding-right: 8px"> </span> '
+ '<span class="titleClass" title="' + item.label + '">' + item.text + '</span>'
},
loadComplete: function (options) {
// 树节点查询
$("#search").on("click", treeSearch);
},
selectTreeNode: {
fileId: '',
treeId: '',
projCode: '',
leafType: '',
downloadFlag: '0'
......@@ -138,45 +172,10 @@ $(function () {
* 开启结点拖拽功能,默认dragAndDrop = false不开启,
* 若未开启拖拽,不会触发dragstart和dragend事件
*/
dragAndDrop: false,
dragAndDrop: false
}
};
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 500,
pageSizes: [20, 50, 100, 200, 500],
},
columns: [{
field: "operator",
title: "操作",
template: function (model) {
let template = '';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showPreview(\'' + model.docId + '\')" >预览</a>';
return template;
}
}, {
field: "docVersion",
template: function (model) {
return "v" + model.docVersion;
}
}, {
field: "docType",
template: function (row) {
if (!isBlank(row.docType) && row.docType.startsWith(".")) {
return row.docType.substring(1);
}
return row.docType == null ? "" : row.docType;
}
}],
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
......@@ -294,12 +293,11 @@ let treeSelectClick = function (nodeData) {
* @param nodeData
*/
let setTreeNodeValue = function (nodeData) {
IPLATUI.EFTree.docTree.selectTreeNode.fileId = nodeData.id;
IPLATUI.EFTree.docTree.selectTreeNode.treeId = nodeData.id;
IPLATUI.EFTree.docTree.selectTreeNode.projCode = nodeData.projCode;
IPLATUI.EFTree.docTree.selectTreeNode.leafType = nodeData.leafType;
IPLATUI.EFTree.docTree.selectTreeNode.downloadFlag = nodeData.downloadFlag == null ? 0
: nodeData.downloadFlag;
$("[name = 'inqu_status-0-parentId']").val(nodeData.id);
$("[name = 'inqu_status-0-fileId']").val(nodeData.id);
$("[name = 'inqu_status-0-projCode']").val(nodeData.projCode);
}
......@@ -338,19 +336,20 @@ let preview = function () {
* @param docId
*/
let showPreview = function (docId) {
let fileId = IPLATUI.EFTree.docTree.selectTreeNode.fileId;
addRecordWindow(fileId, docId);
let treeId = IPLATUI.EFTree.docTree.selectTreeNode.treeId;
addRecordWindow(treeId, docId);
}
/**
* 树节点查询
*/
let treeSearch = function (){
let treeId = IPLATUI.EFTree.docTree.selectTreeNode.treeId;
let tree = $("#docTree").data("kendoTreeView");
let leafName = $("#searchText").val();
if (leafName == null || leafName.trim() === '') {
if (CommonUtils.isBlank(leafName)) {
tree.reload("root");
return
return;
}
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-fileName", leafName);
......@@ -362,7 +361,7 @@ let treeSearch = function (){
}
// 获取所有满足条件的子节点路径
const allPath = res.get("allPath")
if (allPath.length <= 0) {
if (CommonUtils.isBlank(allPath) || allPath.length <= 0) {
return;
}
tree.reload("root");
......
......@@ -17,30 +17,29 @@
<%-- </div>--%>
<div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="docTree" ename="tree_name" textField="text" valueField="label"
hasChildren="leaf" pid="parentId" serviceName="HGWD001D" methodName="queryTree"
expandLevel="1">
hasChildren="leaf" pid="parentId" serviceName="HGWD001D" methodName="queryTree">
</EF:EFTree>
</div>
</EF:EFRegion>
</div>
<div id="right-pane" class="i-fit-height">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput cname="项目代码" ename="projCode" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="文档库id" ename="fileId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput ename="projCode" cname="项目代码" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput ename="fileId" cname="文档库id" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="fileType" cname="附件分类" colWidth="3"
<EF:EFSelect ename="fileType" cname="附件分类" blockId="inqu_status" row="0" colWidth="3"
filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.hgwd.fileType"/>
</EF:EFSelect>
<EF:EFInput cname="附件名称" ename="docName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="docName" cname="附件名称" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFDateSpan startCname="上传时间" endCname="至" blockId="inqu_status" row="0"
startName="createdDateFrom" endName="createdDateTo" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="false">
</EF:EFDateSpan>
</div>
<div class="row">
<EF:EFInput cname="文件路径" ename="filePath" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="filePath" cname="文件路径" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment