|
|
|
|
@ -118,10 +118,17 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column v-if="isPurchaseUnitStockIn" :label="t('ErpStock.Item.defaultSupplier')" min-width="130">
|
|
|
|
|
<el-table-column v-if="isPurchaseUnitStockIn" :label="t('ErpStock.Item.supplier')" min-width="150">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-form-item class="mb-0px!">
|
|
|
|
|
<el-input readonly v-model="row.supplierName" />
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="row.supplierName"
|
|
|
|
|
readonly
|
|
|
|
|
:clearable="!disabled"
|
|
|
|
|
:placeholder="t('ErpStock.Item.placeholderSupplier')"
|
|
|
|
|
@click="openSupplierSelectDialog(row)"
|
|
|
|
|
@clear="clearSupplier(row)"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
@ -228,9 +235,9 @@
|
|
|
|
|
<el-table-column :label="t('ErpStock.Item.category')" prop="subCategoryName" min-width="120" />
|
|
|
|
|
<el-table-column :label="t('ErpStock.Item.unit')" prop="unitName" min-width="80" />
|
|
|
|
|
<el-table-column v-if="isPurchaseUnitStockIn" :label="t('ErpStock.Item.purchaseUnit')" prop="purchaseUnitName" min-width="100" />
|
|
|
|
|
<el-table-column v-if="isPurchaseUnitStockIn" :label="t('ErpStock.Item.defaultSupplier')" min-width="130">
|
|
|
|
|
<el-table-column v-if="isPurchaseUnitStockIn" :label="t('ErpStock.Item.supplier')" min-width="130">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
{{ getDefaultSupplierName(row) || '-' }}
|
|
|
|
|
{{ getDefaultSupplier(row)?.name || '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column v-if="isPurchaseUnitStockIn" :label="t('ErpStock.Item.purchaseUnitConvertQuantity')" prop="purchaseUnitConvertQuantity" min-width="120" />
|
|
|
|
|
@ -245,6 +252,63 @@
|
|
|
|
|
</template>
|
|
|
|
|
</Dialog>
|
|
|
|
|
|
|
|
|
|
<Dialog :title="t('FactoryModeling.ProductInformation.dialogSupplierTitle')" v-model="supplierDialogVisible" width="900px">
|
|
|
|
|
<el-form ref="supplierSearchFormRef" :model="supplierQueryParams" :inline="true" class="-mb-15px">
|
|
|
|
|
<el-form-item :label="t('ErpPurchase.Supplier.name')" prop="name">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="supplierQueryParams.name"
|
|
|
|
|
clearable
|
|
|
|
|
:placeholder="t('ErpPurchase.Supplier.placeholderName')"
|
|
|
|
|
@keyup.enter="handleSupplierDialogQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('ErpPurchase.Supplier.mobile')" prop="mobile">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="supplierQueryParams.mobile"
|
|
|
|
|
clearable
|
|
|
|
|
:placeholder="t('ErpPurchase.Supplier.placeholderMobile')"
|
|
|
|
|
@keyup.enter="handleSupplierDialogQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" @click="handleSupplierDialogQuery">
|
|
|
|
|
<Icon icon="ep:search" class="mr-5px" /> {{ t('common.query') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button @click="resetSupplierDialogQuery">{{ t('common.reset') }}</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<el-table
|
|
|
|
|
v-loading="supplierDialogLoading"
|
|
|
|
|
:data="supplierDialogList"
|
|
|
|
|
row-key="id"
|
|
|
|
|
:stripe="true"
|
|
|
|
|
:show-overflow-tooltip="true"
|
|
|
|
|
@row-click="handleSupplierDialogRowClick"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column width="55" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-radio v-model="selectedSupplierId" :label="row.id"> </el-radio>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="t('ErpPurchase.Supplier.name')" prop="name" min-width="160" />
|
|
|
|
|
<el-table-column :label="t('ErpPurchase.Supplier.contact')" prop="contact" min-width="100" />
|
|
|
|
|
<el-table-column :label="t('ErpPurchase.Supplier.mobile')" prop="mobile" min-width="120" />
|
|
|
|
|
<el-table-column :label="t('ErpPurchase.Supplier.telephone')" prop="telephone" min-width="120" />
|
|
|
|
|
</el-table>
|
|
|
|
|
<div class="product-dialog-pagination">
|
|
|
|
|
<Pagination
|
|
|
|
|
:total="supplierDialogTotal"
|
|
|
|
|
v-model:page="supplierQueryParams.pageNo"
|
|
|
|
|
v-model:limit="supplierQueryParams.pageSize"
|
|
|
|
|
@pagination="getSupplierDialogList"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<el-button type="primary" :disabled="!selectedSupplierId" @click="confirmSupplierSelect">{{ t('common.ok') }}</el-button>
|
|
|
|
|
<el-button @click="supplierDialogVisible = false">{{ t('common.cancel') }}</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</Dialog>
|
|
|
|
|
|
|
|
|
|
<Dialog :title="t('ErpStock.Item.selectTaskOrder')" v-model="taskDialogVisible" width="1100px">
|
|
|
|
|
<div class="task-select-dialog">
|
|
|
|
|
<div class="task-select-dialog__section-title">{{ t('ErpStock.Item.selectTaskOrder') }}</div>
|
|
|
|
|
@ -501,6 +565,7 @@ import { WarehouseAreaApi, WarehouseAreaVO } from '@/api/erp/stock/warehousearea
|
|
|
|
|
import { StockApi } from '@/api/erp/stock/stock'
|
|
|
|
|
import { TaskApi, TaskVO } from '@/api/mes/task'
|
|
|
|
|
import { PalletApi, PalletVO } from '@/api/erp/stock/pallet'
|
|
|
|
|
import { SupplierApi } from '@/api/erp/purchase/supplier'
|
|
|
|
|
import PalletForm from '../../pallet/PalletForm.vue'
|
|
|
|
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
|
|
|
|
import { dateFormatter2 } from '@/utils/formatTime'
|
|
|
|
|
@ -557,6 +622,18 @@ const productQueryParams = reactive({
|
|
|
|
|
})
|
|
|
|
|
const currentSelectRow = ref<any>()
|
|
|
|
|
const selectedProductId = ref<number>()
|
|
|
|
|
const supplierDialogVisible = ref(false)
|
|
|
|
|
const supplierDialogLoading = ref(false)
|
|
|
|
|
const supplierDialogList = ref<any[]>([])
|
|
|
|
|
const supplierDialogTotal = ref(0)
|
|
|
|
|
const supplierSearchFormRef = ref()
|
|
|
|
|
const selectedSupplierId = ref<number>()
|
|
|
|
|
const supplierQueryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
name: undefined,
|
|
|
|
|
mobile: undefined
|
|
|
|
|
})
|
|
|
|
|
const taskDialogVisible = ref(false)
|
|
|
|
|
const taskDialogLoading = ref(false)
|
|
|
|
|
const taskSchemeLoading = ref(false)
|
|
|
|
|
@ -709,6 +786,7 @@ const handleAdd = () => {
|
|
|
|
|
productPrice: undefined,
|
|
|
|
|
purchaseUnitId: undefined,
|
|
|
|
|
purchaseUnitName: undefined,
|
|
|
|
|
supplierId: undefined,
|
|
|
|
|
supplierName: undefined,
|
|
|
|
|
purchaseUnitConvertQuantity: undefined,
|
|
|
|
|
relateTask: false,
|
|
|
|
|
@ -807,7 +885,9 @@ const fillRowByProduct = (row: any, product: any) => {
|
|
|
|
|
row.productName = product.name
|
|
|
|
|
row.purchaseUnitId = product.purchaseUnitId
|
|
|
|
|
row.purchaseUnitName = product.purchaseUnitName
|
|
|
|
|
row.supplierName = getDefaultSupplierName(product)
|
|
|
|
|
const supplier = getDefaultSupplier(product)
|
|
|
|
|
row.supplierId = supplier?.id
|
|
|
|
|
row.supplierName = supplier?.name
|
|
|
|
|
row.purchaseUnitConvertQuantity = product.purchaseUnitConvertQuantity
|
|
|
|
|
fillPackagingSchemeByProduct(row, product)
|
|
|
|
|
normalizePackageCount(row)
|
|
|
|
|
@ -829,11 +909,21 @@ const fillPackagingSchemeByProduct = (row: any, product: any) => {
|
|
|
|
|
row.palletTotalQuantity = scheme?.palletTotalQuantity
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getDefaultSupplierName = (product: any) => {
|
|
|
|
|
const getDefaultSupplier = (product: any) => {
|
|
|
|
|
if (!product) return undefined
|
|
|
|
|
if (product.supplierName) return product.supplierName
|
|
|
|
|
if (product.supplierId || product.supplierName) {
|
|
|
|
|
return {
|
|
|
|
|
id: product.supplierId,
|
|
|
|
|
name: product.supplierName
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const suppliers = Array.isArray(product.suppliers) ? product.suppliers : []
|
|
|
|
|
return suppliers.find((item) => Number(item?.defaultStatus) === 1)?.supplierName
|
|
|
|
|
const supplier = suppliers.find((item) => Number(item?.defaultStatus) === 1) || suppliers[0]
|
|
|
|
|
if (!supplier) return undefined
|
|
|
|
|
return {
|
|
|
|
|
id: supplier.supplierId ?? supplier.id,
|
|
|
|
|
name: supplier.supplierName ?? supplier.name
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const clearProduct = (row: any) => {
|
|
|
|
|
@ -845,6 +935,7 @@ const clearProduct = (row: any) => {
|
|
|
|
|
row.productName = undefined
|
|
|
|
|
row.purchaseUnitId = undefined
|
|
|
|
|
row.purchaseUnitName = undefined
|
|
|
|
|
row.supplierId = undefined
|
|
|
|
|
row.supplierName = undefined
|
|
|
|
|
row.purchaseUnitConvertQuantity = undefined
|
|
|
|
|
row.packagingSchemeRelationId = undefined
|
|
|
|
|
@ -916,6 +1007,60 @@ const confirmProductSelect = async () => {
|
|
|
|
|
productDialogVisible.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const openSupplierSelectDialog = async (row: any) => {
|
|
|
|
|
if (props.disabled) return
|
|
|
|
|
currentSelectRow.value = row
|
|
|
|
|
selectedSupplierId.value = row.supplierId
|
|
|
|
|
supplierQueryParams.pageNo = 1
|
|
|
|
|
supplierQueryParams.name = undefined
|
|
|
|
|
supplierQueryParams.mobile = undefined
|
|
|
|
|
supplierDialogVisible.value = true
|
|
|
|
|
await getSupplierDialogList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getSupplierDialogList = async () => {
|
|
|
|
|
supplierDialogLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await SupplierApi.getSupplierPage({
|
|
|
|
|
...supplierQueryParams,
|
|
|
|
|
status: 0
|
|
|
|
|
})
|
|
|
|
|
supplierDialogList.value = data?.list || []
|
|
|
|
|
supplierDialogTotal.value = data?.total || 0
|
|
|
|
|
} finally {
|
|
|
|
|
supplierDialogLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleSupplierDialogQuery = () => {
|
|
|
|
|
supplierQueryParams.pageNo = 1
|
|
|
|
|
getSupplierDialogList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const resetSupplierDialogQuery = () => {
|
|
|
|
|
supplierSearchFormRef.value?.resetFields()
|
|
|
|
|
handleSupplierDialogQuery()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleSupplierDialogRowClick = (row: any) => {
|
|
|
|
|
selectedSupplierId.value = row.id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const confirmSupplierSelect = () => {
|
|
|
|
|
if (props.disabled) return
|
|
|
|
|
const supplier = supplierDialogList.value.find((item) => item.id === selectedSupplierId.value)
|
|
|
|
|
if (!supplier || !currentSelectRow.value) return
|
|
|
|
|
currentSelectRow.value.supplierId = supplier.id
|
|
|
|
|
currentSelectRow.value.supplierName = supplier.name
|
|
|
|
|
supplierDialogVisible.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const clearSupplier = (row: any) => {
|
|
|
|
|
if (props.disabled) return
|
|
|
|
|
row.supplierId = undefined
|
|
|
|
|
row.supplierName = undefined
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const openTaskSelectDialog = async (row: any) => {
|
|
|
|
|
currentSelectRow.value = row
|
|
|
|
|
selectedTaskId.value = row.taskId
|
|
|
|
|
@ -1208,7 +1353,7 @@ const getInitialSelectedPalletRows = (row: any) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getPalletPackageCount = (row: any, pallet: PalletVO) => {
|
|
|
|
|
return pallet.productCount ?? row?.palletPackageQuantity ?? row?.packageQuantity ?? row?.count
|
|
|
|
|
return row?.palletPackageQuantity ?? pallet.productCount ?? row?.packageQuantity ?? row?.count
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getSelectedPalletItemCountValue = (pallet: any) => {
|
|
|
|
|
@ -1336,7 +1481,9 @@ const fillProductNames = (rows: any[]) => {
|
|
|
|
|
row.productPrice = row.productPrice ?? product.minPrice
|
|
|
|
|
row.purchaseUnitId = row.purchaseUnitId ?? (product as any).purchaseUnitId
|
|
|
|
|
row.purchaseUnitName = row.purchaseUnitName ?? (product as any).purchaseUnitName
|
|
|
|
|
row.supplierName = row.supplierName ?? getDefaultSupplierName(product)
|
|
|
|
|
const supplier = getDefaultSupplier(product)
|
|
|
|
|
row.supplierId = row.supplierId ?? supplier?.id
|
|
|
|
|
row.supplierName = row.supplierName ?? supplier?.name
|
|
|
|
|
row.purchaseUnitConvertQuantity = row.purchaseUnitConvertQuantity ?? (product as any).purchaseUnitConvertQuantity
|
|
|
|
|
normalizePackageCount(row)
|
|
|
|
|
syncCountByPackageCount(row)
|
|
|
|
|
|