| | |
| | | PUBLISH_ROLE_OPTIONS, |
| | | DEPT_OPTIONS, |
| | | createEmptyForm, |
| | | createInitialMockNews, |
| | | loadStoredNews, |
| | | saveStoredNews, |
| | | getUnreadEmployees, |
| | |
| | | |
| | | export function useEnterpriseNews() { |
| | | const stored = loadStoredNews(); |
| | | const allRows = ref(stored?.length ? stored : createInitialMockNews()); |
| | | const allRows = ref(stored?.length ? stored : []); |
| | | |
| | | const searchForm = reactive({ |
| | | keyword: "", |
| | |
| | | return { ok: true, count: selectedIds.length }; |
| | | } |
| | | |
| | | function toggleLike(row, userId = "u1", userName = "张三") { |
| | | function toggleLike(row, userId = "", userName = "") { |
| | | const hit = allRows.value.find((r) => r.id === row.id); |
| | | if (!hit) return; |
| | | hit.likes = hit.likes || []; |
| | |
| | | } |
| | | } |
| | | |
| | | function addComment(row, content, userId = "u1", userName = "张三") { |
| | | function addComment(row, content, userId = "", userName = "") { |
| | | const text = (content || "").trim(); |
| | | if (!text) return { ok: false, message: "请输入评论内容" }; |
| | | const hit = allRows.value.find((r) => r.id === row.id); |