forked from CITKParus/P8-Panels
main #2
@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
Парус 8 - Панели мониторинга - ПУП - Выдача сменного задания
|
||||||
|
Кастомные хуки
|
||||||
|
*/
|
||||||
|
|
||||||
//---------------------
|
//---------------------
|
||||||
//Подключение библиотек
|
//Подключение библиотек
|
||||||
//---------------------
|
//---------------------
|
||||||
|
@ -20,7 +20,8 @@ import { useCostDeliveryLists } from "./backend_dg"; //Собственные х
|
|||||||
|
|
||||||
//Стили
|
//Стили
|
||||||
const STYLES = {
|
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"]) {
|
if (row["NQUANT_PLAN"] <= row["NREST"]) {
|
||||||
return {
|
return {
|
||||||
cellStyle: { backgroundColor: "lightblue" },
|
cellStyle: { ...STYLES.DATA_GRID_CELL_COVERED },
|
||||||
data: row[columnDef]
|
data: row[columnDef]
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
@ -20,7 +20,8 @@ import { useGoodsParties } from "./backend_dg"; //Собственные хук
|
|||||||
|
|
||||||
//Стили
|
//Стили
|
||||||
const STYLES = {
|
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) {
|
if (row["NRESTFACT"] >= quantPlanSum) {
|
||||||
return {
|
return {
|
||||||
cellStyle: { backgroundColor: "lightblue" },
|
cellStyle: { ...STYLES.DATA_GRID_CELL_COVERED },
|
||||||
data: row[columnDef]
|
data: row[columnDef]
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
@ -36,7 +36,8 @@ const currentYear = currentDate.getUTCFullYear();
|
|||||||
|
|
||||||
//Стили
|
//Стили
|
||||||
const STYLES = {
|
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 }) => {
|
const FilterComponent = ({ filter, setFilter, handleMonthChange, handleSelectDeparture }) => {
|
||||||
return (
|
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">
|
<FormControl sx={STYLES.FILTER_BLOCK} readOnly fullWidth variant="outlined">
|
||||||
<InputLabel required={!filter.department.SCODE} htmlFor="department-outlined">
|
<InputLabel required={!filter.department.SCODE} htmlFor="department-outlined">
|
||||||
Цех
|
Цех
|
||||||
@ -95,7 +96,7 @@ const FilterComponent = ({ filter, setFilter, handleMonthChange, handleSelectDep
|
|||||||
label="Цех"
|
label="Цех"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Box sx={STYLES.FILTER_BLOCK} display="flex" pb={1}>
|
<Box sx={STYLES.FILTER_BLOCK} pb={1}>
|
||||||
<Box>
|
<Box>
|
||||||
<IconButton onClick={() => handleMonthChange(-1)}>
|
<IconButton onClick={() => handleMonthChange(-1)}>
|
||||||
<Icon>navigate_before</Icon>
|
<Icon>navigate_before</Icon>
|
||||||
|
@ -20,7 +20,8 @@ import { useInsDepartment } from "../hooks"; //Состояние таблицы
|
|||||||
|
|
||||||
//Стили
|
//Стили
|
||||||
const STYLES = {
|
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 }) => {
|
const dataCellRender = ({ row, columnDef, handleSelectDeparture }) => {
|
||||||
return {
|
return {
|
||||||
cellStyle: { cursor: "pointer", backgroundColor: "#ADD8E6" },
|
cellStyle: { ...STYLES.DATA_GRID_CELL_DEFAULT },
|
||||||
cellProps: {
|
cellProps: {
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
handleSelectDeparture({ NRN: row["NRN"], SCODE: row["SCODE"].toString(), SNAME: row["SNAME"] });
|
handleSelectDeparture({ NRN: row["NRN"], SCODE: row["SCODE"].toString(), SNAME: row["SNAME"] });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user