hdy
5 天以前 51eb318f6df9ebc7d1ff47522e33b2ee7cea1ba8
提交 | 用户 | 时间
76a2cd 1 <template>
H 2   <div class="app-container">
3     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
4       <el-form-item label="总成序列号" prop="sfcCode">
5         <el-input
6           v-model="queryParams.sfcCode"
7           placeholder="请输入总成序列号"
8           clearable
9           @keyup.enter.native="handleQuery"
10         />
11       </el-form-item>
12       <el-form-item label="工位编码" prop="locationCode">
13         <el-input
14           v-model="queryParams.locationCode"
15           placeholder="请输入工位编码"
16           clearable
17           @keyup.enter.native="handleQuery"
18         />
19       </el-form-item>
20       <el-form-item label="进站时间" prop="inboundTime">
21         <el-date-picker clearable
22           v-model="queryParams.inboundTime"
23           type="date"
24           value-format="yyyy-MM-dd"
25           placeholder="请选择进站时间">
26         </el-date-picker>
27       </el-form-item>
28       <el-form-item label="出站时间" prop="outboundTime">
29         <el-date-picker clearable
30           v-model="queryParams.outboundTime"
31           type="date"
32           value-format="yyyy-MM-dd"
33           placeholder="请选择出站时间">
34         </el-date-picker>
35       </el-form-item>
36       <el-form-item label="采集时间" prop="collectTime">
37         <el-date-picker clearable
38           v-model="queryParams.collectTime"
39           type="date"
40           value-format="yyyy-MM-dd"
41           placeholder="请选择采集时间">
42         </el-date-picker>
43       </el-form-item>
44       <el-form-item style="float: right">
45         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
46         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
47       </el-form-item>
48     </el-form>
49
50     <el-row :gutter="10" class="mb8">
51       <el-col :span="1.5">
52         <el-button
53           type="primary"
54           plain
55           icon="el-icon-plus"
56           size="mini"
57           @click="handleAdd"
58           v-hasPermi="['main:daStationCollection:add']"
59         >新增</el-button>
60       </el-col>
61       <el-col :span="1.5">
62         <el-button
63           type="success"
64           plain
65           icon="el-icon-edit"
66           size="mini"
67           :disabled="single"
68           @click="handleUpdate"
69           v-hasPermi="['main:daStationCollection:edit']"
70         >修改</el-button>
71       </el-col>
72       <el-col :span="1.5">
73         <el-button
74           type="danger"
75           plain
76           icon="el-icon-delete"
77           size="mini"
78           :disabled="multiple"
79           @click="handleDelete"
80           v-hasPermi="['main:daStationCollection:remove']"
81         >删除</el-button>
82       </el-col>
83       <el-col :span="1.5">
84         <el-button
85           type="warning"
86           plain
87           icon="el-icon-download"
88           size="mini"
89           @click="handleExport"
90           v-hasPermi="['main:daStationCollection:export']"
91         >导出</el-button>
92       </el-col>
93     </el-row>
94
95     <el-table border v-loading="loading" :data="daStationCollectionList" @selection-change="handleSelectionChange">
96       <el-table-column type="selection" width="55" align="center" />
97       <el-table-column label="主键id" align="center" prop="id" />
98       <el-table-column :show-overflow-tooltip="true" label="总成序列号" align="center" prop="sfcCode" />
99       <el-table-column :show-overflow-tooltip="true" label="工位编码" align="center" prop="locationCode" />
100       <el-table-column label="进站时间" align="center" prop="inboundTime" width="180">
101       </el-table-column>
102       <el-table-column label="出站时间" align="center" prop="outboundTime" width="180">
103       </el-table-column>
104       <el-table-column :show-overflow-tooltip="true" label="状态" align="center" prop="status" />
105       <el-table-column label="采集时间" align="center" prop="collectTime" width="180">
106       </el-table-column>
107     </el-table>
108
109     <pagination
110       v-show="total>0"
111       :total="total"
112       :page.sync="queryParams.pageNum"
113       :limit.sync="queryParams.pageSize"
114       @pagination="getList"
115     />
116
117     <!-- 添加或修改过站采集对话框 -->
118     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
119       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
120         <el-form-item label="总成序列号" prop="sfcCode">
121           <el-input v-model="form.sfcCode" placeholder="请输入总成序列号" />
122         </el-form-item>
123         <el-form-item label="工位编码" prop="locationCode">
124           <el-input v-model="form.locationCode" placeholder="请输入工位编码" />
125         </el-form-item>
126         <el-form-item label="进站时间" prop="inboundTime">
127           <el-date-picker clearable
128             v-model="form.inboundTime"
129             type="date"
130             value-format="yyyy-MM-dd"
131             placeholder="请选择进站时间">
132           </el-date-picker>
133         </el-form-item>
134         <el-form-item label="出站时间" prop="outboundTime">
135           <el-date-picker clearable
136             v-model="form.outboundTime"
137             type="date"
138             value-format="yyyy-MM-dd"
139             placeholder="请选择出站时间">
140           </el-date-picker>
141         </el-form-item>
142         <el-form-item label="采集时间" prop="collectTime">
143           <el-date-picker clearable
144             v-model="form.collectTime"
145             type="date"
146             value-format="yyyy-MM-dd"
147             placeholder="请选择采集时间">
148           </el-date-picker>
149         </el-form-item>
150       </el-form>
151       <div slot="footer" class="dialog-footer">
152         <el-button type="primary" @click="submitForm">确 定</el-button>
153         <el-button @click="cancel">取 消</el-button>
154       </div>
155     </el-dialog>
156   </div>
157 </template>
158
159 <script>
160 import { listStationCollection, getStationCollection, delStationCollection, addStationCollection, updateStationCollection } from "@/api/main/da/stationCollection";
161
162 export default {
163   name: "DaStationCollection",
164   data() {
165     return {
166       // 遮罩层
167       loading: true,
168       // 选中数组
169       ids: [],
170       // 非单个禁用
171       single: true,
172       // 非多个禁用
173       multiple: true,
174       // 显示搜索条件
175       showSearch: true,
176       // 总条数
177       total: 0,
178       // 过站采集表格数据
179       daStationCollectionList: [],
180       // 弹出层标题
181       title: "",
182       // 是否显示弹出层
183       open: false,
184       // 查询参数
185       queryParams: {
186         pageNum: 1,
187         pageSize: 10,
188         sfcCode: null,
189         locationCode: null,
190         inboundTime: null,
191         outboundTime: null,
192         status: null,
193         collectTime: null
194       },
195       // 表单参数
196       form: {},
197       // 表单校验
198       rules: {
199       }
200     };
201   },
202   created() {
203     this.getList();
204   },
205   methods: {
206     /** 查询过站采集列表 */
207     getList() {
208       this.loading = true;
209       listStationCollection(this.queryParams).then(response => {
210         this.daStationCollectionList = response.rows;
211         this.total = response.total;
212         this.loading = false;
213       });
214     },
215     // 取消按钮
216     cancel() {
217       this.open = false;
218       this.reset();
219     },
220     // 表单重置
221     reset() {
222       this.form = {
223         id: null,
224         sfcCode: null,
225         locationCode: null,
226         inboundTime: null,
227         outboundTime: null,
228         status: null,
229         collectTime: null
230       };
231       this.resetForm("form");
232     },
233     /** 搜索按钮操作 */
234     handleQuery() {
235       this.queryParams.pageNum = 1;
236       this.getList();
237     },
238     /** 重置按钮操作 */
239     resetQuery() {
240       this.resetForm("queryForm");
241       this.handleQuery();
242     },
243     // 多选框选中数据
244     handleSelectionChange(selection) {
245       this.ids = selection.map(item => item.id)
246       this.single = selection.length!==1
247       this.multiple = !selection.length
248     },
249     /** 新增按钮操作 */
250     handleAdd() {
251       this.reset();
252       this.open = true;
253       this.title = "添加过站采集";
254     },
255     /** 修改按钮操作 */
256     handleUpdate(row) {
257       this.reset();
258       const id = row.id || this.ids
259       getStationCollection(id).then(response => {
260         this.form = response.data;
261         this.open = true;
262         this.title = "修改过站采集";
263       });
264     },
265     /** 提交按钮 */
266     submitForm() {
267       this.$refs["form"].validate(valid => {
268         if (valid) {
269           if (this.form.id != null) {
270             updateStationCollection(this.form).then(response => {
271               this.$modal.msgSuccess("修改成功");
272               this.open = false;
273               this.getList();
274             });
275           } else {
276             addStationCollection(this.form).then(response => {
277               this.$modal.msgSuccess("新增成功");
278               this.open = false;
279               this.getList();
280             });
281           }
282         }
283       });
284     },
285     /** 删除按钮操作 */
286     handleDelete(row) {
287       const ids = row.id || this.ids;
288       this.$modal.confirm('是否确认删除').then(function() {
289         return delStationCollection(ids);
290       }).then(() => {
291         this.getList();
292         this.$modal.msgSuccess("删除成功");
293       }).catch(() => {});
294     },
295     /** 导出按钮操作 */
296     handleExport() {
297       this.download('main/daStationCollection/export', {
298         ...this.queryParams
299       }, `daStationCollection_${new Date().getTime()}.xlsx`)
300     }
301   }
302 };
303 </script>