1. 移除质检模板页面未使用的getCheckItem接口导入 2. 给成本综合页面表格添加固定高度适配布局 3. 更新物料告警页面的表格列文案:理论值→推论值、实测值→实际值、实际偏差值→实际偏差 4. 重构重定向菜单页面的样式,优化布局与视觉效果
455 lines
18 KiB
Vue
455 lines
18 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
<el-form-item label="告警类型" prop="warningType">
|
|
<el-radio-group v-model="queryParams.warningType" @change="handleQuery">
|
|
<el-radio-button label="LENGTH">长度告警</el-radio-button>
|
|
<el-radio-button label="THICKNESS">厚度告警</el-radio-button>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
<!-- <el-form-item label="告警级别" prop="warningLevel">
|
|
<el-select v-model="queryParams.warningLevel" placeholder="请选择告警级别" clearable @keyup.enter.native="handleQuery">
|
|
<el-option label="警告" value="WARNING" />
|
|
<el-option label="错误" value="ERROR" />
|
|
<el-option label="严重错误" value="CRITICAL" />
|
|
</el-select>
|
|
</el-form-item> -->
|
|
<el-form-item label="告警状态" prop="warningStatus">
|
|
<el-select v-model="queryParams.warningStatus" placeholder="请选择告警状态" clearable
|
|
@change="handleQuery">
|
|
<el-option label="未处理" value="0" />
|
|
<el-option label="已处理" value="1" />
|
|
<el-option label="已忽略" value="2" />
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="工序" prop="actionType">
|
|
<el-select v-model="queryParams.actionType" placeholder="请选择工序" clearable
|
|
@change="handleQuery">
|
|
<el-option v-for="item in dict.type.action_type" :key="item.value" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="处理人" prop="handleBy">
|
|
<el-input v-model="queryParams.handleBy" placeholder="请输入处理人" clearable @keyup.enter.native="handleQuery" />
|
|
</el-form-item>
|
|
<el-form-item label="只看今天" prop="onlyToday">
|
|
<el-switch v-model="queryParams.onlyToday" @change="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-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<el-table v-loading="loading" :data="materialWarningList" @selection-change="handleSelectionChange" :row-class-name="getRowClassName">
|
|
<!-- <el-table-column label="钢卷ID" align="center" prop="coilId" /> -->
|
|
<el-table-column label="告警类型" align="center" prop="warningType">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.warningType === 'LENGTH' ? '长度' : scope.row.warningType === 'THICKNESS' ? '厚度' : '宽度'
|
|
}}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="工序" align="center" prop="actionType">
|
|
<template slot-scope="scope">
|
|
<dict-tag :options="dict.type.action_type" :value="scope.row.actionType" />
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="入场卷号" align="center" prop="coilVo.enterCoilNo" />
|
|
<el-table-column label="当前卷号" align="center" prop="coilVo.currentCoilNo" />
|
|
<el-table-column label="发生时间" align="center" prop="createTime" width="180">
|
|
<!-- 如果是今天的标红显示 -->
|
|
<template slot-scope="scope">
|
|
<span v-if="isToday(scope.row.createTime)" style="color: red;">{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
|
<span v-else>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="推论值" align="center" prop="theoreticalVal" />
|
|
<el-table-column label="实际值" align="center" prop="actualVal" />
|
|
<el-table-column label="允许偏差" align="center" prop="allowDeviation">
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.warningType === 'LENGTH'">{{ parseFloat((scope.row.allowDeviation * 100).toFixed(2)) }}%</span>
|
|
<span v-else>{{ scope.row.allowDeviation }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="实际偏差" align="center" prop="deviationValue" />
|
|
|
|
<el-table-column label="告警说明" align="center" prop="warningMsg" show-overflow-tooltip />
|
|
<el-table-column label="告警状态" align="center" prop="warningStatus">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.warningStatus == 0 ? '未处理' : scope.row.warningStatus == 1 ? '已处理' : '已忽略' }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="处理人" align="center" prop="handleBy" />
|
|
<el-table-column label="处理时间" align="center" prop="handleTime" width="180">
|
|
<template slot-scope="scope">
|
|
<span>{{ parseTime(scope.row.handleTime, '{y}-{m}-{d}') }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<!-- <el-table-column label="处理备注" align="center" prop="handleRemark" /> -->
|
|
<!-- <el-table-column label="备注" align="center" prop="remark" /> -->
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<template slot-scope="scope">
|
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleHandle(scope.row)">处理</el-button>
|
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleIgnore(scope.row)">忽略</el-button>
|
|
<el-button size="mini" type="text" icon="el-icon-delete" @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-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
<el-form-item label="钢卷ID" prop="coilId">
|
|
<el-input v-model="form.coilId" placeholder="请输入钢卷ID" />
|
|
</el-form-item>
|
|
<el-form-item label="理论值" prop="theoreticalVal">
|
|
<el-input v-model="form.theoreticalVal" placeholder="请输入理论值" />
|
|
</el-form-item>
|
|
<el-form-item label="实测值" prop="actualVal">
|
|
<el-input v-model="form.actualVal" placeholder="请输入实测值" />
|
|
</el-form-item>
|
|
<el-form-item label="允许偏差" prop="allowDeviation">
|
|
<el-input v-model="form.allowDeviation" placeholder="请输入允许偏差" />
|
|
</el-form-item>
|
|
<el-form-item label="实际偏差值" prop="deviationValue">
|
|
<el-input v-model="form.deviationValue" placeholder="请输入实际偏差值" />
|
|
</el-form-item>
|
|
<el-form-item label="偏差率(%)" prop="deviationRate">
|
|
<el-input v-model="form.deviationRate" placeholder="请输入偏差率(%)" />
|
|
</el-form-item>
|
|
<el-form-item label="告警级别(WARNING/ERROR/CRITICAL)" prop="warningLevel">
|
|
<el-input v-model="form.warningLevel" placeholder="请输入告警级别(WARNING/ERROR/CRITICAL)" />
|
|
</el-form-item>
|
|
<el-form-item label="告警说明" prop="warningMsg">
|
|
<el-input v-model="form.warningMsg" placeholder="请输入告警说明" />
|
|
</el-form-item>
|
|
<el-form-item label="处理人" prop="handleBy">
|
|
<el-input v-model="form.handleBy" placeholder="请输入处理人" />
|
|
</el-form-item>
|
|
<el-form-item label="处理时间" prop="handleTime">
|
|
<el-date-picker clearable
|
|
v-model="form.handleTime"
|
|
type="datetime"
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
placeholder="请选择处理时间">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
<el-form-item label="处理备注" prop="handleRemark">
|
|
<el-input v-model="form.handleRemark" placeholder="请输入处理备注" />
|
|
</el-form-item>
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-input v-model="form.remark" 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 { listMaterialWarning, getMaterialWarning, delMaterialWarning, addMaterialWarning, updateMaterialWarning } from "@/api/wms/materialWarning";
|
|
|
|
export default {
|
|
name: "MaterialWarning",
|
|
data() {
|
|
return {
|
|
// 按钮loading
|
|
buttonLoading: false,
|
|
// 遮罩层
|
|
loading: true,
|
|
// 选中数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 总条数
|
|
total: 0,
|
|
// 钢卷告警表格数据
|
|
materialWarningList: [],
|
|
// 弹出层标题
|
|
title: "",
|
|
// 是否显示弹出层
|
|
open: false,
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
coilId: undefined,
|
|
warningType: 'LENGTH',
|
|
theoreticalVal: undefined,
|
|
actualVal: undefined,
|
|
allowDeviation: undefined,
|
|
deviationValue: undefined,
|
|
deviationRate: undefined,
|
|
warningLevel: undefined,
|
|
warningMsg: undefined,
|
|
warningStatus: undefined,
|
|
handleBy: undefined,
|
|
handleTime: undefined,
|
|
handleRemark: undefined,
|
|
onlyToday: true,
|
|
createStartTime: undefined,
|
|
createEndTime: undefined,
|
|
},
|
|
// 表单参数
|
|
form: {},
|
|
// 表单校验
|
|
rules: {
|
|
warningId: [
|
|
{ required: true, message: "告警ID不能为空", trigger: "blur" }
|
|
],
|
|
coilId: [
|
|
{ required: true, message: "钢卷ID不能为空", trigger: "blur" }
|
|
],
|
|
warningType: [
|
|
{ required: true, message: "告警类型(LENGTH=长度, THICKNESS=厚度, WIDTH=宽度)不能为空", trigger: "change" }
|
|
],
|
|
theoreticalVal: [
|
|
{ required: true, message: "理论值不能为空", trigger: "blur" }
|
|
],
|
|
actualVal: [
|
|
{ required: true, message: "实测值不能为空", trigger: "blur" }
|
|
],
|
|
allowDeviation: [
|
|
{ required: true, message: "允许偏差(数值/百分比)不能为空", trigger: "blur" }
|
|
],
|
|
deviationValue: [
|
|
{ required: true, message: "实际偏差值不能为空", trigger: "blur" }
|
|
],
|
|
deviationRate: [
|
|
{ required: true, message: "偏差率(%)不能为空", trigger: "blur" }
|
|
],
|
|
warningLevel: [
|
|
{ required: true, message: "告警级别(WARNING/ERROR/CRITICAL)不能为空", trigger: "blur" }
|
|
],
|
|
warningMsg: [
|
|
{ required: true, message: "告警说明不能为空", trigger: "blur" }
|
|
],
|
|
warningStatus: [
|
|
{ required: true, message: "告警状态(0=未处理,1=已处理,2=已忽略)不能为空", trigger: "change" }
|
|
],
|
|
handleBy: [
|
|
{ required: true, message: "处理人不能为空", trigger: "blur" }
|
|
],
|
|
handleTime: [
|
|
{ required: true, message: "处理时间不能为空", trigger: "blur" }
|
|
],
|
|
handleRemark: [
|
|
{ required: true, message: "处理备注不能为空", trigger: "blur" }
|
|
],
|
|
delFlag: [
|
|
{ required: true, message: "删除标志不能为空", trigger: "blur" }
|
|
],
|
|
createTime: [
|
|
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
|
],
|
|
updateTime: [
|
|
{ required: true, message: "更新时间不能为空", trigger: "blur" }
|
|
],
|
|
remark: [
|
|
{ required: true, message: "备注不能为空", trigger: "blur" }
|
|
]
|
|
}
|
|
};
|
|
},
|
|
dicts: ['action_type'],
|
|
created() {
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
/** 查询钢卷告警列表 */
|
|
getList() {
|
|
this.loading = true;
|
|
if (this.queryParams.onlyToday) {
|
|
const today = new Date();
|
|
const y = today.getFullYear();
|
|
const m = String(today.getMonth() + 1).padStart(2, '0');
|
|
const d = String(today.getDate()).padStart(2, '0');
|
|
this.queryParams.createStartTime = `${y}-${m}-${d} 00:00:00`;
|
|
this.queryParams.createEndTime = `${y}-${m}-${d} 23:59:59`;
|
|
} else {
|
|
this.queryParams.createStartTime = undefined;
|
|
this.queryParams.createEndTime = undefined;
|
|
}
|
|
listMaterialWarning(this.queryParams).then(response => {
|
|
this.materialWarningList = response.rows;
|
|
this.total = response.total;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
/** 忽略按钮操作 */
|
|
handleIgnore(row) {
|
|
this.loading = true;
|
|
updateMaterialWarning({ ...row, warningStatus: 2, handleBy: this.$store.state.user.name, handleTime: this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}') }).then(response => {
|
|
this.loading = false;
|
|
this.$message({
|
|
message: "忽略成功",
|
|
type: "success"
|
|
});
|
|
this.getList();
|
|
});
|
|
},
|
|
/** 行样式区分长度告警和厚度告警 */
|
|
getRowClassName({ row }) {
|
|
if (row.warningType === 'LENGTH') return 'warning-row-length';
|
|
if (row.warningType === 'THICKNESS') return 'warning-row-thickness';
|
|
return '';
|
|
},
|
|
/** 判断是否是今天的 */
|
|
isToday(date) {
|
|
const today = new Date();
|
|
const year = today.getFullYear();
|
|
const month = today.getMonth() + 1;
|
|
const day = today.getDate();
|
|
const dateObj = new Date(date);
|
|
const year2 = dateObj.getFullYear();
|
|
const month2 = dateObj.getMonth() + 1;
|
|
const day2 = dateObj.getDate();
|
|
return year === year2 && month === month2 && day === day2;
|
|
},
|
|
/** 处理按钮操作 */
|
|
handleHandle(row) {
|
|
this.loading = true;
|
|
// 填写处理人和处理时间
|
|
updateMaterialWarning({ ...row, warningStatus: 1, handleBy: this.$store.state.user.name, handleTime: this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}') }).then(response => {
|
|
this.loading = false;
|
|
this.$message({
|
|
message: "处理成功",
|
|
type: "success"
|
|
});
|
|
this.getList();
|
|
});
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.open = false;
|
|
this.reset();
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.form = {
|
|
warningId: undefined,
|
|
coilId: undefined,
|
|
warningType: undefined,
|
|
theoreticalVal: undefined,
|
|
actualVal: undefined,
|
|
allowDeviation: undefined,
|
|
deviationValue: undefined,
|
|
deviationRate: undefined,
|
|
warningLevel: undefined,
|
|
warningMsg: undefined,
|
|
warningStatus: undefined,
|
|
handleBy: undefined,
|
|
handleTime: undefined,
|
|
handleRemark: undefined,
|
|
delFlag: undefined,
|
|
createTime: undefined,
|
|
createBy: undefined,
|
|
updateTime: undefined,
|
|
updateBy: 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.warningId)
|
|
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 warningId = row.warningId || this.ids
|
|
getMaterialWarning(warningId).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.warningId != null) {
|
|
updateMaterialWarning(this.form).then(response => {
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.open = false;
|
|
this.getList();
|
|
}).finally(() => {
|
|
this.buttonLoading = false;
|
|
});
|
|
} else {
|
|
addMaterialWarning(this.form).then(response => {
|
|
this.$modal.msgSuccess("新增成功");
|
|
this.open = false;
|
|
this.getList();
|
|
}).finally(() => {
|
|
this.buttonLoading = false;
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
const warningIds = row.warningId || this.ids;
|
|
this.$modal.confirm('是否确认删除钢卷告警编号为"' + warningIds + '"的数据项?').then(() => {
|
|
this.loading = true;
|
|
return delMaterialWarning(warningIds);
|
|
}).then(() => {
|
|
this.loading = false;
|
|
this.getList();
|
|
this.$modal.msgSuccess("删除成功");
|
|
}).catch(() => {
|
|
}).finally(() => {
|
|
this.loading = false;
|
|
});
|
|
},
|
|
/** 导出按钮操作 */
|
|
handleExport() {
|
|
this.download('wms/materialWarning/export', {
|
|
...this.queryParams
|
|
}, `materialWarning_${new Date().getTime()}.xlsx`)
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
.el-table .warning-row-length {
|
|
background-color: #fdf6ec;
|
|
}
|
|
.el-table .warning-row-thickness {
|
|
background-color: #ecf5ff;
|
|
}
|
|
</style>
|