shelveindex.vue
4.21 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<template>
<div class="app-container">
<el-row :gutter="20">
<el-col :span="5" :xs="24">
<div class="head-container">
<el-tree
:data="options"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
:default-expand-all=true
node-key="id"
ref="tree"
show-checkbox
highlight-current
@check="handleNodeClick"
/>
</div>
</el-col>
<el-col :span="19" :xs="24" >
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="年度" align="center" prop="year" />
<el-table-column label="卷盒规格" align="center" prop="boxRule" />
<el-table-column label="盒号" align="center" prop="boxMark" />
<el-table-column label="库位码" align="center" prop="deportNodeId" />
<el-table-column label="描述" align="center" prop="describes" />
</el-table>
</el-col>
</el-row>
</div>
</template>
<script>
import {treeselect} from "@/api/service/depot";
import {listByIds, shelve, shelveDown, updateBox} from "@/api/archives/box";
export default {
name: "shelveBox",
props: {
ids: {
type: Array,// 这里你接收的值是什么类型就写什么类型
},
shelveType: {
type: Number,// 这里你接收的值是什么类型就写什么类型
}
},
data() {
return {
options: undefined,
defaultProps: {
children: "children",
label: "label"
},
multiple: true,
single:true,
loading: true,
list: [],
queryParams:{
depotNodeId:undefined
},
params:{
depotNodeId:undefined,
ids:undefined,
depotCode:undefined
}
};
},
created() {
this.getTreeselect();
},
methods: {
getTreeselect() {
treeselect().then(response => {
this.options = response.data;
let id=response.data[0].id;
});
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
// 节点单击事件
handleNodeClick(data) {
this.clearCheck();
this.$refs.tree.setChecked(data.id,true,false);
this.params.depotNodeId=data.id;
this.params.depotCode=data.depotCode;
this.queryParams.deportNodeId=data.depotCode;
this.deportNodeId=data.depotCode;
this.getList();
},
clearCheck(){
let arr=this.$refs.tree.getCheckedKeys(true);
arr.forEach(k=>{
this.$refs.tree.setChecked(k,false,false);
})
this.queryParams.deportNodeId=undefined;
this.params.depotNodeId=undefined;
this.params.ids=undefined;
this.params.depotCode=undefined;
},
getList() {
this.loading = true;
if(this.shelveType==2 && this.queryParams.deportNodeId==undefined){
this.queryParams.deportNodeId='isNotNull'
}
if(this.shelveType==1){
this.queryParams.deportNodeId='isNull'
}
listByIds(this.queryParams,this.ids).then(response => {
this.list = response.rows;
this.loading = false;
});
},
// 多选框选中数据
handleSelectionChange(selection) {
this.params.ids= selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
shelve(){
if(this.params.depotNodeId==undefined){
this.$modal.msgWarning("请选择档案架")
return;
}
if(this.params.ids==undefined||this.params.ids.length==0){
this.$modal.msgWarning("至少选择一条")
return;
}
shelve(this.params).then(response => {
this.$modal.msgSuccess("修改成功");
this.getList();
});
},
shelveDown(){
if(this.params.ids==undefined||this.params.ids.length==0){
this.$modal.msgWarning("至少选择一条")
return;
}
shelveDown(this.params).then(response => {
this.$modal.msgSuccess("修改成功");
this.getList();
});
}
}
}
</script>