lhj #233
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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: "상태 변경 중 오류가 발생했습니다.",
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue