| 1234567891011121314151617181920212223242526272829303132333435363738 |
- import {
- VuexModule,
- Module,
- getModule,
- Mutation,
- Action
- } from "vuex-module-decorators";
- import store from "../index";
- import { getDict } from "@/api/dict";
- import i18n from "@/lang";
- import vue from "vue";
- @Module({ dynamic: true, store, name: "dict", namespaced: true })
- class Dict extends VuexModule {
- private data: {
- [index: string]: IDicts;
- } = {};
- @Action
- public async getList() {
- const list = await getDict();
- this.setList(list);
- }
- @Mutation
- private setList(list: IDicts) {
- vue.set(this.data, i18n.locale, list);
- }
- get list() {
- return this.data[i18n.locale] || {};
- }
- get companyType() {
- return this.list.company_type || [];
- }
- get examineStatus() {
- return this.list.examine_status || [];
- }
- }
- export default getModule(Dict);
|