初始化仓库
This commit is contained in:
62
store/modules/pwoTransfer.ts
Normal file
62
store/modules/pwoTransfer.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
type TypeObj = {
|
||||
data : object,
|
||||
department :Department[], // 使,
|
||||
listWarehouse: listWarehouse[]
|
||||
[key:string] :any
|
||||
}
|
||||
type Department = {
|
||||
departmentCode: string;
|
||||
departmentTitle: string;
|
||||
id: number;
|
||||
plantId: number;
|
||||
};
|
||||
type listWarehouse = {
|
||||
warehouseName :string;
|
||||
warehouseCode : string;
|
||||
id : number
|
||||
}
|
||||
const pwo = {
|
||||
state:{
|
||||
data:{},
|
||||
department:[],
|
||||
listWarehouse:[]
|
||||
},
|
||||
mutations: {
|
||||
updatData(state : TypeObj ,data :object[]){
|
||||
state.data = data;
|
||||
},
|
||||
/**
|
||||
* 共享部门
|
||||
*/
|
||||
updateDepartment(state : TypeObj,data:Department[]){
|
||||
const arr = []
|
||||
for(let i in data){
|
||||
arr.push({
|
||||
departmentCode:data[i].departmentCode,
|
||||
departmentTitle:data[i].departmentTitle,
|
||||
id:data[i].id,
|
||||
plantId:data[i].plantId
|
||||
})
|
||||
}
|
||||
state.department = arr;
|
||||
console.log('updateDepartment',state.department)
|
||||
},
|
||||
/**
|
||||
* 共享部门
|
||||
*/
|
||||
updateWarehouse(state : TypeObj,data : listWarehouse[]){
|
||||
const arr = []
|
||||
for(let i in data){
|
||||
const item = data[i]
|
||||
arr.push({
|
||||
warehouseName :item.warehouseName,
|
||||
warehouseCode : item.warehouseCode,
|
||||
id : item.id
|
||||
})
|
||||
}
|
||||
state.listWarehouse = arr;
|
||||
console.log('listWarehouse',state.listWarehouse)
|
||||
}
|
||||
}
|
||||
}
|
||||
export default pwo
|
||||
Reference in New Issue
Block a user