春风项目四线(合箱线、总装线)
yyt
2024-01-23 c80c6b24a0d76321780d71c2d4249f5144693096
提交 | 用户 | 时间
fd2207 1 <template>
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="productCode">
6         <el-input
7           v-model="queryParams.productCode"
8           placeholder="请输入产品编码"
9           clearable
10           @keyup.enter.native="handleQuery"
11         />
12       </el-form-item>
13       <el-form-item label="产品名称" prop="productName">
14         <el-input
15           v-model="queryParams.productName"
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     <el-card style="margin-top: 10px" class="box-card">
28     <el-row :gutter="10" class="mb8">
29       <el-col :span="1.5">
30         <el-button
31           type="primary"
32           plain
33           icon="el-icon-plus"
34           size="mini"
35           @click="handleAdd"
36           v-hasPermi="['main:paramCollection:add']"
37         >新增</el-button>
38       </el-col>
39       <el-col :span="1.5">
40         <el-button
41           type="success"
42           plain
43           icon="el-icon-edit"
44           size="mini"
45           :disabled="single"
46           @click="handleUpdate"
47           v-hasPermi="['main:paramCollection:edit']"
48         >修改</el-button>
49       </el-col>
50       <el-col :span="1.5">
51         <el-button
52           type="danger"
53           plain
54           icon="el-icon-delete"
55           size="mini"
56           :disabled="multiple"
57           @click="handleDelete"
58           v-hasPermi="['main:paramCollection:remove']"
59         >删除</el-button>
60       </el-col>
61       <el-col :span="1.5">
62         <el-button
63           type="warning"
64           plain
65           icon="el-icon-download"
66           size="mini"
67           @click="handleExport"
68           v-hasPermi="['main:paramCollection:export']"
69         >导出</el-button>
70       </el-col>
71       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
72     </el-row>
73
74     <el-table v-loading="loading" border :data="paramCollectionList" @selection-change="handleSelectionChange" v-if="paramCollectionList.length > 0">
75       <el-table-column type="selection" width="55" align="center" />
b51361 76       <el-table-column label="工单编号" align="center" prop="workOrderNo"></el-table-column>
db8f36 77       <el-table-column label="总成序列号" align="center" width="140" prop="sfcCode" ></el-table-column>
b51361 78       <el-table-column label="产品编号" align="center" prop="productCode"></el-table-column>
W 79       <el-table-column label="产线编号" align="center" prop="productionLine"></el-table-column>
80       <el-table-column label="工位编号" align="center" prop="locationCode"></el-table-column>
81       <el-table-column label="设备编号" align="center" prop="equipmentNo"></el-table-column>
82       <el-table-column label="参数编码" align="center" prop="paramCode"></el-table-column>
83       <el-table-column label="参数值" align="center" prop="paramValue"></el-table-column>
84       <el-table-column label="参数上限" align="center" prop="paramUpper"></el-table-column>
85       <el-table-column label="参数下限" align="center" prop="paramLower"></el-table-column>
db8f36 86       <el-table-column label="采集时间" align="center" prop="collectionTime" width="100">
fd2207 87         <template slot-scope="scope">
88           <span>{{ parseTime(scope.row.collectionTime, '{y}-{m}-{d}') }}</span>
89         </template>
90       </el-table-column>
b51361 91       <el-table-column label="状态" align="center" prop="state"></el-table-column>
db8f36 92       <el-table-column label="参数名称" align="center" prop="paramName" width="150" ></el-table-column>
b51361 93       <el-table-column label="单位" align="center" prop="unit"></el-table-column>
W 94       <el-table-column label="类型" align="center" prop="type"></el-table-column>
db8f36 95       <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width" >
fd2207 96         <template slot-scope="scope">
97           <el-button
98             size="mini"
db8f36 99             type="success"
H 100             plain
101             style="width: 72px"
fd2207 102             icon="el-icon-edit"
103             @click="handleUpdate(scope.row)"
104             v-hasPermi="['main:paramCollection:edit']"
105           >修改</el-button>
106           <el-button
107             size="mini"
db8f36 108             type="danger"
H 109             plain
110             style="width: 72px"
fd2207 111             icon="el-icon-delete"
112             @click="handleDelete(scope.row)"
113             v-hasPermi="['main:paramCollection:remove']"
114           >删除</el-button>
115         </template>
116       </el-table-column>
117     </el-table>
118       <el-empty v-else>
119         <span slot="description">暂无数据</span>
120       </el-empty>
121     </el-card>
122
123     <pagination
124       v-show="total>0"
125       :total="total"
126       :page.sync="queryParams.pageNum"
127       :limit.sync="queryParams.pageSize"
128       @pagination="getList"
129     />
130
131     <!-- 添加或修改设备产品过程参数采集对话框 -->
132     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
133       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
134         <el-form-item label="工单编号" prop="workOrderNo">
135           <el-input v-model="form.workOrderNo" type="textarea" placeholder="请输入内容" />
136         </el-form-item>
137         <el-form-item label="总成序列号" prop="sfcCode">
138           <el-input v-model="form.sfcCode" type="textarea" placeholder="请输入内容" />
139         </el-form-item>
140         <el-form-item label="产品编号" prop="productCode">
141           <el-input v-model="form.productCode" type="textarea" placeholder="请输入内容" />
142         </el-form-item>
143         <el-form-item label="产线编号" prop="productionLine">
144           <el-input v-model="form.productionLine" type="textarea" placeholder="请输入内容" />
145         </el-form-item>
146         <el-form-item label="工位编号" prop="locationCode">
147           <el-input v-model="form.locationCode" type="textarea" placeholder="请输入内容" />
148         </el-form-item>
149         <el-form-item label="设备编号" prop="equipmentNo">
150           <el-input v-model="form.equipmentNo" type="textarea" placeholder="请输入内容" />
151         </el-form-item>
152         <el-form-item label="参数编码" prop="paramCode">
153           <el-input v-model="form.paramCode" type="textarea" placeholder="请输入内容" />
154         </el-form-item>
155         <el-form-item label="参数值" prop="paramValue">
156           <el-input v-model="form.paramValue" type="textarea" placeholder="请输入内容" />
157         </el-form-item>
158         <el-form-item label="参数上限" prop="paramUpper">
159           <el-input v-model="form.paramUpper" type="textarea" placeholder="请输入内容" />
160         </el-form-item>
161         <el-form-item label="参数下限" prop="paramLower">
162           <el-input v-model="form.paramLower" type="textarea" placeholder="请输入内容" />
163         </el-form-item>
164         <el-form-item label="标准值" prop="paramStandard">
165           <el-input v-model="form.paramStandard" type="textarea" placeholder="请输入内容" />
166         </el-form-item>
167         <el-form-item label="采集时间" prop="collectionTime">
168           <el-date-picker clearable
169             v-model="form.collectionTime"
170             type="date"
171             value-format="yyyy-MM-dd"
172             placeholder="请选择采集时间">
173           </el-date-picker>
174         </el-form-item>
175         <el-form-item label="状态" prop="state">
176           <el-input v-model="form.state" placeholder="请输入状态" />
177         </el-form-item>
178         <el-form-item label="参数名称" prop="paramName">
179           <el-input v-model="form.paramName" placeholder="请输入参数名称" />
180         </el-form-item>
181         <el-form-item label="单位" prop="unit">
182           <el-input v-model="form.unit" placeholder="请输入单位" />
183         </el-form-item>
184         <el-form-item label="类型" prop="type">
185           <el-select v-model="form.type" placeholder="请选择类型">
186           </el-select>
187         </el-form-item>
188       </el-form>
189       <div slot="footer" class="dialog-footer">
190         <el-button type="primary" @click="submitForm">确 定</el-button>
191         <el-button @click="cancel">取 消</el-button>
192       </div>
193     </el-dialog>
194   </div>
195 </template>
196
197 <script>
198 import { listParamCollection, getParamCollection, delParamCollection, addParamCollection, updateParamCollection } from "@/api/main/da/paramCollection/paramCollection";
199
200 export default {
201   name: "ParamCollection",
202   data() {
203     return {
204       // 遮罩层
205       loading: true,
206       // 选中数组
207       ids: [],
208       // 非单个禁用
209       single: true,
210       // 非多个禁用
211       multiple: true,
212       // 显示搜索条件
213       showSearch: true,
214       // 总条数
215       total: 0,
216       // 设备产品过程参数采集表格数据
217       paramCollectionList: [],
218       // 弹出层标题
219       title: "",
220       // 是否显示弹出层
221       open: false,
222       // 查询参数
223       queryParams: {
224         pageNum: 1,
225         pageSize: 10,
226         workOrderNo: null,
227         sfcCode: null,
228         productCode: null,
229         productionLine: null,
230         locationCode: null,
231         equipmentNo: null,
232         paramCode: null,
233       },
234       // 表单参数
235       form: {},
236       // 表单校验
237       rules: {
238         id: [
239           { required: true, message: "主键id不能为空", trigger: "blur" }
240         ],
241         workOrderNo: [
242           { required: true, message: "工单编号不能为空", trigger: "blur" }
243         ],
244         sfcCode: [
245           { required: true, message: "总成序列号不能为空", trigger: "blur" }
246         ],
247         productCode: [
248           { required: true, message: "产品编号不能为空", trigger: "blur" }
249         ],
250         productionLine: [
251           { required: true, message: "产线编号不能为空", trigger: "blur" }
252         ],
253         locationCode: [
254           { required: true, message: "工位编号不能为空", trigger: "blur" }
255         ],
256         paramCode: [
257           { required: true, message: "参数编码不能为空", trigger: "blur" }
258         ],
259         paramValue: [
260           { required: true, message: "参数值不能为空", trigger: "blur" }
261         ],
262       }
263     };
264   },
265   created() {
266     this.getList();
267   },
268   methods: {
269     /** 查询设备产品过程参数采集列表 */
270     getList() {
271       this.loading = true;
272       listParamCollection(this.queryParams).then(response => {
273         this.paramCollectionList = response.rows;
274         this.total = response.total;
275         this.loading = false;
276       });
277     },
278     // 取消按钮
279     cancel() {
280       this.open = false;
281       this.reset();
282     },
283     // 表单重置
284     reset() {
285       this.form = {
286         id: null,
287         workOrderNo: null,
288         sfcCode: null,
289         productCode: null,
290         productionLine: null,
291         locationCode: null,
292         equipmentNo: null,
293         paramCode: null,
294         paramValue: null,
295         paramUpper: null,
296         paramLower: null,
297         paramStandard: null,
298         collectionTime: null,
299         spareField1: null,
300         spareField2: null,
301         createUser: null,
302         createTime: null,
303         updateUser: null,
304         updateTime: null,
305         state: null,
306         paramName: null,
307         unit: null,
308         type: 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.title = "添加设备产品过程参数采集";
333     },
334     /** 修改按钮操作 */
335     handleUpdate(row) {
336       this.reset();
337       const id = row.id || this.ids
338       getParamCollection(id).then(response => {
339         this.form = response.data;
340         this.open = true;
341         this.title = "修改设备产品过程参数采集";
342       });
343     },
344     /** 提交按钮 */
345     submitForm() {
346       this.$refs["form"].validate(valid => {
347         if (valid) {
348           if (this.form.id != null) {
349             updateParamCollection(this.form).then(response => {
350               this.$modal.msgSuccess("修改成功");
351               this.open = false;
352               this.getList();
353             });
354           } else {
355             addParamCollection(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 delParamCollection(ids);
369       }).then(() => {
370         this.getList();
371         this.$modal.msgSuccess("删除成功");
372       }).catch(() => {});
373     },
374     /** 导出按钮操作 */
375     handleExport() {
376       this.download('main/paramCollection/export', {
377         ...this.queryParams
378       }, `paramCollection_${new Date().getTime()}.xlsx`)
379     }
380   }
381 };
382 </script>