feat:盘点执行/托盘管理模块
parent
047081f55b
commit
a536ee7603
@ -0,0 +1,40 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export interface PalletVO {
|
||||||
|
id?: number
|
||||||
|
code?: string
|
||||||
|
isCode?: boolean
|
||||||
|
palletType?: number | string
|
||||||
|
specification?: string
|
||||||
|
ratedLoadWeight?: number | string
|
||||||
|
unit?: string
|
||||||
|
status?: number | string
|
||||||
|
warehouseId?: number | string
|
||||||
|
areaId?: number | string
|
||||||
|
planCode?: string
|
||||||
|
productId?: number | string
|
||||||
|
productCount?: number | string
|
||||||
|
qrcode?: string
|
||||||
|
purchaseDate?: string
|
||||||
|
useDate?: string
|
||||||
|
remark?: string
|
||||||
|
createTime?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PalletApi = {
|
||||||
|
getPalletPage: async (params: any) => {
|
||||||
|
return await request.get({ url: `/erp/pallet/page`, params })
|
||||||
|
},
|
||||||
|
|
||||||
|
createPallet: async (params: PalletVO) => {
|
||||||
|
return await request.post({ url: `/erp/pallet/create`, params })
|
||||||
|
},
|
||||||
|
|
||||||
|
updatePallet: async (params: PalletVO) => {
|
||||||
|
return await request.put({ url: `/erp/pallet/update`, params })
|
||||||
|
},
|
||||||
|
|
||||||
|
deletePallet: async (id: number) => {
|
||||||
|
return await request.delete({ url: `/erp/pallet/delete?id=` + id })
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,356 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="900px">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="120px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.code')" prop="code">
|
||||||
|
<el-row :gutter="10" class="!w-full">
|
||||||
|
<el-col :span="18">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.code"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderCode')"
|
||||||
|
:disabled="Boolean(formData.isCode) || formType === 'update'"
|
||||||
|
/>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-switch
|
||||||
|
v-model="formData.isCode"
|
||||||
|
:disabled="formType === 'update'"
|
||||||
|
@change="handleCodeAutoChange"
|
||||||
|
/>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.palletType')" prop="palletType">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.palletType"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderPalletType')"
|
||||||
|
class="!w-1/1"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.STORAGE_PALLET_TYPES)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</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"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.ratedLoadWeight')" prop="ratedLoadWeight">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.ratedLoadWeight"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderRatedLoadWeight')"
|
||||||
|
:min="0"
|
||||||
|
:precision="2"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.unit')" prop="unit">
|
||||||
|
<el-input v-model="formData.unit" :placeholder="t('ErpStock.Pallet.placeholderUnit')" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.status')" prop="status">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.status"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderStatus')"
|
||||||
|
class="!w-1/1"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.STORAGE_PALLET_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</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-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-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.planCode')" prop="planCode">
|
||||||
|
<el-input v-model="formData.planCode" :placeholder="t('ErpStock.Pallet.placeholderPlanCode')" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.productId')" prop="productId">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.productId"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderProductId')"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
class="!w-1/1"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in productList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.productCount')" prop="productCount">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.productCount"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderProductCount')"
|
||||||
|
:min="0"
|
||||||
|
:precision="0"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.purchaseDate')" prop="purchaseDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="formData.purchaseDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderPurchaseDate')"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.useDate')" prop="useDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="formData.useDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderUseDate')"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.qrcode')" prop="qrcode">
|
||||||
|
<el-input v-model="formData.qrcode" :placeholder="t('ErpStock.Pallet.placeholderQrcode')" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.remark')" prop="remark">
|
||||||
|
<el-input
|
||||||
|
type="textarea"
|
||||||
|
v-model="formData.remark"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderRemark')"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">{{ t('common.ok') }}</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">{{ t('common.cancel') }}</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { getIntDictOptions, getStrDictOptions, 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 { ProductApi, ProductVO } from '@/api/erp/product/product'
|
||||||
|
|
||||||
|
defineOptions({ name: 'PalletForm' })
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const message = useMessage()
|
||||||
|
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const dialogTitle = ref('')
|
||||||
|
const formLoading = ref(false)
|
||||||
|
const formType = ref('')
|
||||||
|
const formRef = ref()
|
||||||
|
const warehouseList = ref<any[]>([])
|
||||||
|
const areaList = ref<any[]>([])
|
||||||
|
const productList = ref<ProductVO[]>([])
|
||||||
|
|
||||||
|
const formData = ref<PalletVO>({
|
||||||
|
code: undefined,
|
||||||
|
isCode: true,
|
||||||
|
palletType: undefined,
|
||||||
|
specification: undefined,
|
||||||
|
ratedLoadWeight: undefined,
|
||||||
|
unit: 'kg',
|
||||||
|
status: undefined,
|
||||||
|
warehouseId: undefined,
|
||||||
|
areaId: undefined,
|
||||||
|
planCode: undefined,
|
||||||
|
productId: undefined,
|
||||||
|
productCount: undefined,
|
||||||
|
qrcode: undefined,
|
||||||
|
purchaseDate: undefined,
|
||||||
|
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 validateCode = (_rule, value, callback) => {
|
||||||
|
if (Boolean(formData.value.isCode)) {
|
||||||
|
callback()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (value === undefined || value === null || String(value).trim() === '') {
|
||||||
|
callback(new Error(t('ErpStock.Pallet.validatorCodeRequired')))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
|
||||||
|
const formRules = reactive({
|
||||||
|
code: [{ validator: validateCode, trigger: ['blur', 'change'] }],
|
||||||
|
palletType: [{ required: true, message: t('ErpStock.Pallet.validatorPalletTypeRequired'), trigger: 'change' }],
|
||||||
|
status: [{ required: true, message: t('ErpStock.Pallet.validatorStatusRequired'), trigger: 'change' }]
|
||||||
|
})
|
||||||
|
|
||||||
|
const open = async (type: string, row?: PalletVO) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
await Promise.all([getWarehouseList(), getAreaList(), getProductList()])
|
||||||
|
if (type === 'update' && row) {
|
||||||
|
formData.value = {
|
||||||
|
...row,
|
||||||
|
isCode: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
const emit = defineEmits(['success'])
|
||||||
|
const submitForm = async () => {
|
||||||
|
await formRef.value.validate()
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = { ...formData.value }
|
||||||
|
if (data.isCode) {
|
||||||
|
data.code = undefined
|
||||||
|
}
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await PalletApi.createPallet(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await PalletApi.updatePallet(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getWarehouseList = async () => {
|
||||||
|
warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
|
||||||
|
}
|
||||||
|
|
||||||
|
const getAreaList = async () => {
|
||||||
|
const data = await WarehouseAreaApi.getWarehouseAreaPage({ pageNo: 1, pageSize: 100 })
|
||||||
|
areaList.value = data.list ?? []
|
||||||
|
}
|
||||||
|
|
||||||
|
const getProductList = async () => {
|
||||||
|
productList.value = await ProductApi.getProductSimpleList()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleWarehouseChange = () => {
|
||||||
|
formData.value.areaId = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCodeAutoChange = (value: boolean) => {
|
||||||
|
if (value) {
|
||||||
|
formData.value.code = undefined
|
||||||
|
}
|
||||||
|
formRef.value?.clearValidate('code')
|
||||||
|
}
|
||||||
|
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
code: undefined,
|
||||||
|
isCode: true,
|
||||||
|
palletType: undefined,
|
||||||
|
specification: undefined,
|
||||||
|
ratedLoadWeight: undefined,
|
||||||
|
unit: 'kg',
|
||||||
|
status: undefined,
|
||||||
|
warehouseId: undefined,
|
||||||
|
areaId: undefined,
|
||||||
|
planCode: undefined,
|
||||||
|
productId: undefined,
|
||||||
|
productCount: undefined,
|
||||||
|
qrcode: undefined,
|
||||||
|
purchaseDate: undefined,
|
||||||
|
useDate: undefined,
|
||||||
|
remark: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -0,0 +1,311 @@
|
|||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="auto"
|
||||||
|
>
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.code')" prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.code"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderCode')"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.palletType')" prop="palletType">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.palletType"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderPalletType')"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.STORAGE_PALLET_TYPES)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.status')" prop="status">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.status"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderStatus')"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.STORAGE_PALLET_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.warehouseId')" prop="warehouseId" v-show="showAllFilters">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.warehouseId"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderWarehouseId')"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
@change="handleWarehouseChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in warehouseList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.areaId')" prop="areaId" v-show="showAllFilters">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.areaId"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderAreaId')"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in filteredAreaList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.areaName"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('ErpStock.Pallet.planCode')" prop="planCode" v-show="showAllFilters">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.planCode"
|
||||||
|
:placeholder="t('ErpStock.Pallet.placeholderPlanCode')"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="filterCount > 3">
|
||||||
|
<el-button type="text" class="text-primary" @click="toggleFilters">
|
||||||
|
<Icon :icon="showAllFilters ? 'ep:arrow-up' : 'ep:arrow-down'" class="mr-5px" />
|
||||||
|
{{ showAllFilters ? t('FactoryModeling.FactoryStructure.collapseText') :
|
||||||
|
t('FactoryModeling.FactoryStructure.expandText') }}
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> {{ t('common.query') }}</el-button>
|
||||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> {{ t('common.reset') }}</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
@click="openForm('create')"
|
||||||
|
v-hasPermi="['erp:pallet:create']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:plus" class="mr-5px" /> {{ t('action.add') }}
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<ContentWrap>
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="list"
|
||||||
|
:stripe="true"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
row-key="id"
|
||||||
|
>
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.code')" align="center" prop="code" min-width="150" sortable />
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.palletType')" align="center" prop="palletType" min-width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.STORAGE_PALLET_TYPES" :value="scope.row.palletType" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.specification')" align="center" prop="specification" min-width="140">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.STORAGE_PALLET_SPECIFICATIONS" :value="scope.row.specification" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.ratedLoadWeight')" align="center" min-width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatWeight(scope.row) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.status')" align="center" prop="status" min-width="100" sortable>
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.STORAGE_PALLET_STATUS" :value="scope.row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.warehouseId')" align="center" prop="warehouseId" min-width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ getWarehouseName(scope.row.warehouseId) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.areaId')" align="center" prop="areaId" min-width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ getAreaName(scope.row.areaId) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.planCode')" align="center" prop="planCode" min-width="160" />
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.productId')" align="center" prop="productId" min-width="100" />
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.productCount')" align="center" prop="productCount" min-width="100" />
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.qrcode')" align="center" prop="qrcode" min-width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-link v-if="scope.row.qrcode" :href="scope.row.qrcode" target="_blank" type="primary">
|
||||||
|
{{ t('ErpStock.Pallet.viewQrcode') }}
|
||||||
|
</el-link>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.purchaseDate')" align="center" prop="purchaseDate" min-width="120" />
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.useDate')" align="center" prop="useDate" min-width="120" />
|
||||||
|
<el-table-column :label="t('ErpStock.Pallet.remark')" align="center" prop="remark" min-width="160" />
|
||||||
|
<el-table-column
|
||||||
|
:label="t('ErpStock.Pallet.createTime')"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
width="180px"
|
||||||
|
sortable
|
||||||
|
/>
|
||||||
|
<el-table-column :label="t('common.operate')" align="center" width="150px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row)"
|
||||||
|
v-hasPermi="['erp:pallet:update']"
|
||||||
|
>
|
||||||
|
{{ t('action.edit') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['erp:pallet:delete']"
|
||||||
|
>
|
||||||
|
{{ t('action.del') }}
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<PalletForm ref="formRef" @success="getList" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
import { PalletApi, PalletVO } from '@/api/erp/stock/pallet'
|
||||||
|
import { WarehouseApi } from '@/api/erp/stock/warehouse'
|
||||||
|
import { WarehouseAreaApi } from '@/api/erp/stock/warehousearea'
|
||||||
|
import PalletForm from './PalletForm.vue'
|
||||||
|
|
||||||
|
defineOptions({ name: 'ErpPallet' })
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const message = useMessage()
|
||||||
|
|
||||||
|
const loading = ref(true)
|
||||||
|
const list = ref<PalletVO[]>([])
|
||||||
|
const total = ref(0)
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
code: undefined,
|
||||||
|
palletType: undefined,
|
||||||
|
status: undefined,
|
||||||
|
warehouseId: undefined,
|
||||||
|
areaId: undefined,
|
||||||
|
planCode: undefined
|
||||||
|
})
|
||||||
|
const queryFormRef = ref()
|
||||||
|
const showAllFilters = ref(false)
|
||||||
|
const filterCount = 6
|
||||||
|
const warehouseList = ref<any[]>([])
|
||||||
|
const areaList = ref<any[]>([])
|
||||||
|
|
||||||
|
const filteredAreaList = computed(() => {
|
||||||
|
if (!queryParams.warehouseId) return areaList.value
|
||||||
|
return areaList.value.filter((item) => item.warehouseId === queryParams.warehouseId)
|
||||||
|
})
|
||||||
|
|
||||||
|
const toggleFilters = () => {
|
||||||
|
showAllFilters.value = !showAllFilters.value
|
||||||
|
}
|
||||||
|
|
||||||
|
const getWarehouseName = (warehouseId: number) => {
|
||||||
|
return warehouseList.value.find((item) => item.id === warehouseId)?.name ?? '-'
|
||||||
|
}
|
||||||
|
|
||||||
|
const getAreaName = (areaId: number) => {
|
||||||
|
return areaList.value.find((item) => item.id === areaId)?.areaName ?? '-'
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatWeight = (row: PalletVO) => {
|
||||||
|
if (row.ratedLoadWeight == null) return '-'
|
||||||
|
return row.unit ? `${row.ratedLoadWeight}${row.unit}` : row.ratedLoadWeight
|
||||||
|
}
|
||||||
|
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await PalletApi.getPalletPage(queryParams)
|
||||||
|
list.value = data.list ?? []
|
||||||
|
total.value = data.total ?? 0
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getWarehouseList = async () => {
|
||||||
|
warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
|
||||||
|
}
|
||||||
|
|
||||||
|
const getAreaList = async () => {
|
||||||
|
const data = await WarehouseAreaApi.getWarehouseAreaPage({ pageNo: 1, pageSize: 100 })
|
||||||
|
areaList.value = data.list ?? []
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleWarehouseChange = () => {
|
||||||
|
queryParams.areaId = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
const formRef = ref()
|
||||||
|
const openForm = (type: string, row?: PalletVO) => {
|
||||||
|
formRef.value.open(type, row)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
await message.delConfirm()
|
||||||
|
await PalletApi.deletePallet(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getWarehouseList()
|
||||||
|
getAreaList()
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue