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