feat: refine suffix management layout and column ordering
- column sort dialog: reorder via arrows (persisted via new POST /dirs/:id/columns/order), precise column insertion after a selected position (create column accepts after_id), value columns shown in blue text inside the dialog - workspace cells: edit only after entering the row's 编辑 mode, then double-click the cell (matching legacy interaction) - collapsible global sidebar with edge handle (state persisted); suffix panel directory collapses independently; independent scrollbars for directory and workspace; 5px gap to the sidebar - suffix page drops the internal-console heading block and the 内部管理台 topbar label; 退出 moves to the sidebar footer (same line as the admin email, 5px from the edge); brand subtitle 统一授权管理平台 removed - integration test covers column reorder/precise insert/dedupe
This commit is contained in:
@@ -157,10 +157,46 @@ func TestSuffixAdminIntegration(t *testing.T) {
|
||||
if w.Code != 201 {
|
||||
t.Fatalf("建值列 status=%d body=%s", w.Code, w.Body.String())
|
||||
}
|
||||
valueColID := uint64(getJSON(w)["data"].(map[string]any)["id"].(float64))
|
||||
w = authed(http.MethodPost, fmt.Sprintf("/api/v1/suffix-admin/dirs/%d/columns", dirID), `{"name":"招标人","is_value":false}`)
|
||||
if w.Code != 409 {
|
||||
t.Fatalf("同目录重名列 status=%d, want 409", w.Code)
|
||||
}
|
||||
// 精准插入:插到 招标人 之后
|
||||
w = authed(http.MethodPost, fmt.Sprintf("/api/v1/suffix-admin/dirs/%d/columns", dirID),
|
||||
fmt.Sprintf(`{"name":"插队列","is_value":false,"after_id":%d}`, plainColID))
|
||||
if w.Code != 201 {
|
||||
t.Fatalf("精准插列 status=%d body=%s", w.Code, w.Body.String())
|
||||
}
|
||||
insertedID := uint64(getJSON(w)["data"].(map[string]any)["id"].(float64))
|
||||
w = authed(http.MethodGet, fmt.Sprintf("/api/v1/suffix-admin/dirs/%d/page", dirID), "")
|
||||
pageCols := getJSON(w)["data"].(map[string]any)["columns"].([]any)
|
||||
if pageCols[1].(map[string]any)["id"].(float64) != float64(insertedID) {
|
||||
t.Fatal("精准插列应落在 招标人 之后(第2位)")
|
||||
}
|
||||
// 列排序:插队列移回末位 → 顺序变为 招标人,工料机类型,插队列
|
||||
w = authed(http.MethodPost, fmt.Sprintf("/api/v1/suffix-admin/dirs/%d/columns/order", dirID),
|
||||
fmt.Sprintf(`{"ids":[%d,%d,%d]}`, plainColID, valueColID, insertedID))
|
||||
if w.Code != 200 {
|
||||
t.Fatalf("列排序 status=%d body=%s", w.Code, w.Body.String())
|
||||
}
|
||||
// 漏传列:没传的按原顺序补到末尾 → 顺序不变(招标人,工料机类型,插队列)
|
||||
w = authed(http.MethodPost, fmt.Sprintf("/api/v1/suffix-admin/dirs/%d/columns/order", dirID),
|
||||
fmt.Sprintf(`{"ids":[%d,%d]}`, plainColID, valueColID))
|
||||
if w.Code != 200 {
|
||||
t.Fatalf("漏传列补尾 status=%d body=%s", w.Code, w.Body.String())
|
||||
}
|
||||
// 外列 → 404
|
||||
w = authed(http.MethodPost, fmt.Sprintf("/api/v1/suffix-admin/dirs/%d/columns/order", dirID),
|
||||
`{"ids":[999999]}`)
|
||||
if w.Code != 404 {
|
||||
t.Fatalf("外列 status=%d, want 404", w.Code)
|
||||
}
|
||||
w = authed(http.MethodGet, fmt.Sprintf("/api/v1/suffix-admin/dirs/%d/page", dirID), "")
|
||||
orderedCols := getJSON(w)["data"].(map[string]any)["columns"].([]any)
|
||||
if orderedCols[0].(map[string]any)["name"] != "招标人" || orderedCols[1].(map[string]any)["name"] != "工料机类型" || orderedCols[2].(map[string]any)["name"] != "插队列" {
|
||||
t.Fatalf("排序后顺序不符: %v", orderedCols)
|
||||
}
|
||||
w = authed(http.MethodPut, "/api/v1/suffix-admin/cells",
|
||||
fmt.Sprintf(`{"dir_id":%d,"suffix_id":%d,"column_id":%d,"value":"普通文本"}`, dirID, suffixID, plainColID))
|
||||
if w.Code == 404 || w.Code == 400 {
|
||||
@@ -171,9 +207,10 @@ func TestSuffixAdminIntegration(t *testing.T) {
|
||||
w = authed(http.MethodGet, fmt.Sprintf("/api/v1/suffix-admin/dirs/%d/page", dirID), "")
|
||||
page := getJSON(w)["data"].(map[string]any)
|
||||
cols := page["columns"].([]any)
|
||||
if len(cols) != 2 {
|
||||
t.Fatalf("列数=%d, want 2", len(cols))
|
||||
if len(cols) != 3 {
|
||||
t.Fatalf("列数=%d, want 3", len(cols))
|
||||
}
|
||||
// 排序后顺序:招标人,工料机类型,插队列;第二列=值列
|
||||
if !cols[1].(map[string]any)["is_value"].(bool) {
|
||||
t.Fatal("第二列应为值列")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user