refactor: remove localStorage usage for column visibility and history
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
@ -419,10 +419,7 @@ const allColumns = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
const defaultVisibleCols = ['material_name', 'sku', 'serial_number', 'qty_stock', 'status', 'quality_status', 'product_photo', 'sale_price', 'order_id']
|
const defaultVisibleCols = ['material_name', 'sku', 'serial_number', 'qty_stock', 'status', 'quality_status', 'product_photo', 'sale_price', 'order_id']
|
||||||
const STORAGE_KEY = 'stock_product_visible_columns_v2'
|
const visibleColumnProps = ref(defaultVisibleCols)
|
||||||
const getSavedColumns = () => { try { const saved = localStorage.getItem(STORAGE_KEY); return saved ? JSON.parse(saved) : defaultVisibleCols } catch (e) { return defaultVisibleCols } }
|
|
||||||
const visibleColumnProps = ref(getSavedColumns())
|
|
||||||
watch(visibleColumnProps, (newVal) => { localStorage.setItem(STORAGE_KEY, JSON.stringify(newVal)) }, { deep: true })
|
|
||||||
|
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
id: undefined, base_id: undefined, material_name: '', spec_model: '', material_type: '', category: '', unit: '',
|
id: undefined, base_id: undefined, material_name: '', spec_model: '', material_type: '', category: '', unit: '',
|
||||||
|
|||||||
@ -513,11 +513,8 @@ const stockColumns = [
|
|||||||
]
|
]
|
||||||
const allColumns = [...baseColumns, ...stockColumns]
|
const allColumns = [...baseColumns, ...stockColumns]
|
||||||
|
|
||||||
const STORAGE_KEY = 'stock_semi_visible_columns_v2'
|
|
||||||
const defaultColumns = ['material_name', 'spec_model', 'unit', 'inbound_date', 'sn_bn', 'status', 'quality_status', 'bom_code', 'work_order_code', 'qty_stock', 'qty_available', 'unit_total_cost', 'arrival_photo', 'quality_report_link']
|
const defaultColumns = ['material_name', 'spec_model', 'unit', 'inbound_date', 'sn_bn', 'status', 'quality_status', 'bom_code', 'work_order_code', 'qty_stock', 'qty_available', 'unit_total_cost', 'arrival_photo', 'quality_report_link']
|
||||||
const getSavedColumns = () => { try { const saved = localStorage.getItem(STORAGE_KEY); return saved ? JSON.parse(saved) : defaultColumns } catch (e) { return defaultColumns } }
|
const visibleColumnProps = ref(defaultColumns)
|
||||||
const visibleColumnProps = ref(getSavedColumns())
|
|
||||||
watch(visibleColumnProps, (newVal) => { localStorage.setItem(STORAGE_KEY, JSON.stringify(newVal)) }, {deep: true})
|
|
||||||
|
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
id: undefined, base_id: undefined as number | undefined, material_name: '', spec_model: '', category: '', unit: '', material_type: '',
|
id: undefined, base_id: undefined as number | undefined, material_name: '', spec_model: '', category: '', unit: '', material_type: '',
|
||||||
@ -527,9 +524,6 @@ const form = reactive({
|
|||||||
production_manager: '', production_time_range: [] as string[], arrival_photo: [] as string[], quality_report_link: [] as string[], detail_link: ''
|
production_manager: '', production_time_range: [] as string[], arrival_photo: [] as string[], quality_report_link: [] as string[], detail_link: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
// ------------------------------------
|
|
||||||
// 历史记录管理器
|
|
||||||
// ------------------------------------
|
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
// Autocomplete & Search Logic (后端 API 驱动)
|
// Autocomplete & Search Logic (后端 API 驱动)
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user