|
@@ -2,42 +2,58 @@ import { store } from "@/store";
|
|
|
import { defineStore } from "pinia";
|
|
|
import { getUserDicts } from "@/api/auth";
|
|
|
|
|
|
-export const useDictionaryStore = defineStore("dictionaryStore", () => {
|
|
|
- const types = [
|
|
|
- "station_type",
|
|
|
- "station_operate_type",
|
|
|
- "applicable_platforms",
|
|
|
- "material_properties",
|
|
|
- "quality_testing_plan",
|
|
|
- "material_level",
|
|
|
- "packaging_method",
|
|
|
- "quality_grade",
|
|
|
- "selection_type",
|
|
|
- "device_type",
|
|
|
- "stage",
|
|
|
- "danwei_type",
|
|
|
- "process_type",
|
|
|
- "workshop_section",
|
|
|
- "skill_requirements",
|
|
|
- "accessories_type",
|
|
|
- "trace_type",
|
|
|
- "skill_type",
|
|
|
- "drawing_type",
|
|
|
- "vehicle_level",
|
|
|
- "fault_current_state",
|
|
|
- "escalation_fault_state",
|
|
|
- "defect_mana",
|
|
|
- "disposal_measures_type",
|
|
|
- "process_check_result",
|
|
|
- "excel_states",
|
|
|
- ];
|
|
|
- const dicts = ref<{ [key: string]: any[] }>({});
|
|
|
+export const useDictionaryStore = defineStore(
|
|
|
+ "dictionaryStore",
|
|
|
+ () => {
|
|
|
+ const types = [
|
|
|
+ "station_type",
|
|
|
+ "station_operate_type",
|
|
|
+ "applicable_platforms",
|
|
|
+ "material_properties",
|
|
|
+ "quality_testing_plan",
|
|
|
+ "material_level",
|
|
|
+ "packaging_method",
|
|
|
+ "quality_grade",
|
|
|
+ "selection_type",
|
|
|
+ "device_type",
|
|
|
+ "stage",
|
|
|
+ "danwei_type",
|
|
|
+ "process_type",
|
|
|
+ "workshop_section",
|
|
|
+ "skill_requirements",
|
|
|
+ "accessories_type",
|
|
|
+ "trace_type",
|
|
|
+ "skill_type",
|
|
|
+ "drawing_type",
|
|
|
+ "vehicle_level",
|
|
|
+ "fault_current_state",
|
|
|
+ "escalation_fault_state",
|
|
|
+ "defect_mana",
|
|
|
+ "disposal_measures_type",
|
|
|
+ "process_check_result",
|
|
|
+ "excel_states",
|
|
|
+ ];
|
|
|
+ const dicts = ref<{ [key: string]: any[] }>({});
|
|
|
|
|
|
- return {
|
|
|
- types,
|
|
|
- dicts,
|
|
|
- };
|
|
|
-});
|
|
|
+ return {
|
|
|
+ types,
|
|
|
+ dicts,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ {
|
|
|
+ // 持久化配置
|
|
|
+ persist: {
|
|
|
+ enabled: true,
|
|
|
+ strategies: [
|
|
|
+ {
|
|
|
+ key: "mes-dictionaryData", // 自定义存储键名
|
|
|
+ storage: localStorage, // 使用 localStorage
|
|
|
+ paths: ["dicts"], // 只持久化 dicts 数据
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ }
|
|
|
+);
|
|
|
|
|
|
export function useDictionaryStoreHook() {
|
|
|
// console.log('dicts:',useDictionaryStore(store))
|