春风项目四线(合箱线、总装线)
wujian
5 天以前 ea3c33c8561df39d4f123d1424fda99dd0f0c51d
提交 | 用户 | 时间
fd2207 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="productCode">
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>
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
28     <el-card style="margin-top: 10px" class="box-card">
29         <el-row :gutter="10" class="mb8">
30           <el-col :span="1.5">
31             <el-button
32               type="primary"
33               plain
34               icon="el-icon-plus"
35               size="mini"
36               @click="handleAdd"
37               v-hasPermi="['bs:beatSetting:add']"
38             >新增</el-button>
39           </el-col>
40           <el-col :span="1.5">
41             <el-button
42               type="success"
43               plain
44               icon="el-icon-edit"
45               size="mini"
46               :disabled="single"
47               @click="handleUpdate"
48               v-hasPermi="['bs:beatSetting:edit']"
49             >修改</el-button>
50           </el-col>
51           <el-col :span="1.5">
52             <el-button
53               type="danger"
54               plain
55               icon="el-icon-delete"
56               size="mini"
57               :disabled="multiple"
58               @click="handleDelete"
59               v-hasPermi="['bs:beatSetting:remove']"
60             >删除</el-button>
61           </el-col>
62           <el-col :span="1.5">
63             <el-button
64               type="warning"
65               plain
66               icon="el-icon-download"
67               size="mini"
68               @click="handleExport"
69               v-hasPermi="['bs:beatSetting:export']"
70             >导出</el-button>
71           </el-col>
72           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
73         </el-row>
74
75         <el-table border v-loading="loading" :data="beatSettingList" @selection-change="handleSelectionChange">
76           <el-table-column type="selection" width="55" align="center" />
77           <el-table-column label="产品编码" align="center" prop="productCode">
78           </el-table-column>
79           <el-table-column label="产品名称" align="center" prop="productName">
80           </el-table-column>
250f67 81           <el-table-column label="节拍(S)" align="center" prop="beat">
fd2207 82           </el-table-column>
83           <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width">
84             <template slot-scope="scope">
85               <el-button
86                 size="mini"
87                 type="success"
88                 plain
89                 style="width: 72px"
90                 icon="el-icon-edit"
91                 @click="handleUpdate(scope.row)"
92                 v-hasPermi="['bs:beatSetting:edit']"
93               >修改</el-button>
94               <el-button
95                 size="mini"
96                 type="danger"
97                 plain
98                 style="width: 72px"
99                 icon="el-icon-delete"
100                 @click="handleDelete(scope.row)"
101                 v-hasPermi="['bs:beatSetting:remove']"
102               >删除</el-button>
103             </template>
104           </el-table-column>
105         </el-table>
106     </el-card>
107
108     <pagination
109       v-show="total>0"
110       :total="total"
111       :page.sync="queryParams.pageNum"
112       :limit.sync="queryParams.pageSize"
113       @pagination="getList"
114     />
115
116     <!-- 添加或修改节拍设置对话框 -->
117     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
118       <span slot="title">
119         <i class="el-icon-s-order"></i>
120         {{titleName}}
121       </span>
122       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
123         <el-form-item label="产品编码" prop="productCode">
ea3c33 124           <el-input v-model="form.productCode" placeholder="请输入产品编码" />
fd2207 125         </el-form-item>
126         <el-form-item  label="产品名称" prop="productName">
ea3c33 127           <el-input v-model="form.productName" placeholder="请输入产品名称" />
fd2207 128         </el-form-item>
129         <el-form-item label="节拍" prop="beat">
130           <el-input v-model="form.beat" placeholder="请输入节拍" />
131         </el-form-item>
ea3c33 132
fd2207 133       </el-form>
134       <div slot="footer" class="dialog-footer">
135         <el-button type="primary" @click="submitForm">确 定</el-button>
136         <el-button @click="cancel">取 消</el-button>
137       </div>
138     </el-dialog>
139   </div>
140 </template>
141
142 <script>
143 import { listBeatSetting, getBeatSetting, delBeatSetting, addBeatSetting, updateBeatSetting } from "@/api/main/bs/beatSetting/beatSetting";
144 import {listProductBom} from "@/api/main/bs/ProductBom/ProductBom";
145
146 export default {
147   name: "BeatSetting",
148   data() {
149     return {
150       // 遮罩层
151       loading: true,
152       titleName: "",
153       options: [],
154       // 选中数组
155       ids: [],
156       // 非单个禁用
157       single: true,
158       // 非多个禁用
159       multiple: true,
160       // 显示搜索条件
161       showSearch: true,
162       // 总条数
163       total: 0,
164       // 节拍设置表格数据
165       beatSettingList: [],
166       // 弹出层标题
167       title: "",
168       // 是否显示弹出层
169       open: false,
170       // 查询参数
171       queryParams: {
172         pageNum: 1,
173         pageSize: 10,
174         productCode: null,
175         productName: null,
176         beat: null,
177         spareField1: null,
178         spareField2: null,
179         createUser: null,
180         updateUser: null,
181         dataSource: null
182       },
183       productCodeQueryParams: {
184         pageNum: 1,
185         pageSize: 10,
186         productCode: null,
187         productName: null,
188         beat: null,
189         spareField1: null,
190         spareField2: null,
191         createUser: null,
192         updateUser: null,
193         dataSource: null
194       },
195       // 表单参数
196       form: {},
197       // 表单校验
198       rules: {
199         id: [
200           { required: true, message: "主键id不能为空", trigger: "blur" }
201         ],
202         beat: [
203           { required: true, message: "节拍不能为空", trigger: "blur" }
204         ],
ea3c33 205         productCode: [
W 206           { required: true, message: "产品编码不能为空", trigger: "blur" }
207         ],
fd2207 208       }
209     };
210   },
211   created() {
212     this.getList();
213     this.initProductBom();
214   },
215   methods: {
216     /** 查询节拍设置列表 */
217     handleSelectChange(selectedOption) {
218       this.productCodeQueryParams.productCode = selectedOption;
219       listProductBom(this.productCodeQueryParams).then(response => {
220         this.form.productName = response.rows[0].productName;
221       });
222     },
223     initProductBom(){
224       listProductBom(this.queryParams).then(response => {
225         this.options = response.rows;
226       });
227     },
228
229     getList() {
230       this.loading = true;
231       listBeatSetting(this.queryParams).then(response => {
232         this.beatSettingList = response.rows;
233         this.total = response.total;
234         this.loading = false;
235       });
236     },
237     // 取消按钮
238     cancel() {
239       this.open = false;
240       this.reset();
241     },
242     // 表单重置
243     reset() {
244       this.form = {
245         id: null,
246         productCode: null,
247         productName: null,
248         beat: null,
249         spareField1: null,
250         spareField2: null,
251         remark: null,
252         createUser: null,
253         createTime: null,
254         updateUser: null,
255         updateTime: null,
256         dataSource: null
257       };
258       this.resetForm("form");
259     },
260     /** 搜索按钮操作 */
261     handleQuery() {
262       this.queryParams.pageNum = 1;
263       this.getList();
264     },
265     /** 重置按钮操作 */
266     resetQuery() {
267       this.resetForm("queryForm");
268       this.handleQuery();
269     },
270     // 多选框选中数据
271     handleSelectionChange(selection) {
272       this.ids = selection.map(item => item.id)
273       this.single = selection.length!==1
274       this.multiple = !selection.length
275     },
276     /** 新增按钮操作 */
277     handleAdd() {
278       this.reset();
279       this.open = true;
280       this.titleName = "添加节拍设置";
281     },
282     /** 修改按钮操作 */
283     handleUpdate(row) {
284       this.reset();
285       const id = row.id || this.ids
286       getBeatSetting(id).then(response => {
287         this.form = response.data;
288         this.open = true;
289         this.titleName = "修改节拍设置";
290       });
291     },
292     /** 提交按钮 */
293     submitForm() {
294       this.$refs["form"].validate(valid => {
295         if (valid) {
296           if (this.form.id != null) {
297             updateBeatSetting(this.form).then(response => {
298               this.$modal.msgSuccess("修改成功");
299               this.open = false;
300               this.getList();
301             });
302           } else {
303             addBeatSetting(this.form).then(response => {
304               this.$modal.msgSuccess("新增成功");
305               this.open = false;
306               this.getList();
307             });
308           }
309         }
310       });
311     },
312     /** 删除按钮操作 */
313     handleDelete(row) {
314       const ids = row.id || this.ids;
315       this.$modal.confirm('是否确认删除节拍设置编号为"' + ids + '"的数据项?').then(function() {
316         return delBeatSetting(ids);
317       }).then(() => {
318         this.getList();
319         this.$modal.msgSuccess("删除成功");
320       }).catch(() => {});
321     },
322     /** 导出按钮操作 */
323     handleExport() {
324       this.download('bs/beatSetting/export', {
325         ...this.queryParams
326       }, `beatSetting_${new Date().getTime()}.xlsx`)
327     }
328   }
329 };
330 </script>