Commit c1a0de21 by 宋祥

1.文档库叶子节点选中错误问题

parent 6954b057
...@@ -311,7 +311,7 @@ public class ServiceHGWD001D extends TreeService { ...@@ -311,7 +311,7 @@ public class ServiceHGWD001D extends TreeService {
List<Map> results = new ArrayList(); List<Map> results = new ArrayList();
String userId = UserSessionUtils.getLoginName(); String userId = UserSessionUtils.getLoginName();
// 查询项目来源 // 查询项目来源
HGSC001 dbSc001 = HGSCTools.Hgsc001.queryByCode(projCode); HGSC001 dbSc001 = HGSCTools.Hgsc001.getByCode(projCode);
// true:需要权限 // true:需要权限
boolean isSourceAuth = !ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource()); boolean isSourceAuth = !ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource());
Map queryMap = new HashMap(); Map queryMap = new HashMap();
......
...@@ -95,27 +95,23 @@ $(function () { ...@@ -95,27 +95,23 @@ $(function () {
IPLATUI.EFTree = { IPLATUI.EFTree = {
"categoryTree": { "categoryTree": {
query: function (inInfo, model) { query: function (inInfo, model) {
if (model == null) {
return inInfo;
}
let label = model.label;
// 选中树节点
selectTreeId(label);
// 设置选中节点
treeSelectClick(model);
inInfo.set("inqu_status-0-projCode", $("#inqu_status-0-projCode").val()); inInfo.set("inqu_status-0-projCode", $("#inqu_status-0-projCode").val());
return inInfo; return inInfo;
}, },
select: function (e) { select: function (e) {
var _data = this.dataItem(e.node); let nodeData = this.dataItem(e.node);
var labelValue = _data.label; // 设置选中节点
var typeValue = _data.type; treeSelectClick(nodeData);
const eNameValue = _data.ename;
setTreeNodeValue(_data);
$("[name = 'inqu_status-0-parentId']").val(labelValue);
$("[name = 'inqu_status-0-fileId']").val(eNameValue);
$("[name = 'inqu_status-0-leafLevel']").val(_data.leafLevel==null?0:_data.leafLevel);
$("[name = 'inqu_status-0-projCode']").val(_data.projCode);
$("[name = 'inqu_status-0-type']").val(typeValue);
$("[name = 'inqu_status-0-fileName']").val(_data.text);
$("[name = 'inqu_status-0-leafType']").val(_data.leafType);
resultGrid.dataSource.page(1);
// 编辑、删除树节点时,需要刷新的树节点 // 编辑、删除树节点时,需要刷新的树节点
$("[name = 'inqu_status-0-orgParentId']").val(_data.parentId); $("[name = 'inqu_status-0-orgParentId']").val(nodeData.parentId);
// 显示授权按钮
showAuthButton();
}, },
/*ROOT:{label: 'root',text: '组织机构'},*/ /*ROOT:{label: 'root',text: '组织机构'},*/
template: function (node) { template: function (node) {
...@@ -683,42 +679,27 @@ function expandTreeNodeList(tree, nodeIdList) { ...@@ -683,42 +679,27 @@ function expandTreeNodeList(tree, nodeIdList) {
} }
/** /**
* 选中对应的树节点
* @param tree
* @param treeOrgId
*/
const selectTreeNode = (tree, treeOrgId) => {
if (!tree || treeOrgId == null) {
return
}
setTimeout(() => {
let barDataItem = tree.dataSource.get(treeOrgId);
if (barDataItem) {
let barElement = tree.findByUid(barDataItem.uid);
// 刷新完成后选中对应的树节点
tree.select(barElement);
setTreeNodeValue(barDataItem);
} else {
selectTreeNode(tree, treeOrgId)
}
}, 100)
}
/**
* 设置树节点的值 * 设置树节点的值
* *
* @param nodeData * @param nodeData
*/ */
let setTreeNodeValue = function (nodeData) { let setTreeNodeValue = function (nodeData) {
IPLATUI.EFTree.categoryTree.selectTreeNode.fileId = nodeData.id; let leafLevel = nodeData.leafLevel == null ? 0 : nodeData.leafLevel;
IPLATUI.EFTree.categoryTree.selectTreeNode.fileId = nodeData.label;
IPLATUI.EFTree.categoryTree.selectTreeNode.parentId = nodeData.parentId; IPLATUI.EFTree.categoryTree.selectTreeNode.parentId = nodeData.parentId;
IPLATUI.EFTree.categoryTree.selectTreeNode.fileName = nodeData.text; IPLATUI.EFTree.categoryTree.selectTreeNode.fileName = nodeData.text;
IPLATUI.EFTree.categoryTree.selectTreeNode.companyCode = nodeData.companyCode; IPLATUI.EFTree.categoryTree.selectTreeNode.companyCode = nodeData.companyCode;
IPLATUI.EFTree.categoryTree.selectTreeNode.projCode = nodeData.projCode; IPLATUI.EFTree.categoryTree.selectTreeNode.projCode = nodeData.projCode;
IPLATUI.EFTree.categoryTree.selectTreeNode.leafLevel = nodeData.leafLevel; IPLATUI.EFTree.categoryTree.selectTreeNode.leafLevel = leafLevel;
IPLATUI.EFTree.categoryTree.selectTreeNode.leafType = nodeData.leafType; IPLATUI.EFTree.categoryTree.selectTreeNode.leafType = nodeData.leafType;
IPLATUI.EFTree.categoryTree.selectTreeNode.isAuth = nodeData.isAuth; IPLATUI.EFTree.categoryTree.selectTreeNode.isAuth = nodeData.isAuth;
$("[name = 'inqu_status-0-parentId']").val(nodeData.label);
$("[name = 'inqu_status-0-fileId']").val(nodeData.label);
$("[name = 'inqu_status-0-leafLevel']").val(leafLevel);
$("[name = 'inqu_status-0-projCode']").val(nodeData.projCode);
$("[name = 'inqu_status-0-type']").val(nodeData.Type);
$("[name = 'inqu_status-0-fileName']").val(nodeData.text);
$("[name = 'inqu_status-0-leafType']").val(nodeData.leafType);
} }
/** /**
...@@ -1092,3 +1073,51 @@ let isProjectManager = function (parentId) { ...@@ -1092,3 +1073,51 @@ let isProjectManager = function (parentId) {
} }
}, {async: false}) }, {async: false})
} }
/**
* 选中树节点
*
* @param treeId
*/
let selectTreeId = function (treeId) {
// 刷新树节点
const tree = $("#categoryTree").data("kendoTreeView");
// 选中的节点
selectTreeNode(tree, treeId);
}
/**
* 选中树节点
*
* @param tree
* @param treeId
*/
let selectTreeNode = (tree, treeId) => {
if (!tree || treeId == null) {
return
}
setTimeout(() => {
let barDataItem = tree.dataSource.get(treeId);
if (barDataItem) {
let barElement = tree.findByUid(barDataItem.uid);
// 刷新完成后选中对应的树节点
tree.select(barElement);
} else {
selectTreeNode(tree, treeId)
}
}, 300)
}
/**
* 树点击事件
*
* @param nodeData
*/
let treeSelectClick = function (nodeData) {
// 设置选择的树节点信息
setTreeNodeValue(nodeData);
// 显示授权按钮
showAuthButton();
// 刷新列表
query();
}
\ No newline at end of file
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