接收单
This commit is contained in:
@ -61,3 +61,13 @@ export const delPurchaseDoc = (id: string | number | Array<string | number>) =>
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* 通过采购单获取需求
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const purchaseDocPlanList = (id) => {
|
||||||
|
return request({
|
||||||
|
url: '/cailiaoshebei/purchaseDoc/planList/' + id,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
@ -203,6 +203,18 @@ const handleFile = async (row) => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
//监听项目id刷新数据
|
||||||
|
const listeningProject = watch(
|
||||||
|
() => currentProject.value?.id,
|
||||||
|
(nid, oid) => {
|
||||||
|
queryParams.value.projectId = nid;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
listeningProject();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden">
|
<el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden">
|
||||||
<div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100">
|
<div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100">
|
||||||
<h3 class="text-lg font-semibold text-gray-800">设计原则</h3>
|
<h3 class="text-lg font-semibold text-gray-800">物资设备清单</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-6">
|
<div class="p-6">
|
||||||
<el-form
|
<el-form
|
||||||
|
@ -26,14 +26,7 @@
|
|||||||
<el-table-column label="操作">
|
<el-table-column label="操作">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Download" @click="onExport(scope.row.fileUrl)">下载</el-button>
|
<el-button link type="primary" icon="Download" @click="onExport(scope.row.fileUrl)">下载</el-button>
|
||||||
<el-button
|
<el-button type="success" link icon="edit" v-show="scope.row.status == 'draft'" @click="onUpdate(scope.row)">审核</el-button>
|
||||||
type="success"
|
|
||||||
link
|
|
||||||
icon="edit"
|
|
||||||
v-show="scope.row.status == 'draft' || scope.row.status == 'waiting'"
|
|
||||||
@click="onUpdate(scope.row)"
|
|
||||||
>审核</el-button
|
|
||||||
>
|
|
||||||
<el-button link type="warning" v-show="scope.row.status != 'draft'" icon="View" @click="onView(scope.row)">查看流程</el-button>
|
<el-button link type="warning" v-show="scope.row.status != 'draft'" icon="View" @click="onView(scope.row)">查看流程</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
<dict-tag v-if="scope.row.fileId != null" :options="wf_business_status" :value="scope.row.status" />
|
<dict-tag v-if="scope.row.fileId != null" :options="wf_business_status" :value="scope.row.status" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="变更文件" align="center" prop="remark" width="150">
|
<el-table-column label="变更文件" align="center" width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
@ -81,13 +81,24 @@
|
|||||||
<el-table-column label="备注" align="center" prop="remark" width="150" />
|
<el-table-column label="备注" align="center" prop="remark" width="150" />
|
||||||
<el-table-column label="操作" fixed="right" width="300">
|
<el-table-column label="操作" fixed="right" width="300">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="primary" link icon="Upload" @click="handleAddChange(scope.row)" v-if="!scope.row.fileId">上传</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
icon="Upload"
|
||||||
|
@click="handleAddChange(scope.row)"
|
||||||
|
v-if="scope.row.status == 'draft' || scope.row.status == 'back'"
|
||||||
|
>上传</el-button
|
||||||
|
>
|
||||||
<el-button type="success" link icon="View" v-if="scope.row.status != 'draft'" @click="handleViewInfo(scope.row)">查看</el-button>
|
<el-button type="success" link icon="View" v-if="scope.row.status != 'draft'" @click="handleViewInfo(scope.row)">查看</el-button>
|
||||||
<el-button type="success" link icon="View" @click="handleViewDetail(scope.row)">通知单</el-button>
|
<el-button type="success" link icon="View" @click="handleViewDetail(scope.row)">通知单</el-button>
|
||||||
<!-- <el-tooltip content="查看文档" placement="top">
|
<el-button
|
||||||
<el-button link type="primary" icon="Document" @click="handleView(scope.row)"></el-button>
|
type="warning"
|
||||||
</el-tooltip> -->
|
link
|
||||||
<el-button type="warning" link icon="View" v-if="scope.row.status != 'draft'" @click="handleViewHistory(scope.row)">查看单据</el-button>
|
icon="View"
|
||||||
|
v-if="scope.row.status == 'draft' || scope.row.status == 'termination'"
|
||||||
|
@click="handleViewHistory(scope.row)"
|
||||||
|
>查看单据</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -236,7 +236,10 @@ const data = reactive({
|
|||||||
newest: undefined,
|
newest: undefined,
|
||||||
params: {}
|
params: {}
|
||||||
},
|
},
|
||||||
rules: {}
|
rules: {
|
||||||
|
// 卷册号
|
||||||
|
volumeNo: [{ required: true, message: '请请选择卷册号', trigger: 'change' }]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const { form, rules } = toRefs(data);
|
const { form, rules } = toRefs(data);
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
:pageType="routeParams.type"
|
:pageType="routeParams.type"
|
||||||
/>
|
/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden">
|
<el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden">
|
||||||
<div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100">
|
<div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100">
|
||||||
|
@ -319,6 +319,18 @@ function importExcel(options) {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
//监听项目id刷新数据
|
||||||
|
const listeningProject = watch(
|
||||||
|
() => currentProject.value?.id,
|
||||||
|
(nid, oid) => {
|
||||||
|
queryParams.value.projectId = nid;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
listeningProject();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.drawingreview {
|
.drawingreview {
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['design:volumeCatalog:add']">新增</el-button>
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['design:volumeCatalog:add']">新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<!-- <el-col :span="1.5">
|
||||||
<file-upload
|
<file-upload
|
||||||
v-model="form.file"
|
v-model="form.file"
|
||||||
isImportInfo
|
isImportInfo
|
||||||
@ -41,7 +41,7 @@
|
|||||||
>
|
>
|
||||||
<el-button type="warning" plain icon="Upload">导入</el-button>
|
<el-button type="warning" plain icon="Upload">导入</el-button>
|
||||||
</file-upload>
|
</file-upload>
|
||||||
</el-col>
|
</el-col> -->
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
@ -79,7 +79,7 @@
|
|||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
v-if="scope.row.auditStatus != 'finish' && scope.row.auditStatus != 'termination'"
|
v-if="scope.row.auditStatus != 'finish' && scope.row.auditStatus != 'termination' && scope.row.auditStatus != 'waiting'"
|
||||||
icon="Edit"
|
icon="Edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['design:volumeCatalog:edit']"
|
v-hasPermi="['design:volumeCatalog:edit']"
|
||||||
@ -111,7 +111,12 @@
|
|||||||
v-hasPermi="['out:monthPlan:remove']"
|
v-hasPermi="['out:monthPlan:remove']"
|
||||||
>查看流程</el-button
|
>查看流程</el-button
|
||||||
>
|
>
|
||||||
<el-button type="warning" link icon="View" v-if="scope.row.auditType != 'draft'" @click="handleViewHistory(scope.row)"
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
link
|
||||||
|
icon="View"
|
||||||
|
v-if="scope.row.auditType == 'back' || scope.row.auditStatus == 'termination'"
|
||||||
|
@click="handleViewHistory(scope.row)"
|
||||||
>查看单据</el-button
|
>查看单据</el-button
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
@ -135,11 +140,11 @@
|
|||||||
<el-option v-for="item in userAppList" :key="item.userId" :label="item.userName" :value="item.userId" />
|
<el-option v-for="item in userAppList" :key="item.userId" :label="item.userName" :value="item.userId" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="设计状态" prop="designState">
|
<!-- <el-form-item label="设计状态" prop="designState">
|
||||||
<el-select v-model="form.designState" placeholder="请选择设计状态">
|
<el-select v-model="form.designState" placeholder="请选择设计状态">
|
||||||
<el-option :value="item.value" v-for="item in design_state" :key="item.value" :label="item.label" />
|
<el-option :value="item.value" v-for="item in design_state" :key="item.value" :label="item.label" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="计划出图时间" prop="plannedCompletion">
|
<el-form-item label="计划出图时间" prop="plannedCompletion">
|
||||||
<el-date-picker v-model="form.plannedCompletion" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划出图时间" />
|
<el-date-picker v-model="form.plannedCompletion" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划出图时间" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -71,9 +71,9 @@
|
|||||||
<el-tooltip content="查看" placement="top">
|
<el-tooltip content="查看" placement="top">
|
||||||
<el-button link type="primary" icon="View" @click="handleView(scope.row)"></el-button>
|
<el-button link type="primary" icon="View" @click="handleView(scope.row)"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="修改" placement="top">
|
<!-- <el-tooltip content="修改" placement="top">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['materials:materialReceive:edit']"></el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['materials:materialReceive:edit']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip> -->
|
||||||
<el-tooltip content="删除" placement="top">
|
<el-tooltip content="删除" placement="top">
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
@ -89,7 +89,7 @@
|
|||||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
</el-card>
|
</el-card>
|
||||||
<!-- 添加或修改物料接收单对话框 -->
|
<!-- 添加或修改物料接收单对话框 -->
|
||||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
|
<el-dialog draggable :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
|
||||||
<el-form ref="materialReceiveFormRef" :model="form" :rules="rules" label-width="110px">
|
<el-form ref="materialReceiveFormRef" :model="form" :rules="rules" label-width="110px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -106,18 +106,14 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12"
|
<el-col :span="12"
|
||||||
><el-form-item label="工程名称" prop="projectName">
|
><el-form-item label="采购单编号" prop="docId"
|
||||||
<el-input v-model="form.projectName" placeholder="请输入工程名称" />
|
><el-select @change="handleSelect" v-model="form.docId" filterable placeholder="请选择采购单" style="width: 100%">
|
||||||
</el-form-item>
|
<el-option v-for="item in purchaseDocList" :key="item.id" :label="item.docCode" :value="item.id"></el-option> </el-select
|
||||||
|
></el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="设备材料名称" prop="materialName">
|
<el-form-item label="供货单位" prop="supplierUnit">
|
||||||
<el-input v-model="form.materialName" placeholder="请输入设备材料名称" />
|
<el-input disabled v-model="form.supplierUnit" placeholder="请输入供货单位" />
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="合同名称" prop="contractName">
|
|
||||||
<el-input v-model="form.contractName" placeholder="请输入合同名称" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -125,9 +121,14 @@
|
|||||||
<el-input v-model="form.orderingUnit" placeholder="请输入订货单位" />
|
<el-input v-model="form.orderingUnit" placeholder="请输入订货单位" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="12"
|
||||||
|
><el-form-item label="工程名称" prop="projectName">
|
||||||
|
<el-input v-model="form.projectName" placeholder="请输入工程名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="供货单位" prop="supplierUnit">
|
<el-form-item label="合同名称" prop="contractName">
|
||||||
<el-input v-model="form.supplierUnit" placeholder="请输入供货单位" />
|
<el-input v-model="form.contractName" placeholder="请输入合同名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
@ -139,7 +140,7 @@
|
|||||||
<div class="detail">
|
<div class="detail">
|
||||||
<div class="detail-header">
|
<div class="detail-header">
|
||||||
<span>数量验收</span>
|
<span>数量验收</span>
|
||||||
<el-button type="primary" link @click="addItem" icon="Plus">添加一行</el-button>
|
<!-- <el-button type="primary" link @click="addItem" icon="Plus">添加数量验收</el-button> -->
|
||||||
</div>
|
</div>
|
||||||
<div v-for="(item, index) in form.itemList" :key="index" class="detail-item">
|
<div v-for="(item, index) in form.itemList" :key="index" class="detail-item">
|
||||||
<el-row>
|
<el-row>
|
||||||
@ -176,7 +177,7 @@
|
|||||||
:prop="`itemList.${index}.quantity`"
|
:prop="`itemList.${index}.quantity`"
|
||||||
:rules="{ required: true, message: '数量不能为空', trigger: 'blur' }"
|
:rules="{ required: true, message: '数量不能为空', trigger: 'blur' }"
|
||||||
>
|
>
|
||||||
<el-input v-model="item.quantity" placeholder="请输入数量" />
|
<el-input type="number" v-model="item.quantity" placeholder="请输入数量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -185,7 +186,7 @@
|
|||||||
:prop="`itemList.${index}.acceptedQuantity`"
|
:prop="`itemList.${index}.acceptedQuantity`"
|
||||||
:rules="{ required: true, message: '验收数量不能为空', trigger: 'blur' }"
|
:rules="{ required: true, message: '验收数量不能为空', trigger: 'blur' }"
|
||||||
>
|
>
|
||||||
<el-input v-model="item.acceptedQuantity" placeholder="请输入验收" />
|
<el-input type="number" v-model="item.acceptedQuantity" placeholder="请输入验收" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -194,7 +195,8 @@
|
|||||||
:prop="`itemList.${index}.shortageQuantity`"
|
:prop="`itemList.${index}.shortageQuantity`"
|
||||||
:rules="{ required: true, message: '缺件数量不能为空', trigger: 'blur' }"
|
:rules="{ required: true, message: '缺件数量不能为空', trigger: 'blur' }"
|
||||||
>
|
>
|
||||||
<el-input v-model="item.shortageQuantity" placeholder="请输入缺件" />
|
<el-input type="number" v-model="item.shortageQuantity" placeholder="自动计算(数量-验收数量)" readonly />
|
||||||
|
<span class="tips">*自动计算(数量-验收数量)</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -202,16 +204,15 @@
|
|||||||
<el-input v-model="item.remark" placeholder="请输入备注" />
|
<el-input v-model="item.remark" placeholder="请输入备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.itemList.length > 1">
|
<!-- <el-col :span="12" v-if="form.itemList.length > 1">
|
||||||
<div class="item-actions">
|
<div class="item-actions">
|
||||||
<el-button type="danger" link @click="removeItem(index)" icon="Delete">删除</el-button>
|
<el-button type="danger" link @click="removeItem(index)" icon="Delete">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col> -->
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="合格证文件" prop="certCountFileId">
|
<el-form-item label="合格证文件" prop="certCountFileId">
|
||||||
<file-upload :isShowTip="false" v-model="form.certCountFileId" />
|
<file-upload :isShowTip="false" v-model="form.certCountFileId" />
|
||||||
@ -272,6 +273,8 @@ import {
|
|||||||
import { MaterialReceiveVO, MaterialReceiveQuery, MaterialReceiveForm } from '@/api/materials/materialReceive/types';
|
import { MaterialReceiveVO, MaterialReceiveQuery, MaterialReceiveForm } from '@/api/materials/materialReceive/types';
|
||||||
import { useUserStoreHook } from '@/store/modules/user';
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
import wordllReceive from './word/index.vue';
|
import wordllReceive from './word/index.vue';
|
||||||
|
import { listPurchaseDoc, purchaseDocPlanList } from '@/api/materials/purchaseDoc';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
const { storage_type } = toRefs<any>(proxy?.useDict('storage_type'));
|
const { storage_type } = toRefs<any>(proxy?.useDict('storage_type'));
|
||||||
@ -291,7 +294,8 @@ const total = ref(0);
|
|||||||
|
|
||||||
const queryFormRef = ref<ElFormInstance>();
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
const materialReceiveFormRef = ref<ElFormInstance>();
|
const materialReceiveFormRef = ref<ElFormInstance>();
|
||||||
|
const purchaseDocList = ref([]); //物资采购单
|
||||||
|
const purchaseMap = new Map();
|
||||||
const dialog = reactive<DialogOption>({
|
const dialog = reactive<DialogOption>({
|
||||||
visible: false,
|
visible: false,
|
||||||
title: ''
|
title: ''
|
||||||
@ -318,6 +322,8 @@ const getInitFormData = () => {
|
|||||||
licenseCountFileId: undefined,
|
licenseCountFileId: undefined,
|
||||||
storageType: [],
|
storageType: [],
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
|
docId: undefined,
|
||||||
|
docCode: undefined,
|
||||||
itemList: [
|
itemList: [
|
||||||
{
|
{
|
||||||
name: undefined,
|
name: undefined,
|
||||||
@ -332,7 +338,7 @@ const getInitFormData = () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
const initFormData: MaterialReceiveForm = {};
|
const initFormData: MaterialReceiveForm = {};
|
||||||
const data = reactive<PageData<MaterialReceiveForm, MaterialReceiveQuery>>({
|
const data = reactive({
|
||||||
form: getInitFormData(),
|
form: getInitFormData(),
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@ -397,6 +403,10 @@ const handleAdd = () => {
|
|||||||
reset();
|
reset();
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = '添加物料接收单';
|
dialog.title = '添加物料接收单';
|
||||||
|
// 为初始条目添加监听
|
||||||
|
if (form.value.itemList.length > 0) {
|
||||||
|
watchItemChanges(0);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
@ -405,11 +415,17 @@ const handleUpdate = async (row?: MaterialReceiveVO) => {
|
|||||||
const _id = row?.id || ids.value[0];
|
const _id = row?.id || ids.value[0];
|
||||||
const res = await getMaterialReceive(_id);
|
const res = await getMaterialReceive(_id);
|
||||||
Object.assign(form.value, res.data);
|
Object.assign(form.value, res.data);
|
||||||
if (form.value.storageType.length) {
|
if (form.value.storageType && form.value.storageType.length) {
|
||||||
form.value.storageType = form.value.storageType.split(',');
|
form.value.storageType = form.value.storageType.split(',');
|
||||||
} else {
|
} else {
|
||||||
form.value.storageType = [];
|
form.value.storageType = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 为每个条目添加监听
|
||||||
|
form.value.itemList.forEach((_, index) => {
|
||||||
|
watchItemChanges(index);
|
||||||
|
});
|
||||||
|
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = '修改物料接收单';
|
dialog.title = '修改物料接收单';
|
||||||
};
|
};
|
||||||
@ -440,9 +456,10 @@ const handleDelete = async (row?: MaterialReceiveVO) => {
|
|||||||
proxy?.$modal.msgSuccess('删除成功');
|
proxy?.$modal.msgSuccess('删除成功');
|
||||||
await getList();
|
await getList();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加数量验收条目
|
// 添加数量验收条目
|
||||||
const addItem = () => {
|
const addItem = () => {
|
||||||
form.value.itemList.push({
|
const newItem = {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
specification: undefined,
|
specification: undefined,
|
||||||
unit: undefined,
|
unit: undefined,
|
||||||
@ -450,7 +467,25 @@ const addItem = () => {
|
|||||||
acceptedQuantity: undefined,
|
acceptedQuantity: undefined,
|
||||||
shortageQuantity: undefined,
|
shortageQuantity: undefined,
|
||||||
remark: undefined
|
remark: undefined
|
||||||
});
|
};
|
||||||
|
form.value.itemList.push(newItem);
|
||||||
|
// 监听新条目数据变化
|
||||||
|
watchItemChanges(form.value.itemList.length - 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 监听条目数据变化,自动计算缺件数量
|
||||||
|
const watchItemChanges = (index: number) => {
|
||||||
|
watch(
|
||||||
|
() => [form.value.itemList[index].quantity, form.value.itemList[index].acceptedQuantity],
|
||||||
|
([quantity, acceptedQuantity]) => {
|
||||||
|
// 确保数量和验收数量都是数字
|
||||||
|
const qty = Number(quantity) || 0;
|
||||||
|
const acceptedQty = Number(acceptedQuantity) || 0;
|
||||||
|
// 计算缺件数量(数量 - 验收数量)
|
||||||
|
form.value.itemList[index].shortageQuantity = qty - acceptedQty;
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 删除数量验收条目
|
// 删除数量验收条目
|
||||||
@ -461,13 +496,66 @@ const removeItem = (index: number) => {
|
|||||||
proxy?.$modal.msgWarning('至少需要保留一条数量验收记录');
|
proxy?.$modal.msgWarning('至少需要保留一条数量验收记录');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleView = (row) => {
|
const handleView = (row) => {
|
||||||
// 查看详情
|
// 查看详情
|
||||||
wordllReceiveRef.value?.openDialog(row);
|
wordllReceiveRef.value?.openDialog(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 查询物资-采购联系单列表 */
|
||||||
|
const getlistPurchase = async () => {
|
||||||
|
const res = await listPurchaseDoc({
|
||||||
|
projectId: currentProject.value?.id,
|
||||||
|
status: 'finish'
|
||||||
|
});
|
||||||
|
purchaseDocList.value = res.rows;
|
||||||
|
if (purchaseDocList.value && purchaseDocList.value.length > 0) {
|
||||||
|
purchaseDocList.value.forEach((item) => {
|
||||||
|
purchaseMap.set(item.id, item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 通过采购单获取需求信息
|
||||||
|
const getdemandInfo = async (docId: string) => {
|
||||||
|
let res = await purchaseDocPlanList(docId);
|
||||||
|
if (res.code == 200) {
|
||||||
|
// 需求表单赋值
|
||||||
|
form.value.itemList = [];
|
||||||
|
res.data.forEach((item, index) => {
|
||||||
|
let obj = {
|
||||||
|
quantity: item.demandQuantity,
|
||||||
|
acceptedQuantity: 0,
|
||||||
|
shortageQuantity: item.demandQuantity, // 初始化缺件数量为总数量
|
||||||
|
planId: item.id,
|
||||||
|
...item
|
||||||
|
};
|
||||||
|
obj.id = null;
|
||||||
|
form.value.itemList.push(obj);
|
||||||
|
// 监听每个条目的变化
|
||||||
|
watchItemChanges(form.value.itemList.length - 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSelect = (val) => {
|
||||||
|
// 选择设备
|
||||||
|
let obj = purchaseMap.get(val);
|
||||||
|
getdemandInfo(val);
|
||||||
|
form.value.docCode = obj?.docCode || '';
|
||||||
|
form.value.supplierUnit = obj?.supplier || '';
|
||||||
|
form.value.materialName = obj?.name || '';
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
|
getlistPurchase();
|
||||||
|
// 为初始条目添加监听
|
||||||
|
if (form.value.itemList.length > 0) {
|
||||||
|
watchItemChanges(0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 监听项目id刷新数据
|
// 监听项目id刷新数据
|
||||||
const listeningProject = watch(
|
const listeningProject = watch(
|
||||||
() => currentProject.value?.id,
|
() => currentProject.value?.id,
|
||||||
@ -516,4 +604,10 @@ onUnmounted(() => {
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
padding-top: 6px;
|
padding-top: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Reference in New Issue
Block a user