|
@@ -6,9 +6,14 @@
|
|
|
<div style="width: 100%">
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="采购合同" prop="purchaseId" style="width: 100%; margin-bottom: 18px" @change="changePurchase()">
|
|
|
- <el-select v-model="formData.data.purchaseId" placeholder="请选择采购合同" clearable style="width: 100%">
|
|
|
- <!-- <el-option v-for="item in departmentList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" /> -->
|
|
|
+ <el-form-item
|
|
|
+ label="采购合同"
|
|
|
+ prop="purchaseId"
|
|
|
+ :rules="[{ required: formData.data.detailType === '1' ? true : false, message: '请选择采购合同', trigger: 'change' }]"
|
|
|
+ style="width: 100%; margin-bottom: 18px"
|
|
|
+ @change="changePurchase()">
|
|
|
+ <el-select v-model="formData.data.purchaseId" placeholder="请选择采购合同" clearable filterable style="width: 100%">
|
|
|
+ <el-option v-for="item in purchaseContractList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="事业部" prop="departmentId" style="width: 100%; margin-bottom: 18px">
|
|
@@ -51,6 +56,12 @@
|
|
|
<span>{{ `${row.length} * ${row.width} * ${row.height}` }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="可入库数量" width="140" v-if="formData.data.purchaseId">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <span v-if="row.purchaseQuantity && row.arrivalQuantity">{{ Number(Math.round(row.purchaseQuantity - row.arrivalQuantity)) }}</span>
|
|
|
+ <span>{{ row.purchaseQuantity }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="入库数量" width="180">
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item :prop="'inOutStorageBomList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true" style="width: 100%">
|
|
@@ -81,7 +92,7 @@
|
|
|
</el-card>
|
|
|
|
|
|
<el-dialog title="选择BOM" v-if="openBOM" v-model="openBOM" width="90%">
|
|
|
- <SelectBOM :selectStatus="true" @selectBOM="selectBOM"></SelectBOM>
|
|
|
+ <SelectBOM :selectStatus="true" :purchaseId="formData.data.purchaseId" @selectBOM="selectBOM"></SelectBOM>
|
|
|
<template #footer>
|
|
|
<el-button @click="openBOM = false" size="large">关 闭</el-button>
|
|
|
</template>
|
|
@@ -99,6 +110,7 @@ import SelectBOM from "/src/views/group/BOM/management/index";
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
|
|
|
const warehouseList = ref([]);
|
|
|
+const purchaseContractList = ref([]);
|
|
|
const router = useRouter();
|
|
|
const submit = ref(null);
|
|
|
const formOption = reactive({
|
|
@@ -169,6 +181,16 @@ const getDemandData = () => {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
+ proxy.post("/purchase/purchaseInStorageList", {}).then((res) => {
|
|
|
+ if (res && res.length > 0) {
|
|
|
+ purchaseContractList.value = res.map((item) => {
|
|
|
+ return {
|
|
|
+ dictKey: item.id,
|
|
|
+ dictValue: item.code + "," + item.deliveryDate + "," + item.supplierName,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
getDemandData();
|
|
|
const changePurchase = () => {
|
|
@@ -194,7 +216,10 @@ const selectBOM = (item) => {
|
|
|
width: item.width,
|
|
|
height: item.height,
|
|
|
quantity: undefined,
|
|
|
+ purchaseQuantity: item.purchaseQuantity,
|
|
|
+ arrivalQuantity: item.arrivalQuantity,
|
|
|
});
|
|
|
+ console.log(formData.data.inOutStorageBomList);
|
|
|
ElMessage({ message: "选择完成", type: "success" });
|
|
|
}
|
|
|
};
|
|
@@ -204,6 +229,17 @@ const clickDelete = (index) => {
|
|
|
const submitForm = () => {
|
|
|
submit.value.handleSubmit(() => {
|
|
|
if (formData.data.inOutStorageBomList && formData.data.inOutStorageBomList.length > 0) {
|
|
|
+ if (formData.data.purchaseId) {
|
|
|
+ for (let i = 0; i < formData.data.inOutStorageBomList.length; i++) {
|
|
|
+ let quantity = formData.data.inOutStorageBomList[i].purchaseQuantity;
|
|
|
+ if (formData.data.inOutStorageBomList[i].purchaseQuantity && formData.data.inOutStorageBomList[i].arrivalQuantity) {
|
|
|
+ quantity = Number(Math.round(formData.data.inOutStorageBomList[i].purchaseQuantity - formData.data.inOutStorageBomList[i].arrivalQuantity));
|
|
|
+ }
|
|
|
+ if (quantity < formData.data.inOutStorageBomList[i].quantity) {
|
|
|
+ return ElMessage("入库数量不能大于可入库数量");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
proxy.post("/inOutStorage/add", formData.data).then(() => {
|
|
|
ElMessage({
|
|
|
message: "提交成功",
|