- 실시간 작업장 현황을 지도로 시각화 - 작업장 관리 페이지에서 정의한 구역 정보 활용 - TBM 작업자 및 방문자 현황 표시 주요 변경사항: - dashboard.html: 작업장 현황 섹션 추가 (기존 작업 현황 테이블 제거) - workplace-status.js: 지도 렌더링 및 데이터 통합 로직 구현 - modern-dashboard.js: 삭제된 DOM 요소 조건부 체크 추가 시각화 방식: - 인원 없음: 회색 테두리 + 작업장 이름 - 내부 작업자: 파란색 영역 + 인원 수 - 외부 방문자: 보라색 영역 + 인원 수 - 둘 다: 초록색 영역 + 총 인원 수 기술 구현: - Canvas API 기반 사각형 영역 렌더링 - map-regions API를 통한 데이터 일관성 보장 - 클릭 이벤트로 상세 정보 모달 표시 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
54 lines
2.0 KiB
JavaScript
54 lines
2.0 KiB
JavaScript
/**
|
|
* 마이그레이션: 작업장 지도 이미지 기능 추가
|
|
* - workplace_categories에 layout_image 필드 추가
|
|
* - workplace_map_regions 테이블 생성 (클릭 가능한 영역 정의)
|
|
*/
|
|
|
|
exports.up = async function(knex) {
|
|
// 1. workplace_categories 테이블에 layout_image 필드 추가
|
|
await knex.schema.alterTable('workplace_categories', function(table) {
|
|
table.string('layout_image', 500).nullable().comment('공장 배치도 이미지 경로');
|
|
});
|
|
|
|
// 2. 작업장 지도 클릭 영역 정의 테이블 생성
|
|
await knex.schema.createTable('workplace_map_regions', function(table) {
|
|
table.increments('region_id').primary().comment('영역 ID');
|
|
table.integer('workplace_id').unsigned().notNullable().comment('작업장 ID');
|
|
table.integer('category_id').unsigned().notNullable().comment('공장 카테고리 ID');
|
|
|
|
// 좌표 정보 (비율 기반: 0~100%)
|
|
table.decimal('x_start', 5, 2).notNullable().comment('시작 X 좌표 (%)');
|
|
table.decimal('y_start', 5, 2).notNullable().comment('시작 Y 좌표 (%)');
|
|
table.decimal('x_end', 5, 2).notNullable().comment('끝 X 좌표 (%)');
|
|
table.decimal('y_end', 5, 2).notNullable().comment('끝 Y 좌표 (%)');
|
|
|
|
table.string('shape', 20).defaultTo('rect').comment('영역 모양 (rect, circle, polygon)');
|
|
table.text('polygon_points').nullable().comment('다각형인 경우 좌표 배열 (JSON)');
|
|
|
|
table.timestamps(true, true);
|
|
|
|
// 외래키
|
|
table.foreign('workplace_id')
|
|
.references('workplace_id')
|
|
.inTable('workplaces')
|
|
.onDelete('CASCADE')
|
|
.onUpdate('CASCADE');
|
|
|
|
table.foreign('category_id')
|
|
.references('category_id')
|
|
.inTable('workplace_categories')
|
|
.onDelete('CASCADE')
|
|
.onUpdate('CASCADE');
|
|
});
|
|
};
|
|
|
|
exports.down = async function(knex) {
|
|
// 테이블 삭제
|
|
await knex.schema.dropTableIfExists('workplace_map_regions');
|
|
|
|
// 필드 제거
|
|
await knex.schema.alterTable('workplace_categories', function(table) {
|
|
table.dropColumn('layout_image');
|
|
});
|
|
};
|