Compare commits

..

3 Commits

@ -99,7 +99,11 @@
<dict-tag :options="wms_in_stock_type" :value="scope.row.inStockType" /> <dict-tag :options="wms_in_stock_type" :value="scope.row.inStockType" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="项目ID" align="center" prop="projectId" v-if="columns[4].visible" /> <el-table-column label="所属项目" align="center" prop="projectId" v-if="columns[4].visible">
<template #default="scope">
{{ getProjectName(scope.row.projectId) }}
</template>
</el-table-column>
<el-table-column label="关联单号" align="center" prop="inventoryAmount" v-if="columns[5].visible" /> <el-table-column label="关联单号" align="center" prop="inventoryAmount" v-if="columns[5].visible" />
<el-table-column label="供应商" align="center" prop="supplierName" v-if="columns[6].visible" /> <el-table-column label="供应商" align="center" prop="supplierName" v-if="columns[6].visible" />
<el-table-column label="联系人" align="center" prop="contactUser" v-if="columns[7].visible" /> <el-table-column label="联系人" align="center" prop="contactUser" v-if="columns[7].visible" />
@ -310,13 +314,6 @@ import { getErpProjectInfoList } from '@/api/oa/erp/projectInfo'; // 添加展
import ProductSelect from '@/components/WmsProductSelect/index.vue'; import ProductSelect from '@/components/WmsProductSelect/index.vue';
import { parseTime } from '@/utils/ruoyi'; import { parseTime } from '@/utils/ruoyi';
const projectInfoList = ref([]); //
/** 获取项目列表 */
const getProjectInfoList = async () => {
const res = await getErpProjectInfoList({});
projectInfoList.value = res.data || [];
};
// //
const handleExpandChange = async (row, expandedRows) => { const handleExpandChange = async (row, expandedRows) => {
if (expandedRows.length && !row.data) { if (expandedRows.length && !row.data) {
@ -332,18 +329,30 @@ const handleExpandChange = async (row, expandedRows) => {
// //
const productSelectRef = ref(); const productSelectRef = ref();
// //
const selectedProducts = ref([]); const selectedProducts = ref([]);
//
const projectInfoList = ref([]);
/** 获取项目列表 */
const getProjectInfoList = async () => {
const res = await getErpProjectInfoList({});
projectInfoList.value = res.data || [];
};
// //
const openProductSelect = () => { const openProductSelect = () => {
productSelectRef.value.open(); productSelectRef.value.open();
}; };
/** 根据项目ID获取项目名称 */
const getProjectName = (projectId) => {
const project = projectInfoList.value.find((item) => item.projectId === projectId);
return project ? project.projectCode : projectId;
};
// //
const handleProductSelect = (products) => { const handleProductSelect = (products) => {
selectedProducts.value = products; //
// selectedProducts.value = products;
// //
const timestamp = parseTime(new Date(), '{y}{m}{d}'); const timestamp = parseTime(new Date(), '{y}{m}{d}');
products.forEach((material) => { products.forEach((material) => {
@ -357,6 +366,7 @@ const handleProductSelect = (products) => {
material.inStockAmount = 1; // 1 material.inStockAmount = 1; // 1
material.totalPrice = (material.unitPrice * material.inStockAmount).toFixed(2); material.totalPrice = (material.unitPrice * material.inStockAmount).toFixed(2);
}); });
selectedProducts.value.push(...products);
}; };
// //
@ -433,11 +443,11 @@ const columns = ref<FieldOption[]>([
{ key: 1, label: `租户编号`, visible: false }, { key: 1, label: `租户编号`, visible: false },
{ key: 2, label: `入库单号`, visible: true }, { key: 2, label: `入库单号`, visible: true },
{ key: 3, label: `入库单类型`, visible: true }, { key: 3, label: `入库单类型`, visible: true },
{ key: 4, label: `项目ID`, visible: true }, { key: 4, label: `所属项目`, visible: true },
{ key: 5, label: `关联单号`, visible: true }, { key: 5, label: `关联单号`, visible: true },
{ key: 6, label: `供应商`, visible: true }, { key: 6, label: `供应商`, visible: true },
{ key: 7, label: `联系人`, visible: true }, { key: 7, label: `联系人`, visible: false },
{ key: 8, label: `联系电话`, visible: true }, { key: 8, label: `联系电话`, visible: false },
{ key: 9, label: `入库说明`, visible: true }, { key: 9, label: `入库说明`, visible: true },
{ key: 10, label: `入库单状态`, visible: true }, { key: 10, label: `入库单状态`, visible: true },
{ key: 11, label: `流程状态`, visible: true }, { key: 11, label: `流程状态`, visible: true },
@ -448,7 +458,7 @@ const columns = ref<FieldOption[]>([
{ key: 16, label: `创建人`, visible: false }, { key: 16, label: `创建人`, visible: false },
{ key: 17, label: `创建时间`, visible: true }, { key: 17, label: `创建时间`, visible: true },
{ key: 18, label: `更新人`, visible: false }, { key: 18, label: `更新人`, visible: false },
{ key: 19, label: `更新时间`, visible: true } { key: 19, label: `更新时间`, visible: false }
]); ]);
const initFormData: InStockBillForm = { const initFormData: InStockBillForm = {
@ -580,11 +590,11 @@ const handleAddSubmit = () => {
// //
const invalidMaterials = selectedProducts.value.filter((material) => { const invalidMaterials = selectedProducts.value.filter((material) => {
return !material.unitPrice || material.unitPrice <= 0 || !material.inStockAmount || material.inStockAmount <= 0 || !material.warehouseId; return !material.inStockAmount || material.inStockAmount <= 0 || !material.warehouseId;
}); });
if (invalidMaterials.length > 0) { if (invalidMaterials.length > 0) {
proxy?.$modal.msgError('请完善物料信息,确保单价和数量都大于0且选择了仓库'); proxy?.$modal.msgError('请完善物料信息,确保数量都大于0且选择了仓库');
return; return;
} }

Loading…
Cancel
Save