feat(发货单): 新增发货单打印功能及明细管理
refactor(组件): 重构发货单明细表格为独立组件 feat(组件): 添加发货单打印预览组件 fix(登录页): 移除默认用户名和密码 style(钢卷面板): 添加显示控制属性并优化布局 chore: 添加vitest测试配置和依赖
This commit is contained in:
@@ -2,18 +2,12 @@
|
||||
<div class="app-container">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="4">
|
||||
<div class="plan-container">
|
||||
<el-input v-model="planQueryParams.planName" placeholder="计划名称" clearable
|
||||
@change="handlePlanQuery" style="width: 100%;" />
|
||||
|
||||
<el-tree
|
||||
v-loading="planLoading"
|
||||
:data="planTreeData"
|
||||
:props="planTreeProps"
|
||||
@node-click="handlePlanSelect"
|
||||
default-expand-all
|
||||
style="margin-top: 10px; height: 550px; overflow: auto;"
|
||||
>
|
||||
<el-card>
|
||||
<el-input v-model="planQueryParams.planName" placeholder="计划名称" clearable @change="handlePlanQuery"
|
||||
style="width: 100%;" />
|
||||
|
||||
<el-tree v-loading="planLoading" :data="planTreeData" :props="planTreeProps" @node-click="handlePlanSelect"
|
||||
default-expand-all style="margin-top: 10px; height: 550px; overflow: auto;">
|
||||
<template slot-scope="{ node, data }">
|
||||
<span class="plan-node">
|
||||
<span class="plan-name">{{ data.planName }}</span>
|
||||
@@ -21,65 +15,71 @@
|
||||
</template>
|
||||
</el-tree>
|
||||
<pagination v-show="planTotal > 0" :total="planTotal" :page.sync="planQueryParams.pageNum"
|
||||
:limit.sync="planQueryParams.pageSize" @pagination="getPlanList" style="margin-top: 10px;" layout="total, prev, jumper, next"/>
|
||||
</div>
|
||||
:limit.sync="planQueryParams.pageSize" @pagination="getPlanList" style="margin-top: 10px;"
|
||||
layout="total, prev, jumper, next" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="20">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-form-item label="发货单名称" prop="waybillName">
|
||||
<el-input v-model="queryParams.waybillName" placeholder="请输入发货单名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="收货单位" prop="consigneeUnit">
|
||||
<el-input v-model="queryParams.consigneeUnit" placeholder="请输入收货单位" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" :disabled="!selectedPlan"
|
||||
title="请先选择发货计划">新增</el-button>
|
||||
<el-button type="success" plain icon="el-icon-refresh" size="mini" @click="handleQuery">刷新</el-button>
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-card>
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-form-item label="发货单名称" prop="waybillName">
|
||||
<el-input v-model="queryParams.waybillName" placeholder="请输入发货单名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="收货单位" prop="consigneeUnit">
|
||||
<el-input v-model="queryParams.consigneeUnit" placeholder="请输入收货单位" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
:disabled="!selectedPlan" title="请先选择发货计划">新增</el-button>
|
||||
<el-button type="success" plain icon="el-icon-refresh" size="mini" @click="handleQuery">刷新</el-button>
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" border :data="deliveryWaybillList" highlight-current-row @row-click="handleRowClick">
|
||||
<el-table-column label="发货单唯一ID" align="center" prop="waybillId" v-if="false" />
|
||||
<el-table-column label="发货单名称" align="center" prop="waybillName" />
|
||||
<el-table-column label="车牌" align="center" prop="licensePlate" width="100" />
|
||||
<el-table-column label="发货单位" align="center" prop="senderUnit" />
|
||||
<el-table-column label="发货时间" align="center" prop="deliveryTime" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.deliveryTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="负责人" align="center" prop="principal" />
|
||||
<el-table-column label="负责人电话" align="center" prop="principalPhone" width="100" />
|
||||
<el-table-column label="完成状态" align="center" prop="status" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.status" placeholder="请选择完成状态" @change="handleStatusChange(scope.row)">
|
||||
<el-option label="已发货" :value="1" />
|
||||
<el-option label="未发货" :value="0" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table v-loading="loading" border :data="deliveryWaybillList" highlight-current-row
|
||||
@row-click="handleRowClick">
|
||||
<el-table-column label="发货单唯一ID" align="center" prop="waybillId" v-if="false" />
|
||||
<el-table-column label="发货单名称" align="center" prop="waybillName" />
|
||||
<el-table-column label="车牌" align="center" prop="licensePlate" width="100" />
|
||||
<el-table-column label="发货单位" align="center" prop="senderUnit" />
|
||||
<el-table-column label="发货时间" align="center" prop="deliveryTime" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.deliveryTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="负责人" align="center" prop="principal" />
|
||||
<el-table-column label="负责人电话" align="center" prop="principalPhone" width="100" />
|
||||
<el-table-column label="完成状态" align="center" prop="status" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.status" placeholder="请选择完成状态" @change="handleStatusChange(scope.row)">
|
||||
<el-option label="已发货" :value="1" />
|
||||
<el-option label="未发货" :value="0" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click.stop="handlePrint(scope.row)">打印发货单</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click.stop="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click.stop="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<el-divider style="margin: 20px 0;" />
|
||||
<el-divider style="margin: 20px 0;" />
|
||||
|
||||
<DeliveryWaybillDetail ref="detailTable" :waybillId="waybillId" />
|
||||
</el-card>
|
||||
|
||||
<DeliveryWaybillDetail ref="detailTable" :waybillId="waybillId" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
@@ -126,20 +126,34 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 打印发货单对话框 -->
|
||||
<el-dialog
|
||||
title="打印发货单"
|
||||
:visible.sync="printDialogVisible"
|
||||
width="90%"
|
||||
append-to-body>
|
||||
<WayBill
|
||||
:waybill="currentWaybill"
|
||||
:waybillDetails="currentWaybillDetails" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDeliveryWaybill, getDeliveryWaybill, delDeliveryWaybill, addDeliveryWaybill, updateDeliveryWaybill } from "@/api/wms/deliveryWaybill";
|
||||
import { listDeliveryPlan } from "@/api/wms/deliveryPlan"; // 导入发货计划API
|
||||
import { listDeliveryWaybillDetail } from "@/api/wms/deliveryWaybillDetail";
|
||||
import MemoInput from "@/components/MemoInput";
|
||||
import DeliveryWaybillDetail from "../componnets/detailTable.vue";
|
||||
import DeliveryWaybillDetail from "../components/detailTable.vue";
|
||||
import WayBill from "../components/wayBill.vue";
|
||||
|
||||
export default {
|
||||
name: "DeliveryWaybill",
|
||||
components: {
|
||||
MemoInput,
|
||||
DeliveryWaybillDetail,
|
||||
WayBill
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -160,6 +174,10 @@ export default {
|
||||
// 发货单主表格数据
|
||||
deliveryWaybillList: [],
|
||||
waybillId: null,
|
||||
// 打印相关数据
|
||||
printDialogVisible: false,
|
||||
currentWaybill: {},
|
||||
currentWaybillDetails: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
@@ -285,7 +303,7 @@ export default {
|
||||
this.planLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// 发货计划搜索
|
||||
handlePlanQuery() {
|
||||
this.planQueryParams.pageNum = 1;
|
||||
@@ -378,6 +396,41 @@ export default {
|
||||
this.download('wms/deliveryWaybill/export', {
|
||||
...this.queryParams
|
||||
}, `deliveryWaybill_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 打印发货单 */
|
||||
handlePrint(row) {
|
||||
this.loading = true;
|
||||
// 设置当前发货单
|
||||
this.currentWaybill = row;
|
||||
// 获取发货单明细
|
||||
listDeliveryWaybillDetail({
|
||||
waybillId: row.waybillId,
|
||||
pageNum: 1,
|
||||
pageSize: 1000 // 获取所有明细
|
||||
}).then(response => {
|
||||
// 处理字段映射,确保与wayBill组件使用的字段名一致
|
||||
this.currentWaybillDetails = response.rows.map(item => ({
|
||||
productName: item.productName,
|
||||
edgeType: item.edgeType,
|
||||
packageType: item.packaging, // 映射packaging到packageType
|
||||
settlementType: item.settlementType,
|
||||
rawMaterialFactory: item.rawMaterialFactory,
|
||||
coilNumber: item.coilNo, // 映射coilNo到coilNumber
|
||||
specification: item.specification,
|
||||
material: item.material,
|
||||
quantity: item.quantity,
|
||||
weight: item.weight,
|
||||
unitPrice: item.unitPrice,
|
||||
remark: item.remark
|
||||
}));
|
||||
// 打开打印对话框
|
||||
this.printDialogVisible = true;
|
||||
this.loading = false;
|
||||
}).catch(error => {
|
||||
console.error('获取发货单明细失败:', error);
|
||||
this.$modal.msgError('获取发货单明细失败');
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -389,6 +442,7 @@ export default {
|
||||
height: 100%;
|
||||
border-right: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
.plan-container h3 {
|
||||
margin: 0 0 10px 0;
|
||||
padding: 0;
|
||||
|
||||
Reference in New Issue
Block a user