春风项目四线(合箱线、总装线)
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="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="productCode">
14             <el-input
15               v-model="queryParams.productCode"
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
28     <el-card style="margin-top: 10px" class="box-card">
29         <el-row :gutter="10" class="mb8">
30           <el-col :span="1.5">
31             <el-button
32               type="primary"
33               plain
34               icon="el-icon-plus"
35               size="mini"
36               @click="handleAdd"
37               v-hasPermi="['da:collectionParamConf:add']"
38             >新增</el-button>
39           </el-col>
40           <el-col :span="1.5">
41             <el-button
42               type="success"
43               plain
44               icon="el-icon-edit"
45               size="mini"
46               :disabled="single"
47               @click="handleUpdate"
48               v-hasPermi="['da:collectionParamConf:edit']"
49             >修改</el-button>
50           </el-col>
51           <el-col :span="1.5">
52             <el-button
53               type="danger"
54               plain
55               icon="el-icon-delete"
56               size="mini"
57               :disabled="multiple"
58               @click="handleDelete"
59               v-hasPermi="['da:collectionParamConf:remove']"
60             >删除</el-button>
61           </el-col>
62           <el-col :span="1.5">
63             <el-button
64               type="warning"
65               plain
66               icon="el-icon-download"
67               size="mini"
68               @click="handleExport"
69               v-hasPermi="['da:collectionParamConf:export']"
70             >导出</el-button>
71           </el-col>
72           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
73         </el-row>
74
75         <el-table border v-loading="loading" :data="collectionParamConfList" @selection-change="handleSelectionChange">
76           <el-table-column type="selection" width="55" align="center" />
77 <!--          <el-table-column label="主键id" align="center" prop="id" />-->
78           <el-table-column label="产品编码" align="center" width="150" prop="productCode">
79           </el-table-column>
80           <el-table-column label="工序编号" align="center" width="80" prop="processesCode">
81           </el-table-column>
82           <el-table-column label="参数集编码" align="center" width="130" prop="parameterSetCode">
83           </el-table-column>
84           <el-table-column label="参数集名称" align="center" width="160" prop="parameterSetName">
85           </el-table-column>
86           <el-table-column label="参数编码" align="center" width="130" prop="collectParameterId">
87           </el-table-column>
88           <el-table-column label="参数名称" align="center" width="160" prop="collectParameterName">
89           </el-table-column>
ebfc87 90
fd2207 91
92           <el-table-column label="采集地址" align="center" width="180" prop="gatherAddress">
93           </el-table-column>
94           <el-table-column label="采集顺序" align="center" width="80" prop="gatherSequence">
95           </el-table-column>
96
97           <el-table-column label="参数类型" align="center" width="130" prop="collectParameterType">
98           </el-table-column>
99           <el-table-column label="单位" align="center" width="80" prop="collectParameterUnit">
100           </el-table-column>
ebfc87 101
fd2207 102           <el-table-column label="上限值" align="center" prop="paramUpper">
103           </el-table-column>
104           <el-table-column label="下限值" align="center" prop="paramLower">
105           </el-table-column>
106           <el-table-column label="中心值" align="center" prop="paramCentral">
107           </el-table-column>
108
109           <el-table-column label="备注" align="center" width="160" prop="remarks">
110           </el-table-column>
ebfc87 111           <el-table-column label="是否作为采集参数类型" align="center" width="160" prop="contrastParameterFlag">
J 112             <template slot-scope="scope">
113               <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.contrastParameterFlag"/>
114             </template>
115           </el-table-column>
116
fd2207 117           <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width">
118             <template slot-scope="scope">
119               <el-button
120                 size="mini"
121                 type="success"
122                 plain
123                 style="width: 72px"
124                 icon="el-icon-edit"
125                 @click="handleUpdate(scope.row)"
126                 v-hasPermi="['da:collectionParamConf:edit']"
127               >修改</el-button>
128               <el-button
129                 size="mini"
130                 type="danger"
131                 plain
132                 style="width: 72px"
133                 icon="el-icon-delete"
134                 @click="handleDelete(scope.row)"
135                 v-hasPermi="['da:collectionParamConf:remove']"
136               >删除</el-button>
137             </template>
138           </el-table-column>
139         </el-table>
140     </el-card>
141
142     <pagination
143       v-show="total>0"
144       :total="total"
145       :page.sync="queryParams.pageNum"
146       :limit.sync="queryParams.pageSize"
147       @pagination="getList"
148     />
149
150     <!-- 添加或修改采集参数配置对话框 -->
ebfc87 151     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="1000px" append-to-body>
fd2207 152       <span slot="title">
153         <i class="el-icon-s-order"></i>
154         {{titleName}}
155       </span>
ebfc87 156       <el-form ref="form" inline :model="form" :rules="rules"  label-width="200px" >
fd2207 157         <el-form-item label="工序编号" prop="processesCode">
ebf004 158           <el-select style="width: 100%" @change="handleSelectChangeprocessesCode(form.processesCode)" v-model="form.processesCode" placeholder="请选择工序编号">
J 159             <el-option
160               v-for="item in options"
161               :key="item.processesCode"
162               :label="item.processesCode"
163               :value="item.processesCode">
164             </el-option>
165           </el-select>
fd2207 166         </el-form-item>
167         <el-form-item label="参数集编码" prop="parameterSetCode">
168           <el-input v-model="form.parameterSetCode" placeholder="请输入参数集编码" />
169         </el-form-item>
170         <el-form-item label="参数集名称" prop="parameterSetName">
171           <el-input v-model="form.parameterSetName" placeholder="请输入参数集名称" />
172         </el-form-item>
173         <el-form-item label="采集参数ID" prop="collectParameterId">
174           <el-input v-model="form.collectParameterId" placeholder="请输入采集参数ID" />
175         </el-form-item>
176         <el-form-item label="采集参数名称" prop="collectParameterName">
177           <el-input v-model="form.collectParameterName" placeholder="请输入采集参数名称" />
178         </el-form-item>
ebfc87 179         <el-form-item label="是否作为对比参数"  prop="contrastParameterFlag" >
J 180           <el-select v-model="form.contrastParameterFlag" placeholder="请选择是否作为对比参数">
181             <el-option
182               v-for="dict in dict.type.sys_yes_no"
183               :key="dict.value"
184               :label="dict.label"
185               :value="dict.value"
186             ></el-option>
187           </el-select>
fd2207 188         </el-form-item>
189         <el-form-item label="采集参数单位" prop="collectParameterUnit">
190           <el-input v-model="form.collectParameterUnit" placeholder="请输入采集参数单位" />
191         </el-form-item>
192         <el-form-item label="数据描述" prop="Descriptives">
193           <el-input v-model="form.Descriptives" placeholder="请输入数据描述" />
194         </el-form-item>
195         <el-form-item label="上限值" prop="paramUpper">
196           <el-input v-model="form.paramUpper" placeholder="请输入上限值" />
197         </el-form-item>
198         <el-form-item label="下限值" prop="paramLower">
199           <el-input v-model="form.paramLower" placeholder="请输入下限值" />
200         </el-form-item>
201         <el-form-item label="中心值" prop="paramCentral">
202           <el-input v-model="form.paramCentral" placeholder="请输入中心值" />
203         </el-form-item>
204         <el-form-item label="产品编码" prop="productCode">
205           <el-input v-model="form.productCode" placeholder="请输入产品编码" />
206         </el-form-item>
207         <el-form-item label="采集地址" prop="gatherAddress">
208           <el-input v-model="form.gatherAddress" placeholder="请输入采集地址" />
209         </el-form-item>
210         <el-form-item label="采集顺序" prop="gatherSequence">
211           <el-input v-model="form.gatherSequence" placeholder="请输入采集顺序" />
212         </el-form-item>
213         <el-form-item label="备注" prop="remarks">
214           <el-input v-model="form.remarks" placeholder="请输入备注" />
215         </el-form-item>
216       </el-form>
217       <div slot="footer" class="dialog-footer">
218         <el-button type="primary" @click="submitForm">确 定</el-button>
219         <el-button @click="cancel">取 消</el-button>
220       </div>
221     </el-dialog>
222   </div>
223 </template>
224
225 <script>
226 import { listCollectionParamConf, getCollectionParamConf, delCollectionParamConf, addCollectionParamConf, updateCollectionParamConf } from "@/api/main/da/collectionParamConf/collectionParamConf";
ebf004 227 import {listProcesses} from "@/api/main/bs/processes/processes";
fd2207 228
229 export default {
230   name: "CollectionParamConf",
ebfc87 231   dicts: ['subscription_type', 'sys_yes_no', 'data_type','sys_normal_disable'],
fd2207 232   data() {
233     return {
ebf004 234       options: [],
fd2207 235       // 遮罩层
236       loading: true,
237       titleName: "",
238       // 选中数组
239       ids: [],
240       // 非单个禁用
241       single: true,
242       // 非多个禁用
243       multiple: true,
244       // 显示搜索条件
245       showSearch: true,
246       // 总条数
247       total: 0,
248       // 采集参数配置表格数据
249       collectionParamConfList: [],
250       // 弹出层标题
251       title: "",
252       // 是否显示弹出层
253       open: false,
254       // 查询参数
255       queryParams: {
256         pageNum: 1,
257         pageSize: 10,
258         processesCode: null,
259         parameterSetCode: null,
260         parameterSetName: null,
261         collectParameterId: null,
262         collectParameterName: null,
263         contrastParameterFlag: null,
264         collectParameterType: null,
265         productCode: null,
266       },
ebf004 267
J 268       processesCodeQueryParams:{
269         pageNum: 1,
270         pageSize: 10,
271         processesCode: null,
272         processesName: null,
273         processesType: null,
274         ipAddress: null,
275         spareField1: null,
276         spareField2: null,
277         spareField3: null,
278         spareField4: null,
279         createUser: null,
280         updateUser: null,
281         remarks: null
282       },
fd2207 283       // 表单参数
284       form: {},
285       // 表单校验
286       rules: {
287         id: [
288           { required: true, message: "主键id不能为空", trigger: "blur" }
289         ],
ebf004 290         processesCode: [
J 291           { required: true, message: "工序编号不能为空", trigger: "blur" }
292         ],
293         parameterSetCode: [
294           { required: true, message: "参数集编码不能为空", trigger: "blur" }
295         ],
296         parameterSetName: [
297           { required: true, message: "参数集名称不能为空", trigger: "blur" }
298         ],
299         collectParameterId: [
300           { required: true, message: "采集参数ID不能为空", trigger: "blur" }
301         ],
302         collectParameterName: [
303           { required: true, message: "采集参数名称不能为空", trigger: "blur" }
304         ],
305         collectParameterUnit: [
306           { required: true, message: "采集参数单位不能为空", trigger: "blur" }
307         ],
308         gatherAddress: [
309           { required: true, message: "采集地址不能为空", trigger: "blur" }
310         ],
311         gatherSequence: [
312           { required: true, message: "采集顺序不能为空", trigger: "blur" }
313         ],
fd2207 314       }
315     };
316   },
317   created() {
318     this.getList();
ebf004 319     this.initProcesses()
fd2207 320   },
321   methods: {
ebf004 322
J 323
324     handleSelectChangeprocessesCode(selectedOption) {
325       this.processesCodeQueryParams.processesCode = selectedOption;
326       listProcesses(this.processesCodeQueryParams).then(response => {
327         this.form.collectParameterName = response.rows[0].collectParameterName;
328       });
329     },
330     initProcesses(){
331       listProcesses(this.queryParams).then(response => {
332         this.options = response.rows;
333       });
334     },
fd2207 335     /** 查询采集参数配置列表 */
336     getList() {
337       this.loading = true;
338       listCollectionParamConf(this.queryParams).then(response => {
339         this.collectionParamConfList = response.rows;
340         this.total = response.total;
341         this.loading = false;
342       });
343     },
344     // 取消按钮
345     cancel() {
346       this.open = false;
347       this.reset();
348     },
349     // 表单重置
350     reset() {
351       this.form = {
352         id: null,
353         processesCode: null,
354         parameterSetCode: null,
355         parameterSetName: null,
356         collectParameterId: null,
357         collectParameterName: null,
358         contrastParameterFlag: null,
359         collectParameterType: null,
360         collectParameterUnit: null,
361         Descriptives: null,
362         paramUpper: null,
363         paramLower: null,
364         paramCentral: null,
365         productCode: null,
366         gatherAddress: null,
367         gatherSequence: null,
368         remarks: null,
369         createUser: null,
370         createTime: null,
371         updateUser: null,
372         updateTime: null,
373         spareField1: null,
374         spareField2: null,
375         spareField3: null,
376         spareField4: null
377       };
378       this.resetForm("form");
379     },
380     /** 搜索按钮操作 */
381     handleQuery() {
382       this.queryParams.pageNum = 1;
383       this.getList();
384     },
385     /** 重置按钮操作 */
386     resetQuery() {
387       this.resetForm("queryForm");
388       this.handleQuery();
389     },
390     // 多选框选中数据
391     handleSelectionChange(selection) {
392       this.ids = selection.map(item => item.id)
393       this.single = selection.length!==1
394       this.multiple = !selection.length
395     },
396     /** 新增按钮操作 */
397     handleAdd() {
398       this.reset();
399       this.open = true;
400       this.titleName = "添加采集参数配置";
401     },
402     /** 修改按钮操作 */
403     handleUpdate(row) {
404       this.reset();
405       const id = row.id || this.ids
406       getCollectionParamConf(id).then(response => {
407         this.form = response.data;
408         this.open = true;
409         this.titleName = "修改采集参数配置";
410       });
411     },
412     /** 提交按钮 */
413     submitForm() {
414       this.$refs["form"].validate(valid => {
415         if (valid) {
416           if (this.form.id != null) {
417             updateCollectionParamConf(this.form).then(response => {
418               this.$modal.msgSuccess("修改成功");
419               this.open = false;
420               this.getList();
421             });
422           } else {
423             addCollectionParamConf(this.form).then(response => {
424               this.$modal.msgSuccess("新增成功");
425               this.open = false;
426               this.getList();
427             });
428           }
429         }
430       });
431     },
432     /** 删除按钮操作 */
433     handleDelete(row) {
434       const ids = row.id || this.ids;
435       this.$modal.confirm('是否确认删除采集参数配置编号为"' + ids + '"的数据项?').then(function() {
436         return delCollectionParamConf(ids);
437       }).then(() => {
438         this.getList();
439         this.$modal.msgSuccess("删除成功");
440       }).catch(() => {});
441     },
442     /** 导出按钮操作 */
443     handleExport() {
444       this.download('da/collectionParamConf/export', {
445         ...this.queryParams
446       }, `collectionParamConf_${new Date().getTime()}.xlsx`)
447     }
448   }
449 };
450 </script>