소스 검색

修复build 问题

handy 1 주 전
부모
커밋
3d6d6b7b1f
3개의 변경된 파일31개의 추가작업 그리고 8개의 파일을 삭제
  1. 5 1
      src/App.vue
  2. 1 1
      src/components/CreateLocationSqlModal.vue
  3. 25 6
      src/components/WarehouseMap.vue

+ 5 - 1
src/App.vue

@@ -635,7 +635,11 @@ const locationAttributeOptions = computed<LocationAttributeCode[]>(() => {
 })
 
 const zoneOptions = computed(() => {
-  return [...new Set(locations.value.map((loc) => loc.zoneId).filter(Boolean))].sort()
+  return [
+    ...new Set(
+      locations.value.map((loc) => loc.zoneId).filter((zoneId): zoneId is string => Boolean(zoneId))
+    )
+  ].sort()
 })
 
 const getLocationAttributeLabel = (attribute: LocationAttributeCode) => {

+ 1 - 1
src/components/CreateLocationSqlModal.vue

@@ -197,7 +197,7 @@ const generatedPutawayLogicalSequence = computed(() => {
 const generatedLocationRow = computed(() => form.value.y + 1)
 const generatedLocationColumn = computed(() => form.value.x + 1)
 
-const escapeSqlString = (value: string) => value.replaceAll("'", "''")
+const escapeSqlString = (value: string) => value.split("'").join("''")
 const quoteSqlValue = (value: string) => `'${escapeSqlString(value)}'`
 
 const baseLocationInsertSql = computed(() => {

+ 25 - 6
src/components/WarehouseMap.vue

@@ -108,7 +108,16 @@
 </template>
 
 <script setup lang="ts">
-import { computed, inject, onBeforeUnmount, onMounted, ref, watch, type CSSProperties } from 'vue'
+import {
+  computed,
+  inject,
+  onBeforeUnmount,
+  onMounted,
+  ref,
+  watch,
+  type ComponentPublicInstance,
+  type CSSProperties
+} from 'vue'
 import type { LocationResourceDataVO } from '../types'
 import { applyWarehouseLayoutEnhancement } from './warehouse-layout-enhancers'
 import {
@@ -360,11 +369,11 @@ const gridStyle = computed(() => {
   const minY = gridBounds.value?.minY ?? 0
   const rowHasLocation = Array.from({ length: gridMetrics.value.rows }, () => false)
   const colHasLocation = Array.from({ length: gridMetrics.value.cols }, () => false)
-  const isLocation = (cell: MapCell) => !('type' in cell)
+  const isLocation = (cell: MapCell): cell is GridCell => !('type' in cell)
   for (const cell of gridData.value) {
     if (!isLocation(cell)) continue
-    const rowIndex = cell.gridRow - minX
-    const colIndex = cell.gridCol - minY
+    const rowIndex = cell.parsed.gridRow - minX
+    const colIndex = cell.parsed.gridCol - minY
     if (rowIndex >= 0 && rowIndex < rowHasLocation.length) rowHasLocation[rowIndex] = true
     if (colIndex >= 0 && colIndex < colHasLocation.length) colHasLocation[colIndex] = true
   }
@@ -701,8 +710,18 @@ const getCellStyle = (cell: MapCell): CSSProperties => {
   }
 }
 
-const setCellRef = (el: Element | null, index: number) => {
-  cellRefs.value[index] = el as HTMLElement | null
+const setCellRef = (el: Element | ComponentPublicInstance | null, index: number) => {
+  if (el instanceof HTMLElement || el === null) {
+    cellRefs.value[index] = el
+    return
+  }
+
+  if ('$el' in el) {
+    cellRefs.value[index] = el.$el instanceof HTMLElement ? el.$el : null
+    return
+  }
+
+  cellRefs.value[index] = null
 }
 
 const selectionPoints = computed(() => {