feat(仓库管理): 新增钢卷库区操作日志功能

添加钢卷库区操作日志记录功能,包括:
1. 在入库操作时自动记录日志
2. 新增日志查询API接口
3. 实现日志查看页面和表格组件
4. 处理拒签和删除操作时的日志清理
This commit is contained in:
砂糖
2026-03-05 17:19:48 +08:00
parent 428e94d4f9
commit 9e24368d4c
5 changed files with 418 additions and 2 deletions

View File

@@ -0,0 +1,153 @@
<template>
<div class="log-table-container">
<!-- 筛选条件 -->
<el-form :inline="true" :model="logParams" class="demo-form-inline mb20">
<el-form-item label="开始时间">
<el-date-picker
v-model="logParams.startTime"
type="datetime"
placeholder="选择开始时间"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
/>
</el-form-item>
<el-form-item label="结束时间">
<el-date-picker
v-model="logParams.endTime"
type="datetime"
placeholder="选择结束时间"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getLogList">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="logLoading"
:data="logList"
style="width: 100%"
border
>
<el-table-column prop="createTime" label="操作时间" width="180">
<template slot-scope="scope">
{{ scope.row.createTime }}
</template>
</el-table-column>
<el-table-column prop="operationType" label="操作类型" width="100">
<template slot-scope="scope">
{{ scope.row.operationType === 1 ? '入库' : '出库' }}
</template>
</el-table-column>
<el-table-column prop="inOutType" label="出入库类型" width="100">
<template slot-scope="scope">
{{ scope.row.inOutType === 1 ? '入库' : '出库' }}
</template>
</el-table-column>
<el-table-column prop="coil.enterCoilNo" label="卷号" width="150">
<template slot-scope="scope">
{{ scope.row.coil && scope.row.coil.enterCoilNo ? scope.row.coil.enterCoilNo : '-' }}
</template>
</el-table-column>
<el-table-column prop="coil.itemName" label="物料名称" width="120">
<template slot-scope="scope">
{{ scope.row.coil && scope.row.coil.itemName ? scope.row.coil.itemName : '-' }}
</template>
</el-table-column>
<el-table-column prop="coil.specification" label="规格" width="150">
<template slot-scope="scope">
{{ scope.row.coil && scope.row.coil.specification ? scope.row.coil.specification : '-' }}
</template>
</el-table-column>
<el-table-column prop="warehouse.actualWarehouseName" label="库位" width="150">
<template slot-scope="scope">
{{ scope.row.warehouse && scope.row.warehouse.actualWarehouseName ? scope.row.warehouse.actualWarehouseName : '-' }}
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" min-width="150">
<template slot-scope="scope">
{{ scope.row.remark || '-' }}
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination v-show="total > 0" :total="total" :page.sync="logParams.pageNum"
:limit.sync="logParams.pageSize" @pagination="getLogList" />
</div>
</template>
<script>
import { getCoilWarehouseOperationLogByWarehouseId } from "@/api/wms/coilWarehouseOperationLog";
export default {
name: "LogTable",
props: {
warehouseId: {
type: String,
default: ""
}
},
data() {
return {
logList: [],
total: 0,
logParams: {
startTime: "",
endTime: "",
operationType: null,
inOutType: null,
pageNum: 1,
pageSize: 10,
},
logLoading: false,
};
},
watch: {
warehouseId: {
handler(newVal, oldVal) {
if (newVal !== oldVal && newVal !== "") {
this.logParams.secondWarehouseId = newVal;
this.getLogList();
}
},
immediate: true
}
},
methods: {
// 获取日志列表
getLogList() {
this.logLoading = true;
getCoilWarehouseOperationLogByWarehouseId(this.logParams)
.then((res) => {
this.logList = res.data || [];
this.total = res.total || 0;
})
.catch((err) => { this.$message.error("获取日志列表失败:" + err.message); })
.finally(() => { this.logLoading = false; });
},
// 重置筛选条件
resetParams() {
this.logParams = {
startTime: "",
endTime: "",
operationType: null,
inOutType: null,
pageNum: 1,
pageSize: 10,
secondWarehouseId: this.warehouseId
};
this.getLogList();
},
},
};
</script>
<style scoped>
.mb20 {
margin-bottom: 20px;
}
</style>