ЦИТК-827 - Исправление работы со стилями

This commit is contained in:
Dollerino 2024-07-25 13:11:11 +03:00
parent cf5c1db1f3
commit db158ab4d7
5 changed files with 18 additions and 9 deletions

View File

@ -1,3 +1,8 @@
/*
Парус 8 - Панели мониторинга - ПУП - Выдача сменного задания
Кастомные хуки
*/
//---------------------
//Подключение библиотек
//---------------------

View File

@ -20,7 +20,8 @@ import { useCostDeliveryLists } from "./backend_dg"; //Собственные х
//Стили
const STYLES = {
CONTAINER: { margin: "5px 0px", textAlign: "center" }
CONTAINER: { margin: "5px 0px", textAlign: "center" },
DATA_GRID_CELL_COVERED: { backgroundColor: "lightblue" }
};
//------------------------------------
@ -32,7 +33,7 @@ const dataCellRender = ({ row, columnDef }) => {
//Если "Количество план" равно или меньше "Остаток"
if (row["NQUANT_PLAN"] <= row["NREST"]) {
return {
cellStyle: { backgroundColor: "lightblue" },
cellStyle: { ...STYLES.DATA_GRID_CELL_COVERED },
data: row[columnDef]
};
} else {

View File

@ -20,7 +20,8 @@ import { useGoodsParties } from "./backend_dg"; //Собственные хук
//Стили
const STYLES = {
CONTAINER: { margin: "5px 0px", textAlign: "center" }
CONTAINER: { margin: "5px 0px", textAlign: "center" },
DATA_GRID_CELL_COVERED: { backgroundColor: "lightblue" }
};
//------------------------------------
@ -32,7 +33,7 @@ const dataCellRender = ({ row, columnDef, quantPlanSum }) => {
//Если остаток больше суммы "Выдать по норме" - закрашиваем голубым
if (row["NRESTFACT"] >= quantPlanSum) {
return {
cellStyle: { backgroundColor: "lightblue" },
cellStyle: { ...STYLES.DATA_GRID_CELL_COVERED },
data: row[columnDef]
};
} else {

View File

@ -36,7 +36,8 @@ const currentYear = currentDate.getUTCFullYear();
//Стили
const STYLES = {
FILTER_BLOCK: { maxWidth: "200px" }
FILTER_CONTAINER: { display: "flex", flexDirection: "row", justifyContent: "flex-start", alignItems: "flex-end" },
FILTER_BLOCK: { maxWidth: "200px", display: "flex" }
};
//------------------------------------
@ -71,7 +72,7 @@ DepartmentsDataGrid.propTypes = {
//Компонент фильтра
const FilterComponent = ({ filter, setFilter, handleMonthChange, handleSelectDeparture }) => {
return (
<Box display="flex" flexDirection="row" justifyContent="flex-start" alignItems="flex-end" pt={1.5} pl={1}>
<Box sx={STYLES.FILTER_CONTAINER} pt={1.5} pl={1}>
<FormControl sx={STYLES.FILTER_BLOCK} readOnly fullWidth variant="outlined">
<InputLabel required={!filter.department.SCODE} htmlFor="department-outlined">
Цех
@ -95,7 +96,7 @@ const FilterComponent = ({ filter, setFilter, handleMonthChange, handleSelectDep
label="Цех"
/>
</FormControl>
<Box sx={STYLES.FILTER_BLOCK} display="flex" pb={1}>
<Box sx={STYLES.FILTER_BLOCK} pb={1}>
<Box>
<IconButton onClick={() => handleMonthChange(-1)}>
<Icon>navigate_before</Icon>

View File

@ -20,7 +20,8 @@ import { useInsDepartment } from "../hooks"; //Состояние таблицы
//Стили
const STYLES = {
CONTAINER: { margin: "5px 0px", textAlign: "center" }
CONTAINER: { margin: "5px 0px", textAlign: "center" },
DATA_GRID_CELL_DEFAULT: { cursor: "pointer", backgroundColor: "#ADD8E6" }
};
//------------------------------------
@ -30,7 +31,7 @@ const STYLES = {
//Генерация ссылок на строках
const dataCellRender = ({ row, columnDef, handleSelectDeparture }) => {
return {
cellStyle: { cursor: "pointer", backgroundColor: "#ADD8E6" },
cellStyle: { ...STYLES.DATA_GRID_CELL_DEFAULT },
cellProps: {
onClick: () => {
handleSelectDeparture({ NRN: row["NRN"], SCODE: row["SCODE"].toString(), SNAME: row["SNAME"] });