feat(target-lists): 切换至B方案行内编辑布局

- 名单管理页改为左侧分类导航、右侧宽表格,编辑在对应记录行下展开
- 新增条目按钮触发行内表单,筛选或分页时草稿保留在表格顶部
- 登记模块增加beforeunload保护,区分保存中与未保存状态
- 外观模块增加beforeunload保护并修复偏好拉取的竞态问题
- 地图定位面板调整底部内边距和标题间距
- 更新相关测试脚本适配新交互流程
```
This commit is contained in:
2026-10-23 17:42:17 +08:00
parent 461e2c8e7f
commit 18c5178d8f
14 changed files with 196 additions and 27 deletions
+9 -5
View File
@@ -1,4 +1,4 @@
// Appearance preview acceptance with an isolated database; no physical transports opened.
// Module navigation acceptance with an isolated database; no physical transports opened.
import {mkdtemp} from 'node:fs/promises';
import {tmpdir} from 'node:os';
import path from 'node:path';
@@ -18,7 +18,7 @@ const wait=ms=>new Promise(r=>setTimeout(r,ms));
function start(){child=spawn(exe,['--data-root',root,'--simulation-api'],{env:{...process.env,RID_TEST_PORT:String(backend),PATH:'C:\\Windows\\System32'},windowsHide:true,stdio:['ignore','pipe','pipe']});child.stdout.on('data',b=>output+=b);child.stderr.on('data',b=>output+=b);child.on('error',e=>output+=e.message)}
async function stop(){if(child&&child.exitCode===null){const done=new Promise(r=>child.once('exit',r));child.kill();await done}}
async function ready(){for(let i=0;i<150;i++){if(child.exitCode!==null)throw Error(output);try{if((await fetch(base+'/api/appearance')).ok)return}catch{}await wait(100)}throw Error('server timeout '+output)}
let report={};
let report={root};
try {
await new Promise(r=>proxy.listen(0,'127.0.0.1',r));base='http://127.0.0.1:'+proxy.address().port;start();await ready();
browser=await chromium.launch({headless:true,channel:'msedge'});
@@ -27,8 +27,11 @@ try {
const menu=()=>page.locator('.reference-rail button:visible');
const open=async name=>page.locator(`.reference-rail [data-open="${name}"]`).click();
const home=async()=>page.locator('.reference-rail [data-home]').click();
const labels=async expected=>assert.deepEqual(await menu().evaluateAll(es=>es.map(e=>e.getAttribute('aria-label'))),['应用总览',...expected]);
const labels=async expected=>assert.deepEqual(await menu().evaluateAll(es=>es.map(e=>e.getAttribute('aria-label'))),expected.length?['应用总览',...expected]:[]);
await page.goto(base);await page.locator('#home-app-settings').waitFor();await labels([]);
for(const width of [1600,1000,700,390]){await page.setViewportSize({width,height:1000});assert.equal(await page.locator('.reference-rail').isVisible(),false);assert.equal(await page.locator('#toggle-menu').isVisible(),false);const bounds=await page.locator('.homescreen').boundingBox();assert.equal(bounds.x,0);assert.equal(bounds.width,width);assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);}
await page.setViewportSize({width:1600,height:1000});await page.screenshot({path:path.join(root,'home-no-sidebar.png')});
const iconShapes=await page.locator('.reference-rail [data-module=settings] svg,.reference-rail [data-module=register] svg').evaluateAll(es=>es.map(e=>e.innerHTML));assert.equal(new Set(iconShapes).size,5);
await page.locator('#home-app-settings').click();await labels(['壁纸与外观','显示方式','地图配置']);
assert.equal(await page.locator('.settings-sidebar,.map-settings-nav').count(),0);
assert.equal(await page.locator('#choose-wallpaper').isVisible(),true);
@@ -43,7 +46,7 @@ try {
await page.locator('#register-button').click();await page.locator('#record-result').waitFor();
await open('archives');await page.locator('#history-query').fill('NAV-123456');await page.locator('.archive-card').waitFor();
await page.locator('[data-action=view]').click();assert.equal(await page.locator('#reference-title').innerText(),'设备登记');assert.equal(await page.locator('#record-result').isVisible(),true);
await open('archives');await page.locator('[data-action=more]').click();await page.locator('[data-action=edit]').click();await page.locator('#edit-dialog').waitFor();await page.locator('#edit-owner').fill('导航编辑验证');await page.locator('#edit-save').click();await page.locator('#edit-dialog').waitFor({state:'hidden'});assert.equal(await page.locator('#reference-title').innerText(),'本地档案');
await open('archives');await page.locator('[data-action=more]').click();await page.locator('[data-action=edit]').click();await page.locator('#edit-dialog').waitFor();await page.locator('#edit-owner').fill('导航编辑验证');await page.locator('#edit-save').click();await page.locator('#edit-dialog').waitFor({state:'hidden'});await page.locator('body[data-screen=archives]').waitFor();assert.equal(await page.locator('#reference-title').innerText(),'本地档案');
await page.locator('#selection-toggle').click();await page.locator('[data-action=select]').check();await page.locator('#export-toggle').click();
const download=page.waitForEvent('download');await page.locator('#export-excel').click();assert.ok((await download).suggestedFilename().endsWith('.xlsx'));
await page.locator('#new-registration').click();assert.equal(await page.locator('#serial-no').inputValue(),'');
@@ -55,9 +58,10 @@ try {
for(const name of ['geofences','target-lists','realtime']) {await open(name);await labels(['实时工作台','电子围栏','黑白名单管理']);assert.equal(await page.locator('.reference-rail [aria-current=page]').getAttribute('data-menu'),name);}
await page.locator('#toggle-menu').click();assert.equal(await page.locator('.reference-rail').isVisible(),false);await page.locator('#toggle-menu').click();
await home();await page.locator('#home-app-settings').focus();await page.keyboard.press('Enter');await labels(['壁纸与外观','显示方式','地图配置']);
await page.locator('#toggle-menu').click();await page.locator('.workspace-home-link').click();await labels([]);assert.equal(await page.locator('#toggle-menu').isVisible(),false);await page.locator('#home-app-settings').click();assert.equal(await page.locator('.reference-rail').isVisible(),false);assert.equal(await page.locator('#toggle-menu').isVisible(),true);await page.locator('#toggle-menu').click();await labels(['壁纸与外观','显示方式','地图配置']);
await page.setViewportSize({width:700,height:1000});await page.screenshot({path:path.join(root,'module-settings-narrow.png')});
await page.setViewportSize({width:1600,height:1000});await page.screenshot({path:path.join(root,'module-settings.png')});
assert.deepEqual(errors,[]);report={passed:true,root,checks:['archive export','module menus','settings split','archive split','draft retention','create and view record','edit return','new registration','responsive widths','realtime return','collapse','keyboard']};
assert.deepEqual(errors,[]);report={passed:true,root,checks:['home without rail or gutter','five distinct A icons','module collapse preference retained','archive export','module menus','settings split','archive split','draft retention','create and view record','edit return','new registration','responsive widths','realtime return','collapse','keyboard']};
} finally {
await browser?.close();await stop();for(const s of sockets)s.destroy();await new Promise(r=>proxy.close(r));console.log(JSON.stringify(report));
}