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

This commit is contained in:
2025-12-02 13:30:39 +08:00
26 changed files with 1830 additions and 224 deletions

View File

@@ -0,0 +1,106 @@
<template>
<transition name="el-fade-in-linear">
<div v-if="tooltipVisible && data" class="row-tooltip" :style="adjustedTooltipStyle" ref="rowTooltip">
<slot>
<div class="tooltip-list">
<div class="tooltip-item" v-for="field in visibleColumns" :key="field.prop">
<span class="label">{{ field.label }}</span>
<span class="value">{{ formatTooltipValue(data, field) }}</span>
</div>
</div>
</slot>
</div>
</transition>
</template>
<script>
export default {
name: "KLPTableFloatLayer",
props: {
columns: {
type: Array,
default: () => []
},
data: {
type: Object,
default: () => ({})
},
tooltipVisible: {
type: Boolean,
default: false
},
tooltipStyle: {
type: Object,
default: () => ({})
}
},
computed: {
// 一个列要同时有用 label 和 prop 才显示在浮层中, 并且prop有值时才显示
visibleColumns() {
return this.columns.filter(field => field.label && field.prop && this.data[field.prop])
},
// 修正后的tooltipStyle / 其实tooltipStyle只包含两个属性top, left 当在屏幕中无法完全展示时,需要根据实际情况调整位置
adjustedTooltipStyle() {
const { top, left } = this.tooltipStyle;
const tooltipRect = this.$refs.rowTooltip?.getBoundingClientRect();
if (!tooltipRect) return this.tooltipStyle;
// 检查是否超出底部边界
if (parseInt(top) + tooltipRect.height > window.innerHeight) {
return { ...this.tooltipStyle, top: `${window.innerHeight - tooltipRect.height - 12}px` };
}
// 检查是否超出右侧边界
if (parseInt(left) + tooltipRect.width > window.innerWidth) {
return { ...this.tooltipStyle, left: `${window.innerWidth - tooltipRect.width - 16}px` };
}
return this.tooltipStyle;
}
},
methods: {
formatTooltipValue(row, field) {
// 辅助函数:递归/迭代获取多层嵌套的属性值
const getNestedValue = (obj, path) => {
if (!obj || !path) return undefined;
// 将路径拆分为数组(支持 'dept.deptName' 或 ['dept', 'deptName'] 格式)
const pathArr = Array.isArray(path) ? path : path.split('.');
// 逐层取值遇到null/undefined直接返回
return pathArr.reduce((current, key) => {
return current === null || current === undefined ? undefined : current[key];
}, obj);
};
// 获取多层数据的值(核心修改点)
let value = getNestedValue(row, field.prop);
// 空值兜底处理(保留原有逻辑)
if (value === null || value === undefined || value === '') {
return '-';
}
// 字典匹配逻辑(保留原有逻辑)
if (field.dict && this.dict && this.dict.type && this.dict.type[field.dict]) {
const match = this.dict.type[field.dict].find(item => item.value === value);
return match ? match.label : value;
}
return value;
}
}
}
</script>
<style scoped>
.row-tooltip {
position: absolute;
background: #ffffff;
border: 1px solid #dcdcdc;
border-radius: 4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
padding: 12px 14px;
pointer-events: none;
z-index: 5;
/* max-height: 70%; */
overflow: auto;
transition: all 0.3s ease-in-out;
}
</style>

View File

@@ -6,88 +6,45 @@
<p class="loading-text">{{ loadingText || "加载中..." }}</p>
</div>
<!-- 原生 Table 核心透传 props/事件/插槽 -->
<el-table
:ref="tableRef"
v-bind="$attrs"
v-on="$listeners"
:class="['my-table', customClass]"
>
<!-- 1. 透传列定义插槽原生 columns 中通过 slot 自定义的表头/单元格 -->
<template
v-for="(column, index) in $attrs.columns || []"
v-slot:[`header-${column.prop}`]="scope"
>
<!-- 调用业务层定义的表头插槽 -->
<slot :name="`header-${column.prop}`" v-bind="scope"></slot>
</template>
<template
v-for="(column, index) in $attrs.columns || []"
v-slot:[column.prop]="scope"
>
<!-- 调用业务层定义的单元格插槽 -->
<slot :name="column.prop" v-bind="scope"></slot>
</template>
<!-- 2. 透传原生内置插槽 empty 空数据插槽append 底部插槽等 -->
<template v-slot:empty="scope">
<slot name="empty" v-bind="scope"></slot>
</template>
<template v-slot:append="scope">
<slot name="append" v-bind="scope"></slot>
</template>
<!-- 3. 透传自定义列插槽业务层直接用 <el-table-column> 嵌套的情况 -->
<slot v-bind:tableRef="tableRef"></slot>
<el-table-column
v-if="selectionColumn"
type="selection"
width="55"
align="center"
></el-table-column>
<el-table-column
v-if="indexColumn"
type="index"
width="55"
align="center"
></el-table-column>
<el-table-column
v-for="(column, index) in customColumns"
v-bind="column"
:width="column.width"
:prop="column.prop"
:align="column.align"
:label="column.label"
:min-width="column.minWidth"
:fixed="column.fixed"
:show-overflow-tooltip="column.showOverflowTooltip"
:sortable="column.sortable"
>
<template v-slot="scope">
<ColumnRender v-if="column.render" :column="column" :data="scope.row" :render="column.render"/>
<Eclipse v-else-if="column.eclipse" :text="scope.row[column.prop]"></Eclipse>
<span v-else>{{ scope.row[column.prop] }}</span>
<div class="el-table-container" ref="elTableWrapper" @mouseleave="handleTableLeave">
<!-- 原生 Table 核心透传 props/事件/插槽 -->
<el-table :ref="tableRef" v-bind="$attrs" v-on="$listeners" :class="['my-table', customClass]"
@cell-mouse-enter="handleCellEnter" @row-mouseleave="handleRowLeave">
<!-- 2. 透传原生内置插槽 empty 空数据插槽append 底部插槽等 -->
<template v-slot:empty="scope">
<slot name="empty" v-bind="scope"></slot>
</template>
<template v-slot:append="scope">
<slot name="append" v-bind="scope"></slot>
</template>
</el-table-column>
</el-table>
<!-- 3. 透传自定义列插槽直接接收<el-table-column> 嵌套的情况 -->
<slot v-bind:tableRef="tableRef"></slot>
<el-table-column v-if="selectionColumn" type="selection" width="55" align="center"></el-table-column>
<el-table-column v-if="indexColumn" type="index" width="55" align="center"></el-table-column>
</el-table>
<!-- 浮层组件 -->
<KLPTableFloatLayer v-if="floatLayer" :columns="floatLayerColumns" :data="hoveredRow" :tooltipVisible="tooltipVisible"
:tooltipStyle="tooltipStyle" />
</div>
<!-- 扩展层可后续统一添加分页如与 MyPagination 组件联动 -->
<slot name="pagination"></slot>
</div>
</template>
<script>
import ColumnRender from './ColumnRender.vue';
import ColumnRender from './ColumnRender.vue';
import Eclipse from './renderer/eclipse.vue';
import KLPTableFloatLayer from './FloatLayer/index.vue';
export default {
name: "KLPTable", // 组件名,便于调试和文档生成
components: {
ColumnRender,
Eclipse
Eclipse,
KLPTableFloatLayer
},
props: {
// 1. 扩展 props新增原生 Table 没有的属性(如加载状态)
@@ -104,10 +61,6 @@ export default {
type: String,
default: ""
},
customColumns: {
type: Array,
default: () => []
},
selectionColumn: {
type: Boolean,
default: false
@@ -115,13 +68,42 @@ export default {
indexColumn: {
type: Boolean,
default: false
},
// floatLayer是否显示浮层
floatLayer: {
type: Boolean,
default: false
},
floatLayerConfig: {
type: Object,
default: () => ({
columns: [],
title: '详细信息'
})
}
},
data() {
return {
tableRef: "myTableRef" // 表格 ref便于后续通过 ref 调用原生方法
tableRef: "myTableRef", // 表格 ref便于后续通过 ref 调用原生方法
// 浮层相关
tooltipVisible: false,
tooltipStyle: {
top: '0px',
left: '0px'
},
hoveredRow: null,
columns: []
};
},
computed: {
floatLayerColumns() {
console.log(this.floatLayerConfig?.columns?.length > 1)
if (this.floatLayerConfig?.columns?.length > 1) {
return this.floatLayerConfig.columns
}
return this.columns;
}
},
methods: {
// 核心方法净化scope移除可能导致循环引用的属性
sanitizeScope(scope) {
@@ -136,7 +118,7 @@ export default {
if (obj === null || typeof obj !== "object") return obj;
if (obj instanceof Date) return new Date(obj);
if (obj instanceof RegExp) return new RegExp(obj);
// 避免处理Vue实例通常带有循环引用
if (obj._isVue) return { _isVue: true };
@@ -166,11 +148,48 @@ export default {
if (table && table.toggleRowSelection) {
table.toggleRowSelection(row, selected);
}
}
},
// 浮层相关
handleCellEnter(row, column, cell, event) {
if (!row || !event) return
this.hoveredRow = row
this.tooltipVisible = true
this.updateTooltipPosition(event)
},
handleRowLeave() {
this.tooltipVisible = false
this.hoveredRow = null
},
handleTableLeave() {
this.tooltipVisible = false
this.hoveredRow = null
},
updateTooltipPosition(event) {
this.$nextTick(() => {
const wrapper = this.$refs.elTableWrapper
if (!wrapper) return
const wrapperRect = wrapper.getBoundingClientRect()
let left = event.clientX - wrapperRect.left + 16
let top = event.clientY - wrapperRect.top + 12
this.tooltipStyle = {
top: `${top}px`,
left: `${left}px`
}
})
},
},
mounted() {
// 扩展点:后续可统一添加初始化逻辑(如权限控制、默认排序等)
console.log("MyTable 初始化完成,原生实例:", this.getTableInstance());
// console.log("MyTable 初始化完成,原生实例:", this.getTableInstance());
// 几个特殊的列,需要特殊处理 index, selection, action
const columns = this.$slots.default.filter(item => item.tag?.includes('ElTableColumn') && item.componentInstance && item.componentInstance.columnConfig && item.componentOptions && item.componentOptions.propsData).map(item => ({
...item.componentInstance.columnConfig,
...item.componentOptions.propsData
}))
this.columns = columns
}
};
</script>

View File

@@ -0,0 +1,4 @@
## 组件用法
1. 将原有的el-table标签改为KLPTable标签该组件已经全局注册可以直接使用无需带入。
2. 要展示浮层需要在表格组件上设置props,将floatLayer设置为true这时表格中有哪些列浮层就会展示哪些信息。
3. 如果需要单独设置浮层展示的信息例如展示表格中不存在但数据中存在的列需要在标签上增加一个props配置设置floatLayerConfig.columns为要展示的列示例[ { label: 'xxx', props: 'xxx.xxx' // 支持展示多层的数据 }, { label: '标签', props: 'xxx' } ]

View File

@@ -127,6 +127,7 @@ export default {
},
created() {
this.loadData()
console.log('this.slots', this.$slots)
},
methods: {
loadData() {

View File

@@ -137,7 +137,7 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<KLPTable v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<KLPTable v-loading="loading" :data="userList" @selection-change="handleSelectionChange" :floatLayer="true">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />

View File

@@ -534,8 +534,8 @@ export default {
const actionType = parseInt(row.actionType)
// 特殊处理:发货和移库操作不需要跳转
if (actionType === 4 || actionType === 5) {
this.$message.info(actionType === 4 ? '发货操作已在移动端完成' : '移库操作已在移动端完成')
if (actionType >= 400) {
this.$message.info('特殊操作序在对应页面完成')
return
}

View File

@@ -9,12 +9,7 @@
<!-- 选择产品 -->
<el-form label-width="100px">
<el-form-item label="钢卷" prop="coilId">
<el-button size="small" @click="showCoilSelector">
<i class="el-icon-search"></i> 选择钢卷
</el-button>
<span v-if="form.currentCoilNo" style="margin-left: 10px;">
<el-tag type="info">{{ form.currentCoilNo }}</el-tag>
</span>
<coil-selector v-model="form.coilId" :use-trigger="true" @select="handleItemChange" :filters="coilFilters"/>
</el-form-item>
</el-form>
<el-form ref="form" :model="form" :rules="rules" label-width="100px" disabled>
@@ -186,9 +181,6 @@
</el-col>
</el-row>
<!-- 钢卷选择器 -->
<coil-selector :visible.sync="coilSelectorVisible" @select="handleItemChange" :filters="coilFilters" />
</div>
</template>

View File

@@ -1,13 +1,25 @@
<template>
<div class="app-container">
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="10">
<div class="section-card">
<!-- 入库 -->
<div class="section-header">
<h3 class="section-title">新增入库</h3>
</div>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="收货计划" prop="planId">
<el-select style="width: 100%;" v-model="form.planId" placeholder="请输入计划名称搜索收货计划" filterable remote
:remote-method="remoteMethod">
<el-option v-for="item in planList" :key="item.planId" :label="item.planName"
:value="item.planId" />
</el-select>
</el-form-item>
<!-- 查找并选择选择收货计划, 使用远程搜索 -->
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="入场钢卷号" prop="enterCoilNo">
@@ -33,12 +45,12 @@
clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="实际库区" prop="actualWarehouseId">
<actual-warehouse-select v-model="form.actualWarehouseId" placeholder="请选择实际库区" style="width: 100%;"
clearable />
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="12">
<el-form-item label="班组" prop="team">
<el-input v-model="form.team" placeholder="请输入班组" />
@@ -118,10 +130,10 @@
</el-col>
<el-col :span="12">
<el-col :span="14">
<div class="section-card">
<!-- 入库记录 -->
<div class="section-header">
<div class="section-header">
<h3 class="section-title">入库记录</h3>
<el-button size="mini" icon="el-icon-refresh" @click="getList">刷新</el-button>
</div>
@@ -133,59 +145,91 @@
<el-button type="primary" @click="getList">查询</el-button>
</el-form-item>
</el-form>
<!-- 待操作卡片列表 -->
<div class="card-grid-container">
<div v-if="pendingActions.length === 0" class="empty-state">
<i class="el-icon-document"></i>
<p>暂无入库记录</p>
</div>
<div
v-for="(item, index) in pendingActions"
:key="item.actionId || index"
class="action-card"
:class="{
'urgent-card': item.priority === 2,
'important-card': item.priority === 1
}"
>
<div class="card-header">
<el-tag type="info" size="small" class="coil-no-tag">{{ item.currentCoilNo }}</el-tag>
</div>
<div class="card-body">
<div class="info-list">
<div class="info-item">
<span class="info-label">创建人</span>
<span class="info-value">{{ item.createBy || '—' }}</span>
</div>
<div class="info-item">
<span class="info-label">创建时间</span>
<span class="info-value">{{ parseTime(item.createTime, '{m}-{d} {h}:{i}') || '—' }}</span>
</div>
</div>
</div>
</div>
</div>
<Pagination v-show="total > 0" :total="total" :page.sync="pagination.currentPage"
<!-- 待操作卡片列表 -->
<div v-if="pendingActions.length === 0" v-loading="loading" class="empty-state">
<i class="el-icon-document"></i>
<p>暂无入库记录</p>
</div>
<el-table v-else v-loading="loading" border :data="pendingActions" highlight-current-row>
<el-table-column label="钢卷号" align="center" prop="currentCoilNo" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-tag type="info" size="small">{{ scope.row.currentCoilNo }}</el-tag>
</template>
</el-table-column>
<el-table-column label="优先级" align="center" prop="priority" width="90">
<template slot-scope="scope">
<el-tag v-if="scope.row.priority === 0" type="info" size="mini">普通</el-tag>
<el-tag v-else-if="scope.row.priority === 1" type="warning" size="mini">重要</el-tag>
<el-tag v-else-if="scope.row.priority === 2" type="danger" size="mini">紧急</el-tag>
</template>
</el-table-column>
<el-table-column label="新增时间" align="center" prop="createTime" width="155" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" width="100" />
<el-table-column label="操作状态" align="center" prop="actionStatus" width="120">
<template slot-scope="scope">
<el-tag v-if="scope.row.actionStatus === 2" type="success">已收货</el-tag>
<el-tag v-else type="primary">未收货</el-tag>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button v-if="scope.row.actionStatus == 0 || scope.row.actionStatus == 1" type="primary"
size="mini" @click="openReceiptModal(scope.row)">确认收货</el-button>
</template>
</el-table-column>
</el-table>
<Pagination v-show="total > 0" :total="total" :page.sync="pagination.pageNum"
:limit.sync="pagination.pageSize" @pagination="getList" />
</div>
</div>
</el-col>
</el-row>
<el-dialog title="确认收货" v-loading="loading" :visible.sync="receiptModalVisible" width="30%">
<el-form :model="coilInfo" ref="receiptFormRef" label-width="120px">
<el-form-item label="钢卷号" prop="currentCoilNo">
<el-input v-model="coilInfo.currentCoilNo" disabled placeholder="请输入钢卷号" />
</el-form-item>
<el-form-item label="净重" prop="netWeight">
<el-input v-model="coilInfo.netWeight" disabled placeholder="请输入净重" />
</el-form-item>
<el-form-item label="毛重" prop="grossWeight">
<el-input v-model="coilInfo.grossWeight" disabled placeholder="请输入毛重" />
</el-form-item>
<el-form-item label="实际库区" prop="actualWarehouseId">
<ActualWarehouseSelect v-model="coilInfo.actualWarehouseId" placeholder="请选择实际库区" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="coilInfo.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmReceipt" v-loading="buttonLoading">确认收货</el-button>
<el-button @click="receiptModalVisible = false">取消</el-button>
</template>
</el-dialog>
</div>
</template>
<script>
import { addMaterialCoil } from '@/api/wms/coil'
import { listPendingAction, addPendingAction } from '@/api/wms/pendingAction'
import { addMaterialCoil, updateMaterialCoilSimple, getMaterialCoil } from '@/api/wms/coil'
import { listPendingAction, addPendingAction, updatePendingAction } from '@/api/wms/pendingAction'
import MaterialSelect from "@/components/KLPService/MaterialSelect";
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import ProductSelect from "@/components/KLPService/ProductSelect";
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
import { Pagination } from 'element-ui';
import { listDeliveryPlan } from '@/api/wms/deliveryPlan'
// 键值为[400, 500), 不包含在字典中但后续可以加入的特殊操作这类操作录入后会立刻完成例如入库401和发货402
@@ -211,6 +255,7 @@ export default {
netWeight: null,
grossWeight: null,
remark: null,
dataType: 10, // 表示将要入库但是还未入库的钢卷,一般用于钢卷入库的操作去创建一个无法被检索到的钢卷
trimmingRequirement: null,
packingStatus: null,
packagingRequirement: null,
@@ -222,12 +267,15 @@ export default {
},
// 分页参数
pagination: {
currentPage: 1,
pageNum: 1,
pageSize: 10,
},
total: 0,
// 表单校验
rules: {
planId: [
{ required: true, message: "请选择收货计划", trigger: "change" }
],
enterCoilNo: [
{ required: true, message: "入场钢卷号不能为空", trigger: "blur" }
],
@@ -248,6 +296,18 @@ export default {
{ required: true, message: "毛重不能为空", trigger: "blur" }
],
},
planList: [],
// 确认收货表单参数
receiptModalVisible: false,
receiptForm: {
currentCoilNo: null,
netWeight: null,
grossWeight: null,
actualWarehouseId: null,
remark: null,
},
coilInfo: {},
}
},
mounted() {
@@ -276,6 +336,11 @@ export default {
this.form.itemType = 'raw_material';
}
},
remoteMethod(query) {
listDeliveryPlan({ planName: query, pageNum: 1, pageSize: 5, planType: 1 }).then(res => {
this.planList = res.rows
})
},
getList() {
// 获取入库历史
this.loading = true
@@ -292,13 +357,15 @@ export default {
this.buttonLoading = true;
addMaterialCoil(this.form).then(response => {
addPendingAction({
// 计划ID 对应 warehouseId warehouseId字段并不是仓库ID而是一个根据操作类型自适应的查询字段
warehouseId: this.form.planId,
actionType: 401,
currentCoilNo: this.form.currentCoilNo,
sourceType: 'manual',
coilId: response.data.coilId,
priority: 0,
remark: this.form.remark,
actionStatus: 2,
actionStatus: 0,
}).then(res => {
this.$modal.msgSuccess("入库成功");
this.getList()
@@ -309,6 +376,41 @@ export default {
}
});
},
// 打开收货弹窗
openReceiptModal(row) {
this.loading = true
// 打开确认收货弹窗
this.receiptModalVisible = true;
this.receiptForm = row;
// 根据钢卷id查询钢卷信息
getMaterialCoil(row.coilId).then(res => {
this.coilInfo = res.data;
this.loading = false
})
},
// 确认收货
confirmReceipt() {
// 二次确认
this.$modal.confirm("收货后刚钢卷会进入库存并占用所选的实际库区,是否继续?").then(() => {
this.buttonLoading = true;
// 更新操作记录状态 actionStatus: 2
updatePendingAction({
...this.receiptForm,
actionStatus: 2,
}).then(_ => {
this.$message.success("确认收货成功");
this.getList()
}).finally(() => {
this.buttonLoading = false;
});
// 更新钢卷状态为当前钢卷; dataType: 1
updateMaterialCoilSimple({
...this.coilInfo,
dataType: 1,
})
})
},
// 取消操作
cancel() {
this.form = {};
@@ -354,6 +456,7 @@ export default {
.section-header {
border-bottom-color: #409eff;
}
.section-title {
color: #409eff;
}
@@ -363,6 +466,7 @@ export default {
.section-header {
border-bottom-color: #67c23a;
}
.section-title {
color: #67c23a;
}
@@ -384,25 +488,25 @@ export default {
max-height: calc(100vh - 320px);
overflow-y: auto;
padding-right: 4px;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 3px;
}
&::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 3px;
&:hover {
background: #a8a8a8;
}
}
@media (min-width: 1600px) {
grid-template-columns: repeat(4, 1fr);
}
@@ -413,14 +517,14 @@ export default {
text-align: center;
padding: 60px 20px;
color: #909399;
i {
font-size: 48px;
margin-bottom: 16px;
display: block;
color: #c0c4cc;
}
p {
margin: 0;
font-size: 14px;
@@ -436,51 +540,51 @@ export default {
flex-direction: column;
transition: all 0.3s ease;
height: 100%;
&:hover {
border-color: #409eff;
box-shadow: 0 2px 6px rgba(64, 158, 255, 0.12);
}
.card-header {
padding: 6px 8px;
border-bottom: 1px solid #e4e7ed;
background-color: #fafafa;
.header-left {
display: flex;
align-items: center;
gap: 6px;
}
.coil-no-tag {
font-weight: 600;
font-size: 11px;
padding: 2px 6px;
}
.material-type {
font-size: 11px;
color: #606266;
font-weight: 500;
}
.param-icon {
font-size: 13px;
color: #909399;
cursor: pointer;
transition: color 0.3s;
&:hover {
color: #409eff;
}
}
}
.card-body {
padding: 8px;
flex: 1;
.info-list {
.info-item {
display: flex;
@@ -488,11 +592,11 @@ export default {
margin-bottom: 4px;
font-size: 11px;
line-height: 1.4;
&:last-child {
margin-bottom: 0;
}
.info-label {
color: #909399;
white-space: nowrap;
@@ -500,7 +604,7 @@ export default {
min-width: 40px;
font-size: 11px;
}
.info-value {
color: #303133;
flex: 1;
@@ -512,14 +616,14 @@ export default {
}
}
}
.card-footer {
padding: 6px 8px;
border-top: 1px solid #e4e7ed;
background-color: #fafafa;
display: flex;
justify-content: center;
.action-btn {
width: 100%;
padding: 5px 10px;
@@ -537,32 +641,32 @@ export default {
flex-direction: column;
transition: all 0.3s ease;
height: 100%;
&:hover {
border-color: #67c23a;
box-shadow: 0 2px 8px rgba(103, 194, 58, 0.15);
}
&.urgent-card {
border-left: 4px solid #f56c6c;
background-color: #fef0f0;
&:hover {
border-color: #f56c6c;
box-shadow: 0 2px 8px rgba(245, 108, 108, 0.2);
}
}
&.important-card {
border-left: 4px solid #e6a23c;
background-color: #fdf6ec;
&:hover {
border-color: #e6a23c;
box-shadow: 0 2px 8px rgba(230, 162, 60, 0.2);
}
}
.card-header {
padding: 10px 12px;
border-bottom: 1px solid #e4e7ed;
@@ -570,41 +674,41 @@ export default {
display: flex;
justify-content: space-between;
align-items: center;
.coil-no-tag {
font-weight: 600;
font-size: 12px;
}
.status-tags {
display: flex;
gap: 4px;
flex-wrap: wrap;
}
}
.card-body {
padding: 12px;
flex: 1;
.info-list {
.info-item {
display: flex;
align-items: center;
margin-bottom: 8px;
font-size: 12px;
&:last-child {
margin-bottom: 0;
}
.info-label {
color: #909399;
white-space: nowrap;
margin-right: 6px;
min-width: 50px;
}
.info-value {
color: #303133;
flex: 1;
@@ -612,14 +716,14 @@ export default {
text-overflow: ellipsis;
white-space: nowrap;
}
.action-type-tag {
font-size: 11px;
}
}
}
}
.card-footer {
padding: 10px 12px;
border-top: 1px solid #e4e7ed;
@@ -627,7 +731,7 @@ export default {
display: flex;
justify-content: center;
gap: 6px;
.action-btn {
flex: 1;
font-size: 12px;
@@ -656,7 +760,7 @@ export default {
padding-bottom: 8px;
border-bottom: 1px solid #e4e7ed;
}
.params-list {
.param-item {
.param-row {
@@ -664,17 +768,17 @@ export default {
margin-bottom: 6px;
font-size: 12px;
line-height: 1.5;
&:last-child {
margin-bottom: 0;
}
.param-label {
color: #909399;
min-width: 70px;
margin-right: 8px;
}
.param-value {
color: #303133;
flex: 1;
@@ -682,7 +786,7 @@ export default {
}
}
}
.param-divider {
height: 1px;
background-color: #e4e7ed;

View File

@@ -50,25 +50,25 @@
<div class="info-grid-item value-cell">
<input type="text" class="nob" :value="content.material || ''" />
</div>
<div class="info-grid-item label-cell">表面质量</div>
<div class="info-grid-item label-cell">质量要求</div>
<div class="info-grid-item value-cell">
<input type="text" class="nob" :value="content.surfaceQuality || ''" />
<input type="text" class="nob" :value="content.qualityStatus || ''" />
</div>
<!-- 第五行表面处理 + 剪切要求 -->
<div class="info-grid-item label-cell">表面处理</div>
<div class="info-grid-item value-cell">
<input type="text" class="nob" :value="content.surfaceTreatment || ''" />
<input type="text" class="nob" :value="content.surfaceTreatmentDesc || ''" />
</div>
<div class="info-grid-item label-cell">切要求</div>
<div class="info-grid-item label-cell">要求</div>
<div class="info-grid-item value-cell">
<input type="text" class="nob" :value="content.cuttingRequirements || ''" />
<input type="text" class="nob" :value="content.trimmingRequirement || ''" />
</div>
<!-- 第六行包装种类 + 毛重 -->
<div class="info-grid-item label-cell">包装种类</div>
<div class="info-grid-item label-cell">包装要求</div>
<div class="info-grid-item value-cell">
<input type="text" class="nob" :value="content.packagingType || ''" />
<input type="text" class="nob" :value="content.packagingRequirement || ''" />
</div>
<div class="info-grid-item label-cell">毛重</div>
<div class="info-grid-item value-cell">
@@ -88,7 +88,7 @@
<!-- 第八行生产日期跨3列 -->
<div class="info-grid-item label-cell">生产日期</div>
<div class="info-grid-item value-cell">
<input type="text" class="nob" :value="content.productionDate || ''" />
<input type="text" class="nob" :value="content.updateTime || ''" />
</div>
</div>
@@ -130,10 +130,10 @@ export default {
rawBlankNumber: '',
specification: '2.28*1250',
material: '',
surfaceQuality: '',
surfaceTreatment: '环保钝化/不涂油',
cuttingRequirements: '',
packagingType: 'A03',
qualityStatus: '',
surfaceTreatmentDesc: '环保钝化/不涂油',
trimmingRequirement: '',
packagingRequirement: 'A03',
grossWeight: '',
netWeight: '7080',
referenceLength: '320',

View File

@@ -10,6 +10,22 @@
<td class="value-cell" colspan="1">
<QRCode :content="content.qrcodeRecordId || ' '" :size="5" />
</td>
</tr>
<tr>
<td class="label-cell" colspan="2">逻辑库区</td>
<td class="value-cell" colspan="2">
<input type="text" class="nob" :value="content.warehouseName || ''" />
</td>
<!-- <td class="label-cell">实际库区</td>
<td class="value-cell">
<input type="text" class="nob" :value="content.actualWarehouseName || ''" />
</td> -->
</tr>
<tr>
<td class="label-cell" colspan="2">实际库区</td>
<td class="value-cell" colspan="2">
<input type="text" class="nob" :value="content.actualWarehouseName || ''" />
</td>
</tr>
<tr>
<td class="label-cell">规格(mm)</td>
@@ -38,7 +54,7 @@
</td>
<td class="label-cell">时间</td>
<td class="value-cell">
<input type="text" class="nob" :value="content.productionDate || ''" />
<input type="text" class="nob" :value="content.updateTime || ''" />
</td>
</tr>
</table>

View File

@@ -69,15 +69,15 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="materialCoilList" @selection-change="handleSelectionChange">
<KLPTable v-loading="loading" :data="materialCoilList" @selection-change="handleSelectionChange" :floatLayer="true" :floatLayerConfig="floatLayerConfig">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo" />
<el-table-column label="当前钢卷号" align="center" prop="currentCoilNo" />
<el-table-column label="厂家卷号" align="center" prop="supplierCoilNo" />
<!-- <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="materialType" />
<el-table-column label="产品类型" align="center" prop="itemName">
<!-- <el-table-column label="物料类型" align="center" prop="materialType" /> -->
<el-table-column label="产品类型" align="center">
<template slot-scope="scope">
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row.product">
<template slot-scope="{ product }">
@@ -107,14 +107,14 @@
</el-select>
</template>
</el-table-column>
<el-table-column label="班组" align="center" prop="team" />
<el-table-column label="毛重" align="center" prop="grossWeight" />
<el-table-column label="净重" align="center" prop="netWeight" />
<el-table-column v-if="querys.materialType === '成品'" label="质量状态" align="center" prop="qualityStatus" />
<!-- <el-table-column label="班组" align="center" prop="team" /> -->
<!-- <el-table-column label="毛重" align="center" prop="grossWeight" />
<el-table-column label="净重" align="center" prop="netWeight" /> -->
<!-- <el-table-column v-if="querys.materialType === '成品'" label="质量状态" align="center" prop="qualityStatus" />
<el-table-column v-if="querys.materialType === '成品'" label="切边要求" align="center" prop="trimmingRequirement" />
<el-table-column v-if="querys.materialType === '成品'" label="打包状态" align="center" prop="packingStatus" />
<el-table-column v-if="querys.materialType === '成品'" label="包装要求" align="center" prop="packagingRequirement" />
<el-table-column label="关联信息" align="center" prop="parentCoilNos" :show-overflow-tooltip="true">
<el-table-column v-if="querys.materialType === '成品'" label="包装要求" align="center" prop="packagingRequirement" /> -->
<el-table-column label="关联信息" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.parentCoilNos && scope.row.hasMergeSplit === 1 && scope.row.dataType === 1">
<el-tag type="warning" size="mini">来自母卷{{ scope.row.parentCoilNos }}</el-tag>
@@ -128,7 +128,7 @@
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<!-- <el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip/> -->
<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="handlePreviewLabel(scope.row)">
@@ -139,7 +139,7 @@
<el-button size="mini" type="text" icon="el-icon-search" @click="handleTrace(scope.row)">追溯</el-button>
</template>
</el-table-column>
</el-table>
</KLPTable>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
@@ -367,6 +367,25 @@ export default {
visible: false,
data: {},
type: '2'
},
floatLayerConfig: {
columns: [
{ label: '入场钢卷号', prop: 'enterCoilNo' },
{ label: '当前钢卷号', prop: 'currentCoilNo' },
{ label: '厂家卷号', prop: 'supplierCoilNo' },
{ label: '逻辑库位', prop: 'warehouseName' },
{ label: '实际库位', prop: 'actualWarehouseName' },
{ label: '物料类型', prop: 'materialType' },
{ label: '班组', prop: 'team' },
{ label: '净重', prop: 'netWeight' },
{ label: '毛重', prop: 'grossWeight' },
{ label: '备注', prop: 'remark' },
{ label: '质量状态', prop: 'qualityStatus' },
{ label: '打包状态', prop: 'packingStatus' },
{ label: '切边要求', prop: 'edgeRequirement' },
{ label: '包装要求', prop: 'packagingRequirement' }
],
title: '详细信息'
}
};
},
@@ -443,17 +462,13 @@ export default {
/** 预览标签 */
handlePreviewLabel(row) {
this.labelRender.visible = true;
const item = findItemWithBom(row.itemType, row.itemId)
// 寻找boms中bom键名为'材质'的
const material = item?.boms?.find(bom => bom.attrKey === '材质')
const item = row.itemType === 'product' ? row.product : row.rawMaterial;
const itemName = row.itemType === 'product' ? item?.productName || '' : item?.rawMaterialName || '';
console.log('规格', item)
this.labelRender.data = {
...row,
itemName: item?.itemName || '',
material: material?.attrValue || '',
specification: item?.specification || '',
itemName: itemName,
updateTime: row.updateTime?.split(' ')[0] || '',
};
},
/** 下载二维码 */

View File

@@ -0,0 +1,5 @@
<template>
<div>
囤积成本页面
</div>
</template>

View File

@@ -101,6 +101,13 @@
<p>1品名冷硬钢卷酸连轧冷轧钢卷脱脂退火火拉矫镀锌卷板镀锌管料镀锌分剪料2切边净边/毛边3包装裸包周三径四简包1周三径四内外护角简包2周三径四+防锈纸普包周三径四+内外护角+防锈纸+端护板精包1周三径四+内外护角+防锈纸+薄膜+端护板+内外护板精包2周三径四+内外护角+防锈纸+薄膜+端护板+内外护板+木托</p>
</div>
<div class="waybill-pickup-location">
<!-- <div class="pickup-location-item inline"> -->
<span class="label">取货地点</span>
<input type="text" class="editable-input full-input transparent-input" />
<!-- </div> -->
</div>
<!-- 签名栏 -->
<div class="waybill-footer">
<div class="footer-item inline">
@@ -539,6 +546,20 @@ export default {
font-size: 16px;
}
.waybill-pickup-location {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
font-size: 16px;
}
.waybill-pickup-location label {
font-size: 14px;
margin-right: 10px;
width: 40px;
}
.footer-item {
display: flex;
flex-direction: column;
@@ -563,6 +584,11 @@ export default {
min-width: 150px;
}
.full-input {
/* 占满本行的剩余空间父容器不是flex */
flex: 1;
}
/* 操作按钮样式 */
.waybill-actions {
display: flex;

View File

@@ -175,9 +175,13 @@ export default {
pageSize: 10,
planName: undefined,
planDate: undefined,
planType: 0,
},
// 表单参数
form: {},
form: {
planName: '',
planDate: '',
},
// 表单校验
rules: {
}
@@ -214,6 +218,7 @@ export default {
planId: undefined,
planName: undefined,
planDate: undefined,
planType: 0,
remark: undefined,
delFlag: undefined,
createTime: undefined,
@@ -247,6 +252,8 @@ export default {
this.form.planDate = new Date().toLocaleString().replace('T', ' ').replace().replace(/\//g, '-')
// 发货计划名称格式为年-月-日命名
this.form.planName = new Date().toLocaleDateString().replace(/\//g, '-') + '发货计划'
// 计划类型为发货计划
this.form.planType = 0
this.open = true;
this.title = "添加发货计划";
},

View File

@@ -50,11 +50,11 @@
v-loading="loading"
>
<el-table-column prop="productName" label="产品名称" min-width="120" fixed="left" />
<el-table-column prop="waybillCount" label="运单数量" min-width="100" align="center">
<!-- <el-table-column prop="waybillCount" label="运单数量" min-width="100" align="center">
<template #default="{ row }">
<span>{{ row.waybillCount || 0 }}</span>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column prop="coilCount" label="卷数" min-width="100" align="center">
<template #default="{ row }">
<span>{{ row.coilCount || 0 }}</span>
@@ -65,11 +65,11 @@
<span>{{ formatWeight(row.totalWeight) }}</span>
</template>
</el-table-column>
<el-table-column prop="dailyWaybillCount" label="日均运单数" min-width="120" align="right">
<!-- <el-table-column prop="dailyWaybillCount" label="日均运单数" min-width="120" align="right">
<template #default="{ row }">
<span>{{ formatDailyValue(row.dailyWaybillCount) }}</span>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column prop="dailyCoilCount" label="日均卷数" min-width="120" align="right">
<template #default="{ row }">
<span>{{ formatDailyValue(row.dailyCoilCount) }}</span>
@@ -112,11 +112,12 @@ export default {
initDateRange() {
const now = new Date()
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1)
const lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0)
// const lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0)
const today = new Date()
this.dateRange = [
this.formatDate(firstDay),
this.formatDate(lastDay)
this.formatDate(today)
]
},

View File

@@ -82,13 +82,12 @@
<DeliveryWaybillDetail ref="detailTable" :waybillId="waybillId" />
</el-card>
</el-col>
</el-row>
<!-- 添加或修改发货单对话框 -->
<!-- 添加或修改发货单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="发货单名称" prop="waybillName">
@@ -168,7 +167,7 @@ export default {
showSearch: true,
// 总条数
total: 0,
// 发货单表格数据
// 发货单表格数据
deliveryWaybillList: [],
waybillId: null,
// 打印相关数据
@@ -213,7 +212,8 @@ export default {
planQueryParams: {
pageNum: 1,
pageSize: 100, // 增大分页大小以确保树形结构显示足够数据
planName: undefined
planName: undefined,
planType: 0,
}
};
},
@@ -222,7 +222,7 @@ export default {
this.getPlanList();
},
methods: {
/** 查询发货单列表 */
/** 查询发货单列表 */
getList() {
this.loading = true;
// 确保查询参数包含planId
@@ -334,7 +334,7 @@ export default {
}
}
this.open = true;
this.title = "添加发货单";
this.title = "添加发货单";
},
/** 修改按钮操作 */
handleUpdate(row) {
@@ -345,7 +345,7 @@ export default {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "修改发货单";
this.title = "修改发货单";
});
},
/** 提交按钮 */
@@ -376,7 +376,7 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const waybillIds = row.waybillId || this.ids;
this.$modal.confirm('是否确认删除发货单编号为"' + waybillIds + '"的数据项?').then(() => {
this.$modal.confirm('是否确认删除发货单编号为"' + waybillIds + '"的数据项?').then(() => {
this.loading = true;
return delDeliveryWaybill(waybillIds);
}).then(() => {

View File

@@ -0,0 +1,609 @@
<template>
<div class="import-wizard-container">
<!-- 导入模式选择 -->
<div class="import-mode-selector">
<el-radio-group v-model="importMode" @change="reset">
<el-radio label="validate">校验导入推荐</el-radio>
<el-radio label="direct">直接导入不校验</el-radio>
</el-radio-group>
</div>
<!-- 文件上传区域 -->
<div class="file-upload-area" :class="{ disabled: importStatus === 'processing' }">
<el-upload
ref="upload"
class="upload-excel"
action=""
:auto-upload="false"
:show-file-list="false"
:on-change="handleFileChange"
accept=".xlsx,.xls"
:disabled="importStatus === 'processing'"
>
<el-button type="primary" icon="el-icon-upload2">选择Excel文件</el-button>
</el-upload>
<!-- 操作按钮 -->
<el-button
type="success"
icon="el-icon-check"
@click="handleValidate"
v-if="file && importMode === 'validate' && importStatus === 'idle'"
:disabled="!file"
>
校验数据
</el-button>
<el-button
type="warning"
icon="el-icon-circle-check"
@click="startImport"
v-if="file && (importMode === 'direct' || (importMode === 'validate' && errorList.length === 0)) && importStatus === 'idle'"
:disabled="!file || (importMode === 'validate' && errorList.length > 0)"
>
开始导入
</el-button>
<el-button
type="default"
icon="el-icon-refresh"
@click="reset"
:disabled="importStatus === 'processing'"
>
重置
</el-button>
</div>
<!-- 校验错误提示 -->
<div v-if="errorList.length > 0" class="error-list">
<el-alert
title="数据校验失败"
type="error"
description="以下行数据不符合格式要求,请修正后重新导入:"
show-icon
/>
<el-table :data="errorList" border size="small" max-height="200">
<el-table-column prop="rowNum" label="行号" width="80" />
<el-table-column prop="errorMsg" label="错误信息" />
</el-table>
</div>
<!-- 数据预览 -->
<div v-if="tableData.length > 0 && importStatus === 'idle'" class="data-preview">
<el-alert
title="数据预览"
type="info"
:description="`共解析出 ${tableData.length} 条有效数据`"
show-icon
:closable="false"
/>
<el-table :data="tableData" border size="small" max-height="300" stripe>
<el-table-column prop="type" label="类型" width="80" />
<el-table-column prop="logicWarehouse" label="逻辑库区" width="120" />
<el-table-column prop="inboundCoilNo" label="入场卷号" width="150" />
<el-table-column prop="factoryCoilNo" label="厂家卷号" width="150" />
<el-table-column prop="weight" label="重量(吨)" width="120" />
<el-table-column prop="remark" label="备注" min-width="100" />
<el-table-column prop="name" label="名称" min-width="100" />
<el-table-column prop="specification" label="规格" min-width="100" />
<el-table-column prop="material" label="材质" width="100" />
<el-table-column prop="manufacturer" label="厂家" min-width="100" />
<el-table-column prop="surfaceTreatmentDesc" label="表面处理" width="120" />
<el-table-column prop="zincLayer" label="锌层" width="100" />
</el-table>
</div>
<!-- 导入进度展示 -->
<div v-if="importStatus === 'processing'" class="import-progress">
<el-alert
title="正在导入数据"
type="warning"
:description="`当前进度:${progress}%`"
show-icon
:closable="false"
/>
<el-progress :percentage="progress" status="success" />
<p class="progress-tip">已导入 {{ importedCount }} / {{ totalCount }} 条数据</p>
</div>
<!-- 导入完成提示 -->
<div v-if="importStatus === 'finished'" class="import-finished">
<el-alert
title="导入完成"
type="success"
:description="`共成功导入 ${importedCount} 条数据,总计 ${totalCount} 条`"
show-icon
/>
</div>
<!-- 导入失败提示 -->
<div v-if="importStatus === 'error'" class="import-error">
<el-alert
title="导入失败"
type="error"
:description="importErrorMsg"
show-icon
/>
</div>
</div>
</template>
<script>
import * as XLSX from 'xlsx';
import { addMaterialCoil } from '@/api/wms/coil';
import { addPendingAction } from '@/api/wms/pendingAction';
import { listRawMaterial } from '@/api/wms/rawMaterial';
import { listProduct } from '@/api/wms/product';
export default {
name: 'MaterialCoilImportWizard',
data() {
return {
// 导入模式validate-校验导入 direct-直接导入
importMode: 'validate',
// 文件对象
file: null,
// 解析后的原始数据
rawData: [],
// 格式化后用于展示/导入的数据
tableData: [],
// 校验错误列表
errorList: [],
// 导入进度0-100
progress: 0,
// 已导入条数
importedCount: 0,
// 总数据条数
totalCount: 0,
// 导入状态idle-闲置 processing-处理中 finished-完成 error-失败
importStatus: 'idle',
// 导入错误信息
importErrorMsg: '',
// 规定的表头(顺序和名称必须匹配)
requiredHeaders: [
'类型', '逻辑库区', '入场卷号', '厂家卷号', '重量(吨)', '备注',
'名称', '规格', '材质', '厂家', '表面处理', '锌层'
],
// 表头映射(中文表头 -> 字段名)
headerMap: {
'类型': 'type',
'逻辑库区': 'logicWarehouse',
'入场卷号': 'inboundCoilNo',
'厂家卷号': 'factoryCoilNo',
'重量(吨)': 'weight',
'备注': 'remark',
'名称': 'name',
'规格': 'specification',
'材质': 'material',
'厂家': 'manufacturer',
'表面处理': 'surfaceTreatmentDesc',
'锌层': 'zincLayer'
}
};
},
methods: {
/**
* 处理文件选择
*/
handleFileChange(file) {
this.file = file.raw;
// 选择文件后自动读取Excel
this.readExcel();
},
/**
* 读取Excel文件内容
*/
async readExcel() {
if (!this.file) return;
try {
const fileReader = new FileReader();
fileReader.readAsArrayBuffer(this.file);
fileReader.onload = async (e) => {
try {
const data = new Uint8Array(e.target.result);
const workbook = XLSX.read(data, { type: 'array' });
// 取第一个sheet
const sheetName = workbook.SheetNames[0];
const worksheet = workbook.Sheets[sheetName];
// 解析为JSON跳过表头从第二行开始
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1 });
// 校验表头
this.validateHeaders(jsonData[0]);
// 解析数据行(从第二行开始)
this.rawData = jsonData.slice(1).filter(row => row.length > 0); // 过滤空行
// 格式化数据
this.formatExcel();
this.$message.success(`成功解析Excel共读取到 ${this.rawData.length} 条数据`);
} catch (error) {
this.$message.error(`解析Excel失败${error.message}`);
this.importStatus = 'error';
this.importErrorMsg = `解析Excel失败${error.message}`;
}
};
} catch (error) {
this.$message.error(`读取文件失败:${error.message}`);
this.importStatus = 'error';
this.importErrorMsg = `读取文件失败:${error.message}`;
}
},
/**
* 校验表头是否匹配
*/
validateHeaders(headers) {
this.errorList = [];
// 校验表头数量和名称
if (headers.length !== this.requiredHeaders.length) {
this.errorList.push({
rowNum: 1,
errorMsg: `表头数量不匹配,要求${this.requiredHeaders.length}列,实际${headers.length}`
});
return;
}
// 校验每列表头名称
headers.forEach((header, index) => {
if (header !== this.requiredHeaders[index]) {
this.errorList.push({
rowNum: 1,
errorMsg: `${index + 1}列表头错误,要求:"${this.requiredHeaders[index]}",实际:"${header}"`
});
}
});
if (this.errorList.length > 0) {
this.$message.error('Excel表头格式不符合要求请检查');
}
},
/**
* 校验Excel数据格式
*/
async validateExcel() {
if (this.rawData.length === 0) {
this.$message.warning('暂无数据可校验');
return;
}
this.errorList = [];
// 逐行校验
for (let i = 0; i < this.rawData.length; i++) {
const row = this.rawData[i];
const rowNum = i + 2; // 数据行从第二行开始,行号=索引+2
const rowObj = this.formatRowData(row, rowNum);
// 1. 校验必填项
const requiredFields = [
{ key: 'type', label: '类型', value: rowObj.type },
{ key: 'logicWarehouse', label: '逻辑库区', value: rowObj.logicWarehouse },
{ key: 'inboundCoilNo', label: '入场卷号', value: rowObj.inboundCoilNo },
{ key: 'name', label: '名称', value: rowObj.name },
{ key: 'specification', label: '规格', value: rowObj.specification },
];
// 检查必填项为空
for (const field of requiredFields) {
if (!field.value || field.value.toString().trim() === '') {
this.errorList.push({
rowNum,
errorMsg: `${field.label}不能为空`
});
}
}
// 2. 校验类型只能是“原料”或“成品”
if (rowObj.type && !['原料', '成品'].includes(rowObj.type.trim())) {
this.errorList.push({
rowNum,
errorMsg: '类型只能是"原料"或"成品"'
});
}
// 3. 校验重量是数字且大于0
if (rowObj.weight) {
const weight = Number(rowObj.weight);
if (isNaN(weight) || weight <= 0) {
this.errorList.push({
rowNum,
errorMsg: '重量必须是大于0的数字'
});
}
} else {
this.errorList.push({
rowNum,
errorMsg: '重量不能为空'
});
}
// 4. 预校验itemId是否存在仅校验模式
if (rowObj.type && ['原料', '成品'].includes(rowObj.type.trim()) && !this.errorList.some(err => err.rowNum === rowNum)) {
const itemId = await this._findItemId(rowObj);
if (!itemId) {
this.errorList.push({
rowNum,
errorMsg: `未找到唯一匹配的${rowObj.type}(名称:${rowObj.name},规格:${rowObj.specification}`
});
}
}
}
if (this.errorList.length > 0) {
this.$message.error(`数据校验失败,共发现${this.errorList.length}条错误`);
} else {
this.$message.success('数据校验通过,可以开始导入');
}
},
/**
* 格式化Excel行数据
*/
formatExcel() {
this.tableData = [];
if (this.rawData.length === 0) return;
// 逐行格式化
this.rawData.forEach((row, index) => {
const rowNum = index + 2;
const rowObj = this.formatRowData(row, rowNum);
this.tableData.push(rowObj);
});
},
/**
* 格式化单行数据
*/
formatRowData(row, rowNum) {
const rowObj = {};
// 映射表头和字段
this.requiredHeaders.forEach((header, index) => {
const field = this.headerMap[header];
// 处理空值,统一转为字符串
rowObj[field] = row[index] ? row[index].toString().trim() : '';
});
// 重量转数字
rowObj.weight = rowObj.weight ? Number(rowObj.weight) : 0;
// 增加行号
rowObj.rowNum = rowNum;
return rowObj;
},
/**
* 处理校验按钮点击
*/
async handleValidate() {
if (!this.file) {
this.$message.warning('请先选择Excel文件');
return;
}
await this.validateExcel();
},
/**
* 开始导入数据
*/
async startImport() {
if (!this.file || this.tableData.length === 0) {
this.$message.warning('暂无数据可导入');
return;
}
// 直接导入模式下先快速校验基础格式
if (this.importMode === 'direct') {
await this.validateExcel();
if (this.errorList.length > 0) {
this.$message.error('直接导入模式下基础格式校验失败,请修正');
return;
}
}
// 初始化导入状态
this.importStatus = 'processing';
this.progress = 0;
this.importedCount = 0;
this.totalCount = this.tableData.length;
this.importErrorMsg = '';
try {
await this.batchImport();
this.importStatus = 'finished';
this.$message.success(`导入完成!共成功导入${this.importedCount}条数据`);
} catch (error) {
this.importStatus = 'error';
this.importErrorMsg = `导入失败:${error.message},已导入${this.importedCount}条数据`;
this.$message.error(this.importErrorMsg);
}
},
/**
* 批量导入数据
*/
async batchImport() {
// 遍历所有数据行,逐个导入
for (let i = 0; i < this.tableData.length; i++) {
if (this.importStatus === 'error') break; // 发生错误则停止
const row = this.tableData[i];
try {
await this.importOneRecord(row);
this.importedCount++;
// 更新进度
this.progress = Math.round(((i + 1) / this.totalCount) * 100);
} catch (error) {
// 单条失败可选择继续或终止,这里选择终止
throw new Error(`${row.rowNum}行导入失败:${error.message}`);
}
}
},
/**
* 导入单条记录
*/
async importOneRecord(row) {
try {
// 1. 查找itemId
const itemId = await this._findItemId(row);
if (!itemId) {
throw new Error(`未找到唯一的${row.type}信息`);
}
const itemType = row.type === '原料' ? 'raw_material' : 'product';
// 2. 插入钢卷数据dataType=10
const coilParams = {
itemId,
itemType,
logicWarehouse: row.logicWarehouse,
inboundCoilNo: row.inboundCoilNo,
factoryCoilNo: row.factoryCoilNo,
weight: row.weight,
remark: row.remark,
dataType: 10 // 钢卷数据类型固定为10
};
const coilRes = await addMaterialCoil(coilParams);
if (!coilRes.success) { // 假设接口返回success标识
throw new Error(`钢卷数据插入失败:${coilRes.message || '接口返回异常'}`);
}
const coilId = coilRes.data?.coilId; // 假设返回钢卷ID
// 3. 插入待处理操作actionStatus=0
const actionParams = {
coilId,
actionStatus: 0, // 待处理状态固定为0
itemType,
itemId,
operationType: 'import', // 操作类型:导入
remark: `Excel导入${row.inboundCoilNo}`
};
const actionRes = await addPendingAction(actionParams);
if (!actionRes.success) {
throw new Error(`待处理操作插入失败:${actionRes.message || '接口返回异常'}`);
}
} catch (error) {
throw new Error(error.message);
}
},
/**
* 根据条件查找唯一的itemId
*/
async _findItemId(row) {
const itemType = row.type === '原料' ? 'raw_material' : 'product';
let res = null;
try {
if (itemType === 'raw_material') {
res = await listRawMaterial({
rawMaterialName: row.name,
specification: row.specification,
material: row.material,
manufacturer: row.manufacturer,
surfaceTreatmentDesc: row.surfaceTreatmentDesc,
zincLayer: row.zincLayer
});
} else {
res = await listProduct({
productName: row.name,
specification: row.specification,
material: row.material,
manufacturer: row.manufacturer,
surfaceTreatmentDesc: row.surfaceTreatmentDesc,
zincLayer: row.zincLayer
});
}
// 校验返回结果数量
// 如果锌层,表面处理,厂家未传递,则需要从结果中取出这些值未空的记录
const record = res.data.filter(item =>
(!row.zincLayer || item.zincLayer === row.zincLayer) &&
(!row.surfaceTreatmentDesc || item.surfaceTreatmentDesc === row.surfaceTreatmentDesc) &&
(!row.manufacturer || item.manufacturer === row.manufacturer)
);
if (record.length !== 1) {
return null;
}
// 返回对应ID
return itemType === 'raw_material'
? res.data[0].rawMaterialId
: res.data[0].productId;
} catch (error) {
this.$message.error(`查询${row.type}信息失败:${error.message}`);
return null;
}
},
/**
* 重置所有状态
*/
reset() {
this.file = null;
this.rawData = [];
this.tableData = [];
this.errorList = [];
this.progress = 0;
this.importedCount = 0;
this.totalCount = 0;
this.importStatus = 'idle';
this.importErrorMsg = '';
this.$refs.upload?.clearFiles(); // 清空上传组件文件
}
}
};
</script>
<style scoped>
.import-wizard-container {
padding: 20px;
background: #fff;
border-radius: 4px;
}
.import-mode-selector {
margin-bottom: 20px;
padding: 10px;
background: #f5f7fa;
border-radius: 4px;
}
.file-upload-area {
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 10px;
}
.file-upload-area.disabled {
opacity: 0.6;
pointer-events: none;
}
.error-list {
margin-bottom: 20px;
}
.data-preview {
margin-bottom: 20px;
}
.import-progress {
margin-bottom: 20px;
padding: 10px;
background: #f5f7fa;
border-radius: 4px;
}
.progress-tip {
margin: 10px 0 0 0;
color: #666;
font-size: 14px;
}
.import-finished, .import-error {
margin-bottom: 20px;
}
</style>

View File

@@ -0,0 +1,366 @@
<template>
<div class="app-container">
<el-row :gutter="10">
<el-col :span="6">
<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>
</span>
</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" />
</el-card>
</el-col>
<el-col :span="18">
<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="success" plain icon="el-icon-refresh" size="mini" @click="handleQuery">刷新</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
:disabled="!selectedPlan" title="导入收货计划">导入</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>
<el-table-column label="钢卷号" align="center" prop="currentCoilNo" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-tag type="info" size="small">{{ scope.row.currentCoilNo }}</el-tag>
</template>
</el-table-column>
<el-table-column label="优先级" align="center" prop="priority">
<template slot-scope="scope">
<el-tag v-if="scope.row.priority === 0" type="info" size="mini">普通</el-tag>
<el-tag v-else-if="scope.row.priority === 1" type="warning" size="mini">重要</el-tag>
<el-tag v-else-if="scope.row.priority === 2" type="danger" size="mini">紧急</el-tag>
</template>
</el-table-column>
<el-table-column label="来源" align="center" prop="sourceType">
<template slot-scope="scope">
<el-tag v-if="scope.row.sourceType === 'scan'" type="success" size="mini">
<i class="el-icon-mobile"></i> 扫码
</el-tag>
<el-tag v-else type="info" size="mini">
<i class="el-icon-edit-outline"></i> 手动
</el-tag>
</template>
</el-table-column>
<el-table-column label="新增时间" align="center" prop="createTime" width="155" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" width="100" />
<el-table-column label="操作状态" align="center" prop="actionStatus" width="120">
<template slot-scope="scope">
<el-tag v-if="scope.row.actionStatus === 2" type="success">已收货</el-tag>
<el-tag v-else type="primary">未收货</el-tag>
</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.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" />
</el-card>
</el-col>
</el-row>
<!-- 先做导入功能通过一个钢卷的excel文件导入, 全屏弹窗 -->
<el-dialog title="导入收货计划" :visible.sync="importDialogVisible" width="80%" >
<ImportGuide />
</el-dialog>
</div>
</template>
<script>
import { listDeliveryPlan } from "@/api/wms/deliveryPlan"; // 导入收货计划API
import { listPendingAction } from '@/api/wms/pendingAction';
import MemoInput from "@/components/MemoInput";
import ImportGuide from "@/views/wms/receive/components/ImportGuide.vue";
export default {
name: "DeliveryWaybill",
components: {
MemoInput,
ImportGuide
},
data() {
return {
// 按钮loading
buttonLoading: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 收货单表格数据
deliveryWaybillList: [],
waybillId: null,
// 打印相关数据
printDialogVisible: false,
currentWaybill: {},
currentWaybillDetails: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
waybillNo: undefined,
waybillName: undefined,
licensePlate: undefined,
consigneeUnit: undefined,
senderUnit: undefined,
deliveryTime: undefined,
weighbridge: undefined,
salesPerson: undefined,
principal: undefined,
principalPhone: undefined,
status: undefined,
planId: undefined
},
// 表单参数
form: {},
// 表单校验
rules: {},
// 收货计划相关数据
planList: [],
planTreeData: [],
planTreeProps: {
label: 'planName',
children: 'children'
},
planTotal: 0,
planLoading: false,
selectedPlan: null,
planQueryParams: {
pageNum: 1,
pageSize: 100, // 增大分页大小以确保树形结构显示足够数据
planName: undefined,
planType: 1,
},
// 导入弹窗
importDialogVisible: false,
};
},
created() {
this.getList();
this.getPlanList();
},
methods: {
/** 查询收货单列表 */
getList() {
this.loading = true;
// 确保查询参数包含planId
const params = {
...this.queryParams,
actionType: 401, // 401表示钢卷入库
// 如果选中了计划将计划作为查询条件虽然字段名交warehouseId但实际存储的是计划Id
warehouseId: this.selectedPlan ? this.selectedPlan.planId : undefined
};
listPendingAction(params).then(response => {
this.deliveryWaybillList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
waybillId: undefined,
waybillNo: new Date().getTime(),
waybillName: undefined,
planId: undefined,
licensePlate: undefined,
consigneeUnit: undefined,
senderUnit: '科伦普',
deliveryTime: undefined,
weighbridge: undefined,
salesPerson: undefined,
principal: undefined,
principalPhone: undefined,
status: undefined,
remark: undefined,
delFlag: undefined,
createTime: undefined,
createBy: undefined,
updateTime: undefined,
updateBy: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
// 重置查询时保留planId
if (this.selectedPlan) {
this.queryParams.planId = this.selectedPlan.planId;
}
this.handleQuery();
},
// 获取收货计划列表
getPlanList() {
this.planLoading = true;
listDeliveryPlan(this.planQueryParams).then(response => {
this.planList = response.rows;
this.planTotal = response.total;
// 转换为树形数据格式
this.planTreeData = response.rows;
this.planLoading = false;
});
},
// 收货计划搜索
handlePlanQuery() {
this.planQueryParams.pageNum = 1;
this.getPlanList();
},
// 收货计划重置
resetPlanQuery() {
this.planQueryParams.planName = undefined;
this.handlePlanQuery();
},
handlePlanSelect(row) {
this.selectedPlan = row;
// 更新查询参数根据选中的planId筛选收货单
this.queryParams.planId = row.planId;
this.waybillId = null;
this.getList();
},
handleRowClick(row) {
this.waybillId = row.waybillId;
},
/** 新增按钮操作 */
handleAdd() {
this.importDialogVisible = true;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const waybillId = row.waybillId || this.ids
getDeliveryWaybill(waybillId).then(response => {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "修改收货单";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buttonLoading = true;
if (this.form.waybillId != null) {
updateDeliveryWaybill(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addDeliveryWaybill(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const waybillIds = row.waybillId || this.ids;
this.$modal.confirm('是否确认删除收货单编号为"' + waybillIds + '"的数据项?').then(() => {
this.loading = true;
return delDeliveryWaybill(waybillIds);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('wms/deliveryWaybill/export', {
...this.queryParams
}, `deliveryWaybill_${new Date().getTime()}.xlsx`)
},
}
};
</script>
<style scoped>
.plan-container {
padding: 10px;
height: 100%;
border-right: 1px solid #ebeef5;
}
.plan-container h3 {
margin: 0 0 10px 0;
padding: 0;
font-size: 16px;
font-weight: 500;
}
</style>

View File

@@ -0,0 +1,318 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="计划名称" prop="planName">
<el-input v-model="queryParams.planName" placeholder="请输入收货计划名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="计划日期" prop="planDate">
<el-date-picker clearable v-model="queryParams.planDate" type="date" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划日期">
</el-date-picker>
</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-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single"
@click="handleUpdate">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
@click="handleDelete">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-row :gutter="20" v-loading="loading">
<el-col :span="6" v-for="(row, index) in deliveryPlanList" :key="row.planId">
<el-card shadow="hover" class="delivery-plan-card">
<div class="card-header">
<el-checkbox v-model="row.selected" @change="handleCardSelectionChange(row)"></el-checkbox>
<div class="card-title">{{ row.planName }}</div>
</div>
<div class="card-content">
<div class="content-item">
<span class="label">计划日期</span>
<span>{{ parseTime(row.planDate, '{y}-{m}-{d}') }}</span>
</div>
<div class="content-item">
<span class="label">备注</span>
<span>{{ row.remark || '-' }}</span>
</div>
<div class="content-item">
<span class="label">创建人</span>
<span>{{ row.createBy }}</span>
</div>
<div class="content-item">
<span class="label">更新时间</span>
<span>{{ parseTime(row.updateTime, '{y}-{m}-{d}') }}</span>
</div>
</div>
<div class="card-actions">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(row)">删除</el-button>
</div>
</el-card>
</el-col>
</el-row>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 添加或修改收货计划对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="收货计划名称" prop="planName">
<el-input v-model="form.planName" placeholder="请输入收货计划名称" />
</el-form-item>
<el-form-item label="计划日期" prop="planDate">
<el-date-picker clearable v-model="form.planDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划日期">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDeliveryPlan, getDeliveryPlan, delDeliveryPlan, addDeliveryPlan, updateDeliveryPlan } from "@/api/wms/deliveryPlan";
export default {
name: "DeliveryPlan",
data() {
return {
// 按钮loading
buttonLoading: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 收货计划表格数据
deliveryPlanList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
planName: undefined,
planDate: undefined,
planType: 1
},
// 表单参数
form: {
planName: '',
planDate: '',
},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询收货计划列表 */
getList() {
this.loading = true;
listDeliveryPlan(this.queryParams).then(response => {
this.deliveryPlanList = response.rows.map(item => ({
...item,
selected: false
}));
this.total = response.total;
this.loading = false;
// 重置选择状态
this.ids = [];
this.single = true;
this.multiple = true;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
planId: undefined,
planName: undefined,
planDate: undefined,
planType: 1,
remark: undefined,
delFlag: undefined,
createTime: undefined,
createBy: undefined,
updateTime: undefined,
updateBy: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 卡片选择处理
handleCardSelectionChange(row) {
// 重新计算选中的ID数组
this.ids = this.deliveryPlanList.filter(item => item.selected).map(item => item.planId);
this.single = this.ids.length !== 1;
this.multiple = !this.ids.length;
},
/** 新增按钮操作 */
handleAdd() {
// this.reset();
// 默认选中今天的日期和时间, 格式化未yyyy-MM-dd HH:mm:ss
this.form.planDate = new Date().toLocaleString().substring(0, 19).replace(/\//g, '-').replace('T', ' ')
console.log(this.form.planDate, 'this.form.planDate')
// 收货计划名称格式为年-月-日命名
this.form.planName = new Date().toLocaleDateString().replace(/\//g, '-') + '收货计划'
// 计划类型为收货计划
this.form.planType = 1
this.open = true;
this.title = "添加收货计划";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const planId = row.planId || this.ids
getDeliveryPlan(planId).then(response => {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "修改收货计划";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buttonLoading = true;
if (this.form.planId != null) {
updateDeliveryPlan(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addDeliveryPlan(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const planIds = row.planId || this.ids;
this.$modal.confirm('是否确认删除收货计划编号为"' + planIds + '"的数据项?').then(() => {
this.loading = true;
return delDeliveryPlan(planIds);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('wms/deliveryPlan/export', {
...this.queryParams
}, `deliveryPlan_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style scoped>
.delivery-plan-card {
margin-bottom: 20px;
height: 100%;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.card-title {
font-size: 16px;
font-weight: bold;
color: #333;
}
.card-content {
margin-bottom: 20px;
}
.content-item {
margin-bottom: 10px;
display: flex;
align-items: flex-start;
}
.content-item:last-child {
margin-bottom: 0;
}
.label {
width: 80px;
font-weight: 500;
color: #606266;
margin-right: 10px;
}
.card-actions {
display: flex;
justify-content: flex-end;
gap: 10px;
}
</style>

View File

@@ -34,6 +34,10 @@ public class WmsDeliveryPlan extends BaseEntity {
* 计划日期
*/
private Date planDate;
/**
* 计划类型: 发货0收货1
*/
private Integer planType;
/**
* 备注
*/

View File

@@ -28,6 +28,7 @@ public class WmsCoilPendingActionBo extends BaseEntity {
/**
* 关联的钢卷ID
*/
// 对于入库操作这个时候还不存在钢卷因此无法关联钢卷ID因此先关联为0如果id为0则跟未关联是相同的
@NotNull(message = "关联的钢卷ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long coilId;

View File

@@ -33,6 +33,10 @@ public class WmsDeliveryPlanBo extends BaseEntity {
* 计划日期
*/
private Date planDate;
/**
* 计划类型
*/
private Integer planType;
/**
* 备注

View File

@@ -43,6 +43,12 @@ public class WmsDeliveryPlanVo extends BaseEntity {
@ExcelProperty(value = "计划日期")
private Date planDate;
/**
* 计划类型
*/
@ExcelProperty(value = "计划类型")
private Integer planType;
/**
* 备注
*/

View File

@@ -65,6 +65,7 @@ public class WmsDeliveryPlanServiceImpl implements IWmsDeliveryPlanService {
LambdaQueryWrapper<WmsDeliveryPlan> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getPlanName()), WmsDeliveryPlan::getPlanName, bo.getPlanName());
lqw.eq(bo.getPlanDate() != null, WmsDeliveryPlan::getPlanDate, bo.getPlanDate());
lqw.eq(bo.getPlanType() != null, WmsDeliveryPlan::getPlanType, bo.getPlanType());
return lqw;
}

View File

@@ -8,6 +8,7 @@
<result property="planId" column="plan_id"/>
<result property="planName" column="plan_name"/>
<result property="planDate" column="plan_date"/>
<result property="planType" column="plan_type"/>
<result property="remark" column="remark"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>