forked from CITKParus/P8-Panels
commit
b36eeff021
@ -32,7 +32,9 @@ import { P8PDataGrid, P8P_DATA_GRID_SIZE } from "../../components/p8p_data_grid"
|
|||||||
import { P8P_DATA_GRID_CONFIG_PROPS } from "../../config_wrapper"; //Подключение компонентов к настройкам приложения
|
import { P8P_DATA_GRID_CONFIG_PROPS } from "../../config_wrapper"; //Подключение компонентов к настройкам приложения
|
||||||
import { BackEndСtx } from "../../context/backend"; //Контекст взаимодействия с сервером
|
import { BackEndСtx } from "../../context/backend"; //Контекст взаимодействия с сервером
|
||||||
import { ApplicationСtx } from "../../context/application"; //Контекст приложения
|
import { ApplicationСtx } from "../../context/application"; //Контекст приложения
|
||||||
|
import { MessagingСtx } from "../../context/messaging"; //Контекст сообщений
|
||||||
import { headCellRender, dataCellRender, groupCellRender, DIGITS_REG_EXP, MONTH_NAME_REG_EXP, DAY_NAME_REG_EXP } from "./layouts"; //Дополнительная разметка и вёрстка клиентских элементов
|
import { headCellRender, dataCellRender, groupCellRender, DIGITS_REG_EXP, MONTH_NAME_REG_EXP, DAY_NAME_REG_EXP } from "./layouts"; //Дополнительная разметка и вёрстка клиентских элементов
|
||||||
|
import { TEXTS } from "../../../app.text"; //Тектовые ресурсы и константы
|
||||||
|
|
||||||
//-----------
|
//-----------
|
||||||
//Тело модуля
|
//Тело модуля
|
||||||
@ -49,74 +51,55 @@ const EqsPrfrm = () => {
|
|||||||
reload: false
|
reload: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Состояние информации о трудоёмкости
|
||||||
|
const [info, setInfo] = useState({ cntP: 0, sumP: 0, cntF: 0, sumF: 0 });
|
||||||
|
|
||||||
|
// Состояние фильтра (для отладки)
|
||||||
|
// const [filter, setFilter] = useState({
|
||||||
|
// belong: "Демопример",
|
||||||
|
// prodObj: "Карьер",
|
||||||
|
// techServ: "",
|
||||||
|
// respDep: "",
|
||||||
|
// fromMonth: 1,
|
||||||
|
// fromYear: 2024,
|
||||||
|
// toMonth: 12,
|
||||||
|
// toYear: 2024
|
||||||
|
// });
|
||||||
|
|
||||||
|
// Состояние фильтра
|
||||||
const [filter, setFilter] = useState({
|
const [filter, setFilter] = useState({
|
||||||
belong: "Демопример",
|
belong: "",
|
||||||
prodObj: "К2",
|
prodObj: "",
|
||||||
techServ: "",
|
techServ: "",
|
||||||
respDep: "",
|
respDep: "",
|
||||||
fromMonth: 1,
|
fromMonth: 1,
|
||||||
fromYear: 2024,
|
fromYear: 1990,
|
||||||
toMonth: 12,
|
toMonth: 1,
|
||||||
toYear: 2024
|
toYear: 1990
|
||||||
});
|
});
|
||||||
|
// Состояние открытия фильтра
|
||||||
// const [filter, setFilter] = useState({
|
const [filterOpen, setFilterOpen] = useState(true);
|
||||||
// belong: "",
|
// Состояние данных по умолчанию для фильтра (true - для отладки)
|
||||||
// prodObj: "",
|
const [defaultLoaded, setDefaultLoaded] = useState(false);
|
||||||
// techServ: "",
|
// Состояние хранения копии фильтра
|
||||||
// respDep: "",
|
|
||||||
// fromMonth: "",
|
|
||||||
// fromYear: "",
|
|
||||||
// toMonth: "",
|
|
||||||
// toYear: ""});
|
|
||||||
|
|
||||||
const [info, setInfo] = useState({ cntP: 0, sumP: 0, cntF: 0, sumF: 0 });
|
|
||||||
|
|
||||||
//Подключение к контексту приложения
|
|
||||||
const { pOnlineShowDictionary } = useContext(ApplicationСtx);
|
|
||||||
|
|
||||||
const [filterOpen, setFilterOpen] = useState(false);
|
|
||||||
|
|
||||||
const [filterCopy, setFilterCopy] = useState({ ...filter });
|
const [filterCopy, setFilterCopy] = useState({ ...filter });
|
||||||
|
// Состояние ограничения редактирования фильтра
|
||||||
const [filterLock, setFilterLock] = useState(false);
|
const [filterLock, setFilterLock] = useState(false);
|
||||||
|
|
||||||
const openFilter = () => {
|
// Состояние ячейки заголовка даты (по раскрытию/скрытию)
|
||||||
setFilterOpen(true);
|
const [activeRef, setActiveRef] = useState();
|
||||||
};
|
// Состояние актуальности ссылки на ячейку
|
||||||
|
const [refIsDeprecated, setRidFlag] = useState(true);
|
||||||
|
|
||||||
const closeFilter = e => {
|
//Подключение к контексту приложения
|
||||||
if (filterLock && e != undefined) setFilter(filterCopy);
|
const { pOnlineShowDictionary, pOnlineShowUnit } = useContext(ApplicationСtx);
|
||||||
setFilterOpen(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const clearFilter = () => {
|
|
||||||
setFilter({
|
|
||||||
belong: "",
|
|
||||||
prodObj: "",
|
|
||||||
techServ: "",
|
|
||||||
respDep: "",
|
|
||||||
fromMonth: "",
|
|
||||||
fromYear: "",
|
|
||||||
toMonth: "",
|
|
||||||
toYear: ""
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
let yearArray = [];
|
|
||||||
let today = new Date();
|
|
||||||
|
|
||||||
const getYearArray = () => {
|
|
||||||
for (let i = 1990; i <= today.getFullYear(); i++) {
|
|
||||||
yearArray.push(i);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const monthArray = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"];
|
|
||||||
|
|
||||||
//Подключение к контексту взаимодействия с сервером
|
//Подключение к контексту взаимодействия с сервером
|
||||||
const { executeStored } = useContext(BackEndСtx);
|
const { executeStored } = useContext(BackEndСtx);
|
||||||
|
|
||||||
|
//Подключение к контексту сообщений
|
||||||
|
const { showMsgErr } = useContext(MessagingСtx);
|
||||||
|
|
||||||
//Загрузка данных таблицы с сервера
|
//Загрузка данных таблицы с сервера
|
||||||
const loadData = useCallback(async () => {
|
const loadData = useCallback(async () => {
|
||||||
if (dataGrid.reload) {
|
if (dataGrid.reload) {
|
||||||
@ -144,12 +127,15 @@ const EqsPrfrm = () => {
|
|||||||
data.XROWS.map(row => {
|
data.XROWS.map(row => {
|
||||||
properties = [];
|
properties = [];
|
||||||
Object.entries(row).forEach(([key, value]) => properties.push({ name: key, data: value }));
|
Object.entries(row).forEach(([key, value]) => properties.push({ name: key, data: value }));
|
||||||
if (properties[1].data == "Факт" || properties[2].data == "План") {
|
let info2 = properties.find(element => {
|
||||||
if (properties[2].data == "План") {
|
return element.name === "SINFO2";
|
||||||
|
});
|
||||||
|
if (info2 != undefined) {
|
||||||
|
if (info2.data == "План") {
|
||||||
properties.map(p => {
|
properties.map(p => {
|
||||||
if (DAY_NAME_REG_EXP.test(p.name)) cP = cP + 1;
|
if (DAY_NAME_REG_EXP.test(p.name)) cP = cP + 1;
|
||||||
});
|
});
|
||||||
} else if (properties[1].data == "Факт") {
|
} else if (info2.data == "Факт") {
|
||||||
properties.map(p => {
|
properties.map(p => {
|
||||||
if (DAY_NAME_REG_EXP.test(p.name)) cF = cF + 1;
|
if (DAY_NAME_REG_EXP.test(p.name)) cF = cF + 1;
|
||||||
});
|
});
|
||||||
@ -184,26 +170,133 @@ const EqsPrfrm = () => {
|
|||||||
}
|
}
|
||||||
}, [dataGrid.reload, filter, executeStored]);
|
}, [dataGrid.reload, filter, executeStored]);
|
||||||
|
|
||||||
//пользовательский параметр JuridicalPerson системы
|
//Загрузка значений фильра по умолчанию
|
||||||
const getJurPers = useCallback(async () => {
|
const loadDefaultFilter = useCallback(async () => {
|
||||||
const data = await executeStored({
|
const data = await executeStored({
|
||||||
stored: "PKG_P8PANELS_EQUIPSRV.GET_JUR_PERS_PRM",
|
stored: "PKG_P8PANELS_EQUIPSRV.GET_DEFAULT_FP",
|
||||||
respArg: "CRES"
|
respArg: "COUT"
|
||||||
});
|
});
|
||||||
setFilter(pv => ({ ...pv, belong: data }));
|
|
||||||
|
setFilter(pv => ({ ...pv, belong: data.JURPERS, fromMonth: data.MONTH, fromYear: data.YEAR, toMonth: data.MONTH, toYear: data.YEAR }));
|
||||||
|
setDefaultLoaded(true);
|
||||||
}, [executeStored]);
|
}, [executeStored]);
|
||||||
|
|
||||||
|
//пользовательский параметр JuridicalPerson системы
|
||||||
|
// const getJurPers = useCallback(async () => {
|
||||||
|
// const data = await executeStored({
|
||||||
|
// stored: "PKG_P8PANELS_EQUIPSRV.GET_JUR_PERS_PRM",
|
||||||
|
// respArg: "CRES"
|
||||||
|
// });
|
||||||
|
// setFilter(pv => ({ ...pv, belong: data }));
|
||||||
|
// }, [executeStored]);
|
||||||
|
|
||||||
|
// Отбор документа (ТОиР или Ремонтных ведомостей) по ячейке даты
|
||||||
|
const showEquipSrv = async ({ date, workType, info }) => {
|
||||||
|
const [techName, servKind] = info.split("_");
|
||||||
|
let type;
|
||||||
|
|
||||||
|
if (workType == "План") type = 0;
|
||||||
|
else type = 1;
|
||||||
|
|
||||||
|
let [year, month, day] = date.substring(1).split("_");
|
||||||
|
|
||||||
|
//if (day == undefined) day = null;
|
||||||
|
|
||||||
|
const data = await executeStored({
|
||||||
|
stored: "PKG_P8PANELS_EQUIPSRV.SELECT_EQUIPSRV",
|
||||||
|
args: {
|
||||||
|
SBELONG: filter.belong,
|
||||||
|
SPRODOBJ: filter.prodObj,
|
||||||
|
STECHSERV: filter.techServ ? filter.techServ : null,
|
||||||
|
SRESPDEP: filter.respDep ? filter.respDep : null,
|
||||||
|
STECHNAME: techName,
|
||||||
|
SSRVKIND: servKind,
|
||||||
|
NYEAR: Number(year),
|
||||||
|
NMONTH: Number(month),
|
||||||
|
NDAY: day ? Number(day) : null,
|
||||||
|
NWORKTYPE: type
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (data.NIDENT) {
|
||||||
|
if (type == 0) pOnlineShowUnit({ unitCode: "EquipTechServices", inputParameters: [{ name: "in_SelectList_Ident", value: data.NIDENT }] });
|
||||||
|
else pOnlineShowUnit({ unitCode: "EquipRepairSheets", inputParameters: [{ name: "in_Ident", value: data.NIDENT }] });
|
||||||
|
} else showMsgErr(TEXTS.NO_DATA_FOUND);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Открыть фильтр
|
||||||
|
const openFilter = () => {
|
||||||
|
setFilterOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Закрыть фильтр
|
||||||
|
const closeFilter = e => {
|
||||||
|
if (filterLock && e != undefined) setFilter(filterCopy);
|
||||||
|
setFilterOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Очистить фильтр
|
||||||
|
const clearFilter = () => {
|
||||||
|
setFilter({
|
||||||
|
belong: "",
|
||||||
|
prodObj: "",
|
||||||
|
techServ: "",
|
||||||
|
respDep: "",
|
||||||
|
fromMonth: "",
|
||||||
|
fromYear: "",
|
||||||
|
toMonth: "",
|
||||||
|
toYear: ""
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Отработка события скрытия/раскрытия ячейки даты
|
||||||
|
const handleClick = (e, ref) => {
|
||||||
|
const curCell = ref.current;
|
||||||
|
|
||||||
|
if (e.target.type == "button" || e.target.offsetParent.type == "button") {
|
||||||
|
setActiveRef(curCell);
|
||||||
|
setRidFlag(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// При необходимости обновить данные таблицы
|
||||||
|
useEffect(() => {
|
||||||
|
loadData();
|
||||||
|
}, [loadData, dataGrid.reload]);
|
||||||
|
|
||||||
|
// При открытом фильтре
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (filterOpen) {
|
if (filterOpen) {
|
||||||
setFilterCopy({ ...filter });
|
{
|
||||||
|
setFilterCopy({ ...filter });
|
||||||
|
if (!defaultLoaded) loadDefaultFilter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [filterOpen]);
|
}, [filterOpen]);
|
||||||
|
|
||||||
//При необходимости обновить данные таблицы
|
// При нажатии скрытии/раскрытии ячейки даты, фокус на неё
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadData();
|
if (!refIsDeprecated) {
|
||||||
}, [loadData, dataGrid.reload]);
|
if (activeRef) {
|
||||||
|
var cellRect = activeRef.getBoundingClientRect();
|
||||||
|
//console.log(window.scrollX + cellRect.left + activeRef.clientWidth / 2 - window.innerWidth / 2);
|
||||||
|
window.scrollTo(window.scrollX + cellRect.left + activeRef.clientWidth / 2 - window.innerWidth / 2, 0);
|
||||||
|
setRidFlag(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [refIsDeprecated]);
|
||||||
|
|
||||||
|
let yearArray = [];
|
||||||
|
const monthArray = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"];
|
||||||
|
let today = new Date();
|
||||||
|
|
||||||
|
// Получение списка лет
|
||||||
|
const getYearArray = () => {
|
||||||
|
for (let i = 1990; i <= today.getFullYear(); i++) {
|
||||||
|
yearArray.push(i);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//Генерация содержимого
|
//Генерация содержимого
|
||||||
return (
|
return (
|
||||||
@ -254,26 +347,11 @@ const EqsPrfrm = () => {
|
|||||||
aria-describedby="belong-outlined-helper-text"
|
aria-describedby="belong-outlined-helper-text"
|
||||||
label="Принадлежность"
|
label="Принадлежность"
|
||||||
/>
|
/>
|
||||||
<Grid container>
|
{filter.belong ? null : (
|
||||||
<Grid item xs={6}>
|
<FormHelperText id="belong-outlined-helper-text" sx={{ color: "red" }}>
|
||||||
{filter.belong ? null : (
|
*Обязательное поле
|
||||||
<FormHelperText id="belong-outlined-helper-text" sx={{ color: "red" }}>
|
</FormHelperText>
|
||||||
*Обязательное поле
|
)}
|
||||||
</FormHelperText>
|
|
||||||
)}
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={6} sx={{ textAlign: "end" }}>
|
|
||||||
<Link
|
|
||||||
component="button"
|
|
||||||
variant="body2"
|
|
||||||
id="belong-outlined-link-btn"
|
|
||||||
sx={{ fontSize: "0.75rem", marginRight: "35px" }}
|
|
||||||
onClick={getJurPers}
|
|
||||||
>
|
|
||||||
Значение по умолчанию
|
|
||||||
</Link>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Box>
|
</Box>
|
||||||
<Box component="section" sx={{ p: 1 }}>
|
<Box component="section" sx={{ p: 1 }}>
|
||||||
@ -498,10 +576,10 @@ const EqsPrfrm = () => {
|
|||||||
closeFilter();
|
closeFilter();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Сформировать отчёт
|
Сформировать
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="contained" onClick={clearFilter}>
|
<Button variant="contained" onClick={clearFilter}>
|
||||||
Очистить фильтр
|
Очистить
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
@ -509,7 +587,7 @@ const EqsPrfrm = () => {
|
|||||||
setFilter(filterCopy);
|
setFilter(filterCopy);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Отменить изменения
|
Отмена
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@ -536,8 +614,10 @@ const EqsPrfrm = () => {
|
|||||||
rows={dataGrid.rows}
|
rows={dataGrid.rows}
|
||||||
size={P8P_DATA_GRID_SIZE.LARGE}
|
size={P8P_DATA_GRID_SIZE.LARGE}
|
||||||
reloading={dataGrid.reload}
|
reloading={dataGrid.reload}
|
||||||
headCellRender={prms => headCellRender({ ...prms }, filter.techServ, info.cntP, info.sumP, info.cntF, info.sumF)}
|
headCellRender={prms =>
|
||||||
dataCellRender={prms => dataCellRender({ ...prms })}
|
headCellRender({ ...prms }, handleClick, filter.techServ, info.cntP, info.sumP, info.cntF, info.sumF)
|
||||||
|
}
|
||||||
|
dataCellRender={prms => dataCellRender({ ...prms }, showEquipSrv)}
|
||||||
groupCellRender={prms => groupCellRender({ ...prms })}
|
groupCellRender={prms => groupCellRender({ ...prms })}
|
||||||
showCellRightBorder={true}
|
showCellRightBorder={true}
|
||||||
/>
|
/>
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
//Подключение библиотек
|
//Подключение библиотек
|
||||||
//---------------------
|
//---------------------
|
||||||
|
|
||||||
|
import React, { createRef } from "react"; //Классы React
|
||||||
import { Grid, Stack } from "@mui/material";
|
import { Grid, Stack } from "@mui/material";
|
||||||
import React from "react"; //Классы React
|
|
||||||
|
|
||||||
//---------
|
//---------
|
||||||
//Константы
|
//Константы
|
||||||
@ -25,6 +25,7 @@ let x = 0;
|
|||||||
//-----------
|
//-----------
|
||||||
//Тело модуля
|
//Тело модуля
|
||||||
//-----------
|
//-----------
|
||||||
|
|
||||||
const formatDate = date => {
|
const formatDate = date => {
|
||||||
const [year, month, day] = date.substring(1).split("_");
|
const [year, month, day] = date.substring(1).split("_");
|
||||||
let nd;
|
let nd;
|
||||||
@ -33,76 +34,96 @@ const formatDate = date => {
|
|||||||
return nd;
|
return nd;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const headCellRender = ({ columnDef }, podr, cntP, sumP, cntF, sumF) => {
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
export const headCellRender = ({ columnDef }, hClick, podr, cntP, sumP, cntF, sumF) => {
|
||||||
let cellStyle = { border: "1px solid rgba(0, 0, 0)", textAlign: "center" };
|
let cellStyle = { border: "1px solid rgba(0, 0, 0)", textAlign: "center" };
|
||||||
let cellProps = {};
|
let cellProps = {};
|
||||||
|
let stackStyle = {};
|
||||||
let data = columnDef.caption;
|
let data = columnDef.caption;
|
||||||
|
|
||||||
if (columnDef.expandable) {
|
if (columnDef.expandable) {
|
||||||
// поменять расположение + для развёртывания
|
const ref = createRef();
|
||||||
|
cellStyle = { ...cellStyle, padding: "5px" };
|
||||||
|
cellProps = {
|
||||||
|
...cellProps,
|
||||||
|
ref: ref,
|
||||||
|
onClick: e => {
|
||||||
|
hClick(e, ref);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
stackStyle = { flexDirection: "column" };
|
||||||
}
|
}
|
||||||
if (columnDef.name == "STEST") cellStyle = { display: "none" };
|
if (columnDef.name == "STEST") cellStyle = { display: "none" };
|
||||||
if (columnDef.name == "SINFO" || columnDef.name == "SINFO2") {
|
if (columnDef.name == "SINFO" || columnDef.name == "SINFO2") {
|
||||||
cellProps = { colSpan: 2 };
|
cellProps = { colSpan: 2 };
|
||||||
if (columnDef.name == "SINFO") {
|
if (columnDef.name == "SINFO") cellProps = { ...cellProps, rowSpan: 2 };
|
||||||
cellStyle = { ...cellStyle, padding: "unset" };
|
//if (columnDef.name == "SINFO") {
|
||||||
data = (
|
//cellStyle = { display: "none" };
|
||||||
<Stack sx={{ justifyContent: "center" }} direction="row" width={300}>
|
// cellStyle = { ...cellStyle, padding: "unset" };
|
||||||
<Grid container>
|
// data = (
|
||||||
<Grid item xs={4}>
|
// <Stack sx={{ justifyContent: "center" }} direction="row" width={300}>
|
||||||
Подразделение:
|
// <Grid container>
|
||||||
</Grid>
|
// <Grid item xs={4}>
|
||||||
<Grid item xs={8}>
|
// Подразделение:
|
||||||
{podr}
|
// </Grid>
|
||||||
</Grid>
|
// <Grid item xs={8}>
|
||||||
<Grid item xs={4}>
|
// {podr}
|
||||||
Кол-во ремонтов, план:
|
// </Grid>
|
||||||
</Grid>
|
// <Grid item xs={4}>
|
||||||
<Grid item xs={2}>
|
// Кол-во ремонтов, план:
|
||||||
{cntP}
|
// </Grid>
|
||||||
</Grid>
|
// <Grid item xs={2}>
|
||||||
<Grid item xs={4}>
|
// {cntP}
|
||||||
Трудоемкость, час. план:
|
// </Grid>
|
||||||
</Grid>
|
// <Grid item xs={4}>
|
||||||
<Grid item xs={2}>
|
// Трудоемкость, час. план:
|
||||||
{sumP}
|
// </Grid>
|
||||||
</Grid>
|
// <Grid item xs={2}>
|
||||||
<Grid item xs={4}>
|
// {sumP}
|
||||||
Кол-во ремонтов, факт:
|
// </Grid>
|
||||||
</Grid>
|
// <Grid item xs={4}>
|
||||||
<Grid item xs={2}>
|
// Кол-во ремонтов, факт:
|
||||||
{cntF}
|
// </Grid>
|
||||||
</Grid>
|
// <Grid item xs={2}>
|
||||||
<Grid item xs={4}>
|
// {cntF}
|
||||||
Трудоемкость, час. факт:
|
// </Grid>
|
||||||
</Grid>
|
// <Grid item xs={4}>
|
||||||
<Grid item xs={2}>
|
// Трудоемкость, час. факт:
|
||||||
{sumF}
|
// </Grid>
|
||||||
</Grid>
|
// <Grid item xs={2}>
|
||||||
</Grid>
|
// {sumF}
|
||||||
</Stack>
|
// </Grid>
|
||||||
);
|
// </Grid>
|
||||||
}
|
// </Stack>
|
||||||
|
// );
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (columnDef.name == "SINFO2") cellStyle = { display: "none" };
|
||||||
|
|
||||||
if (columnDef.visible && DAY_NAME_REG_EXP.test(columnDef.name)) {
|
if (columnDef.visible && DAY_NAME_REG_EXP.test(columnDef.name)) {
|
||||||
cellStyle = { ...cellStyle, paddingLeft: "5px", paddingRight: "5px", minWidth: "25px", maxWidth: "25px" };
|
cellStyle = { ...cellStyle, padding: "5px", minWidth: "25px", maxWidth: "25px" };
|
||||||
|
stackStyle = { justifyContent: "center" };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { cellStyle, cellProps, data };
|
return { cellStyle, cellProps, stackStyle, data };
|
||||||
};
|
};
|
||||||
|
|
||||||
export const dataCellRender = ({ row, columnDef }) => {
|
export const dataCellRender = ({ row, columnDef }, showEquipSrv) => {
|
||||||
let cellStyle = {
|
let cellStyle = {
|
||||||
padding: "2px",
|
padding: "2px",
|
||||||
border: "1px solid rgba(0, 0, 0)",
|
border: "1px solid rgba(0, 0, 0) !important",
|
||||||
textAlign: "center"
|
textAlign: "center"
|
||||||
};
|
};
|
||||||
let cellProps = {};
|
let cellProps = {};
|
||||||
let data = " ";
|
let data = " ";
|
||||||
|
|
||||||
if (row["SINFO2"] == undefined) {
|
if (row["SINFO2"] == undefined) {
|
||||||
if (columnDef.name == "STEST") cellProps = { colSpan: 2 };
|
if (columnDef.name == "STEST") {
|
||||||
|
cellProps = { colSpan: 2 };
|
||||||
|
cellStyle = { ...cellStyle, textAlign: "right", fontWeight: "bold" };
|
||||||
|
}
|
||||||
if (columnDef.name == "SINFO2") cellStyle = { display: "none" };
|
if (columnDef.name == "SINFO2") cellStyle = { display: "none" };
|
||||||
if (columnDef.parent == "" && columnDef.expandable == true && columnDef.expanded == false) {
|
if (columnDef.parent == "" && columnDef.expandable == true && columnDef.expanded == false) {
|
||||||
curParent = columnDef.name;
|
curParent = columnDef.name;
|
||||||
@ -130,16 +151,31 @@ export const dataCellRender = ({ row, columnDef }) => {
|
|||||||
|
|
||||||
switch (row[columnDef.name]) {
|
switch (row[columnDef.name]) {
|
||||||
case "blue":
|
case "blue":
|
||||||
cellStyle = { ...cellStyle, backgroundColor: "royalblue", border: "1px solid rgba(0, 0, 0)" };
|
cellStyle = { ...cellStyle, backgroundColor: "lightblue", border: "1px solid rgba(0, 0, 0) !important" };
|
||||||
cellProps = { title: formatDate(columnDef.name) };
|
cellProps = {
|
||||||
|
title: formatDate(columnDef.name),
|
||||||
|
onClick: () => {
|
||||||
|
showEquipSrv({ date: columnDef.name, workType: row["SINFO2"], info: row["groupName"] });
|
||||||
|
}
|
||||||
|
};
|
||||||
return { cellStyle, cellProps, data };
|
return { cellStyle, cellProps, data };
|
||||||
case "green":
|
case "green":
|
||||||
cellStyle = { ...cellStyle, backgroundColor: "lawngreen", border: "1px solid rgba(0, 0, 0)" };
|
cellStyle = { ...cellStyle, backgroundColor: "green", border: "1px solid rgba(0, 0, 0) !important" };
|
||||||
cellProps = { title: formatDate(columnDef.name) };
|
cellProps = {
|
||||||
|
title: formatDate(columnDef.name),
|
||||||
|
onClick: () => {
|
||||||
|
showEquipSrv({ date: columnDef.name, workType: row["SINFO2"], info: row["groupName"] });
|
||||||
|
}
|
||||||
|
};
|
||||||
return { cellStyle, cellProps, data };
|
return { cellStyle, cellProps, data };
|
||||||
case "red":
|
case "red":
|
||||||
cellStyle = { ...cellStyle, backgroundColor: "crimson", border: "1px solid rgba(0, 0, 0)" };
|
cellStyle = { ...cellStyle, backgroundColor: "crimson", border: "1px solid rgba(0, 0, 0) !important" };
|
||||||
cellProps = { title: formatDate(columnDef.name) };
|
cellProps = {
|
||||||
|
title: formatDate(columnDef.name),
|
||||||
|
onClick: () => {
|
||||||
|
showEquipSrv({ date: columnDef.name, workType: row["SINFO2"], info: row["groupName"] });
|
||||||
|
}
|
||||||
|
};
|
||||||
return { cellStyle, cellProps, data };
|
return { cellStyle, cellProps, data };
|
||||||
case "green red":
|
case "green red":
|
||||||
case "red green":
|
case "red green":
|
||||||
@ -148,10 +184,20 @@ export const dataCellRender = ({ row, columnDef }) => {
|
|||||||
data = (
|
data = (
|
||||||
<Stack sx={{ justifyContent: "center" }} direction="row">
|
<Stack sx={{ justifyContent: "center" }} direction="row">
|
||||||
<Grid container maxHeight="100%">
|
<Grid container maxHeight="100%">
|
||||||
<Grid item xs={6} sx={{ backgroundColor: "lawngreen" }}>
|
<Grid
|
||||||
|
item
|
||||||
|
xs={6}
|
||||||
|
sx={{ backgroundColor: "green" }}
|
||||||
|
onClick={() => showEquipSrv({ date: columnDef.name, workType: row["SINFO2"], info: row["groupName"] })}
|
||||||
|
>
|
||||||
<p style={{ display: "none" }}>g</p>
|
<p style={{ display: "none" }}>g</p>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={6} sx={{ backgroundColor: "crimson" }}>
|
<Grid
|
||||||
|
item
|
||||||
|
xs={6}
|
||||||
|
sx={{ backgroundColor: "crimson" }}
|
||||||
|
onClick={() => showEquipSrv({ date: columnDef.name, workType: row["SINFO2"], info: row["groupName"] })}
|
||||||
|
>
|
||||||
<p style={{ display: "none" }}>r</p>
|
<p style={{ display: "none" }}>r</p>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
4
dist/p8-panels.js
vendored
4
dist/p8-panels.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user