diff --git a/frontend/src/views/Materials.vue b/frontend/src/views/Materials.vue index 82cf3245..b43d6bc5 100644 --- a/frontend/src/views/Materials.vue +++ b/frontend/src/views/Materials.vue @@ -46,7 +46,11 @@ - + + + {{ detailRow.spec || '-' }} {{ getMajorCategoryDisplay(detailRow) }} {{ getMinorCategoryDisplay(detailRow) }} - {{ detailRow.unit }} + {{ getUnitDisplay(detailRow) }} {{ formatDate(detailRow.created_at) }} {{ formatDate(detailRow.updated_at) }} @@ -214,6 +218,10 @@ function syncUnit(id) { form.unit = units.value.find(item => item.id === id)?.code || '' } +function getUnitDisplay(row) { + return units.value.find(item => item.id === row.base_unit_id)?.name || row.unit || '-' +} + function handleSearch() { materialsStore.fetchMaterials(1, searchKeyword.value) } diff --git a/scripts/init.sql b/scripts/init.sql index bd12d656..5e5c3952 100644 --- a/scripts/init.sql +++ b/scripts/init.sql @@ -46,3 +46,13 @@ INSERT INTO material_categories (organization_id,code,name,parent_id,status) SELECT organization_id,CONCAT(code,'-02'),CONCAT(name,'·专用型'),id,status FROM material_categories WHERE parent_id IS NULL; INSERT INTO warehouses (id,organization_id,code,name,status) VALUES (1,1,'DEFAULT','默认仓库','active'); INSERT INTO warehouse_locations (id,warehouse_id,code,name,status) VALUES (1,1,'MAIN','主库位','active'); + +-- The repository is maintained on Windows. Normalize the UTF-8 seed literals +-- after MySQL imports this file so they remain correct regardless of client codepage. +UPDATE organizations SET name=CONVERT(BINARY CONVERT(name USING latin1) USING utf8mb4); +UPDATE roles SET name=CONVERT(BINARY CONVERT(name USING latin1) USING utf8mb4); +UPDATE permissions SET name=CONVERT(BINARY CONVERT(name USING latin1) USING utf8mb4); +UPDATE material_types SET name=CONVERT(BINARY CONVERT(name USING latin1) USING utf8mb4); +UPDATE material_categories SET name=CONVERT(BINARY CONVERT(name USING latin1) USING utf8mb4); +UPDATE warehouses SET name=CONVERT(BINARY CONVERT(name USING latin1) USING utf8mb4); +UPDATE warehouse_locations SET name=CONVERT(BINARY CONVERT(name USING latin1) USING utf8mb4);