|
|
|
|
@ -99,17 +99,21 @@
|
|
|
|
|
<dict-tag :options="wms_in_stock_type" :value="scope.row.inStockType" />
|
|
|
|
|
</template>
|
|
|
|
|
</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="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="contactNumber" v-if="columns[8].visible" />
|
|
|
|
|
<el-table-column label="入库说明" align="center" prop="directions" v-if="columns[9].visible" />
|
|
|
|
|
<!-- <el-table-column label="入库单状态" align="center" prop="inStockBillStatus" v-if="columns[10].visible">-->
|
|
|
|
|
<!--<el-table-column label="入库单状态" align="center" prop="inStockBillStatus" v-if="columns[10].visible">-->
|
|
|
|
|
<!-- <template #default="scope">-->
|
|
|
|
|
<!-- <dict-tag :options="wms_in_stock_bill_status" :value="scope.row.inStockBillStatus" />-->
|
|
|
|
|
<!-- </template>-->
|
|
|
|
|
<!-- </el-table-column>-->
|
|
|
|
|
<!--</el-table-column>-->
|
|
|
|
|
<!-- <el-table-column label="流程状态" align="center" prop="flowStatus" v-if="columns[11].visible">-->
|
|
|
|
|
<!-- <template #default="scope">-->
|
|
|
|
|
<!-- <dict-tag :options="wf_business_status" :value="scope.row.flowStatus"></dict-tag>-->
|
|
|
|
|
@ -310,13 +314,6 @@ import { getErpProjectInfoList } from '@/api/oa/erp/projectInfo'; // 添加展
|
|
|
|
|
import ProductSelect from '@/components/WmsProductSelect/index.vue';
|
|
|
|
|
import { parseTime } from '@/utils/ruoyi';
|
|
|
|
|
|
|
|
|
|
const projectInfoList = ref([]); // 项目列表
|
|
|
|
|
|
|
|
|
|
/** 获取项目列表 */
|
|
|
|
|
const getProjectInfoList = async () => {
|
|
|
|
|
const res = await getErpProjectInfoList({});
|
|
|
|
|
projectInfoList.value = res.data || [];
|
|
|
|
|
};
|
|
|
|
|
// 添加展开行处理函数
|
|
|
|
|
const handleExpandChange = async (row, expandedRows) => {
|
|
|
|
|
if (expandedRows.length && !row.data) {
|
|
|
|
|
@ -332,18 +329,30 @@ const handleExpandChange = async (row, expandedRows) => {
|
|
|
|
|
|
|
|
|
|
// 物料选择
|
|
|
|
|
const productSelectRef = ref();
|
|
|
|
|
|
|
|
|
|
// 定义选中的物料列表
|
|
|
|
|
const selectedProducts = ref([]);
|
|
|
|
|
|
|
|
|
|
// 项目列表
|
|
|
|
|
const projectInfoList = ref([]);
|
|
|
|
|
/** 获取项目列表 */
|
|
|
|
|
const getProjectInfoList = async () => {
|
|
|
|
|
const res = await getErpProjectInfoList({});
|
|
|
|
|
projectInfoList.value = res.data || [];
|
|
|
|
|
};
|
|
|
|
|
// 打开物料选择弹窗的方法
|
|
|
|
|
const openProductSelect = () => {
|
|
|
|
|
productSelectRef.value.open();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 根据项目ID获取项目名称 */
|
|
|
|
|
const getProjectName = (projectId) => {
|
|
|
|
|
const project = projectInfoList.value.find((item) => item.projectId === projectId);
|
|
|
|
|
return project ? project.projectCode : projectId;
|
|
|
|
|
};
|
|
|
|
|
// 处理物料选择回调
|
|
|
|
|
const handleProductSelect = (products) => {
|
|
|
|
|
selectedProducts.value = products;
|
|
|
|
|
// 重置所有的物料
|
|
|
|
|
// selectedProducts.value = products;
|
|
|
|
|
|
|
|
|
|
// 为每个物料添加批次号
|
|
|
|
|
const timestamp = parseTime(new Date(), '{y}{m}{d}');
|
|
|
|
|
products.forEach((material) => {
|
|
|
|
|
@ -357,6 +366,7 @@ const handleProductSelect = (products) => {
|
|
|
|
|
material.inStockAmount = 1; // 默认数量为1
|
|
|
|
|
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: 2, 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: 6, label: `供应商`, visible: true },
|
|
|
|
|
{ key: 7, label: `联系人`, visible: true },
|
|
|
|
|
{ key: 8, label: `联系电话`, visible: true },
|
|
|
|
|
{ key: 7, label: `联系人`, visible: false },
|
|
|
|
|
{ key: 8, label: `联系电话`, visible: false },
|
|
|
|
|
{ key: 9, label: `入库说明`, visible: true },
|
|
|
|
|
{ key: 10, label: `入库单状态`, visible: true },
|
|
|
|
|
{ key: 11, label: `流程状态`, visible: true },
|
|
|
|
|
@ -448,7 +458,7 @@ const columns = ref<FieldOption[]>([
|
|
|
|
|
{ key: 16, label: `创建人`, visible: false },
|
|
|
|
|
{ key: 17, label: `创建时间`, visible: true },
|
|
|
|
|
{ key: 18, label: `更新人`, visible: false },
|
|
|
|
|
{ key: 19, label: `更新时间`, visible: true }
|
|
|
|
|
{ key: 19, label: `更新时间`, visible: false }
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
const initFormData: InStockBillForm = {
|
|
|
|
|
@ -580,11 +590,11 @@ const handleAddSubmit = () => {
|
|
|
|
|
|
|
|
|
|
// 验证物料信息的完整性
|
|
|
|
|
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) {
|
|
|
|
|
proxy?.$modal.msgError('请完善物料信息,确保单价和数量都大于0,且选择了仓库');
|
|
|
|
|
proxy?.$modal.msgError('请完善物料信息,确保数量都大于0,且选择了仓库');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|