|
|
|
|
@ -46,19 +46,31 @@
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item :label="t('ErpStock.Pallet.specification')" prop="specification">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="formData.specification"
|
|
|
|
|
:placeholder="t('ErpStock.Pallet.placeholderSpecification')"
|
|
|
|
|
clearable
|
|
|
|
|
class="!w-1/1"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.STORAGE_PALLET_SPECIFICATIONS)"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
<div class="pallet-spec-input">
|
|
|
|
|
<el-input-number
|
|
|
|
|
v-model="specificationParts.length"
|
|
|
|
|
:min="0"
|
|
|
|
|
:precision="0"
|
|
|
|
|
:controls="false"
|
|
|
|
|
:placeholder="t('ErpStock.Pallet.placeholderLength')"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<span>x</span>
|
|
|
|
|
<el-input-number
|
|
|
|
|
v-model="specificationParts.width"
|
|
|
|
|
:min="0"
|
|
|
|
|
:precision="0"
|
|
|
|
|
:controls="false"
|
|
|
|
|
:placeholder="t('ErpStock.Pallet.placeholderWidth')"
|
|
|
|
|
/>
|
|
|
|
|
<span>x</span>
|
|
|
|
|
<el-input-number
|
|
|
|
|
v-model="specificationParts.height"
|
|
|
|
|
:min="0"
|
|
|
|
|
:precision="0"
|
|
|
|
|
:controls="false"
|
|
|
|
|
:placeholder="t('ErpStock.Pallet.placeholderHeight')"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
@ -95,37 +107,20 @@
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item :label="t('ErpStock.Pallet.warehouseId')" prop="warehouseId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="formData.warehouseId"
|
|
|
|
|
:placeholder="t('ErpStock.Pallet.placeholderWarehouseId')"
|
|
|
|
|
clearable
|
|
|
|
|
class="!w-1/1"
|
|
|
|
|
@change="handleWarehouseChange"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in warehouseList"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:label="item.name"
|
|
|
|
|
:value="item.id"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-input :model-value="selectedWarehouseText" readonly :placeholder="t('ErpStock.Pallet.placeholderWarehouseId')">
|
|
|
|
|
<template #append>
|
|
|
|
|
<el-button @click="openWarehouseDialog">{{ t('common.select') }}</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item :label="t('ErpStock.Pallet.areaId')" prop="areaId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="formData.areaId"
|
|
|
|
|
:placeholder="t('ErpStock.Pallet.placeholderAreaId')"
|
|
|
|
|
clearable
|
|
|
|
|
class="!w-1/1"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in filteredAreaList"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:label="item.areaName"
|
|
|
|
|
:value="item.id"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-input :model-value="selectedAreaText" readonly :placeholder="t('ErpStock.Pallet.placeholderAreaId')">
|
|
|
|
|
<template #append>
|
|
|
|
|
<el-button @click="openAreaDialog">{{ t('common.select') }}</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
@ -184,9 +179,19 @@
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-col v-if="formType === 'update'" :span="24">
|
|
|
|
|
<el-form-item :label="t('ErpStock.Pallet.qrcode')" prop="qrcode">
|
|
|
|
|
<el-input v-model="formData.qrcode" :placeholder="t('ErpStock.Pallet.placeholderQrcode')" />
|
|
|
|
|
<QrcodeActionCard
|
|
|
|
|
:image-url="formData.qrcode"
|
|
|
|
|
:print-id="formData.id"
|
|
|
|
|
:print-title="`${formData.code || t('ErpStock.Pallet.code')}二维码打印预览`"
|
|
|
|
|
:empty-text="t('ErpStock.Pallet.qrcodeEmpty')"
|
|
|
|
|
:refresh-url="getQrcodeRefreshUrl()"
|
|
|
|
|
:refresh-disabled="!formData.id || !formData.code"
|
|
|
|
|
:refresh-confirm-text="t('ErpStock.Pallet.qrcodeRefreshConfirm')"
|
|
|
|
|
:print-data="buildPrintData()"
|
|
|
|
|
@refresh-success="handleQrcodeRefreshSuccess"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
@ -205,14 +210,156 @@
|
|
|
|
|
<el-button @click="dialogVisible = false">{{ t('common.cancel') }}</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</Dialog>
|
|
|
|
|
|
|
|
|
|
<Dialog :title="t('ErpStock.Check.selectWarehouseDialogTitle')" v-model="warehouseDialogVisible" width="1000px">
|
|
|
|
|
<el-form :model="warehouseQueryParams" :inline="true" label-width="auto" class="-mb-15px">
|
|
|
|
|
<el-form-item :label="t('ErpStock.Warehouse.name')">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="warehouseQueryParams.name"
|
|
|
|
|
clearable
|
|
|
|
|
:placeholder="t('ErpStock.Warehouse.placeholderName')"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
@keyup.enter="handleWarehouseQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button @click="handleWarehouseQuery">
|
|
|
|
|
<Icon icon="ep:search" class="mr-5px" />{{ t('common.query') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button @click="resetWarehouseQuery">
|
|
|
|
|
<Icon icon="ep:refresh" class="mr-5px" />{{ t('common.reset') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<el-table
|
|
|
|
|
v-loading="warehouseLoading"
|
|
|
|
|
:data="warehouseTableList"
|
|
|
|
|
row-key="id"
|
|
|
|
|
highlight-current-row
|
|
|
|
|
@row-click="handleWarehouseRowClick"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column align="center" width="55">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-radio
|
|
|
|
|
:model-value="warehouseSelection?.id"
|
|
|
|
|
:value="scope.row.id"
|
|
|
|
|
@change="handleWarehouseRowClick(scope.row)"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="t('ErpStock.Warehouse.name')" align="center" prop="name" min-width="160" sortable />
|
|
|
|
|
<el-table-column :label="t('ErpStock.Warehouse.categoryType')" align="center" prop="categoryType" min-width="120">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE" :value="scope.row.categoryType" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="t('ErpStock.Warehouse.address')" align="center" prop="address" min-width="180" show-overflow-tooltip />
|
|
|
|
|
<el-table-column :label="t('ErpStock.Warehouse.principal')" align="center" prop="principal" min-width="110" />
|
|
|
|
|
<el-table-column :label="t('ErpStock.Warehouse.status')" align="center" prop="status" min-width="100" sortable>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="t('ErpStock.Warehouse.createTime')" align="center" prop="createTime" :formatter="dateFormatter" min-width="180" sortable />
|
|
|
|
|
</el-table>
|
|
|
|
|
<div class="pallet-dialog-pagination">
|
|
|
|
|
<Pagination
|
|
|
|
|
:total="warehouseTotal"
|
|
|
|
|
v-model:page="warehouseQueryParams.pageNo"
|
|
|
|
|
v-model:limit="warehouseQueryParams.pageSize"
|
|
|
|
|
@pagination="getWarehouseTableList"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<el-button type="primary" @click="confirmWarehouseSelection">{{ t('common.ok') }}</el-button>
|
|
|
|
|
<el-button @click="warehouseDialogVisible = false">{{ t('common.cancel') }}</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</Dialog>
|
|
|
|
|
|
|
|
|
|
<Dialog :title="t('ErpStock.Check.selectAreaDialogTitle')" v-model="areaDialogVisible" width="1000px">
|
|
|
|
|
<el-form :model="areaQueryParams" :inline="true" label-width="auto" class="-mb-15px">
|
|
|
|
|
<el-form-item :label="t('ErpStock.WarehouseArea.areaCode')">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="areaQueryParams.areaCode"
|
|
|
|
|
clearable
|
|
|
|
|
:placeholder="t('ErpStock.WarehouseArea.placeholderAreaCode')"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
@keyup.enter="handleAreaQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('ErpStock.WarehouseArea.areaName')">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="areaQueryParams.areaName"
|
|
|
|
|
clearable
|
|
|
|
|
:placeholder="t('ErpStock.WarehouseArea.placeholderAreaName')"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
@keyup.enter="handleAreaQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button @click="handleAreaQuery">
|
|
|
|
|
<Icon icon="ep:search" class="mr-5px" />{{ t('common.query') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button @click="resetAreaQuery">
|
|
|
|
|
<Icon icon="ep:refresh" class="mr-5px" />{{ t('common.reset') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<el-table
|
|
|
|
|
v-loading="areaLoading"
|
|
|
|
|
:data="areaTableList"
|
|
|
|
|
row-key="id"
|
|
|
|
|
highlight-current-row
|
|
|
|
|
@row-click="handleAreaRowClick"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column align="center" width="55">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-radio
|
|
|
|
|
:model-value="areaSelection?.id"
|
|
|
|
|
:value="scope.row.id"
|
|
|
|
|
@change="handleAreaRowClick(scope.row)"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.warehouseId')" align="center" prop="warehouseId" min-width="140" sortable>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{ getWarehouseName(scope.row.warehouseId) }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.areaCode')" align="center" prop="areaCode" min-width="130" sortable />
|
|
|
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.areaName')" align="center" prop="areaName" min-width="130" sortable />
|
|
|
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.areaSize')" align="center" prop="areaSize" min-width="100" />
|
|
|
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.description')" align="center" prop="description" min-width="160" show-overflow-tooltip />
|
|
|
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.status')" align="center" prop="status" min-width="100" sortable>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.createTime')" align="center" prop="createTime" :formatter="dateFormatter" min-width="180" sortable />
|
|
|
|
|
</el-table>
|
|
|
|
|
<div class="pallet-dialog-pagination">
|
|
|
|
|
<Pagination
|
|
|
|
|
:total="areaTotal"
|
|
|
|
|
v-model:page="areaQueryParams.pageNo"
|
|
|
|
|
v-model:limit="areaQueryParams.pageSize"
|
|
|
|
|
@pagination="getAreaTableList"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<el-button type="primary" @click="confirmAreaSelection">{{ t('common.ok') }}</el-button>
|
|
|
|
|
<el-button @click="areaDialogVisible = false">{{ t('common.cancel') }}</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</Dialog>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import { PalletApi, PalletVO } from '@/api/erp/stock/pallet'
|
|
|
|
|
import { WarehouseApi } from '@/api/erp/stock/warehouse'
|
|
|
|
|
import { WarehouseAreaApi } from '@/api/erp/stock/warehousearea'
|
|
|
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
|
|
|
import { WarehouseApi, WarehouseVO } from '@/api/erp/stock/warehouse'
|
|
|
|
|
import { WarehouseAreaApi, WarehouseAreaVO } from '@/api/erp/stock/warehousearea'
|
|
|
|
|
import { ProductApi, ProductVO } from '@/api/erp/product/product'
|
|
|
|
|
import QrcodeActionCard from '@/components/QrcodeActionCard/index.vue'
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'PalletForm' })
|
|
|
|
|
|
|
|
|
|
@ -224,9 +371,34 @@ const dialogTitle = ref('')
|
|
|
|
|
const formLoading = ref(false)
|
|
|
|
|
const formType = ref('')
|
|
|
|
|
const formRef = ref()
|
|
|
|
|
const warehouseList = ref<any[]>([])
|
|
|
|
|
const areaList = ref<any[]>([])
|
|
|
|
|
const warehouseOptions = ref<WarehouseVO[]>([])
|
|
|
|
|
const areaOptions = ref<WarehouseAreaVO[]>([])
|
|
|
|
|
const productList = ref<ProductVO[]>([])
|
|
|
|
|
const selectedWarehouse = ref<WarehouseVO | undefined>()
|
|
|
|
|
const selectedArea = ref<WarehouseAreaVO | undefined>()
|
|
|
|
|
|
|
|
|
|
const warehouseDialogVisible = ref(false)
|
|
|
|
|
const warehouseLoading = ref(false)
|
|
|
|
|
const warehouseTableList = ref<WarehouseVO[]>([])
|
|
|
|
|
const warehouseTotal = ref(0)
|
|
|
|
|
const warehouseSelection = ref<WarehouseVO | undefined>()
|
|
|
|
|
const warehouseQueryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
name: undefined as string | undefined
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const areaDialogVisible = ref(false)
|
|
|
|
|
const areaLoading = ref(false)
|
|
|
|
|
const areaTableList = ref<WarehouseAreaVO[]>([])
|
|
|
|
|
const areaTotal = ref(0)
|
|
|
|
|
const areaSelection = ref<WarehouseAreaVO | undefined>()
|
|
|
|
|
const areaQueryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
areaCode: undefined as string | undefined,
|
|
|
|
|
areaName: undefined as string | undefined
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const formData = ref<PalletVO>({
|
|
|
|
|
code: undefined,
|
|
|
|
|
@ -246,12 +418,15 @@ const formData = ref<PalletVO>({
|
|
|
|
|
useDate: undefined,
|
|
|
|
|
remark: undefined
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const filteredAreaList = computed(() => {
|
|
|
|
|
if (!formData.value.warehouseId) return areaList.value
|
|
|
|
|
return areaList.value.filter((item) => item.warehouseId === formData.value.warehouseId)
|
|
|
|
|
const specificationParts = reactive({
|
|
|
|
|
length: undefined as number | undefined,
|
|
|
|
|
width: undefined as number | undefined,
|
|
|
|
|
height: undefined as number | undefined
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const selectedWarehouseText = computed(() => selectedWarehouse.value?.name ?? '')
|
|
|
|
|
const selectedAreaText = computed(() => selectedArea.value?.areaName ?? '')
|
|
|
|
|
|
|
|
|
|
const validateCode = (_rule, value, callback) => {
|
|
|
|
|
if (Boolean(formData.value.isCode)) {
|
|
|
|
|
callback()
|
|
|
|
|
@ -275,12 +450,14 @@ const open = async (type: string, row?: PalletVO) => {
|
|
|
|
|
dialogTitle.value = t('action.' + type)
|
|
|
|
|
formType.value = type
|
|
|
|
|
resetForm()
|
|
|
|
|
await Promise.all([getWarehouseList(), getAreaList(), getProductList()])
|
|
|
|
|
await Promise.all([getWarehouseOptions(), getAreaOptions(), getProductList()])
|
|
|
|
|
if (type === 'update' && row) {
|
|
|
|
|
formData.value = {
|
|
|
|
|
...row,
|
|
|
|
|
isCode: false
|
|
|
|
|
}
|
|
|
|
|
parseSpecification(row.specification)
|
|
|
|
|
await hydrateSelectedWarehouseArea()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
defineExpose({ open })
|
|
|
|
|
@ -291,6 +468,8 @@ const submitForm = async () => {
|
|
|
|
|
formLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = { ...formData.value }
|
|
|
|
|
delete data.qrcode
|
|
|
|
|
data.specification = buildSpecification()
|
|
|
|
|
if (data.isCode) {
|
|
|
|
|
data.code = undefined
|
|
|
|
|
}
|
|
|
|
|
@ -308,21 +487,173 @@ const submitForm = async () => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getWarehouseList = async () => {
|
|
|
|
|
warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
|
|
|
|
|
const getWarehouseOptions = async () => {
|
|
|
|
|
warehouseOptions.value = await WarehouseApi.getWarehouseSimpleList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getAreaList = async () => {
|
|
|
|
|
const getAreaOptions = async () => {
|
|
|
|
|
const data = await WarehouseAreaApi.getWarehouseAreaPage({ pageNo: 1, pageSize: 100 })
|
|
|
|
|
areaList.value = data.list ?? []
|
|
|
|
|
areaOptions.value = data.list ?? []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getProductList = async () => {
|
|
|
|
|
productList.value = await ProductApi.getProductSimpleList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleWarehouseChange = () => {
|
|
|
|
|
const buildPrintData = () => {
|
|
|
|
|
return {
|
|
|
|
|
id: formData.value.id,
|
|
|
|
|
code: formData.value.code,
|
|
|
|
|
palletType: formData.value.palletType,
|
|
|
|
|
specification: buildSpecification() || formData.value.specification,
|
|
|
|
|
warehouseId: formData.value.warehouseId,
|
|
|
|
|
areaId: formData.value.areaId,
|
|
|
|
|
qrcodeUrl: formData.value.qrcode
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getQrcodeRefreshUrl = () => {
|
|
|
|
|
if (!formData.value.id || !formData.value.code) return ''
|
|
|
|
|
return `/erp/pallet/regenerate-code?id=${formData.value.id}&code=${encodeURIComponent(String(formData.value.code))}`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleQrcodeRefreshSuccess = (data: any) => {
|
|
|
|
|
const qrcode = data?.qrcode ?? data?.qrcodeUrl
|
|
|
|
|
if (qrcode) {
|
|
|
|
|
formData.value.qrcode = qrcode
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const parseSpecification = (value?: string) => {
|
|
|
|
|
const [length, width, height] = String(value || '')
|
|
|
|
|
.split(/[xX×*]/)
|
|
|
|
|
.map((item) => Number(item.trim()))
|
|
|
|
|
specificationParts.length = Number.isFinite(length) ? length : undefined
|
|
|
|
|
specificationParts.width = Number.isFinite(width) ? width : undefined
|
|
|
|
|
specificationParts.height = Number.isFinite(height) ? height : undefined
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const buildSpecification = () => {
|
|
|
|
|
const { length, width, height } = specificationParts
|
|
|
|
|
const isEmpty = (value?: number | null) => value === undefined || value === null
|
|
|
|
|
if (isEmpty(length) && isEmpty(width) && isEmpty(height)) {
|
|
|
|
|
return undefined
|
|
|
|
|
}
|
|
|
|
|
return `${length ?? ''}x${width ?? ''}x${height ?? ''}`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const hydrateSelectedWarehouseArea = async () => {
|
|
|
|
|
selectedWarehouse.value = warehouseOptions.value.find((item) => item.id === formData.value.warehouseId)
|
|
|
|
|
selectedArea.value = areaOptions.value.find((item) => item.id === formData.value.areaId)
|
|
|
|
|
if (!selectedArea.value && formData.value.warehouseId && formData.value.areaId) {
|
|
|
|
|
const data = await WarehouseAreaApi.getWarehouseAreaPage({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 100,
|
|
|
|
|
warehouseId: formData.value.warehouseId
|
|
|
|
|
})
|
|
|
|
|
const areas = data?.list ?? []
|
|
|
|
|
areaOptions.value = areas
|
|
|
|
|
selectedArea.value = areas.find((item) => item.id === formData.value.areaId)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getWarehouseName = (warehouseId?: number) => {
|
|
|
|
|
return warehouseOptions.value.find((item) => item.id === warehouseId)?.name ?? '-'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const clearAreaSelection = () => {
|
|
|
|
|
formData.value.areaId = undefined
|
|
|
|
|
selectedArea.value = undefined
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getWarehouseTableList = async () => {
|
|
|
|
|
warehouseLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await WarehouseApi.getWarehousePage(warehouseQueryParams)
|
|
|
|
|
warehouseTableList.value = data?.list ?? []
|
|
|
|
|
warehouseTotal.value = data?.total ?? 0
|
|
|
|
|
} finally {
|
|
|
|
|
warehouseLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const openWarehouseDialog = async () => {
|
|
|
|
|
warehouseDialogVisible.value = true
|
|
|
|
|
warehouseSelection.value = selectedWarehouse.value
|
|
|
|
|
await getWarehouseTableList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleWarehouseQuery = () => {
|
|
|
|
|
warehouseQueryParams.pageNo = 1
|
|
|
|
|
getWarehouseTableList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const resetWarehouseQuery = () => {
|
|
|
|
|
warehouseQueryParams.pageNo = 1
|
|
|
|
|
warehouseQueryParams.name = undefined
|
|
|
|
|
getWarehouseTableList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleWarehouseRowClick = (row: WarehouseVO) => {
|
|
|
|
|
warehouseSelection.value = row
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const confirmWarehouseSelection = () => {
|
|
|
|
|
if (!warehouseSelection.value) return
|
|
|
|
|
const oldWarehouseId = formData.value.warehouseId
|
|
|
|
|
selectedWarehouse.value = warehouseSelection.value
|
|
|
|
|
formData.value.warehouseId = warehouseSelection.value.id
|
|
|
|
|
if (oldWarehouseId !== formData.value.warehouseId) {
|
|
|
|
|
clearAreaSelection()
|
|
|
|
|
}
|
|
|
|
|
warehouseDialogVisible.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getAreaTableList = async () => {
|
|
|
|
|
areaLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await WarehouseAreaApi.getWarehouseAreaPage({
|
|
|
|
|
...areaQueryParams,
|
|
|
|
|
warehouseId: formData.value.warehouseId
|
|
|
|
|
})
|
|
|
|
|
areaTableList.value = data?.list ?? []
|
|
|
|
|
areaTotal.value = data?.total ?? 0
|
|
|
|
|
} finally {
|
|
|
|
|
areaLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const openAreaDialog = async () => {
|
|
|
|
|
if (!formData.value.warehouseId) {
|
|
|
|
|
message.warning(t('ErpStock.Check.validatorSelectWarehouseFirst'))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
areaDialogVisible.value = true
|
|
|
|
|
areaSelection.value = selectedArea.value
|
|
|
|
|
await getAreaTableList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleAreaQuery = () => {
|
|
|
|
|
areaQueryParams.pageNo = 1
|
|
|
|
|
getAreaTableList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const resetAreaQuery = () => {
|
|
|
|
|
areaQueryParams.pageNo = 1
|
|
|
|
|
areaQueryParams.areaCode = undefined
|
|
|
|
|
areaQueryParams.areaName = undefined
|
|
|
|
|
getAreaTableList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleAreaRowClick = (row: WarehouseAreaVO) => {
|
|
|
|
|
areaSelection.value = row
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const confirmAreaSelection = () => {
|
|
|
|
|
if (!areaSelection.value) return
|
|
|
|
|
selectedArea.value = areaSelection.value
|
|
|
|
|
formData.value.areaId = areaSelection.value.id
|
|
|
|
|
areaDialogVisible.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleCodeAutoChange = (value: boolean) => {
|
|
|
|
|
@ -351,6 +682,35 @@ const resetForm = () => {
|
|
|
|
|
useDate: undefined,
|
|
|
|
|
remark: undefined
|
|
|
|
|
}
|
|
|
|
|
specificationParts.length = undefined
|
|
|
|
|
specificationParts.width = undefined
|
|
|
|
|
specificationParts.height = undefined
|
|
|
|
|
selectedWarehouse.value = undefined
|
|
|
|
|
selectedArea.value = undefined
|
|
|
|
|
formRef.value?.resetFields()
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.pallet-dialog-pagination {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
padding: 16px 0 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pallet-spec-input {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
|
|
:deep(.el-input-number) {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
color: var(--el-text-color-secondary);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|