任务共享:面板补「共享给谁」区块 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:
@@ -174,3 +174,27 @@ export async function delTaskAttach(token: string, id: number, aid: number): Pro
|
||||
return await fbApi('/api/v1/tasks/' + id.toString() + '/attach', opts);
|
||||
}
|
||||
|
||||
/** 共享给谁(工单 #26) */
|
||||
export async function fetchTaskShares(token: string, id: number): Promise<FbApiResult> {
|
||||
const opts: FbApiOptions = { token: token, authProbe: true };
|
||||
return await fbApi('/api/v1/tasks/' + id.toString() + '/shares', opts);
|
||||
}
|
||||
|
||||
/** 共享给某人(perm = read / write;任务默认 write,与 Web 端 tasks/share 一致) */
|
||||
export async function shareTask(token: string, id: number, personId: number,
|
||||
perm: string): Promise<FbApiResult> {
|
||||
const body: Record<string, Object> = {};
|
||||
body['person_id'] = personId;
|
||||
body['perm'] = perm;
|
||||
const opts: FbApiOptions = { method: 'POST', token: token, body: body };
|
||||
return await fbApi('/api/v1/tasks/' + id.toString() + '/shares', opts);
|
||||
}
|
||||
|
||||
/** 取消某人的共享(person_id 走 query,DELETE 带 body 服务端读不到) */
|
||||
export async function unshareTask(token: string, id: number, personId: number): Promise<FbApiResult> {
|
||||
const q: Record<string, string> = {};
|
||||
q['person_id'] = personId.toString();
|
||||
const opts: FbApiOptions = { method: 'DELETE', token: token, query: q };
|
||||
return await fbApi('/api/v1/tasks/' + id.toString() + '/shares', opts);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user