524 lines
25 KiB
Vue
524 lines
25 KiB
Vue
<template>
|
||
<el-dialog :title="dialogTitle" v-model="internalVisible" width="900px" align-center :before-close="handleClose" :close-on-click-modal="false">
|
||
<el-form ref="zoneFormRef" :model="formData" :rules="formRules" label-width="100px" label-position="left">
|
||
<!-- 分区类型改为下拉选择 -->
|
||
<el-form-item label="分区类型" prop="zone_type">
|
||
<el-select v-model="formData.zone_type" placeholder="请选择分区类型" style="width: 100%" @change="handleTypeChange"
|
||
:disabled="mode === 'edit' || submitting">
|
||
<el-option v-for="type in availableZoneTypes" :key="type.value" :label="type.label" :value="type.value" />
|
||
</el-select>
|
||
</el-form-item>
|
||
|
||
<el-form-item label="分区编码" prop="zone_code">
|
||
<el-input v-model="formData.zone_code" placeholder="请输入分区编码" maxlength="5" show-word-limit />
|
||
</el-form-item>
|
||
|
||
<el-form-item label="分区名称" prop="zone_name">
|
||
<el-input v-model="formData.zone_name" placeholder="请输入分区名称" maxlength="100" show-word-limit />
|
||
</el-form-item>
|
||
|
||
<!-- 父分区信息显示 -->
|
||
<el-form-item v-if="showParentInfo" label="父分区">
|
||
<el-input v-model="parentDisplayName" :disabled="true" style="width: 100%" />
|
||
</el-form-item>
|
||
|
||
<!-- 尺寸信息 - 所有类型都显示 -->
|
||
<el-card class="size-card">
|
||
<template #header>
|
||
<span>尺寸信息</span>
|
||
<el-tooltip v-if="formData.zone_type === 'area'" content="区域通常用于规划仓库内的功能区划分" placement="top">
|
||
<i class="el-icon-info" style="margin-left: 8px; color: #909399;"></i>
|
||
</el-tooltip>
|
||
<el-tooltip v-if="formData.zone_type === 'warehouse'" content="仓库的整体尺寸" placement="top">
|
||
<i class="el-icon-info" style="margin-left: 8px; color: #909399;"></i>
|
||
</el-tooltip>
|
||
</template>
|
||
|
||
<el-row :gutter="20">
|
||
<el-col :span="8">
|
||
<el-form-item label="总长度" prop="length">
|
||
<el-input-number v-if="formData.direction=='north'||formData.direction=='south'" v-model="formData.length" placeholder="长度" :min="10" :step="10" style="width: 100%" />
|
||
<el-input-number v-else v-model="formData.width" placeholder="长度" :min="10" :step="10" style="width: 100%" />
|
||
<span class="unit-hint">cm</span>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="8">
|
||
<el-form-item label="总宽度" prop="width">
|
||
<el-input-number v-if="formData.direction=='west'||formData.direction=='east'" v-model="formData.length" placeholder="宽度" :min="10" :step="10" style="width: 100%" />
|
||
<el-input-number v-else v-model="formData.width" placeholder="宽度" :min="10" :step="10" style="width: 100%" />
|
||
<span class="unit-hint">cm</span>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="8">
|
||
<el-form-item label="高度" prop="height">
|
||
<el-input-number v-model="formData.height" placeholder="高度" :min="10" :step="10" style="width: 100%" />
|
||
<span class="unit-hint">cm</span>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<!-- 面积/体积信息显示 -->
|
||
<div class="calculation-info">
|
||
<span v-if="formData.zone_type === 'area'">面积:{{ calculateArea() }} m²</span>
|
||
<span v-if="formData.zone_type === 'rack'">体积:{{ calculateVolume() }} m³</span>
|
||
<span v-if="formData.zone_type === 'warehouse'">面积:{{ calculateArea() }} m²</span>
|
||
<span v-if="formData.zone_type === 'pick_start'">面积:{{ calculateArea() }} m²</span>
|
||
</div>
|
||
</el-card>
|
||
|
||
<!-- 坐标信息 - 用于定位 -->
|
||
<el-card class="coordinate-card" v-if="formData.zone_type !== 'warehouse'">
|
||
<template #header>
|
||
<span>坐标信息</span>
|
||
<el-tooltip content="设置分区在三维空间中的位置坐标" placement="top">
|
||
<i class="el-icon-info" style="margin-left: 8px; color: #909399;"></i>
|
||
</el-tooltip>
|
||
</template>
|
||
|
||
<el-row :gutter="20">
|
||
<el-col :span="8">
|
||
<el-form-item label="X坐标" prop="x">
|
||
<el-input-number v-model="formData.x" placeholder="X坐标" :min="0" :step="10" style="width: 100%" />
|
||
<span class="unit-hint">cm</span>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="8">
|
||
<el-form-item label="Y坐标" prop="y">
|
||
<el-input-number v-model="formData.y" placeholder="Y坐标" :min="0" :step="10" style="width: 100%" />
|
||
<span class="unit-hint">cm</span>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="8">
|
||
<el-form-item label="Z坐标" prop="z">
|
||
<el-input-number v-model="formData.z" placeholder="Z坐标" :min="0" :step="10" style="width: 100%" />
|
||
<span class="unit-hint">cm</span>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<!-- 坐标说明 -->
|
||
<div class="coordinate-note">
|
||
<small>说明:X(左右), Y(前后), Z(上下),用于三维空间定位</small>
|
||
</div>
|
||
</el-card>
|
||
|
||
<!-- 货架配置 -->
|
||
<el-card class="rack-card" v-if="formData.zone_type === 'rack'">
|
||
<template #header>
|
||
<span>货架配置</span>
|
||
<el-tooltip content="货架尺寸指单个货架的尺寸,用于计算仓位布局" placement="top">
|
||
<i class="el-icon-info" style="margin-left: 8px; color: #909399;"></i>
|
||
</el-tooltip>
|
||
</template>
|
||
|
||
<!-- 货架单元格尺寸 -->
|
||
<div class="rack-grid-size">
|
||
<el-row :gutter="20">
|
||
<el-col :span="8">
|
||
<el-form-item label="货架长度" prop="cell_length">
|
||
<el-input-number v-model="formData.cell_length" placeholder="货架长度" :min="10" :step="5" style="width: 100%" />
|
||
<span class="unit-hint">cm</span>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="8">
|
||
<el-form-item label="货架深度" prop="cell_width">
|
||
<el-input-number v-model="formData.cell_width" placeholder="货架深度" :min="10" :step="5" style="width: 100%" />
|
||
<span class="unit-hint">cm</span>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="8">
|
||
<el-form-item label="货架高度" prop="cell_height">
|
||
<el-input-number v-model="formData.cell_height" placeholder="货架高度" :min="10" :step="5" style="width: 100%" />
|
||
<span class="unit-hint">cm</span>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
</div>
|
||
|
||
<el-row :gutter="20">
|
||
<el-col :span="8">
|
||
<el-form-item label="列数" prop="rack_columns">
|
||
<el-input-number v-model="formData.rack_columns" placeholder="列数" :min="1" :max="255" style="width: 100%" />
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="8">
|
||
<el-form-item label="层数" prop="rack_rows">
|
||
<el-input-number v-model="formData.rack_rows" placeholder="层数" :min="1" :max="255" style="width: 100%" />
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="8">
|
||
<el-form-item label="分格数" prop="rack_levels">
|
||
<el-input-number v-model="formData.rack_levels" placeholder="分格数" :min="1" :max="255" style="width: 100%" />
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<el-form-item label="朝向" prop="direction">
|
||
<el-radio-group v-model="formData.direction">
|
||
<el-radio label="north">北</el-radio>
|
||
<el-radio label="south">南</el-radio>
|
||
<el-radio label="east">东</el-radio>
|
||
<el-radio label="west">西</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
<el-row :gutter="20">
|
||
<el-col :span="24">
|
||
<el-form-item label="自定义通道" prop="z">
|
||
<el-input v-model="aislesInput" placeholder="通道所在的列数,多个使用英文,分割,不能超出总列数" style="width: 100%" />
|
||
<span class="unit-hint">通道所在的列数,多个使用英文逗号分割</span>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<!-- 货架仓位总数 -->
|
||
<div class="rack-total-info">
|
||
<span>仓位总数:{{ calculateRackTotal() }}</span>
|
||
</div>
|
||
</el-card>
|
||
|
||
<!-- 显示颜色和启用状态 -->
|
||
<el-row :gutter="20">
|
||
<el-col :span="12">
|
||
<el-form-item label="是否启用" prop="is_active">
|
||
<el-switch v-model="formData.is_active" :active-value="1" :inactive-value="0" />
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
</el-form>
|
||
|
||
<template #footer>
|
||
<el-button @click="handleClose">取消</el-button>
|
||
<el-button type="primary" @click="handleSubmit" :loading="submitting">确定</el-button>
|
||
</template>
|
||
</el-dialog>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { ref, reactive, watch, computed } from 'vue'
|
||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||
|
||
const props = defineProps({
|
||
visible: { type: Boolean, required: true },
|
||
mode: { type: String, default: 'add' },
|
||
zoneData: { type: Object, default: null },
|
||
parentId: { type: [Number, String], default: null },
|
||
parentType: { type: String, default: null },
|
||
parentInfo: { type: Object, default: null },
|
||
warehouseId: { type: [Number, String], default: null }
|
||
})
|
||
|
||
const emit = defineEmits(['close', 'success'])
|
||
|
||
const zoneFormRef = ref<any>(null)
|
||
const internalVisible = ref(props.visible)
|
||
const aislesInput = ref('')
|
||
const submitting = ref(false)
|
||
|
||
type ZoneForm = {
|
||
zone_type: string
|
||
zone_code: string
|
||
zone_name: string
|
||
parent_id: string | number | null
|
||
warehouse_id: string | number | null
|
||
x: number
|
||
y: number
|
||
z: number
|
||
length: number
|
||
width: number
|
||
height: number
|
||
rack_columns: number | null
|
||
rack_rows: number | null
|
||
rack_levels: number | null
|
||
cell_length: number | null
|
||
cell_width: number | null
|
||
cell_height: number | null
|
||
direction: string | null
|
||
color: string
|
||
is_active: number
|
||
aisles: (string | number)[]
|
||
}
|
||
|
||
const formData = reactive<ZoneForm>(getDefaultFormData())
|
||
|
||
function getDefaultFormData(): ZoneForm {
|
||
return {
|
||
zone_type: 'area',
|
||
zone_code: '',
|
||
zone_name: '',
|
||
parent_id: null,
|
||
warehouse_id: null,
|
||
x: 0,
|
||
y: 0,
|
||
z: 0,
|
||
length: 500,
|
||
width: 500,
|
||
height: 300,
|
||
rack_columns: 5,
|
||
rack_rows: 5,
|
||
rack_levels: 2,
|
||
cell_length: 220,
|
||
cell_width: 100,
|
||
cell_height: 500,
|
||
direction: 'north',
|
||
color: '#3B82F6',
|
||
is_active: 1,
|
||
aisles: []
|
||
}
|
||
}
|
||
|
||
const allZoneTypes = [ { value: 'area', label: '库区' }, { value: 'rack', label: '货架' }, { value: 'pick_start', label: '拣货点' } ]
|
||
|
||
const predefineColors = [ '#3B82F6','#10B981','#F59E0B','#EF4444','#8B5CF6','#EC4899','#6B7280','#14B8A6','#F97316','#84CC16' ]
|
||
|
||
const formRules = reactive({
|
||
zone_type: [ { required: true, message: '请选择分区类型', trigger: 'change' } ],
|
||
zone_code: [ { required: true, message: '请输入分区编码', trigger: 'blur' }, { pattern: /^[A-Z0-9]{1,5}$/, message: '编码只能是1-5位字母或数字', trigger: 'blur' } ],
|
||
zone_name: [ { required: true, message: '请输入分区名称', trigger: 'blur' }, { max: 100, message: '名称最多100个字符', trigger: 'blur' } ],
|
||
length: [ { required: true, message: '请输入长度', trigger: 'blur' } ],
|
||
width: [ { required: true, message: '请输入宽度', trigger: 'blur' } ],
|
||
height: [ { required: true, message: '请输入高度', trigger: 'blur' } ],
|
||
rack_columns: [ { type: 'number', min:1, max:255, message: '列数范围1-255', trigger: 'blur' } ],
|
||
rack_rows: [ { type: 'number', min:1, max:10, message: '层数范围1-10', trigger: 'blur' } ],
|
||
rack_levels: [ { type: 'number', min:1, max:8, message: '分格数范围1-8', trigger: 'blur' } ],
|
||
cell_length: [ { required: true, message: '请输入单元格长度', trigger: 'blur' } ],
|
||
cell_width: [ { required: true, message: '请输入单元格宽度', trigger: 'blur' } ],
|
||
cell_height: [ { required: true, message: '请输入单元格高度', trigger: 'blur' } ]
|
||
})
|
||
|
||
const availableZoneTypes = computed(() => {
|
||
if (props.mode === 'edit') {
|
||
const currentType = formData.zone_type
|
||
const t = allZoneTypes.find(x => x.value === currentType)
|
||
return t ? [t] : []
|
||
}
|
||
if (props.mode === 'add' && props.parentType) {
|
||
if (props.parentType === 'warehouse') return allZoneTypes.filter(t => t.value === 'area')
|
||
if (props.parentType === 'area') return allZoneTypes.filter(t => t.value === 'rack' || t.value === 'pick_start')
|
||
return []
|
||
}
|
||
return allZoneTypes
|
||
})
|
||
|
||
const dialogTitle = computed(() => {
|
||
const map: any = { 'warehouse': '仓库','area':'库区','rack':'货架','pick_start':'拣货点' }
|
||
const typeName = map[formData.zone_type] || '分区'
|
||
return props.mode === 'add' ? `添加${typeName}` : `编辑${typeName}`
|
||
})
|
||
|
||
const showParentInfo = computed(() => {
|
||
if (props.mode === 'edit' && formData.zone_type !== 'warehouse') return true
|
||
if (props.mode === 'add' && props.parentInfo) return true
|
||
return false
|
||
})
|
||
|
||
const parentDisplayName = computed(() => {
|
||
if (props.mode === 'edit' && formData.zone_type !== 'warehouse') {
|
||
if (props.zoneData && (props.zoneData.parentInfo || props.zoneData.parentWarehouseName)) {
|
||
const p = props.zoneData.parentInfo || { code: '未知编码', name: '未知名称' }
|
||
return `${p.code || '未知编码'} - ${p.name || '未知名称'}`
|
||
}
|
||
return '未知父分区'
|
||
}
|
||
if (props.mode === 'add' && props.parentInfo) {
|
||
const map: any = { 'warehouse': '仓库','area':'库区','rack':'货架' }
|
||
const typeName = map[props.parentInfo.type] || props.parentInfo.type || '未知'
|
||
return `${props.parentInfo.code || '未知编码'} - ${props.parentInfo.name || '未知名称'} (${typeName})`
|
||
}
|
||
return ''
|
||
})
|
||
|
||
watch(() => props.visible, (newVal) => { internalVisible.value = newVal; if (newVal) initFormData(); else resetForm() }, { immediate: true })
|
||
watch(internalVisible, (val) => { if (!val && !submitting.value) emit('close') })
|
||
watch(() => props.zoneData, () => initFormData(), { deep: true })
|
||
watch(() => props.parentType, (nv) => { if (nv && props.mode === 'add') autoSetZoneType(nv) }, { immediate: true })
|
||
|
||
watch(() => formData.length, () => autoCalculateCellSize())
|
||
watch(() => formData.width, () => autoCalculateCellSize())
|
||
watch(() => formData.height, () => autoCalculateCellSize())
|
||
|
||
watch(aislesInput, (newVal) => {
|
||
if (!newVal) { formData.aisles = []; return }
|
||
formData.aisles = newVal.split(',').map(s => { const t = s.trim(); const n = parseInt(t,10); return isNaN(n)? t: n }).filter(x => x !== '')
|
||
})
|
||
|
||
function initFormData() {
|
||
if (props.mode === 'edit' && props.zoneData) {
|
||
const d = props.zoneData.data || {}
|
||
Object.assign(formData, {
|
||
zone_type: props.zoneData.type || props.zoneData.zone_type,
|
||
zone_code: props.zoneData.code || props.zoneData.zone_code,
|
||
zone_name: props.zoneData.name || props.zoneData.zone_name,
|
||
parent_id: props.zoneData.parentId || props.zoneData.parent_id,
|
||
warehouse_id: props.warehouseId,
|
||
x: props.zoneData.x || 0,
|
||
y: props.zoneData.y || 0,
|
||
z: props.zoneData.z || 0,
|
||
length: props.zoneData.length || getDefaultFormData().length,
|
||
width: props.zoneData.width || getDefaultFormData().width,
|
||
height: props.zoneData.height || getDefaultFormData().height,
|
||
rack_columns: props.zoneData.rackColumns || props.zoneData.rack_columns || 5,
|
||
rack_rows: props.zoneData.rackRows || props.zoneData.rack_rows || 5,
|
||
rack_levels: props.zoneData.rackLevels || props.zoneData.rack_levels || 2,
|
||
cell_length: props.zoneData.cellLength || props.zoneData.cell_length || 220,
|
||
cell_width: props.zoneData.cellWidth || props.zoneData.cell_width || 100,
|
||
cell_height: props.zoneData.cellHeight || props.zoneData.cell_height || 500,
|
||
direction: props.zoneData.direction || 'north',
|
||
color: props.zoneData.color || '#3B82F6',
|
||
is_active: props.zoneData.isActive !== undefined ? props.zoneData.isActive : 1,
|
||
aisles: props.zoneData.aisles || []
|
||
})
|
||
aislesInput.value = (formData.aisles || []).map((it:any)=>String(it)).join(',')
|
||
} else {
|
||
Object.assign(formData, getDefaultFormData())
|
||
formData.warehouse_id = props.warehouseId
|
||
formData.parent_id = props.parentId
|
||
generateZoneCode()
|
||
setDefaultSizeByType()
|
||
}
|
||
}
|
||
|
||
function autoSetZoneType(parentTypeVal:any) {
|
||
if (props.mode === 'add' && parentTypeVal) {
|
||
if (parentTypeVal === 'warehouse') formData.zone_type = 'area'
|
||
else if (parentTypeVal === 'area') formData.zone_type = 'rack'
|
||
else { ElMessage.warning('当前位置不能添加子分区'); handleClose() }
|
||
}
|
||
}
|
||
|
||
function handleTypeChange(value:any) {
|
||
if (!formData.zone_code) generateZoneCode()
|
||
if (value !== 'rack') { formData.rack_columns = null; formData.rack_rows = null; formData.rack_levels = null; formData.cell_length = null; formData.cell_width = null; formData.cell_height = null; formData.direction = null }
|
||
setDefaultSizeByType()
|
||
}
|
||
|
||
function getDefaultSizeByType(type:any) {
|
||
const defs:any = { warehouse:{ length:3000,width:2000,height:800 }, area:{ length:500,width:500,height:300 }, rack:{ length:200,width:100,height:200 }, pick_start:{ length:100,width:100,height:100 } }
|
||
return defs[type] || defs.area
|
||
}
|
||
|
||
function setDefaultSizeByType() { Object.assign(formData, getDefaultSizeByType(formData.zone_type)) }
|
||
|
||
function generateZoneCode() {
|
||
if (!formData.zone_code) {
|
||
const prefixMap:any = { warehouse:'WH', area:'A', rack:'R', pick_start:'PS' }
|
||
const prefix = prefixMap[formData.zone_type] || 'Z'
|
||
const timestamp = Date.now().toString().slice(-4)
|
||
const random = Math.floor(Math.random()*90+10)
|
||
formData.zone_code = `${prefix}${random}${timestamp.slice(0,2)}`
|
||
}
|
||
}
|
||
|
||
function autoCalculateCellSize() {
|
||
if (formData.zone_type === 'rack') {
|
||
const { length=200, width=100, height=200, rack_columns=5, rack_rows=5 } = formData as any
|
||
const suggestedLength = Math.floor((length - 20) / rack_columns)
|
||
const suggestedWidth = Math.floor((width - 20) / 1)
|
||
const suggestedHeight = Math.floor((height - 20) / rack_rows)
|
||
if (!formData.cell_length || formData.cell_length <= 0) formData.cell_length = suggestedLength > 10 ? suggestedLength : 50
|
||
if (!formData.cell_width || formData.cell_width <= 0) formData.cell_width = suggestedWidth > 10 ? suggestedWidth : 50
|
||
if (!formData.cell_height || formData.cell_height <= 0) formData.cell_height = suggestedHeight > 10 ? suggestedHeight : 50
|
||
}
|
||
}
|
||
|
||
function calculateArea() { const { length=0, width=0 } = formData as any; return ((length*width)/10000).toFixed(2) }
|
||
function calculateVolume() { const { length=0,width=0,height=0 } = formData as any; return ((length*width*height)/1000000).toFixed(2) }
|
||
function calculateRackTotal() { const { rack_columns=1,rack_rows=1,rack_levels=1 } = formData as any; return rack_columns * rack_rows * rack_levels }
|
||
|
||
function resetForm() { if (zoneFormRef.value && zoneFormRef.value.resetFields) zoneFormRef.value.resetFields(); Object.assign(formData, getDefaultFormData()); submitting.value = false }
|
||
|
||
function handleClose() { if (!submitting.value) emit('close') }
|
||
|
||
async function handleSubmit() {
|
||
try {
|
||
if (zoneFormRef.value && zoneFormRef.value.validate) await zoneFormRef.value.validate()
|
||
submitting.value = true
|
||
const submitData = { ...formData, warehouse_id: props.warehouseId }
|
||
if (!validateHierarchy()) { submitting.value = false; return }
|
||
if (!validateSize()) { submitting.value = false; return }
|
||
let response:any
|
||
if (props.mode === 'add') response = await warehouseApi.create(submitData)
|
||
else response = await warehouseApi.update(submitData, props.zoneData?.id)
|
||
if (response && (response.code == 200 || (response.data && response.data.success))) {
|
||
ElMessage.success(props.mode === 'add' ? '添加成功' : '更新成功')
|
||
emit('success')
|
||
handleClose()
|
||
} else {
|
||
throw new Error(response.message || '操作失败')
|
||
}
|
||
} catch (error:any) {
|
||
console.error('提交失败:', error)
|
||
ElMessage.error(error.message || '操作失败')
|
||
} finally { submitting.value = false }
|
||
}
|
||
|
||
function validateHierarchy() {
|
||
if (props.mode === 'add') {
|
||
if (props.parentType === 'warehouse' && formData.zone_type !== 'area') { ElMessage.error('仓库下只能添加库区'); return false }
|
||
if (props.parentType === 'area' && !['rack','pick_start'].includes(formData.zone_type)) { ElMessage.error('库区下只能添加货架或拣货点'); return false }
|
||
if (props.parentType === 'rack') { ElMessage.error('货架下不能添加子分区'); return false }
|
||
}
|
||
return true
|
||
}
|
||
|
||
function validateSize() {
|
||
const { length=0,width=0,height=0 } = formData as any
|
||
if (length <=0 || width<=0 || height<=0) { ElMessage.error('长度、宽度、高度必须大于0'); return false }
|
||
if (formData.zone_type === 'rack') {
|
||
const { cell_length=0, cell_width=0, cell_height=0, rack_columns=1, rack_rows=1 } = formData as any
|
||
if (cell_length<=0 || cell_width<=0 || cell_height<=0) { ElMessage.error('货架单元格尺寸必须大于0'); return false }
|
||
if (cell_length * rack_columns > length) ElMessage.warning('货架单元格总长度超过货架总长度')
|
||
if (cell_height * rack_rows > height) ElMessage.warning('货架单元格总高度超过货架总高度')
|
||
}
|
||
return true
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.size-card,
|
||
.coordinate-card,
|
||
.rack-card {
|
||
margin-bottom: 20px;
|
||
|
||
.el-card__header {
|
||
padding: 12px 20px;
|
||
background: #f8f9fa;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.unit-hint {
|
||
margin-left: 8px;
|
||
color: #909399;
|
||
font-size: 12px;
|
||
}
|
||
|
||
.calculation-info,
|
||
.rack-total-info {
|
||
margin-top: 16px;
|
||
padding: 8px 12px;
|
||
background: #f0f9ff;
|
||
border-radius: 4px;
|
||
color: #0369a1;
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.rack-grid-size {
|
||
margin-bottom: 20px;
|
||
padding-bottom: 20px;
|
||
border-bottom: 1px solid #ebeef5;
|
||
}
|
||
}
|
||
|
||
.dialog-footer { text-align: right; }
|
||
|
||
.el-form-item { margin-bottom: 20px; &:last-child { margin-bottom: 0; } }
|
||
|
||
.el-input-number, .el-input { width: 100%; }
|
||
|
||
.el-color-picker { vertical-align: middle; margin-right: 8px; }
|
||
|
||
.color-preview { display: inline-block; width: 20px; height: 20px; border-radius: 4px; border: 1px solid #dcdfe6; vertical-align: middle; margin-left: 8px; }
|
||
|
||
.el-tag { font-size: 14px; padding: 0 10px; height: 32px; line-height: 32px; }
|
||
</style> |