fix: сохранение комментария группы в localStorage
This commit is contained in:
parent
046cdf3334
commit
4d1f67b7d2
14
index.html
14
index.html
@ -201,6 +201,11 @@ function loadState() {
|
||||
DEMO_GROUPS.forEach(g => {
|
||||
const savedGroup = state.groups?.find(sg => sg.id === g.id);
|
||||
if (savedGroup) {
|
||||
// Восстанавливаем комментарий группы
|
||||
if (savedGroup.groupComment !== undefined) {
|
||||
g.groupComment = savedGroup.groupComment;
|
||||
}
|
||||
// Восстанавливаем статусы и комментарии строк
|
||||
g.rows.forEach(r => {
|
||||
const savedRow = savedGroup.rows?.find(sr => sr.id === r.id);
|
||||
if (savedRow) {
|
||||
@ -214,7 +219,14 @@ function loadState() {
|
||||
}
|
||||
|
||||
function saveState() {
|
||||
localStorage.setItem('gpz_comparison_state', JSON.stringify({ groups: DEMO_GROUPS }));
|
||||
const state = {
|
||||
groups: DEMO_GROUPS.map(g => ({
|
||||
id: g.id,
|
||||
groupComment: g.groupComment,
|
||||
rows: g.rows.map(r => ({ id: r.id, status: r.status, comment: r.comment }))
|
||||
}))
|
||||
};
|
||||
localStorage.setItem('gpz_comparison_state', JSON.stringify(state));
|
||||
}
|
||||
|
||||
let currentGroupId = null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user