feat(material): 物料列表页支持URL参数edit_id自动弹出编辑框
This commit is contained in:
@ -597,6 +597,8 @@ import { Plus, Document, Refresh, Setting, Rank, Camera, Link, Download, Bell, C
|
||||
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus';
|
||||
import type { FormInstance, FormRules } from 'element-plus';
|
||||
import { useUserStore } from '@/stores/user';
|
||||
import { useRoute } from 'vue-router';
|
||||
const route = useRoute();
|
||||
|
||||
import {
|
||||
listMaterialBase,
|
||||
@ -1589,6 +1591,21 @@ onMounted(() => {
|
||||
initColumnPermissions();
|
||||
getList();
|
||||
getOptionsList();
|
||||
|
||||
// 【新增】:处理外部跳转自动打开编辑弹窗(来自入库编辑的'前往修改基础信息')
|
||||
if (route.query.edit_id) {
|
||||
const editId = Number(route.query.edit_id);
|
||||
listMaterialBase({ id: editId }).then((res: any) => {
|
||||
const rows = res?.data?.list ?? res?.data ?? [];
|
||||
if (rows.length > 0) {
|
||||
setTimeout(() => {
|
||||
handleEdit(rows[0]);
|
||||
}, 300);
|
||||
}
|
||||
}).catch((error: any) => {
|
||||
console.error('自动获取物料详情失败', error);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user