任务共享:面板补「共享给谁」区块 laoyang/FamilyBook#26

用户原话(2026-10-28):「鸿蒙端对齐网页端」。任务面板原来没有共享入口,现在:

1) FbTaskShare 类型 + parseTaskDetail 解析 Task::find 已带的 shares
2) FbTaskRepo 补 fetchTaskShares/shareTask/unshareTask(删除走 query)
3) FbTaskPanel 加「共享给谁」区块:列表(可改/只看)+ 逐条取消 +
   「+ 共享」复用选人组件(与资源/财务共享同一套)

编译 BUILD SUCCESSFUL;服务端冒烟 _i26_task_share_api.py 13/0 + 反证命中。
This commit is contained in:
2026-10-28 22:10:15 +08:00
parent f93dd92cdb
commit 59a9d3df39
4 changed files with 188 additions and 1 deletions
+20
View File
@@ -20,6 +20,7 @@ import {
FbLedgerBook, FbLedgerDetail, FbLedgerEntry, FbLedgerPoint, FbNoteItem, FbNoteBlock, FbNotificationItem, FbResourceItem,
FbTaskItem, FbTripItem, FbWeather, FbStat, FbMemoryItem, FbRecentDay,
FbTaskAttach, FbTaskComment, FbTaskDetail, FbTaskKid, FbTaskMeta, FbCatOpt, FbBoardOpt,
FbTaskShare,
} from '../model/Types';
// ============================================================
@@ -200,6 +201,13 @@ interface RawTaskDetail extends RawTask {
children?: RawTaskKid[];
comments?: RawTaskComment[];
attachs?: RawTaskAttach[];
shares?: RawTaskShare[];
}
/** 任务共享行(工单 #26;服务端 `Task::shares()`:s.person_id/perm + p.name + 昵称) */
interface RawTaskShare {
person_id?: number; perm?: string | null;
name?: string | null; my_nickname?: string | null;
}
/** `?view=boards` 的看板元数据(v79) */
@@ -1016,6 +1024,17 @@ export function parseTaskDetail(json: string): FbTaskDetail | null {
attachs.push(one);
}
// 共享给谁(工单 #26;服务端 Task::find 已带 shares)
const shares: FbTaskShare[] = [];
for (const sh of arr<RawTaskShare>(d.shares)) {
const nick: string = s(sh.my_nickname);
shares.push({
personId: n(sh.person_id),
name: nick !== '' ? nick : s(sh.name),
perm: s(sh.perm) !== '' ? s(sh.perm) : 'write',
});
}
const creatorNick: string = s(d.creator_nick);
const detail: FbTaskDetail = {
base: base,
@@ -1028,6 +1047,7 @@ export function parseTaskDetail(json: string): FbTaskDetail | null {
kids: kids,
comments: comments,
attachs: attachs,
shares: shares,
};
return detail;
}