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