From 1d2ce32ab9f9e12f1d7559cdfa2961bc542b7c78 Mon Sep 17 00:00:00 2001 From: xiaomai Date: Tue, 14 Oct 2025 13:40:49 +0800 Subject: [PATCH] feat(item): implement item editing functionality This commit introduces the capability to edit existing items. The `ItemEditModal` has been refactored to support both creation and editing modes. - The modal UI (title, buttons) and submission logic now adapt based on whether an item is being added or edited. - A new `editItem` function is added to the `useItemsStore` to handle the update logic. - Form validation for the item name is enhanced to correctly check for uniqueness during edits. - The table's row action menu now opens the modal in edit mode, pre-populating the form. - The `latestId` generation logic is improved for robustness. - Additionally, this commit adds row selection checkboxes to the items table. --- app/components/item/EditModal.vue | 125 +++++++++++++++++++++++------- app/composables/items.ts | 25 +++++- app/pages/index.vue | 29 ++++++- 3 files changed, 145 insertions(+), 34 deletions(-) diff --git a/app/components/item/EditModal.vue b/app/components/item/EditModal.vue index 189aec6..2aa15a5 100644 --- a/app/components/item/EditModal.vue +++ b/app/components/item/EditModal.vue @@ -1,11 +1,19 @@