lhj #233

Merged
hjlee merged 2 commits from lhj into main 2025-12-01 17:05:35 +09:00
2 changed files with 44 additions and 32 deletions
Showing only changes of commit 7242f08224 - Show all commits

View File

@ -503,8 +503,8 @@ export const ButtonConfigPanel: React.FC<ButtonConfigPanelProps> = ({
<SelectItem value="excel_upload"> </SelectItem>
<SelectItem value="barcode_scan"> </SelectItem>
<SelectItem value="code_merge"> </SelectItem>
<SelectItem value="geolocation"> </SelectItem>
<SelectItem value="update_field"> </SelectItem>
<SelectItem value="empty_vehicle"></SelectItem>
<SelectItem value="operation_control"> </SelectItem>
</SelectContent>
</Select>
</div>
@ -1665,9 +1665,9 @@ export const ButtonConfigPanel: React.FC<ButtonConfigPanelProps> = ({
)}
{/* 위치정보 가져오기 설정 */}
{(component.componentConfig?.action?.type || "save") === "geolocation" && (
{(component.componentConfig?.action?.type || "save") === "empty_vehicle" && (
<div className="mt-4 space-y-4 rounded-lg border bg-muted/50 p-4">
<h4 className="text-sm font-medium text-foreground">📍 </h4>
<h4 className="text-sm font-medium text-foreground">🚛 </h4>
{/* 테이블 선택 */}
<div>
@ -1849,10 +1849,10 @@ export const ButtonConfigPanel: React.FC<ButtonConfigPanelProps> = ({
</div>
)}
{/* 필드 값 변경 설정 */}
{(component.componentConfig?.action?.type || "save") === "update_field" && (
{/* 운행알림 및 종료 설정 */}
{(component.componentConfig?.action?.type || "save") === "operation_control" && (
<div className="mt-4 space-y-4 rounded-lg border bg-muted/50 p-4">
<h4 className="text-sm font-medium text-foreground">📝 </h4>
<h4 className="text-sm font-medium text-foreground">🚗 </h4>
<div>
<Label htmlFor="update-table">

View File

@ -16,7 +16,7 @@ export type ButtonActionType =
| "edit" // 편집
| "copy" // 복사 (품목코드 초기화)
| "navigate" // 페이지 이동
| "openModalWithData" // 🆕 데이터를 전달하면서 모달 열기
| "openModalWithData" // 데이터를 전달하면서 모달 열기
| "modal" // 모달 열기
| "control" // 제어 흐름
| "view_table_history" // 테이블 이력 보기
@ -24,9 +24,9 @@ export type ButtonActionType =
| "excel_upload" // 엑셀 업로드
| "barcode_scan" // 바코드 스캔
| "code_merge" // 코드 병합
| "geolocation" // 위치정보 가져오기 (1회성, 폼 업데이트만)
| "empty_vehicle" // 공차등록 (위치 수집 + 상태 변경)
| "operation_control" // 운행알림 및 종료 (위치 수집 + 상태 변경 + 연속 추적)
| "swap_fields" // 필드 값 교환 (출발지 ↔ 목적지)
| "update_field" // 필드 값 변경 + 위치 수집 + 연속 추적 (통합)
| "transferData"; // 데이터 전달 (컴포넌트 간 or 화면 간)
/**
@ -350,15 +350,15 @@ export class ButtonActionExecutor {
case "transferData":
return await this.handleTransferData(config, context);
case "geolocation":
return await this.handleGeolocation(config, context);
case "empty_vehicle":
return await this.handleEmptyVehicle(config, context);
case "operation_control":
return await this.handleOperationControl(config, context);
case "swap_fields":
return await this.handleSwapFields(config, context);
case "update_field":
return await this.handleUpdateField(config, context);
default:
console.warn(`지원되지 않는 액션 타입: ${config.type}`);
return false;
@ -3674,12 +3674,10 @@ export class ButtonActionExecutor {
}
/**
*
* - 1
* -
* - DB UPDATE
*
* - + (: status inactive)
*/
private static async handleGeolocation(config: ButtonActionConfig, context: ButtonActionContext): Promise<boolean> {
private static async handleEmptyVehicle(config: ButtonActionConfig, context: ButtonActionContext): Promise<boolean> {
try {
console.log("📍 위치정보 가져오기 액션 실행:", { config, context });
@ -3881,7 +3879,11 @@ export class ButtonActionExecutor {
* 🆕
* 🆕
*/
private static async handleUpdateField(config: ButtonActionConfig, context: ButtonActionContext): Promise<boolean> {
/**
*
* - + + (/)
*/
private static async handleOperationControl(config: ButtonActionConfig, context: ButtonActionContext): Promise<boolean> {
try {
console.log("🔄 필드 값 변경 액션 실행:", { config, context });
@ -4259,26 +4261,36 @@ export const DEFAULT_BUTTON_ACTIONS: Record<ButtonActionType, Partial<ButtonActi
successMessage: "데이터가 전달되었습니다.",
errorMessage: "데이터 전달 중 오류가 발생했습니다.",
},
geolocation: {
type: "geolocation",
empty_vehicle: {
type: "empty_vehicle",
geolocationHighAccuracy: true,
geolocationTimeout: 10000,
geolocationMaxAge: 0,
geolocationLatField: "latitude",
geolocationLngField: "longitude",
successMessage: "위치 정보를 가져왔습니다.",
errorMessage: "위치 정보를 가져오는 중 오류가 발생했습니다.",
geolocationAutoSave: true,
geolocationKeyField: "user_id",
geolocationKeySourceField: "__userId__",
geolocationExtraField: "status",
geolocationExtraValue: "inactive",
successMessage: "공차등록이 완료되었습니다.",
errorMessage: "공차등록 중 오류가 발생했습니다.",
},
operation_control: {
type: "operation_control",
updateAutoSave: true,
updateWithGeolocation: true,
updateGeolocationLatField: "latitude",
updateGeolocationLngField: "longitude",
updateKeyField: "user_id",
updateKeySourceField: "__userId__",
confirmMessage: "운행 상태를 변경하시겠습니까?",
successMessage: "운행 상태가 변경되었습니다.",
errorMessage: "운행 상태 변경 중 오류가 발생했습니다.",
},
swap_fields: {
type: "swap_fields",
successMessage: "필드 값이 교환되었습니다.",
errorMessage: "필드 값 교환 중 오류가 발생했습니다.",
},
update_field: {
type: "update_field",
updateAutoSave: true,
confirmMessage: "상태를 변경하시겠습니까?",
successMessage: "상태가 변경되었습니다.",
errorMessage: "상태 변경 중 오류가 발생했습니다.",
},
};