refactor: 合并原库房客户端到主WMS服务,退役8891端口
1. 将bj_power_wms_client的前端代码、配置及网关逻辑全部迁移到bj_power_wms主项目 2. 删除原库房客户端相关的所有文件与配置 3. 更新README与部署文档,说明合并后的服务架构 4. 新增Web配置项支持自动打开浏览器开关,统一服务端口为8890
This commit is contained in:
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<div class="evt-page">
|
||||
<el-card shadow="never">
|
||||
<el-form inline :model="filters">
|
||||
<el-form-item label="事件类型">
|
||||
<el-select v-model="filters.eventType" clearable style="width:150px" placeholder="全部">
|
||||
<el-option v-for="f in EVENT_FAMILIES" :key="f.value" :label="f.label" :value="f.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人">
|
||||
<el-input v-model="filters.operator" clearable style="width:130px" placeholder="用户名"
|
||||
@keyup.enter="onSearch" />
|
||||
</el-form-item>
|
||||
<el-form-item label="时间范围">
|
||||
<el-date-picker v-model="range" type="daterange" value-format="YYYY-MM-DD" range-separator="至"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" style="width:260px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSearch">查询</el-button>
|
||||
<el-button @click="onReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" style="margin-top:12px">
|
||||
<el-table :data="list" border stripe size="small" v-loading="loading">
|
||||
<el-table-column prop="id" label="ID" width="70" />
|
||||
<el-table-column label="事件类型" min-width="170">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="familyTag(row.eventType)" size="small">{{ familyName(row.eventType) }}</el-tag>
|
||||
<span class="evt-code">{{ row.eventType }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="description" label="描述" min-width="260" show-overflow-tooltip />
|
||||
<el-table-column label="对象" width="110">
|
||||
<template #default="{ row }">{{ entityName(row.entityType) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="entityId" label="对象标识" width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="operator" label="操作人" width="100" />
|
||||
<el-table-column label="时间" width="165">
|
||||
<template #default="{ row }">{{ fmtTime(row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination v-model:current-page="page.current" v-model:page-size="page.size"
|
||||
:page-sizes="[20, 50, 100]" :total="total" background layout="total, sizes, prev, pager, next, jumper"
|
||||
style="margin-top:12px" @size-change="load" @current-change="load" />
|
||||
</el-card>
|
||||
</div>
|
||||
<PageHelp :data="helpEventLog" page="EventLog" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineOptions({ name: 'EventLog' })
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import request from '../utils/request'
|
||||
import { fmtTime } from '../utils/format'
|
||||
import PageHelp from '../components/PageHelp.vue'
|
||||
import { helpEventLog } from '../help'
|
||||
|
||||
// 事件类型按"族前缀"归类(写点处 eventType 形如 user.create / inbound.create …)
|
||||
const EVENT_FAMILIES = [
|
||||
{ label: '账号管理', value: 'user.' },
|
||||
{ label: '角色管理', value: 'role.' },
|
||||
{ label: '权限初始化', value: 'rbac.' },
|
||||
{ label: '物料档案', value: 'material.' },
|
||||
{ label: '区域维护', value: 'zone.' },
|
||||
{ label: '入库', value: 'inbound.' },
|
||||
{ label: '出库', value: 'outbound.' },
|
||||
{ label: '质量检验', value: 'inspection.' },
|
||||
{ label: '库存盘点', value: 'stocktake.' },
|
||||
{ label: '半成品', value: 'semi.' }
|
||||
]
|
||||
const FAMILY_LABEL = Object.fromEntries(EVENT_FAMILIES.map((f) => [f.value, f.label]))
|
||||
const FAMILY_TAG = {
|
||||
'user.': 'primary', 'role.': 'warning', 'rbac.': 'danger',
|
||||
'material.': 'success', 'zone.': 'success', 'inbound.': 'success',
|
||||
'outbound.': 'warning', 'inspection.': 'info', 'stocktake.': 'info', 'semi.': 'info'
|
||||
}
|
||||
const ENTITY_LABEL = {
|
||||
user: '账号', role: '角色', rbac: '权限', material: '物料', zone: '区域',
|
||||
inbound: '入库', outbound: '出库', inspection: '检验', stocktake: '盘点', semi: '半成品'
|
||||
}
|
||||
|
||||
function familyName(evt) {
|
||||
const k = Object.keys(FAMILY_LABEL).find((p) => evt && evt.startsWith(p))
|
||||
return k ? FAMILY_LABEL[k] : (evt || '-')
|
||||
}
|
||||
function familyTag(evt) {
|
||||
const k = Object.keys(FAMILY_TAG).find((p) => evt && evt.startsWith(p))
|
||||
return (k && FAMILY_TAG[k]) || 'info'
|
||||
}
|
||||
function entityName(t) {
|
||||
return (t && ENTITY_LABEL[t]) || t || '-'
|
||||
}
|
||||
|
||||
const filters = reactive({ eventType: '', operator: '' })
|
||||
const range = ref(null) // [开始,结束] YYYY-MM-DD
|
||||
const list = ref([])
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
const page = reactive({ current: 1, size: 20 })
|
||||
|
||||
function toUnix(dateStr) {
|
||||
// dateStr YYYY-MM-DD → Int64 unix 秒
|
||||
const d = new Date(dateStr + 'T00:00:00')
|
||||
return Math.floor(d.getTime() / 1000)
|
||||
}
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const params = { page: page.current, pageSize: page.size }
|
||||
if (filters.eventType) params.eventType = filters.eventType
|
||||
if (filters.operator) params.operator = filters.operator
|
||||
if (range.value && range.value.length === 2) {
|
||||
params.from = toUnix(range.value[0])
|
||||
params.to = toUnix(range.value[1]) + 86400 - 1 // 含结束日全天
|
||||
}
|
||||
const data = await request.get('/event/logs', { params })
|
||||
list.value = data?.list || []
|
||||
total.value = data?.total || 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
page.current = 1
|
||||
load()
|
||||
}
|
||||
function onReset() {
|
||||
filters.eventType = ''
|
||||
filters.operator = ''
|
||||
range.value = null
|
||||
page.current = 1
|
||||
load()
|
||||
}
|
||||
|
||||
onMounted(load)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.evt-code {
|
||||
margin-left: 6px;
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user