Y3}
zGQ#76^`=GHBRl3oRDawdD-@WzR^N$aJTj(2@3SYmPZ?67cTCg7GZny6MWNsqNdc&+
z0cx#T=?GZ!DBR2(pa{}|$p?xi%HWNKajUkqgaaIcG?WI~9IR!`ah_T-U|dtC?^>hf
z3?OFEv&E}014y&HWsHq5So8>EpTu%PcwjPtE|20t==l0Bum6J!21e(jWTGtw1lA(E
ztXATF_`Pmg?)Stbaxq+HuuXzdzn8qE@&k->$_Hi76#>s+sDK%x?kGjFMv$HUyvt6W
zgY$5qn9lX*3zhf?*@#0OAsqwXJW}=eE;-N(p{@Kq0@Qk?&MZP!yehR*AaDC!po3Ed
z8nuqj?7UPxdsDHF$#lkl<9cUMeNRI5*><5jD|YO1(DJE!UgobhI1iss&p(`4o)&)v
z0#odne*Zpww!hDj#J%Xu8qujCORKxg4BAQ*OV)0_4aj#C7mdc2pz=;&`^ryo%gBdz
zJ0~MT*Vi^XQgr2W7%)i6WUx=qg%!P^S{law41aJ7mqM28*=S&1V_(B)q
zMt?ZlXp-upc)5SYGo#m>K8G-8Zvp5db=dWVB0RUhMY9zBvX0F`o*BIMXri^ceahaQ
zg16o@sse9R=?f&~`NF_#K=zR~Xq3f1LiqAf7-cB0CeJp?`<)b{#l*?5Fh&g@6=(fH
zXV0)*xAFP!(z(`N*tPK36n=jhKhmLL9^)|89jb`-)IR(=Gi61WT%HXNFuG3Mobw16
z*?q-WblhiS*G1s{BLsr)s|A{*oZ@S@d}lI{EChEtxlrkMEfJBL(t4w)!KJqzF?-&pT8=h=5N(j{<#w~9DeFc&G!J#h5IVW@%O
zc$~tGhEh=coxy+W>+cT;cBe-+-#0!)pb}F0hffCDh~xzoCD6D#ers|{4!gD{8vJt!
z69;T#abt}itR!#8ruSYtsQQu3a(~I_jo;c?j7)${_ynJ2eR*A2>Ae4sW!Z@OI+4UQ
ziT8H14W;YLbuG9_zl)12(6_wW89lLJy?@C>oMr-SF7y+
literal 0
HcmV?d00001
diff --git a/apps/pc/src/App.vue b/apps/pc/src/App.vue
new file mode 100644
index 0000000..069648f
--- /dev/null
+++ b/apps/pc/src/App.vue
@@ -0,0 +1,128 @@
+
+
+
+
+
+
见物
+
于寻常处,见生活。
+
+
+
+
+
+
+
+ {{ error }}
+
+
+
+
+
+
{{ busy ? '正在读取空间' : '选择一个空间' }}
+
+
+
+
+
diff --git a/apps/pc/src/api.ts b/apps/pc/src/api.ts
new file mode 100644
index 0000000..1d8ddcf
--- /dev/null
+++ b/apps/pc/src/api.ts
@@ -0,0 +1,99 @@
+import { ref } from 'vue'
+
+type Grant = { accessToken: string; refreshToken: string; expiresIn: number }
+type Session = Grant & { expiry: number }
+type Options = { method?: string; body?: unknown; signal?: AbortSignal; idempotencyKey?: string }
+
+export class ApiError extends Error {
+ constructor(readonly status: number, message: string) { super(message) }
+}
+
+export const signedIn = ref(false)
+let session: Session | null = null
+let generation = 0
+let renewing: Promise | null = null
+
+async function request(path: string, options: Options, access?: string): Promise {
+ const headers = new Headers({ Accept: 'application/json' })
+ if (options.body !== undefined) headers.set('Content-Type', 'application/json')
+ if (access) headers.set('Authorization', 'Bearer ' + access)
+ if (options.idempotencyKey) headers.set('Idempotency-Key', options.idempotencyKey)
+ const response = await fetch(path, {
+ method: options.method, headers, signal: options.signal, cache: 'no-store',
+ body: options.body === undefined ? undefined : JSON.stringify(options.body),
+ })
+ if (!response.ok) {
+ const issue = await response.json().catch(() => ({}))
+ throw new ApiError(response.status, issue.detail || issue.message || '请求失败(' + response.status + ')')
+ }
+ return response.status === 204 ? undefined as T : await response.json() as T
+}
+
+function clear() {
+ generation++
+ session = null
+ renewing = null
+ signedIn.value = false
+}
+
+function install(grant: Grant) {
+ session = { ...grant, expiry: Date.now() + grant.expiresIn * 1000 }
+ signedIn.value = true
+ return session
+}
+
+export async function login(username: string, password: string) {
+ const attempt = ++generation
+ const grant = await request('/api/session/login', { method: 'POST', body: { username, password } })
+ if (attempt === generation) install(grant)
+}
+
+export async function logout() {
+ const pending = renewing
+ const refreshToken = session?.refreshToken
+ clear()
+ // A completed refresh may have already rotated the token on the server.
+ await pending?.catch(() => {})
+ if (refreshToken) await request('/api/session/logout', { method: 'POST', body: { refreshToken } }).catch(() => {})
+}
+
+function refresh(rejected?: string): Promise {
+ if (renewing) return renewing
+ if (!session) return Promise.reject(new ApiError(401, '请重新登录。'))
+ if (session.expiry > Date.now() + 30000 && session.accessToken !== rejected) return Promise.resolve(session)
+ const attempt = generation
+ const task = request('/api/session/refresh', { method: 'POST', body: { refreshToken: session.refreshToken } })
+ .then(async (grant) => {
+ if (attempt !== generation) {
+ await request('/api/session/logout', { method: 'POST', body: { refreshToken: grant.refreshToken } }).catch(() => {})
+ throw new DOMException('会话已结束', 'AbortError')
+ }
+ return install(grant)
+ })
+ .catch((error) => {
+ if (attempt === generation && error instanceof ApiError && error.status === 401) clear()
+ throw error
+ })
+ .finally(() => { if (renewing === task) renewing = null })
+ renewing = task
+ return task
+}
+
+export async function api(path: string, options: Options = {}): Promise {
+ const attempt = generation
+ const access = (await refresh()).accessToken
+ let result: T
+ try {
+ result = await request(path, options, access)
+ } catch (error) {
+ if (!(error instanceof ApiError) || error.status !== 401 || attempt !== generation) throw error
+ options.signal?.throwIfAborted()
+ result = await request(path, options, (await refresh(access)).accessToken)
+ }
+ if (attempt !== generation) throw new DOMException('会话已结束', 'AbortError')
+ return result
+}
+
+export const message = (error: unknown) => error instanceof TypeError
+ ? '连接服务失败,请检查网络后重试。'
+ : error instanceof Error ? error.message : '请求失败,请重试。'
diff --git a/apps/pc/src/items/IntakeDialog.vue b/apps/pc/src/items/IntakeDialog.vue
new file mode 100644
index 0000000..572ec76
--- /dev/null
+++ b/apps/pc/src/items/IntakeDialog.vue
@@ -0,0 +1,147 @@
+
+
+
+
+
diff --git a/apps/pc/src/items/Inventory.vue b/apps/pc/src/items/Inventory.vue
new file mode 100644
index 0000000..b90bcc2
--- /dev/null
+++ b/apps/pc/src/items/Inventory.vue
@@ -0,0 +1,217 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ listError }}
+
+
+ | 物品 | 存放位置 | 数量 |
+
+
+ |
+ |
+ {{ item.quantity }} |
+
+
+
+
+ 正在读取物品…
+
+
{{ query.trim() ? '没有找到物品' : '这里还没有物品' }}
+
+
+
+
+
+
+
+
+
diff --git a/apps/pc/src/main.ts b/apps/pc/src/main.ts
new file mode 100644
index 0000000..44c48a0
--- /dev/null
+++ b/apps/pc/src/main.ts
@@ -0,0 +1,17 @@
+import { createApp } from 'vue'
+import { createRouter, createWebHistory } from 'vue-router'
+import App from './App.vue'
+import Inventory from './items/Inventory.vue'
+import FloorPlan from './plan/FloorPlan.vue'
+import './style.css'
+
+const router = createRouter({
+ history: createWebHistory(),
+ routes: [
+ { path: '/', redirect: '/items' },
+ { path: '/items', name: 'items', component: Inventory },
+ { path: '/floor-plan', name: 'plan', component: FloorPlan },
+ { path: '/:pathMatch(.*)*', redirect: '/items' },
+ ],
+})
+createApp(App).use(router).mount('#app')
diff --git a/apps/pc/src/plan/FloorPlan.vue b/apps/pc/src/plan/FloorPlan.vue
new file mode 100644
index 0000000..8709457
--- /dev/null
+++ b/apps/pc/src/plan/FloorPlan.vue
@@ -0,0 +1,461 @@
+
+
+
+
+
+
+ {{ error }}
+
+
+
+
「{{ conflict.name }}」与另一个房间重叠,请先调整位置。
+
{{ status }}
+
正在读取平面图…
+
+
+
+
+
+
{{ target.path }}
+
+
+
+
+
+
+
+
+
diff --git a/apps/pc/src/plan/PlanCanvas.vue b/apps/pc/src/plan/PlanCanvas.vue
new file mode 100644
index 0000000..902c2f6
--- /dev/null
+++ b/apps/pc/src/plan/PlanCanvas.vue
@@ -0,0 +1,169 @@
+
+
+
+
+
+
{{ editable ? '从左侧添加位置到图上' : '还没有摆放位置' }}
+
+
+
{{ Math.round(zoom * 100) }}%
+
+
+
+
+
diff --git a/apps/pc/src/plan/geometry.ts b/apps/pc/src/plan/geometry.ts
new file mode 100644
index 0000000..5ce5240
--- /dev/null
+++ b/apps/pc/src/plan/geometry.ts
@@ -0,0 +1,92 @@
+export const templates = {
+ LIVING_ROOM: ['客厅', 4000, 3400, 'room'],
+ BEDROOM: ['卧室', 3000, 2800, 'room'],
+ STUDY: ['书房', 3000, 2800, 'room'],
+ KITCHEN: ['厨房', 2600, 2400, 'room'],
+ BATHROOM: ['卫生间', 2100, 1900, 'room'],
+ ROOM: ['房间', 3000, 2800, 'room'],
+ ENTRY: ['玄关', 2200, 1500, 'area'],
+ BALCONY: ['阳台', 2200, 1500, 'area'],
+ AREA: ['开放区域', 2200, 1500, 'area'],
+ SOFA: ['沙发', 2300, 1400, 'furniture'],
+ BED: ['床', 1600, 2100, 'furniture'],
+ DESK: ['书桌', 1400, 620, 'furniture'],
+ TV_STAND: ['电视柜', 1400, 620, 'furniture'],
+ WARDROBE: ['衣柜', 1600, 650, 'furniture'],
+ BOOKCASE: ['书架', 1100, 450, 'furniture'],
+ SHELF: ['层架', 1100, 450, 'furniture'],
+ TABLE: ['边几', 600, 600, 'furniture'],
+ STORAGE_BOX: ['收纳箱', 500, 450, 'furniture'],
+} as const
+
+export type Template = keyof typeof templates
+export type Geometry = {
+ template: Template; xMm: number; yMm: number; widthMm: number; depthMm: number; rotation: number
+}
+export type Slot = { id: string; name: string; icon: string; geometry: Geometry | null }
+export type Snapshot = { version: string; widthMm: number; depthMm: number; locations: Slot[] }
+export type Placement = { id: string; name: string; newName?: string; geometry: Geometry }
+export type Suggestion = { locationId: string | null; name: string; note: string; geometry: Geometry | null }
+export type Bounds = Pick
+export type Guides = { x?: number; y?: number }
+
+export const grid = 100
+export const kind = (template: Template) => templates[template][3]
+export const overlap = (a: Geometry, b: Geometry) => a.xMm < b.xMm + b.widthMm && b.xMm < a.xMm + a.widthMm
+ && a.yMm < b.yMm + b.depthMm && b.yMm < a.yMm + a.depthMm
+const limit = (value: number, min: number, max: number) => Math.max(min, Math.min(max, Math.round(value)))
+
+export function fit(shape: Geometry, board: Bounds): Geometry {
+ const widthMm = limit(shape.widthMm, 100, board.widthMm)
+ const depthMm = limit(shape.depthMm, 100, board.depthMm)
+ return { ...shape, widthMm, depthMm, xMm: limit(shape.xMm, 0, board.widthMm - widthMm),
+ yMm: limit(shape.yMm, 0, board.depthMm - depthMm) }
+}
+
+export function roomConflict(placements: Placement[]) {
+ const rooms = placements.filter(({ geometry }) => kind(geometry.template) === 'room')
+ return rooms.find((room, index) => rooms.slice(0, index).some((other) => overlap(room.geometry, other.geometry)))
+}
+
+export function defaultGeometry(template: Template, board: Bounds, placements: Placement[]) {
+ const shape = fit({ template, xMm: 0, yMm: 0, widthMm: templates[template][1],
+ depthMm: templates[template][2], rotation: 0 }, board)
+ for (let y = 200; y <= board.depthMm - shape.depthMm; y += 200) {
+ for (let x = 200; x <= board.widthMm - shape.widthMm; x += 200) {
+ const candidate = { ...shape, xMm: x, yMm: y }
+ if (placements.every(({ geometry }) => !overlap(candidate, geometry))) return candidate
+ }
+ }
+ return shape
+}
+
+function alignment(start: number, size: number, bound: number, coordinates: number[], resize: boolean, tolerance: number) {
+ const anchors = resize ? [start + size] : [start, start + size / 2, start + size]
+ let guide: number | undefined
+ let adjustment = tolerance + 1
+ for (const anchor of anchors) {
+ for (const line of coordinates) {
+ if (Math.abs(line - anchor) < Math.abs(adjustment)) {
+ adjustment = line - anchor
+ guide = line
+ }
+ }
+ }
+ if (Math.abs(adjustment) > tolerance) {
+ return { value: Math.round((resize ? size : start) / grid) * grid }
+ }
+ const value = resize ? size + adjustment : start + adjustment
+ if (value < (resize ? 100 : 0) || value > (resize ? bound - start : bound - size)) return { value }
+ return { value, guide }
+}
+
+export function snap(shape: Geometry, board: Bounds, others: Geometry[], resize: boolean, tolerance: number) {
+ const x = alignment(shape.xMm, shape.widthMm, board.widthMm,
+ [0, board.widthMm, ...others.flatMap((g) => [g.xMm, g.xMm + g.widthMm / 2, g.xMm + g.widthMm])], resize, tolerance)
+ const y = alignment(shape.yMm, shape.depthMm, board.depthMm,
+ [0, board.depthMm, ...others.flatMap((g) => [g.yMm, g.yMm + g.depthMm / 2, g.yMm + g.depthMm])], resize, tolerance)
+ const geometry = fit(resize
+ ? { ...shape, widthMm: Math.min(x.value, board.widthMm - shape.xMm), depthMm: Math.min(y.value, board.depthMm - shape.yMm) }
+ : { ...shape, xMm: x.value, yMm: y.value }, board)
+ return { geometry, guides: { x: x.guide, y: y.guide } }
+}
diff --git a/apps/pc/src/style.css b/apps/pc/src/style.css
new file mode 100644
index 0000000..d35a335
--- /dev/null
+++ b/apps/pc/src/style.css
@@ -0,0 +1,231 @@
+:root {
+ font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
+ color: #172c36;
+ background: #f2f5f4;
+ font-synthesis: none;
+ --ink: #172c36;
+ --muted: #52676e;
+ --line: #dce5e3;
+ --paper: #fff;
+ --accent: #17624e;
+ --accent-soft: #e4f1ea;
+ --rail: #172d32;
+}
+* { box-sizing: border-box; }
+body { margin: 0; min-width: 340px; }
+button, input, select, textarea { font: inherit; color: inherit; }
+button, .action {
+ display: inline-flex; align-items: center; justify-content: center; gap: 7px;
+ min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px;
+ background: #fff; cursor: pointer; text-decoration: none; color: var(--ink); font-size: 13px; font-weight: 580;
+}
+button:hover:not(:disabled), .action:hover { background: #f1f7f4; border-color: #a9c2b8; }
+button:disabled { opacity: .47; cursor: default; }
+button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #238766; outline-offset: 2px; }
+.primary { background: var(--accent); color: white; border-color: var(--accent); font-weight: 650; }
+.primary:hover:not(:disabled) { background: #104d3c; border-color: #104d3c; }
+.quiet { border-color: transparent; background: transparent; }
+.icon-button { padding: 0; width: 36px; flex-shrink: 0; }
+.danger { color: #a02f39; }
+.full { width: 100%; }
+.secondary { color: var(--muted); }
+.small { font-size: 13px; }
+h1, h2, h3, p { margin: 0; }
+h1 { font-size: clamp(26px, 2.6vw, 36px); font-weight: 720; letter-spacing: -.035em; }
+h2 { font-size: 16px; font-weight: 680; }
+h3 { font-size: 14px; }
+a { color: var(--accent); }
+.notice { padding: 10px 13px; border-radius: 8px; background: #edf4f3; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
+.notice.error { color: #902c35; background: #fff0ef; }
+.notice.success { color: #1b5d42; background: #e7f4e9; }
+.notice button { min-height: 26px; border: none; padding: 0 7px; margin-inline-start: 4px; }
+.brand { display: flex; align-items: center; gap: 11px; }
+.brand img { width: 36px; height: 36px; border-radius: 9px; object-fit: contain; background: white; padding: 4px; }
+.brand strong { font-size: 21px; font-weight: 760; letter-spacing: .1em; }
+.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 26px; background: #eaf1ee; }
+.sign-in-card { width: min(100%, 420px); padding: 39px; background: white; border: 1px solid #d8e4de; border-radius: 15px; box-shadow: 0 18px 70px #22463814; }
+.sign-in-brand img { width: 49px; height: 49px; padding: 0; }
+.sign-in-brand strong { font-size: 33px; }
+.brand-line { color: var(--muted); margin: 12px 0 26px; font-size: 15px; letter-spacing: .09em; }
+.sign-in-card .primary { min-height: 43px; margin-top: 6px; }
+.shell { display: grid; grid-template-columns: 174px minmax(0, 1fr); min-height: 100dvh; }
+.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 24px; padding: 23px 15px; background: var(--rail); color: #eef5ee; }
+.rail .brand { padding-left: 6px; }
+.space-control { position: relative; display: flex; align-items: center; gap: 9px; min-width: 0; padding: 0 9px; min-height: 42px; border: 1px solid #456064; border-radius: 7px; }
+.space-control svg { color: #b4c9c3; flex-shrink: 0; }
+.space-control select { background: transparent; border: 0; appearance: none; min-width: 0; flex: 1; padding: 7px 0; color: white; }
+.space-control option { color: var(--ink); }
+.rail nav, .rail-footer { display: grid; gap: 5px; }
+.rail nav a, .rail-footer button { display: flex; justify-content: start; align-items: center; gap: 10px; min-height: 42px; text-decoration: none; color: #c4d6d0; padding: 0 11px; border-radius: 7px; font-size: 14px; }
+.rail nav a:hover, .rail-footer button:hover:not(:disabled) { background: #29464a; color: white; }
+.rail nav .router-link-active { background: #31564e; color: #f2fff8; font-weight: 700; }
+.rail-footer { margin-top: auto; }
+.workspace { min-width: 0; padding: 0 clamp(16px, 2.5vw, 38px) 24px; }
+.workspace-notice, .create-space { margin-top: 15px; }
+.create-space { display: flex; align-items: end; gap: 9px; padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; }
+.create-space label { display: grid; gap: 5px; flex: 1; font-size: 13px; }
+.page-header { display: flex; justify-content: space-between; align-items: end; gap: 15px; padding: 24px 0 20px; }
+.page-header .primary { min-height: 39px; }
+.crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
+.header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
+.save-status { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-size: 12px; margin-right: 6px; }
+.save-status i { width: 7px; height: 7px; border-radius: 50%; background: #bd7c2e; }
+.panel, .plan-shell { background: var(--paper); border: 1px solid var(--line); border-radius: 11px; min-width: 0; }
+.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 48px 16px; color: var(--muted); text-align: center; }
+.workspace-empty { height: 75vh; }
+.inventory-grid { display: grid; grid-template-columns: 192px minmax(0, 1fr); gap: 14px; align-items: start; }
+.inventory-grid.has-detail { grid-template-columns: 192px minmax(0, 1fr) clamp(238px, 23vw, 320px); }
+.location-tree { padding: 12px 8px; max-height: calc(100dvh - 128px); overflow: auto; }
+.location-tree h2 { padding: 4px 10px 12px; }
+.location-tree .small { padding: 8px 10px; }
+.tree-row { display: flex; justify-content: start; width: 100%; min-width: 0; padding: 0 10px; border: 0; background: transparent; text-align: start; }
+.tree-row svg { flex-shrink: 0; color: var(--muted); }
+.tree-row span { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
+.tree-row.current { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
+.tree-divider { border-top: 1px solid var(--line); margin: 9px 5px; }
+.tree-link { margin-top: 10px; }
+.item-list { min-height: 375px; }
+.list-toolbar { display: flex; align-items: center; gap: 11px; padding: 12px; }
+.search-field { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; color: var(--muted); background: #f4f7f6; border: 1px solid #dbe5e1; border-radius: 7px; padding: 0 10px; }
+.search-field input { border: none; background: transparent; min-width: 0; width: 100%; min-height: 38px; }
+.search-field input:focus-visible { outline-offset: -2px; }
+.check-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
+input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
+.table-wrap { overflow-x: auto; }
+table { width: 100%; border-collapse: collapse; font-size: 13px; }
+td, th { padding: 9px 12px; text-align: left; border-bottom: 1px solid #eaf0ed; }
+td:first-child, th:first-child { padding-left: 14px; }
+th { color: var(--muted); font-weight: 550; background: #f5f8f7; white-space: nowrap; }
+tr:hover td, tr.active-row td { background: #f1f8f4; }
+td:last-child, th:last-child { text-align: right; white-space: nowrap; }
+.item-cell, .table-path { background: none; border: 0; padding: 0; text-align: start; justify-content: start; }
+.item-cell:hover:not(:disabled), .table-path:hover:not(:disabled) { background: transparent; color: var(--accent); }
+.item-cell { gap: 9px; word-break: break-word; font-weight: 650; }
+.table-path { color: var(--muted); }
+.item-mark, .property-symbol { width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; border-radius: 7px; color: #245d4b; background: #e8f3ec; }
+.list-status { color: var(--muted); padding: 14px; text-align: center; font-size: 13px; }
+.item-list > .notice { margin: 0 12px 10px; }
+.item-detail { padding: 13px; }
+.detail-header, .detail-hero, .detail-actions { display: flex; gap: 8px; align-items: center; }
+.detail-header { justify-content: space-between; }
+.detail-hero { margin-top: 12px; overflow-wrap: anywhere; }
+.detail-hero .item-mark { width: 42px; height: 42px; }
+.detail-hero h3 { font-size: 18px; }
+.item-detail dt { font-size: 12px; color: var(--muted); margin-top: 10px; }
+.item-detail dd { margin: 3px 0; font-size: 14px; overflow-wrap: anywhere; }
+.plain-text { white-space: pre-wrap; }
+.detail-actions { flex-wrap: wrap; }
+.move-form, .move-history, .item-detail > .notice { margin-top: 12px; }
+.move-history h3 { margin-bottom: 7px; }
+.move-history p { display: grid; gap: 2px; padding: 5px 0; font-size: 12px; }
+.move-history svg { vertical-align: middle; }
+.move-history time { color: var(--muted); }
+.item-detail > .danger { margin-top: 11px; }
+.plan-page > .notice { margin-bottom: 10px; }
+.plan-shell { overflow: hidden; }
+.plan-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
+.toolbar-group { display: flex; align-items: center; gap: 7px; color: var(--muted); }
+.plan-toolbar select { min-height: 34px; min-width: 120px; max-width: 210px; background: white; }
+.plan-edit-tools { padding-left: 12px; border-left: 1px solid var(--line); }
+.snap-toggle { padding-left: 4px; }
+.ai-button { margin-left: auto; border-color: #d5e4de; color: var(--accent); background: #f1f8f4; }
+.plan-columns { display: grid; grid-template-columns: 171px minmax(0, 1fr) 211px; height: max(575px, calc(100dvh - 184px)); }
+.plan-columns.readonly { grid-template-columns: minmax(0, 1fr) 211px; }
+.plan-library, .plan-properties { overflow: auto; }
+.plan-library { border-right: 1px solid var(--line); padding: 13px 10px; }
+.plan-properties { border-left: 1px solid var(--line); padding: 13px 11px; }
+.pane-title { padding: 2px 5px 12px; }
+.pane-title h2 { font-size: 14px; }
+.template-group { display: grid; gap: 2px; padding-bottom: 12px; }
+.template-group h3 { font-weight: 540; font-size: 11px; color: var(--muted); padding: 7px 6px 4px; }
+.library-option { width: 100%; text-align: left; justify-content: start; border: 0; min-height: 32px; padding: 0 6px; gap: 7px; }
+.library-option svg { color: #467569; flex-shrink: 0; }
+.library-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.library-option .append-icon { margin-left: auto; color: #69887f; }
+.canvas-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
+.canvas-stage { min-height: 0; flex: 1; position: relative; overflow: hidden; display: grid; background: #e6eeea; }
+.plan-svg { width: 100%; height: 100%; position: absolute; inset: 0; touch-action: none; user-select: none; cursor: grab; }
+.dragging .plan-svg { cursor: grabbing; }
+.plan-shape { color: #52796f; cursor: pointer; outline: none; }
+.plan-outline { fill: #d4e6de66; stroke: #55786f; stroke-width: 1.5; }
+.furniture .plan-outline { fill: #d6ebe1; stroke: #438572; }
+.area .plan-outline { fill: #e2ede7aa; stroke-dasharray: 5 4; }
+.plan-shape:hover .plan-outline, .plan-shape:focus-visible .plan-outline, .plan-shape.focused .plan-outline { stroke: #147755; stroke-width: 2.4; }
+.plan-shape.focused .plan-outline { fill: #b1d8c59c; }
+.shape-name { fill: #1c423a; font-weight: 680; paint-order: stroke; stroke: #fcfdfa; stroke-width: 19; stroke-linejoin: round; }
+.resize-grip { fill: #1c795e; stroke: white; stroke-width: 1.5; cursor: nwse-resize; }
+.snap-guide { stroke: #0875ad; stroke-width: 1.2; stroke-dasharray: 5 5; pointer-events: none; }
+.canvas-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; font-size: 14px; }
+.canvas-zoom { position: absolute; display: flex; gap: 4px; align-items: center; right: 10px; bottom: 10px; border-radius: 8px; padding: 3px; background: white; box-shadow: 0 2px 7px #183a3526; }
+.canvas-zoom span { min-width: 40px; text-align: center; font-size: 12px; color: var(--muted); }
+.canvas-zoom button { border: 0; min-height: 32px; width: 32px; }
+.canvas-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px; min-height: 31px; padding: 4px 10px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }
+.map-target { display: block; padding: 7px 10px; font-size: 12px; color: var(--accent); border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
+.shape-property { display: flex; align-items: center; gap: 7px; padding: 4px; margin-bottom: 12px; }
+.shape-property input { min-width: 0; width: 100%; }
+.shape-property h3 { overflow-wrap: anywhere; }
+.property-fields { margin: 0; border: 0; padding: 0 4px; display: grid; gap: 7px; grid-template-columns: repeat(2,minmax(0,1fr)); }
+.property-fields label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
+.property-fields label span { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; }
+.property-fields input { min-width: 0; width: 100%; border: 0; padding: 4px; min-height: 32px; }
+.property-fields small { padding-right: 4px; }
+.property-actions { display: grid; gap: 6px; padding: 10px 4px 0; }
+.property-empty { display: grid; justify-items: center; gap: 8px; padding: 29px 4px; text-align: center; color: var(--muted); font-size: 13px; }
+.plan-loading { min-height: 350px; }
+.modal { width: min(92vw, 590px); max-height: 89dvh; border: 1px solid #d5e2dd; border-radius: 12px; padding: 19px; color: var(--ink); box-shadow: 0 26px 90px #0b272944; }
+.intake-modal { width: min(94vw, 685px); }
+.modal::backdrop { background: #12272b85; }
+.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 5px; }
+.modal-header h2 { font-size: 19px; }
+.modal .notice { margin-bottom: 9px; }
+.fields { display: grid; gap: 11px; }
+.fields > button { justify-self: start; }
+.fields label { display: grid; gap: 6px; font-size: 13px; font-weight: 620; min-width: 0; }
+.fields input, .fields textarea, .fields select, .create-space input, .shape-property input, .plan-toolbar select {
+ padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: white; min-height: 35px; font-weight: 450;
+}
+textarea { resize: vertical; }
+.form-row { display: grid; grid-template-columns: minmax(82px, .32fr) minmax(0, 1fr); gap: 11px; }
+.modal-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 8px; }
+.segmented { display: flex; align-items: center; gap: 3px; width: fit-content; padding: 3px; border-radius: 8px; background: #edf3ef; }
+.segmented button { background: transparent; border-color: transparent; min-height: 32px; }
+.segmented button[aria-pressed="true"] { background: white; color: var(--accent); border-color: #d7e5dd; }
+.intake-tabs { margin-bottom: 12px; }
+.candidate-list { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin: 0; min-width: 0; }
+.candidate-list legend { font-size: 13px; color: var(--muted); padding: 0 5px; }
+.candidate { display: grid; grid-template-columns: 18px minmax(75px, 1fr) 68px minmax(85px, 1fr); gap: 6px; align-items: center; margin: 4px; }
+.candidate input, .candidate select { min-width: 0; }
+.suggestion-list { margin: 0; padding: 0; list-style: none; }
+.proposal-canvas { height: 245px; display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
+.suggestion-list label { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 8px; }
+.suggestion-list input { min-height: 0; }
+.suggestion-list small { display: block; color: var(--muted); font-weight: 460; margin-top: 2px; }
+@media (max-width: 1080px) {
+ .shell { grid-template-columns: 135px minmax(0, 1fr); }
+ .rail { padding: 16px 9px; }
+ .inventory-grid, .inventory-grid.has-detail { grid-template-columns: 151px minmax(0, 1fr); }
+ .item-detail { grid-column: 2; }
+ .plan-columns { grid-template-columns: 125px minmax(0, 1fr) 170px; }
+ .plan-columns.readonly { grid-template-columns: minmax(0, 1fr) 170px; }
+}
+@media (max-width: 760px) {
+ .shell { display: block; }
+ .rail { position: static; height: auto; flex-direction: row; align-items: center; gap: 7px; padding: 8px; flex-wrap: wrap; }
+ .rail .brand { padding: 0; }
+ .rail .brand strong { font-size: 16px; }
+ .rail .brand img { width: 26px; height: 26px; }
+ .rail nav, .rail-footer { display: flex; margin: 0; }
+ .rail nav a, .rail-footer button { padding: 0 7px; min-height: 35px; font-size: 12px; }
+ .rail-footer button svg { display: none; }
+ .space-control { max-width: 145px; min-height: 34px; }
+ .workspace { padding-inline: 10px; }
+ .page-header { align-items: start; padding-top: 15px; }
+ .inventory-grid, .inventory-grid.has-detail { grid-template-columns: 1fr; gap: 8px; }
+ .location-tree { max-height: 145px; }
+ .item-detail { grid-column: 1; }
+ .plan-columns, .plan-columns.readonly { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; }
+ .canvas-column { grid-row: 1; height: 45vh; min-height: 285px; }
+ .plan-library, .plan-properties { max-height: 190px; border: 0; border-top: 1px solid var(--line); }
+ .template-group { display: flex; flex-wrap: wrap; align-items: center; }
+ .library-option { width: auto; }
+}
diff --git a/apps/pc/src/types.ts b/apps/pc/src/types.ts
new file mode 100644
index 0000000..06a0e1d
--- /dev/null
+++ b/apps/pc/src/types.ts
@@ -0,0 +1,18 @@
+export type Space = { id: string; name: string; role: 'OWNER' | 'EDITOR' | 'VIEWER' }
+export type Place = { id: string; parentId: string | null; name: string; path: string; depth: number; sortRank: number | null }
+export type Item = {
+ id: string; name: string; quantity: number; notes: string; locationId: string | null;
+ locationPath: string; version: number; aliases: string[]; coverPhotoId: string | null; priceCents: number | null
+}
+export type ItemDetail = {
+ item: Item
+ moves: { fromPath: string; toPath: string; movedAt: string }[]
+ relations: { itemId: string; name: string; locationPath: string; kind: string }[]
+ preference: { favorite: boolean; rating: number | null; note: string }
+}
+export type Draft = {
+ id: string; version: number; status: string
+ candidates: { name: string; quantity: number | null; action: 'RECORD' | 'SKIP' | 'REVIEW'; location: string | null }[]
+}
+export type Operation = { id: string; status: string }
+export const family = (space: string) => '/api/households/' + space
diff --git a/apps/pc/tsconfig.json b/apps/pc/tsconfig.json
new file mode 100644
index 0000000..aa8de62
--- /dev/null
+++ b/apps/pc/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ESNext",
+ "moduleResolution": "Bundler",
+ "strict": true,
+ "noEmit": true,
+ "skipLibCheck": true,
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
+ "types": ["vite/client"]
+ },
+ "include": ["src/**/*.ts", "src/**/*.vue"]
+}
diff --git a/apps/pc/vite.config.mjs b/apps/pc/vite.config.mjs
new file mode 100644
index 0000000..3b7dc2e
--- /dev/null
+++ b/apps/pc/vite.config.mjs
@@ -0,0 +1,16 @@
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+
+export default defineConfig({
+ plugins: [vue()],
+ server: {
+ host: '127.0.0.1',
+ proxy: {
+ '/api': {
+ target: process.env.ATLAS_GATEWAY_URL || 'https://api-atlas.tutudog.com',
+ changeOrigin: true,
+ proxyTimeout: 80000,
+ },
+ },
+ },
+})
diff --git a/docs/architecture/clients.md b/docs/architecture/clients.md
index 67f89a0..49208ba 100644
--- a/docs/architecture/clients.md
+++ b/docs/architecture/clients.md
@@ -5,7 +5,7 @@
| 端 | 技术选型 | 使用与交付 |
| --- | --- | --- |
| H5 | uni-app(Vue 3、TypeScript、Vite),使用 DCloud 的 CLI 模板 | 面向临时找物、相机上传和快速录入。首版构建 H5 静态文件,由 Nginx 镜像托管。 |
-| PC 网页 | Vue 3、TypeScript、Vite、Vue Router | 面向批量草稿、详情查看和浏览位置树。独立 Nginx 镜像。 |
+| PC 网页 | Vue 3、TypeScript、Vite、Vue Router | [桌面工作台](../../apps/pc/README.md)支持搜索、物品录入、移位和两级平面图。独立 Nginx 镜像。 |
| 管理后台 | Vue 3、TypeScript、Vite、Element Plus | 已有空间查询、删除及图片清理入口。独立 Nginx 镜像。其他管理模块有多页路由需求时接入 Vue Router。 |
| iOS | Swift、SwiftUI,最低 iOS 17 | [iOS 应用](../../apps/ios/README.md)接入账号、空间、物品、草稿和相册上传。拍照和录音按后续原生端验收范围补齐。 |
| Android | Kotlin、Jetpack Compose | Gradle 工程。相机、录音走 Android 平台能力,使用同一 HTTPS API。 |
diff --git a/docs/testing/cases.md b/docs/testing/cases.md
index a378458..7658fcd 100644
--- a/docs/testing/cases.md
+++ b/docs/testing/cases.md
@@ -62,5 +62,6 @@ R01–R10 对应[需求与验收](../product/requirements.md)。实现和当前
| TC-51 从物品查看平面图 | R04、R11 | 把一件物品放进「主卧 / 衣柜 / 抽屉」。从找物进详情,点「在平面图中查看」。依次取消衣柜和主卧在图上的摆放,下拉刷新。再用只读成员查看,并检查无位置的物品。 | 优先标出室内图的衣柜,回退时标出空间图的主卧,两处都未摆放时显示提示。完整存放路径始终可见。只读成员能查看,无位置的物品没有平面图入口。 |
| TC-52 从平面图选存放位置 | R03、R06、R11 | 在手动添加、智能草稿或移位中打开位置选择,点「从平面图选择」。点房间,进入室内位置,再从家具进入抽屉。另选一次没有摆在图上的位置,并取消一次选择。 | 标记和底部路径随点选更新。可直接选房间或家具,也可进入抽屉。未摆放位置可从列表选。选中只回填表单,取消保留原位置。 |
| TC-53 浏览下级位置的物品 | R04、R11 | 在主卧和主卧抽屉各放一件物品,另在其他房间和无位置各放一件。在主卧详情来回切换物品范围。用只读成员重试,移动或归档抽屉里的物品后刷新。 | 「仅此位置」只显示直接存放的物品。「含下级位置」也显示抽屉里的物品和完整路径,两种范围的分页和缓存独立。其他房间、无位置和归档物品不混入。 |
+| TC-54 PC 建模和找物联动 | R03、R04、R11、R12 | 在桌面浏览器添加房间,拖动后撤回和重做,改右侧宽深并保存。在室内图添加书桌,再从书桌进入录入,按别名找物并回到平面图定位。另试放弃修改、AI 预览和保存版本冲突。 | 全屋与室内使用各自的布局。操作可撤销,确认保存后重读一致。录入沿用书桌位置,人工保存前 AI 草稿不落库,版本冲突仍保留本地修改。 |
[测试与演示计划](plan.md)
diff --git a/docs/ui/README.md b/docs/ui/README.md
index a732a90..b036b8e 100644
--- a/docs/ui/README.md
+++ b/docs/ui/README.md
@@ -19,7 +19,7 @@
| 走查 | 要看的页面和状态 |
| --- | --- |
| H5 | 找物、详情、移位、位置树、手工与批量录入。补齐空结果、权限不足、模型不可用、确认中、失败重试。 |
-| PC | 列表和详情、位置树导航、批量草稿表格。补键盘导航、窄窗口和长位置路径。 |
+| PC | [桌面工作台](pc-workbench.md)包含位置树、物品详情、文字批量录入和两级平面图。 |
| 管理后台 | 用户和家庭、模型状态、额度及异常操作。明确筛选、记录详情和角色权限。 |
| iOS、Android | 从同一套术语和任务出发,单独画原生导航、相机、录音权限与返回后的状态。 |
diff --git a/docs/ui/pc-workbench.md b/docs/ui/pc-workbench.md
new file mode 100644
index 0000000..75d1efd
--- /dev/null
+++ b/docs/ui/pc-workbench.md
@@ -0,0 +1,20 @@
+# PC 端桌面工作台
+
+## 物品
+
+左侧位置树负责缩小范围,中间列表显示名称、位置和数量。选中物品后在右侧查看和移位。位置有下级时可以展开全部后代范围,同名位置通过完整路径区分。录入优先支持手填,也可把一段文字交给现有模型服务,再逐条核对、修改位置并确认。
+
+浏览器可以通过 HTTPS 和麦克风权限录音。录音数据与文字转写是两个步骤。不同浏览器的实时转写能力和处理地点不同,首版使用表单和文本草稿。后续接入录音时,可以用统一转写服务,再把文字交给现有草稿接口。 [W3C 媒体捕获](https://www.w3.org/TR/mediacapture-streams/) · [W3C 录音接口](https://www.w3.org/TR/mediastream-recording/)
+
+## 平面图
+
+左侧是可添加的模板和已有位置,中间画布占主要面积,右侧修改坐标、宽度和进深。总图与室内图共用现有一级和二级布局;三级以下仍由位置树管理。房间和家具使用不同描边,同名物件选中后仍可由位置路径找到。
+
+- 滚轮按指针位置缩放,拖空白平移,右下角可恢复适合画布的视图。
+- 拖动物件或拉右下角调整大小。默认吸附到 10 厘米网格、墙边及相邻物件边线和中心线。按住 Alt 可临时关闭吸附。方向键微调 1 厘米,Shift 加方向键微调 10 厘米。
+- Ctrl / ⌘ + Z 撤回,附加 Shift 重做。移出平面图只改摆放图,不删除位置。放弃整次修改会恢复已保存版本。
+- AI 建模按已保存的平面图生成建议。勾选后应用到当前草稿,保存才写入数据库。保存发生版本冲突时保留编辑状态。
+
+## 后续
+
+批量录入继续补交付重试与恢复,之后接相册和裁剪、成员管理与社区。浏览器录音和统一转写单独验收权限、设备和取消操作。