feat(wms/report): 新增修复报告页面和功能

feat(ems/assisted): 添加公辅消耗记录和类型管理功能

fix(eqp): 修改公辅消耗记录接口返回类型为Long

refactor(wms/report): 优化合并模板查询逻辑和统计信息展示

style(wms/report): 调整时间范围选择器组件逻辑

docs(wms/report): 更新配置文件中产线类型配置

feat(wms/report): 新增异常报告页面和功能
This commit is contained in:
2026-04-30 13:57:42 +08:00
parent 9967d8be46
commit 12b3f0556d
18 changed files with 1543 additions and 28 deletions

View File

@@ -0,0 +1,298 @@
<template>
<div class="assisted-table-container">
<div class="left-panel">
<el-menu
:default-active="currentLine"
class="line-menu"
@select="handleLineSelect"
>
<el-menu-item index="">全部</el-menu-item>
<el-menu-item
v-for="item in dict.type.sys_lines"
:key="item.value"
:index="item.value"
>
{{ item.label }}
</el-menu-item>
</el-menu>
</div>
<div class="right-panel" v-loading="rightLoading">
<div v-if="!currentLine" class="empty-state">
<el-empty description="请选择产线" />
</div>
<div v-else-if="!auxiliaryTypes.length" class="empty-state">
<el-empty description="该产线下暂无公辅类型" />
</div>
<div v-else>
<div style="margin-bottom: 16px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px;">
<el-date-picker
v-model="selectedMonth"
type="month"
placeholder="选择月份"
format="yyyy-MM"
value-format="yyyy-MM"
@change="handleMonthChange"
style="width: 150px;"
/>
<el-button icon="el-icon-refresh" @click="handleRefresh">刷新</el-button>
</div>
<div style="margin-bottom: 16px; padding: 10px; background: #f5f7fa; border-radius: 4px;">
<el-checkbox v-model="configOptions.showSumRow">显示求和行</el-checkbox>
</div>
<el-table :data="tableData" style="width: 100%" border :show-summary="configOptions.showSumRow" :summary-method="getSummaries">
<el-table-column prop="date" label="日期" width="120" />
<el-table-column v-for="type in auxiliaryTypes" :key="type.typeId" :prop="'type_' + type.typeId" :label="type.typeName">
<template slot-scope="scope">
<input v-model="scope.row['type_' + type.typeId].consume" class="nob"
@change="(e) => handleCellChange(scope.row, type.typeId)" />
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</template>
<script>
import { listAuxiliaryType } from "@/api/eqp/auxiliaryType";
import { listAuxiliaryConsume, updateAuxiliaryConsume, addAuxiliaryConsume } from "@/api/eqp/auxiliaryConsume";
import dayjs from "dayjs";
export default {
name: "AuxiliaryRecord",
dicts: ['sys_lines'],
data() {
const currentMonth = dayjs().format("YYYY-MM");
return {
auxiliaryTypes: [],
currentLine: "",
tableData: [],
rightLoading: false,
selectedMonth: currentMonth,
originalData: [],
configOptions: {
showSumRow: false
}
};
},
mounted() {
},
methods: {
async handleRefresh() {
if (this.currentLine) {
this.rightLoading = true;
await this.loadAllData();
this.rightLoading = false;
}
},
async handleLineSelect(index) {
this.currentLine = index;
this.rightLoading = true;
await this.loadAllData();
this.rightLoading = false;
},
async handleMonthChange() {
if (this.currentLine) {
this.rightLoading = true;
await this.loadAllData();
this.rightLoading = false;
}
},
async loadAllData() {
await this.loadAuxiliaryTypes();
await this.loadAuxiliaryConsumes();
},
async loadAuxiliaryTypes() {
const params = { pageSize: 999 };
if (this.currentLine) {
params.lineName = this.currentLine;
}
const res = await listAuxiliaryType(params);
this.auxiliaryTypes = res.rows || [];
},
async loadAuxiliaryConsumes() {
const startDate = dayjs(this.selectedMonth).startOf('month').format('YYYY-MM-DD') + ' 00:00:00';
const endDate = dayjs(this.selectedMonth).endOf('month').format('YYYY-MM-DD') + ' 23:59:59';
const res = await listAuxiliaryConsume({
recordStartDate: startDate,
recordEndDate: endDate
});
this.originalData = res.rows || [];
this.processTableData(res.rows || []);
},
processTableData(records) {
const dateMap = new Map();
records.forEach(record => {
const dateStr = dayjs(record.recordDate).format('YYYY-MM-DD');
if (!dateMap.has(dateStr)) {
dateMap.set(dateStr, {
date: dateStr
});
}
dateMap.get(dateStr)['type_' + record.typeId] = {
consumeId: record.consumeId,
consume: record.consume,
remark: record.remark
};
});
const monthDates = this.generateMonthDates(this.selectedMonth);
this.tableData = monthDates.map(date => {
const row = {
date: date
};
this.auxiliaryTypes.forEach(type => {
if (dateMap.has(date) && dateMap.get(date)['type_' + type.typeId]) {
row['type_' + type.typeId] = dateMap.get(date)['type_' + type.typeId];
} else {
row['type_' + type.typeId] = {
consumeId: null,
consume: 0,
remark: ''
};
}
});
return row;
});
this.tableData.sort((a, b) => {
return new Date(a.date) - new Date(b.date);
});
},
generateMonthDates(month) {
const dates = [];
const start = dayjs(month).startOf('month');
const end = dayjs(month).endOf('month');
let current = start;
while (current.isBefore(end) || current.isSame(end, 'day')) {
dates.push(current.format('YYYY-MM-DD'));
current = current.add(1, 'day');
}
return dates;
},
async handleCellChange(row, typeId) {
const cellData = row['type_' + typeId];
const record = {
consumeId: cellData.consumeId,
typeId: typeId,
consume: cellData.consume,
recordDate: row.date,
remark: cellData.remark
};
try {
if (cellData.consumeId) {
await updateAuxiliaryConsume(record);
} else {
const { data: newRecordId } = await addAuxiliaryConsume(record);
cellData.consumeId = newRecordId;
this.originalData.push({
...record,
consumeId: newRecordId
});
}
this.$message.success('保存成功');
} catch (error) {
console.error('保存失败:', error);
this.$message.error('保存失败');
this.loadAuxiliaryConsumes();
}
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
if (!this.configOptions.showSumRow) {
return sums;
}
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
}
const prop = column.property;
if (prop && prop.startsWith('type_')) {
const values = data.map(item => Number(item[prop]?.consume) || 0);
const sum = values.reduce((prev, curr) => prev + curr, 0);
sums[index] = sum.toFixed(2);
return;
}
sums[index] = '';
});
return sums;
},
}
};
</script>
<style scoped>
.assisted-table-container {
display: flex;
height: 100%;
}
.left-panel {
width: 200px;
border-right: 1px solid #e6e6e6;
padding: 16px;
overflow-y: auto;
}
.line-menu {
border: none;
}
.right-panel {
flex: 1;
padding: 16px;
overflow-y: auto;
}
.empty-state {
display: flex;
justify-content: center;
align-items: center;
height: 400px;
}
.nob {
border: none;
outline: none;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
line-height: 23px;
}
.nob:focus {
border: 1px dotted black;
}
</style>

View File

@@ -0,0 +1,386 @@
<template>
<div class="app-container">
<div class="main-layout">
<div class="left-menu">
<el-menu
:default-active="currentLine"
class="line-menu"
@select="handleLineSelect"
>
<el-menu-item index="">全部</el-menu-item>
<el-menu-item
v-for="item in dict.type.sys_lines"
:key="item.value"
:index="item.value"
>
{{ item.label }}
</el-menu-item>
</el-menu>
</div>
<div class="right-content">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
<el-form-item label="公辅类型名称" prop="typeName">
<el-input v-model="queryParams.typeName" placeholder="请输入公辅类型名称" clearable @keyup.enter.native="handleQuery" />
</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="success" plain icon="el-icon-edit" size="mini" :disabled="single"
@click="handleUpdate">修改</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-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<div v-loading="loading" class="card-list">
<el-row :gutter="20">
<el-col :span="8" v-for="item in auxiliaryTypeList" :key="item.typeId">
<el-card :class="['auxiliary-card', { 'selected': ids.includes(item.typeId) }]" shadow="hover" @click.native="handleCardClick(item)">
<div class="card-header">
<span class="card-title">{{ item.typeName }}</span>
<el-tag size="mini" type="info">{{ item.lineName }}</el-tag>
</div>
<div class="card-body">
<div class="card-info">
<span class="info-label">备注:</span>
<span class="info-value">{{ item.remark || '-' }}</span>
</div>
</div>
<div class="card-footer">
<el-button size="mini" type="text" icon="el-icon-edit" @click.stop="handleUpdate(item)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click.stop="handleDelete(item)">删除</el-button>
</div>
</el-card>
</el-col>
</el-row>
<el-empty v-if="auxiliaryTypeList.length === 0 && !loading" description="暂无数据" />
</div>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
</div>
</div>
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="公辅类型名称" prop="typeName">
<el-input v-model="form.typeName" placeholder="请输入公辅类型名称" />
</el-form-item>
<el-form-item label="产线名称" prop="lineName">
<el-select v-model="form.lineName" placeholder="请选择产线名称">
<el-option v-for="item in dict.type.sys_lines" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listAuxiliaryType, getAuxiliaryType, delAuxiliaryType, addAuxiliaryType, updateAuxiliaryType } from "@/api/eqp/auxiliaryType";
export default {
name: "AuxiliaryType",
data() {
return {
// 按钮loading
buttonLoading: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 公辅类型表格数据
auxiliaryTypeList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 当前选中的产线
currentLine: "",
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
typeName: undefined,
lineName: undefined,
},
// 表单参数
form: {},
// 表单校验
rules: {
typeId: [
{ required: true, message: "公辅类型ID不能为空", trigger: "blur" }
],
typeName: [
{ required: true, message: "公辅类型名称不能为空", trigger: "blur" }
],
lineName: [
{ required: true, message: "产线名称不能为空", trigger: "blur" }
],
remark: [
{ required: false, message: "备注不能为空", trigger: "blur" }
]
}
};
},
created() {
this.getList();
},
dicts: ['sys_lines'],
methods: {
/** 产线选择 */
handleLineSelect(index) {
this.currentLine = index;
this.queryParams.lineName = index || undefined;
this.queryParams.pageNum = 1;
this.getList();
},
/** 卡片点击 */
handleCardClick(row) {
// 切换选中状态
const index = this.ids.indexOf(row.typeId);
if (index > -1) {
this.ids.splice(index, 1);
} else {
this.ids = [row.typeId];
}
this.single = this.ids.length !== 1;
this.multiple = !this.ids.length;
},
/** 查询公辅类型列表 */
getList() {
this.loading = true;
listAuxiliaryType(this.queryParams).then(response => {
this.auxiliaryTypeList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
typeId: undefined,
typeName: undefined,
lineName: undefined,
createBy: undefined,
updateBy: undefined,
createTime: undefined,
updateTime: undefined,
delFlag: undefined,
remark: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.typeId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加公辅类型";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const typeId = row.typeId || this.ids
getAuxiliaryType(typeId).then(response => {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "修改公辅类型";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buttonLoading = true;
if (this.form.typeId != null) {
updateAuxiliaryType(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addAuxiliaryType(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const typeIds = row.typeId || this.ids;
this.$modal.confirm('是否确认删除公辅类型编号为"' + typeIds + '"的数据项?').then(() => {
this.loading = true;
return delAuxiliaryType(typeIds);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('eqp/auxiliaryType/export', {
...this.queryParams
}, `auxiliaryType_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style scoped>
.main-layout {
display: flex;
height: calc(100vh - 84px);
overflow: hidden;
}
.left-menu {
width: 200px;
overflow-y: auto;
}
.menu-title {
padding: 16px;
font-size: 14px;
font-weight: bold;
border-bottom: 1px solid #e6e6e6;
background: #f5f7fa;
}
.line-menu {
border: none;
}
.right-content {
flex: 1;
padding: 0 16px;
overflow-y: auto;
}
.card-list {
margin-top: 16px;
}
.auxiliary-card {
margin-bottom: 20px;
cursor: pointer;
transition: all 0.3s;
}
.auxiliary-card:hover {
transform: translateY(-4px);
}
.auxiliary-card.selected {
border: 1px solid #409eff;
background: #b5d9fc;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.card-title {
font-size: 16px;
font-weight: bold;
color: #303133;
}
.card-body {
margin-bottom: 12px;
}
.card-info {
display: flex;
margin-bottom: 8px;
font-size: 14px;
}
.card-info:last-child {
margin-bottom: 0;
}
.info-label {
color: #909399;
min-width: 50px;
}
.info-value {
color: #606266;
flex: 1;
word-break: break-all;
}
.card-footer {
display: flex;
justify-content: flex-end;
padding-top: 12px;
border-top: 1px solid #f0f0f0;
}
</style>