feat(bid): 新增操作记录模块并优化物料管理页面

1. 新增系统操作日志的后端控制器、前端API、路由与完整页面
2. 为物料管理页面添加发货记录标签页,新增物料发货记录查询功能
This commit is contained in:
2026-06-13 10:40:26 +08:00
parent a8e84f9132
commit 8393e4940d
5 changed files with 327 additions and 64 deletions

View File

@@ -0,0 +1,23 @@
package com.ruoyi.web.controller.bid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.service.ISysOperLogService;
@RestController
@RequestMapping("/bid/operationLog")
public class BizOperationLogController extends BaseController {
@Autowired
private ISysOperLogService operLogService;
@PreAuthorize("@ss.hasPermi('bid:operationlog:list')")
@GetMapping("/list")
public TableDataInfo list(SysOperLog log) {
startPage();
return getDataTable(operLogService.selectOperLogList(log));
}
}

View File

@@ -0,0 +1,3 @@
import request from '@/utils/request'
const baseUrl = '/bid/operationLog'
export const listOperationLog = (params) => request({ url: baseUrl + '/list', method: 'get', params })

View File

@@ -235,6 +235,19 @@ export const dynamicRoutes = [
}]
},
// ── 操作记录 ──
{
path: '/bid/operationLog',
component: Layout,
permissions: ['bid:operationlog:list'],
children: [{
path: '',
component: () => import('@/views/bid/operationLog/index'),
name: 'OperationLog',
meta: { title: '操作记录', activeMenu: '/bid/operationLog' }
}]
},
{
path: '/bid/comparison/detail',
component: Layout,

View File

@@ -1,70 +1,104 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="queryParams.materialName" placeholder="请输入物料名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="queryParams.materialCode" placeholder="请输入物料编码" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="厂家/品牌" prop="brand">
<el-select v-model="queryParams.brand" placeholder="全部品牌" clearable style="width:160px" filterable>
<el-option v-for="b in brandList" :key="b" :label="b" :value="b" />
</el-select>
</el-form-item>
<el-form-item label="所属分类">
<el-select v-model="queryParams.categoryId" placeholder="全部分类" clearable style="width:160px">
<el-option v-for="c in flatCategories" :key="c.categoryId"
:label="c.categoryName" :value="c.categoryId" />
</el-select>
</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-tabs v-model="activeTab">
<!-- Tab 1: 物料列表原有内容 -->
<el-tab-pane label="物料列表" name="list">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="queryParams.materialName" placeholder="请输入物料名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="queryParams.materialCode" placeholder="请输入物料编码" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="厂家/品牌" prop="brand">
<el-select v-model="queryParams.brand" placeholder="全部品牌" clearable style="width:160px" filterable>
<el-option v-for="b in brandList" :key="b" :label="b" :value="b" />
</el-select>
</el-form-item>
<el-form-item label="所属分类">
<el-select v-model="queryParams.categoryId" placeholder="全部分类" clearable style="width:160px">
<el-option v-for="c in flatCategories" :key="c.categoryId"
:label="c.categoryName" :value="c.categoryId" />
</el-select>
</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="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
</el-col>
</el-row>
<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="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
</el-col>
</el-row>
<el-table
v-loading="loading"
:data="materialList"
@selection-change="handleSelectionChange"
border
stripe
style="width:100%"
:header-cell-style="{ background: '#f5f7fa', color: '#303133', fontWeight: 700, fontSize: '13px' }"
:cell-style="{ fontSize: '12px', color: '#606266' }"
size="small">
<el-table-column type="selection" width="44" align="center" />
<el-table-column label="物料编码" prop="materialCode" width="120" header-align="center" align="center" />
<el-table-column label="物料名称" prop="materialName" min-width="130" :show-overflow-tooltip="true" />
<el-table-column label="分类" prop="categoryName" width="100" :show-overflow-tooltip="true" />
<el-table-column label="品牌" prop="brand" width="120" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" prop="spec" min-width="140" :show-overflow-tooltip="true" />
<el-table-column label="材质" prop="material" width="80" :show-overflow-tooltip="true" />
<el-table-column label="用途" prop="purpose" min-width="100" :show-overflow-tooltip="true" />
<el-table-column label="状态" align="center" width="80">
<template slot-scope="scope">
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="handleDetail(scope.row)">详情</el-button>
<el-button size="mini" type="text" @click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" style="color:#f56c6c" @click="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-table
v-loading="loading"
:data="materialList"
@selection-change="handleSelectionChange"
border stripe style="width:100%"
:header-cell-style="{ background: '#f5f7fa', color: '#303133', fontWeight: 700, fontSize: '13px' }"
:cell-style="{ fontSize: '12px', color: '#606266' }"
size="small">
<el-table-column type="selection" width="44" align="center" />
<el-table-column label="物料编码" prop="materialCode" width="120" header-align="center" align="center" />
<el-table-column label="物料名称" prop="materialName" min-width="130" :show-overflow-tooltip="true" />
<el-table-column label="分类" prop="categoryName" width="100" :show-overflow-tooltip="true" />
<el-table-column label="品牌" prop="brand" width="120" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" prop="spec" min-width="140" :show-overflow-tooltip="true" />
<el-table-column label="材质" prop="material" width="80" :show-overflow-tooltip="true" />
<el-table-column label="用途" prop="purpose" min-width="100" :show-overflow-tooltip="true" />
<el-table-column label="状态" align="center" width="80">
<template slot-scope="scope">
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="handleDetail(scope.row)">详情</el-button>
<el-button size="mini" type="text" @click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" style="color:#f56c6c" @click="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-tab-pane>
<!-- Tab 2: 发货记录新增 -->
<el-tab-pane label="发货记录" name="records">
<el-select v-model="recordMaterialId" filterable placeholder="选择物料" style="width:400px" @change="loadRecords" clearable>
<el-option v-for="m in materialOptions" :key="m.materialId"
:label="m.materialCode + ' | ' + (m.materialName || '')" :value="m.materialId" />
</el-select>
<el-table v-loading="recordLoading" :data="recordList" border stripe size="small" style="width:100%;margin-top:12px">
<el-table-column label="发货单号" prop="doNo" width="160" />
<el-table-column label="供应商" prop="supplierName" width="150" show-overflow-tooltip />
<el-table-column label="甲方客户" prop="clientName" width="150" show-overflow-tooltip />
<el-table-column label="数量" prop="quantity" width="80" align="right" />
<el-table-column label="单价" width="100" align="right">
<template slot-scope="s">¥{{ s.row.unitPrice }}</template>
</el-table-column>
<el-table-column label="小计" width="100" align="right">
<template slot-scope="s">¥{{ s.row.totalPrice }}</template>
</el-table-column>
<el-table-column label="交货期" prop="deliveryDate" width="95" align="center" />
<el-table-column label="结单日期" prop="actualCloseDate" width="95" align="center" />
<el-table-column label="状态" width="85" align="center">
<template slot-scope="s">
<el-tag :type="recordStatusType(s.row.deliveryStatus)" size="small" effect="dark">{{ recordStatusLabel(s.row.deliveryStatus) }}</el-tag>
</template>
</el-table-column>
</el-table>
<el-empty v-if="!recordMaterialId && !recordLoading" description="请先选择物料" />
<el-empty v-if="recordMaterialId && !recordList.length && !recordLoading" description="该物料暂无发货记录" />
</el-tab-pane>
</el-tabs>
<!-- 新增/修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="760px" append-to-body>
@@ -161,6 +195,7 @@
<script>
import { listMaterial, getMaterial, addMaterial, updateMaterial, delMaterial, listManufacturer } from "@/api/bid/material";
import { getCategoryList } from "@/api/bid/category";
import request from '@/utils/request'
export default {
name: "Material",
@@ -173,6 +208,12 @@ export default {
flatCategories: [],
brandList: [],
perfParams: [],
// 发货记录
activeTab: "list",
recordMaterialId: null,
recordLoading: false,
recordList: [],
materialOptions: [],
rules: {
materialCode: [{ required: true, message: "物料编码不能为空", trigger: "blur" }],
materialName: [{ required: true, message: "物料名称不能为空", trigger: "blur" }],
@@ -183,6 +224,7 @@ export default {
this.getList();
this.loadCategories();
this.loadBrands();
this.loadMaterialOptions();
},
methods: {
loadCategories() {
@@ -281,7 +323,23 @@ export default {
const action = this.form.materialId ? updateMaterial : addMaterial;
action(this.form).then(() => { this.$modal.msgSuccess("操作成功"); this.open = false; this.getList(); });
});
}
},
// ═══════════ 发货记录 ═══════════
loadMaterialOptions() {
listMaterial({ pageSize: 999 }).then(r => { this.materialOptions = r.rows || [] }).catch(() => {})
},
loadRecords(materialId) {
if (!materialId) { this.recordList = []; return }
this.recordLoading = true
request({ url: '/bid/delivery/materialRecords/' + materialId, method: 'get' })
.then(r => { this.recordList = (r.data || []).map(d => ({
...d, deliveryDate: d.deliveryDate ? d.deliveryDate.substring(0, 10) : '',
actualCloseDate: d.actualCloseDate ? d.actualCloseDate.substring(0, 10) : ''
})); this.recordLoading = false })
.catch(() => { this.recordLoading = false })
},
recordStatusType(s) { return { pending: "warning", transit: "primary", history: "success" }[s] || "" },
recordStatusLabel(s) { return { pending: "待发", transit: "在途", history: "已收货" }[s] || s || "-" }
}
};
</script>

View File

@@ -0,0 +1,166 @@
<template>
<div class="log-page">
<!-- 标题栏 -->
<div class="page-header">
<span class="page-title">操作记录</span>
<span class="page-subtitle">OPERATION AUDIT LOG</span>
<div class="header-right">
<span class="total-info"> <b>{{ total }}</b> 条记录</span>
</div>
</div>
<!-- 筛选栏 -->
<div class="search-bar">
<el-input v-model="q.searchKey" placeholder="搜索目标 / 详情" clearable size="small" style="width:200px"
prefix-icon="el-icon-search" @keyup.enter.native="handleSearch" />
<el-select v-model="q.title" placeholder="全部模块" clearable size="small" style="width:130px" @change="handleSearch">
<el-option label="全部模块" value="" />
<el-option label="甲方客户" value="甲方客户" />
<el-option label="物料管理" value="物料管理" />
<el-option label="供应商管理" value="供应商管理" />
<el-option label="报价请求" value="报价请求" />
<el-option label="供应商报价" value="报价单" />
<el-option label="采购单" value="采购单" />
<el-option label="发货管理" value="发货管理" />
<el-option label="结单时间" value="结单时间" />
<el-option label="订单异议" value="订单异议" />
<el-option label="供应商评价" value="供应商评价" />
<el-option label="租户管理" value="租户管理" />
</el-select>
<el-select v-model="q.businessType" placeholder="全部操作" clearable size="small" style="width:120px" @change="handleSearch">
<el-option label="全部操作" value="" />
<el-option label="新增" value="1" />
<el-option label="修改" value="2" />
<el-option label="删除" value="3" />
<el-option label="导出" value="5" />
</el-select>
<el-date-picker v-model="dateRange" type="daterange" range-separator="至" start-placeholder="开始"
end-placeholder="结束" value-format="yyyy-MM-dd" size="small" style="width:210px" clearable />
<el-button type="primary" size="small" icon="el-icon-search" @click="handleSearch">搜索</el-button>
<el-button size="small" icon="el-icon-refresh" @click="resetSearch">重置</el-button>
<div class="search-right">
<el-button size="small" icon="el-icon-refresh" @click="getList">刷新</el-button>
</div>
</div>
<!-- 表格 -->
<el-table v-loading="loading" :data="list" border stripe size="small" class="log-table" style="width:100%">
<el-table-column label="时间" prop="operTime" width="155" />
<el-table-column label="操作人" prop="operName" width="90" />
<el-table-column label="模块" width="100">
<template slot-scope="s">
<el-tag :type="moduleType(s.row.title)" size="small" effect="plain">{{ s.row.title }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作类型" width="85" align="center">
<template slot-scope="s">
<span :style="{ color: actionColor(s.row.businessType), fontWeight:600 }">{{ actionLabel(s.row.businessType) }}</span>
</template>
</el-table-column>
<el-table-column label="请求地址" prop="operUrl" min-width="200" show-overflow-tooltip />
<el-table-column label="参数" min-width="180" show-overflow-tooltip>
<template slot-scope="s">{{ formatParam(s.row.operParam) }}</template>
</el-table-column>
<el-table-column label="状态" width="65" align="center">
<template slot-scope="s">
<el-tag :type="s.row.status === 0 ? 'success' : 'danger'" size="mini" effect="dark">
{{ s.row.status === 0 ? '正常' : '异常' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="耗时" prop="costTime" width="70" align="center">
<template slot-scope="s">{{ s.row.costTime || '-' }}ms</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="q.pageNum" :limit.sync="q.pageSize"
@pagination="getList" />
</div>
</template>
<script>
import { listOperationLog } from "@/api/bid/operation-log"
export default {
name: "OperationLog",
data() {
return {
loading: false, list: [], total: 0,
dateRange: null,
q: {
pageNum: 1, pageSize: 20,
title: "", businessType: "", searchKey: "",
params: { beginTime: null, endTime: null }
}
}
},
created() { this.getList() },
methods: {
getList() {
this.loading = true
const p = {
pageNum: this.q.pageNum, pageSize: this.q.pageSize,
title: this.q.title || undefined,
businessType: this.q.businessType || undefined,
params: {}
}
if (this.dateRange && this.dateRange.length === 2) {
p.params.beginTime = this.dateRange[0] + ' 00:00:00'
p.params.endTime = this.dateRange[1] + ' 23:59:59'
}
if (this.q.searchKey) p.operParam = this.q.searchKey
listOperationLog(p).then(r => {
this.list = r.rows || []; this.total = r.total || 0; this.loading = false
}).catch(() => { this.loading = false })
},
handleSearch() { this.q.pageNum = 1; this.getList() },
resetSearch() {
this.q.title = ""; this.q.businessType = ""; this.q.searchKey = ""
this.dateRange = null; this.q.params = {}
this.handleSearch()
},
moduleType(title) {
const map = { "物料管理": "", "供应商管理": "", "报价单": "warning", "报价请求": "warning",
"采购单": "", "发货管理": "success", "甲方客户": "primary", "结单时间": "warning",
"订单异议": "danger", "供应商评价": "success", "租户管理": "info" }
return map[title] || ""
},
actionLabel(b) {
const map = { 1: "新增", 2: "修改", 3: "删除", 4: "授权", 5: "导出", 6: "导入" }
return map[b] || ("类型" + b)
},
actionColor(b) {
const map = { 1: "#67c23a", 2: "#e6a23c", 3: "#f56c6c", 5: "#409EFF" }
return map[b] || "#909399"
},
formatParam(param) {
if (!param) return "-"
if (param.length > 80) return param.substring(0, 80) + "..."
return param
}
}
}
</script>
<style scoped>
.log-page { background: #f5f7fa; padding: 12px; min-height: calc(100vh - 84px); }
.page-header {
background: #fff; padding: 12px 16px; border-radius: 4px; margin-bottom: 12px;
box-shadow: 0 1px 4px rgba(0,0,0,0.06); display: flex; align-items: center; gap: 12px;
}
.page-title { font-size: 16px; font-weight: 700; color: #1a2c4e; }
.page-subtitle { font-size: 11px; color: #c0c4cc; letter-spacing: 1px; }
.header-right { margin-left: auto; }
.total-info { font-size: 12px; color: #909399; }
.search-bar {
background: #fff; padding: 12px 16px; border-radius: 4px;
box-shadow: 0 1px 4px rgba(0,0,0,0.06); margin-bottom: 12px;
display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.search-right { margin-left: auto; }
.log-table { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
</style>