From 33342488474139b7e1f4a470adfdef3a25b25c9c Mon Sep 17 00:00:00 2001 From: wangyu <823267011@qq.com> Date: Fri, 5 Jun 2026 13:54:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E6=88=BF=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/oa/domain/SysOaWarehouseTask.java | 5 + .../oa/domain/bo/SysOaWarehouseTaskBo.java | 5 + .../oa/domain/vo/SysOaWarehouseTaskVo.java | 5 + .../mapper/oa/SysOaWarehouseTaskMapper.xml | 1 + ruoyi-ui/src/views/oa/oaWarehouse/index.vue | 4 +- ruoyi-ui/src/views/oa/oaWarehouse/task.vue | 314 +++++++++--------- sql/warehouse_task_receipt_doc.sql | 5 + 7 files changed, 181 insertions(+), 158 deletions(-) create mode 100644 sql/warehouse_task_receipt_doc.sql diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/SysOaWarehouseTask.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/SysOaWarehouseTask.java index 1a32971..76b9d6c 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/SysOaWarehouseTask.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/SysOaWarehouseTask.java @@ -81,4 +81,9 @@ public class SysOaWarehouseTask extends BaseEntity { private String unit; + /** + * 收货单 OSS ID(逗号分隔),按物料明细单独保存 + */ + private String receiptDoc; + } diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/SysOaWarehouseTaskBo.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/SysOaWarehouseTaskBo.java index a039126..9651809 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/SysOaWarehouseTaskBo.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/SysOaWarehouseTaskBo.java @@ -89,4 +89,9 @@ public class SysOaWarehouseTaskBo extends BaseEntity { * 单位 */ private String unit; + + /** + * 收货单 OSS ID(CSV) + */ + private String receiptDoc; } diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SysOaWarehouseTaskVo.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SysOaWarehouseTaskVo.java index b929821..6f2e527 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SysOaWarehouseTaskVo.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SysOaWarehouseTaskVo.java @@ -91,4 +91,9 @@ public class SysOaWarehouseTaskVo { */ private String unit; + /** + * 收货单 OSS ID(CSV),按物料明细绑定 + */ + private String receiptDoc; + } diff --git a/ruoyi-oa/src/main/resources/mapper/oa/SysOaWarehouseTaskMapper.xml b/ruoyi-oa/src/main/resources/mapper/oa/SysOaWarehouseTaskMapper.xml index 65e0a1c..72621a9 100644 --- a/ruoyi-oa/src/main/resources/mapper/oa/SysOaWarehouseTaskMapper.xml +++ b/ruoyi-oa/src/main/resources/mapper/oa/SysOaWarehouseTaskMapper.xml @@ -19,6 +19,7 @@ + diff --git a/ruoyi-ui/src/views/oa/oaWarehouse/index.vue b/ruoyi-ui/src/views/oa/oaWarehouse/index.vue index fa2d3cf..0879da7 100644 --- a/ruoyi-ui/src/views/oa/oaWarehouse/index.vue +++ b/ruoyi-ui/src/views/oa/oaWarehouse/index.vue @@ -91,14 +91,12 @@ type="primary" icon="el-icon-shopping-cart-2" size="mini" - @click="addDialogVisible = true" + @click="addWarehouseTask" >新建采购单 - - diff --git a/ruoyi-ui/src/views/oa/oaWarehouse/task.vue b/ruoyi-ui/src/views/oa/oaWarehouse/task.vue index 9ca47b5..f0f5a2c 100644 --- a/ruoyi-ui/src/views/oa/oaWarehouse/task.vue +++ b/ruoyi-ui/src/views/oa/oaWarehouse/task.vue @@ -31,95 +31,10 @@ 新建采购单 - + @click="$router.push('/oa/warehouse-data/addTask')">新建采购单 - - - + row-key="masterId" :row-class-name="rowClassName"> @@ -147,10 +62,12 @@ @blur="updateMasterRemark(scope.row)" /> - + @@ -192,11 +196,6 @@ export default { // 顶部状态筛选 statusFilter: 'all', stat: { undone: 0, done: 0, urgent: 0 }, - // 物料明细缓存(按 masterId) - itemsMap: {}, - itemsLoading: {}, - // 当前展开的行(单展开) - expandedKeys: [], // 新建采购单 dialog addDialogVisible: false, completeDrawer: false, @@ -372,7 +371,7 @@ export default { this.warehouseTaskList.splice(index, 1) this.$message.success('删除成功') }, - submitComplete (masterRow) { + submitComplete () { const rows = this.$refs.warehouseTable.selection || [] if (!rows.length) { return this.$message.warning('请先勾选物料') @@ -383,21 +382,21 @@ export default { rows.forEach(r => { r.taskStatus = this.batchStatus }) - // 1. 如果有收货单 → 先保存到 master - const saveMaster = (masterRow && masterRow.receiptDoc) - ? updateOaWarehouseMaster({ - masterId: masterRow.masterId, - receiptDoc: masterRow.receiptDoc, - type: masterRow.type - }) - : Promise.resolve() - - saveMaster.then(() => updateOaWarehouseTaskBatch(rows)).then(() => { + updateOaWarehouseTaskBatch(rows).then(() => { this.getList() this.drawer = false this.$message.success(`已批量入库 ${rows.length} 条`) }) }, + // 单条收货单上传后立刻保存 + onReceiptDocChange (row) { + updateOaWarehouseTask({ + taskId: row.taskId, + receiptDoc: row.receiptDoc + }).then(() => { + this.$message.success('收货单已保存') + }) + }, /** 执行入库操作 */ handleIn (row) { // 更新采购单情况 @@ -443,8 +442,6 @@ export default { this.TaskList = res.rows || []; this.total = res.total || 0; this.loading = false; - // 重置已展开行的缓存 - this.itemsMap = {}; }); this.refreshStat(); }, @@ -485,40 +482,6 @@ export default { this.queryParams.pageNum = 1 this.getList() }, - // 行展开:懒加载物料明细 + 同步 warehouseTaskList(兼容老方法) - onRowExpand (row, expanded) { - // 单展开:只保留当前 - if (expanded && expanded.length) { - this.expandedKeys = [row.masterId] - } else { - this.expandedKeys = this.expandedKeys.filter(k => k !== row.masterId) - } - if (!expanded || !expanded.length) return - const id = row.masterId - this.currentMasterId = id - if (this.itemsMap[id]) { - this.warehouseTaskList = this.itemsMap[id] - return - } - this.$set(this.itemsLoading, id, true) - getOaWarehouseTaskByMasterId(id).then(res => { - const list = res.data || res.rows || [] - this.$set(this.itemsMap, id, list) - this.warehouseTaskList = list - }).finally(() => { - this.$set(this.itemsLoading, id, false) - }) - }, - // 程序化展开(用于"执行入库"按钮) - expandRow (row) { - if (this.expandedKeys.includes(row.masterId)) { - this.expandedKeys = this.expandedKeys.filter(k => k !== row.masterId) - return - } - this.expandedKeys = [row.masterId] - // 触发数据加载 - this.onRowExpand(row, [row.masterId]) - }, // 取消按钮 cancel () { this.open = false; @@ -683,20 +646,61 @@ export default { border-radius: 4px; i { font-size: 11px; margin-right: 2px; } } -.receipt-row { - display: flex; - align-items: center; - gap: 8px; - padding: 6px 0; - margin-bottom: 6px; - border-bottom: 1px dashed #ebeef5; - .r-label { - color: #606266; - font-size: 12px; - flex-shrink: 0; - i { margin-right: 2px; color: #909399; } +// 表格里的紧凑上传按钮 / 文件列表 +.cell-upload { + ::v-deep .upload-file-uploader { margin-bottom: 4px; } + ::v-deep .el-upload .el-button { + padding: 4px 8px !important; + font-size: 12px !important; + height: 24px; + line-height: 14px; + } + // 已上传文件列表 + ::v-deep .upload-file-list { + margin: 0; + padding: 0; + .el-upload-list__item { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: nowrap; + height: 24px; + line-height: 22px; + margin: 2px 0 0 0 !important; + padding: 0 6px; + border: 1px solid #ebeef5; + border-radius: 4px; + background: #fafafa; + // 文件名:超出省略 + .el-icon-document { + flex: 1; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 12px; + color: #303133; + padding-right: 6px; + } + // 操作按钮:纯图标,不换行 + .ele-upload-list__item-content-action { + flex-shrink: 0; + display: inline-flex; + align-items: center; + gap: 2px; + .el-button { + padding: 0 4px !important; + margin: 0 !important; + height: 20px; + line-height: 20px; + font-size: 0; // 隐藏文字 + [class^="el-icon-"] { + font-size: 14px; + margin: 0; + } + } + } + } } - .r-hint { color: #909399; font-size: 11px; } - ::v-deep .el-upload-list { font-size: 12px; } } diff --git a/sql/warehouse_task_receipt_doc.sql b/sql/warehouse_task_receipt_doc.sql new file mode 100644 index 0000000..d4b7bc8 --- /dev/null +++ b/sql/warehouse_task_receipt_doc.sql @@ -0,0 +1,5 @@ +-- 物料明细加"收货单"字段:CSV 形式的 sys_oss 主键 +-- 让收货单按物料明细行单独绑定,而不是绑定到整张采购单 +ALTER TABLE `sys_oa_warehouse_task` + ADD COLUMN `receipt_doc` varchar(500) DEFAULT NULL COMMENT '收货单 OSS ID(逗号分隔,sys_oss.oss_id)' + AFTER `remark`;