4.29扫码获取库位小工具接口
This commit is contained in:
@ -77,4 +77,13 @@ export function getLatestSpecs() {
|
||||
url: '/inbound/base/spec-latest',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 8. 标记预警物料已采购
|
||||
export function markWarningOrdered(data: { baseId: number; isOrdered: boolean }) {
|
||||
return request({
|
||||
url: '/inbound/base/warning/mark-ordered',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
@ -302,10 +302,14 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="userStore.hasPermission('material_list:operation')" label="操作" min-width="200" fixed="right" align="center">
|
||||
<el-table-column v-if="userStore.hasPermission('material_list:operation')" label="操作" width="280" fixed="right" align="center">
|
||||
<template #default="scope">
|
||||
<el-button v-if="userStore.hasPermission('material_list:operation')" link type="primary" size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
||||
<el-button v-if="userStore.hasPermission('material_list:edit_warning')" link type="warning" size="small" @click="handleSetSingleWarning(scope.row)">设置预警</el-button>
|
||||
<template v-if="userStore.hasPermission('material_list:edit_warning') && scope.row.warningStatus > 0">
|
||||
<el-button v-if="scope.row.warningOrdered" disabled size="small" type="info">采购在途</el-button>
|
||||
<el-button v-else link type="success" size="small" @click="handleMarkOrdered(scope.row)">标记已采购</el-button>
|
||||
</template>
|
||||
<el-button v-if="userStore.hasPermission('material_list:operation')" link type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -560,10 +564,16 @@
|
||||
<el-input-number v-model="warningForm.redThreshold" :min="0" :precision="0" step="1" placeholder="库存≤此值为红色预警" style="width: 100%" />
|
||||
<div class="form-tip">库存数量 ≤ 此值时显示红色预警</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="红色预警邮箱" v-if="warningForm.isEnabled">
|
||||
<el-input v-model="warningForm.redEmails" placeholder="逗号分隔多个邮箱" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="黄色阈值" prop="yellowThreshold" v-if="warningForm.isEnabled">
|
||||
<el-input-number v-model="warningForm.yellowThreshold" :min="0" :precision="0" step="1" placeholder="库存≤此值为黄色预警" style="width: 100%" />
|
||||
<div class="form-tip">红色阈值 < 库存 ≤ 此值时显示黄色预警</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="黄色预警邮箱" v-if="warningForm.isEnabled">
|
||||
<el-input v-model="warningForm.yellowEmails" placeholder="逗号分隔多个邮箱" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@ -622,7 +632,8 @@ import {
|
||||
getMaterialBaseOptions,
|
||||
exportAssetStatistics,
|
||||
batchSetWarning,
|
||||
batchSetInspection
|
||||
batchSetInspection,
|
||||
markWarningOrdered
|
||||
} from '@/api/material_base';
|
||||
import { uploadFile, deleteFile } from '@/api/common/upload';
|
||||
import WebRtcCamera from '@/components/Camera/WebRtcCamera.vue';
|
||||
@ -646,6 +657,8 @@ interface MaterialBaseVO {
|
||||
statusLoading?: boolean;
|
||||
inventoryCount?: number;
|
||||
availableCount?: number;
|
||||
warningStatus?: number;
|
||||
warningOrdered?: boolean;
|
||||
}
|
||||
|
||||
interface QueryParams {
|
||||
@ -791,7 +804,9 @@ const warningLoading = ref(false);
|
||||
const warningForm = reactive({
|
||||
isEnabled: false,
|
||||
redThreshold: undefined as number | undefined,
|
||||
yellowThreshold: undefined as number | undefined
|
||||
yellowThreshold: undefined as number | undefined,
|
||||
redEmails: '',
|
||||
yellowEmails: ''
|
||||
});
|
||||
const warningRules = {
|
||||
yellowThreshold: [
|
||||
@ -1388,11 +1403,34 @@ const handleSetSingleWarning = (row: MaterialBaseVO) => {
|
||||
warningForm.isEnabled = row.warningEnabled || false;
|
||||
warningForm.redThreshold = row.warningRed;
|
||||
warningForm.yellowThreshold = row.warningYellow;
|
||||
warningForm.redEmails = (row as any).redEmails || '';
|
||||
warningForm.yellowEmails = (row as any).yellowEmails || '';
|
||||
|
||||
warningDialog.title = '设置预警';
|
||||
warningDialog.visible = true;
|
||||
};
|
||||
|
||||
// 标记预警物料已采购
|
||||
const handleMarkOrdered = (row: MaterialBaseVO) => {
|
||||
ElMessageBox.confirm(
|
||||
'确认已对该预警物料下单?标记后在途期间将不再发送预警邮件。',
|
||||
'确认标记已采购',
|
||||
{
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
).then(async () => {
|
||||
try {
|
||||
await markWarningOrdered({ baseId: row.id, isOrdered: true });
|
||||
ElMessage.success('已标记为已采购');
|
||||
getList();
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error?.msg || '标记失败');
|
||||
}
|
||||
}).catch(() => {});
|
||||
};
|
||||
|
||||
// 提交预警设置
|
||||
const submitWarning = async () => {
|
||||
if (!warningFormRef.value) return;
|
||||
@ -1415,7 +1453,9 @@ const submitWarning = async () => {
|
||||
baseId,
|
||||
isEnabled: warningForm.isEnabled,
|
||||
redThreshold: red,
|
||||
yellowThreshold: yellow
|
||||
yellowThreshold: yellow,
|
||||
redEmails: warningForm.redEmails || '',
|
||||
yellowEmails: warningForm.yellowEmails || ''
|
||||
}));
|
||||
|
||||
await batchSetWarning(data);
|
||||
@ -1463,17 +1503,13 @@ const submitBatchInspection = async () => {
|
||||
|
||||
// 表格行样式(根据预警状态)
|
||||
const tableRowClassName = ({ row }: { row: MaterialBaseVO }) => {
|
||||
// 只有拥有 view_warning 权限且有预警状态时才显示特殊样式
|
||||
if (!userStore.hasPermission('material_list:view_warning')) return '';
|
||||
|
||||
const status = (row as any).warningStatus;
|
||||
if (status === 2) {
|
||||
return 'warning-row-red'; // 红色预警
|
||||
} else if (status === 1) {
|
||||
return 'warning-row-yellow'; // 黄色预警
|
||||
if (row.warningStatus === 2) {
|
||||
return 'danger-row'; // 红色预警
|
||||
} else if (row.warningStatus === 1) {
|
||||
return 'warning-row'; // 黄色预警
|
||||
}
|
||||
return '';
|
||||
};
|
||||
}
|
||||
|
||||
// --- 文件上传辅助函数 ---
|
||||
|
||||
@ -1715,34 +1751,32 @@ onMounted(() => {
|
||||
.upload-file-item .el-upload-list__item-actions .el-icon { color: #fff; font-size: 20px; cursor: pointer; margin: 0 4px; }
|
||||
.upload-add-trigger { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
|
||||
|
||||
/* 预警行样式 - 加深颜色 */
|
||||
:deep(.warning-row-red) {
|
||||
--el-table-tr-bg-color: #ffcdd2 !important;
|
||||
background-color: #ffcdd2 !important;
|
||||
}
|
||||
:deep(.warning-row-red td) {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
:deep(.warning-row-yellow) {
|
||||
--el-table-tr-bg-color: #fff59d !important;
|
||||
background-color: #fff59d !important;
|
||||
}
|
||||
:deep(.warning-row-yellow td) {
|
||||
background-color: transparent !important;
|
||||
/* ================================================================
|
||||
Element Plus 表格预警行样式 & 固定列重叠修复
|
||||
================================================================ */
|
||||
|
||||
/* 黄色预警行底色 (全覆盖) */
|
||||
:deep(.el-table .warning-row),
|
||||
:deep(.el-table .warning-row > td.el-table__cell) {
|
||||
background-color: #fcedc4 !important; /* 明显的黄色 */
|
||||
}
|
||||
|
||||
/* 表单提示文字 */
|
||||
.form-tip {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-top: 4px;
|
||||
line-height: 1.4;
|
||||
/* 红色预警行底色 (全覆盖) */
|
||||
:deep(.el-table .danger-row),
|
||||
:deep(.el-table .danger-row > td.el-table__cell) {
|
||||
background-color: #fcd3d3 !important; /* 明显的红色 */
|
||||
}
|
||||
|
||||
/* 固定列的按钮容器底色跟随所在行的背景色,视觉无缝融合 */
|
||||
:deep(.el-table .el-table__cell.is-fixed) {
|
||||
background-color: inherit !important;
|
||||
}
|
||||
|
||||
/* 按钮间距微调,更紧凑 */
|
||||
:deep(.el-table .el-table__cell.is-fixed .cell) {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
justify-content: flex-start; /* 左对齐更自然 */
|
||||
flex-wrap: nowrap; /* 尽量不换行 */
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
/* 增加下拉框的最大高度,使其能容纳更多选项而不必频繁滚动 */
|
||||
.long-dropdown .el-select-dropdown__wrap {
|
||||
max-height: 600px !important; /* 可以根据屏幕大小适当调整 */
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user