|
|
|
@ -35,6 +35,7 @@ function startRender() { |
|
|
|
|
toolbar: '#tableToolBar', |
|
|
|
|
searchFieldNames: 'formComment', |
|
|
|
|
url: `${ctx}/directory/form/page?dirId=${dirId}`, |
|
|
|
|
where: {dirId}, |
|
|
|
|
height: 'full-110', |
|
|
|
|
//method: 'get',
|
|
|
|
|
text: {none: permis.viewPermis ? '没有数据' : '没有权限'}, |
|
|
|
@ -104,51 +105,67 @@ function startRender() { |
|
|
|
|
|
|
|
|
|
// 加载并渲染目录树
|
|
|
|
|
let currentNode, currentParentNode; |
|
|
|
|
let treeChildrenUrl = `${ctx}/business/directory/tree?busType=${bus_type}` |
|
|
|
|
let treeOps = { |
|
|
|
|
id: 'directoryTree', |
|
|
|
|
url: treeChildrenUrl, |
|
|
|
|
cache: false, |
|
|
|
|
//type: 'all',
|
|
|
|
|
initLevel: 1, // 默认展开一级
|
|
|
|
|
scroll: '#tree-toobar-div', |
|
|
|
|
width: 'fit-content', |
|
|
|
|
toolbar: true, |
|
|
|
|
toolbarShow: [], //置空默认菜单项
|
|
|
|
|
sendSuccess: function (res) { |
|
|
|
|
if (res.flag) { |
|
|
|
|
res.data.forEach(item => { |
|
|
|
|
dirCache.set(item.id, item); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
$('.dtree-nav-div.dtree-theme-item').each((index, elem) => { |
|
|
|
|
let data = $(elem).data('basic'); |
|
|
|
|
if (data) { |
|
|
|
|
if (typeof data === 'string') { |
|
|
|
|
data = JSON.parse(data); |
|
|
|
|
} |
|
|
|
|
let title = data.metadataComment || data.directoryName || data.fileName + data.fileSuffix; |
|
|
|
|
$(elem).attr('title', title) |
|
|
|
|
let treeChildrenUrl = `${ctx}/business/directory/tree?busType=${bus_type}`; |
|
|
|
|
const toolbarExt = [ |
|
|
|
|
{ |
|
|
|
|
toolbarId: "toolbar_dir_add", |
|
|
|
|
icon: "dtreefont dtree-icon-weibiaoti5", |
|
|
|
|
title: "新建目录", |
|
|
|
|
handler: function (node, elem) { |
|
|
|
|
const {id, basicData} = node; |
|
|
|
|
openDirectoryEditLayer({parentId: id}, function (data) { |
|
|
|
|
if (id === DIR_ROOT_ID) { |
|
|
|
|
dirTree.partialRefreshAdd(elem); |
|
|
|
|
} else { |
|
|
|
|
setTimeout(function () { |
|
|
|
|
let $newDom = $(`#directoryTree div.dtree-nav-div.dtree-theme-item[data-id="${basicData.id}"]`) |
|
|
|
|
dirTree.partialRefreshAdd($newDom); |
|
|
|
|
}, 50) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, 200) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
done: function (nodes, elem) { |
|
|
|
|
// 模拟鼠标点击事件展开第一层目录
|
|
|
|
|
elem.find('li:first>div:first>i:first').click(); |
|
|
|
|
elem.find('li:first>div:first').click(); |
|
|
|
|
{ |
|
|
|
|
toolbarId: "toolbar_dir_rename", |
|
|
|
|
icon: "dtreefont dtree-icon-bianji", |
|
|
|
|
title: "修改目录", |
|
|
|
|
handler: function (node, elem) { |
|
|
|
|
const {basicData} = node; |
|
|
|
|
openDirectoryEditLayer(basicData, function (data) { |
|
|
|
|
dirTree.partialRefreshEdit(elem, data); |
|
|
|
|
dirTree.getChild(elem); |
|
|
|
|
elem[0].click(); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onClick: function (node) { |
|
|
|
|
tempNode = node; |
|
|
|
|
currentNode = getCurrentNode(); |
|
|
|
|
currentParentNode = getCurrentParentNode(); |
|
|
|
|
const {basicData} = node.param; |
|
|
|
|
setLocation(basicData.directoryPath) |
|
|
|
|
loadMetadataList(node.param) |
|
|
|
|
{ |
|
|
|
|
toolbarId: "toolbar_dir_delete", |
|
|
|
|
icon: "dtreefont dtree-icon-delete1", |
|
|
|
|
title: "删除目录", |
|
|
|
|
handler: function (node, elem) { |
|
|
|
|
const {id, parentId} = node; |
|
|
|
|
deleteDirectory(id).then(() => { |
|
|
|
|
//dirTree.partialRefreshDel(elem)
|
|
|
|
|
reZhanKai(currentParentNode); |
|
|
|
|
// 点击父节点
|
|
|
|
|
$(`div[data-id="${parentId}"]`).click(); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
toolbarFun: { |
|
|
|
|
{ |
|
|
|
|
toolbarId: "toolbar_dir_link", |
|
|
|
|
icon: "layui-icon layui-icon-link", |
|
|
|
|
title: "关联数据", |
|
|
|
|
handler: function (node, elem) { |
|
|
|
|
const {basicData, id, parentId, context} = node; |
|
|
|
|
openAddMetadataLayer(basicData, function () { |
|
|
|
|
//dirTree.partialRefreshAdd(elem);
|
|
|
|
|
metaListTable.reloadTable(); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
]; |
|
|
|
|
const toolbarFun = { |
|
|
|
|
// 显示右键菜单之前的回调,用于设置显示哪些菜单
|
|
|
|
|
loadToolbarBefore: function (buttons, param, $div) { |
|
|
|
|
const {basicData} = param; |
|
|
|
@ -203,66 +220,52 @@ function startRender() { |
|
|
|
|
|
|
|
|
|
return buttons; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
toolbarExt: [ |
|
|
|
|
{ |
|
|
|
|
toolbarId: "toolbar_dir_add", |
|
|
|
|
icon: "dtreefont dtree-icon-weibiaoti5", |
|
|
|
|
title: "新建目录", |
|
|
|
|
handler: function (node, elem) { |
|
|
|
|
const {id, basicData} = node; |
|
|
|
|
openDirectoryEditLayer({parentId: id}, function (data) { |
|
|
|
|
if (id === DIR_ROOT_ID) { |
|
|
|
|
dirTree.partialRefreshAdd(elem); |
|
|
|
|
} else { |
|
|
|
|
setTimeout(function () { |
|
|
|
|
let $newDom = $(`#directoryTree div.dtree-nav-div.dtree-theme-item[data-id="${basicData.id}"]`) |
|
|
|
|
dirTree.partialRefreshAdd($newDom); |
|
|
|
|
}, 50) |
|
|
|
|
}; |
|
|
|
|
let treeOps = { |
|
|
|
|
id: 'directoryTree', |
|
|
|
|
url: treeChildrenUrl, |
|
|
|
|
cache: false, |
|
|
|
|
//type: 'all',
|
|
|
|
|
initLevel: 1, // 默认展开一级
|
|
|
|
|
scroll: '#tree-toobar-div', |
|
|
|
|
width: 'fit-content', |
|
|
|
|
toolbar: true, |
|
|
|
|
toolbarShow: [], //置空默认菜单项
|
|
|
|
|
sendSuccess: function (res) { |
|
|
|
|
if (res.flag) { |
|
|
|
|
res.data.forEach(item => { |
|
|
|
|
dirCache.set(item.id, item); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
$('.dtree-nav-div.dtree-theme-item').each((index, elem) => { |
|
|
|
|
let data = $(elem).data('basic'); |
|
|
|
|
if (data) { |
|
|
|
|
if (typeof data === 'string') { |
|
|
|
|
data = JSON.parse(data); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
let title = data.metadataComment || data.directoryName || data.fileName + data.fileSuffix; |
|
|
|
|
$(elem).attr('title', title) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
toolbarId: "toolbar_dir_rename", |
|
|
|
|
icon: "dtreefont dtree-icon-bianji", |
|
|
|
|
title: "修改目录", |
|
|
|
|
handler: function (node, elem) { |
|
|
|
|
const {basicData} = node; |
|
|
|
|
openDirectoryEditLayer(basicData, function (data) { |
|
|
|
|
dirTree.partialRefreshEdit(elem, data); |
|
|
|
|
dirTree.getChild(elem); |
|
|
|
|
elem[0].click(); |
|
|
|
|
}); |
|
|
|
|
}, 200) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
toolbarId: "toolbar_dir_delete", |
|
|
|
|
icon: "dtreefont dtree-icon-delete1", |
|
|
|
|
title: "删除目录", |
|
|
|
|
handler: function (node, elem) { |
|
|
|
|
const {id, parentId} = node; |
|
|
|
|
deleteDirectory(id).then(() => { |
|
|
|
|
//dirTree.partialRefreshDel(elem)
|
|
|
|
|
reZhanKai(currentParentNode); |
|
|
|
|
// 点击父节点
|
|
|
|
|
$(`div[data-id="${parentId}"]`).click(); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
done: function (nodes, elem) { |
|
|
|
|
// 模拟鼠标点击事件展开第一层目录
|
|
|
|
|
elem.find('li:first>div:first>i:first').click(); |
|
|
|
|
elem.find('li:first>div:first').click(); |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
toolbarId: "toolbar_dir_link", |
|
|
|
|
icon: "layui-icon layui-icon-link", |
|
|
|
|
title: "关联数据", |
|
|
|
|
handler: function (node, elem) { |
|
|
|
|
const {basicData, id, parentId, context} = node; |
|
|
|
|
openAddMetadataLayer(basicData, function () { |
|
|
|
|
//dirTree.partialRefreshAdd(elem);
|
|
|
|
|
metaListTable.reloadTable(); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
onClick: function (node) { |
|
|
|
|
tempNode = node; |
|
|
|
|
currentNode = getCurrentNode(); |
|
|
|
|
currentParentNode = getCurrentParentNode(); |
|
|
|
|
const {basicData} = node.param; |
|
|
|
|
setLocation(basicData.directoryPath) |
|
|
|
|
loadMetadataList(node.param) |
|
|
|
|
}, |
|
|
|
|
toolbarFun: !browser && toolbarFun, |
|
|
|
|
toolbarExt: !browser && toolbarExt, |
|
|
|
|
} |
|
|
|
|
dirTree = globalTree.init(treeOps); |
|
|
|
|
|
|
|
|
|