更新init.sql

This commit is contained in:
文睿 张 2026-09-17 17:55:03 +08:00
parent 855642ea75
commit 6a443577b0
2 changed files with 20 additions and 2 deletions

View File

@ -46,7 +46,11 @@
</el-table-column> </el-table-column>
<el-table-column prop="name" label="物料名称" /> <el-table-column prop="name" label="物料名称" />
<el-table-column prop="spec" label="规格" /> <el-table-column prop="spec" label="规格" />
<el-table-column prop="unit" label="单位" width="60" /> <el-table-column label="单位" width="60">
<template #default="{ row }">
{{ getUnitDisplay(row) }}
</template>
</el-table-column>
<el-table-column <el-table-column
label="操作" label="操作"
width="240" width="240"
@ -111,7 +115,7 @@
<el-descriptions-item label="规格">{{ detailRow.spec || '-' }}</el-descriptions-item> <el-descriptions-item label="规格">{{ detailRow.spec || '-' }}</el-descriptions-item>
<el-descriptions-item label="大类类型">{{ getMajorCategoryDisplay(detailRow) }}</el-descriptions-item> <el-descriptions-item label="大类类型">{{ getMajorCategoryDisplay(detailRow) }}</el-descriptions-item>
<el-descriptions-item label="小类类型">{{ getMinorCategoryDisplay(detailRow) }}</el-descriptions-item> <el-descriptions-item label="小类类型">{{ getMinorCategoryDisplay(detailRow) }}</el-descriptions-item>
<el-descriptions-item label="单位">{{ detailRow.unit }}</el-descriptions-item> <el-descriptions-item label="单位">{{ getUnitDisplay(detailRow) }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ formatDate(detailRow.created_at) }}</el-descriptions-item> <el-descriptions-item label="创建时间">{{ formatDate(detailRow.created_at) }}</el-descriptions-item>
<el-descriptions-item label="更新时间" :span="2">{{ formatDate(detailRow.updated_at) }}</el-descriptions-item> <el-descriptions-item label="更新时间" :span="2">{{ formatDate(detailRow.updated_at) }}</el-descriptions-item>
<el-descriptions-item label="物料图片" :span="2"> <el-descriptions-item label="物料图片" :span="2">
@ -214,6 +218,10 @@ function syncUnit(id) {
form.unit = units.value.find(item => item.id === id)?.code || '' 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() { function handleSearch() {
materialsStore.fetchMaterials(1, searchKeyword.value) materialsStore.fetchMaterials(1, searchKeyword.value)
} }

View File

@ -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; 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 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'); 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);