feat(heli): 回滚入库管理打印功能
This commit is contained in:
parent
0beec72e20
commit
29d7dc1d5f
@ -29,10 +29,10 @@
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="stockInType" label="入库类型">
|
||||
<el-select
|
||||
v-model="formData.stockInType" clearable style="width: 100%" @change="handleStockType"
|
||||
v-model="formData.stockInType" clearable style="width: 100%" @change="handleStockType"
|
||||
:disabled="ctrView || ctrSave">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_IN_TYPE)" :key="dict.value"
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_IN_TYPE)" :key="dict.value"
|
||||
:label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -61,8 +61,8 @@ v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_IN_TYPE)" :key="dict.val
|
||||
@click="openProjectPurchaseorderDialog" /></template>
|
||||
</el-input>
|
||||
</div>
|
||||
<!-- <el-input v-model="formData.headerNo" class="!w-700px"-->
|
||||
<!-- v-bind:disabled="ctrView || ctrSave || enableHeadNo" />-->
|
||||
<!-- <el-input v-model="formData.headerNo" class="!w-700px"-->
|
||||
<!-- v-bind:disabled="ctrView || ctrSave || enableHeadNo" />-->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -73,7 +73,7 @@ v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_IN_TYPE)" :key="dict.val
|
||||
<el-form-item label="单据日期" prop="createTime">
|
||||
<!-- {{ formatDate(formData.createTime, 'YYYY-MM-DD HH:mm:ss') }} -->
|
||||
<el-date-picker
|
||||
v-model="formData.createTime" value-format="x" placeholder="单据日期" disabled
|
||||
v-model="formData.createTime" value-format="x" placeholder="单据日期" disabled
|
||||
class="!w-400px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -82,7 +82,7 @@ v-model="formData.createTime" value-format="x" placeholder="单据日期" disabl
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="whId" label="入库仓库">
|
||||
<el-select
|
||||
v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh"
|
||||
v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh"
|
||||
:disabled="ctrView || ctrSave">
|
||||
<el-option v-for="dict in whList" :key="dict.id" :label="dict.whName" :value="dict.id" />
|
||||
</el-select>
|
||||
@ -139,7 +139,7 @@ v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @c
|
||||
:disabled="ctrView || ctrSave">新增</el-button>
|
||||
<el-button @click="openPnForm" type="success" v-if="btnSave" size="large">新增物料</el-button></el-col>
|
||||
<el-form
|
||||
ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules"
|
||||
ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules"
|
||||
v-loading="subFormLoading" label-width="0">
|
||||
<el-table :data="formData.matItemDOList" class="hl-table">
|
||||
<el-table-column type="index" label="序号" min-width="80" align="center" fixed />
|
||||
@ -177,7 +177,7 @@ ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules"
|
||||
<template #default="scope">
|
||||
<el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!">
|
||||
<el-select
|
||||
v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)"
|
||||
v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)"
|
||||
:disabled="ctrView || ctrSave">
|
||||
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rg_name" :value="dict.id" />
|
||||
</el-select>
|
||||
@ -191,10 +191,10 @@ v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(sc
|
||||
<template #default="scope">
|
||||
<el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!">
|
||||
<el-select
|
||||
v-model="scope.row.pnId" placeholder="" style="width: 100%"
|
||||
v-model="scope.row.pnId" placeholder="" style="width: 100%"
|
||||
:disabled="ctrView || ctrSave">
|
||||
<el-option
|
||||
v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pn_name"
|
||||
v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pn_name"
|
||||
:value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -206,7 +206,7 @@ v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pn_name"
|
||||
|
||||
<template #default="scope">
|
||||
<el-form-item
|
||||
:prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty"
|
||||
:prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty"
|
||||
class="mb-0px!">
|
||||
<el-input v-model="scope.row.storageOkQty" :disabled="ctrView || ctrSave" />
|
||||
</el-form-item>
|
||||
@ -218,7 +218,7 @@ v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pn_name"
|
||||
|
||||
<template #default="scope">
|
||||
<el-form-item
|
||||
:prop="`${scope.$index}.price`" :rules="subFormRules.price"
|
||||
:prop="`${scope.$index}.price`" :rules="subFormRules.price"
|
||||
class="mb-0px!">
|
||||
<el-input v-model="scope.row.price" :disabled="ctrView || ctrSave" />
|
||||
</el-form-item>
|
||||
@ -230,7 +230,7 @@ v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pn_name"
|
||||
|
||||
<template #default="scope">
|
||||
<el-form-item
|
||||
:prop="`${scope.$index}.price`"
|
||||
:prop="`${scope.$index}.price`"
|
||||
class="mb-0px!">
|
||||
<el-input v-model="scope.row.price" :disabled="ctrView || ctrSave" />
|
||||
</el-form-item>
|
||||
@ -261,7 +261,7 @@ v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pn_name"
|
||||
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link type="danger" @click.prevent="handleDelete2(scope.$index)"
|
||||
link type="danger" @click.prevent="handleDelete2(scope.$index)"
|
||||
:disabled="ctrView || ctrDelete">
|
||||
删除
|
||||
</el-button>
|
||||
@ -284,7 +284,7 @@ link type="danger" @click.prevent="handleDelete2(scope.$index)"
|
||||
<el-card class="hl-incard">
|
||||
<el-col>
|
||||
<el-upload
|
||||
ref="matUploadRef" :file-list="matUploadFiles" multiple :action="uploadUrl" :headers="{
|
||||
ref="matUploadRef" :file-list="matUploadFiles" multiple :action="uploadUrl" :headers="{
|
||||
Authorization: 'Bearer ' + getAccessToken(),
|
||||
'tenant-id': getTenantId()
|
||||
}" name="files" :show-file-list="false" :auto-upload="false" :data="matUploadData" :on-change="matUploadChange"
|
||||
@ -296,7 +296,7 @@ ref="matUploadRef" :file-list="matUploadFiles" multiple :action="uploadUrl" :hea
|
||||
</el-upload>
|
||||
</el-col>
|
||||
<el-table
|
||||
:data="formData.attachments" class="hl-table" v-loading.fullscreen.lock="uploading"
|
||||
:data="formData.attachments" class="hl-table" v-loading.fullscreen.lock="uploading"
|
||||
element-loading-text="附件上传中..." element-loading-background="rgba(122, 122, 122, 0.6)">
|
||||
<el-table-column prop="name" label="文件名称" align="center">
|
||||
<!-- <template #default="scope">
|
||||
@ -310,12 +310,12 @@ ref="matUploadRef" :file-list="matUploadFiles" multiple :action="uploadUrl" :hea
|
||||
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link type="danger" size="small" :disabled="ctrView || ctrDelete"
|
||||
link type="danger" size="small" :disabled="ctrView || ctrDelete"
|
||||
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)">
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
link type="primary" size="small" :disabled="ctrView || ctrDelete"
|
||||
link type="primary" size="small" :disabled="ctrView || ctrDelete"
|
||||
@click="downloadAttachment(scope.row.name, scope.row.url)">
|
||||
下载
|
||||
</el-button>
|
||||
@ -335,7 +335,7 @@ link type="primary" size="small" :disabled="ctrView || ctrDelete"
|
||||
<el-button @click="isPrint()" type="primary" size="large" :loading="printLoading" >打 印</el-button>
|
||||
<el-button @click="submitForm" type="success" v-if="btnSave&&formData.status ==1" size="large">保 存</el-button>
|
||||
<el-button @click="handleStatus(2)" type="primary" v-if="btnSave" size="large">提 交</el-button>
|
||||
<!-- <el-button @click="handleStatus(3)" type="danger" v-if="btnCancel&&formData.status != 2" size="large">作 废</el-button>-->
|
||||
<!-- <el-button @click="handleStatus(3)" type="danger" v-if="btnCancel&&formData.status != 2" size="large">作 废</el-button>-->
|
||||
<el-button @click="handleDelete" type="danger" v-if="btnCancel&&formData.status ==1" size="large">作 废</el-button>
|
||||
|
||||
</template>
|
||||
@ -378,9 +378,9 @@ link type="primary" size="small" :disabled="ctrView || ctrDelete"
|
||||
</el-row>
|
||||
</el-card>
|
||||
</el-form>
|
||||
<!-- <div class="hl-footer text-center">-->
|
||||
<!-- -->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="hl-footer text-center">-->
|
||||
<!-- -->
|
||||
<!-- </div>-->
|
||||
</el-card>
|
||||
<!-- 表单弹窗:物料列表 -->
|
||||
<materials ref="matOpenFormRef" @success="getList" />
|
||||
@ -390,7 +390,98 @@ link type="primary" size="small" :disabled="ctrView || ctrDelete"
|
||||
<purchaseorderDialog ref="projectPurchaseorderDialog" @success="handleSelectedProjectPurchaseorder" />
|
||||
<!-- 表单弹窗:新增物料 -->
|
||||
<MaterialForm ref="materialOpenFormRef" @success="getList" />
|
||||
<PrintRef ref="printFormRef" />
|
||||
<el-dialog v-model="printDialogVisible" width="80%" title="入库单打印" :close-on-click-modal="false">
|
||||
<div id="printArea" class="print-content">
|
||||
<div class="print-header">
|
||||
<div class="order-info">
|
||||
<div style="display: flex;">
|
||||
<span style="width: 210px;">编号:{{ printData.stockNo}}</span>
|
||||
<span style="margin-left:20px; width: 170px;">入库日期:{{ formatDate(printData.createTime) }}</span>
|
||||
<span style="margin-left:20px;width: 250px">供应商:{{ printData.supplierName }}</span>
|
||||
</div>
|
||||
<!-- <div style="display: flex;">
|
||||
<span style="margin-left:20px;width: 110px">联系人:{{ printData.contactName }}</span>
|
||||
<span style="margin-left:20px;width: 150px">电话:{{ printData.contactMobile }}</span>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<table class="print-table">
|
||||
<colgroup>
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
|
||||
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th>物料号</th>
|
||||
<th>零件名称</th>
|
||||
<th>规格</th>
|
||||
<th>单位</th>
|
||||
<th>入库数量</th>
|
||||
<th>单价(元)</th>
|
||||
<th>小计(元)</th>
|
||||
<th>项目名称</th>
|
||||
<th>备注</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in 17" :key="index">
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.matCode || '' }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.matName ? limitTo20Chars(printData.storageMatDOList[index].matName) : '' }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.mtSpec || '' }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.matUnit || '' }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.storageOkQty || '' }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.unitPrice || '' }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.totalPrice || '' }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.projectName || '' }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.description || '' }}</td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td colspan="9"></td>
|
||||
<td style="font-weight: bold;">合计</td>
|
||||
<td style="font-weight: bold;">{{ printData.estimatedPriceSum }}</td>
|
||||
</tr> -->
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<div class="order-info" style="margin-top: 10px;border-bottom: 1px solid #ccc;padding-bottom: 10px;">
|
||||
<div style="display: flex;width: 40%;">
|
||||
<span >经手人:{{ printData.userName }}</span>
|
||||
|
||||
</div>
|
||||
<div style="display: flex;width: 20%;justify-content: center;">
|
||||
<!-- <span style="margin-left:20px;width: 150px">审核:{{ printData.auditorName }}</span> -->
|
||||
<!-- <span style="margin-left:20px;width: 120px">仓库签字:</span> -->
|
||||
|
||||
</div>
|
||||
<div style="display: flex; width: 40%;justify-content: right;">
|
||||
<span style="margin-left:20px;width: 150px">仓库签字:{{ printData.signature }}</span>
|
||||
|
||||
<span style="margin-left:20px;width: 150px">日期:{{ printData.date }}</span>
|
||||
<!-- <span style="margin-left:20px;width: 150px">接收人:{{ printData.username }}</span> -->
|
||||
<!-- <span style="margin-left:20px;width: 150px">电话:{{ printData.userMobile }}</span> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="printDialogVisible = false">关闭</el-button>
|
||||
<el-button type="primary" @click="doPrint">打印</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
@ -421,7 +512,6 @@ import projects from './subproject.vue'
|
||||
import {Search} from "@element-plus/icons-vue";
|
||||
import purchaseorderDialog from '@/views/heli/outsourcestock/purchaseorderDialog.vue'
|
||||
import MaterialForm from '@/views/heli/material/MaterialForm.vue'
|
||||
import PrintRef from './print.vue'
|
||||
import * as StorageinApi from "@/api/heli/storagein";
|
||||
import * as storageInventoryApi from "@/api/heli/storageinventory";
|
||||
|
||||
@ -538,33 +628,120 @@ function formatDate(val) {
|
||||
}
|
||||
|
||||
const printLoading = ref(false)
|
||||
const printFormRef = ref()
|
||||
// 打印弹窗内容
|
||||
const printDialogVisible = ref(false)
|
||||
const printData = ref({})
|
||||
|
||||
function openPrintDialog(data) {
|
||||
printData.value = data
|
||||
printDialogVisible.value = true
|
||||
}
|
||||
const isPrint = async () => {
|
||||
printLoading.value = true
|
||||
printLoading.value = true
|
||||
try {
|
||||
const newVar = await StorageApi.isPrint(query.id)
|
||||
const data = newVar.storageMatDOList?.map((item, idx) => ({
|
||||
编号: idx + 1,
|
||||
物料号: item.matCode || '',
|
||||
零件名称: item.matName ? (item.matName.length > 20 ? item.matName.slice(0, 20) : item.matName) : '',
|
||||
规格: item.mtSpec || '',
|
||||
单位: item.matUnit || '',
|
||||
入库数量: item.storageOkQty || '',
|
||||
单价: item.unitPrice || '',
|
||||
小计: item.totalPrice || '',
|
||||
项目名称: item.projectName || '',
|
||||
备注: item.description || ''
|
||||
})) || []
|
||||
// 补齐到17行
|
||||
const emptyRow = { 编号: '', 物料号: '', 零件名称: '', 规格: '', 单位: '', 入库数量: '', 单价: '', 小计: '', 项目名称: '', 备注: '' }
|
||||
while (data.length < 17) {
|
||||
data.push({ ...emptyRow, 编号: data.length + 1 })
|
||||
}
|
||||
printFormRef.value?.open(data, '', 'detail')
|
||||
var newVar = await StorageApi.isPrint(query.id);
|
||||
console.log(newVar)
|
||||
openPrintDialog(newVar)
|
||||
} finally {
|
||||
printLoading.value = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function doPrint() {
|
||||
// 创建新的打印窗口
|
||||
const printContent = document.getElementById('printArea')
|
||||
if (!printContent) return
|
||||
|
||||
const iframe = document.createElement('iframe')
|
||||
iframe.style.position = 'absolute'
|
||||
iframe.style.width = '0'
|
||||
iframe.style.height = '0'
|
||||
iframe.style.border = 'none'
|
||||
document.body.appendChild(iframe)
|
||||
|
||||
const doc = iframe.contentWindow?.document
|
||||
doc?.open()
|
||||
doc?.write(`
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title >入库单</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.print-content {
|
||||
width: 100%;
|
||||
padding-top: 15px;
|
||||
}
|
||||
.order-info {
|
||||
justify-content: space-between;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
|
||||
.stamp-info {
|
||||
margin-top: 10px;
|
||||
|
||||
}
|
||||
.stamp-info span{
|
||||
font-size: 15px !important;
|
||||
|
||||
}
|
||||
.order-info span{
|
||||
font-size: 15px !important;
|
||||
|
||||
}
|
||||
.print-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.print-table th, .print-table td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
height: 20px; /* 设置固定高度 */
|
||||
line-height: 20px; /* 垂直居中 */
|
||||
}
|
||||
.print-table th {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
@media print {
|
||||
body { margin: 0; }
|
||||
.print-content {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
${printContent.innerHTML}
|
||||
</body>
|
||||
</html>
|
||||
`)
|
||||
doc?.close()
|
||||
|
||||
iframe.onload = () => {
|
||||
iframe.contentWindow?.focus()
|
||||
iframe.contentWindow?.print()
|
||||
setTimeout(() => document.body.removeChild(iframe), 1000)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function limitTo20Chars(input) {
|
||||
if (typeof input !== 'string') return '';
|
||||
return input.length > 20 ? input.slice(0, 20) : input;
|
||||
}
|
||||
|
||||
|
||||
@ -1267,4 +1444,77 @@ a {
|
||||
color: #409eff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* 打印样式 */
|
||||
@media print {
|
||||
/* 隐藏所有非打印内容 */
|
||||
body * {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* 只显示打印区域 */
|
||||
#printArea, #printArea * {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* 打印区域定位 */
|
||||
#printArea {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 隐藏弹窗相关元素 */
|
||||
.el-dialog, .el-dialog__wrapper, .el-dialog__header, .el-dialog__footer {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.order-info {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
}
|
||||
|
||||
.order-info span {
|
||||
font-size: 15px !important;
|
||||
margin-right: 10px !important;
|
||||
}
|
||||
.stamp-info {
|
||||
margin-top: 10px;
|
||||
|
||||
}
|
||||
.stamp-info span{
|
||||
font-size: 15px !important;
|
||||
|
||||
}
|
||||
.print-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 10px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.print-table th,
|
||||
.print-table td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 6px 8px;
|
||||
text-align: center;
|
||||
font-size: 13px !important;
|
||||
height: 30px; /* 设置固定高度 */
|
||||
line-height: 30px; /* 垂直居中 */
|
||||
|
||||
}
|
||||
|
||||
.print-table th {
|
||||
background-color: #f5f7fa;
|
||||
color: #303133;
|
||||
font-weight: 600;
|
||||
font-size: 13px !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@ -91,12 +91,7 @@
|
||||
<el-button type="primary" plain @click="openDetail('create')">
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
>
|
||||
<el-button type="success" plain @click="handleExport" :loading="exportLoading">
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
@ -104,34 +99,23 @@
|
||||
</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="isPrint" type="primary" size="large">打印</el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- style="margin-left: 20px"-->
|
||||
<!-- type="success"-->
|
||||
<!-- plain-->
|
||||
<!-- @click="handleExport"-->
|
||||
<!-- :loading="exportLoading"-->
|
||||
<!-- >-->
|
||||
<!-- <Icon icon="ep:download" class="mr-5px" /> 导出EXCEL-->
|
||||
<!-- </el-button>-->
|
||||
</template>
|
||||
<ContentWrap>
|
||||
<el-table
|
||||
v-loading="loading" :data="list" class="hl-table"
|
||||
ref="multipleTableRef"
|
||||
@selection-change="handleSelectionChange" :row-class-name="tableRowClassName">
|
||||
<el-table-column type="selection" width="70" fixed="left" />
|
||||
<el-table-column type="index" width="70" fixed label="序号" align="center" />
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:show-overflow-tooltip="true"
|
||||
:stripe="true"
|
||||
class="hl-table"
|
||||
>
|
||||
<!-- <el-table-column label="主键id" align="center" prop="id" /> -->
|
||||
<el-table-column type="index" width="100" fixed label="序号" align="center" />
|
||||
<el-table-column label="入库单号" align="center" prop="stockNo" min-width="210" fixed />
|
||||
<!-- <template #default="scope">-->
|
||||
<!-- <el-button text type="primary" @click="openDetail('review',scope.row.id)">-->
|
||||
<!-- {{scope.row.stockNo}}-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <template #default="scope">-->
|
||||
<!-- <el-button text type="primary" @click="openDetail('review',scope.row.id)">-->
|
||||
<!-- {{scope.row.stockNo}}-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column label="入库类型" align="center" prop="stockInType" min-width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.HELI_STORAGE_IN_TYPE" :value="scope.row.stockInType" />
|
||||
@ -143,7 +127,7 @@
|
||||
{{ warehouseList.find((tag) => tag.id === scope.row.whId)?.whName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="即入即出" align="center" prop="inOutFlag" min-width="100" >
|
||||
<el-table-column label="即入即出" align="center" prop="inOutFlag" min-width="90">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.inOutFlag ? 'success' : 'info'">
|
||||
{{ scope.row.inOutFlag ? '是' : '否' }}
|
||||
@ -176,26 +160,37 @@
|
||||
:formatter="dateFormatter"
|
||||
min-width="240"
|
||||
/>
|
||||
<!-- <el-table-column label="作废人" align="center" prop="cancel" min-width="120">-->
|
||||
<!-- <template #default="scope">-->
|
||||
<!-- {{ userList.find((user) => user.id == scope.row.cancel)?.nickname }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column-->
|
||||
<!-- label="作废时间"-->
|
||||
<!-- align="center"-->
|
||||
<!-- prop="cancelTime"-->
|
||||
<!-- :formatter="dateFormatter"-->
|
||||
<!-- min-width="240"-->
|
||||
<!-- />-->
|
||||
<el-table-column label="单据状态" align="center" prop="status" min-width="120" fixed="right">
|
||||
<!-- <el-table-column label="作废人" align="center" prop="cancel" min-width="120">-->
|
||||
<!-- <template #default="scope">-->
|
||||
<!-- {{ userList.find((user) => user.id == scope.row.cancel)?.nickname }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column-->
|
||||
<!-- label="作废时间"-->
|
||||
<!-- align="center"-->
|
||||
<!-- prop="cancelTime"-->
|
||||
<!-- :formatter="dateFormatter"-->
|
||||
<!-- min-width="240"-->
|
||||
<!-- />-->
|
||||
<el-table-column
|
||||
label="单据状态"
|
||||
align="center"
|
||||
prop="status"
|
||||
min-width="120"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.HELI_STORAGE_IN_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" min-width="180" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="openDetail('update', scope.row.id)" v-if="scope.row.status != 3&&scope.row.status!=4">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openDetail('update', scope.row.id)"
|
||||
v-if="scope.row.status != 3 && scope.row.status != 4"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button link type="primary" @click="openDetail('review', scope.row.id)">
|
||||
@ -220,8 +215,6 @@
|
||||
/>
|
||||
</ContentWrap>
|
||||
</el-card>
|
||||
<PrintRef ref="printRef" />
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@ -231,11 +224,8 @@ import * as StorageApi from '@/api/heli/storage'
|
||||
import * as WarehouseApi from '@/api/heli/warehouse'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import routeParamsCache from '@/utils/routeParamsCache'
|
||||
import axios from "axios";
|
||||
import {getAccessToken, getTenantId} from "@/utils/auth";
|
||||
import {ElButton, ElTable} from "element-plus";
|
||||
import PrintRef from "./print.vue"
|
||||
import * as PurchaseOrderApi from "@/api/heli/purchaseorder";
|
||||
import axios from 'axios'
|
||||
import { getAccessToken, getTenantId } from '@/utils/auth'
|
||||
defineOptions({ name: 'Storage' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
@ -297,33 +287,10 @@ const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
const multipleTableRef: any = ref<InstanceType<typeof ElTable>>()
|
||||
const multipleSelection: any = ref([])
|
||||
|
||||
const handleSelectionChange = (val: PurchaseOrderApi.PurchaseOrderVO[]) => {
|
||||
// 第一步:重置所有行的 isSelected 为 false
|
||||
list.value.forEach(row => {
|
||||
row.isSelected = false;
|
||||
});
|
||||
|
||||
// 第二步:将当前选中行的 isSelected 设为 true
|
||||
val.forEach(selectedRow => {
|
||||
// 找到对应行并更新状态(通过唯一标识符匹配更准确)
|
||||
const targetRow = list.value.find(row => row.id === selectedRow.id);
|
||||
if (targetRow) {
|
||||
targetRow.isSelected = true;
|
||||
}
|
||||
});
|
||||
multipleSelection.value = val
|
||||
|
||||
}
|
||||
const tableRowClassName = ({ row }) => {
|
||||
return row.isSelected ? 'selected-row' : '';
|
||||
}
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
if (!queryParams.stockNo){
|
||||
message.error("请输入入库单号")
|
||||
if (!queryParams.stockNo) {
|
||||
message.error('请输入入库单号')
|
||||
return
|
||||
}
|
||||
|
||||
@ -332,16 +299,17 @@ const handleExport = async () => {
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
// 收集选中的ID
|
||||
const baseUrl = import.meta.env.VITE_BASE_URL;
|
||||
const baseUrl = import.meta.env.VITE_BASE_URL
|
||||
// 使用axios直接请求文件流
|
||||
const response = await axios({
|
||||
url: baseUrl+'/admin-api/heli/storage/export-excel-new',
|
||||
url: baseUrl + '/admin-api/heli/storage/export-excel-new',
|
||||
method: 'get',
|
||||
headers: { // 这里应该是headers而不是header
|
||||
headers: {
|
||||
// 这里应该是headers而不是header
|
||||
'tenant-id': getTenantId(),
|
||||
'Authorization': getAccessToken()
|
||||
Authorization: getAccessToken()
|
||||
},
|
||||
params: {
|
||||
stockNo: queryParams.stockNo ? queryParams.stockNo : undefined
|
||||
@ -349,7 +317,6 @@ const handleExport = async () => {
|
||||
responseType: 'blob' // 关键:指定响应类型为blob
|
||||
})
|
||||
|
||||
|
||||
// 创建下载链接
|
||||
const url = window.URL.createObjectURL(new Blob([response.data]))
|
||||
const link = document.createElement('a')
|
||||
@ -361,12 +328,11 @@ const handleExport = async () => {
|
||||
// 清理
|
||||
document.body.removeChild(link)
|
||||
window.URL.revokeObjectURL(url)
|
||||
|
||||
} catch (error) {
|
||||
console.error('导出失败:', error)
|
||||
message.error('导出失败,请重试')
|
||||
} finally {
|
||||
loading.value = false;
|
||||
loading.value = false
|
||||
exportLoading.value = false
|
||||
// 清理选中的ID
|
||||
queryParams.ids = []
|
||||
@ -382,51 +348,14 @@ const openDetail = (active: string, id?: number) => {
|
||||
router.push({ path: '/inventory/storagedetail', query: { type: active, id: id } })
|
||||
}
|
||||
|
||||
|
||||
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,
|
||||
入库单号: item.stockNo,
|
||||
入库类型: getIntDictOptions(DICT_TYPE.HELI_STORAGE_IN_TYPE).find(d => d.value === item.stockInType)?.label || item.stockInType,
|
||||
上游单号: item.headerNo,
|
||||
入库仓库: warehouseList.value.find(w => w.id === item.whId)?.whName || item.whId,
|
||||
即入即出: item.inOutFlag ? '是' : '否',
|
||||
单据状态: getIntDictOptions(DICT_TYPE.HELI_STORAGE_IN_STATUS).find(d => d.value === item.status)?.label || item.status,
|
||||
创建时间: formatDate(item.createTime),
|
||||
提交时间: formatDate(item.keeperTime),
|
||||
})) || [];
|
||||
console.log(data)
|
||||
|
||||
// openPrintDialog(newVar)
|
||||
printRef.value?.open(data,"")
|
||||
} finally {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
const route = useRoute()
|
||||
const routeValue = ref('')
|
||||
onMounted(async () => {
|
||||
let params = routeParamsCache.get(route.path);
|
||||
let params = routeParamsCache.get(route.path)
|
||||
routeValue.value = route.path
|
||||
if (params ) {
|
||||
Object.assign(queryParams, params);
|
||||
if (params) {
|
||||
Object.assign(queryParams, params)
|
||||
}
|
||||
const queryParamsWarehouse = reactive({
|
||||
pageNo: 1,
|
||||
@ -446,21 +375,15 @@ onMounted(async () => {
|
||||
await getList()
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
const plainParams = JSON.parse(JSON.stringify(queryParams));
|
||||
routeParamsCache.set(routeValue.value, plainParams);
|
||||
});
|
||||
const plainParams = JSON.parse(JSON.stringify(queryParams))
|
||||
routeParamsCache.set(routeValue.value, plainParams)
|
||||
})
|
||||
|
||||
window.addEventListener('beforeunload', () => {
|
||||
const plainParams = JSON.parse(JSON.stringify(queryParams));
|
||||
routeParamsCache.set(routeValue.value, plainParams);
|
||||
});
|
||||
const plainParams = JSON.parse(JSON.stringify(queryParams))
|
||||
routeParamsCache.set(routeValue.value, plainParams)
|
||||
})
|
||||
onActivated(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
.selected-row {
|
||||
background-color: #ffe6cc !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user