You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.0 KiB
TypeScript

/**
* 工作区模块
*/
import { Module, VuexModule, getModule } from 'vuex-module-decorators';
import store from '@/store';
import { session } from '@/store/modules/session';
export interface Area {
driveClassName: string | null;
parkName: string;
poolName: string;
// warehouseType: '1' | '2';
url: string;
userName: string;
// workareaCode: string;
// workareaName: string;
}
export interface Factory {
factory: string;
factoryname: string;
value: string;
label: string;
}
@Module({ dynamic: true, store, namespaced: true, name: 'area' })
class AreaService extends VuexModule {
// 工作区列表
get areas(): Array<Factory> {
if (session.user && session.getUser.poolNameList) {
return session.getUser.poolNameList.map((area) => ({
factory: area.poolName.split('_')[1],
factoryname: area.parkName,
value: area.poolName.split('_')[1],
label: area.parkName,
poolName: area.poolName,
}));
} else {
return [];
}
}
}
export const area = getModule(AreaService);