lius
2023-06-08 c66a22e4b6bb02667a5000f2e04aeb4ef5ae44c2
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
import Vue from 'vue'
import { queryTreeListByProduction } from "@/api/Tree"
import { SYS_PRODUCTION } from "@/store/mutation-types"
import { getAction } from '@/api/manage'
 
const Production = {
  state: {
    token: '',
    //产线树
    ProductionTree:[]
 
  },
 
  mutations: {
    SET_TOKEN: (state, token) => {
      state.token = token
    },
    SET_PRODUCTION:(state,ProductionTree) => {
      state.ProductionTree = ProductionTree
    }
  },
 
  actions: {
    // 产线树
      QueryProduction({ commit }) {
      return new Promise((resolve, reject) => {
        getAction("/mdc/mdcEquipment/queryTreeListByProduction").then(response => {
          console.log("----产线树--------",response);
          if(response.success){
            const result = response.result
            Vue.ls.set(SYS_PRODUCTION, result)
            commit('SET_PRODUCTION', result)
            resolve(response)
          }else{
            resolve(response)
          }
        }).catch(error => {
          reject(error)
        })
      })
    },
 
 
  }
}
 
export default Production