|
|
@@ -453,7 +453,9 @@ function currentSubs(enterpriseIndex) {
|
|
|
}
|
|
|
|
|
|
function go(next, id) {
|
|
|
- if (next !== route) backRoute = next === "enterprise" ? route : null;
|
|
|
+ /* 工单详情同样记来源页,但只认工单类的列表页(见 TICKET_LISTS),从别的页面进来时不记 */
|
|
|
+ if (next !== route)
|
|
|
+ backRoute = next === "enterprise" ? route : next === "ticket" && TICKET_LISTS[route] ? route : null;
|
|
|
route = next;
|
|
|
focus = id === undefined ? null : id;
|
|
|
render();
|
|
|
@@ -967,9 +969,28 @@ window.addEventListener("resize", () => {
|
|
|
(这里不能回到详情页自身,go() 不带下标会把 focus 清掉) */
|
|
|
const DETAIL_BACK = { statement: ["statements", "返回对账清单"], bill: ["bills", "返回账单明细"] };
|
|
|
|
|
|
+/* 能点「查看」进工单详情的工单列表页,值是页面标题(概览页的未完成工单弹窗也算一个入口) */
|
|
|
+const TICKET_LISTS = {
|
|
|
+ tickets: "工单列表", mine: "我的工单", backfill: "开停回填",
|
|
|
+ queue: "待分派工单", progress: "工单进度", home: "概览",
|
|
|
+};
|
|
|
+
|
|
|
+/* 工单详情的返回入口:回到进入前的那张工单列表;刷新或从别的页面进来时,退回本角色默认的那张 */
|
|
|
+function ticketBackHtml() {
|
|
|
+ const role = user().role;
|
|
|
+ const to = TICKET_LISTS[backRoute] ? backRoute
|
|
|
+ : role === "ops" || role === "worker" ? "mine"
|
|
|
+ : role === "enterprise" || role === "sub" ? "progress" : "tickets";
|
|
|
+ /* 同一张页面对不同角色换了标题,按钮文案跟着页面走 */
|
|
|
+ const label = to === "mine" && role === "worker" ? "我的施工工单"
|
|
|
+ : to === "progress" && role === "sub" ? "我的工单" : TICKET_LISTS[to];
|
|
|
+ return `<button class="btn ghost" data-go="${to}">← 返回${label}</button>`;
|
|
|
+}
|
|
|
+
|
|
|
function backButton() {
|
|
|
if (route === "enterprise" && backRoute)
|
|
|
return `<button class="btn ghost" data-go="${backRoute}">← ${backRoute === "regions" ? "返回区域管理" : "返回"}</button>`;
|
|
|
+ if (route === "ticket") return ticketBackHtml();
|
|
|
const t = DETAIL_BACK[route];
|
|
|
return t ? `<button class="btn ghost" data-go="${t[0]}">← ${t[1]}</button>` : "";
|
|
|
}
|