春风项目四线(合箱线、总装线)
懒羊羊
2024-01-15 7f1dbf4296013a4b15fbc2748de072f7c7ad4388
提交 | 用户 | 时间
64a177 1 <template>
J 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="model">
6             <el-input
7               v-model="queryParams.model"
8               placeholder="请输入机型"
9               clearable
10               @keyup.enter.native="handleQuery"
11             />
12           </el-form-item>
13           <el-form-item label="日期" prop="modelDate">
14             <el-input
15               v-model="queryParams.modelDate"
16               placeholder="请输入日期"
17               clearable
18               @keyup.enter.native="handleQuery"
19             />
20           </el-form-item>
21           <el-form-item label="最大值" prop="maxnumValue">
22             <el-input
23               v-model="queryParams.maxnumValue"
24               placeholder="请输入最大值"
25               clearable
26               @keyup.enter.native="handleQuery"
27             />
28           </el-form-item>
29           <el-form-item label="上次的编号" prop="lastNumber">
30             <el-input
31               v-model="queryParams.lastNumber"
32               placeholder="请输入上次的编号"
33               clearable
34               @keyup.enter.native="handleQuery"
35             />
36           </el-form-item>
82939b 37 <!--          <el-form-item label="状态" prop="status">-->
J 38 <!--            <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>-->
64a177 39
82939b 40 <!--            </el-select>-->
J 41 <!--          </el-form-item>-->
42 <!--          <el-form-item label="预留字段1" prop="spareField1">-->
43 <!--            <el-input-->
44 <!--              v-model="queryParams.spareField1"-->
45 <!--              placeholder="请输入预留字段1"-->
46 <!--              clearable-->
47 <!--              @keyup.enter.native="handleQuery"-->
48 <!--            />-->
49 <!--          </el-form-item>-->
50 <!--          <el-form-item label="预留字段2" prop="spareField2">-->
51 <!--            <el-input-->
52 <!--              v-model="queryParams.spareField2"-->
53 <!--              placeholder="请输入预留字段2"-->
54 <!--              clearable-->
55 <!--              @keyup.enter.native="handleQuery"-->
56 <!--            />-->
57 <!--          </el-form-item>-->
58 <!--          <el-form-item label="预留字段3" prop="spareField3">-->
59 <!--            <el-input-->
60 <!--              v-model="queryParams.spareField3"-->
61 <!--              placeholder="请输入预留字段3"-->
62 <!--              clearable-->
63 <!--              @keyup.enter.native="handleQuery"-->
64 <!--            />-->
65 <!--          </el-form-item>-->
66 <!--          <el-form-item label="预留字段4" prop="spareField4">-->
67 <!--            <el-input-->
68 <!--              v-model="queryParams.spareField4"-->
69 <!--              placeholder="请输入预留字段4"-->
70 <!--              clearable-->
71 <!--              @keyup.enter.native="handleQuery"-->
72 <!--            />-->
73 <!--          </el-form-item>-->
74 <!--          <el-form-item label="创建用户" prop="createUser">-->
75 <!--            <el-input-->
76 <!--              v-model="queryParams.createUser"-->
77 <!--              placeholder="请输入创建用户"-->
78 <!--              clearable-->
79 <!--              @keyup.enter.native="handleQuery"-->
80 <!--            />-->
81 <!--          </el-form-item>-->
82 <!--          <el-form-item label="更改用户" prop="updateUser">-->
83 <!--            <el-input-->
84 <!--              v-model="queryParams.updateUser"-->
85 <!--              placeholder="请输入更改用户"-->
86 <!--              clearable-->
87 <!--              @keyup.enter.native="handleQuery"-->
88 <!--            />-->
89 <!--          </el-form-item>-->
90 <!--          <el-form-item label="备注" prop="remarks">-->
91 <!--            <el-input-->
92 <!--              v-model="queryParams.remarks"-->
93 <!--              placeholder="请输入备注"-->
94 <!--              clearable-->
95 <!--              @keyup.enter.native="handleQuery"-->
96 <!--            />-->
97 <!--          </el-form-item>-->
64a177 98           <el-form-item style="float: right">
J 99             <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
82939b 100             <el-button type="warning" icon="el-icon-copy-document" size="mini" @click="advancedQuery">高级查询</el-button>
64a177 101             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
J 102           </el-form-item>
103         </el-form>
104     </el-card>
105
106     <el-card style="margin-top: 10px" class="box-card">
107         <el-row :gutter="10" class="mb8">
108           <el-col :span="1.5">
109             <el-button
110               type="primary"
111               plain
112               icon="el-icon-plus"
113               size="mini"
114               @click="handleAdd"
115               v-hasPermi="['bs:modelNumber:add']"
116             >新增</el-button>
117           </el-col>
118           <el-col :span="1.5">
119             <el-button
120               type="success"
121               plain
122               icon="el-icon-edit"
123               size="mini"
124               :disabled="single"
125               @click="handleUpdate"
126               v-hasPermi="['bs:modelNumber:edit']"
127             >修改</el-button>
128           </el-col>
129           <el-col :span="1.5">
130             <el-button
131               type="danger"
132               plain
133               icon="el-icon-delete"
134               size="mini"
135               :disabled="multiple"
136               @click="handleDelete"
137               v-hasPermi="['bs:modelNumber:remove']"
138             >删除</el-button>
139           </el-col>
140           <el-col :span="1.5">
141             <el-button
142               type="warning"
143               plain
144               icon="el-icon-download"
145               size="mini"
146               @click="handleExport"
147               v-hasPermi="['bs:modelNumber:export']"
148             >导出</el-button>
149           </el-col>
150           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
151         </el-row>
152
153         <el-table border v-loading="loading" :data="modelNumberList" @selection-change="handleSelectionChange">
154           <el-table-column type="selection" width="55" align="center" />
155           <el-table-column label="ID" align="center" prop="id" />
156           <el-table-column label="机型" align="center" prop="model">
157
158           </el-table-column>
159           <el-table-column label="日期" align="center" prop="modelDate">
160
161           </el-table-column>
162           <el-table-column label="最大值" align="center" prop="maxnumValue">
163
164           </el-table-column>
165           <el-table-column label="保存时间" align="center" prop="saveTime">
166
167           </el-table-column>
168           <el-table-column label="上次的编号" align="center" prop="lastNumber">
169
170           </el-table-column>
82939b 171 <!--          <el-table-column label="状态" align="center" prop="status">-->
64a177 172
82939b 173 <!--          </el-table-column>-->
J 174 <!--          <el-table-column label="预留字段1" align="center" prop="spareField1">-->
64a177 175
82939b 176 <!--          </el-table-column>-->
J 177 <!--          <el-table-column label="预留字段2" align="center" prop="spareField2">-->
64a177 178
82939b 179 <!--          </el-table-column>-->
J 180 <!--          <el-table-column label="预留字段3" align="center" prop="spareField3">-->
64a177 181
82939b 182 <!--          </el-table-column>-->
J 183 <!--          <el-table-column label="预留字段4" align="center" prop="spareField4">-->
64a177 184
82939b 185 <!--          </el-table-column>-->
J 186 <!--          <el-table-column label="创建用户" align="center" prop="createUser">-->
64a177 187
82939b 188 <!--          </el-table-column>-->
J 189 <!--          <el-table-column label="更改用户" align="center" prop="updateUser">-->
64a177 190
82939b 191 <!--          </el-table-column>-->
J 192 <!--          <el-table-column label="备注" align="center" prop="remarks">-->
64a177 193
82939b 194 <!--          </el-table-column>-->
64a177 195           <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width">
J 196             <template slot-scope="scope">
197               <el-button
198                 size="mini"
199                 type="success"
200                 plain
201                 style="width: 72px"
202                 icon="el-icon-edit"
203                 @click="handleUpdate(scope.row)"
204                 v-hasPermi="['bs:modelNumber:edit']"
205               >修改</el-button>
206               <el-button
207                 size="mini"
208                 type="danger"
209                 plain
210                 style="width: 72px"
211                 icon="el-icon-delete"
212                 @click="handleDelete(scope.row)"
213                 v-hasPermi="['bs:modelNumber:remove']"
214               >删除</el-button>
215             </template>
216           </el-table-column>
217         </el-table>
218     </el-card>
219
220     <pagination
221       v-show="total>0"
222       :total="total"
223       :page.sync="queryParams.pageNum"
224       :limit.sync="queryParams.pageSize"
225       @pagination="getList"
226     />
227
228     <!-- 添加或修改机型序号对话框 -->
229     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
230       <span slot="title">
231         <i class="el-icon-s-order"></i>
232         {{titleName}}
233       </span>
234       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
235         <el-form-item label="机型" prop="model">
236           <el-input v-model="form.model" placeholder="请输入机型" />
237         </el-form-item>
238         <el-form-item label="日期" prop="modelDate">
239           <el-input v-model="form.modelDate" placeholder="请输入日期" />
240         </el-form-item>
241         <el-form-item label="最大值" prop="maxnumValue">
242           <el-input v-model="form.maxnumValue" placeholder="请输入最大值" />
243         </el-form-item>
244         <el-form-item label="上次的编号" prop="lastNumber">
245           <el-input v-model="form.lastNumber" placeholder="请输入上次的编号" />
246         </el-form-item>
82939b 247 <!--        <el-form-item label="状态" prop="status">-->
J 248 <!--          <el-radio-group v-model="form.status">-->
64a177 249
82939b 250 <!--          </el-radio-group>-->
J 251 <!--        </el-form-item>-->
252 <!--        <el-form-item label="预留字段1" prop="spareField1">-->
253 <!--          <el-input v-model="form.spareField1" placeholder="请输入预留字段1" />-->
254 <!--        </el-form-item>-->
255 <!--        <el-form-item label="预留字段2" prop="spareField2">-->
256 <!--          <el-input v-model="form.spareField2" placeholder="请输入预留字段2" />-->
257 <!--        </el-form-item>-->
258 <!--        <el-form-item label="预留字段3" prop="spareField3">-->
259 <!--          <el-input v-model="form.spareField3" placeholder="请输入预留字段3" />-->
260 <!--        </el-form-item>-->
261 <!--        <el-form-item label="预留字段4" prop="spareField4">-->
262 <!--          <el-input v-model="form.spareField4" placeholder="请输入预留字段4" />-->
263 <!--        </el-form-item>-->
264 <!--        <el-form-item label="创建用户" prop="createUser">-->
265 <!--          <el-input v-model="form.createUser" placeholder="请输入创建用户" />-->
266 <!--        </el-form-item>-->
267 <!--        <el-form-item label="更改用户" prop="updateUser">-->
268 <!--          <el-input v-model="form.updateUser" placeholder="请输入更改用户" />-->
269 <!--        </el-form-item>-->
270 <!--        <el-form-item label="备注" prop="remarks">-->
271 <!--          <el-input v-model="form.remarks" placeholder="请输入备注" />-->
272 <!--        </el-form-item>-->
64a177 273       </el-form>
J 274       <div slot="footer" class="dialog-footer">
275         <el-button type="primary" @click="submitForm">确 定</el-button>
276         <el-button @click="cancel">取 消</el-button>
277       </div>
278     </el-dialog>
279   </div>
280 </template>
281
282 <script>
283 import { listModelNumber, getModelNumber, delModelNumber, addModelNumber, updateModelNumber } from "@/api/main/bs/modelNumber/modelNumber";
284
285 export default {
286   name: "ModelNumber",
287   data() {
288     return {
289       // 遮罩层
290       loading: true,
291       titleName: "",
292       // 选中数组
293       ids: [],
294       // 非单个禁用
295       single: true,
296       // 非多个禁用
297       multiple: true,
298       // 显示搜索条件
299       showSearch: true,
300       // 总条数
301       total: 0,
302       // 机型序号表格数据
303       modelNumberList: [],
304       // 弹出层标题
305       title: "",
306       // 是否显示弹出层
307       open: false,
308       // 查询参数
309       queryParams: {
310         pageNum: 1,
311         pageSize: 10,
312         model: null,
313         modelDate: null,
314         maxnumValue: null,
315         saveTime: null,
316         lastNumber: null,
317         status: null,
318         spareField1: null,
319         spareField2: null,
320         spareField3: null,
321         spareField4: null,
322         createUser: null,
323         updateUser: null,
324         remarks: null
325       },
326       // 表单参数
327       form: {},
328       // 表单校验
329       rules: {
330         id: [
331           { required: true, message: "ID不能为空", trigger: "blur" }
332         ],
333       }
334     };
335   },
336   created() {
337     this.getList();
338   },
339   methods: {
340     /** 查询机型序号列表 */
341     getList() {
342       this.loading = true;
343       listModelNumber(this.queryParams).then(response => {
344         this.modelNumberList = response.rows;
345         this.total = response.total;
346         this.loading = false;
347       });
348     },
349     // 取消按钮
350     cancel() {
351       this.open = false;
352       this.reset();
353     },
354     // 表单重置
355     reset() {
356       this.form = {
357         id: null,
358         model: null,
359         modelDate: null,
360         maxnumValue: null,
361         saveTime: null,
362         lastNumber: null,
363         status: null,
364         spareField1: null,
365         spareField2: null,
366         spareField3: null,
367         spareField4: null,
368         createUser: null,
369         createTime: null,
370         updateUser: null,
371         updateTime: null,
372         remarks: null
373       };
374       this.resetForm("form");
375     },
376     /** 搜索按钮操作 */
377     handleQuery() {
378       this.queryParams.pageNum = 1;
379       this.getList();
380     },
381     /** 重置按钮操作 */
382     resetQuery() {
383       this.resetForm("queryForm");
384       this.handleQuery();
385     },
386     // 多选框选中数据
387     handleSelectionChange(selection) {
388       this.ids = selection.map(item => item.id)
389       this.single = selection.length!==1
390       this.multiple = !selection.length
391     },
392     /** 新增按钮操作 */
393     handleAdd() {
394       this.reset();
395       this.open = true;
396       this.titleName = "添加机型序号";
397     },
398     /** 修改按钮操作 */
399     handleUpdate(row) {
400       this.reset();
401       const id = row.id || this.ids
402       getModelNumber(id).then(response => {
403         this.form = response.data;
404         this.open = true;
405         this.titleName = "修改机型序号";
406       });
407     },
408     /** 提交按钮 */
409     submitForm() {
410       this.$refs["form"].validate(valid => {
411         if (valid) {
412           if (this.form.id != null) {
413             updateModelNumber(this.form).then(response => {
414               this.$modal.msgSuccess("修改成功");
415               this.open = false;
416               this.getList();
417             });
418           } else {
419             addModelNumber(this.form).then(response => {
420               this.$modal.msgSuccess("新增成功");
421               this.open = false;
422               this.getList();
423             });
424           }
425         }
426       });
427     },
428     /** 删除按钮操作 */
429     handleDelete(row) {
430       const ids = row.id || this.ids;
431       this.$modal.confirm('是否确认删除机型序号编号为"' + ids + '"的数据项?').then(function() {
432         return delModelNumber(ids);
433       }).then(() => {
434         this.getList();
435         this.$modal.msgSuccess("删除成功");
436       }).catch(() => {});
437     },
438     /** 导出按钮操作 */
439     handleExport() {
440       this.download('bs/modelNumber/export', {
441         ...this.queryParams
442       }, `modelNumber_${new Date().getTime()}.xlsx`)
443     }
444   }
445 };
446 </script>