diff --git a/klp-ui/src/api/wms/deliveryWaybillDetail.js b/klp-ui/src/api/wms/deliveryWaybillDetail.js index bc7c7a59..ed6227ef 100644 --- a/klp-ui/src/api/wms/deliveryWaybillDetail.js +++ b/klp-ui/src/api/wms/deliveryWaybillDetail.js @@ -42,3 +42,12 @@ export function delDeliveryWaybillDetail(detailId) { method: 'delete' }) } + +// 批量新增发货单明细 +export function batchAddDeliveryWaybillDetail(data) { + return request({ + url: '/wms/deliveryWaybillDetail/batch', + method: 'post', + data: data + }) +} \ No newline at end of file diff --git a/klp-ui/src/components/CoilSelector/index.vue b/klp-ui/src/components/CoilSelector/index.vue index 915dfd27..957d848e 100644 --- a/klp-ui/src/components/CoilSelector/index.vue +++ b/klp-ui/src/components/CoilSelector/index.vue @@ -2,23 +2,25 @@
- - - - - {{ selectedCoil.currentCoilNo }} - ({{ selectedCoil.itemName }}) - [{{ selectedCoil.netWeight }}t] - - {{ placeholder }} - - +
+ + + + + {{ selectedCoil.currentCoilNo }} + ({{ selectedCoil.itemName }}) + [{{ selectedCoil.netWeight }}t] + + {{ placeholder }} + + +
- + - + @@ -70,9 +72,8 @@ - + @@ -83,7 +84,19 @@ + + + + + + + + @@ -162,6 +175,10 @@ export default { type: Boolean, default: false }, + multiple: { + type: Boolean, + default: false + } }, data() { return { @@ -187,6 +204,7 @@ export default { }, columns: defaultColumns, currentTab: 'my', + selectedCoils: [], }; }, computed: { @@ -216,6 +234,14 @@ export default { renderColumns() { // 如果有自定义列配置,使用它;否则使用默认列 return this.coilColumn.length > 0 ? this.coilColumn : this.columns; + }, + // 已选钢卷ID集合(用于快速判断) + selectedCoilIds() { + if (this.multiple) { + return new Set(this.selectedCoils.map(item => item.coilId)); + } else { + return this.selectedCoil ? new Set([this.selectedCoil.coilId]) : new Set(); + } } }, watch: { @@ -262,13 +288,31 @@ export default { } }, methods: { - // 表格行类名动态生成 - 核心:区分权限行/禁用行 - tableRowClassName({ row }) { + // 动态生成表格行类名 - 综合处理选中、禁用等状态 + getRowClassName({ row }) { + const classNames = []; + + // 检查是否为已选中的钢卷 + if (this.selectedCoilIds.has(row.coilId)) { + classNames.push('selected-coil-row'); + } + // 销售受限模式下,判断当前行是否有权限 if (this.salesRestricted && row.saleId !== this.currentUserId) { - return 'disabled-coil-row'; // 禁用行类名 + classNames.push('disabled-coil-row'); // 禁用行类名 } - return ''; + + return classNames.join(' '); + }, + + handleRemove(row) { + this.selectedCoils = this.selectedCoils.filter(item => item.coilId !== row.coilId); + }, + + handleConfirm() { + this.$emit('confirm', this.selectedCoils); + this.selectedCoils = []; + this.handleClose(); }, // 获取钢卷列表 @@ -362,8 +406,19 @@ export default { this.$message.warning('您没有权限选择此钢卷'); return; } - // 存储选中的钢卷数据 - this.selectedCoil = row; + if (this.multiple) { + // 检查是否已经选择 + if (this.selectedCoils.some(item => item.coilId === row.coilId)) { + // 再次点击删除 + this.handleRemove(row); + return; + } + this.selectedCoils.push(row); + return; + // return; + } else { + this.selectedCoil = row; + } // 触发自定义事件,通知父组件选中结果(返回完整行数据) this.$emit('select', row); // 触发器模式下,支持v-model双向绑定 @@ -378,6 +433,7 @@ export default { // 清除选中状态 handleClearSelection() { this.selectedCoil = null; + this.selectedCoils = []; // 清空多选数据 this.$emit('input', ''); this.$emit('change', ''); this.$emit('clear', true); // 触发清除事件 @@ -486,6 +542,20 @@ export default { background-color: var(--el-color-primary-light-8) !important; } +// 核心:已选钢卷样式(黄色背景) +::v-deep .el-table .selected-coil-row { + background-color: #fffbe6 !important; /* 浅黄色背景 */ + + &:hover > td { + background-color: #fff8d9 !important; /* hover时稍深一点的黄色 */ + } + + // 当同时是当前行时 + &.current-row { + background-color: #fff8d9 !important; + } +} + // 核心:禁用行样式(销售权限受限) ::v-deep .el-table .disabled-coil-row { background-color: #f8f8f8 !important; @@ -507,6 +577,15 @@ export default { pointer-events: none; user-select: none; // 禁止文本选中 } + + // 当同时是已选行时(优先级:禁用 > 已选) + &.selected-coil-row { + background-color: #f5f5f5 !important; + + &:hover > td { + background-color: #f5f5f5 !important; + } + } } .dialog-footer { diff --git a/klp-ui/src/views/wms/delivery/components/detailTable.vue b/klp-ui/src/views/wms/delivery/components/detailTable.vue index f7bd8cf1..fd3a6988 100644 --- a/klp-ui/src/views/wms/delivery/components/detailTable.vue +++ b/klp-ui/src/views/wms/delivery/components/detailTable.vue @@ -6,6 +6,12 @@ 新增 + + + 批量新增 + + 导出 @@ -48,20 +54,30 @@
- +
- + + + - + + + + - + + + + + @@ -100,7 +116,7 @@