Merge remote-tracking branch 'origin/0.8.X' into 0.8.X

This commit is contained in:
2026-01-14 11:57:49 +08:00
5 changed files with 345 additions and 10 deletions

View File

@@ -85,7 +85,7 @@
</el-table-column>
<!-- <el-table-column label="厂家卷号" align="center" prop="supplierCoilNo" /> -->
<el-table-column label="逻辑库位" align="center" prop="warehouseName" v-if="!hideWarehouseQuery" />
<el-table-column label="实际库区" align="center" prop="actualWarehouseName" v-if="!hideWarehouseQuery" />
<el-table-column label="实际库区" align="center" prop="actualWarehouseName" v-if="!hideWarehouseQuery && !showExportTime" />
<!-- <el-table-column label="物料类型" align="center" prop="materialType" /> -->
<el-table-column label="产品类型" align="center" width="250">
<template slot-scope="scope">
@@ -95,16 +95,22 @@
</el-table-column>
<el-table-column v-if="showAbnormal" label="异常数量" align="center" prop="abnormalCount"></el-table-column>
<el-table-column label="长度 (米)" align="center" prop="length" v-if="showLength" />
<el-table-column label="更新时间" align="center" prop="updateTime" />
<el-table-column label="发货时间" align="center" v-if="showExportTime" prop="exportTime" width="160">
<el-table-column label="更新时间" v-if="!showExportTime" align="center" prop="updateTime" />
<el-table-column label="发货时间" v-if="showExportTime" align="center" prop="exportTime" width="205">
<template slot-scope="scope">
<el-date-picker @change="handleExportTimeChange(scope.row)" v-if="canEditExportTime" style="width: 90%"
<el-date-picker @change="handleExportTimeChange(scope.row)" v-if="canEditExportTime" style="width: 100%"
v-model="scope.row.exportTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择发货时间" />
<div v-else>{{ scope.row.exportTime }}</div>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateByName" />
<el-table-column label="发货人" v-if="showExportTime" align="center" prop="exportByName" width="150">
<template slot-scope="scope">
<el-select v-model="scope.row.exportBy" placeholder="请选择发货人" filterable @change="handleExportByNameChange(scope.row)">
<el-option v-for="item in userList" :key="item.userName" :value="item.userName" :label="item.nickName" />
</el-select>
</template>
</el-table-column>
<el-table-column label="更新人" v-if="!showExportTime" align="center" prop="updateByName" />
<el-table-column label="二维码" v-if="qrcode">
<template slot-scope="scope">
<QRCode :content="scope.row.qrcodeRecordId" :size="50" />
@@ -178,7 +184,7 @@
<warehouse-select v-model="form.warehouseId" placeholder="请选择仓库/库区/库位" style="width: 100%;" clearable />
</el-form-item>
<el-form-item label="实际库区" prop="actualWarehouseId">
<actual-warehouse-select v-model="form.actualWarehouseId" placeholder="请选择实际库区" style="width: 100%;"
<actual-warehouse-select v-model="form.actualWarehouseId" :clearInput="form.coilId != null" placeholder="请选择实际库区" style="width: 100%;"
clearable />
</el-form-item>
<el-form-item label="班组" prop="team">
@@ -311,6 +317,7 @@ import MemoInput from "@/components/MemoInput";
import MutiSelect from "@/components/MutiSelect";
import html2canvas from 'html2canvas';
import { PDFDocument } from 'pdf-lib';
import { listUser } from "@/api/system/user";
export default {
name: "MaterialCoil",
@@ -553,7 +560,8 @@ export default {
{ label: '厂家', prop: 'itemManufacturer' },
],
title: '详细信息'
}
},
userList: [],
};
},
computed: {
@@ -575,8 +583,14 @@ export default {
},
created() {
this.getList();
this.getUserList();
},
methods: {
getUserList() {
listUser({ pageNum: 1, pageSize: 1000 }).then(res => {
this.userList = res.rows || [];
});
},
// 打印标签
handlePrintLabel(row) {
const item = row.itemType === 'product' ? row.product : row.rawMaterial;
@@ -882,7 +896,7 @@ export default {
if (row.exportTime) {
row.exportTime = row.exportTime.replace('T', ' ');
}
console.log(row);
this.buttonLoading = true;
updateMaterialCoilSimple(row).then(_ => {
this.$modal.msgSuccess("发货时间修改成功");
this.getList();
@@ -890,6 +904,15 @@ export default {
this.buttonLoading = false;
});
},
handleExportByNameChange(row) {
this.buttonLoading = true;
updateMaterialCoilSimple(row).then(_ => {
this.$modal.msgSuccess("发货人修改成功");
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
},
/** 删除按钮操作 */
handleDelete(row) {
const coilIds = row.coilId || this.ids;

View File

@@ -28,7 +28,7 @@ export default {
data() {
return {
chartInstance: null, // ECharts实例
selectedType: 'itemName', // 默认选中:按物料名称汇总
selectedType: 'manufacturer', // 默认选中:按厂家汇总
// 维度名称映射 - 用于图表标题/提示框展示
typeLabel: {
itemName: '物料名称',

View File

@@ -0,0 +1,142 @@
<template>
<!-- 柱状图容器 必须设置宽高绑定ref获取DOM节点 -->
<div class="bar-chart-container" ref="chartRef"></div>
</template>
<script>
// Vue2 标准echarts引入方式兼容性最优
import * as echarts from 'echarts'
export default {
name: 'BarChart',
props: {
data: {
type: Array,
default: () => []
}
},
data() {
return {
chartInstance: null // 存储echarts实例防止重复渲染/内存泄漏
}
},
mounted() {
// 初始化图表
this.initEcharts()
// 监听窗口大小变化,图表自适应
window.addEventListener('resize', this.resizeChart)
},
beforeDestroy() {
// Vue2 销毁生命周期钩子,清理实例+解绑监听
window.removeEventListener('resize', this.resizeChart)
if (this.chartInstance) {
this.chartInstance.dispose()
this.chartInstance = null
}
},
watch: {
// ✅ 深度监听父组件传的data数据数据更新/新增/删除 自动重绘图表
data: {
deep: true,
immediate: true,
handler() {
this.chartInstance && this.initEcharts()
}
}
},
methods: {
// 初始化柱状图核心方法
initEcharts() {
const chartDom = this.$refs.chartRef
// 防止重复初始化,先销毁旧实例
if (this.chartInstance) {
this.chartInstance.dispose()
}
// 创建新的echarts实例
this.chartInstance = echarts.init(chartDom)
// 从props.data中提取图表数据和你的数据格式完全匹配
const xAxisData = this.data.map(item => item.productName) // X轴收货计划名称
const coilCountData = this.data.map(item => item.coilCount) // 总卷数
const totalWeightData = this.data.map(item => Number(item.totalWeight)) // 总重量(字符串转数字)
// 柱状图核心配置项
const option = {
// 图表内边距,防止内容溢出
grid: { left: '3%', right: '10%', bottom: '3%', containLabel: true },
// 鼠标悬浮提示框,精准展示数据
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' }, // 鼠标悬浮显示阴影指示器,柱状图专属
formatter: '{b}<br/>{a}{c}'
},
// 图例,右上角展示指标名称,可点击切换显隐
legend: {
data: ['总卷数', '总重量(吨)'],
top: 10
},
// X轴 类目轴 - 收货计划名称/日期
xAxis: [
{
type: 'category',
data: xAxisData,
axisLabel: { interval: 0 }, // 强制显示所有X轴标签不隐藏
axisTick: { show: false } // 隐藏X轴刻度线美化
}
],
// ✅ 双Y轴配置核心解决数值量级差异大的问题
yAxis: [
{
// 左侧Y轴 - 对应总卷数
type: 'value',
name: '总卷数',
nameTextStyle: { color: '#1890ff' },
axisLine: { lineStyle: { color: '#1890ff' } }
},
{
// 右侧Y轴 - 对应总重量
type: 'value',
name: '总重量(吨)',
nameTextStyle: { color: '#ff7a45' },
axisLine: { lineStyle: { color: '#ff7a45' } },
splitLine: { show: false } // 关闭右侧网格线,避免页面杂乱
}
],
// ✅ 双系列柱状图配置
series: [
{
name: '总卷数',
type: 'bar', // 图表类型:柱状图
yAxisIndex: 0, // 绑定左侧Y轴
barWidth: '35%', // 柱子宽度,美观适配
itemStyle: { color: '#1890ff', borderRadius: [4, 4, 0, 0] }, // 柱子颜色+顶部圆角
data: coilCountData
},
{
name: '总重量(吨)',
type: 'bar', // 图表类型:柱状图
yAxisIndex: 1, // 绑定右侧Y轴
barWidth: '35%',
itemStyle: { color: '#ff7a45', borderRadius: [4, 4, 0, 0] },
data: totalWeightData
}
]
}
// 挂载配置项渲染图表
this.chartInstance.setOption(option)
},
// 图表自适应窗口大小
resizeChart() {
this.chartInstance && this.chartInstance.resize()
}
}
}
</script>
<style scoped>
/* 柱状图容器样式,宽高可按需修改,必须设置! */
.bar-chart-container {
width: 100%;
height: 400px;
}
</style>

View File

@@ -0,0 +1,154 @@
<template>
<!-- Echarts图表容器必须设置宽高绑定ref用于获取DOM -->
<div class="line-chart-container" ref="chartRef"></div>
</template>
<script>
// Vue2 推荐这种引入方式适配绝大多数echarts版本
import * as echarts from 'echarts'
export default {
name: 'LineChart',
props: {
data: {
type: Array,
default: () => []
}
},
data() {
return {
// 存储echarts实例对象防止重复渲染
chartInstance: null
}
},
mounted() {
// 组件挂载完成初始化图表
this.initEcharts()
// 监听浏览器窗口大小变化,图表自适应
window.addEventListener('resize', this.resizeChart)
},
beforeDestroy() {
// Vue2 销毁生命周期【重点】不是beforeUnmount
// 销毁实例+解绑监听,防止内存泄漏
window.removeEventListener('resize', this.resizeChart)
if (this.chartInstance) {
this.chartInstance.dispose()
this.chartInstance = null
}
},
watch: {
// 深度监听父组件传入的data数据数据更新时重新渲染图表【核心】
data: {
deep: true,
immediate: true,
handler() {
// 数据变化时,先判断实例是否存在,存在则重新渲染
this.chartInstance && this.initEcharts()
}
}
},
methods: {
// 初始化echarts图表核心方法
initEcharts() {
const chartDom = this.$refs.chartRef
// 防止重复初始化,先销毁再创建
if (this.chartInstance) {
this.chartInstance.dispose()
}
// 初始化图表实例
this.chartInstance = echarts.init(chartDom)
// 从props接收的data中提取图表所需数据
const xAxisData = this.data.map(item => item.productName)
const coilCountData = this.data.map(item => item.coilCount)
// 总重量是字符串格式,强制转数字,保证图表能正常渲染
const totalWeightData = this.data.map(item => Number(item.totalWeight))
// echarts核心配置项 - 双Y轴折线图
const option = {
// 图表内边距,防止内容溢出
grid: { left: '3%', right: '10%', bottom: '3%', containLabel: true },
// 鼠标悬浮提示框,展示精准数据
tooltip: {
trigger: 'axis',
formatter: '{b}<br/>{a}: {c}',
axisPointer: { type: 'cross' }
},
// 图例,可点击切换显隐对应折线
legend: {
data: ['总卷数', '总重量(吨)'],
top: 10
},
// X轴 - 类目轴,展示收货计划名称
xAxis: [
{
type: 'category',
data: xAxisData,
axisLabel: {
interval: 0, // 强制显示所有X轴标签不隐藏
fontSize: 12
}
}
],
// 双Y轴核心配置
yAxis: [
{
// 左侧Y轴 - 对应【总卷数】
type: 'value',
name: '总卷数',
nameTextStyle: { color: '#2db7f5' },
axisLine: { lineStyle: { color: '#2db7f5' } }
},
{
// 右侧Y轴 - 对应【总重量】
type: 'value',
name: '总重量(吨)',
nameTextStyle: { color: '#ff6600' },
axisLine: { lineStyle: { color: '#ff6600' } },
splitLine: { show: false } // 关闭右侧网格线,避免页面杂乱
}
],
// 折线图系列数据
series: [
{
name: '总卷数',
type: 'line',
yAxisIndex: 0, // 指定绑定左侧Y轴
data: coilCountData,
smooth: true, // 平滑折线,更美观
symbol: 'circle', // 拐点为圆点
symbolSize: 6,
lineStyle: { width: 2, color: '#2db7f5' },
itemStyle: { color: '#2db7f5' }
},
{
name: '总重量(吨)',
type: 'line',
yAxisIndex: 1, // 指定绑定右侧Y轴
data: totalWeightData,
smooth: true,
symbol: 'circle',
symbolSize: 6,
lineStyle: { width: 2, color: '#ff6600' },
itemStyle: { color: '#ff6600' }
}
]
}
// 设置配置项并渲染图表
this.chartInstance.setOption(option)
},
// 图表自适应窗口大小
resizeChart() {
this.chartInstance && this.chartInstance.resize()
}
}
}
</script>
<style scoped>
/* 图表容器必须设置宽高,否则无法渲染,可根据需求修改尺寸 */
.line-chart-container {
width: 100%;
height: 400px;
}
</style>

View File

@@ -35,6 +35,16 @@
</el-descriptions>
</el-card>
<el-row :gutter="20" style="margin-top: 20px; margin-bottom: 20px;">
<el-col :span="12">
<line-chart :data="details" />
</el-col>
<el-col :span="12">
<bar-chart :data="details" />
</el-col>
</el-row>
<!-- 详细数据表格 -->
<el-card class="table-card" v-if="details && details.length > 0">
<template #header>
@@ -92,9 +102,15 @@
<script>
import { getReceiptReport } from '@/api/wms/deliveryPlan'
import lineChart from './charts/line.vue';
import barChart from './charts/bar.vue';
export default {
name: 'DeliveryReport',
components: {
lineChart,
barChart
},
data() {
return {
summary: null,