feat: столбец «Дата выхода» в разделах при фильтре по рабочему месту
Tests / frontend-test (push) Successful in 2m7s
Tests / frontend-test (push) Successful in 2m7s
Раньше дата выхода показывалась только во «Все заявки». Теперь — в любом разделе (Мои заявки, очереди), когда фильтр по типу оставляет только заявки на организацию рабочего места. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -143,7 +143,7 @@ interface ITableColumns {
|
||||
assignee: boolean;
|
||||
/** Колонка «Исполнено» — кто из исполнителей уже выполнил (см. showsExecuted). */
|
||||
executed: boolean;
|
||||
/** Колонка «Дата выхода» — только «Все заявки» по организации рабочего места. */
|
||||
/** Колонка «Дата выхода» — только таблица из заявок на организацию рабочего места (см. showsStartDate). */
|
||||
startDate?: boolean;
|
||||
/** Заголовок колонки с комментарием; undefined — колонки нет. */
|
||||
commentLabel?: string;
|
||||
@@ -178,9 +178,15 @@ function showsExecuted(view: ListView, statusFilter: string): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Дата выхода сотрудника есть только у заявки на организацию рабочего места, и показываем её во «Все заявки». */
|
||||
function showsStartDate(view: ListView, type: IRequestType | undefined): boolean {
|
||||
return view === 'all' && type?.pageUrl === WORKPLACE_SETUP_FORM_ID;
|
||||
/**
|
||||
* Дата выхода сотрудника есть только у заявки на организацию рабочего места.
|
||||
* Показываем её, когда таблица целиком из таких заявок: «Все заявки» этого типа
|
||||
* или любой раздел с фильтром по этому типу. Без фильтра типы вперемешку —
|
||||
* колонка была бы почти пустой.
|
||||
*/
|
||||
function showsStartDate(view: ListView, allRequestsType: IRequestType | undefined, filteredType: IRequestType | undefined): boolean {
|
||||
const tableType = view === 'all' ? allRequestsType : filteredType;
|
||||
return tableType?.pageUrl === WORKPLACE_SETUP_FORM_ID;
|
||||
}
|
||||
|
||||
function columnsFor(view: ListView, statusFilter: string, startDate = false): ITableColumns {
|
||||
@@ -194,15 +200,15 @@ function columnsFor(view: ListView, statusFilter: string, startDate = false): IT
|
||||
? 'Причина возврата'
|
||||
: undefined;
|
||||
|
||||
if (view === 'approvals' || view === 'execution') return { author: true, status: false, assignee, executed };
|
||||
if (view === 'rework') return { author: false, status: false, assignee, executed, commentLabel };
|
||||
if (view === 'own:created') return { author: false, status: !statusFilter, assignee, executed, commentLabel };
|
||||
if (view === 'approvals' || view === 'execution') return { author: true, status: false, assignee, executed, startDate };
|
||||
if (view === 'rework') return { author: false, status: false, assignee, executed, startDate, commentLabel };
|
||||
if (view === 'own:created') return { author: false, status: !statusFilter, assignee, executed, startDate, commentLabel };
|
||||
// 'all' — заявки всех авторов вперемешку, поэтому нужны и автор, и статус.
|
||||
if (view === 'all') return { author: true, status: true, assignee, executed, startDate };
|
||||
// История решений: заявка чужая, поэтому нужен автор. Статус — только если он
|
||||
// не предопределён самой вкладкой («Отклонённые мной» — это всегда «Отклонено»,
|
||||
// а вот у согласованных/выполненных заявка могла уйти дальше по маршруту).
|
||||
return { author: true, status: !decisionStatus, assignee, executed, commentLabel };
|
||||
return { author: true, status: !decisionStatus, assignee, executed, startDate, commentLabel };
|
||||
}
|
||||
|
||||
export interface IRequestsTableViewProps {
|
||||
@@ -494,6 +500,8 @@ export const RequestsTableView: React.FC<IRequestsTableViewProps> = ({
|
||||
});
|
||||
const { localFilters, sort, isRefined } = refinement;
|
||||
const refinementSig = refinement.signature;
|
||||
const filteredType = types?.find((t) => t.id === localFilters.typeId);
|
||||
const withStartDate = showsStartDate(view, allRequestsType, filteredType);
|
||||
|
||||
// Полный список раздела для режима с фильтрами — последний загруженный.
|
||||
// Листание страниц и смена фильтра его переиспользуют (заново по сети не
|
||||
@@ -664,7 +672,7 @@ export const RequestsTableView: React.FC<IRequestsTableViewProps> = ({
|
||||
decisionStatus ? hydrateDecisionComments(context, types, result.rows, decisionStatus) : undefined,
|
||||
showsAssignee(view, statusFilter) ? hydrateCurrentAssignees(context, types, result.rows) : undefined,
|
||||
showsExecuted(view, statusFilter) ? hydrateExecutedSteps(context, types, result.rows) : undefined,
|
||||
showsStartDate(view, allRequestsType) ? hydrateStartDates(context, result.rows) : undefined,
|
||||
withStartDate ? hydrateStartDates(context, result.rows) : undefined,
|
||||
]);
|
||||
return result;
|
||||
};
|
||||
@@ -850,7 +858,7 @@ export const RequestsTableView: React.FC<IRequestsTableViewProps> = ({
|
||||
rows={visible}
|
||||
view={view}
|
||||
statusFilter={statusFilter}
|
||||
withStartDate={showsStartDate(view, allRequestsType)}
|
||||
withStartDate={withStartDate}
|
||||
sort={sort}
|
||||
onSort={refinement.onSort}
|
||||
onOpen={onOpen}
|
||||
|
||||
Reference in New Issue
Block a user