提交 | 用户 | 时间
|
0cceb6
|
1 |
<template> |
Y |
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="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> |
|
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-form :model="queryParams" ref="queryParams" size="small" :inline="true" v-show="advancedShowSearch" label-width="68px"/> |
|
27 |
</el-card> |
|
28 |
|
|
29 |
<el-card style="margin-top: 10px" class="box-card"> |
|
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> |
|
76 |
<el-table v-loading="loading" border :data="processesList" @selection-change="handleSelectionChange" v-if="processesList.length > 0"> |
|
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> |
|
82 |
<!-- <el-table-column label="工序类型" align="center" prop="processesType">--> |
|
83 |
<!-- </el-table-column>--> |
|
84 |
<el-table-column label="状态" align="center" prop="status" width="80"> |
|
85 |
<template slot-scope="scope"> |
|
86 |
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
|
87 |
</template> |
|
88 |
</el-table-column> |
|
89 |
<el-table-column label="备注" align="center" prop="remarks"> |
|
90 |
</el-table-column> |
|
91 |
<el-table-column label="创建人" align="center" prop="createUser" width="160"> |
|
92 |
</el-table-column> |
|
93 |
<el-table-column label="创建时间" width="160" align="center" prop="createTime"> |
|
94 |
</el-table-column> |
|
95 |
<el-table-column label="更新人" align="center" prop="updateUser" width="160"> |
|
96 |
</el-table-column> |
|
97 |
<el-table-column label="更改时间" width="160" align="center" prop="updateTime"> |
|
98 |
</el-table-column> |
|
99 |
|
|
100 |
<el-table-column fixed="right" label="操作" width="200" align="center" class-name="small-padding fixed-width"> |
|
101 |
<template slot-scope="scope"> |
|
102 |
<el-button |
|
103 |
size="mini" |
|
104 |
type="success" |
|
105 |
plain |
|
106 |
style="width: 72px" |
|
107 |
icon="el-icon-edit" |
|
108 |
@click="handleUpdate(scope.row)" |
|
109 |
v-hasPermi="['bs:processes:edit']" |
|
110 |
>修改</el-button> |
|
111 |
<el-button |
|
112 |
size="mini" |
|
113 |
plain |
|
114 |
style="width: 72px" |
|
115 |
type="danger" |
|
116 |
icon="el-icon-delete" |
|
117 |
@click="handleDelete(scope.row)" |
|
118 |
v-hasPermi="['bs:processes:remove']" |
|
119 |
>删除</el-button> |
|
120 |
</template> |
|
121 |
</el-table-column> |
|
122 |
</el-table> |
|
123 |
<el-empty v-else> |
|
124 |
<span slot="description">暂无数据</span> |
|
125 |
</el-empty> |
|
126 |
</el-card> |
|
127 |
|
|
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 |
<!-- 添加或修改工序信息对话框 --> |
|
138 |
<el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body> |
|
139 |
<span slot="title"> |
|
140 |
<i class="el-icon-s-order"></i> |
|
141 |
{{titleName}} |
|
142 |
</span> |
|
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>--> |
|
160 |
<!-- <el-form-item label="准备时间" prop="preparationTime">--> |
|
161 |
<!-- <el-input v-model="form.preparationTime" placeholder="请输入准备时间" />--> |
|
162 |
<!-- </el-form-item>--> |
|
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> |
|
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", |
|
192 |
dicts: ['sys_normal_disable'], |
|
193 |
data() { |
|
194 |
return { |
|
195 |
// 遮罩层 |
|
196 |
loading: true, |
|
197 |
titleName: 'test', |
|
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, |
|
214 |
advancedShowSearch: false, |
|
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 |
], |
|
234 |
processesName: [ |
|
235 |
{ required: true, message: "工序名称不能为空", trigger: "blur" } |
|
236 |
], |
|
237 |
processesType: [ |
|
238 |
{ required: true, message: "工序类型不能为空", trigger: "change" } |
|
239 |
], |
|
240 |
} |
|
241 |
}; |
|
242 |
}, |
|
243 |
created() { |
|
244 |
this.getList(); |
|
245 |
}, |
|
246 |
methods: { |
|
247 |
advancedQuery(){ |
|
248 |
this.advancedShowSearch = (this.advancedShowSearch) ? this.advancedShowSearch = false : this.advancedShowSearch = true; |
|
249 |
}, |
|
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, |
|
273 |
status: "0", |
|
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"); |
|
294 |
this.queryParams.remarks = null; |
|
295 |
this.queryParams.createUser = null; |
|
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; |
|
308 |
this.titleName = "添加工序信息"; |
|
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; |
|
317 |
this.titleName = "修改工序信息"; |
|
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> |