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
|