提交 | 用户 | 时间
|
bdd09a
|
1 |
<template> |
1308d4
|
2 |
<el-main class="contbox" ref="contBox"> |
W |
3 |
<div class="head" ref="headBox"> |
|
4 |
<BaseSearch |
|
5 |
@getList="getList" |
|
6 |
:formItemList="searchFormSchema" |
|
7 |
@search="getList" |
|
8 |
@showSearchChange="getElHeight(28)" |
|
9 |
> |
|
10 |
<template #actionButton> |
|
11 |
<el-col :span="1.5"> |
|
12 |
<el-button |
|
13 |
type="primary" |
|
14 |
plain |
|
15 |
icon="el-icon-plus" |
|
16 |
size="mini" |
|
17 |
@click="handleAdd" |
|
18 |
v-hasPermi="['iqc_checkItem_create']" |
|
19 |
>新增</el-button |
|
20 |
> |
|
21 |
</el-col> |
|
22 |
<el-col :span="1.5"> |
|
23 |
<el-button |
|
24 |
type="success" |
|
25 |
plain |
|
26 |
icon="el-icon-edit" |
|
27 |
size="mini" |
|
28 |
@click="handleUpdate" |
|
29 |
v-hasPermi="['iqc_checkItem_edit']" |
|
30 |
>修改</el-button |
|
31 |
> |
|
32 |
</el-col> |
|
33 |
<el-col :span="1.5"> |
|
34 |
<el-button |
|
35 |
type="danger" |
|
36 |
plain |
|
37 |
icon="el-icon-delete" |
|
38 |
size="mini" |
|
39 |
@click="handleDelete" |
|
40 |
v-hasPermi="['iqc_checkItem_delete']" |
|
41 |
>删除</el-button |
|
42 |
> |
|
43 |
</el-col> |
bdd09a
|
44 |
</template> |
1308d4
|
45 |
</BaseSearch> |
W |
46 |
</div> |
|
47 |
<TableCom |
|
48 |
:column="tabiInfo.columns" |
|
49 |
:table-data="tabiInfo.tableData" |
|
50 |
:table-loading="tabiInfo.tableLoading" |
|
51 |
:isSelection="tabiInfo.isSelection" |
|
52 |
:height="elementHeight" |
|
53 |
rowKey="locationGroupId" |
|
54 |
ref="tabel" |
|
55 |
@checkData="checkData" |
|
56 |
@checkLook="checkInfo" |
|
57 |
> |
|
58 |
<template slot="checkType" slot-scope="scope"> |
|
59 |
<dict-tag |
|
60 |
:options="dict.type.check_type" |
|
61 |
:value="scope.row.checkType" |
|
62 |
/> |
|
63 |
</template> |
|
64 |
<template slot="isAutoCheck" slot-scope="scope"> |
|
65 |
<dict-tag |
|
66 |
:options="dict.type.is_auto_check" |
|
67 |
:value="scope.row.isAutoCheck" |
|
68 |
/> |
|
69 |
</template> |
|
70 |
<template slot="isRequired" slot-scope="scope"> |
|
71 |
<dict-tag |
|
72 |
:options="dict.type.is_required" |
|
73 |
:value="scope.row.isRequired" |
|
74 |
/> |
|
75 |
</template> |
|
76 |
<template slot="auditState" slot-scope="scope"> |
|
77 |
<dict-tag :options="dict.type.audit_status" :value="scope.row.auditState" /> |
|
78 |
</template> |
|
79 |
<template slot="status" slot-scope="scope"> |
|
80 |
<dict-tag :options="dict.type.status" :value="scope.row.status" /> |
|
81 |
</template> |
|
82 |
</TableCom> |
|
83 |
<div class="pagination" ref="pagination"> |
|
84 |
<pagination |
|
85 |
v-show="pageInfo.pageTotal > 0" |
|
86 |
:total="pageInfo.pageTotal" |
|
87 |
:page.sync="pageInfo.currentPage" |
|
88 |
:limit.sync="pageInfo.pageSize" |
|
89 |
@pagination="getList" |
|
90 |
/> |
|
91 |
</div> |
|
92 |
<AddaddModal ref="addaddModal" @getList="getList" /> |
|
93 |
</el-main> |
bdd09a
|
94 |
</template> |
W |
95 |
|
|
96 |
<script> |
1308d4
|
97 |
import TableCom from "@/components/Table/index"; |
W |
98 |
import BaseSearch from "@/components/Table/BaseSearch"; |
|
99 |
|
|
100 |
import { columns, searchFormSchema } from "./info.data"; |
|
101 |
import mixin from "@/components/Table/mixins/resize"; |
|
102 |
|
|
103 |
import { listLocationGroup, delLocationGroup } from "@/api/basicData/locationGroup"; |
|
104 |
import AddaddModal from "./addModal"; |
bdd09a
|
105 |
|
W |
106 |
export default { |
|
107 |
name: "LocationGroup", |
1308d4
|
108 |
components: { TableCom, BaseSearch, AddaddModal }, |
W |
109 |
mixins: [mixin], |
|
110 |
dicts: ["audit_status", "status"], |
bdd09a
|
111 |
data() { |
W |
112 |
return { |
1308d4
|
113 |
searchFormSchema: searchFormSchema, |
W |
114 |
tabiInfo: { |
|
115 |
columns: columns, |
|
116 |
tableData: [], |
|
117 |
tableLoading: false, |
|
118 |
isSelection: true, |
|
119 |
rowClassName: "rowClassName", |
bdd09a
|
120 |
}, |
1308d4
|
121 |
pageInfo: { |
W |
122 |
pageSize: 10, |
|
123 |
pageTotal: 0, |
|
124 |
currentPage: 1, |
|
125 |
}, |
|
126 |
visible: false, |
|
127 |
ids: [], |
|
128 |
open: false, |
bdd09a
|
129 |
}; |
W |
130 |
}, |
1308d4
|
131 |
mounted() { |
bdd09a
|
132 |
this.getList(); |
W |
133 |
}, |
|
134 |
methods: { |
1308d4
|
135 |
getList(info = {}) { |
W |
136 |
this.ids = []; |
|
137 |
this.tabiInfo.tableLoading = true; |
|
138 |
let params = { |
|
139 |
pageSize: this.pageInfo.pageSize, |
|
140 |
pageNum: this.pageInfo.currentPage, |
|
141 |
bizType: 10, |
|
142 |
...info, |
bdd09a
|
143 |
}; |
1308d4
|
144 |
listLocationGroup(params).then((res) => { |
W |
145 |
if (res.code == 200) { |
|
146 |
this.pageInfo.pageTotal = res.total; |
|
147 |
this.tabiInfo.tableData = res.rows; |
|
148 |
this.tabiInfo.tableLoading = false; |
bdd09a
|
149 |
} |
W |
150 |
}); |
|
151 |
}, |
1308d4
|
152 |
checkData(data) { |
W |
153 |
if (data.length) { |
|
154 |
this.ids = data.map((item) => { |
|
155 |
return item.locationGroupId; |
|
156 |
}); |
|
157 |
} else { |
|
158 |
this.ids = []; |
|
159 |
} |
bdd09a
|
160 |
}, |
1308d4
|
161 |
handleAdd() { |
W |
162 |
this.$refs.addaddModal.elDialogShow(1); |
|
163 |
}, |
|
164 |
checkInfo(info) { |
|
165 |
this.$refs.addaddModal.elDialogShow(3, info.locationGroupId); |
|
166 |
}, |
|
167 |
/** 修改按钮操作 */ |
|
168 |
handleUpdate() { |
|
169 |
if (this.ids.length > 1) { |
|
170 |
this.$message({ |
|
171 |
message: "只能操作单条数据!", |
|
172 |
type: "warning", |
|
173 |
}); |
|
174 |
return; |
|
175 |
} else if (this.ids.length < 1) { |
|
176 |
this.$message({ |
|
177 |
message: "请选择数据", |
|
178 |
type: "warning", |
|
179 |
}); |
|
180 |
return; |
|
181 |
} |
|
182 |
this.$refs.addaddModal.elDialogShow(2, this.ids[0]); |
|
183 |
}, |
|
184 |
handleDelete() { |
|
185 |
const locationGroupIds = this.ids; |
|
186 |
|
|
187 |
if (locationGroupIds.length) { |
|
188 |
this.$modal |
|
189 |
.confirm( |
|
190 |
'是否确认删除已选中的数据项?' |
|
191 |
) |
|
192 |
.then(() => { |
|
193 |
this.tabiInfo.tableLoading = true; |
|
194 |
return delLocationGroup(locationGroupIds); |
|
195 |
}) |
|
196 |
.then(() => { |
|
197 |
this.tabiInfo.tableLoading = false; |
|
198 |
this.ids = []; |
|
199 |
this.getList(); |
|
200 |
this.$message({ |
|
201 |
message: "删除成功", |
|
202 |
type: "success", |
|
203 |
}); |
|
204 |
}) |
|
205 |
.catch(() => {}) |
|
206 |
.finally(() => { |
|
207 |
this.tabiInfo.tableLoading = false; |
|
208 |
}); |
|
209 |
} else { |
|
210 |
this.$message({ |
|
211 |
message: "请选择数据", |
|
212 |
type: "warning", |
|
213 |
}); |
|
214 |
} |
|
215 |
}, |
|
216 |
}, |
bdd09a
|
217 |
}; |
W |
218 |
</script> |
1308d4
|
219 |
|
W |
220 |
<style lang="less" scoped> |
|
221 |
.rowClassName { |
|
222 |
height: 50px; |
|
223 |
} |
|
224 |
.contbox { |
|
225 |
width: 100; |
|
226 |
height: 100%; |
|
227 |
} |
|
228 |
</style> |