hdy
2024-01-03 21530ef5b5574a6c97b42572fe0c2665c081e9eb
提交 | 用户 | 时间
94f7fb 1 <template>
YY 2   <div class="app-container">
21530e 3     <el-card class="box-card">
94f7fb 4     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
ed2060 5       <el-form-item label="产品编码" prop="productCode">
YY 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>
21530e 21       <el-form-item style="float: right">
94f7fb 22         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
YY 23         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
24       </el-form-item>
25     </el-form>
21530e 26     </el-card>
H 27     <el-card style="margin-top: 10px" class="box-card">
94f7fb 28     <el-row :gutter="10" class="mb8">
YY 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
21530e 74     <el-table v-loading="loading" border :data="paramCollectionList" @selection-change="handleSelectionChange" v-if="paramCollectionList.length > 0">
94f7fb 75       <el-table-column type="selection" width="55" align="center" />
YY 76       <el-table-column label="主键id" align="center" prop="id" />
77       <el-table-column label="工单编号" align="center" prop="workOrderNo">
78 <!--        <template slot-scope="scope">-->
79 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.workOrderNo"/>-->
80 <!--        </template>-->
81       </el-table-column>
ed2060 82       <el-table-column label="总成序列号" align="center" width="100" prop="sfcCode">
94f7fb 83 <!--        <template slot-scope="scope">-->
YY 84 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.sfcCode"/>-->
85 <!--        </template>-->
86       </el-table-column>
87       <el-table-column label="产品编号" align="center" prop="productCode">
88 <!--        <template slot-scope="scope">-->
89 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.productCode"/>-->
90 <!--        </template>-->
91       </el-table-column>
92       <el-table-column label="产线编号" align="center" prop="productionLine">
93 <!--        <template slot-scope="scope">-->
94 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.productionLine"/>-->
95 <!--        </template>-->
96       </el-table-column>
97       <el-table-column label="工位编号" align="center" prop="locationCode">
98 <!--        <template slot-scope="scope">-->
99 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.locationCode"/>-->
100 <!--        </template>-->
101       </el-table-column>
102       <el-table-column label="设备编号" align="center" prop="equipmentNo">
103 <!--        <template slot-scope="scope">-->
104 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.equipmentNo"/>-->
105 <!--        </template>-->
106       </el-table-column>
107       <el-table-column label="参数编码" align="center" prop="paramCode">
108 <!--        <template slot-scope="scope">-->
109 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.paramCode"/>-->
110 <!--        </template>-->
111       </el-table-column>
112       <el-table-column label="参数值" align="center" prop="paramValue">
113 <!--        <template slot-scope="scope">-->
114 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.paramValue"/>-->
115 <!--        </template>-->
116       </el-table-column>
117       <el-table-column label="参数上限" align="center" prop="paramUpper">
118 <!--        <template slot-scope="scope">-->
119 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.paramUpper"/>-->
120 <!--        </template>-->
121       </el-table-column>
122       <el-table-column label="参数下限" align="center" prop="paramLower">
123 <!--        <template slot-scope="scope">-->
124 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.paramLower"/>-->
125 <!--        </template>-->
126       </el-table-column>
127       <el-table-column label="标准值" align="center" prop="paramStandard">
128 <!--        <template slot-scope="scope">-->
129 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.paramStandard"/>-->
130 <!--        </template>-->
131       </el-table-column>
132       <el-table-column label="采集时间" align="center" prop="collectionTime" width="180">
133         <template slot-scope="scope">
134           <span>{{ parseTime(scope.row.collectionTime, '{y}-{m}-{d}') }}</span>
135         </template>
136       </el-table-column>
137       <el-table-column label="状态" align="center" prop="state">
138 <!--        <template slot-scope="scope">-->
139 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.state"/>-->
140 <!--        </template>-->
141       </el-table-column>
142       <el-table-column label="参数名称" align="center" prop="paramName">
143 <!--        <template slot-scope="scope">-->
144 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.paramName"/>-->
145 <!--        </template>-->
146       </el-table-column>
147       <el-table-column label="单位" align="center" prop="unit">
148 <!--        <template slot-scope="scope">-->
149 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.unit"/>-->
150 <!--        </template>-->
151       </el-table-column>
152       <el-table-column label="类型" align="center" prop="type">
153 <!--        <template slot-scope="scope">-->
154 <!--          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.type"/>-->
155 <!--        </template>-->
156       </el-table-column>
21530e 157       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" >
94f7fb 158         <template slot-scope="scope">
YY 159           <el-button
160             size="mini"
161             type="text"
162             icon="el-icon-edit"
163             @click="handleUpdate(scope.row)"
164             v-hasPermi="['main:paramCollection:edit']"
165           >修改</el-button>
166           <el-button
167             size="mini"
168             type="text"
169             icon="el-icon-delete"
170             @click="handleDelete(scope.row)"
171             v-hasPermi="['main:paramCollection:remove']"
172           >删除</el-button>
173         </template>
174       </el-table-column>
175     </el-table>
21530e 176       <el-empty v-else>
H 177         <span slot="description">暂无数据</span>
178       </el-empty>
179     </el-card>
94f7fb 180
YY 181     <pagination
182       v-show="total>0"
183       :total="total"
184       :page.sync="queryParams.pageNum"
185       :limit.sync="queryParams.pageSize"
186       @pagination="getList"
187     />
188
189     <!-- 添加或修改设备产品过程参数采集对话框 -->
45a2ee 190     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
94f7fb 191       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
YY 192         <el-form-item label="工单编号" prop="workOrderNo">
193           <el-input v-model="form.workOrderNo" type="textarea" placeholder="请输入内容" />
194         </el-form-item>
195         <el-form-item label="总成序列号" prop="sfcCode">
196           <el-input v-model="form.sfcCode" type="textarea" placeholder="请输入内容" />
197         </el-form-item>
198         <el-form-item label="产品编号" prop="productCode">
199           <el-input v-model="form.productCode" type="textarea" placeholder="请输入内容" />
200         </el-form-item>
201         <el-form-item label="产线编号" prop="productionLine">
202           <el-input v-model="form.productionLine" type="textarea" placeholder="请输入内容" />
203         </el-form-item>
204         <el-form-item label="工位编号" prop="locationCode">
205           <el-input v-model="form.locationCode" type="textarea" placeholder="请输入内容" />
206         </el-form-item>
207         <el-form-item label="设备编号" prop="equipmentNo">
208           <el-input v-model="form.equipmentNo" type="textarea" placeholder="请输入内容" />
209         </el-form-item>
210         <el-form-item label="参数编码" prop="paramCode">
211           <el-input v-model="form.paramCode" type="textarea" placeholder="请输入内容" />
212         </el-form-item>
213         <el-form-item label="参数值" prop="paramValue">
214           <el-input v-model="form.paramValue" type="textarea" placeholder="请输入内容" />
215         </el-form-item>
216         <el-form-item label="参数上限" prop="paramUpper">
217           <el-input v-model="form.paramUpper" type="textarea" placeholder="请输入内容" />
218         </el-form-item>
219         <el-form-item label="参数下限" prop="paramLower">
220           <el-input v-model="form.paramLower" type="textarea" placeholder="请输入内容" />
221         </el-form-item>
222         <el-form-item label="标准值" prop="paramStandard">
223           <el-input v-model="form.paramStandard" type="textarea" placeholder="请输入内容" />
224         </el-form-item>
225         <el-form-item label="采集时间" prop="collectionTime">
226           <el-date-picker clearable
227             v-model="form.collectionTime"
228             type="date"
229             value-format="yyyy-MM-dd"
230             placeholder="请选择采集时间">
231           </el-date-picker>
232         </el-form-item>
ed2060 233 <!--        <el-form-item label="预留字段1" prop="spareField1">-->
YY 234 <!--          <el-input v-model="form.spareField1" type="textarea" placeholder="请输入内容" />-->
235 <!--        </el-form-item>-->
236 <!--        <el-form-item label="预留字段2" prop="spareField2">-->
237 <!--          <el-input v-model="form.spareField2" type="textarea" placeholder="请输入内容" />-->
238 <!--        </el-form-item>-->
239 <!--        <el-form-item label="创建用户" prop="createUser">-->
240 <!--          <el-input v-model="form.createUser" type="textarea" placeholder="请输入内容" />-->
241 <!--        </el-form-item>-->
242 <!--        <el-form-item label="更改用户" prop="updateUser">-->
243 <!--          <el-input v-model="form.updateUser" type="textarea" placeholder="请输入内容" />-->
244 <!--        </el-form-item>-->
94f7fb 245         <el-form-item label="状态" prop="state">
YY 246           <el-input v-model="form.state" placeholder="请输入状态" />
247         </el-form-item>
248         <el-form-item label="参数名称" prop="paramName">
249           <el-input v-model="form.paramName" placeholder="请输入参数名称" />
250         </el-form-item>
251         <el-form-item label="单位" prop="unit">
252           <el-input v-model="form.unit" placeholder="请输入单位" />
253         </el-form-item>
254         <el-form-item label="类型" prop="type">
255           <el-select v-model="form.type" placeholder="请选择类型">
256 <!--            <el-option-->
257 <!--              v-for="dict in dict.type.${dictType}"-->
258 <!--              :key="dict.value"-->
259 <!--              :label="dict.label"-->
260 <!--              :value="dict.value"-->
261 <!--            ></el-option>-->
262           </el-select>
263         </el-form-item>
264       </el-form>
265       <div slot="footer" class="dialog-footer">
266         <el-button type="primary" @click="submitForm">确 定</el-button>
267         <el-button @click="cancel">取 消</el-button>
268       </div>
269     </el-dialog>
270   </div>
271 </template>
272
273 <script>
274 import { listParamCollection, getParamCollection, delParamCollection, addParamCollection, updateParamCollection } from "@/api/main/da/paramCollection/paramCollection";
275
276 export default {
277   name: "ParamCollection",
278   data() {
279     return {
280       // 遮罩层
281       loading: true,
282       // 选中数组
283       ids: [],
284       // 非单个禁用
285       single: true,
286       // 非多个禁用
287       multiple: true,
288       // 显示搜索条件
289       showSearch: true,
290       // 总条数
291       total: 0,
292       // 设备产品过程参数采集表格数据
293       paramCollectionList: [],
294       // 弹出层标题
295       title: "",
296       // 是否显示弹出层
297       open: false,
298       // 查询参数
299       queryParams: {
300         pageNum: 1,
301         pageSize: 10,
302         workOrderNo: null,
303         sfcCode: null,
304         productCode: null,
305         productionLine: null,
306         locationCode: null,
307         equipmentNo: null,
308         paramCode: null,
309       },
310       // 表单参数
311       form: {},
312       // 表单校验
313       rules: {
314         id: [
315           { required: true, message: "主键id不能为空", trigger: "blur" }
316         ],
317         workOrderNo: [
318           { required: true, message: "工单编号不能为空", trigger: "blur" }
319         ],
320         sfcCode: [
321           { required: true, message: "总成序列号不能为空", trigger: "blur" }
322         ],
323         productCode: [
324           { required: true, message: "产品编号不能为空", trigger: "blur" }
325         ],
326         productionLine: [
327           { required: true, message: "产线编号不能为空", trigger: "blur" }
328         ],
329         locationCode: [
330           { required: true, message: "工位编号不能为空", trigger: "blur" }
331         ],
332         paramCode: [
333           { required: true, message: "参数编码不能为空", trigger: "blur" }
334         ],
335         paramValue: [
336           { required: true, message: "参数值不能为空", trigger: "blur" }
337         ],
338       }
339     };
340   },
341   created() {
342     this.getList();
343   },
344   methods: {
345     /** 查询设备产品过程参数采集列表 */
346     getList() {
347       this.loading = true;
348       listParamCollection(this.queryParams).then(response => {
349         this.paramCollectionList = response.rows;
350         this.total = response.total;
351         this.loading = false;
352       });
353     },
354     // 取消按钮
355     cancel() {
356       this.open = false;
357       this.reset();
358     },
359     // 表单重置
360     reset() {
361       this.form = {
362         id: null,
363         workOrderNo: null,
364         sfcCode: null,
365         productCode: null,
366         productionLine: null,
367         locationCode: null,
368         equipmentNo: null,
369         paramCode: null,
370         paramValue: null,
371         paramUpper: null,
372         paramLower: null,
373         paramStandard: null,
374         collectionTime: null,
375         spareField1: null,
376         spareField2: null,
377         createUser: null,
378         createTime: null,
379         updateUser: null,
380         updateTime: null,
381         state: null,
382         paramName: null,
383         unit: null,
384         type: null
385       };
386       this.resetForm("form");
387     },
388     /** 搜索按钮操作 */
389     handleQuery() {
390       this.queryParams.pageNum = 1;
391       this.getList();
392     },
393     /** 重置按钮操作 */
394     resetQuery() {
395       this.resetForm("queryForm");
396       this.handleQuery();
397     },
398     // 多选框选中数据
399     handleSelectionChange(selection) {
400       this.ids = selection.map(item => item.id)
401       this.single = selection.length!==1
402       this.multiple = !selection.length
403     },
404     /** 新增按钮操作 */
405     handleAdd() {
406       this.reset();
407       this.open = true;
408       this.title = "添加设备产品过程参数采集";
409     },
410     /** 修改按钮操作 */
411     handleUpdate(row) {
412       this.reset();
413       const id = row.id || this.ids
414       getParamCollection(id).then(response => {
415         this.form = response.data;
416         this.open = true;
417         this.title = "修改设备产品过程参数采集";
418       });
419     },
420     /** 提交按钮 */
421     submitForm() {
422       this.$refs["form"].validate(valid => {
423         if (valid) {
424           if (this.form.id != null) {
425             updateParamCollection(this.form).then(response => {
426               this.$modal.msgSuccess("修改成功");
427               this.open = false;
428               this.getList();
429             });
430           } else {
431             addParamCollection(this.form).then(response => {
432               this.$modal.msgSuccess("新增成功");
433               this.open = false;
434               this.getList();
435             });
436           }
437         }
438       });
439     },
440     /** 删除按钮操作 */
441     handleDelete(row) {
442       const ids = row.id || this.ids;
443       this.$modal.confirm('是否确认删除设备产品过程参数采集编号为"' + ids + '"的数据项?').then(function() {
444         return delParamCollection(ids);
445       }).then(() => {
446         this.getList();
447         this.$modal.msgSuccess("删除成功");
448       }).catch(() => {});
449     },
450     /** 导出按钮操作 */
451     handleExport() {
452       this.download('main/paramCollection/export', {
453         ...this.queryParams
454       }, `paramCollection_${new Date().getTime()}.xlsx`)
455     }
456   }
457 };
458 </script>