asamap
v1.0.14
Published
This is a standardized dictionary data management plugin designed specifically for Asa projects or technology stacks, aimed at solving the maintenance and usage issues of mapping relationships such as enumeration values, status codes, and type options tha
Readme
Asa Map
This is a standardized dictionary data management plugin designed specifically for Asa projects or technology stacks, aimed at solving the maintenance and usage issues of mapping relationships such as enumeration values, status codes, and type options that frequently occur during the development process. It pre integrates about 80% of commonly used static dictionaries in the Asa system (such as status, type, classification, region, etc.) and provides a consistent and convenient way to call them, significantly reducing duplicate definitions and improving development efficiency and code consistency.
core functionality
📚 High coverage dictionary set
Carefully selected and built-in with over 80% of commonly used mapping relationships in Asa business scenarios, covering user status, order type, business classification, universal identification, etc., eliminating the need for manual maintenance from scratch.
🔄 Dual mode output, suitable for different scenarios
Each dictionary provides two data structures, Array and Object:
Array mode: suitable for scenes that directly consume arrays, such as drop-down selection boxes, single selection groups, list rendering, etc., with formats such as [{label: 'enable', value: 1},...].
Object mode: suitable for quick key value lookup, mapping echo, logical judgment, etc., with formats such as {1: 'enable', 0: 'disable'}, supporting quick tag retrieval through values.
🎯 Ready to use, unified management
Dictionary dataset maintenance, decoupled from the project but easy to call. There is no need to repeatedly define the same state mapping in multiple business modules, ensuring that dictionary values with the same meaning are completely consistent throughout the entire system.
⚙️ Lightweight and type friendly
Provide good type hints for TypeScript, which can obtain complete value type and tag type inference when called, improving development experience and code security.
Typical usage scenarios
Form dropdown options: directly obtain the Array format dictionary and bind it to components such as el select and a-select.
Table status display: Based on the values in the data, quickly map the corresponding display labels using Object format.
Logical judgment and filtering: Directly reference dictionary constants in the code to avoid magic numbers or strings.
Unified data format: Ensure that the meaning and display of fields such as status and type remain consistent during front-end and back-end interaction.
Why do we need it?
In the development of the Asa project, different modules often use the same state enumeration (such as "0=not enabled, 1=enabled"). If each developer or module defines themselves, it will result in:
Distributed definition, difficult maintenance
Easy to generate duplicate definitions with inconsistent meanings
Repetitive writing of echo logic
This plugin standardizes and centralizes these dictionaries, providing a set of call schemes that are superior to configuration. You no longer need to manually maintain these mapping arrays, nor do you have to worry about inconsistent state labels between different pages.
Precautions
This plugin is highly customized for Asa technology stack or business system, and the dictionary content is based on its conventional business abstraction, which may not be fully applicable to other projects with completely different architectures.
The remaining 20% are very business specific dictionaries, and it is recommended that they be managed by the project itself in the same way to maintain consistency in usage habits.
The plugin itself does not provide asynchronous dictionary retrieval or dynamic update functions, but focuses on the management and use of static dictionaries.
By using this plugin, Asa project developers can bid farewell to trivial dictionary definitions and focus more on business logic implementation, while ensuring that the dictionary data of the entire system is clear, consistent, and easy to maintain.
