feat: 完成巡检任务
This commit is contained in:
@@ -39,29 +39,7 @@ const detailSchema = [
|
||||
api: async () => {
|
||||
const res = await plantsProductList({state:1,inventory:0});
|
||||
plantListData = res.rows || [];
|
||||
|
||||
// 获取当前模态框的数据,包含已添加的产品列表
|
||||
const modalData = modalApi.getData();
|
||||
const existingProducts = modalData?.existingProducts || [];
|
||||
const currentProductId = modalData?.currentProductId;
|
||||
|
||||
// 过滤掉已经添加到产品列表中的产品
|
||||
// 如果是编辑模式,需要排除当前正在编辑的产品
|
||||
const filteredRows = res.rows.filter((item: any) => {
|
||||
// 如果是编辑模式且是当前正在编辑的产品,则保留
|
||||
if (currentProductId && item.id === currentProductId) {
|
||||
return true;
|
||||
}
|
||||
// 过滤掉已添加的产品
|
||||
return !existingProducts.some((existing: any) =>
|
||||
existing.productId === item.id || existing.id === item.id
|
||||
);
|
||||
});
|
||||
|
||||
return {
|
||||
...res,
|
||||
rows: filteredRows
|
||||
};
|
||||
return res;
|
||||
},
|
||||
resultField: 'rows',
|
||||
labelField: 'plantName',
|
||||
|
@@ -29,10 +29,10 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 默认label宽度 px
|
||||
labelWidth: 120,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
componentProps: computed(() => ({
|
||||
class: 'w-full',
|
||||
disabled: isReadonly,
|
||||
},
|
||||
disabled: isReadonly.value,
|
||||
})),
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
@@ -143,13 +143,10 @@ const detailColumns = [
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right' as const,
|
||||
width: 200,
|
||||
},
|
||||
];
|
||||
function handleAddDetail() {
|
||||
detailModalApi.setData({
|
||||
existingProducts: detailTable.value
|
||||
});
|
||||
detailModalApi.setData({});
|
||||
detailModalApi.open();
|
||||
}
|
||||
//添加植物组合包产品
|
||||
@@ -172,13 +169,7 @@ function handleViewDetail(record: any) {
|
||||
}
|
||||
// 编辑产品详情
|
||||
function handleEditDetail(record: any, index: number) {
|
||||
detailModalApi.setData({
|
||||
...record,
|
||||
index,
|
||||
readonly: false,
|
||||
existingProducts: detailTable.value.filter((item: any, i: number) => i !== index),
|
||||
currentProductId: record.productId || record.id
|
||||
});
|
||||
detailModalApi.setData({ ...record, index, readonly: false });
|
||||
detailModalApi.open();
|
||||
}
|
||||
//分类字典
|
||||
|
Reference in New Issue
Block a user