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