hdy
2023-12-25 f2a092218ece0821351440331c90064c8cbd5241
提交 | 用户 | 时间
0e6717 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="130" prop="processesCode">
129           </el-table-column>
130           <el-table-column label="参数集编码" align="center" width="130" prop="parameterSetCode">
131           </el-table-column>
132           <el-table-column label="参数集名称" align="center" width="160" prop="parameterSetName">
133           </el-table-column>
134           <el-table-column label="采集参数ID" align="center" width="130" prop="collectParameterId">
135           </el-table-column>
136           <el-table-column label="采集参数名称" align="center" width="160" prop="collectParameterName">
137           </el-table-column>
138 <!--          <el-table-column label="是否作为对比参数" align="center" prop="contrastParameterFlag">-->
139 <!--          </el-table-column>-->
140           <el-table-column label="采集参数类型" align="center" width="130" prop="collectParameterType">
141           </el-table-column>
142           <el-table-column label="采集参数单位" align="center" width="130" prop="collectParameterUnit">
143           </el-table-column>
144           <el-table-column label="数据描述" align="center" width="160" prop="Descriptives">
145           </el-table-column>
146           <el-table-column label="上限值" align="center" prop="paramUpper">
147           </el-table-column>
148           <el-table-column label="下限值" align="center" prop="paramLower">
149           </el-table-column>
150           <el-table-column label="中心值" align="center" prop="paramCentral">
151           </el-table-column>
152           <el-table-column label="产品编码" align="center" width="150" prop="productCode">
153           </el-table-column>
154           <el-table-column label="采集地址" align="center" width="130" prop="gatherAddress">
155           </el-table-column>
156           <el-table-column label="采集顺序" align="center" width="130" prop="gatherSequence">
157           </el-table-column>
158           <el-table-column label="备注" align="center" width="160" prop="remarks">
159           </el-table-column>
160           <el-table-column label="创建用户" align="center" prop="createUser">
161           </el-table-column>
162           <el-table-column label="创建时间" align="center" width="160" prop="createTime">
163           </el-table-column>
164           <el-table-column label="更改用户" align="center" prop="updateUser">
165           </el-table-column>
166           <el-table-column label="更改时间" align="center" width="160" prop="updateTime">
167           </el-table-column>
168           <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width">
169             <template slot-scope="scope">
170               <el-button
171                 size="mini"
172                 type="success"
173                 plain
174                 style="width: 72px"
175                 icon="el-icon-edit"
176                 @click="handleUpdate(scope.row)"
177                 v-hasPermi="['da:collectionParamConf:edit']"
178               >修改</el-button>
179               <el-button
180                 size="mini"
181                 type="danger"
182                 plain
183                 style="width: 72px"
184                 icon="el-icon-delete"
185                 @click="handleDelete(scope.row)"
186                 v-hasPermi="['da:collectionParamConf:remove']"
187               >删除</el-button>
188             </template>
189           </el-table-column>
190         </el-table>
191     </el-card>
192
193     <pagination
194       v-show="total>0"
195       :total="total"
196       :page.sync="queryParams.pageNum"
197       :limit.sync="queryParams.pageSize"
198       @pagination="getList"
199     />
200
201     <!-- 添加或修改采集参数配置对话框 -->
45a2ee 202     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
0e6717 203       <span slot="title">
204         <i class="el-icon-s-order"></i>
205         {{titleName}}
206       </span>
207       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
208         <el-form-item label="工序编号" prop="processesCode">
209           <el-input v-model="form.processesCode" placeholder="请输入工序编号" />
210         </el-form-item>
211         <el-form-item label="参数集编码" prop="parameterSetCode">
212           <el-input v-model="form.parameterSetCode" placeholder="请输入参数集编码" />
213         </el-form-item>
214         <el-form-item label="参数集名称" prop="parameterSetName">
215           <el-input v-model="form.parameterSetName" placeholder="请输入参数集名称" />
216         </el-form-item>
217         <el-form-item label="采集参数ID" prop="collectParameterId">
218           <el-input v-model="form.collectParameterId" placeholder="请输入采集参数ID" />
219         </el-form-item>
220         <el-form-item label="采集参数名称" prop="collectParameterName">
221           <el-input v-model="form.collectParameterName" placeholder="请输入采集参数名称" />
222         </el-form-item>
223         <el-form-item label="是否作为对比参数" prop="contrastParameterFlag">
224           <el-input v-model="form.contrastParameterFlag" placeholder="请输入是否作为对比参数" />
225         </el-form-item>
226 <!--        <el-form-item label="采集参数类型" prop="collectParameterType">-->
227 <!--          <el-select v-model="form.collectParameterType" placeholder="请选择采集参数类型">-->
228 <!--            <el-option-->
229 <!--              v-for="dict in dict.type.${dictType}"-->
230 <!--              :key="dict.value"-->
231 <!--              :label="dict.label"-->
232 <!--              :value="dict.value"-->
233 <!--            ></el-option>-->
234 <!--          </el-select>-->
235 <!--        </el-form-item>-->
236         <el-form-item label="采集参数单位" prop="collectParameterUnit">
237           <el-input v-model="form.collectParameterUnit" placeholder="请输入采集参数单位" />
238         </el-form-item>
239         <el-form-item label="数据描述" prop="Descriptives">
240           <el-input v-model="form.Descriptives" placeholder="请输入数据描述" />
241         </el-form-item>
242         <el-form-item label="上限值" prop="paramUpper">
243           <el-input v-model="form.paramUpper" placeholder="请输入上限值" />
244         </el-form-item>
245         <el-form-item label="下限值" prop="paramLower">
246           <el-input v-model="form.paramLower" placeholder="请输入下限值" />
247         </el-form-item>
248         <el-form-item label="中心值" prop="paramCentral">
249           <el-input v-model="form.paramCentral" placeholder="请输入中心值" />
250         </el-form-item>
251         <el-form-item label="产品编码" prop="productCode">
252           <el-input v-model="form.productCode" placeholder="请输入产品编码" />
253         </el-form-item>
254         <el-form-item label="采集地址" prop="gatherAddress">
255           <el-input v-model="form.gatherAddress" placeholder="请输入采集地址" />
256         </el-form-item>
257         <el-form-item label="采集顺序" prop="gatherSequence">
258           <el-input v-model="form.gatherSequence" placeholder="请输入采集顺序" />
259         </el-form-item>
260         <el-form-item label="备注" prop="remarks">
261           <el-input v-model="form.remarks" placeholder="请输入备注" />
262         </el-form-item>
263       </el-form>
264       <div slot="footer" class="dialog-footer">
265         <el-button type="primary" @click="submitForm">确 定</el-button>
266         <el-button @click="cancel">取 消</el-button>
267       </div>
268     </el-dialog>
269   </div>
270 </template>
271
272 <script>
273 import { listCollectionParamConf, getCollectionParamConf, delCollectionParamConf, addCollectionParamConf, updateCollectionParamConf } from "@/api/main/da/collectionParamConf/collectionParamConf";
274
275 export default {
276   name: "CollectionParamConf",
277   data() {
278     return {
279       // 遮罩层
280       loading: true,
281       titleName: "",
282       // 选中数组
283       ids: [],
284       // 非单个禁用
285       single: true,
286       // 非多个禁用
287       multiple: true,
288       // 显示搜索条件
289       showSearch: true,
290       // 总条数
291       total: 0,
292       // 采集参数配置表格数据
293       collectionParamConfList: [],
294       // 弹出层标题
295       title: "",
296       // 是否显示弹出层
297       open: false,
298       // 查询参数
299       queryParams: {
300         pageNum: 1,
301         pageSize: 10,
302         processesCode: null,
303         parameterSetCode: null,
304         parameterSetName: null,
305         collectParameterId: null,
306         collectParameterName: null,
307         contrastParameterFlag: null,
308         collectParameterType: null,
309         productCode: null,
310       },
311       // 表单参数
312       form: {},
313       // 表单校验
314       rules: {
315         id: [
316           { required: true, message: "主键id不能为空", trigger: "blur" }
317         ],
318       }
319     };
320   },
321   created() {
322     this.getList();
323   },
324   methods: {
325     /** 查询采集参数配置列表 */
326     getList() {
327       this.loading = true;
328       listCollectionParamConf(this.queryParams).then(response => {
329         this.collectionParamConfList = response.rows;
330         this.total = response.total;
331         this.loading = false;
332       });
333     },
334     // 取消按钮
335     cancel() {
336       this.open = false;
337       this.reset();
338     },
339     // 表单重置
340     reset() {
341       this.form = {
342         id: null,
343         processesCode: null,
344         parameterSetCode: null,
345         parameterSetName: null,
346         collectParameterId: null,
347         collectParameterName: null,
348         contrastParameterFlag: null,
349         collectParameterType: null,
350         collectParameterUnit: null,
351         Descriptives: null,
352         paramUpper: null,
353         paramLower: null,
354         paramCentral: null,
355         productCode: null,
356         gatherAddress: null,
357         gatherSequence: null,
358         remarks: null,
359         createUser: null,
360         createTime: null,
361         updateUser: null,
362         updateTime: null,
363         spareField1: null,
364         spareField2: null,
365         spareField3: null,
366         spareField4: null
367       };
368       this.resetForm("form");
369     },
370     /** 搜索按钮操作 */
371     handleQuery() {
372       this.queryParams.pageNum = 1;
373       this.getList();
374     },
375     /** 重置按钮操作 */
376     resetQuery() {
377       this.resetForm("queryForm");
378       this.handleQuery();
379     },
380     // 多选框选中数据
381     handleSelectionChange(selection) {
382       this.ids = selection.map(item => item.id)
383       this.single = selection.length!==1
384       this.multiple = !selection.length
385     },
386     /** 新增按钮操作 */
387     handleAdd() {
388       this.reset();
389       this.open = true;
390       this.titleName = "添加采集参数配置";
391     },
392     /** 修改按钮操作 */
393     handleUpdate(row) {
394       this.reset();
395       const id = row.id || this.ids
396       getCollectionParamConf(id).then(response => {
397         this.form = response.data;
398         this.open = true;
399         this.titleName = "修改采集参数配置";
400       });
401     },
402     /** 提交按钮 */
403     submitForm() {
404       this.$refs["form"].validate(valid => {
405         if (valid) {
406           if (this.form.id != null) {
407             updateCollectionParamConf(this.form).then(response => {
408               this.$modal.msgSuccess("修改成功");
409               this.open = false;
410               this.getList();
411             });
412           } else {
413             addCollectionParamConf(this.form).then(response => {
414               this.$modal.msgSuccess("新增成功");
415               this.open = false;
416               this.getList();
417             });
418           }
419         }
420       });
421     },
422     /** 删除按钮操作 */
423     handleDelete(row) {
424       const ids = row.id || this.ids;
425       this.$modal.confirm('是否确认删除采集参数配置编号为"' + ids + '"的数据项?').then(function() {
426         return delCollectionParamConf(ids);
427       }).then(() => {
428         this.getList();
429         this.$modal.msgSuccess("删除成功");
430       }).catch(() => {});
431     },
432     /** 导出按钮操作 */
433     handleExport() {
434       this.download('da/collectionParamConf/export', {
435         ...this.queryParams
436       }, `collectionParamConf_${new Date().getTime()}.xlsx`)
437     }
438   }
439 };
440 </script>