develop #2

Merged
gitadmin merged 4 commits from develop into master 2026-06-30 17:09:52 +09:00
9 changed files with 358 additions and 259 deletions
Showing only changes of commit 24d917ac7b - Show all commits

View File

@@ -122,6 +122,8 @@
--kfpa-red-100: #f2a8b5;
--kfpa-red-50: #fae6ea;
--kfpa-null: #9a9a9a;
/* =============================
Surface
============================= */
@@ -357,6 +359,7 @@
.border-border { border-color: var(--border); }
.text-zero { color: var(--kfpa-black-150) !important; }
.text-null { color: var(--kfpa-null) !important; }
/* KFPA neutral scale */
.bg-black-600 { background-color: var(--kfpa-black-600) !important; }
@@ -410,6 +413,7 @@
.bg-csi { background-color: var(--kfpa-csi) !important; }
.bg-direct { background-color: var(--kfpa-direct) !important; }
.bg-indirect { background-color: var(--kfpa-indirect) !important; }
.bg-null { background-color: var(--kfpa-null) !important; }
/* =============================
Content Text Size Utilities

View File

@@ -35,9 +35,52 @@ type Props = {
position?: "top" | "insideTop" | "right" | "insideRight";
color?: string;
distance?: number;
minPositionValue?: number;
};
};
type ChartCallbackParam = {
data?: unknown;
value?: unknown;
axisValueLabel?: string;
name?: string;
marker?: string;
seriesName?: string;
};
const isRecord = (value: unknown): value is Record<string, unknown> =>
typeof value === "object" && value !== null && !Array.isArray(value);
const toChartCallbackParam = (value: unknown): ChartCallbackParam =>
isRecord(value) ? value : {};
const getActualValue = (param: unknown) => {
const data = toChartCallbackParam(param).data;
if (isRecord(data) && "actualValue" in data) {
return data.actualValue;
}
return toChartCallbackParam(param).value;
};
const createLabelPositionTooltip = (fmt: ValueFormatter): EChartsOption["tooltip"] => ({
trigger: "axis",
axisPointer: { type: "shadow" },
formatter: (params: unknown) => {
const items = (Array.isArray(params) ? params : [params]).map(toChartCallbackParam);
const title = items[0]?.axisValueLabel ?? items[0]?.name ?? "";
const lines = items.map((item) => {
const value = getActualValue(item);
const text = typeof value === "number" ? fmt(value) : value == null ? "-" : String(value);
return `${item.marker ?? ""}${item.seriesName} ${text}`;
});
return [title, ...lines].join("<br/>");
},
});
const VerticalBar = ({
data,
height,
@@ -58,21 +101,31 @@ const VerticalBar = ({
const option: EChartsOption = useMemo(() => {
const fmt = valueFormatter ?? ((v: number) => String(v));
const minPositionValue = labelOptions?.minPositionValue;
return {
color: palette,
tooltip: tooltip ?? createDefaultTooltip(fmt),
tooltip: tooltip ?? (typeof minPositionValue === "number" ? createLabelPositionTooltip(fmt) : createDefaultTooltip(fmt)),
legend: legend ?? createDefaultLegend(),
grid: grid ?? createDefaultGrid(),
xAxis: xAxis ?? createCategoryAxis(data.categories, false, { axisTick: { alignWithLabel: true } }),
yAxis: yAxis ?? createValueAxis(),
series: data.series.map((s, index) => {
const showLabel = getIsShowLabel(showFocusLabel, index, data.series.length);
const seriesData = s.data.map((value) =>
typeof minPositionValue === "number" &&
typeof value === "number" &&
Number.isFinite(value) &&
value > 0.00 &&
value < minPositionValue
? { value: minPositionValue, actualValue: value }
: value
);
return {
name: s.name,
type: "bar",
data: s.data,
data: seriesData,
emphasis: { disabled: true },
barMaxWidth: barMaxWidth ?? BAR_WIDTHS.DEFAULT,
label: showLabel
@@ -81,7 +134,10 @@ const VerticalBar = ({
position: labelOptions?.position ?? "right",
color: labelOptions?.color,
distance: labelOptions?.distance,
formatter: (p: any) => (typeof p?.value === "number" ? fmt(p.value) : (p?.value ?? "")) as any,
formatter: (p: unknown) => {
const value = getActualValue(p);
return typeof value === "number" ? fmt(value) : value == null ? "" : String(value);
},
}
: undefined,
}

View File

@@ -169,10 +169,14 @@ return (
<BaseTableHeader title={title}/>
<div className="overflow-x-auto">
<table className={cn("kfpa-table kfpa-table", tableClassName)} style={{ minWidth: `${minWidth ?? minWidthPx}px` , maxWidth: maxWidth ? `${maxWidth}px` : undefined}}>
<table className={cn("kfpa-table kfpa-table", tableClassName)} style={{
minWidth: `${minWidth ?? minWidthPx}px`,
maxWidth: maxWidth ? `${maxWidth}px` : undefined
}}>
<colgroup>
{leadingColumnWidths.map((width, index) => (
<col key={`leading-col-${index}`} style={width ? { width, minWidth: width } : undefined} />
<col key={`leading-col-${index}`}
style={width ? {width, minWidth: width} : undefined}/>
))}
{columns.map((column, index) => {
const width = toCssSize(categoryColumnWidths?.[index] ?? column.width ?? categoryColumnWidth);
@@ -191,7 +195,8 @@ return (
className={cn(rowHeaderWidth ? undefined : "w-44", "border-none")}
style={{whiteSpace: "nowrap", ...rowHeaderStyle}}
/>
<td colSpan={columns.length} style={{ padding: 0, height: chartNode ? chartHeight : 0 }}>
<td colSpan={columns.length}
style={{padding: 0, height: chartNode ? chartHeight : 0}}>
{chartNode ? <div style={{width: "100%", height: "100%"}}>{chartNode}</div> : null}
</td>
</tr>
@@ -252,12 +257,16 @@ return (
const roundedValue = toRoundedNumber(rawValue, decimalPlaces);
if (roundedValue === null) {
return <td key={getColumnKey(column)} className={cn(column.cellClassName, row.cellClassName)} style={{ textAlign: column.align }}>-</td>;
return <td key={getColumnKey(column)}
className={cn(column.cellClassName, row.cellClassName, column.nullCellClassName)}
style={{textAlign: column.align}}>-</td>;
}
if (!signRow) {
return (
<td key={getColumnKey(column)} className={cn(column.cellClassName, row.cellClassName)} style={{ textAlign: column.align }}>
<td key={getColumnKey(column)}
className={cn(column.cellClassName, row.cellClassName)}
style={{textAlign: column.align}}>
{roundedValue.toFixed(decimalPlaces)}
</td>
);

View File

@@ -1,9 +1,20 @@
const CsiFormulaNote = () => {
return (
<>
<p className="mt-3 content-text-base">
※ 고객만족지수(CSI, Customer Satisfaction Index) = 고객 만족도조사 직접요소 항목 점수 X 가중치 + 고객
만족도조사 간접요소 항목 점수 X 가중치
</p>
<p className="mt-3 content-text-base">
※ 주요 고객 대상 : 안전점검(특수건물 관계자)
/ UCIS(사원사 등) / Bridge 플랫폼(사원사, 일반회원 등)
/ 방재컨설팅(발주처 관계자 약 20명) / 보험업무(보험 계약 담당자 약 300명)
/ 화재조사(사원사 손해사정부서 총 11명)
</p>
<p className="mt-3 content-text-base">
※ 방재컨설팅 고객만족도 조사는 각 용역이 완료되는 하반기에 진행 예정임.
</p>
</>
);
};

View File

@@ -2,6 +2,7 @@
import DataTable from "@/components/table/DataTable";
import type { DataColumn } from "@/components/table/types";
import { cn } from "@/lib/utils";
import type { CommentColumn, CommentField, CommentValue, DashboardCommentRowConfig } from "@/types/kfpa";
type CommentTableRow = DashboardCommentRowConfig & Record<string, unknown>;
@@ -63,12 +64,22 @@ const CustomerSatisfactionCommentTable = ({
const value = String(draft[column.key]?.[row.field] ?? "");
if (!isEditing) {
return <div className="min-h-24 whitespace-pre-wrap text-left">{value || "-"}</div>;
return (
<div className={cn(
"min-h-24 whitespace-pre-wrap text-left",
"leading-[1.5] content-text-lg"
)}>
{value || "-"}
</div>
);
}
return (
<textarea
className="min-h-28 w-full resize-y border border-gray-300 bg-background p-2 text-sm outline-none focus:border-primary"
className={cn(
"min-h-28 w-full resize-y border border-gray-300 bg-background p-2",
"leading-[1.5] content-text-lg outline-none focus:border-primary"
)}
value={value}
onChange={(event) => onChange(column.key, row.field, event.target.value)}
/>

View File

@@ -55,6 +55,13 @@ const CustomerSatisfactionSummary = () => {
: undefined,
align: "center",
}));
columns
.filter((column) => SUMMARY_CATEGORY_KEYS.includes(column.key ?? ""))
.forEach((column) => {
column.nullCellClassName = "bg-null text-null"
})
const categories = summaryColumns.map(getSummaryColumnLabel);
const rows: TopChartTableRow[] =
@@ -146,7 +153,7 @@ const CustomerSatisfactionSummary = () => {
signStyle={KFPA_GAP_SIGN_STYLE}
minWidth={tableLayout.tableWidth}
maxWidth={tableLayout.tableWidth}
chartHeight={180}
chartHeight={280}
chart={
<VerticalBar
data={chartData}
@@ -155,8 +162,9 @@ const CustomerSatisfactionSummary = () => {
valueFormatter={(value) => value.toFixed(KFPA_DECIMAL_POINT)}
barMaxWidth={30}
showFocusLabel="all"
labelOptions={{ position: "top", distance: 4 }}
grid={{ left: 0, right: 0, top: 20, bottom: 5 }}
labelOptions={{ position: "top", distance: 4, minPositionValue: 3.99 }}
legend={{top:50}}
grid={{ left: 0, right: 0, top: 120, bottom: 5 }}
xAxis={{
type: "category",
data: categories,
@@ -166,7 +174,7 @@ const CustomerSatisfactionSummary = () => {
}}
yAxis={{
type: "value",
min: 4,
min: 3.95,
max: 5,
axisLabel: { show: false },
axisTick: { show: false },

View File

@@ -226,7 +226,7 @@ const CustomerSatisfactionTotal = () => {
barMaxWidth={30}
showFocusLabel="all"
labelOptions={{ position: "top", distance: 4 }}
grid={{ left: 0, right: 0, top: 20, bottom: 5 }}
grid={{ left: 0, right: 0, top: 30, bottom: 5 }}
xAxis={{
type: "category",
data: categories,

View File

@@ -9,6 +9,7 @@ type TableColumnShared<T> = {
align?: TableColumnAlign;
headerClassName?: string;
cellClassName?: string;
nullCellClassName?: string;
render?: (row: T) => React.ReactNode;
};

View File

@@ -79,7 +79,6 @@ export const getAverageGapValue = (
key: string,
wave: number,
) => {
console.log(averageKey, key)
if(averageKey === key) return null;
const averageValue = roundNumber(getSummaryCsiValue(dataMap, averageKey, wave), KFPA_DECIMAL_POINT);