优化
This commit is contained in:
@ -197,18 +197,17 @@
|
||||
></el-col> -->
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-table v-loading="loading" :data="selectPlanList" v-if="form.id">
|
||||
<el-table v-loading="loading" :data="selectPlanList">
|
||||
<el-table-column label="物资名称" align="center" prop="name" />
|
||||
|
||||
<el-table-column label="质量标准" align="center" prop="qs" />
|
||||
<el-table-column label="规格型号" align="center" prop="specification" />
|
||||
<el-table-column label="计量单位" align="center" prop="unit" width="80" />
|
||||
<el-table-column label="需求数量" align="center" prop="demandQuantity" v-if="form.docType == 2">
|
||||
<el-table-column label="需求数量" align="center" prop="demandQuantity">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.demandQuantity" placeholder="请输入" type="number" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="需求数量" align="center" prop="demandQuantity" v-else />
|
||||
<!-- <el-table-column label="需求数量" align="center" prop="demandQuantity" v-else /> -->
|
||||
<!-- <el-table-column label="需求到货时间" align="center" prop="arrivalTime" width="250" /> -->
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
</el-table>
|
||||
@ -364,6 +363,7 @@ const data = reactive({
|
||||
docCode: [{ required: true, message: '采购单编号不能为空', trigger: 'blur' }],
|
||||
planId: [{ required: true, message: '需求计划不能为空', trigger: 'blur' }],
|
||||
mrpBaseId: [{ required: true, message: '需求批次号不能为空', trigger: 'blur' }],
|
||||
supplierId: [{ required: true, message: '供应商不能为空', trigger: 'blur' }],
|
||||
// 电话号码验证
|
||||
technicalDirectorTel: [
|
||||
{ required: true, message: '请输入电话', trigger: 'blur' },
|
||||
@ -468,9 +468,16 @@ const handleUpdate = async (row?: PurchaseDocVO) => {
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getPurchaseDoc(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
getPlanList();
|
||||
form.value.planId = form.value.associationList?.map((item: any) => item.planId);
|
||||
await getPlanList();
|
||||
|
||||
form.value.planId = form.value.associationList?.map((item: any) => item.planId);
|
||||
planList.value.forEach((item) => {
|
||||
form.value.associationList.forEach((items: any) => {
|
||||
if (item.id == items.planId) {
|
||||
item.demandQuantity = items.demandQuantity;
|
||||
}
|
||||
});
|
||||
});
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改物资-采购联系单';
|
||||
};
|
||||
@ -478,6 +485,7 @@ const handleUpdate = async (row?: PurchaseDocVO) => {
|
||||
const selectPlanList = computed(() => {
|
||||
if (!form.value.planId) return [];
|
||||
const result = planList.value.filter((item) => form.value.planId.includes(item.id));
|
||||
|
||||
return result;
|
||||
});
|
||||
|
||||
@ -486,11 +494,12 @@ const submitForm = () => {
|
||||
purchaseDocFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
form.value.associationList = form.value.planId?.map((item: any) => ({
|
||||
planId: item
|
||||
}));
|
||||
form.value.associationList = selectPlanList.value;
|
||||
form.value.associationList.forEach((item: any) => {
|
||||
item.planId = item.id;
|
||||
delete item.id;
|
||||
});
|
||||
form.value.supplier = supplierOptions.value.find((item) => item.id == form.value.supplierId)?.supplierName;
|
||||
|
||||
if (form.value.id) {
|
||||
await updatePurchaseDoc(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user