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