懒羊羊
2024-03-13 b64ed2c784bde6dea9d18149ca706ebe532c857d
提交 | 用户 | 时间
e57a89 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="inboundTime">
6         <el-date-picker clearable
7           v-model="queryParams.inboundTime"
8           type="date"
9           value-format="yyyy-MM-dd"
10           placeholder="请选择入站时间">
11         </el-date-picker>
12       </el-form-item>
13       <el-form-item label="出站时间" prop="outboundTime">
14         <el-date-picker clearable
15           v-model="queryParams.outboundTime"
16           type="date"
17           value-format="yyyy-MM-dd"
18           placeholder="请选择出站时间">
19         </el-date-picker>
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     <el-card style="margin-top: 10px" class="box-card">
28     <el-row :gutter="10" class="mb8">
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="['da:passingStationCollection: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="['da:passingStationCollection: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="['da:passingStationCollection: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="['da:passingStationCollection:export']"
69         >导出</el-button>
70       </el-col>
71       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
72     </el-row>
73
74     <el-table v-loading="loading" border :data="passingStationCollectionList" @selection-change="handleSelectionChange" v-if="passingStationCollectionList.length > 0">
75       <el-table-column type="selection" width="55" align="center" />
76       <el-table-column label="工单编号" align="center" prop="workOrderNo">
77       </el-table-column>
b64ed2 78 <!--      <el-table-column label="总成序列号" align="center" prop="sfcCode">-->
79 <!--      </el-table-column>-->
80       <el-table-column label="产品序列号" align="center" prop="productCode">
e57a89 81       </el-table-column>
b64ed2 82 <!--      <el-table-column label="产线编号" align="center" prop="productionLine">-->
83 <!--      </el-table-column>-->
84       <el-table-column label="工序编号" align="center" prop="locationCode">
e57a89 85       </el-table-column>
b64ed2 86       <el-table-column label="入站时间" align="center" prop="inboundTime" width="160">
e57a89 87         <template slot-scope="scope">
88           <span>{{ parseTime(scope.row.inboundTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
89         </template>
90       </el-table-column>
b64ed2 91       <el-table-column label="出站时间" align="center" prop="outboundTime" width="160">
e57a89 92         <template slot-scope="scope">
93           <span>{{ parseTime(scope.row.outboundTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
94         </template>
95       </el-table-column>
96
97       <el-table-column label="是否合格" align="center" prop="outRsSign">
98       </el-table-column>
99       <el-table-column label="NG原因" align="center" prop="outMsgSign">
100       </el-table-column>
b64ed2 101 <!--      <el-table-column label="采集时间" align="center" prop="collectionTime" width="180">-->
102 <!--        <template slot-scope="scope">-->
103 <!--          <span>{{ parseTime(scope.row.collectionTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>-->
104 <!--        </template>-->
105 <!--      </el-table-column>-->
e57a89 106       <el-table-column label="节拍时间" align="center" prop="beatTime">
107       </el-table-column>
108       <el-table-column fixed="right" label="操作" width="200" align="center" class-name="small-padding fixed-width">
109         <template slot-scope="scope">
110           <el-button
111             size="mini"
112             type="success"
113             plain
114             style="width: 72px"
115             icon="el-icon-edit"
116             @click="handleUpdate(scope.row)"
117             v-hasPermi="['da:passingStationCollection:edit']"
118           >修改</el-button>
119           <el-button
120             size="mini"
121             type="danger"
122             plain
123             style="width: 72px"
124             icon="el-icon-delete"
125             @click="handleDelete(scope.row)"
126             v-hasPermi="['da:passingStationCollection:remove']"
127           >删除</el-button>
128         </template>
129       </el-table-column>
130     </el-table>
131       <el-empty v-else>
132         <span slot="description">暂无数据</span>
133       </el-empty>
134     </el-card>
135
136     <pagination
137       v-show="total>0"
138       :total="total"
139       :page.sync="queryParams.pageNum"
140       :limit.sync="queryParams.pageSize"
141       @pagination="getList"
142     />
143
144     <!-- 添加或修改产品过站采集对话框 -->
145     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="1000px" append-to-body>
146       <el-form ref="form" inline :model="form" :rules="rules" label-width="120px">
147         <el-form-item label="工单编号" prop="workOrderNo">
148           <el-input v-model="form.workOrderNo" type="textarea" placeholder="请输入内容" />
149         </el-form-item>
150         <el-form-item label="总成序列号" prop="sfcCode">
151           <el-input v-model="form.sfcCode" type="textarea" placeholder="请输入内容" />
152         </el-form-item>
153         <el-form-item label="产品编号" prop="productCode">
154           <el-input v-model="form.productCode" type="textarea" placeholder="请输入内容" />
155         </el-form-item>
156         <el-form-item label="产线编号" prop="productionLine">
157           <el-input v-model="form.productionLine" type="textarea" placeholder="请输入内容" />
158         </el-form-item>
159         <el-form-item label="工位编号" prop="locationCode">
160           <el-input v-model="form.locationCode" type="textarea" placeholder="请输入内容" />
161         </el-form-item>
162         <el-form-item label="设备编号" prop="equipmentNo">
163           <el-input v-model="form.equipmentNo" type="textarea" placeholder="请输入内容" />
164         </el-form-item>
165         <el-form-item label="入站时间" prop="inboundTime">
166           <el-date-picker clearable
167             v-model="form.inboundTime"
168             type="date"
169             value-format="yyyy-MM-dd"
170             placeholder="请选择入站时间">
171           </el-date-picker>
172         </el-form-item>
173         <el-form-item label="出站时间" prop="outboundTime">
174           <el-date-picker clearable
175             v-model="form.outboundTime"
176             type="date"
177             value-format="yyyy-MM-dd"
178             placeholder="请选择出站时间">
179           </el-date-picker>
180         </el-form-item>
181         <el-form-item label="是否合格" prop="outRsSign">
182           <el-input v-model="form.outRsSign" placeholder="请输入出站是否合格" />
183         </el-form-item>
184         <el-form-item label="NG原因" prop="outMsgSign">
185           <el-input v-model="form.outMsgSign" type="textarea" placeholder="请输入内容" />
186         </el-form-item>
187         <el-form-item label="采集时间" prop="collectionTime">
188           <el-date-picker clearable
189             v-model="form.collectionTime"
190             type="date"
191             value-format="yyyy-MM-dd"
192             placeholder="请选择采集时间">
193           </el-date-picker>
194         </el-form-item>
195         <el-form-item label="节拍时间" prop="beatTime">
196           <el-input v-model="form.beatTime" placeholder="请输入节拍时间" />
197         </el-form-item>
198       </el-form>
199       <div slot="footer" class="dialog-footer">
200         <el-button type="primary" @click="submitForm">确 定</el-button>
201         <el-button @click="cancel">取 消</el-button>
202       </div>
203     </el-dialog>
204   </div>
205 </template>
206
207 <script>
208 import { listPassingStationCollection, getPassingStationCollection, delPassingStationCollection, addPassingStationCollection, updatePassingStationCollection } from "@/api/main/da/passingStationCollection/passingStationCollection";
209
210 export default {
211   name: "PassingStationCollection",
212   data() {
213     return {
214       // 遮罩层
215       loading: true,
216       // 选中数组
217       ids: [],
218       // 非单个禁用
219       single: true,
220       // 非多个禁用
221       multiple: true,
222       // 显示搜索条件
223       showSearch: true,
224       // 总条数
225       total: 0,
226       // 产品过站采集表格数据
227       passingStationCollectionList: [],
228       // 弹出层标题
229       title: "",
230       // 是否显示弹出层
231       open: false,
232       // 查询参数
233       queryParams: {
234         pageNum: 1,
235         pageSize: 10,
236         workOrderNo: null,
237         sfcCode: null,
238         productCode: null,
239         productionLine: null,
240         locationCode: null,
241         equipmentNo: null,
242         inboundTime: null,
243         outboundTime: null,
244       },
245       // 表单参数
246       form: {},
247       // 表单校验
248       rules: {
249         id: [
250           { required: true, message: "主键id不能为空", trigger: "blur" }
251         ],
252       }
253     };
254   },
255   created() {
256     this.getList();
257   },
258   methods: {
259     /** 查询产品过站采集列表 */
260     getList() {
261       this.loading = true;
262       listPassingStationCollection(this.queryParams).then(response => {
263         this.passingStationCollectionList = response.rows;
264         this.total = response.total;
265         this.loading = false;
266       });
267     },
268     // 取消按钮
269     cancel() {
270       this.open = false;
271       this.reset();
272     },
273     // 表单重置
274     reset() {
275       this.form = {
276         id: null,
277         workOrderNo: null,
278         sfcCode: null,
279         productCode: null,
280         productionLine: null,
281         locationCode: null,
282         equipmentNo: null,
283         inboundTime: null,
284         outboundTime: null,
285         inRsSign: null,
286         inMsgSign: null,
287         outRsSign: null,
288         outMsgSign: null,
289         collectionTime: null,
290         spareField1: null,
291         spareField2: null,
292         createUser: null,
293         createTime: null,
294         updateUser: null,
295         updateTime: null,
296         beatTime: null
297       };
298       this.resetForm("form");
299     },
300     /** 搜索按钮操作 */
301     handleQuery() {
302       this.queryParams.pageNum = 1;
303       this.getList();
304     },
305     /** 重置按钮操作 */
306     resetQuery() {
307       this.resetForm("queryForm");
308       this.handleQuery();
309     },
310     // 多选框选中数据
311     handleSelectionChange(selection) {
312       this.ids = selection.map(item => item.id)
313       this.single = selection.length!==1
314       this.multiple = !selection.length
315     },
316     /** 新增按钮操作 */
317     handleAdd() {
318       this.reset();
319       this.open = true;
320       this.title = "添加产品过站采集";
321     },
322     /** 修改按钮操作 */
323     handleUpdate(row) {
324       this.reset();
325       const id = row.id || this.ids
326       getPassingStationCollection(id).then(response => {
327         this.form = response.data;
328         this.open = true;
329         this.title = "修改产品过站采集";
330       });
331     },
332     /** 提交按钮 */
333     submitForm() {
334       this.$refs["form"].validate(valid => {
335         if (valid) {
336           if (this.form.id != null) {
337             updatePassingStationCollection(this.form).then(response => {
338               this.$modal.msgSuccess("修改成功");
339               this.open = false;
340               this.getList();
341             });
342           } else {
343             addPassingStationCollection(this.form).then(response => {
344               this.$modal.msgSuccess("新增成功");
345               this.open = false;
346               this.getList();
347             });
348           }
349         }
350       });
351     },
352     /** 删除按钮操作 */
353     handleDelete(row) {
354       const ids = row.id || this.ids;
355       this.$modal.confirm('是否确认删除产品过站采集编号为"' + ids + '"的数据项?').then(function() {
356         return delPassingStationCollection(ids);
357       }).then(() => {
358         this.getList();
359         this.$modal.msgSuccess("删除成功");
360       }).catch(() => {});
361     },
362     /** 导出按钮操作 */
363     handleExport() {
364       this.download('da/passingStationCollection/export', {
365         ...this.queryParams
366       }, `passingStationCollection_${new Date().getTime()}.xlsx`)
367     }
368   }
369 };
370 </script>