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