Ben Lin
2025-01-01 3f3817a39238b262155cd5ec76fa351bb344602d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * @Description: 工单流程卡Store
 * @Author: Ben Lin
 * @version:
 * @Date: 2024-06-18 15:09:47
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-10-23 22:52:45
 */
import { defineStore } from 'pinia';
import { store } from '@/store';
import { GetWoPickList } from '/@/api/tigerapi/mes/wo';
import { ActionToJson } from '/@/utils/is';
import { WoFlowCardPrintJson } from '/@/api/tigerapi/model/mesModel';
 
interface WoFlowcardState {
  curPrintInfo: WoFlowCardPrintJson[];
  curOrderNo: string;
  curCPInfo: any[];
}
 
export const useWoFlowcardStore = defineStore({
  id: 'app-WoFlowcard',
  state: (): WoFlowcardState => ({
    curPrintInfo: [],
    curOrderNo: '',
    curCPInfo: [],
  }),
  getters: {
    getCurPrintInfo(state): any[] {
      return state.curPrintInfo;
    },
    getCurOrderNo(state): string {
      return state.curOrderNo;
    },
    getCurCPInfo(state): any[] {
      return state.curCPInfo;
    },
  },
  actions: {
    setCurPrintInfo(val: any[]) {
      this.curPrintInfo = val;
    },
    setCurOrderNo(val: string) {
      this.curOrderNo = val;
    },
    resetState() {
      this.curPrintInfo = [];
      this.curOrderNo = '';
      this.curCPInfo = [];
    },
    /**
     * @description: 获取工单备料信息
     * @param {string} tid
     * @return {*}
     */
    async getWoPickList(code: string) {
      this.setCurOrderNo(code);
      const d = ActionToJson(await GetWoPickList(code));
      this.setCurPrintInfo(d.Data);
    },
    async resetFunc(name, f, ByOrg: boolean) {
      
    },
  },
});
 
// Need to be used outside the setup
export function useQueryWithOut() {
  return useWoFlowcardStore(store);
}