|
|
@@ -2,6 +2,7 @@ let db = cloneSeed();
|
|
|
let session = null;
|
|
|
let route = "home";
|
|
|
let focus = null;
|
|
|
+let backRoute = null;
|
|
|
let selRegion = "pd";
|
|
|
let menuRegion = null;
|
|
|
let modal = null;
|
|
|
@@ -224,6 +225,7 @@ function currentSubs(enterpriseIndex) {
|
|
|
}
|
|
|
|
|
|
function go(next, id) {
|
|
|
+ if (next !== route) backRoute = next === "enterprise" ? route : null;
|
|
|
route = next;
|
|
|
focus = id === undefined ? null : id;
|
|
|
render();
|
|
|
@@ -384,7 +386,7 @@ function layout(title, hint, body, mainClass = "") {
|
|
|
</div>
|
|
|
</aside>
|
|
|
<section class="main ${mainClass}">
|
|
|
- <div class="top"><div><h1>${title}</h1><p>${hint}</p></div></div>
|
|
|
+ <div class="top"><div><h1>${title}</h1><p>${hint}</p></div>${route === "enterprise" && backRoute ? `<button class="btn ghost" data-go="${backRoute}">← ${backRoute === "regions" ? "返回区域管理" : "返回"}</button>` : ""}</div>
|
|
|
${body}
|
|
|
</section>
|
|
|
</div>`;
|
|
|
@@ -710,8 +712,7 @@ function pageRegions() {
|
|
|
<div class="panel uncut">
|
|
|
<div class="tree-head">
|
|
|
<h2>区域树</h2>
|
|
|
- <button class="btn ghost" data-node-menu="__root">+ 操作</button>
|
|
|
- ${menuRegion === "__root" ? `<div class="node-menu" data-menu-node="__root"><button data-menu-action="new-root">新建大区</button></div>` : ""}
|
|
|
+ <button class="btn ghost" data-new-root>+ 新建大区</button>
|
|
|
</div>
|
|
|
${treeHtml(null, 0)}
|
|
|
</div>
|
|
|
@@ -1477,7 +1478,7 @@ document.body.addEventListener("click", (event) => {
|
|
|
render();
|
|
|
return;
|
|
|
}
|
|
|
- const node = event.target.closest("[data-login],[data-go],[data-logout],[data-reset],[data-group-toggle],[data-assign],[data-auto],[data-mode],[data-fill],[data-fail],[data-done],[data-close],[data-delegate],[data-extend],[data-submit],[data-entry],[data-collect],[data-region-node],[data-node-menu],[data-menu-action],[data-modal-close],[data-modal-save],[data-scope-save],[data-scope-toggle],[data-member-save],[data-attr-save],[data-acct-add],[data-pkg-add],[data-partner-add],[data-team-add],[data-rules-save],[data-day-save],[data-op-day],[data-note-add],[data-fb-fill],[data-fb-done],[data-batch-run],[data-regops-add],[data-regops-rename],[data-regops-delete]");
|
|
|
+ const node = event.target.closest("[data-login],[data-go],[data-logout],[data-reset],[data-group-toggle],[data-assign],[data-auto],[data-mode],[data-fill],[data-fail],[data-done],[data-close],[data-delegate],[data-extend],[data-submit],[data-entry],[data-collect],[data-region-node],[data-node-menu],[data-menu-action],[data-modal-close],[data-modal-save],[data-scope-save],[data-scope-toggle],[data-member-save],[data-attr-save],[data-acct-add],[data-pkg-add],[data-partner-add],[data-team-add],[data-rules-save],[data-day-save],[data-op-day],[data-note-add],[data-fb-fill],[data-fb-done],[data-batch-run],[data-regops-add],[data-regops-rename],[data-regops-delete],[data-region-act],[data-new-root]");
|
|
|
if (!node) {
|
|
|
if (menuRegion) { menuRegion = null; render(); }
|
|
|
return;
|
|
|
@@ -1607,12 +1608,16 @@ document.body.addEventListener("click", (event) => {
|
|
|
render();
|
|
|
return;
|
|
|
}
|
|
|
+ if (d.newRoot !== undefined) {
|
|
|
+ menuRegion = null;
|
|
|
+ openModal({ kind: "new", parentId: null, title: "新建大区" });
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (d.menuAction !== undefined) {
|
|
|
const wrap = event.target.closest("[data-menu-node]");
|
|
|
const nodeId = wrap ? wrap.dataset.menuNode : null;
|
|
|
menuRegion = null;
|
|
|
- if (d.menuAction === "new-root") openModal({ kind: "new", parentId: null, title: "新建大区" });
|
|
|
- else if (d.menuAction === "new-child") openModal({ kind: "new", parentId: nodeId, title: "新建下级节点" });
|
|
|
+ if (d.menuAction === "new-child") openModal({ kind: "new", parentId: nodeId, title: "新建下级节点" });
|
|
|
else if (d.menuAction === "rename") openModal({ kind: "rename", nodeId, title: `重命名「${regionNode(db, nodeId).name}」` });
|
|
|
else if (d.menuAction === "mount") openModal({ kind: "mount", nodeId, title: `挂载企业到「${regionNode(db, nodeId).name}」` });
|
|
|
else if (d.menuAction === "delete") openModal({ kind: "delete", nodeId, title: `删除「${regionNode(db, nodeId).name}」` });
|