春风项目四线(合箱线、总装线)
wujian
2024-01-31 c74dcb8dca7b9e3eded0d20299f19a26a6b70974
提交 | 用户 | 时间
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>
629c9f 86       <el-table-column label="采集时间" align="center" prop="collectionTime" width="160">
fd2207 87         <template slot-scope="scope">
629c9f 88           <span>{{ parseTime(scope.row.collectionTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
fd2207 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="state">
168           <el-input v-model="form.state" placeholder="请输入状态" />
169         </el-form-item>
170         <el-form-item label="参数名称" prop="paramName">
171           <el-input v-model="form.paramName" placeholder="请输入参数名称" />
172         </el-form-item>
173         <el-form-item label="单位" prop="unit">
174           <el-input v-model="form.unit" placeholder="请输入单位" />
175         </el-form-item>
176         <el-form-item label="类型" prop="type">
177           <el-select v-model="form.type" placeholder="请选择类型">
178           </el-select>
179         </el-form-item>
180       </el-form>
181       <div slot="footer" class="dialog-footer">
182         <el-button type="primary" @click="submitForm">确 定</el-button>
183         <el-button @click="cancel">取 消</el-button>
184       </div>
185     </el-dialog>
186   </div>
187 </template>
188
189 <script>
190 import { listParamCollection, getParamCollection, delParamCollection, addParamCollection, updateParamCollection } from "@/api/main/da/paramCollection/paramCollection";
191
192 export default {
193   name: "ParamCollection",
194   data() {
195     return {
196       // 遮罩层
197       loading: true,
198       // 选中数组
199       ids: [],
200       // 非单个禁用
201       single: true,
202       // 非多个禁用
203       multiple: true,
204       // 显示搜索条件
205       showSearch: true,
206       // 总条数
207       total: 0,
208       // 设备产品过程参数采集表格数据
209       paramCollectionList: [],
210       // 弹出层标题
211       title: "",
212       // 是否显示弹出层
213       open: false,
214       // 查询参数
215       queryParams: {
216         pageNum: 1,
217         pageSize: 10,
218         workOrderNo: null,
219         sfcCode: null,
220         productCode: null,
221         productionLine: null,
222         locationCode: null,
223         equipmentNo: null,
224         paramCode: null,
225       },
226       // 表单参数
227       form: {},
228       // 表单校验
229       rules: {
230         id: [
231           { required: true, message: "主键id不能为空", trigger: "blur" }
232         ],
233         workOrderNo: [
234           { required: true, message: "工单编号不能为空", trigger: "blur" }
235         ],
236         sfcCode: [
237           { required: true, message: "总成序列号不能为空", trigger: "blur" }
238         ],
239         productCode: [
240           { required: true, message: "产品编号不能为空", trigger: "blur" }
241         ],
242         productionLine: [
243           { required: true, message: "产线编号不能为空", trigger: "blur" }
244         ],
245         locationCode: [
246           { required: true, message: "工位编号不能为空", trigger: "blur" }
247         ],
248         paramCode: [
249           { required: true, message: "参数编码不能为空", trigger: "blur" }
250         ],
251         paramValue: [
252           { required: true, message: "参数值不能为空", trigger: "blur" }
253         ],
254       }
255     };
256   },
257   created() {
258     this.getList();
259   },
260   methods: {
261     /** 查询设备产品过程参数采集列表 */
262     getList() {
263       this.loading = true;
264       listParamCollection(this.queryParams).then(response => {
265         this.paramCollectionList = response.rows;
266         this.total = response.total;
267         this.loading = false;
268       });
269     },
270     // 取消按钮
271     cancel() {
272       this.open = false;
273       this.reset();
274     },
275     // 表单重置
276     reset() {
277       this.form = {
278         id: null,
279         workOrderNo: null,
280         sfcCode: null,
281         productCode: null,
282         productionLine: null,
283         locationCode: null,
284         equipmentNo: null,
285         paramCode: null,
286         paramValue: null,
287         paramUpper: null,
288         paramLower: null,
289         paramStandard: null,
290         collectionTime: null,
291         spareField1: null,
292         spareField2: null,
293         createUser: null,
294         createTime: null,
295         updateUser: null,
296         updateTime: null,
297         state: null,
298         paramName: null,
299         unit: null,
300         type: null
301       };
302       this.resetForm("form");
303     },
304     /** 搜索按钮操作 */
305     handleQuery() {
306       this.queryParams.pageNum = 1;
307       this.getList();
308     },
309     /** 重置按钮操作 */
310     resetQuery() {
311       this.resetForm("queryForm");
312       this.handleQuery();
313     },
314     // 多选框选中数据
315     handleSelectionChange(selection) {
316       this.ids = selection.map(item => item.id)
317       this.single = selection.length!==1
318       this.multiple = !selection.length
319     },
320     /** 新增按钮操作 */
321     handleAdd() {
322       this.reset();
323       this.open = true;
324       this.title = "添加设备产品过程参数采集";
325     },
326     /** 修改按钮操作 */
327     handleUpdate(row) {
328       this.reset();
329       const id = row.id || this.ids
330       getParamCollection(id).then(response => {
331         this.form = response.data;
332         this.open = true;
333         this.title = "修改设备产品过程参数采集";
334       });
335     },
336     /** 提交按钮 */
337     submitForm() {
338       this.$refs["form"].validate(valid => {
339         if (valid) {
340           if (this.form.id != null) {
341             updateParamCollection(this.form).then(response => {
342               this.$modal.msgSuccess("修改成功");
343               this.open = false;
344               this.getList();
345             });
346           } else {
347             addParamCollection(this.form).then(response => {
348               this.$modal.msgSuccess("新增成功");
349               this.open = false;
350               this.getList();
351             });
352           }
353         }
354       });
355     },
356     /** 删除按钮操作 */
357     handleDelete(row) {
358       const ids = row.id || this.ids;
359       this.$modal.confirm('是否确认删除设备产品过程参数采集编号为"' + ids + '"的数据项?').then(function() {
360         return delParamCollection(ids);
361       }).then(() => {
362         this.getList();
363         this.$modal.msgSuccess("删除成功");
364       }).catch(() => {});
365     },
366     /** 导出按钮操作 */
367     handleExport() {
368       this.download('main/paramCollection/export', {
369         ...this.queryParams
370       }, `paramCollection_${new Date().getTime()}.xlsx`)
371     }
372   }
373 };
374 </script>