Merge remote-tracking branch 'origin/main'

This commit is contained in:
z 2026-04-09 09:10:08 +08:00
commit b36d42af05
4 changed files with 403 additions and 236 deletions

View File

@ -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>

View File

@ -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,27 +99,16 @@
</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)">-->
@ -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 ? '是' : '否' }}
@ -188,14 +172,25 @@
<!-- :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="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("请输入入库单号")
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',
method: 'get',
headers: { // headersheader
headers: {
// headersheader
'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);
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>

View File

@ -154,12 +154,6 @@
<el-tag v-else type="success">其他</el-tag>
</template>
</el-table-column>
<el-table-column
label="单据编号"
align="center"
prop="xzdStockNo"
min-width="130"
/>
<el-table-column label="物料编码" align="center" prop="matCode" min-width="200">
<template #default="scope">
@ -206,7 +200,7 @@
/>
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" prop="matName" min-width="190" />
<el-table-column label="物料名称" align="center" prop="matName" min-width="210" />
<el-table-column label="单价" align="center" prop="price" min-width="120" />
<el-table-column label="供应商简称" align="center" prop="brief" min-width="200" />
<el-table-column label="数量" align="center" prop="storageOkQty" min-width="140" />
@ -232,6 +226,7 @@
:formatter="dateFormatter1"
min-width="170"
/>
<el-table-column label="单据编号" align="center" prop="xzdStockNo" min-width="130" />
</el-table>
<!-- 分页 -->
<Pagination
@ -243,7 +238,6 @@
</ContentWrap>
</el-card>
<MaterialForm ref="materialOpenFormRef" @success="getList" />
</template>
<script setup lang="ts">
@ -258,7 +252,7 @@ import { ref } from 'vue'
import { HeliStockTypeDict, HeliStorageStatusDict } from '@/api/heli/wmsstorage'
import { HeliStorageIsExportDict } from '@/api/heli/xzdstoragelog'
import { dateFormatter, dateFormatter1 } from '@/utils/formatTime'
import MaterialForm from "@/views/heli/material/MaterialForm.vue";
import MaterialForm from '@/views/heli/material/MaterialForm.vue'
defineOptions({ name: 'Xzdstoragelog' })
@ -316,7 +310,7 @@ const getList = async () => {
const materialOpenFormRef = ref()
const openPnForm = () => {
materialOpenFormRef.value.open("create")
materialOpenFormRef.value.open('create')
}
/** 搜索按钮操作 */