提交 | 用户 | 时间
|
3bbdaf
|
1 |
<template> |
H |
2 |
<div class="app-container"> |
|
3 |
<el-card class="box-card"> |
|
4 |
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
|
5 |
<el-form-item label="设备编码" prop="equipmentCode"> |
|
6 |
<el-input |
|
7 |
v-model="queryParams.equipmentCode" |
|
8 |
placeholder="请输入设备编码" |
|
9 |
clearable |
|
10 |
@keyup.enter.native="handleQuery" |
|
11 |
/> |
|
12 |
</el-form-item> |
|
13 |
<el-form-item label="设备名称" prop="equipmentName"> |
|
14 |
<el-input |
|
15 |
v-model="queryParams.equipmentName" |
|
16 |
placeholder="请输入设备名称" |
|
17 |
clearable |
|
18 |
@keyup.enter.native="handleQuery" |
|
19 |
/> |
|
20 |
</el-form-item> |
|
21 |
<el-form-item style="float: right"> |
|
22 |
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
|
23 |
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
|
24 |
</el-form-item> |
|
25 |
</el-form> |
|
26 |
</el-card> |
|
27 |
|
|
28 |
<el-card style="margin-top: 10px" class="box-card"> |
|
29 |
<el-row :gutter="10" class="mb8"> |
|
30 |
<el-col :span="1.5"> |
|
31 |
<el-button |
|
32 |
type="primary" |
|
33 |
plain |
|
34 |
icon="el-icon-plus" |
|
35 |
size="mini" |
|
36 |
@click="handleAdd" |
|
37 |
v-hasPermi="['em:equipmentArchives:add']" |
|
38 |
>新增</el-button> |
|
39 |
</el-col> |
|
40 |
<el-col :span="1.5"> |
|
41 |
<el-button |
|
42 |
type="success" |
|
43 |
plain |
|
44 |
icon="el-icon-edit" |
|
45 |
size="mini" |
|
46 |
:disabled="single" |
|
47 |
@click="handleUpdate" |
|
48 |
v-hasPermi="['em:equipmentArchives:edit']" |
|
49 |
>修改</el-button> |
|
50 |
</el-col> |
|
51 |
<el-col :span="1.5"> |
|
52 |
<el-button |
|
53 |
type="danger" |
|
54 |
plain |
|
55 |
icon="el-icon-delete" |
|
56 |
size="mini" |
|
57 |
:disabled="multiple" |
|
58 |
@click="handleDelete" |
|
59 |
v-hasPermi="['em:equipmentArchives:remove']" |
|
60 |
>删除</el-button> |
|
61 |
</el-col> |
|
62 |
<el-col :span="1.5"> |
|
63 |
<el-button |
|
64 |
type="warning" |
|
65 |
plain |
|
66 |
icon="el-icon-download" |
|
67 |
size="mini" |
|
68 |
@click="handleExport" |
|
69 |
v-hasPermi="['em:equipmentArchives:export']" |
|
70 |
>导出</el-button> |
|
71 |
</el-col> |
|
72 |
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
|
73 |
</el-row> |
|
74 |
|
|
75 |
<el-table border v-loading="loading" :data="equipmentArchivesList" @selection-change="handleSelectionChange"> |
|
76 |
<el-table-column type="selection" width="55" align="center" /> |
|
77 |
<el-table-column label="设备编码" align="center" prop="equipmentCode"/> |
|
78 |
<el-table-column label="设备名称" align="center" prop="equipmentName"/> |
|
79 |
<el-table-column label="品牌" align="center" prop="equipmentBrand"/> |
|
80 |
<el-table-column label="规格型号" align="center" prop="equipmentSpec"/> |
|
81 |
<el-table-column label="车间编码" align="center" prop="workshopCode"/> |
8043f5
|
82 |
<el-table-column label="产线编码" align="center" prop="lineCode"/> |
3bbdaf
|
83 |
<el-table-column label="设备状态" align="center" prop="status"/> |
c6a3be
|
84 |
<el-table-column label="创建时间" width="160" align="center" prop="createTime"/> |
3bbdaf
|
85 |
<el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width"> |
H |
86 |
<template slot-scope="scope"> |
|
87 |
<el-button |
|
88 |
size="mini" |
|
89 |
type="success" |
|
90 |
plain |
|
91 |
style="width: 72px" |
|
92 |
icon="el-icon-edit" |
|
93 |
@click="handleUpdate(scope.row)" |
|
94 |
v-hasPermi="['em:equipmentArchives:edit']" |
|
95 |
>修改</el-button> |
|
96 |
<el-button |
|
97 |
size="mini" |
|
98 |
type="danger" |
|
99 |
plain |
|
100 |
style="width: 72px" |
|
101 |
icon="el-icon-delete" |
|
102 |
@click="handleDelete(scope.row)" |
|
103 |
v-hasPermi="['em:equipmentArchives:remove']" |
|
104 |
>删除</el-button> |
|
105 |
</template> |
|
106 |
</el-table-column> |
|
107 |
</el-table> |
|
108 |
</el-card> |
|
109 |
|
|
110 |
<pagination |
|
111 |
v-show="total>0" |
|
112 |
:total="total" |
|
113 |
:page.sync="queryParams.pageNum" |
|
114 |
:limit.sync="queryParams.pageSize" |
|
115 |
@pagination="getList" |
|
116 |
/> |
|
117 |
|
|
118 |
<!-- 添加或修改设备档案对话框 --> |
|
119 |
<el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body> |
|
120 |
<span slot="title"> |
|
121 |
<i class="el-icon-s-order"></i> |
|
122 |
{{titleName}} |
|
123 |
</span> |
|
124 |
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
|
125 |
<el-form-item label="设备编码" prop="equipmentCode"> |
|
126 |
<el-input v-model="form.equipmentCode" placeholder="请输入设备编码" /> |
|
127 |
</el-form-item> |
|
128 |
<el-form-item label="设备名称" prop="equipmentName"> |
|
129 |
<el-input v-model="form.equipmentName" placeholder="请输入设备名称" /> |
|
130 |
</el-form-item> |
|
131 |
<el-form-item label="品牌" prop="equipmentBrand"> |
|
132 |
<el-input v-model="form.equipmentBrand" placeholder="请输入品牌" /> |
|
133 |
</el-form-item> |
8043f5
|
134 |
<el-form-item label="设备类型" prop="equipmentTypeName"> |
3bbdaf
|
135 |
<el-input v-model="form.equipmentTypeName" placeholder="请输入设备类型名称" /> |
H |
136 |
</el-form-item> |
|
137 |
<el-form-item label="规格型号" prop="equipmentSpec"> |
|
138 |
<el-input v-model="form.equipmentSpec" placeholder="请输入规格型号" /> |
|
139 |
</el-form-item> |
8043f5
|
140 |
<el-form-item label="车间编号" prop="workshopCode"> |
e76993
|
141 |
<el-select style="width: 100%" @change="handleSelectChange(form.workshopCode)" v-model="form.workshopCode" placeholder="请选择车间编号"> |
8043f5
|
142 |
<el-option |
H |
143 |
v-for="item in options" |
|
144 |
:key="item.workshopCode" |
e76993
|
145 |
:label="item.workshopName" |
8043f5
|
146 |
:value="item.workshopCode"> |
H |
147 |
</el-option> |
|
148 |
</el-select> |
|
149 |
</el-form-item> |
e76993
|
150 |
<el-form-item label="产线编号" prop="lineCode"> |
H |
151 |
<el-select style="width: 100%" v-model="form.lineCode" placeholder="请选择产线编号"> |
8043f5
|
152 |
<el-option |
e76993
|
153 |
v-for="item in lineOptions" |
8043f5
|
154 |
:key="item.lineCode" |
e76993
|
155 |
:label="item.lineName" |
8043f5
|
156 |
:value="item.lineCode"> |
H |
157 |
</el-option> |
|
158 |
</el-select> |
3bbdaf
|
159 |
</el-form-item> |
e76993
|
160 |
<el-form-item label="备注" prop="remark"> |
H |
161 |
<el-input v-model="form.remark" placeholder="请输入备注" /> |
|
162 |
</el-form-item> |
3bbdaf
|
163 |
</el-form> |
H |
164 |
<div slot="footer" class="dialog-footer"> |
|
165 |
<el-button type="primary" @click="submitForm">确 定</el-button> |
|
166 |
<el-button @click="cancel">取 消</el-button> |
|
167 |
</div> |
|
168 |
</el-dialog> |
|
169 |
</div> |
|
170 |
</template> |
|
171 |
|
|
172 |
<script> |
|
173 |
import { listEquipmentArchives, getEquipmentArchives, delEquipmentArchives, addEquipmentArchives, updateEquipmentArchives } from "@/api/main/em/equipmentArchives/equipmentArchives"; |
8043f5
|
174 |
import {listWorkshop} from "@/api/main/bs/workshop/workshop"; |
H |
175 |
import {listLineInfo} from "@/api/main/bs/lineInfo/lineInfo"; |
e76993
|
176 |
import ItemSelect from "@/components/itemSelect/single.vue"; |
H |
177 |
import {listProductionOrde} from "@/api/main/om/productionOrde/productionOrde"; |
3bbdaf
|
178 |
|
H |
179 |
export default { |
|
180 |
name: "EquipmentArchives", |
e76993
|
181 |
components: { |
H |
182 |
ItemSelect , |
|
183 |
}, |
3bbdaf
|
184 |
data() { |
H |
185 |
return { |
|
186 |
// 遮罩层 |
e76993
|
187 |
lineOptions: [], |
H |
188 |
options: [], |
3bbdaf
|
189 |
loading: true, |
H |
190 |
titleName: "", |
|
191 |
// 选中数组 |
|
192 |
ids: [], |
|
193 |
// 非单个禁用 |
|
194 |
single: true, |
|
195 |
// 非多个禁用 |
|
196 |
multiple: true, |
|
197 |
// 显示搜索条件 |
|
198 |
showSearch: true, |
|
199 |
// 总条数 |
|
200 |
total: 0, |
|
201 |
// 设备档案表格数据 |
|
202 |
equipmentArchivesList: [], |
|
203 |
// 弹出层标题 |
|
204 |
title: "", |
|
205 |
// 是否显示弹出层 |
|
206 |
open: false, |
|
207 |
// 查询参数 |
|
208 |
queryParams: { |
|
209 |
pageNum: 1, |
|
210 |
pageSize: 10, |
|
211 |
equipmentCode: null, |
|
212 |
equipmentName: null, |
|
213 |
equipmentBrand: null, |
|
214 |
equipmentSpec: null, |
|
215 |
equipmentTypeId: null, |
|
216 |
equipmentTypeCode: null, |
|
217 |
equipmentTypeName: null, |
|
218 |
workshopCode: null, |
|
219 |
lineCode: null, |
|
220 |
processes: null, |
|
221 |
status: null, |
|
222 |
createUser: null, |
|
223 |
updateUser: null, |
|
224 |
spareField1: null, |
|
225 |
spareField2: null, |
|
226 |
spareField3: null, |
|
227 |
spareField4: null |
|
228 |
}, |
|
229 |
// 表单参数 |
|
230 |
form: {}, |
|
231 |
// 表单校验 |
|
232 |
rules: { |
|
233 |
id: [ |
|
234 |
{ required: true, message: "ID不能为空", trigger: "blur" } |
|
235 |
], |
|
236 |
equipmentCode: [ |
|
237 |
{ required: true, message: "设备编码不能为空", trigger: "blur" } |
|
238 |
], |
|
239 |
equipmentName: [ |
|
240 |
{ required: true, message: "设备名称不能为空", trigger: "blur" } |
|
241 |
], |
|
242 |
equipmentTypeId: [ |
|
243 |
{ required: true, message: "设备类型ID不能为空", trigger: "blur" } |
|
244 |
], |
|
245 |
} |
|
246 |
}; |
|
247 |
}, |
|
248 |
created() { |
|
249 |
this.getList(); |
8043f5
|
250 |
this.initWorkshop(); |
e76993
|
251 |
|
3bbdaf
|
252 |
}, |
H |
253 |
methods: { |
|
254 |
/** 查询设备档案列表 */ |
8043f5
|
255 |
initWorkshop(){ |
de1e72
|
256 |
listWorkshop().then(response => { |
8043f5
|
257 |
this.options = response.rows; |
H |
258 |
}); |
|
259 |
}, |
e76993
|
260 |
// 在这里编写处理选中事件的逻辑 |
H |
261 |
handleSelectChange(selectedOption) { |
|
262 |
this.form.lineCode = null; |
b79f97
|
263 |
let param = { |
H |
264 |
workshopCode : selectedOption |
|
265 |
} |
|
266 |
listLineInfo(param).then(response => { |
e76993
|
267 |
this.lineOptions = response.rows; |
8043f5
|
268 |
}); |
H |
269 |
}, |
3bbdaf
|
270 |
getList() { |
b79f97
|
271 |
// this.$modal.msgSuccess("修改成功"); |
de1e72
|
272 |
console.log(this.queryParams) |
3bbdaf
|
273 |
this.loading = true; |
H |
274 |
listEquipmentArchives(this.queryParams).then(response => { |
|
275 |
this.equipmentArchivesList = response.rows; |
|
276 |
this.total = response.total; |
|
277 |
this.loading = false; |
|
278 |
}); |
|
279 |
}, |
|
280 |
// 取消按钮 |
|
281 |
cancel() { |
|
282 |
this.open = false; |
|
283 |
this.reset(); |
|
284 |
}, |
|
285 |
// 表单重置 |
|
286 |
reset() { |
|
287 |
this.form = { |
|
288 |
id: null, |
|
289 |
equipmentCode: null, |
|
290 |
equipmentName: null, |
|
291 |
equipmentBrand: null, |
|
292 |
equipmentSpec: null, |
|
293 |
equipmentTypeId: null, |
|
294 |
equipmentTypeCode: null, |
|
295 |
equipmentTypeName: null, |
|
296 |
workshopCode: null, |
|
297 |
lineCode: null, |
|
298 |
processes: null, |
|
299 |
status: null, |
|
300 |
remark: null, |
|
301 |
createUser: null, |
|
302 |
createTime: null, |
|
303 |
updateUser: null, |
|
304 |
updateTime: null, |
|
305 |
spareField1: null, |
|
306 |
spareField2: null, |
|
307 |
spareField3: null, |
|
308 |
spareField4: null |
|
309 |
}; |
|
310 |
this.resetForm("form"); |
|
311 |
}, |
|
312 |
/** 搜索按钮操作 */ |
|
313 |
handleQuery() { |
|
314 |
this.queryParams.pageNum = 1; |
|
315 |
this.getList(); |
|
316 |
}, |
|
317 |
/** 重置按钮操作 */ |
|
318 |
resetQuery() { |
|
319 |
this.resetForm("queryForm"); |
|
320 |
this.handleQuery(); |
|
321 |
}, |
|
322 |
// 多选框选中数据 |
|
323 |
handleSelectionChange(selection) { |
|
324 |
this.ids = selection.map(item => item.id) |
|
325 |
this.single = selection.length!==1 |
|
326 |
this.multiple = !selection.length |
|
327 |
}, |
|
328 |
/** 新增按钮操作 */ |
|
329 |
handleAdd() { |
|
330 |
this.reset(); |
|
331 |
this.open = true; |
|
332 |
this.titleName = "添加设备档案"; |
|
333 |
}, |
|
334 |
/** 修改按钮操作 */ |
|
335 |
handleUpdate(row) { |
|
336 |
this.reset(); |
|
337 |
const id = row.id || this.ids |
|
338 |
getEquipmentArchives(id).then(response => { |
|
339 |
this.form = response.data; |
|
340 |
this.open = true; |
|
341 |
this.titleName = "修改设备档案"; |
|
342 |
}); |
|
343 |
}, |
|
344 |
/** 提交按钮 */ |
|
345 |
submitForm() { |
|
346 |
this.$refs["form"].validate(valid => { |
|
347 |
if (valid) { |
|
348 |
if (this.form.id != null) { |
|
349 |
updateEquipmentArchives(this.form).then(response => { |
|
350 |
this.$modal.msgSuccess("修改成功"); |
|
351 |
this.open = false; |
|
352 |
this.getList(); |
|
353 |
}); |
|
354 |
} else { |
|
355 |
addEquipmentArchives(this.form).then(response => { |
|
356 |
this.$modal.msgSuccess("新增成功"); |
|
357 |
this.open = false; |
|
358 |
this.getList(); |
|
359 |
}); |
|
360 |
} |
|
361 |
} |
|
362 |
}); |
|
363 |
}, |
|
364 |
/** 删除按钮操作 */ |
|
365 |
handleDelete(row) { |
|
366 |
const ids = row.id || this.ids; |
|
367 |
this.$modal.confirm('是否确认删除设备档案编号为"' + ids + '"的数据项?').then(function() { |
|
368 |
return delEquipmentArchives(ids); |
|
369 |
}).then(() => { |
|
370 |
this.getList(); |
|
371 |
this.$modal.msgSuccess("删除成功"); |
|
372 |
}).catch(() => {}); |
|
373 |
}, |
|
374 |
/** 导出按钮操作 */ |
|
375 |
handleExport() { |
|
376 |
this.download('em/equipmentArchives/export', { |
|
377 |
...this.queryParams |
|
378 |
}, `equipmentArchives_${new Date().getTime()}.xlsx`) |
|
379 |
} |
|
380 |
} |
|
381 |
}; |
|
382 |
</script> |