零件采购收货 单价增加输入选择行回车进入下一行功能,增加选择行数据进行打印处理
This commit is contained in:
parent
aee7de95f7
commit
fbab232b17
@ -86,6 +86,7 @@ v-model="queryParams.supplierName" placeholder="供应商" clearable @keyup.ente
|
|||||||
<template #header>
|
<template #header>
|
||||||
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">订单明细</span>
|
<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>
|
<el-button style="margin-left: 20px" @click="receiveGoods" type="success" size="large">收货</el-button>
|
||||||
|
<el-button style="margin-left: 20px" @click="isPrint" type="primary" size="large">打印</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
style="margin-left: 20px"
|
style="margin-left: 20px"
|
||||||
type="success"
|
type="success"
|
||||||
@ -102,7 +103,7 @@ v-model="queryParams.supplierName" placeholder="供应商" clearable @keyup.ente
|
|||||||
<el-form ref="subFormRef" :model="list" v-loading="formLoading" label-width="0" >
|
<el-form ref="subFormRef" :model="list" v-loading="formLoading" label-width="0" >
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="loading" :data="list" :show-overflow-tooltip="true" class="hl-table" ref="multipleTableRef" show-summary :summary-method="getSummaries" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName">
|
v-loading="loading" :data="list" :show-overflow-tooltip="true" class="hl-table" ref="multipleTableRef" show-summary :summary-method="getSummaries" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName">
|
||||||
<el-table-column type="selection" width="80" />
|
<el-table-column type="selection" width="80" fixed="left" />
|
||||||
<!-- <el-table-column label="收货状态" align="center" prop="receivingStatus" min-width="120">-->
|
<!-- <el-table-column label="收货状态" align="center" prop="receivingStatus" min-width="120">-->
|
||||||
<!-- <template #default="scope">-->
|
<!-- <template #default="scope">-->
|
||||||
<!-- <dict-tag :type="DICT_TYPE.HELI_PURCHASE_RECEIVING_STATUS" :value="scope.row.receivingStatus" />-->
|
<!-- <dict-tag :type="DICT_TYPE.HELI_PURCHASE_RECEIVING_STATUS" :value="scope.row.receivingStatus" />-->
|
||||||
@ -118,21 +119,20 @@ v-model="queryParams.supplierName" placeholder="供应商" clearable @keyup.ente
|
|||||||
<el-table-column prop="purchaseAmount" 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="purchaseRemAmount" min-width="100" label="剩余数量" align="center"/>-->
|
||||||
<el-table-column prop="purchaseRemAmounts" min-width="170" align="center" label="入库数量"/>
|
<el-table-column prop="purchaseRemAmounts" min-width="170" align="center" label="入库数量"/>
|
||||||
<!-- <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="170" label="单价" align="center">
|
<el-table-column prop="estimatedPrice" min-width="170" label="单价" align="center">
|
||||||
<template #header>单价</template>
|
<template #header>单价</template>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-form-item :prop="`${scope.$index}.unitPrice`" class="mb-0px!">
|
<el-form-item :prop="`${scope.$index}.unitPrice`" class="mb-0px!">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
style="width: 100%" v-model="scope.row.unitPrice" placeholder="单价" :min="0" :precision="2"
|
style="width: 100%"
|
||||||
|
v-model="scope.row.unitPrice"
|
||||||
|
placeholder="单价"
|
||||||
|
:min="0"
|
||||||
|
:precision="2"
|
||||||
@change="changeUnitPrice(scope.row)"
|
@change="changeUnitPrice(scope.row)"
|
||||||
|
@input="(val)=>handleInput(val,scope.row)"
|
||||||
|
@keyup.enter="(e)=>handleEnterUnitPrice(e,scope.row)"
|
||||||
|
:id="'unitPrice'+scope.row.id"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
@ -177,6 +177,7 @@ v-model="queryParams.supplierName" placeholder="供应商" clearable @keyup.ente
|
|||||||
</el-row>
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
<PrintRef ref="printRef"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@ -191,6 +192,7 @@ import download from "@/utils/download";
|
|||||||
import {exportExcel} from "@/api/heli/purchaseordernodetail";
|
import {exportExcel} from "@/api/heli/purchaseordernodetail";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import {getAccessToken, getTenantId} from "@/utils/auth";
|
import {getAccessToken, getTenantId} from "@/utils/auth";
|
||||||
|
import PrintRef from "./print.vue"
|
||||||
defineOptions({ name: 'PurchaseordernopartReceived' })
|
defineOptions({ name: 'PurchaseordernopartReceived' })
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const username = userStore.getUser.nickname
|
const username = userStore.getUser.nickname
|
||||||
@ -257,12 +259,10 @@ const handleInput = (val: number, row: PurchaseOrderNoDetailApi.PurchaseOrderNoD
|
|||||||
const handleEnter = (e: KeyboardEvent, row: PurchaseOrderNoDetailApi.PurchaseOrderNoDetailVO) => {
|
const handleEnter = (e: KeyboardEvent, row: PurchaseOrderNoDetailApi.PurchaseOrderNoDetailVO) => {
|
||||||
//敲下回车时切换到下一行的预估总价 如果为0.00将其=null
|
//敲下回车时切换到下一行的预估总价 如果为0.00将其=null
|
||||||
console.log(e, 'e');
|
console.log(e, 'e');
|
||||||
//判断当前行是否为最后一行如为最后一行则不切换
|
|
||||||
if (list.value.indexOf(row) == list.value.length - 1) {
|
if (list.value.indexOf(row) == list.value.length - 1) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const index = list.value.findIndex((item) => item.id == row.id)
|
const index = list.value.findIndex((item) => item.id == row.id)
|
||||||
//切换到下一行
|
|
||||||
const input = document.getElementById("estimatedPrice" + list.value[index + 1].id);
|
const input = document.getElementById("estimatedPrice" + list.value[index + 1].id);
|
||||||
if (input) {
|
if (input) {
|
||||||
input.focus();
|
input.focus();
|
||||||
@ -273,6 +273,19 @@ const handleEnter = (e: KeyboardEvent, row: PurchaseOrderNoDetailApi.PurchaseOrd
|
|||||||
console.log(input, 'input');
|
console.log(input, 'input');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
const handleEnterUnitPrice = (e: KeyboardEvent, row: PurchaseOrderNoDetailApi.PurchaseOrderNoDetailVO) => {
|
||||||
|
if (list.value.indexOf(row) == list.value.length - 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const index = list.value.findIndex((item) => item.id == row.id)
|
||||||
|
const input = document.getElementById("unitPrice" + list.value[index + 1].id);
|
||||||
|
if (input) {
|
||||||
|
input.focus();
|
||||||
|
if (list.value[index + 1].unitPrice == 0.00) {
|
||||||
|
list.value[index + 1].unitPrice = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const getSummaries = (param: SummaryMethodProps) => {
|
const getSummaries = (param: SummaryMethodProps) => {
|
||||||
const summaryField = ["purchaseRemAmounts"];
|
const summaryField = ["purchaseRemAmounts"];
|
||||||
@ -496,7 +509,44 @@ const receiveGoods = async () => {
|
|||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const printRef = ref<InstanceType<typeof PrintRef>>()
|
||||||
|
const isPrint = async () => {
|
||||||
|
function formatDate(val) {
|
||||||
|
if (!val) return ''
|
||||||
|
const date = new Date(val)
|
||||||
|
return date.toLocaleDateString()
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const list = multipleSelection.value|| []; // 安全获取数据
|
||||||
|
if(list.length==0){
|
||||||
|
message.warning("请选择订单信息");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//日期 客户名 模具名 件号 零件名称 材料 规格 数量 单价 总价格 要求日期
|
||||||
|
//createTime brief projectSubCode blueprintNo boomName compositionName matSpec purchaseAmount unitPrice estimatedPrice requireTime
|
||||||
|
const data = list?.map((item,idx) => ({
|
||||||
|
编号:idx + 1,
|
||||||
|
日期: formatDate(item.createTime),
|
||||||
|
客户名: item.brief,
|
||||||
|
模具名: item.projectSubCode,
|
||||||
|
件号: item.blueprintNo,
|
||||||
|
零件名称: item.boomName,
|
||||||
|
材料: item.compositionName,
|
||||||
|
规格: item.matSpec,
|
||||||
|
数量: item.purchaseAmount,
|
||||||
|
单价: item.unitPrice,
|
||||||
|
总价格: item.estimatedPrice,
|
||||||
|
要求日期: formatDate(item.requireTime),
|
||||||
|
})) || [];
|
||||||
|
console.log(data)
|
||||||
|
|
||||||
|
// openPrintDialog(newVar)
|
||||||
|
printRef.value?.open(data,"")
|
||||||
|
} finally {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const routeValue = ref('')
|
const routeValue = ref('')
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
<div class="cell audit"> 审核:<span class="sign-space"></span> </div>
|
<div class="cell audit"> 审核:<span class="sign-space"></span> </div>
|
||||||
<div class="cell handler"> 委外加工经手人:<span class="sign-space"></span> </div>
|
<div class="cell handler"> 委外加工经手人:<span class="sign-space"></span> </div>
|
||||||
<div class="cell receiver"> 收货人:<span class="sign-space"></span> </div>
|
<div class="cell receiver"> 收货人:<span class="sign-space"></span> </div>
|
||||||
<div class="cell order-no"> 订单编号:<span class="sign-space">{{ purchaseNo }}</span> </div>
|
<div class="cell order-no" v-if="purchaseNo"> 订单编号:<span class="sign-space">{{ purchaseNo }}</span> </div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="sheet" border="1" cellspacing="0" cellpadding="0">
|
<table class="sheet" border="1" cellspacing="0" cellpadding="0">
|
||||||
@ -154,14 +154,13 @@ import * as PurchaseOrderNoApi from '@/api/heli/purchaseorderno'
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param data 打印数据
|
* @param data 打印数据
|
||||||
* @param str 采购订单号=订单编号
|
* @param str 采购订单号=订单编号 零件采购收货时,订单编号为空。 零件采购订单管理 不为空
|
||||||
*/
|
*/
|
||||||
const open = (data: Record<string, any>[],str: string) => {
|
const open = (data: Record<string, any>[],str: string) => {
|
||||||
rows.value = Array.isArray(data) ? data : []
|
rows.value = Array.isArray(data) ? data : []
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
purchaseNo.value = str;
|
purchaseNo.value = str;
|
||||||
console.log(query.id);
|
console.log(query.id);
|
||||||
|
|
||||||
}
|
}
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
|
|
||||||
@ -273,8 +272,10 @@ const onPrint = () => {
|
|||||||
iframe.contentWindow!.focus()
|
iframe.contentWindow!.focus()
|
||||||
iframe.contentWindow!.print()
|
iframe.contentWindow!.print()
|
||||||
setTimeout(() => document.body.removeChild(iframe), 500)
|
setTimeout(() => document.body.removeChild(iframe), 500)
|
||||||
|
if(query.id){//用来判断零件采购订单管理 id=true,=false零件采购收货
|
||||||
PurchaseOrderNoApi.updateIsPrint(query.id);
|
PurchaseOrderNoApi.updateIsPrint(query.id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user