2025-09-15 08:15:22 +08:00
|
|
|
<template>
|
|
|
|
|
<el-card class="hl-card">
|
|
|
|
|
<template #header>
|
|
|
|
|
<span>零件采购收货</span>
|
|
|
|
|
</template>
|
|
|
|
|
<ContentWrap class="borderxx">
|
|
|
|
|
<!-- 搜索工作栏 -->
|
|
|
|
|
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="120px">
|
2025-11-05 09:01:37 +08:00
|
|
|
<el-form-item label="采购订单号" prop="purchaseNo">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.purchaseNo" placeholder="采购订单号" clearable @keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
2025-10-15 19:14:42 +08:00
|
|
|
|
|
|
|
|
<el-form-item label="项目编码" prop="projectCode">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.projectCode" placeholder="请输入项目编码" clearable @keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
2025-10-23 18:38:30 +08:00
|
|
|
<el-form-item label="项目简称" prop="projectName">
|
2025-09-15 08:15:22 +08:00
|
|
|
<el-input
|
2025-10-23 18:38:30 +08:00
|
|
|
v-model="queryParams.projectName" placeholder="请输入项目简称" clearable @keyup.enter="handleQuery"
|
2025-09-15 08:15:22 +08:00
|
|
|
class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
2025-10-15 19:14:42 +08:00
|
|
|
<el-form-item label="客户简称" prop="customerName">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.customerName"
|
|
|
|
|
placeholder="请输入客户简称"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
2025-10-23 18:38:30 +08:00
|
|
|
<el-form-item label="子项目简称" prop="projectSubName">
|
2025-09-15 08:15:22 +08:00
|
|
|
<el-input
|
2025-10-23 18:38:30 +08:00
|
|
|
v-model="queryParams.projectSubName" placeholder="子项目简称" clearable @keyup.enter="handleQuery"
|
2025-09-15 08:15:22 +08:00
|
|
|
class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
2025-10-15 19:14:42 +08:00
|
|
|
<el-form-item label="零件" prop="boomName">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.boomName" placeholder="请输入零件" clearable @keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="图号" prop="blueprintNo">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.blueprintNo" placeholder="请输入图号" clearable @keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="工序" prop="procedureName">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.procedureName" placeholder="请输入工序" clearable @keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
2025-09-15 08:15:22 +08:00
|
|
|
<el-form-item label="供应商" prop="supplierName">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.supplierName" placeholder="供应商" clearable @keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="责任人" prop="username">
|
|
|
|
|
<el-input
|
2025-09-15 18:56:07 +08:00
|
|
|
v-model="queryParams.username" placeholder="责任人" clearable @keyup.enter="handleQuery" :readonly="isReadOnly"
|
|
|
|
|
class="!w-240px" />
|
2025-09-15 08:15:22 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="收货状态" prop="receivingStatus">
|
|
|
|
|
<el-select v-model="queryParams.receivingStatus" placeholder="下拉选择" clearable class="!w-240px">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in getIntDictOptions(DICT_TYPE.HELI_PURCHASE_RECEIVING_STATUS)" :key="dict.value"
|
|
|
|
|
:label="dict.label" :value="dict.value" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2025-10-15 19:14:42 +08:00
|
|
|
|
|
|
|
|
|
2025-09-15 08:15:22 +08:00
|
|
|
<el-form-item style="margin-left:50px">
|
|
|
|
|
<el-button @click="handleQuery" type="primary">
|
|
|
|
|
<Icon icon="ep:search" class="mr-5px" /> 搜索
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button @click="resetQuery">
|
|
|
|
|
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<el-card class="hl-card-info">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">订单明细</span>
|
|
|
|
|
<el-button style="margin-left: 20px" @click="receiveGoods" type="success" size="large">收货</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col>
|
|
|
|
|
<el-card class="hl-incard">
|
|
|
|
|
<el-form ref="subFormRef" :model="list" v-loading="formLoading" label-width="0" >
|
|
|
|
|
<el-table
|
2025-11-13 07:30:27 +08:00
|
|
|
v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" class="hl-table" ref="multipleTableRef" @selection-change="handleSelectionChange">
|
2025-09-15 08:15:22 +08:00
|
|
|
<el-table-column type="selection" width="55" />
|
|
|
|
|
<el-table-column label="收货状态" align="center" prop="receivingStatus" min-width="120">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.HELI_PURCHASE_RECEIVING_STATUS" :value="scope.row.receivingStatus" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="projectSubCode" min-width="150" label="子项目编码" align="center"/>
|
|
|
|
|
<el-table-column prop="blueprintNo" min-width="100" label="图号" align="center"/>
|
|
|
|
|
<el-table-column prop="boomName" min-width="120" label="零件名称" align="center"/>
|
2025-09-15 18:56:07 +08:00
|
|
|
<el-table-column prop="supplierName" min-width="120" label="供应商" align="center"/>
|
2025-09-15 08:15:22 +08:00
|
|
|
<el-table-column prop="procedureName" min-width="120" label="工序" align="center"/>
|
|
|
|
|
<el-table-column prop="compositionName" min-width="100" label="材质" align="center"/>
|
|
|
|
|
<el-table-column prop="purchaseAmount" min-width="100" label="采购数量" align="center" />
|
|
|
|
|
<el-table-column prop="purchaseRemAmount" min-width="100" label="剩余数量" align="center"/>
|
|
|
|
|
<el-table-column prop="purchaseAmount" min-width="180" align="center">
|
|
|
|
|
<template #header><span class="hl-table_header">*</span>入库数量</template>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-form-item :prop="`${scope.$index}.purchaseRemAmounts`" class="mb-0px!">
|
|
|
|
|
<el-input-number style="width: 100%" v-model="scope.row.purchaseRemAmounts" placeholder="入库数量" :min="0" :precision="2" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="estimatedPrice" min-width="180" label="预估总价(元)" align="center">
|
|
|
|
|
<template #header><span class="hl-table_header">*</span>预估总价(元)</template>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-form-item :prop="`${scope.$index}.estimatedPrice`" class="mb-0px!">
|
2025-11-13 07:30:27 +08:00
|
|
|
<el-input-number
|
|
|
|
|
style="width: 100%" v-model="scope.row.estimatedPrice" placeholder="预估总价" :min="0" :precision="2"
|
|
|
|
|
@input="(val)=>handleInput(val,scope.row)"
|
|
|
|
|
@keyup.enter="(e)=>handleEnter(e,scope.row)"
|
|
|
|
|
:id="'estimatedPrice'+scope.row.id"
|
|
|
|
|
/>
|
2025-09-15 08:15:22 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2025-11-05 09:01:37 +08:00
|
|
|
<el-table-column prop="createTime" min-width="150" label="订单生成日期" align="center" :formatter="dateFormatter1"/>
|
|
|
|
|
<el-table-column prop="requireTime" min-width="150" label="需要完成日期" align="center" :formatter="dateFormatter1"/>
|
|
|
|
|
<!-- <el-table-column prop="arriveTime" min-width="150" label="收货日期" align="center" :formatter="dateFormatter1" />-->
|
2025-09-15 08:15:22 +08:00
|
|
|
<el-table-column prop="description" min-width="150" label="技术要求" align="center"/>
|
|
|
|
|
<el-table-column prop="theWeight" min-width="100" label="理论重量" align="center"/>
|
|
|
|
|
<el-table-column label="操作" align="center" fixed="right" min-width="200">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button link type="primary" v-if="scope.row.receivingStatus!=3" @click="receiveGood(scope.row)">
|
|
|
|
|
收货
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button link type="primary" @click="updateFrom(scope.row)" v-if="scope.row.receivingStatus==3">
|
|
|
|
|
总价修改
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<!-- 分页 -->
|
|
|
|
|
<Pagination
|
|
|
|
|
:total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
|
|
|
|
@pagination="getList" />
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-card>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import * as PurchaseOrderApi from '@/api/heli/purchaseorder'
|
2025-09-15 18:56:07 +08:00
|
|
|
import * as UserApi from '@/api/system/user'
|
2025-09-15 08:15:22 +08:00
|
|
|
import { ElTable } from 'element-plus'
|
|
|
|
|
import {useUserStore} from "@/store/modules/user";
|
2025-09-15 18:56:07 +08:00
|
|
|
import {dateFormatter1} from "@/utils/formatTime";
|
2025-09-15 08:15:22 +08:00
|
|
|
import * as PurchaseOrderNoDetailApi from "@/api/heli/purchaseordernodetail";
|
2025-11-13 07:30:27 +08:00
|
|
|
defineOptions({ name: 'PurchaseordernopartReceived' })
|
2025-09-15 08:15:22 +08:00
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const username = userStore.getUser.nickname
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
const loading = ref(true) // 列表的加载中
|
2025-09-15 18:56:07 +08:00
|
|
|
const isReadOnly = ref(false) // 列表的加载中
|
2025-09-15 08:15:22 +08:00
|
|
|
const list = ref([]) // 列表的数据
|
|
|
|
|
const total = ref(0) // 列表的总页数
|
|
|
|
|
const queryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
id: undefined,
|
|
|
|
|
ids: undefined,
|
|
|
|
|
purchaseNo: undefined,
|
|
|
|
|
supplierId: undefined,
|
|
|
|
|
contractNo: undefined,
|
|
|
|
|
purchaseType: undefined,
|
|
|
|
|
projectMaterialPlanId: undefined,
|
|
|
|
|
goodsType: 2,
|
|
|
|
|
currencyType: undefined,
|
|
|
|
|
taxRatio: undefined,
|
|
|
|
|
estimatedPrice: undefined,
|
|
|
|
|
actualPrice: undefined,
|
|
|
|
|
status: undefined,
|
|
|
|
|
submitUserId: undefined,
|
|
|
|
|
submitTime: [],
|
|
|
|
|
auditor: undefined,
|
|
|
|
|
auditTime: [],
|
|
|
|
|
description: undefined,
|
|
|
|
|
creator: undefined,
|
|
|
|
|
createTime: undefined,
|
|
|
|
|
receivingStatus:1,
|
|
|
|
|
projectName:undefined,
|
|
|
|
|
projectSubName:undefined,
|
|
|
|
|
username:username,
|
|
|
|
|
supplierName:undefined,
|
|
|
|
|
boomName:undefined,
|
|
|
|
|
blueprintNo:undefined,
|
2025-10-15 19:14:42 +08:00
|
|
|
procedureName:undefined,
|
|
|
|
|
customerName:undefined,
|
|
|
|
|
projectCode:undefined
|
2025-09-15 08:15:22 +08:00
|
|
|
})
|
|
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
|
|
const exportLoading = ref(false) // 导出的加载中
|
2025-11-13 07:30:27 +08:00
|
|
|
const handleInput = (val: number, row: PurchaseOrderNoDetailApi.PurchaseOrderNoDetailVO) => {
|
|
|
|
|
console.log(val, 'val');
|
|
|
|
|
//输入判断当前行是否选中如无将当前行选中
|
|
|
|
|
if (multipleSelection.value.indexOf(row) == -1) {
|
|
|
|
|
multipleSelection.value.push(row);
|
|
|
|
|
multipleTableRef.value.toggleRowSelection(row)
|
2025-09-15 08:15:22 +08:00
|
|
|
|
2025-11-13 07:30:27 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
const handleEnter = (e: KeyboardEvent, row: PurchaseOrderNoDetailApi.PurchaseOrderNoDetailVO) => {
|
|
|
|
|
//敲下回车时切换到下一行的预估总价 如果为0.00将其=null
|
|
|
|
|
console.log(e, 'e');
|
|
|
|
|
//判断当前行是否为最后一行如为最后一行则不切换
|
|
|
|
|
if (list.value.indexOf(row) == list.value.length - 1) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const index = list.value.findIndex((item) => item.id == row.id)
|
|
|
|
|
//切换到下一行
|
|
|
|
|
const input = document.getElementById("estimatedPrice" + list.value[index + 1].id);
|
|
|
|
|
if (input) {
|
|
|
|
|
input.focus();
|
|
|
|
|
if (list.value[index + 1].estimatedPrice == 0.00) {
|
|
|
|
|
list.value[index + 1].estimatedPrice = ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log(input, 'input');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2025-09-15 08:15:22 +08:00
|
|
|
/** 查询列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
queryParams.ids = undefined
|
|
|
|
|
const data = await PurchaseOrderNoDetailApi.getReceiveGoodDetail(queryParams)
|
|
|
|
|
|
|
|
|
|
list.value = data.list
|
|
|
|
|
total.value = data.total
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const updateFrom = async (row) => {
|
|
|
|
|
await PurchaseOrderNoDetailApi.updateFrom(row)
|
|
|
|
|
loading.value = true;
|
|
|
|
|
|
|
|
|
|
message.success("修改成功");
|
|
|
|
|
getList(); // 确保刷新完成
|
|
|
|
|
emit('success');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
queryParams.pageNo = 1
|
|
|
|
|
getList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
const resetQuery = () => {
|
|
|
|
|
queryFormRef.value.resetFields()
|
|
|
|
|
handleQuery()
|
|
|
|
|
}
|
2025-11-13 07:30:27 +08:00
|
|
|
const multipleTableRef: any = ref<InstanceType<typeof ElTable>>()
|
2025-09-15 08:15:22 +08:00
|
|
|
const multipleSelection: any = ref([])
|
|
|
|
|
|
|
|
|
|
const handleSelectionChange = (val: PurchaseOrderApi.PurchaseOrderVO[]) => {
|
2025-11-13 07:30:27 +08:00
|
|
|
multipleSelection.value = val
|
2025-09-15 08:15:22 +08:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
const receiveGood = async (row) => {
|
2025-11-13 07:30:27 +08:00
|
|
|
multipleTableRef.value.clearSelection()
|
|
|
|
|
multipleTableRef.value.toggleRowSelection(row)
|
|
|
|
|
multipleSelection.value.indexOf(row) == -1 && multipleSelection.value.push(row) ;
|
2025-09-15 08:15:22 +08:00
|
|
|
receiveGoods();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const receiveGoods = async () => {
|
|
|
|
|
try {
|
|
|
|
|
|
2025-11-13 07:30:27 +08:00
|
|
|
const list = multipleSelection.value|| []; // 安全获取数据
|
2025-09-15 08:15:22 +08:00
|
|
|
// 1. 检查空数据
|
|
|
|
|
if (!list || list.length==null||list.length==0) {
|
|
|
|
|
message.error("采购单信息未选择,请确认");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
|
|
|
if (list[i].purchaseRemAmounts==null||list[i].purchaseRemAmounts==0){
|
|
|
|
|
message.error("零件"+list[i].boomName+"入库数量为空或数量为0,请确认")
|
|
|
|
|
return
|
|
|
|
|
}
|
2025-09-15 18:56:07 +08:00
|
|
|
if (list[i].estimatedPrice==null||list[i].estimatedPrice==''){
|
|
|
|
|
message.error("零件"+list[i].boomName+"预估总价为空,请确认")
|
2025-09-15 08:15:22 +08:00
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
await PurchaseOrderNoDetailApi.verification(list)
|
|
|
|
|
const res = await Promise.race([
|
|
|
|
|
PurchaseOrderNoDetailApi.receiveGoods(list),
|
|
|
|
|
new Promise((_, reject) =>
|
|
|
|
|
setTimeout(() => reject(new Error("请求超时")), 30000)
|
|
|
|
|
)
|
|
|
|
|
]);
|
|
|
|
|
loading.value = true;
|
|
|
|
|
|
|
|
|
|
message.success("收货成功");
|
|
|
|
|
getList(); // 确保刷新完成
|
|
|
|
|
emit('success');
|
|
|
|
|
} catch (error) {
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const routeValue = ref('')
|
|
|
|
|
onMounted(async () => {
|
2025-09-15 18:56:07 +08:00
|
|
|
const newVar = await UserApi.isAdministrator();
|
2025-09-27 17:16:12 +08:00
|
|
|
if (newVar==false){
|
2025-09-15 18:56:07 +08:00
|
|
|
isReadOnly.value=true
|
|
|
|
|
}
|
|
|
|
|
console.log(newVar)
|
2025-09-15 08:15:22 +08:00
|
|
|
getList()
|
|
|
|
|
})
|
|
|
|
|
</script>
|