/*
|
* @Description: 产品工艺路线Store
|
* @Author: Ben Lin
|
* @version:
|
* @Date: 2024-06-18 15:09:47
|
* @LastEditors: Ben Lin
|
* @LastEditTime: 2024-10-08 16:10:48
|
*/
|
import { defineStore } from 'pinia';
|
import { store } from '@/store';
|
import { useI18n } from '@/hooks/web/useI18n';
|
import { useMessage } from '@/hooks/web/useMessage';
|
import { h } from 'vue';
|
import { MesRotTree } from '/@/api/tigerapi/model/mesModel';
|
|
interface ProdRouteState {
|
curProdRotTree: Nullable<MesRotTree>;
|
rotList: MesRotTree[];
|
}
|
|
export const useProdRouteStore = defineStore({
|
id: 'app-prodrot',
|
state: (): ProdRouteState => ({
|
curProdRotTree: null,
|
rotList: [],
|
}),
|
getters: {
|
getCurProdRotTree(state): MesRotTree | null {
|
return state.curProdRotTree;
|
},
|
getRotList(state): MesRotTree[] {
|
return state.rotList;
|
},
|
},
|
actions: {
|
getRotList(roleList: MesRotTree[]) {
|
this.rotList = roleList;
|
},
|
setUserInfo(info: MesRotTree | null) {
|
this.curProdRotTree = info;
|
},
|
resetState() {
|
this.curProdRotTree = null;
|
this.rotList = [];
|
},
|
/**
|
* @description: 设置默认工艺路线
|
* @return {*}
|
*/
|
setDefaulRoute() {
|
const { createConfirm } = useMessage();
|
const { t } = useI18n();
|
createConfirm({
|
iconType: 'warning',
|
title: () => h('span', t('sys.app.logoutTip')),
|
content: () => h('span', t('sys.app.logoutMessage')),
|
onOk: async () => {
|
// 主动登出,不带redirect地址
|
// await this.logout(true);
|
},
|
});
|
},
|
},
|
});
|
|
// Need to be used outside the setup
|
export function useProdRouteWithOut() {
|
return useProdRouteStore(store);
|
}
|